* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; font-family: 'Segoe UI', system-ui, sans-serif; }
body, html { width: 100%; height: 100%; overflow: hidden; background-color: #0b101b; overscroll-behavior: none; }
#game-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

#loading-screen { position: absolute; inset: 0; background: #0b101b; color: #f59e0b; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; letter-spacing: 2px; z-index: 100; }

#busted-screen { position: absolute; inset: 0; background: rgba(127, 29, 29, 0.88); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; z-index: 200; }
.busted-box { background: #0f172a; border: 3px solid #ef4444; border-radius: 16px; padding: 32px 48px; text-align: center; color: #fff; box-shadow: 0 20px 50px rgba(0,0,0,0.8); }
.busted-box h1 { font-size: 64px; font-weight: 900; letter-spacing: 6px; color: #ef4444; margin-bottom: 8px; }
.busted-box p { font-size: 14px; color: #cbd5e1; margin-bottom: 24px; }
.busted-box button { padding: 12px 28px; font-size: 14px; font-weight: 900; background: #ef4444; color: #fff; border: none; border-radius: 8px; cursor: pointer; letter-spacing: 1px; }

#hud { position: absolute; top: 16px; left: 16px; width: 325px; background: rgba(15, 23, 42, 0.92); border: 2px solid #3b82f6; border-radius: 14px; padding: 14px 18px; color: #f8fafc; z-index: 10; box-shadow: 0 12px 30px rgba(0,0,0,0.6); transition: border-color 0.2s; }
.hud-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sun-clock { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 900; color: #cbd5e1; letter-spacing: 1px; }
.sun-orb { width: 10px; height: 10px; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 8px #f59e0b; display: inline-block; }
#road-name { font-size: 11px; font-weight: 700; color: #f59e0b; max-width: 175px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dash-main { display: flex; justify-content: space-between; align-items: center; margin: 6px 0; }
#speed-val { font-size: 42px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.unit { font-size: 12px; font-weight: 700; color: #64748b; margin-left: 4px; }
#gear-box { background: #1e293b; border: 2px solid #334155; border-radius: 10px; padding: 6px 14px; font-size: 20px; font-weight: 900; color: #fbbf24; }

.rpm-container { width: 100%; height: 7px; background: #1e293b; border-radius: 4px; overflow: hidden; margin: 8px 0; }
#rpm-bar { width: 10%; height: 100%; background: linear-gradient(90deg, #22c55e, #eab308, #ef4444); }

#bust-bar-wrap { display: none; margin: 8px 0; background: rgba(153, 27, 27, 0.35); border: 1px solid #ef4444; border-radius: 6px; padding: 6px; }
.bust-label { font-size: 10px; font-weight: 900; color: #fca5a5; text-align: center; letter-spacing: 1px; margin-bottom: 4px; }
.bust-track { width: 100%; height: 8px; background: #1e293b; border-radius: 4px; overflow: hidden; }
#bust-fill { width: 0%; height: 100%; background: #ef4444; }

#cooldown-bar-wrap { display: none; margin: 8px 0; background: rgba(30, 58, 138, 0.35); border: 1px solid #38bdf8; border-radius: 6px; padding: 6px; }
.cooldown-label { font-size: 10px; font-weight: 900; color: #7dd3fc; text-align: center; letter-spacing: 1px; margin-bottom: 4px; }
.cooldown-track { width: 100%; height: 6px; background: #1e293b; border-radius: 4px; overflow: hidden; }
#cooldown-fill { width: 100%; height: 100%; background: #38bdf8; }

#mode-banner { font-size: 11px; font-weight: 800; padding: 5px 8px; border-radius: 6px; text-align: center; letter-spacing: 0.8px; margin-bottom: 6px; }
.mode-R { background: rgba(239,68,68,0.22); color: #f87171; }
.mode-G { background: rgba(34,197,94,0.22); color: #4ade80; }
.mode-B { background: rgba(59,130,246,0.22); color: #60a5fa; }

#status-alert { font-size: 11px; font-weight: 800; color: #fbbf24; text-align: center; min-height: 16px; margin-bottom: 4px; }
#perf-bar { font-size: 10px; font-family: monospace; color: #4ade80; background: #090d16; padding: 4px 8px; border-radius: 5px; margin-bottom: 6px; text-align: center; border: 1px solid #1e293b; }
.controls-hint { font-size: 10px; color: #94a3b8; line-height: 1.45; border-top: 1px solid #1e293b; padding-top: 8px; }

/* Corner Minimap */
#minimap-wrap {
  position: absolute; bottom: 16px; left: 16px; width: 214px;
  background: rgba(11, 16, 27, 0.92); border: 2px solid #a855f7; border-radius: 14px;
  overflow: hidden; z-index: 12; cursor: pointer;
  box-shadow: 0 10px 28px rgba(0,0,0,0.65); transition: transform 0.15s ease, border-color 0.2s ease;
}
#minimap-wrap:hover { transform: scale(1.03); border-color: #d8b4fe; }
#minimap-canvas { display: block; width: 210px; height: 184px; }
.minimap-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 10px; background: #131c2e; border-top: 1px solid #2e1065;
  font-size: 10px; font-weight: 900; color: #e9d5ff; letter-spacing: 0.5px;
}
#minimap-clear-btn { background: #7e22ce; color: #fff; border: none; border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 900; cursor: pointer; }
#minimap-clear-btn:hover { background: #ef4444; }

/* Full-Screen Searchable Map Modal */
#fullmap-modal { position: absolute; inset: 0; background: rgba(7, 10, 18, 0.96); z-index: 150; display: none; flex-direction: column; }
#fullmap-modal.open { display: flex; }
.fullmap-topbar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: #0f172a; border-bottom: 2px solid #a855f7; z-index: 160; }
.search-wrap { position: relative; width: 410px; }
#map-search-input {
  width: 100%; padding: 10px 14px; border-radius: 8px; border: 2px solid #475569;
  background: #1e293b; color: #f8fafc; font-size: 13px; font-weight: 700; outline: none; user-select: text;
}
#map-search-input:focus { border-color: #c084fc; }
#map-search-results {
  position: absolute; top: 44px; left: 0; right: 0; max-height: 420px; overflow-y: auto;
  background: #0f172a; border: 2px solid #a855f7; border-radius: 8px; display: none; box-shadow: 0 16px 40px rgba(0,0,0,0.85);
}
.search-item { padding: 8px 12px; border-bottom: 1px solid #1e293b; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #f1f5f9; gap: 8px; }
.search-item:hover { background: rgba(168, 85, 247, 0.22); }
.search-item-acts { display: flex; gap: 6px; align-items: center; }
.search-item small { color: #94a3b8; }
.s-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.s-dot { flex: 0 0 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 900; color: #05080f; border: 1px solid #05080f; }
.s-dot-street { background: #e2e8f0; border-radius: 3px; height: 6px; }
.s-dot-area { background: transparent; border: 2px dashed #cbd5e1; }
.s-pill { padding: 3px 8px; border-radius: 5px; font-size: 10px; font-weight: 900; border: none; cursor: pointer; }
.s-pill-nav { background: #7e22ce; color: #fff; }
.s-pill-tp { background: #f59e0b; color: #000; }
.fullmap-stats { flex: 1; font-size: 12px; font-weight: 800; color: #e9d5ff; text-align: center; }
.fullmap-actions { display: flex; gap: 8px; }
.fm-btn { padding: 9px 12px; border-radius: 8px; border: none; font-weight: 900; font-size: 11px; cursor: pointer; letter-spacing: 0.5px; }
.fm-teleport { background: #1e293b; color: #fbbf24; border: 2px solid #f59e0b; }
.fm-teleport.active { background: #f59e0b; color: #000; box-shadow: 0 0 12px rgba(245, 158, 11, 0.6); }
.fm-center { background: #3b82f6; color: #fff; }
.fm-clear { background: #7e22ce; color: #fff; }
.fm-close { background: #ef4444; color: #fff; }
.fm-trains { background: #1e293b; color: #fde047; border: 2px solid #eab308; }
.fm-trains.active { background: #eab308; color: #000; box-shadow: 0 0 12px rgba(234, 179, 8, 0.6); }
/* Train chart side panel (MapUI): a train's stops or a station's board */
#train-panel { position: absolute; top: 70px; right: 14px; width: 330px; max-height: calc(100% - 130px); overflow-y: auto; display: none;
  background: rgba(15, 23, 42, 0.95); border: 2px solid #eab308; border-radius: 10px; padding: 10px 12px; color: #e2e8f0; font-size: 12px; z-index: 170; }
#train-panel.open { display: block; }
#train-panel h3 { margin: 0 0 4px; font-size: 14px; color: #fde047; }
#train-panel .tp-sub { color: #94a3b8; font-size: 11px; margin-bottom: 8px; }
#train-panel table { width: 100%; border-collapse: collapse; }
#train-panel td { padding: 3px 4px; border-bottom: 1px solid #1e293b; vertical-align: top; }
#train-panel tr.tp-row { cursor: pointer; }
#train-panel tr.tp-row:hover { background: rgba(234, 179, 8, 0.18); }
#train-panel .tp-time { font-weight: 900; color: #fde047; white-space: nowrap; }
#train-panel .tp-acts { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
#train-panel .tp-acts button { padding: 6px 9px; border-radius: 6px; border: none; font-weight: 900; font-size: 11px; cursor: pointer; }
#train-panel .tp-catch { background: #22c55e; color: #000; }
#train-panel .tp-plain { background: #334155; color: #fff; }
#train-panel .tp-note { margin-top: 8px; color: #fbbf24; font-weight: 800; }
#fullmap-canvas { flex: 1; width: 100%; cursor: crosshair; }
.fullmap-hint { padding: 8px 16px; background: #0f172a; border-top: 1px solid #1e293b; color: #94a3b8; font-size: 11px; text-align: center; }

/* Top Right Buttons */
#top-bar { position: absolute; top: 16px; right: 16px; display: flex; gap: 8px; z-index: 10; }
.mode-btn { min-width: 44px; height: 42px; padding: 0 10px; border-radius: 10px; border: 2px solid rgba(255,255,255,0.2); background: rgba(15,23,42,0.88); color: #fff; font-weight: 900; font-size: 13px; cursor: pointer; }
.mode-btn.active { border-color: #fff; transform: scale(1.06); }
#btn-R.active { background: #ef4444; }
#btn-G.active { background: #22c55e; }
#btn-B.active { background: #3b82f6; }

.cam-btn { padding: 0 12px; border-radius: 10px; border: 2px solid #a855f7; background: rgba(15, 23, 42, 0.88); color: #d8b4fe; font-weight: 900; font-size: 11px; cursor: pointer; letter-spacing: 0.5px; }
.cam-btn.active { background: #9333ea; color: #ffffff; border-color: #f3e8ff; box-shadow: 0 0 12px rgba(168, 85, 247, 0.55); }
.map-btn { padding: 0 12px; border-radius: 10px; border: 2px solid #c084fc; background: #2e1065; color: #f3e8ff; font-weight: 900; font-size: 11px; cursor: pointer; }
.map-btn:hover { background: #9333ea; color: #fff; }
.lake-btn { padding: 0 12px; border-radius: 10px; border: 2px solid #0ea5e9; background: #0c2d48; color: #7dd3fc; font-weight: 900; font-size: 12px; cursor: pointer; }
.lake-btn:hover { background: #0ea5e9; color: #000; }
.cop-btn { padding: 0 14px; border-radius: 10px; border: 2px solid #ef4444; background: #1e293b; color: #f87171; font-weight: 900; font-size: 12px; cursor: pointer; min-width: 100px; }
.cop-btn:hover { background: #ef4444; color: #fff; }
.clear-cop-btn { padding: 0 10px; border-radius: 10px; border: 1px solid #475569; background: rgba(15,23,42,0.88); color: #94a3b8; font-weight: 800; font-size: 11px; cursor: pointer; }
.log-btn { padding: 0 12px; border-radius: 10px; border: 1px solid #38bdf8; background: #0f172a; color: #38bdf8; font-weight: 900; font-size: 11px; cursor: pointer; }
.dev-btn { padding: 0 14px; border-radius: 10px; border: none; background: #f59e0b; color: #000; font-weight: 900; font-size: 12px; cursor: pointer; }

#dev-console { position: absolute; top: 0; right: -760px; width: 740px; max-width: 100vw; height: 100%; background: #0f172a; border-left: 2px solid #334155; z-index: 50; display: flex; flex-direction: column; transition: right 0.25s ease; color: #fff; }
#dev-console.open { right: 0 !important; }
.dev-header { padding: 14px 16px; background: #1e293b; display: flex; justify-content: space-between; align-items: center; font-weight: 900; color: #f59e0b; font-size: 13px; }
.dev-header button { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; }
#dev-sliders { padding: 14px; overflow-y: auto; flex: 1; display: flex; flex-direction: row; align-items: flex-start; gap: 14px; }
.dev-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.fx-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #cbd5e1; padding: 3px 0; cursor: pointer; }
.fx-row input { accent-color: #f59e0b; width: 15px; height: 15px; flex: none; cursor: pointer; }
.fx-row span { flex: 1; }
.fx-cost { font-style: normal; font-size: 9px; font-weight: 800; color: #0f172a; background: #fbbf24; border-radius: 4px; padding: 1px 5px; text-transform: uppercase; }
.fx-tools { display: flex; gap: 8px; }
.fx-tools button { flex: 1; padding: 8px; border: 1px solid #334155; border-radius: 6px; background: #1e293b; color: #e2e8f0; font-weight: 800; font-size: 11px; cursor: pointer; }
.fx-tools button:hover { background: #334155; }
@media (max-width: 800px) { #dev-console { right: -100vw; width: 100vw; } #dev-sliders { flex-direction: column; align-items: stretch; } }
.dev-group { background: #1e293b; padding: 10px; border-radius: 8px; border: 1px solid #334155; }
.dev-group h4 { font-size: 11px; color: #38bdf8; text-transform: uppercase; margin-bottom: 8px; border-bottom: 1px solid #334155; padding-bottom: 4px; }
.slider-row { margin-bottom: 8px; font-size: 11px; }
.slider-row label { display: flex; justify-content: space-between; color: #cbd5e1; margin-bottom: 3px; }
.slider-row input { width: 100%; accent-color: #f59e0b; cursor: pointer; }
.dev-footer { padding: 12px; background: #1e293b; display: flex; gap: 8px; border-top: 1px solid #334155; }
.dev-footer button { flex: 1; padding: 10px; border: none; border-radius: 6px; font-weight: 800; cursor: pointer; font-size: 12px; }
.btn-save { background: #f59e0b; color: #000; }
.btn-reset { background: #991b1b; color: #fff; }

#touch-controls { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.tc-btn { position: absolute; pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent;
  background: rgba(15, 23, 42, 0.55); color: #f8fafc; border: 2px solid rgba(148, 163, 184, 0.7); border-radius: 18px;
  font-size: 18px; font-weight: 900; letter-spacing: 1px; }
.tc-btn:active { background: rgba(59, 130, 246, 0.55); }
.tc-left  { left: 16px;  bottom: calc(24px + env(safe-area-inset-bottom, 0px)); width: 84px; height: 84px; }
.tc-right { left: 116px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); width: 84px; height: 84px; }
.tc-brake { right: 128px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); width: 92px; height: 84px; font-size: 14px; }
.tc-gas   { right: 16px;  bottom: calc(24px + env(safe-area-inset-bottom, 0px)); width: 100px; height: 100px; font-size: 16px; background: rgba(34, 197, 94, 0.45); }
.tc-uturn { right: 16px;  bottom: calc(140px + env(safe-area-inset-bottom, 0px)); width: 100px; height: 52px; font-size: 12px; }
.tc-jump  { right: 16px;  bottom: calc(200px + env(safe-area-inset-bottom, 0px)); width: 100px; height: 52px; font-size: 12px; }

@media (max-width: 760px), (pointer: coarse) {
  #hud { width: 210px; padding: 8px 10px; top: 8px; left: 8px; }
  #speed-val { font-size: 30px; }
  #perf-bar, #controls-hint { display: none; }
  #minimap-wrap { width: 140px; bottom: 120px; left: 8px; }
  #minimap-canvas { width: 136px; height: 110px; }
  #top-bar { top: 8px; right: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 240px); }
}

/* ---- 3D version: compass (src/ui/Compass.js), vignette overlay ---- */
#compass { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 12; display: flex; align-items: center; gap: 12px;
  background: rgba(15, 23, 42, 0.86); border: 2px solid #334155; border-radius: 14px; padding: 8px 14px 8px 10px; color: #f8fafc; pointer-events: none; max-width: min(92vw, 560px); }
#compass-ring { position: relative; width: 120px; height: 120px; flex: 0 0 120px; border-radius: 50%; border: 2px solid #475569; background: radial-gradient(circle, #0b1220 60%, #1e293b 100%); }
#compass-rose { position: absolute; inset: 0; transition: transform 0.08s linear; }
#compass-rose .cn { position: absolute; font-size: 12px; font-weight: 900; color: #cbd5e1; left: 50%; top: 50%; transform-origin: 0 0; }
#compass-rose .cn-n { color: #ef4444; transform: translate(-50%, -52px); }
#compass-rose .cn-e { transform: translate(44px, -6px); }
#compass-rose .cn-s { transform: translate(-50%, 40px); }
#compass-rose .cn-w { transform: translate(-54px, -6px); }
#compass-exits { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.compass-marker { position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%; background: #38bdf8; box-shadow: 0 0 8px #38bdf8; transform-origin: 6px 6px; }
.compass-marker.bad { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
#compass-bike { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform: translate(-50%, -50%); }
#compass-bike::before { content: ''; position: absolute; left: -7px; top: -36px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 18px solid #3b82f6; }
#compass-bike::after { content: ''; position: absolute; left: -2px; top: -20px; width: 4px; height: 26px; background: #3b82f6; border-radius: 2px; }
#compass-text { min-width: 170px; }
#compass-heading { font-size: 15px; font-weight: 900; letter-spacing: 0.6px; color: #f8fafc; }
#compass-junction { font-size: 11px; color: #94a3b8; margin-top: 4px; line-height: 1.5; }
.compass-junction-head { font-weight: 800; color: #7dd3fc; }
.compass-exit { color: #e2e8f0; }
.compass-exit.bad { color: #fbbf24; }
#vignette { position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.42) 100%); }
@media (max-width: 760px), (pointer: coarse) {
  #compass { bottom: 8px; padding: 4px 8px; gap: 6px; }
  #compass-ring { width: 84px; height: 84px; flex-basis: 84px; }
  #compass-rose .cn { font-size: 9px; }
  #compass-junction { display: none; }
  #compass-text { min-width: 0; }
  #compass-heading { font-size: 12px; }
}
#osm-credit { position: absolute; right: 6px; bottom: 2px; font-size: 10px; color: #94a3b8; opacity: 0.75; z-index: 5; pointer-events: none; }

/* Health / wealth bars and the police record (HUD.js) */
#life-bars { margin-top: 8px; }
.life-row { display: flex; align-items: center; gap: 6px; margin: 3px 0; font-size: 10px; font-weight: 900; color: #cbd5e1; }
.life-label { width: 52px; letter-spacing: 0.5px; }
.life-track { flex: 1; height: 8px; background: #1e293b; border-radius: 4px; overflow: hidden; }
#health-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ef4444, #22c55e); transition: width 0.2s; }
#wealth-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ca8a04, #fde047); transition: width 0.2s; }
#health-val, #wealth-val { width: 54px; text-align: right; font-variant-numeric: tabular-nums; }
#law-stage { margin-top: 4px; font-size: 10px; font-weight: 900; letter-spacing: 0.5px; color: #94a3b8; }
#law-stage.known { color: #fbbf24; }
#law-stage.wanted { color: #f97316; }
#law-stage.predator { color: #ef4444; animation: pulse-red 0.8s infinite alternate; }
@keyframes pulse-red { from { opacity: 1; } to { opacity: 0.55; } }
#cop-intel { margin-top: 3px; font-size: 9px; color: #a78bfa; line-height: 1.3; display: none; }
.iq-btn { padding: 0 12px; border-radius: 10px; background: #1e1b4b; color: #c4b5fd; border: 2px solid #7c3aed; font-weight: 900; font-size: 11px; cursor: pointer; }
.iq-btn.active { background: #7c3aed; color: #fff; box-shadow: 0 0 12px rgba(124, 58, 237, 0.7); }

/* Lens presets in TUNING (HUD.js) */
.lens-presets { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.lens-presets button { flex: 1 0 22%; padding: 4px 0; border: 1px solid #334155; border-radius: 5px; background: #1e293b; color: #e2e8f0; font-weight: 800; font-size: 10px; cursor: pointer; }
.lens-presets button:hover { background: #7c3aed; }

/* developer fly camera (src/core/DevFly.js) */
#devfly-hint { display: none; position: absolute; top: 70px; left: 50%; transform: translateX(-50%); z-index: 40; max-width: 92vw;
  padding: 7px 14px; border-radius: 8px; background: rgba(15, 23, 42, 0.88); border: 1px solid #f59e0b; color: #e2e8f0;
  font: 600 12px "Segoe UI", system-ui, sans-serif; pointer-events: none; text-align: center; }
#devfly-hint b { color: #fbbf24; margin-right: 6px; }
