:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #1f2a24;
  --muted: #6b746e;
  --line: #e2ddd1;
  --accent: #1f6f50;
  --accent-ink: #fff;
  --ok: #1f7a4d;
  --ok-bg: #e3f3ea;
  --bad: #a3322a;
  --bad-bg: #fbe6e3;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816;
    --card: #1d2320;
    --ink: #e8ece9;
    --muted: #9aa49e;
    --line: #2f3833;
    --accent: #4fbf8b;
    --accent-ink: #0d1411;
    --ok: #6fd6a0;
    --ok-bg: #1d3a2c;
    --bad: #f19388;
    --bad-bg: #3d221f;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 640px; margin: 0 auto; padding: 16px; }
main.wide { max-width: 1200px; }
a { color: var(--accent); }
h1 { font-size: 1.7rem; line-height: 1.2; margin: .2em 0 .5em; }
h2 { font-size: 1.2rem; margin: 1.4em 0 .6em; }
.card h2:first-child { margin-top: 0; }
code { font-size: .85em; background: var(--line); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card.narrow { max-width: 380px; margin: 10vh auto; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--accent); }
.crumbs { font-size: .9rem; margin-bottom: 8px; }
.crumbs a { text-decoration: none; }

/* tlačítka a formuláře */
.btn, .choice {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: none;
}
.btn.secondary { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn.warn { background: var(--bad); color: #fff; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 2px 4px; }
input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[type="checkbox"] { width: auto; }
label { display: block; font-weight: 600; font-size: .92rem; }
label > input, label > textarea, label > select { margin-top: 4px; font-weight: 400; }
label .small { display: block; font-weight: 400; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack [hidden] { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { display: inline; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }

/* stanoviště – hráč */
.station h1 { font-size: 1.9rem; }
.question { font-size: 1.25rem; margin: 1em 0 .6em; }
.choices { display: flex; flex-direction: column; gap: 10px; padding: 0; margin: 0; list-style: none; }
.choice { text-align: left; padding: 14px 16px; font-size: 1.05rem; background: var(--bg); color: var(--ink); border: 1.5px solid var(--line); }
.choice:active { border-color: var(--accent); }
.choices.done li { padding: 12px 16px; border-radius: 10px; border: 1.5px solid var(--line); }
.choices.done li.correct { border-color: var(--ok); background: var(--ok-bg); }
.choices.done li.chosen:not(.correct) { border-color: var(--bad); background: var(--bad-bg); }
.choices.done li.chosen::after { content: " ← tvoje odpověď"; color: var(--muted); font-size: .85rem; }
.answer-form { display: flex; gap: 8px; margin: 10px 0; }
.answer-form input { flex: 1; }
.result { padding: 12px 16px; border-radius: 10px; font-weight: 600; margin: 12px 0; }
.result.ok { background: var(--ok-bg); color: var(--ok); }
.result.bad { background: var(--bad-bg); color: var(--bad); }
.result.subtle { font-weight: 500; }
.note, .hint { background: var(--bg); border-radius: 10px; padding: 4px 14px; margin-top: 10px; }
.hint summary { font-weight: 600; padding: 8px 0; cursor: pointer; }
.video { position: relative; aspect-ratio: 16 / 9; margin: 12px 0; border-radius: 10px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
audio { width: 100%; margin: 12px 0; }
img.media { max-width: 100%; border-radius: 10px; margin: 12px 0; display: block; }

.progress-card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 20px; text-decoration: none; color: var(--ink);
}
.progress-card > span { color: var(--accent); font-weight: 600; white-space: nowrap; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin: 14px 0; }
.stats-row > div { background: var(--bg); border-radius: 10px; padding: 10px; text-align: center; }
.stats-row.big > div { background: var(--card); border: 1px solid var(--line); padding: 16px; }
.stats-row b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stats-row span { font-size: .8rem; color: var(--muted); }

.station-list, .leaderboard { list-style: none; padding: 0; margin: 0; }
.station-list li { display: grid; grid-template-columns: 2em 1fr auto; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; }
.station-list .num { font-weight: 700; color: var(--muted); }
.station-list li.done .num { color: var(--ok); }
.leaderboard { counter-reset: lb; }
.leaderboard li { counter-increment: lb; display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.leaderboard li::before { content: counter(lb) "."; width: 2em; color: var(--muted); }
.leaderboard li span:first-child { flex: 1; }
.leaderboard li.me { font-weight: 700; color: var(--accent); }

/* sloupcové grafy */
.bars { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; min-width: 180px; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); border-radius: 4px; }
.bars li.mine .bar-label { font-weight: 700; }

/* administrace */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.topbar .brand { font-weight: 800; text-decoration: none; color: var(--ink); }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: block; overflow-x: auto; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
.table td.actions { white-space: nowrap; }
.table td.answers { min-width: 220px; }
.card.danger { border-color: var(--bad-bg); }

.timeline { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.tcol { flex: 1 0 28px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.tbar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.tcol span { font-size: .65rem; color: var(--muted); white-space: nowrap; margin-top: 4px; }

/* předčítání */
.narrate { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
fieldset.group { border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 16px 16px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
fieldset.group legend { font-weight: 700; padding: 0 6px; }
fieldset.group [hidden] { display: none; }

/* editor vzhledu tisku */
.design-grid { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .design-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .preview-wrap { position: sticky; top: 16px; } }
.preview-wrap { overflow: hidden; border-radius: 6px; box-shadow: 0 2px 14px rgba(0, 0, 0, .18); background: #fff; }
.preview-wrap iframe { width: 794px; height: 1123px; border: 0; transform-origin: 0 0; display: block; }
.thumb { display: flex; align-items: center; gap: 12px; }
.thumb img { max-height: 56px; max-width: 160px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }

/* víc úkolů na stanovišti */
.station-head { padding: 4px 4px 12px; }
.station-head h1 { margin-bottom: .2em; }
.station-head p { margin: 0; }
.card.task { scroll-margin-top: 12px; }
.card.task.is-done { border-color: var(--ok); }
h3.question { font-size: 1.2rem; margin: 1em 0 .6em; }
.btn.small { padding: 6px 10px; font-size: .88rem; }
.add-task { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table tr.station-row td { background: var(--bg); }
.table tr.task-row td:nth-child(2) { padding-left: 24px; }

/* vizuální designer tiskového listu */
main.wide:has(.dz) { max-width: 1500px; }
.dz { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 980px) { .dz { grid-template-columns: minmax(0, 1fr) 360px; } }
.dz-main { min-width: 0; }
.dz-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-bottom: 10px; }
.dz-bar label { font-size: .85rem; }
.dz-bar select { width: auto; max-width: 100%; padding: 6px 10px; }
.dz-bar [hidden] { display: none; }
.dz-bar button, .dz-acts button {
  font: inherit; font-size: .9rem; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  background: var(--card); color: var(--accent); border: 1.5px solid var(--accent);
}
.dz-bar button:disabled { opacity: .45; cursor: default; }
.dz-add { display: flex; flex-wrap: wrap; gap: 6px; }
.dz-wrap { position: relative; margin: 0 auto; overflow: hidden; border-radius: 4px; box-shadow: 0 2px 14px rgba(0, 0, 0, .25); background: #fff; user-select: none; -webkit-user-select: none; }
.dz-canvas { position: absolute; left: 0; top: 0; width: 210mm; height: 297mm; transform-origin: 0 0; touch-action: none; }
.dz-canvas .sheet { margin: 0; }
.dz-canvas .el { cursor: move; }
.dz-canvas .el:hover { box-shadow: 0 0 0 .3mm rgba(40, 120, 255, .6); }
.dz-canvas img { -webkit-user-drag: none; pointer-events: none; }
.dz-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 2000; }
.dz-sel { position: absolute; outline: calc(var(--hs, 12px) / 6) solid #2878ff; pointer-events: auto; cursor: move; }
.dz-sel.dz-ghost { outline-style: dashed; background: rgba(40, 120, 255, .06); }
.dz-h {
  position: absolute; width: var(--hs, 12px); height: var(--hs, 12px);
  margin: calc(var(--hs, 12px) / -2) 0 0 calc(var(--hs, 12px) / -2);
  background: #fff; border: calc(var(--hs, 12px) / 6) solid #2878ff; border-radius: 2px; touch-action: none;
}
.dz-h-nw { left: 0; top: 0; cursor: nwse-resize; }
.dz-h-n { left: 50%; top: 0; cursor: ns-resize; }
.dz-h-ne { left: 100%; top: 0; cursor: nesw-resize; }
.dz-h-e { left: 100%; top: 50%; cursor: ew-resize; }
.dz-h-se { left: 100%; top: 100%; cursor: nwse-resize; }
.dz-h-s { left: 50%; top: 100%; cursor: ns-resize; }
.dz-h-sw { left: 0; top: 100%; cursor: nesw-resize; }
.dz-h-w { left: 0; top: 50%; cursor: ew-resize; }
@media (pointer: coarse) { .dz-h { transform: scale(1.6); } }
.dz-dim {
  position: absolute; left: 0; top: 100%; margin-top: calc(var(--hs, 12px) * .8); white-space: nowrap;
  font: calc(var(--hs, 12px) * .9) system-ui, sans-serif; color: #fff; background: #2878ff; padding: 0 .4em; border-radius: 3px;
}
.dz-guide { position: absolute; background: #e2338f; }
.dz-guide-v { left: 105mm; top: 0; bottom: 0; width: .3mm; }
.dz-guide-h { top: 148.5mm; left: 0; right: 0; height: .3mm; }
.dz-warn { background: #fff3cd; color: #5c4400; border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; font-size: .9rem; }
.dz-warn[hidden] { display: none; }
.dz-side .card { padding: 14px 16px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 980px) { .dz-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; } }
.dz-side h2 { margin: 0; font-size: 1.05rem; }
.dz-side p { margin: 0; }
.dz-side input, .dz-side select, .dz-side textarea { padding: 6px 8px; }
.dz-grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dz-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.dz-color { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; }
.dz-color span { flex: 1; }
.dz-color input[type="color"] { width: 48px; height: 34px; padding: 2px; }
.dz-color select { width: auto; }
.dz-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.dz-acts .dz-del { color: var(--bad); border-color: var(--bad); }
.dz-layers { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.dz-layers li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.dz-layers li:hover { background: var(--bg); }
.dz-layers li.sel { background: var(--bg); box-shadow: inset 3px 0 0 #2878ff; font-weight: 600; }
.dz-layers li.off span:first-of-type { opacity: .5; text-decoration: line-through; }
.dz-layers li span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-badge { font-size: .7rem; padding: 1px 6px; border-radius: 6px; background: #2878ff; color: #fff; white-space: nowrap; }
.dz-badge.alt { background: #b06b00; }
#dz-status.dz-dirty { color: #b06b00; font-weight: 600; }

/* ikona aplikace */
.topbar .brand { display: inline-flex; align-items: center; gap: 8px; }
.topbar .brand img { border-radius: 6px; }
.hero-icon { display: block; margin: 0 0 8px; border-radius: 18px; }

/* obrázky místo slov */
.rebus { display: inline-block; vertical-align: middle; height: 1.7em; width: auto; margin: 0 .08em; }
.rebus.emoji { height: auto; font-size: 1.55em; line-height: 1; font-style: normal; }
.rebus.big { height: 3.2em; }
.rebus.big.emoji { height: auto; font-size: 3em; }
.choice .rebus.big { display: block; margin: 0 auto; }
.choices .choice:has(.rebus.big:only-child) { text-align: center; }
.rebus-panel { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.rebus-panel summary { font-weight: 700; cursor: pointer; }
.rebus-panel > * + * { margin-top: 10px; }
.rebus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.rebus-pick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; font-size: .75rem; cursor: pointer; }
.rebus-pick:hover, .rebus-pick:focus-visible { border-color: var(--accent); }
.rebus-pick .emoji { font-size: 1.8rem; line-height: 1.1; }
.rebus-pick img { height: 2rem; width: auto; max-width: 100%; }
.rebus-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rebus-upload input { width: auto; flex: 1 1 160px; }
