* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0d12;
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  color: #fff;
  user-select: none;
  touch-action: pan-x pan-y;        /* povol posun, zakaž pinch-zoom stránky */
  -webkit-text-size-adjust: 100%;   /* iOS: žádné auto-zoomování fontů */
}

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

/* ---------- Loading ---------- */
#loading {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #1b2536, #06080c);
}
.loading-title {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 6px;
  text-align: center;
  color: #e8eef7;
}
.loading-sub {
  margin-top: 14px;
  text-align: center;
  color: #8fa3bf;
  letter-spacing: 2px;
}

/* ---------- Výběr města ---------- */
#city-select {
  position: fixed;
  inset: 0;
  z-index: 35;
  overflow-y: auto;                 /* na malých displejích se dá scrollovat */
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(circle at 50% 40%, #1b2536, #06080c);
}
#city-select.hidden { display: none; }
.city-box {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
}
.city-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 6px;
  color: #e8eef7;
}
.city-sub {
  margin-top: 10px;
  margin-bottom: 20px;
  color: #8fa3bf;
  letter-spacing: 2px;
}
#city-list { display: flex; flex-direction: column; gap: 10px; align-items: center; width: 100%; }
.city-btn {
  width: min(88vw, 320px);
  padding: 14px 24px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #eaf1ff;
  background: linear-gradient(180deg, #2b3b57, #16202f);
  border: 2px solid rgba(120,170,255,.35);
  border-radius: 12px;
  cursor: pointer;
  transition: transform .1s, border-color .2s;
}
.city-btn:hover { transform: translateY(-2px); border-color: rgba(120,170,255,.7); }
.city-btn:active { transform: translateY(1px); }
/* „Pokračovat kde jsi skončil" — zvýrazněná první volba */
.city-cont {
  background: linear-gradient(180deg, #1f7a4a, #12362a);
  border-color: rgba(93,255,158,.55);
  color: #eafff2;
}
.city-cont:hover { border-color: rgba(93,255,158,.9); }

/* výběr auta (značka + barva) */
.car-select { width: min(88vw, 340px); margin-bottom: 6px; }
.car-label { color: #8fa3bf; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; margin: 4px 0 8px; }
.car-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 14px; }
.car-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 84px; padding: 8px 10px;
  color: #dbe6f5; font-size: 12px; font-weight: 700;
  background: linear-gradient(180deg, #223247, #131c29);
  border: 2px solid rgba(120,170,255,.22);
  border-radius: 10px; cursor: pointer;
  transition: transform .1s, border-color .2s, box-shadow .2s;
}
.car-btn .car-emoji { font-size: 22px; }
.car-btn:hover { transform: translateY(-2px); border-color: rgba(120,170,255,.55); }
.car-btn.active {
  border-color: #7dc0ff;
  box-shadow: 0 0 0 1px #7dc0ff, 0 4px 16px rgba(90,168,240,.35);
}
.model-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-bottom: 14px; }
.model-btn {
  padding: 7px 13px;
  color: #cddbef; font-size: 13px; font-weight: 700;
  background: linear-gradient(180deg, #1d2b3e, #111a26);
  border: 2px solid rgba(120,170,255,.2);
  border-radius: 999px; cursor: pointer;
  transition: transform .1s, border-color .2s, box-shadow .2s;
}
.model-btn:hover { transform: translateY(-2px); border-color: rgba(120,170,255,.5); }
.model-btn.active {
  color: #eaf3ff; border-color: #7dc0ff;
  box-shadow: 0 0 0 1px #7dc0ff, 0 3px 12px rgba(90,168,240,.3);
}
.color-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 4px; }
.color-swatch {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25); cursor: pointer;
  transition: transform .1s, box-shadow .2s, border-color .2s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px #7dc0ff; transform: scale(1.12); }

/* vlastní adresa */
.city-or { margin: 18px 0 12px; color: #6f83a2; font-size: 13px; letter-spacing: 1px; }
.city-addr { display: flex; gap: 8px; width: min(88vw, 320px); }
#addr-input {
  flex: 1; min-width: 0;
  padding: 13px 14px;
  font-size: 16px;                  /* ≥16px → iOS nezoomuje při fokusu */
  color: #eaf1ff;
  background: #0e1622;
  border: 1px solid rgba(120,170,255,.35);
  border-radius: 10px;
  outline: none;
}
#addr-input:focus { border-color: rgba(120,170,255,.75); }
#addr-go {
  padding: 13px 16px;
  font-size: 15px; font-weight: 800;
  white-space: nowrap;
  color: #06080c;
  background: linear-gradient(180deg, #9fd0ff, #5aa8f0);
  border: none; border-radius: 10px;
  cursor: pointer;
}
#addr-go:disabled { opacity: .6; }
#addr-status { margin-top: 10px; min-height: 18px; font-size: 13px; color: #9fb2cd; }
#addr-status.ok { color: #7dffa8; }
#addr-status.err { color: #ff6b6b; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud.hidden { display: none; }

#speedo {
  position: absolute;
  right: 26px;
  bottom: 26px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(10,14,20,.85), rgba(4,6,10,.9));
  border: 3px solid rgba(120,170,255,.35);
  box-shadow: 0 0 24px rgba(0,0,0,.6), inset 0 0 20px rgba(80,140,255,.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#speed-value { font-size: 44px; font-weight: 800; line-height: 1; color: #eaf1ff; }
#speed-unit { font-size: 13px; letter-spacing: 2px; color: #7d93b5; margin-top: 4px; }

#stats {
  position: absolute;
  left: 22px;
  top: 20px;
  font-size: 15px;
  line-height: 1.7;
  text-shadow: 0 2px 6px rgba(0,0,0,.8);
  background: rgba(8,12,18,.4);
  padding: 10px 14px;
  border-radius: 10px;
  backdrop-filter: blur(3px);
}
#location { color: #ffd27a; font-weight: 600; }
/* jméno ulice + obec těsně NAD minimapou (vlevo dole) */
#location-box {
  position: absolute;
  left: 24px;
  bottom: 214px;
  max-width: 220px;
  padding: 6px 12px;
  font-size: 15px;
  border-radius: 10px;
  background: rgba(8,12,18,.5);
  text-shadow: 0 2px 6px rgba(0,0,0,.85);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
}
#score-line { font-size: 18px; font-weight: 800; }
#score { color: #7dffa8; }
#wrecks { color: #ff9a6a; font-weight: 700; }

