/* Silvester-Spiele – Nachthimmel mit Gold */
:root {
  --hg: #0b1026; --hg2: #141b3d; --karte: #1b2350; --rand: #2c3670;
  --text: #f3f4ff; --leise: #a9b0d6; --gold: #ffd166; --rot: #ef476f; --gruen: #06d6a0; --blau: #4cc9f0; --lila: #b388ff;
  --r: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text);
  background: radial-gradient(ellipse at top, #1d2660 0%, var(--hg) 60%) fixed, var(--hg);
  padding-bottom: env(safe-area-inset-bottom);
}
body.mit-leiste { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: .4em 0; line-height: 1.2; }
h1 { font-size: 1.8em; } h2 { font-size: 1.3em; } h3 { font-size: 1.05em; color: var(--gold); }
[hidden] { display: none !important; }

#feuerwerk { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }
#app { max-width: 680px; margin: 0 auto; padding: 12px 14px 24px; }

/* Kopfzeile */
#kopf { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: calc(6px + env(safe-area-inset-top)) 12px 6px;
  background: rgba(11, 16, 38, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rand); }
#kopf:empty { display: none; }
.kopf-links { display: flex; align-items: center; gap: 6px; }
.kopf-logo { font-size: 1.3em; }
.kopf-code { font-weight: 800; letter-spacing: .12em; color: var(--gold); }
.mn { flex: 1; text-align: center; font-variant-numeric: tabular-nums; color: var(--gold); font-size: .9em; }
.kopf-rechts { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.kopf-ich { font-size: .9em; color: var(--leise); margin-right: 4px; white-space: nowrap; }
.kopf-ich b { color: var(--gold); }
.status { flex-basis: 100%; display: none; text-align: center; font-size: .85em; background: #5c2333; border-radius: 8px; padding: 4px 8px; }
.status.sichtbar { display: block; }

/* Knöpfe */
button { cursor: pointer; border: 1px solid var(--rand); background: var(--hg2); border-radius: var(--r); padding: 12px 16px; min-height: 48px;
  transition: transform .06s, background .15s; touch-action: manipulation; }
button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; }
button.primaer { background: linear-gradient(180deg, #ffd166, #f4a93b); color: #2a1a00; border-color: #ffd166; font-weight: 700; }
button.gross { width: 100%; font-size: 1.1em; margin-top: 10px; }
button.leise { background: transparent; color: var(--leise); }
button.warnung { color: #ffb3c1; }
button.icon { min-height: 40px; min-width: 40px; padding: 4px 8px; background: transparent; border-color: transparent; font-size: 1.15em; }

/* Formulare */
label { display: block; font-size: .9em; color: var(--leise); margin: 12px 0 4px; }
input:not([type=checkbox]), select, textarea { width: 100%; background: #0f1534; border: 1px solid var(--rand); border-radius: 10px; padding: 12px; font-size: 1.05em; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.code-eingabe { text-transform: uppercase; letter-spacing: .4em; font-weight: 800; text-align: center; font-size: 1.6em !important; }
.schalter { display: flex; align-items: center; gap: 10px; color: var(--text); cursor: pointer; }
.schalter input { width: 24px; height: 24px; accent-color: var(--gold); flex: none; }
.feld { display: flex; align-items: center; gap: 10px; }
.feld span { flex: 1; color: var(--text); }
.feld select { width: auto; min-width: 48%; padding: 8px; }
.eingabe { display: flex; gap: 8px; margin-top: 10px; }
.eingabe input { flex: 1; }
.fehler { color: #ff8fa3; min-height: 1.2em; margin: 8px 0 0; }
textarea { resize: vertical; }

/* Karten, Texte */
.karte { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--r); padding: 14px; margin: 12px 0; }
details.karte summary { cursor: pointer; color: var(--leise); }
.klein { font-size: .85em; color: var(--leise); }
.mitte { text-align: center; }
.info { text-align: center; color: var(--leise); margin: 14px 0; }
.gross-text { font-size: 1.3em; margin-top: 30vh; }
.blass { opacity: .45; }

/* Start */
.start-kopf { text-align: center; padding: 20px 0 6px; }
.logo { font-size: 3.2em; }
.unter { color: var(--leise); margin: 0; }
.avatare { display: flex; flex-wrap: wrap; gap: 6px; }
.ava { min-height: 44px; min-width: 44px; padding: 4px; font-size: 1.5em; background: transparent; }
.ava.aktiv { background: #3a3f7a; border-color: var(--gold); }

/* Lobby */
.raum { text-align: center; }
.raum-code { font-size: 3em; font-weight: 900; letter-spacing: .25em; color: var(--gold); padding-left: .25em; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.kachel { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; }
.kachel.aktiv { border-color: var(--gold); background: #2b2f63; box-shadow: 0 0 0 2px var(--gold) inset; }
.kachel-emo { font-size: 1.8em; }
.willkommen { text-align: center; margin-top: 20px; }
.gross-ava { font-size: 3.5em; line-height: 1.1; }
ul.spieler, ul.liste, ul.worte { list-style: none; margin: 0; padding: 0; }
ul.spieler li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--rand); }
ul.spieler li:last-child { border: 0; }
ul.spieler li.offline { opacity: .5; }
.ava-klein { font-size: 1.4em; }
.sp-name { flex: 1; }
.rangliste ol { list-style: none; margin: 0; padding: 0; }
.rangliste li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--rand); }
.rangliste li:last-child { border: 0; }
.rangliste li.ich, ul.liste li.ich { color: var(--gold); }
.platz { width: 2em; text-align: center; }

/* Spiel */
.spiel-titel { display: flex; justify-content: space-between; color: var(--leise); font-size: .9em; margin: 4px 0 8px; }
.uhr { position: relative; height: 34px; border-radius: 17px; background: #0f1534; border: 1px solid var(--rand); overflow: hidden; margin-bottom: 12px; }
.uhr-balken { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--blau), var(--gruen)); transition: width .2s linear; }
.uhr.knapp .uhr-balken { background: linear-gradient(90deg, var(--rot), #ff8c42); }
.uhr-zahl { position: relative; text-align: center; line-height: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.frage { font-size: 1.35em; font-weight: 700; text-align: center; margin: 14px 0 18px; }
.vorfrage { text-align: center; color: var(--gold); margin-top: 10px; }
.einheit { text-align: center; color: var(--leise); margin-top: -8px; }
.antworten { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.antw { display: flex; align-items: center; gap: 10px; text-align: left; padding: 14px 12px; min-height: 76px; border-radius: var(--r); border: 2px solid transparent; font-size: 1.05em; color: #fff; }
.antw b { font-size: 1.2em; opacity: .8; }
.antw .anzahl { margin-left: auto; font-weight: 700; }
.antw.f0 { background: #c43a5a; } .antw.f1 { background: #2f6fd6; } .antw.f2 { background: #c98a12; } .antw.f3 { background: #1f9d74; }
.antw.gewaehlt { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
.antw.richtig { opacity: 1; border-color: #fff; box-shadow: 0 0 18px rgba(6, 214, 160, .8); }
.ergebnis { text-align: center; font-size: 1.2em; font-weight: 700; margin: 16px 0; padding: 12px; border-radius: var(--r); background: var(--karte); }
.ergebnis.gut { background: #0e4d3d; color: #b8ffe9; }
.ergebnis.schlecht { background: #4d1626; color: #ffd0da; }
.fertig { text-align: center; margin: 16px 0; }
.fertig-avas { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; font-size: 1.6em; margin-top: 4px; }
.fertig-avas .fa { filter: grayscale(1); opacity: .35; transition: all .3s; }
.fertig-avas .fa.ja { filter: none; opacity: 1; transform: scale(1.1); }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #2a3168; border-radius: 99px; padding: 2px 10px 2px 4px; margin: 2px; white-space: nowrap; }
.chip-ava { font-size: 1.2em; }
ul.liste li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--rand); flex-wrap: wrap; }
ul.liste li:last-child { border: 0; }
ul.liste li b { margin-left: auto; color: var(--gold); }
.tipp { font-weight: 700; }
.loesung { text-align: center; margin: 10px 0; }
.loesung-wert { font-size: 2.2em; font-weight: 900; color: var(--gold); }
.gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 12px 0; }
.person { display: flex; align-items: center; gap: 8px; text-align: left; }
.person-ava { font-size: 1.5em; }
.person.gewaehlt { border-color: var(--gold); background: #4a3f1a; }
.knopfreihe { display: flex; gap: 8px; margin-top: 10px; }
.knopfreihe > * { flex: 1; }
.balken { flex: 1; height: 14px; background: #0f1534; border-radius: 7px; overflow: hidden; }
.balken-fuell { height: 100%; background: linear-gradient(90deg, var(--gold), var(--rot)); }
.stimmzeile { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.sieger { text-align: center; font-size: 1.4em; font-weight: 800; margin: 14px 0; }
.sieger-krone { font-size: 2.2em; }
.intro { text-align: center; padding-top: 20px; }
.intro-emo { font-size: 4em; }
.regeln { font-size: 1.1em; }
.dran { text-align: center; margin: 20px 0; }
.wortkarte { text-align: center; font-size: 2.4em; font-weight: 900; padding: 30px 10px; margin: 10px 0; border-radius: var(--r);
  background: linear-gradient(135deg, #3b2a7a, #1b2350); border: 2px solid var(--gold); word-break: break-word; hyphens: auto; }
ul.worte li { padding: 4px 0; }
.zitat { font-size: 1.4em; font-style: italic; text-align: center; margin: 16px 0; padding: 18px; background: var(--karte); border-left: 4px solid var(--gold); border-radius: var(--r); }
.luecke { color: var(--gold); }
.optionen { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.option { text-align: left; padding: 14px; border-radius: var(--r); background: var(--karte); border: 2px solid var(--rand); font-size: 1.1em; }
.option.gewaehlt { border-color: var(--gold); background: #4a3f1a; }
.option.richtig { border-color: var(--gruen); background: #0e4d3d; }
.option-text { font-weight: 700; }
.vorschau { text-align: center; margin-top: 6px; }
input.zahl { font-size: 1.4em; text-align: center; }

/* Spielleiter-Leiste */
#leiste { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(11, 16, 38, .96); border-top: 1px solid var(--rand); }
#leiste:empty { display: none; }
#leiste button { flex: 1; font-size: 1.05em; }
#leiste button.leise { flex: 0 0 56px; }

/* Dialoge */
.dialog-hg { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; padding: 14px; }
.dialog { background: var(--hg2); border: 1px solid var(--rand); border-radius: var(--r); padding: 16px; width: 100%; max-width: 420px; max-height: 92vh; overflow: auto;
  display: flex; flex-direction: column; gap: 8px; }
.dialog.breit { max-width: 640px; }
.dialog b { word-break: break-all; }
.eigene { margin-bottom: 6px; }
.eigene textarea { margin-top: 4px; font-size: .95em; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; z-index: 70;
  background: #2a3168; border: 1px solid var(--gold); padding: 10px 16px; border-radius: 99px; transition: all .25s; max-width: 90vw; text-align: center; }
#toast.zeigen { opacity: 1; transform: translateX(-50%); }

/* Mitternacht */
#mitternacht { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(5, 8, 24, .88); text-align: center; cursor: pointer; }
.mn-zahl { font-size: min(40vw, 40vh); font-weight: 900; color: var(--gold); line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 0 40px rgba(255, 209, 102, .6); }
.mn-text { font-size: 2em; font-weight: 800; }
.mn-hinweis { color: var(--leise); margin-top: 20px; font-size: .9em; }
#mitternacht.puls .mn-zahl { animation: puls 1s infinite; }
@keyframes puls { 0% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* Großer Bildschirm (Fernseher/Laptop) */
body.tv { font-size: clamp(18px, 2.1vw, 34px); }
body.tv #app { max-width: 1400px; }
body.tv .frage { font-size: 1.8em; }
body.tv .antw { min-height: 3.5em; font-size: 1.2em; }
body.tv .uhr { height: 1.8em; border-radius: .9em; }
body.tv .uhr-zahl { line-height: 1.7em; }
body.tv .tv-beitritt { text-align: center; margin-top: 4vh; font-size: 1.3em; }
body.tv .tv-url { font-size: 1.6em; font-weight: 800; color: var(--blau); margin-bottom: .6em; }
body.tv .tv-code { font-size: 4em; font-weight: 900; letter-spacing: .3em; color: var(--gold); padding-left: .3em; }
body.tv .fertig-avas { font-size: 2.2em; }
body.tv .gross-ava { font-size: 5em; }
body.tv .spieler { display: flex; flex-wrap: wrap; gap: 10px 24px; }
body.tv ul.spieler li { border: 0; }
@media (min-width: 900px) {
  body.tv #live { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
