/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --bg: #f4f6fa;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --surface-3: #e4e9f2;
  --border: #dfe4ee;
  --border-strong: #c8d0e0;
  --text: #101725;
  --text-2: #3d4a60;
  --muted: #64718a;
  --accent: #2d55d4;
  --accent-2: #7b3fe4;
  --accent-weak: #e8edfd;
  --accent-text: #2d55d4;
  --good: #10714a;
  --good-weak: #dcf2e7;
  --bad: #b3261e;
  --bad-weak: #fce6e4;
  --warn: #8a5300;
  --warn-weak: #fdf0d3;

  --r-sm: 9px;
  --r: 14px;
  --r-lg: 20px;
  --r-full: 999px;

  --sh-1: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-2: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px -6px rgba(16, 24, 40, .10);
  --sh-3: 0 2px 4px rgba(16, 24, 40, .06), 0 16px 36px -12px rgba(16, 24, 40, .16);

  --tab-h: 60px;
  --top-h: 56px;

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --ease: cubic-bezier(.32, .72, 0, 1);
}

[data-theme="dark"] {
  --bg: #0b0f16;
  --bg-elev: #131924;
  --surface: #141b26;
  --surface-2: #1c2431;
  --surface-3: #26303f;
  --border: #263042;
  --border-strong: #37455c;
  --text: #e9eef7;
  --text-2: #b9c4d6;
  --muted: #8e9cb4;
  --accent: #7ba1ff;
  --accent-2: #b18cff;
  --accent-weak: #1a2440;
  --accent-text: #9ab7ff;
  --good: #56d39c;
  --good-weak: #102c20;
  --bad: #ff9086;
  --bad-weak: #351917;
  --warn: #ffc95e;
  --warn-weak: #32270e;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px -6px rgba(0, 0, 0, .5);
  --sh-3: 0 2px 4px rgba(0, 0, 0, .45), 0 16px 36px -12px rgba(0, 0, 0, .65);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.58;
  letter-spacing: -.003em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

h1 { font-size: 27px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -.022em; font-weight: 700; }
h2 { font-size: 19px; line-height: 1.3; margin: 28px 0 12px; letter-spacing: -.015em; font-weight: 660; }
h3 { font-size: 14px; margin: 18px 0 8px; font-weight: 660; letter-spacing: -.005em; }
p  { margin: 0 0 12px; }
a  { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }

.lead    { color: var(--muted); margin: 0 0 20px; font-size: 15.5px; }
.muted   { color: var(--muted); }
.small   { font-size: 13px; line-height: 1.5; }

/* ============================================================
   Shell
   ============================================================ */
.app { min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar__title {
  font-weight: 660; font-size: 16.5px; letter-spacing: -.015em; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__back {
  background: none; border: 0; color: var(--text); font-size: 21px; line-height: 1;
  cursor: pointer; padding: 6px 8px; border-radius: var(--r-sm);
  transition: background .15s var(--ease);
}
.topbar__back:hover { background: var(--surface-2); }
.topbar__actions { display: flex; gap: 8px; align-items: center; }

.segmented {
  display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--border);
  background: var(--surface-2); border-radius: var(--r-full); cursor: pointer;
  font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
.segmented span {
  padding: 4px 10px; border-radius: var(--r-full); color: var(--muted);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.segmented span.is-on {
  background: var(--surface); color: var(--accent-text); box-shadow: var(--sh-1);
}

.iconbtn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r-full); padding: 6px 12px; font: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; line-height: 1.4;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.iconbtn:hover { border-color: var(--accent); color: var(--accent-text); }
.iconbtn--square { padding: 6px 9px; }

.view {
  padding: calc(var(--top-h) + env(safe-area-inset-top) + 20px) 16px
           calc(var(--tab-h) + env(safe-area-inset-bottom) + 32px);
  max-width: 840px; margin: 0 auto; outline: none;
}

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; text-decoration: none; color: var(--muted);
  font-size: 10.5px; font-weight: 620; letter-spacing: .005em;
  transition: color .18s var(--ease);
}
.tab__i { font-size: 17px; line-height: 1; }
.tab.is-active { color: var(--accent-text); }
.tab.is-active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--accent);
}