/* stylizovaný "breaking news" banner při srážce (bez reálné osoby/loga) */
#score-pop {
  position: absolute;
  left: 50%;
  top: 8%;
  transform: translate(-50%, -20px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 26px 12px 14px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(90deg, #c81724, #9a0f1b);
  border-left: 6px solid #ffd23e;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
#score-pop b { color: #ffe15a; }
.bn-tag {
  background: #ffd23e;
  color: #7a0a12;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 2px;
  padding: 3px 10px;
  border-radius: 4px;
}
#score-pop.show { animation: bn 1.6s ease-out; }
@keyframes bn {
  0%   { opacity: 0; transform: translate(-50%, -20px) scale(0.9); }
  12%  { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  20%  { transform: translate(-50%, 0) scale(1.0); }
  85%  { opacity: 1; transform: translate(-50%, 0) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -12px) scale(0.98); }
}

#minimap {
  position: absolute;
  left: 24px;
  bottom: 24px;
  border-radius: 12px;
  border: 2px solid rgba(120,170,255,.3);
  background: rgba(8,12,18,.55);
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}

/* navigační banner nad minimapou (nad #location-box) */
#nav-banner {
  position: absolute;
  left: 24px;
  bottom: 256px;
  max-width: 220px;
  padding: 8px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(20,120,70,.92), rgba(14,90,55,.92));
  border-left: 5px solid #6dff9e;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-shadow: 0 2px 5px rgba(0,0,0,.6);
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
#nav-banner .navd { color: #b7ffcf; }

