/* KOP tester – styly. MOBILE FIRST: základ je pro telefon, větší displeje přes @media (min-width). */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #1a1d26;
  --muted: #5b6375;
  --border: #dde2ec;
  --primary: #4263eb;
  --primary-strong: #3451d1;
  --primary-soft: #edf2ff;
  --on-primary: #ffffff;
  --ok: #2b8a3e;
  --ok-soft: #ebfbee;
  --ok-line: #69c37e;
  --bad: #c92a2a;
  --bad-soft: #fff1f1;
  --bad-line: #f08c8c;
  --warn: #c2410c;
  --warn-soft: #fff4e6;
  --info: #1864ab;
  --info-soft: #e7f5ff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .06);
  --radius: 16px;
  --radius-sm: 12px;
  --gutter: 16px;
  --topbar: 52px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11141b;
    --surface: #191d27;
    --surface-2: #232938;
    --text: #e8ebf1;
    --muted: #a3abbb;
    --border: #2d3446;
    --primary: #7b93fd;
    --primary-strong: #9aadff;
    --primary-soft: rgba(123, 147, 253, .14);
    --on-primary: #0d1224;
    --ok: #6fdc83;
    --ok-soft: rgba(111, 220, 131, .12);
    --ok-line: rgba(111, 220, 131, .55);
    --bad: #ff8f8f;
    --bad-soft: rgba(255, 143, 143, .12);
    --bad-line: rgba(255, 143, 143, .55);
    --warn: #ffb066;
    --warn-soft: rgba(255, 176, 102, .12);
    --info: #7cc4fc;
    --info-soft: rgba(124, 196, 252, .12);
    --shadow: none;
  }
}

