/* Tři barevné režimy. Vše ostatní používá jen tyto proměnné. */
:root, [data-theme="pastel"] {
  color-scheme: light;
  --bg: #f7f3ee;
  --panel: #ffffff;
  --panel-soft: #f1ecf7;
  --text: #2c2a35;
  --muted: #615d6c;
  --line: #ddd6e3;
  --accent: #5b4b9a;
  --accent-text: #ffffff;
  --link: #4c3f8a;
  --danger: #a3312f;
  --heart: #d81e2c;
  --bang: #c2410c;
  --left-bg: #e6def5; --right-bg: #fbeed2; --split-line: #5b4b9a;
  --g0: #5b4b9a; --g1: #c2410c; --g2: #0f766e; --g3: #be185d; --g4: #1d4ed8;
  --vote-agree: #1f6b33; --vote-disagree: #a3312f; --vote-unsure: #55525f;
  --fakt-bg: #dff1e0; --fakt-text: #1f5a2a; --fakt-line: #a5d2aa;
  --nazor-bg: #dfe9f8; --nazor-text: #1f4479; --nazor-line: #a9c3e8;
  --redflag-bg: #fbeecb; --redflag-text: #6a4c05; --redflag-line: #e4cd8a;
  --neni-bg: #f8dfdd; --neni-text: #7f2320; --neni-line: #e4aeaa;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --tag-border: solid;
}

[data-theme="neon"] {
  color-scheme: dark;
  --bg: #0b0b16;
  --panel: #15152a;
  --panel-soft: #1e1e3a;
  --text: #f1f0ff;
  --muted: #aaa8c8;
  --line: #34345f;
  --accent: #39ffb6;
  --accent-text: #06241a;
  --link: #7fe9ff;
  --danger: #ff8a9a;
  --heart: #ff3b5c;
  --bang: #ffb020;
  --left-bg: #1a1242; --right-bg: #06262b; --split-line: #39ffb6;
  --g0: #39ffb6; --g1: #ffb020; --g2: #7fe9ff; --g3: #ff6ad5; --g4: #b79bff;
  --vote-agree: #5dffc0; --vote-disagree: #ff8a9a; --vote-unsure: #c5c3e0;
  --fakt-bg: #0b2e22; --fakt-text: #5dffc0; --fakt-line: #1fa877;
  --nazor-bg: #10243f; --nazor-text: #7fd0ff; --nazor-line: #2b7fc0;
  --redflag-bg: #33290a; --redflag-text: #ffe25c; --redflag-line: #b39a1c;
  --neni-bg: #3a1020; --neni-text: #ff93b0; --neni-line: #c23d68;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --tag-border: solid;
}

/* Tužkový režim: typ štítku rozlišuje ikona a styl rámečku, ne barva. */
[data-theme="tuzka"] {
  color-scheme: light;
  --bg: #fafafa;
  --panel: #ffffff;
  --panel-soft: #f0f0f0;
  --text: #1a1a1a;
  --muted: #555555;
  --line: #8a8a8a;
  --accent: #1a1a1a;
  --accent-text: #ffffff;
  --link: #1a1a1a;
  --danger: #1a1a1a;
  --heart: #1a1a1a;
  --bang: #1a1a1a;
  --left-bg: #ffffff; --right-bg: #dcdcdc; --split-line: #1a1a1a;
  --g0: #1a1a1a; --g1: #5c5c5c; --g2: #8a8a8a; --g3: #b0b0b0; --g4: #d0d0d0;
  --vote-agree: #1a1a1a; --vote-disagree: #1a1a1a; --vote-unsure: #1a1a1a;
  --fakt-bg: #ffffff; --fakt-text: #1a1a1a; --fakt-line: #1a1a1a;
  --nazor-bg: #ffffff; --nazor-text: #1a1a1a; --nazor-line: #1a1a1a;
  --redflag-bg: #eeeeee; --redflag-text: #1a1a1a; --redflag-line: #1a1a1a;
  --neni-bg: #dddddd; --neni-text: #1a1a1a; --neni-line: #1a1a1a;
  --radius: 3px;
  --font: Georgia, "Times New Roman", serif;
  --tag-border: dashed;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.55; min-height: 100vh; overflow-wrap: anywhere; }
