/* Desktop landscape column + flat pad polish */
/* --- Desktop landscape: same 390px slide, side panels fill the rest --- */
body.desktop-ui .game-shell {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: stretch !important;
  gap: 22px !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 16px 24px !important;
  box-sizing: border-box !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 28%),
    linear-gradient(180deg, #1e4568 0%, #17324d 55%, #102536 100%) !important;
}

body.desktop-ui .play-col {
  order: 2 !important;
  width: 390px !important;
  max-width: 390px !important;
  flex: 0 0 390px !important;
  height: calc(100dvh - 32px) !important;
  max-height: calc(100dvh - 32px) !important;
  margin: 0 !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  box-shadow: 0 0 0 3px rgba(239,134,61,0.85), 0 18px 40px rgba(0,0,0,0.35) !important;
}

body.desktop-ui .desktop-help,
body.desktop-ui .desktop-sidebar {
  display: flex !important;
  flex-direction: column !important;
  width: min(300px, calc((100vw - 390px - 88px) / 2)) !important;
  min-width: 220px !important;
  flex: 1 1 240px !important;
  max-width: 340px !important;
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  height: auto !important;
  max-height: calc(100dvh - 32px) !important;
  overflow: auto !important;
  padding: 20px 18px !important;
  box-sizing: border-box !important;
  background: rgba(16, 37, 54, 0.78) !important;
  border: 1px solid rgba(255,255,255,0.14) !important;
  border-radius: 18px !important;
  color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 12px 28px rgba(0,0,0,0.22) !important;
}

body.desktop-ui .desktop-help { order: 1 !important; }
body.desktop-ui .desktop-sidebar { order: 3 !important; pointer-events: auto !important; }
body.desktop-ui .sidebar-toggle { display: none !important; }

body.desktop-ui .desktop-help h3,
body.desktop-ui .desktop-sidebar .live-leaderboard h3,
body.desktop-ui .desktop-sidebar .game-key > strong {
  font-family: "Luckiest Guy", cursive !important;
  font-size: 22px !important;
  letter-spacing: 0.06em !important;
  color: #ffd24d !important;
  margin: 0 0 14px !important;
}

body.desktop-ui .desktop-help-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

body.desktop-ui .desktop-help-list li {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  font-family: "League Spartan", "Montserrat", system-ui, sans-serif !important;
  font-weight: 700 !important;
  font-size: 16px !important;
}

body.desktop-ui .desktop-help-keys {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
}

body.desktop-ui .desktop-help kbd {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 32px !important;
  padding: 6px 9px !important;
  border-radius: 8px !important;
  background: #3270b7 !important;
  border-bottom: 3px solid #1d4e86 !important;
  color: #fff !important;
  font-family: "League Spartan", system-ui, sans-serif !important;
  font-weight: 800 !important;
  font-size: 13px !important;
}

body.desktop-ui .desktop-help-note {
  margin: 18px 0 0 !important;
  font-family: "League Spartan", system-ui, sans-serif !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
  color: rgba(255,255,255,0.78) !important;
}

body.touch-ui .desktop-help { display: none !important; }

body.desktop-ui #startScreen.screen-overlay,
body.desktop-ui #gameOverScreen.screen-overlay,
body.desktop-ui #settingsPanel {
  left: 50% !important;
  right: auto !important;
  width: 390px !important;
  max-width: 390px !important;
  transform: translateX(-50%) !important;
}

body.desktop-ui.in-race-controls .play-col,
body.desktop-ui .play-col {
  width: 390px !important;
  max-width: 390px !important;
}

.desktop-help { display: none !important; }
body.desktop-ui .desktop-help { display: flex !important; }

/* Pin the phone play column to the top so the deck sits under it, not with a navy gap */
body.touch-ui .game-shell {
  align-items: flex-start !important;
  justify-content: flex-start !important;
  padding: 0 !important;
}
body.touch-ui .play-col {
  margin: 0 !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
}
body.touch-ui.in-race-controls .play-col {
  height: calc(100dvh - var(--gb-deck-h, 168px)) !important;
  max-height: calc(100dvh - var(--gb-deck-h, 168px)) !important;
}
body.touch-ui .play-col #game,
body.touch-ui .play-col canvas#game { order: 1 !important; }
body.touch-ui .play-col .hud { order: 2 !important; }

