:root {
  --bg: #111418;
  --card: #1b2027;
  --card-2: #232a33;
  --line: #2e3742;
  --text: #eef2f6;
  --muted: #93a1b0;
  --accent: #4a9eff;
  --accent-2: #2b7be0;
  --good: #47c97e;
  --bad: #ff6b6b;
  --bock: #f0a63a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Muss die display-Regeln weiter unten schlagen, sonst bleibt z.B. das
   Ergebnis-Overlay trotz hidden-Attribut sichtbar. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app { max-width: 520px; margin: 0 auto; padding: 20px 16px 40px; }

h1 { font-size: 30px; margin: 12px 0 4px; }
h2 { font-size: 22px; margin: 0 0 4px; }
h3 { font-size: 15px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.lead { color: var(--muted); margin: 0 0 20px; }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.error { color: var(--bad); font-size: 15px; margin: 12px 0 0; }
.label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 500; }
.btn-small { padding: 11px 14px; font-size: 15px; }
.actions { margin-top: 18px; }

/* Eingaben */
input {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}
input::placeholder { color: #5c6875; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.name-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.name-row .num { width: 22px; color: var(--muted); font-variant-numeric: tabular-nums; }
.name-row .del {
  flex: none; width: 44px; height: 48px; border: 1px solid var(--line);
  border-radius: 12px; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer;
}

.code-input, .points-input {
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: .18em;
  font-variant-numeric: tabular-nums;
  padding: 18px 12px;
}
.points-input { letter-spacing: normal; }

/* Kopf des Spielbildschirms */
.game-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.game-head .right { text-align: right; }
.code { font-size: 30px; font-weight: 700; letter-spacing: .14em; font-variant-numeric: tabular-nums; }
.round { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

.bock-banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--bock);
  border-radius: 12px;
  background: rgba(240, 166, 58, .12);
  color: var(--bock);
  font-weight: 600;
  font-size: 15px;
}

/* Spielerliste */
.players { list-style: none; margin: 0 0 20px; padding: 0; }
.players li {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.players .name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players .score { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.players .score.pos { color: var(--good); }
.players .score.neg { color: var(--bad); }
.players li.out { opacity: .55; }

.tag {
  flex: none; width: 26px; height: 26px; line-height: 24px; text-align: center;
  border-radius: 8px; font-size: 13px; font-weight: 700;
}
.tag-g { background: var(--accent); color: #06101d; }
.tag-a { background: var(--bock); color: #201302; }

/* Gewinnerauswahl */
.pick { list-style: none; margin: 14px 0 0; padding: 0; }
.pick li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; margin-bottom: 10px;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--card); font-weight: 600; cursor: pointer;
}
.pick li.on { border-color: var(--good); background: rgba(71, 201, 126, .14); }
.pick li .check { color: var(--good); font-weight: 700; visibility: hidden; }
.pick li.on .check { visibility: visible; }

/* Punkte-Schnellwahl */
.quick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; }
.quick button {
  padding: 12px 0; border: 1px solid var(--line); border-radius: 11px;
  background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.quick button.on { border-color: var(--accent); background: rgba(74, 158, 255, .18); }

/* Verlauf */
.history { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.history ul { list-style: none; margin: 0 0 12px; padding: 0; }
.history li {
  display: flex; gap: 10px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.history li:last-child { border-bottom: none; }
.history .r { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 30px; }
.history .w { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .p { font-weight: 700; font-variant-numeric: tabular-nums; }
.history .p.bock { color: var(--bock); }

/* Ergebnis-Overlay */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(8, 10, 13, .72);
  display: flex; align-items: flex-end; justify-content: center;
  overflow-y: auto;
}
.sheet {
  width: 100%; max-width: 520px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 22px 16px calc(26px + env(safe-area-inset-bottom));
}
@media (min-height: 700px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 20px; border: 1px solid var(--line); margin: 16px; }
}