/* navigační modal */
#nav-modal {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16vh;
  background: rgba(4,7,12,.55);
  backdrop-filter: blur(4px);
}
.nav-box {
  width: min(92vw, 460px);
  padding: 22px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(30,42,62,.98), rgba(12,17,26,.98));
  border: 1px solid rgba(120,170,255,.3);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  pointer-events: auto;
}
.nav-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; color: #eaf1ff; }
#nav-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid #3f5578;
  background: #10151f;
  color: #fff;
  outline: none;
}
#nav-input:focus { border-color: #6dff9e; }
#nav-suggestions {
  list-style: none;
  margin: 8px 0 0;
  max-height: 260px;
  overflow-y: auto;
}
#nav-suggestions li {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: #d6e2f2;
  font-size: 15px;
}
#nav-suggestions li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
#nav-suggestions li .town {
  color: #7fd8a0;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
}
#nav-suggestions li:hover, #nav-suggestions li.active {
  background: #26344c;
  color: #fff;
}
#nav-suggestions li:hover .town, #nav-suggestions li.active .town { color: #a8f0c4; }
.nav-hint { margin-top: 12px; color: #8ba0c0; font-size: 12px; text-align: center; }

/* ---------- Help ---------- */
#help {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4,7,12,.72);
  backdrop-filter: blur(6px);
}
#help.hidden { display: none; }
.help-inner {
  width: min(92vw, 460px);
  padding: 34px 34px 28px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(30,42,62,.95), rgba(12,17,26,.95));
  border: 1px solid rgba(120,170,255,.25);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  text-align: center;
}
.help-inner h1 { font-size: 34px; letter-spacing: 3px; margin-bottom: 6px; }
.tag { color: #9fb4d4; margin-bottom: 20px; font-size: 15px; }
.keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  text-align: left;
  font-size: 14px;
  color: #d6e2f2;
  margin-bottom: 24px;
}
.k {
  display: inline-block;
  min-width: 22px;
  padding: 2px 7px;
  margin-right: 2px;
  text-align: center;
  background: #26344c;
  border: 1px solid #3f5578;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #cfe0ff;
}
#start-btn {
  pointer-events: auto;
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 14px 36px;
  border: none;
  border-radius: 12px;
  color: #06080c;
  background: linear-gradient(180deg, #ffd479, #ffb032);
  box-shadow: 0 8px 22px rgba(255,170,50,.35);
  transition: transform .1s ease;
}
#start-btn:hover { transform: translateY(-2px); }
#start-btn:active { transform: translateY(1px); }
.hint { margin-top: 18px; color: #8ba0c0; font-size: 13px; }

.hidden { display: none !important; }

/* ---------- Dotykové ovládání (mobil) ---------- */
/* Ve výchozím stavu skryté; ukáže se jen na touch zařízení během hry
   (body.touch.playing). Kontejner propouští doteky skrz — jen tlačítka je chytají. */
#touch-controls { display: none; }
body.touch.playing #touch-controls {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;               /* skrz prázdno vidět/ovládat scénu */
  touch-action: none;
}
#touch-controls .tc-btn {
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,.35);
  background: rgba(14,20,30,.44);
  color: #eaf1fb;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
#touch-controls .tc-btn.active {
  background: rgba(255,178,50,.82);
  border-color: #ffd479;
  color: #06080c;
  transform: scale(.94);
}

/* analogový joystick vpravo dole (steer + plyn/brzda) */
.tc-joy {
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: absolute;
  right: calc(24px + env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 148px; height: 148px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.28);
  background: radial-gradient(circle at 50% 50%, rgba(20,28,40,.42), rgba(10,14,22,.5));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
}
.tc-joy.active { border-color: rgba(255,212,121,.6); }
.tc-joy-stick {
  position: absolute;
  left: 50%; top: 50%;
  width: 64px; height: 64px;
  margin-left: -32px; margin-top: -32px;
  border-radius: 50%;
  background: rgba(235,241,251,.9);
  border: 2px solid rgba(255,255,255,.7);
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
  transform: translate(0,0);
  transition: transform .05s linear;
  pointer-events: none;
}
.tc-joy.active .tc-joy-stick {
  background: rgba(255,178,50,.95);
  transition: none;
}
.tc-joy-hint {
  position: absolute;
  color: rgba(255,255,255,.4);
  font-size: 16px; font-weight: 800; line-height: 1;
  pointer-events: none;
}
.tc-joy-up    { top: 6px;  left: 50%; transform: translateX(-50%); }
.tc-joy-down  { bottom: 6px; left: 50%; transform: translateX(-50%); }
.tc-joy-left  { left: 8px;  top: 50%; transform: translateY(-50%); }
.tc-joy-right { right: 8px; top: 50%; transform: translateY(-50%); }

