/* SAT Prep — Bluebook-style neutral theme */
:root {
  --surface: #FFFFFF;
  --surface-2: #F4F6F8;
  --surface-3: #E9EDF1;
  --ink: #1E1E1E;
  --ink-2: #4A4F55;
  --ink-3: #6F757C;
  --line: #D5D9DE;
  --line-strong: #9AA3AC;
  --accent: #0077C8;
  --accent-ink: #005FA3;
  --accent-soft: #E6F1FA;
  --accent-contrast: #FFFFFF;
  --good: #1E7B3A;
  --good-soft: #E4F3E8;
  --warn: #A65A00;
  --warn-soft: #FBEFDD;
  --bad: #C0392B;
  --bad-soft: #FBE7E4;
  --flag: #D14A3A;
  --focus: #0077C8;
  --shadow: 0 2px 8px rgba(20, 30, 40, .10);
  --radius: 6px;
  --font: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #15181C; --surface-2: #1C2026; --surface-3: #262B32;
    --ink: #ECEEF1; --ink-2: #B7BDC5; --ink-3: #8C939B;
    --line: #2F353D; --line-strong: #4E565F;
    --accent: #5FB0EC; --accent-ink: #8AC6F2; --accent-soft: #17304A; --accent-contrast: #0B1620;
    --good: #5FCB7E; --good-soft: #17301F; --warn: #E6A64D; --warn-soft: #3A2A10; --bad: #F08A7E; --bad-soft: #3D1B18;
    --flag: #F07A6A; --focus: #8AC6F2; --shadow: 0 2px 10px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  --surface: #15181C; --surface-2: #1C2026; --surface-3: #262B32;
  --ink: #ECEEF1; --ink-2: #B7BDC5; --ink-3: #8C939B;
  --line: #2F353D; --line-strong: #4E565F;
  --accent: #5FB0EC; --accent-ink: #8AC6F2; --accent-soft: #17304A; --accent-contrast: #0B1620;
  --good: #5FCB7E; --good-soft: #17301F; --warn: #E6A64D; --warn-soft: #3A2A10; --bad: #F08A7E; --bad-soft: #3D1B18;
  --flag: #F07A6A; --focus: #8AC6F2; --shadow: 0 2px 10px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--surface); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; font-weight: 500; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }

/* ---------- App shell ---------- */
.topnav { display: flex; align-items: center; gap: 1.5rem; height: 56px; padding: 0 1.25rem; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 500; font-size: 1.05rem; letter-spacing: .01em; text-decoration: none; color: var(--ink); }
.brand-mark { width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: var(--accent-contrast); display: grid; place-items: center; font-weight: 700; font-size: .8rem; letter-spacing: .02em; }
.brand-sub { color: var(--ink-3); font-weight: 400; font-size: .85rem; }
.brand-logo { height: 40px; width: auto; max-width: 190px; display: block; border-radius: 6px; }
:root[data-theme="dark"] .brand-logo { background: #FFFFFF; padding: 3px 7px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo { background: #FFFFFF; padding: 3px 7px; } }
.login-logo { display: block; height: 76px; width: auto; margin: 0 auto 1.1rem; }
:root[data-theme="dark"] .login-logo { background: #FFFFFF; padding: 6px 12px; border-radius: 8px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .login-logo { background: #FFFFFF; padding: 6px 12px; border-radius: 8px; } }
.brand-text { color: var(--ink-3); font-weight: 400; font-size: .95rem; padding-left: .6rem; border-left: 1px solid var(--line); }
.tabs { display: flex; gap: .25rem; margin-left: .5rem; }
.tab { padding: .45rem .8rem; border-radius: var(--radius); text-decoration: none; color: var(--ink-2); font-size: .95rem; border: 1px solid transparent; }
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab.active { color: var(--accent-ink); background: var(--accent-soft); font-weight: 500; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: var(--ink-2); }
.page { max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: .25rem 0 0; color: var(--ink-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 500; font-size: .95rem; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { border-color: transparent; }
.btn-sm { padding: .35rem .8rem; font-size: .85rem; }
.btn-link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 500; }
.btn-link:hover { text-decoration: underline; background: none; }
.btn-square { border-radius: var(--radius); }

/* ---------- Cards, grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.25rem; }
.card h2, .card h3 { margin-bottom: .75rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.tile { background: var(--surface-2); border-radius: 10px; padding: .9rem 1rem; }
.tile-label { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.tile-value { font-size: 1.75rem; font-weight: 500; line-height: 1.15; margin-top: .2rem; }
.tile-sub { font-size: .85rem; color: var(--ink-2); margin-top: .15rem; }
.tile.accent { background: var(--accent-soft); }

/* skill rows with meters */
.skill-list { display: flex; flex-direction: column; }
.skill-row { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); }
.skill-row:first-child { border-top: none; }
.skill-name { font-size: .95rem; }
.skill-meta { font-size: .8rem; color: var(--ink-3); }
.meter { grid-column: 1 / -1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.meter.good > i { background: var(--good); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--bad); }
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 500; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }

/* tables */
.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: .92rem; }
table.data th, table.data td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-weight: 500; color: var(--ink-3); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--surface-2); }

