:root {
  --bg: #f1f4f9;
  --card: #ffffff;
  --card-hover: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --navy-1: #111c35;
  --navy-2: #1d2f56;
  --primary: #1d72b8;
  --primary-soft: #e0f2fe;
  --live: #dc2626;
  --live-soft: #fee2e2;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

body.dark {
  --bg: #0b1120;
  --card: #131c2e;
  --card-hover: #1a263d;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #1e293b;
  --navy-1: #091022;
  --navy-2: #172544;
  --primary: #38bdf8;
  --primary-soft: rgba(56, 189, 248, 0.14);
  --live: #f87171;
  --live-soft: rgba(239, 68, 68, 0.18);
  --green: #4ade80;
  --green-soft: rgba(34, 197, 94, 0.16);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  padding-bottom: 48px;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 10px 32px;
}

/* Top Telemetry & Speed Bar */
.speed-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--navy-1), var(--navy-2));
  color: #fff;
  padding: 9px 13px;
  border-radius: 13px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  gap: 8px;
}

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

.live-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulseGreen 1.8s infinite;
  flex-shrink: 0;
}

.live-pulse-dot.offline {
  background: #f59e0b;
  animation: none;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.brand-title {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.3px;
}

.speed-pill {
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.13);
  padding: 3px 8px;
  border-radius: 999px;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.icon-chip {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.icon-chip:hover {
  background: rgba(255, 255, 255, 0.22);
}

.icon-chip.active {
  background: #16a34a;
  border-color: #22c55e;
}

/* Primary 5 Tabs */
.primary-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.tab-pill {
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.tab-pill.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.count-bubble {
  background: var(--live);
  color: #fff;
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 999px;
}

/* Date Strip + Sport Switch */
.date-sport-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 9px;
}

.nav-arrow {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 30px;
  height: 38px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.date-strip {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.date-strip::-webkit-scrollbar { display: none; }

.date-pill {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 10px;
  min-width: 60px;
  text-align: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 11.5px;
  line-height: 1.25;
}

.date-pill strong {
  display: block;
  font-size: 12px;
}

.date-pill.active {
  background: var(--navy-1);
  color: #fff;
  border-color: var(--navy-1);
}

body.dark .date-pill.active {
  background: var(--primary);
  color: #0b1120;
  border-color: var(--primary);
}

.calendar-btn {
  position: relative;
  width: 36px;
  height: 38px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 16px;
}

.calendar-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.sport-switch {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.sport-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card);
  font-size: 17px;
  cursor: pointer;
  transition: all 0.15s;
}

.sport-btn.active {
  border-color: var(--navy-1);
  box-shadow: 0 0 0 2px var(--primary-soft);
  transform: scale(1.04);
}

body.dark .sport-btn.active {
  border-color: var(--primary);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 11px;
}

.filter-chip {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-chip.active {
  background: var(--live-soft);
  color: var(--live);
  border-color: var(--live);
}

.red-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 11px;
  min-width: 110px;
}

.search-icon {
  font-size: 13px;
  margin-right: 6px;
  opacity: 0.65;
}

.search-box input {
  border: none;
  background: transparent;
  color: var(--text);
  width: 100%;
  padding: 7px 0;
  font-size: 13px;
  outline: none;
}

/* League Group Card */
.league-card {
  background: var(--card);
  border-radius: 13px;
  overflow: hidden;
  margin-bottom: 11px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.league-header {
  background: linear-gradient(90deg, var(--navy-1), var(--navy-2));
  color: #fff;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 700;
}

.league-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.league-flag {
  font-size: 16px;
}

.league-live-pill {
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 800;
}

.bell-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.72;
  transition: transform 0.15s, opacity 0.15s;
  color: inherit;
  padding: 3px 5px;
}

.bell-btn:hover {
  opacity: 1;
  transform: scale(1.12);
}

.bell-btn.saved {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.7));
}

/* Match Row */
.match-row {
  display: grid;
  grid-template-columns: 58px 1fr 34px;
  align-items: center;
  padding: 10px 10px 10px 12px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.14s;
}

.match-row:first-of-type {
  border-top: none;
}

.match-row:hover {
  background: var(--card-hover);
}

.match-row.is-live {
  border-left: 3.5px solid var(--live);
  padding-left: 8.5px;
}

.match-row.goal-flash {
  animation: goalHighlight 4.5s ease-out;
}

.match-row.recent-goal-row {
  background: var(--green-soft);
  border-left: 4px solid #16a34a;
  padding-left: 8px;
}

@keyframes goalHighlight {
  0%, 30% { background: rgba(34, 197, 94, 0.34); }
  100% { background: var(--green-soft); }
}

.recent-goal-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #15803d, #16a34a);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.38);
  animation: goalBadgePulse 1.4s ease-in-out infinite alternate;
}

