/* ═══════════════════════════════════════════════════════════════════════
   BENCH 9 — the shell: student slip, title gate, touchable menu, subject
   doors, chemistry hub, settings. Everything is a paper cutout laid on the
   painted bench: hard edges, stepped entrances, one shadow per sheet.
   Loaded after game.css, which still owns the bench itself.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --paper-edge: rgba(23, 19, 16, 0.28);
  --cut: 0 1px 0 rgba(255, 248, 232, 0.5) inset, 0 14px 28px -16px rgba(0, 0, 0, 0.85);
  --cut-dark: 0 1px 0 rgba(255, 244, 222, 0.06) inset, 0 18px 34px -20px #000;
}

/* ─────────────────────────────────────────── living background · ambience ── */

.title-art,
.title-shade {
  pointer-events: none;
}

.title-art {
  transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.title-screen.is-entered .title-art {
  transform: scale(1.028);
}

.motes {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: screen;
}

.motes i {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255, 231, 186, 0.75);
  box-shadow: 0 0 9px rgba(255, 211, 146, 0.55);
  animation: mote-drift steps(14) infinite;
}

@keyframes mote-drift {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  15% { opacity: 0.85; }
  80% { opacity: 0.35; }
  100% { transform: translate3d(42px, -70px, 0); opacity: 0; }
}

/* The window light breathes, very slowly, like a room with someone in it. */
.title-shade::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(58% 44% at 58% 40%, rgba(255, 226, 173, 0.1), transparent 70%);
  animation: light-breathe 11s steps(24) infinite alternate;
}

@keyframes light-breathe {
  from { opacity: 0.45; }
  to { opacity: 0.95; }
}

.title-top {
  z-index: 12;
}

.title-top-who {
  padding-left: 14px;
  border-left: 1px solid rgba(244, 233, 211, 0.18);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(236, 183, 92, 0.66);
}

.title-top-sound {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(244, 233, 211, 0.16);
  background: rgba(10, 12, 16, 0.35);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: rgba(244, 233, 211, 0.62);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}

.title-top-sound:hover { color: var(--gold); border-color: rgba(236, 183, 92, 0.5); }
.title-top-sound .menu-eq { height: 8px; }
.title-top-sound[data-muted="1"] .menu-eq i { animation: none; transform: scaleY(0.3); opacity: 0.3; }

/* ───────────────────────────────────────────────── STEP 1 · the gate ── */

.gate {
  position: absolute;
  left: clamp(24px, 7vw, 118px);
  top: 50%;
  z-index: 6;
  width: min(760px, 82vw);
  transform: translateY(-50%);
  pointer-events: none;
}

.gate-kick {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(236, 183, 92, 0.86);
  animation: gate-line 0.7s steps(3) both;
}

.gate-logo {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(76px, 15vw, 210px);
  line-height: 0.78;
  letter-spacing: -0.04em;
  color: #f9efdb;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.3), 0 30px 70px rgba(0, 0, 0, 0.7);
  animation: gate-logo 0.9s steps(5) both;
}

.gate-nine {
  display: inline-block;
  margin-left: 0.03em;
  color: var(--red);
  transform: translateY(-0.04em) rotate(-3deg);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
}

.gate-tag {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(16px, 1.7vw, 23px);
  color: rgba(244, 233, 211, 0.78);
  animation: gate-line 0.7s 0.25s steps(3) both;
}

.gate-assign {
  margin: 26px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(244, 233, 211, 0.16);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(244, 233, 211, 0.58);
  animation: gate-line 0.7s 0.4s steps(3) both;
}

.gate-assign b {
  font-weight: 500;
  color: #f7ecd5;
}

.gate-press {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin: 34px 0 0;
  padding: 11px 16px 10px;
  border: 1px solid rgba(244, 233, 211, 0.24);
  background: rgba(11, 13, 17, 0.5);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.26em;
  color: rgba(248, 238, 217, 0.86);
  animation: gate-line 0.7s 0.55s steps(3) both, gate-pulse 3.2s 1.6s steps(6) infinite;
  cursor: pointer;
  pointer-events: auto;
}

.gate-press i {
  width: 6px;
  height: 6px;
  background: var(--red);
  box-shadow: 0 0 10px rgba(210, 74, 62, 0.8);
}

@keyframes gate-logo {
  from { opacity: 0; transform: translateY(18px); filter: blur(7px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes gate-line {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes gate-pulse {
  0%, 100% { border-color: rgba(244, 233, 211, 0.2); }
  50% { border-color: rgba(236, 183, 92, 0.62); }
}

/* ───────────────────────────────────────────────── STEP 2 · the menu ── */

.menu-stage {
  position: absolute;
  inset: 0;
  z-index: 5;
  animation: stage-in 0.5s steps(4) both;
}

@keyframes stage-in {
  from { opacity: 0; transform: scale(1.014); }
  to { opacity: 1; transform: none; }
}

.title-left {
  position: absolute;
  left: clamp(18px, 5vw, 76px);
  bottom: clamp(64px, 9vh, 104px);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.4vh, 30px);
  width: min(600px, 52vw);
}

.title-block {
  position: relative;
  left: auto;
  bottom: auto;
  max-width: 100%;
}

.title-kicker {
  margin: 0 0 0.55rem;
  font-size: 9.5px;
  letter-spacing: 0.22em;
}

.title-logo {
  font-size: clamp(58px, 8.4vw, 128px);
  line-height: 0.8;
}

.title-tag {
  margin: 0.55rem 0 0;
  font-size: clamp(13px, 1.25vw, 18px);
}

.title-hello {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(236, 183, 92, 0.72);
}

.title-hello b { font-weight: 500; color: #f6e9cd; }

/* The stamp belongs to the cover, not to the window behind it. */
.stamp {
  position: static;
  display: inline-block;
  margin: 12px 0 0 2px;
  width: 108px;
  padding: 6px 0 5px;
  font-size: 8.5px;
  line-height: 1.45;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transform: rotate(-2deg);
  opacity: 1;
  animation: none;
}

.menu {
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.menu::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(236, 183, 92, 0.46), rgba(236, 183, 92, 0));
}

.menu-item {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 11px 30px 11px 14px;
  border: 0;
  border-bottom: 1px solid rgba(244, 233, 211, 0.075);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: rgba(244, 233, 211, 0.74);
  transform: none;
  transition: color 0.18s, background 0.22s;
  animation: cut-in 0.42s steps(3) both;
}

.menu-item:nth-of-type(1) { animation-delay: 0.1s; }
.menu-item:nth-of-type(2) { animation-delay: 0.18s; }
.menu-item:nth-of-type(3) { animation-delay: 0.26s; }
.menu-item:nth-of-type(4) { animation-delay: 0.34s; }

@keyframes cut-in {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: none; }
}

.menu-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 0;
  background: var(--gold);
  transform: translateY(-50%);
  transition: height 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.menu-item::after {
  content: "→";
  position: absolute;
  right: 10px;
  top: 50%;
  opacity: 0;
  color: var(--gold);
  font-size: 13px;
  transform: translate(-5px, -50%);
  transition: opacity 0.18s, transform 0.22s;
}

.menu-item:hover,
.menu-item:focus-visible {
  outline: none;
  color: #fff8ea;
  background: linear-gradient(90deg, rgba(163, 35, 28, 0.34), rgba(163, 35, 28, 0) 82%);
  transform: none;
}

.menu-item:hover::before,
.menu-item:focus-visible::before { height: 62%; }

.menu-item:hover::after,
.menu-item:focus-visible::after { opacity: 0.95; transform: translate(0, -50%); }

.menu-item:last-of-type { border-bottom: 0; }

.menu-no {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: rgba(236, 183, 92, 0.5);
}

.menu-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.menu-label {
  font-family: var(--serif);
  font-size: clamp(19px, 1.9vw, 25px);
  line-height: 1.08;
  color: #f2e6cf;
}

.menu-hint {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(244, 233, 211, 0.36);
  opacity: 1;
  transform: none;
  transition: color 0.18s;
}

.menu-item:hover .menu-hint,
.menu-item:focus-visible .menu-hint { color: rgba(236, 183, 92, 0.72); }

.menu-item.is-live .menu-hint::before { content: "● "; color: var(--gold); }
.menu-item.is-live .menu-no { color: var(--gold); }

/* The first door is the one that is open. */
.menu-item:first-child .menu-label {
  font-size: clamp(24px, 2.5vw, 33px);
  color: #fff7e7;
}

.menu-item:first-child .menu-no { color: var(--gold); }
.menu-item:first-child .menu-hint { color: rgba(236, 183, 92, 0.62); }

.menu-minor { padding-top: 9px; padding-bottom: 9px; }
.menu-minor .menu-label { font-size: 16px; color: rgba(244, 233, 211, 0.6); }
.menu-minor .menu-hint { font-size: 8px; }

.menu-go { display: none; }

.menu-last {
  margin: 12px 0 0 14px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(236, 183, 92, 0.52);
}

.menu-last b { font-weight: 500; color: rgba(244, 233, 211, 0.82); }

/* Three bars that breathe only while the room is audible. */
.menu-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.menu-eq i {
  width: 2px;
  background: var(--gold);
  opacity: 0.8;
  transform-origin: bottom;
  animation: eq 1.15s steps(4) infinite;
}

.menu-eq i:nth-child(1) { height: 4px; animation-delay: 0s; }
.menu-eq i:nth-child(2) { height: 9px; animation-delay: 0.18s; }
.menu-eq i:nth-child(3) { height: 6px; animation-delay: 0.36s; }

@keyframes eq {
  0%, 100% { transform: scaleY(0.55); }
  50% { transform: scaleY(1); }
}

.menu[data-muted="1"] .menu-eq i {
  animation: none;
  transform: scaleY(0.35);
  opacity: 0.28;
}

/* ─────────────────────────────────────────────────────────── Nair ── */

.nair-menu {
  position: absolute;
  right: clamp(0px, 2.2vw, 40px);
  bottom: clamp(50px, 7vh, 76px);
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  width: min(430px, 34vw);
  pointer-events: none;
}

.nair-quip {
  position: relative;
  width: min(304px, 30vw);
  margin-right: clamp(24px, 6vw, 92px);
  padding: 11px 15px 12px;
  background: linear-gradient(176deg, #f8efdc, #e9d8bb);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 16px 30px -16px rgba(0, 0, 0, 0.9);
  border-left: 3px solid var(--red);
  transform: rotate(-1.4deg);
  pointer-events: auto;
  animation: quip-in 0.36s steps(3) both;
}

.nair-quip::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: #e9d8bb;
  border-right: 3px solid var(--red);
  transform: rotate(45deg) skew(6deg, 6deg);
}

.nair-quip-k {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.22em;
  color: rgba(163, 35, 28, 0.85);
}

.nair-quip-line {
  margin: 0;
  font-family: var(--serif);
  font-size: 13.5px;
  line-height: 1.4;
  color: #2c241d;
}

.nair-quip.is-new { animation: quip-in 0.36s steps(3) both; }

@keyframes quip-in {
  from { opacity: 0; transform: translateY(6px) rotate(-3deg); }
  to { opacity: 1; transform: rotate(-1.4deg); }
}

.nair-figure {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.75));
  animation: nair-step 0.55s steps(4) both;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes nair-step {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.nair-figure:hover { transform: translateY(-3px); }
.nair-figure:focus-visible { outline: 2px solid rgba(236, 183, 92, 0.7); outline-offset: 4px; }

.nair-figure img {
  display: block;
  width: 100%;
  height: clamp(250px, 46vh, 470px);
  object-fit: contain;
  object-position: bottom;
}

/* Pupils over the painted ones, moved a few pixels by the pointer. */
.nair-eyes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  --ex: 0;
  --ey: 0;
}

.nair-eyes i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(20, 14, 10, 0.9);
  opacity: 0.4;
  transform: translate(calc(var(--ex) * 2.6px), calc(var(--ey) * 1.9px));
  transition: transform 0.16s ease-out;
}

.nair-eyes i:nth-child(1) { left: 41%; top: 27.5%; }
.nair-eyes i:nth-child(2) { left: 56.5%; top: 26.8%; }

.nair-figure.is-blink .nair-eyes { animation: nair-blink 0.36s steps(3) 1; }

@keyframes nair-blink {
  0%, 100% { opacity: 1; }
  40% { opacity: 0; }
}

/* ───────────────────────────────────────────── the things on the desk ── */

/* The resume row, when a paper is still standing on the bench. */
.menu-continue {
  margin-bottom: 6px;
  background: linear-gradient(90deg, rgba(236, 183, 92, 0.14), rgba(236, 183, 92, 0) 78%);
  border-left: 2px solid var(--gold);
}

.menu-continue .menu-no { color: var(--gold); }
.menu-continue .menu-hint { color: rgba(236, 183, 92, 0.7); }

.nair-figure img.is-swap { animation: face-cut 0.22s steps(2) 1; }

@keyframes face-cut {
  0% { opacity: 0.4; transform: translateY(2px); }
  100% { opacity: 1; transform: none; }
}

.desk {
  position: absolute;
  left: clamp(42%, 46vw, 50%);
  bottom: clamp(62px, 9vh, 96px);
  z-index: 6;
  display: flex;
  align-items: flex-end;
  gap: clamp(4px, 1.2vw, 18px);
}

