/* SpeakTO visual system: transit-signage.
   Near-monochrome, maximum contrast; the only color is functional
   (line colors, the red mic, feedback states). Single face: Inter. */

:root {
  --paper: #eef1f6;
  --card: #ffffff;
  --card-2: #f4f6fa;
  --ink: #1a2130;
  --muted: #5b6472;
  --hairline: #dde3ec;
  --primary: #0b7d4e;
  --primary-edge: #075c39;
  --blue: #0b7d4e;
  --blue-deep: #075c39;
  --blue-tint: #e0f2e9;
  --red: #d0271f;
  --red-edge: #a31c15;
  --red-ink: #ad1f18;
  --ok: #14683f;
  --ok-tint: #e0f2e9;
  --warn: #7d5800;
  --warn-tint: #f5eed6;
  --miss-tint: #f8e2df;
  --xp: #b45309;
  --line1: #dfa800; --line2: #00923f; --line3: #0082c9; --line4: #8e4b9e; --line5: #e03a2e;
  --shadow: 0 1px 2px rgba(26, 33, 48, .05), 0 10px 28px -14px rgba(26, 33, 48, .18);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --r: 22px;
  --display: "Inter", -apple-system, "Segoe UI", sans-serif;
  --body: "Inter", -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  --paper: #101319;
  --card: #1a1f2a;
  --card-2: #232937;
  --ink: #f0f2f7;
  --muted: #9aa4b5;
  --hairline: #2d3546;
  --primary: #2fbf71;
  --primary-edge: #1f8a52;
  --blue: #2fbf71;
  --blue-deep: #7ADCA9;
  --blue-tint: #17352a;
  --red: #f2655c;
  --red-edge: #b23b33;
  --red-ink: #f58b82;
  --ok: #4bc988;
  --ok-tint: #143024;
  --warn: #e3b93c;
  --warn-tint: #322d12;
  --miss-tint: #40201d;
  --xp: #fbbf24;
  --line1: #f5c518; --line4: #b06cc2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -12px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); line-height: 1.08; letter-spacing: -.015em; margin: 0; }

.shell { max-width: 720px; margin: 0 auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }

/* ---------- top bar ---------- */
.top {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 2px 10px;
}
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: 1.35rem;
  letter-spacing: -.02em; display: flex; align-items: center; gap: 2px;
  color: var(--ink); text-decoration: none;
}
.wordmark .to {
  background: var(--red); color: #fff; border-radius: 7px;
  padding: 0 5px; margin-left: 3px; font-size: 1.05rem; line-height: 1.5;
}
.top .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 5px 12px; font-size: .82rem; font-weight: 700;
  color: var(--muted);
}
.chip strong { color: var(--ink); }
.iconbtn {
  background: var(--card); border: 1px solid var(--hairline); border-radius: 999px;
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  transition: transform .3s var(--spring), background .2s;
}
.iconbtn:active { transform: scale(.9); }

/* ---------- generic cards & buttons ---------- */
.card {
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 16px; padding: 14px 22px;
  font-weight: 800; font-size: 1rem; cursor: pointer; letter-spacing: -.01em;
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 0 var(--primary-edge);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--primary-edge); }
.btn.small { padding: 9px 16px; font-size: .85rem; border-radius: 13px; box-shadow: 0 3px 0 var(--primary-edge); }
.btn.small:active { transform: translateY(3px); }
:root[data-theme="dark"] .btn { color: #07271a; }
:root[data-theme="dark"] .btn.quiet, :root[data-theme="dark"] .btn.ghost { color: var(--ink); }
.btn.ghost { background: var(--card); color: var(--ink); border: 2px solid var(--hairline); box-shadow: 0 4px 0 var(--hairline); }
.btn.quiet { background: var(--card-2); color: var(--ink); border: 1.5px solid var(--hairline); box-shadow: 0 4px 0 var(--hairline); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }

.eyebrow {
  font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}

/* ---------- home ---------- */
.hero { margin: 8px 0 18px; }
.hero h1 { font-size: clamp(1.05rem, 3.6vw, 1.35rem); font-weight: 700; margin-top: 14px; }
.hero p { color: var(--muted); margin: 8px 0 0; max-width: 46ch; }

/* Split-flap departure board (Union Station Solari board) */
.board { display: flex; gap: 4px; margin: 10px 0 4px; perspective: 700px; }
.flap {
  flex: 1; max-width: 48px; aspect-ratio: .78; position: relative; overflow: hidden;
  background: #14181d; color: #f4f7f9; border-radius: 6px;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(.95rem, 3.6vw, 1.6rem);
  transform-origin: 50% 50%;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .07), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.flap::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px;
  background: rgba(0, 0, 0, .55);
}
.flap.flip { animation: flap .16s ease-out; }
@keyframes flap { from { transform: rotateX(-82deg); } to { transform: rotateX(0); } }

