/* -----------------------------------------------
   Design tokens — Apple-inspired light palette
   ----------------------------------------------- */
:root {
  --bg:          #e9eaec;
  --surface:     #f7f7f8;
  --surface-2:   #ececee;
  --border:      rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.16);

  --text-primary:   #2c2c2e;
  --text-secondary: #6e6e73;
  --text-tertiary:  #8e8e93;

  --accent:      #0060c2;
  --accent-soft: rgba(0,96,194,0.10);
  --green:       #28a745;
  --green-soft:  rgba(40,167,69,0.12);
  --red:         #e0342a;
  --red-soft:    rgba(224,52,42,0.10);
  --orange:      #e08e0a;

  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
}

/* -----------------------------------------------
   Reset & base
   ----------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* -----------------------------------------------
   Header
   ----------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0 clamp(1rem, 4vw, 3rem);
  height: 60px;
  background: rgba(247,247,248,0.88);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

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

.brand-icon { display: block; }

.brand-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Tab navigation */
.league-tabs {
  display: flex;
  gap: 2px;
  background: rgba(0,0,0,0.06);
  border-radius: 10px;
  padding: 3px;
}

.tab {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: 7px;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
  line-height: 1.4;
}

.tab:hover:not(.active) {
  background: rgba(255,255,255,0.5);
  color: var(--text-primary);
}

.tab.active {
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* -----------------------------------------------
   Next match bar
   ----------------------------------------------- */
.next-match-bar {
  margin: 0;
  padding: 10px clamp(1rem, 4vw, 3rem);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.next-match-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  max-width: 1100px;
  margin: 0 auto;
}

.next-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

#ticker-text {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
}

/* -----------------------------------------------
   Live matches section
   ----------------------------------------------- */
.live-section {
  background: linear-gradient(180deg, rgba(255,59,48,0.06), rgba(255,59,48,0) 60%);
  border-bottom: 1px solid var(--border);
}

.live-section-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 1.75rem;
}

.live-section .col-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  display: inline-block;
  animation: live-pulse 1.8s ease-in-out infinite;
}

.live-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.live-list .match-card {
  border-color: rgba(255,59,48,0.35);
  box-shadow: 0 0 0 1px rgba(255,59,48,0.06), var(--shadow-sm);
}

.live-list .match-card:hover {
  border-color: rgba(255,59,48,0.5);
  box-shadow: 0 0 0 1px rgba(255,59,48,0.1), var(--shadow-md);
}

/* -----------------------------------------------
   Main / columns layout
   ----------------------------------------------- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 3rem) 4rem;
}

.columns {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.col-divider {
  background: var(--border);
  height: 100%;
  min-height: 200px;
  align-self: stretch;
}

.col-header {
  margin-bottom: 1.25rem;
}

.col-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}

.col-sub {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

/* -----------------------------------------------
   Match list & cards
   ----------------------------------------------- */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Day group separator for upcoming */
.day-heading {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 1.25rem 0 4px;
}

.day-heading:first-child { margin-top: 0; }

/* Card */
.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
}

.match-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

/* Card top row: league badge + block name + status */
.match-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.match-meta-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.league-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
}

.block-name {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

/* Status pill */
.match-status {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
}

.match-status.live {
  background: rgba(255,59,48,0.12);
  color: var(--red);
  animation: live-pulse 1.8s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

.match-status.upcoming {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.match-status.completed {
  background: transparent;
  color: var(--text-tertiary);
}

/* Teams row */
.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.team {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team:last-child {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.team img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--surface-2);
  flex-shrink: 0;
}

.team-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.team.win .team-name {
  color: var(--text-primary);
  font-weight: 600;
}

.team.loss .team-name {
  color: var(--text-tertiary);
  font-weight: 400;
}

.team.loss img {
  opacity: 0.4;
}

/* Score */
.score-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  min-width: 48px;
}

.score-a { color: var(--text-primary); }
.score-b { color: var(--text-primary); }

.score-sep {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-tertiary);
}

/* VS divider for upcoming */
.vs-divider {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-align: center;
  min-width: 28px;
}

/* -----------------------------------------------
   State messages
   ----------------------------------------------- */
.state-msg {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  text-align: center;
  padding: 2rem 0;
  margin: 0;
}

/* -----------------------------------------------
   Footer
   ----------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  text-align: center;
}

.site-footer p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  max-width: 60ch;
  margin: 0 auto;
  line-height: 1.6;
}

/* -----------------------------------------------
   Responsive
   ----------------------------------------------- */
@media (max-width: 700px) {
  .site-header {
    flex-wrap: wrap;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 10px;
  }

  .columns {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .col-divider { display: none; }

  .live-list {
    grid-template-columns: 1fr;
  }

  .match-teams {
    grid-template-columns: 1fr auto 1fr;
  }
}
