* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--zl-bg, #06060a);
  color: var(--zl-text, #e9eae2);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none;
}
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.vignette {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(115% 95% at 50% 44%, transparent 52%, rgba(3,4,9,.42) 100%);
  mix-blend-mode: multiply;
}

.hidden { display: none !important; }

/* ───────── overlay menu ───────── */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 100% at 50% 0%, rgba(43,37,64,.28), rgba(6,6,10,.62) 75%);
  backdrop-filter: blur(2px);
}
.panel {
  width: min(560px, 92vw);
  background: color-mix(in srgb, var(--zl-surface-1, #0e0e13) 82%, transparent);
  border: 1px solid var(--zl-line-strong, rgba(255,255,255,.13));
  border-radius: var(--zl-radius-lg, 8px);
  padding: clamp(22px, 4vw, 38px);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  max-height: 94vh; overflow: auto;
}
.brand { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.logo {
  font-size: clamp(42px, 9vw, 72px); font-weight: 700; letter-spacing: -.04em;
  line-height: 1; color: var(--zl-text, #e9eae2);
}
.eyebrow {
  text-transform: uppercase; letter-spacing: .14em; font-size: 13px;
  color: var(--zl-accent-soft, #9dae50); font-weight: 550;
}
.sub { color: var(--zl-text-soft, #b6b7ad); font-size: 17px; line-height: 1.55; margin: 14px 0 22px; }

.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.pick {
  text-align: left; cursor: pointer;
  background: var(--zl-surface-2, #15151c);
  border: 1px solid var(--zl-line-strong, rgba(255,255,255,.13));
  border-radius: var(--zl-radius-lg, 8px);
  padding: 18px; display: flex; flex-direction: column; gap: 6px;
  color: var(--zl-text, #e9eae2);
  transition: border-color .16s, background .16s;
}
.pick:hover { background: var(--zl-surface-3, #1d1d25); }
.pick.sel { border-color: var(--zl-accent-soft, #9dae50); background: var(--zl-surface-3, #1d1d25); }
.pick .pico { font-size: 34px; }
.pick .pname { font-size: 19px; font-weight: 700; }
.pick .pdesc { font-size: 14px; color: var(--zl-text-muted, #7d7e76); line-height: 1.4; }

.namefield { margin-bottom: 16px; }
.namefield .eyebrow { display: block; margin-bottom: 7px; }
.namefield .zl-input { width: 100%; }
.startbtn { width: 100%; justify-content: center; }
.lobbynote { margin-top: 10px; text-align: center; font-size: 14px; color: var(--zl-text-muted, #7d7e76); }

.online {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: rgba(14,14,19,.6); border: 1px solid var(--zl-line-strong, rgba(255,255,255,.13));
  border-radius: 6px; padding: 7px 13px; font-size: 15px; font-weight: 600;
  color: var(--zl-text-soft, #b6b7ad); font-variant-numeric: tabular-nums;
}
.online .odot { width: 9px; height: 9px; border-radius: 50%; background: var(--zl-success, #6f9a3a); box-shadow: 0 0 8px rgba(111,154,58,.8); }

.controls { margin-top: 24px; border-top: 1px solid var(--zl-line, rgba(255,255,255,.07)); padding-top: 18px; }
.ctitle { display: block; margin-bottom: 12px; }
.crow { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--zl-text-soft, #b6b7ad); font-size: 15px; }
kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px;
  min-width: 26px; text-align: center; padding: 3px 7px;
  background: var(--zl-surface-2, #15151c);
  border: 1px solid var(--zl-line-strong, rgba(255,255,255,.13));
  border-radius: 5px; color: var(--zl-text, #e9eae2);
}
.crow span { margin-left: 4px; }
.tip { margin-top: 12px; font-size: 14px; color: var(--zl-accent-soft, #9dae50); }

/* ───────── HUD ───────── */
#hud { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
#hud > *, #hud .tbtn, #hud .tsteer { pointer-events: auto; }
.hudmenu { position: fixed; top: 16px; left: 16px; }
.gauge {
  position: fixed; right: 20px; bottom: 18px; text-align: right;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
}
.gnum { font-size: clamp(40px, 8vw, 64px); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.gunit { font-size: 16px; color: var(--zl-text-soft, #b6b7ad); text-transform: uppercase; letter-spacing: .12em; }
.gdist { flex-basis: 100%; font-size: 15px; color: var(--zl-text-muted, #7d7e76); margin-top: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace; }

/* touch controls — only on coarse pointers */
.touch { display: none; }
@media (pointer: coarse) {
  .touch { display: block; }
  /* gauge to the top-right corner, clear of every thumb control */
  .gauge { right: calc(16px + env(safe-area-inset-right)); top: calc(14px + env(safe-area-inset-top)); bottom: auto; }
  .gnum { font-size: clamp(34px, 11vw, 52px); }
  .hudmenu { top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left)); }
}
/* steering: a horizontal track with a spring-to-centre knob */
.tsteer {
  position: fixed; left: calc(16px + env(safe-area-inset-left));
  bottom: calc(26px + env(safe-area-inset-bottom));
  width: min(46vw, 300px); height: 92px;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; pointer-events: auto;
}
.tsteer-track {
  position: absolute; left: 8%; right: 8%; height: 10px; border-radius: 6px;
  background: color-mix(in srgb, var(--zl-surface-1, #0e0e13) 60%, transparent);
  border: 1px solid var(--zl-line-strong, rgba(255,255,255,.14));
}
.tsteer-knob {
  position: relative; width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--zl-surface-1, #0e0e13) 62%, transparent);
  border: 1.5px solid var(--zl-accent-soft, #9dae50); color: var(--zl-accent-soft, #9dae50);
  backdrop-filter: blur(8px); box-shadow: 0 6px 18px rgba(0,0,0,.4);
  transition: transform .12s ease-out;
  will-change: transform;
}
.tsteer-knob.grab { transition: none; }
.tpedals {
  position: fixed; right: calc(16px + env(safe-area-inset-right));
  bottom: calc(26px + env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; gap: 12px;
}
/* vertical column of secondary buttons, hugging the right edge above the pedals */
.tmini {
  position: fixed; right: calc(20px + env(safe-area-inset-right));
  bottom: calc(122px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.tbtn {
  display: grid; place-items: center;
  width: 74px; height: 74px; border-radius: 50%;
  background: color-mix(in srgb, var(--zl-surface-1, #0e0e13) 58%, transparent);
  color: var(--zl-text, #e9eae2); backdrop-filter: blur(8px);
  border: 1.5px solid var(--zl-line-strong, rgba(255,255,255,.16));
  transition: transform .08s, filter .1s;
}
.tbtn--mini { width: 52px; height: 52px; }
.tbtn.tgo { width: 84px; height: 84px; background: color-mix(in srgb, var(--zl-accent, #3e4618) 46%, transparent); border-color: var(--zl-accent-soft, #9dae50); }
.tbtn.thand { background: color-mix(in srgb, var(--zl-grape, #4c3b4d) 52%, transparent); border-color: var(--zl-accent2-soft, #b095b3); color: var(--zl-accent2-soft, #b095b3); }
.tbtn.pressed, .tbtn:active { transform: scale(.92); filter: brightness(1.25); }
.tbtn.active { border-color: var(--zl-accent2-soft, #b095b3); background: var(--zl-accent2-wash, rgba(176,149,179,.16)); }

.statebadge {
  position: fixed; left: 50%; top: 62px; transform: translateX(-50%);
  display: flex; gap: 8px;
}
.statebadge span {
  display: none; font-weight: 700; letter-spacing: .18em; font-size: 15px;
  padding: 6px 14px; border-radius: 5px; text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.b-drift { background: rgba(199,154,62,.22); color: #d8b25e; border: 1px solid rgba(199,154,62,.5); }
.b-air { background: rgba(176,149,179,.22); color: #cdb6cf; border: 1px solid rgba(176,149,179,.5); }
.statebadge.on .b-drift { display: inline-block; }
.statebadge.air .b-air { display: inline-block; }

.loadtext { font-size: 20px; color: var(--zl-text-soft, #b6b7ad); letter-spacing: .04em; }

@media (max-width: 480px) {
  .picks { grid-template-columns: 1fr; }
}
