:root {
  --bg: #0a0a0a;
  --surface: #1a1a1a;
  --surface-hi: #262626;
  --text: #f5f5f5;
  --text-dim: #a3a3a3;
  --accent: #ef4444;
  --ok: #22c55e;
  --danger: #ef4444;
  --border: #333;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Touch-Targets: Pflichtgröße für die Bedienung am Feld. */
.btn {
  min-height: 56px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-hi);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #000; }
.btn-danger  { background: var(--danger); border-color: var(--danger); }

/* ── Kopf- und Fußzeile ──────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}
.brand img { border-radius: 8px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
}
.brand-title { font-size: 18px; font-weight: 600; }
.topnav { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.topnav a { color: var(--accent); }

.pagefoot { padding: 24px 16px; font-size: 13px; }
.legal { max-width: 720px; line-height: 1.55; }
.legal h2 { font-size: 17px; margin-top: 28px; }

/* ── Grundlayout ─────────────────────────────────────────────────────── */

main { max-width: 900px; margin: 0 auto; padding: 16px; }
main.login { max-width: 420px; }

h1 { font-size: 24px; margin: 8px 0 16px; }
h2 { font-size: 19px; margin: 24px 0 12px; }
a { color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.muted { color: var(--text-dim); }

.error {
  background: #3f1414;
  border: 1px solid var(--danger);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 16px;
}
.error ul { margin: 6px 0 0; padding-left: 20px; }

.success {
  background: #102a17;
  border: 1px solid var(--ok);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 16px;
}

/* ── Formulare ───────────────────────────────────────────────────────── */

label {
  display: block;
  margin-bottom: 14px;
  font-weight: 600;
}

input, select, textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-hi);
  color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Nebeneinander, solange Platz ist — am Feld sonst gestapelt. */
.row { display: flex; flex-wrap: wrap; gap: 14px; }
.row > label { flex: 1 1 180px; margin-bottom: 0; }
.row + .row { margin-top: 14px; }

form .btn { margin-top: 16px; }

/* ── Tabellen ────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th { color: var(--text-dim); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: none; }

/* ── Spiel-Kacheln („Meine Spiele") ──────────────────────────────────── */

.game-tiles { margin: 0; padding: 0; list-style: none; }
.game-tiles > li + li { margin-top: 12px; }

/* Die ganze Kachel ist die Tap-Fläche — am Feld wird nicht auf Links gezielt. */
.game-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.game-tile:active { background: var(--surface-hi); }
.game-tile.is-live { border-color: var(--accent); }
/* Später dran: sichtbar, damit das Team weiß, was kommt — aber kein Link. */
.game-tile.is-locked { opacity: .45; cursor: default; }
.game-tile.is-locked:active { background: var(--surface); }
/* Das aktuelle Spiel vor dem Anpfiff: deutlich als "hier tippen" markiert. */
.game-tile.is-turn:not(.is-live) { border-color: var(--text-dim); }

.tile-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 64px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface-hi);
}
.tile-field-label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.tile-field-number { font-size: 32px; font-weight: 800; line-height: 1; }
.game-tile.is-live .tile-field { background: var(--accent); }
.game-tile.is-live .tile-field-label,
.game-tile.is-live .tile-field-number { color: #000; }

.tile-main { flex: 1 1 auto; min-width: 0; }
.tile-teams { display: block; font-size: 17px; font-weight: 600; }
.tile-meta  { display: block; margin-top: 4px; font-size: 14px; color: var(--text-dim); }

.tile-state { flex: 0 0 auto; text-align: right; }
.tile-score {
  display: block;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tile-phase { display: block; font-size: 13px; color: var(--text-dim); }

/* ── Admin: Korrekturen ──────────────────────────────────────────────── */

td.warn { color: var(--danger); font-weight: 600; }
.admin-actions { white-space: nowrap; }
.admin-actions form { display: inline-block; margin: 0; }
.admin-actions form .btn { margin-top: 0; padding: 6px 12px; min-height: 0; }

/* Team-Passwort: Eingabe und Knopf nebeneinander in der Tabellenzeile. */
.pw-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.pw-form input { flex: 1 1 220px; min-width: 0; }
.pw-form .btn { margin-top: 0; }
.pw-reset { margin: 6px 0 0; }
.short-form { flex-wrap: nowrap; }
.short-form input { flex: none; width: 7em; }
.link-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}
.warn-text { color: var(--danger); font-weight: 600; }

/* Sprachumschalter "EN | DE" in der Kopfzeile. */
.lang-switch { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
.lang-switch a { text-decoration: none; }
a.small, .small { font-size: 14px; }

/* ── Kader ───────────────────────────────────────────────────────────── */

.roster-add .roster-number { flex: 0 0 110px; }
.roster-list { margin: 0; padding: 0; list-style: none; }
.roster-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.roster-list li:last-child { border-bottom: none; }
.roster-list form { margin: 0 0 0 auto; }
.roster-num { min-width: 44px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.roster-name { font-weight: 600; }

label.checkbox { display: flex; align-items: center; gap: 10px; font-weight: 500; }
label.checkbox input { width: auto; min-height: 0; }
select.ref-choice { min-height: 40px; margin-top: 0; padding: 6px 8px; }

.danger-zone { border-color: var(--danger); }
