/* =====================================================
   Bracket Wheel — futuristic dark UI
   ===================================================== */

:root {
  --bg-0: #08090b;
  --bg-1: #111318;
  --bg-2: #1a1d24;
  --bg-3: #21252e;

  --line-dim: #3a3d42;
  --line-mid: #555a61;
  --line-hi: #9ca3af;

  --text-hi: #f3f4f6;
  --text-mid: #cbd0d8;
  --text-lo: #9ca3af;

  --gold-1: #ffe699;
  --gold-2: #f4b64a;
  --gold-3: #9b6120;

  --accent-cyan: #22d3ee;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;

  --panel-bg: rgba(20, 23, 30, 0.6);
  --panel-border: rgba(255, 255, 255, 0.06);

  --transition-slow: 900ms;
  --easing: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(ellipse at top, #14171d 0%, #0a0b0f 60%, #06070a 100%);
  color: var(--text-hi);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* =====================================================
   Layout
   ===================================================== */

.app {
  height: 100vh;
  display: grid;
  grid-template-rows: 64px 1fr;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: linear-gradient(180deg, rgba(15, 17, 22, 0.9) 0%, rgba(10, 12, 16, 0.5) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, rgba(244, 182, 74, 0.25), rgba(15, 17, 22, 0.9) 70%);
  box-shadow: 0 0 20px rgba(244, 182, 74, 0.25), inset 0 0 8px rgba(255, 255, 255, 0.05);
  color: var(--gold-2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.brand-mark svg { width: 100%; height: 100%; display: block; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.14em;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-lo);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

.chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-lo);
  transition: all 200ms var(--easing);
  letter-spacing: 0.02em;
}
.chip:hover {
  color: var(--text-hi);
  background: rgba(255, 255, 255, 0.04);
}
.chip.active {
  color: #0b0d12;
  background: linear-gradient(180deg, #f7f9fb 0%, #d0d5de 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.status-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}
.source-tag {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(244, 182, 74, 0.08);
  color: var(--gold-2);
  border: 1px solid rgba(244, 182, 74, 0.2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: #fca5a5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-red 1.6s infinite;
}
@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.stage {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 20px;
  padding: 20px;
  overflow: hidden;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.panel h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-lo);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-mid);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.badge.live {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge.upcoming {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.badge.finished {
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.muted {
  color: var(--text-lo);
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
}

/* Next match card */
.next-match-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nm-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.nm-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.nm-team-flag {
  font-size: 28px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}
.nm-team-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-hi);
}
.nm-vs {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--text-lo);
  font-size: 12px;
  letter-spacing: 0.16em;
}
.nm-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-lo);
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.nm-meta span:last-child {
  color: var(--text-mid);
  font-weight: 500;
}

.nm-live, .nm-upcoming { cursor: pointer; }
.nm-live { padding-bottom: 4px; }

.nm-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
  color: var(--text-lo);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}
.nm-divider::before,
.nm-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}
.nm-upcoming .nm-team-flag { font-size: 22px; }
.nm-upcoming .nm-team-name { font-size: 11px; }
.nm-upcoming .nm-teams { gap: 6px; }
.nm-upcoming .nm-meta { font-size: 10px; }

/* Recent list */
.recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recent-item {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12px;
  cursor: pointer;
  transition: background 180ms var(--easing);
}
.recent-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.recent-item .ri-team {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.recent-item .ri-team.left { justify-content: flex-start; }
.recent-item .ri-team.right { justify-content: flex-end; }
.ri-flag { font-size: 16px; flex-shrink: 0; }
.ri-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-mid);
}
.ri-team.winner .ri-name { color: var(--text-hi); font-weight: 600; }
.ri-score {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: 0.06em;
}

