/* ═══════════════════════════════════════════════
   EIHL Tracker — Global Styles
   Dark theme with team colour accents
   ═══════════════════════════════════════════════ */

:root {
  --accent: #c8102e;
  --accent-dim: rgba(200,16,46,0.12);
  --accent-glow: rgba(200,16,46,0.25);
  --bg: #08080d;
  --surface: #111118;
  --surface-2: #18181f;
  --surface-3: #1f1f28;
  --border: #252530;
  --text: #c8c8d8;
  --text-dim: #6a6a7a;
  --text-bright: #eeeef4;
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.12);
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,0.12);
  --amber: #f59e0b;
  --amber-dim: rgba(245,158,11,0.12);
  --loss: #ef4444;
  --loss-dim: rgba(239,68,68,0.12);
}

* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: clip;
}

/* ── NAV ── */
.top-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top:0; z-index: 100;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.nav-brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text-bright);
  font-weight: 700; font-size: 1.1rem;
}
.brand-icon { font-size: 1.3rem; }
.brand-accent { color: var(--accent); }
.nav-links {
  display: flex; align-items: center; gap: 4px;
}
.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  display: flex; align-items: center; gap: 4px;
}
.nav-link:hover, .nav-link.active {
  color: var(--text-bright);
  background: var(--surface-2);
}
.nav-dropdown { position: relative; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  min-width: 260px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  max-height: 400px;
  overflow-y: auto;
}
.nav-dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: block;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.dropdown-item:hover { background: var(--surface-3); color: var(--text-bright); }

/* ── HAMBURGER (hidden on desktop) ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-right: -8px;
  z-index: 110;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-dim);
  border-radius: 2px;
  transition: all 0.25s ease;
}
.hamburger:hover span { background: var(--text-bright); }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── HERO ── */
.hero {
  position: relative;
  padding: 56px 32px 48px;
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content:'';
  position: absolute; inset:0;
  background: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 60%);
  pointer-events: none;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.03em;
  position: relative;
}
.hero h1 .team-name { color: var(--accent); }
.hero .subtitle {
  font-size: 1rem;
  color: var(--text-dim);
  margin-top: 8px;
  font-weight: 400;
  position: relative;
}
.hero .subtitle strong { color: var(--text); font-weight: 600; }
.hero-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  position: relative;
}
.hero-pill {
  display: inline-block;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.hero .hero-disclaimer {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 16px;
  opacity: 0.6;
  position: relative;
  font-style: italic;
}
.hero .hero-disclaimer + .hero-disclaimer { margin-top: 6px; }
.hero .hero-disclaimer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.hero .hero-disclaimer a:hover {
  text-decoration: underline;
}

/* ── LAYOUT ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
section { padding: 48px 0; border-bottom: 1px solid var(--border); }
section:last-child { border-bottom: none; }
.section-title {
  font-size: 1.35rem; font-weight: 700; color: var(--text-bright);
  margin-bottom: 24px; letter-spacing: -0.02em;
}
.section-title::before {
  content:''; display:inline-block; width:3px; height:1.1em;
  background: var(--accent); border-radius:2px; margin-right:10px;
  vertical-align: text-bottom;
}
.section-title + .section-hint { margin-top: -16px; }
.section-hint {
  font-size: 0.85rem; color: var(--text-dim); margin-bottom: 20px;
}

/* ── STAT CARDS ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--accent); }
.stat-card .val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.8rem; font-weight: 700;
  color: var(--text-bright);
  line-height: 1.2;
}
.stat-card .val.green { color: var(--green); }
.stat-card .val.red { color: var(--accent); }
.stat-card .val.blue { color: var(--blue); }
.stat-card .val.amber { color: var(--amber); }
.stat-card .label {
  font-size: 0.72rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 4px;
}

/* ── TABLES ── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
table { width:100%; border-collapse:collapse; font-size:0.85rem; white-space:nowrap; }
th {
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  position: sticky; top: 0;
}
td { padding:9px 12px; border-top:1px solid var(--border); color:var(--text); }
tr:hover td { background: var(--surface-2); }
.text-right { text-align:right; }
.text-center { text-align:center; }
.mono { font-family:'JetBrains Mono',monospace; font-size:0.8rem; }
.highlight-row td { background: var(--accent-dim); }
.highlight-row:hover td { background: rgba(200,16,46,0.18); }

/* ── BADGES ── */
.w-badge { display:inline-block; padding:1px 7px; border-radius:4px; font-size:0.72rem; font-weight:600; }
.w-badge.win { background:var(--green-dim); color:var(--green); }
.w-badge.loss { background:var(--loss-dim); color:var(--loss); }
.w-badge.otl { background:var(--amber-dim); color:var(--amber); }

/* ── CHARTS ── */
.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.chart-container canvas { max-height: 640px; }

/* ── CHART SHARE ── */
.chart-container { position: relative; }
.chart-share-btn {
  position: absolute; top: 12px; right: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px;
  color: var(--text-dim); cursor: pointer;
  opacity: 0.5; transition: all 0.15s; z-index: 5;
  display: flex; align-items: center; justify-content: center;
}
.chart-share-btn:hover { opacity: 1; color: var(--text-bright); border-color: var(--text-dim); }
.chart-share-btn svg { width: 16px; height: 16px; }
.chart-share-popover {
  display: none; position: absolute; top: 44px; right: 12px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px; z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5); min-width: 150px;
}
.chart-share-popover.open { display: block; }
.chart-share-popover button {
  display: block; width: 100%; padding: 8px 12px;
  background: none; border: none; border-radius: 6px;
  color: var(--text); font-size: 0.8rem; font-family: inherit;
  text-align: left; cursor: pointer; transition: background 0.1s;
}
.chart-share-popover button:hover { background: var(--surface-2); color: var(--text-bright); }

