:root {
  --bg: #14121a;
  --panel: #1e1b27;
  --panel-2: #282433;
  --line: #3a3447;
  --text: #ece8f2;
  --muted: #9a93a8;
  --accent: #f2b84b;
  --accent-ink: #1a1408;
  --yes: #6fcf7a;
  --no: #ef6f6c;
  --talk: #6fa8ef;
  --radius: 6px;
  --pixel: "Pixelify Sans", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--no); min-height: 1em; margin: 6px 0; }
[hidden] { display: none !important; }

/* Tlačítka */
button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 14px;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.yes { border-color: var(--yes); color: var(--yes); }
.btn.no { border-color: var(--no); color: var(--no); }
.btn.talk { border-color: var(--talk); color: var(--talk); }
.icon-btn {
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  font-size: 20px; width: 36px; height: 36px; line-height: 1;
}
.icon-btn:hover { border-color: var(--line); }

/* Přihlášení */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 28px; }
.login h1 { font-family: var(--pixel); color: var(--accent); margin: 0 0 8px; font-size: 32px; }
.login form { display: flex; gap: 8px; }
.login input { flex: 1; min-width: 0; }

input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Hlavička */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; background: rgba(20, 18, 26, .92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--pixel); font-weight: 700; font-size: 22px; color: var(--accent); }
.tabs { display: flex; gap: 4px; }
.tabs button {
  background: none; border: none; padding: 6px 12px; border-radius: var(--radius); color: var(--muted);
  font-family: var(--pixel); font-size: 16px;
}
.tabs button.on { background: var(--panel-2); color: var(--text); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; cursor: pointer; background: var(--panel-2); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 20px 0; }
.filters select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  background: none; border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; color: var(--muted); font-size: 13px;
}
.chips button.on { background: var(--panel-2); color: var(--text); border-color: var(--muted); }