/* ruční brzda vlevo dole (druhý palec) */
.tc-hb {
  position: absolute;
  left: calc(24px + env(safe-area-inset-left));
  bottom: calc(40px + env(safe-area-inset-bottom));
  width: 74px; height: 74px; border-radius: 50%; font-size: 28px;
}

/* akční tlačítka vpravo nahoře */
.tc-actions {
  position: absolute;
  right: calc(12px + env(safe-area-inset-right));
  top: calc(12px + env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.tc-round { width: 52px; height: 52px; border-radius: 50%; font-size: 22px; }

/* mapa u minimapy (vlevo dole, hned vedle kompasu) */
#touch-controls #tc-map {
  position: absolute;
  left: calc(214px + env(safe-area-inset-left));
  bottom: calc(24px + env(safe-area-inset-bottom));
}

/* nižší/na šířku: zmenši, ať nezakrývá půlku scény */
@media (max-height: 460px) {
  .tc-joy { width: 118px; height: 118px; }
  .tc-joy-stick { width: 52px; height: 52px; margin-left: -26px; margin-top: -26px; }
  .tc-hb { width: 60px; height: 60px; font-size: 24px; }
}

/* ---------- Návrh funkce (feature request) ---------- */
#fr-open {
  pointer-events: auto;
  position: fixed;
  right: 14px; top: 14px;
  z-index: 12;
  padding: 8px 12px;
  font-size: 13px; font-weight: 700;
  color: #ffe6a8;
  background: rgba(20,28,40,.72);
  border: 1px solid rgba(255,210,120,.5);
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
#fr-open:hover { background: rgba(40,52,70,.85); }
#hud.hidden ~ #fr-open { display: none; }
/* na mobilu je „Návrh funkce" v ESC menu (#esc-feature) — HUD tlačítko schovej,
   ať nezakrývá „online" status a nepřesahuje */
body.touch #fr-open { display: none; }

/* „Vypadá to tady jinak" — pod fr-open a map-open (ty jsou top:14/52) */
#report-open {
  pointer-events: auto;
  position: fixed;
  right: 14px; top: 90px;
  z-index: 12;
  padding: 8px 12px;
  font-size: 13px; font-weight: 700;
  color: #ffcfa8;
  background: rgba(20,28,40,.72);
  border: 1px solid rgba(255,170,120,.5);
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
#report-open:hover { background: rgba(40,52,70,.85); }
#hud.hidden ~ #report-open { display: none; }
body.touch #report-open { display: none; }   /* na mobilu je 📸 v touch akcích */

/* modal sdílí .fr-box/.fr-btn/.fr-status s feature requestem — jen se chová jako fr-modal */
#report-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,8,12,.6);
}
#report-modal.hidden { display: none; }
#report-note {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  font: inherit; font-size: 15px;
  color: #eaf1fb;
  background: #0b1119;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px;
  outline: none;
}
#report-note:focus { border-color: rgba(255,170,120,.6); }
#report-photo {
  display: block;
  width: 100%;
  margin-top: 10px;
  font-size: 13px;
  color: #cdd8e8;
}

