/* Tongues — interface styles.
   One accent hue per language (--hue), warm paper neutrals, system fonts only (works offline). */

:root {
  --hue: 215;
  --paper: #f7f3ea;
  --card: #fffdf8;
  --raised: #ffffff;
  --ink: #1c2029;
  --soft: #565d6b;
  --line: #e0d9c8;
  --line-strong: #b9b09a;
  --as: 58%; --al: 34%; --ss: 60%; --sl: 93%;
  --plate: transparent;
  --halo: none;
  --on-accent: #ffffff;
  --good: #1f6e43;
  --good-soft: #dff1e5;
  --warn: #8a5200;
  --warn-soft: #fbeed2;
  --bad: #a93a27;
  --bad-soft: #fbe4de;
  --shadow: 0 1px 2px rgb(40 30 10 / 0.06), 0 6px 20px rgb(40 30 10 / 0.06);
  --radius: 16px;
  --pad: clamp(16px, 4vw, 28px);
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #14161b;
    --card: #1c1f26;
    --raised: #242832;
    --ink: #edeae2;
    --soft: #a9afbb;
    --line: #2f343f;
    --line-strong: #5a6170;
    --as: 68%; --al: 74%; --ss: 34%; --sl: 19%; --plate: #ece6d8; --halo: drop-shadow(0 0 1.3px rgb(255 255 255 / 0.9));
    --on-accent: #14161b;
    --good: #7bd4a0;
    --good-soft: #17301f;
    --warn: #efbf6b;
    --warn-soft: #372b13;
    --bad: #f59a88;
    --bad-soft: #3d201b;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.28);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #14161b;
  --card: #1c1f26;
  --raised: #242832;
  --ink: #edeae2;
  --soft: #a9afbb;
  --line: #2f343f;
  --line-strong: #5a6170;
  --as: 68%; --al: 74%; --ss: 34%; --sl: 19%; --plate: #ece6d8; --halo: drop-shadow(0 0 1.3px rgb(255 255 255 / 0.9));
  --on-accent: #14161b;
  --good: #7bd4a0;
  --good-soft: #17301f;
  --warn: #efbf6b;
  --warn-soft: #372b13;
  --bad: #f59a88;
  --bad-soft: #3d201b;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.28);
  color-scheme: dark;
}

*, *::before, *::after {
  box-sizing: border-box;
  --accent: hsl(var(--hue) var(--as) var(--al));
  --accent-soft: hsl(var(--hue) var(--ss) var(--sl));
}
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
#app {
  max-width: 880px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column;
  padding: 0 max(var(--pad), env(safe-area-inset-right)) 0 max(var(--pad), env(safe-area-inset-left));
}
main { flex: 1; padding-bottom: 72px; outline: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); letter-spacing: -0.015em; }
h2 { font-size: 1.3rem; }
h3 { font: 600 1rem/1.3 var(--sans); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--soft); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { flex: none; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10; background: var(--ink); color: var(--paper);
  padding: 10px 14px; border-radius: 10px; font-weight: 600;
}
.skip:focus { top: 12px; }

/* target-language text */
.tgt { font-family: var(--serif); unicode-bidi: isolate; }
.tgt[lang='he'], .tgt[lang='yi'], [lang='he'], [lang='yi'] { font-family: 'SBL Hebrew', 'Ezra SIL', 'Times New Roman', 'Arial Hebrew', serif; }
.tgt[lang='zh'], [lang='zh'] { font-family: 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif; }
.rom { color: var(--soft); font-style: italic; }
.w {
  all: unset; cursor: help; position: relative; border-bottom: 2px dotted var(--line-strong); border-radius: 2px;
}
.w:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.w:hover::after, .w:focus::after {
  content: attr(data-g); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font: 500 0.875rem/1.3 var(--sans); padding: 6px 10px; border-radius: 8px;
  white-space: nowrap; direction: ltr; z-index: 5; pointer-events: none; box-shadow: var(--shadow);
}

