*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#65c3ee;color:white;font-family:system-ui,-apple-system,sans-serif}
[hidden]{display:none!important}
button{font:inherit;font-weight:900;cursor:pointer;color:#173557;background:#f9fcff;border:3px solid #173557;border-radius:16px;min-width:44px;min-height:44px;touch-action:none;box-shadow:0 4px 0 #173557}
button:hover{background:#c9fbff;transform:translateY(-1px)}
button:active,.held{transform:translateY(3px);box-shadow:0 1px 0 #173557;background:#73f8ec!important}
button:focus-visible{outline:4px solid #ffdb56;outline-offset:4px}
#world{position:fixed;inset:0;width:100%;height:100%;display:block;touch-action:none}
.overlay{position:fixed;inset:0;background:linear-gradient(#17355722,transparent 32%,transparent 56%,#142e5966);overflow:hidden}
.menuCard{position:absolute;inset:25px 30px 22px;display:flex;flex-direction:column;align-items:center}
h1,h2,.raceLead,#toast,#steerHint{font-weight:950;paint-order:stroke fill;-webkit-text-stroke:5px #173557;text-shadow:0 5px 0 #173557}
h1{font-size:clamp(56px,7.5vw,112px);line-height:.95;letter-spacing:-5px;margin:4px 0 0;transform:skew(-5deg);text-align:center}
h1 em{color:#ffdb56;font-style:normal}
.lede{font-size:21px;font-weight:900;text-shadow:0 2px 3px #173557;margin:13px 0 0}
.coverSpace{flex:1;min-height:10px}
.selection{text-align:center;width:min(560px,100%)}
.instructions{font-size:17px;font-weight:800;margin:8px 0 12px;text-shadow:0 2px 3px #173557}
.instructions b{color:#ffe26c}
#arenaChoices{display:flex;gap:10px;justify-content:center}
#arenaChoices button{flex:1;font-size:14px;line-height:1.1;min-height:48px;padding:9px 8px;border-radius:22px;background:#ebf7ff}
#arenaChoices button.selected{background:#ffdb56}
#arenaChoices small{font-size:10px;display:block;margin-top:4px}
#arenaDescription{font-size:13px;font-weight:800;text-shadow:0 2px 3px #173557;margin:12px 0}
.primary{background:#ffdb56;font-size:25px;min-height:65px;padding:12px 24px;box-shadow:0 6px 0 #173557}
#start{width:280px}
.primary:hover{background:#ffe98e}
.tips{font-size:12px;font-weight:700;text-shadow:0 2px 3px #173557;margin:14px 0 0}
#saveNote{font-size:11px;font-weight:700;text-shadow:0 2px 3px #173557}
#hud{position:fixed;inset:0;pointer-events:none;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
.iconButton{position:absolute;top:max(15px,env(safe-area-inset-top));width:48px;height:48px;border-radius:50%;font-size:23px;pointer-events:auto;background:#fff9}
#pause{left:16px}#fullscreen{right:16px}
.raceHud{position:absolute;left:50%;top:16px;transform:translateX(-50%);text-align:center}
.raceLead{display:flex;align-items:center;justify-content:center;gap:24px;line-height:1}
#rank{font-size:50px;color:#ffdc52}
#playerScore{font-size:45px}
#playerScore span{font-size:26px}
.coreIcon{color:#ffdc52;font-size:35px;-webkit-text-stroke:2px #173557}
#scores{display:flex;justify-content:center;gap:18px;margin:10px 0 0;font-weight:900;font-size:15px;text-shadow:0 2px 2px #173557,1px 0 #173557,-1px 0 #173557}
.score{white-space:nowrap;color:var(--color)}
.score b{color:#fff;font-size:19px;margin-left:5px}
#arenaName{position:absolute;left:20px;top:76px;font-size:12px;font-weight:900;text-shadow:0 2px 3px #173557}
.mission{position:absolute;bottom:40px;left:50%;transform:translateX(-50%);text-align:center;text-shadow:0 2px 3px #173557;font-weight:900}
.mission b{font-size:22px;paint-order:stroke fill;-webkit-text-stroke:3px #173557}
.mission span{display:block;font-size:13px;margin-top:4px}
.boostMeter{position:absolute;right:25px;bottom:25px;width:118px;text-align:right;text-shadow:0 2px 3px #173557;font-weight:900}
.boostMeter>span{float:left;font-size:26px;color:#ffdb56}
.energy{height:10px;border:2px solid #173557;border-radius:8px;overflow:hidden;background:#17355788;margin:10px 0 8px 30px}
.energy i{height:100%;display:block;background:#5ff7e7}
.boostMeter b{font-size:35px}.boostMeter small{font-size:10px;margin-left:4px}
#toast{position:absolute;top:28%;left:50%;transform:translateX(-50%) rotate(-3deg);text-align:center;font-size:37px;line-height:1.1;color:#ffdb56;opacity:0;max-width:80%;width:max-content;-webkit-text-stroke:4px #173557;transition:opacity .15s}
#steerHint{position:absolute;left:50%;bottom:24%;transform:translateX(-50%);font-size:25px;white-space:nowrap;-webkit-text-stroke:3px #173557}
.desktopHelp{position:absolute;bottom:14px;left:20px;font-size:12px;font-weight:800;text-shadow:0 2px 3px #173557}
#markers{position:absolute;inset:0;pointer-events:none}
.marker{position:absolute;transform:translate(-50%,-100%);white-space:nowrap;font-size:13px;font-weight:950;text-shadow:0 2px 2px #173557,-1px 0 #173557,1px 0 #173557;color:var(--color);text-align:center}
.marker:after{content:"▼";display:block;font-size:10px;color:var(--color);margin-top:1px}
.marker.edge{transform:translate(-50%,-50%);font-size:12px}
.marker.edge:after{display:none}
.marker em{display:inline-block;font-style:normal;font-size:17px;line-height:1;margin-right:3px}
.marker.objective{font-size:16px;color:#ffdd52}
.marker.home{color:#55ffee}
.modal{display:flex;align-items:center;justify-content:center;background:#17355755;backdrop-filter:blur(3px)}
.modal section{text-align:center;width:min(350px,85%)}
h2{font-size:clamp(40px,6vw,76px);line-height:1;letter-spacing:-2px;margin:0;color:#ffdb56}
.modal button{width:100%;margin-top:22px}
.finish section{position:absolute;inset:30px 30px 35px;display:flex;flex-direction:column;align-items:center;text-align:center}
.finish p{font-size:18px;font-weight:900;text-shadow:0 2px 3px #173557;margin:15px 0}
#finalScores{display:flex;gap:24px;justify-content:center;flex-wrap:wrap;font-weight:900;text-shadow:0 2px 3px #173557;font-size:19px;margin-bottom:18px}
.resultActions{display:flex;gap:12px}.resultActions button{min-width:145px;padding:10px 20px;font-size:19px}
#failure{position:fixed;inset:20%;padding:25px;background:#173557;z-index:20}
#touchControls{display:none;position:absolute;bottom:max(16px,env(safe-area-inset-bottom));left:15px;right:15px;justify-content:space-between;align-items:flex-end;pointer-events:none}
.pad{display:grid;grid-template-columns:52px 52px 52px;grid-template-rows:52px 52px;gap:3px}
.pad button{font-size:22px;border-radius:50%;background:#ffffffa8;pointer-events:auto;user-select:none;-webkit-user-select:none}
.pad button:nth-child(1){grid-column:2}.pad button:nth-child(2){grid-column:1;grid-row:2}.pad button:nth-child(3){grid-column:2;grid-row:2}.pad button:nth-child(4){grid-column:3;grid-row:2}
.actions{display:flex;flex-direction:column;gap:10px;align-items:center}
.actions button{width:78px;height:64px;border-radius:50%;font-size:13px;pointer-events:auto;user-select:none;-webkit-user-select:none}
.actions button:first-child{background:#ffdb56}
.actions button:last-child{width:65px;height:50px;background:#ffffffbb;font-size:11px}
#dragStick{position:absolute;width:100px;height:100px;margin:-50px 0 0 -50px;border:3px solid #fff9;border-radius:50%;background:#17355733}
#dragStick i{position:absolute;top:32px;left:32px;width:30px;height:30px;border:3px solid white;border-radius:50%;background:#ffdb56}
@media(pointer:coarse),(max-width:700px){
  #touchControls{display:flex}.desktopHelp{display:none}.menuCard{inset:25px 18px 22px}
  h1{font-size:66px;letter-spacing:-4px;width:100%;max-width:370px;line-height:.9}h1 em{display:block}.lede{font-size:17px;margin-top:15px}
  .instructions{font-size:14px}#arenaChoices{gap:6px}#arenaChoices button{font-size:12px;min-height:48px;padding:8px 5px}
  #arenaDescription{font-size:11px;margin:12px 0}.tips{font-size:10px;margin-top:13px}#start{min-height:62px;font-size:24px;width:250px}
  .raceHud{top:17px}.raceLead{gap:10px}#rank{font-size:38px}#playerScore{font-size:34px}#playerScore span{font-size:20px}.coreIcon{font-size:27px}
  #scores{font-size:12px;gap:10px;margin-top:8px}.score b{font-size:15px}.iconButton{width:44px;height:44px;font-size:21px;top:15px}#pause{left:10px}#fullscreen{right:10px}
  #arenaName{font-size:10px;top:68px;left:12px}.mission{bottom:158px;white-space:nowrap}.mission b{font-size:18px}.mission span{font-size:11px}
  .boostMeter{right:20px;bottom:156px;width:92px}.boostMeter b,.boostMeter small{display:none}.energy{height:9px;margin-left:24px}.boostMeter>span{font-size:22px}
  #toast{font-size:29px;top:23%;max-width:88%;-webkit-text-stroke:3px #173557}#steerHint{font-size:22px;bottom:29%}
  .marker{font-size:11px}.marker.objective{font-size:13px}.marker.edge{font-size:10px}
  .finish section{inset:35px 18px 24px}.finish h2{font-size:48px}.finish p{font-size:15px}.resultActions button{min-width:0;font-size:17px;padding:10px 15px}
  #finalScores{font-size:15px;gap:15px}
}
@media(max-height:500px){
  .menuCard{inset:16px 22px 18px;align-items:flex-start}h1{font-size:57px;line-height:1;letter-spacing:-3px;width:auto;margin:0}h1 em{display:inline}.lede{font-size:15px;margin-top:4px}.coverSpace{min-height:0}
  .selection{align-self:flex-end;width:365px}.instructions{font-size:12px;margin:3px 0 8px}#arenaChoices button{font-size:11px;min-height:44px}#arenaDescription{font-size:10px;margin:8px 0}
  #start{width:230px;min-height:52px;font-size:20px;padding:8px 15px}.tips{font-size:9px;margin:9px 0 0}
  .raceHud{top:10px}.raceLead{gap:14px}#rank{font-size:35px}#playerScore{font-size:32px}#playerScore span{font-size:20px}.coreIcon{font-size:25px}
  #scores{font-size:11px;gap:12px;margin-top:5px}.score b{font-size:14px}#arenaName{top:65px;font-size:10px}
  #touchControls{display:flex;bottom:12px}.pad{grid-template-columns:46px 46px 46px;grid-template-rows:46px 46px}
  .actions{flex-direction:row;align-items:flex-end;gap:10px}.actions button{height:59px;width:70px}.actions button:last-child{height:48px;width:60px}
  .mission{bottom:20px;white-space:nowrap}.mission b{font-size:18px}.mission span{font-size:11px}
  .boostMeter{right:24px;bottom:86px;width:96px}.boostMeter b,.boostMeter small{display:none}#toast{font-size:28px;top:26%}#steerHint{font-size:20px;bottom:31%}
  .desktopHelp{display:none}.finish section{inset:18px 22px 18px}.finish h2{font-size:43px}.finish p{margin:8px 0;font-size:14px}#finalScores{margin-bottom:10px;font-size:15px;gap:18px}
  .resultActions button{min-height:48px;font-size:17px;padding:8px 14px}.modal button{margin-top:14px}.modal h2{font-size:48px}
}
