/* Talky — calm, premium, phone-first. Apple-like: system type, quiet greys, one accent,
   artwork does the colour. Components use tokens only; kids mode swaps tokens. */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f3;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #aeaeb2;
  --sep: rgba(60, 60, 67, .13);
  --accent: #6b4cff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(107, 76, 255, .12);
  --good: #1f9d55;
  --good-soft: rgba(52, 199, 89, .14);
  --bad: #e5342f;
  --bad-soft: rgba(255, 59, 48, .12);
  --glass: rgba(250, 250, 252, .72);
  --shadow-art: 0 18px 40px -14px rgba(0, 0, 0, .45), 0 4px 12px -4px rgba(0, 0, 0, .2);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px -16px rgba(0, 0, 0, .18);
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 22px;
  --f: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --ink: #f5f5f7; --ink-2: #98989f; --ink-3: #5a5a5f;
  --sep: rgba(84, 84, 88, .55); --accent: #8f78ff; --accent-ink: #0b0717; --accent-soft: rgba(143, 120, 255, .18);
  --good: #32d36b; --good-soft: rgba(50, 211, 107, .16); --bad: #ff5a52; --bad-soft: rgba(255, 90, 82, .16);
  --glass: rgba(28, 28, 30, .72); --shadow-card: none;
  color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --ink: #f5f5f7; --ink-2: #98989f; --ink-3: #5a5a5f;
  --sep: rgba(84, 84, 88, .55); --accent: #8f78ff; --accent-ink: #0b0717; --accent-soft: rgba(143, 120, 255, .18);
  --good: #32d36b; --good-soft: rgba(50, 211, 107, .16); --bad: #ff5a52; --bad-soft: rgba(255, 90, 82, .16);
  --glass: rgba(28, 28, 30, .72); --shadow-card: none;
  color-scheme: dark }

