/* Yaoguai Prom — style bible: night purples, lantern gold, neon magenta, thick outlines. */
:root {
  /* Contract D: surface names are semantic; legacy --paper is foreground. */
  --prom-paper: #28394b; --prom-ink: #f2eedb; --prom-ink-muted: #bac9d1;
  --prom-accent: #b94737; --prom-success: #3ee6c4; --prom-danger: #ffb3ad;
  --prom-text-zh: 1.25rem; --prom-text-latin: 1rem; --prom-target-min: 44px;
  --prom-text-display: 1.75rem; --prom-text-utility: 1rem;
  --night: #191026; --night2: #221636; --panel: #2a1c44; --panel2: #332352;
  --line: #443063; --ink: #f3eaff; --dim: #b9a8d6;
  --magenta: #ff4fa3; --gold: #ffc84a; --teal: #3ee6c4; --red: #e8483f; --out: #241335;
  --pink: #c22d75; /* referenced all over game.js as var(--pink, #c22d75) — defined at last */
  --han: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  /* invitations get a quiet book face; dialogue keeps the familiar sans. */
  --hand: "Songti SC", "Noto Serif CJK SC", "STSong", Georgia, serif;
  /* Physical-object language (Monster Prom rubric 1/15): thick ink outlines and
     HARD offset shadows — a die-cut sticker drops a shadow, it doesn't glow. */
  --ink-line: 2.5px solid #241335;
  --shadow-hard: 0 4px 0 rgba(36, 19, 53, 0.9);
  --shadow-hard-lg: 0 7px 0 rgba(36, 19, 53, 0.75);
  /* chat identity: WeChat-idiom green for YOUR bubbles, paper for theirs */
  --chat-me: #8fe36f; --chat-me-fg: #14211a;
  /* radius scale — pick from these three, nothing else: chips/pills 999, cards 14, sheets 18 */
  --r-pill: 999px; --r-card: 14px; --r-sheet: 18px;

  /* Scene-UI palette. The paintings are loud, so the interface is three
     neutrals and nothing else: ink (near-black, a hair cool so it reads as
     glass over warm art), paper (warm white — never pure #fff, which glares),
     haze (muted grey for anything secondary). The ONLY colour permitted over
     the art is a character's own accent, on their nameplate, because that's
     information rather than decoration. */
  --paper: #f2efe9;
  --haze: #a49fae;

  /* These two carry the theme. Every hardcoded glass panel and every subtle white
     edge in the sheet reads through them now (see the rgba(var(--…-rgb)) rewrites),
     so LIGHT mode is one override block rather than 100 edits. --glass-rgb: what a
     translucent surface is made of; --edge-rgb: the colour of a hairline/hover ON
     it. Dark theme: dark glass, white edges. */
  --glass-rgb: 14, 12, 18;
  --edge-rgb: 255, 255, 255;
  --ink-60: rgba(var(--glass-rgb), 0.60);
  --ink-84: rgba(var(--glass-rgb), 0.84);
  --hairline: rgba(var(--edge-rgb), 0.14);
  --page-bg: #191026;   /* ground behind everything: body, map letterbox */
  --card: #2a1c44;      /* opaque panels: phone rows, drill boards */
  --card-2: #332352;
  --phone-a: #1c1926;   /* the phone slab gradient */
  --phone-b: #131118;
  --emph-fg: #14121a;   /* text on an emphasis button (paper-filled) — dark here */
  --title: #ffffff;     /* colored title text: bold white in dark mode */
  --chip-bg: rgba(150,110,220,0.18); --chip-fg: #e0d2ff; --chip-bd: rgba(150,110,220,0.45);
  --chip-no-bg: rgba(232,72,63,0.16); --chip-no-fg: #ffb3ad; --chip-no-bd: rgba(232,72,63,0.4);
  --field-bg: rgba(0,0,0,0.38); --field-fg: var(--paper);
}

/* ---------- LIGHT THEME ----------
   Light mode is the PAPER world (Lau, cycle 5): the same cream stock, ink
   outlines and hard offset shadows as the enrollment form — never frosted
   white iOS glass (that look lost cycle 1). The tokens here go warm: cream
   grounds, ink text, a registrar's-red title voice. Surfaces that are objects
   in the FICTION (scene pills over paintings, the drills' night stage, the
   binary plaque, graduation) stay pinned to night; the re-materialized paper
   chrome lives in the round-11 block near the end of this file. `data-theme`
   (set by the Settings toggle) wins over any OS preference. */
