/* Road to 95 — design system
   Apple Human Interface Guidelines flavored: system font stack, system colors,
   grouped inset cards, large titles, blurred tab bar, strong ease-out motion. */

:root {
  color-scheme: light dark;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", var(--font);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --large-title: 700 34px/1.15 var(--font);
  --title1: 700 28px/1.2 var(--font);
  --title2: 700 22px/1.25 var(--font);
  --title3: 600 20px/1.3 var(--font);
  --headline: 600 17px/1.35 var(--font);
  --body: 400 17px/1.45 var(--font);
  --callout: 400 16px/1.4 var(--font);
  --subhead: 400 15px/1.4 var(--font);
  --footnote: 400 13px/1.4 var(--font);
  --caption: 400 12px/1.35 var(--font);

  /* Light palette (system colors) */
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f2f2f7;
  --fill: rgba(120, 120, 128, 0.2);
  --fill-2: rgba(120, 120, 128, 0.16);
  --fill-3: rgba(118, 118, 128, 0.12);
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --separator: rgba(60, 60, 67, 0.29);
  --separator-opaque: #c6c6c8;
  --blue: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --yellow: #ffcc00;
  --purple: #af52de;
  --pink: #ff2d55;
  --teal: #5ac8fa;
  --indigo: #5856d6;
  --mint: #00c7be;
  --blue-tint: rgba(0, 122, 255, 0.12);
  --green-tint: rgba(52, 199, 89, 0.14);
  --red-tint: rgba(255, 59, 48, 0.12);
  --orange-tint: rgba(255, 149, 0, 0.14);
  --purple-tint: rgba(175, 82, 222, 0.12);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.16);
  --tabbar-bg: rgba(249, 249, 249, 0.82);
  --on-accent: #ffffff;

  /* Shape and motion */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --t-fast: 140ms;
  --t-med: 220ms;
  --t-slow: 320ms;

  --tabbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --content-w: 640px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --fill: rgba(120, 120, 128, 0.36);
    --fill-2: rgba(120, 120, 128, 0.32);
    --fill-3: rgba(118, 118, 128, 0.24);
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.6);
    --label-3: rgba(235, 235, 245, 0.3);
    --separator: rgba(84, 84, 88, 0.65);
    --separator-opaque: #38383a;
    --blue: #0a84ff;
    --green: #30d158;
    --red: #ff453a;
    --orange: #ff9f0a;
    --yellow: #ffd60a;
    --purple: #bf5af2;
    --pink: #ff375f;
    --teal: #64d2ff;
    --indigo: #5e5ce6;
    --mint: #63e6e2;
    --blue-tint: rgba(10, 132, 255, 0.2);
    --green-tint: rgba(48, 209, 88, 0.2);
    --red-tint: rgba(255, 69, 58, 0.2);
    --orange-tint: rgba(255, 159, 10, 0.2);
    --purple-tint: rgba(191, 90, 242, 0.2);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.6);
    --tabbar-bg: rgba(22, 22, 24, 0.82);
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  --fill: rgba(120, 120, 128, 0.36);
  --fill-2: rgba(120, 120, 128, 0.32);
  --fill-3: rgba(118, 118, 128, 0.24);
  --label: #ffffff;
  --label-2: rgba(235, 235, 245, 0.6);
  --label-3: rgba(235, 235, 245, 0.3);
  --separator: rgba(84, 84, 88, 0.65);
  --separator-opaque: #38383a;
  --blue: #0a84ff;
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --purple: #bf5af2;
  --pink: #ff375f;
  --teal: #64d2ff;
  --indigo: #5e5ce6;
  --mint: #63e6e2;
  --blue-tint: rgba(10, 132, 255, 0.2);
  --green-tint: rgba(48, 209, 88, 0.2);
  --red-tint: rgba(255, 69, 58, 0.2);
  --orange-tint: rgba(255, 159, 10, 0.2);
  --purple-tint: rgba(191, 90, 242, 0.2);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.6);
  --tabbar-bg: rgba(22, 22, 24, 0.82);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--label);
  font: var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: 0.45; }
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--blue-tint); }
[hidden] { display: none !important; }

