* {
  box-sizing: border-box;
}

html {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #111;
  color: #fff;
}

body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #111;
  color: #fff;
}

#app {
  display: block;
  width: 100vw;
  height: 100vh;
}

#mobileControls {
  display: none;
}

#rotateOverlay {
  display: none;
}

#ui {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.panel {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 88px);
  background: rgba(20, 20, 20, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#uiToggle {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(16, 20, 26, 0.8);
  color: #fff;
  padding: 9px 14px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

#uiToggle:hover {
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

#ui.collapsed .panel {
  display: none;
}

#collapsedQuickActions {
  display: none;
  gap: 8px;
  flex-wrap: wrap;
}

#ui.collapsed #collapsedQuickActions {
  display: flex;
}

.quickViewBtn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(16, 20, 26, 0.78);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

.quickViewBtn.is-active {
  background: rgba(86, 190, 255, 0.24);
  border-color: rgba(154, 221, 255, 0.72);
}

h1 {
  margin: 0 0 10px;
  font-size: 22px;
}

p {
  margin: 0 0 12px;
  color: #d5d5d5;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.row.compact label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 8px 10px;
}

input[type="number"] {
  width: 90px;
}

select {
  min-width: 132px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

input[type="range"] {
  accent-color: #7cc8ff;
}

button,
.file-label,
input,
select {
  font: inherit;
}

.range-card {
  min-width: 220px;
  flex: 1 1 220px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 8px 12px;
}

.range-card span:last-child {
  min-width: 52px;
  text-align: right;
  color: #bfe7ff;
}

button,
.file-label {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
}

button:hover,
.file-label:hover {
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

.file-label input {
  display: none;
}

.tips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: #ddd;
}

.tips span,
.status div {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#hud {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  pointer-events: none;
}

#hud .status {
  max-width: min(920px, calc(100vw - 32px));
}

#hud .status div {
  backdrop-filter: blur(10px);
  background: rgba(10, 16, 22, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#wheelHud {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: 172px;
  height: 172px;
  pointer-events: none;
  z-index: 10;
}

.wheelHudTopMark {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 8px;
  height: 24px;
  margin-left: -4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd880, #ff9f43);
  box-shadow: 0 0 12px rgba(255, 180, 92, 0.45);
}

#wheelHudDial {
  position: relative;
  width: 100%;
  height: 100%;
}

#wheelHudDial svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
}

#signalStatusBox[data-signal="left"],
#signalStatusBox[data-signal="right"] {
  background: rgba(255, 181, 77, 0.18);
  color: #ffd89b;
}

#audioStatusBox[data-audio="on"] {
  background: rgba(136, 235, 188, 0.18);
  color: #d6ffeb;
}

#audioStatusBox[data-audio="error"] {
  background: rgba(255, 110, 110, 0.16);
  color: #ffd0d0;
}

#mirrorHud {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 12px;
  align-items: flex-start;
  pointer-events: none;
  z-index: 9;
}

#mirrorHud.cockpit-layout {
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  transform: none;
  display: block;
}

#mirrorHud.cockpit-layout .mirrorPane {
  position: absolute;
}

#mirrorHud.cockpit-layout #mirrorCenter {
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
}

#mirrorHud.cockpit-layout #mirrorLeft {
  top: 128px;
  left: 14px;
}

#mirrorHud.cockpit-layout #mirrorRight {
  top: 128px;
  right: 14px;
}

#cockpitSignalHud {
  position: fixed;
  top: 108px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 14px;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 11;
}

#cockpitSignalHud.is-visible {
  display: flex;
}

.cockpitSignalLamp {
  min-width: 88px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(9, 14, 19, 0.56);
  color: rgba(232, 239, 245, 0.52);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.cockpitSignalLamp.is-active {
  background: rgba(255, 181, 77, 0.22);
  color: #ffe1ad;
  box-shadow: 0 0 18px rgba(255, 181, 77, 0.28);
  transform: translateY(-1px);
}

#miniMap {
  position: fixed;
  right: 16px;
  bottom: 18px;
  width: min(19vw, 210px);
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  border: 3px solid rgba(214, 236, 255, 0.88);
  background: linear-gradient(180deg, rgba(14, 22, 28, 0.18), rgba(5, 10, 14, 0.26));
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  pointer-events: auto;
  z-index: 9;
  cursor: zoom-in;
  transition: width 0.18s ease, border-radius 0.18s ease, box-shadow 0.18s ease;
}