#fr-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,8,12,.6);
}
#fr-modal.hidden { display: none; }
.fr-box {
  width: min(92vw, 460px);
  background: #121a26;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 18px 50px rgba(0,0,0,.5);
}
.fr-title { font-size: 20px; font-weight: 800; color: #ffe6a8; }
.fr-sub { margin: 6px 0 12px; color: #9fb2cd; font-size: 13px; }
#fr-text {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  font: inherit; font-size: 15px;
  color: #eaf1fb;
  background: #0b1119;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px;
  outline: none;
}
#fr-text:focus { border-color: rgba(255,210,120,.6); }
.fr-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.fr-btn {
  pointer-events: auto;
  cursor: pointer;
  padding: 10px 20px;
  font-weight: 800; font-size: 14px;
  border: none; border-radius: 10px;
  color: #06080c;
  background: linear-gradient(180deg, #ffd479, #ffb032);
}
.fr-btn:active { transform: translateY(1px); }
.fr-ghost {
  color: #cdd8e8;
  background: transparent;
  border: 1px solid rgba(255,255,255,.2);
}
.fr-status { margin-top: 10px; font-size: 13px; min-height: 18px; }
.fr-status.ok { color: #5dff9e; }
.fr-status.err { color: #ff6b6b; }

/* ---------- Mapa (celoobrazovková) + otevírací tlačítko ---------- */
#map-open {
  pointer-events: auto;
  position: fixed;
  right: 14px; top: 52px;
  z-index: 12;
  padding: 8px 12px;
  font-size: 13px; font-weight: 700;
  color: #bfe0ff;
  background: rgba(20,28,40,.72);
  border: 1px solid rgba(120,180,255,.5);
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
#map-open:hover { background: rgba(40,52,70,.85); }
#hud.hidden ~ #map-open { display: none; }
body.touch #map-open { display: none; }   /* na mobilu je 🗺️ v touch akcích */

#mapview {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: #0d1420;
}
#mapview.hidden { display: none; }
#mapview-canvas { display: block; width: 100vw; height: 100vh; touch-action: none; cursor: grab; }
#mapview-canvas:active { cursor: grabbing; }

/* tlačítka vpravo nahoře jsou přesunutá do mapy (👥/💡/📸) → v HUDu skrytá */
#map-open, #friends-open, #fr-open, #report-open, #complete-open { display: none !important; }

/* PEEK (Shift): mapa jen průhledně překrývá hru, propouští ovládání dolů */
#mapview.mv-peek { background: transparent; pointer-events: none; }
#mapview.mv-peek #mapview-legend { display: none !important; }
/* stejná tlačítka jako v plné mapě, ale VLEVO; klikají se virtuálním kurzorem */
#mapview.mv-peek #mapview-ui {
  left: calc(14px + env(safe-area-inset-left)); right: auto;
}
#mapview.mv-peek #mapview-ui button { pointer-events: auto; }
#mapview.mv-peek #mv-name { pointer-events: auto; } /* dialog jména musí jít ovládat */

/* virtuální kurzor (peek) — vypadá jako klasická systémová šipka; hrot je v (vcx,vcy) */
#vcursor {
  position: fixed; z-index: 60; width: 22px; height: 30px; margin: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath fill='%23ffffff' stroke='%23000000' stroke-width='30' stroke-linejoin='round' d='M0 55.2V426c0 12.2 9.9 22 22 22 6.3 0 12.4-2.7 16.6-7.5L121.2 346l58.1 116.3c7.9 15.8 27.1 22.2 42.9 14.3s22.2-27.1 14.3-42.9L179.8 320H297.9c12.2 0 22.1-9.9 22.1-22.1 0-6.2-2.6-12.1-7.1-16.3L38.6 39.8c-4.4-4.2-10.2-6.5-16.2-6.5C10.5 33.3 0 43.7 0 55.2z'/%3E%3C/svg%3E") no-repeat;
  background-size: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.55));
}
#vcursor.hidden { display: none; }
#vcursor.press { filter: drop-shadow(0 1px 2px rgba(0,0,0,.55)) brightness(1.4); }

/* toast v mapě (místo alert) */
#mv-toast {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  z-index: 48; pointer-events: none;
  background: rgba(10,14,20,.88); color: #eaf1ff;
  padding: 9px 16px; border-radius: 20px; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
#mv-toast.hidden { display: none; }