/* buttons and chips */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  border: 1.5px solid var(--line-strong); background: var(--card); border-radius: 999px; padding: 8px 20px; font-weight: 600;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { min-height: 52px; padding: 12px 30px; font-size: 1.05rem; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--soft); }
.btn.ghost:hover { color: var(--ink); background: var(--accent-soft); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.icon-btn {
  width: 44px; height: 44px; flex: none; display: inline-grid; place-items: center; border-radius: 50%;
  border: 1.5px solid transparent; background: transparent; color: var(--soft);
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn.sm { width: 44px; height: 44px; margin: -6px 0 -6px -8px; }
.pill {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 10px; font: 600 0.8rem/1.5 var(--sans);
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.pill.due { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--good-soft); color: var(--good); }
.eyebrow span { unicode-bidi: isolate; }
.eyebrow { font: 600 0.78rem/1.4 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); display: block; }
.section-title { font: 600 0.78rem/1.4 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); margin: 36px 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card > h2 { margin-bottom: 4px; }
.notice { margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 0.9rem; }

/* top bar */
.top { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 68px; }
.brand { font: 600 1.35rem var(--serif); letter-spacing: -0.01em; padding: 8px 4px; }
.langnav { display: flex; gap: 2px; margin-inline: auto; overflow-x: auto; scrollbar-width: none; }
.langnav a {
  min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; color: var(--soft);
  font-size: 1.02rem; white-space: nowrap;
}
.langnav a:hover { color: var(--ink); background: var(--accent-soft); }
.langnav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 2px; }
.streak { font-size: 0.875rem; color: var(--soft); padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.streak b { color: var(--ink); }

/* home */
.hero { padding: clamp(24px, 6vw, 56px) 0 clamp(20px, 4vw, 36px); max-width: 640px; }
.hero h1 { margin-top: 10px; font-size: clamp(2.1rem, 6.5vw, 3.3rem); }
.lede { margin-top: 14px; color: var(--soft); font-size: 1.1rem; }
.resume {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--accent-soft); border-radius: var(--radius); padding: 20px 22px;
}
.resume h2 { font-size: 1.6rem; margin: 2px 0; }
.resume h2 .muted { font: 500 1rem var(--sans); }
.resume-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 14px; }
.lang-card {
  display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
}
.lang-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--accent); }
.lang-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.lang-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; }
.lang-card .native { font-size: 2rem; line-height: 1.2; }
.lang-name { font-weight: 600; }
.lang-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 6; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dasharray 0.5s; }
.principles { margin-top: 48px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.principles h3 { margin-bottom: 6px; font: 600 1.1rem var(--serif); }
.principles p { color: var(--soft); font-size: 0.95rem; }

/* course */
.course-hero { position: relative; padding: 18px 0 0; overflow: hidden; }
.watermark {
  position: absolute; inset-inline-end: -6px; top: -18px; font-size: clamp(5rem, 22vw, 9rem); line-height: 1; color: var(--accent);
  opacity: 0.09; pointer-events: none; user-select: none; white-space: nowrap;
}
.course-title { display: flex; align-items: center; gap: 16px; position: relative; }
.tabs { display: flex; gap: 4px; margin-top: 20px; border-bottom: 1px solid var(--line); position: relative; }
.tabs a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; color: var(--soft); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.cta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 22px; }
.cta-grid .card + .card { margin-top: 0; }
.cta { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.cta h2 { margin: 4px 0; }
.cta .btn { align-self: flex-start; }
.cta.hot { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.unit { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-top: 10px; overflow: hidden; }
.unit summary {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; cursor: pointer; list-style: none;
}
.unit summary::-webkit-details-marker { display: none; }
.unit summary:hover { background: var(--accent-soft); }
.unit-n { font: 600 0.75rem var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); white-space: nowrap; }
.unit-t { font: 600 1.05rem var(--serif); flex: 1; min-width: 0; }
.unit-p { display: flex; align-items: center; gap: 8px; }
.caret { color: var(--soft); display: grid; transition: transform 0.2s; }
.unit[open] .caret { transform: rotate(90deg); }
.unit-body { border-top: 1px solid var(--line); }
.lesson { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 64px; border-top: 1px solid var(--line); }
.lesson:first-child { border-top: 0; }
.lesson:hover { background: var(--accent-soft); }
.lesson.next { background: var(--accent-soft); }
.lesson .num {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1.5px solid var(--line-strong); color: var(--soft); font: 600 0.875rem var(--sans);
}
.lesson.next .num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.lesson.done .num { background: var(--good-soft); border-color: transparent; color: var(--good); }
.lesson .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lesson .title { font-weight: 600; }
.lesson .go { color: var(--soft); display: grid; }
.meter { display: inline-block; height: 6px; width: 56px; border-radius: 3px; background: var(--line); overflow: hidden; flex: none; }
.meter.wide { width: 72px; }
.meter i { display: block; height: 100%; background: var(--good); border-radius: 3px; }
[dir='rtl'] .go, [dir='rtl'] .caret { transform: scaleX(-1); }

/* words */
.search { display: block; margin-top: 22px; }
.field {
  width: 100%; min-height: 52px; padding: 12px 16px; border-radius: 14px; border: 1.5px solid var(--line-strong);
  background: var(--raised); color: var(--ink); font-size: 1rem;
}
.field::placeholder { color: var(--soft); opacity: 1; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.words { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.word { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 60px; border-top: 1px solid var(--line); }
.word:first-child { border-top: 0; }
.word[hidden] { display: none; }
.word-main { display: flex; flex-direction: column; flex: 1 1 34%; min-width: 0; }
.word-main .tgt { font-size: 1.25rem; }
.word-en { flex: 1 1 36%; min-width: 0; }
.word-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.due-now { color: var(--warn); }
.res-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--good-soft); color: var(--good); flex: none; }
.word.missed .res-ic { background: var(--warn-soft); color: var(--warn); }
.empty { padding: 20px 4px; }
.empty-state { margin-top: 22px; text-align: center; display: grid; gap: 12px; justify-items: center; padding: 36px 20px; }

/* progress */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 22px 0 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stat b { display: block; font: 600 1.7rem/1.2 var(--serif); }
.stat span { color: var(--soft); font-size: 0.85rem; }
.stack-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); margin: 12px 0 10px; gap: 2px; }
.seg { min-width: 3px; }
.s3 { background: var(--good); }
.s2 { background: var(--accent); }
.s1 { background: var(--warn); }
.s0 { background: var(--line-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.875rem; color: var(--soft); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; }
.forecast { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 150px; margin-top: 14px; }
.fc { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.fc-n { font: 600 0.8rem var(--sans); min-height: 1.2em; }
.fc-bar { width: 100%; max-width: 44px; min-height: 3px; background: var(--accent); border-radius: 6px 6px 2px 2px; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 14px); grid-auto-columns: 14px; gap: 4px; margin-top: 14px; overflow-x: auto; }
.hm { border-radius: 3px; background: var(--line); }
.hm.l1 { background: hsl(var(--hue) 50% 70%); }
.hm.l2 { background: hsl(var(--hue) 55% 52%); }
.hm.l3 { background: var(--accent); }

/* lesson guide */
.crumb { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--soft); font-size: 0.9rem; margin-top: 4px; }
.crumb:hover { color: var(--accent); }
.lesson-h { margin-top: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.notes { counter-reset: n; display: grid; gap: 10px; }
.notes li {
  counter-increment: n; position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px 14px 52px; line-height: 1.6;
}
.notes li::before {
  content: counter(n); position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 700 0.8rem var(--sans);
}
.notes b { color: var(--accent); font-family: var(--serif); font-size: 1.05em; }
.preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.preview li { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-height: 60px; }
.preview-text { display: flex; flex-direction: column; min-width: 0; }
.preview .tgt { font-size: 1.2rem; }

/* dock: the action bar at the bottom of lessons, sessions and summaries */
.dock {
  position: sticky; bottom: 0; z-index: 3; background: var(--paper); border-top: 1px solid var(--line);
  box-shadow: 0 0 0 100vmax var(--paper); clip-path: inset(-1px -100vmax 0);
  padding: 12px 0 max(12px, env(safe-area-inset-bottom));
}
.dock-in { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; min-height: 56px; }
.dock-actions { display: flex; gap: 10px; margin-inline-start: auto; }
.dock.good { background: var(--good-soft); box-shadow: 0 0 0 100vmax var(--good-soft); border-color: transparent; }
.dock.warn { background: var(--warn-soft); box-shadow: 0 0 0 100vmax var(--warn-soft); border-color: transparent; }
.dock.bad { background: var(--bad-soft); box-shadow: 0 0 0 100vmax var(--bad-soft); border-color: transparent; }
.dock.good .btn.primary { background: var(--good); border-color: var(--good); }
.dock.warn .btn.primary { background: var(--warn); border-color: var(--warn); }
.dock.bad .btn.primary { background: var(--bad); border-color: var(--bad); }
.feedback { flex: 1 1 260px; min-width: 0; }
.feedback h2 { font: 700 1.05rem var(--sans); display: flex; align-items: center; gap: 8px; }
.dock.good h2 { color: var(--good); }
.dock.warn h2 { color: var(--warn); }
.dock.bad h2 { color: var(--bad); }
.fb-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: currentColor; }
.fb-ic .ic { color: var(--paper); }
.fb-line { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.fb-line .tgt { font-size: 1.4rem; }
.fb-note { margin-top: 2px; }

/* session */
.session { flex: 1; display: flex; flex-direction: column; max-width: 680px; width: 100%; margin: 0 auto; }
.session main { padding-bottom: 28px; }
.session-top { display: flex; align-items: center; gap: 10px; padding: 12px 0 20px; }
.bar { flex: 1; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width 0.3s ease; }
.count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ask { font: 600 1rem/1.4 var(--sans); color: var(--soft); letter-spacing: 0; display: flex; align-items: center; gap: 8px; }
.prompt { margin: 12px 0 26px; }
.prompt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.big { font-size: 2.9rem; line-height: 1.3; }
.big.long { font-size: 2.1rem; }
.big.xl-long { font-size: 1.6rem; line-height: 1.4; }
.prompt .en { font: 600 1.55rem/1.35 var(--serif); }
.prompt .rom { display: block; margin-top: 2px; font-size: 1.05rem; }
.gloss { margin-top: 6px; }
.intro-card {
  margin-top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  padding: 36px 22px 26px; text-align: center; display: grid; justify-items: center; gap: 6px;
}
.intro-card .mean { font: 600 1.3rem var(--serif); margin: 8px 0 6px; }
.options { display: grid; gap: 10px; }
@media (min-width: 560px) { .options.two { grid-template-columns: 1fr 1fr; } }
.option {
  display: flex; align-items: center; gap: 12px; text-align: start; width: 100%; min-height: 60px;
  background: var(--card); border: 1.5px solid var(--line-strong); border-radius: 14px; padding: 12px 16px; font-size: 1.05rem;
  box-shadow: 0 2px 0 var(--line); transition: border-color 0.12s, background 0.12s, transform 0.08s;
}
.option .tgt { font-size: 1.4rem; }
.option kbd {
  font: 600 0.75rem var(--sans); color: var(--soft); border: 1px solid var(--line-strong); border-radius: 6px;
  min-width: 22px; text-align: center; padding: 1px 6px; flex: none;
}
.option:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.option:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.option:disabled { cursor: default; box-shadow: none; }
.option.right { border-color: var(--good); background: var(--good-soft); animation: pop 0.25s ease; }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake 0.3s ease; }
.option.dim { opacity: 0.55; }
.answer-line {
  min-height: 68px; border-bottom: 2px solid var(--line-strong); padding: 8px 0 12px; display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center; margin-bottom: 20px;
}
.placeholder { color: var(--soft); }
.bank { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 46px; min-width: 46px; background: var(--card); border: 1.5px solid var(--line-strong); border-radius: 12px;
  padding: 6px 14px; font-size: 1.25rem; box-shadow: 0 2px 0 var(--line);
}
.chip.used { background: var(--line); color: transparent; box-shadow: none; border-color: transparent; }
.chip:hover:not(:disabled) { border-color: var(--accent); }
.answer { font: 1.35rem var(--serif); min-height: 60px; }
.type-hint { margin-top: 8px; }
.keys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.key {
  min-width: 44px; height: 46px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card);
  font-size: 1.25rem; box-shadow: 0 2px 0 var(--line);
}
.key:hover { border-color: var(--accent); }
.key:active { transform: translateY(2px); box-shadow: none; }
.play {
  width: 92px; height: 92px; border-radius: 50%; border: none; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.play:hover { filter: brightness(1.08); }
.play.live { animation: pulse 1.1s ease-in-out infinite; }
.mic-row { display: flex; align-items: center; gap: 18px; }

/* summary */
.summary { text-align: center; padding: 28px 0 4px; display: grid; justify-items: center; gap: 8px; }
.score-ring { position: relative; display: grid; place-items: center; margin-bottom: 8px; }
.score-ring .ring-track, .score-ring .ring-fill { stroke-width: 9; }
.score { position: absolute; font: 600 2.4rem var(--serif); }
.score small { font-size: 1.1rem; color: var(--soft); }

/* sheets */
.sheet {
  border: 0; padding: 0; width: min(560px, 100vw); max-width: 100vw; max-height: min(86dvh, 720px); margin: auto auto 0;
  border-radius: 22px 22px 0 0; background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
@media (min-width: 640px) { .sheet { margin: auto; border-radius: 22px; } }
.sheet::backdrop { background: rgb(10 12 16 / 0.5); }
.sheet[open] { animation: sheet-in 0.2s ease; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 10px 22px; position: sticky; top: 0; background: var(--card); z-index: 1; }
.sheet-body { padding: 0 22px max(22px, env(safe-area-inset-bottom)); }
.sheet-body h3 { margin: 20px 0 10px; font: 600 0.78rem var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); }
.sheet-body h3:first-child { margin-top: 4px; }
.sheet .notes li { background: var(--raised); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--line); border-radius: 14px; padding: 4px; }
.seg-btn { min-height: 44px; border: 0; border-radius: 10px; background: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; color: var(--soft); }
.seg-btn.on { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.15); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; min-height: 56px; border-top: 1px solid var(--line); cursor: pointer; }
.switch > span { display: flex; flex-direction: column; }
.switch input {
  appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--line-strong);
  position: relative; flex: none; cursor: pointer; transition: background 0.15s; margin: 0;
}
.switch input::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform 0.15s;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.sheet .btn.danger { margin-top: 12px; }