#miniMap.expanded {
  right: 20px;
  bottom: 20px;
  width: min(42vw, 420px);
  border-radius: 24px;
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.34);
  cursor: crosshair;
  z-index: 120;
}

#miniMap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.miniMapLabel {
  position: absolute;
  left: 12px;
  top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(8, 14, 20, 0.54);
  color: #eef8ff;
  font-size: 12px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

#miniMapClose {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(8, 14, 20, 0.72);
  color: #eef8ff;
  font-size: 18px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

#miniMap.expanded #miniMapClose {
  display: inline-flex;
}

body.minimap-expanded #mobileControls,
body.minimap-expanded #wheelHud,
body.minimap-expanded #mirrorHud,
body.minimap-expanded #ui {
  pointer-events: none;
}

body.minimap-expanded .mobileClusterRight {
  opacity: 0.18;
  z-index: 1;
}

#miniMap.expanded .miniMapLabel::after {
  content: " 点击地点瞬移 / Esc 或右键收起";
  letter-spacing: normal;
}

.mirrorPane {
  position: relative;
  width: min(16vw, 168px);
  aspect-ratio: 1.38 / 1;
  border-radius: 16px 16px 22px 22px;
  border: 3px solid rgba(230, 243, 255, 0.88);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.16));
  overflow: hidden;
}

.mirrorCenter {
  width: min(20vw, 220px);
  aspect-ratio: 2.25 / 1;
  border-radius: 14px 14px 24px 24px;
}

.mirrorPane::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.mirrorLabel {
  position: absolute;
  left: 14px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(12, 18, 24, 0.55);
  color: #eef8ff;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mobileCluster,
.mobilePad,
.mobileDriveStack,
.mobileAuxRow {
  display: flex;
}

.mobileSteerRow,
.mobileViewResetStack {
  display: flex;
}

.mobileControl {
  min-width: 50px;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 15px;
  background: rgba(9, 17, 24, 0.68);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
  color: #f4fbff;
  backdrop-filter: blur(10px);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  font-size: 13px;
}

.mobileControl:active,
.mobileControl.active {
  background: rgba(86, 190, 255, 0.3);
  border-color: rgba(154, 221, 255, 0.72);
}

.mobileControlLarge {
  min-width: 76px;
}

.mobileControlTall {
  min-height: 72px;
}

.mobileThrottle,
.mobileBrake,
.mobileReverse {
  min-height: 72px;
}

.mobileThrottle {
  background: linear-gradient(180deg, rgba(40, 138, 93, 0.82), rgba(22, 78, 56, 0.88));
}

.mobileBrake {
  background: linear-gradient(180deg, rgba(164, 58, 58, 0.84), rgba(100, 24, 24, 0.88));
}

.mobileBrakePrimary {
  min-height: 90px;
}

.mobileReverse {
  background: linear-gradient(180deg, rgba(62, 92, 172, 0.82), rgba(28, 48, 100, 0.88));
}

/* 转向灯拨杆 */
.mobileSignalLever {
  width: 64px;
  height: 52px;
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(9, 17, 24, 0.68);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  overflow: hidden;
}

.mobileSignalLever.dragging {
  border-color: rgba(255, 210, 80, 0.5);
  background: rgba(255, 190, 50, 0.1);
}

.mobileSignalLever[data-signal="left"] {
  border-color: rgba(255, 210, 80, 0.7);
}

.mobileSignalLever[data-signal="right"] {
  border-color: rgba(255, 210, 80, 0.7);
}

.signalLeverKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(200, 215, 228, 0.88);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  will-change: transform;
}

.mobileSignalLever.dragging .signalLeverKnob {
  background: rgba(255, 215, 80, 0.9);
}

.mobileSignalLever[data-signal="left"] .signalLeverKnob,
.mobileSignalLever[data-signal="right"] .signalLeverKnob {
  background: rgba(255, 210, 80, 0.8);
}

.signalLeverLabel {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.32);
  pointer-events: none;
  line-height: 1;
  z-index: 1;
}

.mobileSignalLever[data-signal="left"] .signalLeverLabelTop {
  color: rgba(255, 210, 80, 0.95);
}

.mobileSignalLever[data-signal="right"] .signalLeverLabelBottom {
  color: rgba(255, 210, 80, 0.95);
}

