/* Wayword: a quiet base, with each language's accent used only where it means something
   (the active tab, your progress, the pronunciation line, the main button). */

:root {
  --accent: #4f46e5;
  --accent-2: #f59e0b;
  --bg: #f6f4ef;
  --surface: #fffdf9;
  --surface-2: #f0ede6;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --faint: #9a9aa0;
  --line: #e7e2d9;
  --radius: 18px;
  --tint: color-mix(in srgb, var(--accent) 7%, var(--surface));
  --tint-strong: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --accent-ink: color-mix(in srgb, var(--accent) 72%, #1d1d1f);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-native: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Hebrew", "Noto Naskh Arabic", "Geeza Pro", sans-serif;
  --nav-h: 64px;
  --player-h: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121316;
    --surface: #1a1c21;
    --surface-2: #23262d;
    --ink: #ededf0;
    --muted: #a0a3ab;
    --faint: #73767e;
    --line: #2b2e36;
    --tint: color-mix(in srgb, var(--accent) 12%, var(--surface));
    --tint-strong: color-mix(in srgb, var(--accent) 22%, var(--surface));
    --accent-ink: color-mix(in srgb, var(--accent) 55%, white);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.has-player { --player-h: 112px; }
body.sheet-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, p { margin: 0; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.i-play, .pl-main .ic, [data-action="hear-native"] .ic { fill: currentColor; stroke-width: 1.2; }

#app { max-width: 640px; margin: 0 auto; min-height: 100dvh; }
.main { padding: 4px 16px calc(var(--nav-h) + var(--player-h) + 40px + env(safe-area-inset-bottom)); }
.main.home { padding-bottom: 40px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(14px);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand::after { content: "."; color: var(--accent); }
.lang-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-weight: 700; font-size: 15px; margin-right: auto;
  white-space: nowrap; overflow: hidden; min-width: 0;
}
.lang-chip-name { overflow: hidden; text-overflow: ellipsis; }
.chip-switch { width: 16px; height: 16px; color: var(--faint); }
.glyph {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-family: var(--font-native); font-size: 14px; font-weight: 700; flex: none;
}
.toggles { display: flex; gap: 6px; }
.tog {
  min-width: 42px; height: 38px; border-radius: 12px; font-weight: 800; font-size: 13px;
  border: 1px solid var(--line); background: var(--surface); color: var(--faint);
  text-decoration: line-through; text-decoration-thickness: 1.5px;
}
.tog.on { color: var(--accent-ink); background: var(--tint); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); text-decoration: none; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--muted); flex: none; }
.icon-btn.quiet { color: var(--muted); }
.topbar > .icon-btn { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }

/* ---------- bottom nav ---------- */
.bottomnav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 30;
  width: min(624px, calc(100% - 16px)); height: var(--nav-h);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 5px; border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.3) blur(18px); -webkit-backdrop-filter: saturate(1.3) blur(18px);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgb(0 0 0 / .08);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border-radius: 16px; font-size: 11px; font-weight: 700; color: var(--faint);
}
.bottomnav a.on { color: var(--accent-ink); background: var(--tint); }