/* ============================================================
   Primitives
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 17px; box-shadow: var(--sh-2);
  margin-bottom: 14px;
}
.card--flat { box-shadow: none; background: var(--surface); }
.card__title { font-weight: 660; font-size: 15.5px; margin: 0 0 4px; letter-spacing: -.01em; }
.card__sub   { color: var(--muted); font-size: 13.5px; margin: 0; line-height: 1.55; }

.btn {
  appearance: none; border: 1px solid transparent; background: var(--accent);
  color: #fff; font: inherit; font-weight: 620; font-size: 15px; letter-spacing: -.005em;
  padding: 11px 18px; border-radius: 11px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--sh-1);
  transition: filter .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
}
[data-theme="dark"] .btn { color: #08101f; }
.btn:hover  { filter: brightness(1.08); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; filter: none; transform: none; box-shadow: none; }
.btn--ghost {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
[data-theme="dark"] .btn--ghost { color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-text); filter: none; }
.btn--danger { background: var(--bad); }
.btn--sm { padding: 8px 14px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn--block { width: 100%; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.chip {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 680; letter-spacing: .01em; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.chip--accent { background: var(--accent-weak); color: var(--accent-text); border-color: transparent; }
.chip--good   { background: var(--good-weak);   color: var(--good);   border-color: transparent; }
.chip--bad    { background: var(--bad-weak);    color: var(--bad);    border-color: transparent; }
.chip--warn   { background: var(--warn-weak);   color: var(--warn);   border-color: transparent; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.divider { height: 1px; background: var(--border); border: 0; margin: 18px 0; }

.bar { height: 7px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.bar > i {
  display: block; height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .5s var(--ease);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 118%);
  color: #fff; border-radius: var(--r-lg); padding: 22px; margin-bottom: 18px;
  box-shadow: var(--sh-3);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -70px;
  width: 210px; height: 210px; border-radius: 50%;
  background: rgba(255, 255, 255, .09); pointer-events: none;
}
.hero h1 { color: #fff; margin-bottom: 4px; }
.hero p  { color: rgba(255, 255, 255, .87); margin: 0; font-size: 14px; }
.hero__row { position: relative; z-index: 1; }
.hero__stats { position: relative; z-index: 1; display: flex; gap: 22px; margin-top: 18px; }
.hero__stat b { display: block; font-size: 23px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.hero__stat span {
  font-size: 10.5px; color: rgba(255, 255, 255, .78);
  text-transform: uppercase; letter-spacing: .07em; font-weight: 600;
}
.hero__countdown { position: relative; z-index: 1; margin-bottom: 6px; }
.hero__countdown b { font-size: 48px; font-weight: 750; line-height: 1; letter-spacing: -.03em; }
.hero__countdown span { font-size: 13px; color: rgba(255, 255, 255, .85); margin-left: 8px; }

/* ============================================================
   Today panel
   ============================================================ */
.today__head { display: flex; gap: 16px; align-items: center; margin-bottom: 6px; }

