/* ===== Variables & Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d1117;
  --card:      #161b22;
  --border:    #30363d;
  --green:     #238636;
  --green-lt:  #2ea043;
  --blue:      #1f6feb;
  --red:       #da3633;
  --yellow:    #d29922;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --radius:    10px;
  --radius-lg: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  /* Symbol-Glyphs (⚙, ✏, ✓, ⚡, ⚠ …) sollen monochrom als Text gerendert
     werden, nicht als farbiger Emoji. Browser-Support: Chrome 119+,
     Firefox 116+, Safari 16.4+ — sonst harmloser Fallback. */
  font-variant-emoji: text;
}

a { color: inherit; text-decoration: none; }

/* ===== Top Navigation Bar ===== */
.top-nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  /* Safe-Area Insets für iPhone-Notch / Dynamic Island:
     iOS Status-Bar belegt oberen Bildschirm-Streifen (~47px) wenn als PWA
     installiert. Ohne safe-area-padding würde TEC-tv-Logo unter die Uhrzeit
     rutschen. env() liefert auf Desktop/Browser 0px — dort bleibt es beim
     bisherigen Spacing. */
  padding:
    calc(0.6rem + env(safe-area-inset-top, 0px))
    calc(1rem + env(safe-area-inset-right, 0px))
    0.6rem
    calc(1rem + env(safe-area-inset-left, 0px));
  background: var(--card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.nav-brand {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
  flex-wrap: wrap;
}

.nav-tab {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  position: relative;
  white-space: nowrap;
}

.nav-tab:hover { color: var(--text); }

.nav-tab.is-active {
  color: var(--text);
  background: var(--bg);
}

.nav-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: -0.65rem;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}

/* ===== Admin-Gruppe in der Nav: Untertabs im Hamburger-Menu ===== */
.nav-admin-group {
  /* display: contents lässt die Kinder wie direkte .top-nav-Flex-Items
     erscheinen. Die Admin-Tab sitzt auf Desktop damit horizontal neben
     den anderen Tabs, die Sub-Tabs sind per default display:none und
     werden nur im Mobile-Dropdown sichtbar. */
  display: contents;
}
.nav-admin-subtab {
  display: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  white-space: nowrap;
}
.nav-admin-subtab:hover { color: var(--text); }
.nav-admin-subtab.is-active {
  color: var(--text);
  background: var(--bg);
  border-left: 2px solid var(--blue);
}

/* ===== Hamburger-Burger (mobile only) ===== */
.nav-burger {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  color: var(--text);
}
.nav-burger:hover,
.nav-burger[aria-expanded="true"] { background: var(--bg); }
.nav-burger-icon,
.nav-burger-icon::before,
.nav-burger-icon::after {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-burger-icon {
  position: relative;
}
.nav-burger-icon::before,
.nav-burger-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-burger-icon::before { top: -6px; }
.nav-burger-icon::after  { top:  6px; }
.nav-burger[aria-expanded="true"] .nav-burger-icon {
  background: transparent;
}
.nav-burger[aria-expanded="true"] .nav-burger-icon::before {
  top: 0;
  transform: rotate(45deg);
}
.nav-burger[aria-expanded="true"] .nav-burger-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ===== Help-Button + Dialog ===== */
.help-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  padding: 0;
}
.help-btn:hover {
  background: var(--card);
  color: var(--text);
  border-color: var(--blue);
}

.help-dialog {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 92vw;
  width: 520px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.help-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }

.help-dialog-body {
  position: relative;
  padding: 1.6rem 1.8rem 1.4rem;
}

.help-dialog-close {
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
}
.help-dialog-close:hover { color: var(--text); }

.help-dialog h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.8rem;
  padding-right: 1.5rem;
}

.help-dialog ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-dialog li {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 0.7rem;
  padding-left: 1.2rem;
  position: relative;
}

.help-dialog li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--blue);
  font-weight: 700;
}

.help-foot {
  margin-top: 1rem;
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
}

.help-foot a { color: var(--blue); text-decoration: underline; }

/* Dev role switcher (Phase 0 — temporary) */
.dev-role-switcher {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border: 1px dashed var(--yellow);
  border-radius: var(--radius);
  background: rgba(210, 153, 34, 0.08);
  cursor: pointer;
  flex-shrink: 0;
}

.dev-badge {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--yellow);
  letter-spacing: 1px;
}

.dev-role-current {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.dev-role-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.3rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem;
  min-width: 9rem;
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  z-index: 200;
}

.dev-role-switcher.is-open .dev-role-menu {
  display: flex;
}

.dev-role-link {
  font-size: 0.82rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  color: var(--muted);
}

.dev-role-link:hover { background: var(--bg); color: var(--text); }
.dev-role-link.is-active { color: var(--text); background: var(--bg); }

/* Main content wrapper */
.page-main {
  min-height: calc(100vh - 60px);
}

/* Mobile: stack nav items + shrink dev switcher */
@media (max-width: 640px) {
  .top-nav-bar {
    padding:
      calc(0.5rem + env(safe-area-inset-top, 0px))
      calc(0.6rem + env(safe-area-inset-right, 0px))
      0.5rem
      calc(0.6rem + env(safe-area-inset-left, 0px));
    gap: 0.5rem;
    position: sticky;
  }
  .nav-brand { font-size: 0.85rem; }
  .nav-burger { display: inline-flex; }

  .top-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
    gap: 0.15rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 105;
  }
  .top-nav-bar.nav-open .top-nav { display: flex; }

  .top-nav .nav-tab {
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
    text-align: left;
    border-radius: var(--radius);
  }
  .top-nav .nav-tab.is-active {
    background: var(--bg);
  }
  .top-nav .nav-tab.is-active::after {
    display: none;
  }

  /* Admin-Subtabs sichtbar im Mobile-Dropdown, eingerückt unter Admin */
  .top-nav .nav-admin-subtab {
    display: block;
    margin-left: 1rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.9rem;
    border-left: 2px solid var(--border);
    border-radius: 0 var(--radius) var(--radius) 0;
  }
  .top-nav .nav-admin-subtab.is-active {
    border-left-color: var(--blue);
  }

  .user-menu,
  .btn-login {
    margin-left: auto;
  }

  .dev-badge { display: none; }
  .dev-role-switcher { padding: 0.3rem 0.5rem; }
  .dev-role-current { font-size: 0.72rem; }
}

/* ===== Site Header (legacy, still used by some pages) ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.site-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.admin-link {
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.admin-link:hover { color: var(--text); border-color: var(--muted); }

/* ===== Page sections ===== */
.page-section {
  padding: 1.2rem 1.5rem;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1rem;
}

/* ===== Streams grid (top, 3 courts) ===== */
.streams-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .streams-grid { grid-template-columns: 1fr; }
}

/* ===== Court card (stream) ===== */
.court-card {
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.15s;
  cursor: pointer;
}

.court-card:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
}

.video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.court-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Placeholder ===== */
.stream-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d2618 0%, #1a3a28 100%);
  gap: 0.4rem;
}

.placeholder-icon { font-size: 2.5rem; }
.placeholder-text { font-size: 1rem; color: var(--text); font-weight: 700; }
.placeholder-sub  { font-size: 0.8rem; color: var(--muted); }

.fullscreen-placeholder .placeholder-icon { font-size: 5rem; }
.fullscreen-placeholder .placeholder-text { font-size: 1.5rem; }
.fullscreen-placeholder .placeholder-sub  { font-size: 1rem; }

/* ===== LIVE Badge ===== */
.live-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 1px;
  animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ===== Score overlay (stream card) ===== */
.score-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.88));
  padding: 1.5rem 0.8rem 0.6rem;
}

.overlay-court-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}

.overlay-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.1rem 0;
}

.ov-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ov-sets { display: flex; gap: 0.4rem; }

.ov-set {
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 1rem;
  text-align: center;
}

.ov-set-win { color: #fff; }
.ov-set-cur { color: rgba(255,255,255,0.5); }   /* Zwischenstand heller */
.ov-winner  { font-size: 0.8rem; font-weight: 700; color: var(--yellow); margin-top: 0.3rem; }
.ov-idle    { font-size: 0.8rem; color: var(--muted); padding: 0.3rem 0; }

/* ===== All scores grid ===== */
.scores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.8rem;
}

.score-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  transition: border-color 0.2s;
}

.score-card.is-active  { border-color: var(--green); }
.score-card.is-done    { border-color: var(--yellow); opacity: 0.8; }

.sc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.sc-name { font-size: 0.85rem; font-weight: 700; color: var(--muted); }

.sc-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 1px;
}

.sc-badge.live { background: var(--red);    color: #fff; }
.sc-badge.done { background: var(--yellow); color: #000; }
/* Grace-Period Badge: Match ist fertig aber noch korrigierbar (15 min).
   Visuell schwächer als LIVE, klar abgegrenzt von "done"-Status der
   bereits weggeräumten Matches. */
.sc-badge.sc-badge-grace {
  background: rgba(166, 168, 173, 0.25);
  color: var(--muted);
  letter-spacing: 0.5px;
}
.score-card.is-grace {
  opacity: 0.78;
}
.score-card.is-grace:hover { opacity: 1; }

.sc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
}

.sc-player { flex: 1; font-size: 1rem; font-weight: 600; }

.sc-sets { display: flex; gap: 0.5rem; }

.sc-set {
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 1.1rem;
  text-align: center;
}

.sc-set-win { color: var(--text); }
.sc-set-cur { color: var(--muted); opacity: 0.6; }

.sc-winner {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--yellow);
  margin-top: 0.4rem;
}

.sc-idle {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.2rem 0;
}

/* ===== Court Fullscreen ===== */
/* Court-Viewer belegt den gesamten Viewport — Top-Nav ist auf dieser Seite
   ausgeblendet. page-main nimmt daher die volle Höhe, .court-fullscreen
   füllt page-main, .court-video-wrap füllt .court-fullscreen → sauberer
   Flex-Chain ohne height-Hacks. */
body.court-page {
  display: flex;
  flex-direction: column;
  background: #000;
  height: 100vh;
  height: 100dvh; /* dynamic viewport height — respektiert iOS-Browser-UI */
  overflow: hidden;
}

body.court-page .page-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.court-fullscreen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;  /* Fallback-Ref für absolut positionierte Kinder */
}

/* Pseudo-Fullscreen für iOS Safari — da der native Fullscreen-API dort nur
   auf <video> erlaubt ist (und dann unser Overlay verschluckt), simulieren
   wir Fullscreen via fixed-Positioning. Sieht im Ergebnis identisch aus:
   Overlay + Controls bleiben sichtbar, Safari-Chrome wird überdeckt. */
.court-fullscreen.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
}

.court-video-wrap {
  position: relative;
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Safari-Flex-Fix: ohne min-height:0 + overflow:hidden zwingt das <video>
     mit seiner intrinsischen Auflösung (720p) den Container größer als den
     Flex-Slot und läuft unten aus dem Viewport raus — Overlay + Bar
     verschwinden. Mit diesen beiden bleibt die Wrap in ihrem Flex-Slot. */
  min-height: 0;
  overflow: hidden;
  /* Fallback-Höhe für den Fall, dass der Flex-Chain in Edge-Cases (z.B.
     Safari-Tab ohne dvh-Support) nicht greift — dann zumindest Viewport-
     Höhe minus eine grobe Browser-Chrome-Schätzung. */
  max-height: 100dvh;
}

/* Buffering-Spinner — dezenter rotierender Ring zentriert im Video. Wird
   per JS bei video.waiting/stalled gezeigt, bei playing/canplay/pause
   wieder versteckt. Klein, halbtransparent, kein „kaputt"-Eindruck. */
.stream-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 4;
}
.stream-loader[hidden] { display: none; }
.stream-loader-ring {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  animation: stream-loader-spin 0.9s linear infinite;
}
@keyframes stream-loader-spin {
  to { transform: rotate(360deg); }
}

.court-video-full {
  /* Aus dem Flex-Flow nehmen — sonst kann das <video> mit seiner intrinsischen
     Größe den Flex-Container aufblähen. inset:0 + object-fit:contain hält
     das Video innerhalb der Wrap-Box und zentriert automatisch. */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ===== TV Overlay ===== */
.tv-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.9) 40%);
  padding: 3rem 1.5rem 1rem;
}

.tv-court-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.tv-scores {
  background: rgba(13, 17, 23, 0.85);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  display: inline-flex;
  flex-direction: column;
  min-width: 280px;
  border: 1px solid rgba(255,255,255,0.1);
}

.tv-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.35rem 0;
}

.tv-divider { height: 1px; background: rgba(255,255,255,0.1); }
.tv-name    { flex: 1; font-size: 1.2rem; font-weight: 700; }

.tv-set-scores { display: flex; gap: 0.6rem; }

.tv-set {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 1.3rem;
  text-align: center;
}

.tv-set-win { color: #fff; }
.tv-set-cur { color: rgba(255,255,255,0.45); }
.tv-winner  { margin-top: 0.5rem; font-size: 1.1rem; font-weight: 800; color: var(--yellow); }
.tv-idle    { font-size: 1rem; color: var(--muted); }

/* ===== /tv/court/<id> — standalone OBS overlay ===== */
/* Overrides for when the overlay runs on its own transparent page,
   positioned in a corner for OBS browser sources. */

body.tv-standalone .tv-root {
  position: fixed;
  max-width: 90vw;
}

body.tv-standalone.tv-pos-bl .tv-root { bottom: 40px; left: 40px; }
body.tv-standalone.tv-pos-br .tv-root { bottom: 40px; right: 40px; }
body.tv-standalone.tv-pos-tl .tv-root { top: 40px;    left: 40px; }
body.tv-standalone.tv-pos-tr .tv-root { top: 40px;    right: 40px; }

body.tv-standalone .tv-team-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(0, 0, 0, 0.62);
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  margin-bottom: 0.35rem;
  letter-spacing: 0.4px;
  backdrop-filter: blur(6px);
}

/* Kill the legacy full-width bottom-gradient layout — we want a compact box */
body.tv-standalone .tv-overlay {
  position: static;
  background: transparent;
  padding: 0;
}

body.tv-standalone .tv-court-label {
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 0.25rem;
  padding: 0 0.3rem;
  letter-spacing: 1.5px;
}

body.tv-standalone .tv-scores {
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.55rem 1rem;
  min-width: 340px;
  backdrop-filter: blur(8px);
}

body.tv-standalone .tv-row {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto auto auto;  /* serve | name | sets | pts | wo */
  gap: 0.8rem;
  align-items: center;
  padding: 0.35rem 0;
}

body.tv-standalone .tv-name {
  font-size: 1.08rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.tv-standalone .tv-name.is-loser { color: rgba(255, 255, 255, 0.55); }

body.tv-standalone .tv-set-scores { display: flex; gap: 0.55rem; }
body.tv-standalone .tv-set        { font-size: 1.15rem; min-width: 1.3rem; }
body.tv-standalone .tv-set-cur    { color: rgba(255, 255, 255, 0.55); }

body.tv-standalone .tv-points {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  min-width: 2.4rem;
  text-align: center;
  padding: 0.1rem 0.5rem;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

body.tv-standalone .tv-points:empty { display: none; }

body.tv-standalone .tv-divider { background: rgba(255, 255, 255, 0.14); }

body.tv-standalone .serve-slot {
  font-size: 0.95rem;
  text-align: center;
}

body.tv-standalone .tv-wo-slot { min-width: 2rem; text-align: center; }

body.tv-standalone .tv-idle {
  background: rgba(0, 0, 0, 0.78);
  padding: 0.8rem 1.2rem;
  border-radius: 6px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
}

/* ===== /court/<id> — Viewer Fullscreen ===== */
/* Chrome-Layer: YouTube-Style Auto-Hide für Back-Btn + zukünftige Controls.
   Das tv-overlay daneben (Scores) bleibt bewusst außerhalb → immer sichtbar. */
body.court-page .court-chrome {
  position: absolute;
  inset: 0;
  pointer-events: none;       /* Klicks durch zum Video, außer auf aktiven Kindern */
  z-index: 5;
  transition: opacity 0.35s ease;
  opacity: 1;
}

body.court-page .court-chrome > * { pointer-events: auto; }

body.court-page .court-chrome.is-hidden {
  opacity: 0;
  /* Kein translate → kein Wackeln beim Fade-out */
}

/* Video-Controls-Bar unten (Progress-Bar + Play/Pause/Mute/Fullscreen).
   YouTube-Style zweireihig: oben die Timeline, unten die Button-Zeile. Fade
   über .court-chrome.is-hidden Auto-Hide-Logik, Gradient-Backdrop für
   Lesbarkeit gegen helle Videos. Overlay unten-links wird bewusst von der
   Bar überblendet — das ist OK, die Bar verschwindet ja nach 3 Sek wieder. */
body.court-page .video-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.2rem 1rem 0.6rem;   /* Top-Padding lässt Gradient sanft auslaufen */
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.88) 100%);
  pointer-events: none;
  z-index: 6;
}

