* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1020;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  color: #f8fafc;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ===== 《网上来宾 | LAIBIN ONLINE》 启动界面（对标网上南宁居民卡质感） ===== */
#welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(125deg, rgba(10, 15, 30, 0.72) 0%, rgba(15, 23, 42, 0.45) 55%, rgba(10, 15, 30, 0.78) 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#welcome-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-layout {
  width: min(92vw, 760px);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: center;
  padding: 28px;
  border-radius: 24px;
  background: rgba(11, 16, 30, 0.82);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.62);
}

.start-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.start-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 4px 12px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.48);
  color: #6ee7b7;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1px;
}

.start-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1.1;
  color: #ffffff;
  text-shadow: 0 4px 18px rgba(56, 189, 248, 0.35);
}

.start-title span {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #38bdf8;
  margin-top: 4px;
}

.start-desc {
  font-size: 13px;
  line-height: 1.65;
  color: #cbd5e1;
}

.start-btns {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 4px;
}

.btn-main {
  padding: 13px 20px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  color: #0b1120;
  background: linear-gradient(135deg, #34d399, #38bdf8);
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.34);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-main:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.btn-sub-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-ghost {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(30, 41, 59, 0.72);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ghost:hover {
  background: rgba(51, 65, 85, 0.92);
  border-color: rgba(56, 189, 248, 0.55);
}

/* 网上来宾居民卡 */
.resident-card {
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(155deg, #f8fafc, #e2e8f0);
  color: #0f172a;
  border: 2px solid #0f172a;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.rc-header {
  background: linear-gradient(90deg, #0284c7, #0d9488);
  color: #ffffff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
}

.rc-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed #cbd5e1;
  padding-bottom: 6px;
  font-size: 12px;
}

.rc-label {
  color: #64748b;
  font-weight: 600;
}

.rc-val {
  color: #0f172a;
  font-weight: 800;
}

.rc-plate {
  display: inline-block;
  background: #16a34a;
  color: #fff;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
}

.rc-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 8px 14px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
}

/* ===== 极简清爽游戏 HUD（对标网上南宁极简风格） ===== */
#hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

#hud.hud-hidden {
  opacity: 0;
}
#hud.hud-hidden * {
  pointer-events: none !important;
}

.hud-pill {
  background: rgba(11, 16, 28, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

/* Top Center Compass Bar */
.hud-compass {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: #e2e8f0;
  pointer-events: auto;
}

.compass-dir {
  color: #34d399;
  font-weight: 900;
  min-width: 24px;
  text-align: center;
}

.compass-zone {
  color: #fde68a;
}

/* Top Left Mini Brand Badge */
.hud-top-left {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 12px;
  pointer-events: auto;
}

.mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #10b981, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
}

.mini-title {
  font-size: 13px;
  font-weight: 800;
}
.mini-sub {
  font-size: 10.5px;
  color: #94a3b8;
}

/* Top Right Clock & Quick Toggles */
.hud-top-right {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 12px;
  pointer-events: auto;
}

.game-clock {
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  padding: 0 8px 0 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
}

.mini-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 41, 59, 0.65);
  color: #e2e8f0;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mini-btn:hover {
  background: rgba(51, 65, 85, 0.92);
}

.mini-btn.active {
  background: linear-gradient(135deg, #10b981, #0284c7);
  color: #fff;
  border-color: rgba(110, 231, 183, 0.65);
}

/* Bottom Left Compact Ride / Wheelie Status */
.hud-bottom-left {
  position: absolute;
  bottom: 16px;
  left: 14px;
  padding: 8px 11px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: auto;
  min-width: 170px;
}

/* Interactive Food Prompt Pill (111.mp4 ¥100 Challenge) */
#interact-prompt {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  z-index: 35;
  padding: 10px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.94), rgba(2, 132, 199, 0.94));
  border: 2px solid #fef08a;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s ease;
  white-space: nowrap;
}

#interact-prompt.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.budget-pill {
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: #fde68a;
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ride-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.ride-mode {
  font-size: 12px;
  font-weight: 800;
  color: #34d399;
}

.ride-speed {
  font-size: 24px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}

.ride-speed small {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  margin-left: 2px;
}

.ride-controls {
  display: flex;
  gap: 5px;
}