.mobileSteerZone {
  width: 100%;
  min-height: 110px;
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 15px;
  background: rgba(9, 17, 24, 0.68);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mobileSteerZone.active {
  background: rgba(86, 190, 255, 0.18);
  border-color: rgba(154, 221, 255, 0.72);
}

.mobileSteerIndicator {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(154, 221, 255, 0.85);
  box-shadow: 0 0 8px rgba(86, 190, 255, 0.6);
  pointer-events: none;
  transition: background 0.1s;
  will-change: transform;
}

.mobileSteerZone.active .mobileSteerIndicator {
  background: rgba(86, 190, 255, 1);
}

.mobileSteerHint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.28);
  pointer-events: none;
  letter-spacing: 0.04em;
}

.mobileHandbrake {
  background: linear-gradient(180deg, rgba(160, 120, 30, 0.82), rgba(90, 60, 10, 0.88));
  min-width: 56px;
}

.mobileWheelSlot {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
}

.mobileSteerRow {
  align-items: flex-end;
  gap: 8px;
}

.mobileViewResetStack {
  flex-direction: row;
  gap: 8px;
}

.rotateCard {
  width: min(86vw, 320px);
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(7, 12, 18, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
  text-align: center;
}

.rotateCard strong,
.rotateCard span {
  display: block;
}

.rotateCard strong {
  margin-bottom: 8px;
  font-size: 20px;
}

.rotateCard span {
  color: #dce7f1;
  line-height: 1.45;
}

@media (max-width: 900px) {
  #mirrorHud {
    top: 12px;
    gap: 8px;
  }

  .mirrorPane {
    width: min(18vw, 126px);
  }

  .mirrorCenter {
    width: min(22vw, 160px);
  }

  #mirrorHud.cockpit-layout #mirrorLeft,
  #mirrorHud.cockpit-layout #mirrorRight {
    top: 112px;
  }

  #miniMap {
    width: min(20vw, 136px);
  }

  #miniMap.expanded {
    width: min(42vw, 320px);
  }
}

@media (max-width: 700px) {
  .range-card {
    min-width: 100%;
  }

  #hud {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  #wheelHud {
    width: 136px;
    height: 136px;
    bottom: 12px;
  }

  #mirrorHud {
    top: auto;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
  }

  #mirrorHud.cockpit-layout {
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
  }

  #mirrorHud.cockpit-layout #mirrorCenter {
    top: 12px;
  }

  #mirrorHud.cockpit-layout #mirrorLeft {
    top: 88px;
    left: 8px;
  }

  #mirrorHud.cockpit-layout #mirrorRight {
    top: 88px;
    right: 8px;
  }

  #miniMap {
    right: 10px;
    top: max(10px, env(safe-area-inset-top));
    bottom: auto;
    width: min(24vw, 120px);
  }

  #miniMap.expanded {
    right: 10px;
    top: max(10px, env(safe-area-inset-top));
    bottom: auto;
    width: min(60vw, 300px);
  }

  .mirrorPane {
    width: min(21vw, 92px);
  }

  .mirrorCenter {
    width: min(28vw, 126px);
  }
}

