/* GRE Summit — design tokens
   Ink, index-card paper, highlighter yellow, red pencil, verdigris. */
:root {
  --ink: #1B2559;
  --paper: #F6F7FB;
  --card: #FFFFFF;
  --hl: #FFE14D;
  --red: #D6423A;
  --green: #1E8C6E;

  --bg: var(--paper);
  --surface: var(--card);
  --surface-2: #EEF1F9;
  --text: #1B2559;
  --text-2: #4A5585;
  --muted: #6D769E;
  --line: #DCE2F2;
  --line-strong: #BCC6E6;
  --rule: #CFD8F1;
  --focus: #2F5BD3;
  --link: #2F4FB8;
  --rail: #1B2559;
  --rail-text: #C9D1F2;
  --rail-active: #FFFFFF;
  --red-soft: #FBE4E2;
  --green-soft: #DDF2EA;
  --hl-soft: #FFF5BF;
  --mark-text: inherit;
  --shadow: 0 1px 0 rgba(27, 37, 89, .05), 0 10px 28px -16px rgba(27, 37, 89, .28);
  --shadow-lift: 0 2px 0 rgba(27, 37, 89, .05), 0 22px 40px -20px rgba(27, 37, 89, .38);

  --font-ui: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-read: 'Literata', Georgia, 'Times New Roman', serif;

  --r-s: 6px;
  --r-m: 10px;
  --r-l: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1430;
    --surface: #161E44;
    --surface-2: #1C2552;
    --text: #E7EBF8;
    --text-2: #B9C1E2;
    --muted: #8F98C2;
    --line: #28325F;
    --line-strong: #39457E;
    --rule: #25306A;
    --focus: #8FB0FF;
    --link: #9DB6FF;
    --rail: #0A0F27;
    --rail-text: #A7B0D8;
    --red: #FF7A6E;
    --green: #46CFA4;
    --red-soft: #3A1F2C;
    --green-soft: #133A3A;
    --hl-soft: #3A3620;
    --mark-text: #141A3A;
    --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 12px 30px -16px rgba(0, 0, 0, .6);
    --shadow-lift: 0 2px 0 rgba(0, 0, 0, .2), 0 22px 44px -18px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1430;
  --surface: #161E44;
  --surface-2: #1C2552;
  --text: #E7EBF8;
  --text-2: #B9C1E2;
  --muted: #8F98C2;
  --line: #28325F;
  --line-strong: #39457E;
  --rule: #25306A;
  --focus: #8FB0FF;
  --link: #9DB6FF;
  --rail: #0A0F27;
  --rail-text: #A7B0D8;
  --red: #FF7A6E;
  --green: #46CFA4;
  --red-soft: #3A1F2C;
  --green-soft: #133A3A;
  --hl-soft: #3A3620;
  --mark-text: #141A3A;
  --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 12px 30px -16px rgba(0, 0, 0, .6);
  --shadow-lift: 0 2px 0 rgba(0, 0, 0, .2), 0 22px 44px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font-ui);
  font-feature-settings: 'ss01', 'tnum' 0;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--hl); color: #1B2559; padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.7rem); font-weight: 760; letter-spacing: -0.025em; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 680; }
p { margin: 0 0 1em; }
small, .small { font-size: .86rem; }
.muted { color: var(--muted); }
.read { font-family: var(--font-read); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
kbd { font: 600 .8em var(--font-ui); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--rail); color: var(--rail-text);
  display: flex; flex-direction: column; padding: 22px 14px 18px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 4px 10px 22px; }