.noanim *, .noanim *::before, .noanim *::after { animation: none !important; transition: none !important; }

/* ---------- App frame ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.view {
  flex: 1;
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: calc(var(--safe-t) + 14px) 16px calc(var(--tabbar-h) + var(--safe-b) + 24px);
  animation: view-in var(--t-med) var(--ease-out);
}
.view.no-tabbar { padding-bottom: calc(var(--safe-b) + 24px); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
  display: flex;
  justify-content: center;
  z-index: 20;
  transition: transform var(--t-med) var(--ease-out), opacity var(--t-med) var(--ease-out);
}
.tabbar.hidden-bar { transform: translateY(110%); opacity: 0; pointer-events: none; }
.tabbar-inner { display: flex; width: 100%; max-width: var(--content-w); }
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 0 4px;
  color: var(--label-2);
  font: 500 10px/1 var(--font);
  letter-spacing: 0.01em;
  transition: color var(--t-fast) ease;
}
.tab svg { width: 26px; height: 26px; display: block; }
.tab.active { color: var(--blue); }
.tab:active svg { transform: scale(0.92); }
.tab .badge {
  position: absolute; margin-left: 20px; margin-top: -4px;
  background: var(--red); color: #fff; font: 700 10px/16px var(--font);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; text-align: center;
}
.tab { position: relative; }

/* ---------- Typography helpers ---------- */
.large-title { font: var(--large-title); letter-spacing: -0.02em; }
.title1 { font: var(--title1); letter-spacing: -0.02em; }
.title2 { font: var(--title2); letter-spacing: -0.015em; }
.title3 { font: var(--title3); letter-spacing: -0.01em; }
.headline { font: var(--headline); }
.callout { font: var(--callout); }
.subhead { font: var(--subhead); }
.footnote { font: var(--footnote); }
.caption { font: var(--caption); }
.secondary { color: var(--label-2); }
.tertiary { color: var(--label-3); }
.mono { font-family: var(--font-mono); }
.rounded { font-family: var(--font-rounded); }
.center { text-align: center; }
.tint-blue { color: var(--blue); } .tint-green { color: var(--green); } .tint-red { color: var(--red); }
.tint-orange { color: var(--orange); } .tint-purple { color: var(--purple); } .tint-pink { color: var(--pink); }
.tint-teal { color: var(--teal); } .tint-indigo { color: var(--indigo); }

/* ---------- Nav header ---------- */
.nav {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px;
  margin: 0 0 8px;
}
.nav .back {
  display: inline-flex; align-items: center; gap: 2px;
  color: var(--blue); font: var(--body); padding: 6px 8px 6px 0; margin-left: -4px;
  border-radius: var(--r-sm);
}
.nav .back svg { width: 22px; height: 22px; }
.nav .spacer { flex: 1; }
.nav .nav-title { font: var(--headline); text-align: center; flex: 1; }
.header { margin: 6px 0 18px; }
.header .eyebrow { font: var(--subhead); color: var(--label-2); margin-bottom: 2px; }
.header .large-title { margin-bottom: 4px; }

