/* ─────────────────────────────────────────────────────────────────────────────
   2026 World Cup Fantasy — UI
   Theme: light, clean, sports-data dashboard (trueline-family)
   Fonts: Bebas Neue (scores/ranks) + DM Mono (labels) + Inter (body)
───────────────────────────────────────────────────────────────────────────── */

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:      #edf1f8;
  --bg-card:      #ffffff;
  --bg-card-alt:  #f3f5fb;

  /* Borders */
  --border:       #d4daee;
  --border-mid:   #b8c4df;

  /* Accents */
  --red:          #d93025;
  --red-dim:      #fde8e8;
  --red-border:   #d93025;

  --blue:         #2563eb;
  --blue-dim:     #eff4ff;
  --blue-border:  #2563eb;

  --green:        #1a8a40;
  --green-dim:    #edfaf3;
  --green-border: #1a8a40;

  --yellow:       #b86e00;
  --yellow-dim:   #fff8e1;
  --yellow-border:#b86e00;

  /* Text hierarchy */
  --text-1:       #1a1e35;   /* primary */
  --text-2:       #4a5680;   /* secondary */
  --text-3:       #8090b8;   /* muted */

  /* Typography */
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-mono:    'DM Mono', 'Menlo', monospace;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* Radii */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;

  /* Shadows */
  --shadow-card:  0 1px 4px rgba(80,100,160,.08), 0 1px 2px rgba(80,100,160,.04);
  --shadow-lift:  0 4px 16px rgba(80,100,160,.14), 0 2px 6px rgba(80,100,160,.08);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-1);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--red); }

/* ── Site header ──────────────────────────────────────────────────────────── */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(80,100,160,.08);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0.75rem 1rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.site-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.06em;
  color: var(--text-1);
  line-height: 1;
  white-space: nowrap;
}

.round-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  background: var(--blue-dim);
  border: 1px solid var(--blue-border);
  padding: 0.2em 0.7em;
  border-radius: 999px;
  white-space: nowrap;
}

.round-badge.is-live {
  background: var(--red-dim);
  border-color: var(--red-border);
  color: var(--red);
  animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.source-badge {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.2em 0.65em;
  border-radius: 999px;
  border: 1px solid transparent;
}

.source-badge.live {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green-border);
}
.source-badge.cached {
  background: var(--bg-card-alt);
  color: var(--text-3);
  border-color: var(--border);
}
.source-badge.error {
  background: var(--red-dim);
  color: var(--red);
  border-color: var(--red-border);
}

.updated-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-3);
  white-space: nowrap;
}

/* ── Tab navigation ───────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-1); }

.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

@media (min-width: 480px) {
  .tab-btn { padding: 0.6rem 1.25rem; font-size: 0.83rem; }
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.site-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.25rem 0.75rem 5rem;
}

.tab-panel.hidden { display: none; }

/* ── Leaderboard column headers ───────────────────────────────────────────── */
.lb-col-headers { display: none; }

@media (min-width: 620px) {
  .lb-col-headers {
    display: grid;
    grid-template-columns: 4rem 1fr 1fr 5.5rem 2.75rem;
    padding: 0 0.75rem 0.35rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-3);
  }
  .lbch-score { text-align: right; }
}

/* ── Leaderboard entry ────────────────────────────────────────────────────── */
.lb-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 0.5rem;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  border-left: 3px solid transparent;
}

.lb-entry:hover {
  box-shadow: var(--shadow-lift);
  border-color: var(--border-mid);
  transform: translateY(-1px);
}