/* ---------- základ ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar) + 8px); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.55rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
ul, ol { margin: 0 0 .8em; padding-left: 1.25em; }
li { margin: .25em 0; }
li > ul { margin: .2em 0 .3em; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 6px; overflow-wrap: anywhere; }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 0 .35em; background: var(--surface); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- KaTeX ---------- */
.katex { font-size: 1.05em; }
.katex-display { margin: .7em 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.katex-display > .katex { white-space: nowrap; }

/* ---------- horní lišta a obal ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--topbar) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  display: flex; align-items: center;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text); font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.brand img { border-radius: 8px; }
.wrap {
  max-width: 960px; margin: 0 auto;
  padding: 16px max(var(--gutter), env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}
.loading { color: var(--muted); padding: 32px 0; text-align: center; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- tlačítka ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 18px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 650; text-decoration: none; text-align: center;
  cursor: pointer; touch-action: manipulation; user-select: none;
  transition: background-color .15s, border-color .15s, transform .08s;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.btn-bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: .95rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.linkbtn { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; border-radius: 12px; color: var(--muted); border: 1px solid var(--border); background: var(--surface); }
.icon-btn svg { width: 20px; height: 20px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: -6px 0 6px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back svg { width: 18px; height: 18px; }

/* ---------- rozcestník ---------- */
.hero { margin: 4px 0 18px; }
.hero h1 { margin-bottom: .35em; }
.hero p { color: var(--muted); margin: 0; }
.resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; padding: 14px 16px; border-color: var(--primary); color: var(--text); text-decoration: none; }
.resume svg { width: 22px; height: 22px; flex: none; color: var(--primary); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  --accent: var(--primary);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 158px; padding: 14px 14px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none;
  transition: transform .12s, border-color .15s;
}
.tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--accent); }
.tile:active { transform: scale(.98); }
.tile-zdroj { margin-top: 4px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--accent); }
.tile-nazev { font-size: 1.02rem; font-weight: 750; line-height: 1.25; }
.tile-popis { font-size: .82rem; line-height: 1.35; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile-foot { margin-top: auto; padding-top: 6px; display: grid; gap: 6px; }
.tile-count { font-size: .85rem; color: var(--muted); }
.tile-count b { font-size: 1.25rem; color: var(--text); margin-right: 2px; }
.tile-prog { display: block; height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.tile-prog i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.tile-done { font-size: .74rem; color: var(--ok); font-weight: 650; }

.tile--vse { grid-column: 1 / -1; min-height: 132px; background: linear-gradient(135deg, #4263eb, #7048e8); border-color: transparent; color: #fff; }
.tile--vse::before { display: none; }
.tile--vse .tile-zdroj, .tile--vse .tile-popis, .tile--vse .tile-count, .tile--vse .tile-done { color: rgba(255, 255, 255, .85); }
.tile--vse .tile-count b { color: #fff; }
.tile--vse .tile-nazev { font-size: 1.25rem; }
.tile--vse .tile-prog { background: rgba(255, 255, 255, .25); }
.tile--vse .tile-prog i { background: #fff; }
.tile--tema { border-style: dashed; box-shadow: none; background: transparent; }
.tile--navic { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 10px, var(--surface-2) 10px, var(--surface-2) 20px); }

.foot { margin-top: 22px; font-size: .88rem; color: var(--muted); }
.foot p { margin: 0 0 4px; }

/* ---------- stránka kategorie ---------- */
.cat-head { --accent: var(--primary); margin-bottom: 14px; }
.eyebrow { margin: 0 0 4px; font-size: .76rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--accent, var(--primary)); }
.meta { margin: 0; color: var(--muted); font-size: .92rem; }
.actions { display: grid; gap: 10px; margin: 0 0 12px; }
.settings { margin: 0 0 6px; }
.settings > summary { position: relative; display: block; min-height: 48px; padding: 13px 44px 13px 14px; font-weight: 650; line-height: 1.4; cursor: pointer; list-style: none; }
.settings > summary::-webkit-details-marker { display: none; }
.settings > summary::after { content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; margin-top: -7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s, margin-top .15s; }
.settings[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.settings-body { display: grid; gap: 14px; padding: 2px 14px 16px; }
.seg { border: 0; padding: 0; margin: 0; min-width: 0; }
.seg legend { padding: 0; margin-bottom: 6px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.seg-row { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); font-size: .92rem; font-weight: 600; }
.seg input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.seg input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.switch { display: flex; align-items: flex-start; gap: 10px; min-height: 32px; font-size: .95rem; cursor: pointer; }
.switch input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--primary); }
.test-size { margin: 0 0 16px; font-size: .88rem; color: var(--muted); }

.summary { padding: 16px; }
.summary h2 { margin-bottom: .7em; }
.summary h3 { margin-top: 1.2em; color: var(--text); }
.summary h3:first-of-type { margin-top: .4em; }
.summary ul { padding-left: 1.15em; }
.tip, .warn { margin: 0 0 1em; padding: 10px 12px; border-radius: 10px; font-size: .95rem; }
.tip { background: var(--info-soft); border-left: 4px solid var(--info); }
.warn { background: var(--warn-soft); border-left: 4px solid var(--warn); }

/* ---------- tester ---------- */
.test-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.progress { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: inherit; transition: width .25s; }
.progress--lg { height: 12px; margin: 8px 0 12px; }
.progress--lg i { background: var(--ok); }
.counter { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.score { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .95rem; }
.score span { display: inline-flex; align-items: center; gap: 4px; }
.score svg { width: 16px; height: 16px; }
.score-ok { color: var(--ok); }
.score-bad { color: var(--bad); }
.score-cat { margin-left: auto; font-weight: 600; color: var(--muted); font-size: .82rem; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.q { padding: 16px; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.q-id { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .74rem; font-weight: 650; }
.chip--cat { background: var(--surface-2); background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); }
.badge { display: inline-flex; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 750; }
.badge--oprava { background: var(--bad-soft); color: var(--bad); }
.badge--doplneni { background: var(--info-soft); color: var(--info); }
.badge--navic { background: var(--surface-2); color: var(--muted); }
.q-text { font-size: 1.06rem; font-weight: 650; line-height: 1.5; overflow-wrap: break-word; }
.q-hint { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }

.opts { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.opts li { margin: 0; }
.opt {
  width: 100%; min-height: 54px;
  display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 12px; align-items: start;
  padding: 13px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: inherit;
  font: inherit; text-align: left; cursor: pointer; touch-action: manipulation;
  transition: border-color .12s, background-color .12s;
}
.opt-key { display: none; }
.opt-box { grid-column: 1; width: 24px; height: 24px; margin-top: 1px; border: 2px solid var(--muted); border-radius: 7px; display: grid; place-items: center; transition: background-color .12s, border-color .12s; }
.opt-box::after { content: ""; width: 6px; height: 11px; margin-top: -2px; border: solid transparent; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.opt-text { grid-column: 2; overflow-wrap: break-word; min-width: 0; }
.opt-note { grid-column: 2; font-size: .8rem; font-weight: 700; }
.opt-note:empty { display: none; }
.opt[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.opt[aria-pressed="true"] .opt-box { background: var(--primary); border-color: var(--primary); }
.opt[aria-pressed="true"] .opt-box::after { border-color: var(--on-primary); }
.opt:disabled { cursor: default; color: inherit; opacity: 1; }
.opt.is-correct { border-color: var(--ok-line); background: var(--ok-soft); }
.opt.is-correct .opt-box { background: var(--ok); border-color: var(--ok); }
.opt.is-correct .opt-box::after { border-color: #fff; }
.opt.is-correct .opt-note, .opt.is-missed .opt-note { color: var(--ok); }
.opt.is-missed { border-style: dashed; border-color: var(--ok-line); }
.opt.is-missed .opt-box { border-color: var(--ok); }
.opt.is-wrong { border-color: var(--bad-line); background: var(--bad-soft); }
.opt.is-wrong .opt-box { background: var(--bad); border-color: var(--bad); }
.opt.is-wrong .opt-box::after { content: "×"; width: auto; height: auto; margin: -3px 0 0; border: 0; transform: none; color: #fff; font-weight: 800; font-size: 20px; line-height: 1; }
.opt.is-wrong .opt-note { color: var(--bad); }
.opt.is-neutral { opacity: .62; }

.own { display: block; width: 100%; min-height: 112px; margin-top: 14px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; line-height: 1.5; resize: vertical; }
.own:focus { border-color: var(--primary); outline: none; }

.feedback > * { scroll-margin: calc(var(--topbar) + 16px) 0 110px; }
.feedback:empty { display: none; }
.result { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 1.02rem; scroll-margin: 90px 0 120px; }
.result svg { width: 22px; height: 22px; flex: none; }
.result--ok { background: var(--ok-soft); color: var(--ok); }
.result--bad { background: var(--bad-soft); color: var(--bad); }
.block { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); overflow-wrap: break-word; }
.block > h3 { margin: 0 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.block > :last-child { margin-bottom: 0; }
.block ul { padding-left: 1.15em; }
.block.answer { background: var(--primary-soft); border-left: 4px solid var(--primary); }
.block.answer > h3 { color: var(--primary); }
.block.own-answer { background: transparent; border: 1px dashed var(--border); }
.own-text { white-space: pre-wrap; }
.correct-list { margin: 0; }
.self-q { margin: 16px 0 0; font-weight: 700; text-align: center; }

.fix { margin-top: 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
.fix > summary { display: block; min-height: 44px; padding: 11px 12px; font-size: .9rem; font-weight: 700; line-height: 1.4; cursor: pointer; list-style: none; }
.fix > summary::-webkit-details-marker { display: none; }
.fix > summary::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; vertical-align: 1px; border-radius: 50%; background: currentColor; }
.fix > summary::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 10px; vertical-align: 3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.fix[open] > summary::after { transform: rotate(-135deg); vertical-align: -1px; }
.fix-text > :last-child { margin-bottom: 0; }
.fix--oprava > summary { color: var(--bad); }
.fix--doplneni > summary { color: var(--info); }
.fix-body { padding: 0 12px 12px; font-size: .93rem; }
.fix-orig { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.fix-orig h4 { margin: 0 0 4px; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.fix-orig > :last-child { margin-bottom: 0; }

.actionbar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; gap: 10px;
  margin: 14px calc(-1 * var(--gutter)) 0; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 72%, transparent);
}
.actionbar .btn { flex: 1; }
.kbd-hint { display: none; margin: 4px 0 0; text-align: center; font-size: .8rem; color: var(--muted); }

/* ---------- výsledky ---------- */
.results { padding: 20px 16px; text-align: center; margin-bottom: 18px; }
.results .big { margin: 0; font-size: 3rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.results .big span { font-size: 1.4rem; color: var(--muted); font-weight: 700; }
.results-msg { color: var(--muted); font-weight: 600; }
.results .actions { margin: 14px 0 0; }
.section-title { margin: 6px 0 10px; }

/* ---------- seznam otázek ---------- */
.list-tools {
  position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top)); z-index: 5;
  display: flex; gap: 8px; align-items: center;
  margin: 0 calc(-1 * var(--gutter)) 8px; padding: 10px var(--gutter);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.list-tools input { flex: 1; min-width: 0; min-height: 44px; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
.list-tools input:focus { border-color: var(--primary); outline: none; }
.list-tools .btn { flex: none; }
.list-count { margin: 0 0 10px; font-size: .88rem; color: var(--muted); }
.qlist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.qitem { min-width: 0; }
.qitem-body { overflow-x: auto; }
.opts, .lopts { grid-template-columns: minmax(0, 1fr); }
.qitem > summary { display: block; padding: 14px; cursor: pointer; list-style: none; }
.qitem .q-text { display: block; margin: 8px 0 6px; }
.qitem > summary::-webkit-details-marker { display: none; }
.qitem .q-meta { margin: 0; }
.qitem .q-text { font-size: 1rem; }
.qitem-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 650; color: var(--primary); }
.qitem-toggle svg { width: 16px; height: 16px; transition: transform .15s; }
.qitem[open] .qitem-toggle svg { transform: rotate(180deg); }
.qitem .when-open, .qitem[open] .when-closed { display: none; }
.qitem[open] .when-open { display: inline; }
.qitem-body { padding: 0 14px 14px; }
.qitem-body > .block:first-child, .qitem-body > .lopts:first-child { margin-top: 0; }
.lopts { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lopt { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.lopt-mark svg { width: 18px; height: 18px; margin-top: 2px; }
.lopt--ok { background: var(--ok-soft); color: var(--text); font-weight: 600; }
.lopt--ok .lopt-mark { color: var(--ok); }
.lopt--bad { background: var(--bad-soft); color: var(--text); }
.lopt--bad .lopt-mark { color: var(--bad); }
.lopt-you { font-style: normal; font-weight: 600; font-size: .85em; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot--ok { background: var(--ok); }
.dot--bad { background: var(--bad); }
.empty { padding: 20px 16px; text-align: center; }
.empty .btn { margin-top: 6px; }
.qitem[hidden] { display: none; }

/* ---------- větší displeje ---------- */
@media (min-width: 560px) {
  .actions { display: flex; flex-wrap: wrap; }
  .results .actions { justify-content: center; }
  .summary, .q { padding: 20px 22px; }
}

@media (min-width: 640px) {
  :root { --gutter: 24px; }
  h1 { font-size: 1.9rem; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .tile { aspect-ratio: 1 / 1; min-height: 0; padding: 18px 16px 14px; }
  .tile--vse { grid-column: auto; }
  .tile-nazev { font-size: 1.1rem; }
  .tile--vse .tile-nazev { font-size: 1.3rem; }
  .tile-popis { font-size: .86rem; }
  .actionbar { position: static; margin: 16px 0 0; padding: 0; background: none; justify-content: flex-end; }
  .actionbar .btn { flex: 0 1 auto; min-width: 180px; }
}

@media (min-width: 900px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (hover: hover) and (pointer: fine) {
  .tile:hover { border-color: var(--accent); transform: translateY(-2px); }
  .tile--vse:hover { border-color: transparent; }
  .btn:hover { border-color: var(--primary); }
  .btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
  .opt:not(:disabled):hover { border-color: var(--primary); }
  .opt-key { display: block; grid-column: 1; grid-row: 2; justify-self: center; margin-top: 2px; font-size: .7rem; font-weight: 700; color: var(--muted); }
  .kbd-hint { display: block; }
  .qitem > summary:hover .q-text { color: var(--primary); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
