:root {
  --cyan: #55f7ff;
  --cyan-deep: #18d7ff;
  --pink: #ff3d9a;
  --gold: #ffcf5c;
  --red: #ff3355;
  --ink: #eaf7ff;
  --muted: #8ea6c4;
  --glass: rgba(5, 11, 22, 0.66);
  --glass-2: rgba(8, 16, 31, 0.86);
  --line: rgba(85, 247, 255, 0.22);
  --line-soft: rgba(120, 190, 230, 0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #03050c;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

button, input { font-family: inherit; }
button { color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }

#app { position: fixed; inset: 0; overflow: hidden; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.scene-vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(120% 80% at 50% 42%, transparent 42%, rgba(1, 3, 9, 0.42) 100%),
    linear-gradient(180deg, rgba(1, 3, 9, 0.38) 0%, transparent 16%, transparent 76%, rgba(1, 3, 9, 0.58) 100%);
}

.hud {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  padding: calc(10px + var(--safe-top)) 12px calc(12px + var(--safe-bottom));
  transition: opacity 0.22s ease, visibility 0.22s;
}
.hud.hide { opacity: 0; visibility: hidden; }
.hud.hide * { pointer-events: none !important; }

/* ---------- top / profile / live ---------- */
.hud-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.profile {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto;
  padding: 6px 10px 6px 6px; border-radius: 999px;
  background: linear-gradient(100deg, rgba(6, 13, 26, 0.8), rgba(9, 18, 34, 0.45));
  border: 1px solid rgba(85, 247, 255, 0.16);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32), inset 0 0 18px rgba(24, 215, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.avatar {
  position: relative; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 30% 25%, #65fcff, #1477ff 46%, #5a1ad8 100%);
  box-shadow: 0 0 0 2px rgba(85, 247, 255, 0.5), 0 0 18px rgba(24, 215, 255, 0.35);
}
.avatar::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.4), transparent 45%);
}
.avatar span { position: relative; z-index: 2; font-weight: 800; font-size: 15px; color: #041018; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.avatar.has-img span, .avatar.has-img .mp-icon { display: none; }
.avatar .mp-icon { position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; color: #d6feff; z-index: 3; filter: drop-shadow(0 1px 2px #000); }
.pmeta { min-width: 0; }
.pname { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; max-width: 132px; }
.pname span { overflow: hidden; text-overflow: ellipsis; }
.pname em { font-style: normal; font-size: 9px; font-weight: 800; color: #9df8ff; letter-spacing: 0.4px; }
.xp { width: 104px; height: 4px; margin-top: 5px; border-radius: 99px; background: rgba(120, 200, 255, 0.16); overflow: hidden; }
.xp i { display: block; height: 100%; width: 42%; border-radius: 99px; background: linear-gradient(90deg, var(--cyan-deep), var(--cyan)); box-shadow: 0 0 10px rgba(85, 247, 255, 0.8); transition: width 0.35s ease; }

.top-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.coin-pill {
  pointer-events: auto; display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 9px;
  border-radius: 999px; color: #ffe6a3; font-size: 13px; font-weight: 800;
  background: linear-gradient(180deg, rgba(28, 22, 8, 0.88), rgba(12, 12, 12, 0.72));
  border: 1px solid rgba(255, 207, 92, 0.28); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.coin-pill .mp-icon { width: 18px; height: 18px; color: var(--gold); }
.coin-pill b { font-variant-numeric: tabular-nums; letter-spacing: 0.2px; }
.coin-pill .plus { margin-left: 1px; color: #fff1bd; font-size: 15px; opacity: 0.9; }
.coin-pill.bump { animation: coinBump 0.4s ease; }
.live-btn {
  pointer-events: auto; display: flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px;
  border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: 0.6px;
  color: #fff; background: linear-gradient(180deg, #ff3c5f, #c51134);
  border: 1px solid rgba(255, 120, 140, 0.55);
  box-shadow: 0 0 18px rgba(255, 51, 85, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.live-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px #fff; }
.live-btn.on { background: linear-gradient(180deg, #1d2638, #0b111c); border-color: rgba(255, 51, 85, 0.6); color: #ff8fa4; }
.live-btn.on .dot { animation: pulseDot 1s infinite; background: #ff3355; box-shadow: 0 0 9px #ff3355; }
.live-time { display: none; font-variant-numeric: tabular-nums; font-size: 10px; opacity: 0.85; }
.live-btn.on .live-time { display: inline; }
.live-btn.on #liveLabel { display: none; }

.viewer-chip {
  position: absolute; right: 12px; top: calc(54px + var(--safe-top));
  display: none; align-items: center; gap: 4px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 10px; color: #b9d6e8;
  background: rgba(4, 10, 20, 0.58); border: 1px solid rgba(85, 247, 255, 0.16);
  backdrop-filter: blur(8px);
}
.viewer-chip.show { display: flex; }
.viewer-chip .mp-icon { width: 13px; height: 13px; color: #7df6ff; }
.viewer-chip b { color: #fff; font-size: 11px; }

/* ---------- pursuit / speed warning ---------- */
.pursuit {
  position: absolute; left: 50%; top: calc(58px + var(--safe-top)); transform: translate(-50%, -10px);
  width: min(300px, calc(100% - 28px)); display: none; align-items: center; gap: 9px;
  padding: 7px 12px 7px 8px; border-radius: 12px;
  background: linear-gradient(100deg, rgba(41, 4, 12, 0.9), rgba(8, 12, 24, 0.82));
  border: 1px solid rgba(255, 51, 85, 0.42);
  box-shadow: 0 0 26px rgba(255, 51, 85, 0.22);
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
}
.pursuit.show { display: flex; opacity: 1; transform: translate(-50%, 0); }
.siren {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; display: grid; place-items: center;
  background: #180810; color: #ff5a74; animation: sirenFlash 0.55s infinite alternate;
}
.siren .mp-icon { width: 19px; height: 19px; }
.pursuit-text { min-width: 0; flex: 1; }
.pursuit-text b { display: block; font-size: 12px; letter-spacing: 0.3px; color: #ffd6dd; }
.pursuit-text span { display: block; margin-top: 2px; font-size: 10px; color: #ff97a8; font-variant-numeric: tabular-nums; }
.pursuit-bar { position: absolute; left: 10px; right: 10px; bottom: 3px; height: 2px; border-radius: 9px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.pursuit-bar i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, #ffb340, #ff3355); box-shadow: 0 0 8px #ff3355; }

.speed-warn {
  position: absolute; left: 148px; bottom: calc(232px + var(--safe-bottom));
  display: none; align-items: center; gap: 4px; padding: 5px 9px; border-radius: 8px;
  font-size: 11px; font-weight: 900; letter-spacing: 1px; color: #fff;
  background: rgba(210, 20, 50, 0.86); border: 1px solid rgba(255, 130, 150, 0.5);
  box-shadow: 0 0 18px rgba(255, 51, 85, 0.4); animation: warnBlink 0.7s infinite alternate;
}
.speed-warn.show { display: flex; }
.speed-warn .mp-icon { width: 14px; height: 14px; }

/* ---------- speedometer ---------- */
.speedo {
  position: absolute; left: 8px; bottom: calc(144px + var(--safe-bottom));
  width: 136px; height: 136px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.42));
  transition: opacity 0.2s;
}
.speedo svg { width: 100%; height: 100%; overflow: visible; }
.spd-num { font-size: 33px; font-weight: 900; fill: #f2feff; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.spd-unit { font-size: 8px; font-weight: 700; fill: #7fdcf0; letter-spacing: 1.6px; }
.spd-gear { font-size: 9px; font-weight: 900; fill: #55f7ff; letter-spacing: 1px; }
.spd-limit text { font-size: 13px; font-weight: 900; fill: #131313; font-family: Arial, sans-serif; }
.speedo.over .spd-num { fill: #ff637d; }
.speedo.over .spd-unit { fill: #ff8da0; }
#spdTicks line { stroke: rgba(120, 231, 255, 0.4); stroke-width: 1; }
#spdTicks line.major { stroke: rgba(170, 247, 255, 0.75); stroke-width: 1.8; }

/* ---------- controls ---------- */
.controls {
  position: absolute; left: 0; right: 0; bottom: calc(10px + var(--safe-bottom));
  padding: 0 12px; display: flex; align-items: flex-end; justify-content: space-between;
  z-index: 9; pointer-events: none;
}
.steer-pad, .pedal-pad, .tool-pad { display: flex; align-items: center; gap: 8px; pointer-events: none; }
.ctrl, .tool { pointer-events: auto; touch-action: none; }

.ctrl.steer {
  width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center;
  color: #dffcff; background: linear-gradient(180deg, rgba(13, 28, 48, 0.78), rgba(4, 10, 20, 0.62));
  border: 1px solid rgba(85, 247, 255, 0.28);
  box-shadow: inset 0 0 18px rgba(24, 215, 255, 0.08), 0 6px 18px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}
.ctrl.steer .mp-icon { width: 36px; height: 36px; }
.ctrl.steer.active { background: linear-gradient(180deg, rgba(38, 220, 245, 0.32), rgba(8, 50, 70, 0.6)); border-color: rgba(120, 252, 255, 0.8); box-shadow: 0 0 22px rgba(85, 247, 255, 0.34); }

.pedal-pad { align-items: flex-end; }
.ctrl.brake {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #ffd4dc;
  background: linear-gradient(180deg, rgba(56, 12, 24, 0.82), rgba(18, 6, 12, 0.66));
  border: 1px solid rgba(255, 80, 110, 0.38); backdrop-filter: blur(8px);
}
.ctrl.brake.active { background: rgba(210, 24, 56, 0.55); box-shadow: 0 0 20px rgba(255, 51, 85, 0.35); }
.ctrl.gas {
  width: 76px; height: 76px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: #d9fdff; background: linear-gradient(180deg, rgba(12, 45, 54, 0.9), rgba(4, 16, 24, 0.7));
  border: 1px solid rgba(85, 247, 255, 0.55);
  box-shadow: 0 0 22px rgba(24, 215, 255, 0.18), inset 0 0 22px rgba(85, 247, 255, 0.1);
  backdrop-filter: blur(8px);
}
.ctrl.gas .mp-icon { width: 26px; height: 26px; color: var(--cyan); }
.ctrl.gas span { font-size: 11px; font-weight: 900; letter-spacing: 1px; }
.ctrl.gas.active { background: linear-gradient(180deg, rgba(44, 230, 250, 0.42), rgba(8, 78, 94, 0.7)); box-shadow: 0 0 30px rgba(85, 247, 255, 0.42); }

.tool-pad {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
  gap: 6px; z-index: 10;
}
.tool {
  width: 44px; height: 46px; border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: #a9c6d8; background: rgba(5, 12, 23, 0.58); border: 1px solid rgba(120, 190, 230, 0.16);
  backdrop-filter: blur(8px);
}
.tool .mp-icon { width: 19px; height: 19px; }
.tool span { font-size: 8px; letter-spacing: 1px; }
.tool:active, .tool.active { color: var(--cyan); border-color: rgba(85, 247, 255, 0.55); background: rgba(12, 45, 60, 0.72); }
.tool.drift { color: #ffcf8a; }

/* ---------- gift + danmaku ---------- */
.gift-layer {
  position: absolute; top: calc(104px + var(--safe-top)); left: 0; right: 0;
  display: flex; justify-content: center; align-items: center; gap: 8px;
  height: 60px; overflow: hidden; pointer-events: none;
}
.gift-item {
  display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 12px;
  background: linear-gradient(100deg, rgba(70, 44, 4, 0.86), rgba(23, 18, 6, 0.5));
  border: 1px solid rgba(255, 207, 92, 0.36);
  box-shadow: 0 0 24px rgba(255, 190, 50, 0.18);
  animation: giftIn 0.5s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
.gift-item.out { animation: giftOut 0.5s ease forwards; }
.gift-item .gicon {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 25%, #fff3b0, #ffb300 65%, #a35d00);
  box-shadow: 0 0 14px rgba(255, 191, 0, 0.55);
}
.gift-item .gicon .mp-icon { width: 17px; height: 17px; color: #442300; }
.gift-item .gmeta { display: flex; flex-direction: column; line-height: 1.15; }
.gift-item .gmeta b { font-size: 10px; color: #fff2c4; max-width: 86px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-item .gmeta span { font-size: 10px; color: var(--gold); font-weight: 900; }
.gift-item .gname { font-size: 10px; color: #ffdd8a; }

.danmaku {
  position: absolute; right: 10px; top: 32%; width: min(55vw, 236px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
  pointer-events: none;
}
.dm {
  max-width: 100%; display: flex; align-items: flex-start; gap: 6px; padding: 5px 8px 5px 5px;
  border-radius: 10px; background: linear-gradient(90deg, rgba(6, 13, 26, 0.28), rgba(6, 13, 26, 0.78));
  border: 1px solid rgba(85, 247, 255, 0.12); animation: dmIn 0.35s ease both;
  backdrop-filter: blur(6px);
}
.dm.out { animation: dmOut 0.5s ease forwards; }
.dm .davatar {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 9px; font-weight: 900; color: #04121a; background: linear-gradient(140deg, #72fbff, #2b8dff);
}
.dm .dtext { min-width: 0; font-size: 10px; line-height: 1.35; color: #dff5ff; text-shadow: 0 1px 3px #000; }
.dm .dtext b { display: block; color: #7df6ff; font-size: 9px; font-weight: 700; margin-bottom: 1px; }
.dm .dtext span { display: block; word-break: break-word; }

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 50%; top: 22%; transform: translate(-50%, 8px);
  max-width: calc(100% - 48px); padding: 9px 14px; border-radius: 999px;
  font-size: 12px; text-align: center; color: #e9fcff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(4, 12, 24, 0.88); border: 1px solid rgba(85, 247, 255, 0.28);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
  opacity: 0; pointer-events: none; transition: opacity 0.22s, transform 0.22s;
  z-index: 80;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- cockpit ---------- */
.cockpit { display: none; position: absolute; left: 0; right: 0; bottom: 0; height: 286px; pointer-events: none; z-index: 4; }
.cockpit.show { display: block; }
.cockpit-dash {
  position: absolute; left: 0; right: 0; bottom: 0; height: 240px;
  background:
    radial-gradient(120% 95% at 50% 100%, rgba(12, 24, 44, 0.96), rgba(3, 6, 12, 0.9) 60%, rgba(3, 6, 12, 0.2) 100%);
  border-top: 1px solid rgba(85, 247, 255, 0.12);
  box-shadow: 0 -20px 50px rgba(2, 5, 12, 0.55);
  clip-path: ellipse(90% 78% at 50% 100%);
}
.cockpit-dash::before {
  content: ""; position: absolute; left: 10%; right: 10%; top: 16px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(85, 247, 255, 0.48), transparent);
}
.dash-cluster {
  position: absolute; left: 26px; bottom: 92px; width: 104px; height: 74px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(3, 10, 20, 0.78); border: 1px solid rgba(85, 247, 255, 0.24);
  box-shadow: inset 0 0 18px rgba(24, 215, 255, 0.14);
}
.dash-cluster b { font-size: 27px; font-weight: 900; line-height: 1; color: #f2feff; font-variant-numeric: tabular-nums; }
.dash-cluster small { margin-top: 2px; font-size: 7px; color: #73d7e8; letter-spacing: 1.4px; }
.dash-cluster em { position: absolute; right: 8px; top: 6px; font-style: normal; font-size: 9px; font-weight: 900; color: var(--cyan); }
.dash-wheel { position: absolute; left: 50%; bottom: -104px; width: 286px; height: 166px; transform: translateX(-50%); opacity: 0.96; }
.dash-radio {
  position: absolute; right: 22px; bottom: 96px; min-width: 156px; height: 54px; padding: 0 10px;
  display: flex; align-items: center; gap: 8px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(8, 31, 54, 0.92), rgba(3, 12, 22, 0.9));
  border: 1px solid rgba(85, 247, 255, 0.3); box-shadow: 0 0 18px rgba(24, 215, 255, 0.12);
}
.dash-radio > .mp-icon { width: 22px; height: 22px; color: var(--cyan); }
.dash-radio > div:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.dash-radio b { font-size: 10px; color: #e9fdff; white-space: nowrap; max-width: 88px; overflow: hidden; text-overflow: ellipsis; }
.dash-radio span { font-size: 8px; color: #6fd8e8; margin-top: 2px; }
.mini-eq { display: flex; align-items: flex-end; gap: 2px; height: 18px; margin-left: auto; }
.mini-eq i { width: 2px; height: 6px; background: var(--cyan); border-radius: 2px; animation: eq 0.8s infinite ease-in-out; }
.mini-eq i:nth-child(2) { animation-delay: -0.3s; height: 12px; }
.mini-eq i:nth-child(3) { animation-delay: -0.55s; height: 9px; }
.mini-eq i:nth-child(4) { animation-delay: -0.15s; height: 15px; }
.cockpit-mode .speedo { display: none; }
.cockpit-mode .speed-warn { left: 12px; bottom: calc(266px + var(--safe-bottom)); }

/* ---------- common overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: 30; display: none; }
.overlay.show { display: flex; }

/* ---------- splash ---------- */
.splash { position: fixed; inset: 0; z-index: 90; overflow: hidden; background: rgba(2, 4, 10, 0.16); transition: opacity 0.42s ease, visibility 0.42s; }
.splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; display: block; }
.splash-shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 44%, transparent 32%, rgba(2, 4, 10, 0.24) 74%, rgba(2, 4, 10, 0.62) 100%),
    linear-gradient(180deg, rgba(2, 4, 10, 0.34) 0%, transparent 20%, transparent 36%, rgba(2, 5, 12, 0.62) 62%, rgba(2, 4, 10, 0.96) 86%, #02040a 100%);
}
.splash-top { position: absolute; top: calc(16px + var(--safe-top)); left: 16px; right: 16px; display: flex; }
.brand-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 999px;
  font-size: 9px; font-weight: 800; letter-spacing: 1.4px; color: #bdf8ff;
  background: rgba(4, 12, 24, 0.5); border: 1px solid rgba(85, 247, 255, 0.26);
  backdrop-filter: blur(8px);
}
.brand-chip .mp-icon { width: 13px; height: 13px; color: var(--cyan); }
.splash-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 24px calc(26px + var(--safe-bottom));
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.logo {
  font-size: 48px; line-height: 1; font-weight: 900; letter-spacing: 6px; color: #f2feff;
  text-shadow: 0 0 22px rgba(85, 247, 255, 0.42), 0 0 60px rgba(255, 61, 154, 0.22), 0 4px 18px #000;
}
.logo::after {
  content: ""; display: block; width: 72px; height: 3px; margin: 12px auto 0; border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--pink), transparent);
  box-shadow: 0 0 14px rgba(85, 247, 255, 0.6);
}
.tagline { margin-top: 12px; font-size: 12px; letter-spacing: 4px; color: #9fe9ff; }
.splash-desc { max-width: 320px; margin: 12px 0 18px; font-size: 12px; line-height: 1.6; color: #a8bfd6; }
.start-btn {
  width: min(340px, 100%); height: 54px; border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 16px; font-weight: 900; letter-spacing: 3px; color: #031018;
  background: linear-gradient(100deg, #44efff, #8cfbff 48%, #ff7fc4);
  box-shadow: 0 0 30px rgba(85, 247, 255, 0.3), 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.start-btn:active { transform: scale(0.985); }
.start-btn .mp-icon { width: 20px; height: 20px; }
.splash-foot { margin-top: 12px; font-size: 9px; letter-spacing: 1.4px; color: rgba(160, 195, 215, 0.6); }

.splash-garage {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; max-width: 320px;
  height: 46px; margin-top: 10px; border-radius: 14px; font-size: 14px; font-weight: 800; letter-spacing: 2px;
  color: #cdf7ff; background: rgba(5, 13, 25, 0.72); border: 1px solid rgba(85, 247, 255, 0.34);
  backdrop-filter: blur(10px);
}
.splash-garage .mp-icon { width: 20px; height: 20px; }
.splash-garage:active { background: rgba(24, 215, 255, 0.2); }

/* ---------- garage ---------- */
.garage { flex-direction: column; pointer-events: none; }
.garage::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(2, 5, 12, 0.42), transparent 30%, transparent 45%, rgba(2, 5, 12, 0.82) 74%, rgba(2, 4, 10, 0.96) 100%);
  pointer-events: none;
}
.garage-top {
  pointer-events: auto; position: relative; display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-top)) 14px 8px;
}
.round-btn {
  pointer-events: auto; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
  display: grid; place-items: center; color: #cdf7ff;
  background: rgba(5, 13, 25, 0.74); border: 1px solid rgba(85, 247, 255, 0.24);
  backdrop-filter: blur(10px);
}
.round-btn .mp-icon { width: 21px; height: 21px; }
.round-btn:active { background: rgba(24, 215, 255, 0.2); }
.g-title { display: flex; flex-direction: column; flex: 1; }
.g-title b { font-size: 17px; letter-spacing: 1px; }
.g-title span { font-size: 9px; color: #7f9ab3; letter-spacing: 1px; margin-top: 2px; }
.g-coins {
  display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px; border-radius: 999px;
  color: #ffe6a3; font-size: 13px; font-weight: 800;
  background: rgba(16, 14, 8, 0.72); border: 1px solid rgba(255, 207, 92, 0.26);
}
.g-coins .mp-icon { width: 17px; height: 17px; color: var(--gold); }
.garage-hint {
  position: relative; align-self: center; margin-top: 6px; font-size: 9px; letter-spacing: 1px; color: rgba(150, 205, 225, 0.64);
  pointer-events: none;
}
.garage-sheet {
  pointer-events: auto; position: relative; margin-top: auto; width: 100%;
  touch-action: pan-y; -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(7, 14, 27, 0.9), rgba(4, 9, 18, 0.98));
  border-top: 1px solid rgba(85, 247, 255, 0.24);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 12px 14px calc(12px + var(--safe-bottom));
  backdrop-filter: blur(14px);
  max-height: 49vh; display: flex; flex-direction: column;
}
.g-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(3, 8, 17, 0.7); border: 1px solid rgba(120, 190, 230, 0.12); }
.g-tabs button { flex: 1; height: 32px; border-radius: 9px; font-size: 12px; font-weight: 800; color: #7f9ab3; letter-spacing: 1px; }
.g-tabs button.on { color: #061018; background: linear-gradient(100deg, #49efff, #8dfcff); box-shadow: 0 0 18px rgba(85, 247, 255, 0.24); }
.g-subtabs { display: flex; gap: 6px; margin: 9px 0 8px; overflow-x: auto; flex: 0 0 auto; }
.g-subtabs button {
  flex: 0 0 auto; height: 26px; padding: 0 11px; border-radius: 99px; font-size: 10px; color: #8eb0c8;
  background: rgba(11, 22, 38, 0.7); border: 1px solid rgba(120, 190, 230, 0.13);
}
.g-subtabs button.on { color: var(--cyan); border-color: rgba(85, 247, 255, 0.48); background: rgba(16, 54, 68, 0.55); }
.g-items { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 2px 1px 8px; flex: 1 1 auto; min-height: 108px; touch-action: pan-x; }
.g-items::-webkit-scrollbar, .g-subtabs::-webkit-scrollbar, .playlist::-webkit-scrollbar { display: none; }
.g-card {
  position: relative; flex: 0 0 88px; height: 106px; border-radius: 13px; padding: 8px 7px 7px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: linear-gradient(180deg, rgba(14, 27, 46, 0.76), rgba(6, 12, 23, 0.9));
  border: 1px solid rgba(120, 190, 230, 0.14); overflow: hidden;
}
.g-card.sel { border-color: rgba(85, 247, 255, 0.78); box-shadow: 0 0 18px rgba(24, 215, 255, 0.18), inset 0 0 18px rgba(24, 215, 255, 0.07); }
.g-card.equipped::after {
  content: "已装备"; position: absolute; top: 4px; right: 4px; padding: 1px 4px; border-radius: 4px;
  font-size: 7px; color: #041018; background: var(--cyan); font-weight: 900;
}
.g-thumb { width: 46px; height: 46px; margin-top: 4px; border-radius: 12px; display: grid; place-items: center; position: relative; }
.g-thumb .swatch { width: 38px; height: 38px; border-radius: 50%; box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.38), 0 4px 12px rgba(0, 0, 0, 0.4); }
.g-thumb .decal-chip {
  width: 42px; height: 24px; border-radius: 6px; background: linear-gradient(180deg, #2b3950, #111a2a);
  position: relative; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.1);
}
.g-thumb .decal-chip i { position: absolute; display: block; background: #fff; }
.g-thumb .part-chip { width: 44px; height: 44px; position: relative; }
.g-thumb .wheel-chip { width: 38px; height: 38px; border-radius: 50%; border: 5px solid #252f42; background: repeating-conic-gradient(from 0deg, #c8d5e8 0deg 12deg, #1a2332 12deg 24deg); box-shadow: 0 0 12px rgba(85, 247, 255, 0.18); }
.g-thumb .wing-chip { width: 44px; height: 26px; position: relative; }
.g-thumb .wing-chip::before { content: ""; position: absolute; left: 2px; right: 2px; top: 2px; height: 6px; border-radius: 3px; background: #aebdd2; box-shadow: 0 0 10px rgba(85, 247, 255, 0.25); }
.g-thumb .wing-chip::after { content: ""; position: absolute; left: 8px; right: 8px; top: 8px; height: 14px; border-left: 3px solid #596a85; border-right: 3px solid #596a85; }
.g-thumb .bumper-chip { width: 44px; height: 20px; position: relative; }
.g-thumb .bumper-chip::before { content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 7px; border-radius: 3px; background: #aebdd2; }
.g-thumb .bumper-chip::after { content: ""; position: absolute; left: 9px; right: 9px; top: 0; height: 8px; border-radius: 4px 4px 0 0; background: #3c4b63; }
.g-thumb .skirt-chip { width: 44px; height: 14px; border-radius: 3px; background: linear-gradient(90deg, #394960, #b9c8dd 45%, #394960); box-shadow: 0 0 10px rgba(85, 247, 255, 0.2); }
.g-name { margin-top: 6px; font-size: 10px; font-weight: 700; color: #dcecf8; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-tag { margin-top: 2px; font-size: 8px; color: #7894ad; }
.g-tag.owned { color: #6fe7ff; }
.g-tag.price { color: var(--gold); }
.g-action { display: flex; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid rgba(120, 190, 230, 0.1); }
.g-price { flex: 1; min-width: 0; }
.g-price span { display: block; font-size: 11px; color: #d9edf8; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-price b { display: block; margin-top: 2px; font-size: 9px; color: #7795ad; font-weight: 600; }
.g-price b.gold { color: var(--gold); }
.apply-btn {
  flex: 0 0 auto; min-width: 128px; height: 42px; padding: 0 14px; border-radius: 12px;
  font-size: 12px; font-weight: 900; letter-spacing: 0.4px; color: #041018;
  background: linear-gradient(100deg, #47efff, #9bfdff);
  box-shadow: 0 0 20px rgba(85, 247, 255, 0.22);
}
.apply-btn:disabled { color: #69819a; background: rgba(20, 33, 52, 0.7); box-shadow: none; border: 1px solid rgba(120, 190, 230, 0.13); }
.apply-btn.buy { background: linear-gradient(100deg, #ffd76a, #ffb62e); box-shadow: 0 0 20px rgba(255, 190, 50, 0.24); }

/* ---------- radio ---------- */
.radio { align-items: flex-end; }
.radio-backdrop { position: absolute; inset: 0; background: rgba(2, 5, 12, 0.58); backdrop-filter: blur(5px); }
.radio-sheet {
  position: relative; width: 100%; max-height: 87vh; overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(9, 18, 34, 0.98), rgba(3, 7, 15, 0.995));
  border-top: 1px solid rgba(85, 247, 255, 0.28);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -22px 60px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 16px 16px calc(16px + var(--safe-bottom));
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sheet-head > div { display: flex; flex-direction: column; }
.sheet-head b { font-size: 18px; letter-spacing: 1px; }
.sheet-head span { margin-top: 3px; font-size: 9px; color: #7f9ab3; letter-spacing: 0.6px; }
.now-playing {
  margin-top: 14px; display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 16px;
  background: linear-gradient(110deg, rgba(19, 54, 76, 0.65), rgba(34, 12, 44, 0.55));
  border: 1px solid rgba(85, 247, 255, 0.2); box-shadow: inset 0 0 24px rgba(24, 215, 255, 0.05);
}
.np-cover {
  width: 58px; height: 58px; flex: 0 0 58px; border-radius: 15px; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, #57f4ff, #1268ff 55%, #7b1dd6 100%);
  box-shadow: 0 0 22px rgba(24, 215, 255, 0.3);
}
.np-cover .mp-icon { width: 30px; height: 30px; color: #eaffff; }
.np-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.np-info b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-info span { margin-top: 3px; font-size: 9px; color: #8fb9cf; letter-spacing: 0.5px; }
.np-eq { display: flex; align-items: flex-end; gap: 3px; height: 20px; margin-top: 7px; }
.np-eq i { width: 3px; height: 5px; border-radius: 2px; background: linear-gradient(180deg, var(--cyan), #1b7dff); animation: eq 0.72s infinite ease-in-out; }
.np-eq i:nth-child(2) { animation-delay: -0.22s; }
.np-eq i:nth-child(3) { animation-delay: -0.51s; }
.np-eq i:nth-child(4) { animation-delay: -0.37s; }
.np-eq i:nth-child(5) { animation-delay: -0.14s; }
.np-eq i:nth-child(6) { animation-delay: -0.63s; }
.np-eq.paused i { animation-play-state: paused; opacity: 0.22; }
.np-play {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 50%; display: grid; place-items: center;
  color: #041018; background: linear-gradient(140deg, #52f2ff, #a2fdff);
  box-shadow: 0 0 20px rgba(85, 247, 255, 0.3);
}
.np-play .mp-icon { width: 26px; height: 26px; }
.np-controls { display: flex; align-items: center; gap: 9px; margin-top: 12px; }
.volume-row { display: flex; align-items: center; gap: 8px; flex: 1; margin-left: 4px; }
.volume-row .mp-icon { width: 17px; height: 17px; color: #7ecde0; }
.volume-row input[type="range"] { flex: 1; min-width: 0; accent-color: #55f7ff; height: 4px; }
.volume-row span { width: 22px; text-align: right; font-size: 10px; color: #8fb9cf; font-variant-numeric: tabular-nums; }
.playlist-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 8px; }
.playlist-head b { font-size: 13px; letter-spacing: 1px; }
.playlist-head span { font-size: 9px; color: #7894ad; }
.playlist { display: flex; flex-direction: column; gap: 6px; max-height: 29vh; overflow-y: auto; touch-action: pan-y; }
.track {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 12px;
  background: rgba(10, 20, 35, 0.62); border: 1px solid rgba(120, 190, 230, 0.1);
}
.track.on { border-color: rgba(85, 247, 255, 0.42); background: rgba(14, 42, 56, 0.6); }
.track.failed { border-color: rgba(255, 77, 109, 0.46); background: rgba(48, 10, 20, 0.52); }
.track.failed .tnum, .track.failed .tinfo b { color: #ff9aab; }
.track .tnum { width: 18px; font-size: 9px; color: #6f8aa1; text-align: center; }
.track.on .tnum { color: var(--cyan); }
.track .tinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.track .tinfo b { font-size: 11px; font-weight: 700; color: #d9edf8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .tinfo span { margin-top: 1px; font-size: 8px; color: #7692aa; }
.track .tplay { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #b9efff; background: rgba(18, 38, 57, 0.8); }
.track .tplay .mp-icon { width: 17px; height: 17px; }
.track .tdel { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #ff8aa0; }
.track .tdel .mp-icon { width: 16px; height: 16px; }
.add-song { display: flex; gap: 6px; margin-top: 12px; }
.add-song input {
  min-width: 0; height: 38px; border-radius: 10px; padding: 0 10px; font-size: 11px; color: #dff5ff;
  background: rgba(6, 14, 26, 0.8); border: 1px solid rgba(120, 190, 230, 0.16); outline: none;
}
.add-song #songTitle { flex: 0 0 34%; }
.add-song #songUrl { flex: 1; }
.add-song input::placeholder { color: #526c82; }
.add-song button {
  flex: 0 0 auto; height: 38px; padding: 0 11px; border-radius: 10px; display: flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 800; color: #051018; background: linear-gradient(100deg, #50f1ff, #9afdff);
}
.add-song button .mp-icon { width: 15px; height: 15px; }
.radio-fail {
  margin-top: 12px; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 13px;
  background: linear-gradient(100deg, rgba(74, 10, 24, 0.72), rgba(34, 8, 18, 0.6));
  border: 1px solid rgba(255, 77, 109, 0.38);
}
.radio-fail[hidden] { display: none; }
.radio-fail > .mp-icon { width: 19px; height: 19px; flex: 0 0 19px; color: #ff7b93; }
.radio-fail .rf-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.radio-fail .rf-text b { font-size: 11px; color: #ffc2cd; }
.radio-fail .rf-text span { font-size: 9px; line-height: 1.45; color: #d79aa8; }
.radio-fail button {
  flex: 0 0 auto; height: 38px; padding: 0 12px; border-radius: 999px; font-size: 11px; font-weight: 800;
  color: #180a10; background: linear-gradient(100deg, #ffc0cd, #ff9bb0);
}
.add-song-tip { display: flex; align-items: flex-start; gap: 5px; margin-top: 8px; color: #66849c; font-size: 9px; line-height: 1.45; }
.add-song-tip .mp-icon { width: 13px; height: 13px; margin-top: 1px; flex: 0 0 13px; color: #55c8dc; }
.song-error {
  margin-top: 7px; padding: 8px 10px; border-radius: 9px; font-size: 10px; line-height: 1.45;
  color: #ffc2cd; background: rgba(80, 10, 24, 0.55); border: 1px solid rgba(255, 77, 109, 0.32);
}
.song-error:empty { display: none; }

/* ---------- modals ---------- */
.modal { align-items: center; justify-content: center; padding: 22px; background: rgba(2, 5, 12, 0.72); backdrop-filter: blur(7px); }
.modal-card {
  width: min(340px, 100%); padding: 22px 20px 18px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, rgba(13, 27, 46, 0.98), rgba(4, 9, 18, 0.99));
  border: 1px solid rgba(85, 247, 255, 0.24);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.modal-icon {
  width: 62px; height: 62px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center;
  background: radial-gradient(circle at 32% 25%, #fff2b6, #ffb62e 62%, #8b4c00);
  box-shadow: 0 0 28px rgba(255, 190, 50, 0.28);
}
.modal-icon .mp-icon { width: 34px; height: 34px; color: #3a2100; }
.modal-icon.police { background: radial-gradient(circle at 32% 25%, #ff97a8, #e0143c 62%, #5a0012); box-shadow: 0 0 28px rgba(255, 51, 85, 0.32); }
.modal-icon.police .mp-icon { color: #fff; }
.modal-card h3 { margin: 0; font-size: 19px; letter-spacing: 1px; }
.modal-sub { margin: 7px 0 0; font-size: 11px; color: #8fa9bd; }
.modal-stats { display: flex; margin: 16px 0 18px; padding: 12px 0; border-top: 1px solid rgba(120, 190, 230, 0.12); border-bottom: 1px solid rgba(120, 190, 230, 0.12); }
.modal-stats > div { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.modal-stats span { font-size: 9px; color: #7894ad; }
.modal-stats b { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.modal-stats b.gold { color: var(--gold); }
.fine-amount { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 18px; padding: 12px 14px; border-radius: 12px; background: rgba(60, 8, 18, 0.5); border: 1px solid rgba(255, 51, 85, 0.24); }
.fine-amount span { font-size: 11px; color: #ff9aab; }
.fine-amount b { font-size: 21px; font-weight: 900; color: #ff637d; font-variant-numeric: tabular-nums; }
.primary-btn {
  width: 100%; height: 46px; border-radius: 12px; font-size: 13px; font-weight: 900; letter-spacing: 1px; color: #041018;
  background: linear-gradient(100deg, #4befff, #a3fdff); box-shadow: 0 0 20px rgba(85, 247, 255, 0.2);
}

/* ---------- animations ---------- */
@keyframes coinBump { 0% { transform: scale(1); } 42% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.72); } }
@keyframes sirenFlash {
  0% { background: #1c0710; color: #ff3355; box-shadow: 0 0 6px rgba(255, 51, 85, 0.3); }
  100% { background: #07152c; color: #4f8dff; box-shadow: 0 0 18px rgba(70, 130, 255, 0.55); }
}
@keyframes warnBlink { from { opacity: 1; } to { opacity: 0.55; } }
@keyframes giftIn { from { opacity: 0; transform: translateY(-14px) scale(0.82); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes giftOut { to { opacity: 0; transform: translateY(-10px) scale(0.92); } }
@keyframes dmIn { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: translateX(0); } }
@keyframes dmOut { to { opacity: 0; transform: translateX(20px); } }
@keyframes eq { 0%, 100% { height: 4px; opacity: 0.7; } 50% { height: 17px; opacity: 1; } }

/* ---------- small screens ---------- */
@media (max-height: 700px) {
  .logo { font-size: 40px; }
  .splash-bottom { padding-bottom: calc(18px + var(--safe-bottom)); }
  .splash-desc { margin: 9px 0 13px; }
  .speedo { width: 118px; height: 118px; bottom: calc(134px + var(--safe-bottom)); }
  .speed-warn { left: 130px; bottom: calc(212px + var(--safe-bottom)); }
  .tool-pad { bottom: 86px; }
  .g-card { height: 98px; }
  .garage-sheet { max-height: 51vh; }
}
@media (max-width: 350px) {
  .pname { max-width: 100px; }
  .xp { width: 82px; }
  .coin-pill { padding: 0 7px; font-size: 12px; }
  .live-btn { padding: 0 8px; }
  .ctrl.steer { width: 56px; height: 56px; }
  .tool { width: 38px; height: 42px; }
  .tool span { font-size: 7px; }
  .ctrl.gas { width: 68px; height: 68px; }
}
@media (min-width: 700px) {
  .hud { max-width: 520px; margin: 0 auto; }
  .controls { max-width: 520px; margin: 0 auto; }
  .speedo { left: max(10px, calc(50vw - 250px)); }
  .garage-sheet, .radio-sheet { max-width: 520px; margin-left: auto; margin-right: auto; }
}

/* Steering occupies the original two-button footprint. */
.steer-pad { width: 132px; height: 62px; position: relative; flex: 0 0 132px; }
.steering-wheel {
  position: absolute; left: 14px; bottom: 0; width: 104px; height: 104px;
  border-radius: 50%; pointer-events: auto; touch-action: none;
  background: transparent; user-select: none; -webkit-user-select: none;
}
.steering-rim {
  display: block; position: absolute; inset: 3px; border-radius: 50%;
  border: 10px solid #252d38; outline: 1px solid #9caab7;
  box-shadow: inset 0 0 0 2px #090c11, 0 0 0 3px #090c11, 0 4px 12px #0009;
  transform: rotate(var(--steering-angle, 0deg)); transition: transform .22s ease-out;
}
.is-turning .steering-rim { transition: none; }
.steering-mark { position: absolute; top: -10px; left: calc(50% - 3px); width: 6px; height: 10px; background: #55f7ff; }
.steering-spoke { position: absolute; top: calc(50% - 6px); height: 12px; width: 43%; background: linear-gradient(#a1acb6, #35404c); }
.spoke-left { left: 0; transform: rotate(12deg); transform-origin: right center; }
.spoke-right { right: 0; transform: rotate(-12deg); transform-origin: left center; }
.spoke-bottom { top: 50%; left: calc(50% - 6px); width: 12px; height: 50%; background: linear-gradient(90deg, #35404c, #a1acb6); }
.steering-hub { position: absolute; inset: 30%; border-radius: 50%; background: #141b24; border: 2px solid #778592; box-shadow: 0 2px 5px #0008; }