/* ── GRID ── */
.two-col { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width: 768px) { .two-col { grid-template-columns:1fr; } }

/* ── FORM STREAK ── */
.form-streak { display:flex; gap:4px; flex-wrap:wrap; margin-bottom:20px; }
.form-dot {
  width:28px; height:28px; border-radius:6px;
  display:flex; align-items:center; justify-content:center;
  font-size:0.65rem; font-weight:700; color:#fff;
  cursor:default; position:relative;
}
.form-dot.W { background:var(--green); }
.form-dot.L { background:var(--loss); }
.form-dot.OT { background:var(--amber); }
.form-dot .tip {
  display:none;
  position:absolute; bottom:100%; left:50%; transform:translateX(-50%);
  background:var(--surface-3); border:1px solid var(--border);
  padding:4px 8px; border-radius:6px; font-size:0.7rem;
  white-space:nowrap; color:var(--text); z-index:10;
  margin-bottom:4px; font-weight:400;
}
.form-dot:hover .tip { display:block; }

/* ── GOALIE CARDS ── */
.goalie-card {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:10px;
  padding:20px;
  text-align:left;
}
.goalie-card .goalie-name {
  font-size:1.1rem; font-weight:700; color:var(--text-bright); margin-bottom:14px;
}
.goalie-grid {
  display:grid; grid-template-columns:repeat(3,1fr); gap:14px;
}
.goalie-grid .val { font-family:'JetBrains Mono',monospace; font-size:1.3rem; font-weight:700; color:var(--text-bright); line-height:1.2; }
.goalie-grid .label { font-size:0.7rem; color:var(--text-dim); text-transform:uppercase; letter-spacing:0.06em; margin-top:2px; }

/* ── CALLOUT BOXES ── */
.callout {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:10px;
  padding:20px;
  text-align:left;
}
.callout.good { border-left:3px solid var(--green); }
.callout.bad { border-left:3px solid var(--loss); }
.callout .callout-title {
  font-size:0.75rem; text-transform:uppercase; letter-spacing:0.08em; margin-bottom:6px;
}
.callout.good .callout-title { color:var(--green); }
.callout.bad .callout-title { color:var(--loss); }

