/* Pix workshop: dark graphite room, glass and metal details, violet light.
   Visual layer only — markup and behaviour come from js/pix-widget.js. */
.pix-lab, .pix-lab *, .pix-lab *::before, .pix-lab *::after { box-sizing: border-box; }

.pix-lab {
  --w-ink: #f3eef7;
  --w-soft: #b9b1c2;
  --w-dim: #8a8294;
  --w-line: rgba(255, 255, 255, 0.12);
  --w-glass: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
  --w-violet: #8e5cf0;
  --w-glow: #c9b2ff;
  --w-teal: #3fc8b8;
  --w-sun: #e3b25a;
  --w-red: #e0705e;
  /* names used by the game script for the coloured digits */
  --lab-purple: #9a6cff;
  --lab-teal: #3fc8b8;
  --lab-sun: #e3b25a;
  width: min(980px, 100%);
  margin: 0 auto;
  color: var(--w-ink);
  font-family: var(--sans, "Manrope", "Noto Sans Hebrew", sans-serif);
}

/* ---------- Scene ---------- */
.pix-scene {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--w-line);
  border-radius: 20px;
  background:
    radial-gradient(34% 56% at 50% 60%, rgba(142, 92, 240, 0.42), transparent 70%),
    radial-gradient(26% 30% at 12% 18%, rgba(227, 178, 90, 0.10), transparent 70%),
    linear-gradient(180deg, #1e1b25 0%, #15131a 66%, #1c1724 66.2%, #100e13 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 30px 60px rgba(0, 0, 0, 0.35);
}

/* Workshop silhouettes: shelves, a glass cabinet, the bench edge and faint scanlines */
.pix-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, transparent 3%, rgba(201, 178, 255, 0.18) 3% 24%, transparent 24%) 0 30% / 100% 1px no-repeat,
    linear-gradient(90deg, transparent 76%, rgba(201, 178, 255, 0.18) 76% 97%, transparent 97%) 0 28% / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)) 3% 34% / 18% 26% no-repeat,
    linear-gradient(90deg, transparent, rgba(201, 178, 255, 0.3), transparent) 0 66% / 100% 1px no-repeat,
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 4px);
  pointer-events: none;
}

.pix-platform {
  position: absolute;
  left: 50%;
  bottom: 8%;
  z-index: 1;
  width: 34%;
  height: 10%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 45%, rgba(201, 178, 255, 0.5), rgba(142, 92, 240, 0.18) 45%, transparent 70%);
  box-shadow: 0 0 40px rgba(142, 92, 240, 0.35);
  transition: box-shadow 0.4s ease, background 0.4s ease;
}
.pix-lab.is-thinking .pix-platform { animation: pix-pulse 1.4s ease-in-out infinite; }
.pix-lab.is-happy .pix-platform { background: radial-gradient(ellipse at 50% 45%, rgba(227, 178, 90, 0.6), rgba(227, 178, 90, 0.18) 45%, transparent 70%); box-shadow: 0 0 50px rgba(227, 178, 90, 0.45); }
.pix-lab.is-oops .pix-platform { background: radial-gradient(ellipse at 50% 45%, rgba(224, 112, 94, 0.55), rgba(224, 112, 94, 0.15) 45%, transparent 70%); box-shadow: 0 0 40px rgba(224, 112, 94, 0.4); }
@keyframes pix-pulse { 50% { box-shadow: 0 0 70px rgba(142, 92, 240, 0.65); } }

