:root {
  --gold: #ffc100;
  --gold-soft: rgba(255, 193, 0, 0.22);
  --black: #070707;
  --panel: #121212;
  --ink: #f7f7f7;
  --muted: #c9c9c9;
  --line: rgba(255, 193, 0, 0.38);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--black);
  color: var(--ink);
  overflow: hidden;
}

body {
  font-family: Manrope, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background:
    radial-gradient(900px 280px at 0% -10%, rgba(255, 193, 0, 0.16), transparent 55%),
    repeating-linear-gradient(-16deg, #080808 0 14px, #0d0d0d 14px 15px);
}

button, input { font: inherit; }

button {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

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

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

h1, h2, .brand-name, .card-title, .gold-btn, .ghost-btn, .kicker, .index-badge {
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-style: italic;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(34px, 11vw, 60px);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: 0.01em;
}

h2 { margin: 0 0 8px; font-size: clamp(26px, 7vw, 36px); line-height: 0.92; }

p { margin: 0 0 10px; }

.shell {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: rgba(7, 7, 7, 0.94);
  border-bottom: 2px solid var(--gold);
}

.brand-lockup { min-width: 0; }

.brand-kicker, .kicker {
  margin: 0;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-style: italic;
  text-transform: uppercase;
  font-family: "Barlow Condensed", Impact, sans-serif;
}

.brand-name {
  margin: 0;
  font-size: clamp(20px, 6vw, 30px);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0.02em;
}

.marks-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-width: 64px;
  min-height: 42px;
  padding: 4px 10px;
  border: 0;
  background: var(--gold);
  color: #111;
  line-height: 1;
}

.marks-value {
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-style: italic;
  font-weight: 800;
  font-size: 22px;
}

.marks-word {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.view { padding: 14px 14px 22px; display: flex; flex-direction: column; gap: 12px; }

.sideline {
  flex: 0 0 auto;
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  background: #050505;
  border-top: 3px solid var(--gold);
}

.sideline::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 16px;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 8px, transparent 8px 14px);
  opacity: 0.85;
  pointer-events: none;
}

.sideline button {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 52px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.nav-mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: #050505;
}

.sideline button:nth-child(3) .nav-mark { width: 18px; height: 18px; }

.sideline button.active .nav-mark {
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}

.nav-label {
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

.sideline button.active .nav-label { color: var(--gold); }

body.is-playing .topbar,
body.is-playing .sideline { display: none; }

body.is-playing #main { overflow: hidden; }

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transform-origin: center;
  animation: drift 18s ease-in-out infinite alternate;
}

.hero-player {
  display: none;
  position: absolute;
  right: 0;
  top: 0;
  height: 62%;
  width: auto;
  max-width: 46%;
  object-fit: contain;
  object-position: right top;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, #000 45%, transparent 96%);
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 18px 14px 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.94) 10%, rgba(0, 0, 0, 0.15) 100%);
}

.lede { color: var(--muted); font-size: 14px; }

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

.muted { color: var(--muted); }

.stack { display: flex; flex-direction: column; gap: 10px; }

.gold-btn, .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 2px;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 18px;
  line-height: 1.1;
  text-align: center;
}

.gold-btn {
  border: 0;
  color: #141414;
  background: linear-gradient(110deg, #ffc100 0%, #ffc100 42%, #ffe59a 50%, #ffc100 58%, #e0a800 100%);
  background-size: 220% 100%;
  animation: sheen 4.2s linear infinite;
}

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

.gold-btn:active, .ghost-btn:active { transform: translateY(1px); }

button:disabled { opacity: 0.45; }

.panel {
  position: relative;
  background: linear-gradient(180deg, #171717, #101010);
  border: 1px solid var(--gold-soft);
  padding: 12px 12px 12px 16px;
}

.panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gold);
}

.card-title { margin: 0; font-size: clamp(22px, 6vw, 30px); line-height: 0.95; }

.stat-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  background: #0c0c0c;
}

