/* Wichtelwerk – Winternacht im Weihnachtsmannwerk */
:root {
  --grund: #101b29;
  --flaeche: #182637;
  --flaeche2: #203247;
  --rand: #2d4460;
  --text: #eef3f8;
  --leise: #a3b4c7;
  --gold: #f2c14e;
  --gold-dunkel: #c99a2a;
  --rot: #e0483f;
  --gruen: #2fa35a;
  --gefahr: #ff7a6e;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(ellipse at top, #1b2c42 0%, var(--grund) 60%) fixed, var(--grund);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; }
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.leise { color: var(--leise); font-size: .92rem; margin: .25rem 0 .6rem; }
.klein { font-size: .82rem; }
.laden { text-align: center; padding: 30vh 1rem; color: var(--leise); }

button {
  background: var(--flaeche2);
  border: 1px solid var(--rand);
  border-radius: 10px;
  padding: .55rem .9rem;
  min-height: 44px;
  transition: background .15s, border-color .15s, transform .05s;
}
button:hover:not(:disabled) { border-color: var(--gold-dunkel); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button.haupt { background: var(--gold); color: #24190a; border-color: var(--gold); font-weight: 700; }
button.haupt:hover:not(:disabled) { background: #f7cf6c; }
button.gross { padding: .8rem 1.4rem; font-size: 1.05rem; width: 100%; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--gold); text-decoration: underline; }
input, select, textarea {
  background: #0d1622;
  border: 1px solid var(--rand);
  border-radius: 10px;
  padding: .6rem .75rem;
  min-height: 44px;
}
textarea { width: 100%; resize: vertical; min-height: 80px; }

.team { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .82rem; font-weight: 700; color: #fff; white-space: nowrap; vertical-align: middle; }
.team-rot { background: var(--rot); }
.team-gruen { background: var(--gruen); }
.du { font-size: .75rem; background: var(--gold); color: #24190a; border-radius: 999px; padding: 0 .45rem; font-weight: 700; }

.box { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.hinweis-karte { background: #2a3b22; border: 1px solid #4b6b3a; border-radius: 10px; padding: .7rem .85rem; margin: .7rem 0; }

/* ---------- Anmelden ---------- */
.anmelde-seite { display: grid; place-items: center; padding: 16px; }
.anmelden { width: min(380px, 100%); background: var(--flaeche); border: 1px solid var(--rand); border-radius: 16px; padding: 1.6rem 1.4rem; text-align: center; }
.anmelde-symbol { border-radius: 22px; margin-bottom: .4rem; }
.anmelden form { display: grid; gap: .6rem; text-align: left; margin-top: 1rem; }
.anmelden input { width: 100%; }
.meldung { background: #4a1f1d; border: 1px solid #8a3a33; color: #ffd9d4; border-radius: 10px; padding: .55rem .7rem; }

/* ---------- Lobby ---------- */
.lobby-seite { max-width: 720px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.titel { display: flex; gap: 14px; align-items: center; padding: 8px 0; }
.titel h1 { font-size: 2.1rem; color: var(--gold); letter-spacing: .02em; }
.titel canvas { flex: none; width: 96px; height: 104px; }
.unterzeile { margin: 0; color: var(--leise); }
.beitreten label { display: block; font-weight: 600; margin-bottom: .3rem; }
.zeile { display: flex; gap: .5rem; }
.zeile input { flex: 1; min-width: 0; }
.ich-zeile { margin: .2rem 0 .6rem; }
.lobby-liste { list-style: none; padding: 0; margin: .8rem 0; display: grid; gap: .35rem; }
.lobby-liste li { display: flex; align-items: center; gap: .55rem; background: var(--flaeche2); border-radius: 10px; padding: .5rem .7rem; }
.lobby-liste li.weg { opacity: .55; }
.lobby-liste li.leer { justify-content: center; color: var(--leise); }
.punkt { width: 9px; height: 9px; border-radius: 50%; background: #667; flex: none; }
.punkt.an { background: #5fd38a; box-shadow: 0 0 6px #5fd38a; }
.krone { margin-left: auto; color: var(--gold); font-size: .85rem; }
.computer { font-size: .72rem; background: #2d4460; color: #cfe0f2; border-radius: 999px; padding: 0 .45rem; font-weight: 600; }
.weg-knopf { margin-left: auto; min-height: 32px; min-width: 32px; padding: 0 .5rem; font-size: .85rem; }
.krone + .weg-knopf, .du + .weg-knopf { margin-left: .2rem; }
.computer-knopf { width: 100%; margin-bottom: .55rem; }
.einstellungen { display: grid; gap: .5rem; margin: .6rem 0 .9rem; }
.einstellungen label { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.einstellungen label.haken { justify-content: flex-start; }
.einstellungen input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--gold); }
.regeln summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; }
.regeln-liste { padding-left: 1.2rem; margin: .7rem 0 0; display: grid; gap: .45rem; }
.fuss { text-align: center; color: var(--leise); font-size: .85rem; }

/* ---------- Spiel ---------- */
.spiel { display: grid; grid-template-rows: auto 1fr; height: 100dvh; }
.kopf {
  position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .6rem;
  padding: .45rem .8rem .55rem; background: #0c1520; border-bottom: 1px solid var(--rand);
}
.kopf-links { display: flex; align-items: baseline; gap: .7rem; min-width: 0; }
.marke { color: var(--gold); font-weight: 800; letter-spacing: .02em; }
.phase { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uhr { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.3rem; min-width: 4ch; text-align: center; }
.uhr.knapp { color: var(--gefahr); }
.kopf-rechts { display: flex; justify-content: flex-end; align-items: center; gap: .5rem; }
.knopf-klein { min-height: 36px; padding: .2rem .7rem; }
.zeitleiste { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #1b2a3b; }
.zeitleiste > div { height: 100%; background: linear-gradient(90deg, var(--gold), #f39c4e); width: 0; transition: width .3s linear; }

.buehne { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 400px); min-height: 0; }
.kartenfeld { position: relative; min-height: 0; overflow: hidden; }
.kartenfeld canvas { display: block; touch-action: manipulation; cursor: pointer; }
.karten-info {
  position: absolute; left: 10px; bottom: 10px; right: 110px; max-width: max-content;
  background: rgba(12, 21, 32, .86); border: 1px solid var(--rand); border-radius: 10px; padding: .35rem .65rem; font-size: .9rem;
}
.karten-info:empty { display: none; }
.karten-knoepfe { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.knopf-rund { width: 44px; height: 44px; padding: 0; border-radius: 50%; background: rgba(12, 21, 32, .86); font-size: 1.15rem; }

.seite { display: flex; flex-direction: column; min-height: 0; overflow: auto; border-left: 1px solid var(--rand); background: #121e2c; }
.auftrag { padding: 1rem 1rem .6rem; border-bottom: 1px solid var(--rand); }
.wahl-liste { display: grid; gap: .45rem; }
.wahl { display: flex; justify-content: flex-start; align-items: center; gap: .5rem; text-align: left; }
.wahl small { color: var(--leise); font-size: .82rem; text-align: right; margin-left: auto; }
.knopf-bild { border-radius: 6px; background: #263a52; flex: none; }
.unter { font-size: 1rem; margin: 1rem 0 .4rem; }
.blick-liste { display: flex; flex-wrap: wrap; gap: .35rem; }
.klein-wahl { min-height: 38px; padding: .3rem .65rem; font-size: .9rem; }
.klein-wahl.an { background: #3a3215; border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.ich-chip { display: inline-flex; align-items: center; gap: .35rem; }
.chip-bild { border-radius: 6px; background: #263a52; }
.notiz-start { align-items: center; background: #2c2a17; }
.figur-titel { font-size: 1.5rem; margin-bottom: .3rem; }
.team-gross { display: inline-block; font-size: 1.2rem; font-weight: 800; margin: 0; }
.abstimmung { width: min(760px, 100%); }
.abstimmung-kopf { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.abstimmung-kopf h2 { margin: 0; }
.gross-uhr { font-size: 2.2rem; color: var(--gefahr); }
.stimm-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .55rem; margin-top: .6rem; }
.stimm-karte { display: grid; justify-items: center; gap: .3rem; background: var(--flaeche2); border: 1px solid var(--rand); border-radius: 12px; padding: .55rem; }
.stimm-karte.an { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.stimm-knoepfe { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; width: 100%; }
.team-knopf { font-weight: 800; color: #fff; border: 0; min-height: 46px; }
.team-knopf.rot { background: var(--rot); }
.team-knopf.gruen { background: var(--gruen); }
.team-knopf:disabled { opacity: .35; }
.team-knopf.an { opacity: 1; outline: 3px solid var(--gold); outline-offset: 1px; }
.eis-pause { margin: .1rem 0; padding: .45rem .7rem; border-radius: 10px; background: #1d3347; color: #cfe8ff; font-size: .88rem; }
.zuordnung-stand { font-size: .9rem; margin: 0 0 .6rem; color: var(--leise); }
.zuordnung-stand b { color: var(--text); }
.zuordnung { display: flex; align-items: center; gap: .4rem; margin-top: .25rem; font-size: .82rem; color: var(--leise); }
.zuordnung select { min-height: 36px; padding: .2rem .4rem; font-size: .9rem; flex: 1; min-width: 0; }
.zuordnung select.gesetzt { border-color: var(--gold); color: var(--gold); }
.einzelwertung { list-style: none; padding: 0; margin: 0 auto; max-width: 620px; display: grid; gap: .4rem; text-align: left; }
.einzelwertung li { display: flex; align-items: center; gap: .6rem; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; padding: .5rem .8rem; }
.einzelwertung li.ich { border-color: var(--gold); }
.einzelwertung .platz { font-size: 1.4rem; min-width: 2rem; text-align: center; }
.einzelwertung .ew-name { flex: 1; min-width: 0; display: grid; }
.einzelwertung .ew-wert { display: grid; text-align: right; }
.einzelwertung small { color: var(--leise); font-size: .78rem; }
.tipp.richtig { color: #7fe0a2; }
.tipp.falsch { color: #ffb0a8; }
.ergebnis { text-align: center; }
.ergebnis h2 { font-size: 1.6rem; margin-top: .4rem; }
.wahl.an { background: #3a3215; border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.wahl.an::before { content: "✓"; color: var(--gold); font-weight: 800; margin-right: -.2rem; }
.status { color: var(--leise); font-size: .88rem; margin: .7rem 0 0; }
.knoepfe { display: flex; gap: .5rem; margin: .7rem 0; }
.knoepfe button { flex: 1; }
.redner { background: var(--flaeche2); border-radius: 10px; padding: .7rem .85rem; margin-top: .4rem; }
.redner.aktiv { background: #2c2a17; border: 1px solid var(--gold-dunkel); }
.rednerliste { margin: .5rem 0 0; padding-left: 1.4rem; color: var(--leise); }
.kandidaten { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.kandidat { display: grid; justify-items: center; gap: .25rem; padding: .5rem .3rem; }
.kandidat.an { background: #3a3215; border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.kandidat span { font-size: .9rem; overflow-wrap: anywhere; }
.stimmen { margin: .4rem 0; padding-left: 1.2rem; }
.enttarnt-bild { margin: .4rem 0; }
.bildnis { border-radius: 10px; background: #263a52; flex: none; }

.reiter { display: flex; gap: 2px; padding: .6rem .8rem 0; position: sticky; top: 0; background: #121e2c; z-index: 1; }
.reiter button { flex: 1; border-radius: 10px 10px 0 0; border-bottom: 0; min-height: 40px; padding: .3rem .5rem; font-size: .92rem; background: transparent; }
.reiter button[aria-selected="true"] { background: var(--flaeche2); border-color: var(--rand); color: var(--gold); font-weight: 700; }
.reiter-inhalt { padding: .8rem; background: var(--flaeche2); margin: 0 .8rem .8rem; border-radius: 0 0 10px 10px; border: 1px solid var(--rand); border-top: 0; }
.notizen, .steckbriefe, .verlauf { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.notiz { display: flex; gap: .5rem; background: var(--flaeche); border-radius: 10px; padding: .5rem .6rem; font-size: .92rem; }
.notiz-hinweis { background: #2a3b22; }
.notiz-faehigkeit { background: #2c2a17; }
.symbol { flex: none; }
.leer { color: var(--leise); font-size: .9rem; }
.eigene-notiz { display: grid; gap: .3rem; margin-top: .8rem; font-size: .9rem; color: var(--leise); }
.steckbrief { display: flex; gap: .6rem; align-items: center; background: var(--flaeche); border-radius: 10px; padding: .45rem .55rem; }
.steckbrief.weg { opacity: .6; }
.sb-text { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.sb-text small { color: var(--leise); font-size: .8rem; }
.sb-text .wo { color: var(--gold); }
.fertig { color: #5fd38a; font-weight: 800; }
.verdacht { min-width: 58px; min-height: 36px; padding: .2rem .4rem; font-size: .82rem; font-weight: 700; }
.verdacht-rot { background: #4a1f1d; border-color: var(--rot); color: #ffd0cb; }
.verdacht-gruen { background: #173a24; border-color: var(--gruen); color: #c8f1d6; }
.ereignis { display: flex; gap: .5rem; font-size: .9rem; padding: .3rem .1rem; border-bottom: 1px solid #2a3d54; }
.ereignis .runde { color: var(--leise); font-size: .78rem; min-width: 2.2rem; padding-top: .1rem; }
.ereignis-alle { color: #f6e3b0; }
.ereignis-blick { color: #bcd3ea; }

.menue { position: fixed; inset: 0; z-index: 20; }
.menue-karte { position: absolute; top: 52px; right: 10px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; padding: .5rem; display: grid; gap: .35rem; min-width: 230px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.menue-karte button { text-align: left; }
.menue-karte .gefahr { color: var(--gefahr); border-color: #6a2d28; }
.vorhang { position: fixed; inset: 0; z-index: 30; background: rgba(6, 11, 18, .78); display: grid; place-items: center; padding: 16px; overflow: auto; }
.vorhang-karte { width: min(560px, 100%); background: var(--flaeche); border: 1px solid var(--rand); border-radius: 16px; padding: 1.3rem; max-height: calc(100dvh - 32px); overflow: auto; }
.team-gross { font-size: 1.9rem; padding: .5rem .8rem; border-radius: 12px; color: #fff; text-align: center; }
.team-gross.team-rot { background: var(--rot); }
.team-gross.team-gruen { background: var(--gruen); }
.ich-bild { display: flex; gap: .9rem; align-items: center; margin: .8rem 0; }
.ich-bild p { margin: 0; }
.faehigkeiten { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .5rem; }
.faehigkeit { display: grid; gap: .2rem; text-align: left; padding: .7rem .8rem; }
.faehigkeit small { color: var(--leise); }
.faehigkeit.an { background: #3a3215; border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); z-index: 40;
  background: #2b1f12; border: 1px solid var(--gold-dunkel); color: #ffe7b0; border-radius: 12px; padding: .65rem 1rem;
  max-width: calc(100% - 32px); transition: transform .25s;
}
.toast.an { transform: translate(-50%, 0); }
.verbindung { position: fixed; top: 0; left: 0; right: 0; z-index: 50; background: #6a2d28; color: #fff; text-align: center; padding: .35rem; font-size: .9rem; }

/* ---------- Finale ---------- */
.finale { max-width: 900px; margin: 0 auto; padding: 20px 16px 40px; text-align: center; }
.finale h1 { font-size: 2.3rem; color: var(--gold); margin-top: .5rem; }
.finale h1.sieg-rot { color: #ff8a80; }
.finale h1.sieg-gruen { color: #7fe0a2; }
.finale h2 { margin-top: 1.8rem; }
.wertung { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 1rem; margin: 1rem 0 1.4rem; }
.wertung canvas { width: 220px; height: 200px; }
.team-wertung { background: var(--flaeche); border-radius: var(--radius); padding: .9rem; border: 2px solid var(--rand); }
.team-rot-rand { border-color: var(--rot); }
.team-gruen-rand { border-color: var(--gruen); }
.team-wertung .zahl { font-size: 2.6rem; font-weight: 800; }
.team-wertung small { color: var(--leise); }
.aufdeckung { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; text-align: left; }
.enthuellt { display: flex; gap: .7rem; align-items: center; background: var(--flaeche); border-radius: var(--radius); padding: .6rem .7rem; border: 2px solid var(--rand); }
.enthuellt small { color: var(--leise); }
.auszeichnungen { list-style: none; padding: 0; display: grid; gap: .4rem; max-width: 560px; margin: 0 auto; text-align: left; }
.auszeichnungen li { background: var(--flaeche); border-radius: 10px; padding: .55rem .8rem; }
.auszeichnungen small { color: var(--leise); }

/* ---------- Handy ---------- */
@media (max-width: 860px) {
  .spiel { height: auto; min-height: 100dvh; grid-template-rows: auto auto; }
  .kopf { position: sticky; top: 0; z-index: 10; }
  .buehne { grid-template-columns: 1fr; }
  .kartenfeld { height: 46vh; min-height: 260px; }
  .seite { border-left: 0; overflow: visible; }
  .marke { display: none; }
}
@media (max-width: 560px) {
  .titel h1 { font-size: 1.7rem; }
  .titel canvas { width: 72px; height: 78px; }
  .wertung { grid-template-columns: 1fr 1fr; }
  .wertung canvas { grid-column: 1 / -1; grid-row: 1; justify-self: center; width: 160px; height: 145px; }
  .team-wertung .zahl { font-size: 2rem; }
  .karten-info { right: 10px; bottom: 60px; font-size: .85rem; }
}
