/* ---- Schriften ----------------------------------------------------
   Selbst ausgeliefert, nicht von Google eingebunden: die App muss offline
   laufen, und ein Font-Link würde bei jedem Start die IP jedes Mitspielers
   an Google schicken. Nur die Latin-Teilmenge (deckt Umlaute und ß ab),
   zusammen 62 KB. Neu holen mit: node tools/fetch-fonts.mjs
------------------------------------------------------------------- */
@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/anton-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/barlow-condensed-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/barlow-condensed-700.woff2') format('woff2');
}

:root {
  /* ---- Blink 180 -----------------------------------------------------
     Palette aus dem Rebranding-Entwurf („Dart App Rebranding"):
     warmes Schwarz, ein Rot, viel Weiß. Nur diese fünf Akzentwerte
     tauschen, dann zieht sich die Farbe durch Buttons, Rahmen, Diagramm
     und Hervorhebungen.
     Grün-Variante:  #35d07f / #1f7d4d / rgba(53,208,127,.13) /
                     rgba(53,208,127,.08) / #04240f
  ------------------------------------------------------------------ */
  --accent: #e5484d;
  --accent-dark: #8f2c30;
  --accent-soft: rgba(229, 72, 77, 0.16);
  --accent-faint: rgba(229, 72, 77, 0.09);
  --on-accent: #ffffff;

  /* Die Hauptaktion ist hell, nicht rot – Rot bleibt den Werten und
     Hervorhebungen vorbehalten, sonst schreit die Oberfläche. */
  --primary: #f2eeee;
  --on-primary: #17110f;

  --bg: #0a0708;
  --bg-2: #171213;
  --bg-3: #241c1e;
  --line: #2b2224;
  --line-hell: #3a3436;
  --text: #f2eeee;
  --muted: #9a8f90;
  /* Warnfarbe bewusst heller als der Akzent, damit „Achtung" trotz des
     roten Akzents noch als Achtung durchkommt. */
  --red: #ff5a5a;
  --amber: #ffc14d;
  --radius: 14px;
  --tap: 56px;
  /* Ausgegraut: Zahl ist bei allen zu und bringt nichts mehr. */
  --dead: #6f6465;
  --dead-bg: #141011;

  --font-display: 'Anton', 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-cond: 'Barlow Condensed', 'Arial Narrow', -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Buttons auf iPad/iPhone: kein Doppeltipp-Zoom, keine Textauswahl beim Halten. */
button { touch-action: manipulation; -webkit-user-select: none; user-select: none; font-family: inherit; }
/* Ohne eigenen Fokusstil ist auf dem dunklen Grund nicht zu sehen, wo man ist. */
button:focus-visible, [role="button"]:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  max-width: var(--maxw, 620px);
  margin: 0 auto;
  padding: env(safe-area-inset-top) 12px calc(12px + env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
}

h1 { font-size: 1.5rem; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Screens ---------- */
.screen { display: none; padding-bottom: 24px; }
#screen-setup.active { padding-top: 8px; }
.screen.active { display: block; }
.screen.center { min-height: 88vh; display: none; }
.screen.center.active { display: flex; flex-direction: column; justify-content: center; gap: 16px; }

.app-header { padding: 18px 4px 14px; }
.app-header.row { display: flex; align-items: center; justify-content: space-between; }
.app-header .sub { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.footer-note { text-align: center; color: var(--muted); font-size: 0.78rem; margin: 14px 0 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card.no-pad { padding: 0; overflow: hidden; }
.card.resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-color: var(--accent-dark); }
.card.resume span { display: block; font-size: 0.8rem; margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--tap);
}
.btn:active { transform: scale(0.98); }
.btn.full { width: 100%; }
.btn.big { min-height: 62px; font-size: 1.1rem; }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 0.85rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #4a2530; }
.icon-btn {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  width: 44px; height: 44px; flex: none; border-radius: 12px; font-size: 1.4rem; line-height: 1; cursor: pointer;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  /* Automatische Spalten: der Konto-Knopf kommt nur dazu, wenn die Seite von
     einem Server geladen wurde – dann rückt die Leiste von 3 auf 4. */
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
  /* Muss zu --bg passen, sonst liegt beim Scrollen ein andersfarbiger
     Streifen ueber dem Inhalt. */
  background: rgba(10, 7, 8, 0.92); backdrop-filter: blur(8px);
  padding: 8px 0; margin: 0 0 4px;
}
.nav button {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 10px; padding: 10px; font-size: 0.85rem; font-weight: 600; cursor: pointer; min-height: 44px;
}
.nav button.active { color: var(--text); border-color: var(--accent-dark); background: var(--accent-soft); }

/* ---------- Avatare ---------- */
.av {
  display: inline-block; flex: none; border-radius: 50%;
  background-size: cover; background-position: center; background-color: var(--bg-3);
  color: var(--text); font-weight: 700; text-align: center; overflow: hidden;
}
.av.init { display: inline-flex; align-items: center; justify-content: center; }
.av.sm { width: 26px; height: 26px; font-size: 0.68rem; }
.av.md { width: 46px; height: 46px; font-size: 1rem; }
.av.lg { width: 60px; height: 60px; font-size: 1.2rem; }
.av.xl { width: 96px; height: 96px; font-size: 1.9rem; }
.standings td .cell { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Aufstellung ---------- */
.roster { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.roster-item {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.roster-item.selected { border-color: var(--accent); background: var(--accent-faint); }
.roster-item .who { flex: 1; min-width: 0; }
.roster-item .nm { font-weight: 600; }
.roster-item .sm { font-size: 0.76rem; color: var(--muted); }
.roster-item .edit {
  background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer;
  width: 44px; height: 44px; flex: none;
}
.roster-item .check { color: var(--accent); font-weight: 800; opacity: 0; width: 18px; }
.roster-item.selected .check { opacity: 1; }

/* ---------- Modusauswahl ---------- */
.modes { display: flex; flex-direction: column; gap: 8px; }
.modes button {
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 12px 14px; min-height: 58px;
}
.modes button.active { border-color: var(--accent); background: var(--accent-faint); }
.modes .mt { font-weight: 700; font-size: 1rem; }
.modes .md { font-size: 0.78rem; color: var(--muted); }

/* ---------- Cricket ---------- */
.cricket-board { overflow-x: auto; }
.cr-grid { display: grid; gap: 3px; min-width: min-content; }
.cr-cell {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 4px; border-radius: 8px; background: var(--bg-2); font-variant-numeric: tabular-nums;
}
.cr-corner { background: none; }
.cr-head { flex-direction: column; font-size: 0.72rem; font-weight: 600; gap: 4px; padding: 8px 2px; }
.cr-head span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-head.act { background: var(--accent-soft); color: var(--accent); }
.cr-num { background: var(--bg-3); font-weight: 700; font-size: 0.9rem; }
/* Zu bei allen: die ganze Zeile verliert Farbe, damit klar ist, dass sie
   nichts mehr bringt. */
.cr-num.dead { color: var(--dead); background: var(--dead-bg); }
.cr-cell.cr-mark.dead,
.cr-cell.cr-mark.dead.m1,
.cr-cell.cr-mark.dead.m2,
.cr-cell.cr-mark.dead.m3 { color: var(--dead); background: var(--dead-bg); }
.cr-cell.cr-mark.dead.act { outline: none; }
.cr-mark { font-size: 1.15rem; font-weight: 700; color: var(--muted); min-height: 40px; }
.cr-mark.m1, .cr-mark.m2 { color: var(--text); }
.cr-mark.m3 { color: var(--accent); background: var(--accent-soft); }
.cr-mark.act { outline: 1px solid var(--accent); }
.cr-score { font-weight: 800; font-size: 1.05rem; background: var(--bg-3); }
.cr-score.act { color: var(--accent); }
.num-grid button.dim { color: var(--dead); border-style: dashed; }

/* ---------- Round the World ---------- */
.rtw-board { display: flex; flex-direction: column; gap: 8px; }
.rtw-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-2); border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.rtw-row.act { border-color: var(--accent); background: var(--accent-faint); }
.rtw-row .rw-main { flex: 1; min-width: 0; }
.rtw-row .rw-name { font-weight: 700; }
.rtw-row .rw-sub { font-size: 0.74rem; color: var(--muted); margin-top: 3px; }
.rtw-row .rw-bar { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.rtw-row .rw-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.rtw-row .rw-target {
  font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 68px; text-align: right;
}
.rtw-row.act .rw-target { color: var(--accent); }

.turn-label { font-size: 0.92rem; }
.turn-label b { font-weight: 700; }

/* ---------- Ranglisten ---------- */
/* Eine wischbare Zeile statt vier Reihen Kategorien. */
.chips {
  display: flex; gap: 6px; margin-bottom: 12px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }
/* Weiche Kante rechts als Hinweis, dass die Zeile weitergeht. */
.chips { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
@media (min-width: 700px) {
  /* Genug Platz: alle Kategorien sichtbar statt hinter einer Wischkante. */
  .chips { flex-wrap: wrap; overflow-x: visible; -webkit-mask-image: none; mask-image: none; }
  .chips .chip { flex: 0 0 auto; }
}
.chips .chip { flex: none; white-space: nowrap; }
.chips .chip {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 8px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; min-height: 46px;
}
.chips .chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.board-list { display: flex; flex-direction: column; }
.board-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-top: 1px solid var(--line); cursor: pointer;
}
.board-row:first-child { border-top: none; }
.board-row.top { background: var(--accent-faint); }
.board-row .pos { width: 28px; text-align: center; color: var(--muted); font-size: 0.9rem; }
.board-row .nm { flex: 1; font-weight: 600; }
.board-row .val { font-weight: 800; font-variant-numeric: tabular-nums; }
.board-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 0.9rem; }

.records { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rec { background: var(--bg-3); border-radius: 10px; padding: 10px; text-align: center; }
.rec .rt { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.rec .rv { font-size: 1.3rem; font-weight: 800; margin: 3px 0 1px; font-variant-numeric: tabular-nums; }
.rec .rn { font-size: 0.75rem; color: var(--muted); }

/* ---------- Spielstatistik ---------- */
.sum-head { text-align: center; padding: 6px 0 14px; }
.sum-title { font-size: 1.4rem; margin: 0 0 6px; text-transform: none; letter-spacing: 0; color: var(--text); }
.sum-score {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 1rem; color: var(--muted);
}
.sum-score b { font-size: 1.6rem; color: var(--text); font-variant-numeric: tabular-nums; }
.sum-score .w { color: var(--accent); font-weight: 700; }
.sum-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
.sum-card.win { border-color: var(--accent-dark); }
.sum-who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sum-who .nm { font-weight: 700; font-size: 1.05rem; }
.hint.center { text-align: center; }
#summary-actions { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 700px) {
  .sum-cards { grid-template-columns: 1fr 1fr; }
}

/* ---------- Spiel-Log ---------- */
.log-row {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center;
  padding: 10px 4px; border-top: 1px solid var(--line); font-size: 0.9rem;
}
.log-row:first-child { border-top: none; }
.log-row.tap { cursor: pointer; }
.log-row.tap:active { background: var(--bg-3); }
.log-row .lp { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.log-row .lp.right { text-align: right; }
.log-row .lp.w { color: var(--accent); font-weight: 700; }
.log-row .lp .a { font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.log-row .ls { font-weight: 800; font-variant-numeric: tabular-nums; }
.log-row .ld { grid-column: 1 / -1; font-size: 0.7rem; color: var(--muted); }

/* ---------- Spielerkarten & Profil ---------- */
.player-card { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.player-card.hidden-profile { border-style: dashed; }
.player-card .pc-main { flex: 1; min-width: 0; }
.player-card .pc-name { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.player-card .pc-stats { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.78rem; color: var(--muted); }
.player-card .pc-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.player-card .chev { color: var(--muted); font-size: 1.4rem; }

.profile-head { display: flex; align-items: center; gap: 16px; margin: 8px 0 16px; }
.profile-head h1 { font-size: 1.5rem; margin: 0 0 4px; }
.form-row { display: flex; gap: 4px; margin-top: 8px; }
.form {
  width: 22px; height: 22px; border-radius: 6px; font-size: 0.7rem; font-weight: 700;
  display: inline-grid; place-items: center;
}
.form.w { background: var(--accent-soft); color: var(--accent); }
.form.l { background: rgba(255, 90, 90, 0.15); color: var(--red); }
.pline {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.92rem;
}
.pline:first-of-type { border-top: none; }
.pline span { color: var(--muted); }
.pline span i { display: block; font-style: normal; font-size: 0.72rem; color: var(--muted); }
.pline b { font-variant-numeric: tabular-nums; font-size: 1.05rem; }

/* ---------- Profil-Dialog ---------- */
.avatar-edit { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 6px 0 14px; cursor: pointer; }
.avatar-edit .cam { font-size: 0.8rem; color: var(--accent); }
.name-input {
  width: 100%; background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 14px; font-size: 1.05rem; text-align: center; margin-bottom: 12px;
}
.name-input:focus { outline: 2px solid var(--accent-dark); }

/* ---------- Spielerliste ---------- */
.player-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.player-row { display: flex; align-items: center; gap: 8px; }
.player-row .idx {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  background: var(--bg-3); color: var(--muted);
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 700;
}
.player-row input {
  flex: 1; background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 12px; font-size: 1rem; min-height: 48px;
}
.player-row input:focus { outline: 2px solid var(--accent-dark); }
.player-row .rm {
  background: none; border: none; color: var(--muted); font-size: 1.3rem; cursor: pointer;
  width: 40px; height: 40px; flex: none;
}

/* ---------- Einstellungen ---------- */
.setting { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.setting label { font-size: 0.92rem; color: var(--muted); }
/* Auswahlkacheln im selben Stil wie die Modusauswahl */
.options { display: flex; flex-wrap: wrap; gap: 8px; }
.options button {
  flex: 1 1 0; min-width: 76px; min-height: 50px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 12px 10px; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.options button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.segmented { display: flex; background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.segmented button {
  background: none; border: none; color: var(--muted); padding: 10px 12px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer; min-height: 42px;
}
.segmented button.active { background: var(--accent); color: var(--on-accent); }
.segmented.small button { padding: 8px 14px; min-height: 44px; font-size: 0.82rem; }
.hint { font-size: 0.78rem; color: var(--muted); margin: 6px 0 0; line-height: 1.45; }

/* ---------- Tabelle ---------- */
.standings { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.standings th {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  font-weight: 600; padding: 10px 6px; background: var(--bg-3);
}
.standings td { padding: 12px 6px; text-align: center; border-top: 1px solid var(--line); }
.standings .left, .standings td.left { text-align: left; padding-left: 12px; }
.standings tr.leader td { background: var(--accent-faint); }
.standings .rank { color: var(--muted); font-size: 0.8rem; }
.standings .name { font-weight: 600; }
.standings .wins { color: var(--accent); font-weight: 700; }

/* ---------- Spielplan ---------- */
.match-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px; border-radius: 10px; background: var(--bg-3); margin-bottom: 8px;
  border: 1px solid transparent;
}
.match-row.done { background: var(--bg-2); }
.match-row.done .res { color: var(--text); }
.match-row.next { border-color: var(--accent-dark); }
.match-row .pair { flex: 1; font-size: 0.95rem; }
.match-row .pair b { font-weight: 700; }
.match-row .res { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.match-row .go {
  background: var(--accent); color: var(--on-accent); border: none; border-radius: 9px;
  padding: 9px 16px; font-weight: 700; cursor: pointer; min-height: 44px;
}
.round-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 12px 0 6px; }
.round-label:first-child { margin-top: 0; }

/* ---------- Statistik ---------- */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-card { background: var(--bg-3); border-radius: 10px; padding: 10px 12px; }
.stat-card .who { font-weight: 700; margin-bottom: 6px; }
.stat-card .line { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); padding: 2px 0; }
.stat-card .line b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Bull-Off ---------- */
.bulloff { display: grid; gap: 12px; }
.bulloff button {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius); padding: 26px; font-size: 1.35rem; font-weight: 700; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.bulloff button:active { border-color: var(--accent); }

/* Bull-Out mit mehr als zwei Spielern: die ganze Reihenfolge festlegen. */
.bulloff-order { display: flex; flex-direction: column; gap: 14px; }
.bo-list { display: flex; flex-direction: column; gap: 8px; }
.bo-row {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 10px;
}
.bo-pos {
  min-width: 28px; font-weight: 800; font-size: 1.05rem; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.bo-name { flex: 1; font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bo-mv {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; min-width: 48px; min-height: 48px; font-size: 1rem; cursor: pointer;
}
.bo-mv:active { border-color: var(--accent); }
.bo-mv[disabled] { color: var(--dead); background: var(--dead-bg); border-color: var(--dead-bg); cursor: default; }
@media (orientation: landscape) and (min-width: 700px) {
  .bo-row { padding: 12px 14px; }
  .bo-name { font-size: 1.25rem; }
  .bo-mv { min-width: 56px; min-height: 56px; font-size: 1.15rem; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .bulloff-order { gap: 8px; }
  .bo-list { gap: 6px; }
  .bo-row { padding: 4px 8px; }
  .bo-mv { min-height: 44px; min-width: 44px; }
}

/* ---------- Spiel ---------- */
.screen.game { display: none; }
.screen.game.active { display: flex; flex-direction: column; min-height: calc(100vh - 12px); min-height: calc(100dvh - 12px); }
.game-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.game-main { display: flex; flex-direction: column; min-height: 0; }
.game-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; }
.game-title { text-align: center; display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; font-weight: 600; }
.game-title .muted { font-size: 0.75rem; font-weight: 500; }

.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.pcard {
  background: var(--bg-2); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 12px 10px; text-align: center; position: relative;
}
.pcard.active { border-color: var(--accent); background: var(--accent-faint); }
.pcard .pname { font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; }
.pcard .legs { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.pcard .rest { font-size: 3.4rem; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.pcard.active .rest { color: var(--accent); }
.pcard .meta { display: flex; justify-content: center; gap: 12px; font-size: 0.72rem; color: var(--muted); }
.pcard .meta b { color: var(--text); font-variant-numeric: tabular-nums; }
.pcard .arrow { color: var(--accent); }

.checkout-bar {
  min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px; margin-bottom: 8px; flex-wrap: wrap;
}
.checkout-bar .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.checkout-bar .chip {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 10px; font-weight: 700; font-size: 0.95rem;
}
.checkout-bar .chip.first { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.checkout-bar .none { color: var(--muted); font-size: 0.85rem; }

.history {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  flex: 1; min-height: 0; overflow-y: auto; margin-bottom: 8px;
}
.history .col { display: flex; flex-direction: column; gap: 4px; }
.history .v {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  background: var(--bg-2); border-radius: 8px; padding: 6px 10px; font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.history .v .s { font-weight: 700; }
.history .v .r { color: var(--muted); font-size: 0.78rem; }
.history .v.bust .s { color: var(--red); text-decoration: line-through; }
.history .v.co .s { color: var(--accent); }

.input-area { margin-top: auto; }
.mode-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.visit-darts { display: flex; gap: 5px; }
.visit-darts .d {
  min-width: 42px; text-align: center; background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.visit-darts .d.empty { color: var(--muted); font-weight: 500; }

.pad { display: block; }
.quick-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 8px; }
.quick-row button {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 0; font-size: 0.92rem; font-weight: 600; cursor: pointer; min-height: 44px;
}
.quick-row button.miss { color: var(--red); }

.display-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; min-height: 44px; }
.score-display {
  font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.score-display.empty { color: var(--muted); }
.input-error { color: var(--red); font-size: 0.82rem; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.keypad button {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; font-size: 1.5rem; font-weight: 700; min-height: 60px; cursor: pointer;
}
.keypad button.fn { font-size: 1.3rem; color: var(--muted); }
.keypad button.ok { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-size: 1.1rem; }
.keypad button:active { background: var(--bg-3); }
.keypad button.ok:active { background: var(--accent-dark); }

.mult-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; }
.mult-row button {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; min-height: 48px; font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.mult-row button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.num-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.num-grid button {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; min-height: 52px; font-size: 1.15rem; font-weight: 700; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.num-grid button:active { background: var(--bg-3); }
.num-grid button.wide { grid-column: span 2; }
.num-grid.cricket-grid { grid-template-columns: repeat(4, 1fr); }
.num-grid .mx { color: var(--accent); font-size: 0.72em; margin-right: 2px; vertical-align: 2px; }
.num-grid button.miss { color: var(--red); }
.num-grid button.bull { color: var(--amber); }
.num-grid button.hl { outline: 2px solid var(--accent); }

/* ---------- Overlay ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(6, 9, 13, 0.86);
  display: grid; place-items: start center; padding: 16px 16px 40px; z-index: 50;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
/* Auf hohen Schirmen mittig, auf flachen von oben – sonst ragt der Dialog raus. */
@media (min-height: 620px) { .overlay { place-items: center; } }
.overlay-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; width: 100%; max-width: 380px; text-align: center;
}
.overlay-card h3 { margin: 0 0 6px; font-size: 1.4rem; }
.overlay-card p { color: var(--muted); margin: 0 0 16px; font-size: 0.9rem; }
.overlay-card .btn { margin-top: 8px; }
.overlay-card .row-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.overlay-card .row-btns.two { grid-template-columns: repeat(2, 1fr); }
.big-emoji { font-size: 3rem; margin-bottom: 6px; }

/* ---------- Sieger ---------- */
.podium { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.podium .p {
  display: flex; align-items: center; gap: 12px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
}
.podium .p.first { border-color: var(--accent); background: var(--accent-soft); }
.podium .medal { font-size: 1.5rem; width: 34px; text-align: center; }
.podium .pn { flex: 1; font-weight: 700; font-size: 1.05rem; }
.podium .pv { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 699px) and (orientation: portrait) {
  /* Höhenverteilung am Handy: Kopf, Spielstand und Eingabe stehen fest,
     der Wurfverlauf bekommt den Rest – aber nie null, sonst ist die
     Korrektur per Tipp nicht erreichbar. */
  .screen.game.active { height: calc(100dvh - 12px); min-height: 0; overflow: hidden; }
  .game-body { min-height: 0; }
  .game-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .history { flex: 1; min-height: 88px; overflow-y: auto; }
  .input-area { flex: none; margin-top: 0; }
  .pad { display: block; }
  /* Etwas flacheres Tastenfeld, damit der Verlauf zwei Zeilen behält. */
  .keypad button { min-height: 52px; }
  .display-row { min-height: 36px; margin-bottom: 6px; }
  .quick-row { gap: 5px; }
  .quick-row button { min-height: 44px; }
  .num-grid button { min-height: 48px; }
}
/* Kleine Handys (z. B. 360x800): eine Zeile Verlauf genügt, Hauptsache
   das Tastenfeld bleibt vollständig sichtbar. */
@media (max-height: 820px) and (max-width: 699px) and (orientation: portrait) {
  .pcard .rest { font-size: 2.4rem; }
  .pcard { padding: 8px; }
  .history { min-height: 44px; }
  .keypad button { min-height: 46px; font-size: 1.25rem; }
  .num-grid button { min-height: 44px; }
  .quick-row button { min-height: 44px; }
}

/* ================= Tablet / iPad ================= */
@media (min-width: 700px) and (min-height: 600px) {
  :root { --maxw: 860px; --tap: 60px; }
  body { padding-left: 20px; padding-right: 20px; }
  h1 { font-size: 1.8rem; }
  .card { padding: 18px; margin-bottom: 16px; }
  .btn.big { min-height: 70px; font-size: 1.2rem; }
  .standings { font-size: 1.05rem; }
  .standings td { padding: 15px 8px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .setting label { font-size: 1rem; }
  .segmented button { padding: 12px 18px; min-height: 50px; font-size: 0.95rem; }
  .player-row input { min-height: 54px; font-size: 1.05rem; }
  .bulloff { grid-template-columns: repeat(2, 1fr); }
  .bulloff button { padding: 48px 20px; font-size: 1.6rem; }
  .match-row { padding: 15px 14px; }
  .match-row .pair { font-size: 1.05rem; }
  .match-row .go { padding: 12px 20px; min-height: 48px; }
  .overlay-card { max-width: 460px; padding: 28px; }

  .pcard { min-height: 200px; display: flex; flex-direction: column; justify-content: center; }
  /* Cricket-Tafel und Trainingsliste auch im Hochformat mitwachsen lassen. */
  .cricket-board { flex: 1; min-height: 0; }
  .cr-grid { height: 100%; grid-auto-rows: 1fr; }
  .cr-head { font-size: 0.9rem; }
  .cr-num { font-size: 1.3rem; }
  .cr-mark { font-size: clamp(1.3rem, 3vh, 2.2rem); }
  .cr-score { font-size: 1.4rem; }
  .rtw-board { flex: 1; min-height: 0; }
  .rtw-row .rw-target { font-size: clamp(2rem, 5vh, 3.4rem); }
  .pcard .rest { font-size: 4.6rem; }
  .pcard .pname { font-size: 1.25rem; }
  .pcard .legs, .pcard .meta { font-size: 0.85rem; }
  .checkout-bar { min-height: 60px; }
  .checkout-bar .chip { font-size: 1.15rem; padding: 8px 14px; }
  .history .v { font-size: 1rem; padding: 9px 12px; }
  .quick-row button { min-height: 54px; font-size: 1.05rem; }
  .keypad button { min-height: 74px; font-size: 1.8rem; }
  .keypad button.ok { font-size: 1.3rem; }
  .mult-row button { min-height: 58px; font-size: 1.1rem; }
  .num-grid button { min-height: 64px; font-size: 1.35rem; }
  .visit-darts .d { min-width: 56px; font-size: 1rem; padding: 9px 10px; }
  .score-display { font-size: 2.8rem; }
}

/* Querformat (iPad, großes Handy quer): Stand links, Eingabe rechts.
   Nichts muss gescrollt werden, die Tasten füllen die Höhe. */
@media (orientation: landscape) and (min-width: 700px) {
  :root { --maxw: 1320px; }
  .game-body { flex-direction: row; align-items: stretch; gap: 16px; }
  .game-main { flex: 1 1 50%; min-width: 0; }
  .input-area { flex: 1 1 50%; min-width: 0; margin-top: 0; display: flex; flex-direction: column; }
  .pad { flex: 1; display: flex; flex-direction: column; gap: 8px; }
  .pad .keypad, .pad .num-grid { flex: 1; grid-auto-rows: 1fr; }
  .quick-row, .mult-row, .display-row { margin-bottom: 0; }
  .app-header { padding: 14px 4px 10px; }
  .screen.center.active { min-height: calc(100dvh - 24px); }
  /* Der Reststand ist die Zahl, die aus zwei Metern lesbar sein muss. */
  .pcard { min-height: 0; }
  .pcard .rest { font-size: clamp(3.6rem, 9vh, 6.5rem); }
  .checkout-bar .chip { font-size: clamp(1.15rem, 2.6vh, 1.9rem); padding: 8px 16px; }
  .checkout-bar .label { font-size: 0.95rem; }
  .pad .num-grid, .pad .keypad { max-height: min(560px, 100%); }
  /* Turnierseite ebenfalls zweispaltig, sonst scrollt sie über Bildschirme. */
  #screen-tournament.active { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0 16px; align-items: start; }
  #screen-tournament.active > .app-header { grid-column: 1 / -1; }
  /* Die klebende Hauptaktion braucht eigenen Grund und Platz darunter. */
  #screen-tournament [data-action="next-match"],
  #screen-tournament [data-action="to-winner"] {
    background: var(--accent); box-shadow: 0 -10px 16px var(--bg);
  }
  #screen-tournament .card:has(#schedule) { padding-bottom: 76px; }
  /* Cricket-Tafel und Trainingsliste dürfen die freie Höhe nutzen. */
  .cricket-board { flex: 1; min-height: 0; }
  .cr-grid { height: 100%; grid-auto-rows: 1fr; }
  .cr-head { font-size: 0.95rem; }
  .cr-num { font-size: 1.35rem; }
  .cr-mark { font-size: clamp(1.3rem, 3.4vh, 2.2rem); }
  .cr-score { font-size: 1.5rem; }
  .rtw-board { flex: 1; min-height: 0; overflow-y: auto; }
  .rtw-row .rw-target { font-size: clamp(2rem, 6vh, 3.8rem); min-width: 4.5ch; }
  .turn-label { font-size: 1.25rem; }
  .pad .rtw-pad-grid { flex: 1; grid-auto-rows: 1fr; }
  /* Setup und Rangliste zweispaltig, damit nichts unter die Falz rutscht. */
  #screen-setup.active { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: start; }
  #screen-setup.active > #resume-box,
  #screen-setup.active > [data-action="start-game"],
  #screen-setup.active > .footer-note { grid-column: 1 / -1; }
  #screen-boards.active { display: grid; grid-template-columns: 1.15fr 1fr; gap: 0 16px; align-items: start; }
  #screen-boards.active > .app-header,
  #screen-boards.active > #board-mode { grid-column: 1 / -1; }
  #board-chart .chart { max-height: 42vh; }
  /* Die Hauptaktion des Turniers bleibt immer sichtbar. */
  #screen-tournament [data-action="next-match"],
  #screen-tournament [data-action="to-winner"] { position: sticky; bottom: 8px; z-index: 10; }
}

/* Handy im Querformat: sehr flach, alles muss ohne Scrollen passen. */
@media (orientation: landscape) and (max-height: 560px) {
  body { padding-top: 4px; padding-bottom: 4px; }
  /* Feste Höhe statt Mindesthöhe: das Bedienfeld darf nie unter die Falz. */
  .screen.game.active { height: calc(100dvh - 8px); min-height: 0; overflow: hidden; }
  .game-header { padding: 2px 0; }
  .icon-btn { width: 44px; height: 44px; font-size: 1.2rem; }
  .game-title { font-size: 0.8rem; }
  .pcard { padding: 4px 8px; }
  .pcard .rest { font-size: clamp(1.9rem, 9vh, 2.6rem); margin: 0; }
  .pcard .legs { display: none; }
  .pcard .meta { font-size: 0.68rem; }
  .checkout-bar { min-height: 34px; padding: 4px; margin-bottom: 5px; }
  .checkout-bar .chip { padding: 3px 8px; font-size: 0.85rem; }
  .history { display: none; }
  .mode-row { margin-bottom: 4px; }
  .display-row { min-height: 30px; margin-bottom: 4px; }
  .score-display { font-size: 1.5rem; }
  .pad { display: flex; flex-direction: column; gap: 5px; height: 100%; }
  .pad .keypad, .pad .num-grid, .pad .rtw-pad-grid { flex: 1; min-height: 0; grid-auto-rows: 1fr; }
  .keypad button { min-height: 44px; font-size: 1.2rem; }
  .num-grid button { min-height: 44px; font-size: 1rem; }
  .mult-row button { min-height: 44px; }
  /* Schnellwahl als eine wischbare Zeile statt zweier Reihen – das sind
     44 px, die dem Zahlenfeld fehlen würden. */
  .quick-row {
    display: flex; gap: 4px; margin-bottom: 0; overflow-x: auto;
    scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
  }
  .quick-row::-webkit-scrollbar { display: none; }
  .quick-row button { min-height: 44px; font-size: 0.85rem; flex: 0 0 62px; }
  .turn-label { font-size: 0.9rem; }
  .rtw-row .av.md { width: 26px; height: 26px; font-size: 0.6rem; }
  .rtw-row .rw-bar { margin-top: 3px; }
  .rtw-row .rw-sub { margin-top: 1px; }
  .rtw-key { min-height: 44px; padding: 6px; }
  .rtw-key .k { font-size: 1rem; }
  .rtw-key .sub { font-size: 0.65rem; }
  .rtw-row { padding: 5px 8px; gap: 8px; }
  .rtw-row .rw-target { font-size: 1.5rem; min-width: 3.5ch; }
  .rtw-row .av.md { width: 32px; height: 32px; font-size: 0.75rem; }
  .rtw-board { overflow-y: auto; }
  /* Cricket: die Punktezeile muss sichtbar bleiben. */
  .cr-cell { padding: 2px 3px; }
  .cr-head { font-size: 0.62rem; padding: 2px; gap: 2px; }
  .cr-head .av.sm { width: 18px; height: 18px; font-size: 0.5rem; }
  .cr-mark { min-height: 26px; font-size: 0.95rem; }
  .cr-num { font-size: 0.8rem; }
  .cr-score { font-size: 0.9rem; }
  .cricket-board { flex: 1; min-height: 0; overflow: auto; }
  .bulloff button { padding: 12px; font-size: 1.1rem; gap: 6px; }
  .bulloff .av.md { width: 34px; height: 34px; }
  .visit-darts .d { padding: 4px 6px; min-width: 34px; }
}

/* ---------- Round the World: Eingabe nur für die aktuelle Zahl ---------- */
.rtw-pad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rtw-pad-grid.bull { grid-template-columns: 1fr 1fr; }
.rtw-key {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 14px; padding: 18px 10px; min-height: 84px; cursor: pointer;
}
.rtw-key:active { background: var(--bg-3); }
.rtw-key .k { font-size: 1.25rem; font-weight: 800; }
.rtw-key .sub { font-size: 0.74rem; color: var(--muted); }
.rtw-key.miss .k { color: var(--red); }
.rtw-key.bull { border-color: var(--amber); }
.rtw-key.bull .k { color: var(--amber); }
@media (min-width: 700px) and (min-height: 600px) {
  .rtw-key { min-height: 110px; }
  .rtw-key .k { font-size: 1.5rem; }
}

/* ---------- Verlaufsdiagramm ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 10px; }
.chart-legend .cl { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.chart-legend .cl i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-legend .cl b { color: var(--text); font-variant-numeric: tabular-nums; }
#board-mode { margin-bottom: 12px; }
#board-mode button { font-size: 0.9rem; }

/* ---------- Warnung, wenn nicht gespeichert werden kann ---------- */
.save-warning {
  position: sticky; top: 0; z-index: 40;
  background: #4a2530; border: 1px solid var(--red); color: var(--text);
  border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 0.85rem; line-height: 1.4;
}

/* ---------- Aufnahme korrigieren ---------- */
.history .v.tap { cursor: pointer; min-height: 44px; }
.history .v.tap:active { background: var(--bg-3); }
.edit-value {
  font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums;
  margin: 6px 0 10px; min-height: 2.4rem;
}
.edit-error { color: var(--red); font-size: 0.85rem; margin: 0 0 10px; }
.edit-pad { margin-bottom: 10px; }
.edit-pad button { min-height: 52px; font-size: 1.3rem; }
.edit-pad button.ok { font-size: 0.95rem; }

/* ---------- Spieler im Turnier ändern ---------- */
.roster-change { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; text-align: left; }
.rc-row { display: flex; align-items: center; gap: 10px; background: var(--bg-3); border-radius: 10px; padding: 8px 10px; }
.rc-row .rc-name { flex: 1; font-weight: 600; }
.rc-row .muted { font-size: 0.75rem; }
.match-row.void .pair, .match-row.void .res { color: var(--dead); }
.match-row.void .pair { text-decoration: line-through; }
.rtw-row.fin { border-color: var(--accent-dark); }
.rtw-row.fin .rw-target { color: var(--accent); }

/* ---------- Kontext: wer wirft, was bedeuten die Zeichen ---------- */
.game-turn { margin-bottom: 6px; }
.cricket-legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px;
  font-size: 0.75rem; color: var(--muted);
}
.cricket-legend b { color: var(--text); }
.form-label { font-size: 0.72rem; color: var(--muted); margin-top: 8px; }
@media (orientation: landscape) and (max-height: 560px) {
  .game-turn, .cricket-legend { display: none; }
}

/* ---------- Cricket-Eingabe: Single, Double, Triple auf einen Blick ---------- */
.cricket-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.cg-block {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; align-items: stretch;
}
.cg-block .cg-label {
  grid-column: 1 / -1; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin-bottom: -2px;
}
.cg-block button {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; min-height: 58px; font-size: 1.2rem; font-weight: 700; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.cg-block button:active { background: var(--bg-3); }
.cg-block button.dim { color: var(--dead); background: var(--dead-bg); border-color: var(--dead-bg); }
.cg-block button.dim .mx { color: var(--dead); }
.cg-block button.bull { color: var(--amber); }
.cg-block button.miss { color: var(--red); }
.cg-block button.skip { color: var(--accent); font-size: 1rem; }
.cg-block .mx { color: var(--accent); font-size: 0.72em; margin-right: 2px; vertical-align: 2px; }
.cg-extra { grid-template-columns: repeat(4, 1fr); }
.cr-mpr { font-size: 0.62rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cr-head.act .cr-mpr { color: var(--accent); }
.num-grid button.end-visit { font-size: 0.95rem; color: var(--accent); }

@media (orientation: landscape) and (min-width: 700px) {
  .cricket-grid { gap: 10px; }
  .cg-block button { min-height: 72px; font-size: 1.45rem; }
  .cg-block button.skip { font-size: 1.15rem; }
  .cg-block .cg-label { font-size: 0.8rem; }
  .cr-mpr { font-size: 0.8rem; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .cricket-grid { gap: 4px; }
  .cg-block { gap: 3px; }
  .cg-block button { min-height: 46px; font-size: 0.95rem; }
  .cg-block button.skip { font-size: 0.8rem; }
  .cg-block .cg-label { display: none; }
}

/* ---------- Cricket am Handy im Hochformat ---------- */
@media (max-width: 699px) and (orientation: portrait) {
  #screen-cricket .game-main { min-height: 0; }
  .cricket-board { flex: 1; min-height: 0; overflow: auto; }
  .cr-cell { padding: 4px 3px; }
  .cr-head { font-size: 0.66rem; padding: 4px 2px; gap: 2px; }
  .cr-head .av.sm { width: 20px; height: 20px; font-size: 0.55rem; }
  .cr-mark { min-height: 30px; font-size: 1rem; }
  .cr-num { font-size: 0.8rem; }
  .cr-score { font-size: 0.95rem; }
  .cricket-legend { font-size: 0.68rem; gap: 2px 10px; margin-top: 4px; }
  .cricket-grid { gap: 5px; }
  .cg-block { gap: 4px; }
  .cg-block button { min-height: 52px; font-size: 1.05rem; }
  .cg-block button.skip { font-size: 0.85rem; }
  .cg-block .cg-label { font-size: 0.62rem; }
}

/* ---------- Verlauf über das ganze Match ---------- */
.history .leg-sep {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 6px 2px 2px; border-top: 1px solid var(--line); margin-top: 4px;
}
.history .col > .leg-sep:first-child { border-top: none; margin-top: 0; padding-top: 0; }

/* ---------- Konto und Abgleich ---------- */

/* Schmale Zeile ganz oben: was noch nicht beim Server ist. Bewusst ruhig
   gehalten – das ist ein Hinweis, kein Alarm wie die Speicher-Warnung. */
.sync-status {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 10px; padding: 7px 12px; margin: 8px 0 0;
  font-size: 0.78rem; line-height: 1.4;
}

.konto-karte { display: flex; flex-direction: column; gap: 10px; }

.konto-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.konto-tabs button {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--muted);
  border-radius: 10px; padding: 10px; font-weight: 600; cursor: pointer; min-height: 44px;
}
.konto-tabs button.active { color: var(--text); border-color: var(--accent-dark); background: var(--accent-soft); }

.konto-feld { display: flex; flex-direction: column; gap: 4px; }
.konto-feld span { font-size: 0.78rem; color: var(--muted); }
.konto-feld input {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 12px; font-size: 1rem; font-family: inherit;
  /* 16 px verhindert, dass iOS beim Antippen ins Feld hineinzoomt. */
  min-height: var(--tap);
}

.konto-meldung {
  border-radius: 10px; padding: 10px 12px; font-size: 0.85rem; line-height: 1.4; margin: 0 0 10px;
}
.konto-meldung.fehler { background: #4a2530; border: 1px solid var(--red); color: var(--text); }
/* Erfolg darf nicht aussehen wie ein Fehler. Seit der Akzent rot ist, wäre
   ein roter Rahmen hier genau das – deshalb neutral hell statt farbig. */
.konto-meldung.ok {
  background: rgba(242, 238, 238, 0.06);
  border: 1px solid var(--line-hell);
  color: var(--text);
}

.konto-kopf { display: flex; align-items: center; gap: 12px; }
.konto-kopf .who { min-width: 0; }
.konto-kopf .nm { font-weight: 700; font-size: 1.05rem; }
.konto-kopf .sm { font-size: 0.78rem; color: var(--muted); }

.zuordnung-zeile {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.zuordnung-zeile .who { flex: 1; min-width: 0; }
.zuordnung-zeile .nm { font-weight: 600; }
.zuordnung-zeile .sm { font-size: 0.76rem; color: var(--muted); }
.zuordnung-zeile select {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px; font-size: 0.9rem; font-family: inherit;
  min-height: 44px; max-width: 55%;
}

/* Mannschaftslogo über dem Login. Auf kleinen Geräten kleiner, damit
   Formular und Tastatur noch nebeneinander Platz haben. */
.konto-logo { display: flex; justify-content: center; margin: 4px 0 16px; }
.konto-logo img {
  width: 168px; height: 168px; max-width: 62vw; max-height: 62vw;
  border-radius: 50%;
  /* Das Artwork steht auf reinem Schwarz – ein weicher Schein hebt es vom
     etwas helleren App-Hintergrund ab, ohne einen harten Rand zu ziehen. */
  box-shadow: 0 0 0 1px var(--line), 0 12px 32px rgba(0, 0, 0, 0.55);
}
@media (max-height: 680px) {
  .konto-logo img { width: 108px; height: 108px; }
  .konto-logo { margin: 0 0 10px; }
}

/* ---------- Anmeldeschranke ---------- */

/* Vor der Anmeldung gibt es nur den Anmeldebildschirm. Die Überschrift
   „Konto" fällt weg – das Logo sagt schon, wo man ist. */
body.gesperrt #screen-konto > .app-header { display: none; }
body.gesperrt #screen-konto { padding-top: 6vh; }
body.gesperrt .konto-logo img { width: 200px; height: 200px; max-width: 68vw; max-height: 68vw; }
body.gesperrt .konto-logo { margin: 0 0 22px; }
/* Die Statuszeile des Abgleichs gehört hinter die Anmeldung. */
body.gesperrt #sync-status { display: none !important; }

@media (max-height: 680px) {
  body.gesperrt .konto-logo img { width: 128px; height: 128px; }
  body.gesperrt #screen-konto { padding-top: 2vh; }
}

/* ---------- Finisher ---------- */

/* Die Zielzahl ist der Kern des Modus – sie steht groß und allein. */
.fin-zahl {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--bg-2); border: 1px solid var(--accent-dark);
  border-radius: var(--radius); padding: 10px 14px 12px; margin-bottom: 10px;
}
.fin-zahl .lbl {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
}
.fin-zahl .zahl {
  font-size: 3.2rem; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--accent);
}

.fin-liste { display: flex; flex-direction: column; gap: 6px; }
.fin-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px;
}
.fin-row.active { border-color: var(--accent); background: var(--accent-faint); }
/* Wer durch ist, tritt zurück – aber bleibt sichtbar, die anderen ziehen ja nach. */
.fin-row.fertig { opacity: 0.72; border-color: var(--accent-dark); }
.fin-row .who { flex: 1; min-width: 0; }
.fin-row .nm { font-weight: 600; }
.fin-row .sm { font-size: 0.74rem; color: var(--muted); }
.fin-row .pkt {
  min-width: 28px; text-align: center; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.fin-row .rest {
  min-width: 62px; text-align: right;
  font-size: 1.7rem; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.fin-row.fertig .rest { color: var(--accent); }

.fin-stechen { margin-top: 12px; border-color: var(--amber); }
.fin-stechen .btn { margin-top: 6px; }

/* Finish-Vorschlag über dem Zahlenfeld, wie im X01. */
.finish-hint {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  min-height: 30px; margin-bottom: 6px;
}

@media (min-width: 820px) {
  .fin-zahl .zahl { font-size: 4rem; }
  .fin-row .rest { font-size: 2rem; min-width: 74px; }
}

/* ================= Blink-180-Rebranding =================
   Aufgesetzt auf die bestehenden Regeln, damit die Geometrie unberührt
   bleibt: Touch-Ziele, iPad-Layout und Querformat sind getestet und
   sollen sich durch den neuen Anstrich nicht verschieben. Hier ändert
   sich nur, wie es aussieht – nicht, wo es steht.
   Entwurf: „Dart App Rebranding/Blink 180 Redesign v2.dc.html"
========================================================== */

/* ---------- Typografie ---------- */

/* Anton ist eine reine Versalienschrift – Kleinbuchstaben sehen darin
   falsch aus, deshalb überall dort, wo sie steht, auch uppercase. */
h1 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 400;
  font-size: 1.7rem;
}
h2 {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  color: var(--text);
  opacity: 0.86;
}

/* Zahlen sind in dieser App der Inhalt. Barlow Condensed macht sie schmal
   und damit auch dreistellig noch groß lesbar. */
.pcard .rest, .fin-zahl .zahl, .fin-row .rest, .rec .rv, .sum-score b,
.board-row .val, .cr-cell, .edit-value {
  font-family: var(--font-cond);
  font-weight: 700;
}

/* ---------- Hauptaktion ---------- */

/* Hell statt rot: Rot bleibt den Werten vorbehalten. */
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 400;
}
.btn.primary:active { background: #ffffff; }
.btn.big { letter-spacing: 0.06em; }

/* ---------- Navigation und Segmente ---------- */

.nav button {
  font-family: var(--font-cond);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9rem;
}
.nav button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.options button, .konto-tabs button, .chips .chip {
  font-family: var(--font-cond);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
}
/* Der aktive Zustand ist hell – wie in der Navigation, damit „ausgewählt"
   überall dieselbe Sprache spricht. */
.options button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.chips .chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.konto-tabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

/* ---------- Modusauswahl ---------- */

.modes .mt {
  font-family: var(--font-cond);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 1.1rem;
}

/* ---------- Wortmarke ---------- */

/* Kompakt und nur im Setup: eine dauerhafte Kopfleiste auf jedem Screen
   würde am Handy senkrecht zu viel kosten. */
.marke { display: flex; align-items: center; gap: 12px; padding: 14px 4px 6px; }
.marke img {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  border: 2px solid var(--line);
  /* Der kalte Schein aus dem Entwurf – er hebt das Logo vom warmen
     Schwarz ab, ohne einen harten Rand zu ziehen. */
  box-shadow: 0 0 18px rgba(70, 170, 215, 0.32);
}
.marke .wort {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.02em;
}
.marke .wort .rot { color: var(--accent); }
.marke .sub {
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}

@media (min-width: 820px) {
  .marke img { width: 56px; height: 56px; }
  .marke .wort { font-size: 1.9rem; }
}

/* ---------- Nachträge zum Rebranding ---------- */

/* „Ausgewählt" ist überall hell, auch beim Multiplikator – sonst leuchtet
   ein roter Balken über dem Zahlenfeld, der wie eine Warnung aussieht. */
.mult-row button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-cond);
  letter-spacing: 0.04em;
}

/* Der Finish-Vorschlag im Finisher benutzt dieselben Chips wie das X01,
   war dort aber ohne Elternklasse ungestylt. */
.finish-hint .chip {
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 10px; font-size: 0.95rem;
  font-family: var(--font-cond); font-weight: 700;
}
.finish-hint .chip.first { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Zahlenfeld und Multiplikator schmal setzen – dreistellige Reste und die
   Zahlen 1 bis 20 stehen so ruhiger nebeneinander. */
.num-grid button, .keypad button, .quick-row button {
  font-family: var(--font-cond);
  font-weight: 700;
}

@media (min-width: 820px) {
  .finish-hint .chip { font-size: 1.15rem; padding: 8px 14px; }
}