/* Kids mode: same screens, warmer and rounder. */
:root[data-kids] {
  --bg: #fff7ee; --surface: #ffffff; --surface-2: #fff0e0; --ink: #2a1d45; --ink-2: #74658f; --sep: rgba(120, 80, 40, .14);
  --accent: #ff5b7f; --accent-ink: #ffffff; --accent-soft: rgba(255, 91, 127, .14); --glass: rgba(255, 247, 238, .78);
  --r-sm: 14px; --r: 20px; --r-lg: 28px; --f-display: var(--f-round);
}
@media (prefers-color-scheme: dark) { :root[data-kids]:not([data-theme="light"]) {
  --bg: #170f2a; --surface: #241a3f; --surface-2: #2f2350; --ink: #fbf3ff; --ink-2: #c3b3de; --sep: rgba(200, 170, 255, .16);
  --accent: #ff86a2; --accent-ink: #170f2a; --glass: rgba(36, 26, 63, .78) } }
:root[data-kids][data-theme="dark"] {
  --bg: #170f2a; --surface: #241a3f; --surface-2: #2f2350; --ink: #fbf3ff; --ink-2: #c3b3de; --sep: rgba(200, 170, 255, .16);
  --accent: #ff86a2; --accent-ink: #170f2a; --glass: rgba(36, 26, 63, .78) }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.47 var(--f); letter-spacing: -.01em;
  min-height: 100vh; min-height: 100dvh; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#app:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--accent); }
svg { display: block; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }

.wrap { max-width: 680px; margin: 0 auto; display: grid; gap: 20px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 110px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---------- type ---------- */
.large-title { margin: 0; font: 700 34px/1.12 var(--f-display); letter-spacing: -.025em; text-wrap: balance; }
h1.title { margin: 0; font: 700 clamp(26px, 6.4vw, 34px)/1.15 var(--f-display); letter-spacing: -.025em; text-wrap: balance; }
h2 { margin: 0; font: 700 22px/1.2 var(--f-display); letter-spacing: -.02em; }
.lede { margin: 0; color: var(--ink-2); font-size: 17px; }
.note { margin: 0; color: var(--ink-2); font-size: 15px; }
.eyebrow { font-size: 13px; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.top .spacer { flex: 1; }
.top-small { font: 600 17px var(--f); }
.date-eyebrow { color: var(--ink-2); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; margin-bottom: -16px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink);
  display: grid; place-items: center; padding: 0; flex: none; text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.plain { background: none; color: var(--accent); width: auto; padding: 0 4px; gap: 2px; display: inline-flex; align-items: center; font-weight: 400; }
.icon-btn.plain svg { width: 24px; height: 24px; stroke-width: 2.6; }

/* ---------- buttons ---------- */
.btn { text-decoration: none; border: 0; border-radius: var(--r); padding: 13px 20px; font-weight: 600; font-size: 17px;
  background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px;
  transition: transform .15s var(--ease), opacity .15s; }
.btn:active { transform: scale(.98); }
.btn.big { width: 100%; min-height: 54px; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.tinted { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.small { min-height: 36px; padding: 7px 14px; font-size: 15px; border-radius: 999px; }
.btn[disabled] { opacity: .45; cursor: default; }
.link-btn { border: 0; background: none; padding: 4px 0; color: var(--accent); font-weight: 600; justify-self: start; }

/* ---------- chips / pills ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; border: 0; max-width: 100%; }
.chip.busy { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--good-soft); color: var(--good); }
.chip.fail { background: var(--bad-soft); color: var(--bad); }
button.chip, a.chip { min-height: 36px; padding: 8px 14px; font-size: 15px; font-weight: 500; color: var(--ink); text-decoration: none; white-space: normal; overflow-wrap: anywhere; text-align: left; }
button.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ---------- grouped lists (iOS inset grouped) ---------- */
.group { background: var(--surface); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-card); }
.group > * + * { border-top: .5px solid var(--sep); }
.group-title { font-size: 13px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .02em; font-weight: 500; margin: 0 0 -12px 16px; }
.card { background: var(--surface); border-radius: var(--r); padding: 16px; display: grid; gap: 10px; box-shadow: var(--shadow-card); }

/* ---------- library ---------- */
.new-card { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface); border-radius: var(--r-lg); text-decoration: none; color: inherit; box-shadow: var(--shadow-card); }
.new-card .plus { width: 56px; height: 56px; border-radius: var(--r); display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), #ff5e8a); }
.new-card .plus svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2.6; fill: none; stroke-linecap: round; }
.new-card b { display: block; font-size: 17px; font-weight: 600; }
.new-card small { color: var(--ink-2); font-size: 15px; }
.chev { width: 14px; height: 14px; color: var(--ink-3); fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

.shelf { display: grid; gap: 12px; }
.featured { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 14px; }
.tile { display: grid; gap: 8px; text-decoration: none; color: inherit; min-width: 0; }
.tile .cover { border-radius: var(--r); overflow: hidden; aspect-ratio: 1; box-shadow: var(--shadow-art); transition: transform .25s var(--ease); }
.tile:active .cover { transform: scale(.97); }
.tile b { overflow-wrap: anywhere; font-size: 15px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile small { color: var(--ink-2); font-size: 13px; margin-top: -4px; }
.tile .prog { height: 3px; border-radius: 2px; background: var(--sep); overflow: hidden; }
.tile .prog i { display: block; height: 100%; background: var(--accent); }

.row-ep { display: grid; grid-template-columns: 60px 1fr auto; gap: 14px; align-items: center; padding: 10px 14px; text-decoration: none; color: inherit; min-width: 0; }
.row-ep .cover { width: 60px; height: 60px; border-radius: var(--r-sm); overflow: hidden; flex: none; }
.row-ep .txt { min-width: 0; display: grid; gap: 2px; }
.row-ep b { overflow-wrap: anywhere; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-ep small { color: var(--ink-2); font-size: 14px; }
.row-ep .err { color: var(--bad); font-size: 14px; }
.making { position: relative; }
.making::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%); background-size: 250% 100%; }
@media (prefers-reduced-motion: no-preference) { .making::after { animation: sheen 1.6s linear infinite; } @keyframes sheen { to { background-position: -150% 0; } } }
.pulse { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 2px; vertical-align: 1px; }
@media (prefers-reduced-motion: no-preference) { .pulse { animation: pulse 1.2s ease-in-out infinite; } @keyframes pulse { 50% { opacity: .25; } } }
.empty { padding: 24px 20px; display: grid; gap: 12px; }

/* ---------- forms ---------- */
label.field { display: grid; gap: 8px; font-weight: 600; font-size: 15px; }
label.field span.hint { font-weight: 400; color: var(--ink-2); font-size: 14px; margin-top: -4px; }
textarea, input[type="text"], input[type="url"] { width: 100%; border: 0; background: var(--surface); border-radius: var(--r);
  padding: 14px 16px; resize: vertical; font-size: 17px; box-shadow: var(--shadow-card); }
textarea::placeholder { color: var(--ink-3); }
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.msg { border-radius: var(--r); padding: 12px 16px; font-size: 15px; }
.msg.err { background: var(--bad-soft); color: var(--bad); }
.msg.info { background: var(--accent-soft); color: var(--ink); }
.seg-len { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 10px; padding: 2px; gap: 2px; }
.seg-len button { border: 0; background: none; border-radius: 8px; padding: 8px; font-weight: 500; font-size: 15px; }
.seg-len button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.seg-len button[disabled] { color: var(--ink-3); cursor: not-allowed; }

/* ---------- onboarding / settings options ---------- */
.options { background: var(--surface); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-card); }
.opt { display: grid; grid-template-columns: 40px 1fr 22px; gap: 1px 14px; align-items: center; text-align: left;
  border: 0; background: none; padding: 12px 16px; width: 100%; position: relative; }
.opt + .opt::before { content: ""; position: absolute; top: 0; left: 70px; right: 0; border-top: .5px solid var(--sep); }
.opt b { font-weight: 500; font-size: 17px; grid-column: 2; }
.opt small { color: var(--ink-2); font-size: 14px; grid-column: 2; }
.opt .code { grid-row: span 2; font: 700 13px var(--f-round); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2); }
.opt .tick { grid-row: span 2; grid-column: 3; width: 20px; height: 20px; color: var(--accent); opacity: 0; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.opt[aria-pressed="true"] .tick { opacity: 1; }
.opt[aria-pressed="true"] .code { background: var(--accent); color: var(--accent-ink); }
.opt[disabled] { opacity: .45; cursor: not-allowed; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch input { width: 51px; height: 31px; appearance: none; border-radius: 999px; background: var(--surface-2); position: relative; cursor: pointer; flex: none; margin: 0;
  box-shadow: inset 0 0 0 1px var(--sep); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); }
.switch input:checked { background: var(--good); box-shadow: none; }
.switch input:checked::after { left: 22px; }
@media (prefers-reduced-motion: no-preference) { .switch input, .switch input::after { transition: all .2s var(--ease); } }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--sep); }
.steps i.on { background: var(--accent); }

/* ---------- episode: now playing ---------- */
.np { position: relative; display: grid; gap: 18px; justify-items: center; padding-top: 6px; isolation: isolate; }
.np-bg { position: absolute; z-index: -1; left: 50%; transform: translateX(-50%); top: calc(-1 * env(safe-area-inset-top, 0px) - 130px);
  width: 100vw; height: 720px; overflow: hidden; pointer-events: none; }
.np-bg svg { width: 100%; height: 100%; filter: blur(60px) saturate(1.3); opacity: .55; transform: scale(1.3); }
.np-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 30%, var(--bg) 92%); }
.np .art { width: min(76vw, 340px); aspect-ratio: 1; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-art);
  transition: transform .45s var(--ease); transform: scale(.88); }
