:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --surface-2: #efeee9;
  --line: #dddbd3;
  --text: #17171a;
  --text-2: #52514e;
  --muted: #8a8880;
  --accent: #1c5cab;
  --accent-soft: #e3edfb;
  --accent-ink: #ffffff;
  --good: #0ca30c;
  --good-ink: #006300;
  --good-soft: #e3f4e1;
  --warn: #fab219;
  --warn-soft: #fdf1d6;
  --bad: #d03b3b;
  --bad-soft: #fbe5e3;
  --new: #c9c7bf;
  --series: #2a78d6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #242422;
    --line: #34342f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #8f8e86;
    --accent: #5598e7;
    --accent-soft: #1d2c40;
    --accent-ink: #0b0b0b;
    --good-ink: #4cc24c;
    --good-soft: #17301a;
    --warn-soft: #3a3016;
    --bad-soft: #3b1d1c;
    --new: #4a4a45;
    --series: #3987e5;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface: #1a1a19;
  --surface-2: #242422;
  --line: #34342f;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #8f8e86;
  --accent: #5598e7;
  --accent-soft: #1d2c40;
  --accent-ink: #0b0b0b;
  --good-ink: #4cc24c;
  --good-soft: #17301a;
  --warn-soft: #3a3016;
  --bad-soft: #3b1d1c;
  --new: #4a4a45;
  --series: #3987e5;
  --shadow: none;
}
.btn.theme-btn { display: inline-flex; align-items: center; gap: 6px; }
.theme-btn svg { width: 16px; height: 16px; }
.login-theme { position: fixed; top: 14px; right: 14px; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- hlavička ---------- */
header.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 24px; padding: 10px 20px; }
.brand { font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
nav.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
nav.tabs a { text-decoration: none; color: var(--text-2); padding: 7px 12px; border-radius: 8px; font-size: 15px; white-space: nowrap; }
nav.tabs a:hover { background: var(--surface-2); color: var(--text); }
nav.tabs a.active { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.user-box { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); white-space: nowrap; }

main { max-width: 1100px; margin: 0 auto; padding: 28px 20px 80px; }
h1 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -.01em; }
.sub { color: var(--text-2); margin: 0 0 24px; }
.section-gap { margin-top: 28px; }

/* ---------- prvky ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
@media (max-width: 860px) { .g3, .g4, .g5 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g2 { grid-template-columns: 1fr; } }

.btn { text-decoration: none; display: inline-block; border: 1px solid var(--line); background: var(--surface); padding: 9px 16px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 15px; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.label { font-size: 13px; color: var(--text-2); font-weight: 600; margin-bottom: 6px; display: block; }
input[type=text], input[type=password], input[type=search], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
}
input:focus-visible, select:focus-visible, .btn:focus-visible, .opt:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 14px; user-select: none; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }

.mode-list { display: grid; gap: 8px; }
.mode { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: var(--surface); }
.mode.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.mode b { display: block; font-size: 15px; }
.mode span { color: var(--text-2); font-size: 13px; }
.mode .count { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.toggle { display: flex; gap: 10px; align-items: center; cursor: pointer; font-size: 14px; color: var(--text-2); }

/* ---------- přihlášení ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 400px; }
.login h1 { margin-bottom: 6px; }
.login form { display: grid; gap: 14px; margin-top: 22px; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- statistiky / dlaždice ---------- */
.stat .k { font-size: 13px; color: var(--text-2); }
.stat .v { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 4px; }
.stat .d { font-size: 13px; color: var(--muted); margin-top: 2px; }
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero .big { font-size: 56px; font-weight: 750; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; position: relative; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--series); }
.bar .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-2); }
.okr-row { display: grid; grid-template-columns: 90px 1fr 120px; gap: 14px; align-items: center; padding: 8px 0; }
.okr-row + .okr-row { border-top: 1px solid var(--line); }
.okr-row .num { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--text-2); }
.stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--surface); }
.stack > i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.s-new { background: var(--new); } .s-bad { background: var(--bad); } .s-learn { background: var(--warn); } .s-good { background: var(--good); }