/* ---------- Cards and groups ---------- */
.card {
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 14px; }
.card.pad-sm { padding: 14px 16px; }
.card.tinted-blue { background: linear-gradient(135deg, var(--blue), var(--indigo)); color: #fff; }
.card.tinted-green { background: linear-gradient(135deg, var(--green), var(--mint)); color: #fff; }
.card.tinted-orange { background: linear-gradient(135deg, var(--orange), var(--pink)); color: #fff; }
.card.tinted-purple { background: linear-gradient(135deg, var(--purple), var(--indigo)); color: #fff; }
.card[class*="tinted-"] .secondary { color: rgba(255, 255, 255, 0.78); }
.section-title { font: var(--footnote); color: var(--label-2); text-transform: uppercase; letter-spacing: 0.06em; margin: 22px 4px 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 380px) { .grid-3 { grid-template-columns: 1fr 1fr; } }

/* Grouped inset list (Settings-style) */
.list { background: var(--bg-elevated); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-card); }
.list-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 12px 16px; min-height: 52px;
  background: transparent; color: inherit;
  position: relative;
  transition: background var(--t-fast) ease;
}
.list-item + .list-item::before {
  content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 0.5px; background: var(--separator);
}
.list-item.has-icon + .list-item.has-icon::before { left: 58px; }
button.list-item:active { background: var(--fill-3); }
.list-item .li-icon {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none;
}
.list-item .li-icon svg { width: 18px; height: 18px; }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font: var(--body); display: block; }
.list-item .li-sub { font: var(--footnote); color: var(--label-2); margin-top: 1px; display: block; }
.list-item .li-value { font: var(--body); color: var(--label-2); flex: none; }
.list-item .chev { width: 8px; height: 14px; flex: none; color: var(--label-3); }
.list-item .li-progress { width: 44px; height: 44px; flex: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px;
  border-radius: var(--r-md);
  font: 600 17px/1 var(--font);
  background: var(--blue); color: var(--on-accent);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) ease, opacity var(--t-fast) ease;
  user-select: none; -webkit-user-select: none;
  width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn.secondary { background: var(--blue-tint); color: var(--blue); }
.btn.gray { background: var(--fill-3); color: var(--label); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.orange { background: var(--orange); }
.btn.purple { background: var(--purple); }
.btn.plain { background: transparent; color: var(--blue); min-height: 44px; width: auto; padding: 0 8px; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 15px; border-radius: var(--r-sm); width: auto; }
.btn.pill { border-radius: 999px; }
.btn.auto { width: auto; }
.btn svg { width: 20px; height: 20px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--fill-3); color: var(--blue);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) ease;
  flex: none;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.lg { width: 64px; height: 64px; background: var(--blue); color: #fff; }
.icon-btn.lg svg { width: 30px; height: 30px; }
.icon-btn.recording { background: var(--red); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); } 50% { box-shadow: 0 0 0 14px rgba(255, 59, 48, 0); } }

/* Segmented control */
.segmented {
  display: flex; padding: 2px; border-radius: 9px; background: var(--fill-3); position: relative;
}
.segmented button {
  flex: 1; min-height: 32px; border-radius: 7px; font: 500 13px/1 var(--font); color: var(--label);
  transition: background var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.segmented button.active { background: var(--bg-elevated); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); font-weight: 600; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--fill-3); font: 500 14px/1 var(--font); color: var(--label);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) ease, color var(--t-fast) ease;
}
.chip:active { transform: scale(0.96); }
.chip.on { background: var(--blue); color: #fff; }
.chip.good { background: var(--green-tint); color: var(--green); }
.chip.bad { background: var(--red-tint); color: var(--red); }
.chip.warn { background: var(--orange-tint); color: var(--orange); }
.chip.sm { padding: 4px 9px; font-size: 12px; }

/* ---------- Inputs ---------- */
.input, .textarea {
  width: 100%; background: var(--fill-3); border: 0; border-radius: var(--r-md);
  padding: 13px 16px; font: var(--body); color: var(--label);
  outline: none; -webkit-appearance: none; appearance: none;
  transition: box-shadow var(--t-fast) ease;
}
.input:focus, .textarea:focus { box-shadow: 0 0 0 3px var(--blue-tint); }
.textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.input.center { text-align: center; font-size: 22px; font-weight: 600; }
.input.ok { box-shadow: 0 0 0 3px var(--green-tint); background: var(--green-tint); }
.input.bad { box-shadow: 0 0 0 3px var(--red-tint); background: var(--red-tint); }
.input.big { font-size: 20px; padding: 16px; }
label.field { display: block; }
label.field .field-label { font: var(--footnote); color: var(--label-2); margin: 0 4px 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.switch { position: relative; width: 51px; height: 31px; border-radius: 16px; background: var(--fill); transition: background var(--t-med) ease; flex: none; }
.switch::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, 0.15); transition: transform var(--t-med) var(--ease-out); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.stepper { display: inline-flex; background: var(--fill-3); border-radius: 8px; overflow: hidden; }
.stepper button { width: 44px; height: 32px; font: 600 18px/1 var(--font); color: var(--label); }
.stepper button + button { border-left: 0.5px solid var(--separator); }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: 3px; background: var(--fill-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--blue); border-radius: 3px; transition: width var(--t-slow) var(--ease-out); }
.progress.green > i { background: var(--green); }
.progress.orange > i { background: var(--orange); }
.progress.purple > i { background: var(--purple); }
.ring { display: block; }
.ring circle { fill: none; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 700ms var(--ease-out); }

