@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,700;0,800;0,900;1,900&family=Barlow:wght@400;500;600;700&display=swap');
:root{color-scheme:dark;--bg:#141412;--panel:#1e1e1a;--line:#36352e;--muted:#b2ada0;--white:#f5f0e4;--yellow:#ffca45;--heading:"Impact","Arial Narrow","Helvetica Neue Condensed Black","Arial Black",sans-serif;font-family:system-ui,-apple-system,sans-serif}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:var(--bg);color:var(--white);font-size:15px}
button{font:inherit;cursor:pointer;color:inherit}
button:focus-visible{outline:2px solid white;outline-offset:3px}
button:disabled{cursor:default;opacity:.55}
.frame{width:min(1220px,calc(100% - 64px));margin-inline:auto}
.masthead{border-bottom:1px solid var(--line);background:#171714}
.top{height:76px;display:flex;align-items:center;justify-content:space-between;gap:24px}
.brand{display:flex;align-items:center;gap:12px;background:none;border:0;padding:0;text-align:left;font-weight:950;font-size:19px;letter-spacing:-.045em;line-height:1}
.brand strong{color:var(--yellow)}
.brand small{display:block;color:var(--muted);font-size:8px;letter-spacing:.27em;margin-top:5px}
.brand-icon{display:grid;place-items:center;width:38px;height:38px;background:var(--yellow);color:var(--bg);font:900 37px/.8 sans-serif;transform:skew(-8deg)}
nav{align-self:stretch;display:flex;gap:31px}
nav button{background:none;border:0;border-bottom:2px solid transparent;color:var(--muted);font-weight:700;padding:2px 2px 0}
nav .active,nav button:hover{color:var(--yellow);border-color:var(--yellow)}
.wallet{display:flex;align-items:center;gap:7px;border:1px solid #5b4b25;background:#242015;color:var(--yellow);padding:9px 12px;font:700 12px ui-monospace,monospace;white-space:nowrap}
.wallet strong{font-size:16px}
main{min-height:calc(100vh - 150px);padding-top:26px}
.hero{position:relative;min-height:clamp(380px,43vw,535px);display:flex;align-items:end;isolation:isolate;border:1px solid #504738;background:#393024 linear-gradient(90deg,#15130f 2%,#15130fe9 24%,#15130f78 53%,#15130f08 90%);overflow:hidden}
.hero::before{content:"";position:absolute;inset:0;z-index:-2;background:#3d3529 url('hero-classics.webp') center 60%/cover no-repeat}
.hero::after{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,#15130ff5 1%,#15130fbd 29%,#15130f44 56%,transparent 83%),linear-gradient(0deg,#17150fd6,transparent 33%)}
.hero-copy{padding:45px 52px}
.eyebrow{font:750 11px/1.4 ui-monospace,monospace;letter-spacing:.16em;color:var(--yellow);margin:0 0 10px}
.eyebrow span{display:inline-block;width:22px;border-top:2px solid;margin:0 8px 3px 0}
h1,h2,h3,p{margin-top:0}
h1,h2{font-family:var(--heading);text-transform:uppercase;letter-spacing:.012em;font-weight:900;margin-bottom:0}
.hero h1{font-size:clamp(62px,8.5vw,121px);line-height:.87;letter-spacing:.008em}
.hero h1 em{font-style:normal;color:var(--yellow)}
.intro{max-width:345px;color:#e4dccc;line-height:1.55;margin:21px 0 25px}
.primary,.outline{display:inline-flex;align-items:center;justify-content:space-between;gap:20px;font-weight:850;padding:11px 15px;min-height:42px;border:1px solid var(--line);background:#23221e;text-align:left}
.primary{border-color:var(--yellow);background:var(--yellow);color:#17140c;padding:13px 20px;min-width:180px}
.primary:hover:not(:disabled){background:#ffda78}
.outline:hover:not(:disabled){border-color:var(--yellow);color:var(--yellow)}
.primary span,.outline span{font-size:19px;line-height:1}
.home-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:15px;margin-top:15px}
.panel{min-width:0;background:var(--panel);border:1px solid var(--line);padding:23px;display:flex;flex-direction:column}
.panel .outline{align-self:start;margin-top:auto}
.panel-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
h2{font-size:clamp(24px,3vw,33px);line-height:1.04}
.tag{flex:none;color:#cdc3a6;border:1px solid #4d4637;padding:5px 7px;font:650 10px ui-monospace,monospace}
.panel-copy{color:var(--muted);line-height:1.55;margin:14px 0 21px}
.stats{display:grid;gap:7px;margin:15px 0}
.stat{color:var(--muted);font-size:12px;display:grid;grid-template-columns:75px 1fr 25px;align-items:center;gap:8px}
.stat b{text-align:right;color:var(--white);font:700 11px ui-monospace,monospace}
.stat meter{display:block;width:100%;height:6px;appearance:none;background:#36342b}
.stat meter::-webkit-meter-bar{height:6px;background:#36342b;border:0;border-radius:0}
.stat meter::-webkit-meter-optimum-value{background:var(--yellow)}
.stat meter::-moz-meter-bar{background:var(--yellow)}
.stat-speed{grid-template-columns:1fr auto;gap:3px 8px;border-top:1px solid var(--line);padding-top:7px}
.stat-speed b{color:var(--yellow);font-size:12px}
.stat-speed small{grid-column:1/-1;font-size:11px}
#map{width:100%;height:80px;margin:8px 0;display:block;background:#191916;border:1px solid #302e27}
.race-meta,.record{display:flex;flex-wrap:wrap;gap:10px 17px;color:var(--muted);font-size:12px}
.race-meta b,.record b{color:var(--yellow)}
.record{margin-top:19px;padding:11px 0;align-items:center}
.record span:first-child,footer{font:650 10px ui-monospace,monospace;letter-spacing:.09em}
footer{display:flex;justify-content:space-between;gap:12px;padding:20px 0;margin-top:18px!important;border-top:1px solid var(--line);color:var(--muted)}
footer b{color:var(--white)}
.section-head{padding:27px 0 22px}
.section-head h1,.race-header h1{font-size:clamp(46px,7vw,77px);line-height:.95}
.section-head p:last-child{color:var(--muted);margin:14px 0 0}
.secondary-head{padding:25px 0 16px}
.vehicle-grid,.garage-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}
.garage-grid{grid-template-columns:1fr 1.15fr}
.vehicle-art{width:100%;height:auto;aspect-ratio:480/226;background:#211d18;border:1px solid var(--line);display:block;margin-bottom:17px;object-fit:contain}

#upgrades{display:grid;gap:9px}
.upgrade{display:flex;flex-direction:row;justify-content:space-between;gap:15px;align-items:center;padding:16px 20px}
.upgrade h3{margin:0;font-size:16px}
.upgrade p{margin:5px 0 0;color:var(--muted);font-size:13px}
.upgrade .outline{margin:0;flex:none;align-self:center;white-space:nowrap}
#race{position:relative}
.race-header{display:flex;align-items:end;justify-content:space-between;gap:15px;margin:4px 0 15px;padding-right:100px;min-height:44px}
.race-header h1{font-size:clamp(35px,6vw,59px)}
#pause{position:absolute;top:0;right:0}
.race-shell{width:min(100%,max(400px,calc((100svh - 220px) * 100 / 54)));max-width:1000px;margin:auto}
.hud{display:grid;grid-template-columns:repeat(4,1fr);background:#24221c;border:1px solid var(--line);padding:10px 14px;font:700 11px ui-monospace,monospace;color:var(--muted);gap:6px}
.hud strong{color:var(--yellow);margin-left:8px;font-size:17px}
.stage{position:relative;aspect-ratio:1000 / 540;background:#1b1c17;overflow:hidden}
#track{position:absolute;inset:0;display:block;width:100%;height:100%}
#countdown,#overlay{position:absolute;inset:0;display:grid;place-items:center}
#countdown{pointer-events:none;color:var(--yellow);font:900 clamp(52px,11vw,100px)/1 var(--heading);text-shadow:0 4px 16px black}
#overlay{background:#10100cbd;padding:12px;overflow:auto}
.result{background:var(--panel);border:1px solid #6d582f;padding:clamp(10px,3vw,32px);max-width:440px;text-align:center;box-shadow:0 12px 40px #0008}
.result p{margin:8px 0;color:var(--muted)}
.result .result-text{white-space:pre-line;margin-bottom:15px}
.result-actions{display:flex;justify-content:center;gap:8px;flex-wrap:wrap}
.touch-controls{display:none}
#notice{position:fixed;right:18px;bottom:18px;padding:11px 17px;background:var(--yellow);color:#19140c;font-weight:800;box-shadow:0 5px 25px #0007;max-width:calc(100% - 36px)}
@media(max-width:880px){.frame{width:calc(100% - 32px)}.hero-copy{padding:35px}.home-grid{grid-template-columns:1fr 1fr}.home-grid article:last-child{grid-column:1/-1}.panel{padding:18px}}
@media(max-width:580px){main{padding-top:14px}.top{height:auto;display:grid;grid-template-columns:1fr auto;gap:0 10px;padding-top:12px}.top-right{grid-column:2;grid-row:1}.brand{font-size:16px}.brand-icon{width:30px;height:30px;font-size:30px}nav{grid-row:2;grid-column:1/-1;justify-content:space-between;gap:6px;height:43px}.hero{min-height:405px}.hero-copy{padding:20px}.hero::before{background-position:58% 50%}.hero::after{background:linear-gradient(0deg,#15130ffc,#15130fa0 46%,#15130f15)}.home-grid,.garage-grid,.vehicle-grid{grid-template-columns:1fr}.hud{padding:6px;font-size:9px}.hud strong{display:block;margin:2px 0 0;font-size:14px}.result .eyebrow{display:none}.result h2{font-size:21px}.result p{font-size:12px;margin:4px 0}.result .primary,.result .outline{min-width:0;min-height:32px;padding:5px 9px;font-size:12px}}


.hud strong.critical{color:#ff8f70}
#race-feedback{position:absolute;top:10px;left:50%;transform:translateX(-50%);background:#1e1e1aeb;border:1px solid #ffca45;color:#ffca45;padding:5px 9px;font:900 clamp(9px,1.6vw,13px) ui-monospace,monospace;white-space:nowrap;pointer-events:none}
.driving-guide{margin-top:12px;border:1px solid var(--line);background:var(--panel);color:var(--muted)}
.driving-guide summary{cursor:pointer;padding:12px 16px;font-weight:800;color:var(--white)}
.driving-guide summary::marker{color:var(--yellow)}
.driving-guide summary:focus-visible{outline:2px solid var(--yellow);outline-offset:2px}
.driving-keys{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px 18px;margin:0;padding:4px 16px 12px}
.driving-keys dt{font-weight:750;color:var(--white)}
.driving-keys dd{margin:6px 0 0;font-size:13px}
.driving-keys kbd{display:inline-block;padding:2px 5px;background:#343127;border:1px solid #57503a;color:var(--yellow);border-radius:3px}
.driving-touch{margin:0;padding:0 16px 13px;font-size:13px}
@media(max-width:580px){.driving-keys{grid-template-columns:repeat(2,minmax(0,1fr))}}

.race-minimap{position:absolute;right:12px;bottom:12px;width:clamp(86px,16%,145px);height:auto;background:#201d17d9;border:1px solid #d5c09a66;border-radius:6px;pointer-events:none}
@media(max-width:580px){.race-minimap{right:7px;bottom:7px}}

#course-choice{margin:0;padding:0;border:0;min-width:0}
.choice-list{display:flex;flex-wrap:wrap;gap:6px}
.choice-list label{position:relative;flex:1 1 125px;display:flex}
.choice-list input{position:absolute;opacity:0;pointer-events:none}
.choice-list span{display:flex;align-items:center;width:100%;padding:7px 9px;border:1px solid #51483a;background:#28241d;color:var(--muted);font-size:12px;font-weight:750;cursor:pointer}
.choice-list input:checked+span{border-color:var(--yellow);color:var(--yellow);background:#332b1b}
.choice-list input:focus-visible+span{outline:2px solid var(--white);outline-offset:2px}
.course-recommendation{margin:0 0 9px;color:var(--yellow);font-size:.87rem;line-height:1.4}
.course-description{color:var(--muted);font-size:12px;margin:2px 0 9px;line-height:1.45}

.top-right{display:flex;align-items:center;gap:8px}
.choice-list+.choice-list{margin-top:8px}
.choice-list input:disabled+span{opacity:.5;cursor:default}
#course-title{margin-top:10px;font-size:1.23rem}
.campaign-status{color:var(--yellow);font-size:.87rem;font-weight:750;margin:5px 0 0}
.weather-state{display:inline-block;border:1px solid var(--line);padding:4px 9px;margin:0 0 6px;color:var(--muted);font-size:.80rem;font-weight:800}
.weather-state.rain{background:#253842;color:#bde1ef;border-color:#465866}
@media(max-width:420px){.top-right{gap:4px}.wallet{padding:6px}.audio-menu summary{padding:6px;font-size:.74rem}}

.race-conditions{display:flex;align-items:center;gap:10px;margin-bottom:6px}
.weather-state{margin:0}
.race-goal{margin:0;font-size:.80rem;font-weight:750;color:var(--yellow)}

.car-condition{margin:7px 0 4px;font-size:.84rem;font-weight:650;color:#b1cb97}
.car-condition.needs-work{color:#f0af73}
.repair-panel{padding:16px 20px}
.repair-panel h3{margin:0}
.repair-panel p{margin:6px 0 10px;color:var(--muted);font-size:.87rem}
.repair-actions{display:flex;flex-wrap:wrap;gap:6px}
.vehicle-panel .primary{align-self:start;margin-top:auto}

.audio-menu{position:relative;z-index:10}
.audio-menu summary{cursor:pointer;padding:8px 10px;border:1px solid var(--line);background:#27251c;color:var(--white);font-size:.82rem;font-weight:750;white-space:nowrap}
.audio-menu.waiting-for-audio summary{border-color:#786036;color:var(--yellow)}
.audio-options{position:absolute;right:0;top:calc(100% + 5px);min-width:180px;padding:10px;background:#27231d;border:1px solid #625341;box-shadow:0 9px 22px #0008}
.audio-options label{display:flex;align-items:center;gap:9px;min-height:34px;cursor:pointer}
.audio-options input{accent-color:var(--yellow)}
#audio-start{width:100%;margin-top:6px;font-size:.84rem}
.locked-course span{color:#b2a38d;border-style:dashed}
.course-unlock{margin:8px 0 0;font-size:.83rem;line-height:1.4;color:#f5c878}
.records-panel{margin-top:5px}
.records-panel .panel-head{align-items:baseline;flex-wrap:wrap}
.records-panel .driver-button{font-size:.82rem;margin:0}
.stats-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px}
.records-scroll{overflow:auto}
.records-table{border-collapse:collapse;width:100%;text-align:left;font-size:.9rem}
.records-table th,.records-table td{border-bottom:1px solid var(--line);padding:9px 5px}
.records-table th{color:var(--muted)}
.records-table td:nth-child(2){overflow-wrap:anywhere}
.records-table td:last-child,.records-table th:last-child{text-align:right;white-space:nowrap}
.track-records{margin-top:8px}
.track-records tbody th{color:var(--white);overflow-wrap:anywhere}
.track-records tbody td:last-child{color:var(--yellow);font-variant-numeric:tabular-nums}
.track-records tbody tr:nth-child(odd){background:#ffffff06}
.records-empty,.records-panel small{color:var(--muted)}
.records-panel small{margin-top:12px}
#driver-dialog{width:min(430px,calc(100% - 32px));padding:22px;border:1px solid #766341;background:#25211b;color:var(--white)}
#driver-dialog::backdrop{background:#0d0c0ad5}
#driver-dialog h2{margin:0 0 9px}
#driver-dialog p{color:var(--muted);line-height:1.5}
#driver-dialog label{display:block;font-weight:750;margin-bottom:5px}
#driver-name{width:100%;padding:9px 10px;border:1px solid #6b5b44;background:#181713;color:var(--white);font:inherit}
#driver-dialog .driver-audio{font-size:.83rem;margin:9px 0 14px}
#driver-dialog .result-actions{justify-content:flex-start}

.panel .upgrade-gate{color:#e5bb7b;font-size:.84rem}

#race-dashboard{position:absolute;left:10px;bottom:9px;width:clamp(151px,35%,280px);height:auto;filter:drop-shadow(0 3px 5px #0008);pointer-events:none}
@media(max-width:580px){#race-dashboard{left:5px;bottom:5px;width:clamp(138px,37%,200px)}}

.campaign-panel .outline{font-size:.86rem;margin:0}
#campaign-current{color:var(--yellow);font-weight:750;margin:10px 0 8px}
.race-conditions{flex-wrap:wrap}
.race-campaign-clock{margin:0 0 0 auto;color:var(--muted);font-size:.8rem;font-variant-numeric:tabular-nums}
.race-campaign-clock strong{color:var(--yellow);margin-left:4px}
.settings-dialog{width:min(460px,calc(100% - 32px));padding:22px;border:1px solid #766341;background:#25211b;color:var(--white)}
.settings-dialog::backdrop{background:#0d0c0ad5}
.settings-dialog h2{margin:0 0 9px}
.settings-dialog p{color:var(--muted);line-height:1.5}
.settings-dialog .result-actions{justify-content:flex-start}

.profile-panel{margin-bottom:9px}
#profile-status{color:var(--muted);margin-left:6px}
.profile-statistics{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin:15px 0}
.profile-statistics dt{color:var(--muted);font-size:.82rem}
.profile-statistics dd{margin:3px 0 0;color:var(--yellow);font-size:1.15rem;font-weight:800;font-variant-numeric:tabular-nums}
.profile-actions{border:0;padding:0;margin:0 0 16px;min-width:0}
.profile-actions label{display:block;font-weight:750;margin:12px 0 5px}
.profile-actions :is(select,input){box-sizing:border-box;min-width:0;max-width:100%;background:#161511;color:var(--white);border:1px solid #766341;border-radius:3px;padding:9px}
.profile-actions select{flex:1 1 140px}
.profile-actions input{flex:1 1 125px}
.profile-actions .result-actions{gap:8px}
#profile-copy{margin:10px 0 0}
#profile-error{color:#ffd06d}
.reserve-warning{position:absolute;inset:clamp(5px,2vw,17px) auto auto 50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 18px);box-sizing:border-box;display:grid;gap:3px;padding:clamp(5px,1.25vw,12px) clamp(9px,2vw,22px);text-align:center;pointer-events:none;background:#17120a;color:#ffcd55;border:2px solid #ffb83e;box-shadow:0 4px 24px #000c}
.reserve-warning strong{font:900 clamp(16px,3.8vw,36px)/1 var(--heading);letter-spacing:.04em}
.reserve-warning span{font-weight:800;font-size:clamp(10px,1.8vw,17px);color:#fff2d5}

.account-button{min-height:34px;padding:6px 10px;white-space:nowrap}
.auth-tabs,.account-tools{margin:10px 0}
.profile-actions label.auth-field{display:grid;gap:5px}
.auth-field input{width:100%}
#account-form p{margin:10px 0}
#legacy-transfer{border-top:1px solid var(--line);margin-top:12px;padding-top:5px}
@media(max-width:780px){.top{height:auto;display:grid;grid-template-columns:1fr auto;gap:0 10px;padding-top:10px}.top-right{grid-column:2;grid-row:1}nav{grid-row:2;grid-column:1/-1;justify-content:space-between;gap:5px;height:43px}body:has(#race:not([hidden])) .top{height:auto}}
@media(max-width:480px){.account-button{padding:4px 6px;font-size:.76rem}.top .brand-icon{display:none}.top .brand{font-size:14px}.top-right{gap:4px}}
body:has(#race:not([hidden])) main{padding-top:10px}
.race-header{margin:0 0 8px}
.race-header h1{font-size:clamp(25px,5vw,44px)}
.race-header .eyebrow{margin-bottom:5px}
@media (min-width:701px){body:has(#race:not([hidden])) .top{height:57px}}

:root {
  --bg: #141611;
  --panel: #202219;
  --line: #494737;
  --muted: #c7beaa;
  --white: #f6ecda;
  --yellow: #ffc554;
  --heading: "Barlow Condensed", Impact, "Arial Narrow", sans-serif;
  font-family: Barlow, system-ui, sans-serif;
}
body { font-size: 1rem; }
.masthead { background: #171912; }
.masthead .brand { color: var(--white); text-decoration: none; }
.masthead .brand:hover small { color: var(--yellow); }
.brand { font: italic 900 1.38rem / .9 var(--heading); }
.brand small { font: 700 .68rem / 1 Barlow, sans-serif; letter-spacing: .14em; }
.brand-icon { width: 39px; height: 39px; background: transparent; transform: none; }
.hero { border-color: #605031; box-shadow: 0 4px #2b2417; }
.hero::after { background: linear-gradient(90deg,#14140ff5,#151610b7 31%,#14160e20 64%,transparent 86%),linear-gradient(0deg,#16160fa3,transparent 47%); }
.hero h1 { font-weight: 900; text-shadow: 3px 4px #201b11; }
.hero h1 em { font-style: italic; }
.hero-copy .intro { text-shadow: 0 1px 2px #15130f; }
.primary { box-shadow: 0 3px #956022; }
.outline, .audio-menu summary, .audio-options { background: #29281f; }
.panel h2 { font-weight: 800; }
.vehicle-photo {
  aspect-ratio: 3 / 2;
  background-image: url('klasyki-garaz.webp');
  background-size: 300% 300%;
  background-position: var(--px) var(--py);
}
.vehicle-photo.prl-photo { background-image: url('klasyki-prl.webp'); }
.stage { background: #303724; border-inline: 1px solid #6a5939; }
.hud { background: #282619; border-color: #685838; }
#countdown { text-shadow: 3px 4px #442c1a, 5px 6px #1b1b14; }
#race-feedback, .race-minimap { border-radius: 0; }
footer { flex-wrap: wrap; font-size: .79rem; }
footer a { color: var(--yellow); text-underline-offset: .2em; }
a:focus-visible { outline: 2px solid var(--yellow); outline-offset: 4px; }
html:not([data-practice]) [data-play="online"],
html[data-practice] [data-play="practice"] { display: none; }
.play-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.play-actions a, .guest-choice a { color: var(--white); text-decoration: none; }
.signed-in-driver { align-self: center; margin: 0; color: var(--white); }
.signed-in-driver strong { color: var(--yellow); overflow-wrap: anywhere; }
.practice-note { max-width: 39ch; margin: .75rem 0 0; color: var(--white); line-height: 1.4; text-shadow: 0 1px 3px #15130f; }
.guest-choice { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.guest-choice p { margin-bottom: 0; }
.practice-stats { gap: .5rem; }
.practice-stats p { margin: 0; }
.leaderboard-intro { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .75rem; margin: 1rem 0; }
.leaderboard-intro p { margin: 0; color: var(--muted); }
.leaderboard-join a { color: var(--white); text-decoration: none; }
#leaderboard-status:empty { display: none; }
#campaign-current { margin-bottom: 0; }
html[data-practice] #account-open,
html[data-practice] #profile-open,
html[data-practice] [data-mode-label="online"],
html:not([data-practice]) [data-mode-label="practice"] { display: none; }
footer .training-label { color: var(--yellow); }
@media(max-width:580px) {
  .hero::after { background: linear-gradient(0deg,#17160ffc,#17160faa 45%,#18180b15); }
  .hero h1 { font-size: clamp(3.5rem, 13vw, 6rem); }
  .hero-copy { padding-block: 1.8rem; }
  .play-actions .primary { min-width: 0; }
}

.touch-stick,
.touch-actions button {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.touch-actions { display: flex; gap: 8px; align-items: center; }
.touch-actions button {
  min-width: 58px;
  min-height: 56px;
  border: 1px solid #635635;
  border-radius: 8px;
  background: #29281e;
  color: var(--white);
  font-weight: 800;
}
.touch-actions button.is-held { background: var(--yellow); color: #17140c; }
.touch-stick {
  position: relative;
  width: clamp(104px, 26vw, 140px);
  aspect-ratio: 1;
  border: 2px solid #6a5940;
  border-radius: 50%;
  background: radial-gradient(circle, #3b3526 19%, #25251d 20% 57%, #302b1f 58%);
  color: var(--muted);
}
.touch-stick span { position: absolute; pointer-events: none; line-height: 1; }
.stick-up, .stick-down { left: 50%; transform: translateX(-50%); }
.stick-left, .stick-right { top: 50%; transform: translateY(-50%); }
.stick-up { top: 5px; }
.stick-down { bottom: 5px; }
.stick-left { left: 7px; }
.stick-right { right: 7px; }
.touch-stick .stick-knob {
  inset: 50% auto auto 50%;
  width: 35%;
  aspect-ratio: 1;
  border: 2px solid #edba59;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #fbd47d, #9e6b25);
  box-shadow: 0 3px 8px #13120c;
  transform: translate(calc(-50% + var(--stick-x, 0px)), calc(-50% + var(--stick-y, 0px)));
}
#race.left-handed .touch-actions { order: 1; }

@media (any-pointer: coarse), (max-width: 880px) {
  .touch-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px 0; }
  .choice-list span, .account-button, .audio-menu summary { min-height: 44px; }
  .audio-menu summary { align-content: center; }
  .race-shell { width: 100%; }
}
@media (orientation: portrait) and (max-width: 880px) {
  .stage { height: clamp(220px, calc(100svh - 314px), 590px); aspect-ratio: auto; }
}
@media (orientation: portrait) and (max-width: 580px) {
  body:has(#race:not([hidden])) .masthead { display: none; }
  .stage { height: clamp(200px, calc(100svh - 282px), 650px); }
}
@media (max-width: 420px) {
  .frame { width: calc(100% - 24px); }
  .top .brand { font-size: 13px; min-width: 0; }
  .brand small { font-size: .59rem; }
  .wallet strong { font-size: 14px; }
  .upgrade { flex-wrap: wrap; }
  .race-conditions { gap: 4px 8px; }
  .race-campaign-clock { margin-left: 0; }
}
@media (any-pointer: coarse) and (orientation: landscape),
       (orientation: landscape) and (max-height: 550px) and (max-width: 950px) {
  body:has(#race:not([hidden])) { overflow: hidden; }
  body:has(#race:not([hidden])) :is(.masthead,footer) { display: none; }
  body:has(#race:not([hidden])) main {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: env(safe-area-inset-top) max(4px, env(safe-area-inset-right))
      env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
  }
  #race, .race-shell { height: 100%; }
  #race :is(.race-header,.race-conditions,#race-guide) { display: none; }
  .race-shell {
    --buttons-width: 64px;
    --stick-width: clamp(106px, 14vw, 135px);
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: var(--buttons-width) minmax(0, 1fr) var(--stick-width);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 4px;
  }
  #race.left-handed .race-shell {
    grid-template-columns: var(--stick-width) minmax(0, 1fr) var(--buttons-width);
  }
  .hud {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    align-items: center;
    padding: 0 4px;
  }
  .hud strong { display: inline; font-size: 14px; }
  #pause { position: static; min-height: 44px; padding: 4px 12px; }
  .stage { grid-column: 2; grid-row: 2; aspect-ratio: auto; }
  #race-dashboard { inset: 6px auto auto 7px; width: clamp(106px, 26%, 185px); }
  .touch-controls { display: contents; }
  .touch-actions, .touch-stick { grid-row: 2; place-self: center; }
  .touch-actions { grid-column: 1; flex-direction: column; }
  .touch-stick { grid-column: 3; width: min(120px, 100%); }
  #race.left-handed .touch-stick { grid-column: 1; }
  #race.left-handed .touch-actions { grid-column: 3; }
}

#race.rotation-required :is(.race-header,.race-shell) { display: none; }
.race-rotate {
  padding: 28px 20px;
  margin-top: 12px;
  border: 1px solid #685838;
  background: var(--panel);
}
.race-rotate h1 { font-size: clamp(34px, 7vw, 56px); line-height: 1; }
.race-rotate p:not(.eyebrow) { max-width: 33ch; margin: 12px 0 18px; color: var(--muted); }
.race-rotate .outline { min-height: 44px; }