/* ---------- home ---------- */
.home-hero { padding: 22px 4px 24px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.home-hero h1 { font-size: clamp(30px, 8.5vw, 40px); line-height: 1.08; letter-spacing: -.03em; margin-top: 8px; font-weight: 800; }
.continue {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 18px; padding: 11px 14px 11px 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--accent-ink); font-weight: 700;
}
.continue .ic { width: 18px; height: 18px; }
/* visa page: faint guilloché lines, one ink stamp per language */
.visa-page {
  position: relative; border-radius: 22px; padding: 18px 14px 22px;
  background:
    repeating-radial-gradient(circle at 20% 0%, transparent 0 11px, color-mix(in srgb, var(--ink) 4%, transparent) 11px 12px),
    repeating-radial-gradient(circle at 90% 100%, transparent 0 13px, color-mix(in srgb, var(--ink) 3%, transparent) 13px 14px),
    var(--surface);
  border: 1px solid var(--line);
}
.visa-label { position: absolute; top: 12px; right: 16px; font-size: 11px; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; color: var(--faint); }
.stamps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; padding-top: 14px; }
.stamp {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1px;
  padding: 14px 10px 12px; color: color-mix(in srgb, var(--accent) 85%, var(--ink));
  border: 2.5px solid currentColor; outline: 1px solid currentColor; outline-offset: -7px;
  transform: rotate(var(--rot)); opacity: .9;
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  transition: transform .2s ease, opacity .2s;
}
.stamp.shape-0 { border-radius: 18px; }
.stamp.shape-1 { border-radius: 50% / 38%; padding-inline: 16px; }
.stamp.shape-2 { border-radius: 6px; border-style: double; border-width: 5px; outline: 0; }
.stamp:active { transform: rotate(var(--rot)) scale(.97); }
.stamp-region { font-size: 9.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; max-width: 100%; line-height: 1.25; overflow-wrap: anywhere; }
.stamp-glyph {
  display: grid; place-items: center; width: 38px; height: 38px; margin: 6px 0 4px; border-radius: 50%;
  border: 1.5px dashed currentColor; font-family: var(--font-native); font-size: 18px; font-weight: 800;
}
.stamp-native { font-family: var(--font-native); font-size: 19px; font-weight: 800; line-height: 1.2; }
.stamp-name { font-size: 12px; font-weight: 700; opacity: .85; }
.stamp-foot { margin-top: 6px; padding-top: 4px; border-top: 1px dashed currentColor; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.stamp.stamping { animation: stamp-press .42s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stamp-press {
  0% { transform: rotate(var(--rot)) scale(1); }
  35% { transform: rotate(calc(var(--rot) * .3)) scale(1.12); opacity: .7; }
  70% { transform: rotate(var(--rot)) scale(.94); opacity: 1; background: color-mix(in srgb, var(--accent) 14%, transparent); }
  100% { transform: rotate(var(--rot)) scale(1); opacity: 1; background: color-mix(in srgb, var(--accent) 10%, transparent); }
}

/* passport cover intro */
body.intro-on { overflow: hidden; }
#intro {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; align-content: center; gap: 22px;
  background: var(--bg); cursor: pointer; transition: opacity .45s ease;
}
#intro.done { opacity: 0; pointer-events: none; }
.passport {
  position: relative; width: min(58vw, 250px); aspect-ratio: .7; perspective: 1600px;
  transform: scale(.92); opacity: 0; transition: transform .9s cubic-bezier(.6, .05, .3, 1), opacity .35s ease;
}
#intro.in .passport { transform: scale(1); opacity: 1; }
#intro.open .passport { transform: translateX(50%) scale(.9); }
.pp-page, .pp-front, .pp-back { position: absolute; inset: 0; border-radius: 6px 14px 14px 6px; }
.pp-page {
  padding: 22px 18px; display: grid; align-content: start; gap: 2px;
  background:
    repeating-radial-gradient(circle at 30% 20%, transparent 0 9px, rgb(30 60 110 / .06) 9px 10px),
    #f5f0e3;
  color: #2a3550; box-shadow: inset 6px 0 12px rgb(0 0 0 / .08), 0 16px 40px rgb(0 0 0 / .18);
}
.pp-page-k { font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #8a8471; margin-top: 10px; }
.pp-page-v { font-size: 15px; font-weight: 700; font-family: var(--font); }
.pp-cover { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; transition: transform 1s cubic-bezier(.6, .05, .3, 1); }
#intro.open .pp-cover { transform: rotateY(-178deg); }
.pp-front, .pp-back { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.pp-front {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 26px 16px 22px;
  background:
    radial-gradient(120% 90% at 30% 20%, rgb(255 255 255 / .07), transparent 60%),
    radial-gradient(rgb(0 0 0 / .18) 1px, transparent 1.5px) 0 0 / 5px 5px,
    #1d2a4a;
  color: #d9bd74; box-shadow: 0 20px 50px rgb(0 0 0 / .3), inset -3px 0 0 rgb(0 0 0 / .25);
}
.pp-back { transform: rotateY(180deg); background: #f5f0e3; box-shadow: inset -6px 0 12px rgb(0 0 0 / .08); }
.pp-title { font-size: 21px; font-weight: 800; letter-spacing: .32em; text-transform: uppercase; padding-left: .32em; }
.pp-emblem { width: 58%; fill: none; stroke: currentColor; stroke-width: 1.6; }
.pp-emblem .fill { fill: currentColor; stroke: none; }
.pp-sub { font-size: 11px; font-weight: 700; letter-spacing: .08em; font-style: italic; opacity: .9; text-align: center; }
.pp-chip { width: 34px; fill: none; stroke: currentColor; stroke-width: 1.4; opacity: .8; }
.intro-hint { font-size: 13px; font-weight: 600; color: var(--faint); opacity: 0; transition: opacity .3s .5s; }
#intro.in .intro-hint { opacity: 1; }
#intro.open .intro-hint { opacity: 0; transition-delay: 0s; }

.fine { text-align: center; color: var(--faint); font-size: 13px; margin-top: 28px; }

/* ---------- language home ---------- */
.lang-hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: 14px;
  padding: 18px; margin: 4px 0 12px; border-radius: 22px;
  background: var(--tint); border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
}
.lang-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .06; color: var(--accent); }
.hero-text { flex: 1; min-width: 0; }
.hero-native { font-family: var(--font-native); font-size: clamp(28px, 8vw, 38px); font-weight: 800; line-height: 1.2; margin-top: 4px; }
.hero-native[dir="rtl"] { text-align: left; }
.ring {
  --pct: 0;
  flex: none; width: 78px; height: 78px; border-radius: 50%;
  display: grid; place-content: center; text-align: center;
  background:
    radial-gradient(closest-side, var(--tint) 80%, transparent 82% 100%),
    conic-gradient(var(--accent) calc(var(--pct) * 1%), color-mix(in srgb, var(--accent) 14%, transparent) 0);
}
.ring strong { font-size: 20px; line-height: 1; }
.ring small { font-size: 12px; color: var(--muted); }
.ring span { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }

/* faint motifs, drawn in the accent color */
:root[data-motif="tiles"] .lang-hero::before { background: conic-gradient(from 45deg, currentColor 0 25%, transparent 0 50%, currentColor 0 75%, transparent 0) 0 0 / 28px 28px; }
:root[data-motif="sun"] .lang-hero::before { background: repeating-radial-gradient(circle at 90% 10%, transparent 0 14px, currentColor 15px 17px); }
:root[data-motif="stripes"] .lang-hero::before { background: repeating-linear-gradient(90deg, currentColor 0 8px, transparent 8px 24px); }
:root[data-motif="dots"] .lang-hero::before { background: radial-gradient(currentColor 2.5px, transparent 3.5px) 0 0 / 18px 18px; }
:root[data-motif="diamond"] .lang-hero::before { background: linear-gradient(135deg, currentColor 25%, transparent 25%) -12px 0 / 24px 24px, linear-gradient(225deg, currentColor 25%, transparent 25%) -12px 0 / 24px 24px; }
:root[data-motif="star"] .lang-hero::before { background: conic-gradient(currentColor 0 12.5%, transparent 0 25%, currentColor 0 37.5%, transparent 0 50%, currentColor 0 62.5%, transparent 0 75%, currentColor 0 87.5%, transparent 0) 0 0 / 30px 30px; }
:root[data-motif="waves"] .lang-hero::before { background: radial-gradient(circle at 50% 100%, transparent 0 8px, currentColor 8px 9.5px, transparent 9.5px 13px, currentColor 13px 14.5px, transparent 14.5px 18px, currentColor 18px 19.5px, transparent 19.5px) 0 0 / 40px 20px; }
:root[data-motif="stone"] .lang-hero::before { background: linear-gradient(currentColor 1.5px, transparent 1.5px) 0 0 / 100% 22px, linear-gradient(90deg, currentColor 1.5px, transparent 1.5px) 0 0 / 44px 22px; }

.tierwrap { margin: 6px 0 4px; }
.tierbar {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px;
  border-radius: 14px; background: var(--surface-2);
}
.tier-btn { min-height: 42px; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.tier-btn small { font-size: 11px; font-weight: 600; color: var(--faint); }
.tier-btn.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.tier-btn.on small { color: var(--accent-ink); }
.tier-blurb { font-size: 13px; color: var(--faint); text-align: center; margin-top: 6px; }

/* sections and grouped rows */
.sect { margin-top: 30px; }
.sect-head { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 8px; min-height: 28px; }
.sect-head h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.link-btn { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 14px; color: var(--accent-ink); min-height: 36px; padding: 0 4px; }
.link-btn .ic { width: 17px; height: 17px; }
.link-btn.center { display: flex; margin: 10px auto 0; }

.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.group + .group { margin-top: 12px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px;
  text-align: left; border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row:active { background: var(--surface-2); }
.row.static { min-height: 48px; padding-bottom: 4px; }
.row[data-empty] { opacity: .45; }
.row-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--tint); color: var(--accent-ink); flex: none; }
.row-ic .ic { width: 19px; height: 19px; }
.row-ic.emoji { font-size: 18px; background: var(--surface-2); }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 700; font-size: 15px; }
.row-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-count { font-size: 13px; font-weight: 700; color: var(--faint); }
.row-chev { width: 16px; height: 16px; color: var(--faint); }
.row-check { width: 20px; height: 20px; color: var(--accent-ink); }
.row.picked { background: var(--tint); }
.seg-wrap { padding: 0 14px 14px; }
.notes-group { padding: 4px 0; }
.about-row { padding: 10px 14px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); }
.about-row:first-child { border-top: 0; }
.reading { margin: 0; padding: 10px 14px 10px 32px; font-size: 14px; color: var(--muted); display: grid; gap: 6px; }