/* Activity rings hero */
.rings-hero { display: flex; align-items: center; gap: 18px; }
.rings-hero .rings { width: 132px; height: 132px; flex: none; }
.rings-legend { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.rings-legend .leg { display: flex; align-items: baseline; gap: 8px; }
.rings-legend .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: center; }
.rings-legend .leg-name { font: var(--footnote); color: var(--label-2); }
.rings-legend .leg-val { font: 700 17px/1.2 var(--font-rounded); letter-spacing: -0.01em; }
.rings-legend .leg-val small { font: 500 12px/1 var(--font); color: var(--label-2); margin-left: 2px; }

/* Stat tiles */
.stat { background: var(--bg-elevated); border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow-card); }
.stat .stat-val { font: 700 26px/1.1 var(--font-rounded); letter-spacing: -0.02em; }
.stat .stat-label { font: var(--footnote); color: var(--label-2); margin-top: 3px; }

/* ---------- Flashcard ---------- */
.flash-wrap { perspective: 1400px; margin: 8px 0 16px; }
.flash {
  position: relative; min-height: 340px;
  transform-style: preserve-3d;
  transition: transform 420ms var(--ease-in-out);
  cursor: pointer;
}
.flash.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0;
  background: var(--bg-elevated); border-radius: var(--r-xl); box-shadow: var(--shadow-card);
  padding: 26px 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  overflow: hidden;
}
.flash-face.back { transform: rotateY(180deg); justify-content: flex-start; text-align: left; align-items: stretch; overflow-y: auto; }
.flash-face .tag { position: absolute; top: 14px; left: 16px; font: 600 11px/1 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--label-2); }
.flash-face .tag.right { left: auto; right: 16px; }
.flash .word { font: 700 40px/1.1 var(--font); letter-spacing: -0.03em; word-break: break-word; }
.flash .ipa { font: var(--callout); color: var(--label-2); font-family: var(--font-mono); }
.flash .pos { font: 600 12px/1 var(--font); color: var(--blue); background: var(--blue-tint); padding: 5px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.06em; }
.flash .hint { font: var(--footnote); color: var(--label-3); margin-top: 12px; }
.flash .def { font: var(--title3); margin: 4px 0 6px; }
.flash .ex { font: var(--callout); color: var(--label-2); border-left: 3px solid var(--blue); padding-left: 10px; }
.flash .ex b { color: var(--label); }
.flash .pt { font: var(--subhead); color: var(--green); margin-top: 8px; }
.flash .meta { font: var(--footnote); color: var(--label-2); margin-top: 8px; }
.flash .meta b { color: var(--label); font-weight: 600; }
.flash .trap { margin-top: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--orange-tint); color: var(--label); font: var(--footnote); }
.flash .trap b { color: var(--orange); }