a { color: var(--link); }
h1 { font-size: 1.5rem; line-height: 1.3; }
h2 { font-size: 1.15rem; line-height: 1.35; }
h3 { font-size: 1.05rem; line-height: 1.35; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

/* Navigace */
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.3rem; letter-spacing: 2px; color: var(--text); text-decoration: none; }
.logo span { color: var(--link); }
.beta { font-size: .68rem; border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; margin-left: 6px; letter-spacing: 0; color: var(--muted); vertical-align: middle; }
.nav-links { display: flex; align-items: center; gap: 2px; flex: 1; overflow-x: auto; }
.nav-link { color: var(--text); text-decoration: none; font-size: .9rem; padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
.nav-link:hover, .nav-link.active { background: var(--panel-soft); }
.nav-link.active { font-weight: 700; }
.badge { background: var(--danger); color: var(--panel); font-size: .7rem; font-weight: 700; border-radius: 10px; padding: 1px 6px; margin-left: 3px; }
.nav-user { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); margin-left: auto; }

/* Rozložení */
.page { max-width: 760px; margin: 0 auto; padding: 20px 16px 56px; }
.layout { max-width: 1040px; margin: 0 auto; padding: 20px 16px 56px; display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.categories { display: flex; flex-direction: column; gap: 3px; position: sticky; top: 72px; }
.categories h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 0 10px 4px; }
.cat { color: var(--text); text-decoration: none; font-size: .9rem; padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
.cat:hover { background: var(--panel-soft); }
.cat.active { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.stack > * + * { margin-top: 14px; }
.page-title { margin-bottom: 16px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }
article.card { scroll-margin-top: 72px; }
.section { margin-top: 24px; }
.section > h2 { margin-bottom: 10px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.source { font-weight: 700; color: var(--text); }
.pill { background: var(--panel-soft); padding: 1px 9px; border-radius: 10px; }
.title-link { color: inherit; text-decoration: none; }
.title-link:hover { text-decoration: underline; }
.summary { margin: 8px 0 12px; }
.ai-note { font-size: .78rem; color: var(--muted); margin-bottom: 10px; }
.muted { color: var(--muted); font-size: .9rem; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* Štítky */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag { font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 10px; border: 1px var(--tag-border); }
.tag-fakt { background: var(--fakt-bg); color: var(--fakt-text); border-color: var(--fakt-line); }
.tag-nazor { background: var(--nazor-bg); color: var(--nazor-text); border-color: var(--nazor-line); }
.tag-redflag { background: var(--redflag-bg); color: var(--redflag-text); border-color: var(--redflag-line); }
.tag-neni { background: var(--neni-bg); color: var(--neni-text); border-color: var(--neni-line); }
[data-theme="tuzka"] .tag-fakt { border-style: solid; }
[data-theme="tuzka"] .tag-nazor { border-style: dashed; }
[data-theme="tuzka"] .tag-redflag { border-style: dotted; border-width: 2px; }
[data-theme="tuzka"] .tag-neni { border-style: double; border-width: 3px; }
.tag-choice { display: grid; gap: 10px; margin-top: 10px; }
.tag-choice .checkbox { align-items: center; }
.tag-choice .checkbox input { margin-top: 0; }
fieldset { border: 0; }
legend { font-size: .88rem; font-weight: 600; }
.legend { font-size: .8rem; color: var(--muted); margin-bottom: 14px; }

/* Formuláře */
label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="url"], input[type="number"], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 12px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 3px; font-weight: 400; }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.checkbox input { margin-top: 5px; }
.btn { display: inline-block; font: inherit; font-size: .9rem; font-weight: 700; background: var(--accent); color: var(--accent-text); border: 1px solid var(--accent); border-radius: 8px; padding: 9px 16px; cursor: pointer; text-decoration: none; }
.btn:hover { opacity: .88; }
.btn-plain { background: transparent; color: var(--text); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-small { font-size: .8rem; font-weight: 600; padding: 5px 10px; }
.inline-form { display: inline; }
.alert { border: 1px solid var(--danger); color: var(--danger); background: var(--panel); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: .9rem; }
.notice { border: 1px solid var(--line); background: var(--panel-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: .9rem; }

/* Akce u příspěvků a komentářů */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.action { font: inherit; font-size: .82rem; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 5px 8px; min-height: 34px; cursor: pointer; text-decoration: none; }
.action:hover { background: var(--panel-soft); color: var(--text); }
.action.on { color: var(--text); font-weight: 700; background: var(--panel-soft); border-color: var(--line); }
.spread { justify-content: space-between; }

/* Srdíčko a vykřičník */
.reaction { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 700; background: transparent; border: 0; border-radius: 8px; padding: 4px 8px 4px 4px; min-height: 44px; cursor: pointer; }
.reaction:hover { background: var(--panel-soft); }
.reaction-count { color: var(--text); }
.heart { width: 32px; height: 32px; fill: none; stroke: var(--heart); stroke-width: 2.2; stroke-linejoin: round; }
.reaction-heart.on .heart { fill: var(--heart); }
.bang { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--bang); color: var(--bang); font-family: Arial, sans-serif; font-size: 1.25rem; font-weight: 900; line-height: 1; }
.reaction-important.on .bang { background: var(--bang); color: var(--panel); }

/* Vyskakovací okno */
.popup { width: min(92vw, 380px); margin: auto; padding: 20px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.popup::backdrop { background: rgba(0, 0, 0, .55); }
.popup p { font-size: 1.05rem; margin-bottom: 16px; }
.popup-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* Komentáře */
.comment { padding: 12px 0; border-top: 1px solid var(--line); scroll-margin-top: 72px; }
.comment:target { background: var(--panel-soft); box-shadow: 0 0 0 8px var(--panel-soft); border-radius: 2px; }
.replies { margin: 8px 0 0 12px; padding-left: 12px; border-left: 2px solid var(--line); }
.replies .comment:first-child { border-top: 0; }
.author { font-weight: 700; color: var(--text); }
.phrase { font-style: italic; font-weight: 600; }
.reply-to { font-size: .85rem; font-weight: 700; color: var(--link); text-decoration: none; }
a.reply-to:hover { text-decoration: underline; }
.section-tight { margin-bottom: 8px; }
.comment-body { margin-bottom: 6px; white-space: pre-line; }
.removed { font-size: .88rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; }
details > summary { list-style: none; display: inline-block; }
details > summary::-webkit-details-marker { display: none; }
.action-details { display: contents; }
.action-details[open] > summary { font-weight: 700; color: var(--text); }
.drawer { flex-basis: 100%; background: var(--panel-soft); border-radius: 8px; padding: 12px; margin-top: 6px; }
.drawer textarea, .drawer select, .drawer input[type="text"] { margin-bottom: 8px; }

/* Odkazy zpět */
.back-link { margin-bottom: 12px; font-size: .9rem; }
.section-top { margin-top: 8px; }

/* NVL 1.2: stránka rozdělená napůl */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100vh - 56px); margin-bottom: 24px; }
.split-side { padding: 20px clamp(16px, 2.5vw, 40px) 40px; }
.split-left { background: var(--left-bg); border-right: 4px solid var(--split-line); }
.split-right { background: var(--right-bg); }
.topic-list { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-link { padding: 9px 14px; min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; }
.topic-link:hover { border-color: var(--split-line); }
.topic-link.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
#vyrok-odeslan, #vyroky, #mapa { scroll-margin-top: 72px; }
.progress { margin-top: 12px; }
.progress-bar { height: 10px; border-radius: 5px; background: var(--panel-soft); border: 1px solid var(--line); overflow: hidden; margin-top: 6px; }
.progress-fill { display: block; height: 100%; background: var(--accent); }
.p0 { width: 0; } .p10 { width: 10%; } .p20 { width: 20%; } .p30 { width: 30%; } .p40 { width: 40%; } .p50 { width: 50%; }
.p60 { width: 60%; } .p70 { width: 70%; } .p80 { width: 80%; } .p90 { width: 90%; } .p100 { width: 100%; }
.statement-voted .statement-text { font-weight: 500; }
.statement-result { font-size: .85rem; color: var(--muted); margin-top: 8px; }
.r-agree { color: var(--vote-agree); font-weight: 700; }
.r-disagree { color: var(--vote-disagree); font-weight: 700; }
.pill-divisive { font-size: .72rem; font-weight: 700; color: var(--text); border: 1px solid var(--line); }
.topic-state { font-size: .72rem; font-weight: 400; opacity: .8; }
.topic-closed { opacity: .75; }
.my-summary { background: var(--panel-soft); border-radius: 8px; padding: 12px 14px; margin-top: 10px; }
.my-summary p + p { margin-top: 4px; }
.summary-note { white-space: pre-line; border-left: 4px solid var(--split-line); padding-left: 12px; margin: 10px 0; }
.similar { background: var(--panel-soft); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: .9rem; }
.similar ul { margin: 4px 0 0 18px; }
.statements { margin-top: 12px; }
.statement { padding: 14px 0; border-top: 1px solid var(--line); scroll-margin-top: 72px; }
.statement-text { font-weight: 600; margin-bottom: 8px; }
.vote-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.vote { font: inherit; font-size: .88rem; font-weight: 600; min-height: 44px; padding: 6px 12px; border-radius: 8px; cursor: pointer; background: transparent; border: 2px solid currentColor; }
.vote-agree { color: var(--vote-agree); }
.vote-disagree { color: var(--vote-disagree); }
.vote-unsure { color: var(--vote-unsure); }
.vote:hover { background: var(--panel-soft); }
.vote-agree.on { background: var(--vote-agree); color: var(--panel); }
.vote-disagree.on { background: var(--vote-disagree); color: var(--panel); }
.vote-unsure.on { background: var(--vote-unsure); color: var(--panel); }
.vote-points { font-weight: 800; }
.removed + .removed, .statements + .removed { margin-top: 8px; }

/* Mapa názorů */
.opinion-map { display: block; width: 100%; height: auto; margin: 10px 0 4px; }
.map-bg { fill: var(--panel-soft); stroke: var(--line); }
.map-point { stroke: var(--panel); stroke-width: 1.5; }
.g0 { fill: var(--g0); background: var(--g0); }
.g1 { fill: var(--g1); background: var(--g1); }
.g2 { fill: var(--g2); background: var(--g2); }
.g3 { fill: var(--g3); background: var(--g3); }
.g4 { fill: var(--g4); background: var(--g4); }
.map-point.map-me { stroke: var(--text); stroke-width: 4; }
.map-label { fill: var(--text); font-size: 20px; font-weight: 800; paint-order: stroke; stroke: var(--panel-soft); stroke-width: 4px; }
.group-list { list-style: none; margin-top: 8px; }
.group-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.group-swatch { flex-shrink: 0; width: 16px; height: 16px; border-radius: 50%; margin-top: 5px; border: 1px solid var(--text); }
.consensus-list { margin: 8px 0 0 20px; }
.consensus-list li { margin-bottom: 6px; font-weight: 600; }

/* Výběr režimu */
.theme-choice { display: grid; gap: 8px; margin-bottom: 12px; }
.theme-option { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-weight: 400; cursor: pointer; }
.swatch { width: 44px; height: 24px; border-radius: 6px; border: 1px solid var(--line); flex-shrink: 0; }
.swatch-pastel { background: linear-gradient(90deg, #f7f3ee 50%, #5b4b9a 50%); }
.swatch-neon { background: linear-gradient(90deg, #0b0b16 50%, #39ffb6 50%); }
.swatch-tuzka { background: linear-gradient(90deg, #ffffff 50%, #1a1a1a 50%); }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat strong { display: block; font-size: 1.5rem; }
.codes { font-family: Consolas, Menlo, monospace; white-space: pre-line; background: var(--panel-soft); padding: 12px; border-radius: 8px; margin: 10px 0; }
.big-number { font-family: Consolas, Menlo, monospace; font-size: 2.2rem; font-weight: 700; letter-spacing: 2px; text-align: center; margin: 16px 0; }
.invite-code { font-family: Consolas, Menlo, monospace; font-weight: 700; margin-right: 6px; }
.pill-waiting { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.pill { white-space: nowrap; }
.row-list { list-style: none; }
.row-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }

/* Úvodní a textové stránky */
.hero { text-align: center; padding: 40px 0 24px; }
.hero h1 { font-size: 2rem; margin-bottom: 12px; }
.hero p { max-width: 560px; margin: 0 auto 20px; }
.hero .btn { margin: 4px; }
.prose h2 { margin: 20px 0 6px; }
.prose ul, .prose ol { margin: 6px 0 12px 22px; }
ul.prose { margin-left: 22px; }
.prose p { margin-bottom: 10px; }
.footer { max-width: 1040px; margin: 0 auto; padding: 0 16px 32px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .82rem; color: var(--muted); }
.footer a { color: var(--muted); }

.pager { display: flex; justify-content: space-between; margin-top: 16px; }

/* Mobil */
@media (max-width: 760px) {
  .layout { display: block; padding-top: 10px; }
  .categories { position: static; flex-direction: row; overflow-x: auto; margin-bottom: 12px; padding-bottom: 6px; }
  .categories h2 { display: none; }
  .cat { background: var(--panel); border: 1px solid var(--line); }
  .topbar { position: static; }
  .nav-links { order: 3; flex-basis: 100%; margin: 0 -6px; flex-wrap: wrap; overflow-x: visible; }
  .replies { margin-left: 2px; padding-left: 10px; }
  .card { padding: 14px; }
  .hero h1 { font-size: 1.6rem; }
  .split { display: block; }
  .split-left { border-right: 0; border-bottom: 4px solid var(--split-line); }
}