.brand-mark { width: 38px; height: 30px; color: #F6F7FB; }
.brand-name { font-weight: 780; font-size: 1.15rem; letter-spacing: -0.02em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin-top: 14px; padding: 0 12px 6px; font-size: .78rem; color: #8C96C4; font-weight: 600; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 9px; color: var(--rail-text); text-decoration: none; font-weight: 560;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a[aria-current="page"] { color: #1B2559; background: var(--hl); }
.nav a[aria-current="page"] svg { opacity: 1; }
.nav .badge { margin-left: auto; font-size: .72rem; font-weight: 700; background: rgba(255,255,255,.12); color: #fff; border-radius: 99px; padding: 1px 8px; }
.nav a[aria-current="page"] .badge { background: #1B2559; color: var(--hl); }
.rail-foot { margin-top: auto; padding: 16px 12px 0; font-size: .8rem; color: #8C96C4; }
.rail-foot button { background: none; border: 1px solid rgba(255,255,255,.16); color: var(--rail-text); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.rail-foot button:hover { color: #fff; border-color: rgba(255,255,255,.35); }
.sync-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #8C96C4; margin-right: 6px; vertical-align: middle; }
.sync-dot.on { background: #46CFA4; }
.sync-dot.err { background: #FF7A6E; }

.view { min-width: 0; padding: clamp(18px, 3vw, 44px) clamp(16px, 4vw, 56px) 96px; outline: none; }
.page { max-width: 1120px; margin: 0 auto; animation: page-in .38s var(--ease) both; }
.page.narrow { max-width: 780px; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tabbar { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--rail); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px -12px rgba(0,0,0,.35);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
    color: var(--rail-text); text-decoration: none; font-size: .7rem; font-weight: 600;
    border-radius: 10px; background: none; border: 0; cursor: pointer;
  }
  .tabbar svg { width: 21px; height: 21px; }
  .tabbar [aria-current="page"] { color: #1B2559; background: var(--hl); }
  .view { padding-bottom: 110px; }
}

/* mobile "more" sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 39, .45); z-index: 60; animation: fade .2s both; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--surface);
  border-radius: 20px 20px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  animation: sheet-up .28s var(--ease) both; max-height: 80vh; overflow: auto;
}
.sheet a { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.sheet a:hover { background: var(--surface-2); }
.sheet svg { width: 20px; height: 20px; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 28px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 8px 0 0; color: var(--text-2); max-width: 62ch; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }

/* ---------- highlighter ---------- */
.mark {
  background-image: linear-gradient(100deg, transparent 0, var(--hl) .15em, var(--hl) calc(100% - .2em), transparent 100%);
  background-repeat: no-repeat; background-position: 0 70%; background-size: 0% 62%;
  color: inherit; padding: 0 .12em; margin: 0 -.12em; border-radius: 3px;
  animation: swipe .7s .15s var(--ease) forwards;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
:root[data-theme="dark"] .mark { color: var(--mark-text); background-size: 0% 100%; background-position: 0 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mark { color: var(--mark-text); background-position: 0 0; } }
@keyframes swipe { to { background-size: 100% 62%; } }
:root[data-theme="dark"] .mark { animation-name: swipe-full; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mark { animation-name: swipe-full; } }
@keyframes swipe-full { to { background-size: 100% 100%; } }

/* ---------- index card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 20px; box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; }
.index-card {
  position: relative; background-color: var(--surface);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 35px, var(--rule) 35px, var(--rule) 36px);
  background-position: 0 58px;
  border-radius: 4px 4px var(--r-m) var(--r-m);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px 22px 22px;
}
.index-card::before { content: ''; position: absolute; left: 0; right: 0; top: 56px; height: 2px; background: var(--red); opacity: .55; }
.index-card > header { height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.index-card > header h2, .index-card > header h3 { margin: 0; font-size: 1.15rem; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 18px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-weight: 640; cursor: pointer; text-decoration: none;
  transition: transform .12s var(--ease), background .2s, border-color .2s, box-shadow .2s;
  line-height: 1.2;
}
.btn:hover { border-color: var(--text-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
:root[data-theme="dark"] .btn.primary { background: var(--hl); border-color: var(--hl); color: #1B2559; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: var(--hl); border-color: var(--hl); color: #1B2559; } }
.btn.primary:hover { box-shadow: 0 6px 18px -8px rgba(27, 37, 89, .6); }
.btn.hl { background: var(--hl); border-color: #E9C92B; color: #1B2559; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.small { padding: 6px 11px; font-size: .88rem; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .92rem; }
.input, select.input, textarea.input {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 10px 12px; min-width: 0;
}
.input:focus { outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent); border-color: var(--focus); }
textarea.input { resize: vertical; line-height: 1.6; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); padding: 6px 12px; border-radius: 99px;
  font-size: .88rem; font-weight: 600; cursor: pointer; color: var(--text-2);
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
:root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--hl); border-color: var(--hl); color: #1B2559; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip[aria-pressed="true"] { background: var(--hl); border-color: var(--hl); color: #1B2559; } }

.tag { display: inline-block; font-size: .76rem; font-weight: 650; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.tag.v { background: #E6E3FA; color: #4936A8; }
.tag.q { background: #DDEEF9; color: #155C8A; }
.tag.w { background: #FCE9D8; color: #8A4515; }
:root[data-theme="dark"] .tag.v { background: #2C2760; color: #C9C0FF; }
:root[data-theme="dark"] .tag.q { background: #163A55; color: #A9D8FA; }
:root[data-theme="dark"] .tag.w { background: #4A2D16; color: #F7C9A0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag.v { background: #2C2760; color: #C9C0FF; }
  :root:not([data-theme="light"]) .tag.q { background: #163A55; color: #A9D8FA; }
  :root:not([data-theme="light"]) .tag.w { background: #4A2D16; color: #F7C9A0; }
}
.diff { display: inline-flex; gap: 3px; vertical-align: middle; }
.diff i { width: 7px; height: 7px; border-radius: 2px; background: var(--line-strong); display: block; }
.diff i.on { background: var(--text-2); }

/* ---------- progress ---------- */
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width .8s var(--ease); }
:root[data-theme="dark"] .bar > span { background: var(--hl); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar > span { background: var(--hl); } }
.bar.green > span { background: var(--green); }
.bar.red > span { background: var(--red); }

/* ---------- toast ---------- */
#toast-root { position: fixed; z-index: 90; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lift); font-weight: 560; animation: toast-in .3s var(--ease) both; pointer-events: auto; }
:root[data-theme="dark"] .toast { background: #F6F7FB; color: #1B2559; }
.toast.out { animation: toast-out .25s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@media (max-width: 900px) { #toast-root { bottom: 96px; } }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(10, 15, 39, .5); display: grid; place-items: center; padding: 16px; animation: fade .2s both; }
.modal { background: var(--surface); border-radius: var(--r-l); max-width: 560px; width: 100%; padding: 24px; box-shadow: var(--shadow-lift); animation: pop .25s var(--ease) both; max-height: 90vh; overflow: auto; }
.modal h2 { margin-top: 0; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }

/* ---------- prose (notes) ---------- */
.prose { font-family: var(--font-read); font-size: 1.07rem; line-height: 1.72; max-width: 72ch; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--font-ui); }
.prose h2 { margin-top: 2.2em; padding-top: .2em; font-size: 1.5rem; }
.prose h3 { margin-top: 1.8em; font-size: 1.18rem; }
.prose h4 { margin-top: 1.4em; font-size: 1rem; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--muted); }
.prose code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
.prose blockquote {
  margin: 1.4em 0; padding: 14px 18px; border-left: 4px solid var(--hl); background: var(--hl-soft);
  border-radius: 0 10px 10px 0; font-style: normal;
}
.prose blockquote p:last-child { margin: 0; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--font-ui); font-size: .95rem; margin: 1.2em 0; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { font-weight: 700; border-bottom: 2px solid var(--line-strong); white-space: nowrap; }
.prose strong { font-weight: 650; }
.prose .callout, .prose details { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 1.2em 0; background: var(--surface); }
.prose details summary { cursor: pointer; font-family: var(--font-ui); font-weight: 650; }
.prose details[open] summary { margin-bottom: .6em; }

/* ---------- notes layout ---------- */
.notes-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 40px; align-items: start; }
.toc { position: sticky; top: 24px; font-size: .92rem; }
.toc h3 { font-size: .95rem; color: var(--muted); margin: 18px 0 6px; }
.toc a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--text-2); text-decoration: none; }
.toc a:hover { background: var(--surface-2); }
.toc a[aria-current="page"] { background: var(--hl); color: #1B2559; font-weight: 650; }
@media (max-width: 1000px) { .notes-layout { grid-template-columns: 1fr; } .toc { position: static; } }

/* ---------- list rows ---------- */
.list { display: flex; flex-direction: column; }
.list > * { border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }

/* ---------- tasks (today) ---------- */
.task { display: flex; align-items: flex-start; gap: 12px; min-height: 36px; padding: 6px 0; }
.task input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; flex: none; margin-top: 2px; border: 2px solid var(--line-strong); border-radius: 6px; background: var(--surface); cursor: pointer; display: grid; place-items: center; transition: background .2s, border-color .2s; }
.task input[type="checkbox"]::after { content: ''; width: 11px; height: 6px; border-left: 2.5px solid #1B2559; border-bottom: 2.5px solid #1B2559; transform: rotate(-45deg) scale(0); margin-top: -3px; transition: transform .2s var(--ease); }
.task input[type="checkbox"]:checked { background: var(--hl); border-color: #E2C42A; }
.task input[type="checkbox"]:checked::after { transform: rotate(-45deg) scale(1); }
.task .t-body { flex: 1; min-width: 0; }
.task .t-label { font-weight: 560; }
.task .t-label a { color: inherit; text-decoration-color: var(--line-strong); }
.task.done .t-label { color: var(--muted); }
.task .t-meta { font-size: .82rem; color: var(--muted); }
.task .t-min { font-size: .8rem; color: var(--muted); white-space: nowrap; margin-top: 3px; }

/* ---------- week track ---------- */
.track { display: grid; grid-template-columns: repeat(26, minmax(0, 1fr)); gap: 4px; }
.track a { display: block; height: 44px; border-radius: 6px; background: var(--surface-2); position: relative; overflow: hidden; text-decoration: none; }
.track a span.fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); opacity: .85; transition: height .8s var(--ease); }
:root[data-theme="dark"] .track a span.fill { background: var(--hl); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .track a span.fill { background: var(--hl); } }
.track a.now { outline: 2px solid var(--red); outline-offset: 2px; }
.track a b { position: absolute; top: 3px; left: 0; right: 0; text-align: center; font-size: .68rem; font-weight: 700; color: var(--muted); mix-blend-mode: normal; }
.track-phases { display: grid; grid-template-columns: repeat(26, minmax(0, 1fr)); gap: 4px; margin-top: 8px; font-size: .76rem; color: var(--muted); }
.track-phases span { border-top: 2px solid var(--line-strong); padding-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .track { grid-template-columns: repeat(13, minmax(0, 1fr)); } .track-phases { display: none; } }

/* ---------- stat ---------- */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 1.6rem; font-weight: 760; letter-spacing: -0.02em; line-height: 1.1; }
.stat span { font-size: .86rem; color: var(--muted); }

/* ---------- question UI ---------- */
.q-wrap { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
.q-wrap.split { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
@media (max-width: 960px) { .q-wrap.split { grid-template-columns: 1fr; } }
.passage { font-family: var(--font-read); font-size: 1.02rem; line-height: 1.75; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; max-height: 70vh; overflow: auto; }
.passage p { margin: 0 0 .9em; }
.passage .sent { cursor: default; border-radius: 3px; transition: background .15s; }
.passage.selectable .sent { cursor: pointer; }
.passage.selectable .sent:hover { background: var(--hl-soft); }
.passage .sent.picked { background: var(--hl); color: #1B2559; }
.passage .sent.right { background: var(--green-soft); box-shadow: inset 0 -2px 0 var(--green); }
.q-dir { font-size: .9rem; color: var(--text-2); font-style: italic; margin-bottom: 10px; }
.q-stem { font-family: var(--font-read); font-size: 1.08rem; line-height: 1.7; margin-bottom: 18px; }
.q-stem .blank { display: inline-block; min-width: 5.5em; border-bottom: 2px solid var(--text); text-align: center; font-family: var(--font-ui); font-weight: 700; font-size: .85em; color: var(--muted); padding: 0 6px; }
.q-stem .blank.filled { color: var(--text); background: var(--hl-soft); }
.q-stem p { margin: 0 0 .7em; }
.qc-table { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 10px 0 20px; }
.qc-table > div { border: 1px solid var(--line-strong); border-radius: 12px; padding: 14px 16px; background: var(--surface); text-align: center; }
.qc-table > div b { display: block; font-size: .84rem; color: var(--muted); margin-bottom: 6px; }
.qc-table > div .qv { font-family: var(--font-read); font-size: 1.12rem; }
.qc-given { text-align: center; font-family: var(--font-read); margin: 0 0 10px; }

.choices { display: flex; flex-direction: column; gap: 9px; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 11px 14px; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--surface);
  cursor: pointer; transition: border-color .15s, background .15s, transform .12s; font-family: var(--font-read); font-size: 1.02rem;
}
.choice:hover { border-color: var(--text-2); }
.choice .key { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border: 1.5px solid var(--line-strong); font: 700 .82rem var(--font-ui); color: var(--text-2); border-radius: 50%; }
.choice.sq .key { border-radius: 6px; }
.choice[aria-pressed="true"] { border-color: var(--ink); background: var(--hl-soft); }
:root[data-theme="dark"] .choice[aria-pressed="true"] { border-color: var(--hl); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .choice[aria-pressed="true"] { border-color: var(--hl); } }
.choice[aria-pressed="true"] .key { background: var(--ink); border-color: var(--ink); color: #fff; }
:root[data-theme="dark"] .choice[aria-pressed="true"] .key { background: var(--hl); border-color: var(--hl); color: #1B2559; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .choice[aria-pressed="true"] .key { background: var(--hl); border-color: var(--hl); color: #1B2559; } }
.choice.correct { border-color: var(--green); background: var(--green-soft); }
.choice.correct .key { background: var(--green); border-color: var(--green); color: #fff; }
.choice.wrong { border-color: var(--red); background: var(--red-soft); }
.choice.wrong .key { background: var(--red); border-color: var(--red); color: #fff; }
.choice[disabled] { cursor: default; }
.blank-cols { display: grid; gap: 16px; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); }
.blank-cols h4 { font-size: .82rem; color: var(--muted); margin: 0 0 8px; font-weight: 650; }
@media (max-width: 640px) { .blank-cols { grid-template-columns: 1fr; } }
.ne-input { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ne-input input { width: 160px; font-size: 1.1rem; text-align: center; }
.ne-frac { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; }
.ne-frac input { width: 110px; }
.ne-frac hr { width: 120px; margin: 0; border-top: 2px solid var(--text); }

.feedback { margin-top: 22px; border-radius: 14px; padding: 18px 20px; border: 1px solid var(--line); background: var(--surface); animation: pop .3s var(--ease) both; }
.feedback.ok { border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.feedback.no { border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.feedback .verdict { font-weight: 760; font-size: 1.05rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.feedback.ok .verdict { color: var(--green); }
.feedback.no .verdict { color: var(--red); }
.feedback .expl { font-family: var(--font-read); line-height: 1.7; }
.feedback .expl p { margin: 0 0 .7em; }

/* data display */
.di-table { border-collapse: collapse; width: 100%; font-size: .95rem; margin: 6px 0 12px; }
.di-table th, .di-table td { border: 1px solid var(--line-strong); padding: 6px 9px; text-align: center; }
.di-table th { background: var(--surface-2); font-weight: 650; }
.di-title { font-weight: 700; text-align: center; margin: 4px 0 8px; font-family: var(--font-ui); }
.chart-svg text { fill: var(--text-2); font: 12px var(--font-ui); }
.chart-svg .axis { stroke: var(--line-strong); }
.chart-svg .bar1 { fill: #3D5AC8; }
.chart-svg .bar2 { fill: #E0A526; }
.chart-svg .bar3 { fill: #2E9C7A; }
.chart-svg .line1 { stroke: #3D5AC8; fill: none; stroke-width: 2.5; }
.chart-svg .line2 { stroke: #E0A526; fill: none; stroke-width: 2.5; }

/* ---------- exam mode ---------- */
.exam { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: flex; flex-direction: column; }
.exam-bar { display: flex; align-items: center; gap: 10px; padding: 10px clamp(12px, 3vw, 28px); background: var(--rail); color: #fff; flex-wrap: wrap; }
.exam-bar .title { font-weight: 700; margin-right: auto; display: flex; flex-direction: column; line-height: 1.2; }
.exam-bar .title small { color: var(--rail-text); font-weight: 500; }
.exam-bar .btn { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); padding: 8px 13px; }
.exam-bar .btn:hover { background: rgba(255,255,255,.16); }
.exam-bar .btn.on { background: var(--hl); color: #1B2559; border-color: var(--hl); }
.exam-time { font-variant-numeric: tabular-nums; font-weight: 700; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.08); min-width: 74px; text-align: center; }
.exam-time.warn { background: var(--red); }
.exam-body { flex: 1; overflow: auto; padding: clamp(16px, 3vw, 36px) clamp(14px, 4vw, 48px) 60px; }
.exam-body .inner { max-width: 1180px; margin: 0 auto; }
.exam-q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; color: var(--muted); font-size: .9rem; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.review-grid button { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; }
.review-grid button b { display: block; }
.review-grid button.unans { border-style: dashed; }
.review-grid button.marked { box-shadow: inset 4px 0 0 var(--red); }
.review-grid button.cur { outline: 2px solid var(--focus); }

/* calculator */
.calc {
  position: fixed; z-index: 75; width: 264px; background: #2A3263; color: #fff; border-radius: 14px; box-shadow: var(--shadow-lift);
  padding: 10px; user-select: none; touch-action: none;
}
.calc .calc-head { display: flex; align-items: center; justify-content: space-between; cursor: move; padding: 2px 4px 8px; font-weight: 650; font-size: .9rem; }
.calc .calc-head button { background: none; border: 0; color: #fff; cursor: pointer; font-size: 1.1rem; }
.calc .disp { background: #EEF1F9; color: #1B2559; border-radius: 8px; padding: 8px 10px; text-align: right; font: 600 1.35rem var(--font-ui); font-variant-numeric: tabular-nums; min-height: 46px; overflow: hidden; }
.calc .mem { font-size: .7rem; color: #5F6890; text-align: left; height: 12px; }
.calc .keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.calc .keys button { padding: 9px 0; border-radius: 7px; border: 0; background: #3C4680; color: #fff; font-weight: 650; cursor: pointer; font-size: .92rem; }
.calc .keys button:hover { background: #4B5698; }
.calc .keys button.op { background: #56609F; }
.calc .keys button.eq { background: var(--hl); color: #1B2559; }
.calc .keys button.wide { grid-column: span 2; }
.calc .transfer { margin-top: 8px; width: 100%; padding: 8px; border-radius: 7px; border: 0; background: #F6F7FB; color: #1B2559; font-weight: 700; cursor: pointer; }

/* scratchpad */
.scratch { position: fixed; z-index: 74; right: 20px; bottom: 20px; width: min(420px, calc(100vw - 40px)); height: 320px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-lift); display: flex; flex-direction: column; overflow: hidden; }
.scratch header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-weight: 650; font-size: .9rem; }
.scratch canvas { flex: 1; touch-action: none; cursor: crosshair; background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 18px 18px; }

/* ---------- flashcards ---------- */
.fc-stage { perspective: 1400px; max-width: 620px; margin: 0 auto; }
.fc { position: relative; height: 340px; transform-style: preserve-3d; transition: transform .6s var(--ease); cursor: pointer; }
.fc.flipped { transform: rotateY(180deg); }
.fc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; }
.fc-face.back { transform: rotateY(180deg); }
.fc-face.index-card { padding: 18px 26px 22px; }
.fc-word { font-family: var(--font-read); font-weight: 600; font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem); letter-spacing: -0.01em; margin: auto 0; text-align: center; }
.fc-pos { text-align: center; color: var(--muted); font-style: italic; font-family: var(--font-read); margin-top: -8px; }
.fc-def { font-family: var(--font-read); font-size: 1.25rem; line-height: 36px; margin: 0; }
.fc-ex { font-family: var(--font-read); font-style: italic; color: var(--text-2); line-height: 36px; margin: 0; }
.fc-syn { font-size: .9rem; color: var(--muted); margin-top: auto; }
.fc-grade { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 620px; margin: 18px auto 0; }
.fc-grade .btn { flex-direction: column; gap: 2px; }
.fc-grade .btn small { font-weight: 500; color: var(--muted); font-size: .75rem; }
.fc.enter { animation: deal .45s var(--ease) both; }
@keyframes deal { from { opacity: 0; transform: translateX(40px) rotate(3deg); } }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h3 { color: var(--text); }
.pill-nums { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-nums span { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); font-weight: 650; font-size: .85rem; }
.pill-nums span.ok { background: var(--green-soft); color: var(--green); }
.pill-nums span.no { background: var(--red-soft); color: var(--red); }
.pill-nums span.skip { background: var(--surface-2); color: var(--muted); }
.score-big { font-size: clamp(2.6rem, 2rem + 3vw, 4rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { font-weight: 650; color: var(--muted); font-size: .84rem; }
.res-item { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; }
.res-item:last-child { border-bottom: 0; }
.res-item h3 { margin: 0; font-size: 1.04rem; }
.res-item p { margin: 0; color: var(--text-2); grid-column: 1 / -1; }
.res-item .meta { font-size: .82rem; color: var(--muted); grid-column: 1 / -1; }
.word-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 14px; align-items: baseline; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.word-row .w { font-family: var(--font-read); font-weight: 600; font-size: 1.08rem; }
.word-row .d { color: var(--text-2); }
.word-row .d em { color: var(--muted); }
@media (max-width: 640px) { .word-row { grid-template-columns: 1fr auto; } .word-row .d { grid-column: 1 / -1; } }
.lvl { font-size: .72rem; font-weight: 700; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.lvl.new { background: var(--surface-2); color: var(--muted); }
.lvl.learning { background: var(--hl-soft); color: #8A6A00; }
.lvl.known { background: var(--green-soft); color: var(--green); }
:root[data-theme="dark"] .lvl.learning { color: var(--hl); }
.timer-chip { font-variant-numeric: tabular-nums; font-weight: 700; padding: 6px 12px; border-radius: 99px; background: var(--surface-2); }
.essay-box { width: 100%; min-height: 420px; font-family: var(--font-read); font-size: 1.04rem; line-height: 1.75; }
.kbd-hint { font-size: .8rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .mark { background-size: 100% 62%; }
}
@media print {
  .rail, .tabbar, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
