:root {
  --ink: #14212b;
  --ink-soft: #3a4a56;
  --paper: #eef3f5;
  --floor: #d9e4ea;
  --wood: #8b5a2b;
  --wood-light: #c4a07a;
  --chalk: #2f4a3a;
  --accent: #0c6b78;
  --accent-deep: #084e58;
  --gold: #b8891d;
  --stripe-1: #662d91;
  --stripe-2: #00aeef;
  --stripe-3: #39b54a;
  --stripe-4: #fdb913;
  --stripe-5: #f7941d;
  --stripe-6: #e31e24;
  --panel: rgba(255, 255, 255, 0.82);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Syne", sans-serif;
  --font-body: "Literata", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  height: 100svh;
  max-height: 100svh;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overscroll-behavior: none;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  background:
    radial-gradient(1000px 600px at 20% 0%, rgba(12, 107, 120, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 20%, rgba(184, 137, 29, 0.1), transparent 50%),
    linear-gradient(160deg, #f5f8fa, #e5eef2 55%, #dce7ed);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: #fff;
}
.skip-link:focus { top: 1rem; }

/* HUD */
.hud {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem 1rem;
  min-height: 4.25rem;
  padding: 0.55rem max(clamp(0.75rem, 3vw, 2rem), env(safe-area-inset-right))
    0.55rem max(clamp(0.75rem, 3vw, 2rem), env(safe-area-inset-left));
  padding-top: max(0.55rem, env(safe-area-inset-top));
  background: rgba(245, 248, 250, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(20, 33, 43, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}
.brand-text em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-weight: 650;
}

.hud-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hud-link, .hud-cta, .btn {
  font-family: var(--font-display);
  font-weight: 650;
  text-decoration: none;
  border-radius: 2px;
}

.hud-link {
  color: var(--ink-soft);
  font-size: 0.84rem;
  padding: 0.4rem 0.65rem;
}
.hud-link:hover { color: var(--ink); }

.hud-cta, .btn-primary {
  background: var(--ink);
  color: #f4f7f8;
  padding: 0.55rem 0.95rem;
  font-size: 0.84rem;
  border: 0;
  cursor: pointer;
}
.hud-cta:hover, .btn-primary:hover { background: var(--accent-deep); }
.hud-cta,
.station-btn,
.btn {
  -webkit-tap-highlight-color: transparent;
}

.hud-stations {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.hud-stations::-webkit-scrollbar { display: none; }

.station-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 2.35rem;
  padding: 0 0.9rem;
  border: 1px solid rgba(20, 33, 43, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.78rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.station-btn:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}
.station-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.station-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #f4f7f8;
}
.station-btn.is-active:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #f4f7f8;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.65rem 1.1rem;
  border: 0;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(20, 33, 43, 0.14);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

/* Logo (from v1 / app) */
.igeo-logo { position: relative; display: block; flex-shrink: 0; }
.igeo-logo--header { width: 2.1rem; height: 2.1rem; }
.igeo-logo__inner { position: relative; width: 100%; height: 100%; }
.igeo-logo__svg { width: 100%; height: 100%; }
.igeo-logo.is-loading .igeo-logo__svg { animation: igeoLogoRotate 14s linear infinite; }
@keyframes igeoLogoRotate { to { transform: rotate(360deg); } }
.igeo-logo__stripe { stroke-width: 0; transition: all 1.8s cubic-bezier(0.77, 0, 0.175, 1); }
.igeo-logo__stripe-1 { fill: #662d91; }
.igeo-logo__stripe-2 { fill: #00aeef; }
.igeo-logo__stripe-3 { fill: #39b54a; }
.igeo-logo__stripe-4 { fill: #fdb913; }
.igeo-logo__stripe-5 { fill: #f7941d; }
.igeo-logo__stripe-6 { fill: #e31e24; }
.igeo-logo__extra {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  transition: opacity 1.2s ease-out;
}
.igeo-logo.is-done .igeo-logo__extra { opacity: 1; transition-delay: 0.45s; }
.igeo-logo__spine {
  position: absolute; left: 22%; top: 50%; width: 16%; height: 60%;
  background: #111; border-radius: 3px 1px 1px 3px;
  display: flex; align-items: center; justify-content: center;
  transform: translateY(-50%) skewY(-15deg); z-index: 2;
}
.igeo-logo__spine-text {
  color: #fff; font-family: system-ui, sans-serif; font-weight: 900;
  font-size: 5px; transform: rotate(-90deg); letter-spacing: 0.4px;
  text-transform: lowercase; white-space: nowrap;
}

/* Workspace */
.workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(min(100%, 300px), 0.9fr);
  position: relative;
}

/* Stage */
.stage {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.stage-glow {
  position: absolute;
  inset: 10% 15%;
  background: radial-gradient(circle, rgba(255,255,255,0.55), transparent 70%);
  pointer-events: none;
}

.viewport {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  perspective: 1400px;
  touch-action: none;
}

.camera {
  position: relative;
  width: 920px;
  height: 640px;
  flex-shrink: 0;
  transform-origin: center center;
  transform-style: preserve-3d;
  transition: transform 0.9s var(--ease);
  will-change: transform;
}
.camera.is-fitting {
  transition: none;
}

.iso-world {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform:
    rotateX(52deg)
    rotateZ(-42deg)
    scale(0.9);
  transform-style: preserve-3d;
  transition: transform 0.35s var(--ease);
}

/* Floor */
.floor {
  position: absolute;
  inset: 12% 8% 8% 10%;
  transform: translateZ(0);
  background: linear-gradient(135deg, #e7eef2, #d2dde4);
  box-shadow:
    0 30px 60px rgba(20, 33, 43, 0.18),
    12px 12px 0 rgba(20, 33, 43, 0.06);
  pointer-events: none;
}
.floor-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(12, 107, 120, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(12, 107, 120, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.85;
}
.floor-shadow {
  position: absolute;
  inset: 8% 12%;
  background: radial-gradient(ellipse at center, rgba(20,33,43,0.08), transparent 70%);
}


/* Walls — upright from floor edges */
.wall {
  position: absolute;
  transform-style: preserve-3d;
  z-index: 2;
  pointer-events: none;
}
.wall-back {
  left: 10%;
  width: 82%;
  height: 42%;
  top: calc(12% - 42%);
  transform-origin: center bottom;
  transform: rotateX(-90deg);
}
/* Right side wall — hinge on floor's right edge (was bookcase side) */
.wall-side {
  left: 92%;
  top: 12%;
  width: 42%;
  height: 80%;
  transform-origin: left top;
  transform: rotateY(-90deg);
  z-index: 1;
}
.wall-face {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #fbfcfd, #e8eef2);
  border: 1px solid rgba(20, 33, 43, 0.1);
  box-shadow:
    0 -18px 28px rgba(20, 33, 43, 0.08),
    inset 0 0 0 1px rgba(255,255,255,0.4);
  pointer-events: none;
}
.wall-side .wall-face {
  background: linear-gradient(90deg, #f7fafc, #e4ebf0 55%, #d7e0e6);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.35),
    inset -18px 0 28px rgba(20, 33, 43, 0.06);
}
.board {
  position: absolute;
  left: 50%;
  top: 9%;
  width: 52%;
  height: 80%;
  transform: translateX(-50%);
  padding: 0.28rem;
  background: linear-gradient(165deg, #6a737c, #3e464e 55%, #2c333a);
  border: 3px solid #1c2228;
  border-radius: 0.28rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.25),
    0 8px 18px rgba(20, 33, 43, 0.18);
  pointer-events: none;
}
.board-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 0.16rem;
  overflow: hidden;
  background: #eceff3;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Mini Interaktivní Geometrie UI on the board */
.igeo-app {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  font-family: var(--font-display);
  color: #1d2430;
  background: #e8ebf0;
}
.igeo-app__top {
  display: grid;
  grid-template-columns: 1.1fr auto 0.9fr;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem 0.28rem;
  background: #f7f8fb;
  border-bottom: 1px solid rgba(20, 33, 43, 0.08);
}
.igeo-app__brand {
  display: flex;
  align-items: center;
  gap: 0.22rem;
  min-width: 0;
}
.igeo-app__logo {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 0.12rem;
  background: conic-gradient(from 210deg, #5b6cff, #2ec4b6, #f0c75e, #5b6cff);
  flex-shrink: 0;
}
.igeo-app__brand strong {
  display: block;
  font-size: 0.34rem;
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.igeo-app__brand small {
  display: block;
  font-size: 0.22rem;
  opacity: 0.55;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 4.2rem;
}
.igeo-app__brand small a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 1px;
}
.igeo-app__tools {
  display: flex;
  gap: 0.12rem;
  padding: 0.1rem 0.16rem;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(20, 33, 43, 0.08);
}
.igeo-app__tools i {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 0.08rem;
  background: #d7dde6;
}
.igeo-app__tools i:nth-child(2) { background: #b8c0cc; }
.igeo-app__user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.16rem;
}
.igeo-app__avatar {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #6b5cff;
  color: #fff;
  font-size: 0.26rem;
  font-weight: 700;
}
.igeo-app__name {
  font-size: 0.26rem;
  font-weight: 650;
  opacity: 0.75;
}
.igeo-app__body {
  display: grid;
  grid-template-columns: 28% 1fr;
  gap: 0.22rem;
  min-height: 0;
  padding: 0.22rem;
}
.igeo-app__side {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 0.18rem;
  min-height: 0;
}
.igeo-app__card {
  background: #fff;
  border-radius: 0.2rem;
  box-shadow: 0 1px 3px rgba(20, 33, 43, 0.06);
  padding: 0.18rem;
}
.igeo-app__card em {
  font-style: normal;
  font-size: 0.28rem;
  font-weight: 700;
  opacity: 0.55;
}
.igeo-app__bgs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.12rem;
}
.igeo-app__bgs span,
.igeo-app__actions span,
.igeo-app__footer span {
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 0.22rem;
  font-weight: 650;
  line-height: 1.1;
  padding: 0.18rem 0.1rem;
  border-radius: 0.16rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 33, 43, 0.06);
}
.igeo-app__bgs .is-on {
  background: #e8e7ff;
  box-shadow: inset 0 0 0 1px #6b5cff;
  color: #3d36a8;
}
.igeo-app__actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.1rem;
}
.igeo-app__actions .is-warn {
  background: #ffe4e4;
  color: #a33b3b;
}
.igeo-app__canvas {
  position: relative;
  min-height: 0;
  background:
    linear-gradient(rgba(120, 150, 190, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 150, 190, 0.18) 1px, transparent 1px),
    #fbfcfe;
  background-size: 8px 8px, 8px 8px, auto;
  border-radius: 0.2rem;
  box-shadow: inset 0 0 0 1px rgba(20, 33, 43, 0.06);
  overflow: hidden;
}
.igeo-app__sketch {
  position: absolute;
  inset: 8% 6% 18% 6%;
  width: auto;
  height: auto;
}
.igeo-app__sketch [data-board-draw] path,
.igeo-app__sketch [data-board-draw] circle,
.igeo-app__sketch [data-board-draw] polyline,
.igeo-app__sketch [data-board-draw] line {
  fill: none;
  stroke: #2a4d9b;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.igeo-app__sketch .is-drawing {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: boardDraw 1.2s ease forwards;
}
@keyframes boardDraw {
  to { stroke-dashoffset: 0; }
}
.igeo-app__fab {
  position: absolute;
  left: 0.28rem;
  bottom: 0.28rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #6b5cff;
  box-shadow: 0 2px 6px rgba(80, 70, 200, 0.35);
}
.igeo-app__footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.18rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.28rem;
}
.igeo-app__footer .is-primary {
  margin-left: auto;
  background: #3d6df2;
  color: #fff;
  padding: 0.16rem 0.35rem;
}
.window {
  position: absolute;
  left: 50%;
  top: 14%;
  width: 58%;
  height: 62%;
  transform: translateX(-50%);
  background: linear-gradient(160deg, #cfe8f5, #9ec9e0);
  border: 4px solid #c9b08a;
  box-shadow: inset 0 0 0 2px #e8d7bc;
  overflow: hidden;
  pointer-events: none;
}
.wall-side .window {
  /* Na rotateY stěně samotné top jede po úhlopříčce (vypadá jako doprava).
     left + top dohromady = vizuálně dolů ke podlaze. */
  top: 18%;
  left: 29%;
  width: 36.8%;
  height: 41.6%;
}
.window-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0;
}
.window-pane {
  background: linear-gradient(155deg, rgba(210, 232, 245, 0.55), rgba(140, 190, 220, 0.25));
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.25);
}
.window-muntins {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.window-bar {
  position: absolute;
  background: linear-gradient(90deg, #b89a72, #d8c4a4 45%, #b89a72);
  box-shadow: 0 0 0 1px rgba(90, 70, 45, 0.25);
}
.window-bar--v {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 5px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #b89a72, #d8c4a4 45%, #b89a72);
}
.window-bar--h {
  top: 50%;
  left: 0;
  right: 0;
  height: 5px;
  transform: translateY(-50%);
}
.window-light {
  position: absolute;
  inset: -20%;
  z-index: 2;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.55), transparent 70%);
  animation: windowShine 6s ease-in-out infinite;
}
@keyframes windowShine {
  0%, 100% { transform: translateX(-20%); }
  50% { transform: translateX(30%); }
}

/* Bulletin board next to side window */
.notice-board {
  position: absolute;
  left: 19%;
  top: 62%;
  width: 16.8%;
  height: 18%;
  transform: translateX(-50%) rotate(90deg);
  transform-origin: center center;
  background: linear-gradient(145deg, #c4a574, #a88455 55%, #8f6d42);
  border: 3px solid #6e5234;
  box-shadow:
    inset 0 0 0 2px #d4b896,
    2px 3px 8px rgba(20, 33, 43, 0.18);
  pointer-events: none;
}
.notice-board__cork {
  position: absolute;
  inset: 5%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.12) 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 55%, rgba(80, 50, 20, 0.12) 0 1px, transparent 1.5px),
    radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.08) 0 1px, transparent 1.5px),
    linear-gradient(160deg, #d2b48c, #c4a06e 50%, #b8956a);
  box-shadow: inset 0 0 12px rgba(90, 60, 30, 0.25);
  overflow: hidden;
}
.notice-paper {
  position: absolute;
  display: block;
  background: #f7f3e8;
  box-shadow: 1px 2px 4px rgba(20, 33, 43, 0.2);
}
.notice-paper--1 {
  left: 8%;
  top: 10%;
  width: 38%;
  height: 42%;
  transform: rotate(-8deg);
  background: linear-gradient(180deg, #fffef8, #f3efe2);
}
.notice-paper--2 {
  left: 48%;
  top: 8%;
  width: 40%;
  height: 36%;
  transform: rotate(6deg);
  background: #eef5fb;
}
.notice-paper--3 {
  left: 12%;
  top: 48%;
  width: 36%;
  height: 40%;
  transform: rotate(4deg);
  background: #fff8e7;
}
.notice-paper--4 {
  left: 52%;
  top: 42%;
  width: 34%;
  height: 44%;
  transform: rotate(-5deg);
  background: #f3faf3;
}
.notice-paper--5 {
  left: 36%;
  top: 28%;
  width: 30%;
  height: 32%;
  transform: rotate(10deg);
  background: #fff0f3;
  z-index: 1;
}
.notice-lines {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 28%;
  bottom: 14%;
  background: repeating-linear-gradient(
    transparent 0 18%,
    rgba(90, 120, 160, 0.28) 18% 22%
  );
  opacity: 0.85;
}
.notice-sketch {
  position: absolute;
  left: 18%;
  top: 30%;
  width: 64%;
  height: 48%;
  border: 1.5px solid rgba(60, 120, 90, 0.45);
  border-radius: 50% 50% 45% 55%;
  box-shadow: inset 0 0 0 1px rgba(60, 120, 90, 0.15);
}
.notice-sketch::before {
  content: "";
  position: absolute;
  left: 20%;
  top: 55%;
  width: 60%;
  height: 1.5px;
  background: rgba(60, 120, 90, 0.4);
  transform: rotate(-18deg);
}
.notice-pin {
  position: absolute;
  left: 50%;
  top: 6%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  z-index: 2;
}
.notice-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 55%;
  width: 2px;
  height: 4px;
  background: #9aa0a6;
  transform: translateX(-50%);
  border-radius: 0 0 1px 1px;
}
.notice-pin--red { background: radial-gradient(circle at 35% 30%, #ff8a8a, #e23b3b 55%, #a81f1f); }
.notice-pin--blue { background: radial-gradient(circle at 35% 30%, #8ec5ff, #2f7de0 55%, #1a4f9c); }
.notice-pin--yellow { background: radial-gradient(circle at 35% 30%, #ffe9a0, #f0c75e 55%, #c4921a); }
.notice-pin--green { background: radial-gradient(circle at 35% 30%, #9eecc0, #2fa86a 55%, #1a6b42); }
.notice-pin--pink { background: radial-gradient(circle at 35% 30%, #ffb3d0, #e85a9a 55%, #b03068); }

/* Props */
.prop {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) translateZ(12px);
  transform-style: preserve-3d;
  pointer-events: none;
}

.plant {
  width: 3.8rem;
  height: 3.2rem;
  transform-style: preserve-3d;
  z-index: 7;
}
.plant-stand {
  position: absolute;
  left: 50%;
  bottom: 45%;
  width: 2.6rem;
  height: 5.1rem;
  margin-left: -1.3rem;
  transform-origin: center bottom;
  transform: rotateX(-90deg);
  transform-style: preserve-3d;
}
.plant-pot {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 2.05rem;
  height: 1.55rem;
  margin-left: -1.025rem;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.12), transparent 18%, transparent 82%, rgba(0,0,0,0.1)),
    linear-gradient(180deg, #d4a078, #b8794a 45%, #8a5230);
  border: 1px solid rgba(70, 35, 15, 0.45);
  border-bottom-width: 2px;
  clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.plant-rim {
  position: absolute;
  left: 50%;
  bottom: 1.4rem;
  width: 2.2rem;
  height: 0.28rem;
  margin-left: -1.1rem;
  background: linear-gradient(180deg, #e2b48a, #b8794a);
  border: 1px solid rgba(70, 35, 15, 0.4);
  border-radius: 2px;
  z-index: 2;
}
.plant-soil {
  position: absolute;
  left: 50%;
  bottom: 1.48rem;
  width: 1.7rem;
  height: 0.42rem;
  margin-left: -0.85rem;
  background: radial-gradient(ellipse at center, #5a3d28, #2f1d12 70%);
  border-radius: 50%;
  z-index: 1;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.plant-leaf {
  position: absolute;
  left: 50%;
  bottom: 1.55rem;
  width: 1.15rem;
  height: 2.85rem;
  margin-left: -0.57rem;
  background: linear-gradient(180deg, #6fbf82, #2f8a4e 55%, #1f6a3a);
  border-radius: 60% 60% 40% 40%;
  transform-origin: center bottom;
  transform: rotateZ(-20deg);
  box-shadow: inset -2px 0 0 rgba(255, 255, 255, 0.12);
  z-index: 3;
}
.plant-leaf--2 {
  transform: rotateZ(24deg);
  height: 2.55rem;
  width: 1.05rem;
  margin-left: -0.52rem;
  background: linear-gradient(180deg, #84d094, #3a9a55 55%, #287844);
}
.plant-leaf--3 {
  transform: rotateZ(2deg) scale(0.95);
  height: 3.15rem;
  width: 0.95rem;
  margin-left: -0.47rem;
  background: linear-gradient(180deg, #57b06e, #277a42 60%, #1a5c32);
  z-index: 4;
}
.plant--tall .plant-stand {
  height: 5.8rem;
}
.plant--tall .plant-leaf--1 { height: 3.45rem; }
.plant--tall .plant-leaf--2 { height: 3.1rem; }
.plant--tall .plant-leaf--3 { height: 3.7rem; }
.plant--wide .plant-leaf--1 {
  transform: rotateZ(-32deg);
  width: 1.35rem;
  margin-left: -0.67rem;
}
.plant--wide .plant-leaf--2 {
  transform: rotateZ(34deg);
  width: 1.25rem;
  margin-left: -0.62rem;
}
.plant--wide .plant-leaf--3 {
  transform: rotateZ(0deg);
  width: 1.1rem;
}
.plant--lime .plant-leaf--1 {
  background: linear-gradient(180deg, #9ee05a, #5aad30 55%, #3f8a20);
}
.plant--lime .plant-leaf--2 {
  background: linear-gradient(180deg, #b4f070, #6ec438 55%, #4ea024);
}
.plant--lime .plant-leaf--3 {
  background: linear-gradient(180deg, #88d040, #4a9a22 60%, #367818);
}
.plant--lime .plant-pot {
  background:
    linear-gradient(90deg, rgba(0,0,0,0.1), transparent 20%, transparent 80%, rgba(0,0,0,0.08)),
    linear-gradient(180deg, #e0b090, #c48958 45%, #9a6040);
}
.plant--bush .plant-stand {
  height: 4.4rem;
  width: 2.9rem;
  margin-left: -1.45rem;
}
.plant--bush .plant-pot {
  width: 2.25rem;
  margin-left: -1.125rem;
}
.plant--bush .plant-rim {
  width: 2.4rem;
  margin-left: -1.2rem;
}
.plant--bush .plant-leaf--1 {
  transform: rotateZ(-38deg);
  height: 2.2rem;
  width: 1.35rem;
}
.plant--bush .plant-leaf--2 {
  transform: rotateZ(40deg);
  height: 2.1rem;
  width: 1.3rem;
}
.plant--bush .plant-leaf--3 {
  transform: rotateZ(0deg);
  height: 2.45rem;
  width: 1.2rem;
}

/* ===== 3D furniture (boxes standing in room space) ===== */
.desk-cluster {
  width: 20%;
  height: 7.5rem;
  transform-style: preserve-3d;
  z-index: 13;
}

.desk3 {
  --desk-h: 42px;
  --apron: 16px;
  position: relative;
  width: 100%;
  height: 3.9rem;
  transform-style: preserve-3d;
  z-index: 1;
  pointer-events: none;
}
.desk3-shadow {
  position: absolute;
  left: 4%;
  right: 2%;
  top: 8%;
  bottom: -8%;
  background: radial-gradient(ellipse at center, rgba(20, 33, 43, 0.18), transparent 70%);
  transform: translateZ(1px);
  pointer-events: none;
}
.desk3-top {
  position: absolute;
  inset: 0;
  z-index: 4;
  background:
    linear-gradient(90deg, rgba(90, 55, 20, 0.06) 1px, transparent 1px),
    linear-gradient(145deg, #fbf0d4, #edd49a 55%, #dfc086);
  background-size: 18px 100%, auto;
  border: 1px solid rgba(110, 70, 30, 0.28);
  transform: translateZ(var(--desk-h));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -2px 0 rgba(120, 75, 30, 0.12);
}
.desk3-front,
.desk3-back {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--apron);
  border: 1px solid rgba(60, 35, 12, 0.4);
  backface-visibility: visible;
  z-index: 0;
}
.desk3-front {
  top: 100%;
  z-index: 0;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0 10px,
      transparent 10px 20px
    ),
    linear-gradient(180deg, #b88955 0%, #8a5f32 42%, #5c3b1c 100%);
  border-top: 0;
  transform-origin: top center;
  transform: translateZ(var(--desk-h)) rotateX(-90deg);
}
.desk3-back {
  top: 0;
  background: linear-gradient(180deg, #9a7040, #6a4524);
  border-bottom: 0;
  transform-origin: top center;
  transform: translateZ(var(--desk-h)) rotateX(-90deg);
}
.desk3-side {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--apron);
  height: 100%;
  background: linear-gradient(90deg, #8a5f32, #4a2e14);
  border: 1px solid rgba(60, 35, 12, 0.4);
  border-left: 0;
  transform-origin: left center;
  transform: translateZ(var(--desk-h)) rotateY(90deg);
  backface-visibility: visible;
}
.desk3-side.left {
  left: 0;
  right: auto;
  background: linear-gradient(90deg, #3f2712, #8a5f32);
  border-left: 1px solid rgba(60, 35, 12, 0.4);
  border-right: 0;
  transform-origin: right center;
  transform: translateZ(var(--desk-h)) rotateY(-90deg);
}
.desk3-leg {
  position: absolute;
  left: var(--l);
  top: var(--t);
  width: 0.48rem;
  height: var(--desk-h);
  background: linear-gradient(90deg, #6e4a2a, #3f2914);
  box-shadow: 2px 0 0 #2e1d0e;
  transform-origin: top center;
  transform: rotateX(90deg);
}

.desk-item {
  position: absolute;
  display: block;
  transform: translateZ(1px);
}
.desk-item.paper {
  left: 10%;
  bottom: 18%;
  width: 1.9rem;
  height: 1.35rem;
  background: #fffdf8;
  border: 1px solid rgba(20, 33, 43, 0.12);
  transform: rotate(-8deg) translateZ(1px);
  box-shadow: 1px 2px 0 rgba(20, 33, 43, 0.08);
}
.desk-item.paper-sm { width: 1.4rem; height: 1rem; left: 30%; }
.desk-item.ring {
  left: 44%;
  top: 10%;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid rgba(20, 33, 43, 0.48);
  border-radius: 50%;
}
.desk-item.ring-sm { width: 0.85rem; height: 0.85rem; left: 40%; top: 8%; }
.desk-item.tri {
  right: 8%;
  top: 6%;
  width: 0;
  height: 0;
  border-left: 0.85rem solid transparent;
  border-right: 0.85rem solid transparent;
  border-bottom: 1.35rem solid rgba(12, 107, 120, 0.7);
}

/* White notebook page in front of each pupil */
.desk-notebook {
  position: absolute;
  left: var(--nx, 8%);
  bottom: 10%;
  width: 1.55rem;
  height: 1.2rem;
  background: #fff;
  border: 1px solid rgba(20, 33, 43, 0.14);
  box-shadow:
    0.5px 1px 0 rgba(20, 33, 43, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  transform: rotate(-4deg) translateZ(2px);
  pointer-events: none;
  overflow: hidden;
}
.desk-notebook::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 22%;
  height: 1px;
  background: rgba(20, 33, 43, 0.08);
  box-shadow: 0 4px 0 rgba(20, 33, 43, 0.07), 0 8px 0 rgba(20, 33, 43, 0.06);
}

/* Writing line grows / shrinks on each page — speed via --write-dur */
.desk-scribble {
  position: absolute;
  left: 12%;
  top: 48%;
  width: 18%;
  height: 1.5px;
  opacity: 0;
  background: #14212b;
  border-radius: 1px;
  pointer-events: none;
  z-index: 1;
}
.desk-cluster.is-occupied .desk-scribble {
  opacity: 0.85;
  animation: scribbleWrite var(--write-dur, 1.2s) ease-in-out infinite;
}
.desk-cluster.is-cheering .desk-scribble {
  animation: none !important;
  width: 42%;
  opacity: 0.35;
}
@keyframes scribbleWrite {
  0%, 100% {
    width: 16%;
    opacity: 0.4;
  }
  50% {
    width: 72%;
    opacity: 1;
  }
}

.desk-heart-anchor {
  position: absolute;
  left: 50%;
  top: 1.35rem;
  width: 0;
  height: 0;
  transform: translateZ(56px);
  pointer-events: none;
}

.heart-layer {
  position: absolute;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  overflow: visible;
}
.desk-heart {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  font-size: 2.7rem;
  line-height: 1;
  color: #e31e5a;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65),
    0 2px 6px rgba(20, 33, 43, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -100%) scale(0.4);
  transform-origin: 50% 100%;
}
.desk-heart.is-on {
  animation: deskHeartPop 2.4s ease-out forwards;
}
@keyframes deskHeartPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -100%) scale(0.4);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1.15);
  }
  65% {
    opacity: 1;
    transform: translate(-50%, -160%) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -220%) scale(0.9);
  }
}

/*
  Chairs on the desk edge opposite the board (toward camera).
  Seat under the top; backrest is the outermost piece (in front of the apron).
*/
.chair3 {
  --seat-h: 18px;
  --back-h: 2.1rem;
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: 1.55rem;
  height: 1.5rem;
  transform-style: preserve-3d;
  z-index: 10;
  transition: top 0.45s var(--ease), left 0.45s var(--ease);
}
.chair3 i { display: block; position: absolute; }

.c3-seat {
  left: 0.1rem;
  right: 0.1rem;
  top: 0.06rem;
  bottom: 0.32rem;
  z-index: 1;
  background: linear-gradient(145deg, #ebe4d8, #d2c8b6);
  border: 1px solid rgba(100, 60, 25, 0.2);
  border-radius: 2px;
  transform: translateZ(var(--seat-h));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
}
.c3-front {
  left: 0.1rem;
  right: 0.1rem;
  top: 0.06rem;
  height: var(--seat-h);
  z-index: 1;
  background: linear-gradient(180deg, #b88955, #6a4524);
  transform-origin: top center;
  transform: rotateX(-90deg);
}
.c3-side {
  top: 0.06rem;
  bottom: 0.32rem;
  width: var(--seat-h);
  z-index: 1;
  background: linear-gradient(90deg, #8a5f32, #4a2e14);
}
.chair3 .c3-side.left {
  left: 0.1rem;
  transform-origin: left center;
  transform: rotateY(-90deg);
}
.chair3 .c3-side.right {
  right: 0.1rem;
  left: auto;
  transform-origin: right center;
  transform: rotateY(90deg);
}

.c3-sitter {
  position: absolute;
  left: 50%;
  /* sit on the cushion, toward the backrest (not in the desk gap) */
  top: 0.85rem;
  width: 0;
  height: 0;
  z-index: 15;
  /* above the seat mesh so the sprite is not painted under the cushion */
  transform: translateZ(calc(var(--seat-h) + 8px));
  transform-style: preserve-3d;
}

.c3-back {
  left: 0.1rem;
  right: 0.1rem;
  bottom: 0;
  top: auto;
  /* ~10% shorter than 2.1rem; bottom stays on the hinge */
  height: 1.9rem;
  z-index: 50;
  transform-style: preserve-3d;
  background: linear-gradient(180deg, #c9a066, #a57d52 40%, #8a6438);
  border: 1px solid rgba(90, 55, 25, 0.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
  transform-origin: center bottom;
  /* same seat plane as the cushion; closer to camera than the pupil */
  transform: translateZ(var(--seat-h)) rotateX(-90deg);
}
.c3-back::before,
.c3-back::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0.15rem;
  background: linear-gradient(180deg, #e8cfa0, #9a7040);
  border: 1px solid rgba(90, 55, 25, 0.3);
}
.c3-back::before { left: 0; }
.c3-back::after { right: 0; }
.c3-slat {
  position: absolute;
  left: 0.2rem;
  right: 0.2rem;
  height: 0.17rem;
  background: linear-gradient(180deg, #e0c49a, #a57d52);
  border: 1px solid rgba(90, 55, 25, 0.25);
  border-radius: 1px;
}
.c3-slat.s1 { top: 0.3rem; }
.c3-slat.s2 { top: 0.7rem; }
.c3-slat.s3 { top: 1.1rem; }

.c3-leg {
  width: 0.18rem;
  height: var(--seat-h);
  z-index: 1;
  background: #5c3c22;
  box-shadow: 1px 0 0 #3f2916;
  transform-origin: top center;
  transform: rotateX(90deg);
}
.c3-leg.a { left: 0.16rem; top: 0.1rem; }
.c3-leg.b { right: 0.16rem; left: auto; top: 0.1rem; }
.c3-leg.c { left: 0.16rem; top: calc(100% - 0.42rem); }
.c3-leg.d { right: 0.16rem; left: auto; top: calc(100% - 0.42rem); }

.chair3.is-pulled {
  /* clear the desk-top footprint (desk height 3.9rem) so the top no longer paints over sitters */
  top: calc(var(--cy) + 2.1rem);
}
/* Standing bookcase — same upright trick as wall */
.bookcase {
  width: 10%;
  height: 2.5rem;
  transform-style: preserve-3d;
  z-index: 6;
}
.bookcase-stand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 5.4rem;
  height: 8.2rem;
  margin-left: -2.7rem;
  transform-origin: center bottom;
  /* against the back wall — stand upright facing the room */
  transform: rotateX(-90deg) translateZ(0.35rem);
  transform-style: preserve-3d;
  background: linear-gradient(180deg, #d0ae84, #a57d52);
  border: 2px solid rgba(90, 55, 25, 0.4);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.1),
    inset 0 -8px 14px rgba(60, 35, 10, 0.12);
  padding: 0.4rem 0.35rem 0.45rem;
  display: grid;
  grid-template-rows: 1fr 1fr 1fr auto;
  gap: 0.3rem;
}
.bookcase-back {
  position: absolute;
  inset: 0.2rem;
  background: linear-gradient(180deg, #7a5834, #5c4126);
  z-index: 0;
  opacity: 0.75;
}
.bookcase-side {
  position: absolute;
  top: 0;
  right: -1.75rem;
  width: 1.75rem;
  height: 100%;
  background: linear-gradient(90deg, #a57d52, #6e4d2c);
  border: 1px solid rgba(70, 40, 15, 0.4);
  border-left: 0;
  transform-origin: left center;
  transform: rotateY(90deg);
}
.bookcase-side.left {
  left: -1.75rem;
  right: auto;
  background: linear-gradient(90deg, #6e4d2c, #a57d52);
  border-left: 1px solid rgba(70, 40, 15, 0.4);
  border-right: 0;
  transform-origin: right center;
  transform: rotateY(-90deg);
}
.bookcase-shelf {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 0.2rem;
  padding: 0.25rem 0.18rem 0.18rem;
  background: linear-gradient(180deg, transparent 55%, rgba(70, 40, 15, 0.28));
  border-bottom: 4px solid #8a6238;
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.08);
}
.book {
  display: block;
  width: 0.58rem;
  border-radius: 1px 1px 0 0;
  box-shadow:
    1px 0 0 rgba(0, 0, 0, 0.18),
    inset -1px 0 0 rgba(255, 255, 255, 0.15);
}
.book.b1 { height: 1.25rem; background: #0c6b78; }
.book.b2 { height: 1.45rem; background: #c45c26; width: 0.5rem; }
.book.b3 { height: 1.1rem; background: #3f8f5f; }
.book.b4 { height: 1.35rem; background: #b8891d; width: 0.66rem; }
.book.b5 { height: 1rem; background: #4d6a8a; }
.book.b6 { height: 1.28rem; background: #2f6f8f; width: 0.44rem; }
.book.b7 { height: 1.18rem; background: #a33b3b; }
.book.b8 { height: 1.4rem; background: #3d6b4f; width: 0.72rem; }
.bookcase-top {
  position: relative;
  z-index: 1;
  height: 0.42rem;
  background: linear-gradient(180deg, #e0c49a, #b88955);
  border: 1px solid rgba(90, 55, 25, 0.35);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.25);
}
.bookcase-roof {
  position: absolute;
  left: -0.18rem;
  right: -0.18rem;
  top: 0;
  height: 1.75rem;
  z-index: 4;
  background:
    linear-gradient(90deg, rgba(90, 55, 25, 0.12), transparent 18%, transparent 82%, rgba(90, 55, 25, 0.12)),
    linear-gradient(180deg, #ead7b0, #c9a66e 45%, #a57d52);
  border: 1px solid rgba(90, 55, 25, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 0 rgba(90, 55, 25, 0.12);
  transform-origin: center top;
  transform: rotateX(-90deg);
  pointer-events: none;
}

/* Picture with rainbow above the right bookcase */
.bookcase-picture {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.55rem);
  width: 3.1rem;
  height: 2.45rem;
  margin-left: -1.55rem;
  z-index: 5;
  pointer-events: none;
}
.bookcase-picture__frame {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0.18rem;
  background: linear-gradient(145deg, #e8d4a8, #a57d52 55%, #7a5834);
  border: 1px solid rgba(90, 55, 25, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 2px 4px rgba(20, 33, 43, 0.12);
}
.bookcase-picture__mat {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    linear-gradient(180deg, #9ec8e8 0 58%, #7eb56a 58% 72%, #c4a06a 72%);
  border: 1px solid rgba(20, 33, 43, 0.12);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}
.bookcase-picture__rainbow {
  position: absolute;
  left: 50%;
  bottom: 28%;
  width: 2.4rem;
  height: 1.2rem;
  margin-left: -1.2rem;
  border-radius: 2.4rem 2.4rem 0 0;
  background:
    radial-gradient(
      ellipse 100% 100% at 50% 100%,
      transparent 42%,
      #e31e24 42% 48%,
      #f7941d 48% 54%,
      #fdb913 54% 60%,
      #39b54a 60% 66%,
      #00aeef 66% 72%,
      #662d91 72% 78%,
      transparent 78%
    );
  opacity: 0.95;
}

/* Teacher — standing billboard by the chalkboard */
.teacher {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 0;
  height: 0;
  z-index: 12;
  transform: translate3d(0, 0, 50px);
  transform-style: preserve-3d;
  pointer-events: none;
  transition: left 1.15s linear, top 1.15s linear;
}
.teacher.is-pacing .teacher-figure {
  animation: teacherPace 0.4s ease-in-out infinite;
}
@keyframes teacherPace {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
.teacher-billboard {
  position: absolute;
  left: 0;
  top: 0;
  width: 2.55rem;
  height: 3.55rem;
  transform: translate(-50%, -100%) rotateZ(42deg) rotateX(-52deg);
  transform-origin: 50% 100%;
}
.teacher-shadow {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1.55rem;
  height: 0.4rem;
  transform: translateX(-50%);
  background: rgba(20, 33, 43, 0.22);
  border-radius: 50%;
}
.teacher-figure {
  position: absolute;
  inset: 0 0 0.22rem;
  display: grid;
  justify-items: center;
  align-content: start;
}
.teacher-hair {
  width: 1.2rem;
  height: 0.62rem;
  margin-top: 0.06rem;
  margin-bottom: -0.48rem;
  border-radius: 0.6rem 0.6rem 0.18rem 0.18rem;
  background: linear-gradient(180deg, #2c211c, #5a4034);
  z-index: 1;
}
.teacher-head {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: #efc4a0;
  border: 1px solid rgba(20, 33, 43, 0.16);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
  z-index: 0;
}
.teacher-body {
  width: 1.15rem;
  height: 1.95rem;
  margin-top: 0.08rem;
  border-radius: 0.4rem 0.4rem 0.85rem 0.85rem;
  background: linear-gradient(180deg, #3d6f7c 0%, #2a5560 42%, #1f434c 100%);
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.1);
}

/* Waving arms — only while the teacher is idle-waving */
.teacher-arm {
  position: absolute;
  top: 36%;
  width: 0.82rem;
  height: 0.17rem;
  border-radius: 0.1rem;
  background: #efc4a0;
  border: 1px solid rgba(20, 33, 43, 0.14);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.teacher-arm--l {
  left: 8%;
  transform-origin: right center;
  transform: rotate(-24deg);
}
.teacher-arm--r {
  right: 8%;
  transform-origin: left center;
  transform: rotate(24deg);
}
.teacher.is-waving .teacher-arm {
  opacity: 1;
}
.teacher.is-waving .teacher-arm--l {
  animation: teacherWaveL 0.52s ease-in-out infinite alternate;
}
.teacher.is-waving .teacher-arm--r {
  animation: teacherWaveR 0.52s ease-in-out infinite alternate;
}
@keyframes teacherWaveL {
  from { transform: rotate(-18deg); }
  to { transform: rotate(-62deg); }
}
@keyframes teacherWaveR {
  from { transform: rotate(18deg); }
  to { transform: rotate(62deg); }
}

/* Comic speech bubble by the teacher's head */
.teacher-bubble {
  position: absolute;
  left: 52%;
  bottom: 78%;
  display: grid;
  place-items: center;
  min-width: 2.3rem;
  min-height: 1.5rem;
  padding: 0.3rem 0.4rem;
  background: #fff;
  border: 2px solid #14212b;
  border-radius: 0.55rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  line-height: 1;
  color: #14212b;
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.5);
  transform-origin: 0 100%;
  transition: opacity 0.22s ease, transform 0.28s var(--ease);
  box-shadow: 2px 3px 0 rgba(20, 33, 43, 0.18);
  z-index: 6;
}
.teacher-bubble::after {
  content: "";
  position: absolute;
  left: 0.35rem;
  bottom: -0.42rem;
  width: 0.42rem;
  height: 0.42rem;
  background: #fff;
  border-right: 2px solid #14212b;
  border-bottom: 2px solid #14212b;
  transform: rotate(35deg) skewX(-12deg);
}
.teacher-bubble svg {
  display: block;
  width: 1.9rem;
  height: 1.25rem;
}
.teacher.is-talking .teacher-bubble {
  opacity: 1;
  transform: scale(1);
}
.teacher.is-talking .teacher-bubble.is-pop {
  animation: bubblePop 0.32s var(--ease);
}
@keyframes bubblePop {
  0% { transform: scale(0.68); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* Teacher phone demo scene */
.teacher-book {
  position: absolute;
  left: -18%;
  top: 42%;
  width: 0.95rem;
  height: 1.15rem;
  border-radius: 0.08rem 0.14rem 0.14rem 0.08rem;
  background: linear-gradient(135deg, #fff8ef, #f0dcc0 45%, #d4b896);
  border: 1px solid #b8956a;
  box-shadow: 1px 2px 4px rgba(20, 33, 43, 0.2);
  opacity: 0;
  transform: rotate(-12deg) translateY(6px);
  transition: opacity 0.35s ease, transform 0.45s var(--ease);
  z-index: 2;
}
.teacher-book::after {
  content: "";
  position: absolute;
  inset: 0.12rem 0.18rem;
  border-left: 2px solid rgba(184, 149, 106, 0.55);
}
.teacher-phone-hand {
  position: absolute;
  right: -22%;
  top: 38%;
  width: 0.42rem;
  height: 0.72rem;
  border-radius: 0.1rem;
  background: linear-gradient(180deg, #2a3340, #141b24);
  border: 1.5px solid #3a4654;
  box-shadow: 1px 2px 5px rgba(20, 33, 43, 0.28);
  opacity: 0;
  transform: rotate(14deg) translateY(8px);
  transition: opacity 0.35s ease, transform 0.45s var(--ease);
  z-index: 2;
}
.teacher-phone-hand::before {
  content: "";
  position: absolute;
  inset: 0.1rem 0.06rem 0.14rem;
  border-radius: 0.05rem;
  background: linear-gradient(160deg, #1a2744, #3d2a6b);
}
.teacher-phone-hand.is-hidden {
  opacity: 0 !important;
  visibility: hidden;
}
.teacher.is-phone-demo .teacher-arm {
  opacity: 1;
}
.teacher.is-phone-demo .teacher-arm--l {
  transform: rotate(-42deg) translate(-2px, 2px);
  animation: none;
}
.teacher.is-phone-demo .teacher-arm--r {
  transform: rotate(38deg) translate(2px, 1px);
  animation: none;
}
.teacher.is-phone-demo.is-holding-props .teacher-book,
.teacher.is-phone-demo.is-holding-props .teacher-phone-hand {
  opacity: 1;
  transform: rotate(-8deg) translateY(0);
}
.teacher.is-phone-demo.is-holding-props .teacher-phone-hand {
  transform: rotate(18deg) translateY(0);
}
.teacher.is-phone-demo.is-photographing .teacher-arm--r {
  transform: rotate(-8deg) translate(4px, -6px);
}
.teacher.is-phone-demo.is-photographing .teacher-phone-hand {
  transform: rotate(-24deg) translate(-2px, -4px);
}
.teacher.is-phone-demo.is-photographing .teacher-book {
  transform: rotate(-4deg) translate(-2px, -2px);
}

audio[data-voiceover] {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Photo flash + phone overlay on stage */
.stage.is-class-paused .viewport {
  filter: saturate(0.88) brightness(0.94);
}
/* Lobby play button — overlays the classroom until the demo starts */
.play-overlay {
  position: absolute;
  inset: 0;
  z-index: 46;
  display: grid;
  place-items: center;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 50% 50%,
      rgba(20, 33, 43, 0.26) 0%,
      rgba(20, 33, 43, 0.08) 42%,
      rgba(20, 33, 43, 0.02) 68%,
      transparent 100%
    );
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
}
.play-overlay.is-visible {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}
.play-btn {
  position: relative;
  width: clamp(3.58rem, 10.24vmin, 5.38rem);
  height: clamp(3.58rem, 10.24vmin, 5.38rem);
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(165deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow:
    0 0 0 0.55rem rgba(255, 255, 255, 0.22),
    0 18px 40px rgba(20, 33, 43, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: grid;
  place-items: center;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.play-btn:hover,
.play-btn:focus-visible {
  transform: scale(1.06);
  box-shadow:
    0 0 0 0.62rem rgba(255, 255, 255, 0.28),
    0 22px 44px rgba(20, 33, 43, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.play-btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 6px;
}
.play-btn:active {
  transform: scale(0.97);
}
.play-btn__icon {
  display: block;
  width: 38%;
  height: 38%;
  margin: 0;
  fill: currentColor;
}
.play-btn__pulse {
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  border: 2px solid rgba(12, 107, 120, 0.42);
  pointer-events: none;
  animation: playPulse 2.2s var(--ease) infinite;
}
@keyframes playPulse {
  0% { transform: scale(1); opacity: 0.72; }
  100% { transform: scale(1.32); opacity: 0; }
}

.photo-flash {
  position: absolute;
  inset: 0;
  z-index: 38;
  background: rgba(255, 255, 255, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease-out;
}
.photo-flash.is-on {
  opacity: 1;
}
.phone-overlay {
  position: absolute;
  inset: 0;
  z-index: 39;
  pointer-events: none;
}
.phone-overlay.is-from-scan {
  z-index: 42;
}
.phone-overlay__device {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(16rem, 42%);
  height: auto;
  aspect-ratio: 9 / 19.5;
  transform: translate(-50%, -50%) scale(0.08);
  opacity: 0;
  transition:
    transform 1.35s cubic-bezier(0.4, 0.0, 0.2, 1),
    opacity 0.35s ease,
    left 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    top 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    width 1.35s cubic-bezier(0.4, 0.0, 0.2, 1),
    height 1.35s cubic-bezier(0.4, 0.0, 0.2, 1);
  transform-origin: center center;
}
.phone-overlay__device.is-animating {
  transition:
    transform 0.95s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease,
    left 0.95s cubic-bezier(0.22, 1, 0.36, 1),
    top 0.95s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.95s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.95s cubic-bezier(0.22, 1, 0.36, 1);
}
.phone-overlay.is-visible .phone-overlay__device {
  left: 50%;
  top: 50%;
  width: min(17rem, 46%, calc(90% * 9 / 19.5));
  height: auto;
  max-width: 92%;
  max-height: 90%;
  aspect-ratio: 9 / 19.5;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.phone-overlay.is-visible .phone-overlay__device.is-morphing {
  transform: translate(-50%, -50%) scale(0.94);
}
.phone-overlay.is-visible .phone-overlay__device.is-landscape {
  width: min(34rem, 88%);
  height: auto;
  max-width: 94%;
  max-height: 88%;
  aspect-ratio: 19.5 / 9;
}
.phone-overlay.is-visible .phone-overlay__device.is-landscape:not(.is-morphing) {
  transform: translate(-50%, -50%) scale(1);
}
.phone-overlay.is-visible .phone-overlay__device.is-landscape.is-morphing {
  transform: translate(-50%, -50%) scale(0.94);
}
.phone-overlay__bezel {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0.55rem 0.45rem;
  border-radius: 1.6rem;
  background: linear-gradient(145deg, #2a3340, #0f1419);
  box-shadow:
    0 24px 48px rgba(20, 33, 43, 0.35),
    inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}
.phone-overlay__bezel::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.65rem;
  width: 28%;
  height: 0.22rem;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  transition: left 1.35s cubic-bezier(0.4, 0.0, 0.2, 1), top 1.35s cubic-bezier(0.4, 0.0, 0.2, 1), width 1.35s cubic-bezier(0.4, 0.0, 0.2, 1);
}
.phone-overlay__device.is-landscape .phone-overlay__bezel::before {
  left: 0.65rem;
  top: 50%;
  width: 0.22rem;
  height: 22%;
  transform: translateY(-50%);
}
.phone-overlay__screens {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 1.15rem;
  overflow: hidden;
  background: #0f1419;
}
.phone-overlay__screens.is-zoomed {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}
.phone-overlay__screens.is-zoomed.is-panning {
  cursor: grabbing;
}
.phone-overlay__zoom {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}
.phone-overlay__screen {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1.15rem;
  background: #0f1419;
  opacity: 0;
  transition: opacity 0.55s ease;
  pointer-events: none;
}
.phone-overlay__screen.is-active {
  opacity: 1;
}

/* QR scan scene — teacher's point of view over the textbook page */
.stage.is-scanning .viewport {
  filter: blur(3px) brightness(0.9) saturate(0.9);
}
.scan-scene {
  position: absolute;
  inset: 0;
  z-index: 41;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 90% at 50% 40%, rgba(20, 33, 43, 0.12), rgba(20, 33, 43, 0.42));
  opacity: 0;
  pointer-events: none;
}
.scan-scene.is-visible {
  opacity: 1;
}
.scan-scene[hidden] {
  display: none !important;
}
.scan-phone.is-flying {
  position: absolute;
  z-index: 50;
  margin: 0;
  aspect-ratio: auto;
  overflow: hidden;
  transform: none;
  transition:
    left 1s cubic-bezier(0.22, 1, 0.36, 1),
    top 1s cubic-bezier(0.22, 1, 0.36, 1),
    width 1s cubic-bezier(0.22, 1, 0.36, 1),
    height 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.scan-page {
  --scan-left: 50%;
  --scan-top: 50%;
  --scan-tx: -73%;
  --scan-ty: -30%;
  --scan-rot: -2.5deg;
  --scan-scale: 0.985;
  position: absolute;
  left: var(--scan-left);
  top: var(--scan-top);
  height: min(104%, 52rem);
  max-width: 96%;
  transform: translate(var(--scan-tx), var(--scan-ty)) rotate(var(--scan-rot)) scale(var(--scan-scale));
  transform-origin: center center;
  filter: drop-shadow(0 26px 44px rgba(20, 33, 43, 0.32));
  transition: transform 0.9s var(--ease);
}
.scan-scene.is-visible .scan-page {
  --scan-scale: 1;
}
.scan-page__img {
  display: block;
  height: 100%;
  width: auto;
  border-radius: 0.35rem;
  background: #fff;
}
.scan-page__qr-halo {
  position: absolute;
  border-radius: 0.2rem;
  box-shadow: 0 0 0 2px rgba(12, 107, 120, 0.55), 0 0 22px rgba(12, 107, 120, 0.35);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.scan-scene.is-aiming .scan-page__qr-halo {
  opacity: 1;
  animation: qrHaloPulse 1.2s ease-in-out infinite;
}
.scan-scene.is-locked .scan-page__qr-halo {
  opacity: 1;
  animation: none;
  box-shadow: 0 0 0 2px rgba(57, 181, 74, 0.75), 0 0 26px rgba(57, 181, 74, 0.4);
}
@keyframes qrHaloPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* Hand shell = position; inner motion = tilt/scale during rAF approach only */
.scan-hand {
  position: absolute;
  width: 19%;
  min-width: 5.75rem;
}
.scan-hand__motion {
  transform-origin: var(--scan-phone-origin-x, 50%) var(--scan-phone-origin-y, 24%);
}
.scan-hand.is-animating,
.scan-hand.is-animating .scan-hand__motion {
  transition: none !important;
}
.scan-hand.is-calibrating .scan-hand__motion {
  transform: none !important;
  transition: none !important;
}
.scan-hand__palm {
  position: absolute;
  left: 24%;
  top: 60%;
  width: 92%;
  height: 64%;
  border-radius: 48% 40% 40% 52%;
  background: linear-gradient(150deg, #efc09b, #d99a6c);
  box-shadow: 0 18px 30px rgba(20, 33, 43, 0.26);
  transform: rotate(10deg);
}
.scan-hand__palm::after {
  content: "";
  position: absolute;
  left: 42%;
  top: 58%;
  width: 68%;
  height: 128%;
  border-radius: 44% 44% 22% 22%;
  background: linear-gradient(165deg, #e8b48d, #cd8a5c);
  transform: rotate(-16deg);
  z-index: -1;
}
.scan-hand__thumb {
  position: absolute;
  left: -13%;
  top: 68%;
  width: 33%;
  height: 14%;
  border-radius: 999px;
  background: linear-gradient(160deg, #f3c8a5, #dfa478);
  box-shadow: 0 3px 6px rgba(20, 33, 43, 0.22);
  transform: rotate(-26deg);
  z-index: 3;
}
.scan-hand::before {
  content: "";
  position: absolute;
  right: -11%;
  top: 62%;
  width: 26%;
  height: 12%;
  border-radius: 999px;
  background: linear-gradient(160deg, #f0c19c, #d99a6c);
  transform: rotate(16deg);
  z-index: 3;
}
.scan-phone {
  position: relative;
  z-index: 2;
  width: 100%;
  aspect-ratio: 9 / 19.5;
  padding: 0.4rem 0.34rem;
  border-radius: 1.2rem;
  background: linear-gradient(145deg, #2a3340, #0f1419);
  box-shadow:
    0 20px 40px rgba(20, 33, 43, 0.4),
    inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}
.scan-phone__screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 0.9rem;
  overflow: hidden;
  background: #0f1419;
}
.scan-phone.is-playing-video .scan-phone__camera,
.scan-phone.is-playing-video .scan-phone__reticle,
.scan-phone.is-playing-video .scan-phone__beam,
.scan-phone.is-playing-video .scan-phone__result,
.scan-phone.is-flying .scan-phone__camera,
.scan-phone.is-flying .scan-phone__reticle,
.scan-phone.is-flying .scan-phone__beam,
.scan-phone.is-flying .scan-phone__result {
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: none;
}
.scan-phone.is-playing-video .phone-overlay__screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  border-radius: 0.9rem;
}
.scan-phone__camera {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
}
.scan-phone__camera img {
  position: absolute;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  transform: none;
  filter: brightness(1.02) contrast(1.05);
  will-change: left, top, width, height;
}
.scan-phone__reticle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}
.scan-phone__reticle i {
  position: absolute;
  width: 26%;
  height: 26%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  transition: border-color 0.3s ease;
}
.scan-phone__reticle i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.scan-phone__reticle i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.scan-phone__reticle i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.scan-phone__reticle i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; }
.scan-scene.is-locked .scan-phone__reticle i {
  border-color: #39b54a;
}
.scan-phone__beam {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 20%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(57, 181, 74, 0.95), transparent);
  box-shadow: 0 0 14px rgba(57, 181, 74, 0.65);
  opacity: 0;
}
.scan-scene.is-aiming .scan-phone__beam {
  opacity: 1;
  animation: scanBeam 1.15s ease-in-out infinite;
}
@keyframes scanBeam {
  0% { top: 22%; opacity: 0.2; }
  50% { top: 76%; opacity: 1; }
  100% { top: 22%; opacity: 0.2; }
}
.scan-phone__result {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.3rem;
  padding: 0.8rem 0.6rem;
  text-align: center;
  background: linear-gradient(170deg, #ffffff, #eef3f5);
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.4s ease, transform 0.4s var(--ease);
}
.scan-scene.is-locked .scan-phone__result {
  opacity: 1;
  transform: scale(1);
}
.scan-phone__result-logo {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background:
    conic-gradient(var(--stripe-1), var(--stripe-2), var(--stripe-3), var(--stripe-4), var(--stripe-5), var(--stripe-6), var(--stripe-1));
  mask: radial-gradient(circle, transparent 38%, #000 40%);
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 40%);
}
.scan-phone__result strong {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.scan-phone__result em {
  font-style: normal;
  font-size: 0.46rem;
  color: var(--ink-soft);
  line-height: 1.25;
}
.scan-phone__result-status {
  margin-top: 0.15rem;
  padding: 0.16rem 0.4rem;
  border-radius: 999px;
  background: rgba(57, 181, 74, 0.14);
  color: #2f7d3a;
  font-family: var(--font-display);
  font-size: 0.42rem;
  font-weight: 700;
}


.pupils {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 11;
  transform-style: preserve-3d;
}
.pupil {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 0;
  height: 0;
  transform: translate3d(0, 0, 42px);
  transform-style: preserve-3d;
  transition: left 1.15s linear, top 1.15s linear;
  will-change: left, top;
}
.pupil-billboard {
  position: absolute;
  left: 0;
  top: 0;
  width: 2.1rem;
  height: 2.6rem;
  transform: translate(-50%, -100%) rotateZ(42deg) rotateX(-52deg);
  transform-origin: 50% 100%;
  transition: height 0.35s var(--ease), transform 0.35s var(--ease);
}
.pupil.is-walking .pupil-figure {
  animation: pupilBob 0.4s ease-in-out infinite;
}
@keyframes pupilBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.pupil-shadow {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1.35rem;
  height: 0.38rem;
  transform: translateX(-50%);
  background: rgba(20, 33, 43, 0.22);
  border-radius: 50%;
  transition: width 0.3s ease, opacity 0.3s ease;
}
.pupil-figure {
  position: absolute;
  inset: 0 0 0.2rem;
  display: grid;
  justify-items: center;
  align-content: start;
}
.pupil-head {
  width: 0.8rem;
  height: 0.8rem;
  margin-top: 0.05rem;
  border-radius: 50%;
  background: #f0c7a0;
  border: 1px solid rgba(20,33,43,0.14);
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset;
  transition: margin-top 0.3s ease;
}
.pupil-body {
  width: 1rem;
  height: 1.15rem;
  margin-top: 0.08rem;
  border-radius: 0.2rem 0.2rem 0.14rem 0.14rem;
  background: hsl(var(--hue, 188), 58%, 40%);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,0.1);
  transition: height 0.3s ease, width 0.3s ease, border-radius 0.3s ease;
}
.pupil-arm,
.pupil-pencil {
  display: none;
  position: absolute;
}
.pupil.is-sitting {
  transform: translate3d(0, 0, 28px);
  transition: left 0.9s ease, top 0.9s ease, transform 0.35s ease;
}
.pupil.is-sitting .pupil-billboard {
  height: 1.85rem;
}
.pupil.is-sitting .pupil-head {
  margin-top: 0.15rem;
  width: 0.74rem;
  height: 0.74rem;
}
.pupil.is-sitting .pupil-body {
  height: 0.68rem;
  width: 1.1rem;
  border-radius: 0.18rem 0.18rem 0.35rem 0.35rem;
}
.pupil.is-sitting .pupil-shadow {
  width: 1.5rem;
  opacity: 0.85;
}
.pupil.is-sitting .pupil-arm,
.pupil.is-sitting .pupil-pencil {
  display: block;
}
/* Seated at desks: writing hand only — never animate head/body */
.pupil.is-on-chair .pupil-arm,
.pupil.is-on-chair .pupil-pencil {
  display: block;
}
.pupil.is-on-chair .pupil-head,
.pupil.is-on-chair .pupil-body,
.pupil.is-on-chair .pupil-figure {
  animation: none !important;
}
.pupil.is-on-chair .pupil-body {
  position: relative;
  z-index: 2;
}
.pupil.is-on-chair .pupil-head {
  position: relative;
  z-index: 3;
}
/* Left hand: shoulder on torso side, hand toward the paper */
.pupil.is-on-chair .pupil-arm {
  left: calc(50% - 1.62rem);
  top: 58%;
  width: 0.95rem;
  height: 0.15rem;
  z-index: 4;
  transform-origin: right center;
  transform: rotate(-18deg);
  animation: seatWriteArm var(--write-dur, 1.05s) ease-in-out infinite;
  animation-delay: var(--write-delay, 0s);
}
.pupil.is-on-chair .pupil-pencil {
  left: calc(50% - 1.85rem);
  top: 50%;
  width: 0.11rem;
  height: 0.48rem;
  z-index: 4;
  transform-origin: 50% 100%;
  transform: rotate(-22deg);
  animation: seatWritePencil var(--write-dur, 1.05s) ease-in-out infinite;
  animation-delay: var(--write-delay, 0s);
}
@keyframes seatWriteArm {
  0%, 100% { transform: rotate(-12deg) translate(0, 0); }
  50% { transform: rotate(-26deg) translate(-1.5px, 1px); }
}
@keyframes seatWritePencil {
  0%, 100% { transform: rotate(-28deg) translate(0, 0); }
  50% { transform: rotate(-14deg) translate(1.5px, 1px); }
}
/* Right-handers: pencil on the right side of the paper; shorter arm to it */
.pupil.is-on-chair.is-righty .pupil-arm {
  left: calc(50% - 0.55rem);
  top: 54%;
  width: 1.2rem;
  height: 0.14rem;
  z-index: 0;
  transform-origin: right center;
  transform: rotate(-8deg);
  animation-name: seatWriteArmRight;
}
.pupil.is-on-chair.is-righty .pupil-pencil {
  left: calc(50% - 0.75rem);
  top: 38%;
  z-index: 1;
  transform: rotate(-18deg);
  animation-name: seatWritePencilRight;
}
@keyframes seatWriteArmRight {
  0%, 100% { transform: rotate(-2deg) translate(0, 0); }
  50% { transform: rotate(-14deg) translate(-1px, 1px); }
}
@keyframes seatWritePencilRight {
  0%, 100% { transform: rotate(-24deg) translate(0, 0); }
  50% { transform: rotate(-10deg) translate(1.5px, 1px); }
}

/* Occasional ruler / compass — slide onto paper, then retract the same way */
.pupil-tool {
  display: none;
  position: absolute;
  pointer-events: none;
  transform-origin: center center;
  --tool-rot: -10deg;
  --tool-from-x: 8px;
  --tool-from-y: 12px;
}
.pupil.is-on-chair.is-using-ruler .pupil-pencil,
.pupil.is-on-chair.is-using-compass .pupil-pencil,
.pupil.is-on-chair.is-putting-away .pupil-pencil {
  opacity: 0;
}
.pupil.is-on-chair.is-using-ruler .pupil-tool,
.pupil.is-on-chair.is-using-compass .pupil-tool,
.pupil.is-on-chair.is-putting-away .pupil-tool {
  display: block;
}
.pupil.is-on-chair.is-using-ruler:not(.is-putting-away) .pupil-tool,
.pupil.is-on-chair.is-using-compass:not(.is-putting-away) .pupil-tool {
  animation: toolLift 0.4s ease-out;
}
.pupil.is-on-chair.is-putting-away .pupil-tool {
  animation: toolRetract 0.4s ease-in forwards;
}
.pupil.is-on-chair.is-using-ruler .pupil-tool {
  left: calc(50% - 1.95rem);
  top: 34%;
  width: 1.25rem;
  height: 0.2rem;
  z-index: 5;
  --tool-rot: -10deg;
  border-radius: 1px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 2px,
      rgba(20, 33, 43, 0.45) 2px 2.5px
    ),
    linear-gradient(180deg, #f7efd2, #e2d2a4);
  border: 1px solid rgba(20, 33, 43, 0.35);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
}
.pupil.is-on-chair.is-using-compass .pupil-tool {
  left: calc(50% - 1.75rem);
  top: 30%;
  width: 0.72rem;
  height: 0.72rem;
  z-index: 5;
  --tool-rot: -8deg;
  border: 2px solid #14212b;
  border-radius: 50%;
  background: transparent;
}
.pupil.is-on-chair.is-using-compass .pupil-tool::before,
.pupil.is-on-chair.is-using-compass .pupil-tool::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 0.55rem;
  background: linear-gradient(180deg, #8a6438, #14212b);
  border-radius: 1px;
  transform-origin: top center;
}
.pupil.is-on-chair.is-using-compass .pupil-tool::before {
  transform: translate(-50%, 0) rotate(-28deg);
}
.pupil.is-on-chair.is-using-compass .pupil-tool::after {
  transform: translate(-50%, 0) rotate(32deg);
  background: linear-gradient(180deg, #c45c26, #14212b);
}
.pupil.is-on-chair.is-righty.is-using-ruler .pupil-tool,
.pupil.is-on-chair.is-righty.is-using-compass .pupil-tool {
  z-index: 1;
  --tool-from-x: -8px;
}

/* Cheering — both hands raised; writing paused (scribble via .desk-cluster.is-cheering) */
.pupil-arm-raise {
  display: none;
  position: absolute;
  width: 0.18rem;
  height: 0.95rem;
  border-radius: 0.1rem;
  background: #f0c7a0;
  border: 1px solid rgba(20, 33, 43, 0.14);
  z-index: 4;
  pointer-events: none;
}
.pupil.is-on-chair.is-cheering .pupil-pencil,
.pupil.is-on-chair.is-cheering .pupil-tool {
  display: none !important;
  opacity: 0 !important;
  animation: none !important;
}
.pupil.is-on-chair.is-cheering .pupil-arm {
  display: block;
  left: 22%;
  top: 22%;
  width: 0.18rem;
  height: 0.95rem;
  z-index: 4;
  transform-origin: 50% 100%;
  transform: rotate(-10deg);
  animation: cheerArm 0.7s ease-in-out infinite alternate;
}
.pupil.is-on-chair.is-cheering .pupil-arm-raise {
  display: block;
  left: 62%;
  top: 22%;
  transform-origin: 50% 100%;
  transform: rotate(10deg);
  animation: cheerArmRight 0.7s ease-in-out infinite alternate;
  animation-delay: 0.12s;
}
@keyframes cheerArm {
  from { transform: rotate(-16deg) translateY(0); }
  to { transform: rotate(4deg) translateY(-2px); }
}
@keyframes cheerArmRight {
  from { transform: rotate(16deg) translateY(0); }
  to { transform: rotate(-4deg) translateY(-2px); }
}
@keyframes toolLift {
  from {
    opacity: 0;
    transform: translate(var(--tool-from-x), var(--tool-from-y)) scale(0.6) rotate(var(--tool-rot));
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(var(--tool-rot));
  }
}
@keyframes toolRetract {
  from {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(var(--tool-rot));
  }
  to {
    opacity: 0;
    transform: translate(var(--tool-from-x), var(--tool-from-y)) scale(0.6) rotate(var(--tool-rot));
  }
}
.pupil.is-on-chair.is-drawing .pupil-arm,
.pupil.is-on-chair.is-drawing .pupil-pencil {
  display: block;
}
/*
  Seated pupils:
  - feet hinged on the sitter (bottom: 0) — never top:0 + tall box (that buried them under the desk)
  - camera billboard so they read as characters
  - figure packed to the BOTTOM of the billboard so the torso sits on the cushion
  - chairs pulled past the desk-top Y so the desktop cannot bury them
*/
.pupil.is-on-chair {
  left: 0;
  top: 0;
  z-index: 15;
  transform: none;
  transition: none;
  --sit-dx: 0px;
  --sit-dy: 0px;
}
.pupil.is-on-chair .pupil-billboard,
.pupil.is-on-chair.is-sitting .pupil-billboard {
  left: 0;
  top: auto;
  bottom: 0;
  width: 2.55rem;
  height: 2.7rem;
  margin-left: -1.275rem;
  transform-style: preserve-3d;
  transform-origin: center bottom;
  transform:
    translate(var(--sit-dx), var(--sit-dy))
    rotateZ(42deg)
    rotateX(-52deg);
}
.pupil.is-on-chair .pupil-figure {
  inset: 0;
  align-content: end;
  justify-items: center;
  gap: 0.05rem;
  padding-bottom: 0.04rem;
}
.pupil.is-on-chair.is-sitting .pupil-head {
  margin-top: 0;
  width: 1rem;
  height: 1rem;
  transform: none;
  border: 1.5px solid rgba(20, 33, 43, 0.28);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
}
.pupil.is-on-chair.is-sitting .pupil-body {
  height: 1.15rem;
  width: 1.35rem;
  margin-top: 0;
  border-radius: 0.22rem 0.22rem 0.35rem 0.35rem;
}
.pupil.is-on-chair .pupil-shadow {
  display: none;
}
.pupil.is-at-board {
  z-index: 20;
  transform: translate3d(0, 0, 52px);
}
.pupil.is-walking {
  z-index: 22;
  transform: translate3d(0, 0, 46px);
  transition: left 1.05s linear, top 1.05s linear;
}
.pupil.is-walking .pupil-billboard,
.pupil.is-at-board .pupil-billboard {
  width: 2.35rem;
  height: 3.2rem;
  margin-left: 0;
  top: 0;
  bottom: auto;
  left: 0;
  transform: translate(-50%, -100%) rotateZ(42deg) rotateX(-52deg);
  transform-origin: 50% 100%;
}
.pupil.is-walking .pupil-figure,
.pupil.is-at-board .pupil-figure {
  inset: 0 0 0.2rem;
  align-content: start;
}
.pupil.is-walking .pupil-head,
.pupil.is-at-board .pupil-head {
  width: 0.85rem;
  height: 0.85rem;
  margin-top: 0.08rem;
}
.pupil.is-walking .pupil-body,
.pupil.is-at-board .pupil-body {
  width: 1.05rem;
  height: 1.35rem;
  border-radius: 0.2rem 0.2rem 0.18rem 0.18rem;
}
.pupil.is-walking .pupil-shadow,
.pupil.is-at-board .pupil-shadow {
  display: block;
  width: 1.4rem;
}
.pupil.is-at-board .pupil-arm,
.pupil.is-at-board .pupil-pencil {
  display: block;
}
.pupil.is-at-board .pupil-arm {
  animation: drawArm 0.55s ease-in-out infinite alternate;
}
@keyframes drawArm {
  from { transform: rotate(8deg); }
  to { transform: rotate(28deg); }
}
.pupil-arm {
  left: 58%;
  top: 48%;
  width: 0.55rem;
  height: 0.18rem;
  border-radius: 0.1rem;
  background: #f0c7a0;
  transform-origin: left center;
  transform: rotate(18deg);
}
.pupil-pencil {
  left: 72%;
  top: 42%;
  width: 0.14rem;
  height: 0.7rem;
  border-radius: 1px;
  background: linear-gradient(180deg, #14212b 15%, #c45c26 15% 88%, #f0c75e 88%);
  transform-origin: 50% 100%;
  transform: rotate(-28deg);
}
.pupil.is-drawing .pupil-arm {
  animation: armDraw 0.55s ease-in-out infinite;
}
.pupil.is-drawing .pupil-pencil {
  animation: pencilScratch 0.55s ease-in-out infinite;
}
@keyframes armDraw {
  0%, 100% { transform: rotate(12deg) translateX(0); }
  50% { transform: rotate(28deg) translateX(2px); }
}
@keyframes pencilScratch {
  0%, 100% { transform: rotate(-32deg) translate(0, 0); }
  50% { transform: rotate(-18deg) translate(2px, 1px); }
}

/* Floaters */
.floaters { position: absolute; inset: 0; pointer-events: none; }
.floater {
  position: absolute;
  border: 1.5px solid rgba(12, 107, 120, 0.28);
  border-radius: 50%;
  animation: floatY 7s ease-in-out infinite;
}
.floater-a { width: 3.5rem; height: 3.5rem; left: 12%; top: 18%; animation-delay: 0s; }
.floater-b { width: 2.2rem; height: 2.2rem; left: 70%; top: 22%; border-color: rgba(184,137,29,0.35); animation-delay: 1.2s; }
.floater-c {
  width: 4rem; height: 1px; left: 30%; top: 78%; border: 0;
  background: linear-gradient(90deg, transparent, rgba(20,33,43,0.25), transparent);
  animation-delay: 0.6s;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}


/* Panel */
.panel {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  min-height: 0;
  padding: clamp(1.15rem, 3vw, 2.4rem);
  padding-bottom: max(clamp(1.15rem, 3vw, 2.4rem), env(safe-area-inset-bottom));
  background: var(--panel);
  backdrop-filter: blur(16px);
  border-left: 1px solid rgba(20, 33, 43, 0.08);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  animation: panelIn 0.55s var(--ease);
}
@keyframes panelIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
.panel.is-updating { animation: panelPulse 0.45s var(--ease); }
@keyframes panelPulse {
  0% { opacity: 0.35; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}
.panel-kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.panel h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}
.panel-lead a,
.panel-list a,
.panel-foot a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.panel-lead a:hover,
.panel-list a:hover,
.panel-foot a:hover {
  color: var(--accent);
}
.panel-lead {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.panel-secondary {
  display: block;
  margin-top: 0.65rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-soft);
  opacity: 0.88;
}
.panel-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.panel-list li {
  padding: 0.85rem 0.95rem;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(20,33,43,0.08);
  font-size: 0.95rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.panel-list strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.92rem;
  margin-bottom: 0.15rem;
}
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: auto;
  padding-top: 1rem;
}
.panel-foot {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--ink-soft);
  opacity: 0.75;
}

@media (max-width: 1540px) {
  .brand-text em { display: none; }
}

@media (max-width: 1180px) {
  .hud-link { display: none; }
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.88fr);
  }
}

@media (max-width: 900px) {
  html, body {
    height: auto;
    max-height: none;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: auto;
  }
  .hud {
    position: sticky;
    top: 0;
    z-index: 30;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "stations";
    min-height: 0;
    gap: 0.45rem 0.7rem;
  }
  .brand { grid-area: brand; }
  .hud-meta { display: none; }
  .hud-cta { display: none; }
  .hud-stations {
    grid-area: stations;
    justify-content: flex-start;
    padding-bottom: 0.1rem;
  }
  .workspace {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
  }
  .stage {
    height: calc((100svh - 5.75rem) * 0.49);
    min-height: 13.5rem;
    flex: 0 0 auto;
  }
  .viewport {
    touch-action: pan-y;
  }
  .panel {
    border-left: 0;
    border-top: 1px solid rgba(20, 33, 43, 0.08);
    gap: 0.6rem;
    padding: 1rem 1.05rem 1.15rem;
    padding-bottom: max(1.15rem, env(safe-area-inset-bottom));
    overflow: visible;
    min-height: auto;
    flex: 0 0 auto;
  }
  .panel h1 {
    font-size: clamp(1.28rem, 5.5vw, 1.75rem);
  }
  .panel-lead {
    font-size: 0.94rem;
    line-height: 1.5;
  }
  .panel-list li {
    padding: 0.65rem 0.75rem;
    font-size: 0.88rem;
  }
  .panel-actions {
    padding-top: 0.35rem;
  }
  .panel-actions .btn {
    flex: 1 1 8.5rem;
  }
  .scan-page {
    --scan-left: 50%;
    --scan-top: 48%;
    --scan-tx: -58%;
    --scan-ty: -36%;
    --scan-rot: -2deg;
    --scan-scale: 0.94;
    height: 92%;
    max-width: none;
  }
  .scan-scene.is-visible .scan-page {
    --scan-scale: 0.98;
  }
  .scan-hand {
    width: 32%;
    min-width: 6.75rem;
    max-width: 9.5rem;
  }
  .phone-overlay.is-visible .phone-overlay__device {
    width: min(17rem, 58%, calc(88% * 9 / 19.5));
  }
  .phone-overlay.is-visible .phone-overlay__device.is-landscape {
    width: min(34rem, 92%);
  }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 640px) {
  html, body {
    height: 100svh;
    max-height: 100svh;
    overflow: hidden;
    overscroll-behavior: none;
  }
  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.92fr);
    grid-template-rows: minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    height: auto;
  }
  .stage {
    height: auto;
    min-height: 0;
    flex: none;
  }
  .viewport {
    touch-action: none;
  }
  .panel {
    overflow: auto;
    min-height: 0;
    border-top: 0;
    border-left: 1px solid rgba(20, 33, 43, 0.08);
  }
}

@media (max-width: 640px) {
  .brand-text strong {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .station-btn {
    height: 2.05rem;
    padding: 0 0.72rem;
    font-size: 0.72rem;
  }
}

@media (max-height: 500px) {
  .hud {
    min-height: 0;
    padding-top: max(0.28rem, env(safe-area-inset-top));
    padding-bottom: 0.28rem;
  }
  .station-btn { height: 1.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .floater, .window-light, .igeo-logo.is-loading .igeo-logo__svg,
  .pupil.is-walking .pupil-figure, .pupil.is-drawing .pupil-arm,
  .pupil.is-drawing .pupil-pencil, .desk-cluster.is-occupied .desk-scribble,
  .pupil.is-on-chair .pupil-arm, .pupil.is-on-chair .pupil-pencil,
  .pupil.is-on-chair .pupil-tool, .pupil.is-on-chair.is-cheering .pupil-arm,
  .pupil.is-on-chair.is-cheering .pupil-arm-raise,
  .desk-heart.is-on {
    animation: none !important;
  }
  .camera, .pupil, .station-btn, .panel, .chair3, .teacher { transition: none !important; }
  .teacher.is-pacing .teacher-figure,
  .teacher.is-waving .teacher-arm--l,
  .teacher.is-waving .teacher-arm--r,
  .teacher.is-talking .teacher-bubble.is-pop,
  .play-btn, .play-btn__pulse,
  .phone-overlay__device,
  .scan-scene, .scan-page, .scan-hand, .scan-hand__motion, .scan-page__qr-halo,
  .scan-phone__beam, .scan-phone__result { transition: none !important; animation: none !important; }
}

