/* Hero: the full-screen character select. HUD on top, fighters flanking the grid, team docks at the bottom. */
.hero {
  --cell: clamp(64px, min(6.4vw, calc((100svh - 540px) / 4)), 104px);
  --cell-gap: 10px;
  position: relative; isolation: isolate;
  display: grid; grid-template-rows: auto 1fr auto;
  min-height: max(760px, 100svh);
  padding: 0 var(--gutter) 26px;
  overflow: hidden;
}

/* ---------- ambient ground ---------- */
.hero__bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.hero__halftone {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  animation: breathe 3s steps(8, end) infinite alternate;
}
.hero__speed {
  position: absolute; inset: -40% -30%; rotate: calc(var(--slash) * -1); opacity: .5;
}
.hero__speed::before {
  content: ''; position: absolute; inset: 0 -1200px 0 0;
  background-image: var(--speed-tile); background-size: 1200px 520px;
  animation: speed 2.4s linear infinite;
}
@keyframes speed { to { transform: translateX(-1200px); } }

/* ---------- HUD ---------- */
.hud {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  height: 78px; position: relative; z-index: 3;
}
.hud__side { display: flex; align-items: center; gap: 28px; }
.hud__side--end { justify-content: flex-end; }
.hud__brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.hud__credit { font-size: 12px; }
.hud__timer {
  position: relative; display: grid; justify-items: center; align-self: start;
  min-width: 124px; padding: 8px 18px 10px; background: var(--ink); color: var(--yellow);
  clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 18px 100%);
}
.hud__timer-label { font-size: 10px; color: var(--chalk); }
.hud__timer-num { font-size: 50px; line-height: .95; font-variant-numeric: tabular-nums; }
.hud__timer-num.is-tick { animation: tick calc(var(--frame) * 4) steps(2, end); }
.hud__timer-num.is-low { color: var(--p2); }
@keyframes tick { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
.hud__hi { display: flex; gap: 10px; align-items: baseline; font-size: 12px; }
.hud__hi b { font-weight: 400; font-size: 16px; }
.hud__store {
  font-size: 11px; text-decoration: none;
  padding: 7px 10px 6px; border: var(--line) solid var(--ink); background: var(--chalk);
}
.hud__store:hover { background: var(--ink); color: var(--yellow); }

/* ---------- stage ---------- */
.stage {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: clamp(20px, 2.4vw, 40px); align-items: stretch; min-height: 0;
}
.select {
  position: relative; z-index: 2; display: grid; align-content: start; justify-items: center; gap: 10px;
  padding-top: 4px;
}
.select__title {
  font-size: clamp(30px, 3.1vw, 46px); color: var(--ink); white-space: nowrap;
  text-shadow: 3px 3px 0 var(--chalk);
}
.select__lede {
  max-width: 52ch; padding: 2px 10px; text-align: center; font-size: 15px; line-height: 1.35; margin-bottom: 8px;
  background: var(--yellow);
}
.docks__mid { display: grid; justify-items: center; gap: 14px; align-self: end; }
.select__hint { display: flex; gap: 8px; font-size: 10px; }
.select__hint span { padding: 4px 8px 3px; background: var(--ink); color: var(--chalk); }
.hint-touch { display: none; }
@media (hover: none) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}

/* ---------- docks ---------- */
.docks {
  position: relative; z-index: 3;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 24px; padding-top: 18px;
}
.dock { display: grid; gap: 8px; }
.dock--p2 { justify-items: end; }
.dock__label {
  display: flex; gap: 10px; align-items: center; width: max-content; font-size: 11px;
  padding-right: 8px; background: var(--ink); color: var(--chalk);
}
.dock--p2 .dock__label { flex-direction: row-reverse; padding: 0 0 0 8px; }
.dock__label b { padding: 4px 7px 3px; color: var(--chalk); font-weight: 400; }
.dock__label [data-count] { color: var(--yellow); }
.dock--p1 .dock__label b { background: var(--p1); }
.dock--p2 .dock__label b { background: var(--p2); }
.dock__slots { display: flex; gap: 8px; }
.slot {
  --slot: clamp(50px, 4.3vw, 64px);
  position: relative; width: var(--slot); height: calc(var(--slot) + 22px);
  border: var(--line) solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  display: grid; grid-template-rows: 1fr 22px; overflow: hidden; color: var(--chalk);
}
.dock--p1 .slot { background: var(--p1); }
.dock--p2 .slot { background: var(--p2); }
.slot__art { grid-area: 1 / 1 / 2 / 2; background-color: var(--chalk); background-repeat: no-repeat; opacity: 0; }
.slot__role {
  grid-area: 1 / 1 / 3 / 2; display: grid; place-content: center; justify-items: center; gap: 4px; font-size: 10px;
}
.slot__name {
  grid-area: 2 / 1 / 3 / 2; display: grid; place-items: center; background: var(--ink); color: var(--chalk);
  font-size: 10px; font-stretch: 120%; white-space: nowrap; overflow: hidden;
}
.slot.is-filled .slot__art { opacity: 1; }
.slot.is-filled .slot__role { display: none; }
.dock--p1 .slot.is-filled .slot__name { background: var(--p1); }
.dock--p2 .slot.is-filled .slot__name { background: var(--p2); }

.cab--hero { --cap: 46px; }
.cab--hero .cab__text { font-size: 16px; }

/* ---------- flying head crop during a pick ---------- */
.ghost {
  position: fixed; z-index: 80; pointer-events: none; background-color: var(--chalk); background-repeat: no-repeat;
  border: var(--line) solid var(--ink); box-shadow: 6px 6px 0 var(--ink); transform-origin: 0 0;
}
.ghost--p1 { outline: 4px solid var(--p1); }
.ghost--p2 { outline: 4px solid var(--p2); }

/* ---------- slam-in when attract hands over ---------- */
.hero.is-live .stage,
.hero.is-live .hud,
.hero.is-live .docks { animation: slam-in calc(var(--frame) * 12) steps(4, end) both; }
.hero.is-live .docks { animation-delay: calc(var(--frame) * 4); }
@keyframes slam-in {
  0% { transform: scale(1.08); opacity: 0; }
  20% { opacity: 1; }
  50% { transform: scale(.985); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* html is the scroller (its overflow-x: clip stops body overflow reaching the viewport), so lock it there. */
body.is-vs { overflow: hidden; }
html:has(> body.is-vs) { overflow: hidden; }
/* The hero isolates its own stack, so the fixed VS inside it only beats later sections if the hero does too. */
body.is-vs .hero { z-index: 70; }
