/* Quizboard – Styles für Gamemaster-Konsole und Spielbrett */

:root {
  --bg: #0d0c14;
  --bg-2: #13111e;
  --panel: #1a1829;
  --panel-2: #231f37;
  --tile-top: #2b2648;
  --tile-bot: #1c1930;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .15);
  --text: #f5f2ff;
  --muted: #a7a3c4;
  --faint: #6c688a;
  --accent: #ff7a45;
  --accent-hi: #ff9466;
  --accent-ink: #1d0c04;
  --ok: #3ee0b5;
  --bad: #ff4d6d;
  --gold: #ffd166;
  --radius: 14px;
  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, 'Segoe UI', sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%23ff7a45'/%3E%3Crect x='7' y='7' width='8' height='8' rx='2' fill='%230d0c14'/%3E%3Crect x='17' y='7' width='8' height='8' rx='2' fill='%230d0c14' opacity='.5'/%3E%3Crect x='7' y='17' width='8' height='8' rx='2' fill='%230d0c14' opacity='.5'/%3E%3Crect x='17' y='17' width='8' height='8' rx='2' fill='%230d0c14'/%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  background: var(--bg-2);
  font: 600 11px/1.6 var(--font-body);
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}
.btn kbd { background: rgba(0, 0, 0, .18); border-color: rgba(255, 255, 255, .18); color: inherit; opacity: .75; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 22px !important; }

/* ---------- Buttons & Formulare ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform .08s, background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { background: #2d2948; border-color: rgba(255, 255, 255, .24); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.ok { background: rgba(62, 224, 181, .12); border-color: rgba(62, 224, 181, .42); color: var(--ok); }
.btn.ok:hover:not(:disabled) { background: rgba(62, 224, 181, .22); border-color: var(--ok); }
.btn.bad { background: rgba(255, 77, 109, .1); border-color: rgba(255, 77, 109, .42); color: #ff8199; }
.btn.bad:hover:not(:disabled) { background: rgba(255, 77, 109, .2); border-color: var(--bad); }
.btn.ok.on { background: var(--ok); color: #04201a; border-color: var(--ok); }
.btn.bad.on { background: var(--bad); color: #2a0510; border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.big { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn.full { width: 100%; }
.icon-btn { width: 36px; height: 36px; padding: 0; flex: none; }

input[type=text], input[type=number], textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  font-size: 15px;
}
input[type=text]:focus, input[type=number]:focus, textarea:focus {
  outline: 2px solid rgba(255, 122, 69, .65);
  outline-offset: 0;
  border-color: transparent;
}
input:disabled { opacity: .45; }
textarea { resize: vertical; line-height: 1.4; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
input[type=color] {
  width: 36px; height: 36px; flex: none;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--bg-2); padding: 3px; cursor: pointer;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 7px; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 7px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 0; font-size: 15px; }

/* =====================================================================
   GAMEMASTER-KONSOLE
   ===================================================================== */