/* ---------- otázka ---------- */
.qwrap { max-width: 780px; margin: 0 auto; }
.qmeta { display: flex; gap: 8px; align-items: center; color: var(--text-2); font-size: 13px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); }
.pill.good { background: var(--good-soft); color: var(--good-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--text); }
.qtext { font-size: 20px; font-weight: 600; line-height: 1.45; margin: 14px 0 18px; letter-spacing: -.005em; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; padding: 14px 16px; cursor: pointer; font-size: 16px; line-height: 1.45; transition: border-color .1s, background .1s; }
.opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.opt .key { flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: 13px; color: var(--text-2); }
.opt:disabled { cursor: default; }
.opt.correct { border-color: var(--good); background: var(--good-soft); }
.opt.correct .key { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .key { background: var(--bad); color: #fff; }
.opt.picked { border-color: var(--accent); background: var(--accent-soft); }
.opt.picked .key { background: var(--accent); color: var(--accent-ink); }
.opt.dim { opacity: .6; }
.feedback { margin-top: 16px; padding: 12px 14px; border-radius: 10px; font-size: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.feedback.good { background: var(--good-soft); }
.feedback.bad { background: var(--bad-soft); }
.src { color: var(--text-2); font-size: 13px; margin-top: 12px; }
.flag-btn { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.flag-btn.on { border-color: var(--warn); background: var(--warn-soft); color: var(--text); }
.session-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; font-size: 14px; color: var(--text-2); flex-wrap: wrap; }
.kbd { font-size: 12px; color: var(--muted); }
kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }

/* ---------- test ---------- */
.exam-layout { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .exam-layout { grid-template-columns: 1fr; } }
.navgrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.navgrid button { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; font-size: 11px; padding: 4px 0; cursor: pointer; font-variant-numeric: tabular-nums; }
.navgrid button.ans { background: var(--accent-soft); border-color: var(--accent); }
.navgrid button.cur { outline: 2px solid var(--text); outline-offset: 0; }
.navgrid button.ok { background: var(--good-soft); border-color: var(--good); }
.navgrid button.ko { background: var(--bad-soft); border-color: var(--bad); }
.timer { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.timer.low { color: var(--bad); }
.result-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.result-badge { font-size: 20px; font-weight: 700; padding: 8px 16px; border-radius: 10px; }
.result-badge.pass { background: var(--good-soft); color: var(--good-ink); }
.result-badge.fail { background: var(--bad-soft); color: var(--bad); }

/* ---------- seznam otázek ---------- */
.qlist { display: grid; gap: 10px; }
.qitem { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; }
.qitem .qt { font-weight: 600; margin: 6px 0 8px; }
.qitem ol { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 4px; }
.qitem li { font-size: 14px; color: var(--text-2); padding: 4px 8px; border-radius: 6px; }
.qitem li.c { background: var(--good-soft); color: var(--text); font-weight: 600; }
.qitem.hide-ans li.c { background: transparent; font-weight: 400; color: var(--text-2); }
.filters { display: grid; grid-template-columns: 1fr 160px 180px; gap: 10px; margin-bottom: 14px; }
@media (max-width: 700px) { .filters { grid-template-columns: 1fr; } }

/* ---------- grafy ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--text); color: var(--bg); font-size: 13px; padding: 7px 10px; border-radius: 8px; line-height: 1.4; max-width: 320px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.qmap { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
@media (max-width: 700px) { .qmap { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.qmap .blk h3 { font-size: 13px; margin: 0 0 8px; color: var(--text-2); font-weight: 600; display: flex; justify-content: space-between; }
.qmap .cells { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.qmap .cells button { aspect-ratio: 1; border: 0; border-radius: 3px; padding: 0; cursor: pointer; }
.qmap .cells button:hover { outline: 2px solid var(--text); outline-offset: 1px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; color: var(--text-2); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
.empty { color: var(--muted); font-size: 14px; padding: 18px 0; text-align: center; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; max-width: 720px; width: 100%; max-height: 90vh; overflow: auto; padding: 24px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 9px; font-size: 14px; z-index: 60; }
