/* ============ Palette hues ============
   Each palette declares its accent family for light (-l) and dark (-d).
   Theme blocks below map them onto the working tokens. */
:root {
  /* Lagoon (default) */
  --p-accent-l: #0E8D9A; --p-strong-l: #0A6E78; --p-soft-l: #D5F1F4; --p-on-l: #FFFFFF;
  --p-accent-d: #45C4CF; --p-strong-d: #74D6DE; --p-soft-d: #0E3D43; --p-on-d: #04292E;
}
:root[data-palette="sunset"] {
  --p-accent-l: #E4572E; --p-strong-l: #C24420; --p-soft-l: #FFE4D9; --p-on-l: #FFFFFF;
  --p-accent-d: #FF8A5C; --p-strong-d: #FFA981; --p-soft-d: #46231A; --p-on-d: #2B1109;
}
:root[data-palette="bloom"] {
  --p-accent-l: #D23A72; --p-strong-l: #AF2C5D; --p-soft-l: #FBDCE8; --p-on-l: #FFFFFF;
  --p-accent-d: #F1699D; --p-strong-d: #F693BB; --p-soft-d: #451A2B; --p-on-d: #2E0E1B;
}
:root[data-palette="meadow"] {
  --p-accent-l: #2F9E44; --p-strong-l: #228035; --p-soft-l: #DBF2DE; --p-on-l: #FFFFFF;
  --p-accent-d: #5BC96C; --p-strong-d: #86DA93; --p-soft-d: #17381D; --p-on-d: #0A2410;
}
:root[data-palette="grape"] {
  --p-accent-l: #6E4FD0; --p-strong-l: #5638B0; --p-soft-l: #E8E1FA; --p-on-l: #FFFFFF;
  --p-accent-d: #9B7FE8; --p-strong-d: #B7A3F0; --p-soft-d: #291F4A; --p-on-d: #140B33;
}
:root[data-palette="ocean"] {
  --p-accent-l: #2B7DE0; --p-strong-l: #1F63B8; --p-soft-l: #DCEAFB; --p-on-l: #FFFFFF;
  --p-accent-d: #6AAEF5; --p-strong-d: #92C4F8; --p-soft-d: #14304E; --p-on-d: #071C33;
}