/* ── LEAGUE RECORDS ── */
.records-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.record-card.record-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.record-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.record-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.2;
}
.record-value.green { color: var(--green); }
.record-value.red { color: var(--loss); }
.record-team {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 6px;
}
.record-season {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ── TEAM RECORDS ── */
.records-section .section-title { display: flex; align-items: center; gap: 10px; position: relative; }
.team-record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.team-record-card .record-label {
  font-size: 0.8rem;
  margin-bottom: 10px;
  text-align: left;
}
.team-record-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.82rem;
  padding: 3px 0;
}
.team-record-row .label { color: var(--text-dim); }
.team-record-row .value { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.team-record-row .season { font-size: 0.72rem; color: var(--text-dim); min-width: 48px; text-align: right; }
.team-record-row.current-row { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--border); }
.team-record-row.current-row .label { color: var(--text-bright); }
.team-record-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 10px;
  position: relative;
}
.team-record-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}

/* ── FOOTER ── */
.site-footer {
  text-align:center;
  padding:32px 20px;
  font-size:0.75rem;
  color:var(--text-dim);
  border-top:1px solid var(--border);
}
.site-footer a { color:var(--accent); text-decoration:none; }

/* ── SUB LABELS ── */
.sub-label { font-size:0.8rem; color:var(--text-dim); margin-bottom:12px; }

/* ── TEAM CARDS (Dashboard) ── */
.team-grid {
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap:12px;
}
.team-card {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:10px;
  padding:16px;
  text-decoration:none;
  color:var(--text);
  transition: all 0.2s;
  display:block;
}
.team-card:hover {
  border-color: var(--team-colour, var(--accent));
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.team-card .team-card-name {
  font-weight:700; color:var(--text-bright); font-size:0.95rem;
}
.team-card .team-card-record {
  font-family:'JetBrains Mono',monospace;
  font-size:0.8rem;
  color:var(--text-dim);
  margin-top:4px;
}

/* ── TEAM CARD FORM DOTS ── */
.team-card-form {
  display: flex;
  gap: 3px;
  margin-top: 6px;
}
.form-dot-mini {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.form-dot-mini.W { background: var(--green); }
.form-dot-mini.L { background: var(--loss); }
.form-dot-mini.OT { background: var(--amber); }

/* ── SCROLLABLE TABLE ── */
.table-scroll { max-height:600px; overflow-y:auto; }

/* ── TREND TABLE HIGHLIGHTS ── */
.trend-peak td { background: var(--green-dim); }
.trend-peak:hover td { background: rgba(34,197,94,0.18); }
.trend-slump td { background: var(--loss-dim); }
.trend-slump:hover td { background: rgba(239,68,68,0.18); }

/* ── PERIOD / 3-COL GRID DEFAULTS ── */
.period-cards { grid-template-columns: repeat(3, 1fr); }
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ── TAB NAV ── */
.tab-nav {
  display: flex;
  gap: 2px;
  margin-bottom: 32px;
  background: var(--surface);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--border);
}
.tab-nav a {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-nav a:hover { color: var(--text-bright); background: var(--surface-2); }
.tab-nav a.active { color: var(--text-bright); background: var(--accent); }

/* ── SEASON SELECTOR ── */
.season-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 24px 0 16px;
}
.season-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.01em;
}
.season-arrow {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-bright);
  font-size: 1.2rem;
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
  line-height: 1;
}
.season-arrow:hover { background: var(--accent); border-color: var(--accent); }
.season-arrow.disabled { opacity: 0.25; cursor: default; pointer-events: none; }

