:root {
  --brand: #5b4fe0; --brand-2: #7a6dff; --brand-ink: #ffffff;
  --grad: linear-gradient(135deg, #6d5efc 0%, #5b4fe0 100%);
  --bg: #f7f7fb; --panel: #ffffff; --panel-2: #f2f1f9;
  --line: #e7e6f1; --line-2: #dcdaee;
  --ink: #191826; --ink-2: #5c5a72; --ink-3: #8b89a3;
  --good: #12996b; --good-bg: #e4f6ee; --warn: #b5771a;
  --r-lg: 20px; --r: 14px; --r-sm: 10px; --pill: 999px;
  --sh: 0 1px 2px rgba(25,20,50,.05), 0 6px 20px rgba(25,20,50,.05);
  --sh-lg: 0 2px 6px rgba(25,20,50,.06), 0 18px 44px rgba(25,20,50,.09);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --sp: 4px;
}
/* DARK PALETTE. Applies when: the user explicitly chose dark (data-theme="dark"), OR
   they haven't overridden and the OS is dark (media query, excluded only by an explicit
   data-theme="light"). No attribute = follow the OS, exactly as before. */
:root[data-theme="dark"] {
  --brand: #8b7dff; --brand-2: #a99dff;
  --grad: linear-gradient(135deg, #7d6dff 0%, #6355e6 100%);
  --bg: #0c0b12; --panel: #16151f; --panel-2: #1e1c2b;
  --line: #292734; --line-2: #35324a;
  --ink: #eceaf7; --ink-2: #a6a3bd; --ink-3: #726f8c;
  --good: #35c48c; --good-bg: #143a2c; --warn: #d19a3e;
  --sh: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.28);
  --sh-lg: 0 2px 6px rgba(0,0,0,.34), 0 18px 44px rgba(0,0,0,.42);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #8b7dff; --brand-2: #a99dff;
    --grad: linear-gradient(135deg, #7d6dff 0%, #6355e6 100%);
    --bg: #0c0b12; --panel: #16151f; --panel-2: #1e1c2b;
    --line: #292734; --line-2: #35324a;
    --ink: #eceaf7; --ink-2: #a6a3bd; --ink-3: #726f8c;
    --good: #35c48c; --good-bg: #143a2c; --warn: #d19a3e;
    --sh: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.28);
    --sh-lg: 0 2px 6px rgba(0,0,0,.34), 0 18px 44px rgba(0,0,0,.42);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.55; -webkit-font-smoothing: antialiased; }
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }
.wrap { max-width: 940px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--ink-2); }
.tiny { font-size: .82rem; }
h1,h2,h3 { letter-spacing: -0.02em; line-height: 1.18; }

