/* ---------- fonts ---------- */
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-style: normal; font-display: swap; src: url('fonts/barlow-condensed-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-style: normal; font-display: swap; src: url('fonts/barlow-condensed-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/barlow-condensed-700.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-style: normal; font-display: swap; src: url('fonts/inter-600.woff2') format('woff2'); }

/* ---------- tokens ---------- */
:root {
  --night: #0b0e14;        /* stadium night — page + ocean */
  --land: #171c26;         /* non-qualified land */
  --line: #2a3140;         /* borders, hairlines */
  --panel: #10141dee;      /* HUD / deck panels */
  --gold: #e2b95c;         /* trophy gold — the one accent */
  --ink: #e8ebf2;          /* primary text */
  --ink-dim: #8b93a3;      /* secondary text */
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --ui: 'Inter', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- HUD header ---------- */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 28px 0;
  pointer-events: none;
  z-index: 10;
}

.eyebrow {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
}

.hud h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 54px;
  line-height: .95;
  letter-spacing: .01em;
  text-transform: uppercase;
}

.hud-count { text-align: right; }

.count-num {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 64px;
  line-height: .9;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.count-label {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* ---------- map ---------- */
#mapWrap { flex: 1; position: relative; min-height: 0; }

#map { width: 100%; height: 100%; display: block; cursor: grab; }
#map:active { cursor: grabbing; }

.unit {
  fill: var(--land);
  stroke: var(--line);
  stroke-width: .5;
  vector-effect: non-scaling-stroke;
}

.team {
  stroke: #cfd6e4;
  stroke-width: .7;
  stroke-opacity: .55;
  vector-effect: non-scaling-stroke;
  transition: filter .7s ease, opacity .7s ease;
  cursor: pointer;
}

.team.out {
  /* almost the didn't-qualify look — flag stays as a faint ghost */
  filter: grayscale(1) brightness(.26) saturate(0);
  opacity: .13;
  stroke-opacity: .08;
}

.pin { transition: filter .7s ease, opacity .7s ease; cursor: pointer; }
.pin rect.frame { fill: none; stroke: #cfd6e4; stroke-opacity: .75; stroke-width: 1; }
.pin.out { filter: grayscale(1) brightness(.26) saturate(0); opacity: .15; }

.legend {
  position: absolute;
  left: 28px;
  bottom: 10px;
  font-size: 11.5px;
  color: var(--ink-dim);
  letter-spacing: .02em;
  pointer-events: none;
}

/* ---------- tooltip ---------- */
.tooltip {
  position: absolute;
  min-width: 150px;
  max-width: 240px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  pointer-events: none;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.tooltip .t-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.tooltip .t-group { color: var(--gold); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; margin-top: 1px; }
.tooltip .t-status { color: var(--ink-dim); font-size: 12px; margin-top: 5px; line-height: 1.45; }
.tooltip .t-status.alive { color: var(--ink); }

/* ---------- timeline deck ---------- */
.deck {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 auto 18px;
  padding: 14px 18px;
  width: min(1060px, calc(100% - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.play {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .2s ease;
}
.play svg { fill: currentColor; }
.play:hover { background: #e2b95c22; }
.play:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.play .icon-pause { display: none; }
.play.playing .icon-pause { display: block; }
.play.playing .icon-play { display: none; }

.deck-track {
  position: relative;
  flex: 1;
  height: 58px;
  cursor: pointer;
  touch-action: none;
}

.stages { position: absolute; inset: 12px 0 14px; display: flex; }

.stage {
  position: relative;
  height: 100%;
  border-left: 1px solid var(--line);
  background: #1a2030;
}
.stage:first-child { border-left: none; border-radius: 6px 0 0 6px; }
.stage:last-child { border-radius: 0 6px 6px 0; }
.stage:nth-child(even) { background: #161c2a; }

.stage .s-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}

/* the halving: teams alive entering each stage */
.stage .s-count {
  position: absolute;
  top: -12px;
  left: -1px;
  transform: translateX(-50%);
  font-family: var(--display);
  font-weight: 600;
  font-size: 12px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.stage.tight .s-label { font-size: 11px; letter-spacing: .06em; }

.future {
  position: absolute;
  top: 12px; bottom: 14px; right: 0;
  background: repeating-linear-gradient(-45deg, transparent 0 5px, #0b0e1488 5px 10px);
  border-radius: 0 6px 6px 0;
  pointer-events: none;
}

.now-tick {
  position: absolute;
  top: 6px; bottom: 8px;
  width: 0;
  border-left: 1px dashed var(--gold);
  opacity: .8;
  pointer-events: none;
}

.playhead {
  position: absolute;
  top: 8px; bottom: 10px;
  width: 2px;
  margin-left: -1px;
  background: var(--gold);
  pointer-events: none;
}

.playhead::after {
  content: '';
  position: absolute;
  bottom: -5px; left: 50%;
  transform: translateX(-50%);
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px #e2b95c88;
}

.playhead-date {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hud { padding: 14px 16px 0; }
  .hud h1 { font-size: 34px; }
  .eyebrow { font-size: 12px; }
  .count-num { font-size: 42px; }
  .count-label { font-size: 12px; }
  .legend { display: none; }
  .stage .s-label { display: none; }
  .deck { margin-bottom: 10px; padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .team, .pin, .play { transition: none; }
}
