/* ---------- theme tokens ---------- */
:root, :root[data-theme="light"], .pane-light {
  --bg: #f4f5f7; --panel: #ffffff; --panel2: #eef0f3; --text: #1b1f27; --muted: #6b7280; --line: #e2e5ea;
  --accent: #4263eb; --accent-soft: #e7ecff; --on-accent: #fff;
  --good: #16a34a; --good-soft: #e3f6e8; --bad: #dc2626; --bad-soft: #fde8e8;
  --easy: #16a34a; --med: #ca8a04; --hard: #dc2626;
  --c-alg: #0d9488; --c-adv: #2563eb; --c-data: #ea580c; --c-geo: #b45309;
  --c-info: #15803d; --c-craft: #7c3aed; --c-expr: #db2777; --c-sec: #0284c7;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}
:root[data-theme="dark"], .pane-dark {
  --bg: #1a1a1a; --panel: #242424; --panel2: #2e2e2e; --text: #ececec; --muted: #9b9b9b; --line: #333;
  --accent: #7b93ff; --accent-soft: #2a3150; --on-accent: #fff;
  --good: #4ade80; --good-soft: #1e3326; --bad: #f87171; --bad-soft: #3b2224;
  --easy: #4ade80; --med: #facc15; --hard: #f87171;
  --c-alg: #2dd4bf; --c-adv: #7b93ff; --c-data: #fb923c; --c-geo: #facc15;
  --c-info: #86efac; --c-craft: #c4b5fd; --c-expr: #f472b6; --c-sec: #38bdf8;
  --shadow: none;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 14px; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); }