/* ============================================================
   === CSS PAD v3 — flat modern controls + no empty bands ===
   Solid fills, no gloss/bevel/3D shadows. HUD overlays canvas.
   ============================================================ */

:root {
  --css-navy: #17324d;
  --css-navy-deep: #102536;
  --css-orange: #ef863d;
  --css-blue: #3270b7;
  --css-sky: #3f91d0;
}

/* Kill letterbox / gap colours that showed as empty bands */
body.touch-ui .game-shell {
  background: #17324d !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  padding: 0 !important;
  gap: 0 !important;
}
body.touch-ui .play-col {
  background: #17324d !important;
  margin: 0 !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
body.touch-ui.in-race-controls .play-col {
  height: calc(100dvh - var(--gb-deck-h, 148px)) !important;
  max-height: calc(100dvh - var(--gb-deck-h, 148px)) !important;
}

/* Slim HUD over the top of the canvas — no strip below the slide */
body.touch-ui .play-col .hud,
.play-col .hud {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  order: 0 !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 8px 10px 10px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px 8px !important;
  background: rgba(16, 37, 54, 0.92) !important;
  border: 0 !important;
  border-bottom: 2px solid #ef863d !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  z-index: 8 !important;
  pointer-events: none !important;
}
body.touch-ui .play-col .hud .game-brand,
.play-col .hud .game-brand {
  width: 100% !important;
  font-family: "Luckiest Guy", cursive !important;
  font-size: 14px !important;
  letter-spacing: 0.06em !important;
  color: #ffd24d !important;
}
body.touch-ui .play-col .hud > div:not(.game-brand),
.play-col .hud > div:not(.game-brand) {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  padding: 5px 8px !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  text-align: center !important;
  font-family: "Luckiest Guy", cursive !important;
  font-size: 12px !important;
  letter-spacing: 0.04em !important;
  color: #fff !important;
}
body.touch-ui .play-col .hud strong,
.play-col .hud strong {
  font-family: "Luckiest Guy", cursive !important;
  font-weight: 400 !important;
  color: #fff !important;
}

/* Canvas fills the whole play column under the overlay HUD */
body.touch-ui .play-col #game,
body.touch-ui .play-col canvas#game,
.play-col #game,
.play-col canvas#game {
  order: 0 !important;
  position: relative !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

/* Flat pad shell */
body.touch-ui #touchControls {
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}
body.touch-ui #touchControls .css-pad-deck,
body.touch-ui #touchControls #deck {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  width: 100% !important;
  min-height: 0 !important;
  padding: 12px 14px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
  box-sizing: border-box !important;
  background: #17324d !important;
  border-top: 3px solid #ef863d !important;
  box-shadow: none !important;
  pointer-events: auto !important;
}

body.touch-ui #touchControls .css-pad-steer,
body.touch-ui #touchControls .css-pad-actions {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

/* Shared flat button base — no gradient, gloss, bevel, or thick shadow */
body.touch-ui #touchControls .css-pad-dir,
body.touch-ui #touchControls .css-pad-act {
  background-image: none !important;
  filter: none !important;
  text-shadow: none !important;
  transition: transform 0.08s ease, background-color 0.08s ease, opacity 0.08s ease !important;
}

body.touch-ui #touchControls .css-pad-dir {
  width: 76px !important;
  height: 76px !important;
  min-width: 76px !important;
  min-height: 76px !important;
  padding: 8px 6px !important;
  border-radius: 18px !important;
  background: #3270b7 !important;
  background-image: none !important;
  border: 2px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: none !important;
  color: #fff !important;
}
body.touch-ui #touchControls .css-pad-dir .css-pad-arrow {
  width: 30px !important;
  height: 30px !important;
  filter: none !important;
  color: #fff !important;
}
body.touch-ui #touchControls .css-pad-dir-label,
body.touch-ui #touchControls .css-pad-act-name {
  font-family: "Luckiest Guy", cursive !important;
  font-weight: 400 !important;
  letter-spacing: 0.06em !important;
  line-height: 1 !important;
  color: #fff !important;
  text-shadow: none !important;
}
body.touch-ui #touchControls .css-pad-dir-label {
  font-size: 12px !important;
  margin-top: 2px !important;
}

body.touch-ui #touchControls .css-pad-brake {
  width: 70px !important;
  height: 70px !important;
  min-width: 70px !important;
  min-height: 70px !important;
  border-radius: 50% !important;
  background: #2a5f9e !important;
  background-image: none !important;
  border: 2px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: none !important;
}
body.touch-ui #touchControls .css-pad-brake .css-pad-act-name {
  font-size: 13px !important;
}

