:root {
  --bg-main: #06080d;
  --bg-surface: #0c1017;
  --bg-card: #111622;
  --bg-card-hover: #171e2e;
  --border: #1a2233;
  --border-focus: #2563eb;
  --blue-primary: #1d4ed8;
  --blue-accent: #3b82f6;
  --red-live: #e11d48;
  --green-win: #10b981;
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-muted: #475569;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-score: 'Barlow Condensed', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Topbar OTT */
.topbar {
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.puck-bullet {
  width: 10px;
  height: 10px;
  background: var(--blue-accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--blue-accent);
}

.brand-title {
  font-family: var(--font-score);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
}

.main-nav {
  display: flex;
  gap: 0.25rem;
  margin-left: 0.75rem;
}

.nav-tab {
  background: transparent;
  border: none;
  font-family: var(--font-score);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover { color: #fff; }
.nav-tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

/* Boutons Topbar */
.pill-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-score);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.pill-btn:hover, .pill-btn.active {
  background: rgba(37, 99, 235, 0.15);
  border-color: var(--blue-accent);
  color: #fff;
}

.admin-pill {
  font-family: var(--font-score);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.admin-pill:hover { color: #fff; border-color: var(--text-dim); }

/* Layout Global */
.ott-layout {
  flex: 1;
  max-width: 1450px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1rem;
}

@media (max-width: 950px) {
  .ott-layout {
    grid-template-columns: 1fr;
    padding: 0.5rem;
  }
}

.ott-layout.standings-active {
  grid-template-columns: 1fr;
}
.ott-layout.standings-active .ott-stage {
  display: none;
}

/* Zone Vidéo */
.ott-stage {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ott-stage.multiplex-active {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 800px) {
  .ott-stage.multiplex-active {
    grid-template-columns: 1fr;
  }
}

.screen-frame {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
}

.video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.screen-meta {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  background: #090d14;
}

.meta-headline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
}

.live-pill {
  font-family: var(--font-score);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--red-live);
  color: #fff;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
}

.match-heading {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

.meta-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.quality-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-score);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.45rem;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.icon-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.35rem;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-chip:hover { color: #fff; border-color: var(--blue-accent); }

/* Timeline faits marquants */
.timeline-strip {
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.timeline-label {
  font-family: var(--font-score);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.timeline-feed {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.timeline-row {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid var(--blue-accent);
  color: var(--text-dim);
}

/* Sidebar & Cartes Matchs */
.sidebar-pane {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.league-switch {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem;
  gap: 0.2rem;
}

.league-btn, .league-std-btn {
  flex: 1;
  background: transparent;
  border: none;
  font-family: var(--font-score);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.4rem 0.2rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.league-btn:hover, .league-std-btn:hover { color: #fff; }
.league-btn.active, .league-std-btn.active {
  background: var(--blue-primary);
  color: #fff;
}

.cards-stream {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Carte de match broadcast */
.ott-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ott-card:hover {
  background: var(--bg-card-hover);
  border-color: #2a3750;
}

.ott-card.selected-s1 {
  border-color: var(--blue-accent);
  background: rgba(37, 99, 235, 0.08);
}

.ott-card.selected-s2 {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.card-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.league-tag {
  font-family: var(--font-score);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.match-clock-badge {
  font-family: var(--font-score);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
}

.clock-live {
  background: rgba(225, 29, 72, 0.2);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: #fb7185;
}

.clock-upcoming {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.card-scoreboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.teams-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.team-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.team-badge {
  width: 20px;
  height: 20px;
  background: #1e283d;
  color: #93c5fd;
  border-radius: 3px;
  font-family: var(--font-score);
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.score-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-family: var(--font-score);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  text-align: right;
  min-width: 24px;
}

.periods-breakdown {
  font-family: var(--font-score);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.35rem;
}

/* Animation But Flash */
@keyframes goalHit {
  0% { background-color: var(--bg-card); }
  35% { background-color: rgba(16, 185, 129, 0.25); border-color: #10b981; }
  100% { background-color: var(--bg-card); }
}

.goal-highlight {
  animation: goalHit 2.5s ease-out;
}

/* Standings */
.standings-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow-x: auto;
}

.ffhg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.ffhg-table th, .ffhg-table td {
  padding: 0.65rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.ffhg-table th {
  font-family: var(--font-score);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: #090d14;
}

.ffhg-table td:nth-child(2) {
  text-align: left;
  font-weight: 700;
  color: #fff;
}

.ffhg-table td.pts-field {
  font-family: var(--font-score);
  font-size: 0.95rem;
  font-weight: 800;
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.08);
}

.form-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.dot-w, .dot-l {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot-w { background-color: var(--green-win); }
.dot-l { background-color: var(--red-live); }

/* Indicateur d'écran ciblé en Multiplex */
.screen-frame.target-active {
  border-color: var(--blue-accent);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.35);
}

#player-card-2.target-active {
  border-color: #f59e0b;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
}

/* Fix affichage et ratio Multiplex */
.ott-stage.multiplex-active .screen-frame {
  display: flex !important;
  flex-direction: column;
  height: fit-content;
}

.ott-stage .screen-frame {
  height: fit-content;
}

.video-wrapper {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 56.25%; /* Ratio 16:9 forcé */
  background: #000;
  overflow: hidden;
}

.video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Élargissement du conteneur en Multiplex pour ne pas tasser l'image */
.ott-layout.multiplex-open {
  grid-template-columns: 1fr 320px;
  max-width: 1600px;
}