/* motion */
.stage.enter > * { animation: enter 0.22s ease both; }
.stage.enter > *:nth-child(2) { animation-delay: 0.03s; }
.stage.enter > *:nth-child(3) { animation-delay: 0.06s; }
.dock.rise { animation: rise 0.2s ease; }
.score-ring .ring-fill { animation: draw 0.9s ease-out both; }
.summary .words .word, .summary + .section-title { animation: enter 0.3s ease both; }
@keyframes draw { from { stroke-dashoffset: var(--len); } }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes pop { 50% { transform: scale(1.02); } }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 16px var(--accent-soft); } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(20px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .play.live { outline: 5px solid var(--accent-soft); }
}

@media (max-width: 600px) {
  .top { flex-wrap: wrap; row-gap: 0; }
  .langnav { order: 3; flex-basis: 100%; margin-inline: -6px; }
  .top-actions { margin-inline-start: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .big { font-size: 2.4rem; }
  .big.long { font-size: 1.8rem; }
  .big.xl-long { font-size: 1.4rem; }
  .word { flex-wrap: wrap; row-gap: 2px; }
  .word-en { flex-basis: 100%; order: 5; padding-inline-start: 0; color: var(--soft); }
  .dock-note { display: none; }
  .dock-actions { flex: 1; }
  .dock-actions .btn { flex: 1; }
  .unit-n { display: none; }
}
@media (hover: none) { .dock-note { display: none; } }

/* right-to-left words sit in left-to-right lists: keep one reading edge */
.preview-text > .tgt, .word-main > .tgt { text-align: left; }
main:focus, main:focus-visible { outline: none; }

/* pictures and artwork */
.pic, .pic-in, .pic-sm { font-style: normal; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; line-height: 1; }
.intro-card .pic { font-size: 4.2rem; margin-bottom: 6px; }
.pic-in { margin-inline-end: 10px; font-size: 1.1em; }
.pic-sm { margin-inline-start: auto; font-size: 1.5rem; padding-inline-start: 8px; }
.options.pics { grid-template-columns: 1fr 1fr; }
.option.tile { flex-direction: column; justify-content: center; text-align: center; gap: 8px; min-height: 148px; position: relative; padding: 18px 12px 14px; }
.option.tile kbd { position: absolute; top: 10px; inset-inline-start: 10px; }
.option.tile .pic { font-size: 3.4rem; }
.hero { display: flex; align-items: center; gap: 24px; max-width: none; }
.hero-text { flex: 1 1 0; min-width: 0; max-width: 640px; }
.hero-art { order: 2; position: relative; width: 250px; height: 230px; flex: none; }
.glyph {
  position: absolute; width: 96px; height: 116px; border-radius: 18px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); border: 1.5px solid var(--accent); box-shadow: var(--shadow);
  font-size: 3.2rem; line-height: 1;
}
.glyph .tgt { font-weight: 600; }
.g0 { left: 4px; top: 22px; transform: rotate(-9deg); }
.g1 { left: 78px; top: 0; transform: rotate(4deg); z-index: 1; }
.g2 { left: 150px; top: 30px; transform: rotate(10deg); }
.g3 { left: 38px; top: 108px; transform: rotate(5deg); z-index: 2; }
.g4 { left: 118px; top: 114px; transform: rotate(-6deg); z-index: 3; }
.lang-card:hover .native { color: var(--accent); }
@media (max-width: 760px) { .hero-art { display: none; } }