/* Legend */
.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-mid);
}
.lg {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lg-live { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.lg-win { background: linear-gradient(135deg, #ffe699, #f4b64a); box-shadow: 0 0 8px #f4b64a; }
.lg-scheduled { background: #3b82f6; box-shadow: 0 0 8px rgba(59, 130, 246, 0.6); }
.lg-out { background: #3a3d42; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-cell {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-size: 10px;
  color: var(--text-lo);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: 0.02em;
}

/* =====================================================
   Wheel
   ===================================================== */

.wheel-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.wheel-scale {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 160px);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
}

#wheel {
  width: 100%;
  height: 100%;
  display: block;
}

/* wheel-root gets rotate() applied via JS (rAF-driven, no CSS transition) */
#wheel-root {
  transform-origin: 0 0;
  transform-box: view-box;
  will-change: transform;
}

/* --- Connectors --- */
.connector {
  fill: none;
  stroke: var(--line-dim);
  stroke-width: 1.5;
  stroke-linecap: round;
  cursor: pointer;
  transition: stroke 500ms var(--easing), stroke-width 300ms var(--easing), opacity 500ms var(--easing);
}
.connector.won {
  stroke: url(#goldGrad);
  stroke: #F4B64A;
  stroke-width: 2.2;
  opacity: 0.95;
  filter: drop-shadow(0 0 3px rgba(244, 182, 74, 0.6));
}
.connector.lost {
  stroke: var(--line-dim);
  opacity: 0.35;
}
.connector.live {
  stroke: #ef4444;
  stroke-width: 2.4;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.8));
  animation: dash 1.4s linear infinite;
  stroke-dasharray: 6 6;
}
.connector.scheduled {
  stroke: var(--line-mid);
  opacity: 0.55;
}
.connector:hover {
  stroke-width: 3;
  opacity: 1;
}

@keyframes dash {
  to { stroke-dashoffset: -12; }
}

/* --- Nodes --- */
.node {
  fill: var(--bg-2);
  stroke: var(--line-mid);
  stroke-width: 1;
  transition: all 400ms var(--easing);
}
.node.won {
  fill: #1c1a12;
  stroke: var(--gold-2);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 4px rgba(244, 182, 74, 0.5));
}
.node.live {
  fill: #2a1114;
  stroke: #ef4444;
  animation: node-pulse 1.6s ease-out infinite;
}
@keyframes node-pulse {
  0%, 100% { r: 4; }
  50% { r: 6; }
}

/* --- Teams --- */
.team {
  cursor: pointer;
}
.team-circle {
  fill: var(--bg-2);
  stroke: var(--line-mid);
  stroke-width: 1.5;
  transition: all 320ms var(--easing);
}
.team.winner .team-circle {
  stroke: var(--gold-2);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(244, 182, 74, 0.4));
}
.team.live .team-circle {
  stroke: #ef4444;
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6));
}
.team.eliminated .team-circle {
  opacity: 0.35;
  stroke: var(--line-dim);
}
.team.eliminated .team-flag,
.team.eliminated .team-name {
  opacity: 0.4;
  filter: grayscale(0.9);
}
.team-flag {
  font-size: 26px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
}
.team-name {
  fill: var(--text-mid);
  font-size: 9px;
  font-weight: 600;
  text-anchor: middle;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}
.team:hover .team-circle {
  stroke-width: 2.5;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

/* --- Score labels on connectors --- */
.score-label {
  pointer-events: none;
}
.score-bg {
  fill: rgba(15, 17, 22, 0.95);
  stroke: rgba(244, 182, 74, 0.5);
  stroke-width: 1;
}
.score-bg.live {
  stroke: #ef4444;
}
.score-text {
  fill: var(--text-hi);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 10px;
  text-anchor: middle;
  dominant-baseline: central;
  letter-spacing: 0.06em;
}

/* --- Radar sweep (rotating cone) --- */
#radar-sweep {
  transform-origin: 0 0;
  transform-box: view-box;
  animation: radar-spin 22s linear infinite;
  mix-blend-mode: screen;
  pointer-events: none;
}
@keyframes radar-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* --- Orbit rings --- */
.orbit-ring {
  fill: none;
  stroke: rgba(244, 182, 74, 0.12);
  stroke-width: 1;
  stroke-dasharray: 2 6;
  animation: orbit-breathe 8s ease-in-out infinite;
  transform-origin: 0 0;
  transform-box: view-box;
}
.orbit-ring.orbit-teams {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-dasharray: 1 3;
}
@keyframes orbit-breathe {
  0%, 100% { opacity: 0.8; }
  50%      { opacity: 0.35; }
}

