/* kommzocken.de – „Kartentisch“: Papier, Tinte, Zinnoberrot. Gestempelte Karten statt Glas. */
:root {
  --paper: #f3eee3; --paper-2: #e8e0cf; --card: #fbf8f1; --ink: #1c2230; --ink-2: #4b5363; --ink-3: #6e7584;
  --accent: #c8442b; --accent-2: #a8341f; --on-accent: #fff; --teal: #1d6b73; --gold: #b8871f; --ok: #2e7a4c; --bad: #9b2c2c;
  --tile-correct: #2e7a4c; --tile-present: #b8871f; --tile-absent: #6b7280;
  --shadow: 4px 4px 0 var(--ink); --radius: 10px; --focus: 0 0 0 3px var(--paper), 0 0 0 6px var(--teal);
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15181e; --paper-2: #1d2129; --card: #20252e; --ink: #ece6d8; --ink-2: #c3bcae; --ink-3: #9a9384;
    --accent: #e0604a; --accent-2: #f07a62; --on-accent: #15181e; --teal: #5fb3bb; --gold: #d9a940; --ok: #5cb57f; --bad: #e07070;
    --tile-correct: #3c8f5c; --tile-present: #b88a2a; --tile-absent: #4b5160;
    --shadow: 4px 4px 0 #000; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); min-height: 100vh; -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .5em; letter-spacing: .005em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .8em; }
a { color: var(--teal); text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 1000; }
.skip:focus { left: 8px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopfzeile */
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px clamp(16px, 4vw, 40px); border-bottom: 2px solid var(--ink); background: var(--paper); position: sticky; top: 0; z-index: 500; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-word { font: 800 1.4rem/1 var(--sans); letter-spacing: -0.03em; }
.brand em { font-style: normal; font-weight: 700; color: var(--accent); }
.brand-mark { width: 34px; height: 34px; flex: none; transition: transform .25s ease; }
.brand:hover .brand-mark { transform: rotate(-12deg) scale(1.05); }
.bm-shadow { fill: var(--ink); } .bm-face { fill: var(--accent); } .bm-pips { fill: #fff; }
.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a { color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; }
.topnav a:hover, .topnav a[aria-current="page"] { background: var(--paper-2); }
.conn { font-size: .8rem; color: var(--ink-2); min-width: 0; }
.conn.bad { color: var(--bad); font-weight: 700; }
main { padding: clamp(16px, 4vw, 40px); max-width: 1240px; margin: 0 auto; outline: none; }
.loading { color: var(--ink-2); }

/* Bausteine */
.panel { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 2.5vw, 24px); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 20px; }
.btn { appearance: none; font: 700 1rem var(--sans); color: var(--ink); background: var(--card); border: 2px solid var(--ink); border-radius: 10px; padding: 12px 18px; min-height: 48px; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transition: transform .08s, box-shadow .08s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.ghost { box-shadow: none; background: transparent; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .875rem; box-shadow: 2px 2px 0 var(--ink); }
.btn.block { width: 100%; }
label { font-weight: 600; display: block; margin-bottom: 6px; }
input[type=text], input[type=search], input[type=number], select { font: 600 1rem var(--sans); color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; padding: 10px 12px; min-height: 48px; width: 100%; }
input.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .18em; text-transform: uppercase; }
.field + .field { margin-top: 14px; }
.error-text { color: var(--bad); font-weight: 600; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border: 1.5px solid currentColor; border-radius: 999px; padding: 1px 8px; }
.badge.host { color: var(--gold); } .badge.ready { color: var(--ok); } .badge.wait { color: var(--ink-3); } .badge.off { color: var(--bad); }

/* Startseite */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(20px, 4vw, 48px); align-items: end; margin-bottom: 32px; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 36ch; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.action h3 { display: flex; align-items: center; gap: 10px; }
.action .ico { width: 34px; height: 34px; border-radius: 8px; border: 2px solid var(--ink); display: grid; place-items: center; font: 700 1rem var(--serif); flex: none; }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 36px; }
.game-card { border-top: 6px solid var(--accent); }
.game-card.g-geo { border-top-color: var(--teal); } .game-card.g-wordle { border-top-color: var(--gold); } .game-card.g-music { border-top-color: var(--accent-2); }
.game-card p { color: var(--ink-2); margin-bottom: 0; }
.kicker { font: 700 .75rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; display: block; }

/* Angelsee-Karte (Cozy Catch) */
.angelsee-card { display: grid; grid-template-columns: auto 1fr; gap: clamp(16px, 3vw, 28px); align-items: center; margin-top: 28px; border-top: 6px solid var(--teal); }
.angelsee-art svg { display: block; width: clamp(120px, 18vw, 180px); height: auto; border: 2px solid var(--ink); border-radius: 10px; }
.angelsee-text h2 { margin-bottom: .3em; }
.angelsee-text p { color: var(--ink-2); max-width: 60ch; }
.topnav a.nav-angelsee { color: var(--teal); }
@media (max-width: 620px) { .angelsee-card { grid-template-columns: 1fr; } .angelsee-art svg { width: 100%; max-width: 260px; } }

/* Lobby */
.lobby { display: grid; grid-template-columns: minmax(280px, 1fr) 1.4fr; gap: 24px; align-items: start; }
.codebox { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.code-big { font: 700 clamp(1.6rem, 5vw, 2.3rem) ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .14em; background: var(--paper); border: 2px dashed var(--ink); border-radius: 8px; padding: 4px 12px; }
.players { list-style: none; margin: 0; padding: 0; }
.players li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--paper-2); }
.players li:last-child { border-bottom: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; border: 2px solid var(--ink); }
.pname { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.game-pick button { text-align: left; flex-direction: column; align-items: flex-start; min-height: 96px; }
.game-pick button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.game-pick small { font-weight: 500; opacity: .85; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.blockers { margin: 12px 0 0; padding-left: 18px; color: var(--ink-2); }

/* Spiel */
.gamebar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.gamebar .title { font: 700 1.3rem var(--serif); }
.timer { flex: 1; min-width: 180px; display: flex; align-items: center; gap: 10px; }
.timer .track { flex: 1; height: 10px; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--paper); }
.timer .fill { height: 100%; background: var(--teal); transform-origin: left; }
.timer.low .fill { background: var(--accent); }
.timer .secs { font: 700 1.1rem var(--sans); font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; }
.progress-note { font-weight: 600; color: var(--ink-2); }
.playfield { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: stretch; }
.viewer { position: relative; border: 2px solid var(--ink); border-radius: var(--radius); overflow: hidden; background: #0d0f13; min-height: 420px; box-shadow: var(--shadow); }
.viewer img.photo { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; touch-action: none; user-select: none; transform-origin: 0 0; }
.viewer-tools { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 8px; z-index: 5; flex-wrap: wrap; }
.viewer-tools .btn { background: var(--card); }
.mapwrap { display: flex; flex-direction: column; gap: 12px; }
.map-slot { min-height: 360px; }
.map-slot:empty { border: 2px dashed var(--ink-3); border-radius: var(--radius); }
.map { height: 360px; border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--paper-2); z-index: 1; }
.map-note { font-size: .85rem; color: var(--bad); font-weight: 600; }
.yearbox { display: grid; grid-template-columns: 1fr 110px; gap: 12px; align-items: center; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 32px; }
.submitted { border: 2px dashed var(--ok); color: var(--ok); border-radius: 10px; padding: 12px; font-weight: 700; text-align: center; }
.zoomed { position: fixed; inset: 0; z-index: 900; background: rgba(10,12,16,.94); display: grid; place-items: center; overflow: hidden; touch-action: none; }
.zoomed img { max-width: none; transform-origin: 0 0; user-select: none; cursor: grab; }
.zoomed .close { position: fixed; top: 14px; right: 14px; z-index: 2; }
.zoom-hint { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); color: #ddd; font-size: .85rem; z-index: 2; }
.pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--ink); display: grid; place-items: center; }
.pin span { transform: rotate(45deg); color: #fff; font: 800 10px var(--sans); }
.pin.target { background: var(--ink); border-radius: 4px; transform: none; width: 24px; height: 24px; }
.pin.target span { transform: none; font-size: 14px; }

/* Auflösung & Ergebnis */
.reveal { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.reveal .map { height: 420px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 12px 0; }
.fact { border: 2px solid var(--ink); border-radius: 8px; padding: 8px 12px; background: var(--paper); }
.fact b { display: block; font: 700 1.4rem var(--serif); font-variant-numeric: tabular-nums; }
.fact span { font-size: .8rem; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
table.results { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.results th, table.results td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--paper-2); vertical-align: top; }
table.results th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
table.results td.pts { font-weight: 800; text-align: right; } table.results th.pts { text-align: right; }
tr.me td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.thumb { width: 100%; max-height: 260px; object-fit: contain; background: #0d0f13; border-radius: 8px; border: 2px solid var(--ink); }
.source { font-size: .8rem; color: var(--ink-2); }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; margin: 8px 0 24px; }
.podium div { border: 2px solid var(--ink); border-radius: 10px 10px 0 0; background: var(--card); text-align: center; padding: 12px 8px; box-shadow: var(--shadow); }
.podium .p1 { min-height: 170px; background: var(--gold); color: #1c2230; } .podium .p2 { min-height: 130px; } .podium .p3 { min-height: 100px; }
.podium strong { display: block; font: 700 1.1rem var(--serif); overflow-wrap: anywhere; }
.podium .place { font: 800 2rem var(--serif); display: block; }
.countdown { min-height: 50vh; display: grid; place-items: center; text-align: center; }
.cd-stage { height: clamp(6rem, 22vw, 11rem); display: grid; place-items: center; }
.countdown .big { font: 800 clamp(5rem, 20vw, 10rem) var(--serif); color: var(--accent); line-height: 1; display: block; animation: pop .45s cubic-bezier(.2,.8,.3,1.2) both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Wördle */
.wordle { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 24px; align-items: start; }
.board { display: grid; grid-template-rows: repeat(6, 1fr); gap: 6px; width: min(340px, 100%); margin: 0 auto; }
.wrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wrow.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.tile { aspect-ratio: 1; display: grid; place-items: center; font: 800 clamp(1.4rem, 6vw, 2rem) var(--sans); border: 2px solid var(--ink-3); border-radius: 6px; text-transform: uppercase; position: relative; background: var(--card); }
.tile.filled { border-color: var(--ink); }
.tile.correct, .tile.present, .tile.absent { color: #fff; border-color: transparent; animation: flip .35s ease-out both; }
.tile.correct { background: var(--tile-correct); }
.tile.present { background: var(--tile-present); }
.tile.absent { background: var(--tile-absent); }
.tile.correct::after { content: "✓"; position: absolute; top: 2px; right: 5px; font-size: .6rem; }
.tile.present::after { content: "↔"; position: absolute; top: 2px; right: 4px; font-size: .6rem; }
@keyframes flip { from { transform: rotateX(90deg); } to { transform: none; } }
.keyboard { display: grid; gap: 6px; margin: 18px auto 0; max-width: 560px; }
.krow { display: flex; gap: 5px; justify-content: center; }
.key { flex: 1; min-width: 0; height: 54px; border: 2px solid var(--ink); border-radius: 6px; background: var(--card); color: var(--ink); font: 700 1rem var(--sans); cursor: pointer; padding: 0; }
.key.wide { flex: 1.6; font-size: .8rem; }
.key.correct { background: var(--tile-correct); color: #fff; } .key.present { background: var(--tile-present); color: #fff; } .key.absent { background: var(--tile-absent); color: #fff; opacity: .75; }
.wmsg { min-height: 1.6em; text-align: center; font-weight: 700; margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stats b { display: block; font: 700 1.6rem var(--serif); }
.stats span { font-size: .72rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.dist { display: grid; gap: 4px; margin-top: 12px; }
.dist div { display: grid; grid-template-columns: 16px 1fr; gap: 6px; align-items: center; font-size: .85rem; }
.dist i { display: block; background: var(--ink-3); color: #fff; font-style: normal; font-weight: 700; padding: 0 6px; text-align: right; min-width: 22px; border-radius: 3px; }
.dist i.hi { background: var(--tile-correct); }
.others { list-style: none; padding: 0; margin: 0; }
.others li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--paper-2); }

/* Hinweise */
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 1000; width: min(92vw, 460px); }
.toast { background: var(--ink); color: var(--paper); border-radius: 10px; padding: 12px 16px; font-weight: 600; box-shadow: var(--shadow); animation: up .2s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
.notice { border-left: 6px solid var(--gold); background: var(--card); padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; }
.prose { max-width: 72ch; } .prose h2 { margin-top: 1.4em; }
.prose code { background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 11px; }

@media (max-width: 980px) {
  .actions { grid-template-columns: 1fr 1fr; }
  .lobby, .playfield, .reveal, .wordle { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .actions, .games, .game-pick, .settings { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .topnav { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .conn { margin-left: auto; }
  main { padding: 16px; }
  .viewer { min-height: 300px; }
  .map { height: 300px; }
  .map-slot { min-height: 300px; }
  .reveal .map { height: 300px; }
  .key { height: 50px; font-size: .9rem; }
  .podium { gap: 6px; }
  table.results th:nth-child(3), table.results td:nth-child(3) { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Ohrwurm */
.music { max-width: 640px; }
.clip { display: flex; align-items: center; gap: 14px; }
.play-btn { min-width: 132px; }
.clip-track { flex: 1; min-width: 0; }
.clip-bar { position: relative; height: 18px; border-radius: 9px; background: var(--paper-2); overflow: hidden; border: 1px solid var(--ink-3); }
.clip-fill { position: absolute; inset: 0 auto 0 0; min-width: 4px; background: var(--teal); transition: width .35s ease; }
.clip-head { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: var(--accent); }
.clip-tick { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink-3); opacity: .45; }
.clip-tick.open { background: var(--paper); opacity: .8; }
.clip-scale { position: relative; height: 18px; margin-top: 4px; font-size: .75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.clip-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.clip-scale span:first-child { transform: none; }
.clip-scale span:last-child { transform: translateX(-100%); }
.music-guesses { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.music-guesses li { display: flex; gap: 12px; align-items: center; min-height: 38px; padding: 6px 12px; border: 1px solid var(--paper-2); border-radius: 8px; background: var(--card); }
.music-guesses li .len { width: 48px; font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: .85rem; }
.music-guesses li.now { border-color: var(--ink-2); }
.music-guesses li.ok { border-color: var(--ok); } .music-guesses li.bad { border-color: var(--bad); } .music-guesses li.skipped { color: var(--ink-3); }
.song-search { position: relative; }
.song-search input { width: 100%; }
.song-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--ink-3); border-radius: 8px; box-shadow: var(--shadow); max-height: 320px; overflow: auto; }
.song-list li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.song-list li span { font-size: .85rem; color: var(--ink-2); }
.song-list li.active, .song-list li:hover { background: var(--paper-2); }
.song-reveal { display: flex; gap: 16px; align-items: center; }
.song-reveal img { border-radius: 8px; flex: none; }
.song-reveal h2 { margin: 0; }
.reveal audio { width: 100%; }
@media (max-width: 640px) { .game-pick { grid-template-columns: 1fr 1fr; } .clip { flex-direction: column; align-items: stretch; } }
.volume { display: flex; align-items: center; gap: 6px; min-width: 170px; }
.volume input[type=range] { width: 120px; height: 24px; }
.vol-btn { min-width: 40px; padding: 4px 8px; font-size: 1.1rem; }
.reveal .row audio { flex: 1; min-width: 200px; }
