:root {
  color-scheme: dark;
  --ink: #080a0b;
  --surface: #111719;
  --surface-raised: #182023;
  --line: #344044;
  --line-soft: #20292c;
  --text: #f5f6f3;
  --muted: #aab7b4;
  --red: #ff6268;
  --yellow: #f6ca57;
  --cyan: #5cd5e6;
  --green: #64d69f;
  --blue: #6b94ff;
  --wrap: 1320px;
}

* { box-sizing: border-box; }

html { background: var(--ink); scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a { color: inherit; }

.wrap {
  width: min(var(--wrap), calc(100% - 48px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border: 1px solid var(--cyan);
  background: var(--ink);
  color: var(--text);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(8, 10, 11, 0.94);
}

.header-bar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  text-transform: uppercase;
}

nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 26px;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link[aria-current="page"] { color: var(--text); }

.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--cyan);
}

.hero {
  position: relative;
  min-height: 610px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #050607;
}

.hero-image,
.hero-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-image {
  object-fit: cover;
  object-position: center 42%;
  opacity: 0.66;
  filter: saturate(1.12) contrast(1.08);
}

.hero-shade { background: rgba(4, 6, 7, 0.74); }

.hero-content {
  position: relative;
  z-index: 2;
  padding-block: 78px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--green);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 930px;
  margin: 0;
  font-size: 72px;
  line-height: 0.98;
  letter-spacing: 0;
}

h1,
h2,
h3 { text-wrap: balance; }

h1 span { color: var(--cyan); }

.hero-lede {
  max-width: 650px;
  margin: 24px 0 0;
  color: #d3dcda;
  font-size: 17px;
}

.hero-lede strong { color: var(--red); }

.scoreline {
  max-width: 830px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 34px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 10, 11, 0.76);
}

.scoreline div { padding: 16px 18px; }
.scoreline div + div { border-left: 1px solid rgba(255, 255, 255, 0.17); }

