﻿  html, body { margin: 0; padding: 0; overflow: hidden; background: #1a1f16; font-family: 'Segoe UI', system-ui, sans-serif; }
  canvas { display: block; }
  /* Light "work in progress" notice: see-through and ignores taps so it never blocks play */
  #devBanner {
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 25;
    background: rgba(20,24,16,0.45); color: rgba(232,228,216,0.85); border: 1px solid rgba(232,228,216,0.15);
    padding: 4px 12px; border-radius: 999px; font-size: 11px; letter-spacing: 0.3px; white-space: nowrap;
    pointer-events: none; backdrop-filter: blur(3px);
  }
  #devBanner .short { display: none; }
  #devBanner[data-accel="gentle"]::after { content: ' · gentle accel (trial)'; color: #f4a259; }
  #devBanner[data-accel="real"]::after { content: ' · real accel (trial)'; color: #f4a259; }
  @media (max-width: 760px) { #devBanner .long { display: none; } #devBanner .short { display: inline; } }
  #hudToggle {
    position: absolute; top: 16px; left: 16px; background: rgba(20,24,16,0.6); color: #e8e4d8;
    border: 1px solid rgba(232,228,216,0.25); padding: 8px 12px; border-radius: 6px; font-weight: 600;
    cursor: pointer; font-size: 13px; z-index: 30; -webkit-tap-highlight-color: transparent;
  }
  #winchToggle {
    position: absolute; top: 58px; left: 16px; background: rgba(20,24,16,0.6); color: #e8e4d8;
    border: 1px solid rgba(232,228,216,0.25); padding: 8px 12px; border-radius: 6px; font-weight: 600;
    cursor: pointer; font-size: 13px; z-index: 20; -webkit-tap-highlight-color: transparent;
  }
  #garageBtn {
    position: absolute; top: 100px; left: 16px; background: rgba(20,24,16,0.6); color: #e8e4d8;
    border: 1px solid rgba(232,228,216,0.25); padding: 8px 12px; border-radius: 6px; font-weight: 600;
    cursor: pointer; font-size: 13px; z-index: 20; -webkit-tap-highlight-color: transparent;
  }
  #garageBtn:focus-visible, #hudToggle:focus-visible, #winchToggle:focus-visible { outline: 3px solid #6fa8dc; outline-offset: 2px; }
  #hudToggle[aria-expanded="true"], #winchToggle[aria-expanded="true"] { background: #f4a259; color: #1a1f16; }
  #hud {
    position: absolute; top: 58px; left: 16px; color: #e8e4d8; z-index: 30; cursor: pointer;
    background: rgba(20,24,16,0.6); padding: 10px 16px; border-radius: 8px;
    font-size: 13px; line-height: 1.6; backdrop-filter: blur(4px); background-color: rgba(20,24,16,0.85);
    border: 1px solid rgba(232,228,216,0.15);
  }
  #hud b { color: #f4a259; }
  .hudHint { display: block; margin-top: 4px; font-size: 11px; opacity: 0.6; }
  /* Just ABOVE the throttle stick (Bradley prefers it near the right thumb; 2026-10-15), clear of the
     stick itself, BOOST and the reserved SUPER BOOST slot. Width matches the stick so it sits centred over it. */
  #speed {
    position: absolute; bottom: 168px; right: 20px; width: 124px; text-align: center; color: #f4a259; line-height: 1;
    font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6); pointer-events: none;
  }
  #speed span { font-size: 14px; color: #e8e4d8; opacity: 0.75; }
  #reset {
    position: absolute; top: 16px; right: 16px; background: #f4a259; color: #1a1f16;
    border: none; padding: 8px 14px; border-radius: 6px; font-weight: 600; cursor: pointer;
    font-size: 13px; z-index: 20;
  }
  #reset:hover { background: #ffb877; }
  #camBtn {
    position: absolute; top: 56px; right: 16px; background: rgba(20,24,16,0.6); color: #e8e4d8;
    border: 1px solid rgba(232,228,216,0.25); padding: 8px 14px; border-radius: 6px; font-weight: 600; cursor: pointer;
    font-size: 13px; z-index: 20;
  }
  #touchControls {
    position: absolute; inset: 0; pointer-events: none; z-index: 15;
  }
  /* 31 Oct (Bradley, iPhone): holding a stick sometimes went into iOS text selection ("select all") or an iOS drag
     (red no-entry badge), which cancels the touch and stuck the steering / throttle. Never select, call out or drag
     anything in the touch controls. */
  #touchControls, #touchControls * {
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none;
  }
  .joyBase {
    position: absolute; bottom: 26px; width: 132px; height: 132px; border-radius: 50%;
    background: rgba(232,228,216,0.14); border: 1px solid rgba(232,228,216,0.35);
    touch-action: none; pointer-events: auto; -webkit-tap-highlight-color: transparent;
  }
  #joyLeft { left: 24px; }
  #joyRight { right: 24px; }
  #joySingle { left: 24px; display: none; }
  #controlModeBtn {
    position: absolute; top: 96px; right: 16px; background: rgba(20,24,16,0.6); color: #e8e4d8;
    border: 1px solid rgba(232,228,216,0.25); padding: 6px 10px; border-radius: 6px; font-weight: 600;
    cursor: pointer; font-size: 11px; z-index: 20;
  }
  .joyKnob {
    position: absolute; top: 50%; left: 50%; width: 54px; height: 54px; border-radius: 50%;
    background: rgba(244,162,89,0.75); border: 1px solid rgba(255,255,255,0.5);
    transform: translate(-50%, -50%); will-change: transform;
  }
  .joyLabel {
    position: absolute; bottom: -20px; width: 100%; text-align: center; color: #e8e4d8;
    font-size: 11px; opacity: 0.7; letter-spacing: 0.5px;
  }
  #handbrakeBtn {
    position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%);
    width: 60px; height: 60px; border-radius: 50%; background: rgba(232,228,216,0.16);
    border: 1px solid rgba(232,228,216,0.35); color: #f4f1ea; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; text-align: center;
    touch-action: none; -webkit-tap-highlight-color: transparent; pointer-events: auto;
  }
  #handbrakeBtn.active { background: rgba(244,162,89,0.55); }
  /* Sits just up-left of the throttle stick so the right thumb can reach it */
  #boostBtn {
    position: absolute; bottom: 150px; right: 150px;
    width: 66px; height: 66px; border-radius: 50%; background: rgba(111,168,220,0.22);
    border: 1px solid rgba(111,168,220,0.5); color: #f4f1ea; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; text-align: center;
    touch-action: none; -webkit-tap-highlight-color: transparent; pointer-events: auto;
  }
  #boostBtn.active { background: rgba(111,168,220,0.85); box-shadow: 0 0 14px rgba(111,168,220,0.9); }
  /* RESERVED for a future SUPER BOOST button (not built yet): left of the throttle stick at thumb height,
     below BOOST and right of the handbrake. An invisible placeholder keeps the space free and lets layout
     checks include it; replace it with the real button later. */
  #padToast { position: absolute; top: 48px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 8px 14px; border-radius: 10px; background: rgba(20, 24, 20, 0.82); color: #fff; font: 600 13px/1.35 system-ui, sans-serif; text-align: center; z-index: 110; pointer-events: none; }
  #padToast[hidden] { display: none; }
  #superBoostSlot.superBoostBtn { visibility: visible; pointer-events: auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(200, 60, 40, 0.35); border: 2px solid rgba(255, 140, 90, 0.7); color: #fff; font: 700 12px system-ui, sans-serif; letter-spacing: 0.5px; user-select: none; -webkit-user-select: none; touch-action: none; cursor: pointer; }
  #superBoostSlot.superBoostBtn.active { background: rgba(255, 90, 40, 0.85); }
  #devBanner[data-speed="fast"]::before { content: '80 mph · '; color: #ff8a5a; }
  /* above the right (throttle) stick, above the speed readout (bottom 168 to about 202) */
  #superBoostSlot { position: absolute; bottom: 210px; right: 57px; width: 66px; height: 66px; visibility: hidden; pointer-events: none; }
  /* short landscape phones: no height above the stick (top-right buttons), so beside it, under BOOST */
  @media (max-height: 500px) and (orientation: landscape) { #superBoostSlot { bottom: 30px; right: 168px; } }
  #winchOutBtn, #winchInBtn {
    position: absolute; left: 16px; width: 92px; background: rgba(20,24,16,0.6); color: #e8e4d8;
    border: 1px solid rgba(232,228,216,0.25); padding: 8px 4px; border-radius: 6px;
    font-weight: 600; cursor: pointer; font-size: 11px; z-index: 20; text-align: center;
    line-height: 1.25; touch-action: none; -webkit-tap-highlight-color: transparent;
  }
  /* Opens sideways next to the Winch tab so it never reaches the steer stick on short screens */
  #winchOutBtn { top: 58px; left: 112px; }
  #winchInBtn { top: 58px; left: 220px; }
  #winchOutBtn.active, #winchInBtn.active { background: rgba(244,162,89,0.55); }
  @media (min-width: 900px) and (pointer: fine) { #touchControls { opacity: 0.35; } #touchControls:hover { opacity: 1; } }
  @media (max-width: 700px) {
    #hud { max-width: 260px; font-size: 11px; line-height: 1.45; padding: 8px 10px; }
  }

  /* Sound: right column under DUAL STICK; the panel opens just below it. */
  #soundBtn {
    position: absolute; top: 132px; right: 16px; background: rgba(20,24,16,0.6); color: #e8e4d8;
    border: 1px solid rgba(232,228,216,0.25); padding: 6px 10px; border-radius: 6px; font-weight: 600;
    cursor: pointer; font-size: 11px; z-index: 20; -webkit-tap-highlight-color: transparent;
  }
  #soundBtn[aria-expanded="true"] { background: #f4a259; color: #1a1f16; }
  #soundBtn:focus-visible, #muteBtn:focus-visible, .volSlider:focus-visible { outline: 3px solid #6fa8dc; outline-offset: 2px; }
  #soundPanel {
    position: absolute; top: 166px; right: 16px; z-index: 25; display: flex; flex-direction: column; gap: 6px;
    background: rgba(20,24,16,0.85); border: 1px solid rgba(232,228,216,0.2); border-radius: 8px;
    padding: 8px 10px; color: #e8e4d8; font-size: 12px; backdrop-filter: blur(4px); width: 150px;
  }
  #soundPanel[hidden] { display: none; }
  #muteBtn {
    background: rgba(232,228,216,0.1); color: #e8e4d8; border: 1px solid rgba(232,228,216,0.3);
    border-radius: 6px; padding: 8px 10px; font-weight: 600; font-size: 12px; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  #muteBtn[aria-pressed="true"] { background: rgba(221,85,85,0.35); }
  .volLabel { opacity: 0.8; margin-bottom: -4px; }
  .volSlider { width: 100%; height: 28px; accent-color: #f4a259; touch-action: none; margin: 0; }
  /* Short landscape phones: open sideways, left of the right-hand button column,
     so the panel never covers the throttle stick or BOOST. */
  @media (max-height: 500px) {
    #soundPanel { top: 50px; right: 124px; gap: 4px; padding: 6px 8px; }
    #muteBtn { padding: 6px 8px; }
    .volSlider { height: 22px; }
    #soundPanel { max-height: calc(100vh - 60px); overflow-y: auto; }
  }
  /* Very short screens (e.g. 568x320): one compact row in the strip above BOOST.
     It shares that strip with the winch buttons, so opening one closes the other. */
  @media (max-height: 340px) {
    /* too short for the readout above the stick (the right-hand buttons reach down to it): top row instead */
    #speed { bottom: auto; top: 12px; right: 104px; width: auto; text-align: right; }
    #soundPanel { display: grid; grid-template-columns: auto 110px; align-items: center; column-gap: 6px; width: auto; top: 52px; right: 124px; }
    #soundPanel #muteBtn { grid-column: 1 / -1; }
    .volSlider { width: 110px; height: 20px; }
    #soundPanel .volLabel { margin: 0; }
  }

  /* Narrow portrait: the sideways winch row would run into Camera / DUAL STICK,
     so stack it in the left column under the Garage tab instead. */
  @media (max-width: 600px) and (orientation: portrait) {
    #winchOutBtn { top: 142px; left: 16px; }
    #winchInBtn { top: 182px; left: 16px; }
    #soundBtn { top: 136px; }
    #soundPanel { top: 170px; }
  }

  /* ---------- Practice timer and mini-map (integration test build, 2026-10-16) ---------- */
  #practiceTimer { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); z-index: 26; pointer-events: none;
    background: rgba(20,24,16,0.72); color: #e8e4d8; font: 700 14px/1 'Segoe UI', system-ui, sans-serif; padding: 6px 12px; border-radius: 14px;
    border: 1px solid rgba(232,228,216,0.25); font-variant-numeric: tabular-nums; white-space: nowrap; }
  #practiceTimer.best { background: rgba(46,125,70,0.85); }
  #practiceTimer[hidden] { display: none; }
  #miniMap { position: absolute; top: 96px; right: 128px; width: 120px; height: 120px; z-index: 18; pointer-events: none; }
  #miniMap[hidden] { display: none; }
  #miniMap canvas { width: 100%; height: 100%; display: block; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,0.35); }
  #mapToggleBtn { background: rgba(232,228,216,0.1); color: #e8e4d8; border: 1px solid rgba(232,228,216,0.3); border-radius: 6px;
    padding: 8px 10px; font-weight: 600; font-size: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  #mapToggleBtn[aria-pressed="false"] { opacity: 0.7; }
  @media (max-height: 500px) { #miniMap { top: 56px; width: 84px; height: 84px; } }
  @media (max-height: 340px) { #miniMap { top: 40px; right: auto; left: 132px; width: 70px; height: 70px; } body.winch-open #miniMap { display: none; } }
  /* narrow portrait: left column under Garage (keeps the centre of the view clear); hidden while the
     winch buttons, which share that column on phones, are open */
  @media (max-width: 600px) and (orientation: portrait) { #miniMap { top: 142px; right: auto; left: 16px; width: 96px; height: 96px; } body.winch-open #miniMap { display: none; }
    #practiceTimer { top: 33px; font-size: 12px; padding: 4px 9px; } }

  /* ---------- Menu, mini-map label, How to play (integration test build, 2026-10-16) ---------- */
  body.has-menu #hudToggle, body.has-menu #garageBtn, body.has-menu #soundBtn { display: none; }
  #menuBtn { position: absolute; top: 16px; left: 16px; background: rgba(20,24,16,0.6); color: #e8e4d8; border: 1px solid rgba(232,228,216,0.25);
    padding: 8px 14px; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px; z-index: 31; -webkit-tap-highlight-color: transparent; }
  #menuBtn[aria-expanded="true"] { background: #f4a259; color: #1a1f16; }
  #menuPanel { position: absolute; top: 58px; left: 16px; z-index: 32; display: flex; flex-direction: column; gap: 6px; min-width: 170px;
    background: rgba(20,24,16,0.9); border: 1px solid rgba(232,228,216,0.2); border-radius: 8px; padding: 8px; backdrop-filter: blur(4px); }
  #menuPanel[hidden] { display: none; }
  #menuPanel .menuItem { text-align: left; background: rgba(232,228,216,0.08); color: #e8e4d8; border: 1px solid rgba(232,228,216,0.22); border-radius: 6px;
    padding: 9px 12px; font-weight: 600; font-size: 13px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  #menuPanel .menuItem:active { background: rgba(244,162,89,0.35); }
  body.has-menu #soundPanel { top: 58px; left: 16px; right: auto; z-index: 32; }
  /* Unlockables shop page and Report a bug (2026-10-17) */
  #unlockPanel, #bugPanel, #accountPanel { position: absolute; top: 58px; left: 16px; z-index: 33; color: #e8e4d8; background: rgba(20,24,16,0.94); padding: 12px 16px; border-radius: 8px;
    font-size: 13px; line-height: 1.5; border: 1px solid rgba(232,228,216,0.18); width: min(300px, calc(100vw - 32px)); box-sizing: border-box;
    max-height: calc(100vh - 80px); overflow-y: auto; }
  #unlockPanel[hidden], #bugPanel[hidden], #accountPanel[hidden] { display: none; }
  #unlockPanel b, #bugPanel b, #accountPanel b { color: #f4a259; }
  #unlockPanel .panelClose, #bugPanel .panelClose, #accountPanel .panelClose { float: right; background: none; border: none; color: #e8e4d8; font-size: 16px; cursor: pointer; padding: 0 0 4px 8px; }
  #accountPanel .shopItem, #unlockPanel .shopItem { margin: 8px 0; padding: 10px; border-radius: 8px; background: rgba(200,60,40,0.18); border: 1px solid rgba(255,140,90,0.45); }
  #accountPanel .shopTitle, #unlockPanel .shopTitle { font-weight: 800; font-size: 15px; margin-bottom: 4px; }
  #unlockPanel .shopState { margin: 6px 0; }
  #unlockPanel button:not(.panelClose), #bugPanel button:not(.panelClose), #accountPanel button:not(.panelClose) { background: rgba(244,162,89,0.25); color: #e8e4d8; border: 1px solid rgba(244,162,89,0.6); border-radius: 6px;
    padding: 7px 12px; font-weight: 700; font-size: 12px; cursor: pointer; margin-top: 6px; }
  #accountPanel button:disabled, #unlockPanel button:disabled { opacity: 0.55; cursor: default; }
  #unlockPanel .codeRow { display: block; margin-top: 6px; }
  #unlockPanel input, #bugPanel textarea, #accountPanel input { width: 100%; box-sizing: border-box; margin-top: 4px; background: rgba(0,0,0,0.35); color: #fff; border: 1px solid rgba(232,228,216,0.3);
    border-radius: 6px; padding: 7px 8px; font: 600 13px system-ui, sans-serif; user-select: text; -webkit-user-select: text; }
  /* Adults / Parents panel (2026-10-17) */
  #accountPanel.adultPanel { width: min(360px, calc(100vw - 32px)); }
  #accountPanel .adultIntro { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: rgba(232,228,216,0.07); }
  #accountPanel .adultIntro ul { margin: 4px 0 0 0; padding-left: 18px; }
  #accountPanel .productRow { margin: 8px 0; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(232,228,216,0.2); }
  #accountPanel .productName { font-weight: 800; }
  #accountPanel .approvalBox { margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: rgba(0,0,0,0.25); }
  #accountPanel a { color: #f4c38f; }
  #superBoostSlot.superBoostBtn.locked { background: rgba(80,70,60,0.45); border-color: rgba(244,162,89,0.6); font-size: 11px; }
  #miniMap { pointer-events: auto; cursor: pointer; }
  #miniMapLabel { position: absolute; top: 96px; right: 128px; z-index: 18; background: rgba(20,24,16,0.6); color: #e8e4d8; border: 1px solid rgba(232,228,216,0.25);
    padding: 6px 10px; border-radius: 6px; font-weight: 600; font-size: 11px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  #miniMapLabel[hidden] { display: none; }
  @media (max-height: 500px) { #miniMapLabel { top: 56px; } }
  @media (max-height: 340px) { #miniMapLabel { top: 40px; right: auto; left: 132px; } }
  @media (max-width: 600px) and (orientation: portrait) {
    #miniMap { top: 100px; }
    #miniMapLabel { top: 100px; right: auto; left: 16px; }
    body.winch-open #miniMapLabel { display: none; }
  }
  /* How to play: an open scroll (parchment between two wooden rods), above the vehicle selector */
  #howToPlay { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 14px; box-sizing: border-box;
    background: rgba(12,15,10,0.55); backdrop-filter: blur(2px); }
  #howToPlay[hidden] { display: none; }
  #howToPlay .scroll { width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; filter: drop-shadow(0 8px 18px rgba(0,0,0,0.45)); }
  #howToPlay .scrollRod { height: 22px; margin: 0 -10px; border-radius: 11px; flex: 0 0 auto;
    background: linear-gradient(180deg, #a26b3b 0%, #6e4322 45%, #4d2e16 100%); box-shadow: inset 0 2px 0 rgba(255,255,255,0.18); }
  #howToPlay .scrollPaper { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 26px 20px; color: #3d2a16; font: 15px/1.5 Georgia, 'Times New Roman', serif;
    background: radial-gradient(ellipse at 50% 40%, #f7ebcf 0%, #efdcb2 55%, #e2c894 100%);
    box-shadow: inset 12px 0 18px -10px rgba(110,70,30,0.45), inset -12px 0 18px -10px rgba(110,70,30,0.45), inset 0 8px 12px -8px rgba(110,70,30,0.5), inset 0 -8px 12px -8px rgba(110,70,30,0.5); }
  #howToPlay h1 { margin: 0 0 4px; text-align: center; font-size: 26px; color: #5a2e0e; letter-spacing: 0.5px; }
  #howToPlay h2 { margin: 14px 0 4px; font-size: 16px; color: #7a3d12; border-bottom: 1px solid rgba(122,61,18,0.25); padding-bottom: 2px; }
  #howToPlay .lead { text-align: center; margin: 0 0 6px; font-style: italic; }
  #howToPlay ul { margin: 4px 0; padding-left: 20px; }
  #howToPlay li { margin: 3px 0; }
  #howToPlay b { color: #5a2e0e; }
  #howToPlay .howToStart { display: block; margin: 16px 0 10px; font-size: 13px; }
  #howToClose { display: block; margin: 0 auto; padding: 10px 28px; font: 700 16px 'Segoe UI', system-ui, sans-serif; color: #1a1f16; background: #f4a259;
    border: 2px solid #8a4a17; border-radius: 22px; cursor: pointer; }
  @media (max-height: 500px) { #howToPlay .scrollPaper { font-size: 13px; padding: 12px 18px 14px; } #howToPlay h1 { font-size: 20px; } }

  /* ---------- Vehicle selector / garage ---------- */
  #garage {
    position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: rgba(12,15,10,0.72); backdrop-filter: blur(3px); box-sizing: border-box; color: #e8e4d8;
  }
  #garage[hidden] { display: none; }
  .garagePanel {
    width: min(1120px, 100%); max-height: 100%; display: flex; flex-direction: column; box-sizing: border-box;
    background: rgba(26,31,22,0.97); border: 1px solid rgba(232,228,216,0.18); border-radius: 14px; overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  }
  .garageHead { padding: 16px 20px 6px; }
  .garageHead h1 { margin: 0; font-size: 21px; color: #f4a259; letter-spacing: 0.3px; }
  .garageSub { margin: 4px 0 0; font-size: 13px; opacity: 0.75; }
  .garageGrid {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 20px; display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); -webkit-overflow-scrolling: touch;
    scrollbar-color: rgba(244,162,89,0.6) rgba(232,228,216,0.08); scrollbar-width: thin;
  }
  .garageGrid::-webkit-scrollbar { height: 8px; width: 8px; }
  .garageGrid::-webkit-scrollbar-track { background: rgba(232,228,216,0.08); border-radius: 4px; }
  .garageGrid::-webkit-scrollbar-thumb { background: rgba(244,162,89,0.6); border-radius: 4px; }
  .vcard {
    position: relative; display: flex; flex-direction: column; text-align: left; box-sizing: border-box;
    background: rgba(232,228,216,0.06); border: 2px solid rgba(232,228,216,0.15); border-radius: 10px;
    padding: 8px 10px 10px; color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .vcard:hover { border-color: rgba(244,162,89,0.55); }
  .vcard:focus-visible { outline: 3px solid #6fa8dc; outline-offset: 2px; }
  .vcard[aria-checked="true"] { border-color: #f4a259; background: rgba(244,162,89,0.15); }
  .vcardPreview canvas { display: block; width: 100%; height: auto; aspect-ratio: 240 / 165; }
  .vcardName { font-weight: 700; font-size: 15px; margin-top: 4px; }
  .vcardDesc { font-size: 12px; line-height: 1.35; opacity: 0.8; margin-top: 2px; }
  .vcardCheck {
    position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%;
    background: #f4a259; color: #1a1f16; font-weight: 800; font-size: 14px;
    display: none; align-items: center; justify-content: center;
  }
  .vcard[aria-checked="true"] .vcardCheck { display: flex; }
  .vcardTag {
    position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.4px;
    background: rgba(20,24,16,0.85); border: 1px solid rgba(232,228,216,0.25); padding: 2px 6px; border-radius: 4px;
  }
  .garageFoot {
    display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 12px 20px 16px;
    border-top: 1px solid rgba(232,228,216,0.12);
  }
  .garageNote { flex: 1 1 220px; margin: 0; font-size: 13px; opacity: 0.85; min-height: 1em; }
  .garageActions { display: flex; gap: 10px; margin-left: auto; }
  #garageCancel, #garageDrive { border-radius: 8px; cursor: pointer; font-family: inherit; -webkit-tap-highlight-color: transparent; }
  #garageCancel { background: transparent; border: 1px solid rgba(232,228,216,0.35); color: #e8e4d8; padding: 12px 18px; font-weight: 600; font-size: 15px; }
  #garageDrive { background: #f4a259; color: #1a1f16; border: none; padding: 12px 34px; font-weight: 800; font-size: 17px; letter-spacing: 0.6px; min-width: 150px; }
  #garageDrive:hover { background: #ffb877; }
  #garageCancel:focus-visible, #garageDrive:focus-visible { outline: 3px solid #6fa8dc; outline-offset: 2px; }

  /* Short landscape phones: compact header and one horizontally scrolling row. */
  @media (max-height: 500px) {
    .garageHead { padding: 8px 14px 2px; }
    .garageHead h1 { font-size: 16px; }
    .garageSub { display: none; }
    .garageGrid {
      grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(140px, 1fr);
      overflow-x: auto; overflow-y: hidden; padding: 6px 14px; gap: 8px;
    }
    .vcard { padding: 6px 8px 8px; }
    .vcardPreview canvas { max-height: 30vh; object-fit: contain; }
    .vcardName { font-size: 13px; }
    .vcardDesc { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .garageFoot { padding: 6px 14px 8px; }
    .garageNote { font-size: 11px; }
    #garageDrive { padding: 9px 26px; font-size: 15px; }
    #garageCancel { padding: 9px 14px; font-size: 13px; }
  }
  /* Narrow portrait phones: two columns. */
  @media (max-width: 520px) {
    .garageGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px 12px; gap: 8px; }
    .garageHead { padding: 12px 14px 4px; }
    .garageFoot { padding: 10px 12px 12px; }
    .vcardDesc { font-size: 11px; }
  }

/* Narrow portrait (2026-10-16): the trial tags made the dev banner run into the Menu button; show only the short banner there */
@media (max-width: 600px) and (orientation: portrait) {
  #devBanner::before, #devBanner::after { content: none !important; }
}

/* ---------- Functional winch v1 (2026-10-16) ---------- */
#winchAttachBtn { position: absolute; top: 58px; left: 328px; z-index: 20; padding: 8px 12px; border-radius: 6px; font-weight: 700; font-size: 12px; cursor: pointer;
  background: rgba(46,125,70,0.75); color: #fff; border: 1px solid rgba(232,228,216,0.35); user-select: none; -webkit-user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent; }
#winchAttachBtn.attached { background: rgba(200,60,40,0.8); }
#winchAttachBtn[hidden] { display: none; }
#winchStatus { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); z-index: 26; pointer-events: none; background: rgba(20,24,16,0.75); color: #e8e4d8;
  font: 700 12px/1 'Segoe UI', system-ui, sans-serif; padding: 5px 10px; border-radius: 12px; white-space: nowrap; }
#winchStatus.stalled { background: rgba(200,60,40,0.85); }
#winchStatus[hidden] { display: none; }
@media (max-width: 600px) and (orientation: portrait) { #winchAttachBtn { top: 222px; left: 16px; } #winchStatus { top: 58px; } }

  /* Account / shop (PolyApes mini game backend, 2026-10-17) */
  .miniPanel .acctBlock { margin: 8px 0; }
  .miniPanel .acctLabel { font-size: 11px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }
  .miniPanel .idRow { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; }
  .miniPanel .idRow button { margin-top: 0 !important; }
  .miniPanel .playerId { font: 800 18px ui-monospace, Consolas, monospace; letter-spacing: 1px; color: #fff; user-select: all; -webkit-user-select: all; }
  .miniPanel .shopRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
  .miniPanel .shopRow button { margin-top: 0 !important; }
  .miniPanel .acctMsg { margin-top: 8px; min-height: 1em; font-size: 12px; }
  .miniPanel .acctMsg.good { color: #8fe08f; }
  .miniPanel .acctMsg.warn { color: #ffb37a; }
  .miniPanel .devOnly { border-top: 1px dashed rgba(232,228,216,0.3); padding-top: 6px; opacity: 0.85; }
  .miniPanel button:disabled { opacity: 0.55; cursor: default; }

  /* Music mini player in the Sound panel (2026-10-17) */
  #musicPlayer { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
  #musicTitle { font-size: 11px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 0 100%; }
  #musicPlayer .musicBtns { display: flex; gap: 4px; flex: 1; }
  #musicPlayer .musicBtns button { flex: 1; }
  #musicPlayer button { background: rgba(232,228,216,0.1); color: #e8e4d8; border: 1px solid rgba(232,228,216,0.3); border-radius: 6px; height: 28px; padding: 0; font-size: 13px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  #musicPlayer button:active { background: rgba(244,162,89,0.35); }
  @media (max-height: 340px) { #musicPlayer { grid-column: 1 / -1; } }

  /* Limited-edition vehicle cards (2026-10-18) */
  .vcardLimited { display: block; margin-top: 4px; font-size: 11px; font-weight: 700; color: #f2c46a; letter-spacing: 0.02em; }
  .vcard.locked .vcardPreview { filter: grayscale(0.7) brightness(0.6); }

  /* Pumpkin Truck horn (2026-10-18): small, just under BOOST, left of the throttle stick with a clear gap */
  #hornBtn { position: absolute; bottom: 70px; right: 186px; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(224,112,30,0.25); border: 1px solid rgba(255,160,80,0.6); font-size: 22px; pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent; cursor: pointer; z-index: 16; }
  #hornBtn[hidden] { display: none; }
  #hornBtn.active { background: rgba(255,140,40,0.75); box-shadow: 0 0 12px rgba(255,140,40,0.9); }
  /* short landscape phones: SUPER sits under BOOST there, so the horn goes just left of it */
  @media (max-height: 500px) and (orientation: landscape) { #hornBtn { bottom: 38px; right: 246px; } }
  /* narrow portrait: the handbrake is close, so the horn sits just above BOOST instead */
  /* narrow portrait: just UNDER BOOST (Bradley 19 Oct), between the handbrake and the throttle stick */
  @media (max-width: 600px) and (orientation: portrait) { #hornBtn { bottom: 94px; right: 168px; } }

  /* Crawler-mode zones (2026-10-19): badge + dimmed BOOST / SUPER while inside */
  #crawlBadge { position: absolute; top: 78px; left: 50%; transform: translateX(-50%); padding: 4px 10px; border-radius: 8px; background: rgba(30,60,30,0.75); border: 1px solid rgba(160,220,120,0.6); color: #e8f5d8; font: 700 11px system-ui, sans-serif; letter-spacing: 0.4px; pointer-events: none; z-index: 21; white-space: nowrap; }
  #crawlBadge[hidden] { display: none; }
  body.crawler-zone #boostBtn, body.crawler-zone #superBoostSlot.superBoostBtn { opacity: 0.35; filter: grayscale(1); }

  /* Winch practice tip card (2026-10-19): the How to play scroll look, small, top-left under the buttons; never pauses */
  #winchTip { position: absolute; top: 112px; left: 16px; z-index: 34; width: min(300px, calc(100vw - 32px)); filter: drop-shadow(0 6px 14px rgba(0,0,0,0.45)); }
  #winchTip[hidden] { display: none; }
  #winchTip .wtRod { height: 12px; margin: 0 -6px; border-radius: 6px; background: linear-gradient(#8a5a2b, #5a3415); }
  #winchTip .wtPaper { position: relative; background: linear-gradient(#f6e8c6, #ecd8aa); color: #3d2a16; padding: 10px 14px 10px; font: 13px/1.4 Georgia, serif; }
  #winchTip .wtTitle { display: block; font-size: 15px; color: #5a2e0e; margin-bottom: 4px; }
  #winchTip ol { margin: 2px 0 6px; padding-left: 18px; } #winchTip li { margin: 2px 0; } #winchTip b { color: #5a2e0e; }
  #winchTip .wtHint { font-style: italic; font-size: 12px; opacity: 0.85; }
  #winchTip .wtNever { display: block; margin-top: 6px; font-size: 12px; }
  #winchTip .wtClose { position: absolute; top: 4px; right: 6px; background: none; border: none; font-size: 16px; color: #5a2e0e; cursor: pointer; }
  @media (max-height: 500px) { #winchTip { top: 56px; left: 130px; width: min(280px, calc(100vw - 260px)); } #winchTip .wtPaper { font-size: 12px; padding: 6px 10px; } #winchTip .wtHint { display: none; } }