/* ── SECTION ANCHORS (sticky sub-nav) ── */
.section-anchors {
  display: flex;
  gap: 6px;
  padding: 8px 0;
  margin-bottom: 16px;
  position: sticky;
  top: 56px;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.section-anchors::-webkit-scrollbar { display: none; }
.anchor-chip {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
  min-height: 32px;
  display: flex;
  align-items: center;
}
.anchor-chip:hover { color: var(--text-bright); border-color: var(--text-dim); }
.anchor-chip.active { color: var(--text-bright); background: var(--accent); border-color: var(--accent); }

/* ═══════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════ */

@media (max-width: 640px) {
  /* ── NAV ── */
  .nav-inner { padding: 0 12px; height: 48px; }
  .nav-brand { font-size: 0.95rem; min-width: 0; }

  /* Show hamburger, hide nav-links by default */
  .hamburger { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 8px 12px 12px;
    gap: 2px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  }
  .nav-links.open { display: flex; }
  .nav-link {
    padding: 10px 12px;
    font-size: 0.88rem;
    border-radius: 8px;
    width: 100%;
  }

  /* Teams dropdown: show inline in mobile menu */
  .nav-dropdown { width: 100%; }
  .dropdown-trigger { width: 100%; justify-content: space-between; }
  .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: var(--surface-2);
    border-radius: 8px;
    margin-top: 2px;
    min-width: 0;
    max-height: 240px;
    padding: 6px;
  }
  .dropdown-item {
    padding: 10px 12px;
    margin-bottom: 2px;
  }

  /* ── HERO ── */
  .hero { padding: 36px 16px 28px; }

  /* ── LAYOUT ── */
  .container { padding: 0 12px; }
  section { padding: 32px 0; }
  .section-title { font-size: 1.15rem; margin-bottom: 16px; }

  /* ── STAT CARDS ── */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px 8px; }
  .stat-card .val { font-size: 1.4rem; }
  .stat-card .label { font-size: 0.65rem; }

  /* ── TABLES: horizontal scroll ── */
  .table-wrap { margin: 0 -12px; border-radius: 0; border-left: none; border-right: none; }
  table { font-size: 0.78rem; }
  th { padding: 8px 10px; font-size: 0.65rem; }
  td { padding: 7px 10px; }

  /* ── FORM STREAK ── */
  .form-dot { width: 24px; height: 24px; font-size: 0.6rem; }

  /* ── CHARTS ── */
  .chart-container { padding: 14px 10px; }
  .chart-share-btn { top: 8px; right: 8px; padding: 8px 10px; opacity: 0.7; }
  .chart-share-popover { top: 40px; right: 8px; }

  /* ── GOALIE CARDS ── */
  .goalie-card { padding: 14px; }
  .goalie-grid .val { font-size: 1.1rem; }

  /* ── CALLOUT ── */
  .callout { padding: 14px; }

  /* ── TEAM CARDS ── */
  .team-grid { grid-template-columns: 1fr; gap: 8px; }

  /* ── COMPARE FORM ── */
  .compare-quick { flex-direction: column; gap: 10px; }
  .compare-quick .team-picker { width: 100%; }
  .compare-go-btn { width: 100%; }

  /* ── LEAGUE RECORDS ── */
  .records-grid { grid-template-columns: 1fr; }

  /* ── FOOTER ── */
  .site-footer { padding: 24px 12px; }

  /* ── PERIOD SCORING CARDS ── */
  .period-cards { grid-template-columns: 1fr !important; }
  .period-cards .stat-card .val { font-size: 1.2rem; }
  .period-card-gfga { font-size: 0.7rem !important; }

  /* ── H2H GRID ── */
  .stat-grid-3 { grid-template-columns: repeat(3, 1fr) !important; }
  .stat-grid-3 .stat-card .val { font-size: 1.3rem; }

  /* ── TAB NAV (scrollable on mobile) ── */
  .tab-nav {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-nav a {
    flex: 0 0 auto;
    min-width: 80px;
    padding: 10px 16px;
    font-size: 0.78rem;
    scroll-snap-align: start;
  }

  /* ── SECTION ANCHORS ── */
  .section-anchors { top: 48px; padding: 6px 0; }
  .anchor-chip { padding: 5px 12px; font-size: 0.7rem; min-height: 28px; }
}