@keyframes goalBadgePulse {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

.timeline-row.woodwork {
  background: rgba(245, 158, 11, 0.08);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 8px;
  min-width: 44px;
  background: var(--bg);
  color: var(--text-muted);
}

.status-badge.live {
  background: var(--live-soft);
  color: var(--live);
  font-weight: 800;
}

.status-badge.upcoming {
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
}

.match-center {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.teams-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.team-side {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
}

.team-side.home {
  justify-content: flex-end;
  text-align: right;
}

.team-side.away {
  justify-content: flex-start;
  text-align: left;
}

.team-side.winner {
  font-weight: 800;
}

.team-name-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-mini-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.red-card-icon {
  display: inline-block;
  width: 8px;
  height: 11px;
  background: #dc2626;
  border-radius: 2px;
  flex-shrink: 0;
}

.score-box {
  font-weight: 800;
  font-size: 15px;
  min-width: 50px;
  text-align: center;
  letter-spacing: 0.4px;
}

.score-box.live {
  color: var(--live);
}

.inline-micro-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 5px 7px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.micro-pill {
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 600;
}

.night-note {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
}

/* Goal Alert Toast */
.goal-toast-container {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.goal-toast {
  background: linear-gradient(135deg, #14532d, #16a34a);
  color: #fff;
  padding: 11px 15px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
  animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Detail Sheet Modal */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  z-index: 1500;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

@media (min-width: 680px) {
  .detail-overlay {
    align-items: center;
    padding: 20px;
  }
}

.detail-sheet {
  background: var(--card);
  width: 100%;
  max-width: 700px;
  height: 92vh;
  max-height: 840px;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

@media (min-width: 680px) {
  .detail-sheet {
    border-radius: 18px;
  }
}

.detail-hero {
  background: radial-gradient(circle at 50% 0%, #1e3a5f 0%, #0f172a 75%);
  color: #fff;
  padding: 16px 16px 14px;
  text-align: center;
}

.hero-league {
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 10px;
  font-weight: 600;
}

.hero-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.hero-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.hero-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  padding: 6px;
}

.hero-team-name {
  font-size: 14px;
  font-weight: 700;
}

.hero-score-num {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 2px;
}

.hero-status-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.15);
}

.hero-status-pill.live {
  background: #dc2626;
}

.hero-meta {
  margin-top: 8px;
  font-size: 11px;
  color: #94a3b8;
}

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.dtab {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 11px 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.dtab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--card);
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 72px;
}

.floating-close-btn {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(29, 114, 184, 0.45);
}

/* Timeline Events */
.timeline-divider {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--bg);
  padding: 5px 10px;
  border-radius: 8px;
  margin: 10px 0;
  letter-spacing: 0.6px;
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.timeline-row.away {
  flex-direction: row-reverse;
  text-align: right;
}

.tl-min {
  font-weight: 800;
  color: var(--primary);
  min-width: 34px;
  font-size: 12px;
}

.tl-icon {
  font-size: 16px;
}

.tl-text strong {
  display: block;
}

.tl-text small {
  color: var(--text-muted);
  font-size: 11.5px;
}

/* Dual Stat Bars */
.stat-item {
  margin-bottom: 13px;
}

.stat-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 5px;
}

.stat-label {
  color: var(--text-muted);
  font-weight: 600;
}

.stat-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  height: 8px;
}

.stat-half {
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.stat-half.left {
  justify-content: flex-end;
}

.stat-fill-home {
  background: #2563eb;
  height: 100%;
  border-radius: 999px;
}

.stat-fill-away {
  background: #f59e0b;
  height: 100%;
  border-radius: 999px;
}

/* Football Visual Pitch */
.lineup-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.pitch-field {
  background: repeating-linear-gradient(
    180deg,
    #1e7e34 0px,
    #1e7e34 38px,
    #218838 38px,
    #218838 76px
  );
  border: 2.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  padding: 12px 8px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.pitch-midline {
  border-top: 2px dashed rgba(255, 255, 255, 0.55);
  margin: 10px -8px;
  position: relative;
}

.pitch-team-banner {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.32);
  padding: 4px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.pitch-row {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 9px 0;
  gap: 4px;
}

.pitch-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 72px;
  text-align: center;
}

.shirt-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1d4ed8;
  border: 2px solid #fff;
  font-size: 11.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.shirt-circle.away {
  background: #dc2626;
}

.player-pitch-name {
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.48);
  padding: 1px 5px;
  border-radius: 5px;
  margin-top: 3px;
  white-space: nowrap;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* AI Coupon, Analysis & Odds Panels */
.panel-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.panel-box h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.coupon-controls {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

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

.choice-chip {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.choice-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.primary-cta {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 11px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.odds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.odd-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}

.odd-cell:hover, .odd-cell.saved {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.odd-lbl {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.odd-val {
  font-size: 14px;
  font-weight: 800;
}

/* Standings Table */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.standings-table th,
.standings-table td {
  padding: 7px 5px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.standings-table th:nth-child(2),
.standings-table td:nth-child(2) {
  text-align: left;
}

.standings-table tr.highlight-team {
  background: var(--primary-soft);
  font-weight: 700;
}

/* League Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.league-modal {
  background: var(--card);
  width: 100%;
  max-width: 460px;
  max-height: 80vh;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.league-modal-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.league-modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.text-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.close-x {
  background: none;
  border: none;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}

.league-checklist {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
}

.league-check-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
}

.league-modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
  background: var(--card);
  border-radius: 13px;
  border: 1px dashed var(--border);
}

/* Skeleton */
.skeleton-loader {
  background: var(--card);
  border-radius: 13px;
  padding: 12px;
}
.skeleton-bar {
  height: 34px;
  background: var(--border);
  border-radius: 9px;
  margin-bottom: 10px;
}
.skeleton-row {
  height: 44px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
}

@media (max-width: 480px) {
  .tab-pill { font-size: 11.5px; padding: 7px 2px; }
  .team-side { font-size: 13px; }
  .match-row { grid-template-columns: 50px 1fr 30px; padding: 9px 8px; }
}