.scen-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; scroll-snap-type: x proximity; }
.scen-row::-webkit-scrollbar { display: none; }
.scen-btn {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 86px; height: 86px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
  font-size: 12px; font-weight: 700; text-align: center; padding: 6px; scroll-snap-align: start; color: var(--muted);
}
.scen-ic { font-size: 26px; line-height: 1; }
.scen-ic.big { font-size: 32px; }
.scen-ic.huge { font-size: 42px; }

/* ---------- page heads, chips, search ---------- */
.page-head { padding: 10px 2px 14px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: 15px; }
.scen-head { display: flex; align-items: center; gap: 14px; }

.search { position: relative; margin: 12px 0 10px; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 19px; }
.search input {
  width: 100%; min-height: 48px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); padding: 0 14px 0 42px; font-size: 16px; outline: none;
}
.search input:focus { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: 0 0 0 3px var(--tint-strong); }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 6px; padding: 2px 16px 8px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--muted);
}
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.count { font-size: 13px; color: var(--faint); font-weight: 600; margin: 4px 4px 8px; }

.callout {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font-size: 14px; color: var(--muted); margin: 10px 0 14px;
}
.empty-state { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty-state.big { padding-top: 80px; font-size: 18px; }
.empty-state a { color: var(--accent-ink); font-weight: 700; }

/* ---------- phrase card: native, pronunciation, meaning ---------- */
.list { display: grid; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px 12px;
}
.card.is-pattern { background: var(--tint); border-color: color-mix(in srgb, var(--accent) 16%, var(--line)); }
.card-meta { display: flex; align-items: center; justify-content: space-between; margin: -2px -8px 0 0; font-size: 12px; font-weight: 600; color: var(--faint); }
.fav { width: 36px; height: 36px; color: var(--faint); }
.fav .ic { width: 20px; height: 20px; }
.fav.on { color: var(--accent-2); }
.fav.on .ic { fill: currentColor; }

.native {
  font-family: var(--font-native); font-size: 26px; font-weight: 700; line-height: 1.3;
  letter-spacing: -.005em; overflow-wrap: anywhere;
}
.native[dir="rtl"] { font-size: 29px; line-height: 1.5; text-align: right; }
.native.missing { font-size: 16px; color: var(--muted); font-style: italic; font-weight: 600; }
.kana { font-family: var(--font-native); font-size: 16px; color: var(--muted); margin-top: 1px; letter-spacing: .02em; }
.kana.sm { font-size: 13px; }
.kana.lg { font-size: 18px; }
.kana.fc-kana { font-size: 18px; text-align: center; }
.pron { font-size: 16px; color: var(--accent-ink); margin-top: 2px; font-weight: 600; letter-spacing: .01em; }
.en { font-size: 15px; color: var(--muted); margin-top: 4px; }
.native[dir="rtl"] ~ .pron, .native[dir="rtl"] ~ .en { text-align: right; }
.native.sm { font-size: 19px; }
.native.sm[dir="rtl"] { font-size: 21px; }
.pron.sm { font-size: 14px; margin-top: 0; }
.en.sm { font-size: 13px; margin-top: 1px; }
.native.lg { font-size: 30px; }
.native.lg[dir="rtl"] { font-size: 34px; }
.pron.lg { font-size: 18px; }
.card.is-learned .native::after { content: " ✓"; color: #16a34a; font-size: .55em; vertical-align: middle; }

.slot {
  display: inline-block; min-width: 2em; padding: 0 .2em; margin: 0 .05em;
  border-radius: 6px; background: var(--tint-strong); color: var(--accent-ink);
  border-bottom: 2px solid var(--accent); text-align: center; font-weight: 700; line-height: 1.15; unicode-bidi: isolate;
}
.slot-word { font-style: italic; }

.notes { margin-top: 10px; display: grid; gap: 6px; }
.note { font-size: 14px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.note-link { color: var(--accent-ink); font-weight: 600; white-space: nowrap; }
.note-k { display: inline-block; margin-right: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); }

.card-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.round-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--accent-ink); flex: none;
}
.round-btn .ic { width: 19px; height: 19px; }
.round-btn.small { width: 36px; height: 36px; }
.round-btn.small .ic { width: 16px; height: 16px; }
.listen .i-pause { display: none; }
.listen[data-state="playing"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.listen[data-state="playing"] .i-play { display: none; }
.listen[data-state="playing"] .i-pause { display: block; }
.listen[data-state="paused"] { background: var(--tint-strong); }
.learn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 12px;
  border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--faint); border: 1px solid var(--line);
}
.learn .ic { width: 16px; height: 16px; }
.learn.on { color: #15803d; background: #e8f7ee; border-color: #c6ead3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .learn.on { color: #bbf7d0; background: #14351f; border-color: #1f4d2e; } }

.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 14px; color: var(--ink);
}
.pill-btn .ic { width: 17px; height: 17px; color: var(--accent-ink); }