/* Page-load choreography */
@keyframes fadeup { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
#view > .hero { animation: fadeup .45s both; }
#view .today .card { animation: fadeup .45s .05s both; }
#view .today .card:nth-child(2) { animation-delay: .11s; }
.mapsign { animation: fadeup .45s .16s both; }
#view .phase { animation: fadeup .45s .2s both; }
#view > .card, #view > .stub { animation: fadeup .35s both; }
.today { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-bottom: 22px; }
.today .card { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.today .big { font-family: var(--display); font-size: 1.9rem; font-weight: 800; line-height: 1; }
.today .sub { color: var(--muted); font-size: .85rem; }
.today .btn { margin-top: auto; }
@media (max-width: 430px) { .today { grid-template-columns: 1fr; } }

/* ---------- the line map (signature) ---------- */
/* Station sign: black TTC-style strip with the five line dots */
.mapsign {
  background: #14181d; color: #fff; border-radius: 14px; padding: 13px 16px;
  display: flex; align-items: center; gap: 12px; margin: 26px 0 12px;
  font-family: var(--display); font-weight: 800; letter-spacing: .09em; font-size: .92rem;
}
.mapsign h2 { font-size: clamp(.72rem, 2.6vw, .92rem); letter-spacing: .09em; white-space: nowrap; }
.ms-dots { display: flex; gap: 4px; }
.ms-dots i { width: 10px; height: 10px; border-radius: 50%; }
.ms-count { margin-left: auto; color: #9fb4c4; font-size: clamp(.62rem, 2.2vw, .78rem); white-space: nowrap; }
.phase { margin: 14px 0; }
.phase summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.phase summary::-webkit-details-marker { display: none; }
.linebadge {
  min-width: 34px; height: 34px; border-radius: 10px; color: #fff;
  display: grid; place-items: center; font-family: var(--display); font-weight: 800;
}
.linebadge.l1 { background: var(--line1); color: #231a00; }
.phase summary .ph-name { font-weight: 800; font-family: var(--display); font-size: 1.02rem; }
.phase summary .ph-range { color: var(--muted); font-size: .8rem; }
.phase summary .ph-count { margin-left: auto; font-size: .8rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.stations { margin: 6px 0 0 16px; padding: 8px 0 4px; position: relative; }
.stations::before {
  content: ""; position: absolute; left: 16px; top: 0; bottom: 0; width: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--lc, var(--blue)) 22%, var(--paper));
}
/* Line fills with your progress, like a route lighting up */
.stations::after {
  content: ""; position: absolute; left: 16px; top: 0; width: 6px;
  height: var(--fill, 0%); border-radius: 3px; background: var(--lc, var(--blue));
  transition: height .8s cubic-bezier(.22, 1, .36, 1);
}
.station {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 9px 8px 9px 40px; border-radius: 12px; cursor: pointer;
  border: 0; background: transparent; width: 100%; text-align: left;
}
.station:hover { background: var(--card); }
.station .dot {
  position: absolute; left: 11px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper); border: 4px solid var(--lc, var(--blue));
}
.station.done .dot { background: var(--lc, var(--blue)); box-shadow: inset 0 0 0 3px var(--paper); }
.station.next .dot { background: var(--card); animation: stpulse 1.8s ease-out infinite; }
@keyframes stpulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--lc) 50%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}
.station .s-num { font-family: var(--display); font-weight: 800; color: var(--muted); min-width: 2.2em; font-size: .9rem; }
.station .s-title { font-weight: 700; }
.station .s-focus { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; }
.station .s-check { margin-left: auto; color: var(--ok); font-weight: 800; }
.station.next .s-badge {
  margin-left: auto; font-size: .7rem; font-weight: 800; letter-spacing: .08em;
  background: var(--blue-tint); color: var(--blue-deep); padding: 3px 9px; border-radius: 999px;
}