.np.playing .art { transform: scale(1); }
.np-meta { width: 100%; display: grid; gap: 2px; }
.np-meta h1 { overflow-wrap: anywhere; margin: 0; font: 700 22px/1.25 var(--f-display); letter-spacing: -.02em; text-wrap: balance; }
.np-meta p { overflow-wrap: anywhere; margin: 0; color: var(--ink-2); font-size: 17px; }
.scrub { width: 100%; display: grid; gap: 6px; }
.bar { position: relative; height: 6px; border-radius: 3px; background: var(--sep); cursor: pointer; touch-action: none; transition: height .2s var(--ease); }
.bar::before { content: ""; position: absolute; inset: -16px 0; } /* bigger touch target than the 6px line */
.bar:hover, .bar:focus-visible { height: 10px; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--ink); opacity: .85; }
.times { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.transport { width: 100%; display: grid; grid-template-columns: 1fr auto auto auto 1fr; align-items: center; gap: 22px; }
.transport .tbtn { border: 0; background: none; padding: 6px; color: var(--ink); display: grid; place-items: center; border-radius: 50%; transition: transform .12s var(--ease), background .2s; }
.transport .tbtn:active { transform: scale(.88); background: var(--surface-2); }
.transport .tbtn svg { width: 34px; height: 34px; }
.transport .play svg { width: 54px; height: 54px; }
.pill { justify-self: start; border: 0; background: var(--surface-2); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 14px; min-width: 56px; font-variant-numeric: tabular-nums; }
.pill.r { justify-self: end; display: grid; place-items: center; width: 36px; height: 36px; min-width: 0; padding: 0; }
.pill.r svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pill[aria-pressed="true"], .pill[data-saved="1"] { background: var(--ink); color: var(--bg); }

.segmented { width: 100%; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 10px; padding: 2px; gap: 2px; }
.segmented button { border: 0; background: none; border-radius: 8px; padding: 8px; font-weight: 500; font-size: 15px; color: var(--ink); }
.segmented button[aria-selected="true"] { background: var(--surface); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); font-weight: 600; }