.ring { position: relative; flex-shrink: 0; width: 80px; height: 80px; }
.ring svg { display: block; }
.ring__track { fill: none; stroke: var(--surface-3); stroke-width: 7; }
.ring__fill {
  fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round;
  transition: stroke-dasharray .6s var(--ease);
}
.ring__center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.1;
}
.ring__center b { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.ring__center span { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.tasklist { list-style: none; margin: 12px 0 0; padding: 0; }
.task {
  display: flex; align-items: center; gap: 11px; padding: 11px 0;
  border-top: 1px solid var(--border); font-size: 14.5px;
}
.task:first-child { border-top: 0; }
.task__check {
  flex-shrink: 0; width: 21px; height: 21px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); display: flex; align-items: center;
  justify-content: center; font-size: 12px; color: #fff;
}
.task.is-done .task__check { background: var(--good); border-color: var(--good); }
.task__label { flex: 1; color: inherit; text-decoration: none; font-weight: 520; }
.task__label:hover { color: var(--accent-text); }
.task.is-done .task__label { color: var(--muted); text-decoration: line-through; }
.task__mins { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ============================================================
   Skill / quick cards
   ============================================================ */
.skillgrid { display: grid; gap: 12px; }

.skillcard {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px; box-shadow: var(--sh-1);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .12s var(--ease);
}
.skillcard:hover { border-color: var(--accent); box-shadow: var(--sh-2); }
.skillcard:active { transform: scale(.995); }
.skillcard--lg { display: flex; gap: 15px; align-items: flex-start; }
.skillcard__icon {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent-weak); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.skillcard__main { flex: 1; min-width: 0; }
.skillcard__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.skillcard__name { font-weight: 680; font-size: 15.5px; letter-spacing: -.01em; }
.skillcard__desc { color: var(--muted); font-size: 13px; margin: 5px 0 0; line-height: 1.5; }

.quickgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.quick {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 14px; box-shadow: var(--sh-1);
  transition: border-color .18s var(--ease), transform .12s var(--ease);
}
.quick:hover { border-color: var(--accent); }
.quick:active { transform: scale(.98); }
.quick__icon { color: var(--accent-text); font-size: 16px; }
.quick__name { flex: 1; font-weight: 620; font-size: 14.5px; }
.quick__count {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border-radius: var(--r-full); padding: 2px 8px;
}

.nudge {
  display: flex; gap: 13px; align-items: center; text-decoration: none; color: inherit;
  background: var(--accent-weak); border: 1px solid transparent; border-radius: var(--r);
  padding: 14px 15px; transition: transform .12s var(--ease);
}
.nudge:hover { transform: translateY(-1px); }
.nudge--warn { background: var(--warn-weak); }
.nudge__num {
  font-size: 26px; font-weight: 750; line-height: 1; letter-spacing: -.02em;
  color: var(--accent-text); flex-shrink: 0;
}
.nudge--warn .nudge__num { color: var(--warn); }
.nudge__body { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.nudge__body b { color: var(--text); font-size: 13.5px; }

/* ============================================================
   Levels & mock exams
   ============================================================ */
.levelbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-decoration: none; color: inherit; margin-bottom: 10px;
  background: linear-gradient(135deg, var(--accent-weak), color-mix(in srgb, var(--accent-weak) 55%, var(--surface)));
  border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px;
  transition: border-color .18s var(--ease);
}
.levelbar:hover { border-color: var(--accent); }
.levelbar__label {
  display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 650;
}
.levelbar__value { font-size: 19px; font-weight: 720; letter-spacing: -.02em; color: var(--accent-text); }
.levelbar__right { display: flex; align-items: center; gap: 10px; }
.levelbar__change { font-size: 12.5px; font-weight: 620; color: var(--accent-text); }

.levelcard.is-chosen { border-color: var(--good); box-shadow: 0 0 0 1px var(--good) inset; }

.mockfacts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.mockfacts div { text-align: center; }
.mockfacts b {
  display: block; font-size: 20px; font-weight: 720; letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}
.mockfacts span {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; font-weight: 600;
}

.mockpart { margin-bottom: 26px; }
.mockpart__head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px;
  padding-bottom: 9px; border-bottom: 2px solid var(--accent);
}
.mockpart__num {
  font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent-text); background: var(--accent-weak);
  padding: 3px 9px; border-radius: var(--r-full);
}
.mockpart__title { font-weight: 660; font-size: 16px; letter-spacing: -.012em; }

.item--cleared { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }

.scorehero--pass { border-color: var(--good); }
.verdictbar {
  margin-top: 16px; padding: 11px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 600; line-height: 1.5;
}
.verdictbar.is-pass { background: var(--good-weak); color: var(--good); }
.verdictbar.is-fail { background: var(--warn-weak); color: var(--warn); }

/* ============================================================
   Lists
   ============================================================ */
.itemlist { display: grid; gap: 10px; }
.item {
  display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 15px; cursor: pointer; text-align: left;
  font: inherit; width: 100%; box-shadow: var(--sh-1);
  transition: border-color .18s var(--ease), transform .12s var(--ease);
}
.item:hover { border-color: var(--accent); }
.item:active { transform: scale(.995); }
.item--stack { align-items: stretch; }
.item__body  { flex: 1; min-width: 0; }
.item__title { font-weight: 620; font-size: 14.8px; letter-spacing: -.008em; }
.item__meta  { color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.45; }
.item__right { flex-shrink: 0; }

.ticklist { list-style: none; margin: 0; padding: 0; }
.ticklist li {
  padding: 9px 0 9px 26px; border-top: 1px solid var(--border);
  position: relative; font-size: 14.5px;
}
.ticklist li:first-child { border-top: 0; }
.ticklist li::before {
  content: "\2713"; position: absolute; left: 0; top: 9px;
  color: var(--accent-text); font-weight: 700;
}

/* ============================================================
   Passage / questions
   ============================================================ */