/* ---------- session ---------- */
.sess-top { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.sess-top .back { flex-shrink: 0; }
.sess-meta { min-width: 0; }
.sess-meta .t { font-family: var(--display); font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-meta .f { color: var(--muted); font-size: .8rem; }
.progress { display: flex; gap: 5px; margin: 0 0 16px; }
.progress i { flex: 1; height: 5px; border-radius: 3px; background: var(--hairline); }
.progress i.on { background: var(--blue); }
.progress i.half { background: linear-gradient(90deg, var(--blue) 50%, var(--hairline) 50%); }

.stagechip {
  display: inline-flex; align-items: center; gap: 7px; font-size: .74rem; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; color: var(--blue-deep);
  background: var(--blue-tint); border-radius: 999px; padding: 4px 12px; margin-bottom: 12px;
}

.sentence {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.25rem, 4.5vw, 1.6rem); line-height: 1.45; margin: 6px 0 14px;
  min-height: 3em;
}
.sentence .w { border-radius: 6px; padding: 1px 3px; margin: 0 -1px; transition: background .12s, color .12s; }
.sentence .w.now { background: var(--primary); color: #fff; }
:root[data-theme="dark"] .sentence .w.now { color: #07271a; }
.sentence .w.ok { background: var(--ok-tint); color: var(--ok); }
.sentence .w.near { background: var(--warn-tint); color: var(--warn); }
.sentence .w.miss { background: var(--miss-tint); color: var(--red-ink); text-decoration: underline wavy; text-underline-offset: 3px; }
.sentence .blank {
  color: var(--blue); font-weight: 800; letter-spacing: .05em;
  border-bottom: 3px solid var(--blue); line-height: 1;
}

.coachrow { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.coach { flex-shrink: 0; }
.coach svg { display: block; }
.coach .mouth { transition: rx .09s ease, ry .09s ease; }
.coach.talking svg { animation: bob .5s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }

/* Metronome beat indicator: four beats, accent on the one */
.beats { display: flex; gap: 8px; justify-content: center; margin: 2px 0 10px; }
.beats i {
  width: 9px; height: 9px; border-radius: 50%; background: var(--hairline);
  transition: transform .09s, background .09s;
}
.beats i.on { background: var(--red); transform: scale(1.4); }

.pacer { display: flex; gap: 8px; margin: 10px 0 14px; flex-wrap: wrap; }
.pace-opt {
  flex: 1; min-width: 100px; border: 1.5px solid var(--hairline); background: var(--card-2);
  border-radius: 12px; padding: 9px 6px; cursor: pointer; text-align: center;
  transition: transform .3s var(--spring), border-color .15s, background .15s;
}
.pace-opt:active { transform: scale(.94); }
.pace-opt .p-name { font-family: var(--display); font-weight: 800; font-size: .9rem; display: block; }
.pace-opt .p-wpm { color: var(--muted); font-size: .74rem; }
.pace-opt { box-shadow: 0 3px 0 var(--hairline); }
.pace-opt:active { transform: translateY(3px); box-shadow: none; }
.pace-opt.sel { border-color: var(--primary-edge); background: var(--primary); box-shadow: 0 3px 0 var(--primary-edge); }
.pace-opt.sel .p-name, .pace-opt.sel .p-wpm { color: #fff; }
:root[data-theme="dark"] .pace-opt.sel .p-name, :root[data-theme="dark"] .pace-opt.sel .p-wpm { color: #07271a; }

.controls { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.controls .btn { flex: 1; min-width: 130px; }

/* mic */
.micwrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 16px 0 6px; }
.mic {
  width: 78px; height: 78px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--red); color: #fff; display: grid; place-items: center;
  box-shadow: 0 5px 0 var(--red-edge);
  transition: transform .08s ease, box-shadow .08s ease;
}
.mic:active { transform: translateY(5px); box-shadow: 0 0 0 var(--red-edge); }
.mic.listening { animation: pulse 1.2s ease-out infinite; background: var(--blue); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--blue) 45%, transparent); }
  100% { box-shadow: 0 0 0 22px transparent; }
}
.mic-hint { color: var(--muted); font-size: .85rem; text-align: center; }
.heard { color: var(--muted); font-size: .9rem; text-align: center; min-height: 1.4em; font-style: italic; }

.scorebar { display: flex; align-items: center; gap: 14px; margin: 12px 0; }
.ring { position: relative; width: 62px; height: 62px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring .arc { transition: stroke-dashoffset .7s cubic-bezier(.22, 1, .36, 1); }
.ring .val {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 1.05rem;
}
.score-note { font-size: .9rem; }
.score-note strong { font-family: var(--display); }

/* scaffold panels */
.scaffold { border-radius: 14px; padding: 14px 16px; margin: 12px 0; font-size: .92rem; }
.scaffold.s1 { background: var(--warn-tint); }
.scaffold.s2 { background: var(--blue-tint); }
.scaffold.s3 { background: var(--miss-tint); }
.scaffold .sc-title { font-weight: 800; font-family: var(--display); display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.stress { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.stress b {
  background: var(--card); border: 1px solid var(--hairline); border-radius: 8px;
  padding: 3px 8px; font-family: var(--display);
}
.stress b.hit { border-color: var(--blue); color: var(--blue-deep); }
.artic { display: flex; gap: 14px; align-items: center; margin-top: 10px; }
.artic svg { flex-shrink: 0; }
.artic p { margin: 0; font-size: .88rem; }

/* grading */
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.grade {
  border: 1.5px solid var(--hairline); background: var(--card-2); border-radius: 12px;
  box-shadow: 0 3px 0 var(--hairline);
  padding: 10px 4px; cursor: pointer; text-align: center;
  transition: transform .3s var(--spring), border-color .15s;
}
.grade:active { transform: scale(.92); }
.grade .g-name { font-weight: 800; font-family: var(--display); font-size: .88rem; display: block; }
.grade .g-ivl { color: var(--muted); font-size: .7rem; }
.grade.suggest { border-color: var(--blue); background: var(--blue-tint); }
.grade.g1 .g-name { color: var(--red-ink); }
.grade.g4 .g-name { color: var(--ok); }

/* transfer stub (level complete) */
.stub {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 22px 20px; text-align: center; position: relative; overflow: hidden;
  border: 1px solid var(--hairline);
}
.stub::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 8px;
  background: repeating-linear-gradient(90deg, var(--line1) 0 20%, var(--line2) 0 40%, var(--line3) 0 60%, var(--line4) 0 80%, var(--line5) 0 100%);
}
.stub .punch { border-top: 2px dashed var(--hairline); margin: 16px -20px; position: relative; }
.stub .punch::before, .stub .punch::after {
  content: ""; position: absolute; top: -11px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--paper);
}
.stub .punch::before { left: -11px; } .stub .punch::after { right: -11px; }
.stub h2 { font-size: 1.5rem; margin: 14px 0 2px; }
.stub .meta { color: var(--muted); font-size: .85rem; }
.stub .bigscore { font-family: var(--display); font-weight: 800; font-size: 3rem; color: var(--blue); }
.stub .stats { display: flex; justify-content: center; gap: 26px; margin: 8px 0 2px; font-size: .85rem; color: var(--muted); }
.stub .stats strong { display: block; font-family: var(--display); font-size: 1.15rem; color: var(--ink); }

/* ---------- review ---------- */
.due-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.due-empty .glyph { font-size: 2.4rem; margin-bottom: 8px; }

/* ---------- phrasebook ---------- */
.pb-tabs { display: flex; gap: 8px; margin: 4px 0 16px; }
.pb-tab {
  border: 1.5px solid var(--hairline); background: var(--card-2); border-radius: 999px;
  padding: 8px 18px; font-weight: 800; cursor: pointer; font-size: .88rem;
}
.pb-tab.sel { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pb-item { padding: 14px 16px; margin-bottom: 10px; }
.pb-item .formal { color: var(--muted); font-size: .85rem; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 45%, transparent); }
.pb-item .local { font-family: var(--display); font-weight: 700; font-size: 1.05rem; margin: 4px 0; }
.pb-item .note { color: var(--muted); font-size: .82rem; }
.pb-item .dom {
  font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--blue-deep); background: var(--blue-tint); border-radius: 999px; padding: 2px 9px;
}
.lingo-w { font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--blue-deep); }
.lingo-ex { color: var(--muted); font-style: italic; font-size: .85rem; margin-top: 4px; }
.pb-say {
  float: right; border: 0; background: var(--blue-tint); color: var(--blue-deep);
  border-radius: 10px; width: 36px; height: 36px; cursor: pointer; font-size: 1rem;
  transition: transform .3s var(--spring);
}

/* ---------- bottom nav ---------- */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--hairline);
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; max-width: 130px; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; border-radius: 12px; color: var(--muted);
  font-size: .68rem; font-weight: 800; letter-spacing: .04em;
  transition: transform .3s var(--spring);
}
.tab:active { transform: scale(.9); }
.tab svg { width: 22px; height: 22px; }
.tab.sel { color: var(--blue); }