/* Pix: a square box so the poster and the 3D model line up */
.pix-figure {
  position: absolute;
  left: 50%;
  bottom: 9%;
  z-index: 2;
  width: 44%;
  aspect-ratio: 1;
  margin-left: -22%;
  cursor: pointer;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 0 30px rgba(142, 92, 240, 0.35));
  will-change: transform;
}
.pix-figure:focus-visible { outline: 2px solid var(--w-glow); outline-offset: -6px; border-radius: 24px; }
.pix-poster, .pix-figure model-viewer { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.pix-poster { object-fit: contain; pointer-events: none; user-select: none; transition: opacity 0.45s ease; }
.pix-figure model-viewer { --poster-color: transparent; background: transparent; opacity: 0; pointer-events: none; transition: opacity 0.45s ease; }
.pix-figure.is-3d model-viewer { opacity: 1; }
.pix-figure.is-3d .pix-poster { opacity: 0; }
.pix-loading {
  position: absolute;
  left: 50%;
  bottom: -4px;
  margin: 0;
  padding: 4px 11px;
  transform: translateX(-50%);
  border: 1px solid var(--w-line);
  border-radius: 999px;
  background: rgba(20, 18, 24, 0.75);
  color: var(--w-soft);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.pix-figure.is-3d .pix-loading { opacity: 0; }

/* Pix speaks: a glass caption above the head */
.pix-say {
  position: absolute;
  top: 5%;
  left: 50%;
  z-index: 4;
  width: max-content;
  max-width: min(70%, 420px);
  margin: 0;
  padding: 10px 16px;
  border: 1px solid rgba(201, 178, 255, 0.3);
  border-radius: 14px;
  background: rgba(30, 26, 38, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.2);
  color: var(--w-ink);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.pix-say.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Workshop objects: glass plates with glowing line drawings */
.pix-obj {
  position: absolute;
  z-index: 3;
  width: 12%;
  aspect-ratio: 1;
  padding: 12px;
  border: 1px solid var(--w-line);
  border-radius: 16px;
  background: var(--w-glass);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--w-glow);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease, transform 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.pix-obj svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pix-obj .pix-glow { filter: drop-shadow(0 0 4px rgba(201, 178, 255, 0.9)); }
.pix-obj:hover,
.pix-obj:focus-visible {
  color: #fff;
  border-color: rgba(201, 178, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 28px rgba(142, 92, 240, 0.45);
  transform: translateY(-2px);
}
.pix-obj:focus-visible { outline: 2px solid var(--w-glow); outline-offset: 3px; }
.pix-obj[data-obj="lamp"] { left: 5%; top: 12%; }
.pix-obj[data-obj="screen"] { right: 5%; top: 10%; width: 13%; }
.pix-obj[data-obj="book"] { left: 6%; bottom: 10%; }
.pix-obj[data-obj="chest"] { right: 6%; bottom: 9%; width: 13%; }
.pix-badge {
  position: absolute;
  top: -10px;
  inset-inline-end: -10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #120f16;
  font: 800 14px/1 var(--sans, "Manrope", sans-serif);
  box-shadow: 0 0 0 2px #15131a, 0 0 16px currentColor;
}
.pix-badge[hidden] { display: none; }
.pix-badge.c-purple { background: var(--lab-purple); color: #120f16; box-shadow: 0 0 0 2px #15131a, 0 0 16px rgba(154, 108, 255, 0.8); }
.pix-badge.c-teal { background: var(--lab-teal); box-shadow: 0 0 0 2px #15131a, 0 0 16px rgba(63, 200, 184, 0.7); }
.pix-badge.c-gold { background: var(--lab-sun); box-shadow: 0 0 0 2px #15131a, 0 0 16px rgba(227, 178, 90, 0.7); }
.pix-obj[data-obj="chest"]:not(.is-open) .pix-chest-open { display: none; }
.pix-obj[data-obj="chest"].is-open .pix-chest-closed { display: none; }
.pix-obj[data-obj="chest"].is-open { color: var(--w-sun); border-color: rgba(227, 178, 90, 0.5); box-shadow: 0 0 30px rgba(227, 178, 90, 0.35); }

/* ---------- Control bar ---------- */
.pix-actions {
  display: flex;
  gap: 4px;
  width: min(520px, 100%);
  margin: 18px auto 0;
  padding: 4px;
  border: 1px solid var(--w-line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
}
.pix-act {
  flex: 1 1 0;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--w-soft);
  font: 700 0.92rem/1.1 var(--sans, "Manrope", "Noto Sans Hebrew", sans-serif);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.pix-act:hover { color: #fff; }
.pix-act[aria-pressed="true"] { background: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: inset 0 0 0 1px rgba(201, 178, 255, 0.35); }

/* ---------- Panel ---------- */
.pix-panel {
  width: min(720px, 100%);
  margin: 14px auto 0;
  padding: 16px;
  border: 1px solid var(--w-line);
  border-radius: 18px;
  background: var(--w-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.pix-view[hidden] { display: none; }

.pix-log { display: flex; flex-direction: column; gap: 8px; max-height: 300px; min-height: 52px; margin: 0 0 12px; padding: 2px; overflow-y: auto; scroll-behavior: smooth; }
.pix-msg { max-width: 86%; margin: 0; padding: 10px 14px; border-radius: 14px; font-size: 0.96rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; animation: pix-in 0.25s ease both; }
.pix-msg.from-pix { align-self: flex-start; border: 1px solid rgba(201, 178, 255, 0.2); border-start-start-radius: 4px; background: rgba(142, 92, 240, 0.14); color: var(--w-ink); }
.pix-msg.from-you { align-self: flex-end; border-start-end-radius: 4px; background: #f3eef7; color: #17151a; }
.pix-msg.is-error { border-color: rgba(224, 112, 94, 0.45); background: rgba(224, 112, 94, 0.14); }
.pix-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.pix-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--w-glow); opacity: 0.35; animation: pix-dot 1.1s ease-in-out infinite; }
.pix-dots i:nth-child(2) { animation-delay: 0.15s; }
.pix-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pix-dot { 40% { opacity: 1; transform: translateY(-2px); } }
@keyframes pix-in { from { opacity: 0; transform: translateY(6px); } }

.pix-form { display: flex; align-items: center; gap: 8px; }
.pix-field { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; border: 1px solid var(--w-line); border-radius: 12px; background: rgba(0, 0, 0, 0.28); transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.pix-field:focus-within { border-color: rgba(201, 178, 255, 0.6); box-shadow: 0 0 0 3px rgba(142, 92, 240, 0.2); }
.pix-field input { flex: 1 1 auto; min-width: 0; height: 46px; padding: 0 16px; border: 0; background: transparent; color: #fff; font: 500 16px/1.2 var(--sans, "Manrope", "Noto Sans Hebrew", sans-serif); outline: none; }
.pix-field input::placeholder { color: var(--w-dim); }
.pix-icon-btn { flex: 0 0 auto; width: 46px; height: 46px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; cursor: pointer; transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease; }
.pix-icon-btn svg { width: 20px; height: 20px; }
.pix-icon-btn:active { transform: scale(0.95); }
.pix-icon-btn:disabled { opacity: 0.45; cursor: default; }
.pix-send { background: var(--w-violet); color: #fff; }
.pix-send:hover { background: #9d72f3; }
html[dir="rtl"] .pix-send svg { transform: scaleX(-1); }
.pix-mic { border: 1px solid var(--w-line); background: rgba(255, 255, 255, 0.06); color: var(--w-ink); }
.pix-mic.is-off { opacity: 0.5; }
.pix-mic.is-listening { border-color: transparent; background: var(--w-red); color: #fff; animation: pix-listen 1.2s ease-in-out infinite; }
@keyframes pix-listen { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 112, 94, 0.5); } 50% { box-shadow: 0 0 0 8px rgba(224, 112, 94, 0); } }

.pix-voice-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--w-dim); font-size: 0.82rem; }
.pix-voice { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--w-line); border-radius: 999px; background: rgba(0, 0, 0, 0.25); }
.pix-voice-opt { min-width: 34px; height: 26px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--w-soft); font: 700 0.75rem/1 var(--sans, "Manrope", "Noto Sans Hebrew", sans-serif); cursor: pointer; }
.pix-voice-opt.is-on { background: rgba(201, 178, 255, 0.22); color: #fff; }

/* Explore and mystery views */
.pix-view h2 { margin: 0 0 6px; color: #fff; font: 600 1.3rem/1.2 var(--serif, "Lora", "Noto Serif Hebrew", Georgia, serif); }
.pix-view p { margin: 0 0 12px; color: var(--w-soft); font-size: 0.96rem; line-height: 1.6; }
.pix-clues { display: flex; gap: 8px; margin: 4px 0 14px; padding: 0; list-style: none; }
.pix-clues li { flex: 1 1 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--w-line); border-radius: 12px; background: rgba(0, 0, 0, 0.22); color: var(--w-ink); font-size: 0.86rem; font-weight: 600; }
.pix-dot { flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: #120f16; font-weight: 800; }
.pix-dot.c-purple { background: var(--lab-purple); }
.pix-dot.c-teal { background: var(--lab-teal); }
.pix-dot.c-gold { background: var(--lab-sun); }

/* The lock reads as three glowing rings */
.pix-lock { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; padding: 16px; border: 1px solid var(--w-line); border-radius: 16px; background: rgba(0, 0, 0, 0.25); }
.pix-wheel { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pix-wheel button { width: 40px; height: 26px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.07); color: var(--w-soft); font-size: 0.8rem; cursor: pointer; }
.pix-wheel button:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
.pix-wheel output {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent !important;
  color: #fff;
  font: 700 1.4rem/1 var(--sans, "Manrope", sans-serif);
  box-shadow: inset 0 0 0 2px currentColor, 0 0 18px currentColor;
}
.pix-wheel output.c-purple { color: var(--lab-purple); }
.pix-wheel output.c-teal { color: var(--lab-teal); }
.pix-wheel output.c-gold { color: var(--lab-sun); }
.pix-open { min-height: 46px; padding: 0 20px; border: 0; border-radius: 10px; background: #f3eef7; color: #17151a; font: 700 0.95rem/1 var(--sans, "Manrope", "Noto Sans Hebrew", sans-serif); cursor: pointer; }
.pix-open:hover { background: var(--w-glow); }
.pix-link { margin-top: 12px; padding: 6px 2px; border: 0; background: transparent; color: var(--w-soft); font: 600 0.86rem/1.2 var(--sans, "Manrope", "Noto Sans Hebrew", sans-serif); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pix-link:hover { color: #fff; }
.pix-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  .pix-scene { aspect-ratio: 1 / 1.05; border-radius: 16px; }
  .pix-figure { width: 66%; margin-left: -33%; bottom: 10%; }
  .pix-platform { width: 56%; }
  .pix-obj { width: 18%; padding: 9px; border-radius: 12px; }
  .pix-obj[data-obj="screen"], .pix-obj[data-obj="chest"] { width: 19%; }
  .pix-obj[data-obj="lamp"] { left: 3%; top: 16%; }
  .pix-obj[data-obj="screen"] { right: 3%; top: 15%; }
  .pix-obj[data-obj="book"] { left: 3%; bottom: 5%; }
  .pix-obj[data-obj="chest"] { right: 3%; bottom: 4%; }
  .pix-say { max-width: 86%; font-size: 0.86rem; }
  .pix-act { font-size: 0.84rem; padding: 0 6px; }
  .pix-panel { padding: 12px; }
  .pix-clues { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .pix-lab *, .pix-lab *::before, .pix-lab *::after { animation: none !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