/* Grade buttons */
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade { min-height: 56px; border-radius: var(--r-md); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 15px/1 var(--font); transition: transform var(--t-fast) var(--ease-out); }
.grade:active { transform: scale(0.95); }
.grade small { font: 500 11px/1 var(--font); opacity: 0.8; }
.grade.again { background: var(--red-tint); color: var(--red); }
.grade.hard { background: var(--orange-tint); color: var(--orange); }
.grade.good { background: var(--green-tint); color: var(--green); }
.grade.easy { background: var(--blue-tint); color: var(--blue); }

/* Exercise (grammar / quiz) */
.exercise { background: var(--bg-elevated); border-radius: var(--r-xl); box-shadow: var(--shadow-card); padding: 22px; margin: 8px 0 16px; }
.exercise .ex-type { font: 600 11px/1 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--label-2); margin-bottom: 12px; display: flex; justify-content: space-between; }
.exercise .prompt { font: var(--title3); line-height: 1.4; margin-bottom: 18px; }
.exercise .prompt .blank { display: inline-block; min-width: 64px; border-bottom: 2px solid var(--blue); margin: 0 2px; text-align: center; color: var(--blue); }
.exercise .prompt .wrong-word { text-decoration: underline wavy var(--red); text-underline-offset: 3px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--r-md);
  background: var(--fill-3); font: var(--body); color: var(--label);
  border: 2px solid transparent;
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) ease, border-color var(--t-fast) ease;
}
.option:active { transform: scale(0.98); }
.option.picked { border-color: var(--blue); background: var(--blue-tint); }
.option.correct { border-color: var(--green); background: var(--green-tint); }
.option.incorrect { border-color: var(--red); background: var(--red-tint); }
.feedback { margin-top: 16px; padding: 14px 16px; border-radius: var(--r-md); font: var(--subhead); animation: view-in var(--t-med) var(--ease-out); }
.feedback.ok { background: var(--green-tint); }
.feedback.bad { background: var(--red-tint); }
.feedback .fb-title { font: var(--headline); margin-bottom: 4px; }
.feedback.ok .fb-title { color: var(--green); }
.feedback.bad .fb-title { color: var(--red); }
.feedback .fb-answer { font: var(--callout); margin: 4px 0; }
.feedback .fb-link { display: inline-block; margin-top: 8px; color: var(--blue); font-weight: 600; }

/* Session top bar */
.session-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.session-bar .close { width: 36px; height: 36px; border-radius: 50%; background: var(--fill-3); display: grid; place-items: center; color: var(--label-2); flex: none; }
.session-bar .close svg { width: 18px; height: 18px; }
.session-bar .progress { flex: 1; height: 8px; border-radius: 4px; }
.session-bar .count { font: 600 13px/1 var(--font-rounded); color: var(--label-2); min-width: 44px; text-align: right; }

/* Timer */
.timer { font: 700 15px/1 var(--font-rounded); color: var(--label-2); display: inline-flex; align-items: center; gap: 6px; background: var(--fill-3); padding: 8px 12px; border-radius: 999px; }
.timer.warn { color: var(--red); background: var(--red-tint); }
.timer svg { width: 14px; height: 14px; }

/* C-test passage */
.passage { font: 400 19px/1.75 var(--font); }
.passage .cword { white-space: nowrap; }
.passage .cin {
  display: inline-block; width: 1.05ch; min-width: 12px; text-align: center;
  border: 0; border-bottom: 2px solid var(--blue); background: transparent;
  font: inherit; color: var(--blue); padding: 0; margin: 0; outline: none; caret-color: var(--blue);
  border-radius: 0;
}
.passage .cin.ok { color: var(--green); border-color: var(--green); }
.passage .cin.bad { color: var(--red); border-color: var(--red); }
.passage .fill-in { display: inline-block; min-width: 70px; border: 0; border-bottom: 2px solid var(--blue); background: transparent; font: inherit; color: var(--blue); padding: 0 4px; text-align: center; outline: none; border-radius: 0; }
.passage .fill-in.ok { color: var(--green); border-color: var(--green); }
.passage .fill-in.bad { color: var(--red); border-color: var(--red); }
.passage .reveal { color: var(--green); font-weight: 600; }