.stat-cell {
  min-width: 0;
  padding: 10px;
  border-right: 1px solid var(--gold-soft);
  border-bottom: 1px solid var(--gold-soft);
}

.stat-cell span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-cell strong {
  display: block;
  margin-top: 2px;
  color: var(--gold);
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-style: italic;
  font-weight: 800;
  font-size: clamp(26px, 8vw, 36px);
  line-height: 0.9;
}

.route { display: flex; flex-direction: column; gap: 10px; }

.route-top { display: flex; align-items: center; gap: 8px; min-width: 0; }

.index-badge {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 2px 4px;
  background: var(--gold);
  color: #141414;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.chip {
  border: 1px solid var(--line);
  color: var(--gold);
  padding: 3px 7px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: #0c0c0c;
}

.switcher button {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: white;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-style: italic;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 15px;
}

.switcher button.active { background: var(--gold); color: #141414; }

.locker-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

.locker-card { padding: 0 0 12px; overflow: hidden; }

.locker-card .card-copy { padding: 10px 12px 0 16px; }

.card-art {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0a0a0a;
}

.art-pulse { animation: pulseglow 1.6s ease-in-out infinite; }

.loadout {
  display: grid;
  grid-template-columns: 46px 46px 46px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  background: #101010;
  color: white;
  text-align: left;
}

.loadout img { width: 46px; height: 46px; object-fit: cover; }

.loadout span { font-size: 13px; line-height: 1.25; }

.steps { display: flex; flex-direction: column; gap: 8px; }

.step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.step b {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--gold);
  color: #141414;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-style: italic;
  font-size: 20px;
}

.diagram {
  position: relative;
  height: 150px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(to top, rgba(255, 193, 0, 0.08), transparent 40%),
    #0c0c0c;
}

.diagram-ball {
  position: absolute;
  left: 14%;
  bottom: 18px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #141414;
  border: 2px solid var(--gold);
  box-shadow: 0 0 10px rgba(255, 193, 0, 0.45);
}

.diagram-arc {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 30px;
  height: 78px;
  border: 2px dashed rgba(255, 255, 255, 0.75);
  border-bottom: 0;
  border-radius: 90px 90px 0 0;
}

.diagram-gate {
  position: absolute;
  top: 18px;
  right: 16%;
  width: 58px;
  height: 26px;
  border: 2px solid var(--gold);
  box-shadow: 0 0 14px rgba(255, 193, 0, 0.55);
}

.guide-figure {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.run-list { display: flex; flex-direction: column; gap: 8px; }

.run-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  border-bottom: 1px solid rgba(255, 193, 0, 0.16);
  padding-bottom: 6px;
}

.run-row b { color: var(--gold); flex: 0 0 auto; }

.game-view {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #050505;
}

.game-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px;
}

.game-bar button {
  flex: 0 0 auto;
  max-width: 32%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-style: italic;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.game-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  text-align: center;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 0 10px 4px;
}

.game-hud span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: var(--gold);
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-style: italic;
  letter-spacing: 0.04em;
  font-size: 16px;
}

.game-hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 12px 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.game-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

#lane-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background: #070707;
}

.float-card {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  max-height: min(320px, 74%);
  overflow: auto;
  padding: 12px;
  background: rgba(7, 7, 7, 0.94);
  border: 1px solid var(--gold);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.float-card[hidden] { display: none !important; }

.result-actions, .pair { display: flex; flex-direction: column; gap: 8px; }

.noscript {
  padding: 16px;
}

@keyframes drift {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

@keyframes sheen {
  from { background-position: 100% 0; }
  to { background-position: -80% 0; }
}

@keyframes pulseglow {
  from { filter: saturate(1) brightness(1); }
  to { filter: saturate(1.3) brightness(1.25); }
}

@media (min-width: 390px) {
  .hero-player { display: block; }
}

@media (min-width: 420px) {
  .stat-board { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .locker-grid { grid-template-columns: 1fr 1fr; }
  .mode-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .result-actions { flex-direction: row; }
  .result-actions > * { flex: 1; }
}

@media (min-width: 760px) {
  .shell {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

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