.prop {
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.6));
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), filter 0.22s;
  animation: prop-in 0.5s steps(4) both;
}

.prop:nth-child(2) { animation-delay: 0.09s; }
.prop:nth-child(3) { animation-delay: 0.16s; }

@keyframes prop-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.prop:hover,
.prop:focus-visible {
  outline: none;
  transform: translateY(-6px) rotate(-1deg);
  filter: drop-shadow(0 20px 22px rgba(0, 0, 0, 0.7)) brightness(1.08);
}

.prop img { display: block; height: auto; }
.prop-flask img { width: clamp(58px, 6.4vw, 92px); }
.prop-burette img { width: clamp(28px, 3vw, 44px); }
.prop-reagent img { width: clamp(44px, 4.8vw, 68px); }

.prop-label {
  position: absolute;
  left: 50%;
  bottom: -16px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.18em;
  color: rgba(244, 233, 211, 0.0);
  white-space: nowrap;
  transition: color 0.2s;
}

.prop:hover .prop-label,
.prop:focus-visible .prop-label { color: rgba(236, 183, 92, 0.8); }

.prop-flask.is-swirl img { animation: flask-swirl 0.9s steps(5) 1; }

@keyframes flask-swirl {
  0% { transform: rotate(0deg); }
  20% { transform: rotate(-7deg); }
  40% { transform: rotate(6deg); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(2deg); }
  100% { transform: rotate(0deg); }
}

.prop-flask.is-swirl::before {
  content: "";
  position: absolute;
  inset: 12% 8% 30%;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, rgba(226, 118, 152, 0.75), rgba(190, 48, 96, 0) 68%);
  animation: swirl-glow 0.9s steps(5) 1;
  pointer-events: none;
}

@keyframes swirl-glow {
  0%, 100% { opacity: 0; transform: scale(0.7); }
  40% { opacity: 0.9; transform: scale(1); }
}

.drop {
  position: absolute;
  left: 50%;
  top: 62%;
  width: 5px;
  height: 8px;
  border-radius: 50% 50% 60% 60%;
  background: rgba(196, 90, 140, 0.95);
  opacity: 0;
  pointer-events: none;
}

.prop-burette.is-drop .drop { animation: one-drop 0.7s steps(5) 1; }

@keyframes one-drop {
  0% { opacity: 0; transform: translate(-50%, 0) scaleY(0.6); }
  20% { opacity: 1; }
  80% { opacity: 1; transform: translate(-50%, 42px) scaleY(1.1); }
  100% { opacity: 0; transform: translate(-50%, 52px) scaleY(0.7); }
}

.prop-reagent.is-tap img { animation: reagent-tap 0.4s steps(3) 1; }

@keyframes reagent-tap {
  0%, 100% { transform: rotate(0); }
  40% { transform: rotate(-4deg); }
}

/* The marked file only appears once a paper earned it. */
.prop-notebook {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 6px;
  padding: 9px 12px 8px;
  background: linear-gradient(168deg, #f7eeda, #e5d3b2);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 16px 26px -14px #000;
  transform: rotate(1.6deg);
  animation: notebook-in 0.6s steps(4) both;
}

@keyframes notebook-in {
  from { opacity: 0; transform: translateY(12px) rotate(6deg); }
  to { opacity: 1; transform: rotate(1.6deg); }
}

.notebook-k {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.2em;
  color: rgba(23, 19, 16, 0.55);
}

.prop-notebook b {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  color: var(--red-deep);
}

.notebook-stamp {
  position: absolute;
  right: -8px;
  top: -8px;
  padding: 3px 5px;
  border: 1.5px solid rgba(163, 35, 28, 0.8);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.14em;
  color: rgba(163, 35, 28, 0.85);
  background: rgba(247, 238, 218, 0.9);
  transform: rotate(-8deg);
}

.prop-notebook.is-glow::after {
  content: "";
  position: absolute;
  inset: -18px;
  background: radial-gradient(circle, rgba(232, 146, 178, 0.35), transparent 68%);
  pointer-events: none;
  animation: light-breathe 4s steps(8) infinite alternate;
}

/* ───────────────────────────────────────────── screens: paper on a desk ── */

.screen {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 4.4vw, 58px) clamp(18px, 5vw, 76px) 64px;
  overflow-y: auto;
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(12, 14, 18, 0.3), rgba(6, 8, 11, 0.82) 74%),
    linear-gradient(180deg, rgba(6, 8, 11, 0.8), rgba(6, 8, 11, 0.9));
  backdrop-filter: blur(3px) saturate(0.9);
  animation: screen-in 0.42s steps(4) both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.screen-head { position: relative; }

.crumb {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: rgba(236, 183, 92, 0.68);
  cursor: pointer;
}

.crumb:hover { color: var(--gold); }

.screen-k {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  color: rgba(236, 183, 92, 0.62);
}

.screen-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: #f8eed9;
}

.screen-line {
  max-width: 62ch;
  margin: 12px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(244, 233, 211, 0.62);
}

.screen-foot {
  margin: 22px 0 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(244, 233, 211, 0.12);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 233, 211, 0.36);
}

/* ─────────────────────────────────────────────── STEP 3 · subject doors ── */

.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  gap: clamp(16px, 2.6vw, 34px);
  flex: 1 1 auto;
  width: min(1080px, 100%);
  margin: clamp(20px, 4vh, 44px) 0 0;
  min-height: 0;
}

.subject-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: clamp(260px, 38vh, 360px);
  padding: clamp(20px, 2.6vw, 32px);
  border: 0;
  background: linear-gradient(168deg, #f8efdc 0%, #ecdcbd 78%, #e2cfa9 100%);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.55) inset, 0 26px 46px -22px #000;
  transform: rotate(-0.5deg);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s;
  animation: card-in 0.5s steps(4) both;
}

.subject-card:nth-child(2) { transform: rotate(0.6deg); animation-delay: 0.1s; }

.subject-card::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(23, 19, 16, 0.14);
  pointer-events: none;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(16px) rotate(-2deg); }
  to { opacity: 1; }
}

.subject-card.is-open:hover,
.subject-card.is-open:focus-visible {
  outline: none;
  transform: translateY(-6px) rotate(-0.2deg);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.55) inset, 0 34px 54px -22px #000;
}

.subject-no {
  position: relative;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(23, 19, 16, 0.42);
}

.subject-art {
  position: absolute;
  right: clamp(10px, 2vw, 26px);
  top: clamp(14px, 2vw, 26px);
  display: block;
  opacity: 0.92;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.subject-art img { display: block; width: clamp(64px, 8vw, 104px); height: auto; }
.subject-card.is-open:hover .subject-art { transform: translateY(-6px) rotate(-4deg); }

.subject-name {
  position: relative;
  margin-top: auto;
  font-family: var(--serif);
  font-size: clamp(30px, 3.6vw, 46px);
  line-height: 1;
  color: var(--ink);
}

.subject-code {
  position: relative;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: rgba(163, 35, 28, 0.78);
}

.subject-line {
  position: relative;
  max-width: 34ch;
  margin-top: 10px;
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  line-height: 1.45;
  color: #4a3f34;
}

.subject-state {
  position: relative;
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px dashed rgba(23, 19, 16, 0.24);
  width: 100%;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: rgba(23, 19, 16, 0.58);
}

.subject-card.is-open .subject-state { color: var(--red-deep); }

/* The closed door. */
.subject-card.is-locked {
  background: linear-gradient(168deg, #ded3bd 0%, #cbbda2 100%);
  filter: saturate(0.55);
  cursor: not-allowed;
}

.subject-card.is-locked .subject-art img { filter: grayscale(0.7) contrast(0.9); }
.subject-card.is-locked .subject-name { color: rgba(23, 19, 16, 0.62); }
.subject-card.is-locked .subject-code,
.subject-card.is-locked .subject-line { color: rgba(23, 19, 16, 0.44); }

.locked-stamp {
  position: relative;
  display: inline-block;
  margin-top: 12px;
  padding: 6px 9px 5px;
  border: 2px solid rgba(163, 35, 28, 0.78);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.35;
  letter-spacing: 0.14em;
  text-align: center;
  color: rgba(163, 35, 28, 0.86);
  transform: rotate(-3.5deg);
}

.subject-card.is-locked .locked-stamp {
  position: absolute;
  right: clamp(18px, 3vw, 38px);
  bottom: clamp(58px, 8vw, 88px);
  font-size: 10px;
  padding: 9px 12px 7px;
  background: rgba(222, 211, 189, 0.55);
}

.subject-card.is-shake { animation: shake 0.16s steps(2) 2; }

@keyframes shake {
  0% { transform: translateX(0) rotate(0.6deg); }
  50% { transform: translateX(-5px) rotate(0.9deg); }
  100% { transform: translateX(4px) rotate(0.3deg); }
}

.locked-tip {
  position: absolute;
  left: clamp(18px, 2.4vw, 30px);
  right: clamp(18px, 2.4vw, 30px);
  bottom: clamp(14px, 2vw, 22px);
  padding: 8px 10px;
  background: rgba(23, 19, 16, 0.9);
  color: #f3e5c8;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.subject-card.is-tip .locked-tip { opacity: 1; transform: none; }

/* ────────────────────────────────────────────── STEP 4 · chemistry hub ── */

.hub-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.hub-who {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(236, 183, 92, 0.6);
}

.hub-tabs {
  display: flex;
  gap: 0;
  width: min(820px, 100%);
  margin: clamp(18px, 3.4vh, 32px) 0 0;
  border-bottom: 1px solid rgba(244, 233, 211, 0.14);
}

.hub-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 16px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: rgba(244, 233, 211, 0.5);
  transition: color 0.18s, border-color 0.18s;
}

.hub-tab b {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 18px;
  color: #f2e6cf;
}

.hub-tab span {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hub-tab:hover { color: rgba(236, 183, 92, 0.8); }

.hub-tab.is-on {
  color: rgba(236, 183, 92, 0.9);
  border-bottom-color: var(--gold);
}

.hub-tab.is-on b { color: #fff8ea; }

.hub-panel {
  width: min(980px, 100%);
  margin-top: clamp(16px, 2.6vh, 26px);
  animation: panel-in 0.34s steps(3) both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.prac {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 15px 18px 15px 14px;
  margin-bottom: 8px;
  background: rgba(244, 233, 211, 0.045);
  border-left: 2px solid rgba(236, 183, 92, 0.2);
  transition: background 0.2s, border-color 0.2s;
}

.prac:hover { background: rgba(244, 233, 211, 0.075); }

.prac.is-open {
  background: linear-gradient(90deg, rgba(163, 35, 28, 0.22), rgba(244, 233, 211, 0.04) 70%);
  border-left-color: var(--gold);
}

.prac-no {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: rgba(236, 183, 92, 0.55);
}

.prac-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(17px, 1.8vw, 22px);
  line-height: 1.2;
  color: #f6ead3;
}

.prac-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: rgba(244, 233, 211, 0.5);
}

.prac-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(236, 183, 92, 0.6);
}

.prac-tags .own { color: #f0c078; }

.prac-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.prac-state {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 233, 211, 0.4);
  white-space: nowrap;
}

.prac.is-open .prac-state { color: var(--gold); }

.prac-play {
  padding: 8px 13px;
  border: 1px solid var(--red-deep);
  background: var(--red-deep);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f8eed9;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}

.prac-play:hover { background: #8d1a14; transform: translateY(-1px); }

.prac.is-locked { opacity: 0.58; }

.prac .locked-stamp {
  margin: 0;
  border-color: rgba(236, 183, 92, 0.42);
  color: rgba(236, 183, 92, 0.88);
  background: rgba(236, 183, 92, 0.05);
  transform: rotate(-2deg);
  font-size: 7.5px;
  letter-spacing: 0.12em;
  padding: 5px 7px;
  white-space: nowrap;
}

.prac.is-shake { animation: prac-shake 0.16s steps(2) 2; }

@keyframes prac-shake {
  0% { transform: translateX(0); }
  50% { transform: translateX(-4px); }
  100% { transform: translateX(3px); }
}

/* Mock exam */
.exam-card {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(16px, 3vw, 34px);
  padding: clamp(20px, 3vw, 32px);
  background: linear-gradient(168deg, #f8efdc, #ead9b9);
  color: var(--ink);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.55) inset, 0 26px 46px -22px #000;
  transform: rotate(-0.3deg);
}

.exam-k {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.24em;
  color: rgba(163, 35, 28, 0.8);
}

.exam-title {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.05;
}

.exam-line { margin: 0; font-size: 14px; line-height: 1.55; color: #43382e; }
.exam-note {
  margin: 16px 0 0;
  padding-top: 10px;
  border-top: 1px dashed rgba(23, 19, 16, 0.22);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(23, 19, 16, 0.5);
}

.exam-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  padding-left: clamp(0px, 2vw, 24px);
  border-left: 1px dashed rgba(23, 19, 16, 0.24);
}

.exam-side .locked-stamp {
  position: static;
  font-size: 10px;
  padding: 9px 12px 7px;
  background: rgba(248, 239, 220, 0.5);
}

.exam-side-line {
  margin: 0;
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  line-height: 1.45;
  color: #4a3f34;
}

/* Resources */
.res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.res-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 130px;
  padding: 16px;
  border: 0;
  background: rgba(244, 233, 211, 0.055);
  border-top: 2px solid rgba(236, 183, 92, 0.28);
  text-align: left;
  cursor: pointer;
  color: #f4e9d3;
  transition: background 0.2s, transform 0.2s;
}

.res-card:hover { background: rgba(244, 233, 211, 0.09); transform: translateY(-2px); }

.res-k {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(236, 183, 92, 0.7);
}

.res-title {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.15;
}

.res-line { font-size: 12px; line-height: 1.45; color: rgba(244, 233, 211, 0.52); }

.res-card { min-height: 176px; }

.res-card .locked-stamp {
  margin-top: auto;
  border-color: rgba(236, 183, 92, 0.42);
  color: rgba(236, 183, 92, 0.9);
  background: rgba(236, 183, 92, 0.05);
  font-size: 7.5px;
  letter-spacing: 0.12em;
  padding: 5px 7px;
  white-space: nowrap;
}
.res-card.is-shake { animation: prac-shake 0.16s steps(2) 2; }

/* Molarity calculator, shown in the same slot as a resource. */
.calc {
  display: grid;
  gap: 12px;
  padding: clamp(18px, 3vw, 26px);
  background: linear-gradient(168deg, #f8efdc, #ead9b9);
  color: var(--ink);
  box-shadow: 0 24px 44px -22px #000;
  animation: panel-in 0.3s steps(3) both;
}

.calc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.calc-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 24px; }
.calc-formula { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.12em; color: rgba(163, 35, 28, 0.75); }
.calc-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }

.calc-field { display: flex; flex-direction: column; gap: 4px; }
.calc-field span { font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em; color: rgba(23, 19, 16, 0.55); }
.calc-field input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid rgba(23, 19, 16, 0.28);
  background: rgba(255, 252, 244, 0.6);
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}
.calc-field input:focus { outline: none; border-color: var(--red-deep); }