/* ---------- Login ---------- */
.login-wrap { min-height: calc(100vh - 56px); display: grid; place-items: center; padding: 2rem 1rem; }
.login-col { width: 100%; max-width: 440px; }
.login { width: 100%; }
.login-alt { text-align: center; margin: 1rem 0 0; font-size: .92rem; color: var(--ink-2); }
.consent { display: flex; gap: .6rem; align-items: flex-start; font-size: .85rem; color: var(--ink-2); margin: .25rem 0 1rem; line-height: 1.45; }
.consent input { margin-top: .2rem; flex: none; width: 16px; height: 16px; accent-color: var(--accent); }
.turnstile-box:empty { display: none; }
.turnstile-box { margin-bottom: 1rem; }
.login h1 { margin-bottom: .25rem; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }
.field label { font-size: .85rem; color: var(--ink-2); }
.input { padding: .6rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); width: 100%; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { color: var(--bad); font-size: .9rem; margin-bottom: .75rem; }
.notice { background: var(--surface-2); border-left: 3px solid var(--accent); padding: .6rem .9rem; border-radius: 0 var(--radius) var(--radius) 0; font-size: .9rem; color: var(--ink-2); }

/* ---------- Question rendering (shared) ---------- */
.q-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; min-height: 60vh; }
.q-layout.single { grid-template-columns: minmax(0, 1fr); max-width: 760px; margin: 0 auto; width: 100%; }
.q-passage { padding: 1.5rem 2rem 2rem 1.5rem; border-right: 1px solid var(--line); overflow-y: auto; font-size: 1.05rem; line-height: 1.7; }
.q-layout.single .q-passage { border-right: none; }
.q-passage p, .q-side p { margin: 0 0 1em; }
.q-passage p:last-child { margin-bottom: 0; }
.q-side { padding: 1.5rem 1.5rem 2rem 2rem; overflow-y: auto; }
.q-head { display: flex; align-items: center; gap: .75rem; background: var(--surface-2); border-top: 1px solid var(--ink); border-bottom: 1px dashed var(--line-strong); margin-bottom: 1.25rem; padding-right: .5rem; }
.q-num { background: var(--ink); color: var(--surface); font-weight: 500; min-width: 2rem; height: 2rem; display: grid; place-items: center; font-size: .95rem; }
.q-mark { display: inline-flex; align-items: center; gap: .35rem; background: none; border: none; color: var(--ink-2); font-size: .85rem; padding: .3rem .4rem; border-radius: 4px; }
.q-mark:hover { background: var(--surface-3); }
.q-mark svg { width: 14px; height: 16px; }
.q-mark.on { color: var(--flag); }
.q-mark.on svg path { fill: var(--flag); }
.q-elim { margin-left: auto; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); font-size: .75rem; font-weight: 500; padding: .2rem .45rem; letter-spacing: .04em; }
.q-elim.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.q-stem { font-size: 1.05rem; line-height: 1.6; margin-bottom: 1.1rem; }
.q-stem p { margin: 0 0 .75em; }
.choices { display: flex; flex-direction: column; gap: .65rem; list-style: none; padding: 0; margin: 0; }
.choice { position: relative; display: flex; align-items: stretch; gap: .5rem; }
.choice-btn { flex: 1; display: flex; align-items: flex-start; gap: .8rem; text-align: left; padding: .7rem .85rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); line-height: 1.5; width: 100%; }
.choice-btn:hover { background: var(--surface-2); }
.choice-btn .letter { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-items: center; font-size: .85rem; font-weight: 500; margin-top: .05rem; }
.choice-btn .text { flex: 1; min-width: 0; }
.choice.selected .choice-btn { border: 2px solid var(--accent); padding: calc(.7rem - 1px) calc(.85rem - 1px); }
.choice.selected .choice-btn .letter { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.choice.struck .choice-btn { opacity: .5; }
.choice.struck .choice-btn .text { text-decoration: line-through; }
.choice.struck .choice-btn .letter { position: relative; }
.choice.struck .choice-btn .letter::after { content: ""; position: absolute; left: -4px; right: -4px; top: 50%; height: 1.5px; background: var(--ink); }
.choice-strike { flex: none; width: 1.7rem; align-self: center; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 50%; height: 1.7rem; font-size: .75rem; color: var(--ink-2); position: relative; }
.choice-strike::after { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 1px; background: var(--ink-2); }
.choice-strike.undo { border-color: transparent; font-size: .7rem; text-decoration: underline; width: auto; padding: 0 .2rem; }
.choice-strike.undo::after { display: none; }
.choice.correct .choice-btn { border-color: var(--good); background: var(--good-soft); }
.choice.correct .choice-btn .letter { background: var(--good); border-color: var(--good); color: #fff; }
.choice.wrong .choice-btn { border-color: var(--bad); background: var(--bad-soft); }
.choice.wrong .choice-btn .letter { background: var(--bad); border-color: var(--bad); color: #fff; }
.spr { display: flex; flex-direction: column; gap: .5rem; max-width: 320px; }
.spr input { padding: .6rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: 1.1rem; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.spr input:focus { border-color: var(--accent); outline: none; }
.spr-preview { font-size: 1.1rem; color: var(--ink-2); }
.spr-preview:empty { display: none; }
.spr-help { font-size: .85rem; color: var(--ink-3); }
.blank { letter-spacing: .05em; }
.notes { margin: .5em 0 1em; padding-left: 1.25em; }
.notes li { margin: .2em 0; }
.fig { margin: 1rem 0; }
.fig-caption { font-weight: 500; text-align: center; margin-bottom: .5rem; font-size: .95rem; }
.fig-svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.fig-geom { max-width: 100%; background: #FFFFFF; color: #1E1E1E; border-radius: 8px; padding: 8px; box-sizing: content-box; }
.fig-legend { display: flex; gap: 1rem; justify-content: center; font-size: .8rem; color: var(--ink-2); margin-top: .35rem; flex-wrap: wrap; }
.fig-key { display: inline-flex; align-items: center; gap: .35rem; }
.fig-key i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.fig-table table { border-collapse: collapse; margin: 0 auto; font-size: .95rem; }
.fig-table th, .fig-table td { border: 1px solid var(--line-strong); padding: .35rem .7rem; text-align: center; }
.fig-table thead th { background: var(--surface-2); font-weight: 500; }
.fig-table tbody th { font-weight: 400; text-align: left; }
.katex { font-size: 1.05em; }

/* explanation panel */
.explain { margin-top: 1.25rem; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; }
.explain-head { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; font-weight: 500; }
.explain-head.correct { background: var(--good-soft); color: var(--good); }
.explain-head.wrong { background: var(--bad-soft); color: var(--bad); }
.explain-head.skipped { background: var(--warn-soft); color: var(--warn); }
.explain-body { padding: 1rem; line-height: 1.6; }
.explain-body p { margin: 0 0 .75em; }
.explain-body p:last-child { margin-bottom: 0; }
.explain-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }

/* practice chrome */
.practice-bar { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 56px; z-index: 10; }
.practice-bar .progress { flex: 1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; max-width: 320px; }
.practice-bar .progress i { display: block; height: 100%; background: var(--accent); }
.practice-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.25rem; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); z-index: 10; }
.practice-wrap { display: flex; flex-direction: column; min-height: calc(100vh - 56px); }
.practice-body { flex: 1; }
.tools { display: flex; gap: .5rem; }
.tool-btn { display: inline-flex; align-items: center; gap: .35rem; border: none; background: none; color: var(--ink-2); font-size: .85rem; padding: .3rem .5rem; border-radius: 4px; }
.tool-btn:hover { background: var(--surface-2); color: var(--ink); }
.tool-btn.on { color: var(--accent-ink); background: var(--accent-soft); }
.tool-btn svg { width: 18px; height: 18px; }

/* ---------- Test simulator (full screen) ---------- */
.test-shell { position: fixed; inset: 0; background: var(--surface); z-index: 100; display: flex; flex-direction: column; }
.test-top { display: flex; align-items: center; height: 60px; padding: 0 1.25rem; border-bottom: 1px solid var(--line); gap: 1rem; }
.test-top .section-name { font-weight: 500; font-size: 1rem; }
.test-top .directions { border: none; background: none; color: var(--ink-2); font-size: .9rem; padding: .2rem .3rem; border-radius: 4px; }
.test-top .directions:hover { background: var(--surface-2); }
.test-timer { position: absolute; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.test-timer .time { font-size: 1.15rem; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.test-timer .time.low { color: var(--bad); }
.test-timer .hide { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; font-size: .7rem; padding: .05rem .55rem; color: var(--ink-2); }
.test-top .tools { margin-left: auto; gap: .25rem; }
.test-top .tool-btn { flex-direction: column; gap: 0; font-size: .7rem; padding: .25rem .6rem; }
.test-top .tool-btn svg { width: 22px; height: 22px; }
.test-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.test-body .q-layout { flex: 1; min-height: 0; height: 100%; }
.test-body .q-passage, .test-body .q-side { height: 100%; overflow-y: auto; }
.test-bottom { display: flex; align-items: center; height: 64px; border-top: 1px solid var(--line); padding: 0 1.25rem; position: relative; }
.test-bottom .student { font-weight: 500; }
.test-bottom .center { position: absolute; left: 50%; transform: translateX(-50%); }
.test-bottom .nav-btn { background: var(--ink); color: var(--surface); border: none; border-radius: 6px; padding: .45rem .9rem; font-size: .9rem; font-weight: 500; display: inline-flex; align-items: center; gap: .4rem; }
.test-bottom .right { margin-left: auto; display: flex; gap: .5rem; }
.test-bottom .btn-primary { padding: .55rem 1.4rem; }
.test-intro { max-width: 640px; margin: 0 auto; padding: 3rem 1.5rem; }
.test-intro h1 { margin-bottom: .75rem; }
.test-intro ul { padding-left: 1.2rem; }
.test-intro li { margin: .3rem 0; }
.test-review { max-width: 760px; margin: 0 auto; padding: 2rem 1.5rem; width: 100%; overflow-y: auto; }
.test-review h2 { text-align: center; margin-bottom: .25rem; }
.legend { display: flex; gap: 1.25rem; justify-content: center; font-size: .85rem; color: var(--ink-2); margin: .75rem 0 1rem; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.nav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: .5rem; }
.nav-q { position: relative; height: 40px; border: 1px dashed var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--accent-ink); font-weight: 500; font-size: .9rem; }
.nav-q.answered { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-contrast); }
.nav-q.current::before { content: ""; position: absolute; top: -7px; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); }
.nav-q.flagged::after { content: ""; position: absolute; top: 2px; right: 3px; width: 8px; height: 10px; background: var(--flag); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 70%, 0 100%); }
.nav-pop { position: absolute; bottom: 72px; left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); width: min(560px, 92vw); padding: 1rem 1.25rem; z-index: 5; }
.nav-pop h3 { text-align: center; font-size: 1rem; margin-bottom: .5rem; }
.nav-pop .close { position: absolute; top: .5rem; right: .6rem; border: none; background: none; font-size: 1.2rem; color: var(--ink-3); }
.nav-pop .nav-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); max-height: 40vh; overflow-y: auto; padding: .25rem; }
.nav-pop .foot { text-align: center; margin-top: .9rem; }
.break-screen { flex: 1; display: grid; place-items: center; text-align: center; padding: 2rem; }
.break-screen .time { font-size: 3rem; font-weight: 500; font-variant-numeric: tabular-nums; margin: 1rem 0; }
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 18, .5); z-index: 200; display: grid; place-items: center; padding: 1rem; }
.modal { background: var(--surface); border-radius: 12px; max-width: 560px; width: 100%; padding: 1.5rem; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-bottom: .75rem; }
.modal .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }
.modal ul { padding-left: 1.2rem; }
/* floating panels (calculator, reference) */
.panel { position: fixed; z-index: 150; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.25); display: flex; flex-direction: column; overflow: hidden; min-width: 360px; min-height: 260px; resize: both; }
.panel-head { display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem .4rem .9rem; background: var(--surface-2); border-bottom: 1px solid var(--line); cursor: move; font-size: .9rem; font-weight: 500; user-select: none; }
.panel-head .close { margin-left: auto; border: none; background: none; font-size: 1.1rem; color: var(--ink-2); cursor: pointer; }
.panel-body { flex: 1; min-height: 0; overflow: auto; }
.panel-body .dcalc { border: none; height: 100%; }
.ref-sheet { padding: 1rem 1.25rem; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem .75rem; }
.ref-item { text-align: center; font-size: .85rem; }
.ref-item svg { display: block; margin: 0 auto .25rem; width: 120px; height: 90px; stroke: var(--ink); fill: none; stroke-width: 1.5; }
.ref-item svg text { fill: var(--ink); stroke: none; font-size: 11px; font-family: var(--font); }
.ref-notes { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .75rem; font-size: .9rem; }
.ref-notes p { margin: .25em 0; }
.ref-sheet { color: var(--ink); }
.ref-sheet .katex { font-size: 1em; }