/* characters and custom pictures */
.pic, .pic-in, .pic-sm { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.pic .art, .pic-in .art, .pic-sm .art { width: 100%; height: 100%; display: block; object-fit: contain; }
.intro-card .pic { width: 104px; height: 104px; margin-bottom: 4px; font-size: 0; }
.option.tile .pic { width: 76px; height: 76px; font-size: 0; }
.pic-in { width: 1.5em; height: 1.5em; vertical-align: -0.35em; margin-inline-end: 10px; }
.pic-sm { width: 36px; height: 36px; margin-inline-start: auto; padding: 0; }
.char { display: inline-block; width: 96px; height: 96px; flex: none; line-height: 0; }
.char-svg, .char-img { width: 100%; height: 100%; display: block; overflow: visible; }
.char-img { object-fit: cover; border-radius: 50%; background: #f7f3ea; }
img.char-img { object-fit: contain; border-radius: 0; background: none; }
.char.sm { width: 56px; height: 56px; }
.char.lg { width: 132px; height: 132px; }
.char.host { width: 84px; height: 84px; }
.char.idle .char-svg { animation: bob 3.4s ease-in-out infinite; transform-origin: 50% 100%; }
.char.happy .char-svg { animation: hop 0.7s cubic-bezier(0.3, 0, 0.3, 1) 2; transform-origin: 50% 100%; }
.char.oops .char-svg { animation: sway 0.9s ease-in-out 1; transform-origin: 50% 100%; }
/* Generated stills move as a whole paper cut-out: they breathe from the feet, hop, sway and tilt. */
img.char-img { transform-origin: 50% 96%; will-change: transform; }
.char picture { display: block; width: 100%; height: 100%; }
/* A stop-motion loop already moves; it only gets the entrance hop, not the breathing. */
.char.idle img.moving, .char.think img.moving { animation: none; }
.char.happy img.moving { animation: hop 0.7s cubic-bezier(0.3, 0, 0.3, 1) 1; }
.char.idle img.char-img { animation: paper-breathe 3.6s ease-in-out infinite; }
.char.happy img.char-img { animation: hop 0.7s cubic-bezier(0.3, 0, 0.3, 1) 2, paper-breathe 3.6s ease-in-out 1.4s infinite; }
.char.oops img.char-img { animation: sway 0.9s ease-in-out 1, paper-breathe 4.4s ease-in-out 0.9s infinite; }
.char.think img.char-img { animation: ponder 2.8s ease-in-out infinite; }
@keyframes paper-breathe { 0%, 100% { transform: scale(1, 1) rotate(0); } 45% { transform: scale(0.985, 1.03) rotate(-1.2deg); } 70% { transform: scale(1.01, 0.99) rotate(0.8deg); } }

@keyframes bob { 50% { transform: translateY(-3px) scaleY(1.015); } }
@keyframes hop { 30% { transform: translateY(2px) scale(1.06, 0.92); } 60% { transform: translateY(-16px) scale(0.96, 1.06) rotate(-4deg); } }
@keyframes sway { 20% { transform: rotate(-7deg); } 50% { transform: rotate(6deg); } 80% { transform: rotate(-3deg); } }
@keyframes tilt { 50% { transform: rotate(5deg); } }
.hero-cast { order: 2; display: flex; align-items: flex-end; flex: none; padding-inline-start: 8px; }
.hero-cast .char { width: 112px; height: 112px; margin-inline-start: -10px; }
.hero-cast .c1 { width: 132px; height: 132px; }
.hero-cast .c0, .hero-cast .c4 { width: 104px; height: 104px; }
.hero-cast .c2 .char-svg, .hero-cast .c2 img { animation-delay: -1.2s; }
.hero-cast .c3 .char-svg, .hero-cast .c3 img { animation-delay: -2.1s; }
.hero-cast .c4 .char-svg, .hero-cast .c4 img { animation-delay: -0.6s; }
.hero-scene { order: 2; width: min(460px, 46%); flex: none; animation: paper-breathe 5s ease-in-out infinite; transform-origin: 50% 96%; }
.scene-img { width: min(420px, 100%); animation: enter 0.5s ease-out both; }
.cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.cast-card { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.cast-card .char { width: 72px; height: 72px; }
.cast-card h3 { font: 600 1.05rem var(--serif); }
.cast-card h3 .muted { font: 400 0.875rem var(--sans); }
.cast-card p { font-size: 0.9rem; margin-top: 2px; }
.course-title .course-name { flex: 1; min-width: 0; }
.guide-head { display: flex; align-items: center; gap: 10px; margin: 30px 0 10px; }
.guide-head .section-title { margin: 0; }
.intro-card { position: relative; }
.char.corner { position: absolute; inset-inline-end: 12px; bottom: 10px; width: 60px; height: 60px; }
.char.react { width: 84px; height: 84px; align-self: flex-end; margin-bottom: -6px; }
.fb-say { margin-top: 1px; font-style: italic; }
.saying { display: flex; align-items: center; gap: 10px; max-width: 460px; text-align: start; margin-top: 6px; }
.saying p { font: italic 1.05rem/1.4 var(--serif); }
.saying p span { font: 400 0.875rem var(--sans); }
.empty-state .char { margin-bottom: -6px; }
@media (max-width: 760px) { .hero-cast, .hero-scene { display: none; } }
@media (max-width: 600px) {
  .char.react { width: 60px; height: 60px; position: absolute; inset-inline-end: 0; top: -44px; margin: 0; }
  .dock-in { position: relative; }
  .char.host { width: 64px; height: 64px; }
}

/* gap-fill, memory hooks, rating, goal */
.cloze { font-size: 1.9rem; line-height: 1.6; margin-top: 10px; }
.gap { display: inline-block; min-width: 3.2em; border-bottom: 3px solid var(--accent); height: 1.2em; vertical-align: baseline; margin: 0 0.15em; }
.gap.filled { height: auto; min-width: 0; border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 0 0.3em; font-weight: 600; }
.fb-yours s { text-decoration-thickness: 2px; }
.fb-line .tgt { font-size: 1.7rem; }
.fb-hook { margin-top: 6px; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 7%, transparent); display: inline-block; }
.hook-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.hook-row .field { flex: 1 1 220px; min-height: 44px; padding: 8px 12px; font-size: 0.95rem; }
.rate-q { align-self: center; margin-inline-end: 4px; }
.dock-actions { flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.sheet .sheet-actions .btn.danger { margin-top: 0; }
.goal { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.goal-text { display: flex; flex-direction: column; flex: 1 1 180px; }
.week { display: flex; gap: 8px; }
.wk { display: grid; justify-items: center; gap: 3px; }
.wk i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); }
.wk.some i { border-color: var(--accent); background: var(--accent-soft); }
.wk.full i { border-color: var(--accent); background: var(--accent); }
.hm-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.hm-legend .hm { width: 12px; height: 12px; display: inline-block; }

/* on-screen keyboard: an even grid with space and delete */
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.key { width: 100%; min-width: 0; display: grid; place-items: center; }
.key.wide { grid-column: span 3; font: 500 0.9rem var(--sans); }

/* fixes from the independent design review */
@media (min-width: 761px) and (min-height: 720px) {
  .session main.stage { display: flex; flex-direction: column; justify-content: center; padding-bottom: 6vh; }
}
@media (hover: none) { .option kbd { display: none; } }
.w:hover::after, .w:focus::after { bottom: auto; top: calc(100% + 8px); }
.langnav { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); padding-inline-end: 20px; }
@media (max-width: 600px) {
  .watermark { display: none; }
  .word { flex-wrap: nowrap; }
  .word-en { flex-basis: auto; order: 0; }
  .word-main { flex: 1 1 40%; }
  .word-meta .meter { width: 36px; }
  .rate-q { flex-basis: 100%; text-align: center; }
  .week { width: 100%; justify-content: space-between; }
}
@media (max-width: 440px) {
  .word { flex-wrap: wrap; row-gap: 0; }
  .word-en { flex-basis: 100%; order: 5; padding-inline-start: 40px; color: var(--soft); }
  .words .word > .icon-btn + .word-main + .word-en { padding-inline-start: 56px; }
}


/* second design review: bigger characters, dark-mode backing, script sizes */
.pic { background: var(--plate); border-radius: 16px; }
.intro-card .pic, .option.tile .pic { padding: 6px; }
.pic-in, .pic-sm { background: var(--plate); border-radius: 8px; }
.char { background: radial-gradient(circle at 50% 56%, var(--plate) 0 62%, transparent 63%); }
.char.corner { width: 92px; height: 92px; inset-inline-end: 14px; bottom: 12px; }
.char.react { width: 108px; height: 108px; }
.char.xl { width: 150px; height: 150px; }
.finish { display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
.ask-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.char.ask-host { width: 64px; height: 64px; }
.sheet .guide-head { margin: 0 0 10px; }
.watermark { display: none; }
.tgt.big[lang='he'], .tgt.big[lang='yi'], .cloze[lang='he'], .cloze[lang='yi'] { font-size: 3.4rem; }
.tgt.big.long[lang='he'], .tgt.big.long[lang='yi'] { font-size: 2.5rem; }
.tgt.big.xl-long[lang='he'], .tgt.big.xl-long[lang='yi'] { font-size: 1.9rem; }
.option .tgt[lang='he'], .option .tgt[lang='yi'], .chip[lang='he'], .chip[lang='yi'] { font-size: 1.7rem; }
.option .tgt[lang='zh'], .chip[lang='zh'] { font-size: 1.6rem; }
.remind { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.remind .field { width: auto; min-height: 44px; padding: 6px 10px; }
@media (max-width: 600px) {
  .char.react { position: absolute; top: 4px; inset-inline-end: 0; width: 60px; height: 60px; margin: 0; }
  .feedback h2, .fb-say, .fb-yours { padding-inline-end: 66px; }
  .char.corner { width: 72px; height: 72px; }
  .char.xl { width: 110px; height: 110px; }
  .char.ask-host { width: 52px; height: 52px; }
  .intro-card { padding-bottom: 90px; }
}


/* character rigs: each part moves on its own */
.char-svg g, .char-svg path, .char-svg polygon { transform-box: fill-box; }
.char-svg .eye { transform-origin: 50% 50%; animation: blink 4.6s infinite; }
.char-svg .eye + .eye { animation-delay: 0.02s; }
.char-svg .tail { transform-origin: 0% 100%; animation: wag 2.6s ease-in-out infinite; }
.char-svg .ear-l { transform-origin: 60% 100%; animation: twitch 5.4s ease-in-out infinite; }
.char-svg .ear-r { transform-origin: 40% 100%; animation: twitch 5.4s ease-in-out 0.25s infinite reverse; }
.char-svg .head { transform-origin: 50% 100%; }
.char-svg .head.neck { transform-origin: 85% 100%; }
.char-svg .wing { transform-origin: 0% 100%; animation: settle 3.8s ease-in-out infinite; }
.char-svg .heart { transform-origin: 50% 50%; animation: beat 1.5s ease-in-out infinite; }
.char-svg .body { transform-origin: 50% 100%; animation: breathe 3.4s ease-in-out infinite; }
.char-svg .spark { transform-origin: 50% 50%; animation: twinkle 0.7s ease-in-out infinite alternate; }
.char-svg .spark + .spark { animation-delay: 0.25s; }
.char-svg .spark + .spark + .spark { animation-delay: 0.45s; }
.char-svg .drop { animation: fall 1.3s ease-in infinite; }
.char-svg .qmark { transform-origin: 50% 100%; animation: bobq 1.6s ease-in-out infinite; }
.char.idle .head { animation: look 6.5s ease-in-out infinite; }
.char.think .head { animation: ponder 2.8s ease-in-out infinite; }
.char.happy .head { animation: nod 0.45s ease-in-out 4; }
.char.happy .tail { animation-duration: 0.32s; }
.char.happy .wing { animation: flap 0.22s ease-in-out 8; }
.char.happy .ear-l, .char.happy .ear-r { animation-duration: 0.6s; }
.char.oops .head { animation: shake 0.5s ease-in-out 2; }
.char.oops .ear-l { animation: droop-l 0.5s ease-out forwards; }
.char.oops .ear-r { animation: droop-r 0.5s ease-out forwards; }
.char.oops .tail { animation: none; transform: rotate(14deg); }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96.5% { transform: scaleY(0.08); } }
@keyframes wag { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(7deg); } }
@keyframes twitch { 0%, 88%, 100% { transform: rotate(0); } 92% { transform: rotate(-9deg); } 96% { transform: rotate(4deg); } }
@keyframes settle { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-4deg); } }
@keyframes flap { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-26deg); } }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.22); } 24% { transform: scale(1); } 36% { transform: scale(1.14); } }
@keyframes breathe { 50% { transform: scaleY(1.025); } }
@keyframes twinkle { from { transform: scale(0.5) rotate(-10deg); opacity: 0.5; } to { transform: scale(1.15) rotate(8deg); opacity: 1; } }
@keyframes fall { 0% { transform: translateY(-3px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(16px); opacity: 0; } }
@keyframes bobq { 50% { transform: translateY(-3px) rotate(6deg); } }
@keyframes look { 0%, 60%, 100% { transform: rotate(0); } 70%, 84% { transform: rotate(4deg); } }
@keyframes ponder { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(6deg); } }
@keyframes nod { 50% { transform: rotate(5deg) translateY(2px); } }
@keyframes shake { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@keyframes droop-l { to { transform: rotate(-22deg); } }
@keyframes droop-r { to { transform: rotate(22deg); } }

/* charms and celebration */
.charm { width: 44px; height: 44px; flex: none; }
.charms { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 12px; }
.charms li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
.charms li > span { display: flex; flex-direction: column; min-width: 0; }
.charms li.locked b { color: var(--soft); font-weight: 600; }
.new-charms { display: grid; gap: 8px; margin-top: 4px; }
.new-charm { display: flex; align-items: center; gap: 12px; text-align: start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; box-shadow: var(--shadow); animation: enter 0.4s ease 0.5s both; }
.new-charm .charm { width: 56px; height: 56px; animation: spin-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.6s both; }
.new-charm > div { display: flex; flex-direction: column; }
.summary { position: relative; overflow: hidden; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; opacity: 0; animation: confetti 2.2s ease-in forwards; }
@keyframes confetti { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--x), 360px) rotate(calc(var(--r) + 540deg)); } }
@keyframes spin-in { from { transform: scale(0.2) rotate(-200deg); opacity: 0; } }