.calc-out {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(23, 19, 16, 0.25);
}
.calc-out b { font-family: var(--serif); font-size: 30px; font-weight: 400; color: var(--red-deep); }
.calc-out span { font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em; color: rgba(23, 19, 16, 0.55); }

.calc-note { margin: 0; font-size: 11.5px; line-height: 1.5; color: rgba(23, 19, 16, 0.6); }
.calc-close {
  justify-self: start;
  align-self: start;
  padding: 7px 11px;
  border: 1px solid rgba(23, 19, 16, 0.35);
  background: transparent;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

/* ───────────────────────────────────────────────── STEP 0 · the slip ── */

.roll {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5, 7, 10, 0.42);
  backdrop-filter: blur(5px) saturate(0.92) brightness(1.06);
  animation: fade-in 0.28s both;
  overflow-y: auto;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.roll-card {
  position: relative;
  width: min(504px, 100%);
  margin: auto;
  padding: 28px 30px 24px;
  color: var(--ink);
  background: linear-gradient(170deg, #f8f0dd, #eddfc2);
  border: 1px solid rgba(23, 19, 16, 0.32);
  box-shadow: 0 30px 70px -22px #000;
  animation: roll-in 0.42s steps(3) both;
}

@keyframes roll-in {
  from { opacity: 0; transform: translateY(14px) rotate(-0.35deg); }
  to { opacity: 1; transform: none; }
}

.roll-card::before {
  content: "";
  position: absolute;
  inset: 10px 10px 10px 46px;
  border-left: 1px solid rgba(163, 35, 28, 0.32);
  pointer-events: none;
}

.roll-perforation {
  position: absolute;
  left: 18px;
  top: 14px;
  bottom: 14px;
  width: 10px;
  background-image: radial-gradient(circle at 50% 50%, rgba(23, 19, 16, 0.22) 2px, transparent 2.4px);
  background-size: 10px 14px;
  opacity: 0.7;
}

.roll-k {
  position: relative;
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.24em;
  color: rgba(163, 35, 28, 0.85);
}

.roll-title {
  position: relative;
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.05;
  color: var(--ink);
}

.roll-line {
  position: relative;
  margin: 0 0 16px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  color: #4a3f34;
}

.roll-fields {
  position: relative;
  display: flex;
  flex-direction: column;
}

.roll-field {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 0 5px;
  border-bottom: 1px solid rgba(23, 19, 16, 0.26);
}

.roll-field span,
.roll-class legend,
.roll-audio legend {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: rgba(23, 19, 16, 0.55);
}

.roll-field input {
  width: 100%;
  padding: 2px 0;
  border: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: 19px;
  color: var(--ink);
}

.roll-field input::placeholder {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: rgba(23, 19, 16, 0.28);
}

.roll-field input:focus { outline: none; }
.roll-field:focus-within { border-bottom-color: var(--red); }

.roll-class,
.roll-audio {
  position: relative;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.roll-class legend,
.roll-audio legend { margin-bottom: 8px; }

.roll-class { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.roll-class legend { flex-basis: 100%; }

.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }

.chip span {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid rgba(23, 19, 16, 0.3);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(23, 19, 16, 0.62);
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.chip input:checked + span {
  background: var(--red-deep);
  border-color: var(--red-deep);
  color: #f8eed9;
}

.chip input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }

.roll-audio .vibe {
  display: block;
  margin-bottom: 7px;
  cursor: pointer;
}

.roll-audio .vibe input { position: absolute; opacity: 0; pointer-events: none; }

.vibe-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border: 1px solid rgba(23, 19, 16, 0.22);
  background: rgba(255, 251, 241, 0.28);
  transition: border-color 0.18s, background 0.18s;
}

.vibe-name {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
}

.vibe-line {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  color: rgba(23, 19, 16, 0.52);
}

.vibe input:checked + .vibe-body {
  border-color: var(--red-deep);
  background: rgba(163, 35, 28, 0.07);
}

.vibe input:focus-visible + .vibe-body { outline: 2px solid var(--red); outline-offset: 2px; }

.roll-error {
  position: relative;
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--red-deep);
}

.roll-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.roll-actions .btn {
  padding: 10px 16px;
  border: 1px solid rgba(23, 19, 16, 0.35);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: none;
  cursor: pointer;
}

.roll-actions .btn { flex: 0 0 auto; white-space: nowrap; }

.roll-actions .btn-primary {
  border-color: var(--red-deep);
  background: var(--red-deep);
  color: #f8eed9;
}

.roll-actions .btn-primary:hover { background: #8d1a14; border-color: #8d1a14; }
.roll-actions .btn[disabled] { opacity: 0.55; cursor: progress; }

.roll-guest {
  font-family: var(--serif);
  font-size: 11px;
  font-style: italic;
  line-height: 1.35;
  color: rgba(23, 19, 16, 0.52);
}

.roll-note {
  position: relative;
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  line-height: 1.55;
  color: rgba(23, 19, 16, 0.45);
}

/* ──────────────────────────────────────────────────────── settings ── */

.sheet {
  position: absolute;
  inset: 0;
  z-index: 26;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 7, 10, 0.66);
  backdrop-filter: blur(6px);
  animation: fade-in 0.22s both;
  overflow-y: auto;
}

.sheet-card {
  position: relative;
  width: min(470px, 100%);
  margin: auto;
  padding: 26px 28px 24px;
  background: linear-gradient(170deg, #f8f0dd, #eddfc2);
  color: var(--ink);
  box-shadow: 0 30px 70px -22px #000;
  transform: rotate(-0.4deg);
  animation: roll-in 0.34s steps(3) both;
}

.sheet-title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.05;
}

.sheet-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed rgba(23, 19, 16, 0.2);
}

.sheet-block h3 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(163, 35, 28, 0.8);
}

.sheet-hint {
  margin: 7px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: rgba(23, 19, 16, 0.55);
}

.seg { display: flex; border: 1px solid rgba(23, 19, 16, 0.28); }

.seg button {
  flex: 1;
  padding: 8px 6px;
  border: 0;
  border-right: 1px solid rgba(23, 19, 16, 0.18);
  background: transparent;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(23, 19, 16, 0.6);
  cursor: pointer;
}

.seg button:last-child { border-right: 0; }
.seg button.is-on { background: var(--red-deep); color: #f8eed9; }

.slider-row {
  display: grid;
  grid-template-columns: 46px 1fr 30px;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.slider-row span,
.slider-row b {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: rgba(23, 19, 16, 0.58);
}

.slider-row b { text-align: right; }

.slider-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 2px;
  background: rgba(23, 19, 16, 0.3);
  cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--red-deep);
}

.slider-row input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 0;
  border-radius: 50%;
  background: var(--red-deep);
}

.sheet-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.sheet-inline .sheet-hint { margin-top: 4px; }

.toggle {
  flex: 0 0 auto;
  width: 38px;
  height: 20px;
  padding: 2px;
  border: 1px solid rgba(23, 19, 16, 0.35);
  background: rgba(23, 19, 16, 0.08);
  cursor: pointer;
}

.toggle span {
  display: block;
  width: 14px;
  height: 14px;
  background: rgba(23, 19, 16, 0.4);
  transition: transform 0.18s steps(2), background 0.18s;
}

.toggle[aria-pressed="true"] { background: rgba(163, 35, 28, 0.16); border-color: var(--red-deep); }
.toggle[aria-pressed="true"] span { transform: translateX(17px); background: var(--red-deep); }

.signout {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(163, 35, 28, 0.6);
  background: transparent;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red-deep);
  cursor: pointer;
}

.signout:hover { background: rgba(163, 35, 28, 0.08); }

/* ───────────────────────────────────────────────────────── the tip ── */

.tip {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 30;
  max-width: min(560px, 88vw);
  padding: 9px 14px;
  background: rgba(14, 15, 18, 0.92);
  border-left: 2px solid var(--gold);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  color: rgba(246, 235, 213, 0.85);
  transform: translateX(-50%);
  animation: tip-in 0.24s steps(3) both;
}

@keyframes tip-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.press { display: none; }

/* ─────────────────────────────────── the paper's own small print (bench) ── */

.hud-who {
  margin: 3px 0 0;
  max-width: 34vw;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: rgba(236, 183, 92, 0.72);
}

.nair-cost {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 9px 0 0;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(217, 143, 63, 0.8);
  animation: cost-in 0.3s both;
}