/* ============ Theme tokens ============ */
:root {
  --accent: var(--p-accent-l);
  --accent-strong: var(--p-strong-l);
  --accent-soft: var(--p-soft-l);
  --on-accent: var(--p-on-l);
  --bg: #F5F7F6;
  --bg: color-mix(in srgb, var(--p-accent-l) 5%, #FBFCFB);
  --surface: #FFFFFF;
  --surface-2: #EEF2F1;
  --surface-2: color-mix(in srgb, var(--p-accent-l) 8%, #F2F4F3);
  --ink: #1D2A32;
  --muted: #5D6E77;
  --line: #E0E6E6;
  --line: color-mix(in srgb, var(--p-accent-l) 12%, #E7EAEA);
  --celeste: #C6EAFA;
  --celeste-ink: #0E567A;
  --unknown: #FFE9C4;
  --unknown-ink: #8A5A0B;
  --good: #21A45D;
  --good-soft: #D8F5E4;
  --bad: #E2543F;
  --bad-soft: #FDE1DC;
  --warn: #D97706;
  --shadow: 0 1px 3px rgba(29, 42, 50, .07), 0 4px 18px rgba(29, 42, 50, .06);
  --radius: 16px;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: var(--p-accent-d);
    --accent-strong: var(--p-strong-d);
    --accent-soft: var(--p-soft-d);
    --on-accent: var(--p-on-d);
    --bg: #10181D;
    --bg: color-mix(in srgb, var(--p-accent-d) 4%, #10171B);
    --surface: #182229;
    --surface: color-mix(in srgb, var(--p-accent-d) 5%, #171F25);
    --surface-2: #20303A;
    --surface-2: color-mix(in srgb, var(--p-accent-d) 9%, #1E2A31);
    --ink: #E6EEF2;
    --muted: #93A6B0;
    --line: #2A3941;
    --line: color-mix(in srgb, var(--p-accent-d) 12%, #263239);
    --celeste: #17435C;
    --celeste-ink: #9FDCF8;
    --unknown: #44341A;
    --unknown-ink: #F0C070;
    --good: #4FCB8B;
    --good-soft: #17402F;
    --bad: #F07862;
    --bad-soft: #46221B;
    --warn: #F0A044;
    --shadow: 0 1px 3px rgba(0, 0, 0, .32), 0 6px 22px rgba(0, 0, 0, .26);
  }
}
:root[data-theme="light"] {
  --accent: var(--p-accent-l); --accent-strong: var(--p-strong-l); --accent-soft: var(--p-soft-l); --on-accent: var(--p-on-l);
  --bg: #F5F7F6; --bg: color-mix(in srgb, var(--p-accent-l) 5%, #FBFCFB);
  --surface: #FFFFFF;
  --surface-2: #EEF2F1; --surface-2: color-mix(in srgb, var(--p-accent-l) 8%, #F2F4F3);
  --ink: #1D2A32; --muted: #5D6E77;
  --line: #E0E6E6; --line: color-mix(in srgb, var(--p-accent-l) 12%, #E7EAEA);
  --celeste: #C6EAFA; --celeste-ink: #0E567A; --unknown: #FFE9C4; --unknown-ink: #8A5A0B;
  --good: #21A45D; --good-soft: #D8F5E4; --bad: #E2543F; --bad-soft: #FDE1DC; --warn: #D97706;
  --shadow: 0 1px 3px rgba(29,42,50,.07), 0 4px 18px rgba(29,42,50,.06);
}
:root[data-theme="dark"] {
  --accent: var(--p-accent-d); --accent-strong: var(--p-strong-d); --accent-soft: var(--p-soft-d); --on-accent: var(--p-on-d);
  --bg: #10181D; --bg: color-mix(in srgb, var(--p-accent-d) 4%, #10171B);
  --surface: #182229; --surface: color-mix(in srgb, var(--p-accent-d) 5%, #171F25);
  --surface-2: #20303A; --surface-2: color-mix(in srgb, var(--p-accent-d) 9%, #1E2A31);
  --ink: #E6EEF2; --muted: #93A6B0;
  --line: #2A3941; --line: color-mix(in srgb, var(--p-accent-d) 12%, #263239);
  --celeste: #17435C; --celeste-ink: #9FDCF8; --unknown: #44341A; --unknown-ink: #F0C070;
  --good: #4FCB8B; --good-soft: #17402F; --bad: #F07862; --bad-soft: #46221B; --warn: #F0A044;
  --shadow: 0 1px 3px rgba(0,0,0,.32), 0 6px 22px rgba(0,0,0,.26);
}

/* ============ Base ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100dvh;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, select, textarea { font: inherit; color: var(--ink); }
.hidden { display: none !important; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 17px; height: 17px; }
.icon-xl { width: 44px; height: 44px; stroke-width: 1.8; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ============ Buttons & forms ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 15px;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  transition: filter .12s ease, transform .05s ease;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn-good { background: var(--good); color: #fff; border-color: transparent; }
.btn-bad { background: var(--bad); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-danger-ghost { background: transparent; border-color: var(--line); color: var(--bad); }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); margin-bottom: 14px;
}
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; letter-spacing: .02em; text-transform: uppercase; }
.form-error { color: var(--bad); font-size: 14px; margin-bottom: 12px; }

/* ============ Login ============ */
.login-screen {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, var(--bg) 55%, var(--accent-soft));
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 34px 28px; box-shadow: var(--shadow);
}
.login-brand { text-align: center; margin-bottom: 26px; color: var(--accent); }
.login-brand h1 { color: var(--ink); font-size: 30px; margin-top: 10px; }
.login-brand p { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ============ App shell ============ */
.app { min-height: 100dvh; }
.nav {
  position: fixed; z-index: 40; background: var(--surface); border-top: 1px solid var(--line);
  bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.nav-brand { display: none; }
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
  padding: 5px 10px; border-radius: 10px; min-width: 58px;
}
.nav-item.active { color: var(--accent); }
.view { padding: 18px 16px calc(86px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }

@media (min-width: 900px) {
  .nav {
    top: 0; bottom: 0; right: auto; width: 220px; flex-direction: column; justify-content: flex-start;
    gap: 4px; border-top: none; border-right: 1px solid var(--line); padding: 22px 14px;
  }
  .nav-brand {
    display: flex; align-items: center; gap: 10px; font-family: var(--font-display);
    font-weight: 700; font-size: 19px; color: var(--accent); margin-bottom: 26px; padding: 0 10px;
  }
  .nav-brand span { color: var(--ink); }
  .nav-item { flex-direction: row; gap: 12px; font-size: 15px; padding: 11px 12px; border-radius: 10px; width: 100%; }
  .nav-item.active { background: var(--accent-soft); }
  .view { margin-left: 220px; padding: 34px 32px 60px; max-width: none; }
  .view > * { max-width: 860px; margin-left: auto; margin-right: auto; }
}

/* ============ Common blocks ============ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 26px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.pill-new { background: var(--celeste); color: var(--celeste-ink); }
.pill-due { background: var(--bad-soft); color: var(--bad); }
.pill-total { background: var(--surface-2); color: var(--muted); }
.pill-good { background: var(--good-soft); color: var(--good); }

/* ============ Home ============ */
.hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 20px; box-shadow: var(--shadow); margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.hero h2 { font-size: 24px; margin-bottom: 4px; }
.streak-badge {
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--warn);
  background: var(--surface-2); border-radius: 14px; padding: 12px 18px; min-width: 86px;
}
.streak-badge.active { background: var(--unknown); }
.streak-badge .icon { width: 26px; height: 26px; }
.streak-badge strong { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--ink); }
.streak-badge small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .icon { color: var(--accent); margin-bottom: 8px; }
.stat strong { display: block; font-size: 24px; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.quick-list { display: flex; flex-direction: column; gap: 10px; }
.quick-item {
  display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  text-align: left; width: 100%; font: inherit; cursor: pointer;
}
.quick-item .icon { color: var(--accent); }
.quick-item .grow { flex: 1; min-width: 0; }
.quick-item strong { display: block; font-size: 15.5px; }
.quick-item span { font-size: 13px; color: var(--muted); }

/* ============ Deck list ============ */
.deck-item { display: flex; align-items: center; gap: 12px; }
.deck-item .grow { flex: 1; min-width: 0; }
.deck-item h3 { font-size: 17px; margin-bottom: 5px; overflow-wrap: anywhere; }
.deck-pills { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============ Review ============ */
.review-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.review-top .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.review-top .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .25s ease; }
.flashcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  padding: 26px 22px; text-align: center; min-height: 320px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}
.flashcard img { max-width: min(100%, 300px); max-height: 180px; border-radius: 12px; object-fit: cover; }
.flashcard .word { font-family: var(--font-display); font-size: 38px; font-weight: 700; overflow-wrap: anywhere; }
.flashcard .definition { font-size: 16.5px; max-width: 46ch; }
.flashcard .example { font-size: 15px; color: var(--muted); font-style: italic; max-width: 46ch; }
.flashcard hr { width: 60px; border: none; border-top: 2px solid var(--line); }
.speak-btn {
  display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600;
  padding: 8px 14px; border-radius: 999px; background: var(--accent-soft);
}
.grade-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.grade-row .btn { padding: 12px 8px; font-size: 15px; flex-wrap: wrap; row-gap: 2px; }
.grade-row small { flex-basis: 100%; font-weight: 500; font-size: 11.5px; opacity: .8; text-align: center; }
.review-done { text-align: center; padding: 50px 20px; }
.review-done .icon { width: 52px; height: 52px; color: var(--good); margin-bottom: 12px; }

/* ============ Reading ============ */
.reader-text {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 20px; font-size: 18px; line-height: 1.9;
  max-width: 68ch; margin: 0 auto;
}
.reader-text .w { cursor: pointer; border-radius: 4px; padding: 1px 2px; }
.reader-text .w.st-new { background: var(--celeste); color: var(--celeste-ink); }
.reader-text .w.st-unknown { background: var(--unknown); color: var(--unknown-ink); }
.reader-text .w.st-known { background: transparent; color: inherit; }
.reader-text .w:hover { outline: 1px solid var(--accent); }
.reader-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; max-width: 68ch; margin-left: auto; margin-right: auto; }
.reader-nav .num { font-weight: 600; color: var(--muted); font-size: 14px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 auto 14px; max-width: 68ch; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; }

/* Word sheet (bottom sheet) */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(10, 20, 26, .45); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--surface); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); box-shadow: var(--shadow);
  max-height: 86dvh; overflow-y: auto;
}
@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; padding: 20px; }
  .sheet { border-radius: 18px; }
}
.sheet h3 { font-size: 24px; margin-bottom: 4px; overflow-wrap: anywhere; }
.sheet .status-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 16px 0; }
.sheet .status-row .btn { padding: 12px 6px; font-size: 13.5px; }
.st-btn-known.on { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.st-btn-new.on { background: var(--celeste); color: var(--celeste-ink); border-color: var(--accent); }
.st-btn-unknown.on { background: var(--unknown); color: var(--unknown-ink); border-color: var(--warn); }

/* ============ Practice ============ */
.mode-tabs {
  display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--muted);
  white-space: nowrap; flex: none; text-decoration: none;
}
.mode-tab.active { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.practice-stage { text-align: center; padding: 10px 0; }
.practice-stage textarea { min-height: 90px; text-align: left; }
.diff-out { font-size: 17px; line-height: 2; }
.diff-out .ok { background: var(--good-soft); color: var(--good); border-radius: 4px; padding: 1px 4px; }
.diff-out .miss { background: var(--bad-soft); color: var(--bad); border-radius: 4px; padding: 1px 4px; text-decoration: line-through; }
.diff-out .extra { background: var(--unknown); color: var(--unknown-ink); border-radius: 4px; padding: 1px 4px; }
.score-big { font-family: var(--font-display); font-size: 42px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mic-btn {
  width: 84px; height: 84px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow);
}
.mic-btn .icon { width: 34px; height: 34px; }
.mic-btn.rec { background: var(--bad); animation: pulse 1.2s ease infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(192, 71, 47, .18); } }
@media (prefers-reduced-motion: reduce) {
  .mic-btn.rec { animation: none; }
  * { transition: none !important; }
}