/* --- Live halo : cœur pulsé rouge autour du match live --- */
.live-halo-pulse {
  transform-origin: center;
  transform-box: view-box;
  animation: live-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes live-pulse {
  0%   { opacity: 0.95; transform: scale(0.6); }
  70%  { opacity: 0.0;  transform: scale(1.9); }
  100% { opacity: 0;    transform: scale(1.9); }
}
.live-halo-ring {
  transform-origin: center;
  transform-box: view-box;
  animation: live-ring 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes live-ring {
  0%   { opacity: 0.9; transform: scale(0.4); }
  100% { opacity: 0;   transform: scale(2.5); }
}

/* --- Winner trails : chemin lumineux du parcours vainqueur --- */
.winner-trail {
  fill: none;
  stroke: url(#goldGrad);
  stroke: #FFD47A;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.85;
  filter: drop-shadow(0 0 6px rgba(244, 182, 74, 0.6));
  pointer-events: none;
}
.winner-trail.deep {
  stroke-width: 3;
  filter: drop-shadow(0 0 10px rgba(244, 182, 74, 0.8));
}

/* --- Zodiac ring & starfield --- */
#zodiac-ring { pointer-events: none; }
.zodiac-tick {
  stroke: rgba(244, 182, 74, 0.35);
  stroke-width: 1.2;
  stroke-linecap: round;
}
.zodiac-tick.major {
  stroke: rgba(244, 182, 74, 0.7);
  stroke-width: 1.6;
}
.zodiac-label {
  fill: rgba(244, 182, 74, 0.5);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-anchor: middle;
  dominant-baseline: central;
  text-transform: uppercase;
  font-weight: 600;
}
.zodiac-glyph {
  fill: rgba(244, 182, 74, 0.7);
  font-size: 13px;
  text-anchor: middle;
  dominant-baseline: central;
}

#starfield circle { fill: #ffffff; }

/* --- Trophy orbit --- */
.trophy-orbit {
  fill: none;
  stroke: rgba(244, 182, 74, 0.18);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

/* --- Center trophy --- */
.trophy-halo {
  animation: trophy-breathe 5s ease-in-out infinite;
  transform-origin: 0 0;
  transform-box: view-box;
}
@keyframes trophy-breathe {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.75; transform: scale(1.06); }
}
.trophy-ring {
  fill: none;
  stroke: url(#goldGrad);
  stroke-width: 1;
  opacity: 0.55;
  animation: trophy-rotate 40s linear infinite;
  transform-origin: 0 0;
  transform-box: view-box;
  stroke-dasharray: 4 6;
}
@keyframes trophy-rotate {
  to { transform: rotate(360deg); }
}
.trophy-icon {
  font-size: 42px;
  filter: drop-shadow(0 0 20px rgba(244, 182, 74, 0.7));
  animation: trophy-glow 3.5s ease-in-out infinite;
}
@keyframes trophy-glow {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(244, 182, 74, 0.55)); }
  50%      { filter: drop-shadow(0 0 34px rgba(244, 182, 74, 0.95)); }
}
.trophy-caption {
  fill: var(--gold-2);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.3em;
  opacity: 0.8;
}

/* --- Wheel caption --- */
.wheel-caption {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 18px;
  background: rgba(15, 17, 22, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-width: 260px;
  text-align: center;
}
.cap-line {
  font-size: 13px;
  color: var(--text-hi);
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.cap-line.small {
  font-size: 11px;
  color: var(--text-lo);
}
.cap-tag {
  font-size: 9px;
  color: var(--gold-2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(244, 182, 74, 0.1);
  border: 1px solid rgba(244, 182, 74, 0.25);
}
.cap-tag.alt {
  color: var(--text-lo);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

/* =====================================================
   Popup
   ===================================================== */

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 12, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 200ms var(--easing);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.popup-overlay[hidden] { display: none; }

.popup {
  position: relative;
  width: min(520px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(28, 32, 40, 0.92) 0%, rgba(16, 18, 24, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(244, 182, 74, 0.08);
  animation: pop-in 320ms var(--easing);
  scrollbar-width: thin;
}
@keyframes pop-in {
  from { transform: scale(0.94) translateY(6px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.popup-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-lo);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 180ms var(--easing);
}
.popup-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-hi);
}

.popup-inner .p-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-right: 32px;
}
.p-round {
  font-size: 11px;
  color: var(--gold-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}
.p-date {
  font-size: 11px;
  color: var(--text-lo);
  margin-top: 4px;
}
.p-venue {
  font-size: 11px;
  color: var(--text-lo);
  margin-top: 2px;
}

.p-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.p-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.p-team .p-team-flag {
  font-size: 44px;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.6));
}
.p-team .p-team-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.p-team.winner .p-team-name {
  color: var(--gold-2);
}
.p-score {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 38px;
  color: var(--text-hi);
  letter-spacing: 0.04em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.p-score .p-vs {
  font-size: 14px;
  color: var(--text-lo);
  letter-spacing: 0.24em;
}
.p-score-mini {
  font-size: 11px;
  color: var(--text-lo);
  margin-top: 4px;
  text-align: center;
}

.p-section {
  margin-top: 20px;
}
.p-section-title {
  font-size: 11px;
  color: var(--text-lo);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 12px;
}

.p-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.p-event {
  display: grid;
  grid-template-columns: 40px 20px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  font-size: 12px;
}
.p-event.team-a { border-left: 2px solid #3b82f6; }
.p-event.team-b { border-left: 2px solid #ef4444; }
.p-event-minute {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--text-mid);
  font-size: 12px;
}
.p-event-icon {
  text-align: center;
}
.p-event-desc {
  color: var(--text-mid);
}
.p-event-desc strong { color: var(--text-hi); font-weight: 600; }

.p-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.p-stat-row {
  display: grid;
  grid-template-columns: 1fr 90px 1fr;
  align-items: center;
  gap: 8px;
}
.p-stat-label {
  font-size: 11px;
  color: var(--text-lo);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}
.p-stat-val {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 13px;
}
.p-stat-val.left { text-align: right; }
.p-stat-bar {
  display: grid;
  grid-template-columns: var(--a, 50%) var(--b, 50%);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-2);
}
.p-stat-bar > span { display: block; height: 100%; }
.p-stat-bar > span:first-child { background: #3b82f6; }
.p-stat-bar > span:last-child { background: #ef4444; }

.p-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-lo);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}

/* =====================================================
   Mobile-only components (dock, sheet, glance, chips row)
   Hidden on desktop by default.
   ===================================================== */

/* Force hidden attribute to override display:flex/grid rules */
[hidden] { display: none !important; }

.mobile-chips, .mobile-dock, .mobile-glance { display: none; }

/* --- Mobile chips (horizontal scroll) --- */
.mobile-chips {
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(10, 12, 16, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.mobile-chips::-webkit-scrollbar { display: none; }
.mobile-chips .chip { scroll-snap-align: start; flex-shrink: 0; }

/* --- Mobile glance (floating live card) --- */
.mobile-glance {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  min-width: 260px;
  max-width: calc(100vw - 24px);
  background: linear-gradient(180deg, rgba(28, 32, 40, 0.95), rgba(16, 18, 24, 0.98));
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 24px rgba(239, 68, 68, 0.15);
  color: var(--text-hi);
  font-family: inherit;
  cursor: pointer;
  animation: glance-in 400ms var(--easing);
  text-align: left;
}
@keyframes glance-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.mobile-glance .gl-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-red 1.6s infinite;
  flex-shrink: 0;
}
.mobile-glance .gl-min {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: #fca5a5;
  letter-spacing: 0.06em;
}
.mobile-glance .gl-teams {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 13px;
}
.mobile-glance .gl-score {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--gold-2);
  padding: 0 4px;
}
.mobile-glance .gl-flag { font-size: 16px; }

/* --- Mobile dock (bottom tab bar) --- */
.mobile-dock {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 25;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)) 12px;
  background: rgba(8, 9, 11, 0.85);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  color: var(--text-lo);
  border-radius: 10px;
  transition: color 180ms var(--easing), background 180ms var(--easing);
  font-family: inherit;
}
.dock-btn:hover,
.dock-btn:focus-visible {
  color: var(--text-hi);
  background: rgba(255, 255, 255, 0.04);
}
.dock-btn:active { transform: scale(0.94); }
.dock-icon svg { display: block; }
.dock-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --- Bottom sheet --- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(6, 8, 12, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 220ms var(--easing);
}
.sheet-overlay[hidden] { display: none; }
.sheet {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  background: linear-gradient(180deg, rgba(28, 32, 40, 0.96), rgba(16, 18, 24, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px 24px 0 0;
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom)) 20px;
  animation: sheet-in 380ms cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
}
@keyframes sheet-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sheet-handle {
  width: 44px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 6px auto 8px;
  flex-shrink: 0;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.sheet-head h2 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.sheet-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--text-lo);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 180ms var(--easing);
}
.sheet-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-hi); }
.sheet-body {
  overflow-y: auto;
  padding-top: 14px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.sheet-body .panel {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0 0 18px;
  backdrop-filter: none;
}
.sheet-body .panel:last-child { margin-bottom: 0; }
.sheet-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sheet-filter .chip {
  padding: 14px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.sheet-filter .chip.active {
  color: var(--gold-2);
  background: rgba(244, 182, 74, 0.08);
  border-color: rgba(244, 182, 74, 0.35);
}

/* =====================================================
   Responsive breakpoints
   ===================================================== */

/* --- Tablet: shrink columns --- */
@media (max-width: 1180px) {
  .stage { grid-template-columns: 260px 1fr 260px; gap: 14px; padding: 14px; }
  .panel { padding: 14px; }
  .brand-sub { display: none; }
}
@media (max-width: 1024px) {
  .stage { grid-template-columns: 240px 1fr 240px; gap: 12px; padding: 12px; }
}

/* --- Portrait tablet / large mobile: single column, dock+sheet mode --- */
@media (max-width: 900px) {
  .app { grid-template-rows: 56px auto 1fr; }
  .topbar { padding: 0 14px; grid-template-columns: 1fr auto; }
  .topnav { display: none; }
  .brand-title { font-size: 12px; }
  .status .status-text { display: none; }
  .status { padding: 6px 10px; }
  .source-tag { display: none; }
  .mobile-chips { display: flex; }
  .mobile-glance:not([hidden]) { display: flex; }
  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    padding: 8px;
    gap: 0;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
  .side { display: none; }
  .mobile-dock { display: grid; }
  .wheel-container { min-height: 0; height: 100%; }
  .wheel-caption {
    bottom: 8px;
    min-width: 220px;
    padding: 8px 14px;
  }
  .cap-line { font-size: 12px; }
  .cap-line.small { font-size: 10px; }
  .team-name { display: none; }
  .trophy-caption { font-size: 8px; }
}

/* --- Phone --- */
@media (max-width: 600px) {
  .brand-mark { width: 30px; height: 30px; }
  .brand-title { font-size: 11px; letter-spacing: 0.1em; }
  .mobile-chips { padding: 6px 10px; }
  .mobile-chips .chip { padding: 5px 12px; font-size: 11px; }
  .wheel-scale { max-height: none; }
  .wheel-caption {
    left: 8px;
    right: 8px;
    transform: none;
    min-width: 0;
  }
  .popup {
    padding: 22px 20px;
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: none;
    max-height: 88vh;
    align-self: flex-end;
  }
  .popup-overlay { align-items: flex-end; }
  .p-scoreboard { padding: 16px 0; gap: 12px; }
  .p-team .p-team-flag { font-size: 36px; }
  .p-score { font-size: 30px; }
}

/* --- Very small phone --- */
@media (max-width: 380px) {
  .brand-text { display: none; }
  .wheel-caption { padding: 6px 10px; }
  .cap-line { gap: 6px; font-size: 11px; }
  .cap-tag { font-size: 8px; }
  .dock-label { font-size: 9px; }
}

/* --- Landscape phone: hide caption, keep wheel maximal --- */
@media (max-height: 480px) and (orientation: landscape) {
  .app { grid-template-rows: 48px 1fr; }
  .mobile-chips { display: none; }
  .wheel-caption { display: none; }
  .mobile-dock {
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom)) 8px;
  }
  .dock-btn { padding: 3px 2px; }
  .dock-icon svg { width: 18px; height: 18px; }
  .dock-label { font-size: 8px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .connector.live { animation: none; stroke-dasharray: none; }
  .node.live { animation: none; }
  .trophy-ring { animation: none; }
  .status .dot,
  .mobile-glance .gl-pulse { animation: none; }
  .sheet, .mobile-glance, .popup { animation: none; }
}