/* Rank accent strips */
.lb-entry.lb-rank-1 {
  border-left-color: var(--red);
  background: linear-gradient(90deg, #fff0ef 0%, #ffffff 60px);
}
.lb-entry.lb-rank-2 {
  border-left-color: var(--blue);
  background: linear-gradient(90deg, #eef3ff 0%, #ffffff 60px);
}
.lb-entry.lb-rank-3 {
  border-left-color: #6c7ebc;
  background: linear-gradient(90deg, #f3f5fb 0%, #ffffff 60px);
}

/* ── Row grid ─────────────────────────────────────────────────────────────── */
.lb-main {
  display: grid;
  grid-template-areas:
    "rank player score toggle"
    "rank teams  teams toggle";
  grid-template-columns: 4rem 1fr auto 2.75rem;
  align-items: center;
  padding: 0.85rem 0.5rem 0.85rem 0.75rem;
  gap: 0 0.25rem;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 620px) {
  .lb-main {
    grid-template-areas: "rank player teams score toggle";
    grid-template-columns: 4rem 1fr 1fr 5.5rem 2.75rem;
    grid-template-rows: 1fr;
    padding: 0.7rem 0.5rem 0.7rem 1rem;
    gap: 0 0.5rem;
    align-items: center;
  }
}

/* Rank cell */
.lb-rank-cell {
  grid-area: rank;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
}

.rank-num {
  font-family: var(--font-display);
  font-size: 2.1rem;
  line-height: 1;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.lb-entry.lb-rank-1 .rank-num { color: var(--red); }
.lb-entry.lb-rank-2 .rank-num { color: var(--blue); }
.lb-entry.lb-rank-3 .rank-num { color: #6c7ebc; }

.rank-delta {
  font-family: var(--font-mono);
  font-size: 0.57rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
}

.delta-up   { color: var(--green); }
.delta-down { color: var(--red); }
.delta-same { color: var(--text-3); }

/* Player cell */
.lb-player-cell { grid-area: player; min-width: 0; }

.lb-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conflict-icon {
  font-size: 0.72rem;
  margin-left: 0.3em;
  cursor: help;
  vertical-align: middle;
  color: var(--yellow);
}

/* Teams cell */
.lb-teams-cell { grid-area: teams; min-width: 0; }

.lb-teams-text {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 620px) {
  .lb-teams-text { font-size: 0.76rem; }
}

/* Score cell */
.lb-score-cell { grid-area: score; text-align: right; }

.lb-score {
  display: block;
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--text-1);
  letter-spacing: 0.03em;
}

@keyframes score-flash {
  0%   { color: var(--green); }
  65%  { color: var(--green); }
  100% { color: var(--text-1); }
}

.lb-score.score-flash {
  animation: score-flash 1.5s ease-out forwards;
}

/* Toggle */
.lb-toggle {
  grid-area: toggle;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--r-sm);
  transition: color 0.15s, transform 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
}

.lb-toggle:hover { color: var(--blue); }
.lb-entry.is-expanded .lb-toggle {
  color: var(--blue);
  transform: rotate(90deg);
}

/* ── Breakdown panel ──────────────────────────────────────────────────────── */
.lb-breakdown {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.22s ease;
  border-top: 0px solid var(--border);
}

.lb-entry.is-expanded .lb-breakdown {
  max-height: 900px;
  opacity: 1;
  border-top-width: 1px;
}

.bd-inner {
  padding: 0.85rem 0.85rem 1rem;
  background: var(--bg-card-alt);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

@media (min-width: 560px) {
  .bd-inner { flex-direction: row; gap: 0.75rem; }
}

.bd-team {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.7rem 0.85rem;
}

.bd-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Flag logo */
.bd-flag {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.bd-team-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.bd-team-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bd-tier-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.15em 0.5em;
  border-radius: 999px;
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}

.bd-team-pts {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--text-1);
  letter-spacing: 0.03em;
  margin-left: auto;
}

.bd-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.bd-stat-chip {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  font-weight: 600;
  padding: 0.2em 0.55em;
  border-radius: 999px;
  white-space: nowrap;
}

.chip-win   { background: var(--green-dim); color: var(--green);  border: 1px solid var(--green-border); }
.chip-draw  { background: var(--bg-card-alt); color: var(--text-2); border: 1px solid var(--border); }
.chip-bonus { background: var(--yellow-dim); color: var(--yellow); border: 1px solid var(--yellow-border); }
.chip-ko    { background: var(--blue-dim);  color: var(--blue);   border: 1px solid var(--blue-border); }
.chip-none  { color: var(--text-3); font-size: 0.7rem; font-weight: 400; font-style: italic; }

/* ── Matches tab ──────────────────────────────────────────────────────────── */
.section-heading {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  margin-bottom: 0.85rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.matches-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) { .matches-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 720px) { .matches-grid { grid-template-columns: repeat(3, 1fr); } }

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}

.match-card:hover {
  box-shadow: var(--shadow-lift);
  border-color: var(--border-mid);
  transform: translateY(-1px);
}

.match-card.is-live {
  border-color: var(--red-border);
  background: linear-gradient(180deg, #fff6f6 0%, #ffffff 60px);
}

.mc-teams {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-1);
}

.mc-home { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-away { flex: 1; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mc-score {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--red);
  letter-spacing: 0.05em;
  flex-shrink: 0;
  padding: 0 0.2rem;
}

.mc-meta {
  margin-top: 0.4rem;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-3);
}

.mc-live-indicator {
  color: var(--red);
  font-weight: 700;
  animation: breathe 1.5s ease-in-out infinite;
}

/* ── State / error messages ───────────────────────────────────────────────── */
.state-msg {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-3);
  font-style: italic;
  font-size: 0.9rem;
  font-family: var(--font-mono);
  animation: state-pulse 1.8s ease-in-out infinite;
}

@keyframes state-pulse {
  0%, 100% { opacity: 0.9; }
  50%       { opacity: 0.4; }
}

.error-msg {
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid var(--red-border);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  font-family: var(--font-mono);
}

/* ── Breakdown upcoming matches ───────────────────────────────────────────── */
.bd-upcoming {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.bd-upcoming-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-3);
  margin-bottom: 0.35rem;
}

