:root{--ink:#202729;--red:#d84233;--paper:#f7f8f3;--muted:#5c6964;--line:#d5dbd2;color:var(--ink);font-family:var(--brand-font,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif);font-synthesis:none;background:#d9e1da}*{box-sizing:border-box}body{margin:0}button,a,input{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}button:disabled{cursor:wait;opacity:.5}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid var(--red);outline-offset:4px}a{color:inherit;text-decoration:none}[hidden]{display:none!important}#app{height:100dvh;min-height:400px;overflow:hidden;position:relative}#scene{position:absolute;inset:0;touch-action:none;outline:none}#scene canvas{display:block;width:100%;height:100%}header{position:absolute;inset:0 0 auto;display:flex;align-items:center;justify-content:space-between;padding:22px 28px;z-index:5;pointer-events:none}header>*{pointer-events:auto}.brand-logo{width:106px;height:auto}.nav{display:flex;gap:7px}.icon{display:inline-grid;place-items:center;width:38px;height:38px;border:0;border-radius:50%;background:#f7f8f390;font-size:17px;letter-spacing:1px}.icon svg{width:20px;height:20px}#intro{position:absolute;left:50%;bottom:48px;transform:translateX(-50%);text-align:center;z-index:3;white-space:nowrap}#intro p{font-size:11px;margin:0 0 7px;color:var(--muted)}h1{font-size:36px;letter-spacing:-1.6px;line-height:1;margin:0 0 18px;font-weight:800}.primary{border:0;background:var(--red);color:var(--on-primary,white);font-weight:650;font-size:14px;padding:15px 30px;border-radius:5px;min-height:46px}#start{min-width:145px}#hud{position:absolute;z-index:4;left:50%;top:19px;transform:translateX(-50%);width:150px;background:#f7f8f3e8;border-radius:7px;overflow:hidden;box-shadow:0 4px 18px #20272908}.timer{text-align:center;padding:9px 15px 8px}.timer span{display:block;font-size:30px;font-variant-numeric:tabular-nums;letter-spacing:-1.5px;line-height:1.1;font-weight:700}.timer small{display:block;font-size:9px;line-height:1.4;color:var(--muted);margin-top:3px}.progress{height:3px;background:#d5dbd2}.progress i{height:100%;display:block;width:0;background:var(--red)}#map{position:absolute;width:110px;height:74px;right:24px;top:76px;z-index:3;opacity:.85}#countdown{position:absolute;left:50%;top:44%;transform:translate(-50%,-50%);font-size:100px;font-weight:850;letter-spacing:-7px;color:white;text-shadow:0 3px 25px #20272940;z-index:4;pointer-events:none}#toast{position:absolute;left:50%;top:30%;transform:translateX(-50%);padding:9px 15px;background:var(--paper);border-radius:5px;color:var(--red);font-size:13px;font-weight:650;z-index:6;pointer-events:none}#hint{position:absolute;left:50%;bottom:42px;transform:translateX(-50%);margin:0;font-size:11px;background:#f7f8f3ad;padding:9px 15px;border-radius:20px;z-index:3;white-space:nowrap}#touch-controls{position:absolute;bottom:max(39px,calc(env(safe-area-inset-bottom) + 28px));left:24px;right:24px;display:flex;align-items:center;justify-content:space-between;pointer-events:none;z-index:4}#touch-controls button{pointer-events:auto;user-select:none;touch-action:none;border:1px solid #f7f8f3b0;background:#f7f8f3b5;backdrop-filter:blur(5px);color:var(--ink)}#touch-controls .steer{width:69px;height:65px;font-size:44px;border-radius:12px;line-height:1}#touch-controls button.pressed{background:var(--ink);color:white;border-color:var(--ink)}#brake{align-self:end;border-radius:20px;font-size:11px;padding:10px 19px;margin-bottom:4px}#pause{position:absolute;bottom:34px;right:27px;border:0;background:none;font-size:11px;z-index:3}#recover{position:absolute;left:50%;top:70%;transform:translateX(-50%);z-index:5;background:var(--paper);border:0;border-radius:5px;padding:12px 16px;font-size:12px;box-shadow:0 3px 20px #20272915}#recover small{color:var(--red);margin-left:6px}footer{position:absolute;bottom:0;left:0;right:0;display:flex;justify-content:space-between;padding:10px 27px max(10px,env(safe-area-inset-bottom));font-size:9px;color:#42544a;pointer-events:none}footer a{pointer-events:auto;font-weight:600}dialog{border:0;border-radius:10px;background:var(--paper);color:var(--ink);width:min(430px,calc(100vw - 30px));max-height:calc(100dvh - 36px);padding:34px;box-shadow:0 25px 100px #20272945}dialog::backdrop{background:#20272968;backdrop-filter:blur(5px)}.close{position:absolute;right:10px;top:10px;background:none;font-size:23px;letter-spacing:0;width:30px;height:30px}h2{font-size:33px;line-height:1.02;letter-spacing:-1.3px;margin:8px 0 18px;font-weight:800}dialog p{font-size:12px;line-height:1.65;color:var(--muted)}.result-time{font-size:66px;line-height:1;font-weight:750;letter-spacing:-3px;font-variant-numeric:tabular-nums;margin:24px 0 6px}.result-time small{font-size:19px;letter-spacing:0}.splits{display:flex;justify-content:space-between;gap:15px;border-bottom:1px solid var(--line);padding:10px 0 19px;font-size:11px;color:var(--muted)}.splits strong{color:var(--ink)}dialog label{display:block;font-size:11px;margin:18px 0 7px}dialog input{width:100%;font:inherit;padding:12px;border-radius:5px;border:1px solid #aeb9ad;background:white;color:var(--ink)}dialog .primary{width:100%;margin-top:12px}.actions{display:flex;gap:10px;margin-top:10px}.secondary{background:none;border:1px solid var(--line);border-radius:5px;padding:12px;font-size:12px;flex:1}.cta{display:block;text-align:center;font-size:12px;text-decoration:underline;margin-top:24px}.note{font-size:10px!important;color:var(--muted)}.form-status{font-size:11px!important}table{width:100%;border-collapse:collapse;font-size:12px;margin:20px 0}th,td{padding:11px 0;text-align:left;border-bottom:1px solid var(--line)}th{font-size:10px;font-weight:500;color:var(--muted)}th:last-child,td:last-child{text-align:right}.empty{padding:20px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.menu-actions{display:grid;gap:8px}.menu-actions .secondary{text-align:left;padding:14px}#status{position:absolute;left:50%;bottom:22%;transform:translateX(-50%);z-index:20;background:var(--ink);color:white;max-width:90%;width:max-content;padding:12px 18px;font-size:12px;line-height:1.5;border-radius:5px}.hud-hidden #hud{display:none}@media(min-width:851px) and (pointer:fine){#touch-controls{display:none!important}}@media(max-width:850px),(pointer:coarse){#hint{bottom:118px}.race #pause{display:none}#map{right:15px;top:69px;width:95px;height:65px}}@media(max-width:550px){header{padding:18px 17px}.brand-logo{width:76px}.icon{width:33px;height:33px}#hud{top:13px;width:123px}.timer span{font-size:26px}.timer{padding:8px 12px}.timer small{font-size:8px}.race #board{display:none}#map{top:70px;width:86px;height:58px}#intro{bottom:49px}h1{font-size:29px;letter-spacing:-1px}#intro p{font-size:10px}#touch-controls{left:17px;right:17px}#touch-controls .steer{width:65px;height:62px}footer{padding-left:17px;padding-right:17px;font-size:8px}dialog{padding:32px 25px}.result-time{font-size:58px}}@media(max-height:510px){#app{min-height:340px}header{padding-top:12px}#intro{left:auto;right:30px;bottom:35px;transform:none}h1{font-size:28px}#hud{top:10px}#map{display:none!important}#touch-controls{bottom:30px}#touch-controls .steer{height:48px;width:55px}#hint{bottom:30px}#brake{margin-bottom:0}footer{padding-bottom:6px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

#ghost-label{display:block;font-size:9px;color:#307b85;text-align:center;padding:0 5px 7px}

.brand-logo{object-fit:contain;max-width:150px;height:40px}.brand-lockup{max-width:180px}#brand-name{font-size:17px;letter-spacing:-.7px}#intro{white-space:normal;width:min(520px,90vw)}.brand-lockup img[hidden]{display:none}#intro h1{text-wrap:balance}#celebration{position:absolute;inset:0;pointer-events:none;z-index:6}.finish-badge{display:inline-block;border:1px solid var(--line);padding:8px 12px;margin-top:5px;border-radius:30px;font-size:11px}dialog .note{overflow-wrap:anywhere}@media(max-width:550px){.brand-logo{max-width:100px;height:32px}.brand-lockup{max-width:105px}}

@media(max-width:550px){.brand-logo{width:100px}}

/* A clear invitation above the circuit; two-thumb controls during the lap. */
#intro{inset:100px 0 42px;width:100%;transform:none;display:flex;flex-direction:column;align-items:center;justify-content:space-between;pointer-events:none}
#intro .intro-copy{max-width:600px;padding:0 24px}#intro .eyebrow{font-size:10px;letter-spacing:2px;font-weight:650;margin-bottom:13px}#intro h1{font-size:clamp(34px,4vw,52px);margin-bottom:12px;letter-spacing:-2px}#intro #intro-tagline{font-size:13px}#intro .intro-launch{pointer-events:auto;text-align:center}#intro .intro-launch p{font-size:11px;margin:12px 0;color:var(--ink)}#intro .start-note{opacity:.65;font-size:10px!important}#start{min-width:210px;font-size:15px;min-height:52px}.mobile-help{display:none}
.steering-pair{display:flex;gap:10px}#brake{width:84px;height:65px;border-radius:12px;margin:0;font-size:13px;font-weight:700;padding:0}.race #touch-controls{bottom:max(38px,calc(env(safe-area-inset-bottom) + 28px))}#touch-controls button.pressed{background:var(--ink);color:var(--paper)}header{padding-top:max(20px,env(safe-area-inset-top))}#hud{top:max(19px,env(safe-area-inset-top))}dialog input{font-size:16px}.icon{min-width:44px;min-height:44px}
@media(max-width:850px),(pointer:coarse){.desktop-help{display:none}.mobile-help{display:block}#hint{bottom:120px}#intro{top:105px;bottom:max(42px,calc(env(safe-area-inset-bottom) + 30px))}}
@media(max-width:550px){#intro h1{font-size:39px;max-width:320px;letter-spacing:-1.5px}#intro .intro-copy{padding:0 20px}#intro #intro-tagline{font-size:12px}#touch-controls .steer{width:64px;height:64px}#brake{height:64px;width:84px}#hud{top:max(15px,env(safe-area-inset-top))}.race .brand-logo{width:75px}#intro .eyebrow{font-size:9px}}
@media(max-height:700px) and (min-height:511px){#intro{top:85px;bottom:35px}#intro h1{font-size:34px}#intro .eyebrow{margin-bottom:8px}}
@media(max-height:510px){#intro{inset:82px 28px 36px auto;width:240px;align-items:center;justify-content:center;gap:12px}#intro h1{font-size:30px;letter-spacing:-1px}#intro .intro-copy{padding:0}#intro .eyebrow{margin-bottom:8px}#intro #intro-tagline{display:none}#intro .intro-launch p{margin:8px 0}#start{min-height:46px}#touch-controls .steer,#brake{height:52px;width:64px}#hint{bottom:34px}.race #touch-controls{bottom:max(26px,env(safe-area-inset-bottom))}header{padding-left:max(24px,env(safe-area-inset-left));padding-right:max(24px,env(safe-area-inset-right))}}

@media(min-width:851px) and (min-height:511px){#intro{top:80px}}

.desktop-help kbd{display:inline-block;font-family:inherit;font-size:10px;font-weight:700;letter-spacing:.5px;border:1px solid #65736a;padding:4px 7px;border-radius:4px;background:var(--paper);box-shadow:0 2px 0 #65736a}#hint{font-weight:600;background:#f7f8f3e6}

/* Native long-press selection/callouts must not interrupt held driving inputs. */
#scene,#scene *,#touch-controls,#touch-controls *,#hud,#hint,#countdown,#toast,button{
 -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;
}
#scene,#scene *,#touch-controls,#touch-controls *{-webkit-user-drag:none;touch-action:none}
dialog input,dialog textarea{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}

/* Full-height thumb zones: the labels are cues, not targets. */
.race #touch-controls{inset:80px 0 0;display:block;pointer-events:none}
#touch-controls .control-zone{position:absolute;top:0;bottom:0;width:50%;height:100%;margin:0;padding:0;border:0;border-radius:0;background:transparent;backdrop-filter:none;pointer-events:auto;touch-action:none;color:var(--ink)}
#touch-controls #steer-pad{left:0}#touch-controls #brake{right:0;left:auto;width:50%;height:100%;align-self:auto}
#touch-controls .control-zone.pressed{border:0;color:var(--ink);background:linear-gradient(to top,#f7f8f330,transparent 45%)}
#touch-controls #brake.pressed{background:linear-gradient(to top,#d8423340,transparent 65%)}




#hud,#map,#hint,#countdown,#toast{pointer-events:none}
@media(max-height:510px){.race #touch-controls{top:68px}#hint{bottom:92px}}

/* One steering surface covers the entire track view on touch screens. */
.race #touch-controls{inset:0}
#touch-controls #steer-pad{inset:0;width:100%;height:100%}

@media(max-height:510px){.race #touch-controls{top:0}}

.ghost-driver{position:absolute;z-index:3;max-width:160px;padding:5px 9px;border-radius:12px;background:#f7f8f3e8;border:1px solid #56a7b761;color:#286675;font-size:10px;font-weight:650;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transform:translate(-50%,-100%);box-shadow:0 2px 8px #20303912;pointer-events:none;user-select:none;-webkit-user-select:none}
#ghost-label{max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:550px){#ghost-label{max-width:140px}.ghost-driver{max-width:150px;font-size:9px}}

/* Keep the invitation readable while the actual grid fills the background. */
#app.intro::after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(to bottom,#f7f8f32e 0%,transparent 32%,transparent 73%,#f7f8f34d 100%);z-index:1}
@media(max-height:510px) and (min-aspect-ratio:7/5){#app.intro::after{background:linear-gradient(to right,transparent 38%,#f7f8f335 52%,#f7f8f3e6 72%,#f7f8f3f5 100%)}}
#app.intro footer{z-index:2}

/* Invitation, grid and race UI share Pocket Putt's short fade and opening move. */
#intro .intro-copy,#intro .intro-launch{transition:opacity .18s ease-out,transform .18s ease-out}
.launching #intro .intro-copy,.launching #intro .intro-launch{opacity:0;transform:translateY(-6px);pointer-events:none}
#hud,#map,#pause{transition:opacity .2s ease-out}
.launching #hud,.launching #map,.launching #pause{opacity:0}
#app::after{content:"";position:absolute;inset:0;pointer-events:none;z-index:1;background:linear-gradient(to bottom,#f7f8f32e 0%,transparent 32%,transparent 73%,#f7f8f34d 100%);opacity:0;transition:opacity .18s ease-out}
#app.intro::after{opacity:1}
@media(max-height:510px) and (min-aspect-ratio:7/5){#app::after{background:linear-gradient(to right,transparent 38%,#f7f8f335 52%,#f7f8f3e6 72%,#f7f8f3f5 100%)}}
.primary,.secondary,.icon,#pause{transition:transform .12s ease-out,opacity .12s ease-out}
.primary:active:not(:disabled),.secondary:active:not(:disabled),.icon:active,#pause:active{transform:scale(.97)}
@media(hover:hover) and (pointer:fine){.primary:hover:not(:disabled){filter:brightness(.94)}.secondary:hover,.icon:hover{background:var(--paper)}}
dialog[open]::backdrop{animation:veil-in .18s ease-out}
.result-time{animation:result-in .24s .06s cubic-bezier(.16,1,.3,1) both}
@keyframes veil-in{from{opacity:0}to{opacity:1}}
@keyframes result-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.primary:active:not(:disabled),.secondary:active:not(:disabled),.icon:active,#pause:active{transform:none}}
