:root {
  --gold: #f5c518;
  --gold-hot: #fff1b8;
  --gold-deep: #a67c12;
  --ink: #070605;
  --panel: rgba(16, 14, 11, 0.92);
  --ivory: #f6f1e6;
  --muted: #b7ab96;
  --line: rgba(245, 197, 24, 0.38);
  --danger: #e15a3c;
  --font-display: "Big Shoulders Display", Impact, sans-serif;
  --font-body: Outfit, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  background: var(--ink);
  color: var(--ivory);
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: clamp(15px, 3.6vw, 17px);
  line-height: 1.45;
  background-image:
    radial-gradient(ellipse 90% 42% at 50% -8%, rgba(245, 197, 24, 0.16), transparent 58%),
    linear-gradient(180deg, rgba(245, 197, 24, 0.035) 1px, transparent 1px);
  background-size: auto, 100% 32px;
}

img { max-width: 100%; display: block; }

button, a { -webkit-tap-highlight-color: transparent; }

button, input { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.page {
  width: min(100%, 560px);
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

.mast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 8px;
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.diamond {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  transform: rotate(45deg);
  background: linear-gradient(180deg, var(--gold-hot), var(--gold) 46%, var(--gold-deep));
  color: #1a1203;
  box-shadow: 0 0 16px rgba(245, 197, 24, 0.35);
}

.diamond span {
  transform: rotate(-45deg);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
}

button, .gold-btn, .ghost-btn { touch-action: manipulation; }

.mark-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(22px, 7.2vw, 34px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 0.9;
  background: linear-gradient(180deg, #fff6cf, var(--gold) 48%, #8d6410);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mast-chip {
  margin: 0;
  max-width: 42vw;
  padding: 6px 8px;
  border: 1px solid var(--line);
  color: var(--gold-hot);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sideline {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid rgba(245, 197, 24, 0.16);
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(245, 197, 24, 0.07) 22px 23px),
    #0c0b09;
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}

.sideline::-webkit-scrollbar { display: none; }

.sideline a {
  flex: 0 0 auto;
  min-width: 74px;
  padding: 8px 12px 10px;
  text-decoration: none;
  color: var(--ivory);
  position: relative;
}

.sideline b {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.sideline span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(246, 241, 230, 0.72);
}

.sideline a[data-page="drive"] {
  background: linear-gradient(180deg, rgba(245, 197, 24, 0.16), transparent);
}

.sideline a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}

.hero {
  position: relative;
  min-height: min(78dvh, 680px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 6, 5, 0.15), rgba(7, 6, 5, 0.2) 40%, #070605 96%),
    radial-gradient(ellipse at 50% 0%, rgba(255, 214, 120, 0.22), transparent 46%);
}

.hero-copy, .block, .setup, .stack {
  position: relative;
  padding: 8px 14px 22px;
}

.hero-copy { padding-bottom: 28px; }

.eyebrow, .veil .eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, h3, p { overflow-wrap: break-word; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 0.92;
  margin: 0 0 10px;
}

h1 { font-size: clamp(40px, 12vw, 76px); max-width: 12ch; }

h2 { font-size: clamp(28px, 8vw, 40px); }

.lede, .plate p, .stack p { color: var(--muted); }

.lede { max-width: 38ch; margin-top: 0; }

.actions, .veil-actions, .bowl-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gold-btn, .ghost-btn, .act, .lane-set button, .drive-card, .choice-row button, .match-bar button, .veil-actions button {
  cursor: pointer;
  text-decoration: none;
  border: 0;
}

.gold-btn, .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.gold-btn {
  background: linear-gradient(180deg, var(--gold-hot), var(--gold) 42%, var(--gold-deep));
  color: #1a1203;
}

.ghost-btn {
  background: transparent;
  color: var(--gold-hot);
  border: 1px solid var(--line);
}

.trio, .split, .pick-grid {
  display: grid;
  gap: 10px;
}

.plate {
  background: var(--panel);
  border: 1px solid rgba(245, 197, 24, 0.28);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  padding: 14px;
  min-width: 0;
}

.plate h2 { font-size: clamp(26px, 7vw, 34px); }

.route-board {
  margin: 0 14px 18px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #0c0b09;
  overflow: hidden;
}

.route-board svg { width: 100%; height: auto; display: block; }

.drive-row, #home-drives {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 14px 12px;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

.drive-row::-webkit-scrollbar, #home-drives::-webkit-scrollbar { display: none; }

#home-drives { margin: 0; }

.drive-card {
  flex: 0 0 148px;
  scroll-snap-align: start;
  min-height: 112px;
  padding: 10px;
  text-align: left;
  color: var(--ivory);
  background: #120f0b;
  border: 1px solid rgba(245, 197, 24, 0.24);
  text-decoration: none;
}

.drive-card b {
  display: block;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 22px;
}

.drive-card strong, .drive-card em { display: block; }

.drive-card em {
  margin-top: 6px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.drive-card.is-on {
  background: linear-gradient(180deg, rgba(245, 197, 24, 0.28), #17140e);
  border-color: var(--gold);
}

.drive-card.is-locked { opacity: 0.45; }

.drive-card.is-done { box-shadow: inset 3px 0 0 var(--gold); }

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  padding: 0 14px;
}

.section-head a { color: var(--gold); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }

.split { padding: 0 14px 18px; }

.portrait, .bowl-card img, .redline-scene, .kit-hero {
  width: 100%;
  object-fit: cover;
}

.portrait { height: clamp(220px, 62vw, 380px); object-position: center 18%; }

.bowl-card img, .redline-scene, .kit-hero { height: clamp(160px, 46vw, 250px); }

.athlete-card, .bowl-card { padding: 0 0 14px; overflow: hidden; }

.athlete-card div, .bowl-card div { padding: 12px 14px 0; }

.bars { display: grid; gap: 6px; margin: 10px 0 12px; }

.bars span { display: grid; grid-template-columns: 78px 1fr; gap: 8px; align-items: center; }

.bars em { font-style: normal; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.bars b {
  display: block;
  height: 7px;
  background: linear-gradient(90deg, var(--gold), var(--gold-hot)) 0 0 / var(--bar) 100% no-repeat, rgba(255, 255, 255, 0.08);
}

.lock-line { margin: 8px 0 0; color: var(--gold); }

.choice-row { display: flex; flex-wrap: wrap; gap: 6px; }

.choice-row button, .match-bar button, .veil-actions button, .act, .lane-set button {
  min-height: 44px;
  background: #16130e;
  border: 1px solid rgba(245, 197, 24, 0.28);
  color: var(--ivory);
}

.choice-row button {
  flex: 1 1 calc(50% - 6px);
  min-width: 0;
  padding: 8px;
}

.choice-row button.is-on, .lane-set button.is-on {
  background: var(--gold);
  color: #1a1203;
  border-color: var(--gold);
}

.choice-row button:disabled, .drive-card:disabled { cursor: default; }

.snap-bar {
  position: sticky;
  bottom: 0;
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(7, 6, 5, 0), #070605 28%);
}

.snap-bar .gold-btn { width: 100%; }

.note {
  margin: 8px 0;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.match { position: relative; min-height: 0; }

.match-bar, .deck, .hud {
  display: grid;
  gap: 6px;
  padding-left: 8px;
  padding-right: 8px;
}

.match-bar {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  padding-top: 8px;
}

.match-bar strong, .match-bar span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.match-bar span { color: var(--gold); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

.match-bar button { padding: 8px 10px; font-family: var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; }

.stage {
  position: relative;
  min-height: 0;
  flex: 1;
  touch-action: none;
  background: #07140f;
}

#field { width: 100%; height: 100%; display: block; }

.hud {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 8px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent);
}

.hud-yard strong, .hud-life strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(28px, 8vw, 42px);
  line-height: 0.85;
  color: var(--gold-hot);
}

.hud span, .hud em {
  color: var(--ivory);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-style: normal;
}

.hud-mid { text-align: center; min-width: 0; }

#hud-call {
  display: block;
  color: var(--gold);
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pips { display: flex; justify-content: center; gap: 5px; margin-top: 4px; }

.pips i, #hud-break {
  width: 9px;
  height: 9px;
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(45deg);
}

.pips i.is-on { background: var(--gold); box-shadow: 0 0 8px var(--gold); }

#hud-break[hidden] { display: none; }

#hud-break {
  display: inline-block;
  width: auto;
  height: auto;
  margin-top: 4px;
  padding: 2px 6px;
  transform: none;
  background: var(--gold);
  color: #1a1203;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.deck {
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: stretch;
  padding-top: 8px;
  padding-bottom: 4px;
}

.act, .lane-set button { position: relative; overflow: hidden; }

.act {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.act i {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: calc(var(--ready, 0) * 100%);
  background: rgba(245, 197, 24, 0.32);
  pointer-events: none;
}

.act span { position: relative; z-index: 1; }

.lane-set { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }

.lane-set button {
  font-family: var(--font-display);
  font-size: 18px;
}

.play-note { margin: 0; padding: 0 10px 8px; font-size: 12px; }

.veil {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(5, 4, 3, 0.78);
  overflow: auto;
}

.veil[hidden] { display: none; }

.veil .plate { width: min(100%, 380px); max-height: 100%; overflow: auto; }

.veil-actions { display: grid; margin-top: 8px; }

.veil-actions button, #clear-ledger {
  width: 100%;
  min-height: 46px;
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scoreline { color: var(--gold-hot); font-family: var(--font-display); font-size: 28px; line-height: 1; }

.kit-hero { object-fit: cover; }

.kit-top { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: center; }

.swatch {
  width: 72px;
  height: 72px;
  background:
    linear-gradient(var(--stripe), var(--stripe)) 50% 18% / 8px 70% no-repeat,
    linear-gradient(180deg, var(--helmet), var(--helmet)) 0 0 / 100% 42% no-repeat,
    var(--jersey);
  border: 1px solid var(--line);
}

.kit-card .gold-btn, .athlete-card .gold-btn { margin-top: 8px; }

.stack { display: grid; gap: 12px; }

.ledger-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(245, 197, 24, 0.16);
}

.ledger-row b { color: var(--gold); font-family: var(--font-display); font-size: 24px; }

.ledger-row strong, .ledger-row em { display: block; }

.ledger-row em { color: var(--muted); font-style: normal; font-size: 12px; }

.ledger-row span { color: var(--gold-hot); font-size: 13px; text-align: right; }

.mini-field {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: 8px 0;
}

.mini-field i {
  height: 36px;
  background: rgba(255, 255, 255, 0.08);
}

.mini-field i.open { background: rgba(245, 197, 24, 0.85); }

.mini-field i.hot { background: rgba(225, 90, 60, 0.75); }

.mini-field i.dim { background: rgba(0, 0, 0, 0.65); border: 1px solid rgba(245, 197, 24, 0.3); }

.redline-scene {
  position: relative;
  background:
    radial-gradient(ellipse at 18% 0%, rgba(255, 200, 90, 0.8), transparent 28%),
    radial-gradient(ellipse at 82% 0%, rgba(255, 170, 70, 0.7), transparent 26%),
    linear-gradient(#1a0a0c, #2a120e 42%, #123224 42%, #0c2418);
  overflow: hidden;
}

.redline-scene span {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  background: rgba(255, 236, 190, 0.45);
}

.redline-scene span:nth-child(1) { top: 58%; }
.redline-scene span:nth-child(2) { top: 70%; background: #e15a3c; height: 3px; box-shadow: 0 0 12px #e15a3c; }
.redline-scene span:nth-child(3) { top: 82%; }

.bowl-links a, .bowl-links span {
  border: 1px solid var(--line);
  padding: 6px 8px;
  color: var(--gold-hot);
  text-decoration: none;
  font-size: 13px;
}

.bowl-links span { opacity: 0.45; }

.colophon {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 14px 28px;
  color: var(--muted);
  font-size: 13px;
}

.colophon a { color: var(--gold); }

.colophon p { margin: 0; }

button:disabled { opacity: 0.45; }

body.matching {
  overflow: hidden;
  height: 100dvh;
  overscroll-behavior: none;
}

body.matching .page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
}

body.matching .mast,
body.matching .sideline,
body.matching .colophon,
body.matching .setup { display: none; }

body.matching .match {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.setup .drive-row { padding-left: 0; padding-right: 0; }

.setup[hidden], .match[hidden] { display: none !important; }

@media (min-width: 420px) {
  .pick-grid { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1.1fr 0.9fr; }
}

@media (max-width: 359px) {
  .sideline a { min-width: 66px; padding: 7px 8px 9px; }
  .sideline span { letter-spacing: 0.08em; }
  .deck { grid-template-columns: 64px minmax(0, 1fr) 64px; }
  .bars span { grid-template-columns: 68px 1fr; }
}

@media (max-height: 680px) {
  .hero { min-height: 70dvh; }
  .play-note { display: none; }
  .act, .lane-set button, .match-bar button { min-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-shade { background: linear-gradient(180deg, rgba(7, 6, 5, 0.2), #070605 96%); }
}