.nair-cost b { font-weight: 500; color: #f0bd74; }

@keyframes cost-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.v-student {
  margin: 0 0 3px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(23, 19, 16, 0.6);
}

.rec-student {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(23, 19, 16, 0.55);
}

.viva-item {
  padding: 10px 0 2px;
  border-top: 1px dashed rgba(23, 19, 16, 0.16);
}

.viva-item:first-of-type { border-top: 0; padding-top: 6px; }
.v-viva .viva-item .viva-q { margin-top: 0; }

/* ─────────────────────────────────────────────────────────── counting ── */

@media (max-width: 1180px) {
  .desk { display: none; }
  .nair-menu { width: min(360px, 30vw); }
  .nair-quip { width: min(270px, 26vw); margin-right: 30px; }
}

@media (max-width: 900px) {
  .title-left { width: min(560px, 56vw); }
  .nair-menu { width: 34vw; }
  .nair-quip { width: min(240px, 30vw); margin-right: 12px; }
  .nair-figure img { height: clamp(210px, 34vh, 340px); }
  .exam-card { grid-template-columns: 1fr; }
  .exam-side { padding-left: 0; padding-top: 14px; border-left: 0; border-top: 1px dashed rgba(23, 19, 16, 0.24); }
}

@media (max-height: 780px) {
  .title-left { bottom: 58px; gap: 12px; }
  .title-logo { font-size: clamp(52px, 7vw, 96px); }
  .menu-item { padding: 9px 26px 9px 12px; }
  .menu-item:first-child .menu-label { font-size: clamp(21px, 2.1vw, 27px); }
  .nair-figure img { height: clamp(220px, 40vh, 380px); }
  .nair-quip { padding: 9px 12px 10px; }
  .nair-quip-line { font-size: 12px; }
}

@media (max-height: 650px) {
  .title-tag { display: none; }
  .menu-hint { display: none; }
  .stamp { display: none; }
  .gate-tag { display: none; }
  .gate-press { margin-top: 22px; }
  .title-foot { display: none; }
  .title-left { bottom: 34px; }
}

@media (max-width: 760px) {
  .nair-menu { width: 38vw; right: 4px; bottom: 46px; }
  .nair-quip { display: none; }
  .title-top-sound #top-sound-label { display: none; }
  .title-top-who { display: none; }
  .subject-grid { grid-template-columns: 1fr; }
  .subject-card { min-height: 220px; }
  .hub-tabs { overflow-x: auto; }
  .hub-tab { padding: 9px 11px; flex: 0 0 auto; }
  .prac { grid-template-columns: 26px minmax(0, 1fr); }
  .prac-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; }
  .calc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .title-screen { overflow-y: auto; }
  .gate { left: 18px; top: 44%; width: calc(100% - 36px); }
  .gate-logo { font-size: clamp(64px, 21vw, 120px); }
  .title-left { left: 16px; bottom: 44px; width: calc(100% - 32px); gap: 14px; }
  .title-block { max-width: calc(100% - 8px); }
  .title-logo { font-size: clamp(50px, 17vw, 84px); }
  .menu-hint { display: block; }
  .menu-last { display: none; }
  .stamp { display: none; }
  .nair-menu { display: none; }
  .title-foot { display: none; }
  .screen { padding: 16px 16px 54px; }
  .screen-title { font-size: 34px; }
  .roll { padding: 12px; align-items: flex-start; }
  .roll-card { padding: 22px 18px 18px; margin: 12px auto; }
  .roll-card::before { inset: 8px 8px 8px 26px; }
  .roll-perforation { left: 8px; }
  .sheet { padding: 12px; }
  .sheet-card { padding: 22px 18px 18px; }
  .hub-head { flex-direction: column; align-items: flex-start; }
  .hub-who { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .menu-eq i,
  .motes i,
  .title-shade::after,
  .grain { animation: none; }
  .roll,
  .roll-card,
  .screen,
  .menu-stage,
  .nair-figure,
  .subject-card { animation: none; }
}

body.no-motion .motes,
body.no-motion .dust,
body.no-motion .grain { display: none; }
body.no-motion .title-shade::after { animation: none; }
body.no-motion .title-art { transition: none; }
body.no-motion .title-screen.is-entered .title-art { transform: none; }
body.no-motion .menu-item,
body.no-motion .menu-stage,
body.no-motion .screen,
body.no-motion .subject-card,
body.no-motion .prac,
body.no-motion .nair-figure,
body.no-motion .nair-quip,
body.no-motion .prop,
body.no-motion .prop-notebook,
body.no-motion .gate-logo,
body.no-motion .gate-kick,
body.no-motion .gate-tag,
body.no-motion .gate-assign,
body.no-motion .gate-press { animation: none !important; }
body.no-motion .nair-eyes i { transition: none; }

/* ═══════════════════════════════════════════════════ LAB DIRECTOR BRIEF ═══ */

.brief {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: radial-gradient(120% 100% at 50% 0%, rgba(9, 12, 20, 0.72), rgba(4, 6, 10, 0.94));
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.brief[hidden] {
  display: none;
}
.brief.is-on {
  opacity: 1;
}
.brief-card {
  width: min(760px, 100%);
  max-height: min(88dvh, 760px);
  overflow: auto;
  padding: clamp(20px, 3vw, 34px);
  color: var(--paper-ink, #221b12);
  background:
    linear-gradient(180deg, rgba(255, 252, 242, 0.98), rgba(246, 238, 220, 0.98)),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(80, 60, 30, 0.06) 27px 28px);
  border: 1px solid rgba(90, 62, 26, 0.28);
  box-shadow: 0 2px 0 #cbb994, 0 26px 70px rgba(0, 0, 0, 0.55);
  transform: translateY(14px) rotate(-0.25deg);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.brief.is-on .brief-card {
  transform: translateY(0) rotate(-0.25deg);
}
.brief-kicker {
  margin: 0 0 6px;
  font: 700 10.5px/1.4 var(--mono, ui-monospace, monospace);
  letter-spacing: 0.18em;
  color: #8a5a1f;
}
.brief-title {
  margin: 0 0 6px;
  font: 700 clamp(26px, 3.6vw, 38px)/1.05 var(--serif, Georgia, serif);
  letter-spacing: -0.01em;
}
.brief-sub {
  margin: 0 0 18px;
  font: 500 13.5px/1.55 var(--sans, system-ui, sans-serif);
  color: #5c4a33;
}
.brief-body {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  align-items: start;
}
.brief-say {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(90, 62, 26, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.brief-face {
  width: 96px;
  height: 118px;
  object-fit: cover;
  object-position: 50% 18%;
  filter: saturate(0.9) contrast(1.02);
  border: 1px solid rgba(60, 40, 16, 0.25);
}
.brief-speaker {
  margin: 0 0 6px;
  font: 700 9.5px/1.3 var(--mono, monospace);
  letter-spacing: 0.16em;
  color: #8a5a1f;
}
.brief-line {
  margin: 0;
  font: 500 14.5px/1.6 var(--serif, Georgia, serif);
  font-style: italic;
  color: #2a2116;
}
.brief-facts {
  margin: 0;
  display: grid;
  gap: 1px;
  background: rgba(90, 62, 26, 0.14);
  border: 1px solid rgba(90, 62, 26, 0.14);
}
.brief-facts > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: rgba(255, 253, 245, 0.92);
}
.brief-facts dt {
  font: 700 9.5px/1.4 var(--mono, monospace);
  letter-spacing: 0.12em;
  color: #7d6a4e;
  text-transform: uppercase;
}
.brief-facts dd {
  margin: 0;
  font: 600 12px/1.4 var(--sans, system-ui);
  text-align: right;
}
.brief-faults {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed rgba(90, 62, 26, 0.34);
}
.brief-faults-k {
  margin: 0 0 10px;
  font: 700 9.5px/1.4 var(--mono, monospace);
  letter-spacing: 0.16em;
  color: #9a3c1c;
}
.brief-fault-list {
  display: grid;
  gap: 8px;
}
.brief-fault {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 246, 232, 0.9);
  border: 1px solid rgba(154, 60, 28, 0.28);
  box-shadow: 2px 2px 0 rgba(154, 60, 28, 0.12);
}
.brief-fault.is-fixed {
  border-color: rgba(52, 96, 48, 0.35);
  background: rgba(240, 249, 236, 0.9);
  box-shadow: 2px 2px 0 rgba(52, 96, 48, 0.12);
}
.bf-title {
  margin: 0 0 2px;
  font: 700 12.5px/1.35 var(--sans, system-ui);
}
.bf-symptom {
  margin: 0;
  font: 500 11.5px/1.45 var(--sans, system-ui);
  color: #6b563c;
}
.bf-fix {
  flex: none;
  padding: 7px 12px;
  font: 700 9.5px/1 var(--mono, monospace);
  letter-spacing: 0.12em;
  color: #fff8ea;
  background: #9a3c1c;
  border: 1px solid #6c2912;
  box-shadow: 1px 2px 0 #4d1d0c;
  cursor: pointer;
}
.brief-fault.is-fixed .bf-fix {
  color: #1f3d1b;
  background: #d8ecd0;
  border-color: #7d9c72;
  box-shadow: 1px 2px 0 #a9c29f;
}
.bf-fix:active {
  transform: translateY(1px);
  box-shadow: none;
}
.brief-fault-note {
  margin: 10px 0 0;
  font: 500 11.5px/1.5 var(--sans, system-ui);
  color: #7d6a4e;
}
.brief-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(90, 62, 26, 0.2);
}
.brief-source {
  margin: 0;
  max-width: 40ch;
  font: 500 10.5px/1.5 var(--mono, monospace);
  letter-spacing: 0.03em;
  color: #8a7a63;
}
.brief-foot .go {
  flex: none;
}

/* Tense shifts: the room goes colder without hiding anything. */
.game-screen[data-mood="tense"] .stage-bg img {
  filter: saturate(0.78) contrast(1.08) brightness(0.86);
}
.game-screen[data-mood="tense"] .lamp {
  opacity: 0.75;
  filter: hue-rotate(-12deg);
}
.game-screen[data-mood="tense"] .room-line {
  color: #f0cdbc;
}

/* ══════════════════════════════════════════════════════════ VIVA CHAT ═══ */

.viva-panel {
  padding: 4px 2px 2px;
}
.viva-chat {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding: 12px;
  background: rgba(14, 16, 22, 0.55);
  border: 1px solid rgba(232, 214, 176, 0.18);
}
.viva-turn {
  margin: 0;
  max-width: 92%;
  padding: 9px 11px;
  font: 500 13px/1.55 var(--sans, system-ui);
  color: #f4ead7;
  background: rgba(255, 255, 255, 0.06);
  border-left: 2px solid rgba(232, 214, 176, 0.35);
}
.viva-turn.is-student {
  justify-self: end;
  background: rgba(213, 154, 62, 0.16);
  border-left: 0;
  border-right: 2px solid rgba(232, 190, 110, 0.6);
}
.viva-turn.is-thinking {
  color: #d9c8a8;
  border-left-color: transparent;
  font-style: italic;
}
.viva-who,
.viva-label {
  display: block;
  margin-bottom: 3px;
  font: 700 9px/1.3 var(--mono, monospace);
  letter-spacing: 0.14em;
  color: #d8b273;
}
.viva-turn.is-student .viva-who {
  text-align: right;
}
.viva-dots {
  letter-spacing: 0.3em;
}
.viva-model {
  margin-top: 4px;
  padding: 10px 12px;
  background: rgba(255, 248, 232, 0.06);
  border: 1px dashed rgba(232, 214, 176, 0.28);
}
.viva-model summary {
  cursor: pointer;
  font: 700 10px/1.4 var(--mono, monospace);
  letter-spacing: 0.1em;
  color: #d8b273;
}
.viva-model p {
  margin: 8px 0 0;
  font: 500 12.5px/1.6 var(--sans, system-ui);
  color: #e8dcc6;
}
.viva-form {
  margin-top: 10px;
}
.viva-form-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.viva-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  font: 500 13px/1.4 var(--sans, system-ui);
  color: #f4ead7;
  background: rgba(8, 10, 14, 0.7);
  border: 1px solid rgba(232, 214, 176, 0.28);
}
.viva-form input:focus {
  outline: 2px solid rgba(213, 154, 62, 0.5);
  outline-offset: 1px;
}
.viva-form .go {
  flex: none;
}
.viva-next {
  margin-top: 10px;
}
.viva-next:empty {
  display: none;
}

/* The director's remark sits on the marked paper, above the actions. */
.v-report {
  margin: 16px 0 4px;
  padding: 13px 15px;
  background: rgba(213, 154, 62, 0.1);
  border-left: 3px solid rgba(213, 154, 62, 0.75);
}
.v-report[hidden] {
  display: none;
}
.v-report-k {
  display: block;
  margin-bottom: 5px;
  font: 700 9.5px/1.3 var(--mono, monospace);
  letter-spacing: 0.15em;
  color: #d8b273;
}
.v-report-line {
  margin: 0;
  font: 500 14px/1.6 var(--serif, Georgia, serif);
  font-style: italic;
  color: #f4ead7;
}

@media (max-width: 720px) {
  .brief-body {
    grid-template-columns: 1fr;
  }
  .brief-say {
    grid-template-columns: 72px 1fr;
  }
  .brief-face {
    width: 72px;
    height: 92px;
  }
  .brief-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .brief-foot .go {
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   STEP 1–14: LIGHT, CAMERA, PARTICLES, SPEAKER
   Every visual is driven by data attributes on #stage / #game-screen, set from
   src/client/visuals.ts. With .no-motion the camera and particles stand still.
   ══════════════════════════════════════════════════════════════════════════ */

#stage {
  --light-filter: saturate(0.95) brightness(0.95) contrast(1.05);
  --spot: 0.36;
  --cam-scale: 1;
  --cam-y: 0px;
  transform-origin: 50% 42%;
  transform: scale(var(--cam-scale)) translateY(var(--cam-y));
  transition: transform 900ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}

#stage .stage-bg {
  transition: filter 900ms ease;
  filter: var(--light-filter);
}

/* A radial spotlight that follows the beat, not the pointer. */
#stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(58% 62% at 52% 44%, rgba(255, 236, 196, calc(var(--spot) * 0.34)), transparent 68%),
    radial-gradient(120% 88% at 50% 50%, transparent 52%, rgba(6, 5, 9, calc(0.42 + var(--spot) * 0.3)) 100%);
  transition: background 900ms ease;
}

/* ── particles ──────────────────────────────────────────────────────────── */

.stage-particles {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.stage-particles i {
  position: absolute;
  display: block;
  border-radius: 50%;
  opacity: 0;
  animation-duration: var(--dur, 14s);
  animation-delay: var(--delay, 0s);
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-name: motefloat;
}

.stage-particles[data-kind="dust"] i {
  background: rgba(255, 242, 214, 0.55);
  filter: blur(0.4px);
  animation-name: motefloat;
}

.stage-particles[data-kind="steam"] i {
  background: rgba(238, 244, 244, 0.22);
  filter: blur(3px);
  animation-name: steamrise;
}

.stage-particles[data-kind="plume"] i {
  background: radial-gradient(circle, rgba(214, 74, 142, 0.34), rgba(214, 74, 142, 0));
  filter: blur(2px);
  animation-name: plumedrift;
}

@keyframes motefloat {
  0% { opacity: 0; transform: translate3d(0, 0, 0); }
  12% { opacity: 0.5; }
  70% { opacity: 0.22; }
  100% { opacity: 0; transform: translate3d(var(--drift, 22px), -46px, 0); }
}

@keyframes steamrise {
  0% { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.7); }
  22% { opacity: 0.5; }
  100% { opacity: 0; transform: translate3d(calc(var(--drift, 18px) * 0.5), -120px, 0) scale(1.7); }
}

@keyframes plumedrift {
  0% { opacity: 0; transform: translate3d(0, 0, 0) scale(0.6); }
  25% { opacity: 0.45; }
  100% { opacity: 0; transform: translate3d(var(--drift, 24px), -34px, 0) scale(1.9); }
}

/* ── speaker choreography ───────────────────────────────────────────────── */

.game-screen .nair,
.game-screen .examiner {
  transition: opacity 600ms ease, filter 600ms ease, transform 600ms ease;
}

.game-screen[data-speaker="nair"] .nair { opacity: 1; filter: none; }
.game-screen[data-speaker="nair"] .examiner { opacity: 0.82; }