/* ── COMPARE QUICK FORM (Dashboard) ── */
.compare-quick {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.compare-go-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.compare-go-btn:hover { opacity: 0.85; }

/* ── TEAM LOGOS ── */
.team-logo-lg {
  width: 64px;
  height: 64px;
  vertical-align: middle;
  object-fit: contain;
}
.team-logo-sm {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  object-fit: contain;
}
.team-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
}
.team-logo-fallback.team-logo-lg {
  font-size: 1.2rem;
}
.team-logo-fallback.team-logo-sm {
  font-size: 0.55rem;
}

/* ── TEAM PICKER (custom select with logos) ── */
.team-picker { position: relative; display: inline-block; }
.team-picker--sm { min-width: 200px; }
.team-picker--lg { flex: 1; min-width: 200px; }

.team-picker__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-bright);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 400;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.team-picker--sm .team-picker__trigger { padding: 10px 12px; font-size: 0.9rem; }
.team-picker--lg .team-picker__trigger { padding: 14px 16px; font-size: 1.05rem; background: var(--surface); border-radius: 10px; }

.team-picker__trigger:hover,
.team-picker.open .team-picker__trigger { border-color: var(--text-dim); outline: none; }
.team-picker.open .team-picker__trigger { box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.team-picker__trigger:focus-visible { border-color: var(--text-dim); outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

.team-picker__logo { display: flex; align-items: center; flex-shrink: 0; }
.team-picker__label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-picker__placeholder { flex: 1; text-align: left; color: var(--text-dim); }
.team-picker__chevron { flex-shrink: 0; color: var(--text-dim); transition: transform 0.2s; }
.team-picker.open .team-picker__chevron { transform: rotate(180deg); }

.team-picker__menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  margin: 0;
  list-style: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
  min-width: 220px;
}
.team-picker.open .team-picker__menu { display: block; }

.team-picker__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.85rem;
}
.team-picker--lg .team-picker__option { font-size: 0.95rem; padding: 10px 12px; }
.team-picker__option:hover,
.team-picker__option--focused { background: var(--surface-3); color: var(--text-bright); outline: none; }
.team-picker__option--selected { color: var(--text-bright); font-weight: 600; }

@media (max-width: 640px) {
  .team-picker--sm, .team-picker--lg { width: 100%; min-width: 0; }
  .team-picker__menu { left: 0; right: 0; min-width: 0; }
}

/* ═══════════════════════════════════════════════
   MATCH / GAME REPORT
   ═══════════════════════════════════════════════ */

/* ── Score Header ── */
.match-header {
  padding: 48px 20px 32px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.match-header::before {
  content:'';
  position: absolute; inset:0;
  background:
    radial-gradient(ellipse at 15% 0%, color-mix(in srgb, var(--home-colour, transparent) 12%, transparent) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 0%, color-mix(in srgb, var(--away-colour, transparent) 12%, transparent) 0%, transparent 50%);
  pointer-events: none;
}
.match-score-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  position: relative;
  margin-bottom: 16px;
}
.match-team-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.match-team-side .team-name-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-bright);
  text-align: center;
  line-height: 1.3;
}
.match-team-side a {
  color: inherit;
  text-decoration: none;
}
.match-team-side a:hover .team-name-label {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.match-score-center {
  display: flex;
  align-items: center;
  gap: 12px;
}
.match-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1;
  min-width: 50px;
  text-align: center;
}
.match-score-divider {
  font-size: 2rem;
  color: var(--text-dim);
  font-weight: 300;
}

/* ── Period Scores ── */
.period-scores {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.period-scores .period-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
}
.period-scores .period-chip .period-label {
  color: var(--text-dim);
  font-weight: 600;
  margin-right: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Live Indicator ── */
.live-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--loss);
  margin-bottom: 6px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--loss);
  animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
.live-indicator.intermission {
  color: var(--text-dim);
}
.live-indicator.intermission .live-dot {
  background: var(--text-dim);
  animation: none;
}
.game-clock-time {
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
  margin-left: 2px;
}
.game-clock-time::before {
  content: '\00b7';
  margin-right: 4px;
}

