:root{color-scheme:dark;font-family:system-ui,-apple-system,BlinkMacSystemFont,sans-serif;background:#090c12;color:#edf3fc;--safe-top:env(safe-area-inset-top);--safe-bottom:env(safe-area-inset-bottom)}*{box-sizing:border-box}body{margin:0}button,label{font:inherit}button{color:inherit;background:#151e2d;border:1px solid #2c394e;border-radius:10px;padding:12px 18px;cursor:pointer}button:focus-visible,label:focus-within{outline:3px solid #85e8ff}main{max-width:1000px;margin:0 auto;padding:calc(54px + var(--safe-top)) 28px calc(32px + var(--safe-bottom))}.eyebrow{font-size:12px;letter-spacing:.2em;color:#7dcde6}h1{font-size:clamp(40px,7vw,72px);line-height:1.05;letter-spacing:-.045em;margin:32px 0 20px}.intro{color:#b5c6db;font-size:19px;max-width:520px;line-height:1.6}.primary{display:inline-block;background:#9ae8ff;color:#07131b;padding:16px 22px;border-radius:12px;font-weight:650;cursor:pointer;margin:22px 8px 6px 0}.primary input{position:absolute;width:1px;height:1px;opacity:0}#status,.note{color:#8fa3bd;font-size:13px;line-height:1.6;max-width:560px}.control-guide{display:grid;grid-template-columns:repeat(3,1fr);gap:24px;border-top:1px solid #243047;margin:40px 0 24px;padding-top:20px}.control-guide p{color:#afc0d7;font-size:14px;line-height:1.6}.control-guide strong{display:block;color:#edf3fc;font-size:16px;margin-bottom:8px}#player{height:100dvh;min-height:300px;position:fixed;inset:0;background:#000;overflow:hidden;touch-action:none;user-select:none}#game{width:100%;height:100%;display:block;outline:none;touch-action:none}nav{z-index:3;position:absolute;top:calc(8px + var(--safe-top));left:calc(8px + env(safe-area-inset-left));right:calc(8px + env(safe-area-inset-right));display:flex;align-items:center;gap:6px;pointer-events:none}nav button{pointer-events:auto;width:40px;height:40px;display:grid;place-items:center;padding:0;background:#0c1525a6;border:1px solid #b5d7ed26;backdrop-filter:blur(10px);border-radius:50%;font-size:20px}nav span{flex:1;text-align:center;opacity:.65;font-size:10px;letter-spacing:.15em}#tip{position:absolute;bottom:calc(24px + var(--safe-bottom));left:50%;transform:translateX(-50%);background:#0d1624bb;border:1px solid #35455b;border-radius:20px;padding:10px 18px;font-size:12px;text-align:center;max-width:90vw;width:max-content;pointer-events:none;transition:opacity .6s;opacity:0}#runtime-error{position:absolute;inset:20% max(15%,20px);padding:24px;background:#0c1524ed;border:1px solid #35465f;border-radius:20px;line-height:1.6;font-size:14px;overflow:auto}#save-status{position:absolute;bottom:6px;right:10px;font-size:10px;color:#93a8c3;pointer-events:none} [hidden]{display:none!important}@media(max-width:650px){.control-guide{grid-template-columns:1fr;gap:0;margin-top:24px}h1{margin-top:26px}main{padding-top:calc(26px + var(--safe-top))}#runtime-error{inset:15% 16px}}

#safe-area{position:absolute;inset:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);pointer-events:none;visibility:hidden}#menu-targets{position:absolute;inset:0;pointer-events:none;z-index:1}.native-choice{-webkit-appearance:none;appearance:none;box-shadow:none;position:absolute;pointer-events:auto;background:transparent;border:0;border-radius:0;padding:0;touch-action:none;-webkit-tap-highlight-color:transparent}.native-choice:focus-visible{outline:2px solid #9ae8ff;outline-offset:-2px}#tip{z-index:2}#runtime-error{z-index:4}

#stream-status{position:absolute;bottom:6px;left:10px;font-size:10px;color:#93a8c3;pointer-events:none}button:disabled{opacity:.55;cursor:wait}

#sign-in .primary{text-decoration:none}#account-login{display:flex;align-items:end;gap:12px;margin:18px 0}#account-login label{display:flex;flex-direction:column;gap:7px;font-size:14px;color:#b5c6db}#account-login input{font:inherit;color:#edf3fc;background:#151e2d;border:1px solid #2c394e;border-radius:8px;padding:12px;width:100%;max-width:230px}@media(max-width:650px){#account-login{flex-direction:column;align-items:stretch}#account-login input{max-width:none}}
.native-choice[data-slider=true]{cursor:ew-resize}

/* Safari needs the prefixed selection rule as well as the standard rule.
   Apply it to every game descendant, including canvas and invisible targets. */
#player,#player *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
#player{overscroll-behavior:none}#game{-webkit-user-drag:none}#player #player-icon{-webkit-appearance:none;appearance:none;box-shadow:none;position:absolute;pointer-events:auto;background:transparent;border:0;border-radius:0;backdrop-filter:none;padding:0;z-index:2}
nav #corner-button{position:fixed;left:calc(12px + env(safe-area-inset-left));bottom:calc(12px + var(--safe-bottom));backdrop-filter:none}nav #mode:empty{display:none}

nav #coin-balance{position:fixed;left:calc(58px + env(safe-area-inset-left));top:auto;bottom:calc(12px + var(--safe-bottom));flex:none;font-size:11px;letter-spacing:0;background:#0c152580;padding:3px 6px;border-radius:8px;opacity:.9;white-space:nowrap}#settings{position:absolute;z-index:4;right:max(12px,env(safe-area-inset-right));top:calc(60px + var(--safe-top));width:min(390px,calc(100% - 24px));max-height:calc(100dvh - 100px - var(--safe-top) - var(--safe-bottom));overflow:auto;touch-action:pan-y;background:#0c1524f2;border:1px solid #35465f;border-radius:16px;padding:16px;box-shadow:0 12px 40px #0008}.settings-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px}.settings-heading button{padding:4px 12px;font-size:24px}#best-times{font-size:12px;width:100%}#leaderboard p{font-size:12px}#car-purchase{position:absolute;z-index:3;left:50%;transform:translateX(-50%);bottom:calc(55px + var(--safe-bottom));display:flex;align-items:center;gap:12px;background:#0c1524ed;border:1px solid #35465f;border-radius:12px;padding:12px;max-width:95%;width:max-content;font-size:12px}#car-purchase span{color:#a5bed3}#car-purchase button{white-space:nowrap;background:#92def5;color:#061520;padding:10px 14px}@media(max-width:500px){#car-purchase{flex-wrap:wrap;justify-content:center;width:90%;gap:8px}#car-purchase strong{width:100%;text-align:center}nav{gap:4px}nav button{width:44px;height:44px}}

@media(orientation:portrait){#player[data-machine-menu=true] #tip{display:none}#car-purchase{bottom:calc(16px + var(--safe-bottom));width:min(310px,calc(100% - 120px));flex-wrap:nowrap;gap:10px;padding:9px 12px}#car-purchase strong{width:auto;flex:1;font-size:13px}#purchase-balance{display:none}#car-purchase button{font-size:13px;min-height:44px}#player[data-machine-menu=true] nav #coin-balance{bottom:calc(54px + var(--safe-bottom));left:12px;font-size:10px;background:transparent}}

/* Controls in the Settings panel: native checkboxes and a select, one plain row each. */
#controls-options,#graphics-options{border-top:1px solid #334158;padding:8px 0;margin-bottom:8px}#controls-options h2,#graphics-options h2{font-size:14px;margin:4px 0}#controls-options label,#graphics-options label{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;font-size:14px;cursor:pointer}#controls-options label:focus-within,#graphics-options label:focus-within{outline:none}#controls-options input[type=checkbox],#graphics-options input[type=checkbox]{width:22px;height:22px;margin:0;accent-color:#9ae8ff;cursor:pointer}#controls-options select,#graphics-options select{font:inherit;font-size:14px;color:#edf3fc;background:#151e2d;border:1px solid #2c394e;border-radius:8px;padding:8px 10px;cursor:pointer}#controls-options :focus-visible,#graphics-options :focus-visible{outline:3px solid #85e8ff;outline-offset:2px}
#race-controls{position:absolute;inset:0;pointer-events:none;z-index:2;touch-action:none}
/* Floating thumbs appear where each thumb lands and follow it until release. */
.thumb-stick{position:absolute;left:0;top:0;border-radius:50%;pointer-events:none;border:1px solid #def2ff40;background:#0913222e}
.thumb-stick span{position:absolute;left:50%;top:50%;width:52px;height:52px;margin:-26px 0 0 -26px;border-radius:50%;background:#d8eeff38;border:1px solid #effaff80;will-change:transform}
.thumb-stick[data-thumb=throttle]{width:84px;height:84px;margin:-42px 0 0 -42px}
.thumb-stick[data-thumb=throttle] span{width:60px;height:60px;margin:-30px 0 0 -30px;background:#26739b8c;border-color:#e5fbffb0}
.race-action{position:absolute;pointer-events:auto;touch-action:none;-webkit-appearance:none;appearance:none;border:1px solid #d9edff50;border-radius:50%;padding:0;background:#07111b38;box-shadow:none;backdrop-filter:none;color:#daff98;font-weight:800;font-style:italic;font-size:11px;letter-spacing:.02em}.race-action .touch-cap{position:absolute;inset:4px;border-radius:50%;display:grid;place-items:center;background:#1b301b85;border:1px solid #effaff50;pointer-events:none}.race-action.pressed .touch-cap{background:#5a992aaa;border-color:#e5fbff}.race-action:focus-visible{outline:2px solid #9ae8ff;outline-offset:3px}
/* The lower half belongs to the driving thumbs; Settings moves just above
   it on the right edge, clear of the HUD in both orientations. */
#player[data-touch-race=true] nav #corner-button{left:auto;right:calc(12px + env(safe-area-inset-right));top:calc(50% - 52px);bottom:auto}
#player[data-touch-race=true] nav #coin-balance{display:none}
.native-choice{border-radius:10px;transition:background-color .2s,box-shadow .2s}.native-choice.tapped{background:#ffffff1c;box-shadow:inset 0 0 0 2px #ffffff47;transition:none}
#player #player-icon:active,nav button:active,#settings button:active,#car-purchase button:active{filter:brightness(1.3)}

/* Super 64's home cube ends the top bar, in the top-right corner. */
#player nav #super64-home.super64-home{--super64-home-size:40px;margin-left:auto;pointer-events:auto}




/* Browser controls are limited to the online queue and device settings. */

.race-action[data-control=coast]{color:#eff7ff}.race-action[data-control=coast] .touch-cap{background:#18304985}.race-action[data-control=coast].pressed .touch-cap{background:#315c89aa}

/* Corner menu: opens above the corner button, inside the safe edges. */
#corner-menu{position:fixed;z-index:5;left:calc(12px + env(safe-area-inset-left));bottom:calc(60px + var(--safe-bottom));display:grid;gap:4px;min-width:180px;padding:8px;background:#0c1524f2;border:1px solid #35465f;border-radius:14px;box-shadow:0 12px 40px #0008}
#corner-menu[hidden]{display:none}
#corner-menu button{min-height:44px;padding:8px 14px;text-align:left;background:#192c40;border:1px solid #35465f;border-radius:10px;color:inherit;font:inherit;cursor:pointer}
#corner-menu button:focus-visible{outline:2px solid #f4f6ff;outline-offset:2px;background:#26405c}
#player[data-touch-race=true] #corner-menu{left:auto;right:calc(12px + env(safe-area-inset-right));bottom:auto;top:calc(8px + var(--safe-top))}
@media(max-height:450px){#corner-menu{bottom:calc(52px + var(--safe-bottom));max-height:calc(100dvh - 64px - var(--safe-bottom));overflow:auto}}

/* After a finish the original records list in the game shows the Ghost Field. #results is only a status line for screen readers. */
#results{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* Name tags over the Ghosts. They sit under the touch controls, never take a tap, and stay small so the road stays clear. */
#ghost-tags,#record-tags{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:1}
.ghost-tag{position:absolute;left:0;top:0;display:flex;align-items:center;gap:4px;padding:2px 7px 2px 2px;border-radius:999px;background:#090c1259;color:#edf3fcdd;font-size:11px;line-height:16px;font-weight:600;letter-spacing:.01em;white-space:nowrap;text-shadow:0 1px 2px #000a;will-change:transform,opacity;border:1px solid #ffffff22}
.ghost-tag img{width:16px;height:16px;border-radius:50%;object-fit:cover;flex:none}
.ghost-tag .initial{width:16px;height:16px;border-radius:50%;flex:none;display:grid;place-items:center;background:#26405c;color:#edf3fc;font-size:9px;font-weight:700}
.ghost-tag.self{border-color:#8fd3ff99;color:#fff}
.race-marker{position:absolute;left:0;top:0;image-rendering:pixelated;will-change:transform}
@media(max-width:700px){.ghost-tag{font-size:10px;line-height:14px}.ghost-tag img,.ghost-tag .initial{width:14px;height:14px}}

/* One-Handed racing: no on-screen controls but the corner Menu button. It takes the top corner on the playing side (the
   right, or the left with Left-Handed), just under the HUD's Energy bar so it never covers it, and its menu opens below it. */
#player{--one-hand-top:calc(var(--safe-top) + 56px)}
@media(orientation:landscape){#player{--one-hand-top:calc(var(--safe-top) + 66px)}}
#player[data-one-hand=true] nav #corner-button{left:auto;right:calc(12px + env(safe-area-inset-right));top:var(--one-hand-top);bottom:auto}
#player[data-one-hand=true][data-left-handed=true] nav #corner-button{right:auto;left:calc(12px + env(safe-area-inset-left))}
#player[data-one-hand=true] #corner-menu{top:calc(var(--one-hand-top) + 52px);right:calc(12px + env(safe-area-inset-right));bottom:auto;left:auto}
#player[data-one-hand=true][data-left-handed=true] #corner-menu{right:auto;left:calc(12px + env(safe-area-inset-left))}
/* Its feedback: a faint ring where the thumb landed, an arc for the steering, and an icon that fades in under a second. */
.one-hand-ring{position:absolute;width:56px;height:56px;margin:-28px 0 0 -28px;border-radius:50%;border:2px solid #def2ff55;background:#0913221a;pointer-events:none}
.one-hand-ring.braking{border-color:#ffb347aa;background:#ffb34726}
.one-hand-arc{position:absolute;width:100px;height:100px;margin:-50px 0 0 -50px;pointer-events:none;overflow:visible}
.one-hand-arc path{fill:none;stroke:#daff98;stroke-width:4;stroke-linecap:round;opacity:.8}
.one-hand-icon{position:absolute;width:28px;height:28px;margin:-14px 0 0 -14px;color:#daff98;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;pointer-events:none;filter:drop-shadow(0 1px 2px #000a);animation:one-hand-icon .7s ease-out forwards}
@keyframes one-hand-icon{0%{opacity:0;transform:scale(.7)}15%{opacity:.95;transform:scale(1)}100%{opacity:0;transform:translateY(-14px)}}
/* Record tags scale with the list (app.js sets the layer's font size from the badge height). */
#record-tags .ghost-tag{font-size:1em;line-height:1.45em;gap:.36em;padding:.18em .64em .18em .18em}
#record-tags .ghost-tag img{width:1.45em;height:1.45em}#record-tags .ghost-tag .initial{font-size:.8em;width:1.81em;height:1.81em}

#controls-options h3{font-size:13px;margin:12px 0 2px;color:#a5bed3}#pad-bindings .pad-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;font-size:14px}#pad-bindings button,#reset-bindings{font:inherit;font-size:14px;color:#edf3fc;background:#151e2d;border:1px solid #2c394e;border-radius:8px;padding:8px 10px;min-width:120px;min-height:40px;cursor:pointer}#pad-bindings button[aria-pressed=true]{background:#92def5;color:#061520}#reset-bindings{width:100%;margin-top:8px}

/* Phones: a long press must not select text or open the callout. Typed fields stay selectable. */
html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, [contenteditable], [contenteditable] * { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
