/* Match Pulse — minimalist football. Light + dark, roles as custom properties. */

:root {
  color-scheme: light;
  --surface: #fcfcfb;
  --surface-2: #f3f3ef;
  --line: #e3e2dc;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #8a897f;
  --pitch: #008300;        /* the one accent — pitch green */
  --pitch-soft: #00830014;
  /* event kinds — validated categorical (light) */
  --k-goal: #008300;
  --k-var: #4a3aa7;
  --k-card: #eda100;
  --k-chance: #2a78d6;
  --k-red: #e34948;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface: #1a1a19;
    --surface-2: #232322;
    --line: #35342f;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-3: #8a897f;
    --pitch: #29a329;
    --pitch-soft: #29a3291f;
    /* event kinds — same hues stepped for the dark surface */
    --k-goal: #008300;
    --k-var: #9085e9;
    --k-card: #c98500;
    --k-chance: #3987e5;
    --k-red: #e66767;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 980px; margin: 0 auto; padding: 0 24px; }

/* top bar */
.topbar {
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.wordmark {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 4px;
  font-size: 14px;
}
.wordmark::before {
  content: "●";
  color: var(--pitch);
  margin-right: 10px;
  font-size: 10px;
  vertical-align: 2px;
}
.topbar-note { font-size: 13px; color: var(--ink-3); }

/* hero */
.hero { padding: 56px 0 40px; text-align: center; border-bottom: 1px solid var(--line); }
.round-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 16px;
  margin-bottom: 36px;
}
.fixture {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  max-width: 760px;
  margin: 0 auto;
}
.team { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.team img.flag {
  width: 76px;
  height: 76px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--surface-2);
  padding: 10px;
}
.team .team-name { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.form-chips { display: flex; gap: 4px; }
.form-chips span {
  font-family: var(--mono);
  font-size: 10.5px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--surface);
  font-weight: 700;
}
.form-chips .w { background: var(--pitch); }
.form-chips .d { background: var(--ink-3); }
.form-chips .l { background: var(--ink); opacity: 0.75; }

.score-block { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 150px; }
.score {
  font-family: var(--mono);
  font-size: 54px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1;
}
.score .dash { color: var(--ink-3); }
.status-line { font-family: var(--mono); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--pitch); }
.venue-line { margin-top: 28px; font-size: 14px; color: var(--ink-3); }

/* explainer */
.explainer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 44px 0;
  border-bottom: 1px solid var(--line);
}
.exp-card { padding: 8px 4px; }
.exp-num { font-family: var(--mono); font-size: 12px; color: var(--pitch); letter-spacing: 2px; }
.exp-card h3 { font-size: 17px; margin: 6px 0 6px; }
.exp-card p { font-size: 14px; color: var(--ink-2); }

/* analysis */
.analysis { padding: 48px 0; border-bottom: 1px solid var(--line); }
.analysis h2, .context h2 { font-size: 24px; margin-bottom: 24px; letter-spacing: -0.2px; }

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 56px 24px;
  text-align: center;
}
.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pitch);
  margin: 0 auto 18px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) { .pulse-dot { animation: none; } }
.empty-title { font-size: 18px; font-weight: 650; }
.empty-sub { font-size: 14px; color: var(--ink-2); margin-top: 6px; }

/* stat tiles */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-tile {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 16px 18px;
}
.stat-tile .stat-label { font-size: 12px; color: var(--ink-2); letter-spacing: 0.4px; text-transform: uppercase; font-family: var(--mono); }
.stat-tile .stat-value { font-family: var(--mono); font-size: 32px; font-weight: 700; line-height: 1.25; }
.stat-tile .stat-unit { font-size: 13px; color: var(--ink-3); }
.stat-tile.hero-tile { background: var(--pitch-soft); }
.stat-tile.hero-tile .stat-value { color: var(--pitch); }

/* chart */
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: var(--mono); font-size: 11px; fill: var(--ink-3); }
.chart-svg .axis-line { stroke: var(--line); stroke-width: 1; }
.chart-svg .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 5; }
.chart-svg .hr-path { stroke: var(--ink); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .baseline-band { fill: var(--pitch-soft); }
.chart-svg .baseline-line { stroke: var(--pitch); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart-svg .episode-band { fill: var(--ink); opacity: 0.06; }
.chart-svg .marker { stroke: var(--surface); stroke-width: 2; cursor: pointer; }
.chart-svg .marker-stem { stroke: var(--line); stroke-width: 1; }
.chart-svg .annot { fill: var(--ink); font-weight: 700; }
.chart-svg .crosshair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--surface);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-family: var(--mono);
  max-width: 280px;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 5;
  line-height: 1.45;
}
.chart-tooltip.show { opacity: 1; }

/* legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 14px 2px 0;
  font-size: 13px;
  color: var(--ink-2);
}
.legend .li { display: inline-flex; align-items: center; gap: 7px; }
.legend .swatch { width: 10px; height: 10px; display: inline-block; }
.legend .swatch.round { border-radius: 50%; }
.legend .swatch.diamond { transform: rotate(45deg); border-radius: 2px; }
.legend .swatch.square { border-radius: 2px; }
.legend .swatch.tri {
  width: 0; height: 0; background: none !important;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid currentColor;
}

/* moments list */
.moments { margin-top: 36px; }
.moments h3 { font-size: 18px; margin-bottom: 14px; }
.moment {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
}
.moment:last-child { border-bottom: none; }
.moment .m-min { font-family: var(--mono); font-size: 15px; font-weight: 700; }
.moment .m-what { font-size: 14.5px; }
.moment .m-what .conf { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-left: 8px; }
.moment .m-delta { font-family: var(--mono); font-size: 15px; font-weight: 700; white-space: nowrap; }
.moment .m-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.moment .m-bar i { display: block; height: 100%; background: var(--pitch); border-radius: 2px; }

/* table view (accessibility relief) */
.table-view { margin-top: 28px; }
.table-view summary { cursor: pointer; font-size: 14px; color: var(--ink-2); font-family: var(--mono); }
.table-view table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }
.table-view th, .table-view td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table-view th { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-3); font-weight: 500; }

/* context: form + h2h */
.context { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 48px 0; }
.form-panel { margin-bottom: 22px; }
.form-panel .fp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.form-panel .fp-head img { width: 26px; height: 26px; object-fit: contain; }
.form-panel .fp-head strong { font-size: 15px; }
.form-game {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.form-game .fg-score { font-family: var(--mono); }
.form-game .fg-r { font-family: var(--mono); font-weight: 700; width: 16px; text-align: center; }
.form-game .fg-r.w { color: var(--pitch); }
.form-game .fg-r.l { color: var(--k-red); }
.form-game .fg-r.d { color: var(--ink-3); }
.h2h-list { list-style: none; }
.h2h-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-2);
}
.h2h-list .h2h-score { font-family: var(--mono); font-weight: 700; color: var(--ink); }

footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  font-size: 12.5px;
  color: var(--ink-3);
}

@media (max-width: 720px) {
  .explainer, .stat-row, .context { grid-template-columns: 1fr 1fr; }
  .fixture { grid-template-columns: 1fr; gap: 26px; }
  .score { font-size: 42px; }
}
@media (max-width: 460px) {
  .explainer, .stat-row, .context { grid-template-columns: 1fr; }
}
