/* =====================================================================
   Level I Prep — app styles.
   1. Adult-audience readability: 16px+ base typography, 1.62–1.68 line
      height, 68ch optimal reading measure, WCAG 2.1 AA+ contrast ratios,
      and accessible focus rings.
   2. NotebookLM-style fluid Concept & Calc Cards: floating card stack,
      whole-card flip/morph, editorial insight callouts, tactile BA II Plus
      keycaps, and Focus Stack vs Study Guide Grid modes.
   3. Prometric CBT Exam screen: docked left Question Navigator sidebar,
      3 official Prometric contrast themes, timer hide/show, and true
      select/deselect/strikethrough mechanics.
   ===================================================================== */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #edf1f6;
  --border: #d7dee7;
  --text: #131e2c;
  --muted: #4a5868;
  --faint: #5c6a7b; /* >= 4.8:1 contrast on #fff and >= 4.5:1 on #edf1f6 (WCAG AA+) */
  --navy: #0b2545;
  --navy-2: #13315c;
  --accent: #1a5bb8;
  --accent-soft: #e6effc;
  --accent-text: #134a9e;
  --good: #197c46;
  --good-soft: #e3f4ea;
  --mid: #9c6514;
  --mid-soft: #fbf0db;
  --bad: #bf342a;
  --bad-soft: #fbe9e7;
  --code-bg: #0f1d33;
  --code-text: #d7e5ff;
  --shadow: 0 1px 3px rgba(16, 33, 54, .06), 0 4px 14px rgba(16, 33, 54, .05);
  --shadow-lg: 0 8px 28px rgba(16, 33, 54, .09), 0 2px 6px rgba(16, 33, 54, .05);
  --radius: 14px;
  --measure: 68ch;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, "SFMono-Regular", monospace;
  --side-w: 252px;
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1420; --surface: #121c2c; --surface-2: #192638; --border: #28374b;
    --text: #e8eef6; --muted: #a6b4c6; --faint: #8c9cb0; /* >= 4.6:1 contrast on dark surfaces */
    --navy: #08182e; --navy-2: #0f2442;
    --accent: #5b93ea; --accent-soft: #172b4a; --accent-text: #a4c6ff;
    --good: #43bc80; --good-soft: #102a1e; --mid: #e5ab4f; --mid-soft: #2e2412; --bad: #f27268; --bad-soft: #321816;
    --code-bg: #08111f;
    --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .28);
    --shadow-lg: 0 12px 34px rgba(0, 0, 0, .42), 0 2px 8px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1420; --surface: #121c2c; --surface-2: #192638; --border: #28374b;
  --text: #e8eef6; --muted: #a6b4c6; --faint: #8c9cb0;
  --navy: #08182e; --navy-2: #0f2442;
  --accent: #5b93ea; --accent-soft: #172b4a; --accent-text: #a4c6ff;
  --good: #43bc80; --good-soft: #102a1e; --mid: #e5ab4f; --mid-soft: #2e2412; --bad: #f27268; --bad-soft: #321816;
  --code-bg: #08111f;
  --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .28);
  --shadow-lg: 0 12px 34px rgba(0, 0, 0, .42), 0 2px 8px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 1.55; }
