:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #141615; color: #eef0e6; }
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { touch-action: none; }
/* Holding a control must not select text or open the iOS callout menu. */
#stage, #stage * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, [role=slider]:focus-visible { outline: 3px solid #ecdf55; outline-offset: 4px; }
[hidden] { display: none !important; }
#stage { position: relative; width: 100%; height: 100dvh; overflow: hidden; }
#game { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
#scene-picker, #iso-picker { position: absolute; z-index: 4; inset: 0; display: grid; place-items: center; padding: 24px; overflow-y: auto; touch-action: pan-y; background: #141615ee; }
.launch-card { width: min(540px, 100%); }
h1, h2 { font-size: clamp(24px, 5vw, 32px); line-height: 1.2; margin: 0 0 20px; }
.launch-card p { color: #a4afa4; font-size: 14px; line-height: 1.5; }
.start { width: 100%; padding: 16px 22px; border: 0; border-radius: 4px; background: #ecdf55; color: #1b1e18; font-weight: 700; }
.start:disabled { opacity: .55; cursor: wait; }
#toolbar { position: absolute; z-index: 3; top: max(12px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); display: flex; gap: 8px; }
#toolbar button { border: 1px solid #ffffff55; border-radius: 50%; background: transparent; width: 44px; height: 44px; padding: 0; font-size: 18px; line-height: 1; color: #ffffffcc; text-shadow: 0 1px 3px #000a; }
#toolbar button:active { background: #ecdf5599; color: #151a13; }
#touch-controls { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
#steering { position: absolute; pointer-events: auto; left: max(24px, calc(env(safe-area-inset-left) + 14px)); bottom: max(25px, env(safe-area-inset-bottom)); width: 148px; height: 148px; border: 1px solid #ffffff50; border-radius: 50%; background: transparent; touch-action: none; }
#steering-thumb { position: absolute; left: 49px; top: 49px; width: 48px; height: 48px; border-radius: 50%; background: #eef0e655; border: 1px solid #ffffffaa; }
.steer-left, .steer-right { position: absolute; top: 48px; color: #eef0e660; font-size: 30px; }
.steer-left { left: 13px; } .steer-right { right: 13px; }
.pedals { position: absolute; pointer-events: auto; right: max(22px, calc(env(safe-area-inset-right) + 12px)); bottom: max(25px, env(safe-area-inset-bottom)); display: grid; gap: 10px; touch-action: none; }
.pedals button { background: transparent; border: 1px solid #ffffff55; border-radius: 12px; font-size: 22px; color: #ffffffb0; text-shadow: 0 1px 3px #000a; touch-action: none; }
.handbrake { height: 44px; font-size: 15px !important; font-weight: 700; }
.pedal-row { display: flex; gap: 12px; }
.pedal-row button { width: 78px; height: 100px; }
.pedals .gas { border-color: #ecdf5599; color: #fff697c0; }
.pedals button.pressed { background: #ecdf5580; border-color: #ecdf55; color: #151a13; }
#runtime-error { position: absolute; z-index: 5; top: 70px; left: 20px; right: 20px; background: #471f1fe8; padding: 16px; border-radius: 8px; font-size: 13px; }
body.paused #touch-controls { visibility: hidden; }
body:not(.touch) #touch-controls, body:not(.touch) #menu-controls { display: none; }
.launch-field { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-size: 13px; }
select, input { min-width: 0; flex: 1; font: inherit; color: inherit; background: #252d25; padding: 10px; border: 1px solid #ffffff40; border-radius: 4px; }
.secondary { margin: 12px 0 0; padding: 10px; width: 100%; background: transparent; border: 1px solid #ffffff40; border-radius: 4px; }
#menu-controls { position: absolute; z-index: 3; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 5px; }
#menu-controls button { width: 39px; height: 39px; padding: 0; border-radius: 8px; border: 1px solid #ffffff77; background: #141615bb; font-size: 22px; }
#menu-controls button[data-key=accept] { color: #ecdf55; }
#name-field { position: absolute; z-index: 3; left: 20%; right: 20%; bottom: 65px; font-size: 12px; }
#player-name { width: 100%; }
#asset-loading { position: absolute; z-index: 4; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; background: #141615dd; padding: 24px; }
#asset-loading button, #runtime-error button { padding: 8px 12px; margin: 6px; background: #252d25; border: 1px solid #ffffff55; border-radius: 4px; }
@media (max-height: 440px) { #scene-picker, #iso-picker { padding: 14px 24px; } h1, h2 { margin-bottom: 12px; } .start { padding: 12px 18px; } }
@media (max-width: 420px) { #steering { left: 16px; width: 130px; height: 130px; } #steering-thumb { left: 40px; top: 40px; } .steer-left, .steer-right { top: 39px; } .pedals { right: 16px; } .pedal-row button { width: 66px; } }