body.court-page .video-controls .vc-btn,
body.court-page .video-controls .vc-progress { pointer-events: auto; }

/* ── Progress-Bar ────────────────────────────────────────────────────── */
/* YouTube-Feeling: dünne Linie, beim Hover oder Scrubbing wächst sie,
   Thumb erscheint. Buffered-Range in hellerem Grau unter dem roten Fill. */
.vc-progress {
  width: 100%;
  height: 14px;          /* großer Klick-Hitbereich, Track ist visuell dünner */
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 5px 0;        /* vertikales Padding vergrößert Klick-Hitbox */
}

.vc-progress.is-hidden { visibility: hidden; }   /* bei Live-Streams */

.vc-progress-track {
  position: relative;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  transition: height 0.12s ease;
}

.vc-progress:hover .vc-progress-track,
.vc-progress.is-scrubbing .vc-progress-track { height: 5px; }

.vc-progress-buffered,
.vc-progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 2px;
}

.vc-progress-buffered { background: rgba(255, 255, 255, 0.42); width: 0; }
.vc-progress-fill     { background: #fff;                      width: 0; }

.vc-progress-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  left: 0;
  transition: transform 0.12s ease;
  pointer-events: none;
}

.vc-progress:hover .vc-progress-thumb,
.vc-progress.is-scrubbing .vc-progress-thumb { transform: translate(-50%, -50%) scale(1); }

/* ── Button-Zeile ────────────────────────────────────────────────────── */
.vc-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.vc-time {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  padding: 0 0.4rem;
  pointer-events: none;
}

.vc-time.is-hidden { display: none; }

.vc-live-badge {
  display: none;   /* Default versteckt, JS zeigt nur am Live-Edge */
  color: #fff;
  background: #ff3b30;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  text-transform: uppercase;
  pointer-events: none;
  /* sanfter Puls als "live"-Affordance */
  animation: vcLivePulse 1.8s ease-in-out infinite;
}

.vc-live-badge.is-live { display: inline-block; }

@keyframes vcLivePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.75; }
}

/* ── Zurück-zu-Live-Button (sichtbar wenn nicht am Live-Edge) ───────── */
.vc-back-live {
  display: none;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.4rem;
  padding: 0.3rem 0.7rem 0.3rem 0.55rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s, border-color 0.15s;
}

.vc-back-live.is-visible { display: inline-flex; }
.vc-back-live:hover      { background: rgba(255, 255, 255, 0.22);
                           border-color: rgba(255, 255, 255, 0.45); }
.vc-back-live:active     { transform: scale(0.97); }

.vc-bl-dot {
  width: 8px;
  height: 8px;
  background: #ff3b30;
  border-radius: 50%;
  flex-shrink: 0;
  animation: vcLivePulse 1.8s ease-in-out infinite;
}

/* ── Center-Controls (Rewind 15s · Play · Forward 15s) ──────────────── */
/* Absolut zentriert im Video-Container. Sichtbarkeit folgt der gleichen
   Auto-Hide-Logik wie .court-chrome (fade über .is-hidden). */
.vc-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 1.6rem;
  z-index: 6;
  pointer-events: none;   /* Container neutral, Buttons aktiv */
}

/* Line-art Stil: keine Kreis-Hintergründe, nur Icons. Sky/YouTube-mäßig.
   Hover = subtler Glow, kein Box. Die Icons selbst sind Stroke-SVGs (außer
   Play/Pause die filled bleiben). */
.vc-cbtn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  padding: 0;
  transition: background 0.15s, transform 0.1s, opacity 0.18s;
  /* Drop-Shadow am Icon damit es auf hellem Hintergrund lesbar bleibt */
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
}

.vc-cbtn-play { width: 60px; height: 60px; }

.vc-cbtn:hover  { background: rgba(255, 255, 255, 0.14); }
.vc-cbtn:active { transform: scale(0.92); }

.vc-cbtn.is-disabled {
  opacity: 0;
  pointer-events: none;
}

/* Sekunden-Zahl mittig im Pfeil-Loop von Rewind/Forward */
.vc-cbtn-num {
  position: absolute;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -38%);
  color: #fff;
}

/* Play/Pause-Icon-Toggle im Center-Player (gespiegelt zur Bottom-Bar:
   is-playing → pause-icon zeigen, sonst play-icon). */
.vc-cbtn-play .vc-cicon-pause { display: none; }
.court-fullscreen.is-playing .vc-cbtn-play .vc-cicon-play  { display: none; }
.court-fullscreen.is-playing .vc-cbtn-play .vc-cicon-pause { display: inline-block; }

/* vc-center liegt INNERHALB von .court-chrome — fadet via Parent-Opacity
   automatisch mit der Auto-Hide-Logik. Kein eigener Transition nötig. */

.vc-btn {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, transform 0.1s;
}

.vc-btn:hover  { background: rgba(255, 255, 255, 0.15); }
.vc-btn:active { transform: scale(0.95); }

.vc-spacer { flex: 1; }

/* Play/Pause-Icon je nach Zustand: wenn .is-playing auf .court-fullscreen
   steht, zeig das Pause-Icon; sonst Play-Icon. Gleiche Logik für Mute. */
.vc-icon-play, .vc-icon-pause { display: none; }
body.court-page .court-fullscreen:not(.is-playing) .vc-icon-play  { display: inline-block; vertical-align: middle; }
body.court-page .court-fullscreen.is-playing       .vc-icon-pause { display: inline-block; vertical-align: middle; }

.vc-icon-sound, .vc-icon-mute { display: none; }
body.court-page .court-fullscreen:not(.is-muted) .vc-icon-sound { display: inline-block; vertical-align: middle; }
body.court-page .court-fullscreen.is-muted       .vc-icon-mute  { display: inline-block; vertical-align: middle; }

/* Mute-Button + vertikaler Volume-Slider als Popup. Der Popup ist
   position:absolute, damit das Aufklappen den Button-Row nicht verschiebt.
   Erscheint bei Hover/Focus auf der Volume-Gruppe — die Hitbox reicht bis
   ins Popup hinein (padding-bottom), sodass Maus-Weg zum Slider nicht das
   Popup schließt. */
.vc-volume {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.vc-vol-popup {
  position: absolute;
  bottom: 100%;           /* direkt über dem Button */
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 0.6rem 0.4rem;
  background: rgba(20, 20, 20, 0.9);
  border-radius: 6px;
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.vc-volume:hover .vc-vol-popup,
.vc-volume:focus-within .vc-vol-popup {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-4px);
}
/* Hover-Bridge: unsichtbarer "Steg" zwischen Button und Popup, damit der
   Hover nicht bricht wenn die Maus vom Button ins Popup wandert. */
.vc-vol-popup::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 12px;
}
/* Slider vertikal via writing-mode (moderne Browser) */
.vc-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;           /* 0 unten, 1 oben */
  width: 4px;
  height: 90px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  outline: none;
  margin: 0;
  cursor: pointer;
}
.vc-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
}
.vc-vol-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* Cursor über dem Video → Signal dass Click = Play/Pause */
body.court-page .court-video-full { cursor: pointer; }

/* Compact bottom-left overlay instead of the legacy bottom-gradient bar.
   Reuses the same visual tokens as /tv/court/ — gleicher Look auf beiden
   Oberflächen. */
body.court-page .tv-overlay {
  position: absolute;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: calc(24px + env(safe-area-inset-left, 0px));
  right: auto;
  background: transparent;
  padding: 0;
  max-width: 85vw;
}

/* Court-Page Safe-Area: Back-Button oben und Controls unten müssen
   iOS Notch/Status-Bar und Home-Indicator berücksichtigen, wenn als PWA
   installiert (viewport-fit=cover). */
body.court-page .back-btn {
  top: calc(1rem + env(safe-area-inset-top, 0px));
  left: calc(1rem + env(safe-area-inset-left, 0px));
}

body.court-page .video-controls {
  padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  padding-left: calc(1rem + env(safe-area-inset-left, 0px));
  padding-right: calc(1rem + env(safe-area-inset-right, 0px));
}

body.court-page .tv-scores {
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.55rem 1rem;
  min-width: 320px;
  backdrop-filter: blur(8px);
}

body.court-page .tv-court-label {
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 0.25rem;
  padding: 0 0.3rem;
  letter-spacing: 1.5px;
}

body.court-page .tv-row {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto auto auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.35rem 0;
}

body.court-page .tv-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.court-page .tv-name.is-loser { color: rgba(255, 255, 255, 0.55); }

body.court-page .tv-set-scores { display: flex; gap: 0.55rem; }
body.court-page .tv-set        { font-size: 1.12rem; min-width: 1.3rem; }
body.court-page .tv-set-cur    { color: rgba(255, 255, 255, 0.55); }

body.court-page .tv-points {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  min-width: 2.3rem;
  text-align: center;
  padding: 0.1rem 0.5rem;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

body.court-page .tv-points:empty { display: none; }

body.court-page .tv-divider { background: rgba(255, 255, 255, 0.14); }

body.court-page .tv-wo-slot { min-width: 2rem; text-align: center; }

body.court-page .tv-idle {
  background: rgba(0, 0, 0, 0.78);
  padding: 0.8rem 1.2rem;
  border-radius: 6px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
}

/* ===== Back button ===== */
.back-btn {
  position: absolute;
  top: 1rem; left: 1rem;
  background: rgba(13,17,23,0.8);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 10;
  transition: background 0.2s;
}
.back-btn:hover { background: var(--card); }

/* ===== Admin pages ===== */
body.admin-page {
  /* Kein max-width: Admin-Pages spannen genauso weit wie Live / Begegnung /
     Schedule (die keinen Cap haben). Innen-Padding kommt aus .admin-section
     und .admin-header. */
  padding-bottom: 2rem;
}

.admin-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.admin-header .back-btn {
  position: absolute;
  left: 1rem; top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid var(--border);
}

.admin-header h1 { font-size: 1.1rem; font-weight: 700; }

/* Admin court list */
.admin-courts {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0 1rem;
}

.admin-court-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
}

.admin-court-card.is-active { border-color: var(--green-lt); }

.admin-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.admin-court-name { font-size: 1rem; font-weight: 700; }

.status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 1px;
}

.status-badge.active { background: var(--green);  color: #fff; }
.status-badge.done   { background: var(--yellow); color: #000; }
.status-badge.idle   { background: var(--border); color: var(--muted); }

.admin-score-preview { margin-bottom: 0.6rem; }

.asp-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.1rem 0;
}

.asp-name { flex: 1; font-size: 0.95rem; font-weight: 600; }
.asp-sets { color: var(--muted); font-size: 0.9rem; font-weight: 600; display: flex; gap: 0.4rem; }
.asp-tiebreak { font-size: 0.7rem; color: var(--red); font-weight: 700; margin-top: 0.2rem; }

/* ===== Admin Court Detail ===== */
.current-score-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.2rem;
  margin: 0 1rem 1rem;
}

.current-score-box.match-over { border-color: var(--yellow); }

.score-display-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.25rem 0;
}

.sd-name { flex: 1; font-size: 1.2rem; font-weight: 700; }
.sd-sets { display: flex; gap: 0.5rem; }

.sd-set {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--muted);
  min-width: 1.5rem;
  text-align: center;
}

.sd-win { color: var(--text); }

.sd-sets-won {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
  text-align: right;
}

.winner-display {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--yellow);
  text-align: center;
  margin-bottom: 0.6rem;
}

/* Admin sections */
.admin-section {
  margin: 0 1rem 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.admin-section h2 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.8rem;
}

.label-hint {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.6;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.danger-section { border-color: rgba(218, 54, 51, 0.3); }

/* Name inputs */
.name-inputs {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.name-input {
  flex: 1;
  min-width: 120px;
  font-size: 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.name-input:focus { border-color: var(--blue); }
.vs-label { color: var(--muted); font-weight: 700; }

/* ===== Scoring Columns (admin_court side-by-side) ===== */
.scoring-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 0 1rem 1rem;
}

.scoring-col {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.8rem;
  border: 1px solid var(--border);
}

.col-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.6rem;
}

/* ── Satz rows (left column) ── */
.satz-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.satz-row:last-of-type { border-bottom: none; }
.satz-done { opacity: 0.7; }
.satz-locked { opacity: 0.25; pointer-events: none; }

.satz-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 1.8rem;
}

.satz-score-done {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--muted);
}

.satz-score-done .satz-win { color: var(--text); }

.satz-check {
  color: var(--green);
  font-size: 0.9rem;
  margin-left: 0.2rem;
}

.satz-score-live {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.satz-num {
  font-size: 1.5rem;
  font-weight: 800;
  min-width: 1.3rem;
  text-align: center;
}

.satz-colon {
  color: var(--muted);
  font-size: 1.2rem;
}

.satz-locked-dash {
  color: var(--muted);
  font-size: 1.2rem;
}

.inline-form { display: inline; margin: 0; padding: 0; }

.inc-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-family: inherit;
}

.inc-btn:active { background: var(--border); }

/* Third set type toggle */
.third-btns {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
}

.btn-type-sm {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}

.btn-type-sm.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* ── Points column (right) ── */
.pts-score-row {
  text-align: center;
  padding: 0.4rem 0 0.6rem;
}

.pts-val {
  font-size: 1.8rem;
  font-weight: 900;
}

.pts-colon {
  font-size: 1.4rem;
  color: var(--muted);
  margin: 0 0.3rem;
}

.pts-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pts-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pts-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  color: #fff;
}

.pts-btn:active { filter: brightness(0.85); }
.pts-btn-p1 { background: var(--green-lt); }
.pts-btn-p2 { background: var(--blue); }

.pts-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.tb-label-sm {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 0.4rem;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
}

/* ── Serve slot (fixed-width ball placeholder) ── */
.serve-slot {
  display: inline-block;
  width: 1.2em;
  flex-shrink: 0;
  text-align: center;
  line-height: 1;
}

/* ── Serve selector ── */
.serve-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 1rem 0.8rem;
  flex-wrap: wrap;
}

