/* Schriften liegen im Projekt (public/fonts), es wird nichts von fremden Servern geladen. */
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #202122;
  --muted: #54595d;
  --line: #a2a9b1;
  --soft-line: #eaecf0;
  --soft: #f8f9fa;
  --accent: #ff4f1f;      /* Hop-Orange: Knöpfe, Markierungen */
  --accent-dark: #e63e0f;
  --ink: #202122;         /* Rahmen, Schatten, Schrift auf hellem Grund */
  --on-accent: #202122;   /* Schrift auf Orange und Gelb */
  --dark: #202122;        /* immer dunkle Flächen: Kopfzeile, Hinweisblasen */
  --warn: #ff6b5c;        /* Zeit läuft ab */
  --hl: #ffe45e;          /* Textmarker-Gelb */
  --goal: #0e7a4f;        /* Ziel, Erfolg */
  --link: #3366cc;        /* Links im Artikel */
  --danger: #b42318;
  --radius: 4px;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
}

[hidden] { display: none !important; }

/* ---------- Startbildschirm ---------- */
.start {
  max-width: 460px;
  margin: 0 auto;
  padding: 40px 20px 32px;
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.brand-logo { flex: none; width: 64px; height: 64px; }
.brand-mini { width: 36px; height: 36px; margin-right: 10px; vertical-align: middle; }
h1, h2, h3 { font-family: var(--serif); }
.start h1 { margin: 0; font-size: 2.9rem; font-weight: 700; letter-spacing: -0.03em; line-height: 0.98; }
.lead { margin: 0 0 24px; font-family: var(--serif); font-size: 1.3rem; line-height: 1.35; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 4px; font-weight: 600; font-size: 0.9rem; }
input[type="text"], select {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
input[type="text"]:focus, select:focus, button:focus-visible {
  outline: 3px solid var(--hl);
  outline-offset: 1px;
  box-shadow: 0 0 0 1px var(--ink);
}
.hint { display: block; min-height: 1.3em; margin-top: 4px; color: var(--muted); font-size: 0.85rem; }
.hint.ok { color: var(--goal); }
.hint.bad { color: var(--danger); }

.modes { margin: 0 0 16px; padding: 0; border: 0; }
.modes legend { margin-bottom: 4px; padding: 0; font-weight: 600; font-size: 0.9rem; }
.modes label { display: inline-flex; align-items: center; gap: 6px; margin-right: 18px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }

button { font: inherit; cursor: pointer; }
button.primary {
  width: 100%;
  padding: 13px 14px;
  color: var(--on-accent);
  font-weight: 700;
  background: var(--accent);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
button.primary:hover { background: var(--accent-dark); }
button.primary:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
button.primary:disabled { opacity: 0.6; cursor: progress; }
button.ghost {
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
button.ghost:hover:not(:disabled) { background: var(--soft-line); }
button.ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.error { min-height: 1.4em; margin: 12px 0 0; color: var(--danger); }
.credit { margin-top: 28px; color: var(--muted); font-size: 0.8rem; }
.credit a { color: inherit; }

/* ---------- Spiel-Kopfleiste ---------- */
.hud {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 16px;
  color: #fff;
  background: var(--dark);
  border-bottom: 2px solid var(--dark);
}
.hud button.ghost { color: #fff; background: transparent; border-color: #5b6066; }
.hud button.ghost:hover:not(:disabled) { background: #3a3d40; }
.hud .muted { color: #c8ccd1; }
.hud .route-line strong { font-family: var(--serif); font-size: 1.45rem; letter-spacing: -0.01em; }
.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hud-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.route { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.route-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.route-line > strong, .route-line > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { flex: none; min-width: 3.4em; padding: 1px 7px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-align: center; text-transform: uppercase; border-radius: 4px; }
.tag-goal { color: var(--on-accent); background: var(--accent); }
.tag-start { color: #fff; background: transparent; border: 1px solid #8b9096; }
.route-goal { margin-bottom: 2px; }
.route-start { color: #dfe2e5; font-size: 0.9rem; }
.muted { color: var(--muted); font-size: 0.85rem; }
.hud-right { display: flex; gap: 10px; flex-shrink: 0; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: 4px 12px;
  color: #fff;
  background: #3a3d40;
  border: 1px solid #3a3d40;
  border-radius: var(--radius);
}
.stat-label { color: #c8ccd1; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-family: var(--serif); font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-value.low { color: var(--warn); }

/* ---------- Inhaltsübersicht ---------- */
.game-body { display: block; }
.toc {
  position: fixed;
  top: calc(var(--hud-h, 110px) + 4px);
  right: 8px;
  left: 8px;
  z-index: 20;
  max-height: 60vh;
  padding: 12px 14px;
  overflow-y: auto;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.toc:not(.open) { display: none; }
.toc h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 1rem; }
.toc ol { margin: 0; padding: 0; list-style: none; }
.toc li.sub { padding-left: 16px; }
.toc button {
  display: block;
  width: 100%;
  padding: 7px 8px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.25;
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
}
.toc button:hover { background: var(--soft); }
.toc li.current > button { font-weight: 700; background: var(--soft); border-left-color: var(--accent); }
.toc-button[hidden] { display: none; }
.wiki h2, .wiki h3 { scroll-margin-top: calc(var(--hud-h, 110px) + 12px); }
@media (min-width: 1180px) {
  .game-body { display: flex; justify-content: center; align-items: flex-start; gap: 20px; }
  .game-body .wiki { flex: 0 1 860px; margin: 16px 0; }
  .toc, .toc:not(.open) {
    display: block;
    position: sticky;
    top: calc(var(--hud-h, 110px) + 16px);
    right: auto;
    left: auto;
    flex: none;
    width: 230px;
    max-height: calc(100vh - var(--hud-h, 110px) - 32px);
    margin-top: 16px;
    border: 1px solid var(--line);
    box-shadow: none;
  }
  .toc[hidden] { display: none; }
  .toc-button { display: none; }
}

/* ---------- Artikel ---------- */
.wiki {
  max-width: 860px;
  margin: 16px auto;
  padding: 20px 24px 48px;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  transition: opacity 0.15s;
}
.wiki.loading { opacity: 0.45; pointer-events: none; }
.wiki h1, .wiki h2, .wiki h3, .wiki h4 { font-family: var(--serif); font-weight: 500; line-height: 1.25; }
.wiki h1 { font-size: 2rem; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.wiki h2 { margin-top: 1.8em; padding-bottom: 4px; font-size: 1.6rem; border-bottom: 1px solid var(--line); }
.wiki a.wl { color: var(--link); text-decoration: none; cursor: pointer; }
.wiki a.wl:hover { text-decoration: underline; background: rgba(255, 228, 94, 0.45); }
.wiki img { max-width: 100%; height: auto; }
.wiki table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 0.9rem; }
.wiki th, .wiki td { padding: 4px 8px; border: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.wiki .infobox, .wiki .float-right, .wiki .thumb.tright { float: right; clear: right; margin: 0 0 12px 16px; max-width: 45%; }
.wiki .thumb { margin: 0 0 12px; }
.wiki .thumb.tleft { float: left; clear: left; margin-right: 16px; max-width: 45%; }
.wiki .thumbinner { width: auto !important; max-width: 100%; }
.wiki .thumbcaption { font-size: 0.85rem; color: var(--muted); }
.wiki ul, .wiki ol { padding-left: 1.4em; }
.wiki blockquote { margin-left: 0; padding-left: 14px; border-left: 3px solid var(--line); color: var(--muted); }

/* ---------- Ergebnis & Hinweise ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 20, 18, 0.55);
}
.dialog {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  padding: 24px;
  overflow-y: auto;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--ink);
}
.dialog h2 { margin: 0 0 8px; }
.path { margin: 12px 0 20px; padding-left: 1.4em; color: var(--muted); font-size: 0.9rem; }
.path li.back { font-style: italic; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  color: #fff;
  background: var(--dark);
  border-radius: var(--radius);
  transform: translateX(-50%);
}

/* ---------- Handy & iPad hochkant ---------- */
@media (max-width: 640px) {
  .hud { padding: 8px 10px; }
  .stat { min-width: 54px; padding: 3px 8px; }
  .stat-value { font-size: 1.15rem; }
  #back-button { padding: 8px 10px; }
  .wiki { margin: 8px; padding: 14px 14px 40px; }
  .wiki .infobox, .wiki .float-right, .wiki .thumb.tright, .wiki .thumb.tleft {
    float: none; max-width: 100%; margin: 0 0 12px;
  }
  .wiki table { width: 100%; }
}

/* ---------- Karten, Formulare ---------- */
.card {
  margin-bottom: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
}
.card h2 { margin: 0 0 12px; padding-bottom: 4px; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; border-bottom: 1px solid var(--line); }
.card h3 { margin: 0 0 10px; font-size: 1.15rem; font-weight: 700; }
details.card > summary { cursor: pointer; font-family: var(--serif); font-weight: 700; font-size: 1.3rem; }
details.card[open] > summary { margin-bottom: 14px; }
.join-row { display: flex; gap: 8px; margin-top: 12px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; }
#pot-word { text-transform: none; }
button.secondary {
  padding: 12px 18px;
  color: var(--ink);
  font-weight: 700;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}
button.secondary:hover { color: var(--on-accent); background: var(--hl); }
button.primary.inline { width: auto; padding: 12px 20px; }
.row { display: flex; flex-wrap: wrap; gap: 0 14px; }
.row .field { flex: 1 1 150px; }
.summary { margin: 0; padding-left: 1.2em; color: var(--muted); }

/* ---------- Lobby ---------- */
.lobby { max-width: 980px; margin: 0 auto; padding: 16px; }
.lobby-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.lobby-code strong {
  margin-left: 6px;
  padding: 4px 10px;
  font-size: 1.4rem;
  letter-spacing: 0.15em;
  font-family: var(--serif);
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}
.lobby-actions { display: flex; gap: 8px; }
.lobby-grid { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.players { margin: 0; padding: 0; list-style: none; }
.players li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--soft-line);
}
.players li:last-child { border-bottom: 0; }
.dot { flex: none; width: 9px; height: 9px; background: #2f9e6f; border-radius: 50%; }
.av-wrap { position: relative; flex: none; width: 30px; height: 30px; }
.av-wrap .dot { position: absolute; right: -2px; bottom: 0; box-sizing: content-box; border: 2px solid var(--surface); }
.avatar { display: block; flex: none; }
.dot.off { background: #c9c5b8; }
.p-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-name.me { font-weight: 700; }
.p-tag { color: var(--muted); font-size: 0.8rem; }
.p-score { font-family: var(--serif); font-size: 1.1rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.p-clicks { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.big-timer {
  margin: 8px 0 14px;
  font-family: var(--serif);
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.big-timer.low { color: var(--danger); }

/* ---------- Auslosung ---------- */
.draw { text-align: center; }
.draw-row { display: flex; align-items: stretch; justify-content: center; gap: 12px; margin: 18px 0; }
.draw-box {
  flex: 1;
  max-width: 240px;
  min-width: 0;
  padding: 12px 10px;
  background: var(--soft);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}
.draw-box small { display: block; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.7rem; }
.draw-word {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2em;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.draw-box.rolling { background: var(--hl); }
.draw-box.rolling .draw-word, .draw-box.landed .draw-word { color: var(--on-accent); }
.draw-box.landed { background: var(--accent); animation: pop 0.5s ease-out; }
.draw-arrow { align-self: center; font-size: 1.8rem; color: var(--muted); }
.countdown { min-height: 1.2em; color: var(--ink); font-family: var(--serif); font-size: 4.2rem; font-weight: 700; line-height: 1.2; }
@keyframes pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .draw-box.landed { animation: none; }
}

/* ---------- Ergebnis ---------- */
.ranking { margin: 0 0 16px; padding: 0; list-style: none; counter-reset: place; }
.ranking > li { counter-increment: place; padding: 10px 0; border-bottom: 1px solid var(--soft-line); }
.ranking > li:last-child { border-bottom: 0; }
.rank-line { display: flex; align-items: baseline; gap: 10px; }
.rank-line::before {
  content: counter(place);
  flex: none;
  width: 1.6em;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}
.rank-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-meta { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.rank-points { min-width: 4.5em; text-align: right; color: var(--goal); font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-total { min-width: 3.5em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.ranking details { margin: 4px 0 0 2.4em; color: var(--muted); font-size: 0.85rem; }
.ranking details summary { cursor: pointer; }
.ranking details ol { margin: 6px 0 0; padding-left: 1.3em; }

/* ---------- Klickstand der Mitspieler (oben im Spiel) ---------- */
.board { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding-top: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 10px;
  font-size: 0.85rem;
  color: #fff;
  background: #3a3d40;
  border: 1px solid #3a3d40;
  border-radius: var(--radius);
}
.chip b { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chip .n { font-weight: 700; font-variant-numeric: tabular-nums; }
.chip.me { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.chip.done { color: #fff; background: var(--goal); border-color: var(--goal); }
.chip.out { color: #c8ccd1; text-decoration: line-through; }
.chip.off { opacity: 0.55; }

@media (max-width: 760px) {
  .lobby { padding: 10px; }
  .lobby-grid { grid-template-columns: 1fr; }
  .start { padding-top: 24px; }
  .card { padding: 14px; }
  .draw-word { font-size: 1.1rem; }
  .draw-row { gap: 6px; }
  .big-timer { font-size: 2.2rem; }
  .hud-top { flex-wrap: wrap; }
  .board { justify-content: flex-start; }
  .rank-meta { display: none; }
}

/* ---------- Avatar ---------- */
.avatar-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.avatar-preview { flex: none; }
.avatar-rows { display: grid; flex: 1; gap: 6px; min-width: 190px; }
.avatar-row { display: grid; grid-template-columns: 96px 40px 1fr 40px; align-items: center; gap: 4px; }
.avatar-label { font-weight: 600; font-size: 0.9rem; }
.avatar-count { color: var(--muted); font-size: 0.8rem; text-align: center; font-variant-numeric: tabular-nums; }
.avatar-arrow { height: 36px; color: var(--text); font-size: 1.4rem; line-height: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.avatar-arrow:hover { background: var(--soft-line); }
.avatar-dice { flex: 1 1 100%; }
.avatar-details { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--soft-line); }
.avatar-details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.avatar-details[open] summary { margin-bottom: 10px; }
.avatar-details .avatar-rows { min-width: 0; flex-basis: 100%; }
.avatar-details .avatar-row { grid-template-columns: 1fr 36px 44px 36px; }
.avatar-field > span { margin-bottom: 8px; }
.podium-name .avatar { margin: 0 auto 4px; }
.rank-line .avatar { align-self: center; }
.chat-log .avatar { display: inline-block; margin-right: 6px; vertical-align: -5px; }
.chip .avatar { display: inline-block; margin-right: 4px; vertical-align: -5px; }

/* ---------- Chat ---------- */
.chat { margin-top: 16px; }
.chat-info { margin: 0 0 8px; }
.chat-log {
  margin: 0 0 10px;
  padding: 8px 10px;
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.chat-log li { padding: 3px 0; overflow-wrap: anywhere; }
.chat-name { font-weight: 700; }
.chat-log li.mine .chat-name { color: var(--accent-dark); }
.chat-empty { color: var(--muted); font-size: 0.9rem; }
.chat-form { display: flex; gap: 8px; align-items: stretch; }
.chat-form input[type="text"] { flex: 1; min-width: 0; }
.chat-form input:disabled { opacity: 0.55; cursor: not-allowed; }
.chat-form button.primary.inline { flex: none; padding: 10px 16px; }
.chat-mute { margin: 8px 0 0; color: var(--danger); font-size: 0.9rem; font-weight: 600; }
@media (max-width: 760px) { .chat { margin-bottom: 64px; } } /* Platz für die schwebenden Knöpfe unten rechts */

/* ---------- Kategorien ---------- */
.category-box { margin: 0 0 16px; padding: 12px 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 0; }
.category-box .modes { margin-bottom: 8px; }
.cat-tools { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; font-size: 0.85rem; }
.cat-tools .muted { margin-right: auto; }
.linkish { padding: 2px 0; background: none; border: 0; color: var(--link); font-size: 0.85rem; text-decoration: underline; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; padding: 2px; }
.chip-cat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 34px 8px 12px;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1rem;
  line-height: 1.25;
  hyphens: auto;
  overflow-wrap: break-word;
}
.cat-emoji { flex: none; width: 1.5em; font-size: 1.15em; text-align: center; }
.cat-name { flex: 1; min-width: 0; }
.chip-cat:hover:not(:disabled) { border-color: var(--ink); }
.chip-cat[aria-pressed="true"] { background: var(--hl); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); color: var(--on-accent); font-weight: 700; }
.chip-cat::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 10px;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 50%;
}
.chip-cat[aria-pressed="true"]::after {
  content: "✓";
  display: grid;
  place-items: center;
  color: var(--surface);
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--ink);
  border-color: var(--ink);
}
@media (max-width: 640px) {
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chips { gap: 6px; }
  .chip-cat { gap: 4px; min-height: 44px; padding: 6px 28px 6px 8px; font-size: 0.88rem; hyphens: manual; }
  .chip-cat::after { right: 7px; width: 16px; height: 16px; margin-top: -8px; }
  .cat-emoji { width: 1.3em; }
}

.theme-banner {
  margin: 0 0 14px;
  padding: 10px 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-left: 6px solid var(--hl);
  border-radius: 0;
}
.theme-banner strong { font-size: 1.05rem; }
.theme-banner .examples { display: block; margin-top: 2px; color: var(--muted); font-size: 0.9rem; }
.theme-banner.small { padding: 6px 12px; font-size: 0.9rem; }

/* ---------- Kurzerklärung ---------- */
.word { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
/* Das kleine ? zeigt: Hier gibt es eine Erklärung (Maus: draufgehen, Handy: antippen). */
.word::after {
  content: '?';
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  margin-left: 0.35em;
  font: 700 0.7em/1.2em var(--sans);
  text-align: center;
  text-decoration: none;
  vertical-align: 0.15em;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.8;
}
.word:hover::after, .word:focus-visible::after { opacity: 1; background: var(--hl); color: #202122; border-color: #202122; }
.word:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 3px; }
.term-pop {
  position: fixed;
  z-index: 1000;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  background: var(--dark);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
  line-height: 1.4;
  pointer-events: none;
}
.term-pop b { display: block; margin-bottom: 2px; }
.term-pop .dim { color: #bdbbb2; }

/* ---------- Ton ---------- */
.sound-toggle {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 900;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 1.15rem;
}

.locked-box { margin: 0 0 16px; padding: 10px 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 0; }
.locked-box .summary { margin: 6px 0 0; }

/* Abstimmung über die Kategorien */
.chips-vote { max-height: none; overflow: visible; margin: 12px 0; }
.chip-vote .vote-count { margin-left: auto; }
.chip-vote .vote-count { min-width: 1.5em; padding: 0 6px; color: #fff; font-size: 0.8rem; font-weight: 700; text-align: center; background: var(--dark); border-radius: 999px; }
.chip-vote .vote-count[hidden] { display: none; }
.chip-vote:disabled { cursor: default; }
.chip-vote.out { opacity: 0.45; }
.chip-vote.winner { background: var(--accent); border: 2px solid var(--ink); color: var(--on-accent); font-weight: 700; }
#vote-settings { margin-top: 10px; }

/* Siegerehrung */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; min-height: 240px; margin: 8px 0 20px; padding: 0 4px; border-bottom: 3px solid var(--ink); }
.podium-col { flex: 1 1 0; max-width: 170px; display: flex; flex-direction: column; align-items: stretch; text-align: center; }
.podium-name { margin-bottom: 2px; font-family: var(--serif); font-size: 1.15rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; opacity: 0; }
.podium-points { margin-bottom: 6px; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; opacity: 0; }
.podium-block { display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; font-family: var(--serif); font-size: 2.4rem; font-weight: 700; line-height: 1; background: var(--surface); border: 2px solid var(--ink); border-bottom: 0; transform-origin: bottom; transform: scaleY(0); }
.place-1 .podium-block { height: 150px; color: var(--on-accent); background: var(--accent); }
.place-2 .podium-block { height: 105px; color: var(--on-accent); background: var(--hl); }
.place-3 .podium-block { height: 70px; background: var(--soft-line); }
.podium.play .podium-block { animation: rise 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.15) forwards; animation-delay: var(--rise); }
.podium.play .podium-name, .podium.play .podium-points { animation: fade-up 0.5s ease-out forwards; animation-delay: calc(var(--rise) + 0.55s); }
.podium.play .place-1 .podium-name { animation-name: fade-up, wobble; animation-duration: 0.5s, 0.9s; animation-delay: calc(var(--rise) + 0.55s), calc(var(--rise) + 1.1s); animation-fill-mode: forwards, none; }
@keyframes rise { to { transform: scaleY(1); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes wobble { 0%, 100% { transform: none; } 30% { transform: scale(1.12) rotate(-2deg); } 60% { transform: scale(1.06) rotate(2deg); } }
.confetti { position: fixed; inset: 0; z-index: 30; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -14px; width: 9px; height: 14px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); } }
@media (prefers-reduced-motion: reduce) {
  .podium-block { transform: none; }
  .podium-name, .podium-points { opacity: 1; }
  .podium.play .podium-block, .podium.play .podium-name, .podium.play .podium-points { animation: none; }
}

/* Zeit läuft ab: rot, pulsiert einmal pro Sekunde */
.stat-value.low { animation: tick-pulse 1s ease-in-out infinite; }
@keyframes tick-pulse { 0%, 100% { transform: none; } 12% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .stat-value.low { animation: none; } }

/* ---------- Dunkles Design ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121314;
  --surface: #1c1d1f;
  --text: #e8e8e6;
  --muted: #a3a8ad;
  --line: #3f444a;
  --soft-line: #2b2e31;
  --soft: #222427;
  --ink: #ededeb;
  --dark: #0a0b0c;
  --accent-dark: #ff6a40;
  --link: #8ab4f8;
  --goal: #3fc58b;
  --danger: #ff7b6b;
}
:root[data-theme="dark"] .hud { border-bottom: 1px solid var(--line); }
:root[data-theme="dark"] .wiki a.wl:hover { background: rgba(255, 228, 94, 0.22); }
:root[data-theme="dark"] .dot.off { background: #5c6166; }
:root[data-theme="dark"] .chip.done { color: #0a0b0c; }
:root[data-theme="dark"] .place-1 .podium-block { background: var(--accent); }
:root[data-theme="dark"] .place-2 .podium-block { background: var(--hl); }
:root[data-theme="dark"] .place-3 .podium-block { background: var(--line); }
:root[data-theme="dark"] .wiki img { background: #fff; }

.theme-toggle {
  position: fixed;
  right: 58px;
  bottom: 10px;
  z-index: 900;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