/* ---------- brand + topbar ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.18rem; letter-spacing: -0.03em; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; background: url("logo.svg") center/contain no-repeat; color: transparent; font-size: 0; display: inline-block; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; padding: 13px 20px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); }
.topbar .who { display: flex; align-items: center; gap: 12px; font-size: .9rem; color: var(--ink-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: var(--brand); }

/* ---------- buttons ---------- */
.btn { --pad: 11px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-size: .94rem; font-weight: 650; cursor: pointer; padding: var(--pad); border-radius: var(--pill); border: 1px solid transparent; white-space: nowrap; transition: transform .05s ease, background .16s, border-color .16s, box-shadow .16s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 34%, transparent); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-price { background: var(--panel); color: var(--ink); border-color: var(--line-2); font-weight: 700; }
.btn-price:hover { border-color: var(--brand); color: var(--brand); box-shadow: var(--sh); }
.btn-sm { --pad: 8px 14px; font-size: .86rem; }
.btn-link { background: none; border: none; color: var(--brand); font-weight: 650; cursor: pointer; font-size: .9rem; padding: 0; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- badges / pills ---------- */
.owned-tag { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; color: var(--good); background: var(--good-bg); padding: 4px 9px; border-radius: var(--pill); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- app header ---------- */
main { padding: 30px 0 80px; }
.page-head { margin-bottom: 6px; }
.page-head h1 { font-size: 1.7rem; font-weight: 750; }
.page-head p { color: var(--ink-2); margin-top: 3px; }
.banner { display: flex; gap: 10px; align-items: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 16px; margin: 18px 0 4px; font-size: .9rem; color: var(--ink-2); }
.banner strong { color: var(--ink); }

/* ---------- class grid (home) ---------- */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 22px; }
.class-card { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); padding: 20px 22px; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; transition: border-color .15s, transform .05s, box-shadow .15s; }
.class-card:hover { border-color: var(--brand); box-shadow: var(--sh-lg); }
.class-card:active { transform: translateY(1px); }
.cc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cc-top h3 { font-size: 1.14rem; font-weight: 720; }
.cc-count { font-size: .78rem; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.cc-sub { color: var(--ink-2); font-size: .9rem; margin-top: 2px; }
.cc-foot { margin-top: 14px; }
.cc-open { color: var(--brand); font-weight: 650; font-size: .9rem; }
.back { display: inline-block; margin: 2px 0 8px; }

/* ---------- block card ---------- */
.blocks { display: flex; flex-direction: column; gap: 18px; margin-top: 22px; }
.block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); overflow: hidden; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 20px 22px 6px; }
.block-head h3 { font-size: 1.18rem; font-weight: 720; }
.block-head .sub { color: var(--ink-2); font-size: .9rem; }
.block-head .prog { font-size: .78rem; color: var(--ink-3); font-weight: 600; white-space: nowrap; }

.products { padding: 6px 12px 12px; }
.product { display: flex; align-items: center; gap: 14px; padding: 13px 10px; border-radius: var(--r); }
.product + .product { border-top: 1px solid var(--line); }
.product:hover { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.p-ico { width: 38px; height: 38px; border-radius: 11px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--panel-2); color: var(--brand); }
.p-ico svg { width: 20px; height: 20px; }
.p-main { flex: 1; min-width: 0; }
.p-main .p-label { font-weight: 650; font-size: .98rem; display: flex; align-items: center; gap: 8px; }
.p-main .p-blurb { color: var(--ink-2); font-size: .85rem; margin-top: 1px; }
.p-action { flex: none; }
.p-soon { color: var(--ink-3); font-size: .82rem; font-weight: 600; }

/* bundle bar */
.bundle { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 4px 12px 14px; padding: 14px 16px; border-radius: var(--r); background: color-mix(in srgb, var(--brand) 8%, var(--panel)); border: 1px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); }
.bundle .b-txt { font-size: .9rem; }
.bundle .b-txt strong { color: var(--ink); }
.bundle .b-save { color: var(--brand); font-weight: 700; }

/* owned strip when all three owned */
.all-owned { margin: 4px 12px 14px; padding: 12px 16px; border-radius: var(--r); background: var(--good-bg); color: var(--good); font-size: .88rem; font-weight: 650; display: flex; align-items: flex-start; gap: 8px; }
.all-owned .dot { flex-shrink: 0; margin-top: 6px; }