.scoreline dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.scoreline dd {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.scoreline div:first-child dd { color: var(--yellow); }
.scoreline div:last-child dd { color: var(--green); }

.trajectory-section,
.composite-section { padding-block: 72px 88px; }

.composite-section {
  border-top: 1px solid var(--line-soft);
  background: #0b0e0f;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 24px;
}

.section-head h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.section-head > p {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.trajectory-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(360px, 0.86fr);
  gap: 18px;
  align-items: stretch;
}

.game-screen,
.controller-panel,
.timeline-panel,
.composite-screen {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.game-screen { display: flex; flex-direction: column; background: #000; }

.game-screen video {
  width: 100%;
  aspect-ratio: 598 / 438;
  display: block;
  flex: 1;
  background: #000;
  object-fit: contain;
}

.game-caption {
  min-height: 49px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 15px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.one-player {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  margin-right: 7px;
  border: 1px solid #ff9ca0;
  border-radius: 3px;
  background: var(--red);
  color: #1b0809;
  font-size: 11px;
}

.controller-panel { padding: 15px; }

.controller-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
}

.controller-heading p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.controller-heading span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.controller-heading span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.controller-photo {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 3870 / 3810;
  border: 1px solid #c8ccca;
  border-radius: 4px;
  background: #fff;
}

.controller-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.stick-range,
.stick-position,
.button-hit {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.stick-range {
  left: 50.95%;
  top: 54.4%;
  width: 13.8%;
  aspect-ratio: 1;
  border: 2px solid rgba(8, 10, 11, 0.34);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.stick-position {
  left: 50.95%;
  top: 54.4%;
  width: 4.8%;
  aspect-ratio: 1;
  border: 2px solid #062d34;
  border-radius: 50%;
  background: rgba(92, 213, 230, 0.84);
  box-shadow: 0 0 0 4px rgba(92, 213, 230, 0.25);
  transform: translate(-50%, -50%);
}

.button-hit {
  aspect-ratio: 1;
  border: 4px solid transparent;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: border-color 70ms linear, box-shadow 70ms linear;
}

.button-hit.active { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.66); }
.button-a { left: 75.0%; top: 42.0%; width: 9.2%; }
.button-b { left: 68.2%; top: 35.4%; width: 8.4%; }
.button-c-up { left: 82.25%; top: 23.9%; width: 7.1%; }
.button-c-down { left: 82.25%; top: 35.3%; width: 7.1%; }
.button-c-left { left: 76.6%; top: 29.6%; width: 7.1%; }
.button-c-right { left: 87.9%; top: 29.6%; width: 7.1%; }
.button-start { left: 50.8%; top: 31.9%; width: 6.2%; }
.button-a.active { border-color: var(--blue); }
.button-b.active { border-color: var(--green); }
.button-c-up.active,
.button-c-down.active,
.button-c-left.active,
.button-c-right.active { border-color: var(--yellow); }
.button-start.active { border-color: var(--red); }

.stick-state {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin-top: 13px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.stick-state > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stick-state span { color: var(--muted); }

.stick-state b { font-weight: 750; white-space: nowrap; }

.button-state-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 13px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.button-state {
  min-width: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-rows: 18px 15px;
  column-gap: 7px;
  align-items: center;
  padding: 6px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #0b0f10;
  transition: border-color 70ms linear, background-color 70ms linear;
}

.button-token {
  grid-row: 1 / -1;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 850;
  line-height: 1;
}

.button-state > span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 9px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button-state > b {
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  text-transform: uppercase;
  white-space: nowrap;
}

.button-state.active {
  border-color: var(--yellow);
  background: #24200f;
}

.button-state.active > b { color: var(--yellow); }
.button-state.active .token-a { color: var(--blue); }
.button-state.active .token-b { color: var(--green); }
.button-state.active .token-z { color: var(--red); }
.button-state.active .token-c { color: var(--yellow); }
.button-state.active .token-start,
.button-state.active .token-shoulder,
.button-state.active .token-dpad { color: var(--cyan); }
.token-start,
.token-shoulder,
.token-dpad { border-radius: 3px; }

.telemetry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.telemetry > div { padding: 13px 15px; }
.telemetry > div + div { border-left: 1px solid var(--line); }

.telemetry span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.telemetry b {
  display: block;
  margin-top: 2px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.mario-value { color: var(--red); }
.opponent-value { color: var(--yellow); }

.timeline-panel { margin-top: 18px; padding: 14px 16px 16px; }

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.timeline-head h3 { margin: 0; font-size: 13px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; }

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.swatch { width: 9px; height: 9px; display: inline-block; border-radius: 2px; }
.swatch-a { background: var(--blue); }
.swatch-b { background: var(--green); }
.swatch-c { background: var(--yellow); }
.swatch-z { background: var(--red); }
.swatch-dealt { background: var(--green); }
.swatch-taken { background: var(--red); }

#roll {
  width: 100%;
  height: 154px;
  display: block;
  cursor: pointer;
  touch-action: none;
}

#roll:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

.composite-screen { background: #000; }

.composite-screen video {
  width: 100%;
  aspect-ratio: 1624 / 720;
  display: block;
  background: #000;
}

.site-footer { border-top: 1px solid var(--line-soft); }

.footer-bar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.footer-bar p { margin: 0; }
.footer-bar a { color: var(--green); text-decoration: none; }
.footer-bar a:hover,
.footer-bar a:focus-visible { text-decoration: underline; }
.photo-credit { text-align: center; }

@media (max-width: 980px) {
  .trajectory-grid { grid-template-columns: 1fr; }
  .controller-panel { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(260px, 1fr); gap: 0 18px; }
  .controller-heading { grid-column: 1 / -1; }
  .stick-state { align-content: start; margin-top: 0; }
  .button-state-grid { grid-column: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .wrap { width: min(100% - 24px, var(--wrap)); }
  .header-bar { min-height: 56px; gap: 16px; }
  nav { gap: 14px; }
  .nav-link { font-size: 11px; }
  .hero { min-height: 590px; }
  .hero-content { padding-block: 56px; }
  h1 { font-size: 48px; }
  .hero-lede { font-size: 15px; }
  .scoreline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scoreline div:nth-child(3) { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.17); }
  .scoreline div:nth-child(4) { border-top: 1px solid rgba(255, 255, 255, 0.17); }
  .trajectory-section,
  .composite-section { padding-block: 52px 62px; }
  .section-head { display: block; }
  .section-head > p { margin-top: 8px; }
  .section-head h2 { font-size: 29px; }
  .controller-panel { display: block; }
  .stick-state { margin-top: 13px; }
  .button-state-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .telemetry > div:nth-child(4) { border-top: 1px solid var(--line); }
  .timeline-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .footer-bar { min-height: 0; align-items: flex-start; flex-direction: column; padding-block: 24px; gap: 10px; }
  .photo-credit { text-align: left; }
}

@media (max-width: 420px) {
  .brand { font-size: 11px; }
  nav { gap: 10px; }
  h1 { font-size: 42px; }
  .stick-state { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