.bd-up-match {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.bd-up-match:last-child { border-bottom: none; }

.bd-up-ha {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-3);
  width: 1.2rem;
  flex-shrink: 0;
}

.bd-up-opp {
  flex: 1;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bd-up-tbd {
  font-weight: 400;
  color: var(--text-3);
  font-style: italic;
}

.bd-up-date {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Schedule tab ─────────────────────────────────────────────────────────── */
.sched-section {
  margin-bottom: 2rem;
}

.sched-round-header {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  color: var(--text-1);
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--red);
  margin-bottom: 1rem;
}

.sched-group-section {
  margin-bottom: 1.1rem;
}

.sched-group-header {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  padding: 0.2rem 0 0.35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.2rem;
}

/* Match row */
.sched-match {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto 1fr 3.5rem;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.25rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.sched-match:last-child { border-bottom: none; }

.sched-match:hover { background: var(--bg-card-alt); border-radius: var(--r-sm); }

.sched-match.is-live { background: #fff6f6; border-radius: var(--r-sm); }

.sched-date {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-3);
  white-space: nowrap;
}

.sched-team {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-1);
  min-width: 0;
}

.sched-home { justify-content: flex-end; text-align: right; }
.sched-away { justify-content: flex-start; }

.sched-tname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sched-flag {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.sched-center {
  text-align: center;
  flex-shrink: 0;
}

.sched-score {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  padding: 0 0.35rem;
  border-radius: var(--r-sm);
  white-space: nowrap;
}

.sched-score.is-final {
  color: var(--text-1);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
}

.sched-score.is-live {
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid var(--red-border);
}

.sched-live-dot {
  font-size: 0.5rem;
  animation: breathe 1.2s ease-in-out infinite;
}

.sched-vs {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-3);
  padding: 0 0.5rem;
}

.sched-status {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-3);
  text-align: right;
  white-space: nowrap;
}

.sched-match.is-live .sched-status {
  color: var(--red);
  font-weight: 700;
  animation: breathe 1.5s ease-in-out infinite;
}

@media (max-width: 480px) {
  .sched-match {
    grid-template-columns: 2.8rem 1fr auto 1fr 2.8rem;
    gap: 0.25rem;
    font-size: 0.75rem;
  }
  .sched-flag { font-size: 0.95rem; }
  .sched-score { font-size: 1rem; }
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-3);
  border-top: 1px solid var(--border);
}

.footer-sep { opacity: 0.4; }

.countdown-text {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

/* ── Rules tab ────────────────────────────────────────────────────────────── */
.rules-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rules-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-card);
}

.rules-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.rules-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.rules-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  color: var(--text-1);
  font-weight: 400;
}

.rules-body {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.6;
}

.rules-section-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 0.5rem;
}

.rules-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.85rem 0;
}

/* Scoring rows */
.rules-score-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rules-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.42rem 0;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}

.rules-score-row:last-child { border-bottom: none; }

.rules-score-event {
  font-size: 0.84rem;
  color: var(--text-1);
  font-weight: 500;
}