/* third design review */
.char { background: none; }
.char-svg, img.char-img { filter: var(--halo); }
.dock-in { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px 18px; align-items: center; }
.dock-in > .dock-note { grid-column: 1 / span 2; }
.dock-actions { grid-column: 3; justify-self: end; margin: 0; }
.char.react { align-self: center; margin: 0; width: 116px; height: 116px; }
.feedback { min-width: 0; }
.hook-row .field { flex: 1 1 280px; }
@media (min-width: 761px) and (min-height: 720px) {
  .session main.stage { justify-content: flex-start; padding-top: 5vh; }
}
.intro-card { padding-bottom: 108px; }
.char.xl { width: 190px; height: 190px; }
.new-charm { animation-delay: 0.1s; }
.new-charm .charm { animation-delay: 0.2s; }
.btn.rate { flex-direction: column; gap: 0; line-height: 1.15; padding-block: 6px; min-width: 76px; }
.btn.rate .small { font-weight: 500; opacity: 0.85; font-size: 0.78rem; }
.hero.compact { padding: 22px 0 14px; justify-content: space-between; }
.hero.compact h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); }
.hero.compact .char { order: 2; }
.sheet-actions.start { justify-content: flex-start; margin-top: 10px; }
label.btn { cursor: pointer; }
label.btn:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (max-width: 760px) {
  .hero { flex-wrap: wrap; }
  .hero-cast { display: flex; order: 3; width: 100%; justify-content: center; padding: 0; margin-top: 4px; }
  .hero-scene { display: block; order: 3; width: min(380px, 100%); margin: 4px auto 0; }
  .hero-cast .char { width: 62px; height: 62px; margin-inline-start: -8px; }
  .hero-cast .c1 { width: 76px; height: 76px; }
  .hero-cast .c0, .hero-cast .c4 { width: 56px; height: 56px; }
}
@media (max-width: 600px) {
  .dock-in { grid-template-columns: minmax(0, 1fr); }
  .dock-actions { grid-column: 1; justify-self: stretch; }
  .char.react { width: 60px; height: 60px; }
  .char.xl { width: 130px; height: 130px; }
  .hero.compact .char { width: 84px; height: 84px; }
}
/* feedback gets the full width; its buttons sit on their own row */
@media (min-width: 601px) {
  .dock.good .dock-in, .dock.warn .dock-in, .dock.bad .dock-in { grid-template-columns: auto minmax(0, 1fr); }
  .dock.good .dock-actions, .dock.warn .dock-actions, .dock.bad .dock-actions { grid-column: 1 / -1; justify-self: end; }
}

