:root { --display: 'Arial Rounded MT Bold', 'Trebuchet MS', Arial, sans-serif; --body: 'Trebuchet MS', Arial, sans-serif; --ink: #103847; --gold: #ffd35b; --orange: #ff8748; --blue: #087f96; --panel: rgba(16,56,71,.94); --panel-solid: #103847; }
body { background: #103847; font-weight: 700; }
[hidden] { display: none !important; }
button, a, input { touch-action: manipulation; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #ffd35b; outline-offset: 4px; }
#boot-status { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; background: #103847; text-align: center; padding: 24px; }
#boot-status h1 { font-size: clamp(36px,8vw,72px); margin: 0; }
#boot-status p { max-width: 45ch; margin: 0; line-height: 1.6; }
#boot-status a { color: #ffd35b; padding: 12px; }
#boot-retry { padding: 14px 24px; background: #ffd35b; border: none; border-radius: 12px; color: #103847; }
#game-tools { position: absolute; top: max(12px,env(safe-area-inset-top)); right: max(16px,env(safe-area-inset-right)); z-index: 25; display: flex; align-items: center; gap: 8px; font-size: 13px; }
#game-tools button, #game-tools a { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 12px; border: 1px solid #a4c7ce; border-radius: 10px; background: #103847; color: #fff; text-decoration: none; }
#volume-label { background: #103847; border-radius: 10px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; min-height: 44px; }
#volume { width: 80px; accent-color: #ffd35b; }
.btn { background: #087f96; border: 2px solid #deeff2; border-radius: 12px; box-shadow: 0 4px 0 #103847; font-weight: 900; letter-spacing: 0; font-size: 22px; text-shadow: none; min-height: 48px; }
.btn.primary { background: #ffd35b; color: #103847; box-shadow: 0 4px 0 #93672a; }
.btn.focus { animation: none; }
.title-screen { align-items: flex-start; justify-content: center; padding: 7vw; cursor: default; }
.title-vignette { background: linear-gradient(90deg, rgba(9,39,51,.88), rgba(9,39,51,.2) 63%, transparent); }
.logo { margin: 0; transform: skewX(-6deg); animation: none; text-align: left; }
.logo-line { font-weight: 900; letter-spacing: -5px; -webkit-text-stroke: 0; background: none !important; color: #f5fbfc; text-shadow: 0 5px 0 #103847; line-height: .96; }
.logo-line::before, .logo-swoosh { display: none; }
.logo-line.l1, .logo-line.l2 { font-size: clamp(68px,10vw,144px); margin: 0; }
.title-description { position: relative; line-height: 1.6; font-size: clamp(17px,2vw,23px); color: #f5fbfc; margin: 25px 0; }
.press-start { position: relative; bottom: auto; font-size: 22px; animation: none; text-shadow: none; letter-spacing: 0; }
.title-foot { justify-content: space-between; left: 7vw; right: 7vw; font-size: 12px; bottom: max(20px,env(safe-area-inset-bottom)); flex-wrap: wrap; }
.title-foot a { color: #f5fbfc; padding: 12px 0; }
.select-screen { padding: 76px 24px 20px; background: linear-gradient(90deg,rgba(16,56,71,.9),rgba(16,56,71,.3) 52%,rgba(16,56,71,.8)); }
.sel-title { color: #f5fbfc; background: none; filter: none; transform: none; font-size: clamp(26px,3vw,40px); font-weight: 900; letter-spacing: -.8px; }
.sel-back { color: white; border: 1px solid #a4c7ce; min-height: 44px; }
.sel-grid { width: min(440px,39vw); gap: 10px; }
.card { background: #164353; box-shadow: inset 4px 0 0 var(--kc); border: 2px solid #638795; animation: none; text-align: left; min-height: 72px; }
.card.selected { background: #226072; }
.card-name { font-size: 20px; }
.card-stats { opacity: .9; }
.card-portrait { border: 2px solid #e0edf0; }
.sel-side { width: min(340px,33vw); gap: 12px; }
.preview { border-width: 1px; border-radius: 14px; box-shadow: none; padding: 14px; }
.pv-name { font-size: 30px; font-weight: 900; text-shadow: none; }
.pv-portrait { width: 94px; height: 94px; border-width: 3px; box-shadow: none; }
.opt { padding: 5px 10px; grid-template-columns: 55px 44px minmax(0,1fr) 44px; border-width: 1px; }
.opt-val { font-size: 17px; min-width: 0; white-space: normal; }
.opt-arrow { min-width: 44px; min-height: 44px; background: transparent; border: 0; }
.race-btn { font-size: 23px; }
.touch-help { display: none; font-size: 12px; line-height: 1.5; background: #103847; padding: 10px 14px; border-radius: 10px; }
.pause-panel, .res-panel { background: #103847; border-width: 2px; box-shadow: 0 15px 50px #092b3c80; }
.pause-panel { max-height: calc(100dvh - 100px); overflow-y: auto; }
.pause-title { font-size: 38px; letter-spacing: -1px; }
.res-title { font-size: clamp(28px,5vw,48px); font-weight: 900; transform: none; }
.res-sub { letter-spacing: 0; line-height: 1.5; }
.res-row { animation: none; }
.res-buttons { gap: 12px; }
.hud-standings { top: 78px; }
.hud-lap, .hud-place, .hud-countdown { font-weight: 900; }
.hud-item { top: 78px; }
.item-slot { width: 84px; height: 84px; background: #103847; border: 3px solid #f5fbfc; border-radius: 18px; box-shadow: 0 3px 0 #103847; }
.item-img { width: 64px; height: 64px; }
.item-slot::after { display: none; }
.intro-card { background: #087f96; }
#touch-controls { position: absolute; inset: auto 0 max(14px,env(safe-area-inset-bottom)); z-index: 15; display: none; justify-content: space-between; padding: 0 max(16px,env(safe-area-inset-left)); pointer-events: none; gap: 12px; }
.touch-steer, .touch-drive { display: grid; gap: 9px; align-content: end; grid-template-columns: repeat(2, 64px); }
#touch-controls button { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; min-width: 56px; height: 58px; border: 2px solid #edf8fb; border-radius: 16px; background: #103847e8; color: white; font-size: 16px; font-weight: 900; }
#touch-controls .gas { background: #ffd35b; color: #103847; }
#touch-controls button.held { background: #087f96; transform: translateY(3px); }
@media (pointer: coarse), (max-width: 900px) {
  #touch-controls { display: flex; }
  #volume-label { display: none; }
  body[data-state='paused'] #volume-label, body[data-state='select'] #volume-label { display: flex; }
  #game-tools { gap: 6px; font-size: 12px; }
  #game-tools button, #game-tools a { padding: 8px; }
  .touch-help { display: block; margin-top: 10px; }
  .select-screen { padding: 72px 16px 20px; overflow-y: auto; background: #103847c9; }
  .sel-body { flex: none; flex-direction: column; gap: 14px; }
  .sel-grid { width: 100%; grid-template-columns: repeat(4,minmax(0,1fr)); padding: 10px; }
  .card { padding: 7px 3px; text-align: center; }
  .card-name { font-size: 14px; }
  .card-portrait { width: 48px; height: 48px; }
  .sel-side { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .preview { flex: 1 1 220px; flex-direction: row; }
  .pv-portrait { flex: 0 0 70px; height: 70px; }
  .pv-name { font-size: 22px; }
  .pv-stats { display: none; }
  .opts { flex: 1 1 240px; min-width: 0; }
  .hud-tl { top: 76px; left: 16px; }
  .hud-lap .lbl { font-size: 17px; }
  .hud-lap .val { font-size: 32px; }
  .hud-lap .of { font-size: 22px; }
  .hud-timer { font-size: 18px; }
  .hud-br { right: 18px; bottom: 154px; }
  .hud-place .num { font-size: 62px; }
  .hud-place .suf { font-size: 28px; }
  .hud-speedo { width: 86px; height: 86px; margin-bottom: 0; }
  .speed-val { font-size: 24px; }
  .hud-minimap { width: 114px; height: 114px; left: 16px; bottom: 92px; }
  .res-panel { padding: 16px; max-height: calc(100dvh - 90px); margin-top: 60px; }
  .res-row { grid-template-columns: 40px 32px 1fr 72px; gap: 7px; padding: 4px; }
  .res-portrait { width: 32px; height: 32px; border-width: 1px; }
  .res-name { font-size: 15px; }
  .res-time { font-size: 16px; }
  .res-name em { display: block; margin: 0; width: fit-content; font-size: 10px; }
  .res-buttons .btn { min-width: 120px; font-size: 17px; padding: 10px; }
}
@media (max-width: 480px) {
  .title-screen { padding: 24px; }
  .logo-line { letter-spacing: -3px; }
  .logo-line.l1, .logo-line.l2 { font-size: 76px; }
  .title-foot { left: 24px; right: 24px; gap: 0; }
  .sel-header { gap: 10px; }
  .sel-title { font-size: 25px; }
  .sel-back { font-size: 14px; padding: 8px; }
  .hud-item { left: auto; right: 16px; transform: none; }
  .item-hint { font-size: 10px; }
}
@media (max-height: 500px) and (min-width: 600px) {
  .title-screen { padding: 36px; }
  .logo-line.l1, .logo-line.l2 { font-size: 66px; }
  .title-description { margin: 12px 0; font-size: 16px; }
  .title-foot { bottom: 4px; }
  .sel-body { flex-direction: row; }
  .sel-grid { width: 50%; grid-template-columns: repeat(4,minmax(0,1fr)); }
  .sel-side { width: 46%; }
  .preview { display: none; }
  .touch-help { display: none; }
  .hud-minimap { width: 88px; height: 88px; }
  .hud-br { bottom: 145px; }
  .hud-item { top: 70px; }
  .pause-panel { padding: 14px 24px; gap: 8px; }
  .pause-title { font-size: 28px; }
  .pause-panel .btn { padding: 7px 20px; }
}
.online-start { position: relative; margin-top: 14px; }
.touch-backward { grid-column: 1 / -1; }
.online-screen { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.online-panel { pointer-events: auto; position: absolute; inset: 72px max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); overflow-y: auto; padding: 20px; max-width: 680px; margin: auto; background: #103847; border: 2px solid #a4c7ce; border-radius: 18px; color: #f5fbfc; }
.online-panel h1 { font-size: clamp(26px,6vw,40px); margin: 0 0 12px; }
.online-panel p { line-height: 1.5; }
.online-panel label { display: grid; gap: 6px; min-width: 0; margin-bottom: 12px; }
.online-panel input, .online-panel select, .online-panel button { min-height: 44px; min-width: 0; max-width: 100%; font: inherit; border-radius: 8px; border: 1px solid #a4c7ce; padding: 10px; }
.online-panel input, .online-panel select { width: 100%; background: #f5fbfc; color: #103847; }
.online-panel button { background: #ffd35b; color: #103847; font-weight: 900; }
.online-panel button:disabled { opacity: .55; cursor: default; }
.online-panel fieldset { min-width: 0; margin: 12px 0; border: 1px solid #638795; border-radius: 12px; padding: 12px; }
.online-panel legend { padding: 0 6px; }
.online-options { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; }
.online-panel .online-check { grid-column: 1 / -1; grid-template-columns: 44px minmax(0,1fr); align-items: center; }
.online-check input { width: 24px; accent-color: #ffd35b; }
.online-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.online-roster, .online-result-list { padding-left: 22px; line-height: 1.7; overflow-wrap: anywhere; }
.online-error { color: #ffd35b; overflow-wrap: anywhere; }
.online-hud { position: absolute; inset: 76px 16px auto; display: grid; grid-template-columns: 1fr auto; gap: 8px; color: white; text-shadow: 0 2px 2px #103847; }
.online-position { font-size: 36px; grid-column: 2; grid-row: 1 / 3; }
.online-item, .online-notice, .online-hud .online-error { grid-column: 1 / -1; }
.online-hud .online-error:not(:empty) { margin: 0; padding: 8px; border-radius: 8px; background: #103847; }
.online-countdown { position: fixed; left: 0; right: 0; top: 40%; text-align: center; font-size: 72px; color: #ffd35b; }
@media (max-width: 480px) { .online-panel { padding: 14px; } .online-options { grid-template-columns: minmax(0,1fr); } }
@media (max-height: 500px) { .online-hud { top: 66px; font-size: 12px; } .online-position { font-size: 26px; } .online-countdown { font-size: 48px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .hud-flash { display: none; }
}
