:root {
  color-scheme: dark;
  --bg: #050a12;
  --panel: #0a111d;
  --panel-2: #111b29;
  --line: rgba(255, 255, 255, 0.13);
  --muted: #8d9aae;
  --text: #f7fbff;
  --cyan: #39e6ff;
  --blue: #1479ff;
  --orange: #ff5a1f;
  --gold: #ffd056;
  --green: #65f5a4;
  --track: #b5412f;
  --track-dark: #7d281f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, rgba(39, 98, 166, 0.28), transparent 45%),
    linear-gradient(180deg, #07111e 0%, #03070d 100%);
  font-family: Inter, "Arial Narrow", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button { font: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 32rem;
  height: 32rem;
  border-radius: 999px;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.13;
}

.ambient-one { top: -14rem; right: -10rem; background: var(--blue); }
.ambient-two { bottom: -20rem; left: -12rem; background: var(--orange); }

.app {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 2.6vw, 38px) 30px;
}

.runland-nav {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  padding: 0 4px;
}

.runland-nav a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(57,230,255,.26);
  border-radius: 999px;
  color: #d8f8ff;
  background: rgba(8,39,64,.58);
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
  transition: border-color .2s, background .2s, transform .2s;
}

.runland-nav a:hover { border-color: var(--cyan); background: rgba(10,67,103,.72); }
.runland-nav a:active { transform: scale(.98); }
.runland-nav strong { color: #6f8094; font-size: 10px; letter-spacing: .15em; }

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(410px, 1.45fr) minmax(120px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 76px;
  margin-bottom: 14px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #ff6a24, #e73615);
  clip-path: polygon(12% 0, 100% 0, 88% 100%, 0 100%);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 21px;
  font-style: italic;
  letter-spacing: -1px;
  text-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-size: 19px; font-weight: 900; letter-spacing: .08em; }
.brand-copy small { margin-top: 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .22em; }

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 64px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 13, 22, 0.72);
  box-shadow: inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(12px);
}

.score-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 7px;
  padding: 10px 14px;
  border-left: 1px solid var(--line);
}

.score-item:first-child { border-left: 0; }
.score-item span { grid-column: 1 / -1; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .18em; }
.score-item strong { justify-self: end; font-family: "Arial Narrow", Impact, sans-serif; font-size: clamp(24px, 2.2vw, 34px); font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: .85; }
.score-item small { color: #64738a; font-size: 9px; font-weight: 800; }
.score-time strong { color: var(--gold); text-shadow: 0 0 18px rgba(255, 208, 86, .2); }

.sound-button {
  justify-self: end;
  display: inline-flex;
  min-width: 112px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  color: #cbd5e2;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 21, 34, .72);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  transition: border-color .2s, color .2s, transform .2s;
}

.sound-button:hover { color: #fff; border-color: rgba(57,230,255,.48); }
.sound-button:active { transform: scale(.97); }
.sound-button[aria-pressed="false"] { color: #667286; }

.sound-bars { display: flex; height: 14px; align-items: center; gap: 2px; }
.sound-bars i { display: block; width: 2px; height: 45%; background: currentColor; animation: sound 1s ease-in-out infinite alternate; }
.sound-bars i:nth-child(2) { height: 100%; animation-delay: -.35s; }
.sound-bars i:nth-child(3) { height: 70%; animation-delay: -.7s; }
.sound-button[aria-pressed="false"] .sound-bars i { animation: none; height: 2px; }

@keyframes sound { to { height: 100%; } }

.game-frame {
  position: relative;
  min-height: clamp(430px, 57vw, 720px);
  max-height: 720px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 16px;
  background: #08101c;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,.03);
}

.game-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.18), transparent 12%, transparent 88%, rgba(0,0,0,.2));
  box-shadow: inset 0 0 80px rgba(0,0,0,.28);
}

.stadium-sky {
  position: absolute;
  inset: 0 0 44% 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(1, 10, 24, .1), #081c36 62%, #162a3c 100%),
    radial-gradient(ellipse at 50% 20%, #1b416f, #05101f 70%);
}

.stadium-sky::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.5) .7px, transparent .8px);
  background-size: 51px 51px;
  opacity: .14;
}

