:root {
  --bg: #0b0d0c;
  --map-bg: #111512;
  --panel: rgba(14, 18, 16, 0.94);
  --panel-soft: rgba(25, 31, 27, 0.94);
  --border: rgba(214, 226, 210, 0.14);
  --border-strong: rgba(214, 226, 210, 0.28);
  --text: #edf0e9;
  --muted: #9ba59d;
  --accent: #d7f052;
  --accent-ink: #192000;
  --danger: #ff776b;
  --radius: 12px;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
  --font-ui: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: Consolas, monospace;
  --grid-major: rgba(220, 237, 201, 0.18);
  --grid-minor: rgba(220, 237, 201, 0.055);
}

:root[data-theme="glass"] {
  --bg: #17243f;
  --map-bg: #243858;
  --panel: rgba(24, 39, 63, 0.78);
  --panel-soft: rgba(40, 60, 88, 0.88);
  --border: rgba(235, 246, 255, 0.28);
  --border-strong: rgba(235, 246, 255, 0.5);
  --text: #f7fbff;
  --muted: #c0d0df;
  --accent: #9ee8ff;
  --accent-ink: #09202a;
  --danger: #ff8fa9;
  --grid-major: rgba(224, 244, 255, 0.34);
  --grid-minor: rgba(224, 244, 255, 0.13);
}

* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font: 14px/1.35 var(--font-ui); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#map { width: 100vw; height: 100vh; background: var(--map-bg); z-index: 1; }
.hidden { display: none !important; }
.icon-sprite { position: fixed; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.hud-panel {
  position: absolute; z-index: 1000; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.eyebrow { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

#top-bar { top: 16px; left: 16px; display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px 8px 8px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 800 13px var(--font-mono); letter-spacing: -.08em; }
.live-readout strong, .speed-readout strong { display: block; font: 700 13px var(--font-mono); white-space: nowrap; }
.speed-readout { padding-left: 12px; border-left: 1px solid var(--border); }
#status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--muted); }

#location-search { top: 16px; left: 50%; width: min(390px, calc(100vw - 420px)); padding: 0; transform: translateX(-50%); overflow: hidden; z-index: 1100; }
.search-input-wrap { display: flex; align-items: center; gap: 10px; padding: 11px 12px; color: var(--muted); }
#location-search-input { min-width: 0; flex: 1; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
#location-search-input::placeholder { color: var(--muted); }
#location-search-results { display: none; max-height: min(320px, 45vh); overflow-y: auto; border-top: 1px solid var(--border); }
#location-search.has-results #location-search-results { display: block; }
.location-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; color: var(--text); text-align: left; text-transform: none; }
.location-result:hover, .location-result.is-active { background: rgba(255,255,255,.08); }
.location-result-name { overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.location-result-meta { color: var(--muted); font: 10px var(--font-mono); text-transform: uppercase; }

.icon-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.icon-button:hover, .map-action:hover, .secondary-action:hover { border-color: var(--border-strong); background: var(--panel-soft); }
.icon-button.quiet { width: 34px; height: 34px; border-color: transparent; background: transparent; box-shadow: none; }
#menu-toggle { position: absolute; top: 16px; right: 16px; z-index: 1100; }

#map-actions { position: absolute; top: 86px; left: 16px; z-index: 1000; display: grid; gap: 7px; }
.map-action { display: flex; align-items: center; gap: 9px; min-width: 128px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); font-size: 12px; font-weight: 700; text-align: left; }
.map-action.is-active { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
#cursor-panel { bottom: 16px; left: 16px; padding: 7px 10px; color: var(--accent); font: 11px var(--font-mono); letter-spacing: .05em; }
#nav-summary { right: 70px; top: 16px; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; }
#nav-summary > .icon { color: var(--accent); }
#nav-summary strong { display: block; font: 700 13px var(--font-mono); white-space: nowrap; }

#action-toast { position: absolute; bottom: 22px; left: 50%; z-index: 1300; min-width: 180px; max-width: calc(100vw - 32px); padding: 9px 14px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--panel); box-shadow: var(--shadow); color: var(--accent); font: 11px var(--font-mono); letter-spacing: .06em; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity .2s, transform .2s; }
#action-toast.visible { opacity: 1; transform: translate(-50%, 0); }

#controls { top: 0; right: 0; display: flex; flex-direction: column; width: 370px; height: 100vh; padding: 20px; border-top: 0; border-right: 0; border-bottom: 0; border-radius: 0; overflow-y: auto; transform: translateX(0); transition: transform .22s ease, visibility 0s; }
#controls.hidden { display: flex !important; visibility: hidden; pointer-events: none; transform: translateX(100%); transition: transform .22s ease, visibility 0s linear .22s; }
.controls-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.controls-header strong { display: block; margin-top: 2px; font-size: 18px; }
.control-section { margin: 0; padding: 17px 0; border-bottom: 1px solid var(--border); }
.control-section h2 { margin: 0 0 8px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.select-label { display: block; margin: 0 0 7px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
select, #poi-modal input[type="text"] { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-soft); color: var(--text); }
select option { background: #19201c; color: var(--text); }
.control-section label:not(.select-label) { display: flex; align-items: center; min-height: 36px; color: var(--text); cursor: pointer; }
input[type="checkbox"] { position: relative; appearance: none; width: 34px; height: 19px; margin: 0 10px 0 0; border: 1px solid var(--border-strong); border-radius: 999px; background: rgba(255,255,255,.08); transition: background .15s, border-color .15s; flex: 0 0 auto; }
input[type="checkbox"]::after { position: absolute; top: 3px; left: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); content: ""; transition: transform .15s, background .15s; }
input[type="checkbox"]:checked { border-color: var(--accent); background: var(--accent); }
input[type="checkbox"]:checked::after { background: var(--accent-ink); transform: translateX(15px); }
details summary { display: flex; align-items: center; justify-content: space-between; color: var(--text); cursor: pointer; font-weight: 700; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary .icon { color: var(--muted); transition: transform .15s; }
details[open] summary { margin-bottom: 9px; }
details[open] summary .icon { transform: rotate(90deg); color: var(--accent); }
.control-group { display: none; margin: 3px 0 8px; padding: 11px; border-left: 2px solid var(--accent); background: rgba(255,255,255,.04); }
.slider-row { margin-bottom: 12px; }.slider-row:last-child { margin-bottom: 0; }
.slider-head { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 11px; }.val-display { color: var(--accent); font-family: var(--font-mono); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.secondary-action, .primary-action { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); font-size: 12px; font-weight: 700; }
.secondary-action { width: 100%; margin-top: 8px; }.primary-action { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }

#poi-backdrop { position: fixed; inset: 0; z-index: 1900; background: rgba(0,0,0,.56); backdrop-filter: blur(3px); }
#login-backdrop { position: fixed; inset: 0; z-index: 2100; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
#poi-modal { position: fixed; top: 50%; left: 50%; z-index: 2000; width: min(390px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel); box-shadow: 0 24px 64px rgba(0,0,0,.6); transform: translate(-50%, -50%); }
#login-modal { position: fixed; top: 50%; left: 50%; z-index: 2200; width: min(360px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel); box-shadow: 0 24px 64px rgba(0,0,0,.6); transform: translate(-50%, -50%); }.login-error { min-height: 18px; margin: -6px 0 10px; color: #ff8a84; font-size: 12px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }.modal-header h2 { margin: 1px 0 0; font-size: 19px; }
#poi-modal input[type="text"], #poi-modal select { margin-bottom: 14px; }.modal-actions { display: flex; gap: 8px; }.modal-actions button { flex: 1; }

.gps-marker { position: relative; background: #ff5b54; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 20px #ff5b54; }.gps-marker::after { position: absolute; inset: -2px; border: 2px solid rgba(255,91,84,.7); border-radius: 50%; content: ""; animation: pulse 2s infinite; }@keyframes pulse { 70%,100% { opacity: 0; transform: scale(2.4); } }
.town-label { color: #fff; font: 600 11px var(--font-ui); letter-spacing: .04em; text-shadow: 0 2px 4px #000; text-transform: uppercase; white-space: nowrap; }.town-loot-badge { display: inline-block; margin-left: 3px; padding: 0 2px; border: 1px solid #fff; border-radius: 3px; font: 700 7px var(--font-mono); line-height: 10px; }.tier-3 { background: #a335ee; }.tier-4 { background: #ff8000; }
.poi-icon { font-size: 22px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.8)); }.tactical-tooltip { border: 1px solid var(--accent); border-radius: 5px; background: #101510; color: var(--accent); font: 11px var(--font-mono); }.leaflet-tooltip:before { display: none; }
.landmark-icon { display: flex; align-items: center; width: 20px; height: 20px; white-space: nowrap; }.landmark-star { color: #facc15; font-size: 22px; text-shadow: 0 1px 3px #000; }.landmark-label { margin-left: 4px; color: #facc15; font: 700 10px var(--font-mono); text-shadow: 0 1px 3px #000; }
.pump-icon, .gas-station-icon { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 1px solid rgba(255,255,255,.9); border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.55); font-size: 10px; }.pump-icon { background: #2563eb; }.gas-station-icon { background: #ea580c; }.pump-icon span, .gas-station-icon span { filter: grayscale(1) brightness(4); }
.medical-icon { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 1px solid rgba(255,255,255,.9); border-radius: 50%; background: #dc2626; box-shadow: 0 2px 6px rgba(0,0,0,.55); color: #fff; font: 700 14px Arial; }.hunting-icon { width: 22px; height: 22px; font-weight: 700; }.hunting-diamond { position: absolute; top: 2px; left: 2px; display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1px solid rgba(255,255,255,.8); background: #7c4a21; box-shadow: 0 2px 6px rgba(0,0,0,.55); color: #fff; font: 11px Arial; transform: rotate(45deg); }.hunting-diamond > span { transform: rotate(-45deg); }

@media (max-width: 760px) {
  #top-bar { top: 10px; left: 10px; }.speed-readout { display: none; }
  #location-search { top: 74px; left: 10px; width: calc(100vw - 20px); transform: none; }
  #menu-toggle { top: 10px; right: 10px; } #nav-summary { top: 10px; right: 62px; } #nav-summary .eyebrow { display: none; }
  #map-actions { top: 130px; left: 10px; grid-auto-flow: column; grid-template-columns: repeat(3, 42px); gap: 6px; }.map-action { display: grid; place-items: center; min-width: 42px; width: 42px; height: 42px; padding: 0; }.map-action span { display: none; }
  #controls { top: auto; bottom: 0; width: 100%; height: min(79vh, 680px); padding: 17px; border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; transform: translateY(0); }.controls-header { padding-bottom: 13px; }#controls.hidden { transform: translateY(100%); }
  #cursor-panel { bottom: 10px; left: 10px; } .leaflet-bottom.leaflet-right { bottom: 54px; }
}
@media (max-width: 440px) { #nav-summary { right: 60px; padding: 7px; gap: 7px; } #nav-summary > .icon, #nav-summary div:nth-of-type(2) { display: none; } #nav-summary strong { font-size: 12px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
