/* ── DESIGN TOKENS ──────────────────────────────────────────────────── */
:root {
  --bg:           #071428;
  --panel:        #0f2a44;
  --accent:       #D4AF37;
  --accent-2:     #7DE3E3;
  --text:         #F5F7FA;
  --muted:        #B9C3CF;
  --glass:        rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --radius-sm:    12px;
  --radius-lg:    24px;
}

/* ── RESET ──────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden; /* prevent horizontal scroll on all live subdomain pages */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── CONTAINER ──────────────────────────────────────────────────────── */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── HEADER ─────────────────────────────────────────────────────────── */
.live-header {
  background: var(--panel);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.875rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.live-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.live-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
}

.live-logo img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.back-link {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s;
}

.back-link:hover { color: var(--accent); }

/* ── MATCH HERO ─────────────────────────────────────────────────────── */
.match-hero {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  margin: 1.5rem 0;
  border: 1px solid var(--glass-border);
  text-align: center;
}

.teams-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.team-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  max-width: 140px;
}

.team-block img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--glass);
  padding: 4px;
}

.team-block .team-logo-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.team-name-text {
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.3;
}

.vs-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.match-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.match-meta-row span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.league-tag {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

/* ── LIVE BADGE ─────────────────────────────────────────────────────── */
.live-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #f87171;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: #f87171;
  border-radius: 50%;
  animation: live-pulse 1.3s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

/* ── STREAM LINKS SECTION ───────────────────────────────────────────── */
.stream-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
  text-align: center;
}

.stream-links-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stream-link-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  width: 100%;
}

.stream-link-btn:hover {
  border-color: var(--accent);
  background: rgba(212, 175, 55, 0.08);
  transform: translateY(-1px);
}

.stream-link-btn:active { transform: translateY(0); }

.stream-play-icon {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #071428;
  font-size: 1rem;
}

.stream-link-info {
  flex: 1;
}

.stream-link-label {
  font-weight: 700;
  font-size: 0.95rem;
  display: block;
}

.stream-link-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.stream-quality-badge {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.stream-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

/* ── COMMUNITY BTNS ─────────────────────────────────────────────────── */
.community-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.community-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
}

