:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: #0f1b2f;
  --panel-2: #13223b;
  --line: #223655;
  --text: #e8eefc;
  --muted: #9cb0d0;
  --accent: #38bdf8;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: radial-gradient(circle at top, #132546 0, var(--bg) 45%);
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
}

body.team-route #hero,
body.team-route #summary,
body.team-route #teamsGrid {
  display: none !important;
}

body.team-route #teamDetail {
  display: block !important;
}

.shell {
  width: min(1480px, 100%);
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px;
}

.hero, .panel, .team-card, .video-card, .player-modal-dialog, .team-detail {
  background: rgba(15, 27, 47, 0.95);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.25);
}

.mode-banner {
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  font-weight: 800;
  letter-spacing: .02em;
}

.mode-banner.demo {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0.08));
  color: #fde68a;
}

.mode-banner.live {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.22), rgba(34, 197, 94, 0.08));
  color: #bbf7d0;
}

.mode-banner strong {
  display: inline-block;
  margin-right: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  padding: 24px;
  margin-bottom: 18px;
}

.hero > * {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 46px);
}

.lede { margin: 0; color: var(--muted); max-width: 70ch; }

.brand-header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #04111f;
  font-size: 28px;
  box-shadow: 0 10px 30px rgba(14, 165, 233, 0.25);
  flex: 0 0 auto;
}

.brand-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
}

.brand-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.hero-actions,
.team-right,
.team-detail-grid,
.player-modal-meta {
  min-width: 0;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.mode-switch {
  display: flex;
  gap: 10px;
}

.button {
  background: linear-gradient(90deg, var(--accent), #0ea5e9);
  color: #04111f;
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

.button.secondary {
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: 1px solid var(--line);
}

.button.active {
  background: linear-gradient(90deg, var(--accent), #0ea5e9);
  color: #04111f;
}

.button:hover { filter: brightness(1.05); }

.status {
  color: var(--muted);
  font-size: 14px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.filter-chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}

.filter-chip.active {
  background: linear-gradient(90deg, var(--accent), #0ea5e9);
  color: #04111f;
}

.summary .panel {
  padding: 16px;
}

.summary .label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
}

.summary .value {
  font-size: 26px;
  font-weight: 800;
  margin-top: 6px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.team-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  align-items: start;
  overflow: hidden;
}

.team-left {
  position: sticky;
  top: 16px;
  text-align: left;
}

.team-title, .team-detail-title {
  margin: 0;
  font-size: 20px;
}

.team-kicker {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  margin-bottom: 8px;
}

.team-meta { color: var(--muted); font-size: 13px; }
.team-badge {
  display: inline-flex;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
}
.team-badge.ok { color: #b7f7cc; }
.team-badge.missing { color: #fcd34d; }
.team-badge.error { color: #fca5a5; }

.team-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.team-filters .filter-chip {
  padding: 8px 10px;
  font-size: 12px;
}

.mini-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.videos {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  align-items: stretch;
  -webkit-overflow-scrolling: touch;
}

.videos .video-card {
  flex: 0 0 300px;
  min-width: 300px;
  max-width: 300px;
  scroll-snap-align: start;
}

.videos::-webkit-scrollbar {
  height: 10px;
}

.videos::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.16);
  border-radius: 999px;
}

.team-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.news-section {
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.news-section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.news-section-header h3 {
  margin: 0;
  font-size: 16px;
}

.digest-panel {
  gap: 12px;
}

.digest-hero {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), rgba(56, 189, 248, 0.04));
}

.digest-top-update {
  font-size: 16px;
  line-height: 1.5;
  font-weight: 700;
}

.digest-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.digest-list li {
  margin: 0 0 10px;
  line-height: 1.5;
}

.news-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.news-badge.official {
  color: #bbf7d0;
}

.news-badge.reliable {
  color: #bae6fd;
}

.news-badge.rumour {
  color: #fde68a;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 12px;
  background: rgba(255,255,255,.03);
}

.team-active-labels {
  margin-top: 6px;
  color: #cbd5e1;
}

.video-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.video-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 20px 55px rgba(0, 0, 0, 0.25);
}

.video-select, .more-button {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.more-card {
  justify-content: center;
}

.more-button {
  height: 100%;
  min-height: 220px;
  align-items: center;
  justify-content: center;
}

.more-button-label {
  font-size: 22px;
  font-weight: 800;
}

.thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  background: #111827;
}

.thumb-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  font-size: 14px;
  font-weight: 700;
}

.video-title {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.35;
}

.video-meta { color: var(--muted); font-size: 13px; }

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 14px;
}

.setup-note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 10px;
}

.team-detail {
  margin-bottom: 18px;
  padding: 18px;
}

.team-detail-header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.team-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.player-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.player-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
}

.player-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100vw - 32px));
  margin: 32px auto;
  padding: 18px;
}

.player-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

.player-modal-frame-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #020617;
  border: 1px solid var(--line);
}

.player-modal-frame {
  width: 100%;
  height: 100%;
  border: 0;
}

.player-modal-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
}

.player-modal-title {
  margin: 0;
  font-size: 20px;
}

@media (max-width: 900px) {
  .shell {
    padding: 18px;
  }

  .hero {
    flex-direction: column;
  }

  .hero-actions {
    align-items: stretch;
    width: 100%;
  }

  .hero-actions .button {
    width: 100%;
  }

  .team-card {
    grid-template-columns: 1fr;
  }

  .team-left {
    position: static;
  }
}

@media (max-width: 700px) {
  .shell {
    padding: 12px;
  }

  .hero,
  .team-card,
  .team-detail,
  .player-modal-dialog {
    border-radius: 16px;
  }

  .hero,
  .team-card,
  .team-detail {
    padding: 14px;
  }

  h1 {
    font-size: clamp(28px, 8vw, 36px);
  }

  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary .value {
    font-size: 22px;
  }

  .team-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .team-filters .filter-chip {
    flex: 0 0 auto;
  }

  .team-detail-grid {
    grid-template-columns: 1fr;
  }

  .videos {
    gap: 10px;
    margin-right: -4px;
    padding-right: 22px;
    padding-bottom: 8px;
  }

  .videos .video-card {
    flex: 0 0 calc((100vw - 48px) / 2.2);
    min-width: calc((100vw - 48px) / 2.2);
    max-width: calc((100vw - 48px) / 2.2);
  }

  .video-card {
    padding: 10px;
  }

  .video-title {
    font-size: 15px;
  }

  .player-modal {
    padding: 8px;
  }

  .player-modal-dialog {
    margin: 0;
    width: 100%;
    max-height: calc(100vh - 16px);
    overflow: auto;
    padding: 14px;
  }

  .player-modal-close {
    top: 10px;
    right: 10px;
  }

  .player-modal-title {
    font-size: 18px;
    padding-right: 44px;
  }

  .player-modal-meta {
    align-items: flex-start;
  }

  .team-detail-header {
    flex-direction: column;
    align-items: stretch;
  }

  .team-detail-header .button {
    width: 100%;
  }
}

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

  .mode-banner {
    padding: 14px;
  }

  .team-title,
  .team-detail-title {
    font-size: 18px;
  }

  .videos {
    padding-right: 18px;
  }

  .videos .video-card {
    flex: 0 0 calc((100vw - 34px) / 2.15);
    min-width: calc((100vw - 34px) / 2.15);
    max-width: calc((100vw - 34px) / 2.15);
  }
}