/* Word grid (Read and Select) */
.word-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.word-tile {
  min-height: 54px; border-radius: var(--r-md); background: var(--bg-elevated); box-shadow: var(--shadow-card);
  font: 600 17px/1 var(--font); color: var(--label); display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 2px solid transparent; transition: transform var(--t-fast) var(--ease-out), border-color var(--t-fast) ease, background var(--t-fast) ease;
  padding: 0 8px; word-break: break-word; text-align: center;
}
.word-tile:active { transform: scale(0.95); }
.word-tile.on { border-color: var(--blue); background: var(--blue-tint); }
.word-tile.hit { border-color: var(--green); background: var(--green-tint); }
.word-tile.miss { border-color: var(--orange); background: var(--orange-tint); }
.word-tile.false { border-color: var(--red); background: var(--red-tint); text-decoration: line-through; }
.word-tile svg { width: 18px; height: 18px; flex: none; }

/* Diff output */
.diff { font: var(--body); line-height: 1.7; }
.diff .ok { color: var(--green); }
.diff .bad { color: var(--red); text-decoration: line-through; }
.diff .missing { color: var(--orange); font-weight: 600; }

/* Results */
.result-hero { text-align: center; padding: 18px 0 8px; }
.result-hero .big { font: 800 56px/1 var(--font-rounded); letter-spacing: -0.03em; }
.result-hero .big small { font: 600 20px/1 var(--font-rounded); color: var(--label-2); }
.result-hero .sub { font: var(--callout); color: var(--label-2); margin-top: 6px; }

/* Lesson content */
.lesson h2 { font: var(--title2); margin: 22px 0 8px; letter-spacing: -0.015em; }
.lesson h3 { font: var(--headline); margin: 16px 0 6px; }
.lesson p { margin: 0 0 10px; }
.lesson .rule { background: var(--blue-tint); border-radius: var(--r-md); padding: 12px 14px; margin: 8px 0; }
.lesson .rule .rule-text { font: var(--headline); }
.lesson .rule .rule-ex { font: var(--subhead); color: var(--label-2); margin-top: 4px; }
.lesson .mistake { display: grid; grid-template-columns: 22px 1fr; gap: 6px 8px; align-items: start; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg-tertiary); margin: 8px 0; }
.lesson .mistake .x { color: var(--red); font-weight: 700; }
.lesson .mistake .v { color: var(--green); font-weight: 700; }
.lesson .mistake .why { grid-column: 1 / -1; font: var(--footnote); color: var(--label-2); }
.lesson .mistake .wrong { text-decoration: line-through; color: var(--label-2); }
.lesson .pt-note { background: var(--green-tint); border-radius: var(--r-md); padding: 12px 14px; margin: 10px 0; font: var(--subhead); }
.lesson .pt-note b { color: var(--green); }
.lesson ul { padding-left: 20px; margin: 0 0 10px; }
.lesson li { margin: 3px 0; }

/* Photo prompt */
.photo { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-lg); object-fit: cover; background: var(--fill-3); box-shadow: var(--shadow-card); }

