:root {
  --blue: #004d98;
  --garnet: #a50044;
  --gold: #edbb00;
  --ink: #050914;
  --panel: rgba(7, 11, 26, 0.78);
  --line: rgba(255, 255, 255, 0.1);
  --text: #e9edf6;
  --muted: #9aa4bb;
  --display: "Oswald", Impact, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 16px/1.6 "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* fallback when WebGL is unavailable */
body.no3d { background: radial-gradient(ellipse at 50% 0%, #0d2a5c 0%, var(--ink) 55%), var(--ink); background-attachment: fixed; }
a { color: inherit; }
.mono { font-family: var(--mono); }

#stadium { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }

/* ---- Intro overlay ---- */
#intro {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 12vh; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.65));
  transition: opacity .8s ease;
}
#intro .kicker { font: 500 14px var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin: 0; }
/* the name is on the stadium screen now; the caption stays for screen readers only */
#intro .walk { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#intro .kicker { margin-bottom: 1em; }
#skip {
  pointer-events: auto; cursor: pointer;
  background: rgba(255,255,255,.08); color: var(--text); border: 1px solid rgba(255,255,255,.3);
  padding: .5em 1.2em; border-radius: 999px; font: 500 14px "Inter", sans-serif;
}
#skip:hover, #skip:focus-visible { background: rgba(255,255,255,.18); }
#sound {
  position: fixed; left: 14px; bottom: 14px; z-index: 6; cursor: pointer;
  background: rgba(8,12,26,.72); color: var(--muted); border: 1px solid rgba(255,255,255,.18);
  padding: .45em 1em; border-radius: 999px; font: 500 12px "Inter", sans-serif; backdrop-filter: blur(6px);
}
#sound:hover, #sound:focus-visible { color: var(--text); background: rgba(20,28,52,.85); }
#sound[aria-pressed="true"] { color: var(--gold); border-color: rgba(237,187,0,.5); }
.no3d #sound { display: none; }
#sound .lbl::after { content: ": off"; }
#sound[aria-pressed="true"] .lbl::after { content: ": on"; }
@media (max-width: 760px) {
  #sound { width: 36px; height: 36px; padding: 0; font-size: 16px; left: auto; right: 12px; bottom: 12px; }
  #sound .lbl { display: none; }
}
body:not(.intro) #intro { opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility 0s .8s; }
body.intro { overflow: hidden; }
body.intro:not(.revealing) main, body.intro:not(.revealing) nav.top { opacity: 0; visibility: hidden; pointer-events: none; }
body.intro.revealing main, body.intro.revealing nav.top { visibility: visible; }
body.revealing #intro { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .5s ease, visibility 0s .5s; }