.passage {
  font-family: var(--serif); font-size: 16.5px; line-height: 1.75;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px; margin-bottom: 16px; box-shadow: var(--sh-1);
}
.passage h3 {
  font-family: var(--font); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin: 0 0 12px; font-weight: 650;
}
.passage p { margin: 0 0 15px; }
.passage p:last-child { margin-bottom: 0; }
.passage .pmark {
  font-family: var(--font); font-size: 10.5px; font-weight: 750; color: var(--accent-text);
  background: var(--accent-weak); border-radius: 5px; padding: 2px 7px; margin-right: 8px;
  vertical-align: 1.5px; letter-spacing: .02em;
}
.reader-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }

.q { border-top: 1px solid var(--border); padding: 17px 0; }
.q:first-child { border-top: 0; padding-top: 3px; }
.q__num {
  font-weight: 700; color: var(--accent-text); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px;
}
.q__text { font-weight: 540; margin-bottom: 11px; line-height: 1.5; }

.opts { display: grid; gap: 7px; }
.opt {
  display: flex; gap: 11px; align-items: flex-start; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  background: var(--surface); font-size: 14.5px; line-height: 1.45;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.opt:hover { border-color: var(--border-strong); }
.opt input { margin: 3px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.opt.is-picked  { border-color: var(--accent); background: var(--accent-weak); }
.opt.is-correct { border-color: var(--good);   background: var(--good-weak); }
.opt.is-wrong   { border-color: var(--bad);    background: var(--bad-weak); }

.gapinput {
  width: 100%; max-width: 360px; padding: 10px 13px; font: inherit; font-size: 15px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text);
  transition: border-color .15s var(--ease);
}
.gapinput:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.gapinput.is-correct { border-color: var(--good); background: var(--good-weak); }
.gapinput.is-wrong   { border-color: var(--bad);  background: var(--bad-weak); }
select.gapinput { max-width: 100%; }

.explain {
  margin-top: 11px; padding: 11px 13px; border-radius: 10px;
  background: var(--surface-2); font-size: 13.5px; color: var(--muted);
  border-left: 3px solid var(--accent); line-height: 1.55;
}
.explain b { color: var(--text); }

/* ============================================================
   Score
   ============================================================ */
.scorehero { text-align: center; padding: 28px 18px; }
.scorehero__band {
  font-size: 58px; font-weight: 760; line-height: 1; letter-spacing: -.035em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.scorehero__label {
  color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .08em; margin-top: 8px; font-weight: 620;
}
.scorehero__raw { font-size: 15px; margin-top: 12px; }

/* ============================================================
   Timer / sticky tools
   ============================================================ */
.timer {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px;
  padding: 6px 13px; border-radius: var(--r-full); background: var(--surface-2);
  border: 1px solid var(--border); display: inline-flex; align-items: center; gap: 6px;
  letter-spacing: -.01em;
}
.timer.is-low { background: var(--bad-weak); color: var(--bad); border-color: transparent; }

.sticky-tools {
  position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top)); z-index: 20;
  background: var(--bg); padding: 12px 0; margin: -14px 0 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}

/* ============================================================
   Writing
   ============================================================ */
.editor {
  width: 100%; min-height: 340px; resize: vertical; padding: 17px;
  font-family: var(--serif); font-size: 16px; line-height: 1.72;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--text); box-shadow: var(--sh-1);
}
.editor:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.wcount { display: flex; gap: 15px; font-size: 12.5px; color: var(--muted); margin-top: 9px; flex-wrap: wrap; }
.wcount b { color: var(--text); font-variant-numeric: tabular-nums; }

.feedback-item {
  display: flex; gap: 11px; padding: 10px 0; border-top: 1px solid var(--border);
  font-size: 14px; line-height: 1.5;
}
.feedback-item:first-child { border-top: 0; }
.feedback-item__icon { flex-shrink: 0; font-weight: 700; width: 18px; text-align: center; }
.fb-ok   .feedback-item__icon { color: var(--good); }
.fb-warn .feedback-item__icon { color: var(--warn); }
.fb-bad  .feedback-item__icon { color: var(--bad); }

/* ============================================================
   Speaking
   ============================================================ */
