/* Court-Bedienung: für Tablets und Smartphones am Spielfeld, große Touch-Flächen */
body { min-height: 100vh; font-size: 16px; line-height: 1.4; padding-bottom: env(safe-area-inset-bottom); }
.muted { color: var(--text-2); }
[hidden] { display: none !important; }

/* Kopfzeile nachtblau wie die Seitenleiste der Steuerung */
.cbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px; background: #00021a; color: #f3f6fd; color-scheme: dark;
  border-bottom: 1px solid rgba(132, 148, 235, 0.16);
}
.cbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cbar-logo { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; padding-right: 14px; border-right: 1px solid rgba(132, 148, 235, 0.2); text-decoration: none; }
.cbar-logo img { display: block; width: auto; height: 26px; }
.cbar-logo span { padding-left: 0.16em; font-size: 9px; line-height: 1; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; color: #ffe156; }
.cbar-title { display: grid; min-width: 0; }
.cbar-title strong { font-size: 20px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbar-title span { font-size: 13px; color: #a3abc2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbar-actions { display: flex; align-items: center; gap: 10px; }
.cbar .btn-ghost { color: #dfe9fb; }
.cbar .btn-ghost:hover { background: #0d1650; }
.cbar .whoami { color: #a3abc2; }
.cbar .push-toggle, .cbar .ctheme { border-color: rgba(132, 148, 235, 0.2); background: transparent; color: #a3abc2; }
.cbar .push-toggle[data-state='on'] { color: #8494eb; border-color: #8494eb; background: rgba(132, 148, 235, 0.14); }
.ctheme { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; border: 1px solid; cursor: pointer; }
.conn i { display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--live); }
.conn.ok i { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }

.cview > * { min-width: 0; }
.cview { max-width: 900px; margin: 0 auto; padding: 18px 16px 100px; display: grid; gap: 18px; } /* unten Platz für den SOS-Knopf */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-cta { background: var(--cta); border-color: var(--cta); color: var(--cta-text); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 14px; }
.btn-block { width: 100%; min-height: 52px; font-size: 18px; }

.badge { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.badge-live { background: var(--live); color: #fff; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

.card, .cgame, .clist {
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow);
}

/* Anmeldung */
.clogin { padding: 28px; display: grid; gap: 14px; width: 100%; max-width: 420px; margin: 40px auto; box-sizing: border-box; }
.clogin h1 { margin: 0; font-size: 26px; color: var(--heading); overflow-wrap: anywhere; }
.clogin p { margin: 0; }
.clogin input {
  min-width: 0; width: 100%; box-sizing: border-box;
  font: inherit; font-size: 34px; letter-spacing: 0.4em; text-align: center; padding: 12px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--field); color: var(--text);
}
.clogin input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent); }
.cerror { color: var(--live); font-weight: 600; }

.cempty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.cempty h2 { color: var(--text); margin: 0 0 6px; }

/* Aktuelles Spiel: farbiges Band oben zeigt den Status – auch aus der Entfernung erkennbar */
.cgame { padding: 20px; display: grid; gap: 18px; overflow: hidden; }
.cband {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -20px -20px 0; padding: 12px 20px;
  background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 650;
}
.cband-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; font-size: 13px; }
.cband-status i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; animation: cpulse 1.4s ease-in-out infinite; }
.cband-info { color: inherit; opacity: 0.85; }
.cgame.live { border-color: color-mix(in srgb, var(--live) 55%, var(--border)); }
.cgame.live .cband { background: var(--live); color: #fff; }
.cgame.awaiting .cband, .cgame.deferred .cband { background: var(--warn-soft); color: var(--warn); }
.cgame.awaiting, .cgame.deferred { border-color: var(--warn); }
@keyframes cpulse { 50% { opacity: 0.35; } }
.cteams { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* Vor dem Anpfiff: Paarung groß, dazwischen „gegen“ */
.cteams.preview { grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 0 4px; }
.cvs { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.cteam { font-size: clamp(20px, 5vw, 34px); font-weight: 800; text-align: center; line-height: 1.15; overflow-wrap: anywhere; }
.cteam.ph { color: var(--text-3); font-style: italic; font-weight: 600; }

.cscore { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.csep { font-size: 40px; font-weight: 800; color: var(--text-3); }
.counter { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.cval { min-width: 2ch; text-align: center; font-size: clamp(48px, 13vw, 96px); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.cbtn {
  height: clamp(56px, 14vw, 84px); border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 36px; font-weight: 700; cursor: pointer;
  touch-action: manipulation; min-width: 0; padding: 0;
}
.cbtn.plus { background: var(--primary); border-color: var(--primary); color: #fff; }
.cbtn:disabled { opacity: 0.35; cursor: not-allowed; }
.cbtn:active:not(:disabled) { transform: scale(0.96); }

.cparts { display: grid; gap: 10px; }
.cpart { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 10px; align-items: center; }
.cpart .cval { font-size: 44px; }
.cpart .cbtn { height: 52px; font-size: 26px; }
.cpart-name { font-weight: 700; color: var(--text-2); font-size: 14px; }
.cpart.total { border-top: 1px solid var(--border); padding-top: 10px; }
.cpart.total b { text-align: center; font-size: 32px; }

.cnote { margin: 0; text-align: center; color: var(--text-2); font-weight: 600; }
.cdecision { display: grid; gap: 10px; padding: 14px; border-radius: 12px; background: var(--warn-soft); }
.cdecision .cnote { color: var(--warn); }
.cdec-row { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 10px; align-items: center; font-weight: 700; font-size: 14px; }
.cdec-row .cval { font-size: 40px; }
.cdec-row .cbtn { height: 50px; font-size: 24px; }

.cactions { display: flex; gap: 10px; }
.cbig { flex: 1; min-height: 64px; font-size: 19px; border-radius: 14px; }
/* Selten gebraucht und nicht direkt neben „Abpfiff“: Anpfiff zurücknehmen */
.clink {
  justify-self: center; margin-top: -8px; padding: 6px 12px; border: 0; background: none; color: var(--text-3);
  font: inherit; font-size: 14px; font-weight: 600; text-decoration: underline; cursor: pointer;
}

/* Listen */
.clist { padding: 14px 16px; display: grid; gap: 6px; }
.clist h2 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.crow { display: grid; grid-template-columns: 56px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); font-size: 15px; }
.crow:first-of-type { border-top: 0; }
.crow b { font-variant-numeric: tabular-nums; color: var(--text-2); }
.crow small { color: var(--text-3); }
.crow em { font-style: normal; color: var(--warn); font-weight: 700; font-size: 13px; }
.crow.deferred span { color: var(--warn); }

.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; transition: opacity 0.3s; }
.toast.error { background: var(--live); color: #fff; }
.toast.out { opacity: 0; }

/* Schiedsrichter-Anmeldung & Court-Auswahl */
.clogin[data-mode="user"] input { font-size: 18px; letter-spacing: normal; text-align: left; padding: 12px 14px; }
.cseg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.cseg button {
  min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font: inherit; font-weight: 600; cursor: pointer;
}
.cseg button.active { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.whoami { font-size: 14px; font-weight: 600; color: var(--text-2); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpicker h1 { margin: 0 0 4px; font-size: 24px; }
.cpicker > p { margin: 0 0 14px; }
.cpicker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cpick {
  display: grid; gap: 6px; text-align: left; padding: 18px; min-height: 96px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); font: inherit;
}
a.cpick { text-decoration: none; }
.cpick strong { font-size: 24px; }
.cpick span { font-size: 14px; color: var(--text-2); }
.cpick:hover, .cpick:focus-visible { border-color: var(--primary); }
#switchCourt { white-space: nowrap; }
#switchCourt .narrow { display: none; }
/* Betreiber unten auf der Seite */
.cview > .ecs-credit { justify-content: center; padding: 8px 0 0; }
@media (max-width: 560px) {
  .whoami { display: none; }
  .cbar-logo { display: none; }
  .cbar { padding: 10px 12px; }
  .cbar-actions { gap: 4px; }
  #switchCourt { padding: 0 8px; }
  #switchCourt .wide { display: none; }
  #switchCourt .narrow { display: inline; }
  /* Handy: Zahl oben, −/+ darunter – passt auch bei schmalen Bildschirmen */
  .cgame { padding: 16px 14px; }
  .cband { margin: -16px -14px 0; padding: 11px 14px; }
  .cbig { font-size: 17px; }
  .counter { grid-template-columns: 1fr 1fr; row-gap: 8px; }
  .counter .cval { grid-column: 1 / -1; grid-row: 1; }
  .cscore { gap: 8px; }
  .cpart, .cdec-row { grid-template-columns: 64px 1fr 1fr; gap: 8px; }
  .cpart-name { font-size: 13px; }
}

/* --- Eingabe je Sportart --------------------------------------------------- */
.clegs { text-align: center; font-weight: 700; color: var(--text-2); font-size: 15px; }
.clegs b { font-size: 24px; color: var(--text); font-variant-numeric: tabular-nums; }
.clegs small { display: block; font-weight: 500; font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.csets, .darts { display: grid; gap: 12px; }
.setlist { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.setlist span {
  padding: 4px 12px; border-radius: 99px; background: var(--surface-2); border: 2px solid transparent;
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.setlist span small { color: var(--text-3); font-weight: 600; margin-right: 2px; }
.setlist span.open { border-color: var(--accent); }
.cdisc { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.cdisc h3 { margin: 0; font-size: 16px; }
.cdisc h3 small { color: var(--text-3); font-weight: 500; margin-left: 4px; }

/* Basketball: +1 / +2 / +3 */
.csteps { display: grid; gap: 4px; }
.counter.steps .csteps .cbtn { height: auto; min-height: 34px; font-size: 17px; }

/* Nur Ergebnis */
.coutcome { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.coutcome-btn { min-height: 64px; font-size: 18px; white-space: normal; line-height: 1.2; }
.coutcome-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Darts */
.dplayers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dplayer {
  display: grid; justify-items: center; gap: 3px; padding: 12px 8px; border-radius: 14px; min-width: 0;
  border: 2px solid var(--border); background: var(--surface-2); text-align: center;
}
.dplayer.active { border-color: var(--accent); background: var(--accent-soft); }
.dplayer.won { border-color: var(--success); }
.dname { font-weight: 700; font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drest { font-size: clamp(44px, 12vw, 76px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.dmeta { font-size: 12.5px; color: var(--text-2); min-height: 1.2em; }
.dturn { display: flex; gap: 6px; min-height: 28px; }
.dturn i {
  font-style: normal; min-width: 42px; padding: 3px 6px; border-radius: 8px; background: var(--surface);
  border: 1px solid var(--border); font-weight: 700; font-size: 14px; color: var(--text-3);
}
.dturn i.hit { color: var(--text); }
.dcheckout { text-align: center; font-size: 15px; color: var(--text-2); }
.dcheckout b { color: var(--success); letter-spacing: 0.04em; white-space: pre; }
.dstarter { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.dstarter .dmult { padding: 0 14px; }
.dmults { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dmult {
  min-height: 46px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  font: inherit; font-weight: 700; font-size: 16px; color: var(--text); cursor: pointer; touch-action: manipulation;
}
.dmult.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.dpad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dpad.extra { grid-template-columns: repeat(4, 1fr); }
.dkey {
  min-height: 52px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); padding: 0;
  font: inherit; font-weight: 800; font-size: 19px; color: var(--text); cursor: pointer; touch-action: manipulation;
  font-variant-numeric: tabular-nums;
}
.dkey:active:not(:disabled) { transform: scale(0.96); }
.dkey:disabled { opacity: 0.4; }
.dkey.miss { color: var(--text-2); }
.dkey.undo { font-size: 24px; }
.dend { min-height: 46px; font-size: 16px; }
@media (max-width: 560px) {
  /* Basketball am Handy: +1/+2/+3 als eigene Reihe, Minus darunter */
  .counter.steps { grid-template-columns: 1fr; }
  .counter.steps .csteps { grid-template-columns: repeat(3, 1fr); }
  .counter.steps .csteps .cbtn { min-height: 48px; padding: 0; }
  .counter.steps .minus { grid-row: 3; height: 48px; }
  .dkey { min-height: 48px; font-size: 17px; }
}

/* Fairnesswertung: grünes Feld unter den +/−-Tasten des jeweiligen Teams */
.cside { display: grid; gap: 8px; min-width: 0; }
.cfair {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 50px; padding: 0 10px;
  border-radius: 12px; border: 1px solid #1f5a33; background: #12301d; color: #bbf7d0;
  font: inherit; cursor: pointer; touch-action: manipulation; user-select: none;
}
.cfair small { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.75; }
.cfair b { font-size: 24px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.cfair.default b { opacity: 0.7; }
.cfair:disabled { opacity: 0.45; cursor: default; }
.cfair:active:not(:disabled) { transform: scale(0.98); }
.cfair-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.crow-fair { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.crow .cfair { height: 38px; border-radius: 10px; }
.crow .cfair b { font-size: 19px; }
:root[data-theme='light'] .cfair { background: #e6f6ec; border-color: #a7dfba; color: #14532d; }
@media (max-width: 560px) {
  .cfair { height: 46px; }
  .cfair b { font-size: 21px; }
}

/* Pause im Spielbetrieb */
.cpause {
  margin-bottom: 12px; padding: 12px 16px; border-radius: 12px; font-size: 16px; text-align: center;
  border: 1px dashed var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface));
}
.cpause.now { border-style: solid; font-size: 18px; }

/* Alle Courts: nur zur Information für Schiedsrichter */
.call { padding-bottom: 24px; }
.call-court { padding: 10px 0; border-top: 1px solid var(--border); display: grid; gap: 4px; }
.call-court:first-of-type { border-top: 0; }
.call-name { font-weight: 700; font-size: 15px; }
.call-name small { font-weight: 600; color: var(--accent); margin-left: 4px; }
.call-line { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; font-size: 14px; color: var(--text-2); }
.call-line b { font-variant-numeric: tabular-nums; color: var(--text); font-size: 16px; }
.call-line small { color: var(--text-3); }
.call-tag { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12.5px; color: var(--text-3); }
.call-line.live .call-tag { color: var(--live, #dc2626); text-transform: uppercase; letter-spacing: 0.06em; }
.call-line.live span:not(.call-tag) { color: var(--text); font-weight: 600; }
.call-line.idle span:not(.call-tag) { color: var(--text-3); }

/* Spieluhr */
.cclock {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; margin: 10px 0 4px;
  padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
}
.cclock-face { display: grid; line-height: 1.1; }
.cclock-time { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.cclock-label { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }
.cclock-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.cclock-actions .btn { min-height: 48px; padding: 0 16px; font-size: 16px; }
.cclock.paused .cclock-time, .cclock.halftime .cclock-time { color: var(--warn); }
.cclock.fulltime .cclock-time { color: var(--live); }
.cclock.halftime, .cclock.fulltime { border-color: var(--warn); }
@media (max-width: 560px) {
  .cclock { grid-template-columns: 1fr; }
  .cclock-actions { justify-content: stretch; }
  .cclock-actions .btn { flex: 1; }
}
