/* ---------- Design-Tokens (Vereinsfarben USC Altenautal 21) ----------
   Pantone 229  = #672146 (Bordeaux)
   Pantone 3025 = #004F71 (Petrol)
   Pantone 420  = #D2D2D2 (Hellgrau) */
:root {
  --usc-bordeaux: #672146;
  --usc-petrol: #004f71;
  --usc-grey: #d2d2d2;
  --bg: #efefef;
  --surface: #ffffff;
  --surface-2: #e6e6e6;
  --text: #1c1419;
  --muted: #655a60;
  --border: #d2d2d2;
  --primary: #672146;
  --primary-text: #ffffff;
  --accent: #004f71;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --warn: #e3b505;
  --home: #672146;
  --away: #4b5563; /* neutrales Anthrazit für die Gastmannschaft */
  --card-yellow: #f2c200;
  --card-red: #d7281f;
  --shadow: 0 2px 10px rgba(28,20,25,.08);
  --radius: 14px;
  --tabbar-h: 64px;
  /* Breite der Inhalte. Bis hierhin wächst die Seite mit dem Bildschirm; Tablets
     nutzen so die ganze Breite (iPad Pro 12,9" quer: 1366 px), erst auf großen
     Monitoren bleibt links und rechts Rand. Zum Anpassen nur diese Zeile ändern. */
  --page-max: 1400px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15111a;
    --surface: #211a24;
    --surface-2: #2c2430;
    --text: #f1ecef;
    --muted: #b0a4ab;
    --border: #3a3040;
    --primary: #8c3a66;
    --accent: #1f7ba3;
    --home: #a4487a;
    --away: #8a94a3;
    --shadow: 0 2px 12px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  --bg: #15111a;
  --surface: #211a24;
  --surface-2: #2c2430;
  --text: #f1ecef;
  --muted: #b0a4ab;
  --border: #3a3040;
  --primary: #8c3a66;
  --accent: #1f7ba3;
  --home: #a4487a;
  --away: #8a94a3;
  --shadow: 0 2px 12px rgba(0,0,0,.45);
}