.rec-dot {
  width: 10px; height: 10px; border-radius: 50%; background: currentColor;
  display: inline-block; margin-right: 6px; animation: pulse 1.1s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.cue {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: 12px;
  padding: 16px; margin-bottom: 14px; box-shadow: var(--sh-1);
}
.cue ul { margin: 9px 0 0; padding-left: 20px; }
.cue li { margin-bottom: 5px; }
audio { width: 100%; margin-top: 10px; }

/* ============================================================
   Flashcards
   ============================================================ */
.flashcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 30px 22px; text-align: center; box-shadow: var(--sh-2); margin-bottom: 16px;
  min-height: 200px; display: flex; flex-direction: column; justify-content: center;
}
.flashcard__word {
  font-size: 32px; font-weight: 700; letter-spacing: -.028em; line-height: 1.15;
}
.flashcard__pos {
  color: var(--muted); font-size: 12.5px; margin-top: 6px;
  font-style: italic; letter-spacing: .01em;
}
.flashcard__back {
  margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); text-align: left;
}
.flashcard__meaning { font-size: 15.5px; margin: 0 0 12px; line-height: 1.55; }
.flashcard__example {
  font-family: var(--serif); font-size: 15.5px; color: var(--text-2);
  margin: 0 0 12px; line-height: 1.6;
}
.flashcard__note {
  font-size: 13px; color: var(--muted); background: var(--warn-weak);
  padding: 9px 12px; border-radius: 9px; margin: 12px 0 0; line-height: 1.5;
}
.flashcard__note b { color: var(--warn); }
.colloc { display: flex; flex-wrap: wrap; gap: 6px; }
.colloc span {
  font-size: 12px; font-weight: 560; background: var(--accent-weak); color: var(--accent-text);
  padding: 4px 10px; border-radius: var(--r-full); font-family: var(--mono);
}

.graderow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.gradebtn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 11px 4px; border-radius: 11px; cursor: pointer; font: inherit;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: transform .1s var(--ease), border-color .15s var(--ease);
}
.gradebtn:hover  { border-color: currentColor; }
.gradebtn:active { transform: translateY(1px); }
.gradebtn__label { font-weight: 680; font-size: 13.5px; }
.gradebtn__hint  { font-size: 10px; color: var(--muted); }
.gradebtn__when  { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.grade--again { color: var(--bad); }
.grade--hard  { color: var(--warn); }
.grade--good  { color: var(--accent-text); }
.grade--easy  { color: var(--good); }

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 620; font-size: 14.5px; margin-bottom: 7px; }
.field__hint { color: var(--muted); font-size: 12.5px; margin: 7px 0 0; line-height: 1.5; }

.check {
  display: flex; gap: 11px; align-items: flex-start; padding: 10px 0;
  border-top: 1px solid var(--border); font-size: 14px; cursor: pointer; line-height: 1.5;
}
.check:first-child { border-top: 0; }
.check input { margin: 3px 0 0; accent-color: var(--accent); flex-shrink: 0; }

/* ============================================================
   Progress
   ============================================================ */
.sparkline { display: flex; align-items: flex-end; gap: 4px; height: 92px; margin-top: 14px; }
.sparkline > i {
  flex: 1; border-radius: 4px 4px 0 0; min-height: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: .9;
}
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 14px; box-shadow: var(--sh-1);
}
.stat b {
  display: block; font-size: 23px; line-height: 1.15; font-weight: 720;
  font-variant-numeric: tabular-nums; letter-spacing: -.025em;
}
.stat span {
  font-size: 10.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; font-weight: 600;
}

/* ============================================================
   Accordion / toast / empty
   ============================================================ */
details.acc {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); margin-bottom: 10px; box-shadow: var(--sh-1);
}
details.acc > summary {
  padding: 14px 16px; cursor: pointer; font-weight: 620; font-size: 14.5px;
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after {
  content: "+"; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1;
}
details.acc[open] > summary::after { content: "\2212"; }
details.acc > .acc__body { padding: 0 16px 16px; font-size: 14.5px; line-height: 1.6; }
.model-answer { font-family: var(--serif); font-size: 15.5px; line-height: 1.72; }
.model-answer p { margin-bottom: 13px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(18px);
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 18px);
  background: var(--text); color: var(--bg); padding: 11px 19px; border-radius: var(--r-full);
  font-size: 14px; font-weight: 560; opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
  z-index: 90; max-width: 90vw; text-align: center; box-shadow: var(--sh-3);
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty h2 { color: var(--text); }

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 700px) {
  h1 { font-size: 31px; }
  .view { padding-left: 24px; padding-right: 24px; }
  .tab { flex-direction: row; gap: 8px; font-size: 12px; }
  .skillgrid { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 26px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .topbar, .tabbar, .sticky-tools, .toast { display: none; }
  .view { padding: 0; max-width: none; }
  .card, .passage { box-shadow: none; border-color: #ccc; }
}