body.touch-ui #touchControls .css-pad-slide {
  width: 88px !important;
  height: 88px !important;
  min-width: 88px !important;
  min-height: 88px !important;
  border-radius: 50% !important;
  background: #ef863d !important;
  background-image: none !important;
  border: 2px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: none !important;
}
body.touch-ui #touchControls .css-pad-slide .css-pad-act-name {
  font-family: "Luckiest Guy", cursive !important;
  font-size: 20px !important;
  letter-spacing: 0.05em !important;
  text-shadow: none !important;
}

/* Pressed: scale + colour shift only */
body.touch-ui #touchControls .css-pad-dir.is-pressed,
body.touch-ui #touchControls .css-pad-dir.pressed {
  transform: scale(0.92) !important;
  background: #255a96 !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
}
body.touch-ui #touchControls .css-pad-brake.is-pressed,
body.touch-ui #touchControls .css-pad-brake.pressed {
  transform: scale(0.92) !important;
  background: #1f4d84 !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
}
body.touch-ui #touchControls .css-pad-slide.is-pressed,
body.touch-ui #touchControls .css-pad-slide.pressed {
  transform: scale(0.92) !important;
  background: #d96f28 !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
}

@media (max-width: 360px) {
  body.touch-ui #touchControls .css-pad-dir { width: 66px !important; height: 66px !important; min-width: 66px !important; min-height: 66px !important; }
  body.touch-ui #touchControls .css-pad-brake { width: 60px !important; height: 60px !important; min-width: 60px !important; min-height: 60px !important; }
  body.touch-ui #touchControls .css-pad-slide { width: 78px !important; height: 78px !important; min-width: 78px !important; min-height: 78px !important; }
  body.touch-ui #touchControls .css-pad-slide .css-pad-act-name { font-size: 17px !important; }
}

@media (max-height: 700px) and (orientation: portrait) {
  body.touch-ui #touchControls .css-pad-deck,
  body.touch-ui #touchControls #deck {
    padding-top: 10px !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.touch-ui #touchControls .css-pad-dir { width: 68px !important; height: 68px !important; min-width: 68px !important; min-height: 68px !important; }
  body.touch-ui #touchControls .css-pad-slide { width: 80px !important; height: 80px !important; min-width: 80px !important; min-height: 80px !important; }
}

@media (orientation: landscape) and (max-height: 500px) {
  body.touch-ui #touchControls .css-pad-deck,
  body.touch-ui #touchControls #deck {
    padding: 8px 16px calc(6px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.touch-ui #touchControls .css-pad-dir {
    width: 58px !important; height: 52px !important; min-width: 58px !important; min-height: 52px !important;
    flex-direction: row !important; gap: 6px !important;
  }
  body.touch-ui #touchControls .css-pad-dir-label { display: none !important; }
  body.touch-ui #touchControls .css-pad-brake { width: 54px !important; height: 54px !important; min-width: 54px !important; min-height: 54px !important; }
  body.touch-ui #touchControls .css-pad-slide { width: 64px !important; height: 64px !important; min-width: 64px !important; min-height: 64px !important; }
  body.touch-ui #touchControls .css-pad-slide .css-pad-act-name { font-size: 15px !important; }
}

/* Desktop keeps relative HUD strip above the canvas (landscape panel layout) */
body.desktop-ui .play-col .hud {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  order: -1 !important;
}
body.desktop-ui .play-col #game,
body.desktop-ui .play-col canvas#game {
  order: 0 !important;
  height: auto !important;
}

/* ============================================================
   === CSS PAD v3b — flush flex layout (kill remaining band) ===
   ============================================================ */
body.touch-ui.in-race-controls {
  display: flex !important;
  flex-direction: column !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #17324d !important;
}
body.touch-ui.in-race-controls .game-shell {
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  width: 100% !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  background: #17324d !important;
}
body.touch-ui.in-race-controls .play-col {
  height: 100% !important;
  max-height: none !important;
  width: 100% !important;
  background: #17324d !important;
}
body.touch-ui.in-race-controls #touchControls,
body.touch-ui.in-race-controls #touchControls.in-race {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  top: auto !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  display: block !important;
  z-index: 2147483000 !important;
}