.game-screen[data-speaker="examiner"] .nair {
  opacity: 0.38;
  filter: saturate(0.55) brightness(0.8);
  transform: translateY(6px) scale(0.98);
}

.game-screen[data-speaker="examiner"] .examiner {
  opacity: 1;
  transform: scale(1.04);
  box-shadow: 0 0 0 1px rgba(196, 218, 236, 0.35), 0 18px 44px rgba(4, 10, 16, 0.55);
}

/* ── step 14: three rooms, not a reset ──────────────────────────────────── */

#stage[data-verdict="triumph"] .stage-bg {
  filter: sepia(0.3) saturate(1.16) brightness(1.12) contrast(1.02);
}

#stage[data-verdict="triumph"] {
  --spot: 0.7;
}

#stage[data-verdict="triumph"]::after {
  background:
    radial-gradient(54% 58% at 50% 42%, rgba(255, 210, 132, 0.4), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, transparent 58%, rgba(46, 24, 6, 0.32) 100%);
}

#stage[data-verdict="pass"] .stage-bg {
  filter: saturate(0.86) brightness(1.02) contrast(1.04);
}

#stage[data-verdict="pass"]::after {
  background:
    radial-gradient(60% 60% at 50% 46%, rgba(226, 232, 234, 0.16), transparent 72%),
    radial-gradient(120% 90% at 50% 50%, transparent 58%, rgba(10, 12, 14, 0.4) 100%);
}

#stage[data-verdict="ruined"] .stage-bg {
  filter: saturate(0.4) brightness(0.66) contrast(1.16) hue-rotate(232deg);
}

#stage[data-verdict="ruined"]::after {
  background:
    radial-gradient(56% 56% at 50% 46%, rgba(92, 74, 128, 0.22), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, transparent 44%, rgba(4, 3, 8, 0.66) 100%);
}

/* The marked sheet carries the room. The bench photograph behind it is the
   same picture, so it is faded out — one backdrop, never two stacked copies. */
