@font-face {
  font-family: Teko;
  src: url("./assets/fonts/teko.woff2") format("woff2");
  font-weight: 500 700;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url("./assets/fonts/barlow-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url("./assets/fonts/barlow-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url("./assets/fonts/barlow-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --display: Teko, "Bahnschrift Condensed", "Arial Narrow", sans-serif;
  font-family: Barlow, system-ui, sans-serif;
  color: #fff3df;
  background: #100e15;
  --amber: #ffb252;
  --line: #ffdbac45;
}
.showing-replay :is(#hud,#controls,#status,#standings,#race-room,#results,#leave) { display:none !important; }
#finish-replay {
  position:fixed; inset:0; z-index:2; pointer-events:none;
  background:linear-gradient(to top,#090c14ee 0%,transparent 34%,transparent 88%,#090c14a0 100%);
  box-shadow:inset 0 7px #10171c,inset 0 -7px #10171c;
}
#skip-replay { position:absolute; right:max(18px,env(safe-area-inset-right)); top:64px; pointer-events:auto; }
.replay-caption {
  position:absolute;
  bottom:max(7vh,calc(env(safe-area-inset-bottom) + 20px));
  left:max(6vw,env(safe-area-inset-left));
  right:max(22px,env(safe-area-inset-right));
  border-left:3px solid #ffc685;
  padding:2px 16px 5px;
}
.replay-kicker { display:block; text-transform:uppercase; font-size:12px; font-weight:700; letter-spacing:.18em; color:#ffcc90; }
.replay-name { margin:8px 0 1px; font:700 clamp(44px,8vw,88px)/.84 var(--display); text-transform:uppercase; color:#fff4e1; overflow-wrap:anywhere; }
.replay-score,#replay-outcome { font-weight:700; font-size:15px; letter-spacing:.06em; }
.replay-score { font-variant-numeric:tabular-nums; }
#replay-outcome { padding-left:14px; color:#ffcb79; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow: hidden; }
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(#0b152347, transparent 23%, transparent 78%, #09132150),
    radial-gradient(ellipse at 52% 53%, transparent 42%, #07101b5c 100%);
}
#court { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#court[data-cabinet-hover] { cursor: pointer; }
.topbar {
  position: fixed;
  z-index: 2;
  inset: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) auto max(18px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: grid; line-height: 1; font-size: 13px; letter-spacing: .16em; }
a.brand { color: inherit; text-decoration: none; }
a.brand:hover, a.brand:focus-visible { color: #aaeadb; }
.brand span { color: #aaeadb; font-size: 10px; letter-spacing: .35em; margin-top: 4px; }
.tools { display: flex; gap: 6px; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 2px solid white; outline-offset: 4px; }
.utility {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 7px 11px;
  min-height: 36px;
  background: #111d27eb;
  color: #fff3df;
  font-size: 12px;
  font-weight: 600;
}
.menu {
  position: fixed;
  bottom: max(36px, calc(env(safe-area-inset-bottom) + 24px));
  left: max(34px, 7vw);
  z-index: 1;
  width: min(330px, calc(100vw - 42px));
  filter: drop-shadow(0 8px 28px #100917);
}
h1, h2, p { margin: 0; }
#lobby {
  width: min(358px,calc(100vw - 42px));
  isolation: isolate;
}
#lobby::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: -60px -90px -30px -70px;
  background: radial-gradient(ellipse at 40% 56%, #07111bea 8%, #07111bc4 42%, transparent 72%);
}
#title {
  position: relative;
  padding-bottom: 10px;
  border-bottom: 1px solid #9eb1bd60;
  color: #f4f0e7;
  font: 700 clamp(1.5rem,6vw,2.25rem)/1 Barlow, system-ui, sans-serif;
}
#arcade-logo { display:block; width:100%; height:auto; }
#title::after {
  content: "";
  position: absolute;
  inset: auto auto -1px 0;
  width: 36px;
  height: 2px;
  background: #efa06c;
}
#lobby .best {
  margin-top: 12px;
  color: #c7d5d9;
}
.best {
  color: #ffd3a2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .13em;
  margin: 18px 0 9px;
}
.best output { color: white; font: 600 20px/.8 var(--display); margin-left: 5px; vertical-align: -.1em; }
.primary, .secondary {
  border: 1px solid var(--line);
  border-radius: 5px;
  display: block;
  width: 100%;
  min-height: 46px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}
.primary { background: linear-gradient(180deg, #ffcb71, #ff9c42); color: #21111a; border-color: #ffcd8a; }
.secondary { background: #16131edb; color: #ffe6c5; margin-top: 6px; }
.primary:hover { background: #ffe0a5; }
.secondary:hover, .utility:hover { background: #3a2630; }
#hud {
  position: fixed;
  z-index: 1;
  top: max(62px, calc(env(safe-area-inset-top) + 51px));
  left: 50%;
  transform: translateX(-50%);
  width: min(356px, calc(100vw - 34px));
  pointer-events: none;
  text-align: center;
}
.stats {
  display: grid;
  grid-template-columns: 1fr .82fr 1fr;
  border: 1px solid #65828aa3;
  border-radius: 4px;
  background: linear-gradient(180deg,#1b2c39f8,#101c28f8);
  box-shadow: 0 5px 14px #050a11a8, inset 0 1px #acc9d033;
  overflow: hidden;
}
.stats div { padding: 5px 5px 2px; min-width: 0; }
.stats div:nth-child(2) {
  color: #142530;
  background: linear-gradient(180deg,#ffebc4,#edc78c);
  border-inline: 1px solid #f9dca99c;
}
.stats span { display: block; letter-spacing: .14em; font: 700 11px/1.1 Barlow,system-ui,sans-serif; color: #c6d9dc; }
.stats div:nth-child(2) span { color: #42392d; }
.stats output { display:block; margin-top:3px; font:600 39px/.9 var(--display); font-variant-numeric:tabular-nums; white-space:nowrap; }
#score { color: #ffd08c; }
#hud[data-clock-low] .stats div:nth-child(2) { background: #ffa364; }
.round-state { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:5px 8px; margin-top:5px; }
@media (min-width: 900px) and (min-height: 501px) {
  #hud { top: max(59px, calc(env(safe-area-inset-top) + 48px)); }
  .round-state {
    position: absolute;
    right: calc(100% + 9px);
    bottom: 0;
    flex-flow: column nowrap;
    align-items: flex-end;
    margin: 0;
    white-space: nowrap;
  }
}
#round,#bonus {
  padding: 3px 7px;
  color: #f0e5d0;
  background: #101c27f5;
  border: 1px solid #9daeaf52;
  border-radius: 2px;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .095em;
}
#bonus { color:#24180f; background:#ffd08c; border-color:#ffd08c; }
.status {
  position: fixed;
  z-index: 1;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%) skew(-6deg);
  font: 700 clamp(46px, 8vw, 102px)/.9 var(--display);
  color: #ffcb79;
  white-space: nowrap;
  text-shadow: 0 3px #742f21, 0 5px #16111d, 0 0 28px #1e0f16;
  pointer-events: none;
}
.status[data-basket] {
  top: max(140px, calc(env(safe-area-inset-top) + 129px));
  left: calc(50% - min(120px, 29vw));
  font: 600 26px/1 var(--display);
  color: #ffe3a8;
  text-shadow: 0 2px 6px #071822, 0 1px 2px black;
}
#controls {
  position: fixed;
  z-index: 1;
  pointer-events: none;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 9px));
  width: min(320px, calc(100vw - 32px));
  text-align: center;
}
.meter { position: relative; height: 10px; border-radius: 2px; background: #0b1721ec; border: 1px solid #abc4cb8a; overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; width: var(--power, 0%); background: linear-gradient(90deg,#ffb252,#ffdf9a); }
.meter b { position: absolute; top: 0; bottom: 0; left: var(--sweet-start, 55%); width: var(--sweet-width, 15%); border-inline: 1px solid #c1f2e0; background: #81e8cb55; }
#hint { margin-top: 6px; font-size: 13px; font-weight: 600; color: #fff3df; text-shadow: 0 1px 4px black; }
.results {
  left: 50%;
  bottom: 50%;
  transform: translate(-50%, 50%);
  text-align: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17121deb;
}
.results .best { margin-top: 0; }
.results h2 { font: 700 36px/.9 var(--display); text-transform: uppercase; letter-spacing: .02em; }
#result-score { display: block; margin-top: 6px; font: 700 74px/.9 var(--display); color: #ffd193; }
#result-stats { margin-bottom: 15px; font-size: 13px; }
.error { position: fixed; z-index: 2; inset: 45% 20px auto; text-align: center; }
@media (max-width: 700px) {
  .menu { left: 50%; transform: translateX(-50%); }
  .results { transform: translate(-50%, 50%); }
}
@media (pointer: coarse) { .keys { display: none; } }
@media (max-height: 450px) {
  .menu { bottom: 17px; width: min(260px, calc(100vw - 42px)); }
  #lobby { width:min(288px,calc(100vw - 42px)); }
  .results { bottom: 50%; }
}
#multi { margin-bottom: 7px; }
#room-info { margin: 12px 0; }
#race-room { max-height:calc(100dvh - 32px); overflow-y:auto; width:min(360px,calc(100vw - 36px)); border-top:2px solid #a9ced6; background:linear-gradient(150deg,#203541f8,#0d1722fa); }
#room-info:empty { display:none; }
#name-choice,#basket-choice { display:flex; align-items:center; justify-content:space-between; margin:8px 0; padding:5px 0; }
#basket-choice { border-block:1px solid #ffffff26; padding:8px 0; margin-bottom:14px; }
#racer-name,#race-basket { font:inherit; padding:6px 8px; background:#172128; color:#fff3df; border:1px solid #718084; border-radius:3px; }
#racer-name { width:9.5em; max-width:59%; }
.race-mode { display:flex; align-items:center; justify-content:space-between; text-align:left; gap:8px; padding:12px; min-height:52px; }
.race-mode b { font:600 25px/.94 var(--display); }
.race-mode small { font-size:10px; letter-spacing:.07em; }
#find-match { background:#90e6d3; color:#112625; border-color:#c4f3e9; }
#find-match:hover { background:#b5f4e6; }
#private-room { text-align:left; margin-top:10px; }
#private-room summary { padding:10px 0; cursor:pointer; font-size:14px; color:#f1dcb9; }
#private-room summary:focus-visible { outline:2px solid white; }
#exit-room { min-height:38px; margin-top:10px; }
@media (min-width:850px) {
  #race-room { left:max(34px,7vw); transform:translateY(50%); }
}
#code-label { display:block; margin:12px 0; }
#code { width:7em; text-transform:uppercase; font:inherit; }
#standings {
  position:fixed;
  z-index:1;
  top:125px;
  right:max(12px,env(safe-area-inset-right));
  width:212px;
  padding:8px 9px 6px;
  border:1px solid #61858b91;
  border-top:2px solid #94ddca;
  border-radius:4px;
  background:#111e29f3;
  box-shadow:0 4px 12px #050b1480;
  pointer-events:none;
}
#standings h2 { color:#aee9da; text-transform:uppercase; }
.score-rows { margin:0; padding:0; list-style:none; text-align:left; font:600 14px/1.18 Barlow,system-ui,sans-serif; font-variant-numeric:tabular-nums; }
#race-ranking { margin:10px 0; }
.score-rows li { display:grid; grid-template-columns:1.25em minmax(0,1fr) auto 2.1em; gap:4px; align-items:center; padding:3px 2px; border-top:1px solid #ffffff22; color:#fff3df; }
.score-rows .place,.score-rows .tag { color:#c6d9dc; font-size:.83em; }
.score-rows .name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.score-rows .points { text-align:right; color:#ffd193; font:600 18px/.9 var(--display); }
.score-rows li.own { background:#90e6d32a; box-shadow:inset 2px 0 #90e6d3; padding-inline-start:5px; }
.score-rows .own .tag { color:#90e6d3; }
@media (max-aspect-ratio: 4/5) {
  #standings { inset:auto max(10px,env(safe-area-inset-right)) max(63px,calc(env(safe-area-inset-bottom) + 57px)) max(10px,env(safe-area-inset-left)); width:auto; padding:5px 8px 4px; }
  #live-ranking { display:grid; grid-auto-flow:column; grid-template-rows:repeat(4,auto); grid-auto-columns:minmax(0,1fr); column-gap:12px; font-size:13px; }
  #live-ranking li { padding-block:2px; }
}
@media (max-height:500px) and (min-aspect-ratio: 4/5) {
  #standings { top:62px; width:min(185px,25vw); }
  #hud { width:min(356px,calc(50vw - 34px)); }
  #live-ranking { font-size:12px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #hud {
    left: max(12px, env(safe-area-inset-left));
    width: min(260px, 30vw);
    transform: none;
  }
  .stats output { font-size: clamp(25px, 4.5vw, 36px); }
}
#lobby button { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:6px 13px; min-height:46px; border-radius:3px; border-left:3px solid #69d5cb; text-align:left; }
#lobby button b { font:600 27px/.9 var(--display); letter-spacing:.025em; }
#lobby button small { font-size:10px; font-weight:700; letter-spacing:.08em; }
#lobby #classic { min-height:54px; background:linear-gradient(180deg,#b4eddc,#89d9c7); border-color:#b6f5da; color:#102629; box-shadow:0 3px #254b4b; }
#lobby .secondary { background:linear-gradient(100deg,#1e303bf9,#151e2bf5); border-color:#6d879181; border-left-color:#a58c62; }
#lobby button:hover { filter:brightness(1.18); }

.practice-modes { margin-top: 12px; }
.practice-modes h2 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #d3e2e5;
}
.practice-modes > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#lobby .practice-modes button {
  min-height: 50px;
  padding: 6px 10px;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  border-left-width: 2px;
}
#lobby .practice-modes b { font-size: 23px; line-height: .9; }
#lobby .practice-modes small { color: #d3e2e5; }
@media (max-height: 420px) {
  #lobby #classic, #lobby .practice-modes button { min-height: 44px; }
  #lobby .practice-modes { margin-top: 8px; }
  #lobby .best { margin-top: 11px; }
}

.standings-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 5px;
}
#standings .standings-heading h2 {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  letter-spacing: .05em;
  margin: 0;
  font-size: 12px;
}
#race-gap { color: #ffda9f; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.meter .release-tick {
  display: none;
  position: absolute;
  inset-block: 0;
  left: clamp(1px,var(--release),calc(100% - 2px));
  width: 2px;
  background: #fff4df;
  box-shadow: 0 0 0 1px #0c151ce0;
}
.meter[data-release] .release-tick { display: block; }
.meter[data-rack] { border-color: #ffcd82; box-shadow: 0 0 10px #ffb25255; }
#aim-guide {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  pointer-events: auto;
}
#aim-guide[aria-pressed="true"] { color: #152322; background: #90e6d3; border-color: #c4f3e9; }
.status[data-flight] {
  top: max(150px, calc(env(safe-area-inset-top) + 128px));
  transform: translateX(-50%);
  font: 700 12px/1 Barlow,system-ui,sans-serif;
  text-transform: uppercase;
  letter-spacing: .10em;
}

#race-champion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 14px 10px;
  border: 1px solid #f2cf946e;
  border-left: 3px solid #ffc674;
  background: linear-gradient(110deg,#55402261,#172631da);
  text-align: left;
}
#race-champion span { color: #ffdbab; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
#champion-name {
  display: block;
  margin-top: 3px;
  color: #fff3df;
  font: 700 32px/.9 var(--display);
  overflow-wrap: anywhere;
}
#champion-score {
  margin-right: 3px;
  color: #ffd193;
  font: 600 35px/.9 var(--display);
  font-variant-numeric: tabular-nums;
}
