/* ===== FNP Study Partner — styles ===== */
:root {
  --teal-900:#134e4a; --teal-700:#0f766e; --teal-600:#0d9488; --teal-500:#14b8a6;
  --teal-100:#ccfbf1; --teal-50:#f0fdfa;
  --rose-600:#e11d48; --rose-500:#f43f5e; --rose-100:#ffe4e6;
  --amber-500:#f59e0b; --amber-100:#fef3c7;
  --green-600:#16a34a; --green-100:#dcfce7;
  --slate-900:#0f172a; --slate-700:#334155; --slate-600:#475569;
  --slate-500:#64748b; --slate-400:#94a3b8; --slate-300:#cbd5e1;
  --slate-200:#e2e8f0; --slate-100:#f1f5f9; --slate-50:#f8fafc;

  --bg: var(--slate-100);
  --surface: #ffffff;
  --surface-2: var(--slate-50);
  --border: var(--slate-200);
  --border-strong: var(--slate-300);
  --text: var(--slate-900);
  --text-muted: var(--slate-500);
  --accent: var(--teal-700);
  --accent-strong: var(--teal-900);
  --accent-soft: var(--teal-50);
  /* Layered, restrained shadows — hairline borders do most of the work */
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 12px -6px rgba(15,23,42,.12);
  --shadow-lg: 0 4px 12px -4px rgba(15,23,42,.10), 0 16px 40px -16px rgba(15,23,42,.22);
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 960px;
}
:root[data-theme="dark"] {
  --bg:#0a0f1a; --surface:#111a2b; --surface-2:#0d1524; --border:#1e293b; --border-strong:#293548;
  --text:#e8eef7; --text-muted:#94a3b8; --accent:#2dd4bf; --accent-strong:#5eead4; --accent-soft:#0f2a2a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px -10px rgba(0,0,0,.6);
  --shadow-lg: 0 8px 30px -12px rgba(0,0,0,.7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0a0f1a; --surface:#111a2b; --surface-2:#0d1524; --border:#1e293b; --border-strong:#293548;
    --text:#e8eef7; --text-muted:#94a3b8; --accent:#2dd4bf; --accent-strong:#5eead4; --accent-soft:#0f2a2a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px -10px rgba(0,0,0,.6);
    --shadow-lg: 0 8px 30px -12px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
:root { --font-scale: 1; }
.view { zoom: var(--font-scale, 1); }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
  transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
}
.offline-bar {
  background: var(--amber-500); color: #3a2a00; text-align: center; font-size: 13px; font-weight: 700;
  padding: 6px 12px; position: sticky; top: 0; z-index: 30;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  line-height: 1.55; letter-spacing: -0.006em;
  font-feature-settings: "kern" 1, "liga" 1, "cv11" 1;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
h1,h2,h3,h4 { margin: 0 0 .4em; line-height: 1.22; letter-spacing: -.021em; font-weight: 700; }
h1 { letter-spacing: -.03em; }
h2 { font-size: 21px; }
p { margin: 0 0 .8em; }
a { color: var(--accent); text-underline-offset: 2px; }

/* ===== App layout ===== */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px; background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display:flex; align-items:center; gap:9px; background:none; border:none; padding:0; color:var(--text); }
.brand-mark { font-size: 21px; }
.brand-name { font-weight: 750; letter-spacing: -.02em; font-size: 16px; }
.topbar-right { display:flex; align-items:center; gap:10px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 700; padding: 6px 11px; border-radius: 999px;
  background: var(--amber-100); color: #b45309; white-space: nowrap;
}
.chip .ico { color: var(--amber-500); }
:root[data-theme="dark"] .chip { background:#3a2f10; color:#fcd34d; }
.icon-btn {
  border:1px solid var(--border); background: var(--surface); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; font-size: 16px;
  transition: border-color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }

.tabbar {
  position: sticky; top: 61px; z-index: 15;
  display: flex; gap: 2px; padding: 7px 12px; overflow-x: auto;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display:none; }
.tab {
  display:flex; flex-direction: column; align-items:center; gap:3px;
  border:none; background:none; color: var(--text-muted);
  padding: 6px 14px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  transition: color .15s, background .15s;
}
.tab .tab-ico { display: inline-flex; align-items: center; justify-content: center; height: 20px; }
.tab.active { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.tab:hover:not(.active) { color: var(--text); background: var(--surface-2); }

.view { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 20px 16px 40px; }
.footer {
  max-width: var(--maxw); margin: 0 auto; width: 100%;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding: 16px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 13px;
  flex-wrap: wrap;
}
.link-btn { display:inline-flex; align-items:center; gap:6px; background:none; border:none; color: var(--text-muted); font-size:13px; font-weight:600; padding:6px 8px; border-radius:8px; }
.link-btn:hover { color: var(--text); background: var(--surface-2); }
.footer-note { opacity:.8; }

/* ===== Cards / generic ===== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px;
}
.card + .card { margin-top: 14px; }
/* Clickable cards (buttons/links styled as cards) get a subtle lift */
button.card, a.card { color: var(--text); font: inherit; transition: border-color .15s ease, box-shadow .2s ease, transform .06s ease; }
button.card:hover, a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
button.card:active, a.card:active { transform: translateY(1px); }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-muted); font-weight: 700; margin: 24px 4px 10px; }

/* Inline SVG icons — inherit text color, align with text */
.ico { display: inline-flex; align-items: center; justify-content: center; vertical-align: -.15em; color: inherit; flex: 0 0 auto; }
.ico svg { display: block; }
.view-header { display: flex; align-items: center; gap: 10px; margin: 2px 0 6px; }
.view-header .vh-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.view-header .vh-left .ico { color: var(--accent); }
.view-header h2 { font-size: 21px; }
/* Icon sitting inside a button inherits the button's weight/color cleanly */
.btn .ico { vertical-align: -.15em; }

/* Feature-row cards: leading icon tile, content, trailing arrow */
.feature-row { display:flex; width:100%; align-items:center; gap:13px; text-align:left; cursor:pointer; }
.feature-ico { flex:0 0 auto; width:40px; height:40px; border-radius:11px; display:grid; place-items:center;
  background: var(--accent-soft); color: var(--accent); }
.feature-go { color: var(--text-muted); flex:0 0 auto; }
button.feature-row:hover .feature-go { color: var(--accent); }
.task-ico { flex:0 0 auto; width:34px; height:34px; border-radius:9px; display:grid; place-items:center; background: var(--accent-soft); }

/* Domain badge — colored initial tile */
.domain-badge {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  border-radius: 7px; font-size: 10px; font-weight: 800; letter-spacing: .01em;
  vertical-align: -.35em;
  background: color-mix(in srgb, var(--dc) 15%, transparent);
  color: var(--dc);
}
:root[data-theme="dark"] .domain-badge { background: color-mix(in srgb, var(--dc) 26%, transparent); color: color-mix(in srgb, var(--dc) 65%, white); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .domain-badge { background: color-mix(in srgb, var(--dc) 26%, transparent); color: color-mix(in srgb, var(--dc) 65%, white); } }
/* When used in a flex row, drop the inline vertical nudge */
.row > .domain-badge, .rowitem > .domain-badge, .dbrow > .domain-badge { vertical-align: 0; }
.muted { color: var(--text-muted); }
.center { text-align: center; }

/* Buttons */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 11px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14.5px; text-decoration:none;
  transition: transform .06s ease, box-shadow .2s ease, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 650; box-shadow: 0 1px 2px rgba(13,148,136,.25); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
:root[data-theme="dark"] .btn.primary { color:#04201d; }
.btn.rose { background: var(--rose-600); border-color: var(--rose-600); color:#fff; font-weight: 650; }
.btn.rose:hover { background: var(--rose-500); border-color: var(--rose-500); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn.block { display:flex; width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.row { display:flex; gap:10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; align-items:center; }
.spacer { flex: 1; }

/* Inputs */
label.field { display:block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
label.field span { display:block; margin-bottom: 6px; }
input[type="date"], input[type="text"], input[type="number"], select {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 15px; font-family: inherit;
}
input:focus, select:focus, .btn:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt:focus-visible, .icon-btn:focus-visible, .pill:focus-visible, .rowitem:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 10px 0; font-weight: 700; }
.skip-link:focus { left: 0; }
.pill-group { display:flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600;
  transition: border-color .15s, background .15s, color .15s;
}
.pill:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill.on:hover { background: var(--accent-strong); }
:root[data-theme="dark"] .pill.on { color:#04201d; }

/* Stat tiles */
.stat { text-align:center; padding: 16px 12px; }
.stat .big { font-size: 29px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 11.5px; color: var(--text-muted); font-weight:600; text-transform:uppercase; letter-spacing:.06em; margin-top: 2px; }
.stat .sub { font-size: 12px; color: var(--text-muted); }

/* Progress bars & rings */
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow:hidden; border:1px solid var(--border); }
.bar > i { display:block; height:100%; background: linear-gradient(90deg, var(--teal-500), var(--teal-700)); border-radius:999px; transition: width .5s ease; }
.bar.rose > i { background: linear-gradient(90deg, var(--rose-500), var(--rose-600)); }
.bar.amber > i { background: linear-gradient(90deg, #fbbf24, var(--amber-500)); }
.bar.green > i { background: linear-gradient(90deg, #4ade80, var(--green-600)); }

.ring { --p: 0; --size: 128px; --track: var(--surface-2); --fill: var(--accent);
  width: var(--size); height: var(--size); border-radius: 50%;
  background: conic-gradient(var(--fill) calc(var(--p) * 1%), var(--track) 0);
  display:grid; place-items:center; margin: 0 auto;
}
.ring::before { content:""; position:absolute; }
.ring .ring-inner {
  width: calc(var(--size) - 22px); height: calc(var(--size) - 22px); border-radius:50%;
  background: var(--surface); display:grid; place-items:center; text-align:center;
}
.ring .ring-inner b { font-size: 26px; }
.ring .ring-inner small { display:block; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing:.06em; }

/* Countdown hero */
.hero {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.16), transparent 55%),
    linear-gradient(135deg, var(--teal-900), var(--teal-600) 90%);
  color:#fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::after {
  content:""; position:absolute; right:-40px; top:-40px; width:180px; height:180px;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 70%); pointer-events:none;
}
.hero h2 { color:#fff; }
.hero .days { font-size: 54px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.hero .days small { font-size: 16px; font-weight: 600; opacity: .9; }
.hero .meta { opacity: .92; font-size: 14px; margin-top: 6px; }
.hero .hero-bar { margin-top: 14px; background: rgba(255,255,255,.25); }
.hero .hero-bar > i { background: #fff; }

/* Flashcard */
.flash-wrap { max-width: 620px; margin: 10px auto; }
.flashcard {
  perspective: 1600px; width: 100%; height: 340px; margin: 14px 0; cursor: pointer;
}
.flashcard-inner { position: relative; width:100%; height:100%; transition: transform .5s; transform-style: preserve-3d; }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flash-face {
  position:absolute; inset:0; backface-visibility:hidden; -webkit-backface-visibility:hidden;
  border-radius: var(--radius); border:1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow); padding: 26px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center;
  overflow: auto;
}
.flash-face .tag { position:absolute; top:14px; left:16px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color: var(--text-muted); }
.flash-face .hint { position:absolute; bottom:14px; font-size:12px; color: var(--text-muted); }
.flash-front .q { font-size: 22px; font-weight: 700; }
.flash-back { transform: rotateY(180deg); background: var(--accent-soft); }
.flash-back .a { font-size: 18px; }
.grade-row { display:grid; grid-template-columns: repeat(4,1fr); gap:8px; }
.grade-row .btn { flex-direction:column; padding: 10px 6px; font-size:13px; }
.grade-row .btn small { font-weight:600; opacity:.7; font-size:11px; }

/* Quiz */
.q-stem { font-size: 17.5px; font-weight: 600; line-height: 1.5; margin-bottom: 16px; letter-spacing: -.01em; }
.conf-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin: 0 0 12px; }
.pill.sm { padding: 5px 11px; font-size: 12px; }
.options { display:flex; flex-direction: column; gap: 10px; }
.opt {
  text-align:left; border:1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 13px 15px; font-size: 15px; display:flex; gap:12px; align-items:flex-start;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.opt:hover:not(.locked) { border-color: var(--accent); background: var(--accent-soft); }
.opt .key { font-weight: 700; color: var(--text-muted); min-width: 1em; }
.opt.multi { align-items: center; }
.opt .checkbox { flex:0 0 auto; width:20px; height:20px; border-radius:6px; border:2px solid var(--border-strong); display:inline-flex; align-items:center; justify-content:center; color:#fff; }
.opt .checkbox.on { background: var(--accent); border-color: var(--accent); }
.opt.correct .checkbox { background: var(--green-600); border-color: var(--green-600); }
.opt.wrong .checkbox { background: var(--rose-600); border-color: var(--rose-600); }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.opt.correct { border-color: var(--green-600); background: var(--green-100); color:#14532d; }
.opt.wrong { border-color: var(--rose-600); background: var(--rose-100); color:#881337; }
:root[data-theme="dark"] .opt.correct { background:#0f2e1c; color:#86efac; }
:root[data-theme="dark"] .opt.wrong { background:#3a1420; color:#fda4af; }
.opt.locked { cursor: default; }
.rationale {
  margin-top: 14px; padding: 15px 16px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); border-left: 3px solid var(--accent); font-size: 14px; line-height: 1.6;
}
.rationale .verdict { font-weight: 800; }
.rationale .verdict.ok { color: var(--green-600); }
.rationale .verdict.no { color: var(--rose-600); }
.quiz-top { display:flex; align-items:center; gap:12px; margin-bottom: 14px; }
.quiz-top .bar { flex:1; }
.qcount { font-size: 13px; color: var(--text-muted); font-weight:700; white-space:nowrap; }
.badge { display:inline-block; font-size:10.5px; font-weight:700; padding:3px 9px; border-radius:999px; background:var(--surface-2); color:var(--text-muted); text-transform:uppercase; letter-spacing:.06em; }
.badge.easy { background: var(--green-100); color:#166534; }
.badge.medium { background: var(--amber-100); color:#92400e; }
.badge.hard { background: var(--rose-100); color:#9f1239; }

/* Onboarding */
.onboarding { position: fixed; inset:0; z-index: 50; background: var(--bg); display:grid; place-items:center; padding: 20px; overflow:auto; }
.onboard-card { max-width: 520px; width: 100%; }
.onboard-hero { text-align:center; margin-bottom: 18px; }
.onboard-hero .logo { font-size: 46px; }
.onboard-hero h1 { font-size: 26px; letter-spacing: -.02em; }

/* Exam timer */
.exam-hud { position: sticky; top: 110px; z-index: 12; display:flex; align-items:center; gap:12px; background: var(--surface); border:1px solid var(--border); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); margin-bottom: 14px; }
.exam-hud .timer { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.exam-hud .timer.warn { color: var(--rose-600); }
.exam-nav-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap:6px; }
.qbtn { border:1px solid var(--border); background:var(--surface); color:var(--text); border-radius:8px; padding:8px 0; font-size:12px; font-weight:700; }
.qbtn.answered { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.qbtn.flagged { border-color: var(--amber-500); }
.qbtn.current { outline: 2px solid var(--accent); }

/* Misc */
.list { display:flex; flex-direction: column; gap: 10px; }
.rowitem { display:flex; align-items:center; gap:12px; padding:12px 14px; border:1px solid var(--border); border-radius:12px; background:var(--surface); }
.rowitem .grow { flex:1; min-width:0; }
.rowitem h4 { margin:0; font-size:15px; }
.rowitem .sub { font-size: 13px; color: var(--text-muted); }
.check { width:26px; height:26px; border-radius:50%; border:2px solid var(--border); display:grid; place-items:center; font-size:14px; color:transparent; }
.check.done { background: var(--green-600); border-color: var(--green-600); color:#fff; }
.day-phase { font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; padding:3px 8px; border-radius:999px; }
.phase-foundation { background: var(--teal-50); color: var(--teal-700); }
.phase-build { background: #eef2ff; color:#4338ca; }
.phase-review { background: var(--amber-100); color:#92400e; }
.phase-final { background: var(--rose-100); color:#9f1239; }
:root[data-theme="dark"] .phase-foundation{background:#0f2a2a;color:#5eead4}
:root[data-theme="dark"] .phase-build{background:#1e1b4b;color:#a5b4fc}
:root[data-theme="dark"] .phase-review{background:#3a2f10;color:#fcd34d}
:root[data-theme="dark"] .phase-final{background:#3a1420;color:#fda4af}

.empty { text-align:center; padding: 40px 20px; color: var(--text-muted); }
.empty .big-ico { font-size: 44px; }
.toast { position: fixed; left:50%; bottom: 24px; transform: translateX(-50%); background: var(--slate-900); color:#fff; padding: 12px 18px; border-radius: 12px; font-weight:600; z-index: 60; box-shadow: var(--shadow); opacity:0; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.today-badge { font-size:11px; font-weight:800; color:#fff; background:var(--accent); padding:2px 8px; border-radius:999px; }

/* View transition */
.view { animation: viewIn .28s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.reduce-motion .view { animation: none; }

/* Confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; opacity: .95; animation-name: confetti-fall; animation-timing-function: cubic-bezier(.3,.6,.5,1); animation-fill-mode: forwards; }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(680deg); opacity: .85; } }

/* Lessons / reader */
.lesson { max-width: 720px; margin: 0 auto; }
.lesson-title { font-size: 26px; letter-spacing: -.02em; margin-bottom: 4px; }
.lesson-intro { font-size: 16px; color: var(--text-muted); border-left: 3px solid var(--accent); padding-left: 14px; margin: 10px 0 20px; }
.lesson-section { margin: 22px 0; }
.lesson-section h3 { font-size: 18px; color: var(--accent); margin-bottom: 10px; }
.lesson-points { margin: 0; padding-left: 0; list-style: none; display:flex; flex-direction:column; gap:10px; }
.lesson-points li { position: relative; padding-left: 26px; font-size: 15.5px; line-height: 1.55; }
.lesson-points li::before { content: "▸"; position: absolute; left: 6px; color: var(--accent); font-weight: 800; }
.pearl { display:flex; gap:10px; align-items:flex-start; margin-top: 14px; padding: 14px 16px; background: var(--amber-100); border-radius: 12px; font-size: 14.5px; color:#78350f; }
:root[data-theme="dark"] .pearl { background: #3a2f10; color: #fde68a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pearl { background:#3a2f10; color:#fde68a; } }
.pearl-ico { font-size: 18px; flex: 0 0 auto; }
.keypoints { margin-top: 26px; padding: 18px 20px; background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.keypoints h3 { color: var(--accent); font-size: 17px; margin-bottom: 10px; }
.keypoints ul { margin: 0; padding-left: 20px; display:flex; flex-direction:column; gap:8px; }
.keypoints li { font-size: 15px; }
.table-wrap { overflow-x: auto; margin: 14px 0; border-radius: 12px; border: 1px solid var(--border); }
.lesson-table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 460px; }
.lesson-table caption { text-align: left; font-weight: 700; padding: 10px 12px; color: var(--text-muted); }
.lesson-table th, .lesson-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.lesson-table thead th { background: var(--surface-2); font-weight: 700; position: sticky; top: 0; }
.lesson-table tbody tr:last-child td { border-bottom: none; }
.lesson-footer { max-width: 720px; margin: 24px auto 0; padding-top: 18px; border-top: 1px solid var(--border); }

.result-hero { text-align:center; padding: 10px 0 20px; }
.result-hero .score { font-size: 56px; font-weight: 800; }
.result-hero .pass { color: var(--green-600); }
.result-hero .fail { color: var(--rose-600); }

@media (max-width: 500px) {
  .brand-name { display:none; }
  .hero .days { font-size: 46px; }
}

/* Print — clean study-sheet output for lessons & reference */
@media print {
  .topbar, .tabbar, .footer, .offline-bar, .quiz-top, .lesson-footer, .skip-link,
  .icon-btn, .btn, .reinforce, details > summary { display: none !important; }
  body, .app, .view { background: #fff !important; color: #000 !important; }
  .view { zoom: 1 !important; max-width: 100%; padding: 0; }
  .card, .keypoints, .pearl { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  .lesson-table th, .lesson-table td { border-color: #999 !important; }
  .lesson-section, .lesson-table, .keypoints { break-inside: avoid; }
  a { color: #000 !important; text-decoration: none; }
  h1, h2, h3 { color: #000 !important; }
}

/* Keyboard shortcut help modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn .15s ease;
}
.reduce-motion .modal-overlay { animation: none; }
.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,.3); max-height: 85vh; overflow-y: auto;
}
.kbd-list { display: flex; flex-direction: column; }
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; background: var(--surface-2); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; color: var(--text);
  white-space: nowrap;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