/* ── Status Badges ── */
.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}
.status-final { background: var(--surface-2); color: var(--text-dim); }
.status-live { background: var(--loss); color: #fff; animation: pulse-live 1.5s ease-in-out infinite; }
@keyframes pulse-live { 0%,100% { opacity:1; } 50% { opacity:0.6; } }
.status-scheduled { background: var(--surface-2); color: var(--text-dim); }

.match-comp-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-bright);
  margin-bottom: 8px;
}

/* ── Match Meta ── */
.match-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.match-meta span + span::before {
  content: '\00b7';
  margin: 0 8px;
}

/* ── Expected Win Bar ── */
.expected-win-bar {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto 8px;
  max-width: 500px;
  position: relative;
  border: 1px solid var(--border);
}
.expected-win-fill {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  transition: width 0.6s ease;
  min-width: 40px;
}

/* xG source toggle */
.xg-source-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.72rem;
}
.xg-toggle-btn {
  padding: 4px 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.72rem;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.xg-toggle-btn:hover { color: var(--text-bright); }
.xg-toggle-btn.active {
  background: var(--accent, #22c55e);
  color: #fff;
}
.prediction-bar {
  margin-top: 12px;
}
.xg-totals {
  display: flex;
  justify-content: space-between;
  max-width: 500px;
  margin: 0 auto 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
}
.xg-totals .xg-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 4px;
  font-weight: 600;
}

/* ── Stat Compare Bars ── */
.stat-compare-section { max-width: 600px; margin: 0 auto; }
.stat-compare-row {
  display: grid;
  grid-template-columns: 1fr 100px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.stat-bar-container {
  height: 24px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background: var(--surface-2);
}
.stat-bar-container.home { direction: rtl; }
.stat-bar {
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  min-width: fit-content;
  transition: width 0.5s ease;
}
.stat-bar-container.home .stat-bar {
  direction: ltr;
  justify-content: flex-end;
}
.stat-bar-container.away .stat-bar {
  justify-content: flex-start;
}
.stat-compare-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  min-width: 80px;
  white-space: nowrap;
}

/* ── Event Rows (Goals / Penalties) ── */
.event-list { margin-bottom: 24px; }
.period-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  margin-top: 16px;
}
.period-header:first-child { margin-top: 0; }
.event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.85rem;
}
.event-row:last-child { border-bottom: none; }
.event-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-dim);
  min-width: 44px;
  flex-shrink: 0;
}
.event-team-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.event-detail {
  flex: 1;
  color: var(--text);
  line-height: 1.4;
}
.event-detail strong { color: var(--text-bright); }
.event-detail .event-assists {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.event-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 6px;
}
.event-badge.pp { background: var(--green-dim); color: var(--green); }
.event-badge.sh { background: var(--blue-dim); color: var(--blue); }
.event-badge.en { background: var(--amber-dim); color: var(--amber); }