/* score report */
.score-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; text-align: center; }
.score-hero .big { font-size: 3rem; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.score-hero .lab { font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-top: .35rem; }
.score-hero .rng { font-size: .85rem; color: var(--ink-3); }
details.qreview { border-top: 1px solid var(--line); }
details.qreview summary { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; cursor: pointer; list-style: none; font-size: .92rem; }
details.qreview summary::-webkit-details-marker { display: none; }
details.qreview .qreview-body { padding: .25rem 0 1rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.good { background: var(--good); } .dot.bad { background: var(--bad); } .dot.skip { background: var(--warn); }

/* ---------- Trials, upgrade wall, sales ---------- */
.btn-buy { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 500; box-shadow: 0 1px 2px rgba(0, 60, 120, .15); }
.btn-buy:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-buy svg { width: 18px; height: 18px; }
.btn-locked { color: var(--ink-3); }
.btn-locked svg { width: 14px; height: 14px; }
.card-locked { background: var(--surface-2); }
.trial-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .7rem 1rem; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft); margin-bottom: 1.25rem; }
.trial-banner-text { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .95rem; }
.upsell { margin-top: 1.25rem; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); gap: 1.5rem; align-items: center; padding: 1.5rem 1.75rem; border-radius: 14px; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-ink) 100%); color: #FFFFFF; }
.upsell h2 { color: #FFFFFF; font-size: 1.5rem; margin: .25rem 0 .5rem; }
.upsell p { color: rgba(255, 255, 255, .88); margin-bottom: .75rem; }
.upsell-eyebrow { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .8); }
.upsell-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .3rem .9rem; font-size: .9rem; color: rgba(255, 255, 255, .95); }
.upsell-list li { padding-left: 1.3rem; position: relative; }
.upsell-list li::before { content: ""; position: absolute; left: 0; top: .45em; width: 12px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }
.upsell-cta { display: flex; flex-direction: column; align-items: center; gap: .6rem; text-align: center; }
.upsell .btn-buy { background: #FFFFFF; color: var(--accent-ink); border-color: #FFFFFF; font-size: 1.05rem; padding: .8rem 1.5rem; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.upsell .btn-buy:hover { background: #F2F8FD; }
.upsell-note { font-size: .8rem; color: rgba(255, 255, 255, .8); }
:root[data-theme="dark"] .upsell, :root:not([data-theme="light"]) .upsell { color: #FFFFFF; }
.modal.wall { max-width: 600px; padding: 0; overflow: hidden; }
.wall-head { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-ink) 100%); color: #FFFFFF; padding: 1.5rem 1.75rem 1.25rem; }
.wall-head h2 { color: #FFFFFF; font-size: 1.6rem; margin: .25rem 0 .5rem; }
.wall-head p { color: rgba(255, 255, 255, .9); margin: 0; }
.modal.wall .upsell-list { padding: 1.25rem 1.75rem 0; color: var(--ink); grid-template-columns: 1fr 1fr; }
.modal.wall .upsell-list li::before { color: var(--accent); }
.wall-actions { display: flex; gap: .75rem; justify-content: center; padding: 1.25rem 1.75rem 0; flex-wrap: wrap; }
.wall-actions .btn-buy { font-size: 1.05rem; padding: .8rem 1.5rem; }
.modal.wall .upsell-note { color: var(--ink-3); padding: 0 1.75rem 1.25rem; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: .3rem .8rem; font-size: .85rem; color: var(--ink-2); display: inline-flex; gap: .4rem; align-items: center; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip-n { font-variant-numeric: tabular-nums; opacity: .75; }
.code { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: var(--surface-3); padding: .1rem .4rem; border-radius: 4px; letter-spacing: .04em; white-space: nowrap; }
.code-big { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.6rem; letter-spacing: .12em; text-align: center; background: var(--accent-soft); color: var(--accent-ink); border-radius: 10px; padding: .75rem; margin: .75rem 0 1rem; font-weight: 500; }
textarea.input { font-family: var(--font); resize: vertical; line-height: 1.45; }
.signals { display: flex; gap: .3rem; flex-wrap: wrap; }
.actions-cell { display: flex; gap: .35rem; flex-wrap: wrap; }
table.trials td { vertical-align: middle; }
.timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.timeline li { display: flex; gap: .9rem; align-items: baseline; padding: .3rem 0; border-top: 1px solid var(--line); font-size: .92rem; }
.timeline li:first-child { border-top: none; }
.timeline li > span:first-child { width: 8.5rem; flex: none; }
.tl-hot { color: var(--accent-ink); font-weight: 500; }

/* toast */
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: .6rem 1rem; border-radius: 8px; font-size: .9rem; z-index: 500; box-shadow: var(--shadow); }

@media (max-width: 800px) {
  .q-layout { grid-template-columns: 1fr; }
  .q-passage { border-right: none; border-bottom: 1px solid var(--line); padding: 1.25rem; max-height: 45vh; }
  .q-side { padding: 1rem 1.25rem 2rem; }
  .test-body .q-layout { overflow-y: auto; display: block; }
  .test-body .q-passage, .test-body .q-side { height: auto; overflow: visible; max-height: none; }
  .test-top .section-name { font-size: .85rem; max-width: 30vw; }
  .test-bottom .student { display: none; }
  .tabs { gap: 0; margin-left: 0; }
  .tab { padding: .4rem .5rem; font-size: .85rem; white-space: nowrap; }
  .brand-sub { display: none; }
  .brand > span:not(.brand-mark) { display: none; }
  .brand-logo { height: 30px; max-width: 120px; }
  .topnav { gap: .5rem; padding: 0 .75rem; }
  .nav-right span { display: none; }
  .page { padding: 1rem .9rem 3rem; }
  .panel { min-width: 0; width: 96vw !important; left: 2vw !important; }
  .upsell { grid-template-columns: 1fr; padding: 1.25rem; }
  .modal.wall .upsell-list { grid-template-columns: 1fr; }
  .timeline li > span:first-child { width: 6.5rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