.measure { max-width: var(--measure); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.t-good { color: var(--good); } .t-mid { color: var(--mid); } .t-bad { color: var(--bad); }

/* ---------- icons */
.ico { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ico svg { width: 100%; height: 100%; }
.ico.sm { width: 16px; height: 16px; }
.ico.xl { width: 48px; height: 48px; }

/* ---------- shell */
.shell { min-height: 100vh; }
.sidenav { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: #fff; color: var(--navy); font-weight: 800; font-size: 14.5px; letter-spacing: -.3px; flex: none; }
.brand-name { font-size: 17.5px; font-weight: 700; white-space: nowrap; line-height: 1.2; }
.brand-name small { display: block; font-size: 12px; font-weight: 500; opacity: .78; }
.topbar .icon-btn { background: transparent; border-color: rgba(255, 255, 255, .22); color: #fff; }
.view { max-width: 1060px; margin: 0 auto; padding: 20px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); outline: none; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; color: var(--muted); text-decoration: none; font-weight: 500; }
.tabbar a[aria-current="page"] { color: var(--accent-text); font-weight: 700; }

@media (min-width: 980px) {
  .topbar, .tabbar { display: none; }
  .shell { display: grid; grid-template-columns: var(--side-w) 1fr; }
  .sidenav {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--navy); color: #d9e3f0; padding: 20px 14px;
  }
  .sidenav .brand { padding: 4px 8px 22px; color: #fff; }
  .sidenav nav { display: grid; gap: 3px; }
  .sidenav nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px;
    color: #cdd9ea; text-decoration: none; font-weight: 600; font-size: 15px;
  }
  .sidenav nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
  .sidenav nav a[aria-current="page"] { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset 3px 0 0 #7fb2ff; }
  .nav-label { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #95a8c2; padding: 18px 12px 6px; }
  .nav-badge { margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: 10px; background: #f0b44c; color: #2b1d00; font-size: 12px; font-weight: 800; text-align: center; }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 8px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
  .side-foot .icon-btn { background: transparent; border-color: rgba(255, 255, 255, .2); color: #dbe5f2; }
  .view { padding: 32px 36px 56px; }
}
.save-state { font-size: 12.5px; color: #b0c0d6; display: flex; align-items: center; gap: 6px; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #8da1bc; }
.save-state[data-s="ok"]::before { background: #4cc38a; }
.save-state[data-s="busy"]::before { background: #7fb2ff; animation: pulse 1s infinite; }
.save-state[data-s="error"]::before { background: #ff7b70; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- layout helpers */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; margin-top: 20px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stack > * + * { margin-top: 16px; }
.grid2 { display: grid; gap: 16px; margin-top: 16px; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 28px; line-height: 1.22; margin: 2px 0 6px; letter-spacing: -.3px; }
.sub { color: var(--muted); margin: 0; max-width: 68ch; font-size: 15.5px; line-height: 1.55; }
.eyebrow { display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-text); }
.label { font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.crumb { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.crumb a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; margin-top: 16px; }
.card h2 { font-size: 19px; margin: 0 0 8px; line-height: 1.3; }
.card h3 { font-size: 16px; margin: 0 0 6px; line-height: 1.35; }
.empty { text-align: center; padding: 44px 22px; }
.empty .ico { width: 46px; height: 46px; color: var(--good); }
.empty h2 { margin: 12px 0 6px; }
.empty .btn { margin-top: 16px; }

/* ---------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border-radius: 9px; border: 1px solid transparent; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); font-weight: 600; }
.btn.soft { background: var(--accent-soft); color: var(--accent-text); }
.btn.danger { background: var(--bad); }
.btn.sm { min-height: 36px; padding: 0 13px; font-size: 14px; }
.btn.lg { min-height: 50px; padding: 0 24px; font-size: 16.5px; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 8px; }
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--accent-text); font-weight: 600; text-decoration: none; cursor: pointer; }
.link-btn.small { font-size: 14px; }
.link-btn.light { color: #fff; text-decoration: underline; }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.mid { background: var(--mid-soft); color: var(--mid); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.count { font-size: 12.5px; font-weight: 600; color: var(--faint); }
select, input[type="search"], input[type="text"], input[type="password"], input[type="number"], input[type="date"], textarea {
  border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 8px 12px; min-height: 40px; max-width: 100%; font-size: 15px;
}
textarea { width: 100%; min-height: 84px; resize: vertical; }
.field { display: grid; gap: 6px; margin-top: 12px; font-size: 14px; font-weight: 600; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; }
.toolbar.sticky { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; }
@media (max-width: 979px) { .toolbar.sticky { top: 52px; } }
.seg { display: inline-flex; gap: 3px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; border-radius: 8px; padding: 7px 13px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip[aria-pressed="true"] .count { color: #d0def2; }
.search { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--surface); border-radius: 11px; padding: 0 14px; color: var(--muted); }
.search input { border: 0; outline: 0; flex: 1; min-height: 48px; padding: 0; background: none; font-size: 15.5px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 8px 0 6px; }
.tabs a { padding: 11px 16px; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; font-size: 15px; }
.tabs a[aria-current="true"] { color: var(--text); border-bottom-color: var(--accent); }
kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface); color: var(--text); }
.kbd-inline { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .35); color: #fff; margin-left: 4px; }

/* ---------- tables */
.table-wrap { overflow-x: auto; margin-top: 10px; }
.tbl { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.tbl th { font-size: 12.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.click tbody tr { cursor: pointer; }
.tbl.click tbody tr:hover { background: var(--surface-2); }
.tbl .warn-row td { background: var(--mid-soft); }
.tbl.heat td.hm { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 44px; border: 2px solid var(--surface); border-radius: 6px; }
.hm.good { background: var(--good-soft); color: var(--good); } .hm.mid { background: var(--mid-soft); color: var(--mid); } .hm.bad { background: var(--bad-soft); color: var(--bad); } .hm.none { color: var(--faint); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; font-size: 14.5px; }
.kv span:nth-child(even) { font-family: var(--mono); color: var(--muted); text-align: right; }
.sbar { position: relative; display: inline-block; width: 90px; height: 7px; border-radius: 4px; background: var(--surface-2); vertical-align: middle; }
.sbar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.sbar b { position: absolute; left: 70%; top: -3px; bottom: -3px; width: 2px; background: var(--faint); }
i.good { background: var(--good); } i.mid { background: var(--mid); } i.bad { background: var(--bad); }

/* ---------- dashboard */
.welcome {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 70%, #1d4a85 100%); color: #fff; border-radius: 16px; padding: 26px;
}
.welcome .eyebrow { color: #a4c6ff; }
.welcome h1 { font-size: 28px; margin: 6px 0 6px; letter-spacing: -.3px; }
.welcome p { margin: 0; color: #d2def0; font-size: 15.5px; }
.welcome-stats { display: flex; gap: 0; background: rgba(0, 0, 0, .2); border-radius: 12px; }
.welcome-stats > div { padding: 13px 22px; text-align: center; }
.welcome-stats > div + div { border-left: 1px solid rgba(255, 255, 255, .14); }
.welcome-stats b { display: block; font-size: 25px; font-variant-numeric: tabular-nums; }
.welcome-stats b small { font-size: 13.5px; opacity: .7; }
.welcome-stats span { font-size: 12.5px; color: #c0d0e6; }
.tiles { display: grid; gap: 14px; margin-top: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.tile-link { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.tile-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile-link > div { flex: 1; min-width: 0; }
.tile-link b { display: block; font-size: 16px; }
.tile-link span { font-size: 14px; color: var(--muted); }
.tile-link .ti { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); }
.todo { padding-left: 22px; margin: 10px 0 0; max-width: var(--measure); }
.todo li { margin: 10px 0; line-height: 1.62; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 16px; padding: 16px 18px; border-radius: var(--radius); background: var(--mid-soft); border: 1px solid color-mix(in srgb, var(--mid) 40%, transparent); }
.banner > div:first-child { display: flex; align-items: center; gap: 12px; }
.banner > div:first-child > .ico { color: var(--mid); }
.banner b { display: block; }
.banner span { font-size: 14px; color: var(--muted); }

/* =====================================================================
   NotebookLM-Style Fluid Study Studio (Concept & Calc Cards)
   ===================================================================== */
.studio-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.studio-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.studio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--muted);
}
.studio-pill b { color: var(--text); font-variant-numeric: tabular-nums; }
.studio-pill small { color: var(--faint); }
.studio-pill .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.studio-pill .dot.good { background: var(--good); }
.studio-pill .dot.mid { background: var(--mid); }
.studio-controls { margin: 12px 0 0; }

.studio-stage {
  max-width: 820px;
  margin: 18px auto 0;
}
.studio-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 8px;
  padding: 0 4px;
}
.studio-pos { font-weight: 700; color: var(--text); }
.deck-progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: 16px; border: 1px solid var(--border); }
.deck-progress i { display: block; height: 100%; background: var(--accent); transition: width .35s cubic-bezier(0.22, 1, 0.36, 1); }

/* Tactile stacked card depth */
.card-stack-wrap {
  position: relative;
  z-index: 1;
  margin-bottom: 24px;
}
.card-stack-wrap::before,
.card-stack-wrap::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  pointer-events: none;
  transition: all .3s cubic-bezier(0.22, 1, 0.36, 1);
}
.card-stack-wrap::before {
  width: calc(100% - 28px);
  bottom: -10px;
  height: 28px;
  z-index: -1;
  opacity: .72;
}
.card-stack-wrap::after {
  width: calc(100% - 56px);
  bottom: -19px;
  height: 28px;
  z-index: -2;
  opacity: .42;
}

.flash-studio {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  margin-top: 0;
  padding: 28px 32px;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  user-select: text;
  transition: border-color .2s, transform .25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow .25s;
}
.flash-studio:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}
@media (max-width: 600px) {
  .flash-studio { padding: 20px 18px; border-radius: 18px; }
}
.flash-studio.anim-next { animation: cardSlideNext .32s cubic-bezier(0.22, 1, 0.36, 1); }
.flash-studio.anim-prev { animation: cardSlidePrev .32s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes cardSlideNext {
  from { opacity: 0; transform: translateX(22px) scale(.985); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes cardSlidePrev {
  from { opacity: 0; transform: translateX(-22px) scale(.985); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
.flash-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topic-chip {
  display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: 700; font-size: 12.5px;
}
.deck-name { color: var(--muted); font-weight: 500; }
.flip-badge { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.flash-studio.is-revealed .flip-badge { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }

.flash-front { display: flex; flex-direction: column; flex: 1; animation: fadeSlideUp .25s ease; }
.flash-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 10px; }
.flash-studio.calc .flash-kind { color: var(--mid); }
.flash-q { font-size: 21px; font-weight: 600; line-height: 1.52; margin: 4px 0 16px; color: var(--text); }

/* Progressive Cue / Setup Peek */
.flash-peek-area { margin-top: 6px; margin-bottom: 16px; }
.peek-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 13.5px; font-weight: 600;
  transition: border-color .15s, color .15s;
}
.peek-btn:hover { border-color: var(--accent); color: var(--text); }
.peek-box {
  margin-top: 10px; padding: 14px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 15px; line-height: 1.62; color: var(--text); animation: fadeSlideUp .22s ease;
}
.cue-keys { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }

.flash-footer-prompt {
  margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 13.5px; color: var(--muted);
}
.flip-cta { font-weight: 700; color: var(--accent-text); }

/* Back / Synthesized Answer Side */
.flash-back { display: flex; flex-direction: column; gap: 16px; animation: fadeSlideUp .28s cubic-bezier(0.22, 1, 0.36, 1); }
.prompt-echo {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
}
.echo-q { font-size: 14.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.flip-back-hint { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: var(--accent-text); white-space: nowrap; }

.takeaway-box {
  padding: 18px 20px; border-radius: 16px; background: var(--surface-2);
  border-left: 4px solid var(--accent);
}
.takeaway-box.calc { border-left-color: var(--mid); }
.takeaway-box .ans { font-size: 18.5px; font-weight: 600; line-height: 1.58; margin-top: 4px; color: var(--text); }

.insight-box, .keystroke-box {
  padding: 16px 20px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg);
}
.insight-head {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 8px;
}
.insight-box .exp { font-size: 16px; line-height: 1.66; color: var(--text); }

/* Tactile BA II Plus Keystroke Badges */
.key-steps { display: grid; gap: 8px; margin-top: 8px; }
.key-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border);
}
.key-seq { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.keycap {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 28px; padding: 0 9px; border-radius: 6px;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-bottom-width: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.keycap.sm { min-width: 26px; height: 23px; padding: 0 7px; font-size: 11.5px; }
.keycap.fn { background: var(--mid-soft); border-color: color-mix(in srgb, var(--mid) 45%, var(--border)); color: var(--text); }
.keycap.cpt { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent-text); }
.key-val { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text); padding: 0 3px; }
.key-out { font-family: var(--mono); font-size: 13.5px; font-weight: 700; color: var(--good); background: var(--good-soft); padding: 2px 10px; border-radius: 999px; margin-left: auto; }

pre.keys { background: var(--code-bg); color: var(--code-text); border-radius: 10px; padding: 14px 16px; font-family: var(--mono); font-size: 13.5px; overflow-x: auto; margin: 8px 0; white-space: pre-wrap; line-height: 1.55; }

/* Recall Rating Dock */
.flash-nav { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 12px; }
.recall-dock { animation: fadeSlideUp .25s ease; }
.recall-title { text-align: center; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .grades { grid-template-columns: repeat(2, 1fr); } }
.grades button {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 8px;
  border-radius: 13px; border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow); transition: transform .12s, border-color .15s;
}
.grades button:hover { transform: translateY(-1px); border-color: var(--accent); }
.grades .g-title { font-size: 15px; font-weight: 700; }
.grades small { font-family: var(--mono); font-weight: 500; color: var(--muted); font-size: 12px; }
.grades .g1 .g-title { color: var(--bad); } .grades .g3 .g-title { color: var(--mid); } .grades .g4 .g-title { color: var(--good); } .grades .g5 .g-title { color: var(--accent-text); }

/* Study Guide Grid Mode */
.guide-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
@media (max-width: 500px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-card { margin-top: 0; border-radius: 18px; padding: 18px 20px; transition: border-color .15s; }
.guide-card[open] { border-color: var(--accent); }
.guide-card summary { cursor: pointer; list-style: none; }
.guide-card summary::-webkit-details-marker { display: none; }
.guide-q { font-size: 17px; font-weight: 600; line-height: 1.5; color: var(--text); margin: 4px 0 10px; }
.guide-toggle-hint { font-size: 13px; font-weight: 600; color: var(--accent-text); }
.guide-card[open] .guide-toggle-hint { display: none; }
.guide-body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 12px; animation: fadeSlideUp .22s ease; }

.star {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  width: 36px; height: 36px; color: var(--faint); display: inline-grid; place-items: center;
}
.star:hover { border-color: var(--accent); color: var(--text); }
.star[aria-pressed="true"] { color: var(--mid); background: var(--mid-soft); border-color: color-mix(in srgb, var(--mid) 40%, transparent); }
.star[aria-pressed="true"] svg { fill: currentColor; }
.status-New { background: var(--mid-soft); color: var(--mid); }
.status-Learning { background: var(--accent-soft); color: var(--accent-text); }
.status-Review { background: var(--surface-2); color: var(--text); }
.status-Mastered { background: var(--good-soft); color: var(--good); }

/* ---------- formulas */
.fgroup .ftop { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.fgroup .ftop b { color: var(--accent-text); }
.fgroup h2 { font-size: 18.5px; margin: 6px 0 10px; }
.formula { display: flex; align-items: flex-start; gap: 6px; background: var(--code-bg); color: var(--code-text); border-radius: 11px; margin: 10px 0; }
.formula .fbody { flex: 1; min-width: 0; padding: 14px 0 14px 16px; overflow-x: auto; scrollbar-width: thin; }
.formula .fname { display: block; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #9ab0d4; margin-bottom: 6px; }
.formula .katex-display { margin: 0; text-align: left; }
.formula .katex-display > .katex { text-align: left; }
.copy { flex: none; margin: 10px 10px 0 0; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #c4d2ee; }
.rich { font-size: 15.5px; line-height: 1.65; color: var(--text); max-width: var(--measure); }
.rich p { margin: 10px 0; }
ul.rich { margin: 6px 0; padding-left: 22px; }
.rich table { border-collapse: collapse; margin: 10px 0; font-size: 14.5px; }
.rich td, .rich th { border: 1px solid var(--border); padding: 6px 10px; }
.tbl-scroll, .rich .tbl { overflow-x: auto; max-width: 100%; }

/* ---------- tryouts page */
.hero-card { margin-top: 16px; border-radius: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.hero-main { padding: 24px 26px; background: linear-gradient(180deg, var(--accent-soft), var(--surface)); }
.hero-main h2 { font-size: 24px; margin: 6px 0 6px; }
.hero-main p { margin: 0 0 18px; color: var(--muted); font-size: 15.5px; }
.timeline { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; margin-bottom: 20px; }
.timeline > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.timeline b { display: block; font-size: 16px; }
.timeline span { font-family: var(--mono); font-size: 13.5px; color: var(--accent-text); font-weight: 600; }
.timeline small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.timeline .brk { display: flex; flex-direction: column; justify-content: center; text-align: center; background: var(--surface-2); border-style: dashed; }
.timeline .brk span { color: var(--muted); }
@media (max-width: 640px) { .timeline { grid-template-columns: 1fr; } }
.option-card { margin-top: 0; }
.option-card p { margin: 0 0 14px; }
.info ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.info li { margin: 6px 0; line-height: 1.6; }

/* ---------- result page (Adult Readability Upgraded) */
.score-hero { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-top: 16px; padding: 24px 26px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.score-hero p { margin: 6px 0 0; max-width: var(--measure); }
.verdict { font-size: 21px; font-weight: 800; }
.score-hero.good .verdict { color: var(--good); } .score-hero.mid .verdict { color: var(--mid); } .score-hero.bad .verdict { color: var(--bad); }
.ring { --c: var(--accent); width: 128px; height: 128px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0); }
.score-hero.good .ring { --c: var(--good); } .score-hero.mid .ring { --c: var(--mid); } .score-hero.bad .ring { --c: var(--bad); }
.ring b { font-size: 30px; line-height: 1; }
.ring span { font-size: 13.5px; color: var(--muted); }
.sessions { display: grid; gap: 14px; margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.sess { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.sess-num { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 4px 0; }
.sess-num small { font-size: 15px; color: var(--faint); }
.sess.brk { background: var(--surface-2); box-shadow: none; }
.thirds { display: flex; gap: 8px; align-items: flex-end; height: 58px; margin-top: 12px; }
.thirds span { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.thirds i { width: 100%; border-radius: 4px 4px 0 0; }
.thirds small { font-size: 12px; color: var(--faint); }
.tchart { margin-top: 12px; }
.trow { display: grid; grid-template-columns: minmax(160px, 240px) 1fr 56px; gap: 14px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.tname b { display: block; font-size: 15px; font-weight: 600; }
.tname small { font-size: 13px; color: var(--muted); }
.tbar { position: relative; height: 16px; border-radius: 8px; overflow: hidden; display: flex; }
.zone { height: 100%; }
.z1 { width: 50%; background: var(--bad-soft); } .z2 { width: 20%; background: var(--mid-soft); } .z3 { width: 30%; background: var(--good-soft); }
.tbar i { position: absolute; top: 2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); }
.tval { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.tscale { position: relative; height: 20px; margin-left: calc(min(240px, 40%) + 14px); margin-right: 70px; font-size: 12.5px; color: var(--faint); }
.tscale .z { position: absolute; transform: translateX(-50%); top: 3px; }
@media (max-width: 600px) { .trow { grid-template-columns: 1fr 56px; } .trow .tbar { grid-column: 1 / -1; grid-row: 2; } .tscale { display: none; } }

.agrid-wrap + .agrid-wrap { margin-top: 14px; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 5px; margin-top: 6px; }
.agrid a { display: grid; place-items: center; height: 32px; border-radius: 6px; font-size: 12.5px; font-weight: 700; text-decoration: none; position: relative; }
.agrid a.ok { background: var(--good-soft); color: var(--good); }
.agrid a.no { background: var(--bad-soft); color: var(--bad); }
.agrid a.blank { background: var(--surface-2); color: var(--faint); }
.agrid a.flag::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--mid); }
.rq { border-left: 4px solid var(--bad); scroll-margin-top: 76px; }
.rq.ok { border-left-color: var(--good); }
.rq-meta { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
.stem { font-size: 16.5px; line-height: 1.65; max-width: var(--measure); }
.stem p { margin: 0 0 12px; }
.stem ul { margin: 6px 0 12px; padding-left: 24px; }
.stem table { border-collapse: collapse; margin: 10px 0; font-size: 14.5px; }
.stem td, .stem th { border: 1px solid var(--border); padding: 6px 10px; }
.ropts { display: grid; gap: 8px; margin-top: 12px; max-width: var(--measure); }
.ropt { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border: 1px solid var(--border); border-radius: 9px; font-size: 15.5px; line-height: 1.55; }
.ropt.right { border-color: var(--good); background: var(--good-soft); }
.ropt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.ropt em { margin-left: auto; padding-left: 10px; font-size: 12.5px; font-style: normal; font-weight: 700; white-space: nowrap; }
.ropt.right em { color: var(--good); } .ropt.wrong em { color: var(--bad); }
.explain { margin-top: 14px; border-radius: 11px; padding: 16px 18px; background: var(--surface-2); font-size: 15.5px; line-height: 1.66; color: var(--text); max-width: var(--measure); }
.explain p { margin: 0 0 10px; }
.explain p:last-child { margin-bottom: 0; }
.explain ul { padding-left: 22px; margin: 8px 0; }
.rq-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.rq-foot select { margin-left: 6px; }

/* ---------- my review */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; margin: 3px 0; }
.kpi b small { font-size: 14px; color: var(--faint); }
.kpi > small { font-size: 13px; color: var(--muted); }
.kbar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.kbar i { display: block; height: 100%; background: var(--accent); }
svg.trend { width: 100%; height: auto; margin-top: 8px; }
.trend .gl { stroke: var(--border); stroke-width: 1; }
.trend .ax { fill: var(--faint); font-size: 12px; font-family: var(--font); }
.trend .mps { stroke: var(--mid); stroke-width: 1.5; stroke-dasharray: 5 4; }
.trend .mpsl { fill: var(--mid); font-weight: 700; }
.trend path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .s-all { stroke: var(--accent); stroke-width: 3; }
.trend .s-1 { stroke: #7a8ca3; stroke-dasharray: 2 4; }
.trend .s-2 { stroke: #a37ac0; stroke-dasharray: 2 4; }
.trend .dot { stroke: var(--surface); stroke-width: 2; }
.trend .dot.good { fill: var(--good); } .trend .dot.mid { fill: var(--mid); } .trend .dot.bad { fill: var(--bad); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); margin-top: 6px; }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend .s-all::before { background: var(--accent); } .legend .s-1::before { background: #7a8ca3; } .legend .s-2::before { background: #a37ac0; }
.pace { display: grid; gap: 8px; margin-top: 10px; }
.pace > div { display: grid; grid-template-columns: 135px 1fr 48px; gap: 10px; align-items: center; font-size: 14px; }
.pbar { position: relative; height: 8px; background: var(--surface-2); border-radius: 4px; }
.pbar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.pbar b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .5; }
.notebook { margin-top: 12px; }
.notebook details { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; background: var(--surface); }
.notebook details + details { margin-top: 8px; }
.notebook summary { cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.notebook .nb-mod { font-weight: 600; flex: 1; min-width: 160px; }
.notebook details[open] summary { margin-bottom: 12px; }

/* ---------- sheet, toast */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(6, 14, 28, .55); }
.sheet-panel { position: relative; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; background: var(--surface); border-radius: 16px 16px 0 0; padding: 24px 22px calc(24px + env(safe-area-inset-bottom)); border: 1px solid var(--border); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-panel { border-radius: 16px; } }
.sheet-panel h2 { margin: 0 0 8px; font-size: 21px; }
.sheet-panel h3 { margin: 18px 0 8px; font-size: 16px; }
.sheet-body p { margin: 10px 0; line-height: 1.62; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #131e2c; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 70; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 980px) { .toast { bottom: 24px; } }
body.exam-on .toast { top: 82px; bottom: auto; transform: translate(-50%, -10px); }
body.exam-on .toast.show { transform: translate(-50%, 0); }

/* =====================================================================
   Prometric CBT Exam Screen (3 Official Contrast Themes + Docked Sidebar)
   ===================================================================== */
body.exam-on { overflow: hidden; }
body.exam-on .shell { display: none; }

.exam {
  --x-navy: #1b365d;
  --x-navy-2: #274a78;
  --x-bar: #e6ebf1;
  --x-side: #f2f5f8;
  --x-canvas: #ffffff;
  --x-line: #c4cdd8;
  --x-text: #111827;
  --x-muted: #4b5563;
  --x-sel: #dce8fc;
  --x-sel-line: #1d5fbf;
  --x-hl: #ffe769;
  --x-warn-bg: #fff3cd;
  --x-warn-text: #5c4300;
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column;
  background: var(--x-canvas); color: var(--x-text); color-scheme: light;
  font-family: Arial, "Segoe UI", sans-serif; font-size: 16px;
}
.exam[data-p-theme="dark"] {
  --x-navy: #0f1e36;
  --x-navy-2: #162b4d;
  --x-bar: #182232;
  --x-side: #121b28;
  --x-canvas: #0b1017;
  --x-line: #2e3d52;
  --x-text: #f1f5f9;
  --x-muted: #94a3b8;
  --x-sel: #1c3659;
  --x-sel-line: #60a5fa;
  --x-hl: #8a6d00;
  --x-warn-bg: #3b2e05;
  --x-warn-text: #fde047;
  color-scheme: dark;
}
.exam[data-p-theme="yellow"] {
  --x-navy: #1b365d;
  --x-navy-2: #274a78;
  --x-bar: #efe8c8;
  --x-side: #f6f0d2;
  --x-canvas: #fdf9e2;
  --x-line: #ccc396;
  --x-text: #1a1812;
  --x-muted: #57523e;
  --x-sel: #d6e4f7;
  --x-sel-line: #1b4f9c;
  --x-hl: #ffd940;
  --x-warn-bg: #f6e199;
  --x-warn-text: #4d3800;
  color-scheme: light;
}
.exam[data-font="1"] { font-size: 18px; }
.exam[data-font="2"] { font-size: 20px; }

.x-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 18px; background: var(--x-navy); color: #fff; flex: none; user-select: none; }
.x-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.x-title b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-title small { display: block; font-size: 12.5px; color: #c9d7ec; }
.x-logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; background: #fff; color: #1b365d; font-weight: 800; font-size: 12.5px; flex: none; }
.x-time { text-align: right; font-size: 12.5px; color: #c9d7ec; white-space: nowrap; }
.x-time-head { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.x-time-toggle { background: none; border: 0; color: #fff; font-size: 12px; font-weight: 700; text-decoration: underline; padding: 0; }
.x-time b { display: block; font-family: var(--mono); font-size: 22px; color: #fff; letter-spacing: .5px; line-height: 1.2; }
.x-time-hidden { font-size: 13px; font-style: italic; color: #dbe7f7; margin-top: 2px; }
.x-time.low b { color: #ffb4a8; animation: pulse 1.4s infinite; }

.x-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 7px 18px; background: var(--x-bar); border-bottom: 1px solid var(--x-line); flex: none; font-size: 14px; user-select: none; }
.x-bar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.x-qno b { font-size: 15.5px; }
.x-topic-pill { display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 4px; background: var(--x-canvas); border: 1px solid var(--x-line); font-size: 12.5px; font-weight: 700; color: var(--x-muted); }
.x-q { margin-left: 10px; padding: 2px 9px; border-radius: 4px; background: var(--x-warn-bg); color: var(--x-warn-text); font-size: 12.5px; font-weight: 700; }
.x-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.x-tool { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--x-line); border-radius: 4px; background: var(--x-canvas); font-size: 13px; font-weight: 600; color: var(--x-text); min-height: 32px; }
.x-tool:hover:not(:disabled) { border-color: var(--x-sel-line); }
.x-tool:disabled { opacity: .42; cursor: default; }
.x-tool.on { background: var(--x-warn-bg); border-color: #d9a400; color: var(--x-warn-text); font-weight: 700; }
.x-hl-badge { display: inline-block; padding: 0 5px; border-radius: 3px; background: #ffe769; color: #1a1a1a; font-weight: 800; font-size: 12px; }
.x-tool-select { padding: 4px 9px; min-height: 32px; border: 1px solid var(--x-line); border-radius: 4px; background: var(--x-canvas); color: var(--x-text); font-size: 13px; font-weight: 600; }

.x-notice { padding: 9px 18px; background: var(--x-warn-bg); color: var(--x-warn-text); font-weight: 700; font-size: 14px; border-bottom: 1px solid #d9a400; flex: none; }

/* Split Workspace: Docked Left Navigator + Main Question Body */
.x-workspace { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.x-sidebar {
  width: 224px; flex: none; display: flex; flex-direction: column;
  background: var(--x-side); border-right: 1px solid var(--x-line); user-select: none;
}
@media (max-width: 780px) {
  .x-sidebar { position: absolute; top: 96px; bottom: 58px; left: 0; z-index: 32; box-shadow: 6px 0 20px rgba(0, 0, 0, .2); }
}
.x-side-head { padding: 10px; border-bottom: 1px solid var(--x-line); }
.x-side-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--x-muted); margin-bottom: 8px; }
.x-side-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.x-side-filters button {
  padding: 5px 4px; border-radius: 4px; border: 1px solid var(--x-line);
  background: var(--x-canvas); color: var(--x-text); font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.x-side-filters button[aria-pressed="true"] { background: var(--x-navy); border-color: var(--x-navy); color: #fff; }
.x-nav-list { flex: 1; overflow-y: auto; padding: 8px; display: grid; gap: 4px; align-content: start; }
.x-nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 6px 9px; border-radius: 5px; border: 1px solid var(--x-line);
  background: transparent; color: var(--x-text); font-size: 13px; font-weight: 600; text-align: left;
}
.x-nav-item.answered { background: var(--x-canvas); }
.x-nav-item.seen:not(.answered) { border-style: dashed; }
.x-nav-item.current { background: var(--x-sel); border-color: var(--x-sel-line); box-shadow: inset 0 0 0 1px var(--x-sel-line); }
.x-nav-num {
  display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 5px;
  border-radius: 4px; background: var(--x-bar); color: var(--x-text); font-size: 12px; font-weight: 700;
}
.x-nav-item.answered .x-nav-num { background: var(--x-navy); color: #fff; }
.x-nav-state { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.x-nav-flag { color: #d98b00; font-size: 13px; min-width: 14px; text-align: right; }
.x-nav-empty { padding: 20px 8px; text-align: center; font-size: 12.5px; color: var(--x-muted); }
.x-side-foot {
  padding: 9px 12px; border-top: 1px solid var(--x-line);
  display: flex; justify-content: space-between; font-size: 12.5px; color: var(--x-muted);
}

.x-body { flex: 1; overflow-y: auto; background: var(--x-canvas); }
.x-inner { max-width: 880px; margin: 0 auto; padding: 28px 28px 44px; line-height: 1.66; }
.x-stem p { margin: 0 0 14px; }
.x-stem ul { margin: 6px 0 14px; padding-left: 24px; }
.x-stem table { border-collapse: collapse; margin: 12px 0; }
.x-stem td, .x-stem th { border: 1px solid var(--x-line); padding: 6px 12px; }
.x-opts { display: grid; gap: 11px; margin-top: 22px; }
.x-opt {
  position: relative; display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 46px 13px 16px; border: 1px solid var(--x-line); border-radius: 7px;
  cursor: pointer; background: var(--x-canvas); user-select: text; transition: border-color .12s, background .12s;
}
.x-opt:hover { border-color: var(--x-sel-line); }
.x-opt.selected { border-color: var(--x-sel-line); background: var(--x-sel); box-shadow: inset 0 0 0 1px var(--x-sel-line); }
.x-radio { flex: none; width: 18px; height: 18px; margin-top: .22em; border-radius: 50%; border: 2px solid #7d8a99; background: #fff; }
.x-opt.selected .x-radio { border-color: var(--x-sel-line); background: radial-gradient(circle, var(--x-sel-line) 0 4px, #fff 5px); }
.x-letter { font-weight: 700; flex: none; }
.x-opt.struck .x-text, .x-opt.struck .x-letter { text-decoration: line-through; text-decoration-thickness: 2px; opacity: .48; }
.x-strike {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 5px; border: 1px solid var(--x-line);
  background: var(--x-canvas); color: var(--x-muted); font-size: 13px; font-weight: 700;
}
.x-strike:hover { border-color: #c0362c; color: #c0362c; }
.x-opt.struck .x-strike { color: #c0362c; border-color: #c0362c; }
.x-opt-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; font-size: 13px; color: var(--x-muted);
}
.x-clear-ans { background: none; border: 0; padding: 0; color: var(--x-sel-line); font-weight: 700; text-decoration: underline; font-size: 13px; }
.x-opt-tip { margin-left: auto; }

.exam mark { background: var(--x-hl); color: inherit; padding: 0 2px; border-radius: 2px; cursor: pointer; }
.x-hlpop { position: fixed; z-index: 35; }
.x-hlpop button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; border: 1px solid #c7a600; background: #ffe769; color: #3b3000; font-weight: 700; font-size: 13px; box-shadow: 0 4px 14px rgba(0, 0, 0, .22); }

.x-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); background: var(--x-navy); flex: none; user-select: none; }
.x-foot .mid { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.x-count { color: #c9d7ec; font-size: 13.5px; margin-right: 6px; }
.x-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: 5px; border: 1px solid #fff; background: #fff; color: #1b365d; font-weight: 700; font-size: 14px; }
.x-btn.primary { background: #3b82d6; border-color: #3b82d6; color: #fff; }
.x-btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .58); }
.x-btn.danger { background: #c0362c; border-color: #c0362c; color: #fff; }
.x-btn:disabled { opacity: .4; cursor: default; }
.x-inner .x-btn.ghost { color: var(--x-text); border-color: var(--x-line); background: var(--x-canvas); }
.x-inner .x-btn.primary { min-height: 44px; padding: 0 22px; }
.x-link { background: none; border: 0; color: #c9d7ec; text-decoration: underline; font-size: 13.5px; }

@media (max-width: 640px) {
  .x-foot { flex-wrap: wrap; }
  .x-foot .mid { order: 3; width: 100%; }
  .x-count { display: none; }
  .x-inner { padding: 18px 16px 32px; }
}

.x-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-top: 14px; }
.x-grid button { position: relative; height: 38px; border: 1px solid var(--x-line, #c9d1db); border-radius: 5px; background: var(--x-canvas, #fff); font-weight: 700; font-size: 13.5px; color: var(--x-text, #1a1a1a); }
.x-grid button.seen { background: #fbe9e7; border-color: #e3a49b; color: #5f1914; }
.x-grid button.answered { background: var(--x-sel, #dbe8fb); border-color: var(--x-sel-line, #2f6fd6); }
.x-grid button.current { outline: 3px solid var(--x-sel-line, #1d3557); outline-offset: 1px; }
.x-grid button.flag::after { content: "⚑"; position: absolute; top: -2px; right: 2px; font-size: 12px; color: #d98b00; }
.x-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 13.5px; color: var(--x-muted, #5a6878); }
.x-legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; border: 1px solid #c9d1db; background: #fff; }
.x-legend .answered::before { background: #dbe8fb; border-color: #2f6fd6; }
.x-legend .seen::before { background: #fbe9e7; border-color: #e3a49b; }
.x-legend .flag::before { content: "⚑"; border: 0; background: none; color: #d98b00; width: auto; height: auto; }
.card .x-legend { color: var(--muted); }
.card .x-legend .ok::before { background: var(--good-soft); border-color: var(--good); }
.card .x-legend .no::before { background: var(--bad-soft); border-color: var(--bad); }
.card .x-legend .blank::before { background: var(--surface-2); }
.card .x-legend .flag::before { color: var(--mid); }
.sheet .x-grid button { color: #1a1a1a; background: #fff; }
.sheet .x-grid button.answered { background: #dbe8fb; border-color: #2f6fd6; }
.sheet .x-grid button.seen { background: #fbe9e7; border-color: #e3a49b; }

.x-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 540px; margin-bottom: 14px; }
.x-summary > div { border: 1px solid var(--x-line); border-radius: 8px; padding: 12px 16px; background: var(--x-side); }
.x-summary b { display: block; font-size: 26px; }
.x-summary span { font-size: 13.5px; color: var(--x-muted); font-weight: 600; }
.x-summary .warn { border-color: #d9a400; background: var(--x-warn-bg); color: var(--x-warn-text); }
.x-summary .warn span { color: var(--x-warn-text); }

.intro h1, .break h1 { font-size: 26px; margin: 0 0 8px; }
.intro h2 { font-size: 17px; margin: 0 0 10px; }
.lead { font-size: 1.05em; margin: 0 0 18px; }
.x-table { border-collapse: collapse; min-width: 360px; margin-bottom: 20px; }
.x-table th, .x-table td { border-bottom: 1px solid var(--x-line); padding: 9px 16px 9px 0; text-align: left; }
.x-table .num { text-align: right; }
.x-table .muted td { color: var(--x-muted); font-style: italic; }
.x-intro-grid { display: grid; gap: 16px; margin: 18px 0; }
@media (min-width: 720px) { .x-intro-grid { grid-template-columns: 1fr 1fr; } }
.x-intro-box { padding: 16px 18px; border: 1px solid var(--x-line); border-radius: 8px; background: var(--x-side); }
.rules { padding-left: 20px; margin: 0; font-size: 14.5px; }
.rules li { margin: 8px 0; line-height: 1.55; }
.x-pledge-box { padding: 16px 18px; border: 1px solid var(--x-line); border-radius: 8px; background: var(--x-side); margin-top: 16px; }
.x-pledge-box h3 { margin: 0 0 6px; font-size: 16px; }
.x-pledge-box p { margin: 0 0 12px; font-size: 14.5px; color: var(--x-muted); }
.agree { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--x-line); border-radius: 6px; background: var(--x-canvas); font-weight: 700; cursor: pointer; }
.agree input { width: 18px; height: 18px; }
.break { text-align: center; padding-top: 48px; }
.break .ico { color: var(--x-sel-line); }
.break-clock { display: inline-block; margin: 18px 0; padding: 18px 34px; border: 2px solid var(--x-line); border-radius: 12px; background: var(--x-side); }
.break-clock span { display: block; font-size: 13.5px; color: var(--x-muted); font-weight: 600; }
.break-clock b { font-family: var(--mono); font-size: 44px; }

/* ---------------------------------------------------------------- passkey lock */

body.locked { overflow: hidden; }
.lock {
  position: fixed; inset: 0; z-index: 65; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); overflow-y: auto;
}
.lock-panel {
  width: 100%; max-width: 420px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); padding: 28px 24px; text-align: center;
}
.lock-logo {
  width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 14px; display: grid; place-items: center;
  background: var(--navy); color: #fff; font-weight: 800; font-size: 19px; letter-spacing: .5px;
}
.lock-panel h1 { margin: 0 0 8px; font-size: 22px; }
.lock-panel p { margin: 8px 0; }
.lock-actions { display: grid; gap: 10px; margin-top: 18px; }
.lock-actions .btn { width: 100%; justify-content: center; }
.lock-form { display: grid; gap: 12px; text-align: left; margin-top: 14px; }
.lock-form .btn { justify-content: center; }
.lock-err { color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.lock-more { margin-top: 20px; text-align: left; border-top: 1px solid var(--border); padding-top: 14px; }
.lock-more summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent-text); }

.pk-list { display: grid; gap: 8px; margin-bottom: 10px; }
.pk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.pk-row > div { display: grid; gap: 2px; min-width: 0; }
