/* Radar: a GTA-style rounded rectangle at the bottom left on desktop; a circle under the buttons on touch screens
   (the stick lives bottom left there). */
#minimap {
  position: fixed; left: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); z-index: 5;
  width: 268px; height: 176px; border-radius: 14px;
  background: #d6c39a; border: 3px solid rgba(13,22,40,.85); cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
body.touch #minimap { position: static; width: 132px; height: 132px; border-radius: 50%; }
body.no3d #minimap { display: none; }

.gps {
  position: fixed; left: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 200px); z-index: 5;
  display: flex; align-items: center; gap: 8px; max-width: 268px;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px;
  padding: 5px 6px 5px 10px; font-size: 13px; backdrop-filter: blur(6px);
}
.gps i { font-style: normal; }
.gps b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gps span { margin-left: auto; font-family: var(--f-mono); color: var(--muted); white-space: nowrap; }
.gps button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: rgba(255,255,255,.06); line-height: 1; flex: none; }
body.touch .gps { left: auto; right: 16px; bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 200px); max-width: 220px; }

/* The district you just drove into, bottom right, like GTA. */
.area {
  position: fixed; right: 24px; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); z-index: 4; pointer-events: none;
  font-family: var(--f-display); font-size: clamp(22px, 3.2vw, 36px); color: #fff; letter-spacing: .02em;
  text-shadow: 0 2px 0 rgba(0,0,0,.55), 0 0 18px rgba(0,0,0,.45); opacity: 0;
}
.area.show { animation: area 3.6s ease-out forwards; }
@keyframes area { 0% { opacity: 0; transform: translateY(8px); } 12%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }
body.touch .area { right: auto; left: 50%; transform: translateX(-50%); bottom: auto; top: 30%; font-size: 24px; animation-name: area-t; }
@keyframes area-t { 0% { opacity: 0; } 12%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* Big map */
.bigmap { position: fixed; inset: 0; z-index: 30; background: #0d1628; }
.bigmap-box { position: absolute; inset: 0; }
#map-cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
#map-cv:active { cursor: grabbing; }
.map-head {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 24px; pointer-events: none;
  background: linear-gradient(180deg, rgba(13,22,40,.85), rgba(13,22,40,0));
}
.map-head > * { pointer-events: auto; }
.map-title h2 { margin: 2px 0 0; font-family: var(--f-display); font-weight: 400; font-size: 26px; color: var(--accent); }
.map-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.map-tools .hbtn { min-width: 40px; font-size: 16px; }
.map-tools .x { width: 40px; height: 40px; }
.map-legend {
  position: absolute; left: 16px; top: calc(env(safe-area-inset-top, 0px) + 84px); bottom: 48px; width: 270px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; backdrop-filter: blur(8px);
  overscroll-behavior: contain;
}
.map-legend h3 { margin: 6px 4px 6px; font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.map-legend ul { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.map-legend button { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; padding: 6px 8px; border-radius: 10px; border: 1px solid transparent; background: none; }
.map-legend button:hover, .map-legend button:focus-visible { border-color: var(--c); background: rgba(255,255,255,.06); }
.map-legend i { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 16px; background: var(--c); border: 2px solid #fff; }
.map-legend span { min-width: 0; }
.map-legend b { display: block; font-size: 14px; }
.map-legend small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-card {
  position: absolute; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 48px); width: min(380px, calc(100% - 32px));
  background: var(--panel-solid); border: 1px solid var(--line); border-top: 5px solid var(--c); border-radius: 16px; padding: 14px;
  display: grid; gap: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.45); animation: pop2 .18s ease-out;
}
.mc-top { display: flex; gap: 12px; align-items: flex-start; }
.mc-top > div { flex: 1; min-width: 0; }
.mc-top b { display: block; font-size: 18px; }
.mc-top small { display: block; color: var(--muted); font-size: 13px; }
.mc-ico { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: var(--c); border: 3px solid #fff; }
.map-card .btn { padding: 10px 14px; font-size: 14px; }
.map-hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); margin: 0; font-size: 12px; color: #1d2230; background: rgba(255,255,255,.75); padding: 4px 10px; border-radius: 999px; white-space: nowrap; pointer-events: none; }

@media (max-width: 760px) {
  .map-legend { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 34vh; border-radius: 16px 16px 0 0; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); }
  .map-legend ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-card { bottom: calc(34vh + 10px); }
  .map-hint { display: none; }
  .map-tools .lbl { display: none; }
}
@media (min-width: 641px) and (max-width: 1100px) { #minimap { width: 220px; height: 146px; } .gps { bottom: calc(env(safe-area-inset-bottom, 0px) + 170px); } }
@media (min-width: 1500px) { #minimap { width: 320px; height: 210px; } .gps { bottom: calc(env(safe-area-inset-bottom, 0px) + 236px); max-width: 320px; } }
@media (max-height: 620px) and (orientation: landscape) { #minimap { width: 190px; height: 124px; } .gps { bottom: calc(env(safe-area-inset-bottom, 0px) + 148px); } }