/* Checklist */
.check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; }
.check .box { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--label-3); flex: none; display: grid; place-items: center; margin-top: 1px; }
.check.on .box { background: var(--green); border-color: var(--green); color: #fff; }
.check .box svg { width: 14px; height: 14px; }
.check.flag .box { background: var(--red); border-color: var(--red); color: #fff; }

/* Flag list (error checker) */
.flag-item { padding: 10px 12px; border-radius: var(--r-md); background: var(--red-tint); margin-top: 8px; font: var(--subhead); }
.flag-item b { color: var(--red); }
.flag-item .fix { color: var(--green); font-weight: 600; }

/* ---------- Sheets ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 40; animation: fade-in var(--t-med) ease; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: var(--content-w);
  max-height: 88dvh; overflow-y: auto;
  background: var(--bg-elevated); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 10px 20px calc(var(--safe-b) + 24px);
  z-index: 41; box-shadow: var(--shadow-float);
  animation: sheet-in var(--t-slow) var(--ease-sheet);
}
.sheet .grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill); margin: 0 auto 16px; }
.sheet.closing { animation: sheet-out var(--t-med) var(--ease-in-out) forwards; }
.sheet-backdrop.closing { animation: fade-out var(--t-med) ease forwards; }
@keyframes sheet-in { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes sheet-out { from { transform: translate(-50%, 0); } to { transform: translate(-50%, 100%); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: calc(var(--safe-t) + 12px); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast {
  background: var(--label); color: var(--bg); font: 600 14px/1.2 var(--font);
  padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow-float);
  animation: toast-in var(--t-med) var(--ease-out);
  display: flex; align-items: center; gap: 8px; max-width: min(92vw, 420px);
}
.toast.out { animation: toast-out var(--t-med) var(--ease-in-out) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(0.98); } }

/* ---------- Confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0.6; } }

/* ---------- Onboarding ---------- */
.onboard { min-height: calc(100dvh - 40px); display: flex; flex-direction: column; }
.onboard .hero { text-align: center; padding: 40px 0 24px; }
.onboard .hero .logo { width: 96px; height: 96px; border-radius: 24px; margin: 0 auto 20px; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue), var(--indigo)); color: #fff; font: 800 40px/1 var(--font-rounded); box-shadow: var(--shadow-float); letter-spacing: -0.04em; }
.onboard .features { display: flex; flex-direction: column; gap: 18px; padding: 10px 6px; flex: 1; }
.onboard .feature { display: flex; gap: 14px; align-items: flex-start; }
.onboard .feature .f-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; }
.onboard .feature .f-icon svg { width: 22px; height: 22px; }
.onboard .feature .f-title { font: var(--headline); }
.onboard .feature .f-desc { font: var(--subhead); color: var(--label-2); }
.onboard .actions { padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }

/* ---------- Misc ---------- */
.divider { height: 0.5px; background: var(--separator); margin: 14px 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--fill); border-top-color: var(--blue); animation: spin 600ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 40px 20px; color: var(--label-2); }
.empty .big-emoji { font-size: 44px; margin-bottom: 10px; }
.speaker { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--blue-tint); color: var(--blue); }
.speaker svg { width: 20px; height: 20px; }
.speaker:active { transform: scale(0.92); }
.kbd-hint { font: var(--caption); color: var(--label-3); text-align: center; margin-top: 10px; }
@media (max-width: 640px) { .kbd-hint { display: none; } }
.fade-in { animation: view-in var(--t-med) var(--ease-out); }
.shake { animation: shake 320ms var(--ease-out); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.pop { animation: pop 260ms var(--ease-out); }
@keyframes pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
.mastery-bar { display: flex; gap: 3px; height: 6px; }
.mastery-bar i { flex: 1; border-radius: 3px; background: var(--fill-3); }
.mastery-bar i.on { background: var(--green); }
.streak-flame { display: inline-flex; align-items: center; gap: 6px; font: 700 15px/1 var(--font-rounded); color: var(--orange); background: var(--orange-tint); padding: 8px 12px; border-radius: 999px; }
.streak-flame svg { width: 16px; height: 16px; }
table.simple { width: 100%; border-collapse: collapse; font: var(--subhead); }
table.simple td, table.simple th { padding: 8px 6px; text-align: left; border-bottom: 0.5px solid var(--separator); vertical-align: top; }
table.simple th { font: 600 12px/1.2 var(--font); color: var(--label-2); text-transform: uppercase; letter-spacing: 0.05em; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
