/* PreLevelTest — shared styles (public pages, test player, results, admin). Tokens first; dark mode follows the OS. */
:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f9f9f7;
  --surface-3: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7a7873;
  --line: #e4e3dc;
  --line-2: #d3d2ca;
  --ring: rgba(11, 11, 11, .10);
  --shadow: 0 1px 2px rgba(20, 20, 10, .06), 0 6px 24px rgba(20, 20, 10, .06);
  --shadow-lg: 0 2px 6px rgba(20, 20, 10, .06), 0 18px 48px rgba(20, 20, 10, .10);
  --primary: #256abf;
  --primary-2: #1c5cab;
  --primary-soft: #e6f0fc;
  --primary-ink: #ffffff;
  --ladder: #157a5a;
  --ladder-2: #0f6649;
  --ladder-soft: #e3f4ec;
  --express: #c93f78;
  --express-2: #b03266;
  --express-soft: #fbe9f0;
  --good: #0a7d0a;
  --good-soft: #e5f4e5;
  --bad: #c43535;
  --bad-soft: #fbeaea;
  --warn: #9a6700;
  --warn-soft: #fdf3dc;
  /* charts (reference palette) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --grid: #e8e7e1;
  --axis: #c3c2b7;
  --lv-pre: #b7d3f6; --lv-a1: #9ec5f4; --lv-a2: #6da7ec; --lv-b1: #3987e5;
  --lv-b2: #256abf; --lv-c1: #184f95; --lv-c2: #0d366b;
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f0f0e; --surface: #1a1a19; --surface-2: #20201e; --surface-3: #2a2a27;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #9a988f; --line: #2f2f2c; --line-2: #3d3d39;
    --ring: rgba(255, 255, 255, .10);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .4), 0 18px 48px rgba(0, 0, 0, .35);
    --primary: #3987e5; --primary-2: #5598e7; --primary-soft: #16263b; --primary-ink: #0b0b0b;
    --ladder: #2fb585; --ladder-2: #46c495; --ladder-soft: #13291f;
    --express: #e0679a; --express-2: #ea80ad; --express-soft: #331722;
    --good: #2fbf2f; --good-soft: #142914; --bad: #e66767; --bad-soft: #351919; --warn: #e2a72e; --warn-soft: #33270f;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --grid: #2c2c2a; --axis: #45453f;
    --lv-pre: #104281; --lv-a1: #184f95; --lv-a2: #1c5cab; --lv-b1: #256abf;
    --lv-b2: #3987e5; --lv-c1: #6da7ec; --lv-c2: #9ec5f4;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f0f0e; --surface: #1a1a19; --surface-2: #20201e; --surface-3: #2a2a27;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #9a988f; --line: #2f2f2c; --line-2: #3d3d39;
  --ring: rgba(255, 255, 255, .10);
  --primary: #3987e5; --primary-2: #5598e7; --primary-soft: #16263b; --primary-ink: #0b0b0b;
  --ladder: #2fb585; --ladder-2: #46c495; --ladder-soft: #13291f;
  --express: #e0679a; --express-2: #ea80ad; --express-soft: #331722;
  --good: #2fbf2f; --good-soft: #142914; --bad: #e66767; --bad-soft: #351919; --warn: #e2a72e; --warn-soft: #33270f;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --grid: #2c2c2a; --axis: #45453f;
  --lv-pre: #104281; --lv-a1: #184f95; --lv-a2: #1c5cab; --lv-b1: #256abf;
  --lv-b2: #3987e5; --lv-c1: #6da7ec; --lv-c2: #9ec5f4;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink); font: 16px/1.55 var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); letter-spacing: -.025em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .86rem; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---- header / footer ---- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); font-size: 1.08rem; }
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.brand b { color: var(--primary); font-weight: 700; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { color: var(--ink-2); padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav a.on { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: .85rem; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg.big button { font-size: 1rem; padding: 10px 22px; }
footer.foot { color: var(--muted); font-size: .85rem; padding: 28px 0 36px; }
footer.foot .wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }

/* ---- buttons / forms ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  background: var(--primary); color: var(--primary-ink); font: inherit; font-weight: 600; padding: 11px 20px;
  border-radius: 11px; cursor: pointer; transition: background .15s, transform .05s, box-shadow .15s;
  text-decoration: none !important; white-space: nowrap;
}
.btn:hover { background: var(--primary-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.lg { padding: 14px 26px; font-size: 1.05rem; border-radius: 13px; }
.btn.sm { padding: 6px 12px; font-size: .88rem; border-radius: 9px; }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.quiet { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn.quiet:hover { background: var(--surface-3); color: var(--ink); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--line-2); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ladder { background: var(--ladder); }
.btn.ladder:hover { background: var(--ladder-2); }
.btn.express { background: var(--express); }
.btn.express:hover { background: var(--express-2); }
:root[data-theme="dark"] .btn.ladder, :root[data-theme="dark"] .btn.express { color: #0b0b0b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.ladder, :root:not([data-theme="light"]) .btn.express { color: #0b0b0b; }
}
label.fld { display: block; margin-bottom: 14px; }
label.fld > span { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: .95rem; color: var(--ink-2); }
.err { color: var(--bad); font-size: .92rem; min-height: 1.3em; margin: 4px 0 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2); font-size: .82rem; font-weight: 600; white-space: nowrap;
}
.chip.blue { background: var(--primary-soft); color: var(--primary); }
.chip.green { background: var(--good-soft); color: var(--good); }
.chip.red { background: var(--bad-soft); color: var(--bad); }
.chip.amber { background: var(--warn-soft); color: var(--warn); }
.chip.pink { background: var(--express-soft); color: var(--express); }
.chip.teal { background: var(--ladder-soft); color: var(--ladder); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--ring); }
.pad { padding: 24px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 10px; font-size: .92rem;
  transition: all .2s; pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- level badge ---- */