.stadium-ring {
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 12%;
  height: 64%;
  border: 18px solid rgba(110, 148, 183, .18);
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  transform: perspective(500px) rotateX(20deg);
  box-shadow: inset 0 10px 28px rgba(0,0,0,.38), 0 -2px rgba(255,255,255,.15);
}

.floodlight {
  position: absolute;
  z-index: 3;
  top: 4%;
  display: flex;
  gap: 4px;
  padding: 7px;
  border: 1px solid rgba(255,255,255,.3);
  background: #dceeff;
  box-shadow: 0 0 30px 10px rgba(195,228,255,.38), 0 0 100px 30px rgba(123,190,255,.18);
  transform: perspective(200px) rotateX(-10deg);
}

.floodlight::after { content: ""; position: absolute; top: 100%; left: 48%; width: 4px; height: 280px; background: linear-gradient(#51657a, transparent); }
.floodlight i { width: 10px; height: 10px; border-radius: 2px; background: white; box-shadow: 0 0 8px #fff; }
.light-left { left: 6%; }
.light-right { right: 6%; }

.crowd {
  position: absolute;
  left: -2%;
  width: 104%;
  background-color: #101c2b;
  background-image:
    radial-gradient(circle, #66d5ff 0 1px, transparent 1.4px),
    radial-gradient(circle, #ffca63 0 1px, transparent 1.4px),
    radial-gradient(circle, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle, #ff6840 0 1px, transparent 1.4px);
  background-size: 27px 23px, 31px 29px, 37px 31px, 43px 37px;
  background-position: 0 2px, 8px 12px, 19px 6px, 4px 18px;
  opacity: .75;
}

.crowd-back { bottom: 10%; height: 35%; transform: perspective(300px) rotateX(-8deg); }
.crowd-front { bottom: -3%; height: 22%; filter: brightness(.58); }

.race-status {
  position: absolute;
  z-index: 16;
  top: 18px;
  left: 18px;
  right: 18px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  pointer-events: none;
}

.live-pill {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 5px;
  background: rgba(2, 8, 15, .5);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .17em;
  backdrop-filter: blur(8px);
}

.live-pill span { width: 7px; height: 7px; border-radius: 50%; background: #ff422f; box-shadow: 0 0 10px #ff422f; }
.status-center { color: rgba(255,255,255,.75); font-size: 12px; font-weight: 800; letter-spacing: .14em; }

.wind-box {
  justify-self: end;
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: baseline;
  gap: 5px;
  padding: 7px 10px;
  border-left: 2px solid var(--cyan);
  background: rgba(1,8,15,.52);
  backdrop-filter: blur(8px);
}

.wind-box span { grid-column: 1 / -1; color: #7e8da1; font-size: 8px; font-weight: 900; letter-spacing: .16em; }
.wind-box strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.wind-box small { color: #78869a; font-size: 8px; }

.distance-ruler {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  bottom: 56%;
  height: 26px;
  border-bottom: 1px solid rgba(255,255,255,.45);
  background: linear-gradient(180deg, rgba(255,255,255,.11), rgba(0,0,0,.32));
}

.distance-ruler span {
  position: absolute;
  bottom: 5px;
  color: rgba(255,255,255,.82);
  font-size: 9px;
  font-weight: 800;
  transform: translateX(-50%);
}

.distance-ruler span::after { content: ""; position: absolute; top: calc(100% + 5px); left: 50%; width: 1px; height: 8px; background: white; }

.track {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56%;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 0 4.6%, rgba(255,255,255,.12) 4.6% 4.8%, transparent 4.8% 89.8%, rgba(255,255,255,.12) 89.8% 90%, transparent 90%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.015) 0 2px, transparent 2px 13px),
    linear-gradient(180deg, #b84836, #8f3026);
}

.track::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.10), transparent 18%, transparent 77%, rgba(48,5,0,.22));
}

.lane {
  position: relative;
  height: 25%;
  border-bottom: 2px solid rgba(255,255,255,.66);
}

.lane:last-of-type { border-bottom: 0; }
.player-lane { background: linear-gradient(90deg, rgba(19,122,255,.07), rgba(57,230,255,.12), rgba(19,122,255,.03)); }

.lane-number {
  position: absolute;
  z-index: 2;
  left: 1.3%;
  top: 50%;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 3px;
  color: rgba(255,255,255,.88);
  background: rgba(70,11,5,.45);
  font-family: Impact, sans-serif;
  font-size: 14px;
  transform: translateY(-50%) skew(-8deg);
}

.you-tag {
  position: absolute;
  left: 1.2%;
  bottom: 4px;
  color: var(--cyan);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .12em;
}

.start-line,
.finish-line {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  width: 8px;
  pointer-events: none;
}

.start-line { left: 5%; background: rgba(255,255,255,.85); box-shadow: 0 0 8px rgba(255,255,255,.28); }
.finish-line {
  left: 90%;
  width: 13px;
  background-color: white;
  background-image: conic-gradient(#111 25%, white 0 50%, #111 0 75%, white 0);
  background-size: 12px 12px;
  box-shadow: 0 0 12px rgba(255,255,255,.25);
}

.finish-line span {
  position: absolute;
  right: -1px;
  top: 0;
  padding: 5px 3px;
  color: #08101c;
  background: var(--gold);
  font-size: 7px;
  font-weight: 1000;
  letter-spacing: .08em;
  writing-mode: vertical-rl;
}

.runner {
  --runner-x: 5%;
  position: absolute;
  z-index: 10;
  left: var(--runner-x);
  width: clamp(94px, 10.7vw, 166px);
  height: 25%;
  transform: translateX(-28%);
  transition: filter .2s;
  will-change: left, transform;
}

.runner[data-runner="0"] { top: 0; }
.runner[data-runner="1"] { top: 25%; }
.runner[data-runner="2"] { top: 50%; }
.runner[data-runner="3"] { top: 75%; z-index: 12; }

.runner img {
  position: absolute;
  left: 0;
  bottom: -7%;
  width: 100%;
  height: 125%;
  object-fit: contain;
  filter: drop-shadow(0 8px 5px rgba(21, 5, 2, .48));
  pointer-events: none;
  transform-origin: 48% 78%;
}

.runner.running img { animation: sprintBob .16s cubic-bezier(.2,.8,.4,1) infinite alternate; }
.runner.finished img { animation: finishLean .45s ease-out forwards; }
.runner-one img { filter: hue-rotate(118deg) saturate(.85) drop-shadow(0 8px 5px rgba(21,5,2,.48)); }
.runner-two img { filter: hue-rotate(290deg) saturate(1.1) drop-shadow(0 8px 5px rgba(21,5,2,.48)); }
.runner-three img { filter: hue-rotate(48deg) saturate(.9) drop-shadow(0 8px 5px rgba(21,5,2,.48)); }

@keyframes sprintBob {
  from { transform: translateY(1.5%) rotate(-1.2deg) scaleX(.995); }
  to { transform: translateY(-2.5%) rotate(.8deg) scaleX(1.01); }
}

@keyframes finishLean { to { transform: translateX(4%) rotate(4deg); } }

.name-tag {
  position: absolute;
  z-index: 3;
  left: 8%;
  top: 2%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 3px;
  border-radius: 3px;
  color: rgba(255,255,255,.84);
  background: rgba(3,8,14,.67);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .08em;
  opacity: .82;
}

.name-tag b { display: grid; width: 14px; height: 14px; place-items: center; border-radius: 2px; color: #06101c; background: #dceaff; font-size: 8px; }
.runner-player .name-tag { color: #fff; background: rgba(3,24,40,.78); box-shadow: 0 0 0 1px rgba(57,230,255,.32); }
.runner-player .name-tag b { background: var(--cyan); }

.speed-trail {
  position: absolute;
  z-index: -1;
  left: -18%;
  top: 48%;
  width: 52%;
  height: 2px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(57,230,255,.85));
  box-shadow: 0 -11px rgba(57,230,255,.22), 0 12px rgba(57,230,255,.32);
  transform: skewX(-28deg);
  transition: opacity .15s;
}

.runner-player.boost .speed-trail { opacity: 1; animation: trail .25s linear infinite; }
@keyframes trail { from { transform: translateX(0) skewX(-28deg); } to { transform: translateX(-24%) skewX(-28deg); } }

.start-overlay {
  position: absolute;
  z-index: 18;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, rgba(1,6,13,.88), rgba(1,7,14,.5) 55%, rgba(1,6,12,.22));
  backdrop-filter: blur(2px);
  transition: opacity .35s, visibility .35s;
}

.start-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.intro-card {
  width: min(470px, calc(100% - 44px));
  padding: clamp(24px, 4.2vw, 48px);
  border-left: 3px solid var(--orange);
  background: linear-gradient(110deg, rgba(7,14,24,.96), rgba(8,17,29,.72));
  box-shadow: 0 18px 70px rgba(0,0,0,.5);
}

.eyebrow { margin: 0 0 13px; color: var(--cyan); font-size: 11px; font-weight: 900; letter-spacing: .22em; }
.intro-card h1 { margin: 0; font-size: clamp(34px, 5.2vw, 66px); font-weight: 1000; letter-spacing: -.055em; line-height: .98; }
.intro-card h1 em { color: var(--gold); font-style: normal; }
.intro-copy { max-width: 360px; margin: 18px 0 25px; color: #adb8c7; font-size: 14px; font-weight: 600; line-height: 1.7; }

.player-entry { margin: -10px 0 15px; }
.player-entry label { display: grid; grid-template-columns: auto minmax(150px, 1fr); align-items: center; gap: 11px; }
.player-entry label > span { color: var(--cyan); font-size: 9px; font-weight: 1000; letter-spacing: .14em; }
.player-entry input { width: 100%; min-height: 40px; padding: 0 12px; color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 5px; outline: 0; background: rgba(1,7,14,.78); font-size: 15px; font-weight: 800; user-select: text; }
.player-entry input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(57,230,255,.12); }
.player-entry input::placeholder { color: #69768a; font-weight: 600; }
.player-entry p { min-height: 15px; margin: 3px 0 0; color: #ff8291; font-size: 11px; text-align: right; }

.start-button,
.retry-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 22px;
  border: 0;
  border-radius: 6px;
  color: #08101a;
  background: linear-gradient(100deg, var(--gold), #ffac34);
  box-shadow: 0 9px 28px rgba(255,170,35,.24), inset 0 1px rgba(255,255,255,.5);
  cursor: pointer;
  font-weight: 1000;
  letter-spacing: .1em;
  transition: transform .15s, filter .15s;
}

.start-button:hover, .retry-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.start-button:active, .retry-button:active { transform: translateY(1px) scale(.99); }
kbd { display: inline-grid; min-width: 28px; min-height: 26px; place-items: center; border: 1px solid rgba(0,0,0,.22); border-radius: 4px; background: rgba(255,255,255,.45); box-shadow: 0 2px rgba(0,0,0,.15); font-family: inherit; font-size: 10px; font-weight: 900; }
.start-note { margin: 11px 0 0; color: #78869a; font-size: 10px; text-align: center; }

.countdown {
  position: absolute;
  display: none;
  color: white;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(110px, 23vw, 280px);
  font-style: italic;
  letter-spacing: -.06em;
  line-height: 1;
  text-shadow: 0 0 24px rgba(255,255,255,.28), 8px 10px 0 rgba(0,0,0,.3);
}

.countdown.show { display: block; animation: countPulse .7s cubic-bezier(.1,.8,.2,1); }
.countdown.go { color: var(--gold); font-size: clamp(90px, 20vw, 230px); text-shadow: 0 0 34px rgba(255,208,86,.54), 8px 10px 0 rgba(0,0,0,.3); }
.countdown.false { color: #ff513d; font-size: clamp(55px, 10vw, 120px); letter-spacing: .02em; }
@keyframes countPulse { 0% { opacity: 0; transform: scale(1.45); } 35% { opacity: 1; transform: scale(1); } 100% { opacity: .9; transform: scale(.88); } }

.celebration { position: absolute; z-index: 25; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.control-deck {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(440px, 1.2fr);
  gap: 14px;
  margin-top: 14px;
}

.power-panel,
.tap-controls {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(16,27,42,.93), rgba(7,13,22,.94));
  box-shadow: inset 0 1px rgba(255,255,255,.04), 0 12px 28px rgba(0,0,0,.2);
}

.power-panel { padding: 17px 19px 15px; }
.power-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.power-heading span { color: #afbac8; font-size: 10px; font-weight: 900; letter-spacing: .17em; }
.power-heading strong { color: var(--cyan); font-size: 11px; letter-spacing: .1em; }
.power-track { position: relative; height: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 3px; background: #03070c; }
.power-track > span { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, #1c78ff, var(--cyan) 56%, var(--gold) 82%, #ff502e); box-shadow: 0 0 16px rgba(57,230,255,.5); transition: width .08s linear; }
.power-peak { position: absolute; top: 0; bottom: 0; left: 82%; width: 1px; background: rgba(255,255,255,.8); }

.race-readout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 12px; }
.race-readout > span { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.race-readout small { color: #647286; font-size: 7px; font-weight: 900; letter-spacing: .12em; }
.race-readout strong { overflow: hidden; color: #eaf1f8; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tap-controls {
  display: grid;
  grid-template-columns: 1fr 66px 1fr;
  gap: 10px;
  padding: 10px;
}

.tap-button {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 20px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 7px;
  color: white;
  background: linear-gradient(145deg, #19283c, #0b1421);
  box-shadow: inset 0 1px rgba(255,255,255,.07), 0 5px 0 #04080e;
  cursor: pointer;
  touch-action: manipulation;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: .11em;
  transition: transform .07s, background .07s, border-color .07s;
}

.tap-button::before { content: ""; position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle, rgba(57,230,255,.35), transparent 62%); transition: opacity .1s; }
.tap-button kbd { position: relative; color: white; border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.08); box-shadow: 0 2px rgba(0,0,0,.35); }
.tap-button i { position: relative; color: var(--cyan); font-size: 25px; font-style: normal; }
.tap-button span { position: relative; }
.tap-button.active { border-color: var(--cyan); background: linear-gradient(145deg, #12375a, #092038); box-shadow: inset 0 0 22px rgba(57,230,255,.16), 0 1px 0 #04080e; transform: translateY(4px); }
.tap-button.active::before { opacity: 1; }

.alternate-mark { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #6f7d90; }
.alternate-mark span { font-size: 8px; font-weight: 800; }
.alternate-mark b { margin-top: 3px; color: #dbe6f0; font-size: 24px; }

.keyboard-help { margin: 13px 2px 0; color: #738095; font-size: 11px; text-align: center; }
.keyboard-help span { color: #bdc7d3; font-weight: 900; }

.result-dialog {
  width: min(500px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  padding: 0;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  color: white;
  background: linear-gradient(155deg, #111e2e, #070d16 68%);
  box-shadow: 0 38px 110px rgba(0,0,0,.72), inset 0 1px rgba(255,255,255,.05);
}

.result-dialog::backdrop { background: rgba(1,5,10,.76); backdrop-filter: blur(7px); }
.result-dialog[open] { animation: dialogIn .35s cubic-bezier(.2,.85,.25,1); }
@keyframes dialogIn { from { opacity: 0; transform: translateY(22px) scale(.96); } }

.result-topline { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.result-topline span { color: var(--cyan); font-size: 10px; font-weight: 900; letter-spacing: .2em; }
.result-topline button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 5px; color: #a6b2c2; background: transparent; cursor: pointer; font-size: 24px; line-height: 1; }
.result-label { margin: 26px 0 4px; color: #8f9caf; font-size: 10px; font-weight: 900; letter-spacing: .2em; text-align: center; }
.final-time { display: flex; align-items: baseline; justify-content: center; gap: 9px; }
.final-time strong { color: var(--gold); font-family: Impact, "Arial Narrow", sans-serif; font-size: clamp(64px, 16vw, 96px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .015em; line-height: 1; text-shadow: 0 0 28px rgba(255,208,86,.2); }
.final-time small { color: #738196; font-size: 11px; font-weight: 900; }
.record-banner { width: max-content; margin: 10px auto 21px; padding: 7px 12px; border: 1px solid rgba(101,245,164,.34); border-radius: 3px; color: var(--green); background: rgba(101,245,164,.07); font-size: 9px; font-weight: 1000; letter-spacing: .16em; }
.record-banner.hidden { visibility: hidden; }
.global-save-status { min-height: 18px; margin: -12px 18px 14px; color: #aebad0; font-size: 12px; text-align: center; }
.global-save-status.success { color: var(--green); }
.global-save-status.error { color: #ff9aab; }

.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 18px; border: 1px solid var(--line); border-radius: 7px; background: rgba(1,6,12,.38); }
.result-stats > div { padding: 11px 8px; border-left: 1px solid var(--line); text-align: center; }
.result-stats > div:first-child { border-left: 0; }
.result-stats span { display: block; margin-bottom: 5px; color: #718096; font-size: 8px; font-weight: 800; }
.result-stats strong { font-size: 13px; font-variant-numeric: tabular-nums; }

.result-list { margin: 16px 18px; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.result-list li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 9px 4px; border-bottom: 1px solid rgba(255,255,255,.08); color: #aab6c6; font-size: 12px; }
.result-list li.player-result { color: white; background: linear-gradient(90deg, rgba(57,230,255,.07), transparent); }
.result-list li b { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; color: #0a111d; background: #b7c2cf; font-size: 10px; }
.result-list li:first-child b { background: var(--gold); }
.result-list li span { font-weight: 800; letter-spacing: .05em; }
.result-list li strong { color: white; font-variant-numeric: tabular-nums; }
.retry-button { width: calc(100% - 36px); margin: 0 18px 18px; }

.global-leaderboard {
  margin-top: 22px;
  padding: 22px 24px 18px;
  border: 1px solid rgba(57,230,255,.18);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(10,27,42,.96), rgba(5,10,18,.96));
  box-shadow: inset 0 1px rgba(255,255,255,.05);
}
.global-board-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.global-tag { color: var(--cyan); font-size: 8px; font-weight: 900; letter-spacing: .17em; }
.global-board-head h2 { margin: 7px 0 0; font-size: 18px; }
.global-board-head button { min-width: 68px; min-height: 38px; color: #07101a; font-size: 13px; font-weight: 900; border: 0; border-radius: 999px; background: var(--cyan); cursor: pointer; }
.global-board-meta { margin: 15px 0 9px; display: flex; justify-content: space-between; gap: 14px; color: #8b97ad; font-size: 13px; }
.global-board-meta strong { color: #dce5f4; font-size: 13px; }
.global-board-meta strong.saving { color: var(--cyan); }
.global-board-meta strong.error { color: #ff9aab; }
.global-list { display: grid; gap: 6px; }
.global-row { min-height: 44px; padding: 7px 11px; display: grid; grid-template-columns: 44px minmax(0,1fr) 100px 45px; align-items: center; gap: 10px; border-radius: 8px; background: rgba(255,255,255,.045); }
.global-row.is-you { box-shadow: inset 3px 0 var(--cyan); background: rgba(57,230,255,.09); }
.global-rank { color: #93a0b6; font-size: 13px; }
.global-name { overflow: hidden; font-size: 14px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.global-score { color: #fff; font-family: "Arial Narrow", Impact, sans-serif; font-size: 19px; font-weight: 900; text-align: right; }
.global-date { color: #707d93; font-size: 12px; text-align: right; }
.global-row.rank-1 .global-score { color: var(--gold); }
.global-empty { margin: 24px 0; color: #7f8ba1; font-size: 14px; text-align: center; }
.global-note { margin: 11px 0 0; color: #66738a; font-size: 12px; text-align: right; }

:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

@media (max-width: 820px) {
  .app { padding: 10px 10px 20px; }
  .runland-nav { min-height: 38px; margin-bottom: 3px; }
  .runland-nav a { min-height: 32px; padding: 0 10px; font-size: 11px; }
  .topbar { grid-template-columns: 1fr auto; gap: 10px; min-height: auto; margin-bottom: 10px; }
  .brand-mark { width: 44px; height: 44px; font-size: 18px; }
  .brand-copy strong { font-size: 16px; }
  .sound-button { min-width: 46px; padding: 0 12px; }
  #soundLabel { display: none; }
  .scoreboard { grid-column: 1 / -1; grid-row: 2; min-height: 55px; }
  .score-item { padding: 8px 10px; }
  .score-item strong { font-size: 25px; }
  .game-frame { min-height: clamp(390px, 92vw, 560px); border-radius: 11px; }
  .control-deck { grid-template-columns: 1fr; gap: 9px; margin-top: 9px; }
  .tap-controls { min-height: 98px; grid-row: 1; grid-template-columns: 1fr 48px 1fr; }
  .power-panel { min-height: 102px; }
  .keyboard-help { display: none; }
  .race-status { top: 10px; left: 10px; right: 10px; }
  .status-center { display: none; }
  .race-status { grid-template-columns: 1fr 1fr; }
  .wind-box { grid-column: 2; }
  .distance-ruler { bottom: 61%; }
  .track { height: 61%; }
  .stadium-sky { bottom: 49%; }
  .runner { width: clamp(82px, 21vw, 130px); }
  .name-tag { transform: scale(.88); transform-origin: left top; }
  .intro-card { padding: 28px 24px; }
  .intro-card h1 { font-size: clamp(36px, 10vw, 58px); }
  .intro-copy { font-size: 13px; }
  .global-leaderboard { padding: 18px 13px 15px; }
  .global-board-head h2 { font-size: 16px; }
  .global-board-meta { flex-direction: column; gap: 5px; }
  .global-row { grid-template-columns: 38px minmax(0,1fr) 82px; gap: 7px; }
  .global-date { display: none; }
  .global-score { font-size: 17px; }
  .global-note { text-align: left; }
  .floodlight { transform: scale(.75); }
  .light-left { left: 1%; }
  .light-right { right: 1%; }
}

@media (max-width: 480px) {
  .brand-copy small { font-size: 8px; }
  .score-item span { font-size: 8px; }
  .score-item strong { font-size: 22px; }
  .score-item small { display: none; }
  .game-frame { min-height: 405px; }
  .track { height: 63%; }
  .distance-ruler { bottom: 63%; }
  .stadium-sky { bottom: 50%; }
  .runner { width: 86px; transform: translateX(-30%); }
  .lane-number { left: .7%; width: 18px; height: 18px; font-size: 11px; }
  .you-tag { display: none; }
  .finish-line { left: 91%; }
  .distance-ruler span:last-child { left: 91% !important; }
  .tap-controls { gap: 4px; padding: 7px; grid-template-columns: 1fr 34px 1fr; }
  .tap-button { gap: 8px; }
  .tap-button i { font-size: 20px; }
  .tap-button span { font-size: 10px; }
  .alternate-mark span { display: none; }
  .alternate-mark b { font-size: 18px; }
  .player-entry label { grid-template-columns: 1fr; gap: 5px; }
  .player-entry p { text-align: left; }
  .race-readout > span { display: block; }
  .race-readout small { display: block; margin-bottom: 4px; }
  .result-stats { margin: 0 12px; }
  .result-list { margin: 14px 12px; }
  .retry-button { width: calc(100% - 24px); margin: 0 12px 12px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .app { padding-top: 6px; }
  .topbar { grid-template-columns: 180px 1fr 55px; min-height: 47px; margin-bottom: 5px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-copy small { display: none; }
  .scoreboard { min-height: 44px; }
  .score-item { padding: 5px 10px; }
  .score-item strong { font-size: 22px; }
  .sound-button { min-width: 44px; min-height: 38px; }
  #soundLabel { display: none; }
  .game-frame { min-height: calc(100dvh - 175px); max-height: none; }
  .control-deck { grid-template-columns: .75fr 1.25fr; margin-top: 6px; }
  .power-panel, .tap-controls { min-height: 76px; }
  .power-panel { padding: 9px 13px; }
  .race-readout { margin-top: 7px; }
  .tap-controls { padding: 6px; }
  .keyboard-help { display: none; }
  .intro-card { width: min(520px, 70%); padding: 20px 28px; }
  .intro-card h1 { font-size: 38px; }
  .intro-copy { margin: 10px 0 14px; }
  .start-button { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