/* ── Goalie Compare Grid ── */
.goalie-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.goalie-team-section h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.goalie-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 10px;
}
.goalie-stat-card .goalie-name {
  font-weight: 700;
  color: var(--text-bright);
  font-size: 0.95rem;
  margin-bottom: 10px;
}
.goalie-stat-card .goalie-name .jersey-num {
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  margin-right: 4px;
}
.goalie-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: center;
}
.goalie-stat-row .val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.2;
}
.goalie-stat-row .label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* ── Match Shot Map ── */
.match-rink-wrap {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}
.match-rink-svg { width:100%; max-width:700px; margin:0 auto; display:block; }
.split-rink-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.split-rink-panel { min-width: 0; position: relative; }
.split-rink-panel .chart-share-btn { top: -4px; right: 0; }
.split-rink-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 6px;
}
.split-rink-panel .match-rink-svg { max-width: 100%; }
.rink-legend-goal { background: #22c55e; }
.rink-legend-save { background: #ef4444; }
.rink-legend-block { background: #f59e0b; }
.rink-legend-miss { background: #555; }
.match-shot-tooltip {
  position: absolute;
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  color: var(--text);
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  display: none;
}
.rink-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 12px;
  font-size: 0.72rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.rink-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Pre-Game State ── */
.pre-game-info {
  text-align: center;
  padding: 32px 0;
}
.pre-game-time {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-bright);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 8px;
}

/* ── Match Page Mobile ── */
@media (max-width: 640px) {
  .match-header { padding: 28px 12px 20px; }
  .match-score-area { gap: 12px; }
  .match-team-side { min-width: 0; }
  .match-team-side .team-name-label { font-size: 0.75rem; }
  .match-score { font-size: 2.2rem; min-width: 36px; }
  .match-score-divider { font-size: 1.4rem; }
  .period-scores .period-chip { font-size: 0.65rem; padding: 2px 6px; }
  .expected-win-bar { max-width: 100%; }
  .xg-totals { max-width: 100%; font-size: 0.72rem; }
  .stat-compare-section { max-width: 100%; }
  .stat-compare-row { gap: 6px; grid-template-columns: 1fr 80px 1fr; }
  .stat-compare-label { font-size: 0.6rem; }
  .two-col .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100vw; }
  .two-col .table-wrap table { min-width: 500px; }
  .goalie-compare-grid { grid-template-columns: 1fr; }
  .goalie-stat-row { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .goalie-stat-row .val { font-size: 0.95rem; }
  .split-rink-grid { grid-template-columns: 1fr; }
  .match-rink-wrap { padding: 12px; }
  .event-row { font-size: 0.78rem; gap: 6px; }
  .event-time { font-size: 0.7rem; min-width: 36px; }
  .pre-game-time { font-size: 1.3rem; }
}

/* ═══════════════════════════════════════════════
   SCOREBOARD STRIP (Dashboard)
   ═══════════════════════════════════════════════ */
.scoreboard-strip {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.scoreboard-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 24px;
  margin: 0 auto;
  width: max-content;
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.scoreboard-scroll::-webkit-scrollbar { height: 4px; }
.scoreboard-scroll::-webkit-scrollbar-track { background: transparent; }
.scoreboard-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.scoreboard-card {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 16px 10px;
  min-width: 140px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s;
}
.scoreboard-card:hover {
  border-color: var(--text-dim);
}
.scoreboard-live {
  border-color: var(--loss);
  animation: pulse-border 2s ease-in-out infinite;
}
@keyframes pulse-border {
  0%, 100% { border-color: var(--loss); }
  50% { border-color: transparent; }
}
.scoreboard-header {
  margin-bottom: 4px;
}
.scoreboard-comp-row {
  text-align: right;
}
.scoreboard-comp {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.4;
}
.scoreboard-date-status {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.scoreboard-date-status .status-dot.live {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--loss);
  margin-right: 4px;
}
.scoreboard-teams {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.scoreboard-team {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}
.scoreboard-score {
  margin-left: auto;
  font-weight: 700;
  color: var(--text-bright);
}
.scoreboard-xg {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
}
.scoreboard-active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
}
.scoreboard-active:hover {
  border-color: #6366f1;
}

/* ═══════════════════════════════════════════════
   MATCH LINKS (Schedule, Dashboard)
   ═══════════════════════════════════════════════ */
.match-link {
  color: var(--text-bright);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.match-link:hover {
  border-color: var(--text-dim);
}

.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: var(--surface-hover, rgba(255,255,255,0.04)); }

/* ── Two-Leg Tie Card ── */
.two-leg-card {
  max-width: 420px;
  margin: 12px auto 0;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  font-size: 0.85rem;
}

.two-leg-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.two-leg-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0;
}

.two-leg-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 40px;
  text-align: right;
}

.two-leg-matchup {
  display: flex;
  align-items: center;
  gap: 6px;
}

.two-leg-team {
  font-weight: 600;
  color: var(--text-bright);
  min-width: 32px;
}

.two-leg-score {
  color: var(--text-dim);
  min-width: 40px;
  text-align: center;
}

.two-leg-row--current {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 4px 8px;
}

.two-leg-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  transition: opacity 0.15s;
}

.two-leg-link:hover {
  opacity: 0.7;
}

.two-leg-aggregate {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-bright);
}