.lvl {
  display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 26px; padding: 0 8px;
  border-radius: 7px; font-weight: 700; font-size: .82rem; color: #fff; background: var(--lv-b1);
  font-variant-numeric: tabular-nums;
}
.lvl.Pre-A1, .lvl.pre { background: var(--lv-pre); color: #0d366b; }
.lvl.A1 { background: var(--lv-a1); color: #0d366b; }
.lvl.A2 { background: var(--lv-a2); color: #0b0b0b; }
.lvl.B1 { background: var(--lv-b1); }
.lvl.B2 { background: var(--lv-b2); }
.lvl.C1 { background: var(--lv-c1); }
.lvl.C2 { background: var(--lv-c2); }
:root[data-theme="dark"] .lvl.C1, :root[data-theme="dark"] .lvl.C2, :root[data-theme="dark"] .lvl.B2 { color: #0b0b0b; }
:root[data-theme="dark"] .lvl.Pre-A1, :root[data-theme="dark"] .lvl.A1, :root[data-theme="dark"] .lvl.A2 { color: #f0efec; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lvl.C1, :root:not([data-theme="light"]) .lvl.C2,
  :root:not([data-theme="light"]) .lvl.B2 { color: #0b0b0b; }
  :root:not([data-theme="light"]) .lvl.Pre-A1, :root:not([data-theme="light"]) .lvl.A1,
  :root:not([data-theme="light"]) .lvl.A2 { color: #f0efec; }
}

/* ---- dashboard (index) ---- */
.hero { padding: 56px 0 28px; text-align: center; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 660px; margin: 0 auto 26px; }
.hero .pick { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hero .pick > span { font-weight: 600; color: var(--ink-2); font-size: .95rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 22px; padding: 22px 0 10px; }
.tcard { display: flex; flex-direction: column; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tcard .art { height: 128px; position: relative; overflow: hidden; }
.tcard .art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tcard .body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.tcard .tag { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.tcard h3 { font-size: 1.35rem; margin-bottom: 8px; }
.tcard p { color: var(--ink-2); font-size: .97rem; flex: 1; }
.tcard .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 18px; }
.tcard.ladder .tag { color: var(--ladder); }
.tcard.express .tag { color: var(--express); }
.tcard.soon { opacity: .7; border-style: dashed; box-shadow: none; }
.section { padding: 34px 0; }
.lookup { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: start; }
.lookup form { display: flex; gap: 10px; }
.lookup form input { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; max-width: 220px; }
.results-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.results-list a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 11px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink);
}
.results-list a:hover { border-color: var(--primary); text-decoration: none; }
.cefr { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.cefr div { background: var(--surface); border: 1px solid var(--ring); border-radius: 12px; padding: 14px; }
.cefr b { display: block; }
.cefr span { font-size: .85rem; color: var(--ink-2); }
@media (max-width: 820px) { .lookup { grid-template-columns: 1fr; } .cefr { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px) { .cefr { grid-template-columns: repeat(2, 1fr); } .nav { display: none; } }

/* ---- test player ---- */
.player { max-width: 780px; margin: 0 auto; padding: 28px 16px 60px; }
.player.ladder { --acc: var(--ladder); --acc-2: var(--ladder-2); --acc-soft: var(--ladder-soft); }
.player.express { --acc: var(--express); --acc-2: var(--express-2); --acc-soft: var(--express-soft); }
.intro-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.intro-head .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--acc-soft); display: grid; place-items: center; flex: none; }
.intro-head .ico svg { width: 32px; height: 32px; color: var(--acc); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 22px; }
.facts div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.facts b { display: block; font-size: 1.15rem; }
.facts span { color: var(--muted); font-size: .85rem; }
.choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); margin-bottom: 18px; }
.choices label {
  display: flex; gap: 10px; align-items: center; border: 1.5px solid var(--line-2); border-radius: 11px;
  padding: 11px 13px; cursor: pointer; font-size: .95rem; background: var(--surface); transition: border-color .12s, background .12s;
}
.choices label:hover { border-color: var(--acc); }
.choices input { accent-color: var(--acc); }
.choices label:has(input:checked) { border-color: var(--acc); background: var(--acc-soft); }
.q-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.q-top .count { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; flex: 1; min-width: 120px; }
.bar > i { display: block; height: 100%; background: var(--acc, var(--primary)); border-radius: 99px; transition: width .4s ease; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; padding: 4px 10px; border-radius: 8px; background: var(--surface-3); }
.timer.low { background: var(--bad-soft); color: var(--bad); }
.steps { display: flex; align-items: flex-end; gap: 6px; height: 70px; margin: 4px 0 18px; }
.steps div {
  flex: 1; border-radius: 8px 8px 3px 3px; background: var(--surface-3); color: var(--muted); font-weight: 700; font-size: .8rem;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 5px; transition: background .3s, color .3s;
}
.steps div.past { background: var(--acc-soft); color: var(--acc); }
.steps div.cur { background: var(--acc); color: #fff; box-shadow: 0 6px 16px -6px var(--acc); }
.qcard { padding: 26px; }
.instr { color: var(--muted); font-size: .9rem; font-weight: 600; margin-bottom: 10px; }
.passage {
  background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--acc); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 18px; font-size: 1rem; line-height: 1.65; max-height: 46vh; overflow: auto;
}
.passage h4 { margin: 0 0 6px; font-size: .95rem; }
.prompt { font-size: 1.32rem; line-height: 1.5; margin-bottom: 20px; font-weight: 500; white-space: pre-line; }
.prompt .gap { display: inline-block; min-width: 72px; border-bottom: 2.5px solid var(--acc); margin: 0 4px; height: 1.1em; vertical-align: -2px; }
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; font: inherit; font-size: 1.05rem;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line-2); border-radius: 12px; padding: 13px 16px;
  cursor: pointer; transition: border-color .12s, background .12s, transform .05s;
}
.opt:hover { border-color: var(--acc); background: var(--acc-soft); }
.opt .k {
  flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700;
  font-size: .9rem; background: var(--surface-3); color: var(--ink-2);
}
.opt.sel { border-color: var(--acc); background: var(--acc-soft); }
.opt.sel .k { background: var(--acc); color: #fff; }
.opt:disabled { cursor: default; }
.q-actions { display: flex; gap: 12px; margin-top: 20px; align-items: center; flex-wrap: wrap; }
.q-actions .btn.go { background: var(--acc); }
.q-actions .btn.go:hover { background: var(--acc-2); }
.kbd-hint { color: var(--muted); font-size: .82rem; }
.gapin { font-size: 1.15rem; max-width: 340px; }
.part-card { text-align: center; padding: 44px 28px; }
.part-card .num { display: inline-block; font-weight: 700; color: var(--acc); background: var(--acc-soft); padding: 5px 14px; border-radius: 99px; margin-bottom: 14px; }
.part-dots { display: flex; justify-content: center; gap: 8px; margin: 18px 0 26px; }
.part-dots i { width: 42px; height: 6px; border-radius: 99px; background: var(--surface-3); }
.part-dots i.on { background: var(--acc); }
.spin { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--acc, var(--primary)); animation: spin 0.9s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) {
  .facts { grid-template-columns: 1fr 1fr 1fr; } .qcard { padding: 18px; } .prompt { font-size: 1.15rem; }
  .steps { height: 56px; }
}

/* ---- results ---- */
.res { max-width: 1000px; margin: 0 auto; padding: 30px 16px 60px; }
.res-hero { display: grid; grid-template-columns: 280px 1fr; gap: 0; overflow: hidden; }
.res-hero .left {
  background: linear-gradient(160deg, var(--primary), #0d366b); color: #fff; padding: 30px 26px; display: flex;
  flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.res-hero .left .big { font-size: 4.6rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.res-hero .left .lbl { font-size: 1.1rem; font-weight: 600; opacity: .92; margin-top: 6px; }
.res-hero .left .sc { margin-top: 18px; font-size: .95rem; opacity: .9; }
.res-hero .left .sc b { font-size: 1.6rem; }
.res-hero .right { padding: 28px 30px; }
.thanks { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin-bottom: 6px; }
.codebox {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface-2); border: 1.5px dashed var(--line-2);
  border-radius: 12px; padding: 12px 16px; margin: 18px 0 14px;
}
.codebox .code { font-size: 1.5rem; font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kv div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); }
.kv span { display: block; color: var(--muted); font-size: .8rem; }
.kv b { font-size: .98rem; }
.scale { margin: 6px 0 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
.res h2 { font-size: 1.2rem; }
.cando { list-style: none; padding: 0; margin: 0; }
.cando li { padding: 7px 0 7px 30px; position: relative; color: var(--ink-2); }
.cando li::before {
  content: ""; position: absolute; left: 2px; top: 10px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--good-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%230a7d0a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat;
}
.topics { display: flex; flex-wrap: wrap; gap: 6px; }
.tip { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.tip:first-child { border-top: 0; }
.tip .n { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.note { background: var(--warn-soft); color: var(--ink); border-radius: 10px; padding: 10px 14px; font-size: .93rem; margin-top: 12px; }
.actions-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; justify-content: center; }
@media (max-width: 820px) {
  .res-hero { grid-template-columns: 1fr; } .grid2, .grid3 { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr 1fr; }
}
@media print {
  .topbar, footer.foot, .actions-bar, .no-print { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .res-hero .left { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- charts ---- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font: 12px var(--font); font-variant-numeric: tabular-nums; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .ax { stroke: var(--axis); stroke-width: 1; }
.chart .lab { fill: var(--ink-2); font-weight: 600; }
.chart .val { fill: var(--ink); font-weight: 600; }
.chart .hit { fill: transparent; cursor: default; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.dot { border-radius: 50%; }
.legend i.ring { border-radius: 50%; background: transparent !important; border: 2px solid var(--bad); }
.legend i.line { height: 3px; width: 16px; border-radius: 2px; vertical-align: 3px; }
.tt {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--surface); padding: 7px 10px; border-radius: 8px;
  font-size: .82rem; line-height: 1.35; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 5;
  opacity: 0; transition: opacity .1s;
}
.tt.on { opacity: 1; }
.hbar { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 10px; align-items: center; margin: 9px 0; font-size: .92rem; }
.hbar .track { height: 12px; background: var(--surface-3); border-radius: 0 6px 6px 0; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.hbar .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ---- admin ---- */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 60px); }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; }
.side a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--ink-2);
  font-weight: 600; font-size: .95rem; margin-bottom: 2px;
}
.side a:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.side a.on { background: var(--primary-soft); color: var(--primary); }
.side svg { width: 18px; height: 18px; flex: none; }
.side .sep { height: 1px; background: var(--line); margin: 14px 6px; }
.content { padding: 26px 28px 60px; min-width: 0; }
.content h1 { font-size: 1.6rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { padding: 16px 18px; }
.tile .l { color: var(--ink-2); font-size: .86rem; }
.tile .v { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.tile .s { color: var(--muted); font-size: .8rem; }
.panels { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-bottom: 18px; }
.panel { padding: 18px 20px; }
.panel h3 { font-size: 1rem; margin-bottom: 12px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input[type=search] { max-width: 280px; }
.filters select { width: auto; padding: 9px 12px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th {
  text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
}
.tbl th.sort { cursor: pointer; }
.tbl th.sort:hover { color: var(--ink); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .q { max-width: 420px; }
.tbl tr.flag td { background: var(--warn-soft); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: .9rem; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.st.completed::before { background: var(--good); }
.st.active::before { background: var(--series-1); }
.st.abandoned::before { background: var(--warn); }
.resp { border-top: 1px solid var(--line); padding: 14px 0; display: grid; grid-template-columns: 40px 1fr; gap: 12px; }
.resp .mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; }
.resp .mark.ok { background: var(--good-soft); color: var(--good); }
.resp .mark.no { background: var(--bad-soft); color: var(--bad); }
.resp .mark.skip { background: var(--surface-3); color: var(--muted); }
.resp .qtxt { font-weight: 600; white-space: pre-line; }
.resp .ctx { color: var(--muted); font-size: .86rem; margin: 2px 0 6px; }
.resp .ans { font-size: .92rem; display: flex; gap: 16px; flex-wrap: wrap; }
.resp .ans .wrong { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1px; }
.resp .ans .right { color: var(--good); font-weight: 600; }
.resp details { font-size: .88rem; color: var(--ink-2); margin-top: 6px; }
.resp details p { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin: 6px 0 0; }
.detail-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.login { max-width: 400px; margin: 10vh auto; padding: 30px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }
pre.doc { white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: 14px; font-size: .85rem; color: var(--ink-2); margin: 0; }
@media (max-width: 960px) { .panels { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; }
  .side { display: flex; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side a { white-space: nowrap; } .side .sep { display: none; } .content { padding: 18px 16px 50px; }
}
