/* Chapter Quest — design tokens, themes, layout. iPad-first, touch-friendly. */
:root {
  --ink: #1d2433; --ink-2: #4a5263; --muted: #6b7180;
  --bg: #efe6d2; --surface: #fbf6ea; --surface-2: #f3ead6; --line: #d9ccb0;
  --accent: #2a7f78; --accent-ink: #ffffff; --accent-2: #b5543b; --gold: #c99a3b; --plum: #5b3a6b;
  --good: #2f7d4f; --good-bg: #e6f2e9; --try: #8a5a12; --try-bg: #fbf0d9; --shown-bg: #ecebf5;
  --mark: #ffe08a; --speak: #cfe8e4; --select: #cfe0ff;
  --read-size: 21px; --read-lh: 1.75; --read-ls: 0.01em;
  --font-ui: -apple-system, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-read: -apple-system, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-head: "Iowan Old Style", "Palatino", Georgia, serif;
  --radius: 14px; --shadow: 0 6px 24px rgba(29, 36, 51, 0.12);
  --map-paper: #f7efdc; --map-edge: #e3d3ad; --map-sea: #9cc1cf; --map-ink: #6b5a3a;
  --avatar-bg: #e6dcc6;
  --series-en: #2a78d6; --series-fr: #eb6834; --viz-grid: #e3e1db; --viz-surface: #fcfcfb;
  color-scheme: light;
}
:root[data-paper="paper"] { --bg: #ffffff; --surface: #ffffff; --surface-2: #f4f5f7; --line: #c9ced8; --ink: #0b0f18; --ink-2: #2b3240; --muted: #4a5263; --map-paper: #ffffff; --map-edge: #eef1f5; }
:root[data-theme="dark"] {
  --ink: #ece6d8; --ink-2: #c9c1ae; --muted: #a39d8f;
  --bg: #141a26; --surface: #1d2534; --surface-2: #253047; --line: #34405a;
  --accent: #46b3a9; --accent-ink: #0d1520; --accent-2: #e07a5f;
  --good: #7fd19a; --good-bg: #1d3a2a; --try: #f2c57c; --try-bg: #3a2f1a; --shown-bg: #2a2a40;
  --mark: #6b5a17; --speak: #1f4a45; --select: #2a3f66;
  --map-paper: #222c3e; --map-edge: #161d2b; --map-sea: #2c4a63; --map-ink: #c9b98f; --avatar-bg: #2a3346;
  --series-en: #3987e5; --series-fr: #d95926; --viz-grid: #34405a; --viz-surface: #1a1a19;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .parent { --viz-surface: #1a1a19; }
}
:root[data-font="rounded"] { --font-read: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", var(--font-ui); }
:root[data-font="serif"] { --font-read: "Iowan Old Style", "Palatino", Georgia, serif; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 17px; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
#root { min-height: 100vh; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: 0.01em; margin: 0.2em 0 0.4em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.15rem; }
p { line-height: 1.5; }
.muted { color: var(--muted); } .small { font-size: 0.88rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; color: var(--muted); margin: 0; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.wrap { flex-wrap: wrap; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* ---------- Buttons ---------- */
button, .button { font: inherit; color: inherit; cursor: pointer; border-radius: 12px; border: 1px solid transparent; min-height: 48px; padding: 10px 18px; touch-action: manipulation; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible, .button:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: 0 2px 0 rgba(0,0,0,0.12); }
.primary.big { font-size: 1.15rem; padding: 16px 26px; min-height: 64px; flex-direction: column; gap: 2px; }
.primary.big .sub { font-size: 0.82rem; font-weight: 500; opacity: 0.9; }
.secondary { background: var(--surface); border-color: var(--line); }
.ghost { background: transparent; border-color: transparent; }
.link { background: none; border: none; color: var(--accent); text-decoration: underline; padding: 8px 4px; min-height: 44px; }
.tool { background: var(--surface); border: 1px solid var(--line); padding: 8px 14px; }
.mini { min-height: 36px; min-width: 36px; padding: 4px 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; font-size: 0.9rem; }
.mini.ghost { background: transparent; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; }
.danger-btn { background: #9b2c2c; color: #fff; }
input[type=text], input[type=password], input:not([type]), textarea, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 48px; width: 100%; }
textarea { font-family: var(--font-read); font-size: calc(var(--read-size) * 0.92); line-height: 1.6; resize: vertical; }

/* ---------- Art ---------- */
.scene-art { display: block; width: 100%; height: 34vh; max-height: 340px; min-height: 180px; border-radius: var(--radius); }
.scene-art.short-art { height: 18vh; min-height: 120px; }
.scene-art.hero-art { position: fixed; inset: 0; height: 100%; max-height: none; border-radius: 0; z-index: 0; }
.scene-art.mini-art { height: 60px; min-height: 60px; width: 120px; }
.twinkle circle { animation: twinkle 4s ease-in-out infinite alternate; }
.twinkle circle:nth-child(3n) { animation-delay: 1.3s; }
@keyframes twinkle { to { opacity: 0.15; } }
.drift { animation: drift 14s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translateX(-30px); } }
.pulse { animation: pulse 3s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
:root[data-calm="1"] *, :root[data-calm="1"] *::before { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Splash / onboarding ---------- */
.splash, .onboard { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.splash-card, .onboard-card { position: relative; z-index: 1; background: var(--surface); border-radius: 20px; padding: 28px; max-width: 720px; width: 100%; box-shadow: var(--shadow); }
.creator { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; margin: 16px 0 20px; }
.opt { display: block; margin-bottom: 12px; } .opt-label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.opt-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; border: 2px solid var(--line); font-size: 0.72rem; }
.opt-row .sw:not([style]) { width: auto; border-radius: 10px; padding: 0 12px; background: var(--surface-2); }
.sw.on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold); }
.comp-btn { flex-direction: column; background: var(--surface-2); border: 2px solid var(--line); padding: 8px 12px; }
.comp-btn.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }

/* ---------- Home ---------- */
.home { max-width: 1180px; margin: 0 auto; padding: 16px; }
.home-head { display: flex; align-items: center; gap: 12px; }
.home-title { flex: 1; } .home-title h1 { margin: 0; font-size: 1.5rem; }
.avatar-btn { padding: 0; border-radius: 50%; min-height: 56px; background: none; }
.lantern-count { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 600; white-space: nowrap; }
.quest-cta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 16px 0; }
.home-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.map-wrap { background: var(--surface); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.worldmap { width: 100%; height: auto; display: block; }
.pin { cursor: pointer; } .pin-dot { fill: var(--accent-2); stroke: var(--surface); stroke-width: 0.6; }
.pin-done .pin-dot { fill: var(--gold); } .pin-locked { cursor: default; opacity: 0.45; } .pin-locked .pin-dot { fill: var(--muted); }
.pin-ring { fill: none; stroke: var(--accent-2); stroke-width: 0.5; animation: ring 2s ease-out infinite; transform-origin: center; }
@keyframes ring { from { opacity: 1; r: 3; } to { opacity: 0; r: 7; } }
.pin-label { fill: var(--map-ink); font-family: var(--font-head); font-weight: 600; paint-order: stroke; stroke: var(--map-paper); stroke-width: 0.6; }
.places { display: grid; gap: 10px; align-content: start; }
.place { justify-content: flex-start; text-align: left; background: var(--surface); border: 1px solid var(--line); padding: 14px; gap: 14px; position: relative; }
.place-icon { font-size: 1.7rem; } .place-text { display: flex; flex-direction: column; } .place-text span { font-size: 0.86rem; color: var(--muted); }
.badge { position: absolute; right: 12px; top: 12px; background: var(--accent-2); color: #fff; border-radius: 999px; padding: 2px 9px; font-size: 0.8rem; font-weight: 700; }
.home-foot { text-align: center; margin: 24px 0 8px; }
.banner { padding: 10px 14px; border-radius: 10px; margin: 10px 0; } .banner.warn { background: var(--try-bg); color: var(--try); }
.done-msg { font-family: var(--font-head); font-size: 1.2rem; }

/* sheets */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 22, 0.45); z-index: 20; display: grid; place-items: end center; }
.sheet { background: var(--surface); width: min(900px, 100%); max-height: 88vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 22px 20px 32px; position: relative; -webkit-overflow-scrolling: touch; }
@media (min-width: 760px) { .sheet-backdrop { place-items: center; } .sheet { border-radius: 20px; } }
.sheet-close { position: absolute; right: 10px; top: 10px; background: var(--surface-2); border-radius: 50%; width: 48px; padding: 0; }
.scene-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.scene-btn { width: 100%; justify-content: flex-start; text-align: left; background: var(--surface-2); border: 1px solid var(--line); gap: 14px; }
.scene-btn small { display: block; color: var(--muted); } .scene-btn.done { background: var(--good-bg); }
.practice-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.practice-item { flex-direction: column; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--line); text-align: left; }
.practice-item small { color: var(--muted); } .practice-item.rec { border: 2px solid var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.lang-tag { font-size: 0.7rem; font-weight: 700; background: var(--ink); color: var(--surface); border-radius: 6px; padding: 1px 6px; }

/* satchel */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 48px 14px 0; } .tabs button { background: var(--surface-2); border: 1px solid var(--line); } .tabs button.on { background: var(--ink); color: var(--surface); }
.artifact-grid, .seal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.artifact-tile, .seal { background: var(--surface-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.seal { opacity: 0.55; } .seal.has { opacity: 1; border: 2px solid var(--gold); } .seal span { font-size: 1.8rem; } .seal small { color: var(--muted); }
.board { display: flex; flex-wrap: wrap; gap: 12px; }
.pinned-note { background: #fff6c8; color: #3b3320; padding: 14px 16px; border-radius: 4px; box-shadow: 2px 3px 0 rgba(0,0,0,0.12); transform: rotate(-1deg); max-width: 320px; font-family: var(--font-read); }
.wardrobe { display: grid; grid-template-columns: auto 1fr; gap: 20px; }
.ward-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.ward { justify-content: flex-start; background: var(--surface-2); border: 1px solid var(--line); } .ward.on { border: 2px solid var(--accent); } .ward .sw { width: 26px; height: 26px; min-height: 26px; }

/* settings */
.settings h3 { margin-top: 20px; }
.setting { display: grid; grid-template-columns: 160px 1fr auto; gap: 12px; align-items: center; margin: 12px 0; }
.setting.toggle { grid-template-columns: auto 1fr; } .setting.toggle input { width: 28px; height: 28px; }
.setting input[type=range] { width: 100%; height: 36px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; } .seg button { min-height: 44px; } .seg button.on { background: var(--ink); color: var(--surface); }
.preview { background: var(--surface-2); border-radius: 12px; padding: 4px 16px; }

/* ---------- Runner ---------- */
.runner { min-height: 100vh; }
.run-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.run-title { display: flex; flex-direction: column; min-width: 0; flex: 1; } .run-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.progress { width: 140px; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; } .progress span { display: block; height: 100%; background: var(--gold); }
.run-body { max-width: 1120px; margin: 0 auto; padding: 18px 16px 80px; animation: fadein 0.35s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }
.toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 12px 20px; border-radius: 999px; z-index: 30; box-shadow: var(--shadow); }

.narrate { display: grid; gap: 16px; }
.narrate-box, .card-panel, .strategy-card, .artifact-reveal, .reflection, .clue-step, .choice-step > .narrate-box { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.narrate-box p { font-family: var(--font-read); font-size: var(--read-size); line-height: var(--read-lh); letter-spacing: var(--read-ls); max-width: 70ch; }
.speaker { display: inline-block; background: var(--plum); color: #fff; border-radius: 8px; padding: 2px 10px; font-weight: 600; font-size: 0.85rem; }

/* reading */
.reader, .card-panel { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); max-width: 860px; margin: 0 auto; }
.reader-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; }
.passage-text { font-family: var(--font-read); font-size: var(--read-size); line-height: var(--read-lh); letter-spacing: var(--read-ls); word-spacing: 0.06em; max-width: 68ch; }
.passage-text p { margin: 0 0 0.9em; line-height: var(--read-lh); }
.passage-text.doc { font-family: "Courier New", ui-monospace, monospace; font-size: calc(var(--read-size) * 0.92); background: var(--surface-2); padding: 14px 18px; border-left: 4px solid var(--gold); border-radius: 6px; }
:root[data-font="rounded"] .passage-text.doc, :root[data-font="serif"] .passage-text.doc { font-family: var(--font-read); }
.sent { border-radius: 6px; transition: background 0.2s; padding: 1px 0; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.sent[role=button] { cursor: pointer; }
.sent.speaking { background: var(--speak); }
.sent.marked { background: var(--mark); box-shadow: 0 0 0 2px var(--mark); }
.sent.selected { background: var(--select); outline: 2px solid var(--accent); }
.sent.dimmed { opacity: 0.35; } .sent.focus { background: var(--surface-2); }
.gloss-wrap { position: relative; }
.gloss { background: none; border: none; padding: 0; min-height: 0; font: inherit; color: inherit; text-decoration: underline dotted var(--accent) 2px; text-underline-offset: 4px; display: inline; }
.gloss-pop { position: absolute; left: 0; top: 1.6em; z-index: 8; width: min(320px, 80vw); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 12px; padding: 12px; font-family: var(--font-ui); font-size: 1rem; line-height: 1.4; display: block; }
.gloss-pop .row { margin: 8px 0 0; } .gloss-en { display: block; margin-top: 6px; color: var(--muted); }
.keywords { list-style: none; padding: 0; display: grid; gap: 10px; } .keywords li { display: flex; gap: 10px; align-items: baseline; font-size: 1.05rem; }
.checkin { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 8px; }
.checkin-q { font-size: 1.05rem; background: var(--try-bg); padding: 4px 16px; border-radius: 10px; border-left: 5px solid var(--gold); }
.checkin-q p { margin: 8px 0; } .checkin-prompt { font-family: var(--font-read); font-size: calc(var(--read-size) * 0.95); font-weight: 600; }
.tts-off { color: var(--muted); font-size: 0.85rem; }

/* activities */
.activity-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.activity-single { max-width: 820px; margin: 0 auto; }
.passage-panel { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
.passage-panel .passage-text { font-size: calc(var(--read-size) * 0.88); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.hidden-panel { display: grid; place-items: center; text-align: center; min-height: 200px; background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 10px, var(--surface-2) 10px, var(--surface-2) 20px); }
.question, .activity-single { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.prompt { font-family: var(--font-read); font-size: calc(var(--read-size) * 1.02); line-height: 1.5; font-weight: 600; }
.choices { display: grid; gap: 10px; margin: 12px 0; }
.choice { justify-content: flex-start; text-align: left; background: var(--surface-2); border: 2px solid var(--line); font-family: var(--font-read); font-size: calc(var(--read-size) * 0.92); line-height: 1.4; padding: 12px 16px; min-height: 56px; }
.choice.big { font-size: var(--read-size); padding: 18px; }
.choice-letter { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); font-size: 0.85rem; font-family: var(--font-ui); font-weight: 700; }
.choice.tried { opacity: 0.55; text-decoration: line-through; text-decoration-color: var(--muted); }
.choice.right { border-color: var(--good); background: var(--good-bg); }
.row-choices { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.hint-btn { background: transparent; border: 1px dashed var(--accent); color: var(--accent); }
.hint-btn.glow { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.feedback { border-radius: 12px; padding: 14px 16px; margin: 12px 0; font-size: 1.02rem; }
.feedback p { margin: 0.3em 0; font-family: var(--font-read); }
.feedback.good { background: var(--good-bg); border-left: 5px solid var(--good); }
.feedback.try { background: var(--try-bg); border-left: 5px solid var(--try); }
.feedback.shown { background: var(--shown-bg); border-left: 5px solid var(--plum); }
.hint { background: var(--surface-2); padding: 8px 12px; border-radius: 10px; }
.claim { background: var(--try-bg); padding: 12px 16px; border-radius: 12px; font-family: var(--font-read); font-size: var(--read-size); }
.evidence-board { background: var(--surface-2); border-radius: 12px; padding: 12px 16px; margin: 10px 0; }
.evidence-board .sent { display: inline; padding: 2px 2px; }
.echo-banner { display: flex; align-items: center; gap: 12px; background: var(--plum); color: #fff; padding: 10px 16px; border-radius: 12px; margin-bottom: 12px; font-size: 1.4rem; } .echo-banner p { margin: 0; font-size: 1rem; font-family: var(--font-head); }

.sort-pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 56px; padding: 8px; border: 2px dashed var(--line); border-radius: 12px; }
.card-item { background: var(--surface); border: 2px solid var(--line); font-family: var(--font-read); font-size: calc(var(--read-size) * 0.85); text-align: left; justify-content: flex-start; box-shadow: 0 2px 0 var(--line); }
.card-item.picked { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); transform: translateY(-2px); }
.card-item.locked { border-color: var(--good); background: var(--good-bg); }
.bins { display: grid; gap: 10px; margin: 12px 0; }
.bin { background: var(--surface-2); border: 2px solid var(--line); border-radius: 12px; padding: 10px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
.bin.ready { border-color: var(--accent); border-style: dashed; cursor: pointer; } .bin h4 { margin: 0; font-family: var(--font-head); }

.seq { list-style: none; padding: 0; display: grid; gap: 8px; }
.seq-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 60px; }
.seq-item.locked { border-color: var(--good); background: var(--good-bg); } .seq-item.dragging { box-shadow: var(--shadow); border-color: var(--accent); }
.handle { font-size: 1.3rem; color: var(--muted); padding: 10px 6px; cursor: grab; user-select: none; -webkit-user-select: none; }
.seq-num { font-weight: 700; width: 24px; text-align: center; } .seq-text { flex: 1; font-family: var(--font-read); font-size: calc(var(--read-size) * 0.88); }
.arrows { display: flex; flex-direction: column; gap: 4px; } .tick { color: var(--good); font-size: 1.4rem; font-weight: 700; }

.steps-mini { display: flex; gap: 8px; list-style: none; padding: 0; margin: 8px 0 14px; flex-wrap: wrap; }
.steps-mini > * { background: var(--surface-2); padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; color: var(--muted); }
.steps-mini .on { background: var(--accent); color: var(--accent-ink); } .steps-mini .past { color: var(--good); }
.frame { background: var(--surface-2); padding: 10px 14px; border-radius: 10px; }

.vials { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0; }
.vial { flex-direction: column; min-width: 120px; padding: 14px 16px; border-radius: 18px 18px 26px 26px; border: 2px solid var(--line); background: var(--surface-2); }
.vial-text { font-family: var(--font-read); font-size: 1.4rem; font-weight: 700; }
.vial-meaning { font-size: 0.8rem; color: var(--muted); }
.vial.role-prefix { border-color: #2a78d6; } .vial.role-suffix { border-color: #b5543b; } .vial.role-base, .vial.role-root { border-color: #2a7f78; }
.vial.used { opacity: 0.35; }
.cauldron { text-align: center; padding: 22px; border-radius: 50% / 30%; background: radial-gradient(ellipse at center, color-mix(in srgb, #5ee7b0 35%, var(--surface)) 0%, var(--surface-2) 70%); font-size: 1.3rem; font-family: var(--font-read); min-height: 90px; display: grid; place-items: center; }
.brewed-word { font-size: 2rem; letter-spacing: 0.03em; }

.splitter { display: flex; flex-wrap: wrap; justify-content: center; font-family: var(--font-read); font-size: 2.2rem; margin: 20px 0; }
.split-unit { display: inline-flex; align-items: stretch; }
.letter { padding: 4px 1px; }
.gap { min-height: 56px; width: 22px; padding: 0; background: transparent; border: none; border-radius: 4px; position: relative; }
.gap::after { content: ""; position: absolute; left: 50%; top: 18%; bottom: 18%; width: 2px; background: var(--line); transform: translateX(-50%); }
.gap.cut::after { width: 4px; background: var(--accent-2); top: 0; bottom: 0; }

.checklist { display: grid; gap: 8px; margin: 10px 0; }
.check { display: flex; gap: 12px; align-items: center; background: var(--surface-2); padding: 10px 14px; border-radius: 10px; min-height: 52px; font-size: 1.02rem; }
.check input { width: 26px; height: 26px; flex: none; }
.typed-retell { margin: 10px 0; } .typed-retell summary { cursor: pointer; padding: 10px 0; color: var(--accent); }
.phrased .pause { color: var(--accent-2); font-weight: 700; }

/* strategy card */
.strategy-card { max-width: 760px; margin: 0 auto; border-top: 6px solid var(--gold); }
.card-top { display: flex; gap: 14px; align-items: center; } .card-top > div { flex: 1; } .card-icon { font-size: 2.6rem; }
.card-steps { font-size: 1.1rem; line-height: 1.6; padding-left: 1.4em; } .card-steps li { margin: 6px 0; }
.worked { background: var(--surface-2); padding: 12px 16px; border-radius: 12px; font-family: var(--font-read); font-size: calc(var(--read-size) * 0.9); }
.companion-tip { display: flex; align-items: center; gap: 10px; margin: 14px 0; font-style: italic; color: var(--ink-2); }

.artifact-reveal, .clue-step, .reflection { max-width: 680px; margin: 0 auto; text-align: center; }
.artifact-icon { font-size: 5rem; filter: drop-shadow(0 6px 18px color-mix(in srgb, var(--gold) 60%, transparent)); animation: rise 0.8s ease; }
.artifact-icon.small { font-size: 2.2rem; animation: none; }
@keyframes rise { from { transform: translateY(16px) scale(0.8); opacity: 0; } }
.lore { font-family: var(--font-read); font-style: italic; color: var(--ink-2); line-height: 1.5; }
.clue-step .pinned-note { margin: 10px auto; }
.strategies { list-style: none; padding: 0; } .reflection .choices { text-align: left; }

/* writing studio */
.studio { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); max-width: 980px; margin: 0 auto; }
.studio-steps { display: flex; gap: 6px; list-style: none; padding: 0; flex-wrap: wrap; } .studio-steps li { background: var(--surface-2); border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; color: var(--muted); }
.studio-steps li.on { background: var(--plum); color: #fff; } .studio-steps li.past { color: var(--good); }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; }
.plan-card { background: var(--surface-2); border-radius: 12px; padding: 12px; } .plan-card h4 { margin: 0 0 8px; font-family: var(--font-head); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.chip-btn { min-height: 40px; padding: 6px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 0.92rem; }
.chip-btn.on { background: var(--accent); color: var(--accent-ink); } .chip-btn.soft { background: var(--surface-2); }
.organizer { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.slot { background: var(--surface-2); border-radius: 12px; padding: 10px; min-height: 100px; } .slot h4, .slot h5 { margin: 0 0 8px; font-family: var(--font-head); }
.plan-chip { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; font-family: var(--font-read); }
.plan-chip.small { font-size: 0.85rem; padding: 4px 8px; } .plan-chip .move { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.mini-org .slot { min-height: 0; }
.auto-notes { background: var(--surface-2); border-radius: 12px; padding: 10px 14px 10px 32px; line-height: 1.5; }
blockquote { font-family: var(--font-read); font-size: calc(var(--read-size) * 0.92); line-height: 1.6; border-left: 4px solid var(--gold); margin: 10px 0; padding: 6px 14px; white-space: pre-wrap; }
.dictate .row { margin: 6px 0; }

/* ---------- Parent ---------- */
.parent { --viz-surface: #fcfcfb; max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }
.parent.loading { padding: 40px; }
.parent-login { max-width: 420px; margin: 10vh auto; background: var(--surface); padding: 28px; border-radius: 18px; box-shadow: var(--shadow); }
.parent-login form { display: grid; gap: 12px; }
.parent-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.disclaimer { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; font-size: 0.9rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.tile { background: var(--surface); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tile-v { font-size: 1.8rem; font-weight: 700; font-family: var(--font-head); } .tile-l { color: var(--muted); font-size: 0.85rem; }
.panel { background: var(--surface); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); margin: 14px 0; overflow-x: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.stack > div + div { margin-top: 18px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.suggestions li { margin: 8px 0; line-height: 1.5; }
.skills-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.skills-table th, .skills-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.skills-table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.bar { display: inline-flex; align-items: center; gap: 6px; width: 120px; } .bar-fill { height: 10px; border-radius: 0 4px 4px 0; display: block; }
.bar-v { font-variant-numeric: tabular-nums; color: var(--ink); font-size: 0.85rem; }
.s-en { background: var(--series-en); stroke: var(--series-en); fill: var(--series-en); } .s-fr { background: var(--series-fr); stroke: var(--series-fr); fill: var(--series-fr); }
.timeline svg { width: 100%; height: auto; max-height: 260px; }
.timeline .grid { stroke: var(--viz-grid); stroke-width: 1; } .timeline .axis { fill: var(--muted); font-size: 11px; }
.timeline .ln { fill: none; stroke-width: 2; } .timeline .dot { stroke: var(--surface); stroke-width: 2; } .timeline .crosshair { stroke: var(--muted); stroke-dasharray: 3 3; }
.legend { display: flex; gap: 16px; font-size: 0.88rem; color: var(--ink-2); } .sw-line { display: inline-block; width: 18px; height: 3px; vertical-align: middle; border-radius: 2px; margin-right: 6px; }
.tip { background: var(--ink); color: var(--surface); display: inline-block; padding: 6px 10px; border-radius: 8px; font-size: 0.85rem; }
.focus-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.focus-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.focus-row label { display: flex; gap: 8px; align-items: center; } .focus-row input { width: 22px; height: 22px; } .focus-row select { width: auto; min-width: 140px; }
.writing-item { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; margin: 8px 0; } .writing-item summary { cursor: pointer; }
.danger { margin-top: 16px; } .danger summary { color: #9b2c2c; cursor: pointer; }
.error { color: #9b2c2c; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .home-grid, .two-col, .focus-grid { grid-template-columns: 1fr; }
  .activity-layout { grid-template-columns: 1fr; }
  .passage-panel { position: static; max-height: 42vh; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; } .progress { width: 70px; }
  .creator, .wardrobe { grid-template-columns: 1fr; justify-items: center; }
  .organizer { grid-template-columns: 1fr; }
  .setting { grid-template-columns: 1fr; }
  .home-title h1 { font-size: 1.15rem; }
  .bins { grid-template-columns: 1fr !important; }
}
@media (forced-colors: active) { .sent.marked, .sent.speaking, .sent.selected { outline: 2px solid Highlight; } }