body.gm {
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 0% -10%, rgba(120, 80, 220, .18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 122, 69, .08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px 20px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(13, 12, 20, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 30px; height: 30px; flex: none; background: var(--logo) center / contain no-repeat; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.role {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(255, 122, 69, .12);
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.tabs { display: flex; gap: 3px; background: var(--panel); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tabs button {
  background: transparent; border: 0; padding: 7px 14px; border-radius: 9px;
  color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.link { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; transition: .3s; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(62, 224, 181, .18); }

main { padding: 24px 20px 60px; max-width: 1480px; margin: 0 auto; }

.page-head { margin: 4px 0 20px; }
.page-head h1 { font-family: var(--font-display); font-weight: 800; font-size: 30px; margin: 0 0 6px; letter-spacing: -.01em; }
.page-head p { margin: 0; color: var(--muted); max-width: 70ch; line-height: 1.5; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.count { font: 600 12px var(--font-body); color: var(--muted); background: var(--bg-2); padding: 2px 8px; border-radius: 99px; }

.notice {
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px; border-radius: 12px;
  background: rgba(255, 209, 102, .08); border: 1px solid rgba(255, 209, 102, .3);
  font-size: 14px;
}
.notice.ok { background: rgba(62, 224, 181, .08); border-color: rgba(62, 224, 181, .35); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }

/* ----- Vorbereitung ----- */

.setup { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; }
.setup .how { grid-column: 1 / -1; }
.team-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.stat-list { display: grid; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.stat-list div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; background: var(--bg-2); font-size: 14px; }
.stat-list span { color: var(--muted); }
.stat-list b { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 8px; line-height: 1.5; }
.setup-cta { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

/* ----- Editor ----- */

.ed-top { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.ed-top .field { flex: 1 1 260px; }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ed-actions .sep { width: 1px; height: 26px; background: var(--line-2); margin: 0 4px; }
.ed-saved { font-size: 13px; color: var(--ok); opacity: 0; transition: opacity .3s; margin-left: 6px; }
.ed-saved.show { opacity: 1; }
.ed-scroll { overflow-x: auto; padding-bottom: 10px; margin-bottom: 18px; }
.ed-grid {
  display: grid;
  grid-template-columns: 108px repeat(var(--cols), minmax(160px, 1fr));
  gap: 8px;
  min-width: calc(108px + var(--cols) * 168px);
}
.ed-corner { display: flex; align-items: flex-end; padding: 0 4px 10px; font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.ed-cat { display: flex; gap: 4px; align-items: center; }
.ed-cat input { font-weight: 700; font-family: var(--font-display); }
.ed-pts { display: flex; gap: 4px; align-items: center; }
.ed-pts input { width: 70px; padding: 8px 6px; text-align: center; color: var(--accent); font-weight: 800; font-family: var(--font-display); font-size: 16px; }
.ed-cell {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  min-height: 96px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .15s, background .15s, transform .08s;
}
.ed-cell:hover { border-color: rgba(255, 122, 69, .55); background: #1e1b31; }
.ed-cell:active { transform: translateY(1px); }
.ed-cell .q { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ed-cell .a { font-size: 12px; color: var(--ok); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-cell .a.miss { color: var(--gold); }
.ed-cell .tags { margin-top: auto; display: flex; gap: 6px; font-size: 11px; font-weight: 700; }
.ed-cell .tags span { padding: 2px 7px; border-radius: 99px; background: var(--bg-2); color: var(--muted); }
.ed-cell .tags .jk { color: var(--gold); background: rgba(255, 209, 102, .1); }
.ed-cell.empty { background: transparent; border-style: dashed; }
.ed-cell.empty .q { color: var(--faint); font-style: italic; }
.ed-cell.incomplete { border-color: rgba(255, 209, 102, .35); }
.final-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.final-grid .span2 { grid-column: 1 / -1; }

dialog {
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(640px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
dialog::backdrop { background: rgba(5, 4, 10, .7); backdrop-filter: blur(4px); }
.dlg { display: grid; gap: 14px; padding: 20px; }
.dlg header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dlg h2 { margin: 2px 0 0; font-family: var(--font-display); font-size: 20px; }
.dlg-pos { font-size: 12px; color: var(--muted); font-weight: 600; }
.dlg footer { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.dlg footer .hint { margin-right: auto; }

/* ----- Spiel ----- */

.game { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.side { display: grid; gap: 14px; position: sticky; top: 78px; min-width: 0; }
.side .btn.full { white-space: normal; text-align: center; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0 0 4px; font-family: var(--font-display); font-size: 24px; font-weight: 800; }
.panel-head p { margin: 0; font-size: 14px; }

.gm-board { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 8px; }
.gm-cat {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 54px; padding: 8px 6px; border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 1.15;
  text-transform: uppercase; letter-spacing: .03em; overflow-wrap: break-word; hyphens: auto; min-width: 0;
}
.gm-cell {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--tile-top), var(--tile-bot));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(18px, 2vw, 30px);
  color: var(--accent);
  cursor: pointer;
  transition: transform .1s, border-color .15s, box-shadow .15s;
  overflow: hidden;
  padding: 4px;
}
.gm-cell:hover { transform: translateY(-2px); border-color: rgba(255, 122, 69, .6); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); }
.gm-cell.blank { border-style: dashed; color: var(--faint); }
.gm-cell.used {
  background: var(--bg-2);
  border-color: var(--line);
  box-shadow: none;
  color: var(--faint);
  font: 600 12px var(--font-body);
}
.gm-cell .jk { position: absolute; top: 5px; right: 8px; font-size: 13px; color: var(--gold); }
.gm-cell .by { position: absolute; left: 10px; right: 10px; bottom: 7px; height: 4px; border-radius: 4px; background: var(--by); }

.qp { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; display: grid; gap: 18px; }
.qp-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 13px; font-weight: 700;
}
.chip.pts { color: var(--accent); }
.chip.joker { color: var(--gold); border-color: rgba(255, 209, 102, .4); background: rgba(255, 209, 102, .08); }
.qp-q { font-family: var(--font-display); font-size: clamp(22px, 2.3vw, 32px); font-weight: 700; line-height: 1.22; text-wrap: balance; }
.qp-img { max-width: 100%; max-height: 260px; border-radius: 12px; justify-self: start; }
.qp-a { background: rgba(62, 224, 181, .07); border: 1px dashed rgba(62, 224, 181, .45); border-radius: 12px; padding: 12px 14px; }
.qp-a.shown { border-style: solid; background: rgba(62, 224, 181, .13); }
.qp-a .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ok); font-weight: 800; }
.qp-a .val { font-size: 20px; font-weight: 700; margin-top: 4px; line-height: 1.3; }
.qp-row { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center; }
.sub-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.qp-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.qp-team {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px 10px 12px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-left: 4px solid var(--c);
}
.qp-team .nm { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-team.won { background: rgba(62, 224, 181, .09); border-color: rgba(62, 224, 181, .4); border-left-color: var(--c); }
.qp-team.lost { opacity: .6; }
.tag { font-size: 13px; font-weight: 700; padding: 4px 9px; border-radius: 99px; }
.tag.ok { color: var(--ok); background: rgba(62, 224, 181, .12); }
.tag.bad { color: #ff8199; background: rgba(255, 77, 109, .12); }
.qp-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }

.joker-box { display: grid; gap: 14px; padding: 16px; border-radius: 14px; background: rgba(255, 209, 102, .06); border: 1px solid rgba(255, 209, 102, .3); }
.joker-box h3 { margin: 0; font-family: var(--font-display); font-size: 22px; color: var(--gold); }
.joker-box p { margin: 0; color: var(--muted); line-height: 1.5; }
.joker-box .field { max-width: 260px; }
.team-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.team-pick .btn { border-left: 4px solid var(--c); }
.team-pick .btn small { color: var(--muted); font-weight: 600; }
.team-pick .btn.sel { background: var(--c); color: #0d0c14; border-color: var(--c); }
.team-pick .btn.sel small { color: rgba(13, 12, 20, .7); }
details.peek { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
details.peek summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
details.peek[open] { display: grid; gap: 12px; }

.timer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1 1 320px; }
.timer-read { font-family: var(--font-display); font-weight: 800; font-size: 20px; min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.timer-read.run { color: var(--text); }
.timer-read.warn { color: var(--bad); }
.timer-bar { flex: 1 1 80px; min-width: 60px; height: 8px; background: var(--bg-2); border-radius: 8px; overflow: hidden; margin-right: 4px; }
.timer-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; }

.stepper { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; counter-reset: st; }
.stepper li { counter-increment: st; font-size: 13px; font-weight: 700; color: var(--faint); padding: 5px 10px; border-radius: 99px; background: var(--bg-2); }
.stepper li::before { content: counter(st) ' · '; }
.stepper li.done { color: var(--ok); }
.stepper li.cur { color: var(--accent-ink); background: var(--gold); }
.wagers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.wager { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); border-left: 4px solid var(--c); }
.wager .nm { font-weight: 700; }
.wager input { grid-column: 1 / -1; }

.st {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--bg-2); border-left: 4px solid var(--c);
  margin-bottom: 8px;
}
.st .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st .sc {
  font-family: var(--font-display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums;
  background: none; border: 0; padding: 0 2px; cursor: pointer; border-radius: 6px;
}
.st .sc:hover { background: var(--panel-2); }
.st .sc.neg { color: var(--bad); }
.st .adj { grid-column: 1 / -1; display: flex; gap: 6px; }
.st .adj .btn { flex: 1; }
.stack { display: grid; gap: 8px; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 13px; color: var(--muted); max-height: 260px; overflow: auto; }
.hist li { display: flex; justify-content: space-between; gap: 10px; }
.hist li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist li > span:last-child { text-align: right; flex: none; }
.plus { color: var(--ok); font-weight: 700; }
.minus { color: var(--bad); font-weight: 700; }

.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border-left: 4px solid var(--c); font-size: 18px; }
.rank .pl { font-family: var(--font-display); font-weight: 800; color: var(--muted); width: 2ch; }
.rank .nm { flex: 1; font-weight: 700; }
.rank .sc { font-family: var(--font-display); font-weight: 800; }
.rank li:first-child { background: rgba(255, 209, 102, .08); }
.rank li:first-child .pl { color: var(--gold); }

.empty-state { text-align: center; padding: 48px 20px; }
.empty-state h2 { justify-content: center; font-size: 22px; }
.empty-state p { color: var(--muted); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

#toast {
  position: fixed; bottom: 22px; left: 50%; z-index: 100;
  transform: translate(-50%, 16px);
  max-width: calc(100vw - 32px);
  background: var(--panel-2); border: 1px solid var(--line-2);
  padding: 11px 16px; border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) {
  .game { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 860px) {
  .setup { grid-template-columns: 1fr; }
  .link { margin-left: 0; width: 100%; }
  .link .btn { margin-left: auto; }
  .final-grid { grid-template-columns: 1fr; }
  .gm-board { gap: 5px; }
  .gm-cat { font-size: 10px; min-height: 44px; padding: 6px 3px; letter-spacing: 0; }
}
@media (max-width: 520px) {
  main { padding: 18px 16px 48px; }
  .topbar { padding: 10px 16px; }
  .role { display: none; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 7px 6px; }
  .qp { padding: 16px; }
}

/* =====================================================================
   SPIELBRETT (Beamer / TV)
   ===================================================================== */

body.display {
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(1400px 760px at 50% -25%, rgba(120, 80, 220, .28), transparent 62%),
    radial-gradient(900px 600px at 105% 115%, rgba(255, 122, 69, .14), transparent 60%),
    radial-gradient(800px 600px at -5% 110%, rgba(62, 224, 181, .08), transparent 60%),
    var(--bg);
}
body.display:not(.mouse) { cursor: none; }

.d-stage {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 1.8vh;
  padding: 2.4vh 2.2vw;
}
.d-title {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: min(3vw, 4.4vh);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.d-board {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  grid-template-rows: auto repeat(var(--rows, 5), minmax(0, 1fr));
  gap: 1.1vh .9vw;
  min-height: 0;
}
.d-cat {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 10vh;
  padding: 1.2vh .8vw;
  border-radius: 1.4vh;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: min(calc(9vw / var(--cols, 5)), 3vh);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: .02em;
  overflow-wrap: break-word;
  hyphens: auto;
  min-width: 0;
}
.d-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  border-radius: 1.6vh;
  background: linear-gradient(180deg, var(--tile-top), var(--tile-bot));
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 .8vh 2vh rgba(0, 0, 0, .35);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: min(calc(17vw / var(--cols, 5)), 7.5vh);
  color: var(--accent);
  text-shadow: 0 .35vh 0 rgba(0, 0, 0, .35);
  overflow: hidden;
}
.d-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, .06) 45%, transparent 60%);
  pointer-events: none;
}
.d-cell.used {
  background: rgba(255, 255, 255, .018);
  border-color: rgba(255, 255, 255, .04);
  box-shadow: none;
}
.d-cell.used::before { display: none; }
.d-cell.used::after {
  content: '';
  position: absolute;
  left: 30%;
  right: 30%;
  bottom: 22%;
  height: .55vh;
  border-radius: 1vh;
  background: var(--by, transparent);
  opacity: .75;
}
.d-cell.active { border-color: var(--accent); box-shadow: 0 0 0 .3vh var(--accent), 0 0 4vh rgba(255, 122, 69, .45); }
.d-cell.just-used { animation: cellOut .7s ease both; }
.d-board.deal .d-cell, .d-board.deal .d-cat { animation: deal .55s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i, 0) * 28ms); }

.d-scores {
  position: relative;
  z-index: 30;
  display: flex;
  gap: 1vw;
  justify-content: center;
  transition: opacity .4s;
}
.d-score {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 24vw;
  padding: 1.3vh 1vw 1.1vh;
  border-radius: 1.6vh;
  background: rgba(22, 20, 36, .92);
  border: 1px solid var(--line);
  text-align: center;
  overflow: hidden;
}
.d-score::before { content: ''; position: absolute; inset: 0 0 auto 0; height: .6vh; background: var(--c); }
.d-score .nm { font-weight: 700; font-size: min(1.5vw, 2.6vh); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-score .val { font-family: var(--font-display); font-weight: 800; font-size: min(3vw, 5.2vh); font-variant-numeric: tabular-nums; line-height: 1.1; }
.d-score .val.neg { color: var(--bad); }
.d-score.up { animation: flashUp 1.1s ease; }
.d-score.down { animation: flashDown 1.1s ease; }
body[data-screen="intro"] .d-scores,
body[data-screen="podium"] .d-scores,
body[data-screen="intro"] .d-title { opacity: 0; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 5vh 5vw;
  background: rgba(8, 7, 14, .74);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
.overlay.show { opacity: 1; }
body[data-screen="question"] .overlay,
body[data-screen="final"] .overlay { padding-bottom: 17vh; }
body[data-screen="intro"] .overlay { background: transparent; backdrop-filter: none; }

.qcard {
  position: relative;
  width: min(1500px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3.2vh;
  padding: 5vh 4vw;
  text-align: center;
  border-radius: 3.2vh;
  background: linear-gradient(180deg, #25203f, #18152a);
  border: 1px solid var(--line-2);
  box-shadow: 0 4vh 12vh rgba(0, 0, 0, .55);
  animation: cardIn .55s cubic-bezier(.2, .9, .3, 1.15) both;
  transition: box-shadow .4s, border-color .4s;
  overflow: hidden;
}
.qcard.won { border-color: var(--win); box-shadow: 0 0 0 .5vh var(--win), 0 0 10vh color-mix(in srgb, var(--win) 35%, transparent), 0 4vh 12vh rgba(0, 0, 0, .55); }
.qmeta {
  display: flex;
  gap: 1.2vw;
  align-items: center;
  font-weight: 800;
  font-size: min(1.9vw, 3.2vh);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
}
.qmeta .pts { color: var(--accent); font-family: var(--font-display); }
.dotsep { width: .9vh; height: .9vh; border-radius: 50%; background: var(--faint); }
.qtext {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: min(4.4vw, 7.6vh);
  line-height: 1.14;
  letter-spacing: -.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.qtext.long { font-size: min(3.3vw, 5.6vh); }
.qtext.xlong { font-size: min(2.5vw, 4.3vh); }
.qimg { max-width: 100%; max-height: 36vh; border-radius: 2vh; object-fit: contain; box-shadow: 0 2vh 5vh rgba(0, 0, 0, .4); }
.qanswer:empty { display: none; }
.qanswer .ans {
  display: inline-block;
  padding: 1.8vh 2.6vw;
  border-radius: 2.2vh;
  background: rgba(62, 224, 181, .12);
  border: .25vh solid rgba(62, 224, 181, .6);
  color: var(--ok);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: min(3.4vw, 6vh);
  line-height: 1.15;
  animation: revealIn .55s cubic-bezier(.2, .9, .3, 1.3) both;
}
.qteams { display: flex; gap: .8vw; flex-wrap: wrap; justify-content: center; }
.qteams:empty { display: none; }
.qteams span { padding: .7vh 1.2vw; border-radius: 99px; font-weight: 800; font-size: min(1.6vw, 2.7vh); animation: popIn .35s ease both; }
.qteams .w { color: #ff8199; border: .2vh solid rgba(255, 77, 109, .45); text-decoration: line-through; text-decoration-thickness: .25vh; }
.qteams .win { background: var(--c); color: #0d0c14; }

.dtimer { width: min(900px, 80%); display: flex; align-items: center; gap: 1.6vw; }
.dtimer.idle { display: none; }
.dtimer .bar { flex: 1; height: 1.5vh; border-radius: 2vh; background: rgba(255, 255, 255, .08); overflow: hidden; }
.dtimer .bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ffb547); }
.dtimer .sec { font-family: var(--font-display); font-weight: 800; font-size: min(3vw, 5.2vh); min-width: 3.2ch; text-align: right; font-variant-numeric: tabular-nums; }
.dtimer.warn .bar i { background: var(--bad); }
.dtimer.warn .sec { color: var(--bad); }
.dtimer.done .sec { color: var(--bad); animation: pulse .55s ease-in-out infinite alternate; }
.dtimer.paused { opacity: .55; }

.splash { text-align: center; display: grid; gap: 2.4vh; justify-items: center; animation: splashIn .7s cubic-bezier(.2, .9, .3, 1.2) both; }
.splash .sub { font-size: min(2.4vw, 4vh); color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.splash .big {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: min(15vw, 26vh);
  line-height: .95;
  letter-spacing: -.03em;
  background: linear-gradient(90deg, var(--gold), var(--accent), #ff5c9a, #a78bfa, var(--gold));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 4s linear infinite;
  padding: 0 .1em;
}
.splash .who { font-size: min(3vw, 5vh); font-weight: 700; min-height: 1.3em; }
.splash .who b { font-family: var(--font-display); color: var(--gold); }
.tchip { display: inline-block; padding: .4vh 1.4vw; border-radius: 99px; background: var(--c); color: #0d0c14; font-weight: 800; }

.fres { display: flex; gap: 1.2vw; flex-wrap: wrap; justify-content: center; }
.fr {
  display: grid; gap: .4vh; justify-items: center;
  padding: 1.6vh 2vw; border-radius: 2vh; min-width: 14vw;
  background: rgba(255, 255, 255, .04); border: .25vh solid var(--c);
  animation: popIn .45s ease both; animation-delay: calc(var(--i) * .35s + .3s);
}
.fr .nm { font-weight: 800; font-size: min(1.8vw, 3vh); }
.fr .ic { font-family: var(--font-display); font-weight: 800; font-size: min(3.4vw, 6vh); line-height: 1; }
.fr.ok .ic, .fr.ok .w { color: var(--ok); }
.fr.no .ic, .fr.no .w { color: var(--bad); }
.fr .w { font-family: var(--font-display); font-weight: 800; font-size: min(2vw, 3.4vh); }

.intro { text-align: center; display: grid; gap: 3.6vh; justify-items: center; animation: fadeUp .8s ease both; }
.logo-big { width: 16vh; height: 16vh; background: var(--logo) center / contain no-repeat; filter: drop-shadow(0 2vh 5vh rgba(255, 122, 69, .4)); animation: bob 3.2s ease-in-out infinite; }
.intro h1 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: min(7vw, 12vh); line-height: 1; letter-spacing: -.02em; }
.intro p { margin: 0; font-size: min(2.4vw, 4vh); color: var(--muted); font-weight: 600; }
.i-teams { display: flex; gap: 1.2vw; flex-wrap: wrap; justify-content: center; max-width: 90vw; }
.i-teams span { padding: 1.2vh 2vw; border-radius: 99px; border: .3vh solid var(--c); font-weight: 800; font-size: min(2.2vw, 3.8vh); background: rgba(255, 255, 255, .03); }

.podium { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3vh; }
.podium h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: min(5vw, 8.5vh); letter-spacing: -.02em; animation: fadeUp .7s ease both; }
.pod-row { display: flex; align-items: flex-end; justify-content: center; gap: 2vw; }
.pod { width: min(19vw, 30vh); display: flex; flex-direction: column; align-items: center; gap: 1.2vh; }
.pod .nm, .pod .sc { animation: fadeUp .6s ease both; animation-delay: calc(var(--d) + .5s); text-align: center; max-width: 100%; overflow-wrap: anywhere; }
.pod .nm { font-weight: 800; font-size: min(2.3vw, 3.8vh); line-height: 1.1; }
.pod .sc { font-family: var(--font-display); font-weight: 800; font-size: min(2.8vw, 4.8vh); color: var(--muted); }
.pod.p1 .sc { color: var(--gold); }
.pod .blk {
  width: 100%;
  height: calc(var(--h) * .4vh);
  border-radius: 2.2vh 2.2vh 0 0;
  background: linear-gradient(180deg, var(--c), color-mix(in srgb, var(--c) 35%, #0d0c14));
  display: grid;
  place-items: start center;
  padding-top: 2vh;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: min(6vw, 10vh);
  color: rgba(13, 12, 20, .7);
  transform-origin: bottom;
  animation: rise .9s cubic-bezier(.2, .9, .3, 1.1) both;
  animation-delay: var(--d);
}
.pod.p1 .blk { box-shadow: 0 0 8vh color-mix(in srgb, var(--c) 45%, transparent); }
.pod-rest { display: flex; gap: 1vw; flex-wrap: wrap; justify-content: center; animation: fadeUp .6s ease 2s both; }
.pod-rest span { padding: .8vh 1.4vw; border-radius: 99px; border: .2vh solid var(--c); font-weight: 700; font-size: min(1.7vw, 2.9vh); color: var(--muted); }

.result {
  position: fixed;
  top: 5vh;
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1.4vw;
  padding: 1.8vh 2.8vw;
  border-radius: 2.4vh;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: min(3.4vw, 5.8vh);
  box-shadow: 0 2vh 6vh rgba(0, 0, 0, .5);
  animation: resultIn 2.8s ease forwards;
}
.result.good { background: var(--c); color: #0d0c14; }
.result.bad { background: #2a1220; color: #ff8fa3; border: .3vh solid var(--bad); }
.result .ic { font-size: 1.2em; line-height: 1; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 35; pointer-events: none; }

.waiting {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 5vw;
  text-align: center;
  background: var(--bg);
}
.waiting > div { display: grid; gap: 2.4vh; justify-items: center; max-width: 900px; }
.waiting h1 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: min(4.5vw, 7vh); }
.waiting p { margin: 0; color: var(--muted); font-size: min(2vw, 3vh); line-height: 1.5; }
.waiting code { background: var(--panel-2); padding: .2em .5em; border-radius: 6px; font-size: .9em; }
body.connected .waiting { display: none; }

.lost-badge {
  position: fixed; left: 50%; bottom: 2vh; z-index: 45; transform: translateX(-50%);
  padding: 1vh 1.6vw; border-radius: 99px; font-weight: 700; font-size: min(1.4vw, 2.4vh);
  background: #2a1220; color: #ff8fa3; border: 1px solid rgba(255, 77, 109, .5);
  display: none;
}
body.connected.lost .lost-badge { display: block; }

.fs-btn { position: fixed; top: 1.6vh; right: 1.4vw; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .3s; }
body.mouse .fs-btn { opacity: 1; pointer-events: auto; }

/* ---------- Animationen ---------- */

@keyframes cardIn { from { opacity: 0; transform: scale(.86) translateY(4vh); } to { opacity: 1; transform: none; } }
@keyframes splashIn { 0% { opacity: 0; transform: scale(.4) rotate(-6deg); } 70% { transform: scale(1.06) rotate(1deg); } 100% { opacity: 1; transform: none; } }
@keyframes revealIn { from { opacity: 0; transform: rotateX(80deg) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(3vh); } to { opacity: 1; transform: none; } }
@keyframes deal { from { opacity: 0; transform: translateY(2.5vh) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes cellOut { 0% { transform: scale(1); } 40% { transform: scale(.9); filter: brightness(1.6); } 100% { transform: none; } }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes shimmer { to { background-position: 300% 0; } }
@keyframes bob { 50% { transform: translateY(-1.4vh) rotate(-3deg); } }
@keyframes pulse { to { opacity: .35; } }
@keyframes flashUp { 0% { box-shadow: 0 0 0 0 rgba(62, 224, 181, 0); } 25% { box-shadow: 0 0 0 .5vh var(--ok); transform: translateY(-.8vh); } 100% { box-shadow: 0 0 0 0 rgba(62, 224, 181, 0); transform: none; } }
@keyframes flashDown { 0%, 100% { transform: none; } 15%, 45% { transform: translateX(-.6vw); box-shadow: 0 0 0 .4vh var(--bad); } 30%, 60% { transform: translateX(.6vw); } }
@keyframes resultIn {
  0% { opacity: 0; transform: translate(-50%, -4vh) scale(.8); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  18% { transform: translate(-50%, 0) scale(1); }
  82% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -2vh); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