/* Hidden English / pronunciation: blurred, tap to peek */
body.hide-en [data-peek="en"]:not(.peeked),
body.hide-pron [data-peek="pron"]:not(.peeked) {
  filter: blur(6px); opacity: .5; user-select: none; cursor: pointer;
}

/* ---------- patterns, sounds: mini phrases ---------- */
.pattern { display: grid; }
.pattern .card { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }
.pattern-more {
  margin: 0 10px; padding: 10px 12px 6px; background: var(--surface); border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 16px 16px;
}
.more-k { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin-bottom: 2px; }
.mini { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.more-k + .mini, .sound-ex > .mini:first-child { border-top: 0; }
.mini-text { flex: 1; min-width: 0; }
.mini-actions { display: flex; gap: 6px; }
.sub-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 6px; }
.sub { display: flex; flex-direction: column; background: var(--surface-2); border-radius: 10px; padding: 6px 10px; }
.sub b { font-family: var(--font-native); font-size: 17px; }
.sub i { font-size: 13px; color: var(--accent-ink); font-style: normal; }
.sub em { font-size: 12px; color: var(--muted); font-style: normal; }

.sound { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.sound-head { display: flex; align-items: center; gap: 14px; }
.sound-sym {
  flex: none; min-width: 56px; height: 56px; padding: 0 10px; border-radius: 16px;
  display: grid; place-items: center; background: var(--tint); color: var(--accent-ink);
  font-family: var(--font-native); font-size: 25px; font-weight: 800; line-height: 1; white-space: nowrap;
}
.sound-head h2 { font-size: 18px; font-weight: 800; }
.sound-spelled { font-size: 13px; color: var(--muted); }
.sound-spelled b { color: var(--accent-ink); }
.sound-how { margin-top: 10px; font-size: 15px; color: var(--ink); }
.sound-ex { margin-top: 8px; }
.hl { background: color-mix(in srgb, var(--accent-2) 35%, transparent); color: inherit; border-radius: 4px; padding: 0 1px; }

/* ---------- scenarios ---------- */
.scen-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.scen-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  aspect-ratio: 1; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); padding: 8px;
}
.scen-card strong { font-size: 14px; line-height: 1.15; }
.scen-card small { font-size: 12px; color: var(--faint); font-weight: 600; }
.scen-card:active, .scen-btn:active { transform: scale(.98); }
.scen-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.more-btn {
  display: block; text-align: center; margin-top: 14px; padding: 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 700; color: var(--accent-ink);
}

/* ---------- practice ---------- */
.setup { display: grid; gap: 18px; }
.setup fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.setup legend { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin-bottom: 6px; padding-left: 4px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; }
.opt span {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 54px; padding: 8px 16px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.opt b { font-weight: 700; }
.opt small { color: var(--muted); font-size: 13px; text-align: right; }
.opt input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--tint); }
.opt input:disabled + span { opacity: .45; }
.opt input:focus-visible + span { outline: 3px solid var(--tint-strong); }
.select { width: 100%; min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-weight: 600; }
.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; width: 100%;
  border-radius: 16px; background: var(--accent); color: #fff; font-weight: 800; font-size: 17px;
}