.wheelie-badge {
  display: none;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(244, 63, 94, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 1px;
}

.wheelie-badge.active {
  display: block;
}

/* Bottom Center Slim Teleport Bar */
.hud-bottom-center {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 14px;
  pointer-events: auto;
  max-width: 94vw;
  overflow-x: auto;
}

.tp-btn {
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tp-btn:hover {
  background: rgba(16, 185, 129, 0.24);
  color: #fff;
}

.tp-btn.current-zone {
  background: rgba(16, 185, 129, 0.28);
  border-color: rgba(52, 211, 153, 0.72);
  color: #a7f3d0;
}

/* Bottom Right Key Prompt (Minimal like Nanning Online) */
.hud-bottom-right {
  position: absolute;
  bottom: 16px;
  right: 16px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.65;
  color: #cbd5e1;
  pointer-events: none;
}

.hud-bottom-right kbd {
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: #6ee7b7;
  font-weight: 800;
  font-family: inherit;
  margin-right: 3px;
}

/* Toast */
#toast-banner {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 40;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(11, 16, 28, 0.88);
  border: 1px solid rgba(52, 211, 153, 0.55);
  font-size: 12.5px;
  font-weight: 700;
  color: #ecfdf5;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  white-space: nowrap;
}

#toast-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#restore-hud-btn {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 35;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.52);
  color: rgba(255, 255, 255, 0.8);
  font-size: 11.5px;
  cursor: pointer;
  display: none;
}
#restore-hud-btn.visible { display: block; }

/* Mobile Controls */
#mobile-controls { display: none; position: fixed; inset: 0; z-index: 25; pointer-events: none; }
.joystick-zone {
  position: absolute; bottom: 82px; left: 20px; width: 112px; height: 112px;
  border-radius: 50%; background: rgba(15, 23, 42, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.24); pointer-events: auto; touch-action: none;
}
.joystick-knob {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px;
  margin-left: -22px; margin-top: -22px; border-radius: 50%;
  background: linear-gradient(135deg, #34d399, #38bdf8);
}
.mobile-right-btns {
  position: absolute; bottom: 88px; right: 16px; display: flex; flex-direction: column; gap: 8px; pointer-events: auto;
}
.mob-circle-btn {
  width: 54px; height: 54px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.28);
  background: rgba(15,23,42,0.75); color: #fff; font-size: 11.5px; font-weight: 800;
}

@media (max-width: 1080px) {
  .hud-bottom-right { display: none; }
  .hud-bottom-left { bottom: 66px; }
}
@media (max-width: 760px) {
  .start-layout { grid-template-columns: 1fr; padding: 20px; }
  .hud-compass { display: none; }
  #mobile-controls.enabled { display: block; }
}

/* Compliance Disclaimer on Start Screen */
.start-disclaimer {
  margin-top: 14px;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(203, 213, 225, 0.72);
}

/* Interactive 来宾市区全城地图 Modal (M 键) */
#city-map-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 10, 24, 0.78);
  backdrop-filter: blur(10px);
}
#city-map-modal.open { display: flex; }

.map-card {
  width: min(680px, 94vw);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(24, 34, 62, 0.96));
  border: 1px solid rgba(56, 189, 248, 0.42);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  padding: 16px 18px 18px;
  color: #f8fafc;
}
.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.map-title { font-size: 16px; font-weight: 900; color: #fef08a; }
.map-sub { font-size: 11.5px; color: #94a3b8; }

.map-board {
  position: relative;
  width: 100%;
  height: 410px;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 48%, #1e293b, #0f172a);
  border: 1px solid rgba(148, 163, 184, 0.25);
  overflow: hidden;
}
.map-water-canal {
  position: absolute; left: 10%; right: 6%; top: 34%; height: 14px;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.55), rgba(34, 211, 238, 0.7));
  border-radius: 999px;
}
.map-water-river {
  position: absolute; left: 0; right: 0; bottom: 7%; height: 38px;
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.68), rgba(14, 116, 144, 0.78));
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 16px; font-size: 11px; font-weight: 800; color: rgba(224, 242, 254, 0.85);
}
.map-road-h {
  position: absolute; left: 6%; right: 6%; height: 5px;
  background: rgba(148, 163, 184, 0.45); border-radius: 4px;
}
.map-road-v {
  position: absolute; top: 10%; bottom: 8%; width: 5px;
  background: rgba(148, 163, 184, 0.45); border-radius: 4px;
}
.map-road-label {
  position: absolute; font-size: 10px; font-weight: 700;
  color: rgba(203, 213, 225, 0.65); pointer-events: none;
}

.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(254, 240, 138, 0.55);
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s ease, background 0.14s ease;
  z-index: 4;
}
.map-pin:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: linear-gradient(135deg, #10b981, #0284c7);
  border-color: #fff;
}
.map-player-dot {
  position: absolute;
  width: 14px; height: 14px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid #fff;
  box-shadow: 0 0 14px #22c55e;
  z-index: 6;
  pointer-events: none;
}