.game-screen[data-verdict] .stage-bg,
.game-screen[data-verdict] .stage-shade {
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* The 8/8 stamp lands once, and only on a clean paper. */
.vcard[data-outcome="triumph"] .v-mark {
  animation: stampLand 620ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.vcard[data-outcome="triumph"] .v-score b {
  color: #f3c879;
}

.vcard[data-outcome="ruined"] {
  border-color: rgba(120, 104, 150, 0.4);
}

@keyframes stampLand {
  0% { transform: scale(1.9) rotate(-14deg); opacity: 0; }
  60% { transform: scale(0.94) rotate(-7deg); opacity: 1; }
  100% { transform: scale(1) rotate(-7deg); opacity: 1; }
}

/* ── viva mood line ─────────────────────────────────────────────────────── */

.viva-mood {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(236, 226, 208, 0.55);
}

/* ── reduced motion: intent stays, movement goes ────────────────────────── */

.no-motion #stage,
body.no-motion #stage {
  transform: none !important;
  transition: none !important;
}

.no-motion .stage-particles,
body.no-motion .stage-particles {
  display: none;
}

.no-motion .stage-bg,
.no-motion .nair,
.no-motion .examiner,
.no-motion .v-mark {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  #stage { transform: none; transition: none; }
  .stage-particles { display: none; }
  .vcard[data-outcome="triumph"] .v-mark { animation: none; }
}

/* ═══════════════════════════════════════════ ANSWER VERDICT & VIVA OVERHAUL ══ */

/* Explicit status badge + plain-English diff, right above the tray. */
.answer-feedback {
  /* Desktop: a transient badge sitting on top of the tray, not behind the HUD. */
  position: absolute;
  left: clamp(16px, 3vw, 40px);
  bottom: var(--tray-h, 210px);
  z-index: 9;
  width: min(760px, calc(100% - 330px));
  pointer-events: none;
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
}
.answer-feedback[hidden] { display: none; }

.af-badge {
  justify-self: start;
  margin: 0;
  padding: 6px 14px 5px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #fff;
  box-shadow: 0 6px 18px rgb(0 0 0 / 18%);
}
.af-badge.is-correct { background: #17794b; }
.af-badge.is-partial { background: #b47800; }
.af-badge.is-wrong { background: #b3241c; }

.af-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgb(36 31 26 / 18%);
  border-radius: 12px;
  background: rgb(36 31 26 / 14%);
}
.af-cell { padding: 10px 12px; background: #fbf7ec; }
.af-k {
  display: block;
  margin-bottom: 4px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #7c6f5c;
}
.af-v { margin: 0; font-size: 13.5px; line-height: 1.45; color: #241f1a; }
.af-cell.is-yours .af-v { color: #a3271f; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.af-cell.is-right { background: #eef7ee; }
.af-cell.is-right .af-v { color: #145c37; font-weight: 700; }
.af-cell.is-why { background: #f6efe0; }
.af-cell.is-why .af-v { font-size: 12.5px; }

@keyframes af-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}
.answer-feedback.is-shake { animation: af-shake 150ms ease-in-out 1; }
@media (prefers-reduced-motion: reduce) {
  .answer-feedback.is-shake { animation: none; }
}

/* ── the viva card ── */
.viva-card {
  margin: 18px 0;
  padding: 18px 20px 20px;
  border: 2px solid #2b2620;
  border-radius: 14px;
  background: #fbf7ec;
  box-shadow: 6px 6px 0 rgb(43 38 32 / 12%);
}
.vc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.vc-k {
  margin: 0 0 2px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #8a5a1c;
}
.vc-title { margin: 0; font-family: var(--serif, Georgia, serif); font-size: 20px; color: #241f1a; }
.vc-progress {
  margin: 0;
  padding: 4px 9px;
  border: 1px solid rgb(36 31 26 / 30%);
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #4c4438;
  white-space: nowrap;
}

.vc-meter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f1ead8;
}
.vc-face {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 22%;
  border: 2px solid #2b2620;
  background: #d9cfba;
  transition: filter 220ms ease;
}
.vc-meter[data-state="irritated"] .vc-face { filter: saturate(1.25) contrast(1.15) hue-rotate(-8deg); }
.vc-meter[data-state="impressed"] .vc-face { filter: saturate(0.95) brightness(1.06); }
.vc-patience { flex: 1; min-width: 0; }
.vc-p { font-size: 9px; font-weight: 800; letter-spacing: 0.18em; color: #7c6f5c; }
.vc-track { display: flex; gap: 4px; margin: 4px 0 3px; }
.vc-track i {
  height: 5px; flex: 1;
  border-radius: 99px;
  background: #cfc3ab;
  transition: background 240ms ease;
}
.vc-meter[data-state="skeptical"] .vc-track i:nth-child(2) { background: #d19a1e; }
.vc-meter[data-state="irritated"] .vc-track i:nth-child(1),
.vc-meter[data-state="irritated"] .vc-track i:nth-child(2),
.vc-meter[data-state="irritated"] .vc-track i:nth-child(3) { background: #b3241c; }
.vc-meter[data-state="impressed"] .vc-track i:nth-child(1),
.vc-meter[data-state="impressed"] .vc-track i:nth-child(2),
.vc-meter[data-state="impressed"] .vc-track i:nth-child(3),
.vc-meter[data-state="impressed"] .vc-track i:nth-child(4) { background: #17794b; }
.vc-patience b { font-size: 12px; letter-spacing: 0.04em; color: #241f1a; text-transform: uppercase; }

.vc-q {
  margin: 12px 0 12px;
  font-family: var(--serif, Georgia, serif);
  font-size: 19px;
  line-height: 1.4;
  color: #241f1a;
}

.vc-modes { display: flex; gap: 6px; margin-bottom: 10px; }
.vc-modes button {
  padding: 7px 12px;
  border: 1px solid rgb(36 31 26 / 30%);
  border-radius: 999px;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #4c4438;
  cursor: pointer;
}
.vc-modes button.is-on { background: #241f1a; color: #f7f2e4; border-color: #241f1a; }

.vc-input { display: flex; gap: 8px; }
.vc-input input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border: 1.5px solid #2b2620;
  border-radius: 9px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: #241f1a;
}
.vc-input input:focus-visible { outline: 3px solid #d7a640; outline-offset: 1px; }
.vc-input .go {
  padding: 11px 18px;
  border: 0;
  border-radius: 9px;
  background: #17794b;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.vc-input .go[disabled] { background: #8b8375; cursor: default; }

.vc-choices { display: grid; gap: 7px; }
.vc-choice {
  padding: 11px 13px;
  border: 1px solid rgb(36 31 26 / 26%);
  border-left: 4px solid #8b8375;
  border-radius: 9px;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  text-align: left;
  color: #241f1a;
  cursor: pointer;
}
.vc-choice:hover { background: #f6efe0; }
.vc-choice[disabled] { opacity: 0.55; cursor: default; }
.vc-choice.is-accurate { border-left-color: #17794b; }
.vc-choice.is-partial { border-left-color: #b47800; }
.vc-choice.is-misconception { border-left-color: #b3241c; }
.vc-choice.is-admit { border-left-color: #5b6b8a; font-style: italic; }

/* Mandatory post-answer breakdown; the viva never advances on its own. */
.vc-breakdown {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgb(36 31 26 / 30%);
}
.vc-breakdown[hidden] { display: none; }
.vb-reaction {
  margin: 0 0 10px;
  font-family: var(--serif, Georgia, serif);
  font-size: 15.5px;
  line-height: 1.5;
  color: #2b2620;
}
.vb-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.vb-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.vb-pill.is-hit { background: #dff0e2; color: #145c37; border: 1px solid #9ac9a6; }
.vb-pill.is-miss { background: #f7dfdc; color: #8c1e17; border: 1px solid #dda6a0; }
.vb-board {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fff6d8;
  border-left: 4px solid #d7a640;
}
.vb-board span {
  display: block;
  margin-bottom: 3px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #8a5a1c;
}
.vb-board p { margin: 0; font-size: 13.5px; line-height: 1.5; color: #241f1a; }

/* ── the red-ink marked sheet ── */
.marked-sheet { margin: 18px 0; }
.ms-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ms-head h4 {
  margin: 0;
  font-family: var(--serif, Georgia, serif);
  font-size: 17px;
  letter-spacing: 0.06em;
  color: #241f1a;
}
.ms-head p { margin: 0; font-size: 11px; color: #7c6f5c; }

.sheet-table { margin-top: 8px; border: 1.5px solid #2b2620; border-radius: 10px; overflow: hidden; background: #fbf7ec; }
.sheet-head, .sheet-line summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 60px;
  align-items: center;
  gap: 8px;
}
.sheet-head {
  padding: 6px 12px;
  background: #241f1a;
  color: #f7f2e4;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.sheet-head span:nth-child(2), .sheet-head span:nth-child(3) { text-align: right; }
.sheet-line { border-top: 1px solid rgb(36 31 26 / 18%); }
.sheet-line summary {
  padding: 9px 12px;
  list-style: none;
  cursor: pointer;
}
.sheet-line summary::-webkit-details-marker { display: none; }
.sheet-line summary:hover { background: #f4eddd; }
.sl-label { font-size: 13px; font-weight: 700; color: #241f1a; }
.sl-score { text-align: right; font-size: 12.5px; font-weight: 800; color: #241f1a; }
.sl-lost { text-align: right; font-size: 12px; font-weight: 800; color: #8b8375; }
.sheet-line.is-lost .sl-lost { color: #b3241c; }
.sheet-line.is-lost .sl-label { color: #8c1e17; }
.sheet-line.is-pending .sl-label { color: #8b8375; }
.sheet-line.is-pending summary { cursor: default; }
.sl-body { padding: 0 12px 11px; }
.sl-why { margin: 0; font-size: 12.5px; line-height: 1.45; color: #4c4438; }
.sl-fix {
  margin: 6px 0 0;
  padding: 7px 9px;
  border-left: 3px solid #d7a640;
  background: #fff6d8;
  font-size: 12.5px;
  line-height: 1.45;
  color: #241f1a;
}
.sheet-divide {
  margin: 0;
  padding: 5px 12px;
  background: #efe6d0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #6b5f4c;
}

@media (max-width: 720px) {
  .af-box { grid-template-columns: 1fr; }
  .vc-q { font-size: 17px; }
  .vc-input { flex-direction: column; }
  .vc-input .go { width: 100%; }
  .sheet-head, .sheet-line summary { grid-template-columns: minmax(0, 1fr) 58px 48px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE / TABLET PASS · 360 → 1440
   The dock, the hint drawer and the viva verdict, then one layout pass that
   stacks the HUD, centres the bench and turns the dialogue into a drawer.
   ═══════════════════════════════════════════════════════════════════════ */

/* No horizontal scroll anywhere, on any screen. */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Mobile browser bars: the room is exactly as tall as the visible viewport. */
.title-screen,
.game-screen {
  height: 100dvh;
}

/* On desktop the dock is invisible: every child keeps its absolute seat. */
.dock {
  display: contents;
}

/* ── Ask Mr. Nair ─────────────────────────────────────────────────────── */

.ask-nair {
  position: absolute;
  z-index: 9;
  left: auto;
  right: clamp(16px, 3vw, 40px);
  top: clamp(124px, 14vh, 148px);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(236, 183, 92, 0.5);
  background: rgba(12, 10, 8, 0.82);
  color: #f4e9d3;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: border-color 0.2s, background 0.2s, transform 0.16s;
}
.ask-nair:hover,
.ask-nair:focus-visible {
  border-color: var(--gold);
  background: rgba(28, 20, 12, 0.92);
  transform: translateY(-1px);
  outline: none;
}
.ask-nair b {
  padding: 2px 5px;
  border: 1px solid rgba(236, 183, 92, 0.4);
  color: var(--gold);
  font-size: 8.5px;
  font-weight: 700;
}
.ask-nair-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px rgba(190, 50, 40, 0.9);
  flex: 0 0 auto;
}
.ask-nair.is-open {
  border-color: var(--gold);
  background: rgba(40, 28, 14, 0.94);
}

/* ── the hint drawer ──────────────────────────────────────────────────── */

.hint-drawer {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 28px));
  max-height: 62dvh;
  overflow: auto;
  padding: 16px 18px 14px;
  background: linear-gradient(180deg, #f9f0dc, #e8d5b4);
  color: var(--ink);
  border-left: 3px solid var(--red);
  box-shadow: 0 30px 70px -22px rgba(0, 0, 0, 0.95), inset 0 0 0 1px rgba(23, 19, 16, 0.08);
  animation: hint-rise 0.24s cubic-bezier(0.2, 1, 0.4, 1) both;
}
.hint-drawer[hidden] { display: none !important; }

@keyframes hint-rise {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.hint-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.hint-k {
  margin: 0 0 3px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--red-deep);
}
.hint-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--ink);
}
.hint-close {
  width: 44px;
  height: 44px;
  margin: -8px -8px 0 0;
  border: 0;
  background: transparent;
  color: rgba(23, 19, 16, 0.6);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.hint-close:hover { color: var(--red); }

.hint-body {
  margin: 10px 0 12px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.45;
  color: #2b231c;
}
.hint-body.is-waiting { color: rgba(43, 35, 28, 0.55); font-style: italic; }

.hint-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.hint-quick button {
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid rgba(23, 19, 16, 0.28);
  background: rgba(255, 255, 255, 0.34);
  font-family: var(--serif);
  font-size: 12.5px;
  color: #332a22;
  cursor: pointer;
}
.hint-quick button:hover { border-color: var(--red); color: var(--red-deep); }

.hint-ask { display: flex; gap: 7px; }
.hint-ask input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid rgba(23, 19, 16, 0.35);
  background: rgba(255, 255, 255, 0.55);
  font-family: var(--sans);
  font-size: 16px; /* no iOS zoom */
  color: var(--ink);
}
.hint-ask input:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }

.hint-source {
  margin: 9px 0 0;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: rgba(23, 19, 16, 0.42);
}

/* ── viva: the badge, the probe and the voice row ─────────────────────── */

.vb-badge {
  display: inline-block;
  margin: 12px 0 8px;
  padding: 6px 14px 5px;
  border-radius: 999px;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.vb-badge.is-correct { background: #17794b; }
.vb-badge.is-partial { background: #b47800; }
.vb-badge.is-wrong { background: #b3241c; }
.vb-badge:empty { display: none; }

.vb-probe {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 3px solid #8a5a1c;
  background: #f3e8cf;
  font-size: 13px;
  line-height: 1.45;
  color: #4c4438;
}
.vb-probe[hidden] { display: none; }

.vc-voice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 6px;
}
.vc-voice-btn {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(36, 31, 26, 0.3);
  background: #f2e6cd;
  color: #3a3229;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.vc-voice-btn[aria-pressed="true"] {
  border-color: #17794b;
  background: #e8f4ea;
  color: #145c37;
}

/* ══════════════════════════════════════════════════════════════ PHONES ══ */

@media (max-width: 768px) {
  /* The HUD stacks: title, then one row of instruments. */
  .hud {
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 9px;
  }
  .hud-left { display: block; min-width: 0; }
  .hud-tag { display: block; font-size: 7.5px; letter-spacing: 0.18em; }
  .hud-title { margin: 3px 0 0; font-size: 18px; line-height: 1.15; }
  /* The register line is already on the slip; the HUD keeps the experiment. */
  .hud-who { display: none; }

  .hud-right {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .hud-cell {
    min-height: 44px;
    padding: 5px 9px;
    justify-content: center;
  }
  .hud-cell span { font-size: 7px; letter-spacing: 0.14em; }
  .hud-cell b { font-size: 15px; }
  .examiner {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 2px 9px 2px 2px;
    justify-content: flex-start;
  }
  .examiner img { width: 30px; height: 38px; }
  .examiner-name { font-size: 6.5px; letter-spacing: 0.14em; }
  .eyes i { width: 6px; height: 6px; }
  .hud-exit { min-height: 44px; padding: 0 13px; }

  /* The step strip owns its own band under the HUD, never a fixed 40vw. */
  .task-strip {
    top: calc(env(safe-area-inset-top, 0px) + 112px);
    left: 10px;
    right: 10px;
    width: auto;
    padding: 8px 11px 9px;
  }
  .task-text { font-size: 14.5px; line-height: 1.25; }
  .task-label { font-size: 8px; }
  .room-line { display: none; }

  /* The bench stays centred and clear of both bars. */
  .rig {
    left: 50%;
    transform: translateX(-50%);
    bottom: 44dvh;
    width: min(74vw, 300px);
    height: min(30dvh, 260px);
  }
  .cabinet {
    top: calc(env(safe-area-inset-top, 0px) + 118px);
    width: calc(100% - 20px);
    max-height: 44dvh;
    overflow: auto;
  }
  .app { height: clamp(74px, 13vmin, 104px); }
  #stage[data-scene="bench"] .stage-bg img.is-on,
  .stage-bg img.is-on { object-position: 52% 34%; }

  /* One bottom drawer: Nair is its compact portrait header. */
  .dock {
    display: flex;
    flex-direction: column;
    gap: 7px;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    max-height: 70dvh;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(6, 5, 7, 0) 0%, rgba(6, 5, 7, 0.86) 9%, rgba(6, 5, 7, 0.97) 26%);
    border-top: 1px solid rgba(236, 183, 92, 0.16);
  }

  .nair {
    position: static;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    max-width: none;
    padding: 0;
    background: none;
    border: 0;
    opacity: 1;
    pointer-events: auto;
    order: 1;
  }
  .nair-art {
    order: 1;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 18%;
    border: 1px solid rgba(236, 183, 92, 0.45);
    background: #171310;
    filter: none;
    animation: none;
  }
  .nair-bubble {
    order: 2;
    flex: 1 1 auto;
    width: auto;
    margin: 0;
    padding: 8px 12px 9px;
    transform: none;
    box-shadow: 0 12px 26px -16px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(23, 19, 16, 0.08);
  }
  .nair-bubble::after { display: none; }
  .nair-bubble.is-new { animation: bubble-pop-flat 0.3s ease both; }
  .nair-name { font-size: 7.5px; }
  .nair-line { font-size: 12.5px; line-height: 1.32; min-height: 2.6em; }

  .answer-feedback { position: static; width: auto; bottom: auto; order: 2; margin: 0; }
  .af-box { grid-template-columns: 1fr; }
  .af-v { font-size: 13px; }

  .ask-nair {
    position: static;
    order: 3;
    justify-content: center;
    width: 100%;
  }

  .tray {
    position: static;
    order: 4;
    left: auto;
    bottom: auto;
    width: 100%;
    max-height: 38dvh;
  }

  /* Every control is a thumb, not a target. */
  .go,
  .mini-choice,
  .plan-card,
  .vc-choice,
  .hub-tab,
  .res-card,
  .menu-item {
    min-height: 44px;
  }
  .type-input,
  #mean-input,
  .vc-input input,
  .read-side .go {
    font-size: 16px;
  }
  .hold-pad { padding: 12px 12px 14px; }
  .hold-rail { height: 18px; }
  .read-pad { grid-template-columns: 1fr; }
  .read-scale { min-height: 220px; }
  .record-actions { grid-template-columns: 1fr; }

  /* Verdict: one column, no clipping. */
  .verdict { padding: 10px; }
  .vcard { width: 100%; padding: 14px 14px 18px; }
  .v-top { flex-direction: column; align-items: flex-start; padding-right: 0; gap: 8px; }
  .v-score { font-size: 40px; }
  .viva-card { padding: 14px; }
  .vc-head { flex-direction: column; gap: 6px; }
  .vc-input { flex-direction: column; }
  .vc-input .go { width: 100%; }
  .vc-modes button { min-height: 44px; flex: 1; }
  .sheet-table .sheet-head { display: none; }
}

/* Very short phones: the bench gets the room, the drawer gets out of the way. */
@media (max-width: 768px) and (max-height: 700px) {
  .rig { bottom: 46dvh; height: 24dvh; }
  .dock { max-height: 62dvh; }
  .tray { max-height: 30dvh; }
  .nair-art { width: 40px; height: 40px; }
  .nair-line { min-height: 2.2em; font-size: 12px; }
}

/* Tablets: the right-hand column, with room for the tray beside it. */
@media (min-width: 769px) and (max-width: 1100px) {
  .rig { left: 4vw; bottom: 28vh; width: clamp(280px, 42vmin, 520px); }
  .tray { width: calc(100% - 280px); }
  .nair-art { height: 34vh; }
  .task-strip { width: min(400px, 48vw); }
}

/* Desktop: a hair of breathing room at the very edge. */
@media (min-width: 1280px) {
  .tray { width: min(760px, calc(100% - 360px)); }
}

/* ═══════════════════════════════════════════════ MULTI-BENCH: SALT & PHYSICS ══ */

/* These benches are worked at a table, not under a burette. The titration rig
   and the apparatus cabinet belong to the volumetric room only. */
.game-screen[data-level="chem-salt"] .rig,
.game-screen[data-level="phys-vernier"] .rig,
.game-screen[data-level="phys-bridge"] .rig { display: none; }

/* Fine adjustment for a vernier or a screw gauge. */
.read-nudge {
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
}
.read-nudge button {
  flex: 1;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(236, 183, 92, 0.4);
  background: rgba(12, 10, 8, 0.7);
  color: #f4e9d3;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.read-nudge button:hover,
.read-nudge button:focus-visible {
  border-color: var(--gold);
  outline: none;
}

/* Long plan cards (salt tests, circuit decisions) keep their labels readable. */
.plan-pad { max-height: 46dvh; overflow: auto; }
.plan-card .plan-k { font-size: 13.5px; line-height: 1.35; }
.plan-card .plan-d { font-size: 12px; line-height: 1.4; color: rgba(244, 233, 211, 0.7); }

@media (max-width: 768px) {
  .read-nudge button { min-height: 44px; }
  .plan-pad { max-height: 38dvh; }
}

/* V–I plot on the metre-bridge bench. */
.vi-pad {
  border: 1px solid rgba(236, 183, 92, 0.25);
  background: rgba(10, 8, 6, 0.55);
  padding: 8px 10px 6px;
  margin: 0 0 10px;
}
.vi-k {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(236, 183, 92, 0.85);
}
.vi-chart { display: block; width: 100%; height: auto; max-height: 118px; }
.vi-chart text { fill: rgba(244, 233, 211, 0.55); font-family: var(--mono); font-size: 8px; letter-spacing: 0.08em; }
.vi-axes { fill: none; stroke: rgba(244, 233, 211, 0.28); stroke-width: 1; }
.vi-line { fill: none; stroke: var(--gold); stroke-width: 1.6; }
.vi-chart circle { fill: #f4e9d3; }
.vi-hint { margin: 2px 0 0; font-size: 11.5px; line-height: 1.4; color: rgba(244, 233, 211, 0.7); }

/* ═══════════════════════════════════════ QUICK VIVA & STUDY TOOLS ══════ */

/* The hub's demo door: unmissable, one line of copy, one action. */
.hub-viva {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  margin: 14px 0 4px;
  padding: 10px 16px;
  border: 1px solid rgba(236, 183, 92, 0.4);
  border-left: 3px solid var(--red);
  background: linear-gradient(90deg, rgba(163, 35, 28, 0.24), rgba(10, 9, 8, 0.72) 46%, rgba(10, 9, 8, 0.5));
  color: #f8eed9;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.16s;
}

.hub-viva:hover,
.hub-viva:focus-visible {
  outline: none;
  border-color: var(--gold);
  background: linear-gradient(90deg, rgba(163, 35, 28, 0.34), rgba(32, 23, 12, 0.86) 46%, rgba(16, 12, 8, 0.8));
  transform: translateY(-1px);
}

.hub-viva-mic { font-size: 20px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)); }

.hub-viva-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.hub-viva-body b {
  font-family: var(--serif);
  font-size: clamp(16px, 1.6vw, 21px);
  font-weight: 400;
}

.hub-viva-body span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 233, 211, 0.5);
}

.hub-viva-go {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--gold);
  white-space: nowrap;
}

/* ── the standalone viva overlay ── */

.qvv {
  position: fixed;
  inset: 0;
  z-index: 76;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
  background: rgba(5, 5, 7, 0.74);
  backdrop-filter: blur(6px) saturate(0.9);
  overscroll-behavior: contain;
}

.qvv-card {
  position: relative;
  width: min(720px, 96vw);
  max-height: 92dvh;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(18px, 2.6vw, 30px);
  background: linear-gradient(180deg, #f8eeda, #ecdcbe);
  color: var(--ink);
  box-shadow: 0 40px 90px -30px #000;
  border-left: 4px solid var(--red);
}

.qvv-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(23, 19, 16, 0.12);
  pointer-events: none;
}

.qvv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.qvv-k {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--red-deep);
}

.qvv-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 400;
  line-height: 1.05;
  color: var(--ink);
}

.qvv-sub {
  margin: 5px 0 0;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(23, 19, 16, 0.52);
}

.qvv-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: -8px -8px 0 0;
  border: 0;
  background: transparent;
  color: rgba(23, 19, 16, 0.6);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.qvv-close:hover { color: var(--red); }

.qvv-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: rgba(23, 19, 16, 0.58);
}

.qvv-track { flex: 1 1 auto; height: 3px; background: rgba(23, 19, 16, 0.15); overflow: hidden; }
.qvv-track i { display: block; height: 100%; width: 0; background: var(--red); transition: width 0.3s; }

.qvv-stage {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  padding: 10px 12px;
  background: rgba(23, 19, 16, 0.05);
  border-left: 2px solid rgba(23, 19, 16, 0.3);
}

.qvv-face {
  width: 58px;
  height: 72px;
  object-fit: cover;
  object-position: 50% 16%;
  filter: grayscale(0.3) contrast(1.05);
  border: 1px solid rgba(23, 19, 16, 0.2);
}

.qvv-say { min-width: 0; }
.qvv-name {
  margin: 0 0 3px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--red-deep);
}
.qvv-line { margin: 0; font-family: var(--serif); font-size: 14.5px; line-height: 1.4; color: #2b231c; }

.qvv-question {
  margin: 16px 0 12px;
  font-family: var(--serif);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.3;
  color: #201a15;
}

.qvv-modes {
  display: flex;
  gap: 0;
  margin-bottom: 10px;
  border: 1px solid rgba(23, 19, 16, 0.28);
  width: fit-content;
}
.qvv-modes button {
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: #574a3c;
  cursor: pointer;
}
.qvv-modes button.is-on { background: var(--ink); color: var(--paper); }

.qvv-input { display: flex; gap: 8px; flex-wrap: wrap; }
.qvv-input input {
  flex: 1 1 240px;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(23, 19, 16, 0.4);
  background: rgba(255, 255, 255, 0.6);
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
}
.qvv-mic {
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(23, 19, 16, 0.3);
  background: rgba(255, 255, 255, 0.35);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #4a3f34;
  cursor: pointer;
}

.qvv-choices { display: grid; grid-template-columns: 1fr; gap: 7px; }
.qvv-choice {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid rgba(23, 19, 16, 0.26);
  border-left: 3px solid rgba(23, 19, 16, 0.3);
  background: rgba(255, 255, 255, 0.38);
  font-family: var(--serif);
  font-size: 13.5px;
  line-height: 1.4;
  text-align: left;
  color: #2b231c;
  cursor: pointer;
}
.qvv-choice:hover:not(:disabled) { background: #fff8e9; border-color: var(--red); }
.qvv-choice:disabled { opacity: 0.62; cursor: default; }
.qvv-choice.is-accurate { border-left-color: #17794b; }
.qvv-choice.is-partial { border-left-color: #b47800; }
.qvv-choice.is-misconception { border-left-color: #8b1e17; }

.qvv-break { margin-top: 14px; }
.qvv-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 6px 14px 5px;
  border-radius: 999px;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #fff;
}
.qvv-badge.is-correct { background: #17794b; }
.qvv-badge.is-partial { background: #b47800; }
.qvv-badge.is-wrong { background: #b3241c; }

.qvv-why {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(23, 19, 16, 0.68);
}

.qvv-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.qvv-pill { padding: 4px 9px; border-radius: 999px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; }
.qvv-pill.is-hit { background: #e2f1e5; border: 1px solid #2c7a4d; color: #145c37; }
.qvv-pill.is-miss { background: #f7e2e0; border: 1px solid #a3271f; color: #8b1e17; }

.qvv-board { margin: 0 0 12px; padding: 11px 13px; background: #fff6d9; border-left: 3px solid var(--gold); }
.qvv-board span {
  display: block;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: rgba(23, 19, 16, 0.55);
}
.qvv-board p { margin: 0; font-family: var(--serif); font-size: 14.5px; line-height: 1.45; color: #241d17; }

.qvv-next { width: 100%; min-height: 46px; }

.qvv-final { padding: 10px 0 4px; }
.qvv-final-k { margin: 0; font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: var(--red-deep); }
.qvv-final-score { margin: 4px 0 2px; font-family: var(--serif); font-size: 46px; line-height: 1; }
.qvv-final-score[data-tone="good"] { color: #145c37; }
.qvv-final-score[data-tone="mid"] { color: #8a5a09; }
.qvv-final-score[data-tone="low"] { color: #8b1e17; }
.qvv-final-line { margin: 6px 0 12px; font-family: var(--serif); font-size: 14px; line-height: 1.45; color: #3a3128; }
.qvv-final-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.qvv-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(23, 19, 16, 0.16);
}
.qvv-foot p { margin: 0; font-family: var(--mono); font-size: 8px; letter-spacing: 0.12em; color: rgba(23, 19, 16, 0.48); }
.qvv-voice {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(23, 19, 16, 0.28);
  background: transparent;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  color: #4a3f34;
  cursor: pointer;
}
.qvv-voice[aria-pressed="true"] { border-color: #17794b; color: #145c37; }

/* ── resources: the three tools ── */

.res-tool {
  margin: 18px 0 4px;
  padding: clamp(16px, 2.4vw, 26px);
  background: linear-gradient(180deg, #f8eeda, #ede0c6);
  color: var(--ink);
  box-shadow: 0 24px 50px -26px #000;
  border-left: 3px solid var(--gold);
}

.tool-head { margin-bottom: 14px; }
.tool-k { margin: 0 0 4px; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.2em; color: var(--red-deep); }
.tool-title { margin: 0; font-family: var(--serif); font-size: clamp(20px, 2.4vw, 28px); font-weight: 400; line-height: 1.1; }
.tool-line { max-width: 68ch; margin: 6px 0 0; font-family: var(--serif); font-size: 13.5px; line-height: 1.5; color: #4b3f33; }

.trap-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; }
.trap-group-k {
  margin: 0 0 6px;
  padding-bottom: 5px;
  border-bottom: 2px solid rgba(23, 19, 16, 0.7);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red-deep);
}
.trap-list { margin: 0; padding: 0; list-style: none; counter-reset: trap; }
.trap { position: relative; counter-increment: trap; padding: 7px 0 7px 30px; border-bottom: 1px solid rgba(23, 19, 16, 0.1); }
.trap::before {
  content: counter(trap);
  position: absolute;
  left: 0;
  top: 8px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23, 19, 16, 0.4);
  font-family: var(--mono);
  font-size: 9px;
  color: var(--red-deep);
}
.trap-title { display: block; font-family: var(--serif); font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.trap-line { display: block; margin-top: 2px; font-size: 12px; line-height: 1.45; color: #4b3f33; }

.calc2-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
.calc2-field { display: flex; flex-direction: column; gap: 3px; }
.calc2-field span { font-family: var(--mono); font-size: 8px; letter-spacing: 0.12em; color: #5b4d3e; }
.calc2-field input {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid rgba(23, 19, 16, 0.35);
  background: rgba(255, 255, 255, 0.62);
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
}
.calc2-steps { margin-top: 12px; }
.calc2-list { margin: 0; padding: 0; list-style: none; }
.calc2-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px dashed rgba(23, 19, 16, 0.15); }
.calc2-list li.is-answer { background: #fff6d9; border-bottom: 2px solid var(--gold); padding: 9px 10px; }
.cs-k { font-family: var(--mono); font-size: 8px; letter-spacing: 0.16em; color: var(--red-deep); }
.calc2-list code { font-family: var(--mono); font-size: 13px; color: #241d17; overflow-wrap: anywhere; }
.calc2-check { margin: 9px 0 0; font-family: var(--serif); font-size: 12.5px; line-height: 1.45; color: #574a3c; }
.calc2-note { margin: 12px 0 0; padding-top: 9px; border-top: 1px dashed rgba(23, 19, 16, 0.16); font-size: 12px; line-height: 1.5; color: #4b3f33; }
.calc2-warn { margin: 0; padding: 10px 12px; background: #f7e2e0; border-left: 3px solid #a3271f; font-size: 12.5px; color: #6d1712; }

.flash-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.flash-filters button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(23, 19, 16, 0.28);
  background: rgba(255, 255, 255, 0.34);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #4a3f34;
  cursor: pointer;
}
.flash-filters button.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.flash-stage { padding: 16px; background: #fbf7ec; border: 1px solid rgba(23, 19, 16, 0.16); }
.flash-count { margin: 0 0 8px; font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em; color: rgba(23, 19, 16, 0.5); }
.flash-q { margin: 0; font-family: var(--serif); font-size: clamp(17px, 2vw, 21px); line-height: 1.35; color: #201a15; }
.flash-a { margin: 12px 0 0; padding: 10px 12px; background: #fff6d9; border-left: 3px solid var(--gold); font-family: var(--serif); font-size: 14.5px; line-height: 1.5; color: #2b231c; }
.flash-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.mm-card { padding: 16px; background: #fbf7ec; border: 1px solid rgba(23, 19, 16, 0.16); }
.mm-count { margin: 0 0 8px; font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em; color: rgba(23, 19, 16, 0.5); }
.mm-clue { margin: 0 0 12px; font-family: var(--serif); font-size: 16px; line-height: 1.45; color: #241d17; }
.mm-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.mm-option {
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid rgba(23, 19, 16, 0.3);
  background: rgba(255, 255, 255, 0.5);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #2b231c;
  cursor: pointer;
}
.mm-option:hover:not(:disabled) { border-color: var(--red); }
.mm-option.is-right { border-color: #2c7a4d; background: #e2f1e5; color: #145c37; }
.mm-option.is-wrong { border-color: #a3271f; background: #f7e2e0; color: #8b1e17; }
.mm-badge { display: inline-block; margin: 12px 0 0; padding: 5px 12px; border-radius: 999px; color: #fff; font-family: var(--sans); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; }
.mm-badge.is-correct { background: #17794b; }
.mm-badge.is-wrong { background: #b3241c; }
.mm-why { margin: 9px 0 0; font-family: var(--serif); font-size: 13.5px; line-height: 1.5; color: #3a3128; }
.mm-card .btn { margin-top: 12px; }

@media (max-width: 768px) {
  .hub-viva { gap: 10px; padding: 9px 11px; }
  .hub-viva-go { display: none; }
  .qvv { padding: 0; place-items: stretch; }
  .qvv-card {
    width: 100%;
    max-height: 100dvh;
    min-height: 100dvh;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 14px
      calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .qvv-modes { width: 100%; }
  .qvv-modes button { flex: 1; min-height: 44px; }
  .qvv-input input { flex: 1 1 100%; }
  .qvv-input .go { flex: 1 1 auto; min-height: 46px; }
  .qvv-mic { flex: 1 1 auto; }
  .trap-groups { grid-template-columns: 1fr; }
  .mm-options { grid-template-columns: 1fr; }
  .qvv-foot { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════ BOARD PASS & ABOUT ══════════ */

.title-top-pro {
  padding: 4px 9px;
  border: 1px solid rgba(236, 183, 92, 0.55);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.16em;
  color: var(--gold);
  white-space: nowrap;
}

.menu-pass {
  border-left: 2px solid var(--red);
  background: linear-gradient(90deg, rgba(163, 35, 28, 0.14), transparent 70%);
}
.menu-pass-price {
  margin-left: 6px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.72em;
  letter-spacing: 0.06em;
}

.exam-cta { width: 100%; margin-top: 10px; }

.bp {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
  background: rgba(5, 5, 7, 0.8);
  backdrop-filter: blur(7px) saturate(0.9);
  overscroll-behavior: contain;
}

.bp-card {
  position: relative;
  width: min(760px, 96vw);
  max-height: 92dvh;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(20px, 2.8vw, 34px);
  background: linear-gradient(180deg, #f9efdc, #ecdcbe);
  color: var(--ink);
  box-shadow: 0 40px 100px -30px #000;
  border-left: 4px solid var(--red);
}

.bp-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(23, 19, 16, 0.12);
  pointer-events: none;
}

.bp-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: rgba(23, 19, 16, 0.62);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}
.bp-close:hover { color: var(--red); }

.bp-k {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--red-deep);
}

.bp-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 46px);
  font-weight: 400;
  line-height: 1;
}
.bp-title span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: rgba(23, 19, 16, 0.55);
  text-transform: uppercase;
}

.bp-reason-title {
  margin: 12px 0 3px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: #201a15;
}
.bp-reason-line {
  max-width: 62ch;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #4b3f33;
}

.bp-table {
  margin: 16px 0 16px;
  border: 1px solid rgba(23, 19, 16, 0.3);
  background: rgba(255, 255, 255, 0.3);
}
.bp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px 128px;
  align-items: center;
  min-height: 36px;
  border-top: 1px solid rgba(23, 19, 16, 0.12);
}
.bp-row:first-child { border-top: 0; }
.bp-row > span {
  padding: 8px 11px;
  font-family: var(--serif);
  font-size: 13px;
  color: #2b231c;
}
.bp-row > i,
.bp-row > b {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 6px;
  border-left: 1px solid rgba(23, 19, 16, 0.12);
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  color: #574a3c;
}
.bp-row > i:first-of-type { color: rgba(23, 19, 16, 0.55); }
.bp-row .bp-col-pro { background: rgba(236, 183, 92, 0.16); color: #201a15; }
.bp-row > i.bp-col-pro { font-weight: 700; color: #145c37; }

.bp-row-head {
  background: #201a15;
  color: #f8eed9;
}
.bp-row-head > span {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(248, 238, 217, 0.72);
}
.bp-row-head > b {
  border-left-color: rgba(248, 238, 217, 0.16);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: rgba(248, 238, 217, 0.72);
}
.bp-row-head > b.bp-col-pro { background: var(--gold); color: #201a15; }

.bp-form label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: #5b4d3e;
}
.bp-input { display: flex; gap: 8px; flex-wrap: wrap; }
.bp-input input {
  flex: 1 1 240px;
  min-width: 0;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid rgba(23, 19, 16, 0.4);
  background: rgba(255, 255, 255, 0.66);
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
}
.bp-input .go { flex: 0 0 auto; min-height: 46px; }
.bp-msg { min-height: 15px; margin: 6px 0 0; font-size: 12px; color: #8b1e17; }
.bp-msg.is-bad { font-weight: 600; }
.bp-success {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #e2f1e5;
  border-left: 3px solid #17794b;
  font-size: 12.5px;
  line-height: 1.5;
  color: #145c37;
}

.bp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.bp-demo {
  margin-left: auto;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: rgba(23, 19, 16, 0.5);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.bp-demo:hover { color: var(--red-deep); }

.bp-foot {
  margin: 14px 0 0;
  padding-top: 10px;
  border-top: 1px dashed rgba(23, 19, 16, 0.18);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: rgba(23, 19, 16, 0.48);
}

/* ── about ── */

.bp-note {
  margin: -6px 0 14px;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.7;
  letter-spacing: 0.03em;
  color: rgba(23, 19, 16, 0.52);
}

.about-card { width: min(720px, 94vw); }
.about-title {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 400;
  line-height: 1.05;
}
.about-lede {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.5;
  color: #2b231c;
}
.about-head {
  margin: 18px 0 5px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red-deep);
}
.about-line {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #3a3128;
}
.about-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.about-foot {
  margin: 18px 0 0;
  padding-top: 11px;
  border-top: 1px dashed rgba(23, 19, 16, 0.2);
  font-size: 11.5px;
  line-height: 1.6;
  color: #5b4d3e;
}

@media (max-width: 768px) {
  .bp { padding: 0; place-items: stretch; }
  .bp-card {
    width: 100%;
    max-height: 100dvh;
    min-height: 100dvh;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 14px
      calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .bp-row { grid-template-columns: minmax(0, 1fr) 64px 86px; }
  .bp-row > span { padding: 8px; font-size: 12px; }
  .bp-row > i,
  .bp-row > b { font-size: 8.5px; }
  .bp-demo { margin-left: 0; }
  .bp-actions .btn { flex: 1 1 auto; min-height: 46px; }
  .title-top-pro { display: none; }
}

/* ═══════════════════════════════════════════════ PLAYTEST HARDENING ══════ */

/* One viewport, whatever the phone's address bar is doing. */
html,
body {
  min-height: 100dvh;
  overflow-x: clip;
}

/* Nothing interactive may be dragged out, selected, or long-pressed into a
   system menu — a held stopcock is a gesture, not a right-click. */
.game-screen,
.game-screen * {
  -webkit-touch-callout: none;
}

.game-screen img {
  -webkit-user-drag: none;
  user-select: none;
}

/* The plain-English diff card must survive a short phone screen. */
.answer-feedback {
  max-height: 34dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.af-v {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* The viva gets the same three-cell diff as the bench. */
.vb-diff {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 10px 0 12px;
  overflow: hidden;
  border: 1px solid rgb(36 31 26 / 18%);
  border-radius: 10px;
  background: rgb(36 31 26 / 14%);
}

.vb-diff[hidden] { display: none !important; }

.vb-diff .af-cell { padding: 9px 11px; background: #fbf7ec; }
.vb-diff .af-v { overflow-wrap: anywhere; }

@media (max-width: 768px) {
  .vb-diff { grid-template-columns: 1fr; }
  .answer-feedback { max-height: 32dvh; pointer-events: auto; }

  .crumb,
  .title-top-sound { min-height: 44px; }

  /* The verdict is a full page on a phone: no rotated sheet, no clipped feet. */
  .verdict {
    padding: 0;
    align-items: stretch;
    place-items: stretch;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .vcard {
    width: 100%;
    max-height: none;
    min-height: 100dvh;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 14px
      calc(20px + env(safe-area-inset-bottom, 0px));
    transform: none;
    animation: none;
  }

  .vcard::before { inset: 5px; }

  .v-actions {
    gap: 8px;
  }

  .v-actions .btn {
    min-height: 46px;
    width: 100%;
  }

  .sheet-line summary,
  .viva-card .vc-voice-btn,
  .read-nudge button,
  .record-actions .mini-choice,
  .ask-nair {
    min-height: 44px;
  }

  .tray { padding-bottom: 4px; }
  .hint-drawer { bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 430px) {
  .hud { padding-left: 9px; padding-right: 9px; }
  .hud-title { font-size: 17px; }
  .task-strip { left: 8px; right: 8px; }
  .dock { padding-left: 9px; padding-right: 9px; }
  .tray { width: 100%; }
  .nair-art { width: 40px; height: 40px; }
  .nair-line { font-size: 12px; }
  .v-score b { font-size: 54px; }
  .v-mark { top: 12px; right: 12px; padding: 5px 7px; font-size: 8px; }
}

/* ── the tray never runs under Mr. Nair ─────────────────────────────────
   From 881px up he owns the right-hand column, so the paper stops at the
   midline instead of sliding beneath his portrait. */

@media (min-width: 769px) and (max-width: 880px) {
  /* He is a dialogue bar at this width, not a column: the paper gets the room. */
  .tray,
  .answer-feedback { width: calc(100% - 28px); }
}

@media (min-width: 881px) {
  .tray,
  .answer-feedback { width: min(720px, calc(50% - 40px)); }
}

@media (min-width: 1280px) {
  .tray,
  .answer-feedback { width: min(720px, calc(100% - 420px)); }
}

@media (min-width: 769px) and (max-width: 1100px) {
  .vcard { max-height: 94dvh; }
}

/* ═════════════════════════════════════════ P0 · SHORT SCREENS ════════════ */
/* The about sheet uses the credits pattern: 90dvh and its own scrollbar. */
.about-card {
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ═════════════════════════════════════════ P1-5 · TAP TARGETS ════════════ */
.how-close,
.qvv-close,
#hud-exit { min-width: 44px; min-height: 44px; }
.prac-play,
.qvv-modes button,
.qvv-voice,
.flash-filters button,
#brief-go { min-height: 44px; }
.prac-play,
.qvv-voice,
.flash-filters button { display: inline-flex; align-items: center; justify-content: center; }

/* ═════════════════════════════════════════ P1-1 · THE FRONT GATE ═════════ */
.gate-viva {
  margin: 20px 0 5px;
  min-height: 52px;
  padding: 0 30px;
  border: 1px solid rgba(246, 236, 214, 0.5);
  background: linear-gradient(180deg, #f6ecd8, #ddc79d);
  color: #1b1713;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 18px 40px -18px #000;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.gate-viva:hover { transform: translateY(-2px); box-shadow: 0 22px 46px -18px #000; }
.gate-viva:disabled { opacity: 0.6; cursor: progress; transform: none; }
.gate-viva-note {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(244, 233, 211, 0.45);
}

/* ═════════════════════════════════════════ P1-2 · BENCH WAKING ═══════════ */
.wake {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 42%, rgba(30, 23, 18, 0.9), rgba(8, 7, 6, 0.98));
  opacity: 0;
  transition: opacity 0.35s ease;
}
.wake.is-on { opacity: 1; }
.wake-glass { display: flex; align-items: flex-end; gap: 6px; height: 46px; }
.wake-glass i {
  width: 8px;
  height: 16px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #f6ecd8, #c9a978);
  animation: b9-wake 1.1s ease-in-out infinite;
}
.wake-glass i:nth-child(2) { height: 30px; animation-delay: 0.12s; }
.wake-glass i:nth-child(3) { height: 22px; animation-delay: 0.24s; }
.wake-k {
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: rgba(236, 183, 92, 0.9);
}
.wake-line {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  color: rgba(246, 236, 214, 0.9);
}
.wake-steps { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.wake-steps li {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  color: rgba(244, 233, 211, 0.34);
  animation: fade-in 0.3s both;
}
@keyframes b9-wake {
  0%, 100% { transform: scaleY(0.75); opacity: 0.55; }
  50% { transform: scaleY(1.15); opacity: 1; }
}

/* ═════════════════════════════════════════ P1-3/4 · LOSS LEDGER ══════════ */
.v-loss-ledger {
  position: sticky;
  top: 6px;
  z-index: 4;
  margin: 12px 0 0;
  padding: 10px 13px 11px;
  background: rgba(250, 244, 231, 0.97);
  border: 1px solid rgba(139, 30, 23, 0.32);
  border-left: 3px solid #8b1e17;
  box-shadow: 0 12px 28px -18px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}
.v-loss-ledger.is-clean { border-color: rgba(44, 91, 95, 0.35); border-left-color: var(--teal); }
.vll-k {
  margin: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8b1e17;
}
.v-loss-ledger.is-clean .vll-k { color: #1f5d5f; }
.v-loss-ledger ul { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 0; padding: 0; list-style: none; }
.v-loss-ledger li {
  display: flex;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: rgba(23, 19, 16, 0.72);
  opacity: 0;
  animation: b9-ink-in 0.42s ease forwards;
  animation-delay: calc(var(--i, 0) * 90ms + 120ms);
}
.v-loss-ledger li b { color: #8b1e17; }
.v-loss-ledger.is-clean li b { color: #1f5d5f; }
@keyframes b9-ink-in {
  from { opacity: 0; transform: translateY(-3px); filter: blur(0.6px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* ═════════════════════════════════════════ P1-3 · QUICK VIVA DIFF ════════ */
.qvv-diff {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}
.qvv-diff[hidden] { display: none !important; }
.qvv-diff .af-cell {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.55);
  border-left: 3px solid rgba(23, 19, 16, 0.25);
}
.qvv-diff .is-yours { border-left-color: #8b1e17; }
.qvv-diff .is-right { border-left-color: #17794b; }
.qvv-diff .is-why { border-left-color: var(--gold); }
.qvv-diff .af-k {
  display: block;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(23, 19, 16, 0.5);
}
.qvv-diff .af-v {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.4;
  color: #2b231c;
  overflow-wrap: anywhere;
}
@media (max-width: 620px) {
  .qvv-diff { grid-template-columns: 1fr; }
}

/* ═════════════════════════════════════════ P2 · THINKING / LISTENING ═════ */
.qvv-ink { display: inline-flex; gap: 4px; margin-top: 6px; }
.qvv-ink[hidden] { display: none !important; }
.qvv-ink i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #1b1713;
  animation: b9-ink 1.05s ease-in-out infinite;
}
.qvv-ink i:nth-child(2) { animation-delay: 0.14s; }
.qvv-ink i:nth-child(3) { animation-delay: 0.28s; }
@keyframes b9-ink {
  0%, 100% { opacity: 0.22; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}
.qvv-mic.is-listening {
  border-color: #8b1e17;
  color: #8b1e17;
  background-image: repeating-linear-gradient(90deg, rgba(139, 30, 23, 0.3) 0 2px, transparent 2px 6px);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 28%;
  animation: b9-mic 0.85s ease-in-out infinite;
}
@keyframes b9-mic {
  0%, 100% { background-size: 100% 22%; }
  50% { background-size: 100% 82%; }
}

/* ═════════════════════════════════════════ P2 · GLASS AND SLOSH ══════════ */
.flask img { transition: opacity 0.5s ease, filter 0.5s ease; }
.burette-meniscus { transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), bottom 0.45s ease, opacity 0.35s ease; }
.flask .swirl { transition: transform 0.45s ease, opacity 0.45s ease; }
@keyframes b9-slosh {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  35% { transform: rotate(-1.4deg) translateY(-2px); }
  70% { transform: rotate(1.1deg) translateY(1px); }
}
.flask:hover .swirl { animation: b9-slosh 1.2s ease-in-out infinite; }
@keyframes b9-ripple {
  0% { transform: scale(0.4); opacity: 0.5; }
  100% { transform: scale(2.6); opacity: 0; }
}
.flask:hover::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 14%;
  width: 22px;
  height: 7px;
  margin-left: -11px;
  border-radius: 50%;
  border: 1px solid rgba(214, 120, 160, 0.5);
  pointer-events: none;
  animation: b9-ripple 1.2s ease-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .flask:hover .swirl,
  .flask:hover::after,
  .qvv-ink i,
  .qvv-mic.is-listening,
  .wake-glass i { animation: none; }
  .v-loss-ledger li { animation: none; opacity: 1; }
}

/* The gate ignores the pointer so the art can be clicked; the CTA opts back in. */
.gate-viva { pointer-events: auto; }