/* The home scene sits beside the headline only when there is room for both. */
@media (max-width: 1020px) {
  .hero:not(.compact) { flex-wrap: wrap; }
  .hero:not(.compact) .hero-text { flex-basis: 100%; max-width: none; }
  .hero-scene { display: block; order: 3; width: min(460px, 100%); margin: 8px auto 0; }
}

/* postcards */
.post { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin: 14px 0; border: 1.5px dashed var(--line, #d9d2c0); border-radius: var(--radius); background: var(--card, #fffdf7); text-align: start; }
.post > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.post.arrived { border-style: solid; border-color: var(--accent); }
.post > svg { flex: none; color: var(--accent); }
.postcard { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.postcard-art .char { width: 180px; height: 180px; }
.postcard-art .scene-img { width: min(360px, 100%); }
.postcard-text { font-family: var(--serif, Georgia, serif); font-size: 1.15rem; line-height: 1.55; max-width: 34em; margin: 0; }
.cards-grid { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.card-thumb { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 6px; border: 1.5px solid var(--line, #d9d2c0); border-radius: 12px; background: var(--plate, #fffdf7); cursor: pointer; overflow: hidden; }
.card-thumb .char { width: 100%; height: 100%; }
.card-thumb .scene-img { width: 100%; }
.card-thumb img { animation: none !important; }
.card-thumb.sealed { cursor: default; border-style: dashed; color: var(--muted, #8a8473); background: none; }
.card-thumb .dot { position: absolute; top: 6px; inset-inline-end: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

.intro-say { margin: 0 0 6px; font-style: italic; }

/* scenes */
.scene-head { padding: 8px 0 4px; }
.scene-head h1 { margin: 2px 0 10px; }
.scene-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.scene-lines { list-style: none; padding: 0; margin: 18px 0; display: flex; flex-direction: column; gap: 14px; }
.scene-lines .line { display: flex; align-items: flex-end; gap: 10px; }
.scene-lines .line.alt { flex-direction: row-reverse; }
.scene-lines .char { width: 64px; height: 64px; }
.scene-lines .bubble { display: flex; flex-direction: column; gap: 3px; max-width: min(520px, 78%); padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 18px 18px 18px 4px; background: var(--card); }
.scene-lines .line.alt .bubble { border-radius: 18px 18px 4px 18px; background: var(--accent-soft); }
.scene-lines .who { font-weight: 700; color: var(--accent); }
.scene-lines .line-t { font-family: var(--serif); font-size: 1.35rem; line-height: 1.35; }
.scene-ask h2 { margin-top: 0; }
.scene-ask .options { display: grid; gap: 10px; }
.scene-ask .option.right { border-color: #3d8a55; background: color-mix(in srgb, #3d8a55 14%, var(--card)); }
.scene-ask .option.wrong { border-color: #b4483a; background: color-mix(in srgb, #b4483a 12%, var(--card)); }
.scene-verdict { margin: 14px 0 0; font-weight: 600; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.scene-row.locked { opacity: 0.7; cursor: default; }

.scene-ask .option { display: flex; align-items: center; gap: 12px; text-align: start; }
.num-key { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line-strong); border-radius: 7px; font-size: 0.85rem; color: var(--muted, #6b6657); }
.btn.rate { white-space: nowrap; }