/* Transcript in the style of synced lyrics: current line bright, the rest recede. */
.lyrics-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lines { display: grid; gap: 2px; }
.ln { display: grid; gap: 3px; padding: 10px 12px; border-radius: var(--r); text-align: left; border: 0; background: none; width: 100%;
  font: 700 22px/1.3 var(--f-display); letter-spacing: -.02em; color: var(--ink); opacity: .3; transition: opacity .35s var(--ease), transform .35s var(--ease); transform-origin: left center; }
@media (hover: hover) { .ln:hover { opacity: .55; background: var(--surface-2); } }
.ln .who { font: 600 12px var(--f); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.ln .say { min-width: 0; overflow-wrap: anywhere; }
.ln .tr { display: block; color: var(--ink-2); font: 500 16px/1.4 var(--f); letter-spacing: -.01em; margin-top: 4px; }
.ln.now { opacity: 1; }
.lines.idle .ln { opacity: .85; }
@media (prefers-reduced-motion: no-preference) { .ln.now { transform: scale(1.02); } }

/* Mini player (appears once the big controls scroll away) */
.mini { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  width: min(680px, calc(100% - 24px)); z-index: 20; display: grid; grid-template-columns: 44px 1fr auto auto; gap: 12px; align-items: center;
  padding: 8px 10px 8px 8px; border-radius: 16px; background: var(--glass); backdrop-filter: saturate(1.8) blur(24px); -webkit-backdrop-filter: saturate(1.8) blur(24px);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.35), 0 0 0 .5px var(--sep); overflow: hidden; }
.mini .cover { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; }
.mini b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mini button { border: 0; background: none; padding: 6px; color: var(--ink); display: grid; place-items: center; }
.mini button svg { width: 28px; height: 28px; }
.mini .mp { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); width: 0; }
@media (prefers-reduced-motion: no-preference) { .mini { transition: opacity .25s, transform .3s var(--ease); } }
.mini.off { opacity: 0; transform: translate(-50%, 30px); pointer-events: none; visibility: hidden; transition-property: opacity, transform, visibility; } /* hidden = also out of tab order and away from screen readers */

/* ---------- practice ---------- */
.section { display: grid; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.score { font-size: 15px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.q { gap: 12px; }
.q p { overflow-wrap: anywhere; margin: 0; font-weight: 600; font-size: 17px; }
.choices { display: grid; gap: 8px; }
.choices button { overflow-wrap: anywhere; text-align: left; border: 0; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: 16px; transition: background .2s, color .2s; }
.choices button.ok { color: var(--good); font-weight: 600; background: var(--good-soft); }
.choices button.no { color: var(--bad); background: var(--bad-soft); text-decoration: line-through; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.flash { min-height: 132px; border: 0; background: var(--surface); border-radius: var(--r); padding: 16px; text-align: left; display: grid; align-content: space-between; gap: 8px;
  box-shadow: var(--shadow-card); transition: background .25s var(--ease), transform .2s var(--ease); }
.flash:active { transform: scale(.98); }
.flash b { font: 700 19px/1.2 var(--f-display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.flash .back { color: var(--ink); font-size: 15px; }
.flash .back i { color: var(--ink-2); font-size: 14px; }
.flash[aria-pressed="true"] { background: var(--accent-soft); }
.flash .tap { font-size: 13px; color: var(--ink-2); }

.speak { gap: 12px; }
.speak .who { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.speak .line-text { margin: 0; font: 600 19px/1.35 var(--f-display); letter-spacing: -.015em; overflow-wrap: anywhere; }
.speak .acts { display: flex; gap: 12px; align-items: center; }
.mic { width: 52px; height: 52px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--bad); color: #fff; flex: none;
  box-shadow: 0 6px 16px -6px rgba(229, 52, 47, .6); transition: transform .15s var(--ease); }
.mic svg { width: 24px; height: 24px; fill: currentColor; }
.mic:active { transform: scale(.92); }
.mic.on { background: var(--surface-2); color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.mic[disabled] { opacity: .5; }
.listen-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--ink); flex: none; }
.listen-btn svg { width: 20px; height: 20px; fill: currentColor; }
.meter { flex: 1; display: flex; align-items: center; gap: 3px; height: 32px; min-width: 0; }
.meter i { flex: 1; max-width: 5px; min-height: 4px; border-radius: 3px; background: var(--bad); opacity: .85; transition: height .08s linear; }
.status { flex: 1; color: var(--ink-2); font-size: 15px; min-width: 0; }
.status .live { color: var(--ink); font-weight: 500; }
.rec-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-right: 8px; vertical-align: 1px; }
@media (prefers-reduced-motion: no-preference) { .rec-dot { animation: pulse 1s ease-in-out infinite; } }
.thinking { display: inline-flex; gap: 4px; vertical-align: middle; margin-right: 6px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .thinking i { animation: dot 1s infinite ease-in-out; } .thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
  @keyframes dot { 0%, 80%, 100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } } }
.result { display: grid; gap: 10px; border-top: .5px solid var(--sep); padding-top: 12px; }
.result-head { display: flex; align-items: center; gap: 12px; }
.ring { width: 52px; height: 52px; flex: none; }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: var(--surface-2); }
.ring .val { stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .8s var(--ease); }
.ring text { font: 700 15px var(--f-round); fill: var(--ink); }
.result .verdict b { display: block; font-size: 17px; }
.result .verdict small { color: var(--ink-2); font-size: 14px; }
.result .words { line-height: 2; font-size: 17px; }
.w { padding: 2px 5px; border-radius: 6px; }
.w.ok { color: var(--good); }
.w.no { background: var(--bad-soft); color: var(--bad); }
.heard { color: var(--ink-2); font-size: 14px; overflow-wrap: anywhere; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.8); -webkit-backdrop-filter: blur(20px) saturate(1.8); color: var(--ink);
  padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 500; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 10px 30px -10px rgba(0,0,0,.35), 0 0 0 .5px var(--sep); }