.rules-score-pts {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.pts-blue     { color: var(--blue); }
.pts-red      { color: var(--red); }
.pts-champion { color: #b86e00; }

.rules-score-note {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0;
}

/* Tier cards */
.rules-tier {
  padding: 0.6rem 0.75rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

.rules-tier-a {
  background: var(--red-dim);
  border-color: var(--red-border);
}

.rules-tier-b {
  background: var(--blue-dim);
  border-color: var(--blue-border);
}

.rules-tier-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.3rem;
}

.rules-tier-a .rules-tier-label { color: var(--red); }
.rules-tier-b .rules-tier-label { color: var(--blue); }

.rules-tier-desc {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-bottom: 0.6rem;
  line-height: 1.5;
}

.rules-tier-b .rules-tier-desc { margin-bottom: 0; }

.rules-tier-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.rules-team-chip {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid rgba(217,48,37,.25);
  color: var(--text-1);
  border-radius: 999px;
  padding: 0.2em 0.65em;
  white-space: nowrap;
}

@media (min-width: 620px) {
  .rules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  /* Scoring card spans full width */
  .rules-grid > .rules-card:nth-child(2) {
    grid-column: 1 / -1;
  }
}

/* ── Groups tab ───────────────────────────────────────────────────────────── */

.groups-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 580px) {
  .groups-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .groups-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.group-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: var(--red);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.group-table {
  width: 100%;
  border-collapse: collapse;
}

.group-table thead th {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.5rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-alt);
}

.group-table thead th.gt-team {
  text-align: left;
  padding-left: 0.85rem;
}

.group-row {
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background 0.15s;
}

.group-row:last-child {
  border-bottom: none;
}

.group-row:hover {
  background: var(--bg-card-alt);
}

.gt-pos {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
  text-align: right;
  padding: 0.45rem 0.4rem 0.45rem 0.85rem;
  width: 1.5rem;
}

.gt-team {
  padding: 0.4rem 0.4rem;
}

.gt-team-inner {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.gt-flag {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.gt-tname {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.owner-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  margin-left: 0.25rem;
  white-space: nowrap;
  opacity: 0.85;
}

.gt-stat {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-2);
  text-align: right;
  padding: 0.45rem 0.4rem;
  width: 1.6rem;
}

.gt-pts {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-1);
  text-align: right;
  padding: 0.45rem 0.85rem 0.45rem 0.4rem;
  width: 2rem;
}

/* Advancement / elimination indicators */
.adv-badge {
  font-size: 0.85rem;
  margin-left: 0.2rem;
  flex-shrink: 0;
}

/* Hide owner badge on narrow screens to give team name room */
@media (max-width: 400px) {
  .owner-badge { display: none; }
  .gt-stat { width: 1.3rem; padding: 0.4rem 0.2rem; font-size: 0.65rem; }
  .gt-pts  { padding: 0.4rem 0.5rem 0.4rem 0.2rem; }
  .gt-pos  { padding-left: 0.5rem; }
}

/* Eliminated team (rank 4, group complete) — dimmed via JS class */
.group-row.is-eliminated .gt-tname,
.group-row.is-eliminated .gt-stat,
.group-row.is-eliminated .gt-pts {
  color: var(--text-3);
}

/* ── Live match banner ────────────────────────────────────────────────────── */

#live-banner {
  margin-bottom: 1rem;
}

.live-banner-card {
  background: var(--bg-card);
  border: 1px solid var(--red-border);
  border-left: 4px solid var(--red);
  border-radius: var(--r-lg);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 0 0 3px rgba(217,48,37,.08), var(--shadow-card);
  animation: live-card-breathe 3s ease-in-out infinite;
}

@keyframes live-card-breathe {
  0%, 100% { box-shadow: 0 0 0 3px rgba(217,48,37,.08), var(--shadow-card); }
  50%       { box-shadow: 0 0 0 5px rgba(217,48,37,.15), var(--shadow-lift); }
}

.lbanner-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

.lbanner-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--red);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  flex-shrink: 0;
}

.live-pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: breathe 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

.lbanner-elapsed {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--red);
  letter-spacing: 0.04em;
}

.lbanner-round {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
}

.lbanner-match {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

.lbanner-team {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.lbanner-home { justify-content: flex-end; }
.lbanner-away { justify-content: flex-start; flex-direction: row-reverse; }

.lbanner-flag {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.lbanner-tname {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lbanner-score {
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1;
  color: var(--red);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  padding: 0 0.25rem;
}

.lbanner-owners {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}

.lbanner-owner-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.lbanner-owner-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lbanner-owner-name {
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.lbanner-owner-team {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
}

.lbanner-situ {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.lbs-win  { color: var(--green); }
.lbs-lose { color: var(--red); }
.lbs-draw { color: var(--text-3); }

.lbanner-pts {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  margin-left: auto;
  white-space: nowrap;
}

.lbp-pos  { color: var(--green); font-weight: 600; }
.lbp-zero { color: var(--text-3); }

@media (max-width: 400px) {
  .lbanner-tname { font-size: 0.78rem; }
  .lbanner-score { font-size: 1.8rem; }
  .lbanner-flag  { font-size: 1.25rem; }
}

/* ── Biggest Mover card ───────────────────────────────────────────────────── */
.bm-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0.75rem 1rem;
  margin-bottom: 0.9rem;
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
}

.bm-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  flex-shrink: 0;
  white-space: nowrap;
}

.bm-delta {
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--green);
  flex-shrink: 0;
}

.bm-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
}

.bm-teams {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.bm-score {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--green);
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Activity feed ────────────────────────────────────────────────────────── */

.feed-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  transition: box-shadow 0.15s;
}

.feed-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.feed-item-champion {
  border-width: 1px 1px 1px 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
}

.feed-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.feed-flag {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.feed-center {
  flex: 1;
  min-width: 0;
}

.feed-event-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.feed-team-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-1);
  white-space: nowrap;
}

.feed-event-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-2);
  white-space: nowrap;
}