input[type=text], input[type=search] { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* domain + difficulty colors */
.d-alg { --dc: var(--c-alg); } .d-adv { --dc: var(--c-adv); } .d-data { --dc: var(--c-data); } .d-geo { --dc: var(--c-geo); }
.d-info { --dc: var(--c-info); } .d-craft { --dc: var(--c-craft); } .d-expr { --dc: var(--c-expr); } .d-sec { --dc: var(--c-sec); }
.dc { color: var(--dc); font-weight: 600; }
.lv-Easy { color: var(--easy); } .lv-Medium { color: var(--med); } .lv-Hard { color: var(--hard); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 28px; padding: 0 20px; height: 56px; }
.brand { font-weight: 800; letter-spacing: .02em; color: var(--text); padding-right: 14px; border-right: 1px solid var(--line); }
.brand span { background: linear-gradient(90deg, #facc15, #fb923c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar nav { display: flex; gap: 26px; flex: 1; height: 100%; overflow-x: auto; }
.topbar nav a { display: flex; align-items: center; color: var(--muted); font-size: 16px; border-bottom: 2px solid transparent; white-space: nowrap; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.top-right { display: flex; align-items: center; gap: 16px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); padding: 6px; display: flex; }
.icon-btn:hover { color: var(--text); }
.icon-btn svg, .flame svg { width: 20px; height: 20px; }
.flame { display: flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 600; }
.flame.on { color: #fb923c; }
.avatar-wrap { position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; color: #fff; font-weight: 700; }
.menu { position: absolute; right: 0; top: 44px; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 30; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: transparent; text-align: left; padding: 8px 10px; }
.menu button:hover { background: var(--panel2); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 0; }
.menu .mini { width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.menu .check { margin-left: auto; color: var(--accent); }

/* ---------- layout ---------- */
main { max-width: 1340px; margin: 0 auto; padding: 32px 20px 80px; }
main.narrow { max-width: 1000px; }
main.wide { max-width: none; padding: 0; }
h1 { font-size: 34px; margin: 0 0 24px; }
h2 { font-size: 24px; margin: 0 0 16px; font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }

/* ---------- hero cards ---------- */
.heroes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-bottom: 36px; }
.hero { border-radius: 14px; padding: 22px; color: #fff; min-height: 200px; display: flex; flex-direction: column; }
.hero h3 { margin: 0 0 6px; font-size: 26px; font-weight: 600; letter-spacing: .01em; }
.hero p { margin: 0; opacity: .92; }
.hero button { margin-top: auto; align-self: flex-start; background: #fff; border: 0; color: #2346d6; font-weight: 600; padding: 11px 20px; }
.hero.blue { background: linear-gradient(135deg, #3b82f6, #2340e0); }
.hero.purple { background: linear-gradient(135deg, #8b5cf6, #a855f7 60%, #9333ea); }
.hero.purple button { color: #7c3aed; }
.hero.orange { background: linear-gradient(135deg, #f5c542, #f29a3a); }
.hero.orange button { color: #c2410c; }

/* ---------- dropdown filters ---------- */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.dd { position: relative; }
.dd > button { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-width: 150px; background: var(--panel2); border-color: transparent; color: var(--muted); padding: 9px 14px; }
.dd > button.set { color: var(--text); }
.dd > button svg { width: 14px; height: 14px; }
.dd-panel { position: absolute; top: 46px; left: 0; min-width: 100%; max-height: 420px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; z-index: 20; box-shadow: 0 12px 30px rgba(0,0,0,.3); }
.dd-panel button { display: flex; width: 100%; gap: 10px; align-items: center; border: 0; background: transparent; text-align: left; padding: 9px 12px; white-space: nowrap; border-radius: 7px; }
.dd-panel button:hover, .dd-panel button.on { background: var(--panel2); }
.dd-panel button.on::after { content: "✓"; margin-left: auto; color: var(--muted); }
.dd-panel .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px 4px; }
.search { flex: 1; min-width: 200px; position: relative; }
.search input { width: 100%; background: var(--panel2); border-color: transparent; padding: 9px 12px 9px 36px; }
.search svg { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; min-height: 4px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--panel2); border: 0; }

/* ---------- problems table ---------- */
.ptable { width: 100%; border-collapse: collapse; }
.ptable th { text-align: left; font-weight: 500; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ptable td { padding: 13px 14px; }
.ptable tbody tr { cursor: pointer; }
.ptable tbody tr:nth-child(odd) td { background: var(--panel); }
.ptable tbody tr:hover td { background: var(--panel2); }
.ptable td.num { color: var(--muted); width: 60px; }
.ptable td.st { width: 40px; text-align: center; }
.ok { color: var(--good); } .no { color: var(--bad); }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; align-items: center; }
.pager button { min-width: 40px; background: var(--panel2); border-color: transparent; }
.pager button.cur { background: var(--muted); color: var(--bg); }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: 1fr 360px; gap: 32px; align-items: start; }
.dash section { margin-bottom: 36px; }
.heat { padding: 18px 20px; }
.heat-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.heat-scroll { overflow-x: auto; }
/* Cells stretch to fill the card, so the whole year and every month label fit without scrolling. */
.heat-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, auto); grid-auto-columns: 1fr; gap: 3px; }
.heat-grid i { border-radius: 3px; background: var(--panel2); display: block; aspect-ratio: 1; }
.heat-grid i.l1 { background: color-mix(in srgb, var(--good) 35%, var(--panel2)); }
.heat-grid i.l2 { background: color-mix(in srgb, var(--good) 60%, var(--panel2)); }
.heat-grid i.l3 { background: color-mix(in srgb, var(--good) 80%, var(--panel2)); }
.heat-grid i.l4 { background: var(--good); }
.heat-grid i.blank { visibility: hidden; }
.heat-months { position: relative; height: 20px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.heat-months span { position: absolute; }
.summary { padding: 20px; }
.summary .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.summary .lbl { font-size: 14px; color: var(--muted); }
.summary .big { font-size: 30px; font-weight: 700; margin: 4px 0 18px; }
.summary .big small { font-size: 18px; font-weight: 500; }
.lvbox { display: flex; justify-content: space-between; background: var(--panel2); border-radius: 8px; padding: 8px 14px; font-weight: 500; }
.cats .cat { padding: 22px 26px; border-bottom: 1px solid var(--line); }
.cats .cat:last-child { border-bottom: 0; }
.cats .cat a.name { font-size: 20px; font-weight: 600; color: var(--dc); }
.cat-bar { display: flex; align-items: center; gap: 20px; margin: 14px 0; }
.bar { flex: 1; height: 7px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--dc, var(--accent)); }
.cat-bar .frac { font-size: 18px; white-space: nowrap; }
.cat-bar .frac span { color: var(--muted); }
.squares { display: flex; flex-wrap: wrap; gap: 4px; }
.squares i { width: 13px; height: 13px; border-radius: 3px; background: var(--panel2); cursor: pointer; display: block; }
.squares i.s { background: var(--good); } .squares i.a { background: var(--bad); }
.squares i:hover { outline: 2px solid var(--dc); }
.hist { padding: 6px 0; }
.hist .item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; cursor: pointer; }
.hist .item:hover { background: var(--panel2); }
.hist .item .when { margin-left: auto; color: var(--muted); font-size: 13px; }
.empty { text-align: center; padding: 30px 20px; color: var(--muted); font-size: 16px; }
.empty .z { font-size: 34px; }

/* ---------- study plan ---------- */
.featured { width: 380px; max-width: 100%; height: 300px; border-radius: 14px; padding: 22px; color: #fff; cursor: pointer; position: relative; overflow: hidden;
  background: linear-gradient(160deg, #2f5fd6, #1b3a8c); }
.featured h3 { margin: 0 0 8px; font-size: 20px; font-weight: 500; }
.featured p { margin: 0; opacity: .85; font-size: 14px; }
.featured .target { position: absolute; right: 30px; bottom: 26px; width: 130px; height: 130px; }
.featured .fprog { position: absolute; left: 22px; bottom: 22px; font-size: 14px; opacity: .9; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tile { display: flex; gap: 20px; padding: 12px; background: var(--panel); border-radius: 12px; cursor: pointer; border: 1px solid var(--line); align-items: center; }
.tile:hover { border-color: var(--dc); }
.tile .badge { width: 94px; height: 94px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; color: var(--dc);
  background: linear-gradient(160deg, color-mix(in srgb, var(--dc) 45%, #000), color-mix(in srgb, var(--dc) 18%, #000)); }
:root[data-theme="light"] .tile .badge { color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--dc) 85%, #fff), var(--dc)); }
.tile .info { flex: 1; min-width: 0; }
.tile .t { font-size: 17px; }
.tile .s { color: var(--muted); font-size: 14px; margin: 2px 0 12px; }
.tile .cat-bar { margin: 0; gap: 12px; }
.tile .cat-bar .frac { font-size: 14px; }
.section-gap { margin-top: 48px; }

/* ---------- leaderboard ---------- */
.lb-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.seg { display: inline-flex; background: var(--panel2); border-radius: 10px; padding: 4px; margin: 10px 0 24px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 7px 16px; }
.seg button.on { background: var(--bg); color: var(--text); font-weight: 600; }
.lb-row { display: flex; align-items: center; gap: 26px; padding: 18px 30px; border-bottom: 1px solid var(--line); }
.lb-row .rank { width: 24px; font-size: 18px; text-align: center; }
.lb-row .av { width: 44px; height: 44px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.lb-row .n { font-size: 19px; color: #fb923c; }
.lb-row .n.first { color: #eab308; }
.lb-row .sub { color: var(--muted); font-size: 14px; }
.note { color: var(--muted); font-size: 13px; margin-top: 18px; }

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: 250px 1fr; gap: 44px; align-items: start; }
.about .photo { width: 250px; height: 250px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 90px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #9333ea); }
.about h1 { font-size: 30px; margin-bottom: 12px; }
.about p { font-size: 16px; line-height: 1.65; margin: 0 0 16px; }
.about-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; margin-top: 30px; }
.about-cols h3 { margin: 0 0 12px; font-size: 19px; }
.about-cols li { margin-bottom: 6px; }
footer.foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); margin-top: 80px; padding-top: 20px; }

/* ---------- question view ---------- */
.qbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.qbar .meta { flex: 1; min-width: 200px; }
.qbar .meta .t { font-weight: 600; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 56px; text-align: center; }
.qwrap { display: grid; grid-template-columns: 1fr 340px; height: calc(100vh - 118px); }
.viewer { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; background: var(--bg); }
.tabs button { border-radius: 8px 8px 0 0; border-bottom: 0; }
.tabs button.on { background: var(--panel); font-weight: 600; }
.pdfview { flex: 1; overflow: auto; padding: 12px; background: var(--bg); display: flex; flex-direction: column; gap: 12px; }
.pdfview canvas { display: block; background: #fff; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.pdfview iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.side { padding: 18px; overflow: auto; background: var(--panel); }
.choices { display: grid; gap: 8px; margin: 12px 0; }
.choices button { text-align: left; padding: 12px 14px; font-weight: 600; }
.choices button.sel { border-color: var(--accent); background: var(--accent-soft); }
.choices button.right { border-color: var(--good); background: var(--good-soft); }
.choices button.wrong { border-color: var(--bad); background: var(--bad-soft); }
.choices button:disabled { opacity: 1; }
.choices button:disabled:not(.right):not(.wrong) { color: var(--muted); }
.spr input { width: 100%; font-size: 18px; padding: 10px; margin: 12px 0; }
.feedback { margin-top: 14px; padding: 12px; border-radius: 10px; }
.feedback.ok { background: var(--good-soft); color: var(--good); }
.feedback.no { background: var(--bad-soft); color: var(--bad); }
.feedback.info { background: var(--accent-soft); color: var(--text); }
.hint { font-size: 13px; color: var(--muted); }
.history { margin-top: 18px; font-size: 13px; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.calc { position: fixed; right: 16px; bottom: 16px; width: 520px; height: 460px; z-index: 20; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.25); overflow: hidden; resize: both; }
.calc-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.calc-body { flex: 1; }

@media (max-width: 1000px) {
  .heroes, .tiles { grid-template-columns: 1fr 1fr; }
  .dash { grid-template-columns: 1fr; }
  .about, .about-cols { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .heroes, .tiles { grid-template-columns: 1fr; }
  .topbar-inner { gap: 14px; }
  .topbar nav { gap: 16px; }
  .qwrap { grid-template-columns: 1fr; height: auto; }
  .viewer { height: 70vh; }
  .calc { width: calc(100vw - 32px); }
  .hide-sm { display: none; }
  h1 { font-size: 28px; }
}

/* multi-select filters, gear menu, chips */
.dd > button .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; text-align: center; }
.icon-sq { display: flex; align-items: center; justify-content: center; width: 42px; height: 40px; padding: 0; background: var(--panel2); border-color: transparent; color: var(--muted); }
.icon-sq svg { width: 18px; height: 18px; }
.dd-panel.right { left: auto; right: 0; min-width: 190px; }
.dd-panel .colopt::after { display: none; }
.dd-panel .tick { width: 18px; display: inline-flex; }
.dd-panel .tick svg { width: 16px; height: 16px; }
.chips-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; min-height: 36px; }
.chips-row .chips { flex: 1; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; padding: 5px 12px; border-radius: 8px; background: var(--panel2); border: 0; }
.chip .x { color: var(--muted); }
.list-actions { display: flex; align-items: center; gap: 10px; }
.reset { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 0; color: var(--muted); font-size: 16px; padding: 5px 4px; }
.reset:hover { color: var(--text); }
.reset svg { width: 18px; height: 18px; }
.dd > button.icon-sq { min-width: 0; justify-content: center; padding: 0; }

/* ---------- question workspace (feprep-style) ---------- */
.qnav { display: none; }
body.qmode .topbar nav { display: none; }
body.qmode .qnav { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
body.qmode .topbar-inner { max-width: none; gap: 16px; }
body.qmode main { padding: 10px; max-width: none; }
.qn-btn { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; padding: 6px 10px; border-radius: 8px; border: 0; background: transparent; white-space: nowrap; }
.qn-btn svg, .qn-icon svg { width: 20px; height: 20px; flex: none; }
.qn-btn:hover { background: var(--panel2); }
.qn-icon { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--muted); padding: 7px; border-radius: 8px; }
.qn-icon:hover:not(:disabled) { color: var(--text); background: var(--panel2); }
.qn-icon.on { color: var(--accent); }
.qn-center { flex: 1; display: flex; justify-content: center; align-items: center; gap: 10px; }
.boxed { background: var(--panel2); border-radius: 8px; padding: 8px 12px; color: var(--muted); }
.qn-btn.boxed { font-size: 15px; }
.qn-btn.boxed.on { color: var(--med); }
.timer-box { display: flex; align-items: stretch; gap: 2px; }
.timer-box .qn-icon { background: var(--panel2); border-radius: 0; padding: 8px 10px; }
.timer-box .seg-l { border-radius: 8px 0 0 8px; }
.timer-box .seg-r { border-radius: 0 8px 8px 0; }
.timer-box .seg-m { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.timer-box .seg-m.paused { color: var(--med); }

.ws { display: grid; grid-template-columns: var(--split, 50%) 8px 1fr; height: calc(100vh - 76px); }
.right-col { display: grid; grid-template-rows: var(--rsplit, 45%) 8px 1fr; min-height: 0; min-width: 0; }
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.pane-tabs { display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: var(--panel2); border-bottom: 1px solid var(--line); }
.pane-tabs button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--muted); font-size: 16px; padding: 5px 8px; }
.pane-tabs button.on { color: var(--text); font-weight: 600; }
.pane-tabs .ic { display: inline-flex; } .pane-tabs .ic svg { width: 17px; height: 17px; }
.ic.blue { color: #3b82f6; } .ic.green { color: #22c55e; } .ic.yellow { color: #eab308; }
.sepv { width: 1px; height: 16px; background: var(--line); }
.pdf-bar { display: flex; align-items: center; padding: 4px 10px; border-bottom: 1px solid var(--line); gap: 10px; }
.pdf-title { flex: 1; text-align: center; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-tools { display: flex; align-items: center; gap: 2px; }
.pdf-tools .qn-icon svg { width: 18px; height: 18px; }
.zoom-lvl { font-size: 12px; color: var(--muted); min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }
/* margin:auto centers pages but still lets a zoomed-in page scroll to its left edge */
.pane .pdfview { position: relative; flex: 1; overflow: auto; padding: 16px; background: var(--bg); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.pane .pdfview canvas { flex: none; margin: 0 auto; }
/* Dark reading mode: white paper becomes the panel gray and black text becomes light gray, matching the site. */
.pdfview.inverted canvas:not(.ink) { filter: invert(.86) hue-rotate(180deg); box-shadow: none; }
.pane-foot { display: flex; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.tag { font-size: 13px; padding: 3px 10px; border-radius: 6px; background: var(--panel2); }
.pane-body { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.pane-body textarea { width: 100%; height: 100%; min-height: 120px; resize: none; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 15px; }
.gutter { position: relative; }
.gutter.v { cursor: col-resize; } .gutter.h { cursor: row-resize; }
.gutter::after { content: ""; position: absolute; background: var(--line); border-radius: 2px; }
.gutter.v::after { left: 3px; top: 50%; width: 2px; height: 30px; margin-top: -15px; }
.gutter.h::after { top: 3px; left: 50%; height: 2px; width: 30px; margin-left: -15px; }
.gutter:hover::after { background: var(--accent); }
body.dragging { user-select: none; cursor: grabbing; }
body.dragging iframe, body.dragging canvas { pointer-events: none; }

.board-wrap { position: relative; padding: 0; overflow: hidden; }
.board-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.board-tools { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 6px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.25); flex-wrap: wrap; justify-content: center; max-width: calc(100% - 20px); }
.board-tools .qn-icon.on { background: var(--panel2); color: var(--text); }
.swatch { width: 20px; height: 20px; border-radius: 50%; padding: 0; border: 2px solid transparent; background: var(--sw); }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.sw-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
#penSize { width: 70px; }
.desmos { width: 100%; height: 100%; }
#calcPane { padding: 0; }

.qn-icon.tip { position: relative; }
.qn-icon.tip::after { content: attr(data-tip); position: absolute; top: 110%; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 12px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; max-width: 760px; width: 100%; max-height: 90vh; overflow: auto; padding: 18px 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 18px; }
.ref-sheet { color: var(--text); }
.ref-grid { display: flex; flex-wrap: wrap; gap: 18px 26px; justify-content: center; align-items: flex-end; }
.ref-item { display: flex; flex-direction: column; align-items: center; }
.ref-pair { display: flex; gap: 14px; align-items: flex-end; }
.ref-fig { height: 110px; color: var(--text); overflow: visible; }
.ref-fig text { fill: currentColor; font-family: "Times New Roman", Times, serif; font-style: italic; }
.ref-f { font-family: "Times New Roman", Times, serif; font-size: 17px; margin-top: 6px; text-align: center; line-height: 1.5; }
.ref-item.wide .ref-f { font-style: normal; }
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: 13px; line-height: 1.05; margin: 0 2px; }
.fr span:first-child { border-bottom: 1px solid currentColor; padding: 0 2px; }
.ref-notes { margin: 22px 0 4px; padding-left: 18px; line-height: 1.8; font-size: 15px; }

@media (max-width: 900px) {
  .ws { grid-template-columns: 1fr; grid-template-rows: 70vh auto; height: auto; }
  .ws .gutter.v { display: none; }
  .right-col { grid-template-rows: 380px 8px 420px; margin-top: 10px; }
  .qnav .qn-btn span, .qn-btn.boxed span { display: none; }
  .pdf-title { padding-left: 0; }
}

/* Hero cards: drop shadows under the cards, titles and buttons, plus faint vertical stripes. */
.hero { position: relative; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease;
  box-shadow: 0 6px 16px rgba(0,0,0,.28), 0 2px 4px rgba(0,0,0,.18); }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 1px, transparent 1px 36px); }
.hero > * { position: relative; }
.hero h3 { text-shadow: 0 2px 4px rgba(0,0,0,.35); }
.hero p { text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.hero button { transition: box-shadow .2s ease, transform .2s ease; box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.hero button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,.35); }
.hero:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,.38), 0 3px 6px rgba(0,0,0,.2); }

/* Dark Desmos that matches the site: same soft invert as the PDFs, so white becomes the panel gray
   and hue-rotate keeps graph colors close to their originals. */
.desmos.inverted { filter: invert(.86) hue-rotate(180deg); }
.pane-tabs .tab-tool { margin-left: auto; }
.pane-tabs .tab-tool svg { width: 18px; height: 18px; }

/* Dashboard: section headers and per-difficulty stats inside each category */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 18px 0 10px; }
.sec-head h3 { margin: 0; font-size: 18px; }
.sec-stats { display: flex; gap: 18px; color: var(--muted); font-size: 14px; }
.sec-stats b { color: var(--text); }
.cat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.acc-pill { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--panel2); color: var(--muted); }
.good { color: var(--good) !important; } .okay { color: var(--med) !important; } .weak { color: var(--bad) !important; }
.lv-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 4px 0 16px; }
.lv-stat { background: var(--panel2); border-radius: 10px; padding: 10px 12px; }
.lv-stat > div:first-child { font-weight: 600; font-size: 14px; }
.lv-num { font-size: 18px; margin: 2px 0 6px; } .lv-num span { color: var(--muted); font-size: 14px; }
.bar.thin { height: 5px; background: var(--line); }
.lv-acc { font-size: 13px; margin-top: 6px; font-weight: 600; } .lv-acc .muted { font-weight: 400; }
.summary .lvbox { gap: 10px; }
@media (max-width: 700px) { .lv-stats { grid-template-columns: 1fr; } }
.ref-fig text[font-style="normal"] { font-style: normal; }

.wb-text { position: absolute; z-index: 2; min-width: 120px; background: transparent; border: 1px dashed var(--muted); border-radius: 4px; padding: 0 4px; margin: -2px 0 0 -5px; outline: none; }

/* sortable table headers */
.ptable th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.ptable th.sortable:hover { color: var(--text); }
.ptable th.sorted { color: var(--text); }
.sort-arrows { display: inline-flex; flex-direction: column; gap: 2px; margin-left: 8px; vertical-align: middle; }
.sort-arrows i { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; opacity: .35; }
.sort-arrows .up { border-bottom: 5px solid currentColor; } .sort-arrows .down { border-top: 5px solid currentColor; }
th.sorted.asc .sort-arrows .up, th.sorted.desc .sort-arrows .down { opacity: 1; color: var(--accent); }

/* A right-side panel switched to the opposite theme gets its own background and text colors. */
.pane-body.pane-light, .pane-body.pane-dark { background: var(--panel); color: var(--text); }
.pane-light { color-scheme: light; } .pane-dark { color-scheme: dark; }
.pane-body.pane-light textarea, .pane-body.pane-dark textarea { color: var(--text); }

/* Answer eliminator: cross out choices like the Bluebook app */
.choice-row { display: flex; align-items: center; gap: 8px; }
.choice-row > button[data-c] { flex: 1; }
.choices button.crossed { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); opacity: .6; }
.choices .strike-btn { text-align: center; width: 52px; flex: none; padding: 9px 0; font-size: 14px; color: var(--text); opacity: .75; background: transparent; border-radius: 999px; }
.choices .strike-btn:hover { opacity: 1; }
.strike-btn s { text-decoration-thickness: 2px; font-weight: 600; }
.choices .strike-btn.on { color: var(--accent); }

/* Pencil layer over the question: ignores the mouse until the pencil is switched on */
.pdfview canvas.ink { position: absolute; top: 0; left: 0; margin: 0; pointer-events: none; background: transparent !important; box-shadow: none !important; border-radius: 0; }
.pdfview canvas.ink.active { pointer-events: auto; cursor: crosshair; touch-action: none; }
.ink-tools { display: inline-flex; align-items: center; gap: 4px; }
.ink-tools .swatch { width: 16px; height: 16px; }

/* Diagnostic test */
.featured-row { display: flex; gap: 24px; flex-wrap: wrap; }
.featured.diag-card { cursor: default; background: linear-gradient(160deg, #0f9f8f, #0b5d6b); }
.diag-card p { max-width: 300px; line-height: 1.5; }
.diag-btns { position: absolute; left: 22px; right: 22px; bottom: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.diag-btns button { background: #fff; border: 0; color: #0b5d6b; font-weight: 600; padding: 9px 14px; box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.diag-btns button:hover:not(:disabled) { transform: translateY(-1px); }
.diag-banner { background: var(--panel2); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.diag-banner .bar { margin: 8px 0 6px; }
.diag-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.diag-sum .stat { padding: 16px; }
.diag-sum .num { font-size: 28px; font-weight: 700; margin: 4px 0 10px; }
.diag-sum .num small { font-size: 16px; color: var(--muted); font-weight: 500; }
.diag-sum .lbl { color: var(--muted); font-size: 14px; }
.weak-list { padding: 6px 0; }
.weak-row { display: flex; align-items: center; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.weak-row:last-child { border-bottom: 0; }
.weak-rank { width: 28px; height: 28px; border-radius: 50%; background: var(--bad-soft); color: var(--bad); font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.weak-info { flex: 1; } .weak-skill { font-weight: 600; font-size: 16px; }
.diag-table { padding: 6px 18px; }
.diag-dom { padding: 12px 0; border-bottom: 1px solid var(--line); }
.diag-dom:last-child { border-bottom: 0; }
.diag-dom .name { margin-bottom: 6px; }
.diag-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.diag-row > span:first-child { flex: 1; }
.diag-marks { display: flex; gap: 6px; }
.diag-q { width: 30px; height: 30px; padding: 0; border-radius: 8px; background: var(--panel2); border: 0; font-weight: 700; }
@media (max-width: 800px) { .diag-sum { grid-template-columns: 1fr 1fr; } }

.diag-open { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; margin-bottom: 18px; border-color: var(--accent); }
.diag-choose { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 900px; }
.diag-opt { padding: 22px; }
.diag-opt h3 { margin: 0; font-size: 20px; }
.diag-opt .big { font-size: 34px; font-weight: 700; margin: 6px 0; } .diag-opt .big small { font-size: 16px; color: var(--muted); font-weight: 500; }
.diag-opt p { min-height: 44px; }
@media (max-width: 700px) { .diag-choose { grid-template-columns: 1fr; } }

.diag-choose { grid-template-columns: repeat(3, 1fr); max-width: none; }
.del-cell { width: 90px; text-align: right; }
.del-btn { font-size: 13px; }
.del-btn.armed { color: #fff; background: var(--bad); padding: 6px 10px; }
@media (max-width: 900px) { .diag-choose { grid-template-columns: 1fr; } }

.hero-btns { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.hero .hero-btns button { margin-top: 0; }

/* ---------- accounts ---------- */
.avatar { overflow: hidden; display: flex; align-items: center; justify-content: center; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.signed-out { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.avatar.signed-out svg { width: 18px; height: 18px; }
.menu { min-width: 240px; }
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.menu button svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.menu button.danger, .menu button.danger svg { color: var(--bad); }
.menu-av, .av.photo { width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; object-fit: cover; }
.lb-row img.av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.lb-row span.av { width: 44px; height: 44px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.modal-card.acct { max-width: 380px; padding: 26px; }
.acct-brand { text-align: center; margin-bottom: 18px; }
.acct-brand h2 { margin: 8px 0 2px; font-size: 22px; }
.acct-logo { font-weight: 800; font-size: 34px; letter-spacing: .02em; background: linear-gradient(90deg, #facc15, #fb923c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.acct-list { display: grid; gap: 8px; margin-bottom: 12px; }
.acct-pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; font-weight: 600; }
.acct-wide { width: 100%; margin-top: 8px; padding: 11px; }
.acct-photo-row { display: flex; align-items: center; gap: 16px; margin: 6px 0 16px; }
.acct-big { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 30px; font-weight: 700; object-fit: cover; }
.acct-upload { cursor: pointer; display: inline-block; }
.acct-field { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.acct-field input { display: block; width: 100%; margin-top: 4px; font-size: 15px; color: var(--text); }
.acct-err { color: var(--bad); font-size: 14px; min-height: 18px; }
/* Signed out on a question: blur the workspace behind the sign-in card */
body.locked main, body.locked .qnav { filter: blur(8px); pointer-events: none; user-select: none; }
.lock-overlay { position: fixed; inset: 56px 0 0 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.25); }

.sample-banner { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; line-height: 1.45; }
.free-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--good-soft); color: var(--good); margin-right: 6px; white-space: nowrap; }

.topbar nav a.try-tab { color: var(--good); font-weight: 600; }
.topbar nav a.try-tab:hover { color: var(--text); }

.acct-row { display: flex; justify-content: space-between; margin: -4px 0 6px; font-size: 13px; }
.acct-alt { text-align: center; margin-top: 14px; font-size: 14px; color: var(--muted); }
.acct-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0 4px; }
.acct-sep::before, .acct-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.acct-legacy { margin-top: 14px; display: grid; gap: 6px; font-size: 13px; }
.acct-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acct-note { font-size: 13px; color: var(--muted); background: var(--panel2); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; line-height: 1.4; }
.acct-pw { margin-bottom: 10px; } .acct-pw summary { cursor: pointer; color: var(--accent); font-size: 14px; margin-bottom: 8px; }
.acct-field .muted { font-weight: 400; }

/* About links + store button */
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.link-list a { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 17px; }
.link-list a:hover { color: var(--accent); }
.link-list svg { width: 20px; height: 20px; flex: none; }
.store-btn { display: inline-flex; align-items: center; gap: 10px; background: #5865f2; color: #fff; font-weight: 600; padding: 11px 18px; border-radius: 10px; box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.store-btn:hover { filter: brightness(1.08); }
.store-btn svg { width: 20px; height: 20px; }
/* Site footer (hidden on the question workspace) */
.site-foot { border-top: 1px solid var(--line); margin-top: 20px; }
.site-foot-inner { max-width: 1340px; margin: 0 auto; padding: 22px 20px 34px; color: var(--muted); font-size: 14px; }
.foot-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0; }
.foot-links a { color: var(--muted); padding: 0 14px; border-left: 1px solid var(--line); }
.foot-links a:first-child { border-left: 0; }
.foot-links a:hover { color: var(--text); }
.foot-note { font-size: 12px; margin: 14px 0 0; line-height: 1.5; }
body.qmode .site-foot { display: none; }
/* Legal pages */
.legal { max-width: 780px; line-height: 1.65; font-size: 15px; }
.legal h1 { margin-bottom: 4px; }
.legal h2 { font-size: 19px; margin: 28px 0 8px; }
.legal ul { padding-left: 20px; } .legal li { margin-bottom: 6px; }
main:not(.wide) { min-height: calc(100vh - 190px); }

.foot-left { max-width: 620px; text-align: left; }
.foot-left .foot-note { margin-top: 8px; }
.foot-row { align-items: flex-start; }

.modal-card.acct { position: relative; }
.acct-x { position: absolute; top: 10px; right: 10px; font-size: 14px; }
.about img.photo { object-fit: cover; object-position: center; display: block; background: none; }

/* ---------- pricing ---------- */
.pricing-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.pricing-head h1 { font-size: 34px; margin: 0 0 8px; }
.pricing-head p { margin: 0; }
.price-seg { margin: 0; }
.plan-card { max-width: 520px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px 32px; box-shadow: var(--shadow); }
.plan-name { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plan-tag { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 3px 10px; }
.plan-sub { margin: 6px 0 18px; }
.plan-price { font-size: 46px; font-weight: 800; line-height: 1; }
.plan-price span { font-size: 16px; font-weight: 500; color: var(--muted); }
.plan-note { margin: 8px 0 20px; font-size: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.plan-list { list-style: none; padding: 0; margin: 0 0 26px; display: grid; gap: 11px; }
.plan-list li { display: flex; gap: 10px; align-items: flex-start; }
.plan-list svg { width: 18px; height: 18px; flex: none; color: var(--good); margin-top: 2px; }
.plan-cta { display: block; text-align: center; background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 13px; font-weight: 600; }
.plan-cta:hover { filter: brightness(1.08); }
.plan-foot { text-align: center; margin: 14px 0 0; font-size: 14px; }
@media (max-width: 600px) { .plan-card { padding: 24px 20px; } .pricing-head h1 { font-size: 28px; } }