/* dialog na pojmenování místa (místo browser prompt) */
#mv-name {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,7,12,.55);
}
#mv-name.hidden { display: none; }
.mv-name-box {
  background: #121a26; border: 1px solid rgba(120,170,255,.3); border-radius: 14px;
  padding: 20px; width: min(90vw, 360px); box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.mv-name-title { font-weight: 800; font-size: 17px; color: #eaf1ff; margin-bottom: 12px; text-align: center; }
#mv-name-input {
  width: 100%; box-sizing: border-box; padding: 12px 14px; font-size: 16px;
  color: #eaf1ff; background: #0b1119; border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px; outline: none;
}
#mv-name-input:focus { border-color: rgba(120,170,255,.7); }
.mv-name-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

#mapview-ui {
  position: absolute;
  right: calc(14px + env(safe-area-inset-right));
  top: calc(14px + env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#mapview-ui button {
  width: 46px; height: 46px;
  font-size: 18px; font-weight: 800;
  color: #eaf1fb;
  background: rgba(20,28,40,.82);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#mapview-ui button:hover { background: rgba(40,54,74,.9); }
#mv-close { border-color: rgba(255,150,150,.5); }

#mapview-legend {
  position: absolute;
  left: calc(14px + env(safe-area-inset-left));
  top: calc(14px + env(safe-area-inset-top));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  max-width: 62vw;
  padding: 8px 12px;
  font-size: 12px;
  color: #cdd8e8;
  background: rgba(13,20,32,.8);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
}
#mapview-legend span { display: inline-flex; align-items: center; gap: 5px; }
#mapview-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
#mapview-legend .mv-hint { color: #8ba0c0; }
@media (max-height: 460px) { #mapview-legend .mv-hint { display: none; } }

/* --- Mapa: teleport režim + pokrytí --- */
#mapview-ui button.active {
  background: rgba(255,178,50,.92);
  border-color: #ffd479;
  color: #06080c;
}
#mapview-canvas.mv-picking { cursor: crosshair; }
#mv-teleport-hint {
  position: absolute;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 2;
  padding: 9px 16px;
  font-size: 14px; font-weight: 700;
  color: #06080c;
  background: linear-gradient(180deg, #ffd479, #ffb032);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  white-space: nowrap;
  pointer-events: none;
}
#mv-teleport-hint.hidden { display: none; }
#mapview-legend i.mv-cov {
  width: 12px; height: 12px; border-radius: 2px;
  background: rgba(93,255,158,0.30);
  border: 1px solid rgba(93,255,158,0.7);
}