/* ---------- lifetime cta ---------- */
.lifetime { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 18px 0 6px; padding: 18px 22px; border-radius: var(--r-lg); background: var(--grad); color: #fff; box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 38%, transparent); }
.lifetime .lt-name { font-size: 1.15rem; font-weight: 750; }
.lifetime .lt-desc { font-size: .9rem; opacity: .92; margin-top: 2px; }
.lifetime .lt-buy { display: flex; align-items: center; gap: 14px; }
.lifetime .lt-price { font-size: 1.5rem; font-weight: 750; }
.lifetime .btn-primary { background: #fff; color: var(--brand); box-shadow: none; }
.lifetime .btn-primary:hover { filter: none; background: #f1f0ff; }
.lifetime.owned { background: var(--good-bg); color: var(--good); box-shadow: none; border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); }
.lifetime.owned .lt-name { display: flex; align-items: center; gap: 8px; }
.lifetime.owned .lt-desc { color: var(--good); opacity: .82; }

/* ---------- examsoft signal ---------- */
.examsoft { display: flex; align-items: flex-start; gap: 9px; margin: 0 22px 6px; padding: 10px 14px; border-radius: var(--r); background: color-mix(in srgb, var(--warn) 13%, transparent); color: var(--ink-2); font-size: .85rem; line-height: 1.45; }
.es-tag { flex: none; font-size: .66rem; font-weight: 750; text-transform: uppercase; letter-spacing: .03em; color: var(--warn); background: color-mix(in srgb, var(--warn) 20%, transparent); padding: 3px 9px; border-radius: var(--pill); white-space: nowrap; }
.es-tag.inline { display: inline-block; }
.q-badges { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; min-height: 20px; }

/* ---------- account panel ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); padding: 22px; margin-top: 28px; }
.panel h2 { font-size: 1.1rem; margin-bottom: 14px; }
.kv { display: flex; gap: 8px; align-items: center; font-size: .92rem; margin-bottom: 8px; color: var(--ink-2); }
.kv b { color: var(--ink); font-weight: 600; }
.device-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); font-size: .88rem; color: var(--ink-2); }
.device-row:first-of-type { border-top: none; }
.demo-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* ---------- auth ---------- */
.auth { max-width: 380px; margin: 8vh auto 0; padding: 0 20px; text-align: center; }
.auth .field { text-align: left; }
.auth .brand { margin-bottom: 22px; }
.auth h1 { font-size: 1.55rem; font-weight: 740; }
.auth .sub { color: var(--ink-2); margin: 4px 0 22px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .82rem; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.field input { width: 100%; font: inherit; font-size: 1rem; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.auth-msg { font-size: .86rem; min-height: 1.1em; margin: 6px 0; }
.auth-msg.err { color: #d3503f; font-weight: 650; }
.switch { text-align: center; margin-top: 16px; font-size: .9rem; color: var(--ink-2); }
.demo-box { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.demo-box .row { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }

/* ---------- practice player ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,8,20,.6); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 60; overflow: auto; }
.player { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-lg); width: 100%; max-width: 580px; padding: 22px 22px 20px; }
.player-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.player-top .meta { font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.player-top .score { color: var(--brand); }
.player-close { background: none; border: none; color: var(--ink-3); cursor: pointer; font-size: 1.4rem; line-height: 1; padding: 0 4px; }
.pbar { height: 5px; border-radius: var(--pill); background: var(--panel-2); overflow: hidden; margin-bottom: 18px; }
.pbar > i { display: block; height: 100%; background: var(--grad); transition: width .25s ease; }
.player-q { font-size: 1.16rem; font-weight: 650; min-height: 60px; }
.player-a { font-size: 1rem; background: var(--panel-2); border-left: 3px solid var(--brand); border-radius: 0 10px 10px 0; padding: 13px 16px; margin-top: 14px; }
.player-actions, .player-rate { display: flex; gap: 10px; margin-top: 18px; }
.player-actions .btn, .player-rate .btn { flex: 1; }
.btn-rate { flex: 1; background: var(--panel); border: 1px solid var(--line-2); color: var(--ink); font-weight: 650; padding: 12px; border-radius: var(--r-sm); cursor: pointer; transition: border-color .14s, color .14s; }
.btn-rate:hover { border-color: var(--brand); color: var(--brand); }
.khint { text-align: center; font-size: .76rem; color: var(--ink-3); margin-top: 12px; }

@media (max-width: 620px) {
  .block-head { flex-direction: column; }
  .product { flex-wrap: wrap; }
  .p-action { width: 100%; }
  .p-action .btn { width: 100%; }
  .bundle { flex-direction: column; align-items: stretch; text-align: center; }
  /* topbar: collapse to essentials so it never wraps (the avatar carries identity) */
  .topbar { padding: 11px 14px; }
  .wrap { padding: 0 14px; }
  .topbar .who { gap: 9px; }
  .who-name { display: none; }
  .topbar .who .btn-link, .topbar .brand { white-space: nowrap; }
  .brand { font-size: 1.06rem; }
  .brand-mark { width: 26px; height: 26px; }
  .page-head h1 { font-size: 1.72rem; }
  /* 4 stat tiles are too tight on a phone → 2×2 */
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
  .st-val { font-size: 1.4rem; }
}

/* ==================== Qbank (board-style practice) ==================== */
:root { --danger: #d3503f; }
@media (prefers-color-scheme: dark) { :root { --danger: #f0857a; } }

.qbank { position: fixed; inset: 0; z-index: 100; background: var(--bg); overflow-y: auto; }
.qb-wrap { max-width: 1120px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.qb-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 22px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--line); }
.qb-x { background: none; border: none; color: var(--ink-2); font: inherit; font-size: .95rem; font-weight: 650; cursor: pointer; padding: 0; }
.qb-x:hover { color: var(--brand); }
.qb-title { font-weight: 700; font-size: 1.02rem; }
.qb-progress { flex: 1; display: flex; align-items: center; gap: 12px; max-width: 440px; margin: 0 auto; font-size: .84rem; color: var(--ink-2); font-weight: 650; }
.qb-pbar { flex: 1; height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.qb-pbar > i { display: block; height: 100%; background: var(--grad); transition: width .2s; }
.qb-head-r { display: flex; gap: 8px; }
.qb-flagbtn, .qb-navbtn { background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: .84rem; font-weight: 650; color: var(--ink); cursor: pointer; white-space: nowrap; }
.qb-flagbtn.on { color: var(--warn); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.qb-flagbtn:hover, .qb-navbtn:hover { border-color: var(--brand); color: var(--brand); }

.qb-setup { max-width: 640px; margin: 0 auto; padding: 34px 22px 60px; width: 100%; }
.qb-setup h2 { font-size: 1.5rem; font-weight: 740; margin-bottom: 18px; }
.qb-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 24px; }
.qs { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 6px; text-align: center; }
.qs b { display: block; font-size: 1.4rem; font-weight: 750; }
.qs span { font-size: .72rem; color: var(--ink-2); }
.qs.ok b { color: var(--good); } .qs.bad b { color: var(--danger); } .qs.flag b { color: var(--warn); }
.qb-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.qb-opts label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--ink-2); font-weight: 650; }
.qb-opts select { font: inherit; font-size: .95rem; padding: 11px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); cursor: pointer; }
.qb-start { width: 100%; padding: 14px; }

.qb-body { flex: 1; display: flex; }
.qb-main { flex: 1; max-width: 760px; margin: 0 auto; width: 100%; padding: 26px 22px 64px; }
.qb-nav { display: none; }
.qb-wrap.nav-open .qb-nav { display: block; width: 224px; flex: none; border-left: 1px solid var(--line); padding: 22px 16px; }
.qb-wrap.nav-open .qb-main { margin: 0; }
.qb-nav-title { font-size: .8rem; font-weight: 700; color: var(--ink-2); margin-bottom: 12px; }
.qb-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qb-tile { aspect-ratio: 1; border: 1px solid var(--line-2); border-radius: 7px; background: var(--panel); font: inherit; font-size: .8rem; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.qb-tile.ok { background: var(--good-bg); color: var(--good); border-color: transparent; }
.qb-tile.bad { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); border-color: transparent; }
.qb-tile.flag { box-shadow: inset 0 0 0 2px var(--warn); }
.qb-tile.cur { outline: 2px solid var(--brand); outline-offset: 1px; }

.qb-qcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); padding: 26px 28px; }
.qb-topic { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); padding: 4px 10px; border-radius: 999px; margin-bottom: 14px; }
.qb-stem { font-size: 1.08rem; line-height: 1.62; font-weight: 500; }
.qb-img { display: block; max-width: 460px; width: 100%; margin: 18px auto 4px; border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--sh); }
.qb-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.qb-choice { display: flex; align-items: flex-start; gap: 12px; text-align: left; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); padding: 13px 15px; font: inherit; font-size: .97rem; line-height: 1.45; color: var(--ink); cursor: pointer; transition: border-color .12s, background .12s; }
.qb-choice:not(:disabled):hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, var(--panel)); }
.qb-choice .ql { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--panel-2); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.qb-choice.correct { border-color: var(--good); background: var(--good-bg); }
.qb-choice.correct .ql { background: var(--good); color: #fff; }
.qb-choice.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.qb-choice.wrong .ql { background: var(--danger); color: #fff; }
.qb-choice.picked { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.qb-choice.picked .ql { background: var(--brand); color: #fff; }
.qb-choice:disabled { cursor: default; }
.qb-explain { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.qb-verdict { font-weight: 700; font-size: .95rem; margin-bottom: 8px; }
.qb-verdict.ok { color: var(--good); } .qb-verdict.bad { color: var(--danger); }
.qb-exp { font-size: .96rem; line-height: 1.66; color: var(--ink); }
.qb-exp.show { margin-top: 16px; background: var(--panel-2); border-left: 3px solid var(--brand); border-radius: 0 8px 8px 0; padding: 14px 16px; }
.qb-rate { display: flex; gap: 10px; margin-top: 16px; }
.qb-rate .btn-rate { flex: 1; }
.qb-nav-btns { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }

.qb-results { max-width: 620px; margin: 0 auto; padding: 34px 22px 60px; width: 100%; }
.qb-score { text-align: center; margin-bottom: 26px; }
.qb-score-num { font-size: 3.2rem; font-weight: 780; letter-spacing: -0.02em; line-height: 1; }
.qb-score-num.ok { color: var(--good); } .qb-score-num.bad { color: var(--danger); }
.qb-score-sub { color: var(--ink-2); margin-top: 4px; }
.qb-topics { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }
.qb-trow { display: grid; grid-template-columns: 132px 1fr 46px; align-items: center; gap: 12px; font-size: .9rem; }
.qb-tbar { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.qb-tbar > i { display: block; height: 100%; }
.qb-tbar > i.ok { background: var(--good); } .qb-tbar > i.bad { background: var(--danger); }
.qb-trow b { text-align: right; }
.qb-res-actions { display: flex; flex-direction: column; gap: 10px; }

@media (max-width: 720px) {
  .qb-stats { grid-template-columns: repeat(3, 1fr); }
  .qb-opts { grid-template-columns: 1fr; }
  .qb-progress { display: none; }
  .qb-wrap.nav-open .qb-nav { position: fixed; right: 0; top: 55px; bottom: 0; width: 62%; background: var(--panel); z-index: 6; overflow-y: auto; box-shadow: -8px 0 30px rgba(0,0,0,.2); }
  .qb-wrap.nav-open .qb-main { padding: 22px 18px 64px; }
  .qb-trow { grid-template-columns: 88px 1fr 40px; }
}

/* ---------- topics (class detail) ---------- */
.topics-sec { margin-top: 26px; }
.topics-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.topics-head h3 { font-size: 1.15rem; font-weight: 700; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.topic-section { margin-top: 18px; }
.topic-section:first-child { margin-top: 6px; }
.sec-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 7px 0 9px; border-bottom: 2px solid var(--brand); margin-bottom: 12px; }
.sec-head h4 { font-size: 1.05rem; font-weight: 700; color: var(--brand); letter-spacing: -.01em; }
.sec-sub { font-size: .82rem; color: var(--muted); }
.topic-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 14px 15px; display: flex; flex-direction: column; gap: 9px; }
.topic-box.editing { cursor: grab; border-style: dashed; border-color: var(--brand); }
.topic-box.drag { opacity: .5; }
.topic-grid.editing { background: var(--panel-2); border-radius: var(--r); padding: 10px; }
.tb-head { display: flex; align-items: flex-start; gap: 8px; }
.tb-grip { color: var(--ink-3); font-size: 1rem; line-height: 1; letter-spacing: -3px; user-select: none; margin-top: 2px; }
.tb-titles { min-width: 0; }
.tb-title { font-weight: 650; font-size: .98rem; line-height: 1.25; }
.tb-sub { font-size: .78rem; color: var(--ink-3); margin-top: 1px; }
.tb-bar { height: 6px; border-radius: var(--pill); background: var(--panel-2); overflow: hidden; }
.tb-bar i { display: block; height: 100%; background: var(--brand); border-radius: var(--pill); }
.tb-bar i.ok { background: var(--good); } .tb-bar i.bad { background: #e5695c; }
.tb-stats { display: flex; align-items: center; gap: 10px; font-size: .78rem; color: var(--ink-2); }
.tb-grade { font-weight: 700; } .tb-grade.ok { color: var(--good); } .tb-grade.bad { color: #e5695c; }
.tb-flag { color: var(--warn); font-weight: 600; }
.tb-locked { font-size: .82rem; color: var(--ink-3); }
.btn.full { width: 100%; justify-content: center; }

/* ---------- qbank multi-topic selector ---------- */
.qb-topicsel { margin-top: 4px; }
.qb-topicsel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: .9rem; font-weight: 600; }
.qb-tbtns .btn-link { font-size: .82rem; }
.qb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.qb-chip { border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2); border-radius: var(--pill); padding: 7px 13px; font-size: .84rem; font-weight: 550; cursor: pointer; transition: all .12s; }
.qb-chip:hover { border-color: var(--brand); }
.qb-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- locked class placeholders ---------- */
.class-card.locked { cursor: default; opacity: .72; background: var(--panel-2); border-style: dashed; }
.class-card.locked:hover { transform: none; box-shadow: none; border-color: var(--line-2); }
.class-card.locked h3 { color: var(--ink-2); }
.cc-lock { font-size: 1rem; opacity: .8; }
.cc-soon { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 650;
  color: var(--brand-2, var(--brand)); background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--pill); padding: 3px 10px; }

/* ---------- signed-out-elsewhere notice ---------- */
.superseded-note { margin: 12px 0 4px; padding: 11px 14px; border-radius: 10px; font-size: .86rem;
  line-height: 1.4; color: #7a3a12; background: #fdf1e3; border: 1px solid #f0d3b0; text-align: left; }
@media (prefers-color-scheme: dark) { .superseded-note { color: #f4c99a; background: #3a2a18; border-color: #6a4a24; } }

/* ---------- owner admin: lock / unlock / schedule ---------- */
.adm-list { display: flex; flex-direction: column; gap: 10px; }
.adm-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px 16px;
  padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); }
.adm-name { font-weight: 650; }
.adm-status { justify-self: end; }
.adm-badge { font-size: .8rem; font-weight: 650; padding: 3px 10px; border-radius: var(--pill); white-space: nowrap; }
.adm-badge.live { color: #1f8a4c; background: rgba(31,138,76,.12); }
.adm-badge.sched { color: #9a6a1e; background: rgba(200,150,40,.14); }
.adm-badge.locked { color: var(--ink-3); background: var(--panel-2); }
.adm-ctl { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.adm-date-wrap { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.adm-date { padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: .85rem; }
.btn-sm { padding: 6px 12px; font-size: .82rem; }

/* ---------- theme toggle ---------- */
.theme-toggle { font-size: 1.05rem; line-height: 1; padding: 3px 6px; border-radius: 8px; }
.theme-toggle:hover { background: var(--panel-2); }

/* ---------- class stats strip ---------- */
.stats-strip { margin: 2px 0 22px; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-tile { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); padding: 14px 10px; text-align: center; box-shadow: var(--sh); }
.st-val { font-size: 1.55rem; font-weight: 750; color: var(--ink); line-height: 1.05; }
.st-val.ok { color: var(--good); } .st-val.bad { color: var(--danger); }
.st-of { font-size: .85rem; font-weight: 600; color: var(--ink-3); }
.st-lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-top: 5px; font-weight: 700; }
.stat-bar { height: 8px; border-radius: var(--pill); background: var(--panel-2); overflow: hidden; margin-top: 12px; }
.stat-bar i { display: block; height: 100%; background: var(--grad); border-radius: var(--pill); transition: width .4s ease; }

/* ---------- mastered topic ---------- */
.topic-box.mastered { border-color: var(--brand); box-shadow: inset 3px 0 0 0 var(--brand), var(--sh); }
.tb-star { color: var(--brand); font-size: .82em; vertical-align: middle; }

/* ---------- notification bell ---------- */
.bell { position: relative; font-size: 1.02rem; padding: 3px 5px; }
.bell-badge { position: absolute; top: -3px; right: -3px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .62rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.who .btn-link[data-act="admin"] .bell-badge { position: static; margin-left: 3px; }

/* ---------- free tags ---------- */
.free-tag { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 700; color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, transparent); border-radius: var(--pill); padding: 3px 11px; }
.free-tag.sm { font-size: .72rem; padding: 2px 8px; }
.class-card.free { border-color: color-mix(in srgb, var(--brand) 45%, var(--line-2)); }
.all-owned.free { background: color-mix(in srgb, var(--brand) 10%, var(--panel)); color: var(--ink); }

/* ---------- notifications ---------- */
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item { padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); }
.notif-item.unread { border-left: 3px solid var(--brand); }
.notif-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.notif-subj { font-weight: 700; }
.notif-when { font-size: .74rem; color: var(--ink-3); white-space: nowrap; }
.notif-body { font-size: .92rem; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }

/* ---------- inline contact / help link ---------- */
.contact-link { color: var(--brand); font-weight: 600; text-decoration: underline; }

/* ---------- admin console ---------- */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.atab { font: inherit; font-size: .88rem; font-weight: 600; padding: 7px 14px; border-radius: var(--pill); border: 1px solid var(--line-2);
  background: var(--panel); color: var(--ink-2); cursor: pointer; }
.atab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.admin-intro { font-size: .88rem; color: var(--ink-2); margin-bottom: 16px; line-height: 1.5; }
.au-list { display: flex; flex-direction: column; gap: 12px; }
.au-row { padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); }
.au-row.help.open { border-left: 3px solid var(--warn); }
.au-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.au-email { font-size: .82rem; color: var(--ink-3); }
.au-devs { margin-top: 8px; font-size: .82rem; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.au-dev { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-2); border-radius: var(--pill); padding: 3px 5px 3px 10px; font-size: .78rem; }
.au-x { background: none; border: none; color: var(--ink-3); cursor: pointer; font-size: .8rem; padding: 0 2px; }
.au-x:hover { color: var(--danger); }
.au-actions { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.au-class { padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: .8rem; max-width: 170px; }
.help-body { margin-top: 8px; font-size: .9rem; color: var(--ink-2); line-height: 1.5; }
.help-reply { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.help-ta, .help-form textarea, .bcast textarea { width: 100%; min-height: 64px; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; font-size: .9rem; resize: vertical; }
.bcast { display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.bcast label { font-size: .78rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; margin-top: 8px; }
.bcast select, .bcast input, .help-form input { padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; font-size: .9rem; }
.bcast #bc-send { margin-top: 12px; align-self: flex-start; }
.help-form { display: flex; flex-direction: column; gap: 8px; max-width: 480px; }

/* install / offline help */
.help-q { font-weight: 700; font-size: 1.05rem; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border); line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.help-q:hover { border-color: var(--brand); color: var(--brand); }
.help-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.help-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; }
.help-card h3 { margin: 0 0 8px; font-size: 1rem; }
.help-card ol { margin: 0; padding-left: 18px; }
.help-card li { margin: 5px 0; font-size: .92rem; line-height: 1.4; }
@media (max-width: 720px) { .help-cards { grid-template-columns: 1fr; } }