.fc-progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.fc-progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.fc-meta { font-size: 13px; color: var(--faint); font-weight: 600; margin: 8px 2px 12px; }
.flashcard {
  width: 100%; min-height: min(50dvh, 400px); text-align: center;
  border-radius: 24px; background: var(--surface); border: 1px solid var(--line);
  padding: 24px 20px; cursor: pointer; outline: none;
  display: flex; align-items: center; justify-content: center;
}
.flashcard:focus-visible { border-color: var(--accent); }
.flashcard.flipped { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.fc-face { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.fc-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.fc-en { font-size: 24px; font-weight: 700; line-height: 1.25; }
.fc-native, .fc-native[dir="rtl"] { font-size: 34px; text-align: center !important; }
.fc-native[dir="rtl"] { font-size: 38px; }
.fc-pron, .fc-native[dir="rtl"] ~ .fc-pron { font-size: 18px; text-align: center !important; }
.fc-divider { width: 40px; height: 3px; border-radius: 3px; background: var(--line); margin: 8px 0; }
.fc-hint { margin-top: 14px; font-size: 14px; font-weight: 600; color: var(--muted); }
.flashcard .note { text-align: left; margin-top: 8px; }
.fc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.fc-actions.disabled { opacity: .35; }
.fc-btn { min-height: 56px; border-radius: 16px; font-weight: 800; font-size: 16px; }
.fc-btn.again { background: var(--surface); border: 1px solid var(--line); }
.fc-btn.got { background: var(--accent); color: #fff; }
.fc-extra { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; }
.fc-extra .learn { margin-left: 0; }
.done { text-align: center; padding-top: 40px; display: grid; gap: 12px; justify-items: center; }
.done-burst { font-size: 56px; }
.done h1 { font-size: 28px; font-weight: 800; }
.done p { color: var(--muted); }

/* ---------- phrase player (sessions and the Say it sheet) ---------- */
.topbar.focus { padding-bottom: 4px; }
.main.focus { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.pp-phrase { padding: 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 2px; }
.pp-cue { margin-top: 10px; font-size: 14px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.pp-phrase .notes { margin-top: 8px; }
.pp-stage { display: grid; justify-items: center; gap: 10px; margin: 22px 0 6px; text-align: center; }
.pp-stage .mic-big { margin-top: 0; width: 84px; height: 84px; }
.pp-stage .mic-big.listen { border: 0; }
.pp-stage .mic-big.listen .ic { width: 32px; height: 32px; fill: currentColor; stroke-width: 1.2; }
.pp-stage .mic-big.listen[data-state="paused"] { background: var(--accent); opacity: .75; }
.pp-hint { font-size: 15px; font-weight: 600; color: var(--muted); max-width: 30ch; }
.pp-stage .primer { grid-column: auto; text-align: left; max-width: 34ch; }
.pp-small { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0 0; }
.pp-compare { margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--surface-2); display: grid; gap: 10px; }
.pp-compare .take-actions { justify-content: center; }
.pp-seq { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 15px; color: var(--faint); }
.pp-seq .ic { width: 14px; height: 14px; }
.pp-seq span { padding: 4px 10px; border-radius: 99px; transition: background .15s, color .15s; }
.pp-seq span.on { color: #fff; background: var(--accent); }
.heard-words.sm { font-size: 17px; }
.pp-next { margin-top: 20px; width: 100%; }
.more-btn.pp-next { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pp-next .ic { width: 20px; height: 20px; }
.pp-next + .fine { text-align: center; margin-top: 8px; }

/* recall prompt, listening check, rating inside the player */
.pp-prompt { text-align: center; gap: 8px; padding: 22px 16px; }
.pp-prompt .pp-stage { margin: 14px 0 0; }
.pp .fc-actions { margin-top: 18px; }
.pp .lock-hint { text-align: center; margin-top: 14px; }
.pp .fine, .fine.center { margin-top: 8px; text-align: center; }
.pp .link-btn.center { margin-top: 12px; }
.lc-opts { display: grid; gap: 10px; margin-top: 14px; }
.lc-opt { min-height: 56px; padding: 10px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 16px; text-align: left; }
.lc-opt.right { border-color: #15803d; box-shadow: inset 0 0 0 1px #15803d; background: color-mix(in srgb, #15803d 10%, var(--surface)); }
.lc-opt.wrong { border-color: #dc2626; box-shadow: inset 0 0 0 1px #dc2626; background: color-mix(in srgb, #dc2626 8%, var(--surface)); }
.lc-opt:disabled { color: var(--ink); cursor: default; }
.lc-answer { margin-top: 14px; }

/* ---------- speaking ---------- */
.mic-big {
  display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; margin-top: 10px;
  background: var(--accent); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent);
}
.mic-big .ic { width: 30px; height: 30px; }
.mic-big.rec { background: #dc2626; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(220 38 38 / .35); } 50% { box-shadow: 0 0 0 14px rgb(220 38 38 / 0); } }
.mic-hint { font-size: 14px; color: var(--muted); font-weight: 600; }
.take { width: 100%; margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); text-align: left; display: grid; gap: 8px; }
.take-verdict { font-weight: 700; font-size: 15px; }
.heard-words { font-family: var(--font-native); font-size: 20px; font-weight: 700; line-height: 1.5; }
.heard-words[dir="rtl"] { text-align: right; }
.w-hit { color: #15803d; }
.w-close { color: #b45309; }
.w-miss { color: var(--faint); text-decoration: underline wavy color-mix(in srgb, #dc2626 50%, transparent); text-underline-offset: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .w-hit { color: #4ade80; } :root:not([data-theme="light"]) .w-close { color: #fbbf24; } }
.heard { font-size: 13px; color: var(--muted); }
.take-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* live level ring on the mic button, finishing state, mic check */
.mic-big.rec { --lvl: 0; animation: none; box-shadow: 0 0 0 calc(4px + var(--lvl) * 22px) rgb(220 38 38 / .22); transition: box-shadow .08s linear; }
.mic-big.finishing { opacity: .6; }
.mic-big:disabled { opacity: .35; }
.take.failed { background: color-mix(in srgb, #dc2626 8%, var(--surface-2)); }
.mode-seg { margin-top: 10px; }
.group.pad { padding: 14px; display: grid; gap: 10px; justify-items: start; }
.group.pad > p { font-size: 15px; }
.group.pad .cta { width: 100%; }
.mc-row { display: flex; align-items: center; gap: 16px; width: 100%; }
.mc-row .mic-big { margin: 6px; }
.meter { flex: 1; height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #eab308 70%, #dc2626); border-radius: 99px; transition: width .06s linear; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.checks li { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.checks li .ic { width: 16px; height: 16px; }
.checks li.ok .ic { color: #16a34a; }
.checks li.bad { color: var(--ink); }
.checks li.bad .ic { color: #dc2626; }
.speed-pill { min-width: 56px; justify-content: center; font-variant-numeric: tabular-nums; color: var(--accent-ink); }

/* ---------- bottom sheet ---------- */
#sheet { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / .35); opacity: 0; transition: opacity .2s; }
.sheet-panel {
  position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 100%);
  width: min(640px, 100%);
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--bg); border-radius: 24px 24px 0 0; padding: 8px 16px calc(40px + env(safe-area-inset-bottom));
  transition: transform .25s ease;
}

.sheet-panel::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 6px; }
#sheet.open { pointer-events: auto; }
#sheet.open .sheet-backdrop { opacity: 1; }
#sheet.open .sheet-panel { transform: translate(-50%, 0); }
/* Wider screens: a centred window with room above and below, so it never hides behind the Dock or window edge. */
@media (min-width: 700px) {
  .sheet-panel {
    top: 50%; bottom: auto; transform: translate(-50%, -45%); opacity: 0;
    max-height: calc(100vh - 64px); max-height: calc(100dvh - 64px);
    border-radius: 24px; padding-bottom: 24px; box-shadow: 0 24px 60px rgb(0 0 0 / .25);
    transition: transform .2s ease, opacity .2s ease;
  }
  #sheet.open .sheet-panel { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-panel::before { display: none; }
}

.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { font-size: 20px; font-weight: 800; }
.say-phrase { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 16px; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 4px 10px; align-items: center; }
.step-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--tint-strong); color: var(--accent-ink); font-size: 13px; font-weight: 800; }
.step-t { font-weight: 800; }
.step-body { grid-column: 2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-body .seg { flex: 1; min-width: 220px; }
.step-body.full { display: block; }
.step-body .mic-big { margin-top: 0; }
.seg.filter { margin-bottom: 12px; }
.voice-list { max-height: 50dvh; overflow-y: auto; }
.tip { font-size: 13px; color: var(--muted); margin-top: 12px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.seg-btn { min-height: 36px; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg-btn.on { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 3px rgb(0 0 0 / .08); }

/* ---------- mini player ---------- */
#player {
  position: fixed; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 35;
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); width: min(624px, calc(100% - 16px));
  transition: opacity .2s, transform .2s;
}
#player.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.player { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 10px 10px 8px; box-shadow: 0 10px 30px rgb(0 0 0 / .12); }
.pl-top { display: flex; align-items: center; gap: 10px; }
.pl-main { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; flex: none; }
.pl-main .ic { width: 20px; height: 20px; }
.pl-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl-text b { font-family: var(--font-native); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-text b[dir="rtl"], .pl-text b[dir="rtl"] + span { text-align: right; }
.pl-text span { font-size: 13px; color: var(--accent-ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.pl-btn { display: grid; place-items: center; width: 38px; height: 34px; border-radius: 10px; color: var(--muted); background: var(--surface-2); }
.pl-btn .ic { width: 18px; height: 18px; }
.pl-btn.on { background: var(--tint-strong); color: var(--accent-ink); }
.pl-speed { display: flex; align-items: center; background: var(--surface-2); border-radius: 10px; height: 34px; }
.pl-speed button { width: 32px; height: 34px; font-size: 18px; font-weight: 700; color: var(--muted); }
.pl-speed span { min-width: 44px; text-align: center; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
.pl-voice { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px; font-weight: 700; color: var(--muted); max-width: 40%; }
.pl-voice span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-voice .ic { width: 16px; height: 16px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--player-h) + 22px + env(safe-area-inset-bottom)); z-index: 70;
  width: min(560px, calc(100% - 32px)); transform: translate(-50%, 10px); opacity: 0; pointer-events: none; font-size: 13.5px;
  background: var(--ink); color: var(--bg); padding: 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgb(0 0 0 / .2); transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

@media (min-width: 560px) {
  .stamps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- flow & guidance ---------- */
.next-step {
  margin-top: 16px; padding: 18px; border-radius: 20px; display: grid; gap: 6px;
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 10%, transparent);
}
.ns-k { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.next-step h2 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.ns-sub { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.next-step .cta { text-decoration: none; }
.fc-tip, .step-tip { font-size: 14px; color: var(--muted); }
.fc-tip { text-align: center; margin: -4px 8px 12px; }
.step-tip { grid-column: 2; margin-top: 2px; }
.primer {
  font-size: 13px; color: var(--muted); background: var(--surface); border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 12px; padding: 8px 10px; margin-top: 6px;
}
.session-card { padding: 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 4px; }
.session-next { margin-top: 22px; }
.session-next .ic { width: 20px; height: 20px; }
.done-actions { display: grid; gap: 10px; width: 100%; margin-top: 14px; }
.done-actions .more-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; width: 100%; font-size: 15px; }
.done-actions .more-btn .ic { width: 18px; height: 18px; }
.session-summary { margin-top: 18px; }
.session-summary .row-ic.ok { background: #e8f7ee; color: #15803d; }
.session-summary .row-title { font-family: var(--font-native); }

/* labelled Listen / Say it pills */
.pill-btn.listen .i-pause { display: none; }
.pill-btn.listen[data-state="playing"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill-btn.listen[data-state="playing"] .ic { color: #fff; }
.pill-btn.listen[data-state="playing"] .i-play { display: none; }
.pill-btn.listen[data-state="playing"] .i-pause { display: block; }
.card-actions .pill-btn { min-height: 38px; padding: 0 12px; font-size: 13.5px; }
.card-actions .learn { margin-left: auto; }

/* help */
.help-btn { min-width: 38px; display: grid; place-items: center; text-decoration: none !important; color: var(--muted) !important; }
.help-btn .ic { width: 19px; height: 19px; }
.inline-ic { width: 16px; height: 16px; vertical-align: -3px; }
.help-lead { font-size: 15px; color: var(--muted); margin-bottom: 12px; }
.help { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 14px; }
.help li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.help-t { font-size: 15px; }
.help p { font-size: 14px; color: var(--muted); margin-top: 2px; }
.help-sample { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 4px; }
.hs-line { display: flex; align-items: baseline; gap: 10px; }
.hs-k { flex: none; width: 76px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.hs-line .en, .hs-line .pron, .hs-line .kana { margin: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .session-summary .row-ic.ok { background: #14351f; color: #bbf7d0; } }

/* ---------- reviews, flight prep, cheat sheet ---------- */
.review-step { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line)); }
.review-step .ns-k { color: color-mix(in srgb, var(--accent-2) 60%, var(--ink)); }
.flight-head { display: flex; align-items: center; gap: 14px; }
.flight-ic { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--tint-strong); color: var(--accent-ink); }
.flight-ic .ic { width: 28px; height: 28px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 4px 0 2px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.sect-lead { font-size: 14px; color: var(--muted); margin: -2px 4px 10px; }
.mini-list { padding: 4px 14px; }
.mini-list .mini:first-child { border-top: 0; }
.cs-head .cs-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cs-group { margin-top: 18px; }
.cs-group h2 { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 0 4px 6px; }
.cs-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-top-width: 0; }
.cs-group h2 + .cs-row { border-top-width: 1px; border-radius: 14px 14px 0 0; }
.cs-row:last-child { border-radius: 0 0 14px 14px; }
.cs-group h2 + .cs-row:last-child { border-radius: 14px; }
.cs-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
.cs-native { font-family: var(--font-native); font-size: 18px; font-weight: 700; width: 100%; }
.cs-native[dir="rtl"] { text-align: right; }
.cs-pron { font-size: 14px; font-weight: 600; color: var(--accent-ink); }
.cs-en { font-size: 13px; color: var(--muted); }
.cs-en::before { content: "· "; }

@media print {
  .topbar, .bottomnav, #player, #toast, .cs-actions, .round-btn, .pill-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; }
  .cs-row { break-inside: avoid; border-color: #ccc; }
  .cs-pron { color: #333; }
}

/* ---------- level toggle: new-first groups ---------- */
.tier-head, .tier-divider {
  display: flex; align-items: center; gap: 10px; margin: 8px 4px 0;
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.tier-head { color: var(--accent-ink); }
.tier-divider { color: var(--faint); margin-top: 18px; }
.tier-divider::after, .tier-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tier-note { font-size: 14px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; }
.new-tag { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px; background: var(--tint-strong); color: var(--accent-ink); font-size: 11px; font-weight: 800; }
.scen-card small em { display: block; font-style: normal; color: var(--accent-ink); font-weight: 700; }
.scen-card.empty { opacity: .6; }

/* ---------- Lock it in ---------- */
.learn.locked { color: #fff; background: var(--accent); border-color: var(--accent); }
.hero-counts { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.ring span { text-transform: none; letter-spacing: 0; font-size: 11px; }
.lock-hint { font-size: 13px; font-weight: 600; color: var(--accent-ink); margin-top: 6px; }
.status-tag { flex: 0 0 auto; margin-left: 2px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 800; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent-ink); }
.status-tag.locked { background: var(--accent); border-color: var(--accent); color: #fff; }
.due-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; padding: 12px 14px;
  border-radius: 16px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent-2) 55%, var(--line));
}
.due-k { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.due-k .ic { width: 15px; height: 15px; }
.due-strip a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: color-mix(in srgb, var(--accent) 80%, var(--ink)); font-weight: 700; font-size: 14px; }
.due-strip a b { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; display: grid; place-items: center; }
.trip-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; font-weight: 700; }
.trip-row input { font: inherit; font-weight: 600; min-height: 44px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.trip .heard b { color: var(--ink); }
:root .card-actions .learn.on.locked, :root .fc-extra .learn.on.locked { color: #fff; background: var(--accent); border-color: var(--accent); }
:root[data-motif="stitch"] .lang-hero::before { background: linear-gradient(45deg, transparent 44%, currentColor 44% 56%, transparent 56%) 0 0 / 16px 16px, linear-gradient(-45deg, transparent 44%, currentColor 44% 56%, transparent 56%) 0 0 / 16px 16px; }

/* ---------- Type it ---------- */
.flashcard.typing { cursor: default; }
.type-form { display: grid; gap: 10px; width: 100%; margin-top: 10px; }
.type-input {
  width: 100%; min-height: 54px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface-2); color: var(--ink); font-family: var(--font-native); font-size: 20px; text-align: center;
}
.type-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint-strong); }
.type-input[dir="rtl"] { text-align: center; }
.type-hint { font-size: 12.5px; margin-top: 8px; }
.type-take.good { background: color-mix(in srgb, #16a34a 10%, var(--surface-2)); }
.type-notes { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; color: var(--ink); text-align: left; }
.voice-k { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 14px 4px 8px; }

/* ---------- Today: Continue with a situation, situations with readiness ---------- */
.today-hero { padding: 16px 18px; }
.working {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 6px 0 4px; padding: 10px 12px;
  border-radius: 14px; background: var(--tint); border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line)); text-align: left;
}
.working-text { flex: 1; min-width: 0; display: grid; }
.working-text small { font-size: 12px; color: var(--muted); font-weight: 600; }
.working-text b { font-size: 18px; font-weight: 800; }
.working-n { font-size: 13px; font-weight: 700; color: var(--muted); }
.working-change { font-size: 13px; font-weight: 800; color: var(--accent-ink); }
.sit-list { display: grid; gap: 8px; }
.sit-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
}
.sit-text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.sit-text b { font-size: 16px; }
.sit-text small { font-size: 13px; color: var(--muted); font-weight: 600; }
.sit-row.done small { color: #15803d; }
.ready-bar { display: block; height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.ready-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.sit-row.done .ready-bar span { background: #15803d; }
.scen-head .ready-bar { margin-top: 8px; max-width: 220px; }
.sit-cta { margin: 4px 0 14px; }
.pp-howto { font-size: 13px; color: var(--muted); margin: 0 2px 8px; }
.pp-howto .pron-k { color: var(--accent-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sit-row.done small { color: #4ade80; } }

/* ---------- lookup cards, Show this, offline ---------- */
.lk-main { display: flex; align-items: flex-start; gap: 12px; }
.lk-text { flex: 1; min-width: 0; }
.round-btn.lk-play { width: 52px; height: 52px; flex: none; background: var(--accent); border-color: var(--accent); color: #fff; }
.round-btn.lk-play .ic { width: 22px; height: 22px; fill: currentColor; stroke-width: 1.2; }
.round-btn.lk-play[data-state="paused"] { opacity: .75; }
.lk-spacer { flex: 1; }
.lk-kind { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.card.lk .card-actions { margin-top: 10px; }
.card.lk .fav { margin-right: -8px; }
.chips.dim { opacity: .45; }
.count .link-btn { min-height: 0; padding: 0; font-size: 13px; }
.offline-btn { margin: 0 0 12px; }
.offline-btn.on { color: #15803d; border-color: #c6ead3; background: #e8f7ee; }
.offline-btn.on .ic { color: #15803d; }

#showit {
  position: fixed; inset: 0; z-index: 60; background: var(--surface); color: var(--ink);
  display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}
body.showit-open { overflow: hidden; }
.showit-x { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; background: var(--surface-2); color: var(--ink); }
.showit-body { display: grid; gap: 18px; justify-items: center; text-align: center; max-width: 30ch; }
.showit-native { font-family: var(--font-native); font-size: clamp(36px, 11vw, 64px); font-weight: 800; line-height: 1.15; }
.showit-reading { font-family: var(--font-native); font-size: 22px; color: var(--muted); }
.showit-en { font-size: 18px; color: var(--muted); }
.showit-play { margin-top: 8px; width: 84px; height: 84px; border: 0; }
.showit-play .ic { width: 32px; height: 32px; fill: currentColor; stroke-width: 1.2; }

/* "Try another": patterns in context, inside the player */
.pp-more { margin-top: 16px; padding: 12px; border-radius: 14px; border: 1px dashed color-mix(in srgb, var(--accent) 30%, var(--line)); display: grid; gap: 8px; }
.pp-more .more-k { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); }
.pp-more-row { display: flex; align-items: center; gap: 10px; }
.pp-more-row > div { flex: 1; min-width: 0; display: grid; }
.pp-more-row b { font-family: var(--font-native); font-size: 16px; }
.pp-more-row small { font-size: 13px; color: var(--muted); }

/* Mic opening: amber "wait" until the mic is really live, then red "speak now" */
.mic-big.rec.warming { background: #f59e0b; box-shadow: 0 0 0 6px rgb(245 158 11 / .2); animation: none; }
.speak-now { color: #dc2626; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .speak-now { color: #f87171; } }

/* Drafts (content/added): labelled until a native speaker checks them */
.draft-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .02em; color: #92400e; background: #fef3c7; border: 1px solid #fcd34d; vertical-align: middle; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .draft-tag { color: #fcd34d; background: #422006; border-color: #92400e; } }
.pp-draft { margin-top: 8px; font-size: 13px; color: var(--muted); }
.showit-draft { font-size: 13px; color: var(--faint); }
.examples { margin-top: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.examples summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--accent-ink); }
.examples .pp-more-row { margin-top: 8px; }
.hear-list { display: grid; gap: 10px; padding: 12px; }
.hear-list small { display: block; }
.hear-list .draft-tag { margin: 2px 0; justify-self: start; }
.draft-tag.native { color: #166534; background: #dcfce7; border-color: #86efac; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .draft-tag.native { color: #86efac; background: #052e16; border-color: #166534; } }

/* Retention: answer-a-reply prompt, honest grading note, reminder */
.reply-row { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 4px 0 12px; text-align: left; }
.reply-row > div { display: grid; }
.reply-native { font-family: var(--font-native); font-size: 22px; }
.reply-row small { color: var(--muted); font-size: 13px; }
.pp-prompt .type-form { margin-top: 12px; }
.honest { margin-top: 12px; font-size: 14px; color: #92400e; background: #fef3c7; border-radius: 10px; padding: 8px 10px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .honest { color: #fcd34d; background: #422006; } }
.lc-verdict { margin: 14px 2px 8px; }
.reminder-row { margin: 14px 0; }
.reminder-row input { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }

/* Review ladder (Recognize · Say · Write · Answer) and rating buttons that say what they do */
.ladder { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.ladder span { font-size: 10px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; padding: 2px 6px; border-radius: 99px; background: var(--surface-2); color: var(--faint); }
.ladder span.on { background: var(--accent); color: #fff; }
.fc-actions.rate .fc-btn { display: grid; place-content: center; gap: 2px; min-height: 64px; padding: 6px 8px; }
.fc-actions.rate .fc-btn b { font-size: 16px; }
.fc-actions.rate .fc-btn small { font-size: 12px; font-weight: 600; opacity: .85; }
#update-banner { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 70; display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 12px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgb(0 0 0 / .2); }
#update-banner .pill-btn { background: var(--accent); color: #fff; border-color: var(--accent); }