.center-load { display: grid; place-items: center; min-height: 50vh; color: var(--ink-2); }

@media (prefers-reduced-motion: no-preference) {
  .bar i { transition: width .25s linear; }
  #app > * { animation: rise .35s var(--ease) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } }
}
@media (min-width: 720px) { .large-title { font-size: 40px; } }

/* ---------- settings (iOS-style rows + bottom sheet) ---------- */
.set-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; width: 100%; min-height: 50px;
  padding: 12px 16px; border: 0; background: none; text-align: left; font-size: 17px; color: var(--ink); text-decoration: none; }
.set-row .val { color: var(--ink-2); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-row.static { grid-template-columns: auto 1fr; }
.set-row.switch { grid-template-columns: 1fr auto; cursor: pointer; }
.set-row.danger { grid-template-columns: 1fr; color: var(--bad); }
@media (hover: hover) { button.set-row:hover, a.set-row:hover { background: var(--surface-2); } }
button.set-row:active, a.set-row:active { background: var(--surface-2); }
.group-foot { margin: -12px 16px 0; font-size: 13px; }
.sheet-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .35); display: grid; align-items: end; justify-items: center; }
.sheet { width: min(680px, 100%); max-height: 85vh; overflow: auto; background: var(--bg); border-radius: 18px 18px 0 0; display: grid; gap: 14px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 20px) max(16px, env(safe-area-inset-left, 0px));
  box-shadow: 0 -10px 40px -10px rgba(0, 0, 0, .35); }
.sheet::before { content: ""; justify-self: center; width: 36px; height: 5px; border-radius: 3px; background: var(--ink-3); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head b { font-size: 17px; font-weight: 600; }
@media (prefers-reduced-motion: no-preference) {
  .sheet-wrap { animation: fade .2s ease both; } .sheet { animation: up .3s var(--ease) both; }
  @keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(40px); opacity: .6; } }
}
.group > .set-row + .set-row { border-top: .5px solid var(--sep); }
/* Reduced motion: no sliding, scaling or fading (state changes still show, instantly). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .np .art, .np.playing .art, .ln.now { transform: none; }
}

/* Pinyin above Chinese text (transcript, flashcards, speaking). */
.rom { display: block; color: var(--accent); font: 500 15px/1.35 var(--f); letter-spacing: 0; }
.ln .rom { margin-bottom: 2px; }
.flash .rom { margin-top: -4px; }
.speak .rom { margin-bottom: -6px; }
:lang(zh) { font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", var(--f); letter-spacing: 0; }

/* Talky picks: library tiles are buttons */
button.tile.pick { border: 0; background: none; padding: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; }
button.tile.pick small { color: var(--accent); font-weight: 600; }