/* ---------- Basis ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Kein Gummiband-Effekt über Kopf- und Tableiste hinaus (iOS) */
html, body { overscroll-behavior-y: none; }
html { background: var(--bg); }
body {
  /* Seite immer mindestens bildschirmhoch, sonst sitzt die feste Tableiste auf iOS bei kurzen Seiten nicht am unteren Rand */
  min-height: 100vh; min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  touch-action: manipulation;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
p { margin: .25rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--primary); color: var(--primary-text);
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  box-shadow: var(--shadow);
}
.topbar-inner { display: grid; grid-template-columns: 1fr minmax(0, 8fr) 1fr; align-items: center; gap: 10px; max-width: var(--page-max); margin: 0 auto; }
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.sb-team { font-weight: 600; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-home { text-align: right; }
.sb-away { text-align: left; }
.sb-score { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; padding: 0 6px; }
.sb-team .name-short { display: none; }
@media (max-width: 600px) { .sb-team .name-full { display: none; } .sb-team .name-short { display: inline; } }
.sb-clock { text-align: center; font-size: .9rem; opacity: .85; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---------- Ansicht ---------- */
.view { max-width: var(--page-max); margin: 0 auto; padding: 14px 14px 20px; }
@media (min-width: 900px) { .view { padding-left: 20px; padding-right: 20px; } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card-tight { padding: 10px 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 480px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 760px) { .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; } }

/* ---------- Icons (Lucide, eingebettet) ---------- */
.ico-svg { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.28em; }
.btn .ico-svg { width: 22px; height: 22px; }
.btn-xl .ico-svg { width: 30px; height: 30px; }
.btn-sm .ico-svg { width: 18px; height: 18px; }
.tab-ico .ico-svg { width: 24px; height: 24px; }
.ev-ico .ico-svg { width: 22px; height: 22px; }
.modal-head .ico-svg { width: 24px; height: 24px; margin-right: 6px; }
.announce-big .ico-svg { width: 36px; height: 36px; }
.ico-card { width: 16px; height: 22px; border-radius: 3px; display: inline-block; vertical-align: -0.3em; flex: none; }
.ico-card.yellow { background: var(--card-yellow); }
.ico-card.red { background: var(--card-red); }
.ico-pair { display: inline-flex; gap: 2px; }
.ico-pair .ico-card { width: 12px; height: 18px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 1rem; line-height: 1.2; text-align: center;
  user-select: none; -webkit-user-select: none;
  transition: transform .05s ease, filter .1s ease;
}
.btn:active { transform: scale(.98); filter: brightness(.95); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.btn-accent { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-warn { background: var(--warn); color: #1c1419; border-color: transparent; }
.btn-home { background: var(--home); color: #fff; border-color: transparent; }
.btn-away { background: var(--away); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-xl { min-height: 72px; font-size: 1.25rem; width: 100%; }
.btn-lg { min-height: 64px; font-size: 1.1rem; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn-block { width: 100%; }

.pnum-role { font-size: .8em; letter-spacing: .04em; }

/* ---------- Schieberegler (Tor) ---------- */
.slide { position: relative; height: 64px; border-radius: 14px; color: #fff; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; outline: none; }
.slide-home { background: var(--home); }
.slide-away { background: var(--away); }
.slide:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.slide::before { content: ""; position: absolute; inset: 0; width: calc(var(--slide-p, 0) * 100%); background: rgba(255,255,255,.16); }
.slide-track { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding-left: 58px; padding-right: 10px; opacity: calc(1 - var(--slide-p, 0) * 1.6); }
.slide-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.slide-hint { font-size: .72rem; opacity: .75; white-space: nowrap; }
.slide-knob { position: absolute; top: 6px; left: 6px; width: 52px; height: 52px; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.3); cursor: grab; touch-action: none; transition: transform .25s ease; }
.slide-knob svg { width: 26px; height: 26px; }
.slide-home .slide-knob { color: var(--home); }
.slide-away .slide-knob { color: var(--away); }
.slide.dragging .slide-knob { transition: none; cursor: grabbing; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.slide.done .slide-knob { background: #2e9e5b; color: #fff; }
.slide.nudge .slide-knob { animation: slide-nudge .5s ease; }
@keyframes slide-nudge { 0%, 100% { transform: translateX(0); } 35% { transform: translateX(22px); } 70% { transform: translateX(6px); } }
@media (max-width: 600px) { .grid-2.goal-slides { grid-template-columns: 1fr; } }
.hymn-row { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); }

/* ---------- Uhr ---------- */
.clock-card { text-align: center; padding: 18px 14px 14px; }
.phase-label { font-size: 1rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.clock-label {
  font-size: clamp(76px, 24vw, 150px); font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: 6px 0 2px;
}
.clock-label.stoppage { color: var(--warn); }
.clock-label.idle { color: var(--muted); font-size: clamp(40px, 12vw, 72px); }
.clock-sub { font-size: 1.4rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.clock-rest { font-size: 1.4rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; min-height: 1.4em; }
.clock-label.stoppage + .clock-sub + .clock-rest { color: var(--warn); }
.clock-stoppage-hint { margin-top: 6px; font-weight: 600; color: var(--warn); }
.adjust-row { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
details.adjust > summary { cursor: pointer; color: var(--muted); font-size: .9rem; list-style: none; padding: 8px 0 0; }
details.adjust > summary::-webkit-details-marker { display: none; }

/* ---------- Ansage ---------- */
.announce-card { border-left: 6px solid var(--accent); }
.announce-text { font-size: 1.35rem; font-weight: 700; line-height: 1.35; margin: 4px 0 10px; }
.announce-meta { font-size: .85rem; color: var(--muted); }

/* WhatsApp-Knopf */
.btn-wa { background: #25d366; color: #0b1f1a; border-color: transparent; text-decoration: none; }
.btn-wa:hover { color: #0b1f1a; }
.btn-wa .wa-ico { flex: none; }

/* ---------- Ereignis-Liste ---------- */
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-item { display: grid; grid-template-columns: 48px 28px 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.ev-actions .btn-sm { min-height: 34px; min-width: 36px; padding: 4px 8px; }
@media (max-width: 520px) {
  .ev-item { grid-template-columns: 48px 28px 1fr; row-gap: 4px; }
  .ev-actions { grid-column: 2 / -1; justify-content: flex-end; }
}
.ev-item:first-child { border-top: 0; }
.ev-min { font-weight: 800; font-variant-numeric: tabular-nums; }
.ev-ico { font-size: 1.3rem; text-align: center; }
.ev-text { line-height: 1.3; }
.ev-text .score { font-weight: 800; }
.ev-actions { display: flex; gap: 6px; }
.ev-team-home { color: var(--home); }
.ev-team-away { color: var(--away); }
.half-head { margin: 14px 0 4px; }

/* ---------- Formulare ---------- */
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.input, input[type=text], input[type=number], input[type=date], input[type=time], input[type=url], input[type=password], select, textarea {
  width: 100%; min-height: 46px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
textarea { min-height: 160px; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
/* iOS gibt Datums- und Auswahlfeldern eine eigene Mindestbreite und zentriert den Text – beides abschalten */
input[type=date], input[type=time], select {
  -webkit-appearance: none; appearance: none; min-width: 0; display: block; text-align: left;
  -webkit-min-logical-width: calc(100% - 16px);
}
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; }
select {
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23655a60' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M8 10l4 4 4-4'/></svg>");
  background-repeat: no-repeat; background-position: right .6rem center;
}
.grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0; }
label.field > input, label.field > select { max-width: 100%; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.switch:first-of-type { border-top: 0; }
/* Kippschalter statt Standard-Checkbox */
.switch input[type=checkbox] {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer;
  width: 52px; height: 30px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  position: relative; transition: background .18s ease, border-color .18s ease;
}
.switch input[type=checkbox]::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s ease;
}
.switch input[type=checkbox]:checked { background: var(--primary); border-color: var(--primary); }
.switch input[type=checkbox]:checked::before { transform: translateX(22px); }
.switch input[type=checkbox]:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.switch input[type=checkbox]:disabled { opacity: .45; cursor: default; }
.switch > span { cursor: default; }

/* ---------- Spielerliste (Aufstellung) ---------- */
.plist { list-style: none; margin: 0; padding: 0; }
.prow { display: grid; grid-template-columns: 56px 1fr auto auto auto; gap: 6px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); }
.tagbtns { display: flex; gap: 3px; }
.tagbtn { min-width: 34px; min-height: 40px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .02em; }
.tagbtn.active { background: var(--accent); color: #fff; border-color: transparent; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); }
.srow:first-child { border-top: 0; }
.srow select { min-height: 40px; padding: 4px 8px; font-size: .9rem; }
.srow input { min-height: 40px; }
@media (max-width: 480px) { .prow { grid-template-columns: 46px 1fr auto auto auto; gap: 4px; } .prow .btn-sm { min-width: 60px; padding: 6px 6px; font-size: .8rem; } .tagbtn { min-width: 30px; padding: 0 4px; } }
.prow:first-child { border-top: 0; }
.prow input[type=number] { text-align: center; padding: 6px; }
.prow .btn-sm { min-width: 70px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); font-size: .8rem; color: var(--muted); }
.chip-ok { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

.logo-row { display: flex; align-items: center; gap: 10px; padding: 8px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.logo-thumb { width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; }
.logo-thumb img { width: 100%; height: 100%; object-fit: contain; }
.logo-thumb img.pad { padding: 5px; box-sizing: border-box; }

/* ---------- Spieler-Raster (Modal) ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.pbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 70px; padding: 8px 6px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--surface-2); color: var(--text);
}
.pbtn .pnum { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.pbtn .pname { font-size: .78rem; line-height: 1.15; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pbtn { position: relative; }
.pbtn .ptags { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; }
.pbtn .ptag { font-size: .6rem; font-weight: 800; padding: 1px 4px; border-radius: 4px; background: var(--accent); color: #fff; line-height: 1.2; }
.pbtn .ptag.card { width: 10px; height: 14px; padding: 0; border-radius: 2px; font-size: .55rem; display: inline-flex; align-items: center; justify-content: center; color: #1c1419; }
.pbtn .ptag.card.yellow { background: var(--card-yellow); }
.pbtn .ptag.card.red { background: var(--card-red); color: #fff; }
.pb-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 6px; }
.pbtn.bench { opacity: .55; }
.pbtn.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--surface-2)); opacity: 1; }
.pbtn.off { opacity: .35; }

/* ---------- Segment ---------- */
.seg { display: flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1; min-height: 46px; border: 0; background: var(--surface-2); font-weight: 600; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--primary); color: var(--primary-text); }
.seg.seg-sm button { min-height: 40px; font-size: .9rem; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 700px) { .modal-backdrop { align-items: center; } }
.modal {
  background: var(--surface); color: var(--text); width: 100%; max-width: 720px;
  max-height: calc(100dvh - 20px); overflow: auto;
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 30px rgba(0,0,0,.3);
}
@media (min-width: 700px) { .modal { border-radius: 18px; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head h2 { margin: 0; }
/* Knopfleiste am Ende des Dialoginhalts, nicht schwebend (Wunsch: nichts überblenden, lieber scrollen) */
.modal-foot { display: flex; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.modal-foot .btn { flex: 1 1 auto; min-width: 0; padding-inline: 12px; }
.modal { overflow-x: hidden; }
.btn .btn-lbl { margin-left: 2px; }
/* Schmale Bildschirme: Nebenknöpfe nur als Icon, der Hauptknopf behält seinen Text */
@media (max-width: 480px) {
  .modal .btn:not(.btn-primary):not(.btn-accent) .btn-lbl { display: none; }
  .modal .btn:not(.btn-primary):not(.btn-accent):has(.btn-lbl) { flex: 0 0 auto; min-width: 56px; }
  .modal .btn-primary, .modal .btn-accent { flex: 1 1 auto; }
}
.modal-foot .btn { flex: 1; }
.minute-edit { display: flex; gap: 8px; align-items: center; }
.minute-edit input { width: 80px; text-align: center; font-weight: 700; font-size: 1.1rem; }

/* Mehrfachwechsel: gesammelte Paare */
.staged { margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.staged-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); background: var(--surface-2); }
.staged-row:first-child { border-top: 0; }
.staged-no { font-weight: 800; color: var(--muted); }
.staged-text { flex: 1; font-weight: 600; }
.staged-text .ico-svg { color: var(--accent); }

/* Begrüßung / Aufstellungen zum Vorlesen */
.readout .ro-team { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border-left: 6px solid var(--away); }
.readout .ro-home { border-left-color: var(--home); }
.readout .ro-ref { border-left-color: var(--accent); }
.readout .ro-head { font-size: 1.25rem; font-weight: 800; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 8px; }
.readout .ro-head .muted { font-weight: 600; font-size: .9rem; }
.ro-list { list-style: none; margin: 0; padding: 0; }
.ro-row { display: grid; grid-template-columns: 56px 1fr; align-items: baseline; gap: 10px; padding: 5px 0; border-top: 1px solid var(--border); font-size: 1.25rem; line-height: 1.3; }
.ro-row:first-child { border-top: 0; }
.ro-num { font-weight: 800; font-size: 1.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.ro-label { color: var(--muted); font-size: .95rem; font-weight: 600; margin-right: 6px; }
.ro-tag { font-size: .75rem; font-weight: 800; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: #fff; vertical-align: middle; }
.ro-bench { margin: 10px 0 0; font-size: 1.05rem; line-height: 1.5; }
.ro-bench-p { white-space: nowrap; }
.ro-staff { margin: 8px 0 0; font-size: 1.05rem; line-height: 1.5; }
.ro-refname { font-size: 1.4rem; font-weight: 800; margin: 0; }

/* Ansage-Overlay (groß) */
.announce-big { text-align: center; }
.announce-big .announce-text { font-size: clamp(1.4rem, 5vw, 2.2rem); margin: 10px 0 18px; }

/* ---------- Tableiste ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
/* Bei offener Bildschirmtastatur ausgeblendet (siehe keyboardWatch in app.js) */
:root.keyboard-open .tabbar { display: none; }
:root.keyboard-open body { padding-bottom: 20px; }
:root.keyboard-open .toast { bottom: 16px; }
.tab { flex: 1; border: 0; background: transparent; color: var(--muted); font-size: .75rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tab-ico { font-size: 1.35rem; }
.tab.active { color: var(--primary); }
:root[data-theme="dark"] .tab.active { color: #d98bb6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab.active { color: #d98bb6; } }

/* ---------- Soundboard ---------- */
.snd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.snd-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snd-card .field input[type=range] { width: 100%; min-height: 32px; padding: 0; border: 0; background: transparent; accent-color: var(--primary); }
.player {
  position: fixed; left: 0; right: 0; z-index: 29;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; background: var(--primary); color: var(--primary-text);
  box-shadow: 0 -2px 10px rgba(0,0,0,.2);
}
.player[hidden] { display: none; }
.player-info { display: flex; flex-direction: column; min-width: 0; }
.player-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-info .muted { color: rgba(255,255,255,.75); font-size: .85rem; }
.player-btns { display: flex; gap: 6px; flex: none; }
.player .btn-sm { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.player .btn-sm.btn-warn { background: var(--warn); color: #1c1419; }
.player .btn-sm.btn-danger { background: var(--danger); color: #fff; }
:root.player-open body { padding-bottom: calc(var(--tabbar-h) + 64px + env(safe-area-inset-bottom)); }
:root.keyboard-open .player { display: none; }
@media (max-width: 480px) { .player .btn-lbl { display: none; } }

/* Musiksteuerung innerhalb eines Dialogs (z. B. Tor-Ansage) */
.modal-player { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 4px 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--primary); color: var(--primary-text); text-align: left; }
.modal-player .player-info b { display: flex; align-items: center; gap: 6px; }
.modal-player .btn-sm { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.modal-player .btn-sm.btn-warn { background: var(--warn); color: #1c1419; }
.modal-player .btn-sm.btn-danger { background: var(--danger); color: #fff; }
.modal-player .btn-sm .ico-svg { width: 18px; height: 18px; }
@media (max-width: 480px) { .modal-player { justify-content: center; } }

/* Links zur Tafel / zum Ticker */
.link-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.link-row:first-of-type { border-top: 0; }
.link-row > span { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.link-row a.small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); }
@media (max-width: 520px) { .link-row { grid-template-columns: 1fr auto auto; } .link-row > span { grid-column: 1 / -1; } }

/* ---------- Toast ---------- */
/* kurze Meldungen als Pille, längere Hinweise als lesbarer Kasten: feste Breite, linksbündig, Zeilenabstand */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 14px; font-weight: 600; z-index: 60; box-shadow: var(--shadow);
  width: max-content; max-width: min(520px, calc(100vw - 32px)); line-height: 1.35; text-align: center;
  font-size: .95rem; box-sizing: border-box;
}
.toast.long { text-align: left; padding: 12px 16px; border-left: 5px solid var(--primary); }

/* ---------- Druck / Export ---------- */
pre.report { white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: var(--surface-2); padding: 10px; border-radius: 10px; }

/* Warnung: zweites Gerät sendet auf demselben Kanal */
.conflict { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 170, 0, .16); color: var(--text); border-left: 4px solid var(--warn); font-weight: 600; display: flex; gap: 6px; align-items: flex-start; }
.conflict .ico-svg { flex: none; margin-top: .1em; }

/* Betriebsart in der Kopfzeile und Bestätigung mit „Rückgängig“ (Liveticker) */
.hdr-mode { justify-self: end; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.hdr-mode:not(:empty) { background: rgba(255,255,255,.18); border-radius: 999px; padding: 3px 9px; }
.toast.has-undo { display: flex; align-items: center; gap: 12px; justify-content: space-between; text-align: left; }
.toast .toast-undo { flex: none; border: 0; border-radius: 8px; padding: 6px 10px; font: inherit; font-weight: 700; background: var(--accent, #2f8fbb); color: #fff; }
.tab[hidden] { display: none; }

/* Bank: Wechselwünsche des Betreuers */
.bank-card { border-left: 5px solid var(--accent); }
.link-row .link-btns { grid-column: span 2; display: inline-flex; gap: 6px; justify-self: end; }

/* Aufstellung im Spiel: Spielfeld */
/* Schmal: Heim über dem Feld, Gast darunter (wie auf dem Feld oben/unten) · breit: Heim links, Feld Mitte, Gast rechts */
.pf-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 14px; }
@media (min-width: 820px) { .pf-wrap { grid-template-columns: minmax(0, 1fr) minmax(280px, 400px) minmax(0, 1fr); align-items: start; } }
.pitch { position: relative; width: 100%; max-width: 440px; margin: 0 auto; aspect-ratio: 68 / 105; border-radius: 12px; overflow: hidden;
  background: repeating-linear-gradient(180deg, #3f8f4a 0 12.5%, #46994f 12.5% 25%); box-shadow: var(--shadow); }
.pf-lines { position: absolute; inset: 0; background:
  linear-gradient(#ffffffb0, #ffffffb0) 50% 50% / 100% 2px no-repeat,
  radial-gradient(circle at 50% 50%, transparent 15.5%, #ffffffb0 15.5% 16.6%, transparent 16.6%),
  linear-gradient(#ffffffb0, #ffffffb0) 50% 0 / 60% 2px no-repeat, linear-gradient(#ffffffb0, #ffffffb0) 50% 100% / 60% 2px no-repeat;
}
.pf-lines::before, .pf-lines::after { content: ''; position: absolute; left: 20%; width: 60%; height: 16%; border: 2px solid #ffffffb0; }
.pf-lines::before { top: -2px; border-top: 0; }
.pf-lines::after { bottom: -2px; border-bottom: 0; }
.pf-chip { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; width: 19%; pointer-events: none; }
.pf-circle { position: relative; display: block; }
.pf-num { width: 2.1em; height: 2.1em; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: clamp(11px, 2.4vw, 15px); color: #fff; background: var(--home); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); font-variant-numeric: tabular-nums; }
.pf-chip.other .pf-num { background: var(--away); }
.pf-name { margin-top: 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(9px, 2vw, 12px); font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
/* Gelbe Karte und Kapitän am Nummernkreis, Einwechselminute als Schild unter dem Namen */
.pf-card { position: absolute; top: -4px; right: -7px; width: 11px; height: 15px; border-radius: 2px; background: #f2c200; border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.pf-cap { position: absolute; top: -4px; left: -7px; font-size: 9px; font-weight: 800; line-height: 1; padding: 2px 4px; border-radius: 4px; background: var(--accent); color: #fff; border: 1.5px solid #fff; }
.pf-in { margin-top: 2px; display: inline-flex; align-items: center; gap: 2px; font-size: clamp(9px, 1.9vw, 11px); font-weight: 800; line-height: 1; padding: 2px 5px; border-radius: 999px; background: #1e9e4a; color: #fff; border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); font-variant-numeric: tabular-nums; }
.pf-in .ico-svg { width: 10px; height: 10px; }
.pf-score { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: #0007; color: #fff; font-weight: 800; padding: 2px 8px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.pf-side h3 { margin: 0 0 6px; }
.pf-side h3.usc { color: var(--home); } .pf-side h3.other { color: var(--away); }
.pf-list { list-style: none; margin: 2px 0 8px; padding: 0; }
.pf-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.pf-list .num { min-width: 2.2em; text-align: center; font-variant-numeric: tabular-nums; }

/* Spielbericht teilen: Vorschau der drei Grafiken */
.rb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .rb-grid { grid-template-columns: 1fr 1fr; } }
.rb-card { display: flex; flex-direction: column; gap: 6px; }
.rb-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: var(--surface-2, #eee); border-radius: 10px; box-shadow: var(--shadow); display: block; }
.rb-card .rb-cap { display: flex; flex-direction: column; line-height: 1.2; }
.rb-card .row { gap: 6px; }
