/* ═══════════════════════════════════════════════════════════════════════
   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(88vh, 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 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 {
  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; }
}