/* Sounds / IPA */
.ipa-section { margin-bottom: 8px; }
.ipa-section h3 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 10px; }
.ipa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 8px; }
.ipa-cell {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px;
  text-align: center; box-shadow: var(--shadow);
}
.ipa-cell .sym { font-size: 22px; font-weight: 700; font-family: var(--font-display); color: var(--accent); }
.ipa-cell .ex { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }
.pair-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 420px; margin: 18px auto 0; }
.pair-opts .btn { padding: 16px; font-size: 17px; }
.pair-opts .btn.right { background: var(--good); color: #fff; border-color: transparent; }
.pair-opts .btn.wrong { background: var(--bad); color: #fff; border-color: transparent; }

/* ============ Modal & toast ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 20, 26, .45); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
  background: var(--surface); border-radius: 16px; width: 100%; max-width: 440px;
  padding: 22px; box-shadow: var(--shadow); max-height: 88dvh; overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; font-size: 20px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
#toast-root { position: fixed; bottom: calc(92px + env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 90; pointer-events: none; }
@media (min-width: 900px) { #toast-root { bottom: 28px; left: 220px; } }
.toast {
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow); max-width: 90%;
}

/* ============ Settings ============ */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: none; }
.setting-row .grow { flex: 1; }
.setting-row strong { display: block; font-size: 15px; }
.setting-row span { font-size: 13px; color: var(--muted); }
.setting-row input, .setting-row select { width: 110px; margin-bottom: 0; }

.empty {
  text-align: center; color: var(--muted); padding: 40px 16px; border: 1.5px dashed var(--line);
  border-radius: var(--radius); font-size: 14.5px;
}

/* ============ Palette picker ============ */
.swatch-row { display: flex; gap: 12px; flex-wrap: wrap; padding: 6px 0 2px; }
.swatch {
  width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s ease;
}
.swatch:hover { transform: scale(1.08); }
.swatch i { display: block; width: 30px; height: 30px; border-radius: 50%; }
.swatch.on { border-color: var(--ink); }
.swatch .icon { position: absolute; width: 16px; height: 16px; color: #fff; }

/* ============ Polish & motion ============ */
.view > * { animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.quick-item, .deck-item { transition: transform .15s ease, box-shadow .15s ease; }
.quick-item:hover, .card.deck-item:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(23,36,46,.08), 0 10px 26px rgba(23,36,46,.10); }
.flashcard { animation: flip-in .3s ease both; }
@keyframes flip-in { from { opacity: 0; transform: perspective(900px) rotateX(6deg) translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view > *, .flashcard { animation: none; } }

/* Theme buttons + mobile header */
.nav-foot { display: none; }
.m-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  max-width: 760px; margin: 0 auto;
}
.m-head .m-brand {
  display: flex; align-items: center; gap: 9px; font-family: var(--font-display);
  font-weight: 700; font-size: 18px; color: var(--ink);
}
.m-head .m-brand .icon { color: var(--accent); }
.m-head button {
  width: 40px; height: 40px; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--line); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.m-head button .icon { width: 18px; height: 18px; }
@media (min-width: 900px) {
  .m-head { display: none; }
  .nav-foot { display: block; margin-top: auto; width: 100%; }
  .nav-foot .nav-item { width: 100%; }
}

/* ============ Home: goal + week chart ============ */
.goal-card { margin-bottom: 16px; }
.goal-bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; }
.goal-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--accent-strong)); transition: width .5s ease; }
.goal-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; }
.week-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 68px; margin-top: 14px; }
.week-col { display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.week-col i { width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: var(--accent-soft); min-height: 4px; transition: height .4s ease; }
.week-col.today i { background: var(--accent); }
.week-col span { font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }

/* Install banner */
.install-item { border: 1.5px dashed var(--accent); background: var(--accent-soft); }
.install-item .icon { color: var(--accent); }

/* ============ Reader player ============ */
.reader-player {
  position: sticky; top: 8px; z-index: 30; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow); padding: 8px 10px; max-width: 68ch; margin: 0 auto 14px;
}
.reader-player .btn { padding: 9px; border-radius: 50%; }
.reader-player select { width: auto; margin: 0; padding: 7px 8px; border-radius: 999px; font-size: 13.5px; }
.reader-player .rp-status { flex: 1; font-size: 12.5px; color: var(--muted); font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-text .w.cur-sent { box-shadow: inset 0 -2px 0 var(--accent); }
.reader-text .w.cur-word { background: var(--accent) !important; color: var(--on-accent) !important; }

/* ============ Cloze & quiz ============ */
.cloze-sentence { font-size: 19px; line-height: 1.8; max-width: 50ch; margin: 0 auto 14px; }
.cloze-blank {
  display: inline-block; min-width: 90px; border-bottom: 2.5px solid var(--accent);
  color: var(--accent); font-weight: 700; text-align: center; padding: 0 6px;
}
.quiz-opts { display: grid; gap: 10px; max-width: 460px; margin: 16px auto 0; }
.quiz-opts .btn { justify-content: flex-start; text-align: left; padding: 13px 16px; font-weight: 600; }
.quiz-opts .btn.right { background: var(--good); color: #fff; border-color: transparent; }
.quiz-opts .btn.wrong { background: var(--bad); color: #fff; border-color: transparent; }
.practice-progress { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 14px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
