/* =========================================================================
   Eagles Cup - gemeinsames Design (oeffentliche Ansicht + Verwaltung)
   Mobil-first, ohne externe Abhaengigkeiten.
   ========================================================================= */
:root {
  --navy: #0b2545;
  --navy-2: #13315c;
  --navy-3: #1c4275;
  --gold: #f3b21b;
  --gold-dark: #cf9109;
  --gold-soft: #fff6e0;
  --bg: #e9edf4;
  --bg-2: #e1e7f1;
  --card: #ffffff;
  --line: #e6ebf3;
  --text: #152033;
  --muted: #6b7689;
  --live: #e23b3b;
  --finished: #1a9d54;
  --silver: #cfd5de;
  --bronze: #e2ac7d;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(11, 37, 69, 0.06), 0 8px 24px rgba(11, 37, 69, 0.07);
  --shadow-lg: 0 6px 16px rgba(11, 37, 69, 0.10), 0 20px 44px rgba(11, 37, 69, 0.12);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, #0a2140 0%, var(--navy-2) 55%, var(--navy-3) 100%);
  color: #fff;
  padding: 12px 16px;
  box-shadow: 0 3px 0 0 var(--gold), 0 8px 22px rgba(11, 37, 69, 0.30);
}
.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-badge {
  width: 38px; height: 38px; flex: none;
  border-radius: 10px;
  background: var(--gold);
  color: var(--navy);
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
}
.brand-logo { height: 42px; width: auto; flex: none; display: block; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35)); }
.brand-logo.big { height: 88px; margin: 0 auto 12px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3)); }
.team-logo { height: 20px; width: 20px; object-fit: contain; vertical-align: middle; margin-right: 7px; border-radius: 4px; }
table.standings .team-logo { height: 18px; width: 18px; }

.topbar h1 { font-size: 18px; margin: 0; font-weight: 800; letter-spacing: 0.2px; }
.topbar .sub { font-size: 12px; opacity: 0.82; margin-top: 1px; letter-spacing: 0.3px; }
.topbar .spacer { flex: 1; }

.live-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.3px;
  background: rgba(255, 255, 255, 0.13);
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.live-dot .dot { width: 8px; height: 8px; border-radius: 50%; background: #9fb3c8; transition: background 0.2s; }
.live-dot.on .dot { background: #36d07f; box-shadow: 0 0 0 0 rgba(54, 208, 127, 0.7); animation: pulse 1.8s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(54, 208, 127, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(54, 208, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(54, 208, 127, 0); }
}

/* ---------- Layout ---------- */
.wrap { max-width: 980px; margin: 0 auto; padding: 14px 12px 64px; }

/* ---------- Kategorie-Tabs ---------- */
.tabs {
  position: sticky; top: 62px; z-index: 15;
  display: flex; gap: 8px; overflow-x: auto;
  max-width: 980px;
  margin: 0 auto 6px;
  padding: 12px 12px;
  background: linear-gradient(180deg, var(--bg) 70%, rgba(233, 237, 244, 0));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--navy);
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(11, 37, 69, 0.05);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s, color 0.12s, border-color 0.12s;
}
.tab small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 1px; }
.tab:hover { border-color: var(--gold); }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); box-shadow: 0 4px 12px rgba(11, 37, 69, 0.28); }
.tab.active small { color: var(--gold); opacity: 0.95; }

/* ---------- Abschnitte ---------- */
.section-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--navy);
  margin: 22px 4px 10px;
}
.section-title::before { content: ""; width: 16px; height: 3px; border-radius: 3px; background: var(--gold); flex: none; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}
.card-head {
  padding: 11px 14px;
  font-weight: 800; font-size: 14px;
  color: var(--navy);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #fafcff);
  display: flex; align-items: center; gap: 8px;
}

