/* Need for Peed — micro-machines-in-the-house racing. Dark-themed to match the site. */
:root {
  --bg: #17120f;
  --ink: #f4e6c2;
  --amber: #ecc06a;
  --orange: #e0913c;
  --panel: rgba(30, 22, 16, 0.92);
  --panel-edge: rgba(236, 192, 106, 0.4);
  --font: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; width: 100%; height: 100%; height: 100dvh; overflow: hidden;
  background: radial-gradient(ellipse 90% 60% at 50% -10%, rgba(236, 192, 106, 0.14), transparent), var(--bg);
  color: var(--ink); font-family: var(--font);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
#app { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#game-root { position: relative; width: 100%; height: 100%; }
#viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
#viewport canvas { display: block; width: 100%; height: 100%; }

.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 20; padding: 1rem; }
.overlay.hidden, .hidden { display: none !important; }
.panel { background: var(--panel); border: 2px solid var(--panel-edge); border-radius: 14px; padding: 1.6rem 2rem; text-align: center; max-width: 92%; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5); }
.banner { background: var(--panel); border: 2px solid var(--panel-edge); border-radius: 10px; padding: 0.6rem 1.4rem; font-weight: 800; letter-spacing: 0.08em; }
.logo { margin: 0 0 0.3rem; font-size: clamp(2rem, 9vw, 3.6rem); font-weight: 900; letter-spacing: 0.06em; color: var(--orange); -webkit-text-stroke: 2px var(--amber); text-shadow: 3px 3px 0 #000; font-style: italic; }
.logo-for { font-size: 0.45em; margin: 0 0.25em; vertical-align: 0.35em; letter-spacing: 0.12em; color: var(--amber); -webkit-text-stroke: 0; }
.tagline { margin: 0.2rem auto 1rem; color: #d8c6a0; font-size: clamp(0.85rem, 3vw, 1.05rem); max-width: 34ch; }
.arcade-btn { font-family: inherit; font-weight: 800; letter-spacing: 0.06em; font-size: 1.1rem; color: #1a1208; background: var(--amber); border: 0; border-radius: 8px; padding: 0.7rem 1.6rem; cursor: pointer; box-shadow: 0 4px 0 #a9843a; }
.arcade-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #a9843a; }
.controls { list-style: none; margin: 1rem 0 0.4rem; padding: 0; font-size: 0.82rem; color: #b9a680; line-height: 1.7; }
.hs { margin: 0.8rem 0 0; color: var(--amber); font-weight: 700; }
.quip { margin: 0.1rem 0 0.6rem; color: #d8c6a0; font-style: italic; }
.sub { margin: 0.15rem 0; color: #b9a680; font-size: 0.9rem; }
#res-time { font-size: 1.6rem; font-weight: 900; color: var(--amber); margin: 0.2rem 0; }
#res-title { margin: 0 0 0.2rem; color: var(--orange); -webkit-text-stroke: 1px var(--amber); font-size: 2rem; font-style: italic; }

/* touch/keyboard-specific hint rows */
html.touch .kb-only { display: none; }
html:not(.touch) .touch-only { display: none; }

#hud { position: absolute; top: 0; left: 0; right: 0; z-index: 15; display: flex; align-items: center; gap: 1rem; padding: 0.5rem 0.9rem; font-weight: 800; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6); background: linear-gradient(180deg, rgba(10, 6, 4, 0.5), transparent); pointer-events: none; flex-wrap: wrap; }
.hud-item { display: flex; align-items: baseline; gap: 0.35rem; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.hud-label { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber); }
.hud-item.pos { margin-left: auto; font-size: 1.3rem; color: var(--amber); font-style: italic; }

.hint { position: absolute; left: 50%; top: 20%; transform: translateX(-50%); z-index: 15; background: rgba(120, 20, 20, 0.8); border: 1px solid rgba(255, 120, 100, 0.6); border-radius: 8px; padding: 0.4rem 0.9rem; font-size: 1.1rem; font-weight: 900; letter-spacing: 0.1em; color: #ffd9c0; pointer-events: none; animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

.count { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 18; font-size: clamp(4rem, 18vh, 8rem); font-weight: 900; font-style: italic; color: var(--amber); -webkit-text-stroke: 3px #6b4423; text-shadow: 4px 4px 0 rgba(0,0,0,0.6); pointer-events: none; }
.count.go { color: #9be26a; -webkit-text-stroke: 3px #2c5c1a; }

#vignette { position: absolute; inset: 0; pointer-events: none; z-index: 12; box-shadow: inset 0 0 120px rgba(10, 6, 4, 0.5); }
.frame-btn { position: absolute; right: 10px; bottom: 10px; z-index: 16; font-size: 1.1rem; color: var(--ink); background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 6px; padding: 0.2rem 0.5rem; cursor: pointer; }
html.touch .frame-btn { display: none; }

/* ---- on-screen pedals (touch devices, racing only) ---- */
#touch-ui { position: absolute; inset: 0; z-index: 16; pointer-events: none; }
html:not(.touch) #touch-ui { display: none !important; }
.tc-cluster { position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 12px; pointer-events: none; }
.tc-left { left: max(14px, env(safe-area-inset-left)); }
.tc-right { right: max(14px, env(safe-area-inset-right)); }
.tc-btn {
  pointer-events: auto; touch-action: none;
  width: 74px; height: 74px; border-radius: 50%;
  font-size: 1.5rem; font-weight: 900; font-family: inherit; color: var(--ink);
  background: rgba(30, 22, 16, 0.55); border: 2px solid var(--panel-edge);
  display: flex; align-items: center; justify-content: center;
}
.tc-btn.held { background: rgba(236, 192, 106, 0.45); color: #1a1208; }
.tc-gas { width: 92px; height: 92px; font-size: 2rem; }
.tc-small { width: 62px; height: 62px; font-size: 0.8rem; }
@media (max-height: 420px) {
  .tc-btn { width: 60px; height: 60px; }
  .tc-gas { width: 76px; height: 76px; }
  .tc-small { width: 52px; height: 52px; }
}

/* Force landscape on phones: cover the screen with a rotate prompt in portrait. */
#rotate { display: none; }
html.touch #rotate {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; text-align: center;
  background: var(--bg); color: var(--ink);
}
.rotate-inner { font-weight: 800; font-size: 1.3rem; line-height: 1.5; }
.rotate-icon { font-size: 3rem; color: var(--amber); animation: rot 1.6s ease-in-out infinite; }
@keyframes rot { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(90deg); } }
@media (orientation: portrait) {
  html.touch #rotate { display: flex; }
  html.touch #app { visibility: hidden; }
}