/* Mřížka */
.grid {
  display: grid; gap: 16px; padding: 16px 20px 40px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.empty { text-align: center; color: var(--muted); padding: 60px 16px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column; cursor: pointer; text-align: left; padding: 0;
  transition: transform .1s, border-color .1s;
}
.card:hover { border-color: var(--muted); transform: translateY(-2px); }
.card .thumb { aspect-ratio: 1; display: grid; place-items: center; }
.card .thumb img { max-width: 88%; max-height: 88%; image-rendering: pixelated; }
.card .thumb { overflow: hidden; }
.card .text-thumb {
  padding: 14px 14px 0; color: var(--muted); font-size: 14px;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 16px; line-height: 1.3; }
.card .meta { margin-top: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.card .meta .grow { flex: 1; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px; background: var(--panel-2); color: var(--muted);
}
.badge.novy { color: var(--accent); }
.badge.diskuse { color: var(--talk); }
.badge.schvaleno { color: var(--yes); }
.badge.zamitnuto { color: var(--no); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }

.voters { display: flex; }
.voters img { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--panel); margin-left: -6px; }
.voters img:first-child { margin-left: 0; }
.voters img.up { outline: 2px solid var(--yes); outline-offset: -2px; }
.voters img.down { outline: 2px solid var(--no); outline-offset: -2px; }

/* Pozadí pro pixel art */
.bg-check {
  background-color: #cfcfd6;
  background-image: conic-gradient(#b8b8c2 25%, transparent 0 50%, #b8b8c2 0 75%, transparent 0);
  background-size: 16px 16px;
}
.bg-dark { background: #0d0c11; }
.bg-light { background: #f4f1ea; }
.bg-grass { background: #5a8a3c; }

/* Dialogy */
.dlg {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text);
  padding: 0; max-width: min(1100px, calc(100vw - 32px)); width: 100%;
}
.dlg::backdrop { background: rgba(0, 0, 0, .65); }
.compose { max-width: 560px; }
.compose form { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.compose h2 { font-family: var(--pixel); margin: 0; color: var(--accent); }
.compose label, .edit label, .edit-pics { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.edit { display: flex; flex-direction: column; gap: 12px; }
.edit-pics .previews { justify-content: flex-start; padding-top: 6px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

.drop { border: 2px dashed var(--line); border-radius: 8px; padding: 12px; text-align: center; font-size: 14px; }
.drop.over { border-color: var(--accent); background: var(--panel-2); }
.detail-grid.drop-verze { outline: 3px dashed var(--accent); outline-offset: -3px; }
.detail-grid.drop-verze::after {
  content: 'Pusť obrázky = nové verze'; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(20, 18, 26, .75); color: var(--accent); font-size: 20px; font-weight: bold; pointer-events: none; z-index: 5;
}
.drop p { margin: 4px 0; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.previews figure { margin: 0; position: relative; }
.previews img { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; border-radius: 4px; }
.previews button {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: var(--no); color: #fff; font-size: 12px; line-height: 1;
}

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); max-height: min(88vh, 900px); }
.detail-grid.no-image { grid-template-columns: 1fr; max-width: 680px; }
/* S obrázkem má detail pevnou výšku: posouvá se jen panel vpravo, ne celé okno. */
.detail-grid:not(.no-image) { height: min(88vh, 900px); grid-template-rows: minmax(0, 1fr); }
.viewer { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.stage { flex: 1; min-height: 320px; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 24px; cursor: grab; touch-action: none; user-select: none; position: relative; }
.stage.grabbing { cursor: grabbing; }
/* Mimo tok stránky, aby přiblížený obrázek nenafoukl celý detail. */
.stage .pan { position: absolute; left: 50%; top: 50%; display: flex; align-items: center; gap: 24px; }
.stage img { image-rendering: pixelated; flex: none; max-width: none; -webkit-user-drag: none; }
.stage figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stage figcaption { font-size: 12px; color: #000a; background: #fff9; padding: 1px 6px; border-radius: 3px; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.toolbar .seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.toolbar .seg button { background: none; border: none; padding: 4px 9px; color: var(--muted); }
.toolbar .seg button.on { background: var(--panel-2); color: var(--text); }
.toolbar select { width: auto; padding: 4px 6px; font-size: 13px; }
.swatch { width: 22px; height: 22px; border-radius: 4px; border: 2px solid var(--line); padding: 0; }
.swatch.on { border-color: var(--accent); }

.side { padding: 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.side h2 { margin: 0; font-size: 22px; line-height: 1.25; }
.side .desc { white-space: pre-wrap; margin: 0; }
.detail-grid > .close { position: absolute; top: 10px; right: 10px; z-index: 2; }
.vote-row { display: flex; gap: 8px; }
.vote-row .btn { flex: 1; font-size: 16px; }
.vote-row .btn.mine.yes { background: var(--yes); color: #0b1a0d; }
.vote-row .btn.mine.no { background: var(--no); color: #1f0909; }
.team-votes { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.team-votes div { display: flex; align-items: center; gap: 8px; }
.team-votes img { width: 22px; height: 22px; border-radius: 50%; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 0; }
.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.comment .who { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.comment .who img { width: 18px; height: 18px; border-radius: 50%; }
.comment p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: 6px; }
.gh-link { font-size: 13px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px;
  max-width: calc(100vw - 32px);
}
.toast.bad { border-color: var(--no); }

/* Stavba: tři sloupce */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px 20px 40px; align-items: start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.col h2 { font-family: var(--pixel); font-size: 18px; margin: 0 0 2px; }
.task {
  text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
}
.task:hover { border-color: var(--muted); }
.task h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.task.dela { border-left: 3px solid var(--accent); }
.task.hotovo { opacity: .6; }
.task.hotovo h3 { text-decoration: line-through; }
.task-top { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.task .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.task .meta .grow { flex: 1; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--yes); }
.who-chip { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.who-chip img { width: 18px; height: 18px; border-radius: 50%; }

/* Rozhodnutí: možnosti s pruhem hlasů */
.opts, .opts-mini { display: flex; flex-direction: column; gap: 6px; }
.opts-mini { padding: 14px 14px 0; }
.opt, .opt-mini {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); text-align: left;
}
.opt { padding: 9px 12px; font-size: 15px; }
.opt:not(:disabled):hover { border-color: var(--muted); }
.opt:disabled { cursor: default; }
.opt-mini { padding: 4px 8px; font-size: 13px; }
.opt .bar, .opt-mini .bar { position: absolute; top: 0; bottom: 0; left: 0; background: rgba(242, 184, 75, .18); }
.opt > :not(.bar), .opt-mini > :not(.bar) { position: relative; }
.opt .lbl, .opt-mini .lbl { flex: 1; overflow-wrap: anywhere; }
.opt .n, .opt-mini .n { font-weight: 600; }
.opt.mine { border-color: var(--accent); }
.opt.mine .lbl::after { content: ' · můj hlas'; color: var(--accent); font-size: 12px; }
.opt.win, .opt-mini.win { border-color: var(--yes); }
.opt.win .bar, .opt-mini.win .bar { background: rgba(111, 207, 122, .22); }

.type-seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.type-seg button { flex: 1; background: none; border: none; padding: 7px 4px; color: var(--muted); font-size: 14px; }
.type-seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

@media (max-width: 760px) {
  .board { grid-template-columns: 1fr; padding-left: 16px; padding-right: 16px; }
  .tabs { overflow-x: auto; max-width: 100%; }
  .top { padding: 10px 16px; gap: 10px; }
  .top-actions { margin-left: 0; width: 100%; }
  .top-actions .btn { flex: 1; }
  .filters, .grid { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .dlg { max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .detail-grid, .detail-grid:not(.no-image) { grid-template-columns: 1fr; max-height: none; height: 100%; overflow: auto; grid-template-rows: none; }
  .viewer { border-right: none; border-bottom: 1px solid var(--line); }
  .stage { min-height: 260px; }
  .side { overflow: visible; }
}
.detail:has(.no-image) { max-width: min(680px, calc(100vw - 32px)); }

/* Návod na obrázky (📄 v hlavičce) */
.dlg.navod { width: min(900px, 96vw); max-height: 92vh; padding: 0; display: flex; flex-direction: column; }
.dlg.navod:not([open]) { display: none; }
.navod-hlava { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.navod-hlava h2 { margin: 0; font-size: 18px; }
.navod-hlava .row { display: flex; gap: 8px; align-items: center; }
.navod-text { overflow-y: auto; padding: 8px 20px 24px; line-height: 1.5; font-size: 14px; }
.navod-text h2, .navod-text h3, .navod-text h4, .navod-text h5 { margin: 18px 0 6px; }
.navod-text p { margin: 4px 0; }
.navod-text p.li { padding-left: 14px; }
.navod-text blockquote { margin: 6px 0; padding: 4px 10px; border-left: 3px solid var(--accent); color: var(--muted); }
.navod-text code { background: var(--panel-2); padding: 0 4px; border-radius: 3px; }
.navod-text .odkaz { text-decoration: underline dotted; }
.navod-text table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.navod-text th, .navod-text td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; }
.navod-text .prompt { position: relative; margin: 8px 0; }
.navod-text .prompt pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow-x: auto; white-space: pre-wrap; font-size: 12px; }
.navod-text .prompt .small-btn { position: absolute; top: 6px; right: 6px; padding: 2px 8px; font-size: 12px; }

/* Editor map (editor.js, záložka „Editor map") */
.editor { display: flex; flex-direction: column; height: calc(100dvh - 56px); min-height: 420px; }
.ed-lista { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.ed-nastroje { display: flex; gap: 6px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.ed-nastroje .icon-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ed-oddel { width: 1px; height: 22px; background: var(--line); }
.ed-sila { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.ed-sila input { width: 80px; }
.ed-telo { display: flex; flex: 1; min-height: 0; }
.ed-bok { width: 268px; flex: none; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.ed-hlavni-zalozky { display: flex; border-bottom: 1px solid var(--line); }
.ed-hlavni-zalozky button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 0; font: inherit; cursor: pointer; }
.ed-hlavni-zalozky button.on { color: var(--text); border-bottom-color: var(--accent); }
.ed-obsah { flex: 1; overflow-y: auto; padding: 8px; min-height: 0; }
.ed-zalozky { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.ed-zalozky button { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.ed-zalozky button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ed-sada { margin: 8px 0 2px; }
.ed-rada { display: flex; flex-wrap: wrap; gap: 4px; }
.ed-dlazdice { padding: 0; line-height: 0; background: none; border: 2px solid transparent; border-radius: 4px; cursor: pointer; }
.ed-dlazdice.on { border-color: var(--accent); }
.ed-nahled { image-rendering: pixelated; display: block; width: 32px; height: 32px; }
.ed-vybrana { padding: 8px 2px 0; }
.ed-otoceni { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.ed-otoceni .ed-nahled { width: 48px; height: 48px; }
.ed-otoceni-tlacitka { display: flex; gap: 4px; }
.ed-otoceni .icon-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ed-nahled-obj { width: 48px; height: 48px; }
.ed-vybrany { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ed-nabidka { position: fixed; z-index: 80; min-width: 180px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5); display: flex; flex-direction: column; }
.ed-nabidka-hlava { padding: 4px 8px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ed-nabidka button { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--text); font: inherit; font-size: 13px; text-align: left; padding: 5px 8px; border-radius: 5px; cursor: pointer; }
.ed-nabidka button:hover { background: var(--panel-2); }
.ed-nabidka-znak { width: 16px; text-align: center; }
.ed-vybrany-hlava { display: flex; align-items: center; gap: 8px; }
.ed-vybrany-hlava .ed-nahled { width: 40px; height: 40px; flex: none; }
.ed-vybrany .ed-otoceni-tlacitka { flex-wrap: wrap; align-items: center; }
.ed-procenta { min-width: 42px; text-align: center; }
.ed-poloha { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.ed-cislo { display: flex; gap: 4px; align-items: center; }
.ed-cislo input { width: 64px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 2px 4px; font: inherit; font-size: 12px; }
.ed-duch { position: fixed; z-index: 70; pointer-events: none; opacity: .85; transform: translate(-50%, -100%); image-rendering: pixelated; }
.ed-prazdno p { margin: 6px 0; }
.ed-platno-obal { flex: 1; min-width: 0; position: relative; overflow: hidden; }
.ed-platno { display: block; image-rendering: pixelated; touch-action: none; cursor: crosshair; }
.ed-stav { padding: 6px 20px; border-top: 1px solid var(--line); background: var(--panel); }
/* Patra */
.ed-patra { display: flex; gap: 4px; align-items: center; }
.ed-patra select { padding: 5px 6px; max-width: 140px; }
.ed-patra .icon-btn { font-size: 15px; width: 28px; height: 32px; }
.ed-patra .icon-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ed-patra .icon-btn:disabled { opacity: .35; cursor: default; }
/* Malé okno editoru (místo prompt/confirm) */
.ed-okno-pozadi { position: fixed; inset: 0; z-index: 90; background: rgba(10,8,14,.55); display: grid; place-items: center; padding: 16px; }
.ed-okno { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 10px; }
.ed-okno h3 { margin: 0; font-size: 17px; }
.ed-okno p { margin: 0; }
.ed-okno-pole { display: flex; flex-direction: column; gap: 10px; }
.ed-okno-pole label, label.ed-okno-pole { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.ed-okno-pole input, .ed-okno-pole select { color: var(--text); }
.ed-okno-tlacitka { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
/* Paleta objektů: hledání, čipy, naposledy použité, velké náhledy */
.ed-hledat { width: 100%; box-sizing: border-box; margin-bottom: 8px; padding: 6px 10px; }
.ed-cipy button { display: inline-flex; align-items: center; gap: 5px; }
.ed-pocet { font-size: 10px; opacity: .75; background: rgba(255,255,255,.08); border-radius: 999px; padding: 0 5px; }
.ed-cipy button.on .ed-pocet { background: rgba(0,0,0,.15); }
.ed-nedavne { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.ed-nedavne .ed-sada { margin-top: 0; }
.ed-nedavne .ed-nahled-obj { width: 40px; height: 40px; }
.ed-velikosti { display: flex; gap: 4px; align-items: center; justify-content: flex-end; margin: -2px 0 6px; }
.ed-velikosti button { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 4px; padding: 0 6px; font-size: 11px; line-height: 18px; }
.ed-velikosti button.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.ed-paleta-obj { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--vel, 72px) + 8px), 1fr)); gap: 4px; }
.ed-paleta-obj .ed-obj { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 3px; background: var(--panel-2); line-height: 1.2; min-width: 0; }
.ed-paleta-obj .ed-obj:hover { border-color: var(--line); }
.ed-paleta-obj .ed-obj.on { border-color: var(--accent); }
.ed-paleta-obj .ed-nahled-obj { width: var(--vel, 72px); height: var(--vel, 72px); }
.ed-paleta-obj > p { grid-column: 1 / -1; margin: 4px 0; }
.ed-obj-jmeno { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) {
  .ed-telo { flex-direction: column; }
  .ed-bok { width: auto; max-height: 40%; border-right: 0; border-bottom: 1px solid var(--line); }
  .ed-lista, .ed-stav { padding-left: 16px; padding-right: 16px; }
}

/* Boj a nepřátelé (boj.js, ladění balancu) */
.boj { padding: 0 0 48px; }
.boj-lista {
  display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.boj-skupiny { display: flex; gap: 4px; flex-wrap: wrap; }
.boj-skupiny button {
  background: none; border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; color: var(--muted);
  font-family: var(--pixel); font-size: 15px; display: inline-flex; gap: 6px; align-items: center;
}
.boj-skupiny button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.boj-tecka { background: var(--talk); color: #0b1420; border-radius: 99px; font: 600 11px/1 system-ui, sans-serif; padding: 3px 6px; }
.boj-hledat { display: flex; gap: 10px; align-items: center; flex: 1 1 260px; min-width: 0; }
.boj-hledat input[type=search] { flex: 1; min-width: 0; padding: 6px 10px; }
.boj-jen { display: flex; gap: 6px; align-items: center; color: var(--muted); white-space: nowrap; }
.boj-jen input { width: auto; }
.boj-akce { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.boj-pocet.ma { color: var(--accent); font-weight: 600; }
.boj-stav { margin: 10px 20px 0; }

.boj-kalk { margin: 12px 20px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.boj-kalk summary { cursor: pointer; padding: 10px 14px; font-family: var(--pixel); color: var(--accent); }
.boj-kalk summary b { font-weight: 700; }
.boj-kalk summary .muted { font-family: system-ui, sans-serif; }
.boj-kalk-pole { display: flex; flex-wrap: wrap; gap: 10px 14px; padding: 0 14px 6px; }
.boj-pole { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.boj-pole select, .boj-pole input { width: auto; min-width: 90px; padding: 5px 8px; font-size: 14px; }
.boj-pole input[type=number] { width: 90px; }
.boj-noc { flex-direction: row; align-items: center; gap: 6px; align-self: flex-end; padding-bottom: 7px; font-size: 14px; color: var(--text); }
.boj-noc input { width: auto; min-width: 0; }
.boj-pozn { margin: 0; padding: 0 14px 12px; }

.boj-obsah {
  display: grid; gap: 16px; padding: 16px 20px; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr));
}
.boj-karta { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
.boj-karta-siroka { grid-column: 1 / -1; }
.boj-karta > header { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 6px; }
.boj-karta h3 { font-family: var(--pixel); font-size: 22px; margin: 0 0 6px; color: var(--accent); line-height: 1.1; }
.boj-karta h4 { font-family: var(--pixel); font-size: 15px; font-weight: 500; color: var(--muted); margin: 14px 0 4px; letter-spacing: .02em; }
.boj-obr-box { flex: none; background: #0d0c11; border: 1px solid var(--line); border-radius: 8px; padding: 4px; display: grid; place-items: center; min-width: 72px; min-height: 72px; }
.boj-obr { image-rendering: pixelated; display: block; }
.boj-obr.chybi { opacity: .2; }
.boj-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.boj-chip { font-size: 12px; background: var(--panel-2); color: var(--muted); border-radius: 4px; padding: 1px 7px; }
.boj-chip.boss { color: var(--no); font-weight: 600; }
.boj-nezname { border-color: var(--no); grid-column: 1 / -1; }

.boj-sekce { border-top: 1px solid var(--line); margin-top: 8px; }
.boj-sekce > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.boj-sekce > summary::-webkit-details-marker { display: none; }
.boj-sekce > summary::before { content: '▸'; color: var(--muted); font-size: 12px; margin-top: 8px; }
.boj-sekce[open] > summary::before { content: '▾'; }
.boj-sekce > summary h4 { flex: 1; }
.boj-sekce h4 .small { font-family: system-ui, sans-serif; font-weight: 400; }
.boj-radek {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 128px; grid-template-areas: "popis vstup meta" "varov varov varov";
  gap: 2px 10px; padding: 6px 6px; margin: 0 -6px; border-radius: 6px; align-items: center;
}
.boj-radek:hover { background: rgba(255, 255, 255, .02); }
.boj-radek.zmena { background: rgba(242, 184, 75, .07); box-shadow: inset 3px 0 0 var(--accent); }
.boj-radek.spatne { background: rgba(239, 111, 108, .1); box-shadow: inset 3px 0 0 var(--no); }
.boj-radek.odebrano .boj-popis { text-decoration: line-through; color: var(--muted); }
.boj-popis { grid-area: popis; font-size: 14px; line-height: 1.3; min-width: 0; }
.boj-pozor { color: var(--accent); cursor: help; }
.boj-vstup { grid-area: vstup; display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.boj-vstup input[type=number] { width: 96px; padding: 4px 6px; text-align: right; font-variant-numeric: tabular-nums; }
.boj-vstup input[type=text] { width: min(320px, 50vw); padding: 4px 6px; font-size: 13px; }
.boj-vstup input[type=range] { width: 110px; padding: 0; border: 0; background: none; accent-color: var(--accent); }
.boj-jedn { color: var(--muted); font-size: 12px; min-width: 30px; }
.boj-meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; justify-content: flex-end; font-size: 12px; line-height: 1.3; }
.boj-vych { color: var(--muted); }
.boj-delta { font-weight: 600; color: var(--talk); font-variant-numeric: tabular-nums; }
.boj-delta.plus { color: var(--accent); }
.boj-reset { background: none; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 12px; padding: 0 6px; line-height: 18px; }
.boj-reset:hover { color: var(--text); border-color: var(--muted); }
.boj-varov { grid-area: varov; display: flex; flex-direction: column; font-size: 12px; color: var(--no); text-align: right; }
.boj-radek.zmena:not(.spatne) .boj-varov { color: var(--accent); }
.boj-soucet { text-align: right; padding: 4px 0; }
.boj-soucet .err { margin: 0; }

.boj-skupinky { padding: 4px 0 8px; display: flex; flex-direction: column; gap: 6px; }
.boj-varianty { display: flex; flex-direction: column; gap: 4px; }
.boj-varianta { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.boj-varianta input { padding: 4px 6px; font-size: 13px; }
.boj-ikony { display: flex; gap: 2px; align-items: center; min-height: 32px; }
.boj-ikony canvas { background: #0d0c11; border-radius: 3px; }
.boj-skupinky select { width: auto; padding: 4px 8px; font-size: 13px; }
.boj-typ { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.boj-typ canvas { background: #0d0c11; border-radius: 3px; flex: none; }

.boj-tab-obal { overflow-x: auto; max-width: 100%; }
.boj-tab { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.boj-tab th, .boj-tab td { padding: 4px 6px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.boj-tab thead th { font-weight: 500; color: var(--muted); font-size: 12px; white-space: nowrap; }
.boj-tab .num { text-align: right; white-space: nowrap; }
.boj-tab tr.nova td { border-top: 2px solid var(--line); }
.boj-tab tbody th { font-weight: 400; color: var(--muted); white-space: pre; }
.boj-tab td.vybrany { background: rgba(111, 168, 239, .08); }
.boj-bunka { display: inline-flex; gap: 2px; align-items: center; }
.boj-bunka input { width: 72px; padding: 3px 5px; font-size: 13px; text-align: right; }
.boj-bunka.zmena input { border-color: var(--accent); background: rgba(242, 184, 75, .08); }
.boj-bunka.spatne input { border-color: var(--no); }
.boj-odvozene { margin-top: 12px; border-top: 1px dashed var(--line); }
.boj-odv h4 { color: var(--talk); }
.boj-odv > p { margin: 6px 0 0; }
.boj-odv-misto select { width: auto; padding: 4px 8px; font-size: 13px; margin-bottom: 6px; max-width: 100%; }
.boj-tab-odv tbody th { white-space: normal; }
.boj-tab-n tbody th { white-space: pre; }
.boj-tab b.lepsi { color: var(--yes); }
.boj-tab b.horsi { color: var(--no); }
.boj-tab b.jine { color: var(--accent); }
.boj-urzony { margin: 8px 0 0; }

.boj-dlg { max-width: min(860px, calc(100vw - 32px)); }
.boj-dlg-telo { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.boj-dlg h2 { font-family: var(--pixel); color: var(--accent); margin: 0; }
.boj-rozdil tr.zpet td { color: var(--muted); }
.boj-proc { display: flex; flex-direction: column; gap: 4px; }
.boj-spor { background: var(--panel-2); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.boj-spor p { margin: 0; }
.boj-spor label { display: flex; gap: 6px; align-items: center; }
.boj-spor input { width: auto; }

@media (max-width: 760px) {
  .boj-lista { padding: 10px 16px; }
  .boj-akce { margin-left: 0; width: 100%; }
  .boj-akce .btn { flex: 1; padding: 7px 8px; }
  .boj-stav, .boj-kalk { margin-left: 16px; margin-right: 16px; }
  .boj-obsah { padding: 12px 16px; gap: 12px; }
  .boj-karta { padding: 12px; }
  .boj-radek { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "popis popis" "vstup meta" "varov varov"; }
  .boj-vstup { justify-content: flex-start; }
  .boj-vstup input[type=range] { flex: 1; min-width: 0; }
  .boj-vstup input[type=text] { width: 100%; }
}
.boj-rozdil td { overflow-wrap: anywhere; }
.boj-rozdil td.num { white-space: normal; min-width: 70px; }

/* Šatník */
.satnik { padding: 12px 16px 48px; max-width: 1400px; margin: 0 auto; }
.satnik-postavy, .satnik-pohyby, .satnik-volby { display: flex; gap: 4px; flex-wrap: wrap; }
.satnik-postavy { margin-bottom: 12px; }
.satnik-postavy button, .satnik-pohyby button, .satnik-volby button {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 5px 10px; font-size: 13px;
}
.satnik-postavy button { font-family: var(--pixel); font-size: 15px; padding: 6px 14px; }
.satnik-postavy button.on, .satnik-pohyby button.on, .satnik-volby button.on {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.satnik-telo { display: grid; grid-template-columns: minmax(0, auto) minmax(280px, 1fr); gap: 16px; align-items: start; }
.satnik-nahled { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.satnik-lista, .satnik-akce { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.satnik-lista .satnik-pohyby { flex: 1; }
.satnik-akce { margin-top: 10px; }
.satnik-scena { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; padding: 8px; border-radius: var(--radius); }
.satnik-scena figure { margin: 0; text-align: center; }
.satnik-scena.tmave, .satnik-sady { background: #24202e; }
.satnik-scena.trava { background: #4a6b34; }
.satnik-scena.sachovnice { background: repeating-conic-gradient(#3a3447 0 25%, #2a2533 0 50%) 0 0 / 16px 16px; }
.satnik-platno { image-rendering: pixelated; display: block; }
.satnik-vyber { display: flex; flex-direction: column; gap: 10px; }
.satnik-slot { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.satnik-slot-hlava { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.satnik-nadpis { font-family: var(--pixel); margin: 20px 0 8px; }
.satnik-sady { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px; border-radius: var(--radius); }
.satnik-sada {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px; display: flex; flex-direction: column; align-items: center; font-size: 12px;
}
.satnik-sada:hover { border-color: var(--accent); }
@media (max-width: 900px) {
  .satnik { padding: 12px 16px 48px; }
  .satnik-telo { grid-template-columns: minmax(0, 1fr); }
  .satnik-scena .satnik-platno { width: 128px !important; height: 128px !important; }
}

/* Verze hry: 2D (naše hra) × 3D (Temný svět) */
.verze { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.verze button {
  background: none; border: none; padding: 6px 12px; color: var(--muted);
  font-family: var(--pixel); font-size: 15px;
}
.verze button + button { border-left: 1px solid var(--line); }
.verze button.on { background: var(--accent); color: var(--accent-ink); }
body.verze-3d .verze button.on { background: #7a3cff; color: #fff; }
body.verze-3d .brand { color: #b394ff; }

/* Přehled 3D verze */
.prehled3d { padding: 20px; display: flex; flex-direction: column; gap: 28px; max-width: 1200px; margin: 0 auto; }
.p3-hlava { display: flex; flex-direction: column; gap: 10px; }
.p3-hlava h1 { margin: 0; font-family: var(--pixel); color: #b394ff; }
.p3-hlava p { margin: 0; max-width: 75ch; }
.p3-hlava pre { background: var(--panel-2); padding: 10px 12px; border-radius: var(--radius); overflow-x: auto; }
.p3-cisla { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.p3-cislo { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.p3-cislo b { font-family: var(--pixel); font-size: 26px; color: var(--accent); }
.p3-sekce { display: flex; flex-direction: column; gap: 10px; }
.p3-sekce h2 { margin: 0; font-family: var(--pixel); }
.p3-sekce > p { margin: 0; }
.p3-modely { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.p3-modely h3 { margin: 0 0 4px; font-size: 15px; }
.p3-modely ul { margin: 0; padding-left: 18px; }
.p3-mrizka { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.p3-mrizka figure { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.p3-mrizka img { width: 100%; aspect-ratio: 1280 / 760; object-fit: cover; image-rendering: pixelated; border-radius: var(--radius); background: var(--panel-2); }
.p3-tabulka { overflow-x: auto; }
.p3-tabulka table { border-collapse: collapse; min-width: 480px; font-variant-numeric: tabular-nums; }
.p3-tabulka th, .p3-tabulka td { text-align: left; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.p3-galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.p3-model { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.p3-model.boss { border-color: #7a3cff; }
.p3-model.postava { border-color: var(--accent); }
.p3-dvojice { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.p3-dvojice img { width: 100%; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; background: #2e231a; border-radius: 4px; }
.p3-model figcaption { font-size: 14px; }