@media (hover: none), (pointer: coarse), (max-width: 900px) {
  /* body 固定定位：游戏内容不随文档滚动，但允许 html 被滚动 1px 来隐藏地址栏 */
  html {
    overflow-y: auto;
    min-height: calc(100% + 2px);
  }

  body {
    position: fixed;
    top: 0;
    left: 0;
  }

  #app {
    height: 100dvh;
  }

  #rotateOverlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 8, 12, 0.58);
  }

  body.mobile-portrait #rotateOverlay {
    display: flex;
  }

  body.mobile-portrait #mobileControls,
  body.mobile-portrait #miniMap,
  body.mobile-portrait #wheelHud,
  body.mobile-portrait #mirrorHud {
    display: none !important;
  }

  #mobileControls {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 11;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
  }

  .mobileCluster {
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
  }

  .mobilePad {
    gap: 10px;
    align-items: center;
  }

  .mobileDriveStack {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .mobileAuxRow {
    gap: 8px;
    justify-content: center;
  }

  .mobileAuxRowRight {
    justify-content: flex-end;
  }

  .mobileClusterLeft {
    width: min(40vw, 280px);
    align-items: stretch;
  }

  .mobileClusterRight {
    width: auto;
    align-items: flex-end;
  }

  .mobileClusterCenter {
    width: auto;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    pointer-events: auto;
    padding-bottom: 64px;
  }

  .mobileDriveStack {
    width: 100%;
    max-width: 72px;
  }

  /* 右侧：列方向，宽度跟随内容（约一个按钮宽） */
  .mobileDriveStackRight {
    max-width: none;
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 8px;
  }

  .mobileSignalLever {
    align-self: flex-end;
    margin-left: auto;
  }

  .mobileViewResetStack {
    justify-content: flex-end;
    align-items: flex-end;
  }

  .mobileSteerPad {
    justify-content: flex-end;
    flex-direction: row;
  }

  .mobileAuxRowCenter {
    width: 100%;
    justify-content: center;
  }

  .mobileBottomRow {
    gap: 8px;
    align-items: center;
    justify-content: center;
  }

  #hud .status {
    display: none;
  }

  #wheelHud {
    bottom: max(10px, env(safe-area-inset-bottom));
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    z-index: 12;
  }

  #miniMap {
    right: calc(10px + env(safe-area-inset-right));
    top: calc(10px + env(safe-area-inset-top));
    bottom: auto;
    width: min(19vw, 132px);
  }

  #miniMap.expanded {
    top: calc(10px + env(safe-area-inset-top));
    bottom: auto;
  }

  #ui {
    top: calc(10px + env(safe-area-inset-top));
    left: calc(10px + env(safe-area-inset-left));
    right: calc(10px + env(safe-area-inset-right));
    max-width: calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right));
  }

  #uiToggle {
    display: inline-flex;
    position: relative;
    z-index: 16;
  }

  #collapsedQuickActions {
    gap: 6px;
    max-width: min(260px, calc(100vw - 20px));
  }

  .quickViewBtn {
    padding: 7px 10px;
    font-size: 12px;
  }

  .panel {
    width: min(440px, calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    max-height: calc(100vh - 74px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 12px 12px 14px;
    border-radius: 12px;
  }

  .row {
    gap: 8px;
    margin-bottom: 10px;
  }

  .row.compact label,
  .range-card {
    width: 100%;
  }

  h1 {
    font-size: 18px;
    margin-bottom: 8px;
  }

  p,
  .tips,
  .tips span,
  .tips strong {
    font-size: 12px;
  }
}

@media (max-width: 700px) {
  #mobileControls {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

  .mobileControl {
    min-width: 46px;
    min-height: 46px;
    border-radius: 14px;
    font-size: 12px;
  }

  .mobileThrottle,
  .mobileBrake,
  .mobileReverse {
    min-height: 58px;
  }

  .mobileBrakePrimary {
    min-height: 80px;
  }

  .mobileSignalLever {
    width: 58px;
    height: 44px;
  }

  .mobileClusterRight {
    width: auto;
  }

  #wheelHud {
    top: max(10px, env(safe-area-inset-top));
    width: 46px;
    height: 46px;
  }

  .mobileSteerZone {
    min-height: 90px;
  }

  .mobileWheelSlot {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }

  .mobileSteerRow,
  .mobileViewResetStack {
    gap: 6px;
  }

  #wheelHud {
    width: 46px;
    height: 46px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  #miniMap {
    top: calc(8px + env(safe-area-inset-top));
    bottom: auto;
  }

  #miniMap.expanded {
    top: calc(8px + env(safe-area-inset-top));
    bottom: auto;
  }

  .mobileClusterLeft,
  .mobileClusterRight {
    width: auto;
  }

  .mobileClusterLeft {
    width: min(46vw, 240px);
  }

  .mobileClusterCenter {
    width: auto;
  }
}

@media (max-width: 420px) {
  /* 极小屏：方向盘 HUD 与控制区重叠，直接隐藏 */
  #wheelHud {
    display: none !important;
  }

  .mobileSteerZone {
    min-height: 76px;
  }

  .mobileBrakePrimary {
    min-height: 72px;
  }
}

/* Loading overlay */
#loadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 14, 0.78);
  backdrop-filter: blur(6px);
}

#loadingOverlay.visible {
  display: flex;
}

.loadingCard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: rgba(210, 230, 245, 0.9);
  font-size: 14px;
  letter-spacing: 0.05em;
}

.loadingSpinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(154, 221, 255, 0.85);
  border-radius: 50%;
  animation: loadingSpin 0.75s linear infinite;
}

@keyframes loadingSpin {
  to { transform: rotate(360deg); }
}