.community-btn:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-whatsapp { background: #25D366; color: #fff; }
.btn-telegram { background: #0088cc; color: #fff; }

/* ── DISCLAIMER ─────────────────────────────────────────────────────── */
.live-disclaimer {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 1rem 0;
}

.live-disclaimer strong { color: var(--text); }

/* ── FOOTER ─────────────────────────────────────────────────────────── */
.live-footer {
  border-top: 1px solid var(--glass-border);
  padding: 1.5rem 0;
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.live-footer a { color: var(--accent); }
.live-footer a:hover { text-decoration: underline; }

.footer-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

/* ── COOKIE NOTICE ──────────────────────────────────────────────────── */
.cookie-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  border-top: 1px solid var(--glass-border);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  z-index: 999;
}

.cookie-bar button {
  background: var(--accent);
  color: #071428;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 1rem;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .teams-row { gap: 0.75rem; }
  .team-block img { width: 56px; height: 56px; }
  .team-block .team-logo-placeholder { width: 56px; height: 56px; font-size: 1.5rem; }
  .vs-text { font-size: 1.1rem; }
  .stream-play-icon { width: 36px; height: 36px; font-size: 0.875rem; }
}

/* ── INFO GRID (match details) ──────────────────────────────────────── */
@media (max-width: 400px) {
  .live-info-grid { grid-template-columns: 1fr !important; }
}

/* ── MATCH DATA WIDGET ───────────────────────────────────────────────── */
.md-panel {
  background: var(--panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.md-tabs {
  display: flex;
  border-bottom: 1px solid var(--glass-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.md-tabs::-webkit-scrollbar { display: none; }

.md-tab {
  flex: 1;
  min-width: 70px;
  padding: 0.65rem 0.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
.md-tab:hover { color: var(--text); }
.md-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.md-pane { padding: 1rem; }

/* Stats rows */
.stat-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr 2.5rem;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.stat-row:last-child { margin-bottom: 0; }
.stat-val-home { font-size: 0.82rem; font-weight: 700; text-align: left; color: var(--text); }
.stat-val-away { font-size: 0.82rem; font-weight: 700; text-align: right; color: var(--text); }
.stat-bar-wrap { position: relative; height: 5px; background: var(--glass); border-radius: 4px; overflow: hidden; }
.stat-bar-home-fill { position: absolute; left: 0; top: 0; height: 100%; background: #3b82f6; border-radius: 4px; }
.stat-bar-away-fill { position: absolute; right: 0; top: 0; height: 100%; background: #f87171; border-radius: 4px; }
.stat-label-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr 2.5rem;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.stat-label-center { text-align: center; font-size: 0.7rem; color: var(--muted); }

/* Team legend for stats */
.stat-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--glass-border);
}
.stat-legend-home { color: #3b82f6; }
.stat-legend-away { color: #f87171; }

/* Timeline */
.md-timeline {
  background: var(--panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.tl-header { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.75rem; }
.tl-track { position: relative; height: 80px; }
.tl-line { position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--glass-border); transform: translateY(-50%); }
.tl-ht { position: absolute; top: 10%; bottom: 10%; width: 1px; background: rgba(212,175,55,0.4); }
.tl-event { position: absolute; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.tl-event.home { top: 0; flex-direction: column-reverse; }
.tl-event.away { bottom: 0; }
.tl-icon { font-size: 0.75rem; line-height: 1; }
.tl-min { font-size: 0.58rem; color: var(--muted); margin-top: 1px; }
.tl-minute-labels { display: flex; justify-content: space-between; font-size: 0.6rem; color: var(--muted); margin-top: 0.3rem; }

/* Lineups */
.lineup-toggle { display: flex; gap: 0.5rem; margin-bottom: 0.85rem; }
.lu-btn {
  flex: 1;
  padding: 0.4rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.lu-btn.active { background: rgba(212,175,55,0.15); border-color: var(--accent); color: var(--accent); }

.lineup-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.lineup-col-head { font-size: 0.72rem; font-weight: 700; color: var(--accent); text-transform: uppercase; margin-bottom: 0.5rem; text-align: center; }
.lu-player { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.78rem; }
.lu-player:last-child { border-bottom: none; }
.lu-num { width: 20px; height: 20px; background: var(--glass); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; flex-shrink: 0; }
.lu-name { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lu-pos { font-size: 0.62rem; color: var(--muted); flex-shrink: 0; }
.lu-sub-head { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 0.6rem 0 0.3rem; font-weight: 600; }

/* Pitch view */
.pitch-view { display: none; }
.pitch-wrap { position: relative; background: #1a5c2a; border-radius: 8px; overflow: hidden; margin-bottom: 0.75rem; }
.pitch-lines { position: absolute; inset: 0; pointer-events: none; }
.pitch-rows { display: flex; flex-direction: column; padding: 0.5rem 0.25rem; gap: 0; min-height: 280px; }
.pitch-row { display: flex; justify-content: space-around; align-items: center; flex: 1; }
.pitch-player-dot { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: default; }
.pitch-dot { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2px solid rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center; font-size: 0.6rem; font-weight: 700; color: #071428; }
.pitch-dot.away { background: #f87171; color: #fff; }
.pitch-pname { font-size: 0.55rem; color: #fff; text-align: center; max-width: 42px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,0.8); }

/* Commentary */
.cmty-toggle { display: flex; gap: 0.5rem; margin-bottom: 0.85rem; }
.cmty-btn {
  padding: 0.3rem 0.9rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.cmty-btn.active { background: rgba(212,175,55,0.15); border-color: var(--accent); color: var(--accent); }

.cmty-list { max-height: 360px; overflow-y: auto; scrollbar-width: thin; }
.cmty-event { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.8rem; }
.cmty-event:last-child { border-bottom: none; }
.cmty-min { min-width: 30px; font-size: 0.7rem; font-weight: 700; color: var(--accent); flex-shrink: 0; text-align: right; }
.cmty-icon { flex-shrink: 0; width: 18px; text-align: center; }
.cmty-detail { color: var(--text); line-height: 1.4; }
.cmty-sub-detail { font-size: 0.7rem; color: var(--muted); margin-top: 1px; }

/* Formation pitch */
.formation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.formation-pitch { background: #1a5c2a; border-radius: 8px; padding: 0.5rem 0.25rem; }
.formation-head { font-size: 0.72rem; font-weight: 700; color: var(--accent); text-align: center; margin-bottom: 0.4rem; }

@media (max-width: 420px) {
  .lineup-cols { grid-template-columns: 1fr; }
  .formation-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 2rem 1fr 2rem; }
}

/* ── DETAIL PAGE: score hero / tab bar on very small screens ─────────── */
@media (max-width: 380px) {
  /* Reduce team block max-width and logo so the 3-column row fits 320px */
  .team-block {
    max-width: 100px;
  }
  .team-block img,
  .team-block .team-logo-placeholder {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }
  .team-name-text {
    font-size: 0.78rem;
  }
  .vs-text {
    font-size: 1rem;
  }

  /* Match hero padding */
  .match-hero {
    padding: 1.25rem 0.875rem;
  }

  /* Stream link button: stack icon and text on tiny screens */
  .stream-link-btn {
    padding: 0.875rem 1rem;
    gap: 0.75rem;
  }
}

/* ── DETAIL PAGE: tab bar (score + stream tabs) ──────────────────────── */
/* The tab bar is defined inline in detail.html; these rules ensure it */
/* scrolls horizontally without a scrollbar on very narrow viewports.  */
@media (max-width: 480px) {
  /* Hides horizontal scrollbar on tab bars using the live.css .md-tabs class */
  .md-tabs {
    gap: 0;
  }
  .md-tab {
    min-width: 60px;
    padding: 0.6rem 0.35rem;
    font-size: 0.72rem;
  }
}

/* ── COMMUNITY ROW: wrap on mobile ───────────────────────────────────── */
@media (max-width: 400px) {
  .community-row {
    flex-direction: column;
    align-items: stretch;
  }
  .community-btn {
    justify-content: center;
    text-align: center;
  }
}

/* ── LIVE INDEX: container side padding on tiny screens ─────────────── */
@media (max-width: 360px) {
  .container {
    padding: 0 0.75rem;
  }
}

/* ── COOKIE BAR: full-width button on mobile ─────────────────────────── */
@media (max-width: 480px) {
  .cookie-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .cookie-bar button {
    width: 100%;
    text-align: center;
  }
}