/* ---------- Tabelle ---------- */
table.standings { width: 100%; border-collapse: collapse; font-size: 14px; }
table.standings th, table.standings td { padding: 9px 6px; text-align: center; }
table.standings th { font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
table.standings td.team, table.standings th.team { text-align: left; font-weight: 700; padding-left: 12px; }
table.standings td.pts { font-weight: 800; color: var(--navy); font-size: 15px; }
table.standings tbody tr:nth-child(even) { background: #fafbfd; }
table.standings tr + tr td { border-top: 1px solid var(--line); }
table.standings .rank {
  display: inline-grid; place-items: center;
  width: 23px; height: 23px; border-radius: 7px;
  background: #eef1f7; font-size: 12px; font-weight: 800; color: var(--navy);
}
/* Medaillen fuer die ersten drei Plaetze */
table.standings tbody tr:nth-child(1) .rank { background: linear-gradient(135deg, #ffd75e, var(--gold)); color: #5b4200; box-shadow: 0 1px 3px rgba(207, 145, 9, 0.4); }
table.standings tbody tr:nth-child(2) .rank { background: linear-gradient(135deg, #e3e7ee, var(--silver)); color: #3a4250; }
table.standings tbody tr:nth-child(3) .rank { background: linear-gradient(135deg, #efc59b, var(--bronze)); color: #5c3a17; }
table.standings tr.top { background: var(--gold-soft) !important; }
.prov-note { font-size: 11px; color: var(--muted); padding: 6px 12px 10px; }
.tie-flag { color: var(--gold-dark); font-weight: 800; }

/* ---------- Spielzeilen ---------- */
.match {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 10px; align-items: center;
  padding: 11px 14px;
}
.match + .match { border-top: 1px solid var(--line); }
.match .when { text-align: center; }
.match .time { font-weight: 800; font-size: 14px; color: var(--navy); }
.match .no { font-size: 10px; color: var(--muted); margin-top: 1px; }
.match .teams { min-width: 0; }
.match .team-line { display: flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 600; }
.match .team-line.unresolved { color: var(--muted); font-style: italic; font-weight: 500; }
.match .vs { font-size: 10.5px; color: var(--muted); margin: 2px 0; text-transform: uppercase; letter-spacing: 0.5px; }
.match .score {
  text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 800; font-size: 20px; min-width: 60px;
  color: var(--navy); letter-spacing: 0.5px;
}
.match .score .pending { color: #b7c0cf; font-weight: 700; font-size: 16px; letter-spacing: 1px; }
.match .score .seven { display: block; font-size: 10px; color: var(--muted); font-weight: 700; margin-top: 1px; }
.winner { color: var(--finished); font-weight: 800; }

.badge {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(11, 37, 69, 0.06);
}
.badge.hall { background: #eaf0fb; color: var(--navy-2); }
.badge.live { background: var(--live); color: #fff; animation: blink 1.4s infinite; }
.badge.placement { background: var(--gold-soft); color: var(--gold-dark); }
.badge.ko { background: #e9f0ff; color: var(--navy-3); }
@keyframes blink { 50% { opacity: 0.55; } }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.muted { color: var(--muted); }
.empty {
  text-align: center; color: var(--muted); padding: 44px 20px; font-weight: 600;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
}
.footer-note {
  max-width: 980px; margin: 26px auto 0; padding: 0 14px;
  font-size: 12px; color: var(--muted); text-align: center;
}
.footer-note a { display: inline-block; margin-top: 8px; color: var(--navy); font-weight: 700; text-decoration: none; }
.footer-note a:hover { color: var(--gold-dark); }
.rules { font-size: 12.5px; color: var(--muted); padding: 4px 4px 0; }
.rules li { margin: 3px 0; }

/* ---------- Turnier-Auswahl (oeffentlich) ---------- */
.tournament-bar {
  position: sticky; top: 62px; z-index: 16;
  max-width: 980px; margin: 0 auto; padding: 10px 12px 4px;
  display: flex; align-items: center; gap: 8px;
}
.tournament-bar .tb-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.tsel {
  flex: 1; max-width: 340px; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--navy);
  font-size: 15px; font-weight: 700; box-shadow: 0 1px 2px rgba(11, 37, 69, 0.05);
}
.tournament-bar:not([style*="display:none"]) + .tabs { top: 108px; }

/* ---------- K.o.-Runden ---------- */
.ko-round { margin-bottom: 8px; }
.ko-round-title {
  font-size: 13px; font-weight: 800; color: var(--navy);
  margin: 8px 4px 5px; display: flex; align-items: center; gap: 8px;
}
.ko-round-title::before { content: ""; width: 14px; height: 3px; background: var(--gold); border-radius: 3px; }

/* =========================================================================
   Smartphone-Optimierung (vor allem die Teilnehmer-Ansicht, .public)
   ========================================================================= */
@media (max-width: 480px) {
  .wrap { padding: 10px 8px 60px; }
  .topbar { padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .topbar h1 { font-size: 16px; }
  .topbar .sub { font-size: 11px; }
  .brand-logo { height: 38px; }
  .live-dot { font-size: 11px; padding: 4px 9px; }

  .tabs { top: calc(58px + env(safe-area-inset-top, 0px)); padding: 10px; }
  .tournament-bar { top: calc(58px + env(safe-area-inset-top, 0px)); }
  .tournament-bar:not([style*="display:none"]) + .tabs { top: calc(106px + env(safe-area-inset-top, 0px)); }
  .tab { padding: 8px 13px; font-size: 13.5px; }
  .section-title { margin: 16px 2px 8px; }

  /* Tabellen: auf dem Handy nur das Wesentliche (Platz, Team, Sp, Diff, Pkt) */
  .public table.standings th.hide-sm, .public table.standings td.hide-sm { display: none; }
  .public table.standings th, .public table.standings td { padding: 9px 4px; }
  .public table.standings td.team, .public table.standings th.team { padding-left: 8px; white-space: normal; word-break: break-word; line-height: 1.2; }
  .public table.standings td.pts { font-size: 16px; }
  .public .team-logo { height: 17px; width: 17px; margin-right: 5px; }

  /* Spielzeilen: mehr Platz fuers Ergebnis, Namen duerfen umbrechen */
  .match { grid-template-columns: 44px 1fr auto; gap: 8px; padding: 11px 10px; }
  .match .team-line { font-size: 15px; word-break: break-word; }
  .match .score { font-size: 21px; min-width: 52px; }
  .footer-note { padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 360px) {
  .tab { font-size: 12.5px; padding: 7px 11px; }
  .match .team-line { font-size: 14px; }
  .match .score { font-size: 20px; }
}