/* ---- Nav ---- */
nav.top {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  background: rgba(5,9,20,.7); backdrop-filter: blur(12px); border: 1px solid var(--line);
  transition: opacity .8s ease .3s;
  max-width: calc(100vw - 20px); overflow-x: auto; scrollbar-width: none;
}
nav.top a { text-decoration: none; font-size: 13px; color: var(--muted); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
nav.top a:hover, nav.top a:focus-visible { color: var(--text); background: rgba(255,255,255,.07); }
nav.top .brand { font-family: var(--display); color: var(--gold); letter-spacing: .05em; }

/* ---- Layout ---- */
main {
  position: relative; z-index: 2;
  max-width: 760px; margin: 0 auto; padding: 22vh 20px 80px;
  transition: opacity 1s ease .4s;
}
.panel {
  background: var(--panel);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 28px; margin-bottom: 44vh;
  scroll-margin-top: 80px;
}
.panel:last-of-type { margin-bottom: 40px; }
.panel p { margin: 0 0 .8em; }
h2 { font: 700 30px/1.1 var(--display); text-transform: uppercase; margin: 0 0 22px; letter-spacing: .01em; }
h2 span { display: block; font: 500 12px var(--mono); letter-spacing: .25em; color: var(--gold); margin-bottom: 6px; }
h3 { margin: 0; font-size: 17px; font-weight: 600; }
h3.sub { font: 500 12px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 28px 0 12px; }

/* ---- Scoreboard hero ---- */
.scoreboard { border-color: rgba(237,187,0,.35); box-shadow: 0 0 0 1px rgba(237,187,0,.1), 0 30px 80px rgba(0,0,0,.5); }
.board-head { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
.badge {
  flex: none; width: 76px; height: 76px; border-radius: 16px;
  display: grid; place-items: center;
  font: 700 28px var(--display); color: var(--gold); text-shadow: 0 2px 8px rgba(0,0,0,.5);
  background: repeating-linear-gradient(90deg, var(--blue) 0 15px, var(--garnet) 15px 30px);
  border: 2px solid var(--gold);
}
h1 { font: 700 clamp(34px, 6vw, 48px)/1 var(--display); margin: 0; letter-spacing: .02em; }
.role { color: var(--text); font-weight: 500; margin: 6px 0 2px !important; }
.meta { color: var(--muted); font-size: 13px; margin: 0 !important; }
.board-score {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: rgba(237,187,0,.25); border: 1px solid rgba(237,187,0,.35); border-radius: 10px; overflow: hidden;
  margin-bottom: 22px;
}
.board-score a { display: block; background: #0a0f1f; padding: 12px; text-align: center; text-decoration: none; color: inherit; }
.board-score a:hover, .board-score a:focus-visible { box-shadow: inset 0 0 0 1px var(--gold); outline: none; }
.board-score b { display: block; font-size: 30px; color: var(--gold); line-height: 1.1; text-shadow: 0 0 18px rgba(237,187,0,.45); }
.board-score span { display: block; font-size: 12px; letter-spacing: .04em; color: #c3cad8; line-height: 1.35; }
.lede { font-size: 20px; font-weight: 600; color: var(--text); margin: 18px 0 !important; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn {
  text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.05);
  transition: background .2s, border-color .2s, transform .2s;
}
.btn:hover, .btn:focus-visible { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); transform: translateY(-1px); }
.btn.gold { background: var(--gold); color: #1a1300; border-color: var(--gold); }
.btn.gold:hover, .btn.gold:focus-visible { background: #ffd23a; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---- Lineup pitch ---- */
.pitch {
  position: relative; aspect-ratio: 105 / 68; border-radius: 10px;
  background: repeating-linear-gradient(90deg, #2e7a31 0 9.09%, #36893a 9.09% 18.18%);
  border: 2px solid rgba(255,255,255,.75);
}
.line { position: absolute; border: 2px solid rgba(255,255,255,.55); }
.line.half { left: 50%; top: 0; bottom: 0; border-width: 0 0 0 2px; }
.line.circle { left: 50%; top: 50%; width: 17.4%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); }
.line.box { top: 20.4%; height: 59.2%; width: 15.7%; }
.line.box.l { left: -2px; } .line.box.r { right: -2px; }
.pl {
  position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); transform: translate(-50%, -50%);
  width: max-content; max-width: 96px; z-index: 1;
}
.pl.open { z-index: 5; }
.player {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%;
  background: none; border: 0; padding: 2px; border-radius: 8px; color: var(--text); cursor: pointer;
  font: 600 12px/1.15 "Inter", system-ui, sans-serif; text-align: center;
}
.fig { width: 40px; height: 60px; overflow: visible; filter: drop-shadow(0 3px 4px rgba(0,0,0,.45)); transition: transform .2s; }
.fig text { font: 700 14px var(--display); fill: var(--gold); text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: 1.5px; }
.player:hover .fig, .pl.open .fig { transform: translateY(-2px); }
.name { background: rgba(5,9,20,.78); border: 1px solid rgba(237,187,0,.35); border-radius: 5px; padding: 2px 6px; }
.pl.open .name { border-color: var(--gold); }
.pcard {
  position: absolute; width: 220px; padding: 10px 12px; border-radius: 10px;
  background: #0a1022; border: 1px solid var(--gold); box-shadow: 0 10px 24px rgba(0,0,0,.55);
  font-size: 13px; line-height: 1.4; color: #cdd3e1;
}
.pcard p { margin: 0 0 4px !important; }
.pcard p:last-child { margin: 0 !important; }
.pc-head { font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.pc-skill { font: 700 17px var(--display); color: var(--text); letter-spacing: .02em; }
.pcard a { color: var(--text); text-decoration-color: rgba(237,187,0,.6); }
.chips span {
  font-size: 13px; padding: 4px 11px; border-radius: 8px; white-space: nowrap;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
}

/* ---- Experience / education ---- */
.match { border-left: 3px solid var(--garnet); padding: 4px 0 4px 18px; margin-bottom: 26px; }
.match:last-child { margin-bottom: 0; }
.match header, .card header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.match header .mono { font-size: 12px; color: var(--gold); }
.pos { color: var(--muted); font-style: italic; margin: 2px 0 8px !important; }
ul { margin: 0; padding-left: 18px; }
li { margin-bottom: 6px; }
li::marker { color: var(--gold); }

/* ---- Project cards ---- */
.card {
  scroll-margin-top: 80px;
  border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 16px;
  background: linear-gradient(160deg, rgba(0,77,152,.18), rgba(165,0,68,.1));
  transition: border-color .25s, transform .25s;
}
.card:hover { border-color: rgba(237,187,0,.4); transform: translateY(-2px); }
.card h3 { font: 700 22px var(--display); letter-spacing: .02em; }
.tag { font: 500 12px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px !important; }
.chip-status { font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; text-decoration: none; }
.chip-status.link:hover, .chip-status.link:focus-visible { color: var(--text); border-color: rgba(255,255,255,.35); }
.card header .links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip-status.demo { color: var(--gold); border-color: rgba(237,187,0,.45); }
.chip-status.demo:hover, .chip-status.demo:focus-visible { color: #0b1020; background: var(--gold); border-color: var(--gold); }
.card > p:not(.tag):not(.chips) { color: #cdd3e1; margin-top: 10px !important; }
.card > p.result:not(.tag):not(.chips) { color: var(--gold); font-weight: 600; font-size: 15px; margin: 10px 0 0; }
.card ul { margin-bottom: 14px; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 !important; }
.chips span { font-size: 12px; padding: 4px 10px; }
.more { list-style: none; padding: 0; }
.more li { color: var(--muted); font-size: 15px; }
.more a { color: var(--text); font-weight: 600; margin-right: 6px; }

.cabinet { list-style: none; padding: 0; margin-bottom: 28px; display: grid; gap: 10px; }
.cabinet li { padding: 12px 14px 12px 44px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid var(--line); position: relative; color: #cdd3e1; }
.cabinet li::before { content: "🏆"; position: absolute; left: 14px; top: 12px; }
.cabinet b { display: block; color: var(--text); }

footer { text-align: center; color: var(--muted); font-size: 14px; padding: 20px 0 40px; }
#replay { background: none; border: 0; color: var(--gold); cursor: pointer; font: inherit; text-decoration: underline; }

@media (max-width: 600px) {
  main { padding-top: 16vh; }
  .panel { padding: 20px; margin-bottom: 30vh; }
  .pitch { aspect-ratio: 105 / 110; }
  .pl { max-width: 62px; }
  .pl.gk { left: 3px; max-width: 52px; transform: translateY(-50%); } /* keeps the keeper's name strip inside a 293px pitch */
  .player { font-size: 11px; padding: 1px; }
  .fig { width: 27px; height: 40px; }
  .name { padding: 1px 3px; }
  .pcard { width: 200px; }
  .board-score { grid-template-columns: repeat(2, 1fr); }
  .board-score b { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