:root[data-theme="light"] {
  --prom-paper: #f2eedb; --prom-ink: #28394b; --prom-ink-muted: #526576;
  --prom-success: #0d6b57; --prom-danger: #a8231a;
  --night: #f1ead9; --night2: #e9e1cb; --panel: #faf5e6; --panel2: #f0e8d3;
  --line: #d3c5a5; --ink: #241335; --dim: #6b5e6f; --out: #241335;
  --paper: #241335;     /* "paper" is the text-over-glass colour → ink now */
  --haze: #6b5e6f;      /* 4.9:1 on the cream grounds — pinyin/gloss stay readable */
  --glass-rgb: 250, 245, 230;   /* translucent surfaces are made of cream */
  --edge-rgb: 36, 19, 53;       /* hairlines/hovers are ink, not white */
  --page-bg: #f1ead9;
  --card: #faf5e6; --card-2: #f0e8d3;
  --phone-a: #faf5e6; --phone-b: #f0e7d0;
  --emph-fg: #f6f0e2;   /* emphasis button fill is ink in light mode → cream text */
  --title: #8c2333;     /* colored title text: the registrar's red on paper */
  --chip-bg: rgba(106,63,160,0.1); --chip-fg: #4a2d80; --chip-bd: rgba(106,63,160,0.4);
  --chip-no-bg: rgba(200,40,32,0.08); --chip-no-fg: #9a1b12; --chip-no-bd: rgba(200,40,32,0.35);
  --field-bg: #ffffff; --field-fg: #241335;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--night); color: var(--ink); font-family: -apple-system, system-ui, sans-serif; overflow: hidden; }
.han { font-family: var(--han); }
.dim { color: var(--dim); font-weight: 400; font-size: 0.85em; }
#app { height: 100%; display: flex; flex-direction: column; }
button { font-family: inherit; cursor: pointer; }

/* ---------- THE 16px RULE (iOS zoom trap) ----------
   Mobile Safari force-zooms the whole page the moment you focus a field whose
   computed font-size is under 16px — and it does NOT zoom back out when you
   blur. The player is left on a magnified, side-scrolling page with no way
   back. It is invisible on desktop and in every desktop devtools emulator,
   which is exactly why it keeps coming back.
   So: 16px is the FLOOR for anything focusable and typeable, everywhere in the
   game. This is the base net for fields nobody styled; the handful of rules
   that used to set 13-15px have been raised at their own selectors (search
   this file for "16px floor"). If you ever want a smaller field, shrink the
   BOX (height/padding), never the font. */
input, select, textarea { font-size: 16px; }

/* ---------- title ----------
   (the old .title-screen/.title-han pre-enrollment layout is gone — the live
   title classes are .title-hero/.title-wordmark/.title-latin, styled in the
   polish pass near the end of this file) */
.card { background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 18px; }
.namepick { max-width: 560px; width: 100%; }
.namepick h3 { margin: 0 0 10px; }
.namegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.namebtn { background: var(--panel2); border: 2px solid var(--line); border-radius: 10px; color: var(--ink); padding: 10px; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.namebtn .han { font-size: 22px; font-weight: 800; }
.namebtn em { color: var(--dim); font-style: normal; font-size: 12px; }
.namebtn.sel { border-color: var(--magenta); box-shadow: 0 0 0 2px rgba(255,79,163,0.3); }
.bigbtn { background: var(--magenta); color: #fff; border: 3px solid var(--out); border-radius: 999px; font-size: 17px; font-weight: 800; padding: 10px 26px; width: 100%; }
.bigbtn:hover { filter: brightness(1.1); }
.warn { margin-top: 10px; color: #ff8d86; font-size: 13px; }

/* ── Enrollment (title) screen: the school gate photo, one frosted card ────────── */
.enroll-screen { height: 100%; overflow: auto; display: flex; align-items: center; justify-content: center;
  padding: 24px 18px; background-size: cover; background-position: center; background-repeat: no-repeat; }
.enroll-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 20px;
  padding: 28px 26px 26px; border-radius: 22px;
  background: rgba(14, 10, 22, 0.62); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.enroll-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.enroll-eyebrow { font-family: var(--han); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #ff9ecd; }
.enroll-title { margin: 0; font-size: clamp(22px, 5.5vw, 28px); font-weight: 800; line-height: 1.12; color: #fff; text-wrap: balance; }
.enroll-sub { margin: 2px 0 0; font-size: 13.5px; line-height: 1.5; color: rgba(255, 255, 255, 0.78); max-width: 46ch; text-wrap: balance; }
.enroll-q { display: flex; flex-direction: column; gap: 9px; }
.enroll-label { font-size: 13.5px; font-weight: 700; color: rgba(255, 255, 255, 0.92); letter-spacing: 0.01em; }
.enroll-namewrap { display: flex; flex-direction: column; gap: 6px; }
.enroll-namewrap input { width: 100%; background: rgba(0, 0, 0, 0.32); color: #fff; caret-color: #ff4fa3;
  border: 1.5px solid rgba(255, 255, 255, 0.16); border-radius: 12px; padding: 13px 15px; font-size: 18px; font-family: var(--han); }
.enroll-namewrap input::placeholder { color: rgba(255, 255, 255, 0.4); font-size: 15px; }
.enroll-namewrap input:focus { outline: none; border-color: #ff4fa3; box-shadow: 0 0 0 3px rgba(255, 79, 163, 0.22); background: rgba(0, 0, 0, 0.4); }
.enroll-hint { font-size: 11.5px; line-height: 1.45; color: rgba(255, 255, 255, 0.5); }
.enroll-langrow { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.enroll-lang { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 6px;
  background: rgba(255, 255, 255, 0.05); border: 1.5px solid rgba(255, 255, 255, 0.14); border-radius: 12px;
  color: rgba(255, 255, 255, 0.72); cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.1s; }
.enroll-lang:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.28); }
.enroll-lang b { font-size: 14px; font-weight: 700; color: #fff; }
.enroll-lang span { font-size: 11px; color: rgba(255, 255, 255, 0.6); }
.enroll-lang.sel { background: rgba(255, 79, 163, 0.16); border-color: #ff4fa3; box-shadow: 0 0 0 1px rgba(255, 79, 163, 0.4); }
.enroll-lang.sel span { color: #ffbfe0; }
.enroll-go { margin-top: 2px; background: linear-gradient(150deg, #ff4fa3, #d42d84); color: #fff; border: none;
  border-radius: 999px; font-size: 17px; font-weight: 800; font-family: var(--han); padding: 14px; cursor: pointer;
  box-shadow: 0 10px 28px rgba(255, 79, 163, 0.42); transition: filter 0.15s, transform 0.1s; }
.enroll-go:hover { filter: brightness(1.08); }
.enroll-go:active { transform: translateY(1px); }
.enroll-card .imebar { margin-bottom: 0; }

/* ---------- map ---------- */
/* The painted town fills the page. The old purple gradient (#241636 -> #191026)
   was the "background" you could see around a small map panel; the art is the
   background now, so the screen underneath only needs a neutral ground for the
   strip below the artwork. */
.map-screen { position: relative; height: 100%; display: flex; flex-direction: column; padding: 0; gap: 0; overflow: auto;
  background: var(--page-bg); }
/* the day banner and phone float ON the sky, the way the scene UI floats on art */
.map-head { position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: flex-start; gap: 14px; padding: 12px 14px; padding-right: 64px; } /* clear the floating gear; top-align so the Phone button lines up with the gear */
/* When the "Report bug" pill is present it floats left of the gear (right:64px, ~95px
   wide), so 64px no longer clears the corner and the Phone button lands under it.
   Widen the reserve to clear both — only above the narrow breakpoint, since below 700px
   the pill drops beneath the gear and 64px is enough again (no silly gap either way). */
@media (min-width: 701px) { body:has(.bug-fab) .map-head { padding-right: 172px; } }
.map-screen > .map-hint, .map-screen > .loc-grid { margin: 12px 14px; }
.map-screen > .loc-grid:last-child { margin-bottom: 18px; }
.day-banner { background: rgba(var(--glass-rgb), 0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--hairline); border-radius: 12px; padding: 8px 16px; display: flex; flex-direction: column; }
.day-banner b { color: var(--title); font-size: 15px; }
.day-banner span { color: var(--paper); font-size: 15px; font-weight: 700; }
/* the three day-period dots live along the bottom of the day banner now */
.day-banner .slot-dots { margin-top: 6px; }
.slot-dots { display: flex; gap: 7px; }
.dot { width: 11px; height: 11px; border-radius: 50%; border: 2.5px solid var(--line); display: inline-block; }
.dot.done { background: var(--teal); border-color: var(--teal); }
.dot.now { border-color: var(--magenta); }
.phone-btn { position: relative; margin-left: auto; height: 42px; box-sizing: border-box; display: flex; align-items: center;
  background: var(--panel2); color: var(--title); border: 2px solid var(--line); border-radius: 10px; padding: 0 16px; font-family: var(--han); font-weight: 700; }
/* the unread count rides the corner as a badge — the game's magenta, not Apple's red */
.phone-btn .badge { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-items: center; background: var(--magenta); color: #fff; border: 2px solid var(--out);
  border-radius: 999px; font-size: 11px; font-weight: 800; line-height: 1; box-shadow: 0 2px 0 rgba(36,19,53,0.6); }
.map-hint { background: rgba(var(--glass-rgb), 0.72); border: 1.5px dashed var(--hairline); border-radius: 10px; padding: 7px 14px;
  color: var(--haze); font-size: 12.5px; }
.map-hint b { color: var(--title); }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
/* The strip under the painting: near-black glass so the town stays the loudest
   thing on the page. These were purple panels, which read as "purple background
   at the bottom" once the art moved in above them. */
.scene-card { display: flex; align-items: center; gap: 12px; text-align: left; background: rgba(var(--glass-rgb), 0.72);
  backdrop-filter: blur(10px) saturate(1.1); -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border: 1px solid var(--hairline);
  border-radius: 14px; padding: 10px 12px; color: var(--ink); position: relative; transition: transform 0.08s, border-color 0.08s; }
.scene-card:hover { transform: translateY(-2px); border-color: var(--paper); }
.scene-card.free { opacity: 0.92; }
.scene-card.promposal { border-color: var(--magenta); background: linear-gradient(135deg, #3a1c44, var(--panel)); }
.sc-av { width: 54px; height: 54px; flex: none; }
.sc-av svg { width: 100%; height: 100%; }
.sc-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sc-info b { font-size: 15px; }
/* Not gold. The remaining .han on a card is the character's NAME and your band
   with them (胡多多 · 好朋友) — information, not a heading. The gold Chinese scene
   TITLES are gone entirely: they restated the English title one line above, which
   is why they read as decoration nobody could explain. */
.sc-info .han { color: var(--paper); font-size: 14.5px; font-weight: 600; }
.sc-info em { color: var(--dim); font-size: 12px; font-style: normal; }
.sc-tag { position: absolute; top: 8px; right: 10px; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(62,230,196,0.15); color: var(--teal); border-radius: 999px; padding: 2px 8px; }
.sc-tag.free { background: rgba(185,168,214,0.15); color: var(--dim); }
.sc-tag.prom { background: rgba(255,79,163,0.2); color: var(--magenta); }
.nap-btn { align-self: center; background: none; border: 2px dashed var(--line); color: var(--dim); border-radius: 999px; padding: 8px 18px; }

/* ---------- scene ---------- */
.scene-screen { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: safe flex-end; overflow-x: hidden; overflow-y: auto; background: var(--page-bg); }
/* ---------- scene UI: neutral ink over vibrant art ----------
   Palette discipline: the paintings carry ALL the colour, so the interface
   uses exactly three values — ink (near-black, faintly cool), paper (warm
   white), and haze (muted grey) — plus ONE accent that is never decorative:
   a character's own colour, used only on their nameplate. Everything else
   earns attention through contrast and blur, not hue. */
.scene-top { position: relative; flex-shrink: 0; margin-bottom: auto; display: flex; justify-content: space-between;
  align-items: flex-start; padding: 12px 14px; gap: 10px; z-index: 4; pointer-events: none;
  background: linear-gradient(180deg, rgba(8,7,11,0.55), transparent); }
/* the floating settings gear lives at right:14px — keep the MUST-USE rail (and
   anything else in this row) clear of it so they never overlap */
.scene-top { padding-right: 64px; }
.scene-top > * { pointer-events: auto; }
/* floating over the art: a whisper of ink behind the text, no panel */
/* one text treatment across the top-row pills: 15px / 700 / --paper, matching the
   Mood + Stranger badges over the character's head */
.scene-banner { display: flex; flex-wrap: wrap; min-width: 0; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--paper);
  background: var(--ink-60); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 6px 8px 6px 14px; }
.scene-banner b { color: var(--paper); font-weight: 700; }
.scene-banner span { color: var(--paper); font-weight: 700; }
.scene-banner .han { color: var(--paper); font-weight: 700; font-size: 1em; } /* the location's Chinese reads as clearly as its English */
.leavebtn { background: rgba(var(--edge-rgb), 0.07); border: 1px solid var(--hairline); color: var(--paper);
  border-radius: 999px; padding: 4px 14px; font-size: 15px; font-weight: 700; transition: all 0.12s; }
.leavebtn:hover { color: var(--paper); background: rgba(var(--edge-rgb), 0.14); }
/* Locked until the MUST-USE phrases land: dimmed, but never hidden — a door you
   can see is a goal, a door that isn't there is a mystery. */
.leavebtn.locked { opacity: 0.4; cursor: not-allowed; }
.leavebtn.locked:hover { color: var(--haze); background: rgba(var(--edge-rgb), 0.07); }
/* Earned: the one thing on screen asking to be pressed. */
.leavebtn.ready { opacity: 1; color: var(--emph-fg); background: var(--paper); border-color: var(--paper);
  animation: leaveReady 1.5s ease-in-out infinite; }
.leavebtn.ready:hover { color: var(--emph-fg); background: var(--paper); transform: scale(1.06); }
@keyframes leaveReady {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--edge-rgb), 0.55); }
  50% { box-shadow: 0 0 0 7px rgba(var(--edge-rgb), 0); }
}
@media (prefers-reduced-motion: reduce) { .leavebtn.ready { animation: none; } }
/* "You killed this one" — the scene's curtain call, inside the log where the
   player is already looking. */
.donecard { display: flex; flex-direction: column; gap: 3px; text-align: center;
  background: rgba(var(--edge-rgb), 0.1); border: 1px solid rgba(var(--edge-rgb), 0.28);
  border-radius: 12px; padding: 9px 14px; }
.donecard b { color: var(--paper); font-size: 14px; }
.donecard span { color: var(--haze); font-size: 12px; line-height: 1.45; }
.donecard span b { font-size: 12px; }
/* The MUST-USE phrases live in their own column on the right edge, below the
   settings gear — four separate pills, not one bar of inline chips. Desktop
   only, now: on a phone the rail leaves the corner to the mood/bond pills and
   docks above the dialogue sheet instead (see the phone block below). */
.chip-stack { position: fixed; top: 64px; right: 14px; z-index: 4;
  display: flex; flex-direction: column; align-items: flex-end; gap: 7px; max-width: 220px; }
.rail-label { align-self: flex-end; color: var(--paper); font-size: 13px; font-weight: 700;
  white-space: nowrap; background: var(--ink-60); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 4px 12px; }
.rail-label b { color: var(--paper); }
#chips { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
/* Same opaque fill and border as the gear/day-banner it sits under — each phrase
   is its own pill, right-aligned, wrapping to a second line rather than the row. */
.chip { font-family: var(--han); font-size: 16px; font-weight: 600; background: var(--panel2);
  border: 2px solid var(--line); border-radius: 999px; padding: 6px 16px; color: var(--paper); cursor: pointer;
  text-align: right; transition: all 0.15s; }
.chip:hover { border-color: var(--magenta); }
/* landed = solid paper fill. The only "success" signal, and it needs no colour. */
.chip.hit { background: var(--paper); border-color: var(--paper); color: var(--emph-fg); }
.chip.bonus { border-color: var(--paper); color: var(--paper); }
.chip.pop { animation: chippop 0.6s cubic-bezier(0.2, 2.2, 0.4, 1); }
@keyframes chippop { 0% { transform: scale(1); } 35% { transform: scale(1.3) rotate(-3deg); box-shadow: 0 0 16px rgba(var(--edge-rgb), 0.55); } 100% { transform: scale(1); } }
/* the painting fills the whole screen; the top bar and dialogue float on top of
   it rather than pushing it into a letterbox */
.scene-stage { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; z-index: 1; }
.backdrop { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.9; }

/* painted backgrounds: the JPEG is the base layer; the SVG dressing hides
   beneath it and only shows if the image fails to load (graceful fallback).
   The time-of-day wash (todlayer z2) and weather (wxlayer z3) layer on top. */
/* THE BACKDROP MAY NOT WIDEN THE BOX IT DECORATES. Measured at 390x844: the
   drill stage's copy of this <img> reports a 406px rect inside a 390px
   viewport, because .mg-stagebg scales it 1.04 to hide its own blur halo (see
   the note there) — a decorative bleed that had no business showing up in
   .minigame's scrollWidth, and Lau's rule is that nothing ever scrolls
   sideways. The bleed stays; `contain: paint` is what makes the clip a promise
   rather than a coincidence — an overflow:hidden box still contributes its
   descendants' geometry in some paint/scroll paths, a paint-contained one
   cannot, and it costs nothing here because the layer is already positioned and
   already clipped. max-width on the image for the same reason from the other
   end: whatever a drill does to it, it never asks for more than the box. */
.painted-bg { position: absolute; inset: 0; overflow: hidden; contain: paint; }
.painted-bg img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: 100%; object-fit: cover; object-position: center 38%; }
.painted-bg .painted-fallback { position: absolute; inset: 0; opacity: 0; }
.painted-bg .painted-fallback .backdrop { opacity: 1; }
.painted-bg.failed img { display: none; }
.painted-bg.failed .painted-fallback { opacity: 1; }
.painted-vignette { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 30%, transparent 55%, rgba(8,7,11,0.4) 100%),
              linear-gradient(180deg, transparent 60%, rgba(8,7,11,0.5)); }

.portrait-glow { display: none; }
.portrait-wrap { width: min(46vh, 300px); transition: transform 0.25s ease; transform-origin: bottom center; position: relative; }
.portrait-wrap svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 10px 24px rgba(0,0,0,0.5));
  animation: breathe 4.5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: translateY(-4px) scale(1.006); } }
@media (prefers-reduced-motion: reduce) { .portrait-wrap svg { animation: none; } }
.gesture { min-height: 16px; margin: 2px 2px 6px; color: var(--ink); opacity: 0.82;
  font-size: 12.5px; font-style: italic; }
.gesture:empty { margin: 0; min-height: 0; }

/* ---------- dialogue: a narrow ink panel that lets the art breathe ---------- */
.dlg { position: relative; z-index: 3; width: min(920px, 100%); margin: 0 auto 18px; padding: 20px 20px 14px;
  background: var(--ink-84); backdrop-filter: blur(20px) saturate(1.1); -webkit-backdrop-filter: blur(20px) saturate(1.1);
  border: 1px solid var(--hairline); border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55); }
.dlg-name { position: absolute; top: -14px; left: 22px; color: #fff; font-weight: 700; font-size: 13px;
  letter-spacing: 0.02em; border-radius: 999px; padding: 4px 15px; border: 0;
  box-shadow: 0 6px 20px rgba(0,0,0,0.55); display: flex; align-items: baseline; gap: 7px; }
.dlg-name .han { font-size: 14.5px; font-weight: 800; }
/* overflow-anchor: none — the browser's scroll anchoring tries to hold the
   VISIBLE text still when lines grow (turning EN on shifted scrollTop 143->214 on
   its own), which fights scrollLogToEnd's "stick to the bottom" intent. This log
   always wants the newest line, so opt out and let the code decide. */
/* dvh, not vh — the dialogue sheet is bottom-anchored, so anything the log
   over-claims is pushed straight under the iOS toolbar (see "THE vh TRAP") */
.dlg-log { max-height: min(190px, 23vh); max-height: min(190px, 23dvh);
  min-height: min(84px, 13vh); min-height: min(84px, 13dvh); overflow-y: auto; display: flex; flex-direction: column;
  gap: 9px; padding: 6px 2px 8px; scrollbar-width: thin; scrollbar-color: rgba(var(--edge-rgb), 0.16) transparent;
  overflow-anchor: none; }
.dlg-log::-webkit-scrollbar { width: 4px; }
.dlg-log::-webkit-scrollbar-thumb { background: rgba(var(--edge-rgb), 0.16); border-radius: 2px; }
.line { max-width: 90%; line-height: 1.6; animation: lineIn 0.26s ease both; }
@keyframes lineIn { from { opacity: 0; transform: translateY(4px); } }
.line.char { font-family: var(--han); font-size: 20px; color: var(--paper); }
/* per-line replay: a small speaker at the end of the sentence (replaced the
   toolbar "replay" button — the sound belongs to the line it replays) */
.line.char .line-say { display: inline-flex; align-items: center; justify-content: center;
  vertical-align: middle; margin-left: 7px; width: 25px; height: 25px; padding: 0;
  border-radius: 999px; border: 1px solid var(--hairline); background: transparent;
  color: var(--haze); cursor: pointer; }
.line.char .line-say:hover { color: var(--paper); border-color: rgba(var(--edge-rgb), 0.35); }
.line.player { align-self: flex-end; font-family: var(--han); font-size: 15.5px; color: var(--paper);
  background: rgba(var(--edge-rgb), 0.09); border: 1px solid var(--hairline);
  border-radius: 14px 14px 3px 14px; padding: 6px 13px; }
.line.sys { align-self: center; display: flex; gap: 6px; flex-wrap: wrap; }
.line-en { display: none; color: var(--haze); font-size: 13px; font-family: system-ui, sans-serif; margin-top: 3px; }
.show-en .line-en { display: block; }
.typing { color: var(--haze); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }
.err { color: #e8a0a0; font-size: 14px; }
/* No underline: every word is tappable, so marking each one just striped the
   whole line with dots — the "tap a word for meaning" hint carries the lesson. */
.w { cursor: pointer; }
/* word + its trailing punctuation travel as one unit — a 。 never starts a line */
.wc { white-space: nowrap; }
/* Hover tints the word in the speaker's signature colour (set as --ch-color on the
   scene / thread). White was invisible on light-mode's near-white dialogue. */
.w:hover { color: var(--ch-color, var(--magenta)); }
/* Karaoke: the word being spoken lights pink and lifts a hair; words already
   sung stay tinted but calmer, so the line reads left-to-right as it's voiced.
   Colour transitions are quick — the sweep is driven off audio playback time. */
.w.kara { color: var(--magenta); font-weight: 700; text-shadow: 0 0 10px rgba(255, 79, 163, 0.5); }
.w.kara-done { color: #ff9ecd; }
.w.kara, .w.kara-done { transition: color 90ms linear, text-shadow 90ms linear; }
.w ruby rt { display: none; font-size: 9.5px; color: var(--haze); font-family: system-ui, sans-serif; letter-spacing: 0; }
.show-pinyin .w ruby rt { display: revert; }
.show-pinyin .dlg-log { line-height: 2.3; }
/* Each pinyin-annotated word gets its own inline-block box with horizontal room,
   so wide readings (chàng, xiǎng) can't spill into the next word's pinyin. Without
   this the ruby overhangs and adjacent readings collide. */
.show-pinyin .line.char .w { display: inline-block; padding: 0 0.35em; }
.w ruby { ruby-align: center; }
.dlg-tools { display: flex; gap: 5px; align-items: center; padding: 4px 0 9px; flex-wrap: wrap; }
.tool { background: transparent; border: 1px solid var(--hairline); color: var(--haze);
  border-radius: 999px; padding: 4px 11px; font-size: 11.5px; font-weight: 600; transition: all 0.12s; }
.tool:hover { color: var(--paper); border-color: rgba(var(--edge-rgb), 0.35); background: rgba(var(--edge-rgb), 0.07); }
.tool.on { border-color: var(--paper); color: var(--paper); }
.dlg-input { display: flex; gap: 9px; align-items: center; }
#say { flex: 1; min-width: 0; background: var(--field-bg); border: 1px solid var(--hairline); color: var(--field-fg);
  border-radius: 999px; padding: 12px 18px; font-family: var(--han); font-size: 16px; outline: none; transition: all 0.15s; }
#say::placeholder { color: rgba(var(--edge-rgb), 0.3); }
#say:focus { border-color: rgba(var(--edge-rgb), 0.45); background: var(--field-bg); filter: brightness(1.04); }
.sendbtn { background: var(--paper); border: 0; color: var(--emph-fg); border-radius: 999px;
  padding: 0 24px; height: 44px; font-weight: 800; font-size: 14.5px; flex: none;
  transition: transform 0.1s, opacity 0.1s; }
.sendbtn:hover { transform: translateY(-1px); opacity: 0.9; }
.sendbtn:active { transform: translateY(1px); }
/* The field stays fully legible during the model wait — it's EDITABLE then, and
   a player composing their next line shouldn't feel the game greying them out.
   Only Send dims: the lock is on submitting, not on thinking. */
.dlg-input.busy #say { opacity: 1; }
.dlg-input.busy .sendbtn { opacity: 0.35; pointer-events: none; }
.suggestion { display: block; background: rgba(var(--edge-rgb), 0.06); border: 1px solid var(--hairline); border-radius: 10px;
  color: var(--paper); padding: 6px 12px; font-size: 14px; }
.suggestion:hover { background: rgba(var(--edge-rgb), 0.13); }
.suggestion .tag { color: var(--haze); font-size: 10.5px; margin-right: 6px; }
.micbtn { background: transparent; border: 1px solid var(--hairline); color: var(--haze); border-radius: 50%;
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; transition: all 0.12s; }
.micbtn:hover { color: var(--paper); border-color: rgba(var(--edge-rgb), 0.35); }
.micbtn.listening { background: var(--paper); color: var(--emph-fg); border-color: var(--paper); animation: micpulse 1.2s infinite; }
@keyframes micpulse { 50% { box-shadow: 0 0 0 8px rgba(var(--edge-rgb), 0.12); } }
.micbtn.unsupported { opacity: 0.35; }
/* ---------- setup card, modals: same three neutrals ---------- */
.setup-card { position: absolute; inset: 0; z-index: 10; background: rgba(10,9,13,0.90);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 24px; transition: opacity 0.3s; }
.setup-card.hidden { opacity: 0; pointer-events: none; }
.setup-card h3 { font-size: 24px; margin: 0 0 6px; color: var(--paper); }
.setup-card h3 .han { color: var(--paper); opacity: 0.7; }
.setup-card p { max-width: 520px; color: var(--haze); }
.setup-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 640px; margin: 12px 0 18px; }
.setup-chips .chip { font-size: 13px; cursor: default; }
.setup-chips .chip b { color: var(--paper); margin-right: 4px; }
.setup-card .bigbtn { width: auto; }

/* ---------- modals ---------- */
/* `inset: 0` on a fixed overlay resolves against iOS's LARGE viewport — the page
   as if the toolbars weren't there — so the bottom of this box is under the
   toolbar (see "THE vh TRAP" above .phone). Cap it at 100dvh and inset the
   padding by the safe areas, so what's centred here is centred in what you can
   actually SEE. */
.binary-modal, .stamps-modal, .phone-modal { position: fixed; inset: 0; z-index: 20; background: rgba(8,7,11,0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  max-height: 100vh; max-height: 100dvh;
  padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom));
  /* Taller than the fold on a phone (a payout card with every stamp and every
     wrong-answer line) => it SCROLLS. The scroller is the OVERLAY, not the
     card: the card's decorations deliberately break its own box — the closer's
     fortune slips hang -42px past the bottom edge, the 合格 seal is absolutely
     placed in the corner — and an overflow:auto on the card would clip the
     slips and scroll the seal away.
     `safe center` is the second half of the fix and it is not optional: a
     centred flex child that overflows spills off BOTH ends, so the top of a
     long card is unreachable no matter how you scroll. Browsers that don't
     know the keyword drop the line and keep the plain `center` above it. */
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  align-items: safe center; }
/* theme-aware card: dark panel in dark mode, white in light mode — the text is
   var(--paper) which flips with the theme, so a fixed dark bg went invisible. */
.binary-card, .stamps-card { background: var(--card); border: 1px solid var(--hairline); border-radius: 18px;
  padding: 24px; max-width: 560px; width: 100%; box-shadow: 0 24px 70px rgba(0,0,0,0.6); }
.binary-card p { font-size: 17px; margin: 0 0 14px; color: var(--paper); }
.binary-opt { display: block; width: 100%; margin: 8px 0; background: rgba(var(--edge-rgb), 0.05); border: 1px solid var(--hairline);
  border-radius: 12px; color: var(--paper); padding: 12px 14px; text-align: left; transition: all 0.12s; }
.binary-opt:hover { border-color: rgba(var(--edge-rgb), 0.4); background: rgba(var(--edge-rgb), 0.11); }
.binary-opt .han { font-size: 18px; display: block; }
.binary-opt span { color: var(--haze); font-size: 13px; }
.stamps-card h3 { font-size: 26px; margin: 0 0 10px; color: var(--paper); }
.stamps-card h3.pass, .stamps-card h3.soft, .stamps-card h3.bad { color: var(--paper); }
.stamps-card h3.bad { opacity: 0.65; }
.stamp-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
/* one neutral stamp; only the heart line earns a tint, because it's the number
   the player actually came for */
.stamp { border: 1px solid var(--hairline); color: var(--haze); border-radius: 999px; padding: 4px 12px;
  font-size: 12.5px; font-weight: 600; opacity: 0; transform: scale(1.6); }
.stamp b { color: var(--paper); }
.stamp.slam { animation: slam 0.28s cubic-bezier(0.2, 1.6, 0.4, 1) forwards; }
@keyframes slam { to { opacity: 1; transform: scale(1); } }
/* hearts read brighter through TEXT, not a heavier outline — one border weight
   across the whole stamp row, so no pill looks accidentally "selected" */
.stamp.hearts { color: var(--paper); }
.stamp.money, .stamp.ok { border-color: var(--hairline); color: var(--haze); }
.stamp.meh { opacity: 0.5; }
.band-change { color: var(--paper); font-weight: 600; }
.outcome { color: var(--haze); }
/* Shared result action: retain a usable touch target at phone widths. */
.stamps-card #stampsDone { min-height: 44px; min-width: 44px; }
.binary-result { color: var(--haze); font-size: 14.5px; }
.event-kicker { color: var(--haze); font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px; }
.event-zh { font-size: 19px; line-height: 1.6; margin: 8px 0 2px; }
.event-py { color: var(--title); font-size: 12.5px; margin: 0; }
.event-en { color: var(--dim); font-size: 13.5px; margin: 4px 0 12px; }
.badge { background: var(--magenta); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; vertical-align: top; }
.msgitem { display: flex; gap: 10px; background: var(--panel); border-radius: 10px; padding: 8px; }
.msgitem.unread { border-left: 3px solid var(--magenta); }
.msgitem .cc-av { width: 38px; height: 38px; }
.msg-zh { font-size: 16px; margin-top: 2px; }
.msg-en { color: var(--dim); font-size: 12px; }
.msg-reply { color: var(--chip-fg); font-size: 13.5px; margin-top: 4px; }
.msg-replies { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.profile-bio { font-size: 12.5px; color: var(--ink); margin-top: 2px; }
.likes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.likechip { font-size: 11.5px; background: var(--chip-bg); color: var(--chip-fg); border: 1px solid var(--chip-bd);
  border-radius: 999px; padding: 1px 8px; cursor: default; }
.likechip.no { background: var(--chip-no-bg); color: var(--chip-no-fg); border-color: var(--chip-no-bd); }
button.likechip { cursor: pointer; }
button.likechip:hover { filter: brightness(1.3); }

/* the living town map */
/* The painted map runs edge to edge with NO frame — a window on the town, not a
   picture of it. The aspect ratio is the artwork's own (2944x1648) and must stay
   locked to it: every MAP_NODES coordinate is a percentage of this image, so the
   moment the box crops or letterboxes, the pins drift off their landmarks. Size
   it by width and let the height follow. */
.townmap { position: relative; width: 100%; flex: none; overflow: hidden;
  border: 0; border-radius: 0; box-shadow: none; background: var(--page-bg); }
.townmap-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* the hand-drawn town survives as the fallback if the painting fails to load */
.townmap > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.townmap.noart > svg { display: block; }
.townmap.noart .townmap-art { display: none; }
/* the art's own sky is bright at the top; keep the floating header legible */
.townmap::after { content: ""; position: absolute; inset: 0 0 auto; height: 92px; pointer-events: none;
  background: linear-gradient(180deg, rgba(8,7,11,0.55), transparent); z-index: 1; }
/* Place labels sit ON a painting now, not on a flat purple strip, so they read
   like the scene UI does: near-black ink, a hairline, and blur — no purple chip
   fighting the lanterns behind it. */
.mapnode { position: absolute; transform: translate(-50%, -50%); background: rgba(var(--glass-rgb), 0.8);
  backdrop-filter: blur(8px) saturate(1.1); -webkit-backdrop-filter: blur(8px) saturate(1.1);
  border: 1px solid var(--hairline); border-radius: 999px; color: var(--paper); font-weight: 800; font-size: 13px;
  padding: 5px 14px; cursor: pointer; z-index: 2; box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  transition: background 0.12s, border-color 0.12s, transform 0.12s; }
.mapnode:hover, .mapnode.sel { border-color: var(--paper); background: rgba(var(--glass-rgb), 0.94);
  transform: translate(-50%, -50%) scale(1.06); }
.mapnode.allnode { border-style: dashed; color: var(--haze); font-size: 11px; }
/* Standing pins: at 30px on a painted town these were unidentifiable smudges —
   you couldn't tell who was waiting for you, which is the whole point of them.
   52px with a ring reads as a face; the name arrives on hover. */
.mappin { position: absolute; width: 52px; height: 52px; transform: translate(-50%, 0); border: none;
  background: none; padding: 0; cursor: pointer; z-index: 1; transition: transform 0.12s;
  border-radius: 50%; box-shadow: 0 0 0 2px rgba(var(--glass-rgb), 0.85), 0 6px 16px rgba(0,0,0,0.55); }
.mappin:hover { transform: translate(-50%, -5px) scale(1.12); z-index: 4;
  box-shadow: 0 0 0 2px var(--paper), 0 10px 22px rgba(0,0,0,0.6); }
.mappin svg, .mappin img { width: 100%; height: 100%; border-radius: 50%; display: block; }
/* the name, on hover — built from the pin's own title so there's one source */
.mappin::after { content: attr(data-name); position: absolute; left: 50%; bottom: calc(100% + 7px);
  transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  background: rgba(var(--glass-rgb), 0.92); border: 1px solid var(--hairline); border-radius: 999px;
  padding: 3px 10px; font-size: 11.5px; font-weight: 700; color: var(--paper);
  opacity: 0; transition: opacity 0.12s; }
.mappin:hover::after { opacity: 1; }
.cc-future { color: var(--dim); font-size: 12px; font-style: italic; }

/* IME candidates */
.imebar { display: none; gap: 6px; padding: 0 0 6px; flex-wrap: wrap; }
.imebar.show { display: flex; }
.imecand { background: var(--panel2); border: 1.5px solid var(--line); border-radius: 8px; color: var(--ink);
  padding: 3px 10px 3px 8px; cursor: pointer; display: flex; gap: 6px; align-items: baseline; }
.imecand:hover { border-color: var(--gold); }
.imecand b { font-size: 16px; }
.imecand .imepy { font-size: 11px; color: var(--dim); }
/* the 1–9 shortcut number, Apple-keyboard style: press it to pick the candidate */
.imecand .imenum { font-size: 11px; font-weight: 700; color: var(--magenta); align-self: center;
  font-variant-numeric: tabular-nums; opacity: 0.85; }
/* the DECISION pill: the conversation's purpose, pinned under the must-use rail.
   pending = dim; answered = inked in (green yes / red no) */

.askresult { border-left: 3px solid var(--gold); padding-left: 10px; }
.promise-hint b { color: var(--gold); }

/* 风波 drama cards: the red of a scandal, worn like a headline */
.sc-tag.drama { background: var(--red); color: #fff; }
.dramacard { border-color: var(--red); }
/* half a heart: the same glyph twice — a dim base with a filled overlay
   clipped to its left half. No half-heart glyph exists; we make one. It
   inherits --heart-color so it matches whichever character's row it's in. */
.hh-halfheart { position: relative; display: inline-block; color: var(--heart-color, var(--magenta)); opacity: 0.55; }
.hh-halfheart .hh-halffill { position: absolute; left: 0; top: 0; width: 55%; overflow: hidden; color: var(--heart-color, var(--magenta)); opacity: 1; }
/* the phone's To-dos page — the main one up top, one row per storm below */
.storyline.quest-main { border-left-color: var(--magenta); }
.storyline.quest-main.done { opacity: 1; border-left-color: var(--teal); }
.storyline { padding: 9px 12px; margin: 0 0 8px; border: 1px solid var(--hairline); border-radius: 10px;
  border-left: 3px solid var(--red); }
.storyline.done, .storyline.concluded, .storyline.expired { border-left-color: var(--line); opacity: 0.75; }
.storyline .story-dots { color: var(--red); letter-spacing: 3px; margin-left: 6px; font-size: 11px; }
.storyline .dim { font-size: 12px; margin-top: 3px; }

/* ‹ › paging arrows on the far right — step through more candidates, Apple-style */
.imenav { display: flex; gap: 4px; margin-left: auto; align-self: stretch; }
.imearrow { background: var(--panel2); border: 1.5px solid var(--line); border-radius: 8px; color: var(--ink);
  min-width: 30px; padding: 0 6px; font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer; }
.imearrow:hover:not(:disabled) { border-color: var(--gold); }
.imearrow:disabled { opacity: 0.35; cursor: default; }

/* tier bonus chip */
.chip.bonus { border-style: dashed; border-color: var(--gold); color: var(--title); }

/* slots + yearbook shelf */
.slotrow { display: flex; gap: 8px; margin-bottom: 12px; }
.slotbtn { flex: 1; background: var(--panel2); border: 2px solid var(--line); border-radius: 10px; color: var(--dim);
  padding: 8px; font-size: 12.5px; cursor: pointer; }
.slotbtn.sel { border-color: var(--magenta); color: var(--ink); }
.slotbtn b { color: var(--title); margin-right: 4px; }
.ybshelf { margin-top: 4px; }
.ybcard { background: var(--panel2); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 6px 0; font-size: 13px; }

/* gifts */
.giftrow { display: flex; align-items: center; gap: 10px; background: var(--panel2); border-radius: 10px; padding: 8px 12px; margin: 6px 0; }
.giftrow .han { font-size: 16px; }
.giftrow .buygift { margin-left: auto; color: var(--title); border-color: var(--gold); }
.giftrow .buygift:disabled { opacity: 0.35; pointer-events: none; }
.ownedtag { color: var(--teal); font-weight: 800; font-size: 12px; }

/* toast + word tip */
/* Notifications wear the same near-black glass as the in-scene pills (headhud,
   scene banner): high-contrast white text on dark blur, one thin hairline, a
   soft drop — game-HUD, not web-alert. The old teal-on-panel text was barely
   readable in light mode. */
.toast { position: fixed; top: 18px; left: 50%; transform: translate(-50%, -30px); opacity: 0; z-index: 40;
  background: rgba(10, 9, 14, 0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.16); color: #fff; border-radius: 999px; padding: 9px 20px;
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); transition: all 0.3s; pointer-events: none; }
.toast b, .toast .han { color: #fff; }
/* a landed phrase gets one gold tick of celebration, not a whole green pill */
.toast.chip { border-color: rgba(255, 205, 100, 0.5); }
.toast.chip::before { content: "✓ "; color: #ffd479; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
/* theme-aware card: --card is dark in dark mode, white in light — the text
   (--ink / --title / --dim) flips with the theme, so a fixed dark bg made the
   gloss invisible in light mode. */
/* Placement is JS-owned (placeWordTip in game.js): above its word so the card
   never covers what it defines, flipped below only when there is no room, and
   clamped to the viewport on both axes. z-index 50 on document.body clears the
   drill panel (.minigame, z-index 30) and therefore everything painted inside
   it — the tutorial coach and the manual included, since .minigame is a fixed
   positioned stacking context and their 70/80 are local to it.
   pointer-events stays none: the card must never block a drill's own target. */
#wordtip { position: fixed; z-index: 50; background: var(--card); color: var(--ink);
  border: 2px solid var(--gold); box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; max-width: min(240px, calc(100vw - 16px));
  opacity: 0; pointer-events: none; transition: opacity 0.15s; }
#wordtip.show { opacity: 1; }
#wordtip .han { font-size: 17px; color: var(--ink); }
#wordtip .py { color: var(--title); margin-left: 6px; }
#wordtip .en { color: var(--dim); }
.show-pinyin .line.char .w::after { content: attr(data-py); display: none; }

.fest-chip { background: rgba(232,72,63,0.15); border: 2px solid var(--red); color: #ffb3a8; border-radius: 999px;
  padding: 6px 14px; font-weight: 800; font-size: 14px; }

@media (max-width: 700px) {
  .map-head { flex-wrap: wrap; gap: 8px; }
  .fest-chip { order: 3; font-size: 12.5px; }
  .map-hint { font-size: 11.5px; }
  .loc-grid { grid-template-columns: 1fr; }
  /* Narrow enough that the 15px desktop banner wraps to two lines and collides
     with the Mood/Stranger badges below it — shrink it back down here only. */
  .scene-banner { font-size: 12px; padding: 5px 6px 5px 12px; gap: 8px; }
  .leavebtn { font-size: 12px; padding: 3px 10px; }
  /* THE RAIL COMES OFF THE TOP-RIGHT CORNER ENTIRELY (Lau: "move the must-use
     words pill to be just above the dialogue box to the top right, so it
     doesn't block Coco's mood and hearts pills"). Dropping it to top:92 was
     meant to clear the .headhud band and did not: the mood/bond cluster floats
     centre-stage at top:max(64px, 10vh - 38px) — 92px at 844 tall — and at 390
     wide the two are in the same 92px line, so the phrases you owe were parked
     on the face you owe them to.
     So it stops floating and becomes what it already looked like: the line
     above the dialogue. .scene-screen is a bottom-justified flex column whose
     only other in-flow child is .dlg, so a static rail lands immediately above
     the sheet, right-aligned to the same 8px margin, and an expanded stack
     grows UPWARD over the painting — no page scroll on either axis, because
     that column is height:100% overflow:hidden.
     position:relative rather than static: a static box ignores z-index, and the
     rail has to stay over the stage (1) the way it always did.
     The width cap gets to grow with the move — 42vw was a corner's worth of
     room (164px, which wrapped two-character phrases onto three lines); above
     the sheet there is a whole screen width to right-align into. */
  .chip-stack {
    position: relative; top: auto; right: auto; z-index: 4;
    align-self: flex-end; max-width: min(70vw, 300px); margin: 0 8px 6px;
  }
  .rail-label { font-size: 11.5px; padding: 3px 10px; }
  /* the rail folds up into its own label on phones: the pill is the handle, the
     tags only unfold when you ask for them (game.js toggles .open). Desktop
     never gets this rule, so there the chips are simply always out. */
  #chips { display: none; }
  .chip-stack.open #chips { display: flex; }
  /* the handle looks tappable when it IS one: a hair more ink and a caret */
  .rail-label::after { content: "▾"; margin-left: 5px; font-size: 10px; display: inline-block;
    transition: transform 0.15s; }
  .chip-stack.open .rail-label::after { transform: rotate(180deg); }
  .chip { font-size: 13px; padding: 5px 12px; }
  .portrait-wrap { width: min(34vh, 210px); }
  .gesture { font-size: 11px; }
  .dlg { margin: 0 8px 8px; padding: 16px 12px 10px; border-radius: 16px; }
  .dlg-log { max-height: min(132px, 20vh); max-height: min(132px, 20dvh); min-height: 70px; }
  .line.char { font-size: 17px; }
  /* the second row is gone: Hint and conversation mode moved up to .dlg-tools
     and the mic moved into the field, so [field][chop] fits one line at 390px */
  .setup-chips .chip { font-size: 12px; }
  .binary-card, .stamps-card { padding: 16px; }
  .mg-head { flex-wrap: wrap; gap: 6px; }
  .mg-score { margin-left: 0; width: 100%; }
  .mg-tones { flex-wrap: wrap; justify-content: center; }
  .mg-tone { padding: 6px 10px; }
  .mg-tone svg { width: 34px; height: 18px; }
  .mg-court { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mg-board { font-size: 20px; padding: 18px 6px; }
  .mg-word .han { font-size: 24px; }
  /* dvh, not vh (see "THE vh TRAP" further down): on a phone the difference is
     the whole Safari toolbar, and the sheet's close button lives in the part
     that goes missing. The safe-area subtraction keeps it off the home bar. */
  .phone { width: 96vw; max-height: 90vh;
    max-height: calc(90dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .credits-card { margin: 8px; padding: 16px; }
  .cc-stats { gap: 12px; }
  .prom-portrait { width: 190px; }
}

/* ============================================================ round 4 */
/* (the .title-cine gate cinematic and .moonrabbit hop were retired with the old
   title screen — zero references left in js/, deleted rather than orphaned) */

/* -- almanac -- */
.almchip { cursor: pointer; }
.almanac-card .alm-rows { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 16px; }
.almanac-card .alm-row { display: grid; grid-template-columns: 52px auto; gap: 3px 12px; align-items: center; text-align: left; }
.almanac-card .alm-row b { font-size: 22px; border: 1px solid var(--hairline); border-radius: 10px; text-align: center;
  padding: 6px 0; color: var(--paper); font-family: var(--han); }
.almanac-card .alm-row.lucky b { font-size: 15px; }
.almanac-card .alm-row span { font-size: 10.5px; letter-spacing: 0.1em; color: var(--haze); font-weight: 700; }
.almanac-card .alm-row em { grid-column: 2; font-style: normal; color: var(--paper); font-size: 13.5px; }

/* -- ensemble scenes: two on stage -- */
.portrait-wrap.duo { display: flex; align-items: flex-end; justify-content: center; gap: 0; }
.duo-slot { width: 46%; max-width: 300px; transition: filter 0.35s, transform 0.35s, opacity 0.35s; transform-origin: bottom center; }
/* the listener isn't faded — they're cast in shadow: full presence, just darkened
   (with a touch of cool tint), the way a spotlight leaves the other in shade. */
.duo-slot.dimmed { filter: brightness(0.45) contrast(1.05) saturate(0.9); }
.duo-slot svg { width: 100%; height: auto; display: block; }
.sc-av.duo-av { display: flex; }
.sc-av.duo-av svg { width: 58%; margin-left: -16%; }
.sc-av.duo-av svg:first-child { margin-left: 0; }
.sc-tag.duo { background: #6a3fa0; }

/* -- polaroids -- */
.pola-strip { display: flex; gap: 12px; overflow-x: auto; padding: 8px 2px 14px; }
.pola { background: #f6f0e2; color: #241335; border-radius: 4px; padding: 8px 8px 10px; width: 150px; flex: none; box-shadow: 0 6px 14px rgba(0,0,0,0.35); transform: rotate(-2deg); cursor: pointer; }
.pola:nth-child(even) { transform: rotate(1.6deg); }
.pola-img { background: var(--card-2); border-radius: 3px; overflow: hidden; height: 110px; display: flex; align-items: flex-start; justify-content: center; }
.pola-img svg { width: 86%; margin-top: 2px; }
/* the painted card fills the polaroid window, framed by the paper itself */
.pola-img .pcard { width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none; aspect-ratio: auto; }
.pola-img .pcard img { object-position: center 22%; }
.pola-line { font-size: 12.5px; line-height: 1.35; margin-top: 6px; max-height: 3.9em; overflow: hidden; }
.pola-en { font-size: 10px; opacity: 0.65; max-height: 2.6em; overflow: hidden; }
.pola-day { font-size: 10px; opacity: 0.55; margin-top: 4px; text-align: right; }
.cc-polas { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0; }
.cc-polas .pola { width: 128px; }

/* -- confession -- */
.confession #fw { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
.confession .portrait-wrap { z-index: 2; }
.conf-prompt { border-left: 3px solid var(--gold, #ffc84a); padding-left: 10px; }

/* -- endings + credits -- */
.cc-ending { margin-top: 10px; padding: 8px 14px; border: 2.5px solid var(--gold, #ffc84a); border-radius: 12px; display: inline-block; }
.cc-ending b { font-size: 20px; letter-spacing: 2px; }
.cc-ending em { display: block; font-style: normal; font-size: 12.5px; opacity: 0.8; }

/* -- school paper -- */
.paper { background: #f2ead6; color: #241335; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; box-shadow: inset 0 0 0 2px rgba(36,19,53,0.15); }
.paper-head { font-weight: 700; font-size: 16px; border-bottom: 2px solid rgba(36,19,53,0.25); padding-bottom: 6px; margin-bottom: 8px; letter-spacing: 1px; }
.paper-head .dim { color: rgba(36,19,53,0.5); font-size: 11px; letter-spacing: 0; }
.paper-item { padding: 6px 0; border-bottom: 1px dashed rgba(36,19,53,0.2); }
.paper-item:last-child { border-bottom: 0; }
.paper-zh { font-size: 17px; }
.paper-py { font-size: 11.5px; color: #8c2333; }
.paper-en { font-size: 12px; opacity: 0.7; }

.haggle-row { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 14px; }
.haggle-row input { width: 130px; font-size: 24px; text-align: center; background: rgba(0,0,0,0.3); color: #fff; border: 2.5px solid var(--teal, #3ee6c4); border-radius: 10px; padding: 8px; }

/* -- the wisp (map pin variant) -- */
.mappin.wisp { background: transparent; border-color: transparent; animation: wispFlicker 2.6s ease-in-out infinite; }
@keyframes wispFlicker { 0%, 100% { opacity: 0.55; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-5px); } }

/* ============================================================ round 5 */
/* -- portrait life: blinks always, mouth flaps only while TTS speaks -- */
.pblink { transform-box: fill-box; transform-origin: center; animation: pblink 4.6s infinite; }
svg .pblink:nth-of-type(odd) { animation-duration: 5.3s; }
@keyframes pblink { 0%, 94.5%, 100% { transform: scaleY(1); } 96%, 98% { transform: scaleY(0.08); } }
.pmouth { transform-box: fill-box; transform-origin: center; }
.talking .pmouth { animation: pflap 0.26s infinite alternate ease-in-out; }
@keyframes pflap { from { transform: scaleY(0.72); } to { transform: scaleY(1.14); } }
@media (prefers-reduced-motion: reduce) { .pblink, .talking .pmouth { animation: none; } }

/* -- weather -- */
.wxchip.rain { border-color: #7ab8e8; color: #bfe0ff; }
.wxchip.wind { border-color: #a8e0b8; color: #d8f2dc; }
.wxlayer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.map-screen > .wxlayer { position: fixed; z-index: 5; }
.wxlayer.rain {
  background-image: repeating-linear-gradient(75deg, transparent 0 12px, rgba(160, 200, 255, 0.14) 12px 13.5px);
  animation: rainfall 0.7s linear infinite;
}
@keyframes rainfall { from { background-position: 0 0; } to { background-position: -46px 130px; } }
.wxlayer.wind {
  background-image:
    radial-gradient(circle 3px at 12% 30%, rgba(232, 200, 120, 0.55) 40%, transparent 41%),
    radial-gradient(circle 2.4px at 40% 60%, rgba(200, 232, 160, 0.5) 40%, transparent 41%),
    radial-gradient(circle 2px at 70% 22%, rgba(232, 200, 120, 0.45) 40%, transparent 41%);
  background-size: 300px 220px, 260px 180px, 340px 260px;
  animation: windblow 5s linear infinite;
}
@keyframes windblow { from { background-position: 0 0, 0 0, 0 0; } to { background-position: 340px 30px, 300px -20px, 380px 40px; } }
@media (prefers-reduced-motion: reduce) { .wxlayer { animation: none; } }

/* -- golden hour -- */
.mappin.golden { border-color: var(--title); box-shadow: 0 0 0 3px rgba(255, 200, 74, 0.35), 0 0 18px rgba(255, 200, 74, 0.7); animation: goldpulse 1.8s ease-in-out infinite; }
@keyframes goldpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.golden-card .golden-portrait { width: 84px; margin: 0 auto 6px; }
.golden-card .golden-portrait svg { width: 100%; height: auto; }

/* -- old shrine -- */
.sc-tag.shrine { background: #6b2a35; }
.deeppick { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.deeppick .binary-opt { display: flex; align-items: center; gap: 12px; text-align: left; }
.deeppick .cc-av { width: 44px; flex: none; }

/* -- coronation + class photo -- */
.corocard { max-width: 560px; }
.corocard #coroFw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.coro-pair { display: flex; gap: 26px; justify-content: center; margin: 16px 0; }
.coro-win { display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.coro-win .crownsvg { width: 46px; margin-bottom: -8px; z-index: 2; filter: drop-shadow(0 3px 0 rgba(14, 6, 24, 0.4)); animation: crowndrop 0.7s cubic-bezier(.2,.8,.3,1.3); }
@keyframes crowndrop { from { transform: translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.coro-win .cc-av.big { width: 84px; height: 84px; }
.coro-win .cc-av.big svg { width: 100%; height: 100%; }
.coro-win .nameav { display: flex; align-items: center; justify-content: center; width: 84px; height: 84px; border-radius: 50%; background: #3a2a58; border: 5px solid var(--gold, #ffc84a); font-size: 34px; }
.coro-win b { font-size: 19px; }
.classphoto { background: var(--card-2); border: 4px solid var(--gold, #ffc84a); border-radius: 12px; padding: 14px 10px 10px; margin: 12px 0; }
.cp-head { text-align: center; font-size: 17px; letter-spacing: 2px; color: #f3eaff; margin-bottom: 10px; }
.cp-row { display: flex; flex-wrap: wrap; gap: 8px 6px; justify-content: center; align-items: flex-end; }
.cp-slot { display: flex; flex-direction: column; align-items: center; width: 62px; position: relative; }
.cp-slot svg { width: 54px; height: 54px; }
.cp-slot .crownsvg { position: absolute; top: -16px; width: 30px; z-index: 2; }
.cp-slot em { font-style: normal; font-size: 10.5px; opacity: 0.85; margin-top: 2px; }
.cp-you { display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 50%; background: #c22d75; border: 4px solid #ffe9b0; font-size: 20px; }
.cp-foot { text-align: center; font-size: 10.5px; opacity: 0.6; margin-top: 8px; }

/* -- field guide -- */
.guide-item { background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(var(--edge-rgb), 0.09); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.guide-item summary { cursor: pointer; font-size: 14.5px; }
.guide-item summary .han { font-size: 16px; }
.guide-item p { margin: 8px 2px 4px; font-size: 13.5px; line-height: 1.55; opacity: 0.9; }

/* ============================================================ round 6 */
/* -- iris transition -- */
.iris { position: fixed; inset: 0; background: #0e0618; z-index: 90; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.iris-plate { text-align: center; animation: plateIn 0.5s ease; }
.iris-plate b { display: block; font-size: 34px; letter-spacing: 6px; color: #f3eaff; }
.iris-plate span { color: #9aa0ae; font-size: 13px; letter-spacing: 2px; }
@keyframes plateIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* -- time of day: one wash, three moods -- */
.todlayer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.todlayer.morning { background: linear-gradient(180deg, rgba(255, 200, 110, 0.13), rgba(255, 170, 90, 0.05) 60%, transparent); }
.todlayer.afternoon { background: linear-gradient(180deg, rgba(140, 190, 255, 0.05), transparent 50%); }
.todlayer.evening { background: linear-gradient(180deg, rgba(60, 40, 130, 0.2), rgba(30, 16, 70, 0.12) 70%, transparent); }

/* -- 班群 group chat -- */
.gc-head { font-weight: 700; font-size: 15px; padding: 4px 2px 10px; border-bottom: 1px solid rgba(var(--edge-rgb), 0.1); margin-bottom: 8px; }
.gc-log { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; max-height: 52dvh; min-height: 0; overflow-y: auto; padding: 2px; }
.gc-day { text-align: center; font-size: 11px; margin: 4px 0; }
.gc-msg { display: flex; gap: 8px; align-items: flex-start; }
.gc-msg .gc-av { width: 30px; height: 30px; flex: none; }
.gc-msg .gc-av svg { width: 100%; height: 100%; }
.gc-name { font-style: normal; font-size: 11px; display: block; margin-bottom: 2px; }
.gc-bubble { background: rgba(var(--edge-rgb), 0.08); border-radius: 4px 12px 12px 12px; padding: 6px 10px; font-size: 15px; max-width: 78%; display: inline-block; }
.gc-msg.you { justify-content: flex-end; }
.gc-msg.you .gc-bubble { background: var(--chat-me); color: var(--chat-me-fg); border-radius: 12px 4px 12px 12px; }
.gc-en { font-size: 10.5px; opacity: 0.55; margin-top: 2px; }
.gc-replybar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 10px 2px 2px; border-top: 1px dashed rgba(var(--edge-rgb), 0.12); margin-top: 8px; }

/* -- talisman craft -- */
.fu-wrap { display: flex; justify-content: center; padding: 8px; }
.fu-wrap canvas { width: min(300px, 78vw); height: auto; border-radius: 8px; touch-action: none; cursor: crosshair; box-shadow: 0 6px 18px rgba(0,0,0,0.4); }

/* -- debate club -- */
.debate-card { max-width: 520px; }
.debate-patterns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 10px 0; }

/* -- endings gallery -- */
.endgallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.endcard { border-radius: 8px; overflow: hidden; border: 2px solid rgba(var(--edge-rgb), 0.12); position: relative; }
.endcard svg { width: 100%; height: auto; display: block; }
.endcard span { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 11.5px; color: #f3eaff; letter-spacing: 1px; }
.endcard.locked svg { filter: grayscale(1) brightness(0.3); }
.endcard.locked span { color: #6a6a7a; }
.cc-endart { margin-top: 10px; }
.cc-endart svg { width: min(240px, 70%); border-radius: 10px; border: 3px solid var(--gold, #ffc84a); }

/* ============================================================ round 7 */
/* -- stickers -- */
.sticker { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; background: #f6f0e2; border-radius: 12px; padding: 8px 12px 6px; width: 86px; }
.sticker svg { width: 56px; height: 56px; }
.sticker b { font-size: 15px; color: #c22d75; letter-spacing: 1px; }
.sticker.small { width: 64px; padding: 6px 8px 4px; }
.sticker.small svg { width: 40px; height: 40px; }
.sticker.small b { font-size: 12px; }
.sticker.locked { background: rgba(var(--edge-rgb), 0.07); }
.sticker.locked b { color: #6a6a7a; font-size: 20px; }
.st-shelf { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.st-drawer { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 2px; border-top: 1px dashed rgba(var(--edge-rgb), 0.12); margin-top: 6px; }
.st-drawer.hidden { display: none; }
.st-send { background: none; border: 0; padding: 0; cursor: pointer; transition: transform 0.15s; }
.st-send:hover { transform: scale(1.08) rotate(-2deg); }
.gc-bubble.stbubble { background: transparent; padding: 2px; }

/* -- custom name -- */
.namebtn.custom { border-style: dashed; }
.customname { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.customname.hidden { display: none; }
.customname input { background: rgba(0, 0, 0, 0.3); color: #fff; border: 2.5px solid var(--pink, #c22d75); border-radius: 10px; padding: 10px 12px; font-size: 18px; }

/* -- graduation reel -- */
/* already a scroller, so it only needs the safe areas — `inset: 0` on iOS is
   the LARGE viewport, so its last 100px sit under the toolbar (see "THE vh TRAP") */
.reel-overlay { position: fixed; inset: 0; background: rgba(10, 5, 18, 0.92); z-index: 80; overflow-y: auto; padding: 14px;
  padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.reel-bar { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; position: sticky; top: 0; z-index: 2; }
.reel-strip { max-width: 460px; margin: 0 auto; background: #160d28; border: 3px solid var(--gold, #ffc84a); border-radius: 14px; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.reel-cover { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.reel-cover svg { width: min(280px, 80%); border-radius: 10px; }
.reel-cover h2 { font-size: 26px; letter-spacing: 3px; }
.reel-cover span { font-size: 13px; opacity: 0.8; }
.reel-day { border-top: 1px dashed rgba(var(--edge-rgb), 0.15); padding-top: 10px; }
.reel-daymark { font-size: 15px; color: var(--title); letter-spacing: 2px; margin-bottom: 6px; }
.reel-feed { font-size: 13px; line-height: 1.5; opacity: 0.85; margin: 4px 0; }
.reel-polas { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.reel-polas .pola { width: 120px; cursor: default; }
.reel-rel { display: flex; gap: 10px; align-items: center; margin: 8px 0; font-size: 13.5px; }
.reel-rel .cc-av { width: 44px; flex: none; }
.reel-end { padding-bottom: 8px; }

/* -- idle helper suggestions -- */
.sugg-head { font-size: 12.5px; opacity: 0.75; margin-bottom: 6px; padding-left: 2px; }
.sugg-row { display: flex; gap: 6px; align-items: stretch; margin: 4px 0; }
.sugg-row .suggestion { flex: 1; }
.sugg-listen { flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; } /* stretches to the chip's height; centers the speaker icon */

/* -- unhappy-path pass -- */
.scene-card.dimcard { opacity: 0.62; }
.scene-card.dimcard:hover { opacity: 0.8; }

/* -- feel pass -- */
.tool.on { border-color: var(--title); color: var(--title); }

/* painted face avatars (cropped from the character art) — drop-in for avatarSVG */
.pav { width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  border: 3px solid var(--gold, #ffc84a); background: var(--card-2); display: block; }

/* ---------- painted sprites on stage ---------- */
/* The cutout stands in the scene like a real VN sprite. It keeps the same pose
   classes the vector portraits used, so breathing/leaning still animate. */
/* Heads reach ~75% up the screen, and the figure is CROPPED at the waist rather
   than scaled down to fit — a shrunken full-body sprite reads as a doll standing
   far away; a cropped one reads as a person standing close. object-fit: cover
   fills the box and lets the bottom run off behind the dialogue; object-position
   pins the top so the head always lands in the same place instead of bobbing
   with each character's proportions. */
.sprite { height: 100%; width: auto; max-width: 100%; object-fit: cover; object-position: top center;
  display: block; filter: drop-shadow(0 12px 28px rgba(0,0,0,0.55)); }
/* The character stands BEHIND the dialogue panel and is partly hidden by it —
   that's the visual novel look, and it's why .dlg sits at z-index 3 over the
   stage's z-index 1. This padding used to reserve MORE room than the panel is
   tall, parking the sprite's feet in a no-man's-land just above it: a hard
   horizontal edge that reads as the art being cut off. Reserve less than the
   panel's height so the figure always tucks in behind it. Never raise this past
   the dialogue's height — the gap comes straight back. */
.scene-stage { padding-bottom: clamp(96px, 16vh, 150px); }
/* The wrap is the crop window. Its TOP sits 10% down the screen, so a head filling
   the top of the sprite lands at ~90% of the height measured from the bottom —
   Lau's call, twice: 75% read as a doll standing too far back. The wrap runs down
   behind the dialogue panel and .sprite's cover fit throws away everything below
   the crop, so a TALLER window shows MORE of the body — 90% lands the cut below
   the waist rather than at it. Change this and .headhud/.emotes must follow: they
   are pinned to the same 10vh. */
.portrait-wrap:has(.sprite) { width: auto; height: 100%; max-height: 100%; display: flex;
  align-items: flex-end; justify-content: center; overflow: hidden; }
.scene-stage:has(.sprite) { padding-top: 10vh; }
/* Duo cutouts: each character OWNS a full half of the stage — full height (big,
   like a solo portrait), natural width, centered in its half, and the half CLIPS
   any overflow so neither figure can spill into or cut off the other. On a wide
   screen the figures fit their halves with room to spare; only a very narrow
   phone trims the outer edges. */
.portrait-wrap.duo:has(.sprite) { width: 100%; max-width: none; gap: 0; }
.portrait-wrap.duo:has(.sprite) .duo-slot { width: 50%; max-width: none; height: 100%; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center; }
.duo-slot .sprite { height: 100%; width: auto; max-width: none; object-fit: cover; object-position: top center; }
.portrait-wrap.duo .duo-slot { height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.portrait-wrap .stagecard { height: 92%; aspect-ratio: 3/4; }
.portrait-wrap .stagecard img { object-position: top center; }

/* In-scene modals share the Send button's treatment: one paper-white primary
   action. The title screen keeps its magenta — nothing competes with it there. */
.stamps-card .bigbtn, .binary-card .bigbtn, .setup-card .bigbtn {
  background: var(--paper); color: var(--emph-fg); border: 0; box-shadow: none; font-size: 15px; padding: 11px 26px; }
.stamps-card .bigbtn:hover, .binary-card .bigbtn:hover, .setup-card .bigbtn:hover { filter: none; opacity: 0.9; }

/* districts that are closed until after school */
/* Shut districts must still be READABLE — they tell you where the night goes, and
   0.35 vanished into a busy painting. Dim the text, keep the chip solid. */
.mapnode.shut { opacity: 0.72; border-style: dashed; cursor: not-allowed; color: var(--haze); }
.mapnode.shut:hover { opacity: 0.9; transform: translate(-50%, -50%); }

/* ---------- must-use phrase card ---------- */
.chipcard { max-width: 420px; text-align: left; }
.chipcard-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 2px; }
.chipcard-head b { font-family: var(--han); font-size: 34px; color: var(--paper); font-weight: 800; }
.chipcard-py { color: var(--haze); font-size: 15px; letter-spacing: 0.04em; }
.chipcard-en { font-size: 17px; color: var(--paper); margin: 0 0 10px; }
.chipcard-note { color: var(--haze); font-size: 13px; line-height: 1.5; margin: 0 0 12px; }
.chipcard-ex { border-top: 1px solid var(--hairline); padding-top: 12px; margin-bottom: 16px; }
.chipcard-exlabel { font-size: 10.5px; letter-spacing: 0.12em; color: var(--haze); font-weight: 700; text-transform: uppercase; }
.chipcard-ex .han { font-size: 19px; color: var(--paper); margin: 6px 0 3px; }
.chipcard-exen { color: var(--haze); font-size: 13.5px; margin: 0 0 10px; }

/* settings: its own door on the map, and the technical stuff folded away */
.set-btn { background: var(--panel2); color: var(--dim); border: 2px solid var(--line); border-radius: 10px;
  padding: 8px 12px; display: grid; place-items: center; }
.set-btn:hover { color: var(--title); border-color: var(--gold); }
.advset { margin: 10px 0; border-top: 1px solid var(--line); padding-top: 10px; }
.advset summary { cursor: pointer; color: var(--dim); font-size: 13px; font-weight: 600; }
.advset[open] summary { margin-bottom: 8px; }

/* Painted character card: the framed portrait for every static spot — the phone's
   Friends list, scene setup cards, polaroids, and the stage for anyone with no
   clean cutout (阿霞). The neutral-scene rewrite dropped this block by accident,
   which left the <img> with no size at all: it rendered at its intrinsic 527x700
   in the Friends list and spilled out of its frame and over the dialogue panel on
   stage. Everything below sizes the image to its frame — keep it that way. */
.pcard { border-radius: 12px; overflow: hidden; border: 3px solid rgba(255, 233, 176, 0.85);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); background: var(--card-2); aspect-ratio: 3/4; }
.pcard img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.pcard.novart { display: flex; align-items: center; justify-content: center; }
.pcard.novart svg { width: 100%; height: 100%; }
/* Friends tab: painted card left, details right */
.contact { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border-radius: 10px; padding: 8px; }
.contact .cc-av { width: 44px; height: 44px; }
.contact.painted { display: flex; gap: 12px; align-items: flex-start; }
.contact.painted .contact-art { flex: none; width: 84px; }
.contact.painted .contact-art .pcard { width: 84px; }
.mems { color: var(--dim); font-size: 12px; margin-top: 3px; }

/* contacts: likes/dislikes now read in English and unlock as you learn them */
.likechip { background: var(--chip-bg); border: 1px solid var(--chip-bd); color: var(--chip-fg);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.likechip.no { background: var(--chip-no-bg); border-color: var(--chip-no-bd); color: var(--chip-no-fg); }
.locknote { font-size: 11.5px; margin-top: 6px; font-style: italic; }

/* ---------- minigames, spell FX, Study tab ----------
   Restored: the neutral-scene rewrite (7dad718) deleted this whole block while
   re-skinning the CONVERSATION UI, which these screens are not. Losing
   `.minigame` was the worst of it — it's the fixed full-screen panel, so without
   it the drills stopped being a screen at all and became loose rows stacking in
   page flow on top of the map. That's the "jank", and the phantom duplicate too.
   The Study tab lost its spellcards and wrongbook the same way.
   These screens live on the purple panel palette on purpose; only the scene UI
   went neutral, because only the scene UI sits on top of a painting. */
.minigame { position: fixed; inset: 0; z-index: 30; background: var(--night); display: flex; flex-direction: column;
  align-items: center; padding: 14px; gap: 10px; overflow: auto; }
/* NOTHING SCROLLS SIDEWAYS. Measured at 390x844: seven of thirteen drills had
   .minigame.scrollWidth past its clientWidth (boba 400, clinic 406, dance 406,
   forge 406, hoops 406, cloze 392, history 410) — a phone board you can shove
   off its own left edge.
   Two rules, and the order matters. First the honest one: the drills size their
   furniture in vw ("almost the whole screen") while this column is padded, so a
   centred `width: min(720px, 94vw)` child is wider than the content box it sits
   in and pokes out both sides. 100% IS almost the whole screen in here, and it
   knows about the padding. Direct children only — an absolutely positioned one
   resolves 100% against the padding box, so the stage backdrop and the head
   keep the full bleed they were drawn for.
   Then the backstop, and it is only a backstop: overflow-x CLIP rather than
   hidden, because hidden on one axis forces the other to auto and this column's
   vertical scrolling is load-bearing (several boards are taller than a phone).
   Clip also cannot be scrolled programmatically, so a stray focus() on
   something half off-screen can no longer slide the board sideways. */
.minigame > * { max-width: 100%; }
.minigame { overflow-x: clip; overflow-y: auto; }
.mg-bigprompt { min-height: 74px; text-align: center; font-size: 24px; line-height: 1.6; padding: 8px 14px;
  display: flex; flex-direction: column; justify-content: center; }
.mg-bigprompt .blank { color: var(--magenta); letter-spacing: 2px; }
.mg-board.quiz { font-size: 19px; padding: 16px 10px; }
.mg-court.quiz { width: min(760px, 95vw); }
.mg-prompt { display: flex; align-items: center; gap: 14px; min-height: 40px; flex-wrap: wrap; justify-content: center; }
.mg-reveal { font-size: 16px; color: var(--dim); }
.mg-reveal .han { font-size: 24px; color: var(--title); margin-right: 6px; }
.okmark { color: var(--teal); font-weight: 900; margin-left: 8px; }
.badmark { color: #ff8d86; font-weight: 800; margin-left: 8px; }
.cardget { color: var(--title); font-weight: 800; margin-left: 8px; }
.mg-timerwrap { width: min(920px, 96vw); height: 10px; background: var(--panel); border-radius: 999px; overflow: hidden;
  border: 2px solid var(--line); }
.mg-timer { height: 100%; width: 100%; background: var(--teal); transition: background 0.2s; }
.spellfx { position: absolute; inset: 0; pointer-events: none; }
.spellfx span { position: absolute; left: 50%; top: 44%; width: 10px; height: 10px; border-radius: 2px;
  background: var(--gold); transform: rotate(45deg);
  animation: spellburst var(--d, 0.8s) ease-out forwards; rotate: var(--a); }
@keyframes spellburst {
  0% { opacity: 1; translate: 0 0; scale: 0.6; }
  100% { opacity: 0; translate: 0 -130px; scale: 1.4; }
}
.study-h { margin: 6px 0 4px; color: var(--title); font-size: 15px; }
.cardshelf { display: flex; flex-wrap: wrap; gap: 6px; }
.spellcard { border-radius: 8px; padding: 4px 10px; font-size: 14px; font-weight: 800; cursor: help; }
.spellcard.got { background: rgba(255,200,74,0.15); border: 2px solid var(--gold); color: var(--title); }
.spellcard.locked { background: var(--panel); border: 2px dashed var(--line); color: var(--dim); opacity: 0.6; }
.wrongitem { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 8px; padding: 6px 10px; }
.wrongitem .han { font-size: 16px; }
.misscount { margin-left: auto; color: #ff8d86; font-weight: 800; font-size: 12px; }

/* The desktop base rules for the minigame chrome, also lost in 7dad718. Only the
   @media (max-width:700px) overrides survived, which is why an audit for
   ".mg-board" looked fine while the drills rendered as raw browser buttons on a
   laptop: the mobile block supplied a font-size and nothing else. Restored from
   7dad718^ — if you touch these, check them at BOTH widths. */
.mg-head { display: flex; align-items: center; gap: 14px; width: min(920px, 96vw); }
.mg-head b.han { color: var(--title); font-size: 19px; }
.mg-head > span { color: var(--dim); font-size: 12.5px; }
.mg-score { margin-left: auto; color: var(--ink); }
.mg-score b { color: var(--teal); }
#mgCanvas { width: min(920px, 96vw); height: auto; border: 3px solid var(--out); border-radius: 14px;
  box-shadow: 0 0 0 2px var(--line); }
.mg-word .han { font-size: 30px; font-weight: 900; color: var(--ink); margin-right: 8px; }
#mgQmark { color: var(--magenta); font-weight: 800; }
.mg-tones { display: flex; gap: 10px; }
.mg-tone { background: var(--panel); border: 2.5px solid var(--line); border-radius: 12px; color: var(--ink);
  padding: 8px 16px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.mg-tone:hover { border-color: var(--teal); color: var(--teal); }
.mg-tone b { font-size: 20px; line-height: 1; }
.mg-tone svg { width: 44px; height: 22px; }
.mg-court { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(720px, 94vw); margin-top: 6px; }
.mg-board { background: var(--panel); border: 3px solid var(--line); border-radius: 16px; color: var(--ink);
  font-size: 26px; font-weight: 900; padding: 26px 10px; cursor: pointer; transition: border-color 0.1s, transform 0.08s; }
.mg-board:hover { border-color: var(--gold); transform: translateY(-2px); }

/* ---------- the phone ----------
   Restored and rebuilt. 7dad718 deleted .phone, .phone-tabs, .ptab and
   .phone-body — the panel itself — so the phone had no background at all and the
   Class Chat appeared to float transparently over the town. It wasn't a styling
   opinion, it was a hole.
   Rebuilt as an actual object: a dark glass slab on a dimmed room, the way Persona
   and Monster Prom do it. One accent (the game's magenta) earns its place on
   exactly two things — your own bubbles and the unread badge. Everything else is
   ink, hairline, haze, so the CONTENT is the colour. */
/* FIXED height, not max-height: a phone shouldn't grow and shrink as you flip
   between Friends and Settings. The tabs and body are laid out so the body flexes
   to fill whatever's left and scrolls if a tab overflows — so the frame is the
   same size on every tab, and short tabs just have room to spare. */
/* THE vh TRAP (read this before you touch any height in this file).
   On iOS Safari `vh` resolves against the LARGE viewport — the page as it would
   be with the URL bar and the bottom toolbar hidden — but those toolbars OVERLAY
   the page. So 86vh is genuinely taller than the ~86% of screen you can actually
   see and touch, and the bottom of a "fits on screen" sheet sits under the
   toolbar. `dvh` is the honest unit: it tracks the viewport as it currently is.
   Every sheet below therefore ships the vh line first (fallback for browsers
   with no dvh) and the dvh line immediately after; the later one wins wherever
   it parses. Rule: if it's taller than the fold it SCROLLS — it never overflows
   off-screen. */
.phone { width: min(400px, 94vw); height: min(640px, 86vh); height: min(640px, 86dvh); display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, var(--phone-a) 0%, var(--phone-b) 100%);
  border: 1px solid rgba(var(--edge-rgb), 0.11); border-radius: 26px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.72), inset 0 1px 0 rgba(var(--edge-rgb), 0.07); }
.phone-body { flex: 1 1 auto; min-height: 0; }

/* tabs: a scrolling pill rail, not a row of squashed buttons fighting for width */
.phone-tabs { display: flex; align-items: center; gap: 4px; flex: none; padding: 10px 10px 9px;
  background: rgba(var(--edge-rgb), 0.035); border-bottom: 1px solid rgba(var(--edge-rgb), 0.07);
  overflow-x: auto; scrollbar-width: none; }
.phone-tabs::-webkit-scrollbar { display: none; }
.ptab { flex: none; background: transparent; border: 0; border-radius: 999px; color: #948da3;
  padding: 7px 13px; font-size: 12.5px; font-weight: 700; white-space: nowrap; letter-spacing: 0.01em;
  transition: color 0.12s, background 0.12s; }
.ptab:hover { color: var(--paper); background: rgba(var(--edge-rgb), 0.07); }
.ptab.sel { color: var(--emph-fg); background: var(--paper); }
/* The rail scrolls, so margin-left:auto would push Close off the end where it
   can't be reached. Stick it to the right edge instead — the way out of a modal
   must never be the one thing you have to go looking for. */
.ptab.close { position: sticky; right: -10px; margin-left: auto; color: #7d7689; font-size: 15px; padding: 6px 12px;
  background: linear-gradient(90deg, transparent, var(--card) 22%, var(--card)); border-radius: 0; }
.ptab.close:hover { color: var(--paper); }
.ptab .badge { margin-left: 5px; }

.phone-body { padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: rgba(var(--edge-rgb), 0.16) transparent; }
.phone-body::-webkit-scrollbar { width: 4px; }
.phone-body::-webkit-scrollbar-thumb { background: rgba(var(--edge-rgb), 0.16); border-radius: 2px; }
.phone-body > p.dim { text-align: center; padding: 26px 10px; line-height: 1.6; }

/* rows: one surface treatment everywhere instead of four different purples */
.contact, .msgitem, .feeditem, .wrongitem, .paper-item {
  background: rgba(var(--edge-rgb), 0.05); border: 1px solid rgba(var(--edge-rgb), 0.07); border-radius: 14px; }
.feeditem { padding: 9px 12px; font-size: 13.5px; color: var(--paper); line-height: 1.5; }
.feeditem b { color: var(--title); margin-right: 6px; }
.msgitem { padding: 10px; }
.msgitem.unread { border-left: 3px solid var(--magenta); }
.contact { padding: 10px; }

/* settings: readable rows, real spacing, controls that look like controls */
.phone-body label { display: flex; gap: 9px; align-items: center; font-size: 13.5px; color: var(--paper); }
.setgroup { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px 2px; }
.setgroup label { cursor: pointer; }
.phone-body input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--magenta); flex: none; cursor: pointer; }
/* 16px floor (iOS zoom trap). These are the Settings sheet's fields — the
   language picker, the API key, the call budget — and at 13px every one of
   them zoomed the page on focus. Padding drops to 5px so the rows grow by a
   couple of pixels rather than by the full three the type gained. */
.phone-body select, .phone-body input[type=password], .phone-body input[type=number] {
  background: var(--field-bg); border: 1px solid var(--hairline); color: var(--field-fg);
  border-radius: 9px; padding: 5px 10px; font-family: inherit; font-size: 16px; outline: none; }
.phone-body select:focus, .phone-body input:focus { border-color: rgba(var(--edge-rgb), 0.4); }
.phone-body input[type=password] { flex: 1; min-width: 0; }
.advset { margin: 12px 0 4px; border-top: 1px solid rgba(var(--edge-rgb), 0.09); padding-top: 12px; }
.advset summary { cursor: pointer; color: var(--haze); font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; }
.advset[open] summary { margin-bottom: 12px; }
.advset > label, .advset > div, .advset > p { margin: 10px 0; }

/* chat: the bubbles were fine, the room they sat in was missing */
.gc-head { color: var(--paper); }
.gc-log { max-height: 56vh; max-height: 56dvh; }
.gc-day { color: var(--haze); }
.gc-name { color: var(--haze); }
.gc-bubble { line-height: 1.5; }
.gc-msg.you .gc-bubble { background: var(--chat-me); color: var(--chat-me-fg); }
.gc-msg.you .gc-en { text-align: right; }
.gcr, .reply-btn { cursor: pointer; }

/* ---------- map: labels, pins, filter, fitting on one screen ---------- */
/* Place labels: hanzi first, English under it, both big enough to read from a
   lean-back distance. 13px hanzi alone made the map a memory test. */
.mapnode { padding: 6px 15px; line-height: 1.15; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.mapnode .han { font-size: 16px; font-weight: 800; letter-spacing: 0.02em; }
.mapnode .mn-en { font-size: 11px; font-weight: 700; color: var(--haze); letter-spacing: 0.03em; }
.mapnode.sel .mn-en, .mapnode:hover .mn-en { color: var(--paper); }
.mapnode.allnode { flex-direction: row; }
.mapnode.allnode .han { font-size: 12px; }

/* Standing pins: 52 still read as a smudge on a busy painting. 72 is a face. */
.mappin { width: 72px; height: 72px;
  box-shadow: 0 0 0 2.5px rgba(var(--glass-rgb), 0.9), 0 8px 20px rgba(0,0,0,0.6); }
.mappin:hover { box-shadow: 0 0 0 2.5px var(--paper), 0 12px 26px rgba(0,0,0,0.65); }
.mappin.sel { box-shadow: 0 0 0 3px var(--magenta), 0 12px 26px rgba(0,0,0,0.65); z-index: 4; }
.mappin::after { font-size: 12.5px; padding: 4px 11px; bottom: calc(100% + 8px); }

/* The filter bar: only exists while a filter is on, and always carries its own
   way out. */
.filterbar { display: none; }
.filterbar.on { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 14px; padding: 8px 14px; border-radius: 999px;
  background: rgba(var(--glass-rgb), 0.82); border: 1px solid var(--hairline); }
.fb-label { color: var(--haze); font-size: 12.5px; }
.fb-label b { color: var(--paper); }
.fb-clear { margin-left: auto; background: var(--paper); color: var(--emph-fg); border: 0; border-radius: 999px;
  padding: 5px 14px; font-size: 12px; font-weight: 800; cursor: pointer; }
.fb-clear:hover { transform: translateY(-1px); }

/* Fit the town AND the activities on one screen. The painting is 16:9 and was
   taking 717px of an 860px window, which pushed every scene card below the fold —
   art you can't act on. So the map fills the WIDTH but is capped by height, and
   the artwork covers that box (cropping a little sky and river rather than
   letterboxing into gutters or squashing).
   Because it crops, percentage coordinates no longer line up with the painting —
   placeMapMarks() in game.js recomputes every pin against the same cover
   transform the browser uses. Do NOT put aspect-ratio back on this box, and do
   NOT position pins with raw % again; the two must agree or the pins drift off
   their landmarks. */
/* The town IS the screen. No list beneath it — tapping a face or a place opens a
   card ON the map (see .mappop). The height/crop trade-off that made 66vh
   necessary is gone with the list: at 100% there's simply more painting, and
   placeMapMarks still maps every pin through the browser's own cover transform,
   so nothing drifts. */
.townmap { height: 100%; flex: 1 1 auto; }
.map-screen { overflow: hidden; }
.map-screen > .loc-grid { display: none; } /* the library — built, never shown */

/* scene banner padding/gap match the MUST-USE rail's shell; type size is set once,
   above, at 15px/700 — this used to re-shrink it to 11.5px here, undoing that. */
.scene-banner { padding: 7px 8px 7px 14px; gap: 12px; }

/* ---------- the input row: one height, one type size ----------
   The scene's row is now just the field and the chop; the confession screen and
   the debate modal still hang a standalone mic off .dlg-input, which is why the
   .micbtn rule below stays. Everything is pinned to --row-h; change that alone
   to resize the row. The height goes on the ELEMENTS, not on line-height, so the
   pills stay circular/round-ended regardless of font metrics. */
.dlg-input { --row-h: 44px; display: flex; gap: 9px; align-items: center; }
/* 16px floor (iOS zoom trap — see the top of this file). The box is unchanged:
   the row is still --row-h tall, only the type inside it grew a pixel. */
.dlg-input #say { height: var(--row-h); padding: 0 18px; font-size: 16px; line-height: var(--row-h); }
.dlg-input .micbtn { height: var(--row-h); width: var(--row-h); flex: none; border-radius: 50%;
  display: grid; place-items: center; padding: 0; }
.dlg-input .sendbtn { height: var(--row-h); padding: 0 24px; font-size: 14px; font-weight: 800; }
/* The scene's field carries its own mic, pinned to the right edge INSIDE the
   well (iPhone Messages). The wrapper is the flex item now, so the field still
   eats the row; the extra right padding keeps typed hanzi off the icon. */
.dlg-input .field-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.dlg-input .field-wrap #say { flex: 1; min-width: 0; padding-right: 44px; }
.dlg-input .field-wrap .micbtn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  height: 34px; width: 34px; border-radius: 50%; border: 0; background: transparent;
  box-shadow: none; color: var(--haze); }
.dlg-input .field-wrap .micbtn:hover { background: rgba(var(--edge-rgb), 0.1); color: var(--paper); }

/* ---------- the coach ----------
   Feedback on the player's Chinese, above the dialogue. Deliberately NOT in the
   log: the log is the fiction, and the character never breaks role to teach. Only
   appears when there's something to say. */
.coachbar { position: absolute; left: 18px; right: 18px; bottom: calc(100% + 10px);
  display: none; flex-direction: column; gap: 8px;
  background: rgba(var(--glass-rgb), 0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hairline); border-left: 3px solid var(--haze); border-radius: 12px;
  padding: 10px 14px; box-shadow: 0 14px 40px rgba(0,0,0,0.5); animation: coachIn 0.22s ease both; }
.coachbar.show { display: flex; }
.coachbar.nailed { border-left-color: #3ee6c4; }
.coachbar.awkward { border-left-color: var(--title); }
.coachbar.wrong { border-left-color: #ff8d86; }
@keyframes coachIn { from { opacity: 0; transform: translateY(6px); } }
.cb-tag { font-size: 9.5px; font-weight: 800; letter-spacing: 0.14em; color: var(--haze); }
.coachbar.nailed .cb-tag { color: #3ee6c4; }
.coachbar.awkward .cb-tag { color: var(--title); }
.coachbar.wrong .cb-tag { color: #ff8d86; }
.cb-note { font-size: 13px; line-height: 1.5; color: var(--paper); }
.cb-fix { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid var(--hairline); padding-top: 8px; }
.cb-fix .han { font-size: 17px; color: var(--paper); }
.cb-say { background: transparent; border: 1px solid var(--hairline); color: var(--haze);
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.cb-say:hover { color: var(--paper); border-color: var(--paper); }
.cb-use { margin-left: auto; background: var(--paper); color: var(--emph-fg); border: 0; border-radius: 999px;
  padding: 5px 14px; font-size: 12px; font-weight: 800; }
.cb-use:hover { transform: translateY(-1px); }

/* ---------- mood + bond, over their head ----------
   Pinned to the SPRITE's top edge, not the screen's. The stage reserves 25vh above
   the figure (see .scene-stage:has(.sprite)), so the head starts at 25vh — sit the
   badges just above that. At a flat `top: 6%` these floated up into the scene
   chrome and read as another status bar next to MUST-USE, which is the opposite of
   the point: they belong to the PERSON.
   The floor (the max() first arg) must CLEAR the scene-top row: the banner ends
   around 52px (12px padding + ~40px pill), so a 52px floor sat the badges flush
   against — and on short windows, over — the Day/place/Leave pill. */
.headhud { position: absolute; top: max(64px, calc(10vh - 38px)); left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; gap: 7px; align-items: center; pointer-events: none; }
.hh-mood, .hh-bond { display: flex; align-items: center; gap: 9px;
  background: var(--ink-60); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 8px 16px; white-space: nowrap; }
.hh-mood { gap: 6px; } /* "Mood: Annoyed" reads as one phrase */
/* the "Mood:" label matches the value beside it — same size/weight/colour as Stranger */
.hh-k { font-size: 15px; font-weight: 700; color: var(--paper); }
.hh-mood b { font-size: 15px; color: var(--paper); font-weight: 700; text-transform: capitalize;
  max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the relationship word carries the same weight as the mood — they're a pair */
.hh-rel { font-size: 15px; color: var(--paper); font-weight: 700; }
.hh-bond.bad .hh-rel { color: #ff8d86; }
.hh-bond.maxed .hh-rel { color: var(--title); }
.hh-bond.maxed .hh-hearts { --heart-color: var(--title); }
/* Bigger hearts with real air between them — 5 squished glyphs read as a smear.
   letter-spacing does the spacing; font-size does the size. */
/* --heart-color tracks whatever colour the FILLED hearts are right now (magenta,
   red when hostile, gold when maxed) — the empty hearts' outline reads it too,
   so it's always that colour instead of a fixed white that vanished on light
   mode's near-white pill. */
/* hearts wear the character's own colour (their name-pill colour, set as
   --ch-color on the scene); magenta only if no character colour is in scope. */
.hh-hearts { --heart-color: var(--ch-color, var(--magenta)); font-size: 16px; letter-spacing: 3px; color: var(--heart-color); padding-right: 3px; }
/* Empty hearts read as HOLLOW outlines, not faint fills — transparent centre,
   a stroke in the current heart colour. The rgba fallback (rare browser without
   text-stroke) also follows --heart-color rather than a hardcoded shade. */
.hh-empty { color: var(--heart-color); opacity: 0.55;
  -webkit-text-stroke: 1.6px var(--heart-color); text-stroke: 1.6px var(--heart-color);
  -webkit-text-fill-color: transparent; }
.hh-bond em { font-style: normal; font-size: 13px; font-weight: 800; color: var(--paper);
  font-variant-numeric: tabular-nums; }
.hh-bond.bad .hh-hearts { --heart-color: #ff8d86; }

/* ---------- reaction emotes ---------- */
/* bursts beside the head, at the same height the badges sit */
.emotes { position: absolute; top: max(76px, calc(10vh + 8px)); left: 50%; width: 0; height: 0; z-index: 3; pointer-events: none; }
.emote { position: absolute; left: 110px; top: -8px; font-size: 46px; line-height: 1;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.7));
  animation: emoteBurst 1.8s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes emoteBurst {
  0%   { opacity: 0; transform: translate(0, 6px) scale(0.3); }
  14%  { opacity: 1; transform: translate(var(--drift), -12px) scale(1.3); }
  28%  { transform: translate(var(--drift), -6px) scale(1); }
  80%  { opacity: 1; transform: translate(var(--drift), -14px) scale(1); }
  100% { opacity: 0; transform: translate(var(--drift), -48px) scale(0.95); }
}
/* Reduced-motion users still SEE the reaction — it just fades instead of flying.
   (The old rule collapsed the whole animation to 0.01s, making it invisible.) */
@media (prefers-reduced-motion: reduce) {
  .emote { animation: emoteHold 1.8s ease both; }
  @keyframes emoteHold { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
}
/* The +1/-1 heart reaction: this had NO css at all, so it fell back to being a
   normal flex sibling of the <img> inside #portraitWrap (a flex box, see
   .portrait-wrap:has(.sprite)) — widening the box and re-centering it shifted
   the whole character sideways for its ~1.5s life. Absolute + pointer-events:none
   pulls it out of flow entirely, so it overlays without ever touching layout. */
.floatheart { position: absolute; left: 50%; top: 20%; z-index: 3; pointer-events: none;
  transform: translateX(-50%); font-size: 26px; font-weight: 800; color: var(--magenta);
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.6));
  animation: floatHeartUp 1.5s ease both; }
.floatheart.bad { color: #ff8d86; }
@keyframes floatHeartUp {
  0%   { opacity: 0; transform: translate(-50%, 10px) scale(0.6); }
  15%  { opacity: 1; transform: translate(-50%, -6px) scale(1.15); }
  30%  { transform: translate(-50%, -10px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -54px) scale(0.95); }
}
@media (prefers-reduced-motion: reduce) {
  .floatheart { animation: floatHeartHold 1.5s ease both; }
  @keyframes floatHeartHold { 0% { opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
}

@media (max-width: 700px) {
  /* PHONE: these are status text, not headline chrome (Lau — "a lot smaller;
     it doesn't need to be as big as that"). On a 390px screen the two pills at
     desktop size ate a third of the width and stood between the player and the
     character's face. Everything here shrinks — pad, type, hearts, the gaps —
     and desktop is untouched. Don't re-tune these to match .scene-banner: the
     banner is the room's label and it may be louder than a mood. */
  /* narrow screens: the banner can wrap to two lines — drop the badge floor below it */
  .headhud { top: max(88px, calc(10vh - 38px)); gap: 5px; }
  /* the 2px ink outline stays — it's the object language, and it's re-asserted
     by the round-12/light blocks below anyway; only the fill shrinks */
  .hh-mood, .hh-bond { padding: 3px 8px; gap: 5px; }
  .hh-mood { gap: 4px; }
  .hh-mood b, .hh-rel, .hh-k { font-size: 10.5px; }
  .hh-mood b { max-width: 12ch; }
  .hh-hearts { font-size: 10px; letter-spacing: 1px; padding-right: 1px; }
  .hh-empty { -webkit-text-stroke-width: 1.1px; }
  .hh-bond em { font-size: 10px; }
  .emote { left: 74px; font-size: 36px; }
}

/* ---------- chip card ---------- */
.chipcard-head { align-items: center; }
.chip-say { background: transparent; border: 1px solid var(--hairline); color: var(--haze);
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-left: 2px; }
.chip-say:hover { color: var(--paper); border-color: var(--paper); background: rgba(var(--edge-rgb), 0.07); }
.chipcard-ex .han.tappable { cursor: pointer; }
.chipcard-ex .han.tappable:hover { color: var(--magenta); }
.chipcard-bonus { color: var(--title); font-size: 12.5px; margin: 0 0 12px; }

/* ---------- drills: the same room as the rest of the game ----------
   The restored 7dad718^ rules made the drills WORK; they still looked like a
   different, older game — flat purple panel, 3px outlines, a bare canvas. This is
   the Monster Prom read: one dark stage, content centred in a column, generous
   type, and exactly one accent doing the work (teal = right, red = wrong).
   Board cards get the same glass + hairline as the scene UI so a drill feels like
   somewhere you went, not a dialog that opened. */
.minigame { background: radial-gradient(ellipse 90% 60% at 50% 0%, var(--card-2) 0%, var(--page-bg) 62%, var(--page-bg) 100%);
  gap: 14px; padding: 22px 16px; justify-content: center; }
/* the header stays at the top; the play area gets the middle. Without this the
   whole column crams against the top edge and leaves a dead half-screen.
   THE Z-INDEX IS LSAD-CRITICAL, not decoration (FTUE overlap sweep, 2026-07-31).
   The head was absolutely positioned with NO z-index while every drill's stage
   sits at 2-8 and its focus scrims at 40 — so the moment the goal chip pushed
   the head past ~y=76 the chip fell BEHIND the art. Measured: stream2's 消音 0/3
   painted under the lamp at 375 dark, chengyu2's 红笔 count under the host's
   bubble, and all three of stream2's chips veiled by the pre-air scrim at every
   width. The head states the goal and counts progress toward it — bar point 2 —
   so it outranks the board and its scrims, and only the teaching layers cover
   it: the coach (70), the ? coin (76) and the book (80). */
.minigame > .mg-head { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 50; }
.minigame > .mg-timerwrap { position: absolute; top: 46px; left: 50%; transform: translateX(-50%); z-index: 50; }
.mg-head { gap: 10px; padding: 2px 4px 0; align-items: baseline; }
.mg-head b.han { font-size: 20px; letter-spacing: 0.01em; }
.mg-head > span { font-size: 12px; color: var(--haze); }
.mg-score { font-size: 12px; color: var(--haze); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.mg-score b { color: var(--paper); font-weight: 800; }

.mg-timerwrap { height: 5px; border: 0; background: rgba(var(--edge-rgb), 0.09); border-radius: 999px; }
.mg-timer { background: linear-gradient(90deg, #3ee6c4, #79f0d6); }

.mg-bigprompt { font-size: 22px; color: var(--paper); min-height: 62px; }
.mg-bigprompt .dim { color: var(--haze); font-size: 15px; }

/* the answers: glass cards, not purple bricks */
.mg-court { gap: 10px; width: min(760px, 94vw); }
.mg-board { background: rgba(var(--edge-rgb), 0.055); border: 1px solid var(--hairline); border-radius: 16px;
  color: var(--paper); font-size: 22px; font-weight: 800; padding: 22px 12px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  transition: transform 0.1s, border-color 0.1s, background 0.1s; }
.mg-board:hover { border-color: rgba(var(--edge-rgb), 0.5); background: rgba(var(--edge-rgb), 0.1);
  transform: translateY(-3px); }
.mg-board:active { transform: translateY(0); }
/* right/wrong read instantly, without reading */
/* color must adapt: the near-white text vanished on light mode's pale tint. */
.mg-board.right { border-color: #3ee6c4; background: rgba(62,230,196,0.16); color: var(--ink); }
.mg-board.wrong { border-color: #ff8d86; background: rgba(255,141,134,0.14); color: var(--ink); }

.mg-tone { background: rgba(var(--edge-rgb), 0.055); border: 1px solid var(--hairline); border-radius: 14px;
  color: var(--paper); padding: 10px 18px; transition: transform 0.1s, border-color 0.1s, background 0.1s; }
.mg-tone:hover { border-color: #3ee6c4; color: #3ee6c4; background: rgba(62,230,196,0.1); transform: translateY(-2px); }

#mgCanvas { border: 1px solid var(--hairline); border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,0.5); }

.mg-reveal { font-size: 15px; color: var(--haze); }
.mg-reveal .han { font-size: 22px; color: var(--paper); }
.okmark { color: #3ee6c4; }
.badmark { color: #ff8d86; }

.haggle-row { --row-h: 46px; display: flex; align-items: center; gap: 9px; }
.haggle-row .micbtn { height: var(--row-h); width: var(--row-h); border-radius: 50%; flex: none;
  display: grid; place-items: center; padding: 0; }
.haggle-row .tool { height: var(--row-h); padding: 0 18px; font-size: 13.5px; border-radius: 999px; }

/* ---------- bond badges on a face ----------
   Sits on the rim, not over it: the art is the point, the badge is an annotation.
   pointer-events:none so it can never swallow the click meant for the avatar. */
.pinbadge { position: absolute; right: -3px; bottom: -3px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; line-height: 1; pointer-events: none;
  border: 2px solid #14121a; box-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.pinbadge.love { background: var(--magenta); color: #fff; }
.pinbadge.foe { background: #2b2b33; color: #ff8d86; font-size: 13px; }
.mappin { position: absolute; }
.sc-av { position: relative; }
.sc-av .pinbadge { width: 19px; height: 19px; font-size: 10px; border-width: 1.5px; }

/* ---------- phone tabs: stop the hover states colliding ----------
   Close was a .ptab like any other, so its hover pill grew into the tab beside it
   and, at the rail's edge, past the card itself. Give it its own lane: a divider,
   its own width, and a hover that stays inside its box. */
.phone-tabs { padding-right: 4px; }
.ptab { flex: none; }
.ptab.close { position: sticky; right: 0; margin-left: auto; padding: 0; width: 30px; height: 30px;
  border-radius: 9px; display: grid; place-items: center; font-size: 14px; line-height: 1;
  color: var(--haze); background: var(--card); box-shadow: -10px 0 12px 6px var(--card); }
.ptab.close::before { content: ""; position: absolute; left: -9px; top: 5px; bottom: 5px; width: 1px;
  background: rgba(var(--edge-rgb), 0.1); }
.ptab.close:hover { color: var(--paper); background: rgba(var(--edge-rgb), 0.12); }
/* the last real tab keeps clear of the close lane so their hovers never touch */
.phone-tabs .ptab:not(.close):not(.phone-bug):last-of-type { margin-right: 8px; }
/* Report-bug rides in the phone header so it's reachable on every phone screen at
   any width. Like the ✕, it sticks to the right edge above the scrolling tab rail
   (a 7th tab overflows the panel) instead of sliding under the pinned close. */
.phone-tabs .phone-bug { position: sticky; right: 30px; margin: 0 0 0 auto; z-index: 1;
  font-size: 15px; padding: 0 6px 0 10px; width: auto; border-radius: 0;
  background: linear-gradient(90deg, transparent, var(--card) 45%, var(--card)); }
.phone-tabs .ptab.close { z-index: 2; margin-left: 0; }

/* ---------- the activity popover ----------
   Opens next to whatever you tapped and is physically incapable of leaving the
   screen: placeMapPop measures the real box, flips it above the anchor when the
   bottom would clip, clamps it horizontally, and caps its height to the room
   actually available — so the LIST scrolls rather than the card hanging off the
   map. The arrow tracks the anchor after clamping, so a card shoved sideways
   still points at the face that opened it. */
.mappop { position: absolute; z-index: 6; width: min(360px, calc(100vw - 20px));
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(var(--glass-rgb), 0.93); backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border: 1px solid var(--hairline); border-radius: 16px;
  box-shadow: 0 26px 70px rgba(0,0,0,0.65);
  animation: popIn 0.16s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(0.97); } }
.mappop.above { animation-name: popInUp; }
@keyframes popInUp { from { opacity: 0; transform: translateY(6px) scale(0.97); } }
@media (prefers-reduced-motion: reduce) { .mappop { animation: none; } }
/* the pointer, tracking the anchor even when the card has been clamped */
.mappop::after { content: ""; position: absolute; left: var(--arrow, 50%); transform: translateX(-50%);
  border: 7px solid transparent; }
.mappop:not(.above)::after { top: -14px; border-bottom-color: rgba(var(--edge-rgb), 0.14); }
.mappop.above::after { bottom: -14px; border-top-color: rgba(var(--edge-rgb), 0.14); }

.mp-head { display: flex; align-items: baseline; gap: 8px; flex: none;
  padding: 12px 12px 10px 14px; border-bottom: 1px solid var(--hairline); }
.mp-head b { color: var(--paper); font-size: 14px; font-weight: 800; }
.mp-head > span { color: var(--paper); font-size: 13px; font-weight: 600; font-family: var(--han); }
.mp-close { margin-left: auto; background: transparent; border: 0; color: var(--haze);
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  font-size: 13px; line-height: 1; flex: none; }
.mp-close:hover { color: var(--paper); background: rgba(var(--edge-rgb), 0.1); }

.mp-list { display: flex; flex-direction: column; gap: 8px; padding: 10px;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(var(--edge-rgb), 0.18) transparent; }
.mp-list::-webkit-scrollbar { width: 4px; }
.mp-list::-webkit-scrollbar-thumb { background: rgba(var(--edge-rgb), 0.18); border-radius: 2px; }
.mp-empty { color: var(--haze); font-size: 12.5px; text-align: center; padding: 18px 8px; margin: 0; }

/* Cards inside the popover: the text ALWAYS fits. No clamping, no ellipsis — the
   card grows to its content and the list scrolls if there's a lot. A card that
   hides half a sentence is worse than a taller card. */
.mp-list .scene-card { width: 100%; align-items: flex-start; padding: 10px 12px; }
.mp-list .sc-info { flex: 1; min-width: 0; gap: 3px; }
.mp-list .sc-info b { font-size: 14px; line-height: 1.3; text-wrap: balance; }
.mp-list .sc-info em, .mp-list .sc-info .han {
  white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.45;
  overflow-wrap: anywhere; }
.mp-list .sc-tag { position: static; align-self: flex-start; margin-left: 6px; flex: none; }
.mp-list .sc-av { width: 46px; height: 46px; }

/* the star: nowhere further to go with this person */
.pinbadge.best { background: var(--gold); color: #241335; font-size: 13px; font-weight: 900; }

/* ---------- conversation mode ----------
   It rides in .dlg-tools now (the input bar is field + chop only), so it wears
   the tool-pill shell its neighbours wear and carries an icon instead of a word.
   Only the ON state keeps its own colour — "the loop is live" is a state, not a
   preference, and it has to be readable across the room. */
.dlg-tools .convobtn { display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 9px; transition: all 0.14s; }
.dlg-tools .convobtn svg { display: block; width: 14px; height: 14px; }
/* (the ON fill is re-asserted in round 14 — it has to outrank .tool.on) */

/* When it's on, the mic and Send step back — you're talking, not typing. The input
   stays (you can still type to override), but the loop drives the turn. The field
   reclaims the mic's gutter while it's gone. */
.scene-screen.convo-on #mic { display: none; }
.scene-screen.convo-on .field-wrap #say { padding-right: 18px; }
.scene-screen.convo-on .convobtn.on { box-shadow: 0 0 0 0 rgba(255,79,163,0.5); animation: convoPulse 1.6s ease-in-out infinite; }
@keyframes convoPulse { 50% { box-shadow: 0 0 0 6px rgba(255,79,163,0); } }
@media (prefers-reduced-motion: reduce) { .convobtn.on { animation: none; } }

/* a live status dot on the input while a turn is in flight, so it's obvious the
   game is listening (or thinking) rather than frozen */
.scene-screen[data-convo="listening"] #say,
.scene-screen[data-convo="recording"] #say,
.scene-screen[data-convo="transcribing"] #say {
  border-color: var(--magenta); padding-left: 34px; }
.scene-screen[data-convo="listening"] .dlg-input,
.scene-screen[data-convo="recording"] .dlg-input,
.scene-screen[data-convo="transcribing"] .dlg-input { position: relative; }
.scene-screen[data-convo="listening"] .dlg-input::before,
.scene-screen[data-convo="recording"] .dlg-input::before,
.scene-screen[data-convo="transcribing"] .dlg-input::before {
  content: ""; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 9px; height: 9px; border-radius: 50%; background: var(--magenta); z-index: 2;
  animation: convoDot 1s ease-in-out infinite; }
.scene-screen[data-convo="transcribing"] .dlg-input::before { background: var(--gold); }
@keyframes convoDot { 50% { opacity: 0.25; transform: translateY(-50%) scale(0.7); } }

/* The per-session instruction card: floats at the top-centre of the map, under
   the day banner and phone. Transparent glass so the town shows through — it's a
   prompt, not a panel. It sits ABOVE the map (position:absolute over the townmap)
   rather than in the column, so the map can still be 100% tall. */
.slot-hint { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center;
  max-width: min(560px, calc(100vw - 32px)); padding: 9px 20px; border-radius: 14px;
  background: rgba(var(--glass-rgb), 0.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--hairline); box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  pointer-events: none; animation: slotHintIn 0.4s ease both; }
.slot-hint b { color: var(--paper); font-size: 14px; font-weight: 700; }
.slot-hint .han { color: var(--paper); font-size: 13.5px; font-weight: 600; }
@keyframes slotHintIn { from { opacity: 0; transform: translate(-50%, -6px); } }
@media (prefers-reduced-motion: reduce) { .slot-hint { animation: none; } }
@media (max-width: 560px) { .slot-hint { top: 58px; padding: 7px 14px; } .slot-hint b { font-size: 13px; } }

/* ---------- settings: theme toggle ---------- */
.setrow { display: flex; align-items: center; gap: 12px; }
.setrow > span { font-size: 13.5px; color: var(--paper); }
.segbtn { margin-left: auto; display: inline-flex; background: rgba(var(--edge-rgb), 0.06);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 2px; }
.segbtn button { border: 0; background: transparent; color: var(--haze); border-radius: 999px;
  padding: 5px 14px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.segbtn button.on { background: var(--magenta); color: #fff; }

/* ---------- phone notifications, on the game's own glass ----------
   Not iOS white: night ink, hairline, gold timestamp — the same slab language as
   the toast. top:64px reserves the corner row for the map's Phone button (42px +
   12px pad) so a card can never squat on the button or its unread badge. */
.notifs { position: fixed; top: 64px; right: 14px; z-index: 45; display: flex; flex-direction: column; gap: 10px;
  width: min(370px, calc(100vw - 24px)); pointer-events: none; }
.notif { pointer-events: auto; display: flex; align-items: flex-start; gap: 11px; cursor: pointer;
  background: rgba(16, 10, 28, 0.88); backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1.5px solid rgba(255,255,255,0.16); border-radius: 16px; padding: 12px 13px;
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.55), 0 14px 40px rgba(0,0,0,0.35);
  transform: translateX(120%); opacity: 0; transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.34s; }
.notif.in { transform: translateX(0); opacity: 1; }
.notif-ico { flex: none; width: 40px; height: 40px; border-radius: 11px; overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255, 233, 176, 0.35); }
.notif-ico .pav, .notif-ico img, .notif-ico svg { width: 100%; height: 100%; border: 0; border-radius: 11px; display: block; object-fit: cover; }
.notif-appicon { width: 100%; height: 100%; display: grid; place-items: center; background: #2a1c44; color: var(--gold); font-size: 21px; }
.notif-body { flex: 1; min-width: 0; }
.notif-top { display: flex; align-items: baseline; gap: 8px; }
.notif-top b { flex: 1; font-size: 14px; font-weight: 700; color: #fff; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-top span { flex: none; font-size: 11.5px; color: rgba(255, 200, 74, 0.75); }
.notif-body p { margin: 1px 0 0; font-size: 13.5px; line-height: 1.32; color: #e9defc;
  font-family: var(--han); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-x { flex: none; align-self: center; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,0.1); color: #cfc3e8; font-size: 11px; line-height: 1; cursor: pointer; }
.notif-x:hover { background: rgba(255,255,255,0.2); color: #fff; }
@media (prefers-reduced-motion: reduce) { .notif { transition: opacity 0.2s; transform: none; } }
@media (max-width: 560px) { .notifs { left: 12px; right: 12px; width: auto; } }

/* ---------- global settings gear + standalone Settings sheet ---------- */
/* z-index 15: above scene/map chrome (which tops out around 5) but BELOW modals
   (20) and drills (30), so an open phone/settings/event sheet covers the gear
   instead of the gear floating on top of it. */
/* Same fill/border/height as the Phone button (map) and the MUST-USE rail (scene),
   top-aligned at 12px so it lines up with whichever control shares its row. */
/* z-index 85, not 15: Lau — "settings should be accessible everywhere and
   anytime in the game". At 15 the gear sat UNDER a drill board (.minigame is
   30), under its coach (70) and under its manual (80), so the one screen where
   a player might want to change the voice or the script was the one screen
   where Settings could not be reached. 85 puts it over all of them, and under
   the iris (90), which is a pointer-transparent scene wipe. */
.global-gear { position: fixed; top: 12px; right: 14px; z-index: 85; width: 44px; height: 44px;
  box-sizing: border-box; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  background: var(--panel2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 2px solid var(--line); color: var(--title); }
.global-gear:hover { color: var(--title); border-color: var(--magenta); }
/* A DRILL OWNS THE TOP-RIGHT CORNER — its ? (.dm-help, 40px at right:10px) is
   fixed furniture on all fifteen boards and the one control every blind judge
   identified correctly. So the gear steps aside while a board is on stage
   rather than landing on it: 40px of coin + 10px of margin + a 10px gap. Only
   while .minigame exists, so the map keeps the gear in its usual corner. */
/* Beside the ? was not far enough: at 1280 lyric's goal chip reaches x=1250 and
   ktv's score line is nearly as wide, so a gear tucked in at right:60 sat on
   both (ftue-hud caught it, 2 dirty). Widening the head's reserved gutter would
   have shoved every drill's title 48px left to make room for a utility button.
   Cheaper and calmer: while a board is on stage the gear crosses to the LEFT,
   which no drill claims — the ? owns top-right, the goal chip owns top-centre,
   and the playtest coin sits bottom-left. */
body:has(.minigame) .global-gear {
  right: auto;
  left: max(12px, env(safe-area-inset-left));
}
/* THE GEAR STANDS DOWN WHILE ITS OWN SHEET IS OPEN (Lau: "the settings button
   should disappear if the user clicks on settings since it overlaps with the X
   to close settings"). Both live top-right, so at 390 the gear sat on the
   sheet's ✕ — you aimed at close and hit open.
   CSS, not a toggle at the call site, because the sheet closes three ways (the
   ✕, a backdrop pointerdown, and renderSettings' own done callback — plus
   whatever the next one is) and a gear that comes back on two of them is worse
   than one that never left. The presence of .settings-modal in the DOM is the
   one condition they all agree on, and it is true for exactly as long as the
   sheet is up. !important because setGearVisible writes display INLINE. */
body:has(.settings-modal) .global-gear { display: none !important; }

/* "Report bug" — floats just left of the gear, same chrome, same 42px height,
   on every in-game screen and event. The corner can't fit both on a phone, so
   narrow screens drop it below the gear (and nudge the scene chip rail down). */
.bug-fab { position: fixed; top: 12px; right: 64px; z-index: 15; height: 42px;
  box-sizing: border-box; display: grid; place-items: center; padding: 0 14px;
  border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 700;
  background: var(--panel2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 2px solid var(--line); color: var(--title); white-space: nowrap; }
.bug-fab:hover { border-color: var(--magenta); }
@media (max-width: 700px) {
  .bug-fab { top: 60px; right: 14px; }
  /* the rail used to be nudged to top:110 here so the dropped bug fab could
     have the band. It does not live in that band any more — it sits above the
     dialogue sheet, in flow (see the note in the phone block above) — and a
     leftover `top` on a now-relative box would have shoved it 110px down into
     the sheet. */
}
.bug-card { text-align: left; }
.bug-card .bug-shot { display: block; width: 100%; max-height: 42vh; max-height: 42dvh; object-fit: contain;
  border-radius: 10px; border: 1px solid var(--hairline); margin: 0 0 12px; background: rgba(0,0,0,0.25); }
.bug-card .bug-noshot { margin: 0 0 12px; font-size: 13px; }
.bug-card .bug-text { width: 100%; box-sizing: border-box; resize: vertical; min-height: 84px;
  background: var(--field-bg); color: var(--field-fg); border: 1px solid var(--hairline);
  border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 16px; margin: 0 0 8px; } /* 16px floor — iOS zoom trap */
.bug-card .bug-text:focus { outline: none; border-color: var(--magenta); }
.bug-card .bug-status { min-height: 18px; font-size: 13px; margin: 0 0 8px; }

/* Settings has no save-slot picker anymore and is short — size to its content
   instead of a fixed 680px tall shell with empty space at the bottom. Still caps
   at the fold and scrolls if Advanced is expanded on a small screen.
   THE CAP IS dvh, NOT vh (see "THE vh TRAP" above .phone). At 92vh on an iPhone
   the sheet was taller than the visible page, the header — and with it the ✕ —
   scrolled out of reach, and Lau could not get out of Settings at all. The safe
   areas come off the top as well as the bottom so the header clears the notch. */
.settings-modal .phone.settings-sheet { width: min(560px, 96vw); height: auto; max-height: 92vh;
  max-height: calc(92dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
/* min-height: 0 is load-bearing. A flex child refuses to shrink below its own
   content by default, so `overflow-y: auto` on a body inside a flex column does
   NOTHING and the sheet grows past its cap instead of scrolling. This one line
   is the difference between "the modal scrolls" and "the modal runs off screen". */
.settings-modal .phone.settings-sheet .phone-body { flex: 0 1 auto; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding-bottom: max(14px, env(safe-area-inset-bottom)); }
/* The way out never scrolls away: the header is sticky at the top of the
   scroller with its own opaque backing, so however long Advanced gets, ✕ is
   exactly where it was when the sheet opened. */
.settings-head { display: flex; align-items: center; padding: 14px 16px; flex: none;
  position: sticky; top: 0; z-index: 2;
  border-bottom: 1px solid var(--hairline);
  /* the old translucent tint, now painted ON an opaque base — a sticky header
     you can see through is a smear of two screenfuls of text */
  background: linear-gradient(rgba(var(--edge-rgb), 0.035), rgba(var(--edge-rgb), 0.035)), var(--phone-a); }
.settings-head b { flex: 1; font-size: 15px; font-weight: 800; color: var(--ink); }
.settings-head .close { position: static; margin: 0; width: 30px; height: 30px; border-radius: 9px;
  background: rgba(var(--edge-rgb), 0.08); color: var(--haze); display: grid; place-items: center; box-shadow: none; }
.settings-head .close:hover { color: var(--ink); background: rgba(var(--edge-rgb), 0.16); }
.settings-head .close::before { content: none; }

.dangerbtn { display: block; width: 100%; margin-top: 12px; background: transparent;
  border: 1.5px solid rgba(232,72,63,0.5); color: #ff6b61; border-radius: 12px; padding: 11px;
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.12s; }
.dangerbtn:hover { background: rgba(232,72,63,0.12); border-color: #ff6b61; }
.dangerbtn .dim { font-weight: 400; }
:root[data-theme="light"] .dangerbtn { color: #c0271b; border-color: rgba(192,39,27,0.5); }
:root[data-theme="light"] .dangerbtn:hover { background: rgba(192,39,27,0.08); }

/* ---------- wider phone so every tab label fits on small screens ---------- */
.phone { width: min(460px, 96vw); }

/* ---------- chat reply input (Class Chat + Texts) ---------- */
.chat-input { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--hairline); }
/* 16px floor on both chat fields (iOS zoom trap). Heights stay 40/34px — the
   .mini variant is a SMALLER BOX, not smaller type; that distinction is the
   whole reason the page no longer zooms when you tap Reply. */
.chat-input input { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--field-bg); border: 1px solid var(--hairline); color: var(--field-fg);
  font-family: var(--han); font-size: 16px; outline: none; }
.chat-input input:focus { border-color: rgba(var(--edge-rgb), 0.45); }
.chat-input .micbtn { height: 40px; width: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.chat-input .sendbtn { height: 40px; padding: 0 18px; font-size: 13.5px; }
.chat-input.mini { margin-top: 6px; padding-top: 6px; border-top: 0; }
.chat-input.mini input { height: 34px; font-size: 16px; }
.chat-input.mini .micbtn { height: 34px; width: 34px; }
.chat-input.mini .sendbtn { height: 34px; padding: 0 14px; font-size: 12.5px; }

.phone-body input[type=range] { flex: 1; accent-color: var(--magenta); height: 4px; cursor: pointer; }
.setrow input[type=range] { min-width: 120px; }

/* ---------- Messages: iMessage-style inbox + thread ---------- */
/* the phone body becomes a flex column so the thread scrolls and the input pins */
.phone-body:has(.im-list), .phone-body:has(.im-thread) { padding: 0; overflow: hidden; }

/* inbox list */
.im-list { display: flex; flex-direction: column; overflow-y: auto; }
.im-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: 0; border-bottom: 1px solid var(--hairline); padding: 12px 14px; cursor: pointer; }
.im-row:hover { background: rgba(var(--edge-rgb), 0.05); }
.im-av { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex: none; display: block; }
.im-av .pav, .im-av img, .im-av svg { width: 100%; height: 100%; border: 0; border-radius: 50%; display: block; object-fit: cover; }
.im-groupav { position: relative; background: var(--card-2); }
.im-groupav span { position: absolute; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; border: 2px solid var(--phone-a); }
.im-groupav span:first-child { top: 2px; left: 2px; z-index: 1; }
.im-groupav span:last-child { bottom: 2px; right: 2px; }
.im-rowmid { flex: 1; min-width: 0; }
.im-rowtop { display: flex; align-items: baseline; gap: 8px; }
.im-rowtop b { flex: 1; font-size: 14.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.im-time { flex: none; font-size: 11.5px; color: var(--haze); }
.im-preview { font-size: 13px; color: var(--haze); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.im-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--magenta); }

/* thread header */
.im-head { display: flex; align-items: center; gap: 6px; flex: none; padding: 10px 12px;
  border-bottom: 1px solid var(--hairline); background: rgba(var(--edge-rgb), 0.03); }
.im-back { background: transparent; border: 0; color: var(--gold); font-size: 15px; font-weight: 600; cursor: pointer; padding: 4px 2px; flex: none; }
.im-title { flex: 1; text-align: center; font-size: 14px; font-weight: 700; color: var(--ink); }
.im-title .dim { font-weight: 400; }

/* thread bubbles */
.im-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 3px; }
.im-day { text-align: center; font-size: 11px; color: var(--haze); margin: 8px 0 4px; }
.im-msg { display: flex; align-items: flex-end; gap: 7px; max-width: 84%; margin-top: 4px; }
.im-msg.them { align-self: flex-start; }
.im-msg.me { align-self: flex-end; }
.im-msgcol { display: flex; flex-direction: column; min-width: 0; }
.im-msg.me .im-msgcol { align-items: flex-end; }
/* the sender's avatar rides the bottom-left of their bubble, iMessage-group style */
.im-bubav { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex: none; align-self: flex-end; }
.im-bubav .pav, .im-bubav img, .im-bubav svg { width: 100%; height: 100%; border: 0; border-radius: 50%; object-fit: cover; display: block; }
.im-sender { font-size: 10.5px; color: var(--haze); margin: 0 0 2px 4px; }
.im-bubble { padding: 8px 13px; border-radius: 18px; font-size: 15px; line-height: 1.35; word-break: break-word; }
/* WeChat idiom, not iMessage: their side speaks on paper, YOUR side is the
   green bubble every teen at this school would recognize (--chat-me). */
.im-msg.them .im-bubble { background: #f2efe9; color: #1c1430; border-bottom-left-radius: 5px; }
.im-msg.me .im-bubble { background: var(--chat-me); color: var(--chat-me-fg); border-bottom-right-radius: 5px; }
.im-bubble.st { background: transparent; padding: 2px; }
.im-en { font-size: 11px; opacity: 0.7; margin-top: 2px; }
/* per-message speaker: hear any text in the sender's voice */
.im-say { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  margin-left: 6px; width: 21px; height: 21px; padding: 0; border: 0; border-radius: 999px;
  background: rgba(0,0,0,0.08); color: inherit; opacity: 0.65; cursor: pointer; }
.im-say:hover { opacity: 1; }
.im-msg.me .im-say { background: rgba(20, 33, 26, 0.14); }
.im-msg.me .im-en { color: rgba(20, 33, 26, 0.62); }

/* the input bar (with its IME candidate row) pins to the bottom of the thread */
.im-inputwrap { flex: none; border-top: 1px solid var(--hairline); }
.im-inputwrap .imebar.show { padding: 8px 12px 2px; }
.phone-body:has(.im-thread) .chat-input { flex: none; margin: 0; padding: 10px 12px; border-top: 0; }

/* ---------------------------------------------------------- developer mode
   Opt-in on the enrollment screen, then a standing button in-game. Styled to sit
   apart from the game's chrome on purpose: this is scaffolding, and it should
   never be mistaken for something a player is meant to use. */
/* (.enroll-dev / .enroll-dev-pill removed — the enrollment dev checkbox is gone;
   DEV mode arrives via the .dev-fab now) */
.dev-fab { position: fixed; top: 12px; right: 108px; z-index: 15; height: 42px; padding: 0 13px;
  font: inherit; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; cursor: pointer;
  color: var(--title); background: var(--panel); border: 1px dashed var(--magenta); border-radius: 12px; }
.dev-fab:hover { background: rgba(255,79,163,.16); }

.dev-panel { position: fixed; top: 62px; right: 14px; z-index: 40; width: min(360px, calc(100vw - 28px));
  max-height: min(76vh, 640px); max-height: min(76dvh, 640px); overflow: auto; padding: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0,0,0,.42); }
.dev-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dev-x { background: none; border: 0; color: var(--dim); font-size: 15px; cursor: pointer; }
.dev-sec { padding: 11px 0; border-top: 1px solid var(--line); }
.dev-sec:first-of-type { border-top: 0; padding-top: 0; }
.dev-lab { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 7px; }
.dev-note { font-size: 11px; color: var(--dim); margin-top: 6px; line-height: 1.45; }
.dev-row { display: flex; gap: 7px; align-items: center; }
.dev-row input[type=number] { width: 68px; }
/* 16px floor (iOS zoom trap) — dev chrome zooms the page just as hard as
   player chrome does, and the dev bar is where a phone playtest starts. Padding
   comes down so the panel's rows stay roughly the height they were. */
.dev-panel input, .dev-panel select { background: rgba(0,0,0,.28); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font: inherit; font-size: 16px; }
.dev-panel #devFind { width: 100%; }
.dev-btn { background: rgba(255,255,255,.07); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.dev-btn:hover:not(:disabled) { background: rgba(255,255,255,.15); border-color: var(--magenta); }
.dev-btn:disabled { opacity: .45; cursor: default; }
.dev-list { margin-top: 8px; max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 5px; }
.dev-scene { text-align: left; background: rgba(255,255,255,.05); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px; cursor: pointer; color: var(--ink); font: inherit; }
.dev-scene:hover { border-color: var(--magenta); background: rgba(255,79,163,.12); }
.dev-scene b { display: block; font-size: 12.5px; }
.dev-scene span { font-size: 10.5px; color: var(--dim); }
.dev-band { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim);
  margin: 9px 0 3px; padding-top: 7px; border-top: 1px dashed var(--line); }
.dev-band:first-child { border-top: 0; margin-top: 2px; padding-top: 0; }
.dev-scene.story { border-color: rgba(255,200,74,.35); }
.dev-scene.story:hover { border-color: var(--gold, #ffc84a); background: rgba(255,200,74,.10); }

/* ============================================================ round 8
   THE SHIPPED-GAME PASS. One design system, chosen on purpose: the style
   bible's (thick #241335 ink outlines, flat saturated fills, lantern-gold for
   earned states, hard OFFSET shadows — objects drop shadows, they don't glow).
   The frosted-glass neutrality stays only on true reading surfaces (dialogue
   sheet, coach). Everything a player GRABS — chips, choice bars, map plaques,
   trays — is now a die-cut physical object per the Monster Prom rubric. */

/* ---------- 8.1 the display register ----------
   Hand-marker Latin (the pitch's own --hand stack) on headings, nameplates,
   buttons and signage; hanzi glyphs fall through to the han faces untouched.
   This one register is most of the distance between "web app" and "game". */
.enroll-title, .stamps-card h3, .dlg-name, .bigbtn, .enroll-go,
.scene-banner, .rail-label, .day-banner b, .mapnode .mn-en, .title-latin,
.toast, .fb-label, .slot-hint b { font-family: var(--hand); }

/* ---------- 8.2 title: the wordmark performs its own entrance ----------
   game.js inlines position/color per glyph (--i is the glyph index); the CSS
   owns everything the inline baseline doesn't carry: animation and filter. */
.title-wordmark span { display: inline-block;
  animation: glyphRise 0.65s cubic-bezier(0.2, 0.9, 0.3, 1.35) both;
  animation-delay: calc(var(--i, 0) * 0.09s); }
@keyframes glyphRise { from { opacity: 0; transform: translateY(26px) scale(0.86); } }
.enroll-card.rise { animation: cardRise 0.5s 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
@keyframes cardRise { from { opacity: 0; transform: translateY(22px); } }
/* die-cut sticker treatment on the two cast cutouts leaning into frame */
.title-cutout { filter:
  drop-shadow(1.5px 0 0 #241335) drop-shadow(-1.5px 0 0 #241335)
  drop-shadow(0 1.5px 0 #241335) drop-shadow(0 -1.5px 0 #241335)
  drop-shadow(0 14px 30px rgba(0, 0, 0, 0.55));
  animation: cutoutIn 0.8s 0.25s ease both; }
@keyframes cutoutIn { from { opacity: 0; } }

/* ---------- 8.3 scene chrome: ink-outlined objects over the art ----------
   The top-row pills are pinned to NIGHT ink in both themes — they sit on
   paintings, not on the page, so the theme toggle has no business here. */
.scene-banner { background: rgba(12, 8, 20, 0.82); border: 2px solid #241335;
  box-shadow: 0 3px 0 rgba(36, 19, 53, 0.6); color: #f2efe9; }
.scene-banner b, .scene-banner span, .scene-banner .han { color: #f2efe9; }
.rail-label { background: rgba(12, 8, 20, 0.82); border: 2px solid #241335;
  box-shadow: 0 3px 0 rgba(36, 19, 53, 0.6); color: #f2efe9; }
.rail-label b { color: #fff; }
.hh-mood, .hh-bond { background: rgba(12, 8, 20, 0.74); border: 1.5px solid rgba(255, 255, 255, 0.16); }
.hh-k, .hh-mood b, .hh-rel { color: #f2efe9; }
.leavebtn { color: #f2efe9; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); }
.leavebtn:hover { color: #fff; background: rgba(255, 255, 255, 0.16); }
/* the earned door is LANTERN GOLD — the one saturated thing in the top row */
.leavebtn.ready { color: #241335; background: var(--gold); border: 2px solid #241335;
  box-shadow: 0 3px 0 rgba(36, 19, 53, 0.7); animation: leaveReadyGold 1.5s ease-in-out infinite; }
.leavebtn.ready:hover { color: #241335; background: var(--gold); transform: scale(1.06); }
@keyframes leaveReadyGold {
  0%, 100% { box-shadow: 0 3px 0 rgba(36, 19, 53, 0.7), 0 0 0 0 rgba(255, 200, 74, 0.55); }
  50% { box-shadow: 0 3px 0 rgba(36, 19, 53, 0.7), 0 0 0 8px rgba(255, 200, 74, 0); } }
/* MUST-USE chips: sticker pills — opaque night fill, thick ink line, hard drop.
   A landed phrase turns lantern-gold: earned states wear the palette's warmth. */
.chip { background: #332352; color: #f3eaff; border: 2.5px solid #241335;
  box-shadow: 0 3px 0 rgba(36, 19, 53, 0.75); }
.chip:hover { border-color: var(--gold); }
.chip.hit { background: var(--gold); border-color: #241335; color: #241335;
  box-shadow: 0 3px 0 rgba(36, 19, 53, 0.75); }
.chip.bonus { background: #2a1c44; border-style: dashed; border-color: var(--gold); color: #ffe9b0; }
/* dialogue sheet stays a reading surface (theme-aware glass) — just a firmer edge */
.dlg { border: 1.5px solid rgba(var(--edge-rgb), 0.16); }
/* the nameplate is a hand-lettered sticker slapped on the sheet's top edge —
   its background is the character's own accent (inlined by game.js) */
.dlg-name { font-size: 14px; padding: 5px 16px; border: 2px solid #241335;
  box-shadow: 0 3px 0 rgba(36, 19, 53, 0.7); transform: rotate(-1.5deg); }
/* toasts: same slab, harder landing */
.toast { border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.5), 0 14px 34px rgba(0, 0, 0, 0.4); }

/* ---------- 8.4 the gesture is a narrator aside, in the speaker's colour ---------- */
.gesture { font-style: italic; letter-spacing: 0.02em; opacity: 0.95;
  color: color-mix(in srgb, var(--ch-color, #c9b7e8) 55%, var(--paper)); }
.gesture:not(:empty)::before { content: "\2014\00a0"; opacity: 0.7; }
/* while the model thinks, the aside becomes a thought bubble with a live ellipsis */
.gesture.thinking { width: fit-content; background: rgba(var(--glass-rgb), 0.5);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 3px 14px; }
.gesture.thinking::after { content: "\2026"; display: inline-block; margin-left: 2px;
  animation: ellipsisPulse 1.2s ease-in-out infinite; }
@keyframes ellipsisPulse { 50% { opacity: 0.25; } }
/* the figure itself muses — a slow sway on the individual `rotate` property, so
   it composes with any pose transform instead of clobbering it */
.portrait-wrap.musing { animation: musingSway 3.4s ease-in-out infinite; transform-origin: bottom center; }
@keyframes musingSway { 0%, 100% { rotate: 0deg; } 50% { rotate: 0.8deg; } }

/* ---------- 8.5 sprite life: the art performs the mood ----------
   game.js maps expression -> pose class (BODY_CLASS) on .portrait-wrap and
   .duo-slot every beat. Static poses are transforms; arrivals re-trigger the
   animated ones because the className is rewritten each beat. Poses live on
   the WRAP only (the img's copy of the class is a data hook, not a style hook —
   styling both would double every transform). */
.portrait-wrap { transition: transform 0.35s ease, filter 0.35s ease; }
.portrait-wrap.pose-lean, .duo-slot.pose-lean { transform: rotate(4deg); }
.portrait-wrap.pose-tilt, .duo-slot.pose-tilt { transform: rotate(-3deg) translateY(2px); }
.portrait-wrap.pose-droop, .duo-slot.pose-droop:not(.dimmed) { transform: translateY(8px); filter: saturate(0.8) brightness(0.92); }
.portrait-wrap.pose-shy, .duo-slot.pose-shy { transform: scale(0.97) translateY(4px); }
.portrait-wrap.pose-forward, .duo-slot.pose-forward { transform: scale(1.03) translateY(-2px); }
.portrait-wrap.pose-bounce, .duo-slot.pose-bounce { animation: poseBounce 0.8s cubic-bezier(0.3, 1.4, 0.4, 1) 1; }
@keyframes poseBounce {
  0%, 100% { transform: translateY(0); }
  18% { transform: translateY(-14px); } 40% { transform: translateY(0); }
  58% { transform: translateY(-7px); } 78% { transform: translateY(0); } }
.portrait-wrap.pose-jump, .duo-slot.pose-jump { animation: poseJump 0.55s ease 1; }
@keyframes poseJump { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-18px) scale(1.02); } }
/* idle breath — barely there, but a still JPEG reads dead without it */
.portrait-wrap .sprite, .duo-slot .sprite { animation: spriteBreath 4s ease-in-out infinite alternate; }
@keyframes spriteBreath { from { translate: 0 0; } to { translate: 0 3px; } }
/* cutout silhouettes get the style bible's deliberate ink contour: a tight
   4-way stacked drop-shadow, so a standing figure reads as an outlined stage
   cutout rather than a raw paste */
.portrait-wrap .sprite, .duo-slot .sprite { filter:
  drop-shadow(1.5px 0 0 #241335) drop-shadow(-1.5px 0 0 #241335)
  drop-shadow(0 1.5px 0 #241335) drop-shadow(0 -1.5px 0 #241335)
  drop-shadow(0 12px 24px rgba(0, 0, 0, 0.5)); }

/* ---------- 8.6 prom night wears a warmer grade ---------- */
.prom-night .portrait-wrap .sprite, .prom-night .duo-slot .sprite { filter:
  drop-shadow(1.5px 0 0 #241335) drop-shadow(-1.5px 0 0 #241335)
  drop-shadow(0 1.5px 0 #241335) drop-shadow(0 -1.5px 0 #241335)
  drop-shadow(0 0 18px rgba(255, 200, 74, 0.28)) drop-shadow(0 12px 24px rgba(0, 0, 0, 0.5))
  brightness(0.97) saturate(1.05); }
.prom-night .pcard { box-shadow: 0 0 0 3px rgba(255, 233, 176, 0.85),
  0 0 24px rgba(255, 200, 74, 0.35), 0 6px 18px rgba(0, 0, 0, 0.45);
  filter: brightness(0.97) saturate(1.05); }
.scene-banner.prom { background: rgba(8, 5, 16, 0.86); border-color: rgba(255, 200, 74, 0.55); }
.scene-banner.prom b, .scene-banner.prom span, .scene-banner.prom .han { color: var(--gold); }
@media (max-width: 700px) { .prom-dress .prom-deco { height: 120px; } }

/* ---------- 8.7 stat HUD: gold flash up, red flash down (one shot) ---------- */
.shud.up { animation: shudUp 0.9s ease 1; }
@keyframes shudUp {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 74, 0); filter: brightness(1); }
  25% { box-shadow: 0 0 0 7px rgba(255, 200, 74, 0.4); filter: brightness(1.6) saturate(1.3); } }
.shud.down { animation: shudDown 0.9s ease 1; }
@keyframes shudDown {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 72, 63, 0); filter: brightness(1); }
  25% { box-shadow: 0 0 0 7px rgba(232, 72, 63, 0.45); filter: brightness(1.35) saturate(1.4) hue-rotate(-12deg); } }

/* ---------- 8.8 the stamps card is a PAPER OBJECT with an ink seal ----------
   Every .stamps-card (scene end card, event cards, chip cards, coronation) is
   now cream paper with a thick ink outline, a hard drop, and a 1deg tilt — a
   thing that was handed to you, not a dialog that opened. Locals re-scope the
   glass tokens so every token-driven child reads as ink-on-paper in BOTH themes. */
.stamps-card {
  --paper: #241335; --ink: #241335; --haze: rgba(36, 19, 53, 0.6);
  --dim: rgba(36, 19, 53, 0.55); --title: #a06514; --emph-fg: #f6f0e2;
  --edge-rgb: 36, 19, 53; --hairline: rgba(36, 19, 53, 0.24);
  --card: #f6f0e2; --card-2: #ece2cc; --line: rgba(36, 19, 53, 0.35);
  --field-bg: rgba(36, 19, 53, 0.07); --field-fg: #241335;
  --chip-bg: rgba(106, 63, 160, 0.12); --chip-fg: #4a2d80; --chip-bd: rgba(106, 63, 160, 0.4);
  --chip-no-bg: rgba(200, 40, 32, 0.1); --chip-no-fg: #9a1b12; --chip-no-bd: rgba(200, 40, 32, 0.35);
  position: relative; background: #f6f0e2; color: #241335; font-size: var(--prom-text-latin); line-height: 1.5;
  border: 3px solid #241335; border-radius: 14px;
  box-shadow: 0 8px 0 rgba(14, 6, 24, 0.55), 0 30px 70px rgba(0, 0, 0, 0.5);
  transform: none; }
.stamps-card .wrongline { font-size: var(--prom-text-latin) !important; } /* runtime inline 13px fallback */
.stamps-card .han { font-size: var(--prom-text-zh); }
.stamps-card h3 { color: #241335; }
.stamps-card h3.pass, .stamps-card h3.soft { color: #241335; opacity: 1; }
.stamps-card h3.bad { color: #a8231a; opacity: 1; }
/* room for the seal beside the verdict */
.stamps-card h3.pass, .stamps-card h3.soft, .stamps-card h3.bad { padding-right: 96px; min-height: 84px; }
/* the ink seal SLAMS in at an angle: gold 合格 on a pass, red on a blow-up,
   a patient grey 再来 on an almost. :has() keys it off the verdict class so
   non-outcome stamps-cards (events, chip cards) never grow a seal. */
.stamps-card:has(> h3.pass)::after, .stamps-card:has(> h3.soft)::after, .stamps-card:has(> h3.bad)::after {
  position: absolute; top: 12px; right: 16px; width: 84px; height: 84px;
  display: grid; place-items: center; border: 4px solid currentColor; border-radius: 50%;
  font-family: var(--han); font-weight: 900; font-size: 27px; letter-spacing: 2px; line-height: 1;
  pointer-events: none; mix-blend-mode: multiply; transform: rotate(12deg);
  animation: sealSlam 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) 0.25s both; }
.stamps-card:has(> h3.pass)::after { content: "合格"; color: #b8860b; }
.stamps-card:has(> h3.soft)::after { content: "再来"; color: rgba(36, 19, 53, 0.45); }
.stamps-card:has(> h3.bad)::after { content: "不合"; color: #a8231a; }
@keyframes sealSlam { from { opacity: 0; transform: rotate(24deg) scale(1.9); } }
/* a hostile ending washes the whole card red — Monster Prom's color-flip law */
.stamps-card:has(> h3.bad) { background: #f0d8d0; border-color: #6b2a35;
  --card: #f0d8d0; --card-2: #e6c8bd; }
/* stamp pills: inked ticket chips on the paper */
.stamp { border: 2px solid rgba(36, 19, 53, 0.75); color: #241335; font-weight: 700; font-size: var(--prom-text-latin);
  background: rgba(255, 255, 255, 0.45); }
.stamp b { color: #241335; }
.stamp.hearts { color: #c22d75; border-color: rgba(194, 45, 117, 0.8); }
.stamp.hearts b { color: #c22d75; }
.stamp.money, .stamp.ok { color: #a06514; border-color: rgba(160, 101, 20, 0.7); }
.stamp.meh { opacity: 0.55; }
.band-change { color: #241335; }
.outcome, .binary-result { color: rgba(36, 19, 53, 0.72); }
.askresult { border-left-color: #b8860b; }
/* the Continue slab: solid ink, cream lettering — unmissable, physical */
.stamps-card .bigbtn { background: #241335; color: #f6f0e2; border: 0;
  box-shadow: 0 4px 0 rgba(36, 19, 53, 0.35); }
.stamps-card .bigbtn:hover { filter: none; opacity: 0.92; }

/* ---------- 8.9 the decision modal: black slab, cream slanted bars ----------
   Straight from ref-choice.jpg: dark stage card, hand-lettered question, and
   each option a cream bar that tilts and fills with the CHARACTER'S accent on
   hover (--ch-color is set on the scene root by game.js). */
.binary-card { --paper: #f6f2ff; --haze: #c9bfdd; --edge-rgb: 255, 255, 255;
  --hairline: rgba(255, 255, 255, 0.16); --emph-fg: #14121a; --title: #ffc84a; --dim: #b9a8d6;
  background: rgba(34, 22, 54, 0.96); color: #f6f2ff;
  border: 3px solid #241335; border-radius: 18px;
  box-shadow: 0 8px 0 rgba(14, 6, 24, 0.6), 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: rotate(-0.6deg); }
.binary-card p { color: #fff; font-size: 18px; font-weight: 700; }
.binary-card .binary-result, .binary-card .outcome { color: #c9bfdd; }
.binary-opt { --tilt: -0.7deg; background: #f6f0e2; color: #241335;
  border: 2.5px solid #241335; border-radius: 12px;
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.75); transform: rotate(var(--tilt));
  transition: transform 0.12s, background 0.12s, border-color 0.12s, box-shadow 0.12s; }
.binary-opt:nth-of-type(even) { --tilt: 0.6deg; }
.binary-opt:hover { transform: rotate(var(--tilt)) translateY(-2px);
  background: color-mix(in srgb, var(--ch-color, #ff4fa3) 16%, #f6f0e2);
  border-color: var(--ch-color, var(--magenta));
  box-shadow: 0 6px 0 rgba(14, 6, 24, 0.75); }
.binary-opt b { color: #241335; }
.binary-opt .han { color: #241335; }
.binary-opt span { color: rgba(36, 19, 53, 0.62); }
/* the stat chip inside an option (once game.js renders it): bold when the odds
   favor you, gold-filled so risk reads at a glance — chili-pepper law */
.binary-opt .opt-stat { display: inline-block; margin-left: 8px; padding: 1px 9px;
  border: 2px solid rgba(36, 19, 53, 0.75); border-radius: 999px;
  font-size: 12.5px; font-weight: 800; color: #241335; background: rgba(36, 19, 53, 0.06); }
.binary-opt .opt-stat.fav { background: var(--gold); border-color: #241335; }

/* ---------- 8.10 map: plaques planted in the town, not tags on a page ----------
   ROUND 2 (cycle 5). The night-ink pass regressed the map 2/3 → 0/3: with the
   HUD unified dark too, every judge read the overlay as "uniform dark app
   chips scattered mid-canvas". So the map's markers change MATERIAL: cream
   PAPER signboards with ink outlines and a planted stake — the same paper
   language as the enroll form that wins its pairs, and the diegetic-signpost
   idiom the judges praised in the winning map. The character pins become
   die-cut stickers (cream ring + ink line), also straight from the winning
   map's "sticker head markers". */
.mapnode { --tilt: -1deg; background: linear-gradient(178deg, #faf3df 0%, #f2ebd6 70%, #ebe1c6 100%);
  color: #241335;
  border: 2.5px solid #241335; border-radius: 8px;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: 0 4px 0 rgba(20, 10, 32, 0.55), 0 10px 18px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%) rotate(var(--tilt)); }
.mapnode:nth-child(even) { --tilt: 1.1deg; }
.mapnode:nth-child(3n) { --tilt: -0.4deg; }
/* the stake that plants the board in the painting — a signpost, not a pill */
.mapnode::before { content: ""; position: absolute; left: 50%; top: 100%; width: 5px; height: 13px;
  margin-left: -2.5px; background: #241335; border-radius: 0 0 2.5px 2.5px; z-index: -1; }
.mapnode .han { color: #241335; text-shadow: none; }
.mapnode .mn-en { color: rgba(36, 19, 53, 0.62); }
.mapnode:hover, .mapnode.sel { background: #fffaf0; border-color: #c1272d;
  transform: translate(-50%, -50%) rotate(var(--tilt)) scale(1.07); }
.mapnode:hover .han, .mapnode.sel .han { color: #8c2333; }
.mapnode:hover .mn-en, .mapnode.sel .mn-en { color: rgba(140, 35, 51, 0.85); }
/* a shut district stays readable AND explains itself on hover — silent 40%
   opacity was a mystery; a signboard can say "not yet". Kraft stock, dim ink. */
.mapnode.shut { opacity: 0.95; border-style: solid; background: #e2d7bd; color: rgba(36, 19, 53, 0.6); cursor: not-allowed; }
.mapnode.shut .han { color: rgba(36, 19, 53, 0.55); }
.mapnode.shut .mn-en { color: rgba(36, 19, 53, 0.45); }
.mapnode.shut:hover { opacity: 1; transform: translate(-50%, -50%) rotate(var(--tilt)); background: #e2d7bd; border-color: #241335; }
.mapnode.shut:hover .han { color: rgba(36, 19, 53, 0.55); }
.mapnode.shut:hover .mn-en { color: rgba(36, 19, 53, 0.45); }
.mapnode.shut::after { content: "还没开 · not yet open"; position: absolute; left: 50%; top: calc(100% + 12px);
  transform: translateX(-50%); white-space: nowrap; pointer-events: none; z-index: 3;
  background: rgba(14, 8, 24, 0.94); color: #e9defc; border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700;
  opacity: 0; transition: opacity 0.12s; }
.mapnode.shut:hover::after { opacity: 1; }
/* character pins: die-cut stickers — cream ring, ink contour, hard drop.
   State arrives as badges and glows, never as a different ring colour. */
.mappin { box-shadow: 0 0 0 3px #f6f0e2, 0 0 0 5.5px #241335,
  0 5px 0 rgba(20, 10, 32, 0.5), 0 12px 20px rgba(0, 0, 0, 0.4); }
.mappin:hover { box-shadow: 0 0 0 3px #fff, 0 0 0 5.5px #241335,
  0 7px 0 rgba(20, 10, 32, 0.5), 0 14px 24px rgba(0, 0, 0, 0.45); }
.mappin.sel { box-shadow: 0 0 0 3px #f6f0e2, 0 0 0 5.5px #241335, 0 0 0 8.5px var(--magenta),
  0 12px 24px rgba(0, 0, 0, 0.55); }
.mappin.golden { box-shadow: 0 0 0 3px #f6f0e2, 0 0 0 5.5px #241335, 0 0 18px 6px rgba(255, 200, 74, 0.7); }
/* the pin's hover name tag matches the paper signboards */
.mappin::after { background: #f6f0e2; border: 2px solid #241335; color: #241335;
  box-shadow: 0 2px 0 rgba(20, 10, 32, 0.4); }
/* the day banner + phone button join the object language */
.day-banner { border: 2px solid #241335; box-shadow: 0 4px 0 rgba(36, 19, 53, 0.55); }
.phone-btn { border: 2.5px solid #241335; box-shadow: 0 4px 0 rgba(36, 19, 53, 0.55); }
.global-gear, .bug-fab { border-color: #241335; box-shadow: 0 3px 0 rgba(36, 19, 53, 0.5); }
/* the three day-slot dots stop being mystery meat: 早/午/晚 live inside them */
.slot-dots { gap: 8px; }
.slot-dots .dot { width: 17px; height: 17px; border-width: 2px; display: grid; place-items: center; }
.slot-dots .dot::before { font-family: var(--han); font-size: 9px; font-weight: 700; line-height: 1; color: var(--dim); }
.slot-dots .dot:nth-child(1)::before { content: "早"; }
.slot-dots .dot:nth-child(2)::before { content: "午"; }
.slot-dots .dot:nth-child(3)::before { content: "晚"; }
.slot-dots .dot.done::before { color: #14211a; }
.slot-dots .dot.now::before { color: var(--paper); }

/* ---------- 8.11 the phone is a lacquer slab, not a settings sheet ----------
   Pinned dark in both themes (it's an OBJECT in the fiction — a phone at night),
   with a faint gold charm edge. The Settings sheet keeps the theme's colours:
   it's chrome, not fiction. */
.phone:not(.settings-sheet) {
  --phone-a: #1c1926; --phone-b: #131118;
  --glass-rgb: 14, 12, 18; --edge-rgb: 255, 255, 255;
  --hairline: rgba(255, 255, 255, 0.14);
  --ink-60: rgba(14, 12, 18, 0.6); --ink-84: rgba(14, 12, 18, 0.84);
  --paper: #f2efe9; --haze: #a49fae; --ink: #f3eaff; --dim: #b9a8d6; --title: #ffffff;
  --card: #1c1926; --card-2: #241d31; --emph-fg: #14121a;
  --panel: #2a1c44; --panel2: #332352; --line: #443063;
  --field-bg: rgba(0, 0, 0, 0.38); --field-fg: #f2efe9;
  --chip-bg: rgba(150, 110, 220, 0.18); --chip-fg: #e0d2ff; --chip-bd: rgba(150, 110, 220, 0.45);
  --chip-no-bg: rgba(232, 72, 63, 0.16); --chip-no-fg: #ffb3ad; --chip-no-bd: rgba(232, 72, 63, 0.4);
  color: var(--ink);
  border: 1.5px solid rgba(255, 200, 74, 0.22); }

/* ---------- 8.12 graduation: a decorated night ceremony ----------
   game.js inlines the dark stage + max-width/padding so the card survives a CSS
   miss; everything else — the glass card, the gold diploma voice, sized
   avatars, spaced rows — lives here. Fixed colours: graduation is night in
   both themes (the stage gradient is inlined dark). */
.credits-screen { padding: 4vh 14px 6vh; }
.credits-card { background: rgba(26, 16, 48, 0.74); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.cc-head { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cc-school { color: var(--gold); font-size: 12.5px; font-weight: 700; letter-spacing: 0.18em; }
.cc-name { margin: 6px 0 0; font-size: 40px; font-weight: 900; color: #fff; line-height: 1.1;
  text-shadow: 0 3px 0 #241335, 0 0 26px rgba(255, 200, 74, 0.3); }
.cc-sub { color: #b9a8d6; font-size: 13px; }
.cc-hearts { color: var(--gold); letter-spacing: 2px; }
.cc-rels { margin: 12px 0; display: flex; flex-direction: column; gap: 2px; }
.cc-rel { display: flex; gap: 10px; align-items: flex-start; text-align: left; margin: 8px 0; }
.cc-rel > div { min-width: 0; }
/* the base avatar frame: everything that renders an avatar() into a .cc-av
   relies on this — credits rows carry inline clamps as a fallback, but the
   binary pickers, deeppick and reel rows all lean on the context rule */
.cc-av { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none; display: inline-block; }
.cc-av img, .cc-av svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.cc-hero .pola { margin: 0 auto; }
.cc-stats { margin: 14px 0; }
.cc-mems { color: #b9a8d6; font-size: 13px; font-style: italic; }
.cc-mems p { margin: 4px 0; }
.cc-note { margin: 18px 0 8px; font-size: 22px; font-family: var(--han); font-weight: 700;
  color: var(--gold); letter-spacing: 6px; }
.cc-actions { margin-top: 14px; }
.cc-actions .bigbtn { flex: 1 1 45%; width: auto; font-size: 15px; }
@media (max-width: 560px) {
  .cc-name { font-size: 30px; }
  .cc-actions .bigbtn { flex-basis: 100%; }
}

/* ---------- 8.13 drills: the night stage, in BOTH themes ----------
   The drill hall is a full-bleed stage with painted backdrops and a hardcoded
   dark canvas — a "light theme" here meant near-white walls around night art.
   Clamp every glass/ink token to the night values and fix the ground gradient;
   the theme toggle keeps its say on reading surfaces, not on stages. */
.minigame {
  --glass-rgb: 14, 12, 18; --edge-rgb: 255, 255, 255;
  --hairline: rgba(255, 255, 255, 0.14);
  --ink-60: rgba(14, 12, 18, 0.6); --ink-84: rgba(14, 12, 18, 0.84);
  --paper: #f2efe9; --haze: #a49fae; --ink: #f3eaff; --dim: #b9a8d6; --title: #ffffff;
  --page-bg: #191026; --card: #2a1c44; --card-2: #332352;
  --panel: #2a1c44; --panel2: #332352; --line: #443063; --emph-fg: #14121a;
  --field-bg: rgba(0, 0, 0, 0.38); --field-fg: #f2efe9;
  color: var(--ink);
  background: radial-gradient(ellipse 90% 60% at 50% 0%, #241636 0%, #191026 62%, #191026 100%); }
/* the painted backdrop is scenery, not a screenshot: soft focus, a hair darker,
   scaled past its own blur halo */
.mg-stagebg img { filter: blur(2.5px) saturate(0.82) brightness(0.8); transform: scale(1.04); }
/* the flat inline scrim steps aside for a stage-lit gradient (dark top for the
   HUD, dark floor for the boards, open middle for the art) */
.mg-stagebg .mg-scrim { visibility: hidden; }
.mg-stagebg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(14, 7, 26, 0.78) 0%, rgba(18, 9, 30, 0.34) 30%,
    rgba(18, 9, 30, 0.38) 62%, rgba(10, 5, 20, 0.82) 100%); }
/* the host: an outlined cutout who slides on stage; gone below 720px so the
   answer court never fights a torso for room */
/* z-index is load-bearing, not decoration: mgHostIn animates TRANSFORM, which
   makes .mg-host a stacking context for the 0.3s it runs — trapping the speech
   bubble inside it and painting it UNDER the answer boards, then flipping it on
   top the instant the animation ended (Lau saw the flash in Hoops). An explicit
   z-index keeps the host's layer above the court from the first frame. Safe
   because the boards now sit clear of the host's lane (see the padding rule). */
.mg-host { animation: mgHostIn 0.3s ease-out both; z-index: 3; }
@keyframes mgHostIn { from { opacity: 0; transform: translateY(9%); } }
.mg-hostart { filter:
  drop-shadow(1.5px 0 0 #241335) drop-shadow(-1.5px 0 0 #241335)
  drop-shadow(0 1.5px 0 #241335) drop-shadow(0 -1.5px 0 #241335)
  drop-shadow(0 10px 22px rgba(0, 0, 0, 0.55)); }
.mg-host .pcard { height: 100%; width: auto; }
@media (max-width: 720px) { .mg-host { display: none; } }
/* the speech bubble: PAPER — cream fill, thick ink line, a tail aimed at the
   host's head. .pop restarts on every line; .shout leans in; ok/bad tint the rim. */
.mg-bubble { width: max-content; max-width: min(40vw, 320px);
  background: #fdf6e0; color: #241335; border: 3px solid #241335; border-radius: 14px;
  padding: 8px 14px; font-size: 15px; line-height: 1.45; z-index: 2;
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.55); transform-origin: 12% 100%; }
.mg-bubble .han { font-size: 19px; font-weight: 700; color: #241335; }
.mg-bubble::after { content: ""; position: absolute; top: calc(100% - 7px); left: 14px;
  width: 13px; height: 13px; background: #fdf6e0;
  border-right: 3px solid #241335; border-bottom: 3px solid #241335;
  transform: rotate(58deg) skewX(14deg); }
.mg-bubble.pop { animation: bubblePop 0.22s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes bubblePop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
.mg-bubble.shout { transform: rotate(-2deg); font-weight: 800; }
.mg-bubble.shout.pop { animation-name: bubblePopShout; }
@keyframes bubblePopShout { 0% { transform: rotate(-2deg) scale(0.6); opacity: 0; } 70% { transform: rotate(-2deg) scale(1.08); opacity: 1; } 100% { transform: rotate(-2deg) scale(1); } }
.mg-bubble.ok { border-color: #1d9d80; }
.mg-bubble.bad { border-color: #e8483f; }
/* answer boards: solid night cards with the ink line and a TIGHT offset shadow —
   the huge blurred drops are gone (a sticker rests on the page, it doesn't hover
   four inches above it) */
.mg-board { background: var(--card); border: 3px solid #241335; border-radius: 14px;
  color: var(--paper); backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.7); }
.mg-board:hover { background: var(--card-2); border-color: var(--gold);
  transform: translateY(-3px); box-shadow: 0 7px 0 rgba(14, 6, 24, 0.7); }
.mg-board:active { transform: translateY(0); box-shadow: 0 3px 0 rgba(14, 6, 24, 0.7); }
.mg-board.right { border-color: var(--teal); background: rgba(62, 230, 196, 0.18); color: #eafff9; }
.mg-board.wrong { border-color: #e8483f; background: rgba(232, 72, 63, 0.2); color: #ffe9e6; }
/* Night-Market Rush: the answers are physical TRAYS — warm paper on a wood rim */
.mg-board.tray { background: #f2e4c2; color: #241335; border: 3px solid #241335; border-radius: 14px;
  box-shadow: inset 0 0 0 5px #8c5a2a, inset 0 0 0 7px rgba(36, 19, 53, 0.5), 0 4px 0 rgba(14, 6, 24, 0.8); }
.mg-board.tray .han { color: #241335; font-size: 21px; }
.mg-board.tray:hover { background: #f8eed4; border-color: #241335;
  transform: translateY(-3px) rotate(1deg);
  box-shadow: inset 0 0 0 5px #8c5a2a, inset 0 0 0 7px rgba(36, 19, 53, 0.5), 0 7px 0 rgba(14, 6, 24, 0.8); }
.mg-board.tray.right { background: #ffe9b0; color: #241335; border-color: #b8860b;
  box-shadow: inset 0 0 0 5px #b8860b, 0 4px 0 rgba(14, 6, 24, 0.8), 0 0 22px rgba(255, 200, 74, 0.5); }
.mg-board.tray.wrong { background: #f0d8d0; color: #6b1610; border-color: #a8231a;
  box-shadow: inset 0 0 0 5px #a8231a, 0 4px 0 rgba(14, 6, 24, 0.8); }
/* tone glider tags: outlined objects on the dark stage, and they now grade the
   answer exactly like the boards (right gold-lit / wrong red / dim faded) */
.mg-tone { background: #2a1c44; border: 2.5px solid #241335; border-radius: 12px;
  color: var(--paper); box-shadow: 0 3px 0 rgba(14, 6, 24, 0.7); }
.mg-tone:hover { background: #332352; border-color: var(--gold); color: var(--gold);
  transform: translateY(-2px); }
.mg-tone.right { border-color: var(--gold); color: var(--gold);
  box-shadow: 0 3px 0 rgba(14, 6, 24, 0.7), 0 0 18px rgba(255, 200, 74, 0.55); }
.mg-tone.wrong { border-color: #e8483f; color: #ff8d86; background: rgba(232, 72, 63, 0.16);
  animation: toneFlash 0.4s ease 1; }
@keyframes toneFlash { 30% { background: rgba(232, 72, 63, 0.4); } }
.mg-tone.dim { opacity: 0.35; }
/* the rush clock is a WOK FLAME, not a hairline: gold burning down to red with
   a flame cap riding the leading edge */
.mg-timerwrap { background: rgba(255, 255, 255, 0.1); border: 0; }
.mg-timerwrap.wok { height: 12px; overflow: visible; background: rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 0 0 2px rgba(36, 19, 53, 0.8); border-radius: 999px; }
/* !important: the drill loop writes an inline teal/red background on #mgTimer
   every frame as a CSS-less fallback — the wok flame must outrank it */
.mg-timerwrap.wok .mg-timer { position: relative; border-radius: 999px;
  background: linear-gradient(90deg, #e8483f, #ff9c4a 55%, #ffc84a) !important; }
.mg-timerwrap.wok .mg-timer::after { content: ""; position: absolute; right: -7px; top: 50%;
  width: 16px; height: 16px; margin-top: -8px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: radial-gradient(circle at 50% 60%, #fff6d8 0%, #ffc84a 45%, #e8483f 85%);
  box-shadow: 0 0 12px rgba(255, 156, 74, 0.8); animation: flameFlicker 0.35s ease-in-out infinite alternate; }
@keyframes flameFlicker { from { transform: rotate(-45deg) scale(1); } to { transform: rotate(-45deg) scale(1.25); } }
/* every timed drill: under 30% the clock burns red and pulses */
.mg-timerwrap.low { animation: mgLowPulse 0.7s ease-in-out infinite; }
.mg-timerwrap.low .mg-timer { background: linear-gradient(90deg, #a8231a, #e8483f) !important; }
@keyframes mgLowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 72, 63, 0); }
  50% { box-shadow: 0 0 10px 3px rgba(232, 72, 63, 0.55); } }
.mg-timerwrap.wok.low { animation: mgLowPulse 0.7s ease-in-out infinite; }
/* a miss is FELT before it's read: decaying jitter on the court */
.mg-shake { animation: mgShake 0.45s ease both; }
@keyframes mgShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px); } 30% { transform: translateX(8px); }
  45% { transform: translateX(-5px); } 60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); } }
/* the teaching payload on a miss becomes the headline — it owns the 2.2s window */
.mg-reveal.big { font-size: 20px; color: var(--dim); animation: revealFlash 0.3s ease both; }
.mg-reveal.big .han { font-size: 34px; color: #fdf6e0; text-shadow: 0 2px 0 #241335; }
@keyframes revealFlash { from { opacity: 0; transform: scale(1.12); } }
/* streak badge: pops centre-stage, drifts up, gone in under a second */
.mg-burst { position: absolute; left: 50%; top: 38%; z-index: 6; pointer-events: none;
  transform: translate(-50%, -50%); }
.mg-burst.streak { animation: streakUp 0.95s ease-out both; }
.mg-burst.streak .han, .mg-burst.streak b { font-family: var(--han); font-size: 28px; font-weight: 900;
  color: var(--gold); -webkit-text-stroke: 1.5px #241335; text-shadow: 0 3px 0 #241335, 0 0 22px rgba(255, 200, 74, 0.6); }
@keyframes streakUp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.18); }
  32% { transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 40px)) scale(1); } }
/* wok steam: six blurred puffs rising over the court when the clock wins */
.mg-steam { position: absolute; inset: 26% 14% 22%; z-index: 5; pointer-events: none; }
.mg-steam i { position: absolute; bottom: 20%; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 70%);
  filter: blur(5px); opacity: 0; animation: steamRise 1.05s ease-out forwards; }
.mg-steam i:nth-child(1) { left: 18%; animation-delay: 0s; }
.mg-steam i:nth-child(2) { left: 34%; width: 46px; height: 46px; animation-delay: 0.07s; }
.mg-steam i:nth-child(3) { left: 50%; animation-delay: 0.12s; }
.mg-steam i:nth-child(4) { left: 62%; width: 52px; height: 52px; animation-delay: 0.05s; }
.mg-steam i:nth-child(5) { left: 74%; animation-delay: 0.16s; }
.mg-steam i:nth-child(6) { left: 44%; width: 28px; height: 28px; animation-delay: 0.22s; }
@keyframes steamRise {
  0% { opacity: 0; transform: translateY(20px) scale(0.7); }
  25% { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-120px) scale(1.5); } }
/* curtain call: the grade takes the whole stage, stars pop in one by one */
.mg-finale { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: rgba(14, 6, 24, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: finaleIn 0.25s ease both; }
@keyframes finaleIn { from { opacity: 0; } }
.mg-finale > .han { font-size: 46px; font-weight: 900; color: var(--gold);
  -webkit-text-stroke: 2px #241335; text-shadow: 0 4px 0 #241335, 0 0 40px rgba(255, 200, 74, 0.45);
  animation: bubblePop 0.3s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.mg-stars { display: flex; gap: 12px; }
.mg-stars i { width: 14px; height: 14px; transform: rotate(45deg);
  border: 2.5px solid #241335; background: rgba(36, 19, 53, 0.5);
  animation: starPop 0.3s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.mg-stars i.on { background: var(--gold); box-shadow: 0 0 10px rgba(255, 200, 74, 0.7); }
.mg-stars i:nth-child(1) { animation-delay: 0.10s; } .mg-stars i:nth-child(2) { animation-delay: 0.18s; }
.mg-stars i:nth-child(3) { animation-delay: 0.26s; } .mg-stars i:nth-child(4) { animation-delay: 0.34s; }
.mg-stars i:nth-child(5) { animation-delay: 0.42s; } .mg-stars i:nth-child(6) { animation-delay: 0.50s; }
.mg-stars i:nth-child(7) { animation-delay: 0.58s; } .mg-stars i:nth-child(8) { animation-delay: 0.66s; }
.mg-stars i:nth-child(n+9) { animation-delay: 0.74s; }
@keyframes starPop { from { opacity: 0; transform: rotate(45deg) scale(0.2); } }
/* The run's score is the one fact on the card, so it sits at the kit's label
   floor (16px) rather than at 14. Round-2 judging: nothing a player must read
   goes under 16px, and "4/6 · big finish" is the whole point of the card. */
.mg-finale-en { color: #b9a8d6; font-size: 16px; }

/* ---------- 8.13b contrast patches for the pinned-night chrome ----------
   Anything pinned to a dark object above must not read its text colour from
   theme tokens (they flip dark in light mode). */
.hh-bond em { color: #f2efe9; }
.hh-bond.maxed .hh-rel { color: var(--gold); } /* --title flips dark in light mode; gold reads on the night pill in both */
.leavebtn.locked, .leavebtn.locked:hover { color: #cfc3e8; background: rgba(255, 255, 255, 0.07); }
.mapnode.allnode { color: rgba(36, 19, 53, 0.62); } /* paper signboard family now */
.mapnode.allnode .han { color: rgba(36, 19, 53, 0.62); }
.stamps-card .cp-head { color: #241335; }
.credits-card { --paper: #f6f2ff; --haze: #a49fae; --dim: #b9a8d6; --title: #ffffff;
  --out: #241335; --gold: #ffc84a; --teal: #3ee6c4;
  --edge-rgb: 255, 255, 255; --hairline: rgba(255, 255, 255, 0.14); }
/* the setup card + graduation reel are night stages in both themes — pin their
   text tokens so light mode can't turn them ink-on-ink */
.setup-card { --paper: #f2efe9; --haze: #a49fae; --edge-rgb: 255, 255, 255;
  --hairline: rgba(255, 255, 255, 0.14); color: #f3eaff; }
.reel-overlay { --paper: #f6f2ff; --haze: #a49fae; --dim: #b9a8d6; --title: #ffc84a;
  --edge-rgb: 255, 255, 255; --hairline: rgba(255, 255, 255, 0.14); color: #f3eaff; }

/* ---------- 8.14 motion respects the player ----------
   Reduced motion: entrances land in their final state (their keyframes only
   define a `from`), loops stop, jitter never runs. */
@media (prefers-reduced-motion: reduce) {
  .title-wordmark span, .enroll-card.rise, .title-cutout,
  .stamps-card:has(> h3.pass)::after, .stamps-card:has(> h3.soft)::after, .stamps-card:has(> h3.bad)::after,
  .shud.up, .shud.down, .leavebtn.ready,
  .portrait-wrap.pose-bounce, .duo-slot.pose-bounce, .portrait-wrap.pose-jump, .duo-slot.pose-jump,
  .portrait-wrap .sprite, .duo-slot .sprite, .portrait-wrap.musing, .gesture.thinking::after,
  .mg-host, .mg-bubble.pop, .mg-burst.streak, .mg-steam i, .mg-shake,
  .mg-timerwrap.low, .mg-timerwrap.wok .mg-timer::after, .mg-tone.wrong,
  .mg-finale, .mg-finale > .han, .mg-stars i, .mg-reveal.big { animation: none; }
}

/* ============================================================ round 9
   THE DIEGETIC SHEET PASS (cycle 3). Blind judges, all three: the dialogue
   panel + input row + tool pills read as "a productivity chat app sitting on
   a painting" — the single biggest margin in every verdict. The sheet becomes
   a dark LACQUER OBJECT in the same ink/paper language as the stamps card and
   the map plaques: opaque fill, thick #241335 ink line, hard offset shadow.
   Pinned to night in both themes — like the phone, the drills and the map
   chrome, it is an object in the fiction, not app chrome (the established
   light-theme constraint, handoff open-decision 5). */

/* ---------- 9.1 the lacquer sheet ---------- */
.dlg {
  /* pinned night tokens: every token-driven child (log text, hairlines, IME
     bar, donecard, gesture) reads as light-on-lacquer in BOTH themes */
  --glass-rgb: 14, 12, 18; --edge-rgb: 255, 255, 255;
  --hairline: rgba(255, 255, 255, 0.13);
  --ink-60: rgba(14, 12, 18, 0.6); --ink-84: rgba(14, 12, 18, 0.84);
  --paper: #f2efe9; --haze: #a49fae; --ink: #f3eaff; --dim: #b9a8d6; --title: #ffffff;
  --emph-fg: #14121a; --panel: #2a1c44; --panel2: #332352; --line: #443063;
  /* The well used to be rgba(0,0,0,0.35) — near-black purple on a dark purple
     sheet, which Lau could barely find. It's a LIGHTER lacquer inlay now: one
     step above the sheet instead of one step below it, so the place you type
     is the first thing your eye lands on. Light mode keeps its white form. */
  --field-bg: #3d2b60; --field-fg: #f2efe9;
  color: var(--ink);
  /* compressed footprint: the painting is the hero — the sheet is narrower,
     sits tighter to the bottom, and spends less padding on itself */
  width: min(860px, calc(100% - 20px)); margin: 0 auto 12px; padding: 16px 16px 11px;
  background: linear-gradient(180deg, #2b1d42 0%, #221533 100%);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 3px solid #241335; border-radius: 18px;
  box-shadow: 0 6px 0 rgba(14, 6, 24, 0.65), 0 26px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* tool pills: inked toggles — small solid objects, not web chips. ON presses
   the toggle in as paper (the ptab.sel idiom); gold stays reserved for earned. */
.dlg-tools { gap: 6px; padding: 2px 0 8px; }
.tool { background: #332352; border: 2px solid #241335; color: #cfc3e8;
  border-radius: 999px; padding: 3px 11px; font-size: 11.5px; font-weight: 700;
  box-shadow: 0 2px 0 rgba(14, 6, 24, 0.55); transition: all 0.12s; }
.tool:hover { color: #fff; border-color: #241335; background: #3c2a5e; transform: translateY(-1px); }
.tool.on { background: #f2efe9; border-color: #241335; color: #241335;
  box-shadow: 0 1px 0 rgba(14, 6, 24, 0.55); transform: translateY(1px); }

/* the input: a lacquer inlay set INTO the sheet — ink-lined, with a cream
   hairline around the outside so the field's edge exists at a glance */
.dlg-input { gap: 8px; }
.dlg-input #say { background: var(--field-bg); border: 2px solid #241335; color: var(--field-fg);
  box-shadow: inset 0 2px 0 rgba(14, 6, 24, 0.4), 0 0 0 1.5px rgba(242, 239, 233, 0.22); }
.dlg-input #say::placeholder { color: rgba(242, 239, 233, 0.45); }
/* focus is unmissable: the gold rim the rest of the game uses for "you're here" */
.dlg-input #say:focus { border-color: var(--gold); background: var(--field-bg); filter: none;
  box-shadow: inset 0 2px 0 rgba(14, 6, 24, 0.4), 0 0 0 3px rgba(255, 200, 74, 0.3); }
/* (the standalone mic slab is the confession screen's and the debate's now —
   the scene's mic lives inside the field and opts out of this look) */
.dlg-input .micbtn { background: #332352; border: 2px solid #241335; color: #cfc3e8;
  box-shadow: 0 2px 0 rgba(14, 6, 24, 0.55); }
.dlg-input .micbtn:hover { color: #fff; background: #3c2a5e; border-color: #241335; }
.dlg-input .micbtn.listening { background: #f2efe9; color: #14121a; border-color: #241335; }

/* Send is a SEAL-STAMP SLAB: vermillion chop, ink outline, hard drop — and it
   physically presses when you stamp your words. Shared with the phone's chat
   inputs (same fiction, same object). */
.dlg-input .sendbtn, .chat-input .sendbtn {
  background: linear-gradient(160deg, #e8483f, #bd2028); color: #ffe9b0;
  border: 2.5px solid #241335; border-radius: 12px;
  font-family: var(--hand); font-weight: 800; letter-spacing: 0.04em;
  text-shadow: 0 1px 0 rgba(36, 19, 53, 0.55);
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.7); }
.dlg-input .sendbtn:hover, .chat-input .sendbtn:hover { transform: translateY(-1px); opacity: 1;
  filter: brightness(1.07); box-shadow: 0 5px 0 rgba(14, 6, 24, 0.7); }
.dlg-input .sendbtn:active, .chat-input .sendbtn:active { transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(14, 6, 24, 0.7); }
/* (Hint left the send row for the tool strip — it takes the .tool pill above) */

/* your line is a die-cut paper note stuck on the lacquer */
.line.player { background: #f2efe9; border: 2px solid #241335; color: #241335;
  border-radius: 14px 14px 4px 14px; box-shadow: 0 2px 0 rgba(14, 6, 24, 0.5); }
.line.player .line-en { color: rgba(36, 19, 53, 0.62); }

/* suggestion chips: die-cut stickers — cream, inked, slightly askew */
.suggestion { background: #f6f0e2; border: 2px solid #241335; border-radius: 11px;
  color: #241335; box-shadow: 0 3px 0 rgba(14, 6, 24, 0.6);
  transform: rotate(-0.5deg); transition: transform 0.1s, box-shadow 0.1s, background 0.1s; }
.line.sys .suggestion:nth-of-type(even), .sugg-row:nth-of-type(even) .suggestion { transform: rotate(0.5deg); }
.suggestion:hover { background: #fdf6e0; transform: translateY(-2px) rotate(0deg);
  box-shadow: 0 5px 0 rgba(14, 6, 24, 0.6); }
.suggestion .tag { color: #8c2333; font-size: 10px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; }
.suggestion .han { color: #241335; }
.suggestion .dim { color: rgba(36, 19, 53, 0.6); }

/* the coach becomes the teacher's PAPER note clipped to the sheet's top edge —
   cream stock, ink text, the verdict lives in the red-pen edge colour */
.coachbar { background: #f6f0e2; backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 2.5px solid #241335; border-left-width: 6px; border-left-color: rgba(36, 19, 53, 0.45);
  border-radius: 12px; box-shadow: 0 4px 0 rgba(14, 6, 24, 0.55), 0 14px 34px rgba(0, 0, 0, 0.4); }
.coachbar.nailed { border-left-color: #1d9d80; }
.coachbar.awkward { border-left-color: #b8860b; }
.coachbar.wrong { border-left-color: #a8231a; }
.cb-tag { color: rgba(36, 19, 53, 0.55); }
.coachbar.nailed .cb-tag { color: #1d9d80; }
.coachbar.awkward .cb-tag { color: #b8860b; }
.coachbar.wrong .cb-tag { color: #a8231a; }
.cb-note { color: #241335; }
.cb-fix { border-top: 1px dashed rgba(36, 19, 53, 0.3); }
.cb-fix .han { color: #241335; }
.cb-say { border: 1.5px solid rgba(36, 19, 53, 0.4); color: rgba(36, 19, 53, 0.65); background: transparent; }
.cb-say:hover { color: #241335; border-color: #241335; }
.cb-use { background: #241335; color: #f6f0e2; box-shadow: 0 2px 0 rgba(14, 6, 24, 0.4); }

@media (max-width: 700px) {
  .dlg { width: auto; margin: 0 6px 6px; padding: 12px 10px 8px; border-radius: 16px; }
}

/* ---------- 9.2 night lighting: evening scenes grade the figures ----------
   Daylight portrait art floated over night courtyards (every judge). Evening
   scenes now pull the figure INTO the night: darker, a touch desaturated, and
   rim-lit warm from the lanterns below. Keyed off the scene's own time-of-day
   layer, so every cutout in the scene — Coco's standing sprite included, and
   with nothing Coco-specific — wears the same grade. Prom night keeps its own
   warmer festival grade (9.2b). */
.scene-screen:not(.prom-night):has(.todlayer.evening) .portrait-wrap .sprite,
.scene-screen:not(.prom-night):has(.todlayer.evening) .duo-slot .sprite {
  filter:
    drop-shadow(1.5px 0 0 #241335) drop-shadow(-1.5px 0 0 #241335)
    drop-shadow(0 1.5px 0 #241335) drop-shadow(0 -1.5px 0 #241335)
    drop-shadow(0 0 18px rgba(255, 170, 80, 0.32))
    drop-shadow(0 12px 24px rgba(0, 0, 0, 0.6))
    brightness(0.84) saturate(0.9) contrast(1.04); }
.scene-screen:not(.prom-night):has(.todlayer.evening) .portrait-wrap svg {
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.55)) brightness(0.84) saturate(0.9); }
.scene-screen:not(.prom-night):has(.todlayer.evening) .portrait-wrap .stagecard {
  filter: brightness(0.86) saturate(0.9);
  box-shadow: 0 0 0 3px rgba(255, 214, 150, 0.75), 0 0 22px rgba(255, 170, 80, 0.3),
    0 8px 20px rgba(0, 0, 0, 0.5); }
/* the evening wash itself: cooler at the sky, a whisper of lantern warmth low */
.todlayer.evening { background:
  linear-gradient(180deg, rgba(50, 30, 110, 0.28), rgba(24, 12, 60, 0.16) 55%, rgba(255, 140, 40, 0.07)); }

/* 9.2b prom night: the same discipline, warmer — the figure dims into the hall
   and the gold rim does the lighting (was brightness 0.97, still daylight) */
.prom-night .portrait-wrap .sprite, .prom-night .duo-slot .sprite { filter:
  drop-shadow(1.5px 0 0 #241335) drop-shadow(-1.5px 0 0 #241335)
  drop-shadow(0 1.5px 0 #241335) drop-shadow(0 -1.5px 0 #241335)
  drop-shadow(0 0 22px rgba(255, 200, 74, 0.42)) drop-shadow(0 12px 26px rgba(0, 0, 0, 0.6))
  brightness(0.9) saturate(1.04); }

/* ---------- 9.3 enrollment is a PAPER FORM on the gate painting ----------
   The frosted glass card becomes the school's own enrollment form: cream
   stock, ink rule, hard drop, one red chop of a CTA drawn from the title
   art's red sun. Hardcoded (it sits on a painting in both themes). */
.enroll-card { background: #f6f0e2; backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 3px solid #241335; border-radius: 16px; gap: 16px; padding: 24px 22px 22px;
  box-shadow: 0 8px 0 rgba(14, 6, 24, 0.5), 0 30px 70px rgba(0, 0, 0, 0.5);
  transform: rotate(-0.5deg); }
.enroll-eyebrow { color: #8c2333; }
.enroll-title { color: #241335; }
.enroll-sub { color: rgba(36, 19, 53, 0.72); }
.enroll-label { color: #241335; }
.enroll-hint { color: rgba(36, 19, 53, 0.5); }
.enroll-namewrap input { background: #fff; color: #241335; caret-color: #c1272d;
  border: 2px solid rgba(36, 19, 53, 0.45); border-radius: 10px; }
.enroll-namewrap input::placeholder { color: rgba(36, 19, 53, 0.35); }
.enroll-namewrap input:focus { border-color: #c1272d; background: #fff;
  box-shadow: 0 0 0 3px rgba(232, 72, 63, 0.18); }
/* 3-up language grid: the third choice no longer orphans on its own row */
.enroll-langrow { grid-template-columns: repeat(3, 1fr); }
.enroll-lang { background: rgba(36, 19, 53, 0.04); border: 2px solid rgba(36, 19, 53, 0.35);
  border-radius: 10px; color: rgba(36, 19, 53, 0.75); padding: 10px 4px; }
.enroll-lang:hover { background: rgba(36, 19, 53, 0.08); border-color: rgba(36, 19, 53, 0.6); }
.enroll-lang b { color: #241335; }
.enroll-lang span { color: rgba(36, 19, 53, 0.55); font-size: 10.5px; }
/* picked = red-circled on the form, the way a registrar would */
.enroll-lang.sel { background: rgba(232, 72, 63, 0.1); border-color: #c1272d;
  box-shadow: 0 0 0 1.5px rgba(193, 39, 45, 0.4); }
.enroll-lang.sel span { color: #8c2333; }
/* the CTA is the red sun off the title art: vermillion slab, gold lettering */
.enroll-go { background: linear-gradient(160deg, #e8483f, #b81f26); color: #ffe9b0;
  border: 3px solid #241335; border-radius: 14px;
  text-shadow: 0 1px 0 rgba(36, 19, 53, 0.55);
  box-shadow: 0 5px 0 rgba(14, 6, 24, 0.6); }
.enroll-go:hover { filter: brightness(1.07); }
.enroll-go:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(14, 6, 24, 0.6); }
.enroll-card .warn { color: #a8231a; }
/* contact shadows ground the two cast cutouts leaning into frame; explicit
   z-order keeps the shadow UNDER the figures and the card (a fixed pseudo
   otherwise paints over unpositioned children) */
.enroll-screen::before, .enroll-screen::after { content: ""; position: fixed; bottom: -3vh;
  width: 30vw; height: 9vh; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse at center, rgba(8, 4, 14, 0.55), transparent 68%); }
.enroll-screen::before { left: -4vw; }
.enroll-screen::after { right: -4vw; }
.title-cutout { z-index: 1; }
.enroll-card { position: relative; z-index: 2; }

/* ---------- 9.4 graduation: certificate + red chop ----------
   The card was a dark receipt. Now it's a warm ceremony object: certificate
   rules in gold, an inner hairline, and the school's vermillion chop stamped
   over the corner. The prom-date polaroid stays the hero, bigger. */
.credits-card { position: relative;
  background: linear-gradient(180deg, #2f1c48 0%, #221136 100%);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 2.5px solid rgba(255, 200, 74, 0.55); border-radius: 16px;
  box-shadow: 0 8px 0 rgba(10, 4, 18, 0.6), 0 34px 80px rgba(0, 0, 0, 0.6); }
.credits-card::before { content: ""; position: absolute; inset: 7px; pointer-events: none;
  border: 1.5px solid rgba(255, 200, 74, 0.28); border-radius: 10px; }
/* the chop: 毕业, stamped a little crooked, same slam as the stamps card */
.credits-card::after { content: "毕业"; position: absolute; top: 14px; right: 14px;
  width: 64px; height: 64px; display: grid; place-items: center; pointer-events: none;
  border: 3.5px solid #d84740; border-radius: 12px; color: #e8564d;
  font-family: var(--han); font-weight: 900; font-size: 22px; letter-spacing: 2px;
  transform: rotate(9deg); opacity: 0.92;
  animation: sealSlam 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) 0.5s both; }
/* the polaroid hero dominates (the inline width is the CSS-miss fallback) */
.cc-hero-pola { width: min(340px, 84vw) !important;
  border: 2.5px solid #241335;
  box-shadow: 0 6px 0 rgba(10, 4, 18, 0.55), 0 20px 50px rgba(0, 0, 0, 0.5); }
.cc-seal svg { filter: drop-shadow(0 6px 0 rgba(10, 4, 18, 0.5)); }
@media (max-width: 560px) { .credits-card::after { width: 52px; height: 52px; font-size: 18px; top: 10px; right: 10px; } }

/* ---------- 9.5 notifications speak the phone's language ----------
   Same lacquer slab + gold charm edge as the phone object, round contact
   face — a message from the fiction's phone, not an OS toast. */
.notif { background: linear-gradient(180deg, #1c1926 0%, #131118 100%);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 1.5px solid rgba(255, 200, 74, 0.3); border-radius: 18px;
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.65), 0 16px 40px rgba(0, 0, 0, 0.45); }
.notif-ico { border-radius: 50%; box-shadow: 0 0 0 2.5px rgba(255, 233, 176, 0.8); }
.notif-ico .pav, .notif-ico img, .notif-ico svg, .notif-appicon { border-radius: 50%; }

/* ---------- 9.6 Rush finale: the curtain call owns the stage ----------
   (queued from the minigames fixer) The 满分 headline sat on the busy board;
   the confetti burst had z-index auto and painted UNDER the z7 scrim. Darker
   spotlight grade behind the grade, confetti above it. */
.mg-finale { background: radial-gradient(ellipse 72% 60% at 50% 44%,
    rgba(14, 6, 24, 0.84) 0%, rgba(14, 6, 24, 0.52) 100%);
  backdrop-filter: blur(4px) saturate(0.8); -webkit-backdrop-filter: blur(4px) saturate(0.8); }
.minigame > .spellfx { z-index: 8; }

/* ---------- 9.7 toast, bottom-anchored variant ----------
   For toasts over cinematics (credits): game.js relies on THESE TWO RULES alone
   now (the inline-style fallback is gone) — never drop them. */
.toast.low { top: auto; bottom: 20px; transform: translate(-50%, 30px); }
.toast.low.show { transform: translate(-50%, 0); }

/* ============================================================ round 10
   THE CYCLE-4 SWEEP. Cycle 3's three 0/3 surfaces (choice modal, prom doors,
   enroll title) plus the stills judges' floor list: rectangular sprite crops,
   three-voice HUD, debug quota chip. One rule of thumb runs through all of it:
   if it floats over a painting it is a NIGHT-INK PLAQUE (opaque ink fill, thick
   #241335 line, hard offset drop, gold hanzi as the light); if the player grabs
   it, it is CREAM PAPER with the same line and drop. No more third voice. */

/* ---------- 10.1 the choice is an OBJECT: lacquer plaque + fortune slips ----
   ROUND 2 (cycle 5). The cycle-4 rebuild still lost 0/3; the whys were
   specific, so this pass answers them one by one:
   - "blurs and dims its art to near-invisibility" → the scrim loses its blur
     and most of its ink: the WORLD stays visible, the choice floats low so the
     speaker keeps the stage (their reaction IS the stakes).
   - "sets a full narration paragraph in its heavy outlined display font" →
     body copy goes back to the body stack; the hand voice survives only on the
     DECISION tab and the kicker.
   - "two choice cards are unequal widths / orphans 好！" → slips are flex:1 1 0
     with balanced text; tilts share ONE axis (a hand that placed both slips at
     once), no more opposite-rotation scatter.
   - "cream cards with drop shadows, rounded corners" → tighter radius, hard
     offset drop, vermillion band + punched cord hole: a temple fortune slip,
     not a note card. */
.binary-modal { background: linear-gradient(180deg,
    rgba(10, 5, 18, 0.12) 0%, rgba(10, 5, 18, 0.26) 48%, rgba(10, 4, 18, 0.62) 100%);
  backdrop-filter: none; -webkit-backdrop-filter: none; }
.binary-card {
  background:
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1.4px),
    radial-gradient(ellipse 120% 90% at 50% -20%, rgba(255, 200, 74, 0.09), transparent 55%),
    linear-gradient(175deg, #2c1a4a 0%, #221136 58%, #1a0d2b 100%);
  background-size: 9px 9px, auto, auto;
  border: 3px solid #241335; border-radius: 16px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 200, 74, 0.3),
    0 9px 0 rgba(10, 4, 18, 0.65), 0 34px 80px rgba(0, 0, 0, 0.65); }
/* the kicker reads as the plaque's small gold engraving, not a web overline */
.binary-card .event-kicker { color: var(--gold); letter-spacing: 0.16em; }
.binary-card h3 { font-family: var(--hand); color: #fdf6e0; }
/* the setup line: quiet BODY type — narration is copy, not signage. The hanzi
   inside it stays a teaching surface: lantern gold, han face. */
.binary-card .binary-prompt { font-family: -apple-system, system-ui, sans-serif;
  font-size: 15.5px; font-weight: 500; line-height: 1.6;
  color: #efe8fb; text-align: center; text-wrap: balance;
  max-width: 46ch; margin: 4px auto 16px; }
.binary-card .binary-prompt b { color: var(--gold); }
.binary-card .binary-prompt .han { color: var(--gold); font-family: var(--han); }
/* the authored closer announces itself with a wax-gold tab pinned to the edge */
.closer-modal .binary-card { position: relative; }
.closer-modal .binary-card::before { content: "DECISION"; position: absolute; top: -15px; left: 20px;
  transform: rotate(-3deg); background: var(--gold); color: #241335;
  font-family: var(--hand); font-weight: 800; font-size: 12.5px; letter-spacing: 0.14em;
  padding: 4px 13px; border: 2.5px solid #241335; border-radius: 999px;
  box-shadow: 0 3px 0 rgba(36, 19, 53, 0.75); }
/* the closer hangs LOW on the stage so the character stays in frame above it —
   the world the judges wanted visible is the speaker waiting on your answer */
/* dvh + the home-bar inset: this plaque sits ON the bottom edge, which is
   exactly where iOS parks its toolbar (see "THE vh TRAP") */
.binary-modal.closer-modal { align-items: flex-end; padding-bottom: max(9vh, 76px);
  padding-bottom: max(9dvh, 76px, env(safe-area-inset-bottom)); }
/* two fortune-slips in a row, placed by one hand (same tilt axis, same seat),
   breaking the plaque's bottom edge — objects resting on it, not rows in it */
.binary-slips { display: flex; align-items: stretch; gap: 16px; margin: 6px 2px -42px; }
.binary-slips .binary-slip { flex: 1 1 0; min-width: 0; margin: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; gap: 7px; text-align: center;
  padding: 12px 14px 15px; border-radius: 7px;
  background: linear-gradient(178deg, #fdf6e0 0%, #f6f0e2 66%, #efe5cd 100%);
  border: 2.5px solid #241335;
  transform: rotate(var(--tilt)) translateY(var(--dy, 0px));
  box-shadow: 0 5px 0 rgba(14, 6, 24, 0.8), 0 16px 26px rgba(0, 0, 0, 0.38); }
.binary-slips .binary-slip { --tilt: -1.3deg; }
.binary-slips .binary-slip:nth-of-type(even) { --tilt: -1.3deg; --dy: 5px; }
.binary-slips .binary-slip:not(:disabled):hover { transform: rotate(var(--tilt)) translateY(calc(var(--dy, 0px) - 4px));
  border-color: var(--ch-color, var(--magenta));
  box-shadow: 0 8px 0 rgba(14, 6, 24, 0.8), 0 20px 30px rgba(0, 0, 0, 0.44); }
/* the vermillion band + punched cord hole: the temple-slip tell, and the hole
   is real INK through the band, not a floating dot */
.binary-slips .binary-slip::before { content: ""; flex: none; align-self: stretch;
  height: 14px; margin: -12px -14px 6px; border-bottom: 2.5px solid #241335;
  border-radius: 4px 4px 0 0;
  background:
    radial-gradient(circle 3.5px at 50% 7px, #241335 3.5px, transparent 4.2px),
    linear-gradient(180deg, #d3352b, #b81f26); }
.binary-slips .binary-slip .han { font-size: 21px; font-weight: 800; line-height: 1.4; margin-top: 4px;
  text-wrap: balance; }
/* the gloss is the slip's printed foot-line: same seat on both slips */
.binary-slips .binary-slip > span { font-size: 12px; line-height: 1.4; color: rgba(36, 19, 53, 0.68);
  text-wrap: balance; margin-top: auto; padding-top: 8px; align-self: stretch;
  border-top: 1px dashed rgba(36, 19, 53, 0.3); }
/* the authored closer gets a wider plaque so neither slip has to hyphenate */
.closer-modal .binary-card { max-width: 620px; }
@media (max-width: 560px) { .binary-slips { flex-direction: column; gap: 10px; margin-bottom: -30px; }
  .binary-slips .binary-slip { --dy: 0px; }
  .binary-modal.closer-modal { padding-bottom: 24px; } }
/* a stale word tooltip has no business floating over a decision or a payoff —
   nor does the coach's note from the previous reply peeking out behind one */
body:has(.binary-modal) #wordtip, body:has(.stamps-modal) #wordtip { opacity: 0 !important; }
body:has(.binary-modal) .coachbar, body:has(.stamps-modal) .coachbar { display: none; }

/* ---------- 10.2 prom doors: the pennant hangs ABOVE the star, never on her --
   All three cycle-3 judges: the 妖怪舞会 pennant sat square on the lead's face
   ("no certified AAA build ships this"). Scale it down and hoist it into the
   lantern garland's band — SVG user units, viewBox 0 0 1000 260 — and drop the
   Mood/Crush pills (which shared that band) to just above the head instead.
   9.6vw tracks the pennant's own width-proportional scale so the pills clear
   its hem at any 16:9 size. */
.prom-dress .prom-marquee { transform-box: view-box; transform-origin: 500px 40px;
  transform: translate(0px, -12px) scale(0.55); }
@media (min-width: 701px) {
  .scene-screen.prom-night .headhud { top: max(122px, 9.6vw); }
}

/* ---------- 10.3 sprites lose their rectangle: die-cut vignette -------------
   "Visible rectangular sprite crops in three screens" — the painted stand-in
   art keeps its backdrop wash (settled canon), but the crop window now feathers
   its edges, so the wash MELTS into the scene instead of slicing it. Cutouts
   with true transparency are untouched except at the frame edge, which is
   exactly where a crop could bite them. */
.portrait-wrap:has(.sprite), .duo-slot:has(.sprite) {
  -webkit-mask-image:
    linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%),
    linear-gradient(180deg, transparent 0, #000 5%, #000 calc(100% - 12px), transparent 100%);
  -webkit-mask-composite: source-in;
  -webkit-mask-repeat: no-repeat; -webkit-mask-size: 100% 100%;
  mask-image:
    linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%),
    linear-gradient(180deg, transparent 0, #000 5%, #000 calc(100% - 12px), transparent 100%);
  mask-composite: intersect;
  mask-repeat: no-repeat; mask-size: 100% 100%; }

/* ---------- 10.4 the player's chrome is PAPER; the fiction stays night ------
   ROUND 2 (cycle 5). Cycle 4 unified the whole map overlay into night ink and
   the judges read it as "uniform dark app chips" — uniformity was the bug, not
   the cure. New split: anything that is YOURS (day calendar, phone button,
   gear, the pamphlet hint, stat chips ON THE MAP) is cream school paperwork —
   the object language that wins blind pairs — while the in-scene fiction
   (banner, MUST-USE rail, mood pills over the character) keeps its night ink.
   Two materials, one hand: same #241335 line, same hard offset drop. */
.day-banner { background: linear-gradient(178deg, #faf3df, #f0e8d1); backdrop-filter: none; -webkit-backdrop-filter: none; }
.day-banner b { color: #241335; }
.day-banner span { color: #8c2333; }
.day-banner .dot { border-color: rgba(36, 19, 53, 0.45); }
.day-banner .dot.done { border-color: #241335; }
.day-banner .dot.now { border-color: #c1272d; }
.day-banner .slot-dots .dot::before { color: rgba(36, 19, 53, 0.55); }
.day-banner .slot-dots .dot.now::before { color: #241335; }
.phone-btn { background: #f6f0e2; color: #241335; }
.phone-btn:hover { border-color: #c1272d; }
.phone-btn .badge { border-color: #241335; }
.global-gear, .bug-fab { background: #f6f0e2; color: #241335; backdrop-filter: none; -webkit-backdrop-filter: none; }
.global-gear:hover, .bug-fab:hover { color: #241335; border-color: #c1272d; }
/* the pamphlet hint is a paper NOTICE, hung plumb and fully opaque — the old
   translucent fade-in read as a rendering bug in stills (cycle-4 pair 5, all
   three judges). Opacity-only entrance, no translate, nothing to catch
   mid-slide; overflow visible so no line can ever clip against the card edge. */
.slot-hint { background: linear-gradient(178deg, #faf3df, #f1e9d3); backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 2.5px solid #241335; box-shadow: 0 4px 0 rgba(20, 10, 32, 0.5), 0 14px 30px rgba(0, 0, 0, 0.35);
  overflow: visible; animation: slotHintFade 0.18s ease both; }
@keyframes slotHintFade { from { opacity: 0; } }
.slot-hint b { color: #241335; }
.slot-hint .han { color: #8c2333; }
.map-hint { background: rgba(250, 243, 223, 0.92); color: rgba(36, 19, 53, 0.66); border-color: rgba(36, 19, 53, 0.4); }
.map-hint b { color: #241335; }
/* the 说/缘/¥ cluster: the inline pill string is the CSS-miss fallback, so the
   object voice has to outrank it. On the SCENE it stays a night plaque in the
   dark chip rail; on the MAP it joins the paper chrome. */
.shud { background: rgba(12, 8, 20, 0.82) !important; border: 2px solid #241335 !important;
  box-shadow: 0 3px 0 rgba(36, 19, 53, 0.6); }
.map-screen .shud { background: #f6f0e2 !important; border: 2px solid #241335 !important;
  box-shadow: 0 3px 0 rgba(20, 10, 32, 0.5); }
.map-screen .shud b { color: #8c2333 !important; }
.map-screen .shud em { color: #241335 !important; }
@media (prefers-reduced-motion: reduce) { .slot-hint { animation: none; } }
/* Notification cards on the MAP drop below the whole corner column (phone
   button 12+42, stat cluster 60+~26) — cycle-4 judges caught a Coco card
   squatting on the controls behind it, which reads as screenshot jank. */
body:has(.map-screen) .notifs { top: 100px; }
/* Mood + Crush wear the same plaque as the banner above them */
.hh-mood, .hh-bond { background: rgba(12, 8, 20, 0.82); backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 2px solid #241335; box-shadow: 0 3px 0 rgba(36, 19, 53, 0.6); }
/* the quota chip joins the pedagogy chip family it counts — same sticker fill,
   line and drop as the MUST-USE pills under it; the count is earned-gold */
.rail-label { background: #332352; backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 2.5px solid #241335; box-shadow: 0 3px 0 rgba(36, 19, 53, 0.75);
  color: #f3eaff; padding: 4px 13px; }
.rail-label b { color: var(--gold); font-variant-numeric: tabular-nums; margin-left: 2px; }
.rail-label .han { color: var(--gold); }

/* ---------- 10.5 the enroll lockup: layered ink-and-gold, not a bare stroke --
   "Naive stroked display title" (0/3). Each glyph becomes a die-cut sticker:
   lantern-gold gradient fill over a thick ink understroke, a hard offset drop,
   and a hand-placed tilt per glyph. The Latin line moves onto its own little
   ink plaque so the lockup reads as TWO set objects, not stroked text. */
.title-wordmark span {
  background: linear-gradient(180deg, #fff6d8 4%, #ffe9b0 32%, #ffc84a 60%, #ff9c4a 92%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1.5px #241335;
  text-shadow: none; margin: 0 1px;
  /* the thick ink line is compounded drop-shadows (same trick as the sprite
     outlines) — a wide text-stroke would need paint-order:stroke, which
     Chromium does not honor for HTML text and which eats the glyph interior */
  filter: drop-shadow(2px 0 0 #241335) drop-shadow(-2px 0 0 #241335)
    drop-shadow(0 2px 0 #241335) drop-shadow(0 -2px 0 #241335)
    drop-shadow(0 5px 0 rgba(36, 19, 53, 0.92))
    drop-shadow(0 0 26px rgba(255, 200, 74, 0.4)); }
.title-wordmark span:nth-child(odd) { transform: rotate(-2.4deg) translateY(2px); }
.title-wordmark span:nth-child(even) { transform: rotate(1.8deg) translateY(-3px); }
.title-wordmark span:last-child { transform: rotate(2.6deg) translateY(1px); }
.title-latin { display: inline-block; padding: 5px 16px 6px;
  background: rgba(12, 8, 20, 0.85); border: 2.5px solid #241335; border-radius: 999px;
  box-shadow: 0 4px 0 rgba(36, 19, 53, 0.7); transform: rotate(-1.2deg); }
/* the form stops reading web-signup: taped to the gate, registrar's red rule */
.enroll-card::before, .enroll-card::after { content: ""; position: absolute; top: -13px;
  width: 86px; height: 26px; background: rgba(255, 233, 176, 0.45);
  border: 1.5px solid rgba(36, 19, 53, 0.3); box-shadow: 0 2px 5px rgba(14, 6, 24, 0.2); }
.enroll-card::before { left: -24px; transform: rotate(-42deg); }
.enroll-card::after { right: -24px; transform: rotate(42deg); }
.enroll-head { padding-bottom: 12px; border-bottom: 3px double rgba(193, 39, 45, 0.45); }

/* ---------- 10.6 drill floor sweep (queued from the minigames fixer) -------- */
/* the sound nudge whispers — one dim centered line, the han in lantern gold */
.mg-soundhint { align-self: center; text-align: center; font-size: 12px; font-weight: 400;
  color: var(--haze); letter-spacing: 0.02em; }
.mg-soundhint .han { color: var(--gold); font-weight: 700; margin-right: 2px; }
/* captioned shout bubbles carry whole sung lines (14 hanzi + ♪) — let them run
   wide instead of stacking into a tower over the host's head */
.mg-bubble.shout.cc { max-width: min(58vw, 470px); }
/* the tested morpheme lights up inside the caption and the reveal — lantern
   gold on the dark reveal, ink-gold on the cream bubble so it still reads */
.mg-reveal .mw { color: var(--gold); font-weight: 800; }
.mg-bubble .mw { color: #b8860b; font-weight: 800; }

@media (prefers-reduced-motion: reduce) { .credits-card::after { animation: none; } }

/* ---------- classic notification variant (Lau A/B) ----------
   Settings > Notifications = Classic restores the cycle-0 glassy banner; the
   lacquer slab stays the default. game.js stamps .notif-classic on the root,
   so the choice restyles live and queued cards alike. Higher specificity than
   every .notif rule above — placement is cosmetic, the selector does the work. */
:root.notif-classic .notif { background: rgba(245, 244, 250, 0.82);
  backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 0.5px solid rgba(255, 255, 255, 0.5); border-radius: 20px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.14); }
:root.notif-classic .notif-ico { border-radius: 11px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
:root.notif-classic .notif-ico .pav, :root.notif-classic .notif-ico img,
:root.notif-classic .notif-ico svg, :root.notif-classic .notif-appicon { border-radius: 11px; }
:root.notif-classic .notif-appicon { background: #34c759; color: #fff; }
:root.notif-classic .notif-top b { color: #111; }
:root.notif-classic .notif-top span { color: #8a8a8f; }
:root.notif-classic .notif-body p { color: #1c1c1e; }
:root.notif-classic .notif-x { background: rgba(0, 0, 0, 0.08); color: #6b6b70; }
:root.notif-classic .notif-x:hover { background: rgba(0, 0, 0, 0.16); color: #111; }

/* ============================================================ round 11
   CYCLE 5: the true chop, the paper light mode, the mic gate's paper, the
   floated drill caption, and the paper toast. */

/* ---------- 11.1 Send is a TRUE CHOP (印章) ----------
   Lau could not find the "vermillion seal" in a screenshot — because it was a
   rounded red pill that said "Send". Now it is the object itself: a squared
   vermillion chop, carved inner rim, the glyph 发 in a brush face, and a
   press-down STAMP on :active. Same object wherever words get sealed: the
   scene sheet, the phone DM/group-chat composer, and the debate's 立论. */
.dlg-input .sendbtn, .chat-input .sendbtn {
  width: 54px; min-width: 54px; flex: none; padding: 0;
  display: grid; place-items: center; gap: 1px;
  /* The button's own "Send" text node rides UNDER the carved 发 as a small
     caption (Lau, 2026-07-27): the chop is the object, the word is the
     training wheel for a player who has never seen 发 before. */
  font-size: 8.5px; line-height: 1; letter-spacing: 0.1em;
  text-transform: uppercase; font-weight: 800;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.2), transparent 44%),
    linear-gradient(160deg, #de4237 0%, #c1272d 55%, #9d1a20 100%);
  border: 2.5px solid #241335; border-radius: 8px;
  color: #ffe9b0;
  box-shadow: inset 0 0 0 2px rgba(255, 227, 180, 0.4), 0 4px 0 rgba(14, 6, 24, 0.7);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.12s; }
.dlg-input .sendbtn::before, .chat-input .sendbtn::before {
  content: "发"; font-family: "Xingkai SC", "Baoli SC", "Kaiti SC", "STKaiti", var(--han);
  font-size: 23px; font-weight: 700; line-height: 1; letter-spacing: 0;
  text-transform: none;
  text-shadow: 0 1px 0 rgba(36, 19, 53, 0.5); }
.dlg-input .sendbtn:hover, .chat-input .sendbtn:hover { transform: translateY(-1px); opacity: 1;
  filter: brightness(1.08); box-shadow: inset 0 0 0 2px rgba(255, 227, 180, 0.4), 0 5px 0 rgba(14, 6, 24, 0.7); }
/* the stamp: presses flat onto the sheet */
.dlg-input .sendbtn:active, .chat-input .sendbtn:active { transform: translateY(3px) scale(0.97);
  filter: brightness(0.96);
  box-shadow: inset 0 0 0 2px rgba(255, 227, 180, 0.4), 0 1px 0 rgba(14, 6, 24, 0.7); }
/* the DM composer's chop matches its 40px row (34px in the mini bar) */
.chat-input .sendbtn { width: 48px; min-width: 48px; font-size: 8px; }
.chat-input .sendbtn::before { font-size: 21px; }
/* the mini bar has no room for the caption — the chop stands alone there */
.chat-input.mini .sendbtn { width: 40px; min-width: 40px; font-size: 0; }
.chat-input.mini .sendbtn::before { font-size: 20px; }
/* the debate's 立论 keeps its own carved glyphs — a two-character seal */
#debateGo.sendbtn {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.2), transparent 44%),
    linear-gradient(160deg, #de4237 0%, #c1272d 55%, #9d1a20 100%);
  border: 2.5px solid #241335; border-radius: 8px; color: #ffe9b0;
  font-family: "Xingkai SC", "Baoli SC", "Kaiti SC", "STKaiti", var(--han);
  font-size: 19px; font-weight: 700; padding: 8px 16px;
  text-shadow: 0 1px 0 rgba(36, 19, 53, 0.5);
  box-shadow: inset 0 0 0 2px rgba(255, 227, 180, 0.4), 0 4px 0 rgba(14, 6, 24, 0.7);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.12s; }
#debateGo.sendbtn:hover { transform: translateY(-1px); filter: brightness(1.08); }
#debateGo.sendbtn:active { transform: translateY(3px) scale(0.97);
  box-shadow: inset 0 0 0 2px rgba(255, 227, 180, 0.4), 0 1px 0 rgba(14, 6, 24, 0.7); }
/* narrow screens: the chop stays square — the field takes the rest of the row */
@media (max-width: 700px) {
  .dlg-input .sendbtn { flex: none; width: 54px; }
}

/* ---------- 11.2 the mic gate is real school paperwork ----------
   game.js ships the card with inline cream so it holds without CSS; this is
   the actual object: laid-paper texture, tape at the corners, a hand-marker
   register, and the CTA as the same vermillion seal slab as Enroll. The
   !important flags are the CSS voice outranking the inline fallback. */
.mic-gate-card {
  background:
    repeating-linear-gradient(0deg, rgba(36, 19, 53, 0.045) 0 1px, transparent 1px 24px),
    radial-gradient(ellipse 130% 90% at 50% -12%, #f8efd9 0%, #f2e4c2 58%, #ecdcb4 100%) !important;
  border-radius: 12px !important;
  box-shadow: 0 9px 0 rgba(14, 6, 24, 0.55), 0 30px 70px rgba(0, 0, 0, 0.5) !important;
  position: relative; transform: rotate(-0.6deg); }
.mic-gate-card::before, .mic-gate-card::after { content: ""; position: absolute; top: -13px;
  width: 82px; height: 25px; background: rgba(255, 233, 176, 0.5);
  border: 1.5px solid rgba(36, 19, 53, 0.3); box-shadow: 0 2px 5px rgba(14, 6, 24, 0.2); }
.mic-gate-card::before { left: -22px; transform: rotate(-42deg); }
.mic-gate-card::after { right: -22px; transform: rotate(42deg); }
.mic-gate-card h2 { font-family: var(--hand); }
.mic-gate-card div[style*="uppercase"] { font-family: var(--hand); color: #8c2333; opacity: 1 !important; }
.mic-gate-card ol li::marker { color: #c1272d; font-weight: 800; }
#micGateGo.bigbtn { background: linear-gradient(160deg, #e8483f, #b81f26); color: #ffe9b0;
  border: 3px solid #241335; border-radius: 12px; font-family: var(--hand); font-weight: 800;
  font-size: 16.5px; padding: 13px; text-shadow: 0 1px 0 rgba(36, 19, 53, 0.55);
  box-shadow: 0 5px 0 rgba(14, 6, 24, 0.6); transition: transform 0.08s, box-shadow 0.08s, filter 0.12s; }
#micGateGo.bigbtn:hover { filter: brightness(1.07); }
#micGateGo.bigbtn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(14, 6, 24, 0.6); }

/* ---------- 11.3 the floated drill caption ----------
   Below 720px the host cutout leaves the stage and minigames.js re-anchors the
   caption bubble into flow just above the answer court (structural inline
   position:relative). The look lives here: centered caption card, no tail
   (it would point at a host who isn't on stage), and the width cap absorbed
   from the JS stopgap. While hidden BETWEEN captions it keeps its box, so the
   court doesn't jump each time a line lands. */
.mg-bubble.float { max-width: min(86vw, 470px); margin: 0 auto 6px; transform-origin: 50% 100%; }
.mg-bubble.float::after { display: none; }
.mg-bubble.float[hidden] { display: block; visibility: hidden; }

/* ---------- 11.4 the toast is a paper chit ----------
   The last dark-glass pill in the overlay family ("a toast" was on the judges'
   uniform-chip list). Announcements are notes the school hands you: cream,
   ink line, hard drop — loud enough on night scenes, native on the map. */
.toast { background: linear-gradient(178deg, #faf3df, #f0e8d1);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 2.5px solid #241335; color: #241335;
  box-shadow: 0 4px 0 rgba(20, 10, 32, 0.5), 0 12px 28px rgba(0, 0, 0, 0.3); }
.toast b, .toast .han { color: #241335; }
.toast.chip { border-color: #241335; }
.toast.chip::before { color: #b8860b; }

/* ---------- 11.5 LIGHT MODE: the paper world ----------
   Everything the player HOLDS re-materials as cream stock with ink outlines
   and hard offset shadows — the enroll-form language, which wins its blind
   pairs. What stays pinned to night is the FICTION: scene pills over the
   paintings, the drills' stage, the binary plaque, graduation. The phone
   flips to paper — it's the player's own object, not scenery. */

:root[data-theme="light"] .dlg-input .micbtn {
  background: #fdfaf1; border: 2px solid #241335; color: #241335;
  box-shadow: 0 2px 0 rgba(20, 10, 32, 0.35); }
:root[data-theme="light"] .dlg-input .micbtn:hover {
  background: #fff; color: #241335; border-color: #241335; }
:root[data-theme="light"] .dlg-input .micbtn.listening { background: #241335; color: #f6f0e2; border-color: #241335; }
/* (Hint and conversation mode wear the .tool paper pill above now) */
/* your line: a white note on the cream sheet */
:root[data-theme="light"] .line.player { background: #fff; border-color: #241335; color: #241335;
  box-shadow: 0 2px 0 rgba(20, 10, 32, 0.3); }
:root[data-theme="light"] .line.player .line-en { color: rgba(36, 19, 53, 0.62); }
/* suggestions pop white against the cream */
:root[data-theme="light"] .suggestion { background: #fffdf6; }
:root[data-theme="light"] .suggestion:hover { background: #fff; }
/* karaoke's "already sung" tint needs more ink on cream */
:root[data-theme="light"] .w.kara-done { color: #c22d75; }

/* the phone flips to a cream paper slab — the player's own object */
:root[data-theme="light"] .phone:not(.settings-sheet) {
  --phone-a: #faf5e8; --phone-b: #f0e7d0;
  --glass-rgb: 250, 245, 232; --edge-rgb: 36, 19, 53;
  --hairline: rgba(36, 19, 53, 0.18);
  --ink-60: rgba(250, 245, 232, 0.6); --ink-84: rgba(250, 245, 232, 0.84);
  --paper: #241335; --haze: #6b5e6f; --ink: #241335; --dim: #6b5e6f; --title: #8c2333;
  --card: #faf5e8; --card-2: #f0e7d0; --emph-fg: #faf5e8;
  --panel: #fdfaf1; --panel2: #f0e7d0; --line: rgba(36, 19, 53, 0.35);
  --field-bg: #ffffff; --field-fg: #241335;
  --chip-bg: rgba(106, 63, 160, 0.1); --chip-fg: #4a2d80; --chip-bd: rgba(106, 63, 160, 0.4);
  --chip-no-bg: rgba(200, 40, 32, 0.08); --chip-no-fg: #9a1b12; --chip-no-bd: rgba(200, 40, 32, 0.35);
  color: var(--ink);
  border: 3px solid #241335;
  box-shadow: 0 8px 0 rgba(20, 10, 32, 0.3), 0 32px 80px rgba(20, 10, 32, 0.28); }
:root[data-theme="light"] .phone:not(.settings-sheet) .ptab { color: rgba(36, 19, 53, 0.6); }
:root[data-theme="light"] .phone:not(.settings-sheet) .ptab:hover { color: #241335; }
:root[data-theme="light"] .phone:not(.settings-sheet) .ptab.sel { color: #faf5e8; background: #241335; }
:root[data-theme="light"] .phone:not(.settings-sheet) .im-msg.them .im-bubble {
  background: #fff; border: 1.5px solid rgba(36, 19, 53, 0.22); color: #1c1430; }
:root[data-theme="light"] .phone:not(.settings-sheet) .im-back { color: #8c2333; }
:root[data-theme="light"] .phone:not(.settings-sheet) .im-groupav span { border-color: #faf5e8; }

/* notifications (lacquer variant only — .notif-classic is Lau's separate A/B):
   a cream card from the same paper drawer */
:root[data-theme="light"]:not(.notif-classic) .notif {
  background: linear-gradient(178deg, #faf3df, #f0e8d1);
  border: 2.5px solid #241335; border-radius: 16px;
  box-shadow: 0 4px 0 rgba(20, 10, 32, 0.45), 0 16px 40px rgba(20, 10, 32, 0.25); }
:root[data-theme="light"]:not(.notif-classic) .notif-ico { box-shadow: 0 0 0 2.5px #241335; }
:root[data-theme="light"]:not(.notif-classic) .notif-top b { color: #241335; }
:root[data-theme="light"]:not(.notif-classic) .notif-top span { color: #8c2333; }
:root[data-theme="light"]:not(.notif-classic) .notif-body p { color: #241335; }
:root[data-theme="light"]:not(.notif-classic) .notif-x { background: rgba(36, 19, 53, 0.1); color: #4a4058; }
:root[data-theme="light"]:not(.notif-classic) .notif-x:hover { background: rgba(36, 19, 53, 0.2); color: #241335; }

/* the map popover + its activity cards: opaque paper, never frosted glass */
:root[data-theme="light"] .mappop { background: #faf5e6;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 2.5px solid #241335;
  box-shadow: 0 6px 0 rgba(20, 10, 32, 0.35), 0 22px 50px rgba(20, 10, 32, 0.3); }
:root[data-theme="light"] .mappop:not(.above)::after { border-bottom-color: #241335; }
:root[data-theme="light"] .mappop.above::after { border-top-color: #241335; }
:root[data-theme="light"] .scene-card { background: #fffdf4; border-color: rgba(36, 19, 53, 0.35); }
:root[data-theme="light"] .scene-card:hover { border-color: #241335; }
:root[data-theme="light"] .scene-card.promposal { background: #fff0f7; border-color: var(--magenta); }
:root[data-theme="light"] .sc-tag { background: rgba(13, 106, 87, 0.12); color: #0d6a57; }
:root[data-theme="light"] .sc-tag.free { background: rgba(36, 19, 53, 0.08); color: rgba(36, 19, 53, 0.6); }
:root[data-theme="light"] .sc-tag.prom { background: rgba(160, 35, 97, 0.12); color: #a02361; }
:root[data-theme="light"] .filterbar { background: #faf5e6; border: 2px solid #241335;
  box-shadow: 0 3px 0 rgba(20, 10, 32, 0.35); }

/* small print that must hold its contrast on cream */
:root[data-theme="light"] #wordtip { border-color: #241335; box-shadow: 0 4px 0 rgba(20, 10, 32, 0.3),
  0 10px 30px rgba(20, 10, 32, 0.22); }
:root[data-theme="light"] .warn { color: #a8231a; }
:root[data-theme="light"] .err { color: #a8231a; }
:root[data-theme="light"] .misscount { color: #a8231a; }

/* ============================================================ round 12
   CYCLE 6: the choice moves INTO the chat (Lau's headline ruling), and the
   dialogue pair's chrome — the pair-2 losses — gets its material pass. One
   grammar throughout: night-lacquer plaques for the fiction's chrome, cream
   die-cut paper for anything the player's hand touches. */

/* ---------- 12.1 the in-chat choice: the scene holds its breath ----------
   The closer's fortune-slips (and the walk-away pair) render inside the
   dialogue sheet as .line.sys.choice-line > .chat-choice. The slips keep the
   modal-era paper (10.1); the block gets a recessed tray, a wax-tab kicker,
   and REAL bottom clearance — the modal's -42px "break the plaque's edge"
   margin has no business inside a scrolling log (it ran the nudge line under
   the left slip). */
.line.sys.choice-line { display: block; align-self: stretch; max-width: 100%; }
.chat-choice { position: relative; display: block; margin: 14px 2px 4px;
  padding: 18px 14px 14px; border-radius: 12px;
  background: rgba(var(--edge-rgb), 0.05);
  border: 1.5px solid rgba(var(--edge-rgb), 0.16);
  /* keep the slips' tilt + hard drop inside this block's own paint order so a
     later line can never interleave with them */
  isolation: isolate; }
/* while a slip is still clickable, the tray breathes — a slow gold swell, the
   quietest possible "the scene is waiting on your hand" */
.chat-choice:has(.binary-slip:not(:disabled)) { border-color: rgba(255, 200, 74, 0.45);
  animation: choiceBreath 2.6s ease-in-out infinite; }
@keyframes choiceBreath {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 74, 0); }
  50% { box-shadow: 0 0 0 6px rgba(255, 200, 74, 0.10); } }
/* …and the input row exhales: dimmed, not removed — the painting stays lit,
   the typing hand waits (Lau: dim the input row, not the painting) */
.dlg:has(.chat-choice .binary-slip:not(:disabled)) .dlg-input,
.dlg:has(.chat-choice .binary-slip:not(:disabled)) .dlg-tools {
  opacity: 0.35; filter: saturate(0.5); transition: opacity 0.25s, filter 0.25s; }
.dlg .dlg-input, .dlg .dlg-tools { transition: opacity 0.25s, filter 0.25s; }
/* the log gives the moment a full stage: while a slip waits, the sheet opens
   tall enough that the kicker, the setup line and both slips are ALL on screen
   (at 190px the wax tab and the question scrolled out of view) */
.dlg .dlg-log { transition: max-height 0.3s ease; }
.dlg:has(.chat-choice .binary-slip:not(:disabled)) .dlg-log { max-height: min(340px, 42vh); max-height: min(340px, 42dvh); }
/* answered: the tray goes quiet and stays in the transcript as a record */
.chat-choice:not(:has(.binary-slip:not(:disabled))) { border-color: rgba(var(--edge-rgb), 0.10);
  background: rgba(var(--edge-rgb), 0.03); }

/* the kicker is the wax tab off the old binary card, pinned to the tray's lip:
   gold for a DECISION, kraft stock for the quieter LEAVE EARLY? question */
.choice-kicker { position: absolute; top: -12px; left: 12px; z-index: 2;
  transform: rotate(-2.2deg);
  background: var(--gold); color: #241335;
  font-family: var(--hand); font-weight: 800; font-size: 11.5px; letter-spacing: 0.12em;
  padding: 3px 12px; border: 2.5px solid #241335; border-radius: 999px;
  box-shadow: 0 3px 0 rgba(36, 19, 53, 0.75); white-space: nowrap; }
.leave-choice .choice-kicker { background: #e2d7bd; color: rgba(36, 19, 53, 0.85); }

/* the setup line: body voice, centered, hanzi in the teaching accent —
   gold on the lacquer, registrar red once the sheet flips to paper */
.chat-choice { --choice-accent: var(--gold); }
:root[data-theme="light"] .dlg .chat-choice { --choice-accent: #8c2333; }
.chat-choice .binary-prompt { margin: 0 auto 12px; max-width: 52ch;
  text-align: center; text-wrap: balance;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 14.5px; font-weight: 500; line-height: 1.55; color: var(--paper); }
.chat-choice .binary-prompt b, .chat-choice .binary-prompt .han { color: var(--choice-accent); }

/* slips in the flow: opposing tilts (two slips offered by two hands), a hair
   smaller than the modal scale, and positive margins — clearance, not overlap */
.chat-choice .binary-slips { margin: 6px 4px 10px; gap: 14px; }
.chat-choice .binary-slips .binary-slip { --tilt: -1.2deg; --dy: 0px; padding: 10px 12px 12px; }
.chat-choice .binary-slips .binary-slip:nth-of-type(even) { --tilt: 1.4deg; --dy: 3px; }
.chat-choice .binary-slips .binary-slip .han { font-size: 19px; }
@media (max-width: 560px) { .chat-choice .binary-slips { margin-bottom: 8px; } }

/* the record of the choice: the picked slip is SEALED (a vermillion 定 chop
   slammed over its corner), the other one folds away dim — the log reads as
   something that happened, not two dead buttons */
.binary-slips .binary-slip:disabled { cursor: default; }
.binary-slips .binary-slip.picked { position: relative; border-color: #b8860b;
  transform: rotate(calc(var(--tilt) * 0.4)) translateY(var(--dy, 0px));
  box-shadow: 0 3px 0 rgba(14, 6, 24, 0.7), 0 10px 16px rgba(0, 0, 0, 0.25); }
.binary-slips .binary-slip.picked::after { content: "定"; position: absolute;
  right: 9px; top: 50%; width: 38px; height: 38px;
  display: grid; place-items: center; pointer-events: none;
  border: 3px solid #c1272d; border-radius: 50%; color: #c1272d;
  font-family: var(--han); font-weight: 900; font-size: 18px; line-height: 1;
  transform: translateY(-52%) rotate(12deg); mix-blend-mode: multiply;
  animation: sealSlam 0.35s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.binary-slips .binary-slip.unpicked { opacity: 0.5; filter: saturate(0.55);
  transform: rotate(var(--tilt)) translateY(4px) scale(0.965);
  box-shadow: 0 1px 0 rgba(14, 6, 24, 0.5);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%); }

/* ---------- 12.2 the hesitation beat ----------
   The nudge is the CHARACTER speaking: their own colour on the line's edge and
   a small head-shake as it lands. The one-time sys note under it is the
   handrail — a quiet dashed chit naming what's being waited on. */
.line.char.nudge { position: relative; z-index: 1;
  padding: 5px 12px 6px 12px; border-radius: 4px 12px 12px 4px;
  border-left: 3px solid var(--ch-color, var(--magenta));
  background: color-mix(in srgb, var(--ch-color, #ff4fa3) 9%, transparent);
  animation: lineIn 0.26s ease both, nudgeShake 0.5s ease 0.12s; }
@keyframes nudgeShake {
  0%, 100% { translate: 0 0; }
  25% { translate: -4px 0; } 50% { translate: 3px 0; } 75% { translate: -2px 0; } }
.line.sys .nudge-note { display: inline-block; font-size: 12px; color: var(--haze);
  border: 1.5px dashed rgba(var(--edge-rgb), 0.3); border-radius: 999px;
  padding: 3px 12px; line-height: 1.5; }
.line.sys .nudge-note .han { color: var(--paper); }
/* Leave, while a choice is pending: HELD, not locked — the character's own
   colour holds the door (title text explains; .locked stays the dim ghost) */
.leavebtn.held, .leavebtn.held:hover { opacity: 1; color: #f2efe9;
  background: rgba(255, 255, 255, 0.05); transform: none;
  border: 1.5px dashed color-mix(in srgb, var(--ch-color, #ff4fa3) 75%, #fff); }

/* ---------- 12.3 pair-2 chrome: one plaque system, a worlded input band ---- */
/* the name tag clipped the stage direction on every screen except prom night
   (the tag runs ~19px into the sheet; the sheet padded 16px) — reserve the
   tag's landing strip once, for every screen */
.dlg { padding-top: 26px; }
/* the top strip speaks with ONE voice per material: every night plaque shares
   the same fill, the same 2px ink line, the same 3px drop */
.scene-banner, .hh-mood, .hh-bond { background: rgba(12, 8, 20, 0.84);
  border: 2px solid #241335; box-shadow: 0 3px 0 rgba(36, 19, 53, 0.6); }
/* the input band joins the object family: squared lacquer slabs, thicker ink,
   no more web-pill roundness */
.dlg-input #say { border-radius: 12px; }
.dlg-input .micbtn,
:root[data-theme="light"] .dlg-input .micbtn {
  border-radius: 12px; border-width: 2.5px; }
/* utility toggles (Pinyin / EN / Hint / 0.7x / Gift / conversation mode) step
   down a size — they are preferences, not actions, and they were shouting at
   the send row's volume */
.dlg-tools .tool { padding: 2px 9px; font-size: 10.5px; border-width: 1.5px;
  box-shadow: 0 2px 0 rgba(14, 6, 24, 0.45); }

/* the MUST-USE rail becomes the player's own PAPER: die-cut phrase tags in the
   enroll-form material (the "purple web pills" read that lost pair 2 are gone).
   Landed = a gold slip; bonus = dashed gold on cream; due = registrar red. */
.rail-label { background: linear-gradient(178deg, #efe6cd, #e2d7bd);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 2px solid #241335; box-shadow: 0 3px 0 rgba(20, 10, 32, 0.5);
  color: #241335; }
.rail-label b, .rail-label .han { color: #8c2333; }
.chip-stack .chip { --tilt: -1deg;
  background: linear-gradient(178deg, #fdf6e0 0%, #f6f0e2 70%, #efe5cd 100%);
  color: #241335; border: 2px solid #241335; border-radius: 7px;
  padding: 5px 13px; box-shadow: 0 3px 0 rgba(20, 10, 32, 0.5);
  transform: rotate(var(--tilt)); }
.chip-stack #chips .chip:nth-child(even) { --tilt: 0.9deg; }
.chip-stack .chip:hover { border-color: #c1272d; transform: rotate(var(--tilt)) translateX(-3px); }
.chip-stack .chip.hit { background: linear-gradient(178deg, #ffe9b0, #ffc84a);
  border-color: #241335; color: #241335; box-shadow: 0 3px 0 rgba(20, 10, 32, 0.5); }
.chip-stack .chip.bonus { background: linear-gradient(178deg, #fdf6e0, #f6f0e2);
  border: 2px dashed #b8860b; color: #8c5a2a; }
.chip-stack .chip.pop { animation: chippop 0.6s cubic-bezier(0.2, 2.2, 0.4, 1); }
@media (max-width: 700px) { .chip-stack .chip { padding: 4px 10px; } }

/* ---------- 12.4 unfinished business wears registrar red ----------
   Due chips (错题本 / spaced review) on the scene rail: red-edged paper with a
   red dot — homework, not a fresh handout. Distinct from .bonus's dashed gold. */
.chip-stack .chip.due { border-color: #c1272d;
  background: linear-gradient(178deg, #fdf0e6 0%, #f8e6d8 100%); }
.chip-stack .chip.due:hover { border-color: #a8231a; }
.chip .due-dot { color: #c1272d; font-size: 10px; vertical-align: 2px; margin-right: 1px; }
/* the 记进错题本 line on wrap + payout cards: the registrar's red-pen note in
   the margin — a record, not fail theater (rides the cream stamps-card) */
.wrongline { color: #8c2333; border-left: 3px solid #c1272d;
  background: rgba(193, 39, 45, 0.07); padding: 7px 11px;
  border-radius: 0 9px 9px 0; line-height: 1.55; }
.wrongline .han { color: #a8231a; }
.wrongline .dim { color: rgba(140, 35, 51, 0.75); }
/* the caption toll's line on a payout card (captionToll in game.js): the player
   pulled the words up in writing, so the card names which skill actually banked
   the points. It is a FACT ABOUT THE RUN, never a verdict — so it takes a quiet
   ink spine and never the registrar's red one, and it carries no accent hue at
   all. It sits at near-full ink because the card's own --dim measures 3.80:1 on
   this cream, under the 4.5:1 body floor (prom/dev/cc-contrast.mjs). */
.tollnote { color: rgba(36, 19, 53, 0.86); border-left: 3px solid rgba(36, 19, 53, 0.32);
  padding: 6px 11px; border-radius: 0 9px 9px 0; font-size: 13px; line-height: 1.55;
  margin: 0 0 10px; }
.tollnote .han { color: #241335; font-weight: 700; }
/* the provenance line on the chip tap-card (dark plaque): same red spine,
   lifted text so it reads on lacquer */
.chipcard .chipcard-due { margin: -4px 0 14px; padding: 6px 11px;
  border-left: 3px solid #c1272d; border-radius: 0 9px 9px 0;
  background: rgba(193, 39, 45, 0.14); color: #e8c9c4; line-height: 1.5; }
.chipcard .chipcard-due .han { color: #ff9c94; }
.chipcard .chipcard-due .dim { color: rgba(232, 201, 196, 0.7); }

/* ---------- 12.5 sound badge: a small in-world door sign ----------
   开声音 on class/drill cards was raw inline text in .sc-info — now a cream
   pill in the card grammar, the speaker + hanzi in the registrar's red */
.sc-info .soundreq { display: block; width: fit-content; margin-top: 4px;
  padding: 3px 10px 3.5px 8px; border-radius: 9px;
  background: linear-gradient(178deg, #faf3df, #f0e8d1);
  border: 1.5px solid #241335; box-shadow: 0 2px 0 rgba(20, 10, 32, 0.4);
  color: rgba(36, 19, 53, 0.72); font-size: 10.5px; font-weight: 700;
  font-style: normal; line-height: 1.5; }
.sc-info .soundreq svg { width: 12px; height: 12px; color: #8c2333;
  vertical-align: -2px; margin-right: 3px; }
.sc-info .soundreq .han { color: #8c2333; font-size: 11.5px; font-weight: 800;
  white-space: nowrap; margin-right: 2px; }

/* ---------- 12.6 the mic gate's quiet door ----------
   The typing path is the form's fine print under a cut rule — present, calm,
   never competing with the vermillion CTA. (!important outranks the inline
   fallback game.js ships.) */
.mic-gate-skip { opacity: 1 !important; text-decoration: none !important;
  color: rgba(36, 19, 53, 0.6) !important; font-size: 12.5px !important;
  margin-top: 14px !important; padding: 8px 0 2px !important;
  border-top: 1px dashed rgba(36, 19, 53, 0.35) !important; border-radius: 0; }
.mic-gate-skip:hover { color: #241335 !important;
  text-decoration: underline dotted !important; text-underline-offset: 3px; }

/* ---------- 12.7 stamps-card additions ----------
   说到做到: the freeform promise row is a gold-spined ledger line — a thing
   now owed, sitting apart from the plain result lines */
.stamps-card .commitline { border-left: 3px solid #b8860b;
  background: rgba(184, 134, 11, 0.09); padding: 8px 12px;
  border-radius: 0 10px 10px 0; color: rgba(36, 19, 53, 0.8); }
.stamps-card .commitline .han { color: #8c5a2a; }
.stamps-card .commitline b { color: #241335; }
/* 下次再聊 Good talk: the WARM exit reads warm — brown-gold ink and its own
   再聊 seal, unmistakably not the grey Almost */
.stamps-card h3.soft.warm { color: #8c5a2a; }
.stamps-card:has(> h3.soft.warm)::after { content: "再聊"; color: #b8860b; }

/* ---------- 12.8 字幕 armed is GOLD ----------
   The captions toggle pressed state (cycle-5 finding, confirmed live): a gold
   fill + pressed seat on .on / aria-pressed, wherever the drill shows it */
.tool.mg-cc.on, .tool.mg-cc[aria-pressed="true"] {
  background: var(--gold); border-color: #241335; color: #241335; font-weight: 800;
  box-shadow: inset 0 0 0 1.5px rgba(36, 19, 53, 0.28), 0 1px 0 rgba(14, 6, 24, 0.55);
  transform: translateY(1px); }

/* ---------- 12.9 tool row at phone width ----------
   The row (buttons + tools) overran 375px and clipped content (cycle-5 judge
   p14). Let it wrap, centered, and step the strip down one size below 480px. */
.haggle-row { flex-wrap: wrap; justify-content: center; max-width: 96vw; }
@media (max-width: 480px) {
  .haggle-row { --row-h: 40px; gap: 7px; padding: 10px 4px; }
  .haggle-row .tool { padding: 0 12px; font-size: 12px; }
}

/* round 12 respects reduced motion like everything above it */
@media (prefers-reduced-motion: reduce) {
  .chat-choice:has(.binary-slip:not(:disabled)),
  .binary-slips .binary-slip.picked::after,
  .line.char.nudge { animation: none; }
  .line.char.nudge { animation: lineIn 0.26s ease both; }
}

/* ============================================================ round 13
   THE FULL LIGHT PORT (Lau: "do full port light mode then" — no
   half-conversion). Cycle 5 flipped the reading surfaces (sheet, phone,
   enroll) to cream and left the rest of the chrome pinned night, which is
   exactly the mismatch in shots/cycle5/16-scene-light.png: a paper sheet
   under night-ink pills. This round finishes the port: EVERY piece of object
   chrome re-materials as the enroll form's cream stock + #241335 ink line +
   hard offset drop when the theme is light. What does NOT convert is the
   FICTION — the paintings and their time-of-day washes, the drills' painted
   stages, the ceremonial lacquer plaques (decision closer, events, golden
   hours, scene setup) and the night scrims that light them. Dark theme is
   untouched: everything here rides :root[data-theme="light"]. */

/* ---------- 13.1 scene top chrome: paper signboards over the painting ----
   The same trick the map pulled in 10.4 — cream boards read as diegetic
   signage on art (the signboards WIN blind pairs), so the banner, the mood
   and bond pills and the stat chips all join the paper drawer in light. */
:root[data-theme="light"] .scene-banner {
  background: linear-gradient(178deg, #faf3df, #f0e8d1);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 2px solid #241335; box-shadow: 0 3px 0 rgba(20, 10, 32, 0.5);
  color: #241335; }
:root[data-theme="light"] .scene-banner b,
:root[data-theme="light"] .scene-banner span { color: #241335; }
:root[data-theme="light"] .scene-banner .han { color: #8c2333; }
/* prom night's banner: still the cream board, lettered in festival gold-ink */
:root[data-theme="light"] .scene-banner.prom { border-color: #b8860b; }
:root[data-theme="light"] .scene-banner.prom b, :root[data-theme="light"] .scene-banner.prom span,
:root[data-theme="light"] .scene-banner.prom .han { color: #a06514; }
/* Leave: an inked button ON the board; earned stays lantern gold; held keeps
   the character's dashed hand on the door (re-asserted — the paper base rule
   outranks the state classes by specificity, so each state speaks again) */
:root[data-theme="light"] .leavebtn { color: #241335; background: rgba(36, 19, 53, 0.06);
  border: 1.5px solid rgba(36, 19, 53, 0.5); }
:root[data-theme="light"] .leavebtn:hover { color: #241335; background: rgba(36, 19, 53, 0.13); }
:root[data-theme="light"] .leavebtn.locked, :root[data-theme="light"] .leavebtn.locked:hover {
  color: rgba(36, 19, 53, 0.4); background: rgba(36, 19, 53, 0.04); }
:root[data-theme="light"] .leavebtn.ready, :root[data-theme="light"] .leavebtn.ready:hover {
  color: #241335; background: var(--gold); border: 2px solid #241335; }
:root[data-theme="light"] .leavebtn.held, :root[data-theme="light"] .leavebtn.held:hover {
  color: #241335; background: rgba(36, 19, 53, 0.04);
  border: 1.5px dashed color-mix(in srgb, var(--ch-color, #c22d75) 70%, #241335); }
/* Mood + Crush: the same cream plaque, ink lettering; the hearts keep the
   character's own colour (saturated accents carry on cream) */
:root[data-theme="light"] .hh-mood, :root[data-theme="light"] .hh-bond {
  background: linear-gradient(178deg, #faf3df, #f0e8d1);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border: 2px solid #241335; box-shadow: 0 3px 0 rgba(20, 10, 32, 0.5); }
:root[data-theme="light"] .hh-k, :root[data-theme="light"] .hh-mood b,
:root[data-theme="light"] .hh-rel, :root[data-theme="light"] .hh-bond em { color: #241335; }
:root[data-theme="light"] .hh-bond.bad .hh-rel { color: #a8231a; }
:root[data-theme="light"] .hh-bond.maxed .hh-rel { color: #a06514; }
/* the 说/缘/¥ cluster on the SCENE joins the paper voice (the map's already
   did in 10.4); !important outranks the inline pill fallback, same as there */
:root[data-theme="light"] .shud { background: #f6f0e2 !important; border: 2px solid #241335 !important;
  box-shadow: 0 3px 0 rgba(20, 10, 32, 0.5); }
:root[data-theme="light"] .shud b { color: #8c2333 !important; }
:root[data-theme="light"] .shud em { color: #241335 !important; }

/* ---------- 13.2 map leftovers: the last two night pills on the town ---- */
:root[data-theme="light"] .fest-chip { background: linear-gradient(178deg, #fdf0e6, #f8e6d8);
  border: 2px solid #a8231a; color: #a8231a; box-shadow: 0 3px 0 rgba(20, 10, 32, 0.4); }
:root[data-theme="light"] .mapnode.shut::after { background: #faf5e6; color: rgba(36, 19, 53, 0.75);
  border: 1.5px solid #241335; box-shadow: 0 2px 0 rgba(20, 10, 32, 0.35); }

/* ---------- 13.3 drills: paper props on the painted stage ----------
   The stage painting and its scrim are the fiction and stay; the props the
   player grabs — answer boards, tone tags, the head plaque — re-material as
   cream. Rush's wooden trays are already paper objects and keep their rim
   (every board rule below excludes .tray). */
:root[data-theme="light"] .minigame > .mg-head {
  background: linear-gradient(178deg, #faf3df, #f0e8d1);
  border: 2px solid #241335; border-radius: 10px; padding: 5px 14px;
  box-shadow: 0 3px 0 rgba(20, 10, 32, 0.5); }
:root[data-theme="light"] .minigame .mg-head b.han { color: #241335; }
:root[data-theme="light"] .minigame .mg-head > span { color: rgba(36, 19, 53, 0.62); }
:root[data-theme="light"] .minigame .mg-score { color: rgba(36, 19, 53, 0.62); }
:root[data-theme="light"] .minigame .mg-score b { color: #8c2333; }
/* the head plaque grew a border + padding — drop the clock under its new hem */
:root[data-theme="light"] .minigame > .mg-timerwrap { top: 64px; }
:root[data-theme="light"] .mg-board:not(.tray) {
  background: linear-gradient(178deg, #fdf6e0 0%, #f6f0e2 70%, #efe5cd 100%);
  border: 3px solid #241335; color: #241335;
  box-shadow: 0 4px 0 rgba(20, 10, 32, 0.55); }
:root[data-theme="light"] .mg-board:not(.tray):hover { background: #fffaf0; border-color: #b8860b;
  box-shadow: 0 7px 0 rgba(20, 10, 32, 0.55); }
:root[data-theme="light"] .mg-board:not(.tray).right { background: #ffe9b0; border-color: #b8860b;
  color: #241335; box-shadow: 0 4px 0 rgba(20, 10, 32, 0.55), 0 0 22px rgba(255, 200, 74, 0.5); }
:root[data-theme="light"] .mg-board:not(.tray).wrong { background: #f0d8d0; border-color: #a8231a;
  color: #6b1610; box-shadow: 0 4px 0 rgba(20, 10, 32, 0.55); }
:root[data-theme="light"] .mg-tone { background: linear-gradient(178deg, #fdf6e0, #efe5cd);
  border: 2.5px solid #241335; color: #241335; box-shadow: 0 3px 0 rgba(20, 10, 32, 0.5); }
:root[data-theme="light"] .mg-tone:hover { background: #fffaf0; border-color: #b8860b; color: #8c5a2a; }
:root[data-theme="light"] .mg-tone.right { border-color: #b8860b; color: #8c5a2a;
  box-shadow: 0 3px 0 rgba(20, 10, 32, 0.5), 0 0 18px rgba(255, 200, 74, 0.55); }
:root[data-theme="light"] .mg-tone.wrong { border-color: #a8231a; color: #a8231a; background: #f0d8d0; }
/* the drill's small controls (mic, replay, captions) are paper chits too;
   the armed 字幕 keeps its gold press (12.8), re-asserted over the paper base */
:root[data-theme="light"] .minigame .micbtn, :root[data-theme="light"] .minigame .tool {
  background: #fdfaf1; border: 2px solid #241335; color: #241335;
  box-shadow: 0 2px 0 rgba(20, 10, 32, 0.4); }
:root[data-theme="light"] .minigame .tool.mg-cc.on,
:root[data-theme="light"] .minigame .tool.mg-cc[aria-pressed="true"] {
  background: var(--gold); border-color: #241335; color: #241335; }

/* ---------- 13.4 graduation: the certificate is CREAM STOCK in light ----
   The night ceremony stays the dark default; in light the same certificate
   prints on the school's paper — ink rules, deep-gold lettering, the red 毕业
   chop unchanged. !important outranks the inlined dark-stage fallback. */
:root[data-theme="light"] .credits-screen {
  background: linear-gradient(180deg, #efe6cd 0%, #f6efdd 55%, #e9dfc6 100%) !important; }
:root[data-theme="light"] .credits-card {
  --paper: #241335; --haze: rgba(36, 19, 53, 0.6); --dim: rgba(36, 19, 53, 0.55);
  --title: #8c2333; --edge-rgb: 36, 19, 53; --hairline: rgba(36, 19, 53, 0.22);
  color: #241335 !important;
  background:
    repeating-linear-gradient(0deg, rgba(36, 19, 53, 0.03) 0 1px, transparent 1px 26px),
    linear-gradient(180deg, #faf4e3 0%, #f1e9d5 100%);
  border: 3px solid #241335;
  box-shadow: 0 8px 0 rgba(20, 10, 32, 0.35), 0 34px 80px rgba(20, 10, 32, 0.28); }
:root[data-theme="light"] .credits-card::before { border-color: rgba(184, 134, 11, 0.55); }
:root[data-theme="light"] .cc-school { color: #a06514; }
:root[data-theme="light"] .cc-name { color: #241335; text-shadow: none; }
:root[data-theme="light"] .cc-sub, :root[data-theme="light"] .cc-mems { color: rgba(36, 19, 53, 0.65); }
:root[data-theme="light"] .cc-hearts { color: #a06514; }
:root[data-theme="light"] .cc-note { color: #8c2333; }
:root[data-theme="light"] .cc-ending { border-color: #b8860b; }
:root[data-theme="light"] .cc-stat b { color: #a06514 !important; }
:root[data-theme="light"] .cc-secret { color: #a06514 !important; }
:root[data-theme="light"] .classphoto { background: #fdfaf1; border-color: #b8860b; }
:root[data-theme="light"] .cp-head { color: #241335; }
/* the graduation reel keeps the same promise: memories on paper in light */
:root[data-theme="light"] .reel-overlay { background: rgba(241, 234, 217, 0.95);
  --paper: #241335; --haze: rgba(36, 19, 53, 0.6); --dim: rgba(36, 19, 53, 0.55);
  --title: #8c2333; --edge-rgb: 36, 19, 53; --hairline: rgba(36, 19, 53, 0.3);
  color: #241335; }
:root[data-theme="light"] .reel-strip { background: #faf4e3; border: 3px solid #241335;
  box-shadow: 0 8px 0 rgba(20, 10, 32, 0.3), 0 26px 60px rgba(20, 10, 32, 0.22); }
:root[data-theme="light"] .reel-daymark { color: #8c2333; }

/* ---------- 13.5 phone-drawer stragglers on cream ---------- */
:root[data-theme="light"] .guide-item { background: rgba(36, 19, 53, 0.05);
  border-color: rgba(36, 19, 53, 0.2); }

/* ---------- 13.6 the choice receipt in the transcript ----------
   The plaque's pick leaves a .choice-record sys line (game.js, cycle 8) so
   the conversation record stays complete — the same dashed-chit voice as the
   nudge note, with the 抉择 kicker in the teaching accent: gold on lacquer,
   registrar red once the sheet flips to paper. */
.line.sys .choice-record { display: inline-block; font-size: 12.5px; color: var(--haze);
  border: 1.5px dashed rgba(var(--edge-rgb), 0.3); border-radius: 999px;
  padding: 4px 14px; line-height: 1.5; }
.choice-record .choice-record-kicker { font-family: var(--han); font-weight: 800;
  font-size: 11px; letter-spacing: 0.1em; color: var(--gold); margin-right: 4px; }
:root[data-theme="light"] .dlg .choice-record .choice-record-kicker { color: #8c2333; }
.choice-record .han { color: var(--paper); font-weight: 700; }

/* ---------- KTV: the player's take (speakAnswer) ----------
   The mic is on you. A quiet status line under the lyrics that names what the
   room is doing — waiting, listening, or repeating back what it heard. */
.mg-say { text-align: center; margin: 2px 0 8px; min-height: 20px;
  font-size: 13.5px; color: var(--dim); letter-spacing: 0.01em; }
.mg-say .han { font-family: var(--han); }
.mg-say.live { color: var(--gold); }
.mg-say.live.rec { color: #ff6f9a; }
.mg-say.live.rec::before { content: ""; display: inline-block; width: 8px; height: 8px;
  margin-right: 7px; border-radius: 50%; background: #ff4f7f; vertical-align: 1px;
  box-shadow: 0 0 0 0 rgba(255, 79, 127, 0.7); animation: mgRec 1.1s ease-out infinite; }
@keyframes mgRec { to { box-shadow: 0 0 0 9px rgba(255, 79, 127, 0); } }
.mg-say.heard { color: var(--paper); }
.mg-say.heard.miss { color: #ffb9ae; }
.mg-say.off { color: #ffb9ae; }
@media (prefers-reduced-motion: reduce) { .mg-say.live.rec::before { animation: none; } }

/* ---------- drills with a host: keep the boards out of the bubble ----------
   The play column is vertically centred, which parked the bottom row of tray
   boards at exactly the height of the host's speech bubble — with 字幕 on, the
   caption covered part of an answer (Lau, 2026-07-27; measured 30px into the
   left-hand boards at 1280x720). Reserving the host's lane at the foot of the
   drill lifts the whole column clear. The host is hidden under 720px, so this
   only applies where a host is actually on stage. */
@media (min-width: 721px) {
  .minigame:has(.mg-host) { padding-bottom: 210px; }
}

/* ---------- 点单 Order Builder: the rail, the tray, the tiles ----------
   Not a board quiz — an assembly bench. The rail is a paper order ticket with
   punched slots; the tray below is the shop's word magnets. Same ink-line /
   offset-shadow language as .mg-board.tray, so it reads as the same shop. */
.boba-court { display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: min(760px, 94vw); margin-top: 6px; }
.boba-rail { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  align-items: stretch; min-height: 66px; width: 100%; padding: 10px 12px;
  background: #f2e4c2; border: 3px solid #241335; border-radius: 14px;
  box-shadow: inset 0 0 0 5px #8c5a2a, inset 0 0 0 7px rgba(36, 19, 53, 0.5),
    0 4px 0 rgba(14, 6, 24, 0.8); }
.boba-slot { flex: 0 0 auto; min-width: 92px; display: grid; place-items: center;
  padding: 8px 12px; border: 2px dashed rgba(36, 19, 53, 0.4); border-radius: 11px;
  background: rgba(255, 255, 255, 0.35); }
.boba-slot .han { font-size: 16px; font-weight: 700; color: rgba(36, 19, 53, 0.55); }
.boba-slot .dim { font-size: 16px; font-weight: 800; color: rgba(36, 19, 53, 0.32);
  font-variant-numeric: tabular-nums; }
.boba-tray { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; width: 100%; }
.boba-tile { display: grid; gap: 1px; justify-items: center; padding: 8px 14px; cursor: pointer;
  background: var(--card); color: var(--paper); border: 3px solid #241335; border-radius: 12px;
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.7); transition: transform 0.12s, background 0.12s; }
.boba-tile .han { font-size: 20px; font-weight: 800; line-height: 1.15; }
.boba-tile span { font-size: 11.5px; color: var(--haze); letter-spacing: 0.02em; }
.boba-tile:hover:not(:disabled) { background: var(--card-2); border-color: var(--gold);
  transform: translateY(-3px); box-shadow: 0 7px 0 rgba(14, 6, 24, 0.7); }
.boba-tile:active:not(:disabled) { transform: translateY(0); box-shadow: 0 3px 0 rgba(14, 6, 24, 0.7); }
.boba-tile.used { opacity: 0.26; cursor: default; }
/* a tile ON the ticket is a printed line, not a magnet — warm paper, no lift */
.boba-tile.placed { background: #fdf6e0; color: #241335; box-shadow: 0 3px 0 rgba(14, 6, 24, 0.45); }
.boba-tile.placed .han { color: #241335; }
.boba-tile.placed span { color: rgba(36, 19, 53, 0.6); }
.boba-tile.placed:hover { background: #fff; border-color: #a8231a; transform: translateY(-2px); }
.boba-tile.right { border-color: #1d9d80; background: #d8f6ec; }
.boba-tile.wrong { border-color: #a8231a; background: #f6dcd6; }
.boba-ticket { display: inline-block; margin-top: 4px; font-size: 21px; font-weight: 800;
  color: var(--paper); letter-spacing: 0.01em; }
.mg-reveal .han.bad { color: #ffb9ae; }
#bobaGo:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 720px) {
  .boba-tile { padding: 7px 10px; }
  .boba-tile .han { font-size: 17px; }
  .boba-slot { min-width: 74px; }
}
/* the miss reveal is two stacked teaching lines, capped so it never grows down
   into the host's bubble (which is exactly what .mg-reveal.big did here) */
.boba-court + .mg-prompt .mg-reveal { display: grid; gap: 3px; justify-items: center;
  max-width: min(720px, 92vw); }
.boba-rev { display: block; font-size: 15px; }
.boba-rev .han { font-size: 22px; }

/* ---------- 拆字课 Radical Forge: Professor Wan's shell as a workbench ----------
   The combining bed is not a row of boxes — it is the character's actual
   STRUCTURE, because position is half the answer. 左右 puts two cells side by
   side, 上下 stacks them, 品字 makes the pyramid, 包围 nests the inner cell
   inside the outer one. The player is looking at the shape they're building. */
.forge-court { display: flex; flex-direction: column; align-items: center; gap: 16px;
  width: min(760px, 94vw); }
.forge-shell { position: relative; display: grid; place-items: center;
  width: min(248px, 64vw); aspect-ratio: 1 / 0.92; padding: 22px;
  border: 3px solid #241335; border-radius: 46% 46% 42% 42% / 50% 50% 38% 38%;
  background:
    radial-gradient(ellipse at 50% 34%, #6f5a3a 0%, #4e3d27 58%, #3a2d1d 100%);
  box-shadow: inset 0 0 0 6px rgba(36, 19, 53, 0.45),
    inset 0 -14px 26px rgba(0, 0, 0, 0.45), 0 6px 0 rgba(14, 6, 24, 0.7); }
/* the scute seams — a plastron, scratched by ten thousand years of students */
.forge-shell::before { content: ""; position: absolute; inset: 12px; pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent 49.2%, rgba(36, 19, 53, 0.5) 49.6%, rgba(36, 19, 53, 0.5) 50.4%, transparent 50.8%),
    linear-gradient(0deg, transparent 32.4%, rgba(36, 19, 53, 0.34) 32.9%, rgba(36, 19, 53, 0.34) 33.4%, transparent 33.9%),
    linear-gradient(0deg, transparent 66.4%, rgba(36, 19, 53, 0.34) 66.9%, rgba(36, 19, 53, 0.34) 67.4%, transparent 67.9%); }
.forge-graffiti { position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  border-radius: inherit; opacity: 0.3; }
.forge-graffiti span { position: absolute; font-size: 12px; font-weight: 700; color: #f2e4c2;
  white-space: nowrap; }
.forge-graffiti span:nth-child(1) { left: 7%; top: 12%; transform: rotate(-13deg); }
.forge-graffiti span:nth-child(2) { right: 6%; top: 24%; transform: rotate(9deg); font-size: 11px; }
.forge-graffiti span:nth-child(3) { left: 10%; bottom: 15%; transform: rotate(6deg); font-size: 11px; }
.forge-graffiti span:nth-child(4) { right: 12%; bottom: 24%; transform: rotate(-8deg); font-size: 17px; }
.forge-graffiti span:nth-child(5) { left: 42%; bottom: 7%; transform: rotate(3deg); font-size: 11px; }
/* the bed: an incised panel in the middle of the shell */
.forge-bed { position: relative; display: grid; gap: 6px; width: 62%; aspect-ratio: 1;
  place-items: stretch; padding: 6px; border-radius: 8px;
  background: rgba(20, 10, 30, 0.42); box-shadow: inset 0 0 0 2px rgba(36, 19, 53, 0.7); }
.forge-bed.form-lr { grid-template-columns: 1fr 1fr; }
.forge-bed.form-tb { grid-template-rows: 1fr 1fr; }
.forge-bed.form-tri { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.forge-bed.form-tri > :nth-child(1) { grid-column: 1 / 3; }
.forge-bed.form-enc { position: relative; }
.forge-bed.form-enc > :nth-child(1) { position: absolute; inset: 6px; }
.forge-bed.form-enc > :nth-child(2) { position: absolute; inset: 34% 24% 16% 30%; z-index: 2; }
.forge-cell { display: grid; place-items: center; border-radius: 6px;
  border: 2px dashed rgba(242, 228, 194, 0.32); background: rgba(0, 0, 0, 0.18); }
.forge-cell.full { border-style: solid; border-color: rgba(242, 228, 194, 0.5); }
.forge-ghost { font-size: 13px; font-weight: 800; color: rgba(242, 228, 194, 0.36); }
.forge-tile { display: grid; place-items: center; min-width: 56px; padding: 6px 12px; cursor: pointer;
  background: #f2e4c2; color: #241335; border: 3px solid #241335; border-radius: 10px;
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.7); transition: transform 0.12s, background 0.12s; }
.forge-tile .han { font-size: 30px; font-weight: 800; line-height: 1.05; color: #241335; }
.forge-tile:hover:not(:disabled) { background: #fff6d8; border-color: #b8860b;
  transform: translateY(-3px); box-shadow: 0 7px 0 rgba(14, 6, 24, 0.7); }
.forge-tile:active:not(:disabled) { transform: translateY(0); box-shadow: 0 3px 0 rgba(14, 6, 24, 0.7); }
.forge-tile.used { opacity: 0.22; cursor: default; }
/* a radical ON the shell is scratched into bone, not resting on it */
.forge-tile.set { background: transparent; border: 0; box-shadow: none; padding: 0; min-width: 0; }
.forge-tile.set .han { color: #ffe9b0; font-size: clamp(26px, 7vw, 44px);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.65); }
.forge-tile.set:hover { background: transparent; transform: none; }
.forge-tile.set:hover .han { color: #ff8d86; }
.forge-tray { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
/* it took: the whole character glows gold and settles into the bone */
.forge-bed.sealed { display: grid; place-items: center; background: rgba(20, 10, 30, 0.2);
  box-shadow: inset 0 0 0 2px rgba(184, 134, 11, 0.8), 0 0 32px rgba(255, 200, 74, 0.45); }
.forge-carved { font-size: clamp(56px, 15vw, 96px); font-weight: 900; color: #ffe9b0;
  text-shadow: 0 0 18px rgba(255, 200, 74, 0.75), 0 2px 0 rgba(0, 0, 0, 0.6);
  animation: forgeCarve 0.6s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
@keyframes forgeCarve { from { opacity: 0; transform: scale(0.55); filter: blur(3px); } }
.forge-bed.crumbled { box-shadow: inset 0 0 0 2px rgba(168, 35, 26, 0.85); }
.forge-want { font-size: 25px; font-weight: 800; color: var(--paper); }
.forge-py { font-size: 19px; color: var(--gold, #ffc84a); margin-left: 8px; letter-spacing: 0.02em; }
.forge-gl { font-size: 11.5px; color: var(--haze); margin-left: 3px; }
#forgeGo:disabled { opacity: 0.4; cursor: default; }
/* Professor Wan has no cutout art yet (see prom/dev/ART-SHOPPING-LIST.md), so
   her voice gets a caption card centred over the bench instead of an empty
   host lane. Same paper bubble, no tail — nobody is standing there to point at. */
#wanSay { margin: 0 auto 4px; max-width: min(70vw, 460px); }
#wanSay::after { display: none; }
@media (max-width: 720px) {
  .forge-tile .han { font-size: 25px; }
  .forge-shell { padding: 20px; }
}
/* the enclosure form (问 = 门 around 口): the outer radical has to read as a
   FRAME, not as a second glyph stacked on the first */
.forge-bed.form-enc > :nth-child(1) .forge-tile.set .han { font-size: clamp(62px, 17vw, 104px);
  opacity: 0.92; }
.forge-bed.form-enc > :nth-child(2) .forge-tile.set .han { font-size: clamp(20px, 5vw, 32px); }
.forge-bed.form-enc .forge-cell { border: 0; background: none; }
/* The forge has no host cutout, so nothing reserves the top strip and the
   prompt's first line ran straight through the HUD. Light theme makes the
   HUD an opaque cream bar, which turned a near-miss into a real collision,
   so the clearance is set against the TALLER of the two. */
.minigame:has(.forge-court) { padding-top: 78px; }
/* .minigame is a flex column, so a tall drill lets the browser SHRINK its
   children below their content — which is how Professor Wan's caption came to
   sit on top of the 上下/左右 structure hint. These blocks keep their height. */
.minigame:has(.forge-court) .mg-bigprompt,
.minigame:has(.forge-court) #wanSay,
.forge-court, .forge-shell, .forge-tray { flex: none; }

/* ---------- 砍价对决: the negotiation slip and the four phrases ----------
   The stall's running tally, written on Jackpot's own paper. Prices show in
   HANZI only — reading 三十八块五 is the drill; the digits arrive at settle. */
.hag-court { display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: min(760px, 94vw); }
.hag-slip { width: min(430px, 92vw); padding: 12px 16px 10px;
  background: #f2e4c2; color: #241335; border: 3px solid #241335; border-radius: 12px;
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.75); }
.hag-item { display: flex; align-items: baseline; gap: 9px; padding-bottom: 7px; margin-bottom: 6px;
  border-bottom: 2px dashed rgba(36, 19, 53, 0.32); }
.hag-item .han { font-size: 23px; font-weight: 800; color: #241335; }
.hag-item span { font-size: 12px; color: rgba(36, 19, 53, 0.66); }
.hag-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 2px 0; }
.hag-line .dim { font-size: 12px; color: rgba(36, 19, 53, 0.6); }
.hag-line .han { font-size: 20px; font-weight: 800; color: #241335; }
.hag-line .han.dim { color: rgba(36, 19, 53, 0.34); letter-spacing: 2px; }
.hag-line.now .han { color: #a8231a; font-size: 24px; }
.hag-ex { display: flex; align-items: center; gap: 5px; margin-top: 8px;
  padding-top: 7px; border-top: 2px dashed rgba(36, 19, 53, 0.32); }
.hag-ex i { width: 11px; height: 11px; border-radius: 50%; background: #b8860b;
  box-shadow: inset 0 0 0 2px rgba(36, 19, 53, 0.6); }
.hag-ex i.spent { background: transparent; }
.hag-ex .dim { margin-left: auto; font-size: 11.5px; color: rgba(36, 19, 53, 0.6); }
/* the phrases are MOVES, not quiz options: each one does something to the price */
.hag-moves { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  width: min(700px, 94vw); }
.hag-move { display: grid; gap: 0; justify-items: center; padding: 7px 13px; cursor: pointer;
  background: var(--card); color: var(--paper); border: 3px solid #241335; border-radius: 999px;
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.7); transition: transform 0.12s, background 0.12s; }
.hag-move .han { font-size: 17px; font-weight: 800; line-height: 1.2; }
.hag-move span { font-size: 11px; color: var(--gold, #ffc84a); letter-spacing: 0.02em; }
.hag-move em { font-size: 10.5px; font-style: normal; color: var(--haze); }
.hag-move:hover:not(:disabled) { background: var(--card-2); border-color: var(--gold);
  transform: translateY(-3px); box-shadow: 0 7px 0 rgba(14, 6, 24, 0.7); }
.hag-move:active:not(:disabled) { transform: translateY(0); box-shadow: 0 3px 0 rgba(14, 6, 24, 0.7); }
.hag-move.spent, .hag-move:disabled { opacity: 0.32; cursor: default; }
/* the duel got a slip and a phrase rail, so the column no longer fits by luck:
   pin the blocks against flex shrink and keep the round line clear of the HUD */
.minigame:has(.hag-court) .mg-bigprompt { min-height: 0; }
.minigame:has(.hag-court) { padding-top: 40px; }
.hag-court, .hag-slip, .hag-moves { flex: none; }
/* in 包围 the two cells are stacked on the same centre, so their empty-slot
   numbers landed on top of each other — put the outer one on the frame */
.forge-bed.form-enc > :nth-child(1) .forge-ghost { align-self: start; justify-self: start;
  margin: 2px 0 0 4px; }

/* ============================================================ round 14
   THE CONVERSATION SHEET STOPS SHOUTING (Lau: "too busy, especially on
   mobile"). Four things left the screen or moved: the 说/缘/¥ cluster (map
   business, not mid-line business), the "tap a word for meaning" whisper, the
   second row under the input, and the mic's own circle. What's left is a
   sentence to write, a chop to stamp it with, and a strip of preferences. */

/* the rail's label is a real button now — but only a phone can actually fold
   the rail, so the desktop cursor doesn't promise something inert */
.rail-label { cursor: default; line-height: 1.35; }
@media (max-width: 700px) { .rail-label { cursor: pointer; } }

/* conversation mode's ON is a STATE, not a pressed preference — it keeps the
   magenta in both themes instead of taking .tool.on's paper press */
.dlg .dlg-tools .convobtn.on,
:root[data-theme="light"] .dlg .dlg-tools .convobtn.on {
  background: var(--magenta); border-color: #241335; color: #fff; }

/* the in-field mic in the paper world: same ghost icon, ink-coloured. It has to
   re-assert itself here because the light block styles .dlg-input .micbtn as a
   cream slab for the confession/debate rows, and that outranks the layout rule. */
:root[data-theme="light"] .dlg-input .field-wrap .micbtn {
  background: transparent; border: 0; box-shadow: none; border-radius: 50%;
  color: #6b5e6f; }
:root[data-theme="light"] .dlg-input .field-wrap .micbtn:hover {
  background: rgba(36, 19, 53, 0.08); color: #241335; }
/* listening still reads as a filled ink dot — the one state you must not miss */
:root[data-theme="light"] .dlg-input .field-wrap .micbtn.listening {
  background: #241335; color: #f6f0e2; }

/* ---------- playtest drawer (title screen, developers only) ----------
   Lau asked to reach any drill from the home page instead of the console
   (2026-07-31). Gated in game.js on devMode or a localhost origin, so it
   never reaches a player on the deployed site. Deliberately quiet: it must
   not compete with the title moment it sits under. */
.playtest { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%);
  z-index: 12; width: min(760px, 94vw); text-align: center; }
.playtest-tab { background: var(--panel2); color: var(--title); border: 2px solid var(--line);
  border-radius: 10px; padding: 6px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
  letter-spacing: 0.04em; box-shadow: 0 3px 0 rgba(14, 6, 24, 0.6); }
.playtest-tab:hover { border-color: var(--gold); }
.playtest-tab .han { color: var(--gold); margin-right: 4px; }
.playtest-body { margin-top: 8px; background: rgba(26, 17, 42, 0.96); border: 2px solid var(--line);
  border-radius: 12px; padding: 12px; box-shadow: 0 6px 0 rgba(14, 6, 24, 0.6); }
.playtest-mode { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.playtest-mode button { background: var(--panel); color: var(--dim); border: 2px solid var(--line);
  border-radius: 999px; padding: 4px 14px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.playtest-mode button.on { background: var(--gold); color: #241335; border-color: #241335; }
.playtest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 7px; }
.playtest-grid button { display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel); color: var(--ink); border: 2px solid var(--line); border-radius: 10px;
  padding: 8px 6px; cursor: pointer; transition: transform 0.08s, border-color 0.1s;
  position: relative; }
.playtest-grid button:hover { border-color: var(--gold); transform: translateY(-1px); }
.playtest-grid button:active { transform: translateY(1px); }
.playtest-grid .han { font-size: 17px; font-weight: 800; color: var(--title); }
.playtest-grid small { font-size: 11px; color: var(--dim); line-height: 1.2; }
.playtest-note { margin: 9px 0 0; font-size: 11.5px; color: var(--dim); }
/* a recent-change marker (Lau, 2026-08-10) — a quiet dot, not a banner; the
   tooltip (button title=) carries the actual note. */
.playtest-grid button.has-note { border-color: var(--gold); }
.playtest-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold);
  display: inline-block; position: absolute; top: 6px; right: 6px; }
.playtest-note .playtest-dot { position: static; margin: 0 1px; vertical-align: middle; }
@media (max-width: 560px) { .playtest { bottom: 4px; } .playtest-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------------------------------------- the playtest escape hatch's SHEET
   The hatch itself is no longer here and no longer floats: it is a coin docked
   beside the drill's ?, styled in drill-manual.css with the rest of the FTUE
   chrome. It floated bottom-left at z-index 85 until a 390x844 elementFromPoint
   sweep found it taking the tap in eight of thirteen drills — four of them on
   the tutorial's own 下一步 — and no corner tested clean. See the note over
   ensurePlaytestExit in game.js. */
.playtest-jump {
  position: fixed; inset: 0; z-index: 86;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(8, 4, 14, 0.72);
}
.playtest-jump-card {
  width: min(560px, 96vw); max-height: 88vh;
  max-height: calc(88dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--card, #1a1130); color: var(--paper, #f2efe9);
  border: 3px solid var(--dk-gold, #ffc84a); border-radius: 16px; padding: 14px;
  box-shadow: 0 12px 0 rgba(14, 6, 24, 0.6), 0 30px 60px rgba(0, 0, 0, 0.55);
}
.playtest-jump-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 10px; }
.playtest-jump-head .han { font-family: var(--han, "PingFang SC", sans-serif); font-size: 20px; color: var(--dk-gold, #ffc84a); }
.playtest-jump-head span { font-size: 14px; color: var(--haze, #a49fae); }
.playtest-jump-head .pj-x {
  margin-left: auto; width: 44px; height: 44px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 2px solid var(--haze, #a49fae); color: var(--paper, #f2efe9);
}
.playtest-jump .playtest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.playtest-jump .playtest-grid button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
  min-height: 44px; padding: 9px 6px; border-radius: 11px; position: relative;
  background: rgba(255, 255, 255, 0.06); border: 2px solid rgba(246, 237, 218, 0.22);
  color: var(--paper, #f2efe9);
}
.playtest-jump .playtest-grid button:hover { border-color: var(--dk-gold, #ffc84a); }
.playtest-jump .playtest-grid button.has-note { border-color: var(--dk-gold, #ffc84a); }
.playtest-jump .playtest-grid .han { font-family: var(--han, "PingFang SC", sans-serif); font-size: 16px; font-weight: 800; }
.playtest-jump .playtest-grid small { font-size: 11px; color: var(--haze, #a49fae); line-height: 1.2; text-align: center; }
.playtest-jump .playtest-mode { display: flex; gap: 8px; margin-bottom: 10px; }
.playtest-jump .playtest-mode button {
  flex: 1; padding: 7px 10px; border-radius: 999px; cursor: pointer; font-weight: 800;
  background: transparent; border: 2px solid rgba(246, 237, 218, 0.28); color: var(--paper, #f2efe9);
}
.playtest-jump .playtest-mode button.on { background: var(--dk-gold, #ffc84a); border-color: var(--dk-gold, #ffc84a); color: #241335; }
.playtest-jump .pj-act {
  width: 100%; min-height: 44px; margin-top: 10px; padding: 10px; border-radius: 12px; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); border: 2px solid rgba(246, 237, 218, 0.28);
  color: var(--paper, #f2efe9); font-weight: 800;
}
.playtest-jump .pj-act:hover { border-color: var(--dk-gold, #ffc84a); }
.playtest-jump .pj-act .han { font-family: var(--han, "PingFang SC", sans-serif); font-size: 16px; margin-right: 6px; }

/* ---------- a conversation first, with the painting around it ----------
   real button boxes replace invisible hit expanders: what looks tappable is
   what responds, even when the tools wrap or the keyboard takes half the room. */
.dlg, .daily-screen {
  --paper: var(--prom-ink); --haze: var(--prom-ink-muted);
  --ink: var(--prom-ink); --dim: var(--prom-ink-muted); --title: var(--prom-ink);
  --panel: var(--prom-paper); --panel2: #344b60; --line: #607487;
  --field-bg: #344b60; --field-fg: var(--prom-ink); --page-bg: #1c2937;
}
:root[data-theme="light"] :is(.dlg, .daily-screen) {
  --panel2: #e5e5d9; --line: #b9c1bc; --field-bg: #fffdf5; --page-bg: #e5e5d9;
}
.dlg {
  background: var(--prom-paper); color: var(--prom-ink); border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  padding: 24px 20px 16px; max-height: calc(100dvh - 92px);
  display: flex; flex-direction: column; min-height: min-content; flex-shrink: 0;
}
.dlg .dlg-name {
  background: var(--panel) !important; color: var(--paper); border: 1px solid var(--line);
  border-radius: 6px; box-shadow: none; font-family: var(--han); font-size: var(--prom-text-latin);
  padding: 5px 12px; top: -17px;
}
.dlg .dlg-name .han { font-size: var(--prom-text-zh); }
.dlg .dlg-log { flex: 1 1 auto; max-height: min(280px, 32dvh); min-height: 72px; padding-bottom: 12px; }
.dlg .line { max-width: 100%; }
.dlg .line.char { font-size: var(--prom-text-zh); line-height: 1.7; }
.dlg .line.player { font-size: var(--prom-text-zh); box-shadow: none; border-width: 1px; }
.dlg .line-en { font-size: var(--prom-text-latin); line-height: 1.5; }
.dlg .w ruby rt { font-size: var(--prom-text-latin); }
.dlg .dlg-tools { flex: none; gap: 8px; padding: 4px 0 8px; }
.dlg .dlg-tools .tool, .dlg .dlg-tools .convobtn {
  min-width: 44px; min-height: 44px; padding: 8px 10px; font: 600 var(--prom-text-utility) var(--han);
  background: transparent; color: var(--haze); border: 1px solid transparent;
  border-radius: 8px; box-shadow: none; transform: none;
}
.dlg .dlg-tools .tool:hover, .dlg .dlg-tools .tool.on {
  background: var(--panel2); color: var(--paper); border-color: var(--line);
}
.dlg .dlg-tools .tool::after, .dlg .dlg-tools .convobtn::after,
.dlg .field-wrap .micbtn::after { content: none; }
.dlg .dlg-input { flex: none; gap: 8px; }
.dlg .dlg-input #say { min-height: 48px; border: 1px solid var(--line); box-shadow: none; font-size: var(--prom-text-zh); }
.dlg .dlg-input #say::placeholder { color: var(--haze); }
.dlg .dlg-input .micbtn { display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  width: auto; min-width: 78px; min-height: 48px; padding: 0 10px; white-space: nowrap;
  background: var(--panel2); color: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: none; }
.dlg .dlg-input .micbtn:hover { background: var(--line); color: var(--paper); }
.dlg .dlg-input .micbtn.listening { background: var(--prom-accent); color: #fffdf5; border-color: var(--prom-accent); }
.dlg .dlg-input .sendbtn {
  width: auto; min-width: 68px; min-height: 48px; padding: 0 14px;
  background: var(--prom-accent); color: #fffdf5; border: 1px solid var(--prom-accent); border-radius: 8px;
  font: 700 var(--prom-text-latin) var(--han); letter-spacing: 0; text-transform: none; text-shadow: none;
  box-shadow: none;
}
.dlg .dlg-input .sendbtn::before { content: none; }
.dlg button:focus-visible, .dlg summary:focus-visible { outline: 3px solid var(--paper); outline-offset: 2px; }
.dlg .suggestion { min-height: 44px; font-size: var(--prom-text-latin); transform: none; box-shadow: none; border-width: 1px; }
.scene-banner, :root[data-theme="light"] .scene-banner { min-height: 64px; font-size: var(--prom-text-latin); border-width: 1px; box-shadow: none; border-radius: 10px; }
.scene-banner .han { font-size: var(--prom-text-zh); }
.scene-banner .leavebtn { font-size: var(--prom-text-latin); min-width: 44px; min-height: 44px; padding: 8px 12px; }
.rail-label { min-height: 44px; display: flex; align-items: center; }
@media (max-width: 700px) {
  .scene-banner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; }
  .scene-banner > b, .scene-banner > span { grid-column: 1; }
  .scene-banner > .leavebtn { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .dlg { width: calc(100% - 12px); margin: 0 6px max(6px, env(safe-area-inset-bottom));
    padding: 22px 12px 10px; border-radius: 14px; }
  .dlg .dlg-log { max-height: 32dvh; min-height: 56px; }
  .dlg .line.char { font-size: var(--prom-text-zh); }
  .dlg .dlg-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .dlg .dlg-tools .tool, .dlg .dlg-tools .convobtn { width: 100%; justify-content: center; padding: 8px 6px; }
  .dlg .dlg-input #say { padding-left: 10px; }
  .dlg .dlg-input .sendbtn { min-width: 60px; padding: 0 10px; }
  .dlg .dlg-input .micbtn { min-width: 48px; padding: 0 8px; }
  .dlg .dlg-input .micbtn span { display: none; }
}
@media (max-height: 540px) {
  .dlg { max-height: calc(100dvh - 66px); }
  .dlg .dlg-log { max-height: 27dvh; min-height: 40px; }
  .scene-stage:has(.sprite) { padding-top: 0; }
}

.dlg :is(.conversation-question, .conversation-correction, .conversation-recovery) {
  flex: 0 0 auto; padding: 12px; margin-block: 8px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--prom-ink); font-size: var(--prom-text-latin);
  overflow-wrap: anywhere;
}
.dlg :is(.conversation-question, .conversation-correction, .conversation-recovery) .han { font-size: var(--prom-text-zh); }

/* help opens beside the draft; the rest of the tools wait in one drawer. */
.scene-purpose { margin: 0 0 8px; color: var(--haze); font-size: var(--prom-text-latin); line-height: 1.45; }
.dlg .dlg-tools .primary-help { background: var(--panel2); color: var(--paper); border-color: var(--line); font-size: var(--prom-text-latin); }
.scene-tools { position: relative; margin-left: auto; }
.scene-tools > summary { display: flex; align-items: center; min-height: 44px; padding: 8px 12px;
  list-style: none; color: var(--haze); cursor: pointer; font-size: var(--prom-text-latin); }
.scene-tools > summary::-webkit-details-marker { display: none; }
.scene-tools > summary::after { content: "+"; margin-left: 8px; }
.scene-tools[open] > summary::after { content: "−"; }
.scene-tools-options { position: absolute; right: 0; bottom: 100%; z-index: 6;
  width: min(300px, calc(100vw - 40px)); display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2); }
.reply-help { flex: 0 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) var(--panel2); max-height: 32dvh; padding: 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; font-size: var(--prom-text-latin); }
.reply-help[hidden] { display: none; }
.reply-help p { margin: 0 0 8px; line-height: 1.5; }
.reply-intents, .reply-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reply-help button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--paper); border-radius: 8px; font: 600 var(--prom-text-latin) var(--han); }
.reply-help button:hover { border-color: var(--paper); }
.reply-draft { display: block; width: 100%; min-height: 78px; resize: vertical; margin: 10px 0;
  padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field-bg);
  color: var(--field-fg); font: var(--prom-text-zh)/1.5 var(--han); }
.daily-screen { height: 100%; overflow-y: auto; padding: 64px max(18px, calc((100vw - 960px) / 2)) 28px;
  background: var(--page-bg); color: var(--paper); }
.daily-screen h1, .daily-screen h2 { font-family: var(--hand); color: var(--title); }
.daily-screen p { font-size: var(--prom-text-latin); line-height: 1.6; }
.daily-screen > header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: start; }
.daily-screen > header :is(h1, p) { grid-column: 1; }
.daily-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.daily-invitations { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 16px; margin: 20px 0; }
.daily-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; text-align: left;
  background: var(--panel); color: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.daily-card h2, .daily-card h3, .daily-card p { margin: 0; }
.daily-card img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 10px; }
.daily-screen button { min-width: var(--prom-target-min); min-height: var(--prom-target-min); padding: 10px 14px; font-size: var(--prom-text-latin); }
.daily-topics { display: flex; flex-wrap: wrap; gap: 8px; }
.daily-chat { width: min(760px, 100%); margin: 20px auto; padding: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.daily-chat .line { margin: 12px 0; }
.daily-compose { display: flex; gap: 8px; align-items: flex-end; margin-top: 16px; }
.daily-compose input, .daily-compose textarea { flex: 1; min-width: 0; min-height: 48px;
  padding: 10px; font: var(--prom-text-zh)/1.5 var(--han); background: var(--field-bg); color: var(--field-fg);
  border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 700px) {
  .daily-screen { padding: 60px 12px max(16px, env(safe-area-inset-bottom)); }
  .daily-screen > header { grid-template-columns: 1fr; }
  .daily-screen > header :is(h1, p), .daily-actions { grid-column: 1; grid-row: auto; }
  .daily-actions { justify-content: flex-start; }
  .daily-chat { padding: 12px; }
  .dlg:has(.reply-help:not([hidden])) .dlg-log { min-height: 40px; max-height: 22dvh; }
}
/* a phrase tray is optional on a wide screen too; the painting keeps its margin. */
.chip-stack:not(.open) #chips { display: none; }
.rail-label { cursor: pointer; }
.dlg .w.kara-done { color: var(--paper); }
.dlg .gesture { color: var(--haze); }

/* daily practice has one reader and one writer; the portrait gets the margin,
   not the height the next reply needs. The log scrolls inside the page. */
.daily-screen:has(> .daily-portrait) {
  display: grid; grid-template-columns: minmax(140px, 0.7fr) minmax(0, 1.6fr);
  grid-template-rows: auto minmax(160px, 1fr) auto auto auto auto auto;
  gap: 8px 24px; padding-top: max(64px, env(safe-area-inset-top)); min-height: 0; overflow-y: auto;
}
/* The existing developer/report controls occupy two rows on phones. */
@media (max-width: 700px) {
  body:has(.dev-fab) .scene-top { padding-top: 112px; }
  body:has(.dev-fab) .daily-screen:has(> .daily-portrait) { padding-top: max(112px, env(safe-area-inset-top)); }
}
.daily-screen:has(> .daily-portrait) > header { grid-column: 1 / -1; padding-right: 48px; }
.daily-screen:has(> .daily-portrait) > header h1 { margin: 0 0 6px; font-size: var(--prom-text-display); }
.daily-screen:has(> .daily-portrait) > header p { margin: 0 0 8px; }
.daily-portrait { grid-column: 1; grid-row: 2 / span 6; width: 100%; height: 100%; min-height: 0;
  object-fit: contain; object-position: center top; align-self: start; }
.daily-screen:has(> .daily-portrait) > .daily-chat { grid-column: 2; grid-row: 2;
  width: 100%; height: 100%; min-height: 0; margin: 0; overflow-y: auto; overscroll-behavior: contain; }
.daily-chat .character, .daily-chat .player { margin: 0 0 18px; }
.daily-chat .han { font-size: var(--prom-text-zh); line-height: 1.65; margin: 0 0 8px; }
.daily-chat .player { padding: 12px; background: var(--panel2); border-radius: 10px; }
.daily-chat summary { cursor: pointer; color: var(--haze); padding: 10px 0; min-height: 44px; }
.daily-screen:has(> .daily-portrait) > .daily-status { grid-column: 2; grid-row: 3; margin: 0; }
.daily-status:empty { display: none; }
.daily-screen:has(> .daily-portrait) > button { grid-column: 2; justify-self: start; }
.daily-screen:has(> .daily-portrait) > .reply-help { grid-column: 2; max-height: 28dvh; }
.daily-screen:has(> .daily-portrait) > .daily-compose { grid-column: 2; margin: 0; }
.daily-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
.daily-compose textarea::placeholder { color: var(--haze); opacity: 1; }
.daily-compose textarea { width: 100%; min-height: 72px; max-height: 120px; resize: vertical; }
.daily-screen button { border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel2); color: var(--paper); }
.daily-compose button:first-of-type { background: var(--prom-accent); border-color: var(--prom-accent); color: #fffdf5; }
.daily-screen button:focus-visible, .daily-screen summary:focus-visible,
.daily-screen textarea:focus-visible { outline: 3px solid var(--paper); outline-offset: 2px; }
.daily-card img { object-fit: contain; object-position: center 15%; }
@media (max-width: 700px) {
  .daily-screen:has(> .daily-portrait) { position: relative;
    grid-template-columns: minmax(0, 1fr) 80px; gap: 8px;
    padding-top: max(64px, env(safe-area-inset-top));
    grid-template-rows: auto minmax(160px, 1fr) auto auto auto auto auto; }
  .daily-screen:has(> .daily-portrait) > header { grid-column: 1; grid-row: 1;
    padding-right: 0; min-height: auto; overflow-wrap: anywhere; }
  .daily-screen:has(> .daily-portrait) > header h1 { font-size: 1.5rem; }
  .daily-screen:has(> .daily-portrait) > header p { font-size: var(--prom-text-latin); line-height: 1.5; }
  .daily-portrait { position: static; grid-column: 2; grid-row: 1; width: 80px; height: 128px;
    object-fit: contain; object-position: center top; border-radius: 0; }
  .daily-screen:has(> .daily-portrait) > :is(.daily-chat, .daily-status, .reply-help, .daily-compose, button) { grid-column: 1 / -1; }
  .daily-chat .han { font-size: var(--prom-text-zh); }
  .daily-compose { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .daily-compose textarea { grid-column: 1 / -1; min-height: 64px; max-height: 90px; }
  .daily-compose button { min-height: 44px; padding: 8px 12px; }
  .daily-screen:has(> .daily-portrait) > .reply-help { max-height: 24dvh; }
}
@media (max-height: 600px) {
  .daily-screen:has(> .daily-portrait) { overflow-y: auto; grid-template-rows: auto minmax(120px, 1fr) auto auto auto auto auto; }
  .daily-screen:has(> .daily-portrait) > .daily-compose { position: sticky; bottom: 0; padding-top: 8px; background: var(--page-bg); }
}