.feed-result {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}

.feed-result-team {
  font-size: 0.75rem;
  color: var(--text-2);
  white-space: nowrap;
}

.feed-result-score {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-1);
  padding: 0 0.15rem;
}

.feed-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  gap: 0.15rem;
  min-width: 3.5rem;
}

.feed-pts {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-1);
}

.feed-item-champion .feed-pts {
  color: var(--red);
}

.feed-owner {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
}

.feed-date {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-3);
  white-space: nowrap;
}

.feed-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-2);
}

.feed-empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
}

.feed-empty p {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--text-1);
}

.feed-empty-sub {
  font-size: 0.82rem;
  color: var(--text-3);
  font-weight: 400 !important;
}

/* ── Notification bell & panel ────────────────────────────────────────────── */

.notif-wrap {
  position: relative;
  flex-shrink: 0;
}

.notif-bell {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0.3rem 0.35rem;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.notif-bell:hover { color: var(--text-1); background: var(--bg-card-alt); }
.notif-bell-on { color: var(--blue) !important; }

/* Subscribed indicator dot */
.notif-bell-on::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  border: 1.5px solid var(--bg-card);
}

/* Preferences panel */
.notif-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  z-index: 200;
  overflow: hidden;
}

.notif-panel.is-open { display: block; }

@media (max-width: 340px) {
  .notif-panel { width: calc(100vw - 1.5rem); right: -0.5rem; }
}

.np-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem 0.6rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-alt);
}

.np-title {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--text-1);
}

.np-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: var(--r-sm);
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.np-close:hover { color: var(--text-1); background: var(--border); }

.np-body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.np-status {
  font-size: 0.82rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.np-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
  animation: breathe 2s ease-in-out infinite;
}

.np-status-on  strong { color: var(--green); }
.np-status-off strong { color: var(--text-3); }

.np-desc {
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.55;
}

/* Preference rows with toggle switch */
.np-prefs {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.np-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  gap: 0.5rem;
}

.np-pref-row:last-child { border-bottom: none; }
.np-pref-row:hover { background: var(--bg-card-alt); }

.np-pref-label {
  font-size: 0.78rem;
  color: var(--text-1);
  font-weight: 500;
  flex: 1;
}

/* Toggle switch */
.np-toggle-wrap {
  position: relative;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}

.np-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.np-toggle-track {
  display: block;
  width: 32px;
  height: 18px;
  background: var(--border-mid);
  border-radius: 999px;
  transition: background 0.2s;
  cursor: pointer;
}

.np-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.np-toggle-input:checked + .np-toggle-track {
  background: var(--blue);
}

.np-toggle-input:checked + .np-toggle-track::after {
  transform: translateX(14px);
}

.np-toggle-input:disabled + .np-toggle-track {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Action buttons */
.np-action {
  width: 100%;
  padding: 0.6rem;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  transition: opacity 0.15s;
}

.np-action:hover { opacity: 0.85; }

.np-sub   { background: var(--blue); color: #fff; }
.np-unsub {
  background: none;
  border: 1px solid var(--border-mid);
  color: var(--text-3);
  font-weight: 500;
}

/* ── Opt-in prompt banner ─────────────────────────────────────────────────── */

.notif-optin {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, calc(100vw - 2rem));
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  z-index: 300;
  animation: optin-slide-up 0.3s ease-out;
}

@keyframes optin-slide-up {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);   opacity: 1; }
}

.notif-optin-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.notif-optin-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.notif-optin-text strong {
  font-size: 0.88rem;
  color: var(--text-1);
  display: block;
}

.notif-optin-text span {
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.45;
}

.notif-optin-btns {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.notif-optin-allow,
.notif-optin-later {
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.notif-optin-allow:hover,
.notif-optin-later:hover { opacity: 0.8; }

.notif-optin-allow { background: var(--blue); color: #fff; }
.notif-optin-later { background: var(--bg-card-alt); color: var(--text-3); border: 1px solid var(--border); }