/* --- Report „vypadá to jinak": náhledy fotek + hint --- */
.report-hint { margin-top: 8px; font-size: 12px; color: #8ba0c0; }
.report-previews { display: flex; gap: 12px; margin-top: 10px; }
.report-previews figure { flex: 1; margin: 0; text-align: center; }
.report-previews img {
  width: 100%; max-height: 120px; object-fit: cover;
  border-radius: 8px; border: 1px solid rgba(255,255,255,.15);
  background: #0b1119;
}
.report-previews img.hidden { display: none; }
.report-previews figcaption { margin-top: 4px; font-size: 11px; color: #8ba0c0; }
#report-photo { margin-top: 10px; font-size: 13px; color: #cdd8e8; }

/* ---------- Multiplayer: přihlášení / chat / přátelé ---------- */
#auth-modal {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #1b2536, #06080c);
}
#auth-modal.hidden { display: none; }
.auth-box {
  width: min(92vw, 380px); background: #121a28; border: 1px solid #26344c;
  border-radius: 16px; padding: 26px 24px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.auth-sub { color: #9fb2cc; margin: 6px 0 18px; font-size: 14px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-tab {
  flex: 1; padding: 9px; border-radius: 9px; border: 1px solid #26344c; background: #0e1622;
  color: #b9c8de; font-weight: 600; cursor: pointer;
}
.auth-tab.active { background: #26344c; color: #fff; border-color: #3a5074; }
#auth-modal input {
  width: 100%; box-sizing: border-box; margin: 6px 0; padding: 12px 14px; border-radius: 10px;
  border: 1px solid #2b3a54; background: #0b1220; color: #eaf2ff; font-size: 15px;
}
#auth-modal input:focus { outline: none; border-color: #6dff9e; }
.auth-btn {
  width: 100%; margin-top: 12px; padding: 13px; border: none; border-radius: 11px; cursor: pointer;
  background: linear-gradient(180deg, #37d67a, #21b45f); color: #05210f; font-weight: 800; font-size: 16px;
}
.auth-btn:disabled { opacity: .6; }
.auth-status { min-height: 18px; margin-top: 10px; color: #ff9b8a; font-size: 13px; }
.auth-guest { margin-top: 10px; background: none; border: none; color: #8ba0c0; cursor: pointer; font-size: 13px; text-decoration: underline; }

#chat {
  position: fixed; left: 12px; top: 128px; z-index: 30; width: min(46vw, 340px);
  display: flex; flex-direction: column; gap: 6px; pointer-events: none;
}
#chat.hidden { display: none; }
#chat-log {
  max-height: 26vh; overflow-y: auto; display: flex; flex-direction: column; gap: 3px;
  opacity: .35; transition: opacity .3s; pointer-events: auto;
}
#chat.show #chat-log { opacity: 1; }
.chat-line {
  align-self: flex-start; background: rgba(10,14,20,.62); color: #dce8f7; font-size: 13px;
  padding: 4px 9px; border-radius: 10px; max-width: 100%; word-break: break-word;
}
.chat-line b { color: #7fd8a0; }
.chat-time { color: #6f7f98; font-size: 11px; margin-right: 4px; font-variant-numeric: tabular-nums; }
#chat-input {
  pointer-events: auto; padding: 9px 12px; border-radius: 20px; border: 1px solid #2b3a54;
  background: rgba(11,18,32,.85); color: #eaf2ff; font-size: 14px; opacity: .5; transition: opacity .2s;
}
#chat-input:focus { opacity: 1; outline: none; border-color: #6dff9e; }

#friends-modal, #garage-modal {
  position: fixed; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center;
  background: rgba(4,7,12,.6);
}
#friends-modal.hidden, #garage-modal.hidden { display: none; }

/* garáž — oblíbená auta jako klikací dlaždice „nahoře" */
.garage-box { width: min(94vw, 480px); max-height: 92vh; overflow-y: auto; }
.garage-favs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; justify-content: center; }
.garage-favs.hidden { display: none; }
.fav-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 999px; cursor: pointer;
  background: #12203a; border: 1px solid rgba(120,170,255,.4); color: #eaf1ff;
  font-size: 14px; font-weight: 700;
}
.fav-chip:hover { background: #1b2c4c; border-color: rgba(120,170,255,.75); }
.fav-dot { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(255,255,255,.45); }
.fav-name { white-space: nowrap; }
.fav-x { margin-left: 3px; color: #ff9090; font-weight: 900; opacity: .85; }
.fav-x:hover { opacity: 1; }
/* online hráči v panelu přátel */
.friends-online { margin-top: 14px; text-align: left; }
.friends-online ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.friends-online li {
  background: #0e1622; border: 1px solid #22304a; border-radius: 8px; padding: 7px 10px;
  color: #dce8f7; font-size: 14px; display: flex; justify-content: space-between; align-items: center;
}
.friends-online li.muted { color: #6b7d99; background: none; border: none; }
.fr-addbtn { background: #2a6df0; color: #fff; border: none; border-radius: 7px; padding: 4px 9px; font-weight: 700; cursor: pointer; font-size: 12px; }
.fr-addbtn:hover { background: #3f80ff; }
.friends-cols { display: flex; gap: 14px; margin-top: 12px; text-align: left; }
.friends-cols > div { flex: 1; }
.friends-h { color: #8ba0c0; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.friends-cols ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.friends-cols li { background: #0e1622; border: 1px solid #22304a; border-radius: 8px; padding: 7px 10px; color: #dce8f7; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.friends-cols li.muted { color: #6b7d99; background: none; border: none; }
.fr-accept { background: #21b45f; color: #05210f; border: none; border-radius: 7px; padding: 4px 9px; font-weight: 700; cursor: pointer; font-size: 12px; }

/* našeptávač přátel */
.fr-ac-wrap { position: relative; flex: 1; min-width: 0; }
#friend-input {
  width: 100%; box-sizing: border-box;
  padding: 13px 14px; font-size: 16px;   /* ≥16px → iOS nezoomuje */
  color: #eaf1ff; background: #0e1622;
  border: 1px solid rgba(120,170,255,.35); border-radius: 10px; outline: none;
}
#friend-input:focus { border-color: rgba(120,170,255,.75); }
.fr-ac {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  list-style: none; margin: 0; padding: 4px;
  background: #0e1622; border: 1px solid rgba(120,170,255,.35); border-radius: 10px;
  max-height: 230px; overflow-y: auto; box-shadow: 0 10px 28px rgba(0,0,0,.55);
}
.fr-ac li {
  padding: 9px 11px; border-radius: 7px; color: #dce8f7; font-size: 15px;
  cursor: pointer; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fr-ac li:hover, .fr-ac li.active { background: #1b2942; }

/* Google login + volba jména */
.auth-or { margin: 14px 0 8px; color: #6f83a2; font-size: 12px; letter-spacing: 1px; }
.auth-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; box-sizing: border-box; padding: 11px; border-radius: 11px;
  background: #fff; color: #202124; font-weight: 700; font-size: 15px;
  text-decoration: none; border: 1px solid #dadce0;
}
.auth-google.hidden { display: none; }
.auth-google span {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0);
  color: #fff; font-weight: 900; font-size: 13px;
}
#name-modal {
  position: fixed; inset: 0; z-index: 46; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #1b2536, #06080c);
}
#name-modal.hidden { display: none; }

/* Host tlačítko + dokončení registrace */
.auth-guest-btn {
  display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 11px;
  border-radius: 11px; border: 1px solid #2b3a54; background: #0e1622; color: #cddbef;
  font-weight: 700; font-size: 15px; cursor: pointer;
}
.auth-guest-btn:hover { border-color: #6dff9e; color: #eaf2ff; }
.auth-guest-btn.hidden { display: none; }
#complete-modal {
  position: fixed; inset: 0; z-index: 46; display: flex; align-items: center; justify-content: center;
  background: rgba(4,7,12,.72);
}
#complete-modal.hidden { display: none; }
#complete-modal input {
  width: 100%; box-sizing: border-box; margin: 6px 0; padding: 12px 14px; border-radius: 10px;
  border: 1px solid #2b3a54; background: #0b1220; color: #eaf2ff; font-size: 15px;
}
#complete-modal input:focus { outline: none; border-color: #6dff9e; }
#complete-open.hidden { display: none; }

/* ---------- HUD tlačítka Přátelé / Dokončit registraci ---------- */
/* Byla uvnitř #hud (pointer-events:none) bez pozice → nešla kliknout a ležela
   přes #stats. Fixní pozice na pravém sloupci + pointer-events:auto. */
#friends-open, #complete-open {
  pointer-events: auto;
  position: fixed;
  right: 14px;
  z-index: 13;
  padding: 8px 12px;
  font-size: 13px; font-weight: 700;
  color: #cfe0ff;
  background: rgba(20,28,40,.72);
  border: 1px solid rgba(120,180,255,.5);
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
#friends-open { top: 128px; }
#complete-open { top: 166px; }
#friends-open:hover, #complete-open:hover { background: rgba(40,52,70,.85); }
/* na mobilu jsou Přátelé / Dokončit registraci v ESC menu (#esc-friends/#esc-complete),
   ať nekolidují s dotykovou vrstvou vpravo nahoře */
body.touch #friends-open, body.touch #complete-open { display: none; }

/* ---------- ESC menu (pauza) ---------- */
#esc-menu {
  position: fixed;
  inset: 0;
  z-index: 47;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4,7,12,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#esc-menu.hidden { display: none; }
.esc-box {
  width: min(90vw, 340px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 24px calc(26px + env(safe-area-inset-bottom));
  background: linear-gradient(160deg, rgba(30,42,62,.98), rgba(12,17,26,.98));
  border: 1px solid rgba(120,170,255,.3);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  text-align: center;
}
.esc-title {
  font-size: 22px; font-weight: 800; letter-spacing: 3px;
  color: #eaf1ff; margin-bottom: 6px;
}
.esc-btn {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px; font-weight: 700;
  color: #eaf1ff;
  background: linear-gradient(180deg, #2b3b57, #16202f);
  border: 1px solid rgba(120,170,255,.3);
  border-radius: 12px;
  cursor: pointer;
  transition: transform .1s, border-color .2s;
}
.esc-btn:hover { transform: translateY(-1px); border-color: rgba(120,170,255,.7); }
.esc-btn:active { transform: translateY(1px); }
.esc-btn.hidden { display: none; }
.esc-primary {
  color: #06080c;
  background: linear-gradient(180deg, #ffd479, #ffb032);
  border: none;
}