.note-banner {
  background: var(--warn-tint); color: var(--warn); border-radius: 12px;
  padding: 10px 14px; font-size: .84rem; margin: 10px 0; font-weight: 700;
}

/* ---------- profile ---------- */
.field { display: block; margin: 12px 0; }
.field span { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field input {
  width: 100%; padding: 13px 14px; border-radius: 14px; font: inherit;
  border: 1.5px solid var(--hairline); background: var(--card-2); color: var(--ink);
}
.field input:focus { outline: 3px solid var(--ink); outline-offset: 1px; }
.form-err { color: var(--red-ink); font-size: .85rem; font-weight: 700; min-height: 1.2em; margin: 4px 0 8px; }

.pcard .prow { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.avatarbtn {
  width: 66px; height: 66px; border-radius: 50%; border: 2px solid var(--hairline);
  background: var(--card-2); font-size: 2rem; cursor: pointer; flex-shrink: 0;
  transition: transform .3s var(--spring);
}
.avatarbtn:active { transform: scale(.9); }
.pname { font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; }
.pmeta { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.leaguechip {
  display: inline-block; margin-top: 6px; font-size: .7rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; padding: 3px 10px;
  border-radius: 999px; background: var(--ink); color: var(--paper);
}
.statgrid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  border-top: 1px solid var(--hairline); padding-top: 14px; text-align: center;
}
.statgrid strong { display: block; font-size: 1.25rem; font-weight: 800; }
.statgrid span { color: var(--muted); font-size: .7rem; font-weight: 600; }
@media (max-width: 380px) { .statgrid { grid-template-columns: repeat(2, 1fr); } }

.psec { margin-top: 12px; }
.goalbar { height: 10px; border-radius: 5px; background: var(--hairline); overflow: hidden; }
.goalbar i { display: block; height: 100%; border-radius: 5px; background: var(--ok); transition: width .6s cubic-bezier(.22,1,.36,1); }
.goalchips { display: flex; gap: 8px; }
.goalchip {
  flex: 1; padding: 10px 4px; border-radius: 12px; font-weight: 800; font-size: .85rem;
  border: 1.5px solid var(--hairline); background: var(--card-2); cursor: pointer;
  transition: transform .3s var(--spring);
}
.goalchip:active { transform: scale(.92); }
.goalchip.sel { background: var(--primary); color: #fff; border-color: var(--primary-edge); }
:root[data-theme="dark"] .goalchip.sel { color: #07271a; }

.lbrow { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 10px; }
.lbrow.you { background: var(--blue-tint); }
.lbrank { font-weight: 800; color: var(--muted); min-width: 1.6em; }
.lbav { font-size: 1.2rem; }
.lbname { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbxp { margin-left: auto; font-weight: 800; font-size: .85rem; }

.achgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ach {
  border: 1.5px solid var(--hairline); border-radius: 14px; padding: 12px;
  opacity: .45; filter: grayscale(1);
}
.ach.got { opacity: 1; filter: none; border-color: var(--ok); background: var(--ok-tint); }
.achem { font-size: 1.5rem; display: block; }
.achname { font-weight: 800; font-size: .85rem; display: block; margin-top: 4px; }
.achdesc { color: var(--muted); font-size: .72rem; display: block; }

footer.appfoot { margin: 34px 0 8px; text-align: center; color: var(--muted); font-size: .78rem; }
footer.appfoot button { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .78rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ---------- splash & onboarding ---------- */
.tabs.hidden { display: none; }
.splash-in { min-height: 78dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 12px; }
.splash-in .coach svg { animation: floaty 2.8s ease-in-out infinite; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.sp-title { font-size: 2.4rem; font-weight: 900; letter-spacing: -.03em; display: flex; align-items: center; gap: 3px; }
.sp-title .to { background: var(--red); color: #fff; border-radius: 10px; padding: 0 8px; font-size: 1.9rem; }
.sp-tag { color: var(--muted); max-width: 34ch; margin: 0 0 14px; }
.splash-in .btn.wide { max-width: 320px; }
.linklike { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .88rem; padding: 10px; }
.obchips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 380px; }
.obchip {
  padding: 14px 18px; border-radius: 16px; border: 2px solid var(--hairline);
  background: var(--card); font-weight: 800; cursor: pointer; font-size: .95rem;
  box-shadow: 0 4px 0 var(--hairline); transition: transform .08s, box-shadow .08s;
}
.obchip:active { transform: translateY(4px); box-shadow: none; }
.ob-q { font-size: 1.3rem; font-weight: 900; margin: 4px 0 14px; }

/* ---------- guided plan ---------- */
.homehero { margin-bottom: 4px; }
.homehero .coachrow { margin: 4px 0 0; }
.speech {
  background: var(--card); border: 1.5px solid var(--hairline); border-radius: 18px;
  border-bottom-left-radius: 4px; padding: 12px 16px; font-size: .95rem;
  box-shadow: var(--shadow);
}
.plan { margin: 14px 0 4px; }
.planrow { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 14px; }
.planrow.cur { background: var(--blue-tint); }
.planrow .pdot {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card-2); border: 2px solid var(--hairline); font-size: 1.05rem; flex-shrink: 0;
}
.planrow.done .pdot { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); font-weight: 900; }
.planrow .plabel { font-weight: 700; font-size: .95rem; min-width: 0; }
.planrow.done .plabel { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.planrow .go { margin-left: auto; flex-shrink: 0; }

/* ---------- prepare (situations) ---------- */
.sitgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.sitcard {
  position: relative; text-align: left; cursor: pointer; padding: 16px 14px 14px;
  background: var(--card); border: 1.5px solid var(--hairline); border-radius: 20px;
  box-shadow: 0 4px 0 var(--hairline); transition: transform .08s, box-shadow .08s;
  overflow: hidden;
}
.sitcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--sc, var(--primary)); }
.sitcard:active { transform: translateY(4px); box-shadow: none; }
.sitemoji { font-size: 1.9rem; display: block; margin-bottom: 6px; }
.sittitle { font-weight: 800; display: block; }
.sittag { color: var(--muted); font-size: .76rem; display: block; margin-top: 2px; }
.sitprog { display: inline-block; margin-top: 8px; font-size: .7rem; font-weight: 800; color: var(--primary); background: var(--blue-tint); border-radius: 999px; padding: 2px 9px; }
.culture {
  background: var(--warn-tint); border-radius: 16px; padding: 14px 16px; font-size: .9rem; margin: 12px 0;
}
.culture strong { display: block; margin-bottom: 4px; }
.modecard {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--hairline); border-radius: 18px;
  padding: 15px 16px; margin: 10px 0; box-shadow: 0 4px 0 var(--hairline);
  transition: transform .08s, box-shadow .08s;
}
.modecard:active { transform: translateY(4px); box-shadow: none; }
.modecard .m-emoji { font-size: 1.6rem; }
.modecard .m-title { font-weight: 800; display: block; }
.modecard .m-desc { color: var(--muted); font-size: .8rem; display: block; }
.modecard .m-check { margin-left: auto; font-weight: 900; color: var(--ok); font-size: 1.1rem; }
.sitbar { height: 12px; border-radius: 6px; background: var(--hairline); overflow: hidden; margin: 6px 0 16px; }
.sitbar i { display: block; height: 100%; border-radius: 6px; background: var(--primary); transition: width .5s cubic-bezier(.22,1,.36,1); }
.usenote {
  background: var(--blue-tint); color: var(--blue-deep); border-radius: 12px;
  padding: 10px 14px; font-size: .88rem; font-weight: 600; margin: 4px 0 12px;
}
.modelcard { background: var(--ok-tint); border-radius: 14px; padding: 14px 16px; margin: 12px 0; }
.modelcard .m-say { font-weight: 800; font-size: 1.05rem; }
.modelcard .m-tip { color: var(--muted); font-size: .82rem; margin-top: 6px; }
.cuecard { background: var(--card-2); border: 1.5px dashed var(--hairline); border-radius: 14px; padding: 14px 16px; margin: 6px 0 12px; font-weight: 700; }

/* chat role-play */
.chat { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.bubble { max-width: 86%; padding: 11px 15px; border-radius: 18px; line-height: 1.4; font-size: .95rem; animation: fadeup .3s both; }
.bubble.them { background: var(--card-2); border: 1.5px solid var(--hairline); align-self: flex-start; border-bottom-left-radius: 5px; }
.bubble.you { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
:root[data-theme="dark"] .bubble.you { color: #07271a; }
.yourline { border-top: 1.5px dashed var(--hairline); padding-top: 12px; margin-top: 4px; }
.yourline .eyebrow { color: var(--primary); }

/* ---------- xp toast ---------- */
.toast {
  position: fixed; top: 14px; left: 50%; z-index: 99;
  transform: translateX(-50%) translateY(-90px);
  background: var(--ink); color: var(--paper);
  padding: 11px 22px; border-radius: 999px; font-weight: 800; font-size: .95rem;
  box-shadow: var(--shadow); transition: transform .45s var(--spring);
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

.stub { animation: pop .5s var(--spring) both; }
@keyframes pop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* word repository */
.searchbar {
  width: 100%; padding: 13px 16px; border-radius: 16px; font: inherit; margin-bottom: 10px;
  border: 1.5px solid var(--hairline); background: var(--card); color: var(--ink);
}
.catchips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.catchip {
  border: 1.5px solid var(--hairline); background: var(--card); border-radius: 999px;
  padding: 7px 14px; font-weight: 700; font-size: .82rem; cursor: pointer;
  box-shadow: 0 2px 0 var(--hairline);
}
.catchip.sel { background: var(--primary); color: #fff; border-color: var(--primary-edge); box-shadow: 0 2px 0 var(--primary-edge); }
:root[data-theme="dark"] .catchip.sel { color: #07271a; }


/* ---------- compact lines card (home) + station-grid map screen ---------- */
.msbtn { width: 100%; border: 0; cursor: pointer; text-align: left; }
.lines { padding: 8px 12px; margin-bottom: 4px; }
.linesrow {
  display: grid; grid-template-columns: 44px 1fr auto; grid-template-rows: auto auto;
  column-gap: 12px; row-gap: 6px; align-items: center;
  width: 100%; background: transparent; border: 0; padding: 10px 6px;
  border-radius: 14px; cursor: pointer; text-align: left;
}
.linesrow:hover { background: var(--card-2); }
.linesrow .linebadge { grid-row: 1 / 3; }
.lname { font-weight: 800; font-size: .92rem; min-width: 0; }
.lcount { color: var(--muted); font-weight: 700; font-size: .8rem; }
.lbar { grid-column: 2 / 4; height: 9px; border-radius: 5px; background: var(--hairline); overflow: hidden; }
.lbar i { display: block; height: 100%; border-radius: 5px; background: var(--lc); transition: width .6s cubic-bezier(.22,1,.36,1); }

.map-phase { margin: 22px 0 8px; }
.mp-head { display: flex; gap: 12px; align-items: center; }
.mp-head b { font-size: 1rem; }
.mp-sub { color: var(--muted); font-size: .78rem; }
.dotgrid { display: flex; flex-wrap: wrap; gap: 9px; padding: 12px 0 2px; }
.stn {
  width: 44px; height: 44px; border-radius: 50%; padding: 0;
  border: 3px solid var(--lc); background: var(--card); color: var(--ink);
  font-weight: 800; font-size: .85rem; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 3px 0 var(--hairline);
  transition: transform .08s ease, box-shadow .08s ease;
}
.stn:active { transform: translateY(3px); box-shadow: none; }
.stn.future { border-color: var(--hairline); color: var(--muted); }
.stn.done { background: var(--lc); border-color: var(--lc); }
.stn.next { animation: stpulse 1.8s ease-out infinite; }
.stn.sel { outline: 3px solid var(--ink); outline-offset: 2px; }
.stn-detail .card { margin: 10px 0 2px; animation: fadeup .25s both; }
.sd-title { font-weight: 800; }
.sd-meta { color: var(--muted); font-size: .82rem; margin: 2px 0 12px; }

/* locked stations */
.stn.lock {
  border-color: var(--hairline); background: var(--card-2); color: var(--muted);
  box-shadow: none; font-size: .8rem;
}

/* map accordion: one line open at a time */
.mp-head {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: var(--card); border: 1.5px solid var(--hairline); border-radius: 18px;
  padding: 12px 14px; cursor: pointer; box-shadow: 0 3px 0 var(--hairline);
  transition: transform .08s ease, box-shadow .08s ease;
}
.mp-head:active { transform: translateY(3px); box-shadow: none; }
.mp-head b { display: block; }
.mp-sub { display: block; }
.mp-chev { margin-left: auto; color: var(--muted); font-size: 1.15rem; transition: transform .2s; }
.map-phase.open .mp-chev { transform: rotate(180deg); }
.map-phase { margin: 12px 0; }
.mp-body { display: none; }
.map-phase.open .mp-body { display: block; animation: fadeup .25s both; }

/* v6: superapp pass */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sentence.veiled .w { filter: blur(7px); cursor: pointer; }
.sentence.veiled::after {
  content: "👂 Listen first, then tap to read"; display: block;
  font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-top: 6px; filter: none;
}
.privline { color: var(--muted); font-size: .78rem; }
.clbnote { color: var(--muted); font-size: .78rem; margin: -4px 0 10px; }
.field select {
  width: 100%; padding: 13px 14px; border-radius: 14px; font: inherit;
  border: 1.5px solid var(--hairline); background: var(--card-2); color: var(--ink);
}
[dir="rtl"] .sess-meta, [dir="rtl"] .speech { text-align: right; }

/* accessibility & mobile polish pass */
html { -webkit-tap-highlight-color: transparent; }
#view:focus { outline: none; }
.iconbtn { width: 40px; height: 40px; }
.pb-say { width: 40px; height: 40px; }
.catchip { padding: 9px 15px; }

/* settings controls */
.checkrow { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .92rem; padding: 8px 0 2px; cursor: pointer; }
.checkrow input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--primary); cursor: pointer; }

/* daily drills */
.pairbtns { display: flex; gap: 12px; justify-content: center; }
.pairbtn {
  flex: 1; max-width: 160px; padding: 22px 10px; border-radius: 18px; cursor: pointer;
  font-weight: 800; font-size: 1.25rem; font-family: var(--display);
  background: var(--card-2); border: 2px solid var(--hairline); box-shadow: 0 4px 0 var(--hairline);
  transition: transform .08s, box-shadow .08s, background .15s, border-color .15s;
}
.pairbtn:active { transform: translateY(4px); box-shadow: none; }
.pairbtn.hit { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); }
.pairbtn.miss { background: var(--miss-tint); border-color: var(--red); color: var(--red-ink); }
.chunkline {
  min-height: 62px; border: 2px dashed var(--hairline); border-radius: 14px;
  padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 12px;
}
.chunkbank { display: flex; flex-wrap: wrap; gap: 8px; min-height: 50px; }
.chunk {
  padding: 10px 14px; border-radius: 12px; cursor: pointer; font-weight: 700; font-size: .95rem;
  background: var(--card); border: 1.5px solid var(--hairline); box-shadow: 0 3px 0 var(--hairline);
  transition: transform .08s, box-shadow .08s;
}
.chunk:active { transform: translateY(3px); box-shadow: none; }
.chunk.placed { background: var(--blue-tint); border-color: var(--primary); color: var(--blue-deep); }


/* free talk */
.chatrow { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.chatrow .searchbar { flex: 1; margin: 0; }
.bubble.typing { opacity: .55; letter-spacing: 4px; animation: pulse-soft 1s ease-in-out infinite; }
@keyframes pulse-soft { 0%, 100% { opacity: .35; } 50% { opacity: .75; } }
#ftChat { max-height: 46vh; overflow-y: auto; }

/* profile pill tabs */
.ptabs { gap: 6px; margin: 14px 0; flex-wrap: nowrap; overflow-x: auto; }
.ptabs .pb-tab { flex: 1; padding: 9px 8px; font-size: .78rem; text-align: center; white-space: nowrap; }

/* ---------- microinteractions & light animation pass ---------- */
/* header mark */
.wordmark .mark { margin-right: 7px; border-radius: 8px; transition: transform .3s var(--spring); }
.wordmark:hover .mark, .wordmark:active .mark { transform: rotate(-8deg) scale(1.06); }

/* the coach blinks */
.coach .eye { transform-box: fill-box; transform-origin: center; animation: blink 4.6s infinite; }
.coach .eye:last-of-type { animation-delay: .05s; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95%, 97% { transform: scaleY(.08); } }

/* streak flame breathes when alive */
.chip.lit { animation: flamebreathe 2.6s ease-in-out infinite; }
@keyframes flamebreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* tab icon pops when selected */
.tab.sel svg { animation: tabpop .35s var(--spring); }
@keyframes tabpop { 0% { transform: scale(.7); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* gentle screen fade on every route change */
#view.vin { animation: viewin .22s ease; }
@keyframes viewin { from { opacity: .35; } to { opacity: 1; } }

/* hover lift for tactile cards and buttons (desktop) */
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(4px); }
.sitcard:hover, .modecard:hover, .mp-head:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--hairline); }
.sitcard:active, .modecard:active, .mp-head:active { transform: translateY(4px); box-shadow: none; }

/* live word highlight pops slightly */
.sentence .w { display: inline-block; }
.sentence .w.now { transform: scale(1.07); }
.sentence .w.gradepop { animation: gradepop .3s var(--spring); }
@keyframes gradepop { 0% { transform: translateY(0); } 45% { transform: translateY(-4px); } 100% { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .sentence .w.gradepop { animation: none; } }

/* completed plan steps pop in */
.planrow.done .pdot { animation: pop .4s var(--spring); }

/* suggested grade glows for attention, twice, then rests */
.grade.suggest { animation: suggestglow 1.4s ease-in-out 2; }
@keyframes suggestglow {
  0%, 100% { box-shadow: 0 3px 0 var(--hairline); }
  50% { box-shadow: 0 3px 0 var(--primary-edge), 0 0 0 4px var(--blue-tint); }
}

/* chunk lands with a pop */
.chunk.placed { animation: pop .3s var(--spring); }

/* maple leaf burst on completions */
.leafburst { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.leafburst span {
  position: absolute; left: 50%; top: 42%; font-size: 1.35rem; opacity: 0;
  animation: leaffly 1.9s ease-out forwards;
}
@keyframes leaffly {
  0% { transform: translate(-50%, 0) rotate(0deg) scale(.6); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), -150px) rotate(var(--dr)) scale(1.1); opacity: 0; }
}

/* ---- auth screen ---- */
.authcard { text-align: left; width: 100%; max-width: 360px; margin: 10px auto 4px; }
.gwrap { display: flex; justify-content: center; min-height: 0; }
.gwrap:empty { display: none; }
.ordiv { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 12px 0 4px; }
.ordiv[hidden] { display: none; }
.ordiv::before, .ordiv::after { content: ""; flex: 1; border-top: 1px solid var(--line, rgba(128,128,128,.25)); }
.sitcard.gated { opacity: .55; }
.sitcard.gated .sittag::after { content: "Free with an account"; font-weight: 700; display: block; margin-top: 2px; }
.linklike.danger { color: #c0392b; }