.serve-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-serve {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.btn-serve:hover { border-color: var(--blue); }

.btn-serve.is-active {
  background: var(--green);
  border-color: var(--green-lt);
  color: #fff;
}
/* AJAX-Pending-State: Klick-Feedback bis der Server geantwortet hat. */
.btn-serve.is-pending,
.btn-undo.is-pending { filter: brightness(0.85); }

.serve-choice {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.serve-current {
  font-size: 0.9rem;
  font-weight: 700;
}

.btn-serve-switch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-family: inherit;
}

.btn-serve-switch:hover { color: var(--text); border-color: var(--blue); }

/* ===== Teams / Mannschaften ===== */
.team-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.team-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.team-card-main { flex: 1; min-width: 0; }

.team-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.team-card-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.team-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.team-create-form .name-row { margin-bottom: 0; }

.muted-hint {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.4rem 0;
}

/* Meldeliste */
.roster-paste {
  width: 100%;
  font-family: monospace;
  font-size: 0.8rem;
  padding: 0.7rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  outline: none;
}

.roster-paste:focus { border-color: var(--blue); }

.roster-btn-row {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.4rem;
}

.roster-list {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.roster-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.roster-players {
  list-style: decimal inside;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.8rem;
  padding-left: 0.4rem;
}

.roster-players li {
  padding: 0.15rem 0;
}

/* Match meta (team + opponent) in admin court page */
.match-meta-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.match-meta-row select.name-input,
.match-meta-row input.name-input {
  flex: 1;
  min-width: 0;
}

/* Team label on admin list */
.admin-team-line {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* Team label below score on index score cards */
.sc-team-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

/* Team label on stream overlay (under the score rows) */
.overlay-team-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* ===== Begegnungen ===== */

/* Aggregated score header (admin edit) */
.bg-aggregate-score {
  text-align: center;
  padding: 0.6rem;
  font-size: 2rem;
  font-weight: 900;
  color: var(--text);
}

.bg-aggregate-score .bg-as-colon {
  color: var(--muted);
  margin: 0 0.4rem;
}

/* Lineup grid (admin edit) */
.lineup-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.lineup-head {
  display: grid;
  grid-template-columns: 2.2rem 1fr 1fr auto;
  gap: 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.lineup-row {
  display: grid;
  grid-template-columns: 2.2rem 1fr 1fr auto;
  gap: 0.6rem;
  align-items: start;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.lineup-pos {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
  padding-top: 0.5rem;
}

.lineup-cell {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.lineup-cell .name-input {
  width: 100%;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
}

/* Slot status (start/live/done) */
.slot-status,
.slot-start-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.slot-status-done .slot-result {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.slot-result .satz-win { color: var(--green); }

.slot-status-live .slot-live-link {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue);
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--blue);
  border-radius: 12px;
}

.court-pick {
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.btn-icon:hover { border-color: var(--blue); color: var(--blue); }

/* ===== Admin sub-tab navigation ===== */
.admin-subnav {
  display: flex;
  gap: 0.2rem;
  padding: 0.5rem 1rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.admin-subtab {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
  white-space: nowrap;
  margin-bottom: -1px;
}

.admin-subtab:hover { color: var(--text); }

.admin-subtab.is-active {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-color: var(--card);
}

/* Admin-Subnav auf Mobile: kompakt + horizontal scrollbar wenn die Tabs
   nicht alle in eine Zeile passen. (Früher: display:none mit Verweis auf
   einen Hamburger-Sub-Eintrag, der aber nie für mein-bereich gebaut wurde
   — auf Mobile waren die 4 Mein-Bereich-Subtabs damit unerreichbar.) */
@media (max-width: 640px) {
  .admin-subnav {
    padding: 0.4rem 0.6rem 0;
    gap: 0.15rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .admin-subnav .admin-subtab {
    font-size: 0.78rem;
    padding: 0.4rem 0.7rem;
  }
}

/* ===== Admin Matches: date picker ===== */
.admin-date-picker {
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-date-picker form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-date-picker label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-date-picker input[type=date] {
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
}

/* ===== Nicht zugewiesen: collapsible list with inline forms ===== */
.unassigned-section {
  margin: 0 1rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
}

.unassigned-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  user-select: none;
}

.unassigned-section > summary::-webkit-details-marker { display: none; }

.unassigned-section > summary::before {
  content: "▸";
  display: inline-block;
  color: var(--muted);
  font-size: 0.8rem;
  transition: transform 0.15s;
  width: 0.8rem;
}

.unassigned-section[open] > summary::before {
  transform: rotate(90deg);
}

.unassigned-section > summary .section-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  padding: 0;
  margin: 0;
}

.unassigned-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0 0;
}

.unassigned-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.ua-info {
  flex: 1;
  min-width: 200px;
}

.ua-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}

.ua-type-badge {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
}

.ua-type-tournament { background: var(--blue);  color: #fff; }
.ua-type-mannschaft { background: var(--green); color: #fff; }

.ua-pos {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--bg);
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ua-event {
  font-size: 0.75rem;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

.ua-players {
  font-size: 0.9rem;
  font-weight: 600;
}

.ua-inputs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.ua-inputs .ua-date,
.ua-inputs .ua-time,
.ua-inputs .ua-court {
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
}

.ua-inputs .ua-date  { width: 9rem; }
.ua-inputs .ua-time  { width: 6rem; }
.ua-inputs .ua-court { min-width: 7rem; }

.ua-date-fixed {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  color: var(--muted);
  width: 9rem;
}

/* ===== Meldeliste (admin tournament view) ===== */
.meldeliste-list {
  list-style: decimal inside;
  font-size: 0.9rem;
  padding-left: 0.4rem;
  margin-bottom: 0.5rem;
}

.meldeliste-list li {
  padding: 0.2rem 0;
}

.kpl-seed {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.05rem 0.3rem;
  border-radius: 6px;
  margin-right: 0.3rem;
}

.kpl-lk {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
  margin-left: 0.3rem;
}

.ml-name {
  font-weight: 600;
}

.meldeliste-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

/* ===== Admin tab — court tile grid with schedule + start buttons ===== */
.admin-court-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.9rem;
  padding: 0 1rem 1rem;
}

.admin-court-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-court-tile.is-busy { border-color: var(--blue); }

.admin-court-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.admin-court-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}

.admin-court-status {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.4rem;
  border-radius: 8px;
}

.admin-court-status.status-live { background: var(--blue);  color: #fff; }
.admin-court-status.status-done { background: var(--green); color: #fff; }

/* Current live state (small score box at top of tile) */
.admin-court-current {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: rgba(31, 111, 235, 0.04);
}

.acc-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
  font-size: 0.85rem;
  font-weight: 700;
}

.acc-name {
  flex: 1;
  min-width: 0;
}

.acc-sets {
  display: flex;
  gap: 0.35rem;
}

.acc-set {
  display: inline-block;
  min-width: 1.1rem;
  text-align: center;
  font-weight: 800;
  color: var(--muted);
}

.acc-set.acc-set-win { color: var(--text); }
.acc-set.acc-set-cur { color: var(--blue); }

.acc-manage-link {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue);
}

/* Today's match list inside the tile */
.admin-tile-matches {
  display: flex;
  flex-direction: column;
}

.admin-tile-match {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.admin-tile-match:last-child { border-bottom: none; }
.admin-tile-match.admin-tile-match-live { background: rgba(31, 111, 235, 0.06); }
.admin-tile-match.admin-tile-match-done { opacity: 0.75; }

.atm-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.atm-time {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text);
}

.atm-pos {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.atm-team {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.atm-status {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.1rem 0.35rem;
  border-radius: 8px;
  margin-left: auto;
}

.atm-status-live { background: var(--blue);  color: #fff; }
.atm-status-done { background: var(--green); color: #fff; }
.atm-status-open {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.atm-players {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.atm-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.atm-actions .btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; flex: 0 0 auto; }
.atm-actions .btn:disabled { opacity: 0.4; cursor: not-allowed; }

.atm-result {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.atm-result .satz-win { color: var(--green); }

.admin-tile-empty {
  padding: 1rem 0.9rem;
  text-align: center;
}

/* Confirm dialog */
.start-dialog {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 90vw;
  width: 360px;
}

.start-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.dialog-form {
  padding: 1.2rem 1.4rem;
}

.dialog-form h3 {
  font-size: 1.05rem;
  margin-bottom: 0.8rem;
}

.dialog-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.dialog-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.3rem 0.5rem 0.3rem 0;
  vertical-align: top;
  width: 6.5rem;
}

.dialog-table td {
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.3rem 0;
  color: var(--text);
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.dialog-actions .btn { width: auto; padding: 0.5rem 1rem; }

/* ===== Tournament konkurrenz overview (intermediate page) ===== */
.konkurrenz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.8rem;
  padding: 0 1.5rem;
}
.konkurrenz-grid-3col {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 760px) {
  .konkurrenz-grid-3col { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .konkurrenz-grid-3col { grid-template-columns: 1fr; }
}

/* Geschlechter-Spalten: Herren | Damen nebeneinander, jeweils mit eigenen
   gestapelten Konkurrenz-Kacheln. Auf Mobile: untereinander. */
.konkurrenz-gender-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 640px) {
  .konkurrenz-gender-cols { grid-template-columns: 1fr; }
}
.konkurrenz-gender-col .section-title { padding: 0 1.5rem; }
.konkurrenz-gender-col .konkurrenz-grid {
  grid-template-columns: 1fr;
}

.konkurrenz-card {
  display: block;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.konkurrenz-card:hover { border-color: var(--blue); }

.kc-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.kc-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.kc-progress {
  margin-top: 0.6rem;
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}

.kc-progress-bar {
  height: 100%;
  background: var(--blue);
  transition: width 0.3s ease;
}

/* Edit-dialog inputs (admin tournament bracket edit) */
.bedlg-player-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.bedlg-player-row label {
  width: 5rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.bedlg-player-row input { flex: 1; min-width: 0; }
.bedlg-player-row input:disabled { opacity: 0.5; cursor: not-allowed; }

.bedlg-result {
  margin-top: 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.bedlg-result label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}

.btn-edit-bracket {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--blue);
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  margin-top: 0.3rem;
}

.btn-edit-bracket:hover {
  background: var(--blue);
  color: #fff;
}

/* ===== Tournament KO bracket (Phase T2) ===== */
.tournament-page .tournament-header {
  padding: 1rem 1.5rem 0.4rem;
}

.tournament-page .empty-state {
  padding: 1.2rem 1.5rem;
}

/* Subtab-Nav (Bracket / Meldeliste auf Konkurrenz-Seite) */
.subtab-nav {
  display: flex;
  gap: 0.4rem;
  padding: 0.4rem 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.subtab {
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subtab:hover { color: var(--text); }
.subtab.is-active {
  color: var(--text);
  border-bottom-color: var(--blue);
}

/* Entry-List (Meldeliste, public) */
.entry-list {
  list-style: decimal;
  padding-left: 1.6rem;
  margin: 0;
}
.entry-list-item {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: baseline;
}
.entry-list-item:last-child { border-bottom: 0; }
.el-name { font-weight: 600; flex: 1 1 auto; }
.el-lk {
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--bg);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
}
.el-club { font-size: 0.82rem; color: var(--muted); }
.el-player-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: baseline;
  width: 100%;
}
.el-partner-row {
  padding-left: 0.6rem;
  border-left: 2px solid var(--border);
  margin-top: 0.25rem;
}
.entry-list-item { flex-direction: column; align-items: flex-start; }

/* /live/<id> nutzt das alte court-page-CSS (court-fullscreen, court-chrome,
   vc-*-Controls). Hier nur die Hover-Animation aufs Score-Overlay drauf. */

/* Auf /live/<id> + /vod/<id>: Grid-Layout für die Score-Zeilen damit Sets
   beider Spieler PIXELGENAU übereinander stehen (auch bei unterschiedlich
   langen Namen). Spalten:
     [serve] [name 14rem] [set1] [set2] [set3] [match-pt rechts]
   Der ov-sets-Wrapper ist display:contents, damit die einzelnen .ov-set
   direkt in die Grid-Spalten 3-5 fallen. */
body.court-page .overlay-row,
body.vod-page   .overlay-row {
  display: grid;
  grid-template-columns:
    1.2rem                      /* serve-slot */
    14rem                       /* name */
    1.6rem 1.6rem 1.6rem        /* up to 3 sets, tight */
    1.8rem                      /* match-point (Game-Score 0/15/30/40/A) */
    1fr;                        /* filler, schiebt rechts auf */
  align-items: baseline;        /* Text-Baseline statt Box-Center */
  gap: 0.25rem;                 /* enger zusammen */
}
body.court-page .overlay-row .ov-set,
body.vod-page   .overlay-row .ov-set {
  font-size: 0.95rem;           /* identisch zu .ov-name → keine Höhen-Diff durch Ascent */
  line-height: 1;
}
body.court-page .overlay-row .ov-name,
body.vod-page   .overlay-row .ov-name {
  flex: none;
  width: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.court-page .overlay-row .ov-sets,
body.vod-page   .overlay-row .ov-sets {
  display: contents;            /* Sets-Children fallen direkt in die Grid-Spalten */
}
body.court-page .overlay-row .ov-set,
body.vod-page   .overlay-row .ov-set {
  text-align: center;
  min-width: 0;                 /* override base 1rem */
}
body.court-page .overlay-row .ov-wo-slot,
body.vod-page   .overlay-row .ov-wo-slot {
  text-align: center;
  margin-left: 0;               /* kein auto mehr — Grid setzt die Position */
}

/* Hover-Lift NUR auf /live/<id>: wird gekoppelt an die Auto-Hide-Logik der
   Chrome-Bar — solange .court-fullscreen die Klasse .is-chrome-visible hat
   (Maus war kürzlich aktiv) wird das Overlay nach oben geschoben, bündig
   bis direkt über die Bar. Sobald die Chrome verschwindet (3 s ohne
   Maus-Aktivität), fällt das Overlay zurück. */
body.court-page .score-overlay {
  transition: transform 0.25s ease;
  will-change: transform;
}
body.court-page .court-fullscreen.is-chrome-visible .score-overlay {
  /* Lift-Höhe wird zur Laufzeit aus der tatsächlichen Chrome-Bar-Höhe
     berechnet (JS setzt --chrome-bar-h auf .court-fullscreen). Fallback
     100 px falls JS aus ist. */
  transform: translateY(calc(-1 * var(--chrome-bar-h, 100px)));
}

/* CC-Toggle als .vc-btn-Variante in der Bottom-Bar. Off-State dimmt
   den Button (Browser-Standard für inaktive Captions-Buttons). */
.vc-btn.is-off { opacity: 0.45; }
.vc-btn-cc .vc-cc-icon {
  display: inline-block;
  padding: 0.05rem 0.3rem;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  font-size: 0.7rem;
  line-height: 1;
  font-weight: 700;
}

/* Die alte vod-page-Klasse wird nicht mehr benutzt (vod-mode ersetzt sie
   in der neuen Variante). Lassen wir die Regeln aber stehen — Browsers
   ignorieren sie still. Neue Layout-/Hover-Regeln auf body.vod-page
   greifen weiterhin für vod-mode wenn die Selektoren matchen. */

/* ═════ Player-Page (/spieler/<last>/<first>) ═════ */
.player-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem 3rem;
}
.player-header {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  padding: 1rem 0 1.5rem;
  position: relative;
}
.player-photo-wrap {
  flex-shrink: 0;
  width: 120px; height: 120px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--card);
  border: 2px solid var(--border);
}
.player-photo {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.player-photo-placeholder svg { width: 100%; height: 100%; display: block; }

.player-head-info { flex: 1; min-width: 0; }
.player-name {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 0.4rem;
}
.player-quick-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.player-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
}

.player-data {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
}
.player-data dt {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.player-data dd {
  margin: 0;
  font-weight: 600;
}

.player-teams { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.player-team-link {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.55rem 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.player-team-link:hover { border-color: var(--blue); }
.player-team-league { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.player-team-name   { font-weight: 700; }

.player-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}
.player-stat-box {
  padding: 0.8rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.player-stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.player-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.player-match-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.player-match {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "meta badge"
    "body result";
  gap: 0.4rem 0.8rem;
  align-items: center;
}
.player-match.is-win  { border-left-color: #2ea043; }
.player-match.is-loss { border-left-color: #c84a4a; }
.pm-meta {
  grid-area: meta;
  display: flex; gap: 0.6rem; align-items: baseline;
  font-size: 0.78rem; color: var(--muted);
  flex-wrap: wrap;
}
.pm-pos { font-weight: 800; color: var(--text); font-size: 0.85rem; }
.pm-team { color: var(--text); text-decoration: none; }
.pm-team:hover { color: var(--blue); }
.pm-side {
  grid-area: badge;
  justify-self: end;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.pm-side.is-home { background: rgba(46,160,67,0.18); color: #2ea043; }
.pm-side.is-away { background: rgba(216,148,52,0.18); color: #d4a534; }
.pm-body {
  grid-area: body;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pm-side-block { font-weight: 600; }
.pm-vs { color: var(--muted); font-size: 0.85rem; }
.pm-result {
  grid-area: result;
  justify-self: end;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.pm-set { margin-left: 0.2rem; }

.player-notes {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  white-space: pre-wrap;
}

@media (max-width: 540px) {
  .player-stat-row { grid-template-columns: 1fr; }
  .player-photo-wrap { width: 90px; height: 90px; }
  .player-name { font-size: 1.2rem; }
  .pm-body { grid-template-columns: 1fr; }
  .pm-result { text-align: left; }
}

/* ═════ VOD-Page ═════ */
.vod-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}
.vod-header { margin-bottom: 1rem; }
.vod-title { font-size: 1.5rem; font-weight: 800; margin: .4rem 0 .2rem; }
.vod-meta  { color: var(--muted); font-size: 0.88rem; }
.vod-player-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 1rem;
}
/* Score-Overlay über dem VOD-Player — identische Optik zum /live/<id>.
   Sitzt etwas höher als bottom:0, damit die HTML5-Native-Controls
   (~40 px) drunter frei bleiben. */
.vod-score-overlay {
  position: absolute;
  left: 0; right: 0;
  bottom: 2.6rem;
  pointer-events: none;
  z-index: 2;
}
.vod-score-overlay:empty { display: none; }

/* Custom Fullscreen-Button (verstreckt rechts unten an der Stelle vom
   nativen FS-Button — den wir per controlslist=nofullscreen aus dem
   Native-Controls-Layout entfernt haben). */
.vod-fs-btn {
  position: absolute;
  right: 0.6rem;
  bottom: 0.4rem;
  z-index: 3;
  width: 34px; height: 34px;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
  pointer-events: auto;
}
.vod-fs-btn:hover { color: #fff; }

/* Im Fullscreen-Modus füllt die wrap den ganzen Screen — und unser
   Overlay + CC-Button sitzen damit AUF dem Vollbild, nicht außerhalb. */
.vod-player-wrap:fullscreen,
.vod-player-wrap:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
}
.vod-player-wrap:fullscreen .vod-player,
.vod-player-wrap:-webkit-full-screen .vod-player {
  width: 100%;
  height: 100%;
  max-height: 100vh;
  object-fit: contain;
}

/* Score-CC-Toggle: kleiner Button oben-rechts überm Player. Persistiert
   Sichtbarkeit des Score-Overlays in localStorage. */
.vod-cc-toggle {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 6px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  backdrop-filter: blur(6px);
}
.vod-cc-toggle:hover { background: rgba(0, 0, 0, 0.85); }
.vod-cc-icon {
  display: inline-block;
  padding: 0.05rem 0.32rem;
  border: 1.5px solid #fff;
  border-radius: 3px;
  font-size: 0.7rem;
  line-height: 1;
}
.vod-cc-state {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
}
.vod-cc-toggle.is-off { opacity: 0.55; }
.vod-cc-toggle.is-off .vod-cc-icon { border-color: rgba(255,255,255,0.5); }
.vod-player {
  width: 100%;
  display: block;
  max-height: 80vh;
}
.vod-section { margin-top: 1.4rem; }
.vod-player-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.vod-player-list li {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.92rem;
}
.vod-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.vod-status {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-top: 1rem;
}
.vod-status-error { border-color: #c84a4a; }
.vod-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: vod-spin 1s linear infinite;
  flex-shrink: 0;
}
@keyframes vod-spin { to { transform: rotate(360deg); } }

.vod-list {
  display: grid;
  gap: 0.6rem;
}
.vod-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  color: var(--text);
  text-decoration: none;
}
.vod-card:hover { border-color: var(--blue); }
.vod-card-title { font-weight: 700; font-size: 1.05rem; }
.vod-card-meta {
  font-size: 0.83rem; color: var(--muted); margin-top: 0.2rem;
}
.vod-card-status { margin-top: 0.4rem; }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge-ok { background: rgba(46,160,67,0.15); color: #2ea043; border-color: #2ea043; }
.badge-error { background: rgba(200,74,74,0.15); color: #c84a4a; border-color: #c84a4a; }

.admin-vods-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.admin-vods-table th, .admin-vods-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.admin-vods-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.admin-vods-table tr.is-hidden { opacity: 0.55; }
.admin-vods-actions { white-space: nowrap; }
.admin-vods-actions .inline-form { display: inline-block; margin-right: 0.3rem; }

/* Mode-Toggle (Einzel / Doppel) — pill-style segmented control,
   liegt rechts neben dem Konkurrenz-Namen im Import-Block. */
.mode-name-row {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.mode-pills {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.mode-pill {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.mode-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.mode-pill span {
  display: inline-block;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  border-right: 1px solid var(--border);
}
.mode-pill:last-child span { border-right: 0; }
.mode-pill input:checked + span {
  background: var(--blue);
  color: #fff;
}

/* Admin: zwei Boxen pro Konkurrenz (Bracket + Meldeliste) */
.konkurrenz-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.6rem;
}
@media (max-width: 720px) {
  .konkurrenz-edit-grid { grid-template-columns: 1fr; }
}
.konkurrenz-edit-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
}
.konkurrenz-edit-box .roster-paste { width: 100%; box-sizing: border-box; }

.tournament-name {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
}

.tournament-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.tournament-konkurrenz-section {
  padding: 0.8rem 0 1.2rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.tk-section-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  padding: 0 1rem 0.4rem;
}

/* Bracket horizontal scroll wrapper */
.bracket-wrap {
  overflow-x: auto;
  padding: 0.5rem 1rem 1rem;
  -webkit-overflow-scrolling: touch;
}

.bracket {
  display: flex;
  gap: 1.4rem;
  align-items: stretch;
  min-height: 360px;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  min-width: 220px;
  flex-shrink: 0;
}

.bracket-round-label {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 0.4rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* The actual matches container — distributes matches evenly, so later rounds
   visually align to the midpoint between pairs in the previous round */
.bracket-round-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 0.5rem;
}

/* Each match card */
.bracket-match {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
}

.bracket-match.bm-done { opacity: 0.92; }

.bm-player {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.85rem;
}

.bm-player + .bm-player {
  border-top: 1px solid var(--border);
}

.bm-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bm-tbd { color: var(--muted); font-style: italic; }
.bm-bye { color: var(--muted); font-style: italic; }

.bm-seed {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.05rem 0.3rem;
  border-radius: 6px;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.bm-sets {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.bm-set {
  display: inline-block;
  min-width: 1.05rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--muted);
}

.bm-set.bm-set-win { color: var(--text); }

.bm-meta {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.3rem;
  padding-top: 0.25rem;
  border-top: 1px dashed var(--border);
  text-align: right;
}

.bm-live-tag {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bracket-match.bm-live {
  border-color: var(--blue);
  background: rgba(31, 111, 235, 0.06);
}

.bm-actions {
  margin-top: 0.4rem;
  text-align: right;
}

.btn-start-tournament {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--green-lt);
  background: transparent;
  color: var(--green-lt);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.btn-start-tournament:hover {
  background: var(--green-lt);
  color: #fff;
}

/* Mobile: breitere Matches damit Namen nicht abgeschnitten werden.
   Horizontal-Scroll durch .bracket-wrap bleibt erhalten. */
@media (max-width: 640px) {
  .bracket { gap: 0.8rem; min-height: 300px; }
  .bracket-round { min-width: 240px; }

  .bm-player {
    align-items: flex-start;
    font-size: 0.82rem;
    gap: 0.5rem;
  }
  .bm-name {
    font-size: 0.82rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    line-height: 1.3;
  }
  .bm-sets { padding-top: 0.1rem; }
  .bm-set { font-size: 0.88rem; min-width: 1rem; }

  /* Turnier-Header: Back-Button aus absolutem Layout holen, damit er
     nicht den Titel überlappt. Titel nimmt Mobile-angepasste Größe. */
  .tournament-page .tournament-header { padding: 0.8rem 1.5rem 0.4rem; }
  .tournament-page .back-btn {
    position: static;
    display: inline-block;
    margin-bottom: 0.5rem;
  }
  .tournament-page .tournament-name { font-size: 1.2rem; line-height: 1.25; }
  .tournament-page .tournament-meta { font-size: 0.75rem; }
}

/* Mini-Phones (<400px): wieder etwas schmaler, damit 2 Matches nicht
   direkt komplett vom Screen verschwinden */
@media (max-width: 400px) {
  .bracket-round { min-width: 210px; }
}

/* ===== Schedule view (court tiles in a responsive grid) ===== */
.sched-court-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.9rem;
  padding: 0 1rem;
}

.sched-court-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sched-court-head {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.sched-court-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}

.sched-court-matches {
  display: flex;
  flex-direction: column;
}

/* Each match row inside a court tile */
.sched-tile-match {
  display: block;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.sched-tile-match:last-child { border-bottom: none; }
.sched-tile-match:hover { background: var(--bg); }
.sched-tile-match.sched-tile-match-live { background: rgba(31, 111, 235, 0.06); }
.sched-tile-match.sched-tile-match-done { opacity: 0.72; }

.sched-tile-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}

.sched-tile-time {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
}

.sched-tile-pos {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.sched-tile-team {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sched-tile-status {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.1rem 0.35rem;
  border-radius: 8px;
  margin-left: auto;
}

.sched-tile-status-live { background: var(--blue);   color: #fff; }
.sched-tile-status-done { background: var(--green);  color: #fff; }
.sched-tile-status-open {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.sched-tile-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.sched-tile-row-open { padding: 0.3rem 0 0.1rem; font-size: 0.82rem; }

.sched-tile-pname {
  flex: 1;
  min-width: 0;
}

.sched-tile-sets {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.sched-tile-set {
  display: inline-block;
  min-width: 1.05rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--muted);
}

.sched-tile-set.sched-tile-set-win { color: var(--text); }
.sched-tile-set.sched-tile-set-cur { color: var(--blue); }

.sched-unscheduled {
  margin-top: 1.5rem;
  padding: 0 1rem;
}

.sched-unscheduled-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
}

.schedule-page .empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

/* ===== Scoring tab list ===== */
.scoring-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0 1rem;
}

.scoring-tap-card {
  display: block;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.scoring-tap-card:hover { border-color: var(--blue); }
.scoring-tap-card:active { filter: brightness(0.92); }

.scoring-tap-card .sc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.scoring-tap-card .sc-name {
  font-size: 1rem;
  font-weight: 800;
}

.scoring-tap-card .sc-badge.tb {
  background: var(--yellow);
  color: #000;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scoring-tap-card .sc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.scoring-tap-card .sc-player {
  flex: 1;
  min-width: 0;
}

.scoring-tap-card .sc-sets {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.scoring-tap-card .sc-set {
  display: inline-block;
  min-width: 1.2rem;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--muted);
}

.scoring-tap-card .sc-set.sc-set-win { color: var(--text); }
.scoring-tap-card .sc-set.sc-set-cur { color: var(--blue); }

.scoring-tap-card .sc-team-label {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.scoring-list-page .empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

/* ===== Court scoring page (mobile-first) ===== */
.scoring-page .court-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem 0.4rem;
}

.court-page-head-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Override the global absolutely-positioned .back-btn so both links flow
   side-by-side inside .court-page-head-links on the scoring page. */
.scoring-page .court-page-head-links .back-btn {
  position: static;
  top: auto;
  left: auto;
}

.back-btn.back-btn-alt {
  background: transparent;
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
}

.court-page-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0;
}

.scoring-page .empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-state-icon {
  /* Empty-State-Icons waren farbige Emojis (🎾, 📅, 📊, 🗓 …). Im neuen
     Design rein textlich — der Empty-State-Text ist sprechend genug. */
  display: none;
  font-size: 3rem;
  opacity: 0.4;
  margin-bottom: 0.5rem;
}

/* Score box (mobile-prominent) */
.score-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0 1rem 1rem;
}

.score-box.match-over { border-color: var(--green); }

.score-box .score-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.score-box .sd-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}

.score-box .sd-sets {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.score-box .sd-set {
  display: inline-block;
  min-width: 1.2rem;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--muted);
}

.score-box .sd-set.sd-win { color: var(--text); }
.score-box .sd-set.sd-cur { color: var(--blue); }

.score-box .sd-set.sd-tb {
  color: var(--yellow);
  font-size: 0.95rem;
  font-weight: 700;
  margin-left: 0.1rem;
}

.score-box .sd-pts {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--yellow);
  min-width: 3rem;
  text-align: right;
}

.score-box .sd-meta {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.4rem;
  text-align: center;
}

.score-box .winner-display {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--green);
  text-align: center;
  padding: 0.5rem 0;
}

/* Big +1 buttons — primary scoring action */
.big-points {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin: 0 1rem 1rem;
}

.bp-col {
  margin: 0;
  display: flex;
}

.bp-btn {
  width: 100%;
  min-height: 130px;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: inherit;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1rem;
  /* No transition: must be instant for fast scoring */
}

.bp-btn:active,
.bp-btn.is-pending { filter: brightness(0.85); }
.bp-btn-p1 { background: var(--green-lt); }
.bp-btn-p2 { background: var(--blue); }

.bp-plus {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
}

.bp-name {
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  word-break: break-word;
}

/* Smaller "+1 Punkt" secondary buttons below the big game buttons */
.small-points {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin: 0 1rem 1rem;
}

.sp-col { margin: 0; display: flex; }

.sp-btn {
  width: 100%;
  height: 48px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.sp-btn:active,
.sp-btn.is-pending { filter: brightness(0.85); }

.sp-btn-p1 {
  border-color: var(--green-lt);
  color: var(--green-lt);
}
.sp-btn-p1:hover { background: rgba(46, 160, 67, 0.12); }

.sp-btn-p2 {
  border-color: var(--blue);
  color: var(--blue);
}
.sp-btn-p2:hover { background: rgba(31, 111, 235, 0.12); }

/* Secondary actions area */
.scoring-secondary {
  margin: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.serve-block {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.7rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sb-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 0.3rem;
}

/* Game-fix collapsible (rare action) */
.game-fix {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
}

.game-fix > summary {
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.game-fix > summary::before {
  content: "▸ ";
  display: inline-block;
  margin-right: 0.3rem;
  transition: transform 0.15s;
}

.game-fix[open] > summary::before { content: "▾ "; }

.game-fix-rows {
  padding: 0 0.8rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.game-fix-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  gap: 0.6rem;
}

.game-fix-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.game-fix-row .inc-btn {
  width: auto;
  min-width: 4.5rem;
  height: 32px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  padding: 0 0.7rem;
}

.undo-set-form { margin: 0; }
.undo-set-form .btn-undo {
  width: auto;
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.5rem 0.9rem;
}

/* Setup section (collapsible, spielleiter only) */
.setup-section {
  margin: 1.5rem 1rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.setup-section > summary {
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.setup-section > summary::-webkit-details-marker { display: none; }

.setup-summary-icon { font-size: 1.1rem; }

.setup-summary-hint {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--yellow);
  letter-spacing: 0.5px;
  margin-left: auto;
}

.setup-section[open] > summary { border-bottom: 1px solid var(--border); }

.setup-body {
  padding: 0.6rem 1rem 1rem;
}

.setup-body .admin-section {
  margin-top: 0.8rem;
  padding: 0;
  background: transparent;
  border: none;
}

.setup-body .admin-section h2 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0.5rem;
}

/* Mobile tweaks for scoring page */
@media (max-width: 640px) {
  .bp-btn { min-height: 110px; }
  .bp-plus { font-size: 1.7rem; }
  .score-box { margin: 0 0.6rem 0.8rem; padding: 0.7rem 0.8rem; }
  .big-points { margin: 0 0.6rem 0.8rem; gap: 0.5rem; }
  .small-points { margin: 0 0.6rem 0.8rem; gap: 0.5rem; }
  .scoring-secondary { margin: 0 0.6rem; }
}

/* Imported away roster (in begegnung edit) */
.away-roster-box {
  margin-top: 0.4rem;
}

.away-roster-list {
  list-style: decimal inside;
  font-size: 0.85rem;
  padding: 0.5rem 0.4rem;
  margin-bottom: 0.5rem;
  max-height: 250px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.away-roster-list li { padding: 0.15rem 0.4rem; }

/* ===== Slot cards (admin begegnung edit) ===== */
.slot-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.slot-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
}

.slot-card.slot-status-live { border-color: var(--blue); }
.slot-card.slot-status-done { opacity: 0.85; }

.slot-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.slot-card-header .slot-pos {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
  min-width: 1.8rem;
}

.slot-time-inp,
.slot-court-sel {
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
}

.slot-time-inp { width: 6rem; }
.slot-court-sel { min-width: 6.5rem; }

.slot-card-action {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.slot-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-top: 0.6rem;
}

.slot-side {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.slot-side-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  width: 100%;
}

.slot-side .name-input {
  flex: 1;
  min-width: 6rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
}

.slot-card-body-doubles .slot-side .name-input {
  flex: 1 1 calc(50% - 0.2rem);
}

.lineup-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.8rem;
}

.hidden-action-form {
  display: contents;
}

/* Court picker (admin edit) */
.court-picker {
  margin-top: 0.8rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.court-picker-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
}

.court-picker-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
}

.court-picker-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.court-picker-row select.name-input {
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
}

/* One-click start button */
.btn-start {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: 14px;
  border: 1px solid var(--green-lt);
  background: transparent;
  color: var(--green-lt);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.btn-start:hover {
  background: var(--green-lt);
  color: #fff;
}

.btn-stop {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: 14px;
  border: 1px solid var(--red);
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.btn-stop:hover {
  background: var(--red);
  color: #fff;
}

/* Court + schedule line in public match row */
.bg-match-court {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 0.15rem;
  white-space: nowrap;
}

/* ===== Public list of Begegnungen ===== */
/* Favoriten-Toggle (♥) — kompakter Icon-Button. Inactive=muted, Active=blau. */
.fav-form { display: inline-flex; }
.fav-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  font-family: inherit;
  font-variant-emoji: text;  /* monochrome ♥ statt color-emoji */
  transition: color 0.15s ease, border-color 0.15s ease;
}
.fav-btn:hover { color: var(--blue); border-color: var(--border); }
.fav-btn.is-fav { color: var(--blue); }
.fav-btn.is-fav:hover { color: var(--muted); }
.fav-icon { font-weight: bold; }
.icon-svg { width: 1.1em; height: 1.1em; display: block; vertical-align: middle; }
.fav-btn .icon-svg, .bell-btn .icon-svg { width: 1.15em; height: 1.15em; }

/* Bell-Button (Benachrichtigungs-Einstellungen pro Favorit) */
.bell-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  font-family: inherit;
  font-variant-emoji: text;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.bell-btn:hover:not(:disabled) { color: var(--blue); border-color: var(--border); }
.bell-btn.is-active { color: var(--blue); }
.bell-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.bell-icon { font-weight: bold; }
.fav-bell-pair { display: inline-flex; align-items: center; gap: 0.15rem; }

/* Bell-Modal (Per-Favorit-Override-Dialog) */
.bell-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.bell-modal[hidden] { display: none; }
.bell-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
}
.bell-modal-card {
  position: relative; z-index: 1;
  background: var(--bg, #fff);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem 1.2rem 1rem;
  max-width: 420px;
  width: calc(100% - 2rem);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.bell-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.4rem;
}
.bell-modal-title { margin: 0; font-size: 1.05rem; }
.bell-modal-close {
  background: none; border: 0; font-size: 1.4rem;
  cursor: pointer; color: var(--muted); padding: 0.2rem 0.5rem;
}
.bell-modal-sub { font-size: 0.85rem; margin: 0.2rem 0 0.6rem; }
.bell-modal-events {
  list-style: none; padding: 0; margin: 0.6rem 0;
}
.bell-modal-event {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 0; border-bottom: 1px solid var(--border);
}
.bell-modal-event:last-child { border-bottom: 0; }
.bell-modal-event-label { flex: 1; }
.bell-modal-event-select {
  background: var(--bg-elev, #f6f6f6);
  border: 1px solid var(--border);
  border-radius: 6px; padding: 0.25rem 0.4rem;
  color: inherit; font-family: inherit;
}
.bell-modal-foot {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  margin-top: 0.8rem;
}
body.modal-open { overflow: hidden; }

/* Push-Settings auf der Favoriten-Page */
.push-settings-section { margin-bottom: 1.6rem; }
.push-banner {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin: 0.6rem 0 1rem;
  background: var(--bg-elev, transparent);
}
.push-banner-ok { border-color: var(--blue); }
.push-banner-warn { border-color: #b08800; }
.push-banner-body strong { display: block; margin-bottom: 0.1rem; }
.push-global-prefs .push-prefs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.4rem 1rem; margin-top: 0.5rem;
}
/* Custom-Checkbox-Look — native input visually hidden, eigene Box per CSS.
   Im aktiven Zustand blau gefüllt + Häkchen. Konsistent mit dem TEC-Stil. */
.push-pref-toggle {
  display: inline-flex; align-items: center; gap: 0.6rem;
  cursor: pointer; padding: 0.35rem 0; font-size: 0.92rem;
  user-select: none;
}
.push-pref-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.push-pref-toggle-box {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  display: inline-block;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.push-pref-toggle input[type="checkbox"]:checked + .push-pref-toggle-box {
  background: var(--blue);
  border-color: var(--blue);
}
.push-pref-toggle input[type="checkbox"]:checked + .push-pref-toggle-box::after {
  content: "";
  position: absolute;
  left: 0.32rem;
  top: 0.06rem;
  width: 0.3rem;
  height: 0.6rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.push-pref-toggle input[type="checkbox"]:focus-visible + .push-pref-toggle-box {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.push-pref-toggle-label { color: var(--text); }

.push-banner-btn { display: inline-block; width: auto; margin-top: 0.6rem; }
.push-device-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.push-device-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.6rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.push-device-item:last-child { border-bottom: 0; }
.push-device-ua { word-break: break-all; }
.push-device-meta { white-space: nowrap; }

.fav-match-list { list-style: none; padding: 0; margin: 0; }
.fav-match-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border);
}
.fav-match-headline { font-weight: 600; color: var(--text); }

/* Site-header rechts ggf. mehrere Aktionen (Fav-Pair + Verwalten-Button) */
.site-header-actions {
  display: inline-flex; align-items: center; gap: 0.4rem;
}

/* Bell oben rechts in Score-Cards (Live-Tab) — auf Mobile etwas größerer Tap-Target */
.sc-bell { margin-left: auto; display: inline-flex; }
.sc-bell .bell-btn { padding: 0.2rem 0.35rem; }
.bg-header-bell { display: inline-flex; margin-left: 0.5rem; }

/* Kachel-Body: Player-Rows links flex-1 + Actions rechts, gemeinsam in
   einer flex-row mit align-items:center. Bedeutet: Actions sitzen auf
   gleicher Höhe wie der vertikale Mittelpunkt der Player-Rows — bei einer
   Reihe (offenes Match) inline neben den Namen, bei zwei Reihen mittig
   dazwischen. Keine absoluten Positionswerte = kein Overlap mit Badge. */
.sched-tile-wrap { position: relative; }
.sched-tile-body {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.sched-tile-content {
  flex: 1;
  min-width: 0;
}
.sched-tile-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.sched-tile-bell { display: inline-flex; }
.sched-tile-bell .bell-btn { padding: 0.15rem 0.25rem; }

/* Slot-Fav-Buttons im Begegnungs-Detail (klein, dezent in der Pos-Spalte) */
.bg-match-fav {
  display: inline-flex; gap: 0.1rem; margin-top: 0.2rem;
}
.bg-match-fav .fav-btn,
.bg-match-fav .bell-btn { padding: 0.15rem 0.3rem; font-size: 0.9rem; }

/* Auswärts-Karte: Fav-Pair rechts oben */
.sched-away-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.sched-away-fav { margin-left: auto; }

/* Favoriten-Liste: Spieler-Rows mit Action rechts */
.fav-player-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.fav-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}
.fav-player-name { font-weight: 600; color: var(--text); }

/* Team-Card-Variante mit Fav-Toggle rechts */
.team-card-with-fav {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.team-card-with-fav .team-card-body {
  flex: 1;
  text-decoration: none;
  color: inherit;
}
.team-card-with-fav .team-card-fav {
  padding: 0.4rem 0.6rem;
  display: flex;
  align-items: flex-start;
}
.team-card-static { cursor: default; opacity: 0.85; }

/* Card mit transparentem Link-Overlay + absolut positioniertem Fav-Button.
   Vorteil: Fav klebt rechts oben in der Card (klein, dezent), restliche
   Click-Fläche bleibt ein Link zur Mannschaft. Form-in-Anchor-Verschachtelung
   wird vermieden weil <form> und <a> Geschwister sind, nicht ineinander. */
.team-card-overlayed {
  position: relative;
}
.team-card-overlayed .team-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.team-card-overlayed > * { position: relative; z-index: 0; }
/* Heart + Bell auf der Mannschaften-Karte vertikal gestackt (übereinander),
   damit sie nicht überlappen. Nur die OUTER Span ist absolut positioniert —
   die innere .fav-form darin bleibt statisch und ordnet sich im flex-column ein.
   Direkt-Kind-Selektor (>) damit's nicht für nested .fav-form gilt. */
.team-card-overlayed > .fav-form,
.team-card-overlayed > .team-card-fav-overlay {
  position: absolute;
  top: 0.3rem;
  right: 0.4rem;
  z-index: 2;
}
.team-card-overlayed > .team-card-fav-overlay {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-end;
}
.team-card-overlayed > .team-card-fav-overlay .fav-form { position: static; }
.team-card-overlayed > .team-card-fav-overlay .fav-btn,
.team-card-overlayed > .team-card-fav-overlay .bell-btn {
  padding: 0.15rem 0.3rem;
}

/* Meldeliste Fav-Spalte */
.meldeliste-table .ml-fav { width: 2.6rem; text-align: right; }

/* Rollen-Tag in der Meldeliste (MF / Sc) — kompakt direkt hinter Name. */
.ml-role-tag {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  margin-left: 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.ml-role-tag-mf {
  background: rgba(46, 160, 67, 0.18);
  color: #2ea043;
}
.ml-role-tag-sc {
  background: rgba(32, 174, 189, 0.18);
  color: var(--blue);
}

/* Spieler-Auswahl in admin_begegnung: ein <select> pro Spieler-Slot,
   plus zwei hidden inputs für Backend-Compat. Wrap als .player-pick. */
.player-pick {
  display: block;
  margin-bottom: 0.4rem;
}
.player-pick .player-select {
  width: 100%;
  font-size: 0.9rem;
  padding: 0.4rem 0.5rem;
  font-family: inherit;
}
/* In admin_court ersetzt der Dropdown die zwei Vor/Nach-Inputs einer
   .name-row → ohne flex:1 würde das Single-Element nicht die volle Breite
   nehmen und gequetscht wirken. */
.name-row > .player-pick {
  flex: 1;
  margin-bottom: 0;
}
.player-pick .player-select-home {
  border-color: rgba(46, 160, 67, 0.4);
}
.player-pick .player-select-away {
  border-color: rgba(31, 111, 235, 0.4);
}

/* Scorekeeper-Liste auf /admin/teams/<id> — eine Zeile pro berechtigtem User. */
.sk-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.sk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.7rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.sk-row-name { min-width: 0; flex: 1; }
.sk-row-mail { font-size: 0.78rem; }
.sk-add-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.sk-add-select {
  flex: 1;
  min-width: 14rem;
  font-size: 0.9rem;
}

/* Page-Header mit Title links und Verwalten-Button rechts.
   Wird auf Listen-Pages (Begegnungen, Mannschaften, Schedule) und auf
   Detail-Pages (Mannschaft, Begegnung) verwendet. */
.page-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header-row .section-title { margin-bottom: 0; }

.manage-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.manage-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.manage-btn-icon { font-size: 0.95em; }

/* Wochentag-Anzeige rechts vom Date-Picker auf /begegnungen.
   Visuell konsistent mit dem `/admin`-Picker — gleiche Klasse, nur ein
   kleines Wochentag-Tag rechts daneben damit man weiß welcher Tag das
   gerade ist (sonst zeigt der Picker nur "08.05.2026"). */
.date-picker-weekday {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  margin-left: 0.4rem;
}
.date-picker-today-pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  background: rgba(32, 174, 189, 0.15);
  color: var(--blue);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 0.3rem;
}

.bg-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bg-card {
  display: block;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.bg-card:hover { border-color: var(--blue); }

.bg-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 1rem;
  font-weight: 700;
}

.bg-card-team {
  flex: 1;
  min-width: 0;
}

.bg-card-team:last-child { text-align: right; }

.bg-card-score {
  font-size: 1.2rem;
  font-weight: 900;
  flex-shrink: 0;
}

.bg-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* 2-Zeilen-Layout: Mannschaften übereinander, Score rechts pro Zeile. Bell
   sitzt in der Meta-Row (oben) rechts via margin-left:auto, dadurch auf
   derselben X-Achse wie die Scores darunter (alle drei rechte-Enden in der
   gleichen content-area-Spalte). */
.bg-card-meta-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.bg-card-bell {
  margin-left: auto;
  display: inline-flex;
}
.bg-card-bell .bell-btn {
  padding: 0.05rem 0;
  margin: 0;
  border: 0;
}
.bg-card-bell .icon-svg { width: 1rem; height: 1rem; }
.bg-card-time { font-weight: 700; color: var(--text); }
.bg-card-league { color: var(--muted); }
/* 2-Spalten-Layout für /begegnungen — Heim links, Auswärts rechts.
   Auf Mobile (< 700px) stacked, eine Spalte. Turniere darunter eigene Reihe. */
.bg-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.2rem;
  margin-top: 0.4rem;
}
@media (max-width: 700px) {
  .bg-cols { grid-template-columns: 1fr; }
}
.bg-col { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.bg-col-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.2rem;
}
.bg-col-empty { font-size: 0.82rem; font-style: italic; margin: 0; padding: 0.4rem 0; }
.bg-tournaments-row { margin-top: 1.2rem; }

/* Heim und Gast übereinander, jeweils Name links + Score rechts. */
.bg-card-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.18rem 0;
  font-size: 1rem;
}
.bg-card-line .bg-card-team {
  font-weight: 700;
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bg-card-score-num {
  font-size: 1.25rem;
  font-weight: 900;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Tournament card variant in the begegnungen list — name left-aligned, no opponent column */
.bg-card-tournament {
  display: block;
  text-align: left;
}

.bg-tournament-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}

/* ===== Public single Begegnung view ===== */
.bg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1rem 0.4rem;
  gap: 0.6rem;
}

.bg-team {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.bg-team-away { text-align: right; }

.bg-score {
  flex-shrink: 0;
  text-align: center;
  font-size: 2.2rem;
  font-weight: 900;
}

.bg-score .bg-score-colon {
  color: var(--muted);
  margin: 0 0.3rem;
}

.bg-date {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.bg-section {
  padding: 0 1rem 0.5rem;
}

.bg-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 1rem 0 0.5rem;
}

.bg-matches {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* 4-Spalten-Layout: Pos | Players | Sätze | Tools (Bell + Badge).
   Alle Zellen vertikal mittig zueinander, Tools-Zelle horizontal flex mit
   Bell + Badge nebeneinander. Analog zu /live's sc-header. */
.bg-match {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bg-match-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.bg-match-tools .bell-btn { padding: 0.2rem 0.3rem; }
.bg-match-status-pill {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.bg-match-status-live { background: var(--blue);  color: #fff; }
.bg-match-status-done { background: var(--green); color: #fff; }
.bg-match-status-open {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.bg-live-court {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.bg-match-bell {
  display: flex;
  align-items: center;
}
.bg-match-bell .bell-btn { padding: 0.25rem 0.4rem; }

.bg-match-live {
  border-color: var(--blue);
}

.bg-match-pos {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
}

.bg-match-players {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.bg-pname {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

/* Nationality-Pill: 3-Letter-Code direkt rechts vom Spielernamen
   (nur Einzel). Klein, monospaced, dezent. */
.bg-nat {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

/* nuLiga-meetingReport: Spielernamen + Position-Tag im 2-Spalten-Grid,
   damit Heim- und Gast-Pos-Tag EXAKT übereinander stehen (auch bei
   unterschiedlich langen Namen). `display: contents` an den Player-Rows
   sorgt dafür dass ihre Children direkt im Grid landen. Existing
   `.bg-match-players` ohne diese Modifier bleibt 1-Spalten-Layout
   (für /begegnung wo es keinen Pos-Tag gibt). */
.bg-match-players-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 0.25rem;
  column-gap: 1rem;
  align-items: baseline;
}
.bg-match-players-grid .bg-player-row {
  display: contents;
}
.bg-pos-tag {
  min-width: 2.6rem;
  text-align: right;
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}

.bg-match-result {
  text-align: right;
  position: relative;
}

.bg-set-row {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  font-size: 0.95rem;
  font-weight: 700;
}

.bg-set {
  display: inline-block;
  min-width: 1.2rem;
  text-align: center;
  color: var(--muted);
}

.bg-set.bg-set-win { color: var(--text); }
.bg-set.bg-set-cur { color: var(--blue); }

.bg-live-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 0.2rem;
}

.bg-pending {
  color: var(--muted);
  font-size: 1.2rem;
}

.bg-walkover-tag {
  display: inline-block;
  background: var(--yellow);
  color: #000;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.05rem 0.3rem;
  border-radius: 6px;
  margin-left: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Loser dimming: applied to player names on finished matches ===== */
.is-loser { color: var(--muted); }

/* Status slot column on each score row (per-row, so set numbers stay aligned).
   Holds either:
     • live game points (15/30/40/AD) in the live tab
     • a W.O. badge on the loser row if the match ended via walkover
     • empty otherwise
   Both rows render the slot span so they reserve identical width. */
.sd-wo-slot,
.sc-wo-slot,
.ov-wo-slot,
.tv-wo-slot,
.sched-tile-wo-slot,
.acc-wo-slot,
.bg-wo-slot {
  display: inline-block;
  min-width: 2.8rem;
  text-align: left;
  margin-left: 0.4rem;
  flex-shrink: 0;
}

.tv-wo-slot { min-width: 3.5rem; }

/* Live tab slots show game points in yellow/bold — W.O. badge overrides via its own class */
.sc-wo-slot,
.ov-wo-slot {
  color: var(--yellow);
  font-weight: 800;
}

/* Stream-Vorschau-Overlay auf der Startseite: Punkte-Slot kompakter
   (kein 2.8rem-Reserved-Width, kein 0.4rem extra margin) und in der
   gleichen Schriftgröße wie die Sätze. */
.score-overlay .overlay-row .ov-wo-slot {
  min-width: 1.4rem;
  margin-left: 0;
  font-size: 1rem;  /* match .ov-set Desktop */
}

/* datalist dropdown arrow hint for select */
select.name-input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.8rem;
}

/* ===== Player name inputs ===== */
.doubles-toggle {
  margin-bottom: 0.8rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}

.toggle-label input[type=checkbox] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--blue);
}

.team-block { margin-bottom: 0.6rem; }

.team-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.3rem;
}

.name-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

/* Labeled Form-Field: kleine Uppercase-Überschrift über Input.
   Für date/time-Felder wichtig, weil Placeholder dort nicht angezeigt werden. */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}
.form-field-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vs-divider {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0.4rem 0;
}

/* Score display box updates */
.sd-pts {
  font-size: 1.1rem;
  font-weight: 800;
  min-width: 4rem;
  text-align: right;
  color: var(--yellow);
}

.sd-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.4rem;
  text-align: right;
}


.stream-input {
  width: 100%;
  font-size: 0.85rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
  margin-bottom: 0.6rem;
  font-family: monospace;
}

.stream-input:focus { border-color: var(--blue); }

/* ===== Buttons ===== */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  text-align: center;
  transition: filter 0.15s, transform 0.1s;
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn:not(:disabled):active { transform: scale(0.97); }
.btn:not(:disabled):hover  { filter: brightness(1.12); }

.btn-primary   { background: var(--blue);     color: #fff; }
.btn-manage    { background: var(--blue);     color: #fff; margin-top: 0.2rem; }
.btn-secondary { background: var(--border);   color: var(--text); }
.btn-danger    { background: var(--red);      color: #fff; }
.btn-undo      { background: var(--border);   color: var(--muted); font-size: 0.9rem; }
.btn-walkover  { background: var(--yellow);   color: #000; }

.walkover-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.walkover-buttons .btn-walkover { width: 100%; }

/* ===== Schedule inline start button (spielleiter) ===== */
.sched-tile-wrap { position: relative; }

.sched-start-form {
  /* lebt jetzt im .sched-tile-actions inline-flex container, kein absolutes
     Positioning mehr nötig. Bleibt klein und mittig zur Glocke. */
  margin: 0;
  display: inline-flex;
}

.sched-start-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--green-lt);
  background: var(--green);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.sched-start-btn:hover {
  background: var(--green-lt);
  transform: scale(1.08);
}

/* ===== Admin: User & Role Management ===== */
.users-search-bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

.users-search-bar input[type="search"] {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.users-search-bar input[type="search"]:focus {
  outline: none;
  border-color: var(--blue);
}

.users-search-count {
  font-size: 0.75rem;
  min-width: 4rem;
  text-align: right;
  white-space: nowrap;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.user-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.user-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.user-card-identity { flex: 1 1 14rem; min-width: 0; }

.user-card-email {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: break-word;
}

.user-card-name {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.user-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.user-card-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.user-card-delete {
  margin-left: auto;
  flex-shrink: 0;
}

.btn-icon-danger {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
  transition: all 0.15s;
}

.btn-icon-danger:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(218, 54, 51, 0.08);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.role-badge-player              { background: rgba(139,148,158,0.15); color: var(--muted); border-color: var(--border); }
.role-badge-scorekeeper         { background: rgba(31,111,235,0.15); color: var(--blue); border-color: var(--blue); }
.role-badge-mannschaftsfuehrer  { background: rgba(210,153,34,0.15); color: var(--yellow); border-color: var(--yellow); }
.role-badge-spielleiter         { background: rgba(46,160,67,0.15); color: var(--green-lt); border-color: var(--green-lt); }
.role-badge-super_admin         { background: rgba(218,54,51,0.15); color: var(--red); border-color: var(--red); }

.role-badge:hover { filter: brightness(1.2); }
.role-badge .role-scope { font-weight: 500; opacity: 0.8; text-transform: none; }
.role-badge .role-remove { font-size: 0.9rem; opacity: 0.6; margin-left: 0.15rem; }
.role-badge:hover .role-remove { opacity: 1; }

.user-card-grant {
  /* 2×2-Grid: die vier Rollen-Controls nebeneinander/untereinander statt
     Listen-Style. Jede Zelle ist Button + Beschreibung als vertikaler Stack. */
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  padding-top: 0.7rem;
  margin-top: 0.7rem;
  border-top: 1px dashed var(--border);
}

.grant-line {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
}

.grant-line .inline-form { margin: 0; }

.grant-line-btn {
  width: 100%;
  justify-content: center;
  text-align: center;
  white-space: normal;
}

.grant-line-explain {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.35rem;
  line-height: 1.3;
}

@media (max-width: 640px) {
  .user-card-grant { grid-template-columns: 1fr; }
}

.user-card-link-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--blue);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 0.3rem;
}
.user-card-link-btn:hover { border-color: var(--blue); background: rgba(31,111,235,0.08); }

.link-player-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  background: var(--card);
  color: var(--text);
  max-width: 520px;
  width: 92vw;
}
.link-player-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.link-player-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.4rem;
}
.link-player-header h2 { margin: 0; font-size: 1.2rem; }
.link-player-dialog .claim-list { max-height: 300px; }

/* Profil-Seite: Foto-Preview oberhalb des Upload-Felds */
.profile-photo-preview {
  margin: 0.5rem 0;
}
.profile-photo-preview img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border);
}

/* Bulk-Invite Preview-Tabelle */
.invite-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.invite-preview-table th,
.invite-preview-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.invite-preview-table th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .5px; }
.invite-preview-table code { font-size: 0.82rem; color: var(--muted); }

.invite-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}
.invite-badge-ok       { background: rgba(35, 134, 54, 0.18);  color: var(--green); }
.invite-badge-new      { background: rgba(31, 111, 235, 0.18); color: var(--blue); }
.invite-badge-noop     { background: rgba(180, 180, 180, 0.2); color: var(--muted); }
.invite-badge-conflict { background: rgba(218, 54, 51, 0.18);  color: var(--red); }
.invite-row-conflict td { background: rgba(218, 54, 51, 0.04); }

/* ═══ Mannschaften Public-Tab ═══ */
.team-group { margin-top: 1.6rem; }
.team-group-title {
  font-size: 1rem;
  color: var(--text);
  margin: 0 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.7rem;
}
.team-card {
  display: block;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.1s;
}
.team-card:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}
.team-card-name { font-weight: 700; font-size: 1rem; }
.team-card-league { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }
.team-card-meta { font-size: 0.75rem; margin-top: 0.4rem; }

/* Mannschaft-Detail Header */
.mannschaft-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.mannschaft-header .section-title { margin: 0; }
.back-btn-inline {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.back-btn-inline:hover { color: var(--text); border-color: var(--blue); }
.mannschaft-league { font-size: 0.9rem; }

/* Reusable tabs (Mannschaft-Detail, evtl. später woanders) */
.tabs {
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.tab {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.6rem 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.tab-content { display: none; }
.tab-content.is-active { display: block; }

/* Meldeliste-Tabelle */
.meldeliste-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.meldeliste-table th,
.meldeliste-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.meldeliste-table th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.meldeliste-table .ml-pos,
.meldeliste-table .ml-lk,
.meldeliste-table .ml-year { width: 5rem; color: var(--muted); }
.meldeliste-table .player-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.meldeliste-table .player-link:hover { color: var(--blue); }
.meldeliste-table .ml-record { width: 3.2rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* nuLiga-Mirror: Tabelle + Spielplan */
.nuliga-table,
.nuliga-schedule {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.nuliga-table th,
.nuliga-table td,
.nuliga-schedule th,
.nuliga-schedule td {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.nuliga-table th,
.nuliga-schedule th {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.nuliga-table .nl-rank { width: 2.2rem; color: var(--muted); text-align: center; }
.nuliga-table .nl-num,
.nuliga-schedule .nl-result {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 3rem;
}
.nuliga-table th.nl-num,
.nuliga-schedule th.nl-result { text-align: right; }
.nuliga-table .nl-team,
.nuliga-schedule .nl-team { color: var(--text); }
.nuliga-schedule .nl-date {
  width: 9rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* TEC-eigene Zeile in Tabelle dezent hervorheben */
.nuliga-table tr.nl-row-self td,
.nuliga-schedule tr.nl-row-self td {
  background: rgba(32, 174, 189, 0.08);  /* var(--blue) at 8% */
}
.nuliga-table tr.nl-row-self .nl-team,
.nuliga-schedule tr.nl-row-self .nl-team-self {
  font-weight: 700;
  color: var(--blue);
}

/* Zukünftige Begegnungen visuell zurücknehmen */
.nuliga-schedule tr.nl-future td { color: var(--muted); }
.nuliga-schedule tr.nl-future.nl-row-self td { color: var(--text); }

.nuliga-stand {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.6rem;
  padding-top: 0.4rem;
}
.nuliga-stand a { color: var(--muted); text-decoration: underline; }
.nuliga-stand a:hover { color: var(--blue); }

/* Klickbares Match-Ergebnis im Spielplan → öffnet eigenen Spielbericht */
.nl-result-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}
.nl-result-link:hover {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* /nuliga/meeting/<id> erbt komplett vom .bg-*-Layout der lokalen
   Begegnungs-Seite (templates/begegnung.html) — kein zusätzliches CSS
   nötig. */

/* Rang-Badge im Mannschaft-Header */
.mannschaft-rank-pill {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0.15rem 0.55rem;
  background: rgba(32, 174, 189, 0.12);
  color: var(--blue);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Mobile: Spielplan-Datum-Spalte schmaler, kleinere Schriften */
@media (max-width: 600px) {
  .nuliga-table,
  .nuliga-schedule { font-size: 0.78rem; }
  .nuliga-table th,
  .nuliga-table td,
  .nuliga-schedule th,
  .nuliga-schedule td { padding: 0.4rem 0.35rem; }
  .nuliga-schedule .nl-date { width: 5.5rem; }
  /* Drop weniger wichtige Spalten auf Mobile, Kontext bleibt erhalten */
  .nuliga-table .nl-num:nth-of-type(8),  /* MP */
  .nuliga-table .nl-num:nth-of-type(9) { display: none; }  /* Sätze */
  .meldeliste-table .ml-record:nth-of-type(5),  /* Einzel */
  .meldeliste-table .ml-record:nth-of-type(6) { display: none; }  /* Doppel */
}

.grant-form {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.grant-team-sel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  color: var(--text);
  font-size: 0.78rem;
  font-family: inherit;
}

/* Mannschaftsführer-Dropdown (inline unter dem Button) */
.grant-mf-wrap {
  position: relative;
}

.grant-mf-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 16rem;
  max-width: 24rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  z-index: 50;
}

.grant-mf-dropdown[hidden] { display: none; }

.mf-scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: rgba(210, 153, 34, 0.08);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-radius: 6px;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.mf-scope-name {
  font-weight: 600;
  color: var(--text);
}

.mf-scope-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.3rem;
}

.mf-scope-remove:hover { color: var(--red); }

.mf-empty {
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
  padding: 0.3rem 0;
}

.mf-add-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
}

.mf-add-row .grant-team-sel { flex: 1; }

.mf-error {
  color: var(--red);
  font-size: 0.8rem;
  min-height: 1em;
  margin-top: 0.5rem;
}

/* ===== Top-nav: User chip + Login button ===== */
.btn-login {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}
.btn-login:hover { background: var(--blue); color: #fff; }

.user-menu {
  /* Kein position:relative — das Account-Menu soll am Nav-Bar-Rand sitzen
     (rechte Bildschirmkante) und nicht am User-Chip, sonst schiebt der
     Dev-Role-Switcher die Menu-Box nach links ins Off-Canvas. */
  flex-shrink: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 14rem;
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
  color: inherit;
  transition: border-color 0.15s;
}
.user-chip:hover,
.user-chip[aria-expanded="true"] {
  border-color: var(--blue);
}
.user-chip-email {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 9rem;
}
.user-chip-role {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--green-lt);
  background: rgba(46, 160, 67, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.account-menu {
  position: absolute;
  /* Positioniert relativ zur sticky top-nav-bar — right:0 meint jetzt den
     rechten Nav-Bar-Rand, nicht den User-Chip-Rand. */
  top: 100%;
  right: calc(0.6rem + env(safe-area-inset-right, 0px));
  min-width: 14rem;
  max-width: calc(100vw - 1.2rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  margin-top: 0.3rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 0.35rem;
  z-index: 110;
}
.account-menu[hidden] { display: none; }

.account-menu-header {
  padding: 0.6rem 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}
.account-menu-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}
.account-menu-email {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
  overflow-wrap: anywhere;
}
.account-menu-role {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--green-lt);
  background: rgba(46, 160, 67, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 0.4rem;
}

.account-menu-item {
  display: block;
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  color: var(--text);
  border-radius: calc(var(--radius) - 2px);
  text-decoration: none;
}
.account-menu-item:hover { background: var(--bg); }
.account-menu-item.is-active { background: var(--bg); color: var(--blue); font-weight: 600; }
.account-menu-logout { color: var(--red); font-weight: 600; }
.account-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.4rem 0;
}

/* Sponsor-Admin-Dashboard */
.sponsor-summary-head {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.sponsor-active-pill {
  background: var(--green); color: #fff;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  text-transform: uppercase;
}
.sponsor-inactive-pill {
  background: var(--border); color: var(--muted);
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  text-transform: uppercase;
}
.sponsor-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
  margin: 0.8rem 0;
}
.sponsor-stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
}
.sponsor-stat-label {
  font-size: 0.72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 600;
}
.sponsor-stat-value {
  font-size: 1.6rem; font-weight: 800; color: var(--text);
  margin-top: 0.2rem; font-variant-numeric: tabular-nums;
}
.sponsor-daily-table {
  width: 100%; max-width: 400px;
  border-collapse: collapse; font-size: 0.88rem;
}
.sponsor-daily-table th, .sponsor-daily-table td {
  padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border);
}
.sponsor-daily-table th { background: var(--bg); font-weight: 600; }
.sponsor-daily-table td.num, .sponsor-daily-table th.num {
  text-align: right; font-variant-numeric: tabular-nums;
}

/* Bell-Button-Position im Tournament-Header (kleiner Inline-Block rechts oben) */
.tournament-header { position: relative; }
.tournament-header-actions {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.tournament-header-bell {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
}

/* Featured-Tournament-Nav-Tab: dezenter Highlight (linke + rechte
   blaue Border) damit er als „besonderes Event" auffällt aber nicht schreit.
   Wird automatisch eingeblendet wenn ein Turnier in den nächsten 7 Tagen
   ansteht / läuft / vor ≤ 2 Tagen geendet hat. */
.nav-tab-featured {
  position: relative;
  font-weight: 700;
}
.nav-tab-featured::before {
  content: "•";
  color: var(--blue);
  margin-right: 0.3rem;
  font-size: 1.1em;
  line-height: 0.5;
}
.nav-tab-featured.is-active {
  color: var(--blue);
}

/* Featured-Tournament-Card: prominenter Block oben auf /live wenn ein Turnier
   in den nächsten 7 Tagen startet, läuft, oder gerade beendet ist. */
.tournament-feature {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  margin: 1rem 0 1.5rem;
  background: linear-gradient(135deg, rgba(31,111,235,0.12), rgba(31,111,235,0.04));
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tournament-feature:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 111, 235, 0.2);
}
.tournament-feature.is-running {
  background: linear-gradient(135deg, rgba(34,197,94,0.16), rgba(34,197,94,0.04));
  border-color: var(--green);
}
.tournament-feature.is-recent { opacity: 0.85; }
.tournament-feature-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.tournament-feature-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  margin-bottom: 0.2rem;
}
.tournament-feature.is-running .tournament-feature-badge { background: var(--green); }
.tournament-feature-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.tournament-feature-meta {
  font-size: 0.82rem;
}
.tournament-feature-arrow {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--blue);
  flex-shrink: 0;
}

/* Sponsor-Banner — bewusst dezent, schmaler Strip unter Top-Nav.
   "präsentiert von" in muted color, Sponsor-Name in Akzentfarbe. Klick führt
   zur Sponsor-Profil-Seite. */
.sponsor-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 1rem;
  text-align: center;
  font-size: 0.8rem;
}
.sponsor-bar-link {
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.3px;
}
.sponsor-bar-link:hover { color: var(--text); }
.sponsor-bar-prefix {
  text-transform: uppercase;
  font-weight: 600;
  margin-right: 0.45rem;
  letter-spacing: 0.6px;
  font-size: 0.7rem;
}
.sponsor-bar-name {
  color: var(--blue);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Court-Scoring-Page (combined view, replaces alte Fullscreen-/court/<id>) */
.court-page-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.court-page-head .section-title { margin: 0; }
.court-page-context {
  font-size: 0.85rem;
}
.court-page-head .manage-btn { margin-left: auto; }

.court-controls {
  margin-top: 1rem;
  padding: 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.court-controls > * + * { margin-top: 0.8rem; }

/* Spieler-Gegenüberstellung */
.player-faceoff {
  margin-top: 1.5rem;
}
.faceoff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.6rem;
}
.faceoff-side {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.faceoff-player {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.faceoff-player-empty {
  font-style: italic;
  padding: 0.4rem 0;
}
.faceoff-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}
.faceoff-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid var(--border);
}
.faceoff-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.faceoff-meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.faceoff-lk { font-weight: 700; color: var(--text); }
.faceoff-record {
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.match-stats-placeholder {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

@media (max-width: 600px) {
  .faceoff-grid { grid-template-columns: 1fr; }
}

/* Such-Icon-Tab im Top-Nav — kleines Lupen-SVG, kein Text.
   nav-tab-suche bekommt margin-left:auto, damit's ans rechte Ende der Nav rutscht. */
.nav-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.7rem;
}
.nav-tab-icon .icon-svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* /suche-Seite */
.suche-form {
  display: flex;
  gap: 0.5rem;
  margin: 0.6rem 0 1rem;
  position: relative;
}
.suche-input-wrap {
  flex: 1;
  position: relative;
}
.suche-input {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 0.95rem;
  box-sizing: border-box;
}
.suche-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 20;
  overflow: hidden;
  max-height: 60vh;
  overflow-y: auto;
}
.suche-suggestion {
  display: flex; align-items: baseline; gap: 0.6rem;
  padding: 0.5rem 0.8rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.suche-suggestion:last-child { border-bottom: 0; }
.suche-suggestion:hover, .suche-suggestion.is-active {
  background: var(--bg);
}
.suche-suggestion-label { font-weight: 600; }
.suche-suggestion-sub { font-size: 0.78rem; }
.suche-input:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.suche-submit { width: auto; padding: 0.55rem 1.2rem; }
.suche-tournaments {
  list-style: none; padding: 0; margin: 0.4rem 0 0;
}
.suche-tournaments li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.suche-tournaments li:last-child { border-bottom: 0; }
.suche-tournament-link {
  display: block;
  color: var(--text);
  text-decoration: none;
}
.suche-tournament-link:hover { color: var(--blue); }

/* Benachrichtigungs-Seite: App-installieren-Hinweis */
.push-install-hint .push-install-steps {
  list-style: disc;
  padding-left: 1.4rem;
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
}
.push-install-hint .push-install-steps li { padding: 0.25rem 0; }

@media (max-width: 640px) {
  .user-chip-email { max-width: 6rem; font-size: 0.72rem; }
  .user-chip-role { display: none; }
  .account-menu { min-width: 16rem; }
}

/* ===== Auth pages (Login / Welcome) ===== */
body.auth-page .page-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.8rem;
  max-width: 420px;
  width: 100%;
}

.auth-card h1 {
  font-size: 1.4rem;
  margin-bottom: 0.6rem;
  color: var(--text);
}

.auth-card p {
  font-size: 0.9rem;
  margin-bottom: 0.9rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.auth-form label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
}

.auth-form input[type="email"],
.auth-form input[type="text"],
.auth-form input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--blue);
}

/* Chromium/Safari tönen Autofill-Felder gelb/beige (Browser-Heuristik:
   "look, a password!"). Mit einem internen box-shadow überstempeln wir
   den gelben Background mit unserer card-dark-Farbe. Die lange Transition
   auf background-color ist der Standard-Trick damit Chrome den override
   nicht beim nächsten Autofill-Event überschreibt. */
.auth-form input:-webkit-autofill,
.auth-form input:-webkit-autofill:hover,
.auth-form input:-webkit-autofill:focus,
.auth-form input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  caret-color: var(--text);
  transition: background-color 5000s ease-in-out 0s;
}

.auth-form button {
  margin-top: 0.4rem;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
}

.auth-error {
  background: rgba(218, 54, 51, 0.12);
  border-left: 3px solid var(--red);
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  color: var(--red);
  font-size: 0.88rem;
  margin-bottom: 0.8rem;
}
.auth-success {
  background: rgba(35, 134, 54, 0.12);
  border-left: 3px solid var(--green);
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  color: var(--green);
  font-size: 0.88rem;
  margin-bottom: 0.8rem;
}
.auth-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}
.auth-actions .btn { flex: 1 1 auto; }

.auth-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 1rem;
}

.auth-hint a { color: var(--blue); text-decoration: underline; }

/* "Erstregistrierung / Passwort vergessen"-Sekundärbereich unter dem
   Haupt-Login-Form. Visuell durch eine dünne Trennlinie abgesetzt. */
.auth-alt {
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}
.auth-alt-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.auth-form-compact {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}

/* Screen-reader-only: visible for assistive tech, off-screen for sighted
   users. Used for hidden labels when the visual context is enough. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Text-styled button (no background) — wird als "Später festlegen"-Action
   benutzt, damit es visuell weniger präsent ist als der Primary-Button. */
.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  text-decoration: underline;
}
.btn-link:hover { color: var(--text); }

/* Player-Claim-Seite (/welcome) */
body.claim-page .auth-card { max-width: 560px; }

.claim-search-bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.8rem 0 0.5rem;
}

.claim-search-bar input[type="search"] {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

.claim-search-bar input[type="search"]:focus {
  outline: none;
  border-color: var(--blue);
}

.claim-search-bar .muted-hint {
  font-size: 0.75rem;
  min-width: 4rem;
  text-align: right;
  white-space: nowrap;
}

.claim-list {
  list-style: none;
  padding: 0;
  margin: 0.3rem 0 1rem;
  /* Kompakter Scroll-Container, damit auf einem mittelhohen Viewport der
     „Ich bin Gast"-Block darunter noch in den ersten Scroll-Frame fällt. */
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.claim-item { border-bottom: 1px solid var(--border); }
.claim-item:last-child { border-bottom: none; }

.claim-btn {
  display: block;
  width: 100%;
  padding: 0.65rem 0.8rem;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.claim-btn:hover { background: rgba(31, 111, 235, 0.08); }
.claim-btn.is-selected {
  background: rgba(46, 160, 67, 0.15);
  border-left: 3px solid var(--green-lt);
  padding-left: calc(0.8rem - 3px);
}

.claim-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.claim-sources {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.claim-empty {
  margin: 1rem 0;
  text-align: center;
}

.claim-skip-form {
  margin-top: 1rem;
  text-align: center;
}

.claim-step-title {
  font-size: 1rem;
  color: var(--text);
  margin: 1.2rem 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
.claim-step-title:first-of-type { margin-top: 0.5rem; }

.claim-skip-btn {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.6rem;
  text-align: center;
}
.claim-skip-btn.is-selected {
  background: rgba(31, 111, 235, 0.12);
  color: var(--blue);
  text-decoration: none;
  border-radius: var(--radius);
}

/* Gast-Selbstregistrierung (aufklappbar unter der Spielerliste) */
.guest-toggle-wrap {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.guest-toggle-btn {
  width: 100%;
  text-align: center;
  padding: 0.5rem;
}
.guest-form-wrap .name-inputs {
  display: flex;
  gap: 0.4rem;
}
.guest-form-wrap .name-input {
  flex: 1;
}

/* "Bist das du?"-Dialog — Player-Info-Card mit Roster-Details */
.guest-confirm-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0.8rem 0;
  background: rgba(31, 111, 235, 0.05);
}
.guest-confirm-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.guest-confirm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.guest-confirm-meta span::before {
  content: "· ";
  margin-right: 0.2rem;
}
.guest-confirm-meta span:first-child::before { content: ""; margin: 0; }
.guest-confirm-notes {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  padding: 0.4rem;
}

.btn-link:hover { color: var(--text); }

/* ===== Scoring list: quick-result button overlay ===== */
.scoring-card-wrap {
  position: relative;
}

.quick-result-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 5;
  background: rgba(22, 27, 34, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.6rem;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.quick-result-btn:hover {
  background: var(--card);
  border-color: var(--blue);
}

/* ===== Meine-Matches-Seite ===== */
body.my-matches-page .page-section {
  max-width: 900px;
  margin: 0 auto;
}

.mm-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mm-who {
  font-size: 0.82rem;
}

.mm-change-link {
  color: var(--blue);
  text-decoration: underline;
}

.mm-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
}

.mm-empty-state .btn { margin-top: 0.5rem; }

.mm-section {
  margin-bottom: 1.5rem;
}

.mm-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.6rem;
}

details.mm-section summary.mm-section-title {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.mm-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.mm-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
}

.mm-card-live { border-left-color: var(--blue); }
.mm-card-done { border-left-color: var(--green); }
.mm-card-open { border-left-color: var(--border); }

.mm-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.mm-when {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.mm-date { font-weight: 600; color: var(--text); }
.mm-time { font-weight: 600; color: var(--text); }
.mm-court { color: var(--muted); }

.mm-status {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  align-items: center;
}

.mm-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.mm-badge-live   { background: var(--blue); color: #fff; }
.mm-badge-win    { background: var(--green); color: #fff; }
.mm-badge-loss   { background: rgba(139,148,158,0.2); color: var(--muted); }
.mm-badge-pos    { background: var(--bg); border: 1px solid var(--border); color: var(--muted); }

.mm-context {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin: 0.25rem 0 0.45rem;
}

.mm-matchup {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

.mm-side-me { color: var(--text); }
.mm-side-opp { color: var(--text); }
.mm-vs {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mm-sets {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.mm-set {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-weight: 700;
  font-size: 0.82rem;
}

.mm-set-win { color: var(--green-lt); }

.mm-card-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--blue);
  text-decoration: underline;
}

/* ===== Collapsible Kommende/Vergangen sections on /begegnungen ===== */
.bg-collapsible { border: none; padding: 0; }
.bg-collapsible > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.bg-collapsible > summary::-webkit-details-marker { display: none; }
.bg-collapsible > summary::before {
  content: '▸';
  display: inline-block;
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform 0.15s;
}
.bg-collapsible[open] > summary::before { transform: rotate(90deg); }
.bg-collapsible > summary .muted-hint {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
}

/* ===== Meldeliste order-violation warning (admin_begegnung) ===== */
.order-warn {
  margin: 0 0 0.6rem 0;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--yellow);
  border-left-width: 4px;
  background: rgba(210, 153, 34, 0.12);
  color: var(--yellow);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ===== Player card dialog (Spielerkarte) ===== */
.player-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  cursor: pointer;
}
.player-link:hover { border-bottom-color: var(--blue); }

.score-card.is-clickable { cursor: pointer; }
a.score-card { color: inherit; text-decoration: none; display: block; }
a.score-card:hover { border-color: var(--blue); }

.player-card-dialog {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 92vw;
  width: 380px;
}

.player-card-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }

.player-card-dialog .pcd-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  z-index: 2;
}
.player-card-dialog .pcd-close:hover { color: var(--text); }

.player-card-dialog .pcd-body {
  padding: 1.4rem 1.4rem 1.2rem;
}

.pcd-body.is-match {
  width: auto;
}

.player-card-dialog .pcd-loading {
  padding: 1rem 0;
  color: var(--muted);
  text-align: center;
}

.pcd-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  grid-template-areas:
    "photo info"
    "photo info";
  gap: 0.9rem 1rem;
  align-items: start;
  position: relative;
}

.pcd-photo-wrap {
  grid-area: photo;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
}
.pcd-photo { width: 100%; height: 100%; object-fit: cover; display: block; }

.pcd-info { grid-area: info; min-width: 0; }

.pcd-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.5rem;
  padding-right: 1.6rem; /* space for edit pencil */
}

.pcd-fields {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.7rem;
}
.pcd-fields li {
  display: contents;
  font-size: 0.85rem;
}
.pcd-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  align-self: center;
}
.pcd-value { color: var(--text); font-weight: 600; }

.pcd-notes {
  margin-top: 0.7rem;
  padding: 0.6rem 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--blue);
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--text);
  white-space: pre-wrap;
  grid-column: 1 / -1;
}

.pcd-edit-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}
.pcd-edit-btn:hover { color: var(--text); border-color: var(--blue); }

/* Edit form */
.pcd-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.pcd-edit-form h4 {
  font-size: 0.95rem;
  margin: 0 0 0.3rem 0;
  color: var(--text);
}
.pcd-edit-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.pcd-edit-row label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
}
.pcd-edit-row input[type="text"],
.pcd-edit-row input[type="number"],
.pcd-edit-row textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
}
.pcd-edit-row textarea { resize: vertical; min-height: 60px; }
.pcd-edit-row input[type="file"] {
  color: var(--muted);
  font-size: 0.8rem;
}
.pcd-remove-photo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

/* Circular preview cropper (drag + zoom) */
.pcd-cropper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.pcd-cropper-view {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: var(--bg);
  border: 2px solid var(--border);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.pcd-cropper-view:active { cursor: grabbing; }

.pcd-cropper-img {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  max-width: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.pcd-cropper-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 220px;
}
.pcd-cropper-zoom-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
}
.pcd-cropper-zoom { flex: 1; }

.pcd-cropper-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pcd-cropper-hint {
  font-size: 0.72rem;
  color: var(--muted);
}
.pcd-edit-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.4rem;
}
.pcd-edit-actions .btn { width: auto; padding: 0.45rem 1rem; }
.pcd-edit-error {
  color: var(--red);
  font-size: 0.8rem;
  min-height: 1em;
}

/* Match card layout — two sides face to face */
.player-card-dialog:has(.is-match) {
  width: min(92vw, 760px);
}
.pcd-match-wrap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.9rem;
  align-items: stretch;
}
.pcd-match-side {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}
.pcd-match-side .pcd-card {
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  grid-template-columns: 72px 1fr;
}
.pcd-match-side .pcd-photo-wrap { width: 72px; height: 72px; }
.pcd-match-side .pcd-name { font-size: 0.95rem; }
.pcd-match-vs {
  align-self: center;
  font-weight: 800;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0 0.3rem;
}

@media (max-width: 640px) {
  .player-card-dialog:has(.is-match) { width: 92vw; }
  .pcd-match-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
  }
  .pcd-match-vs { padding: 0.3rem 0; text-align: center; }
}

/* ===== Phase 1 Mobile-Fixes (Audit Findings) ===== */

/* Big-Points-Buttons im Landscape: sonst werden sie zu schmalen Streifen */
@media (max-height: 500px) and (orientation: landscape) {
  .bp-btn {
    min-height: 72px;
    padding: 0.6rem 0.8rem;
  }
  .bp-plus { font-size: 1.4rem; }
}

/* Begegnung-Grid: lange Spielernamen brauchen eigene Zeile auf Mini-Displays */
@media (max-width: 460px) {
  .bg-match {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
}

/* TV-Score-Overlay: min-width 280px überflutet 320px-Displays */
@media (max-width: 360px) {
  .tv-scores {
    min-width: 0;
    width: min(90vw, 280px);
  }
}

/* Admin-Team-/Turnier-Karten: auf Mobile vertikal stapeln, sonst quetschen
   sich Name, Datum und 3 Action-Buttons in einer Reihe und wrappen brutal. */
@media (max-width: 640px) {
  .team-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }
  .team-card-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .team-card-actions .btn,
  .team-card-actions .inline-form {
    flex: 1 1 auto;
  }
  .team-card-actions .inline-form .btn { width: 100%; }

  /* Admin-Forms auf Mobile: .name-row-Felder untereinander statt gequetscht
     nebeneinander (wichtig für date/time/Team-Select die sonst nicht lesbar
     sind auf 360px) */
  .name-row {
    flex-direction: column;
    gap: 0.55rem;
  }
}

/* ===== Phase 2 UX-Polish ===== */

/* Scoring "Ergebnis eintragen"-Button: auf Mobile größer, damit man nicht
   versehentlich auf die Karte dahinter tippt */
@media (max-width: 640px) {
  .quick-result-btn {
    font-size: 0.82rem;
    padding: 0.45rem 0.75rem;
    min-height: 36px;
    background: rgba(22, 27, 34, 0.95);
  }
}

/* Bracket Horizontal-Scroll: dünne Scrollbar auf Mobile immer sichtbar
   machen, damit User merken dass es scrollt. Standard auf iOS/Android ist
   die Scrollbar unsichtbar — und ohne Indikator denkt man, der Bracket
   wäre schon zu Ende. */
@media (max-width: 640px) {
  .bracket-wrap {
    scrollbar-width: thin;
    scrollbar-color: var(--muted) transparent;
    padding-bottom: 0.5rem;
  }
  .bracket-wrap::-webkit-scrollbar { height: 6px; }
  .bracket-wrap::-webkit-scrollbar-track { background: transparent; }
  .bracket-wrap::-webkit-scrollbar-thumb {
    background: var(--muted);
    border-radius: 3px;
  }
}

/* ── Zwischenstand / Gesamtergebnis (Matchpunkte · Sätze · Spiele) ────────
   Card-Style wie Match-Ergebnisse, mit farbigem Akzent links um Einzel /
   Doppel vom Gesamtergebnis zu trennen. Drei Spalten: große Zahl oben,
   kleines Label darunter. Stacked auf Mobile. */
.bg-subscore {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  margin: 0.75rem 1rem 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
}
.bg-subscore.is-gesamt {
  border-left-color: var(--green-lt);
  margin-top: 1.25rem;
  padding: 1rem 1rem;
}
.bg-subscore-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  flex: 0 0 auto;
  min-width: 10rem;
}
.bg-subscore.is-gesamt .bg-subscore-label {
  font-size: 1.05rem;
  font-weight: 700;
}
.bg-subscore-pill {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.bg-subscore-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}
.bg-subscore-num {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.bg-subscore.is-gesamt .bg-subscore-num {
  font-size: 1.4rem;
}
.bg-subscore-tag {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 640px) {
  .bg-subscore {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding: 0.75rem 0.8rem;
  }
  .bg-subscore-label {
    min-width: 0;
    text-align: center;
  }
}

/* ── Auswärts-Label (Begegnung, Card, Detail) ───────────────────────────── */
.away-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  margin-left: 0.4rem;
  background: var(--yellow);
  color: #2a2200;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  vertical-align: middle;
  text-transform: uppercase;
}
/* Kompakte Variante in den Cards (nur "A") */
.bg-card-team .away-badge {
  padding: 0.05rem 0.35rem;
  font-size: 0.6rem;
  margin-left: 0.3rem;
}

/* ── "Heute auswärts"-Section auf der Startseite ──────────────────────────
   Liste von Cards, jede Card zeigt Begegnung + alle 9 Slots mit Ergebnis. */
.away-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.away-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--yellow);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}
.away-card:hover { border-color: var(--blue); }

.away-card-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.6rem;
  align-items: center;
}
.away-card-team {
  font-weight: 600;
  text-align: left;
}
.away-card-score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}
.away-card-opp {
  font-weight: 600;
  text-align: right;
}
.away-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.away-slots {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem 0.8rem;
}
.away-slot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.15rem 0;
}
.away-slot-pos {
  font-weight: 700;
  color: var(--muted);
  min-width: 1.6rem;
}
.away-slot.is-done .away-slot-pos { color: var(--text); }
.away-slot-result {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.away-slot-pending {
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 640px) {
  .away-slots { grid-template-columns: repeat(2, 1fr); }
  .away-card-header { grid-template-columns: 1fr auto; }
  .away-card-opp { grid-column: 2; }
  .away-card-score { grid-column: 1 / -1; text-align: center; }
}

/* Live laufende Auswärts-Kachel im Score-Grid: eigene Reihe unter den
   physischen Courts, mit gelbem Akzent links. Score-Zahlen bewusst
   ausgespart (kein Live-Scoring bei Auswärts). */
.score-card.away-live-card {
  border-left: 4px solid var(--yellow);
}
.score-card.away-live-card .sc-player {
  font-weight: 600;
}
.scores-subtitle {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 1.25rem 0 0.5rem;
}

/* ── Auswärts-Section im Schedule-Tab ───────────────────────────────── */
.sched-away-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--yellow);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
}
.sched-away-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.sched-away-team {
  font-weight: 600;
  color: var(--text);
}
.sched-away-meta {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sched-away-rows {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.sched-away-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto auto auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}
.sched-away-row + .sched-away-row {
  border-top: 1px solid var(--border);
}
.sched-away-pos {
  font-weight: 700;
  color: var(--muted);
}
.sched-away-row.sched-away-row-live .sched-away-pos,
.sched-away-row.sched-away-row-done .sched-away-pos { color: var(--text); }
.sched-away-players { color: var(--text); }
.sched-away-status {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.sched-away-sets {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}
.sched-away-actions {
  display: flex;
  gap: 0.3rem;
}
@media (max-width: 640px) {
  .sched-away-row { grid-template-columns: 2rem 1fr auto; }
  .sched-away-sets, .sched-away-status { grid-column: 2; justify-self: start; font-size: 0.8rem; }
  .sched-away-actions { grid-column: 1 / -1; justify-self: stretch; margin-top: 0.3rem; }
}

/* Begegnungs-Card: Datum prominent oben, Mannschaft+Score mittig, Liga unten */
.bg-card-date {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.bg-card-date .away-badge {
  margin-left: 0;
}

/* Scoring-Tab-Variante: Slot-Buttons zum Ergebnis eintragen */
.away-slots-scoring {
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}
.away-slot-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.away-slot-btn:hover { border-color: var(--blue); background: rgba(31, 111, 235, 0.08); }
.away-slot-btn.is-done { border-color: var(--green); background: rgba(35, 134, 54, 0.08); }
.away-slot-btn.is-done:hover { border-color: var(--green-lt); }
/* Links (open/live) müssen sich wie Buttons anfühlen — Underline weg,
   Farbe erben, is-live bekommt Live-Rot-Akzent. */
a.away-slot-btn { text-decoration: none; color: inherit; }
.away-slot-btn.is-live  { border-color: #d23; background: rgba(221, 51, 51, 0.06); }
.away-slot-btn.is-live:hover { border-color: #f44; background: rgba(221, 51, 51, 0.12); }
.away-slot-btn.is-live .away-slot-pending { color: #d23; font-style: normal; font-weight: 600; }
.away-slot-btn .away-slot-pos {
  font-weight: 700;
  min-width: 1.8rem;
}
.away-slot-btn .away-slot-pending {
  color: var(--muted);
  font-style: italic;
}
@media (max-width: 640px) {
  .away-slots-scoring { grid-template-columns: 1fr; }
}

/* Checkbox-Zeile, wird als .form-field in einer .name-row verwendet.
   Layout: Checkbox links, Label rechts, vertikal zur Input-Zeile ausgerichtet
   sodass Format-Select und Checkbox eine Höhe haben. */
.checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.7rem;
  padding-top: 1.1rem;  /* gleiche Höhe wie Label oberhalb der Inputs */
  cursor: pointer;
  user-select: none;
}
.checkbox-row input[type="checkbox"] {
  width: 1.4rem;
  height: 1.4rem;
  flex: 0 0 auto;
  cursor: pointer;
  accent-color: var(--green-lt);
}
.checkbox-row span {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.2;
}

/* ═══════════════════════════════════════════════════════════════════════
   Mobile-Tauglichkeit — neue Features (Mannschaften, Auth-Flow v2,
   Admin-Invites). Auf <640px umbrechen / stapeln, Tables scrollbar.
   Phone-Test-Breakpoints: 375 (iPhone), 414 (Plus/Pro Max).
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  /* Meldeliste-Tabelle + Invite-Preview: Horizontal-Scroll statt Overflow.
     Tabellen werden nicht kleiner skaliert — Text bleibt lesbar, bei Bedarf
     kann der User zur Seite wischen. */
  .meldeliste-table,
  .invite-preview-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .meldeliste-table td,
  .invite-preview-table td { white-space: normal; }
  .meldeliste-table .ml-pos,
  .meldeliste-table .ml-lk,
  .meldeliste-table .ml-year {
    width: auto;
    min-width: 3.5rem;
  }

  /* Team-Grid bleibt dank auto-fill/minmax sauber; nur eine dichtere Gap. */
  .team-grid { gap: 0.5rem; }
  .team-card { padding: 0.7rem 0.8rem; }

  /* Mannschaft-Header: Back-Button über dem Titel, nicht daneben. */
  .mannschaft-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  /* Tabs auf Mobile: horizontal scrollbar wenn zu viele oder zu lang. */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: thin;
  }
  .tab { flex-shrink: 0; padding: 0.6rem 0.7rem; font-size: 0.88rem; }

  /* Auth-Actions mit 2 Buttons: stacken. Single-Button bleibt 100% breit. */
  .auth-actions {
    flex-direction: column;
  }
  .auth-actions .btn {
    width: 100%;
  }

  /* Admin-Header: Bulk-Invite-Button volle Breite statt inline. */
  .admin-header .btn-secondary {
    display: block;
    width: 100%;
  }

  /* Link-Player-Dialog: volle Breite, kleinere Padding. */
  .link-player-dialog {
    padding: 1rem;
    max-width: 100%;
    width: 94vw;
  }

  /* User-Card-Meta: "Spieler: xyz" + ändern-Button wickelt um. */
  .user-card-link-btn {
    display: inline-block;
    margin-top: 0.2rem;
  }

  /* Bist-das-du Confirm-Card: Action-Buttons stacken. */
  .guest-confirm-card + .auth-actions { flex-direction: column; }

  /* Scoring-Primary-Buttons auf Mobile weiter flexible (sind schon per
     Default gut), aber Walkover-Row untereinander stapeln damit niemand
     bei engem Screen ausversehen trifft. */
  .big-points { gap: 0.5rem; }

  /* Profil-Seite Foto-Preview: 80px statt 100px damit's nicht dominiert */
  .profile-photo-preview img {
    width: 80px;
    height: 80px;
  }
}

/* Sehr schmal (≤360px, z.B. iPhone SE 1. Gen): noch aggressiver kondensieren */
@media (max-width: 360px) {
  .meldeliste-table th,
  .meldeliste-table td,
  .invite-preview-table th,
  .invite-preview-table td {
    padding: 0.3rem 0.35rem;
    font-size: 0.78rem;
  }
  .team-card-name { font-size: 0.92rem; }
  .tab { padding: 0.5rem 0.55rem; font-size: 0.82rem; }
}

/* ═══ App-Install-Seite (/auth/app) ═══ */

/* Section-Überschriften */
.app-benefits-title,
.app-install-title {
  font-size: 1.05rem;
  color: var(--text);
  margin: 2.2rem 0 1.2rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* Vorteile-Grid: 2×2 auf Desktop, 1-col Mobile */
.app-benefits-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.app-benefits-list > li {
  padding: 1rem 1.1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.55;
}
.app-benefits-list strong {
  font-size: 0.95rem;
  color: var(--text);
}
.app-benefit-icon {
  font-size: 1.05rem;
  line-height: 1;
  margin-left: 0.2rem;
}

/* Pro-OS Accordion */
.app-install-os {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.app-install-os summary {
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-install-os summary:hover { background: rgba(31, 111, 235, 0.08); }
.app-install-os[open] summary { border-bottom: 1px solid var(--border); }
.app-os-icon {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  background: var(--blue);
  border-radius: 4px;
  flex-shrink: 0;
}

/* Install-Steps mit großzügigem Vertikal-Rhythmus */
.app-install-steps {
  margin: 1.2rem 1.6rem 1.4rem;
  padding: 0 0 0 1.2rem;
  line-height: 1.7;
}
.app-install-steps > li {
  margin-bottom: 1.4rem;
  padding-left: 0.3rem;
}
.app-install-steps > li:last-child { margin-bottom: 0; }

.app-icon-placeholder {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  background: var(--border);
  border-radius: 4px;
  font-family: -apple-system, monospace;
  font-size: 0.95em;
  margin: 0 0.15rem;
}

/* Screenshots deutlich kleiner — als "Beleg" für den Step, nicht als Haupt-Element. */
.app-step-screenshot {
  margin: 0.7rem 0 0;
  padding: 0;
  text-align: center;
}
.app-step-screenshot img {
  display: inline-block;
  max-width: 260px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Mobile */
@media (max-width: 640px) {
  .app-benefits-list { grid-template-columns: 1fr; }
  .app-install-steps { margin: 1rem 0.6rem 1.2rem; padding-left: 1rem; }
  .app-install-steps > li { margin-bottom: 1.2rem; }
  .app-step-screenshot img { max-width: 220px; }
}

/* Begegnungs-Detail: dezenter Hinweis dass Match-Start anderswo läuft. */
.bg-flow-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.4rem 1rem 1rem;
}
.bg-flow-hint a { color: var(--blue); text-decoration: underline; }

/* ===== Mobile-Fixes 04.05.2026 ===== */
@media (max-width: 600px) {
  /* Admin-Header (Mannschaftsspiele Detail): back-btn war
     position:absolute und überlappte den langen Match-Title — auf Mobile
     vertikal stacken. */
  .admin-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0.7rem 1rem;
  }
  .admin-header .back-btn {
    position: static;
    align-self: flex-start;
    transform: none;
  }
  .admin-header h1 {
    font-size: 0.98rem;
    line-height: 1.25;
    text-align: center;
    word-break: break-word;
    margin: 0;
  }
  .admin-header .admin-link { align-self: flex-end; font-size: 0.85rem; }

  /* Slot-Cards: Action-Buttons (Score + ✏ + ✕) flossen rechts aus dem
     Viewport — auf Mobile als eigene Zeile, full-width, rechts-bündig.
     `flex: 0 0 100%` zwingt eigene Zeile; ohne das Schiebt flex-wrap die
     Action manchmal zurück in Zeile 1. Slot-status hat default nowrap —
     auf Mobile aufheben damit Score+Buttons brechen können. */
  .slot-card-action {
    margin-left: 0;
    flex: 0 0 100%;
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding-top: 0.3rem;
  }
  .slot-card-action .slot-status {
    flex-wrap: wrap;
    justify-content: flex-end;
    white-space: normal;
    max-width: 100%;
  }

  body.court-page .tv-wo-slot { display: none; }
}

/* Stream-Overlays kompakt halten — sowohl Portrait (max-width 600px) als
   auch Landscape-Mobile (typisch >800px breit, aber <500px hoch).
   Anton 09.05.: Querformat-Bug, Overlay war wieder Desktop-groß weil
   die alte (max-width: 600px)-Regel nicht griff. */
@media (max-width: 600px), (max-height: 500px) {
  body.court-page .tv-overlay {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    left:   calc(8px + env(safe-area-inset-left, 0px));
    max-width: calc(100vw - 16px);
    padding: 1rem 0.6rem 0.4rem;
  }
  body.court-page .tv-scores  { min-width: 0; padding: 0.25rem 0.5rem; }
  body.court-page .tv-court-label { font-size: 0.5rem; margin-bottom: 0.2rem; }
  body.court-page .tv-row {
    grid-template-columns: 0.9rem minmax(0, 1fr) auto auto;
    gap: 0.3rem;
    padding: 0.12rem 0;
  }
  body.court-page .tv-name { font-size: 0.65rem; }
  body.court-page .tv-set-scores { gap: 0.25rem; }
  body.court-page .tv-set        { font-size: 0.7rem; min-width: 0.8rem; }
  body.court-page .tv-points {
    font-size: 0.7rem;
    min-width: 1.3rem;
    padding: 0.02rem 0.25rem;
  }

  /* Index-Page Stream-Cards (.score-overlay) — gleiche Behandlung. */
  .score-overlay {
    padding: 0.8rem 0.5rem 0.4rem;
  }
  .overlay-court-name { font-size: 0.5rem; margin-bottom: 0.15rem; }
  .overlay-row { gap: 0.25rem; padding: 0.05rem 0; }
  .ov-name  { font-size: 0.7rem; }
  .ov-sets  { gap: 0.25rem; }
  .ov-set   { font-size: 0.75rem; min-width: 0.9rem; }
  /* Punkte-Slot mobil: gleiche Schriftgröße wie Sätze, kompakte
     Spaltenbreite (für 1-2-stellige Werte reichen 1.1rem). */
  .ov-wo-slot { font-size: 0.75rem; min-width: 1.1rem; }
}
