/* ============================================================
   Stopovacka - design system
   Tmavy podklad kvuli citelnosti v terenu, mobile-first.
   ============================================================ */

:root {
  --bg: #070b11;
  --bg-2: #0b111a;
  --panel: rgba(255, 255, 255, .045);
  --panel-2: rgba(255, 255, 255, .07);
  --solid: #101825;
  --line: rgba(255, 255, 255, .10);
  --line-2: rgba(255, 255, 255, .18);

  --txt: #e9eff7;
  --muted: #8ba0b8;
  --dim: #5f7186;

  --acc: #4ade80;
  --acc-dark: #052e16;
  --acc-2: #38bdf8;
  --warn: #fbbf24;
  --err: #f87171;
  --gold: #fcd34d;

  --bar: rgba(7, 11, 17, .78);
  --glass: rgba(13, 19, 28, .88);
  --scrim: rgba(2, 5, 9, .66);
  --map-bg: #0a0f16;
  --input-bg: rgba(0, 0, 0, .28);
  --glow-1: rgba(74, 222, 128, .10);
  --glow-2: rgba(56, 189, 248, .09);

  --r-xl: 22px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

/* Svetly rezim - prepina se v menu (auto podle systemu / svetly / tmavy) */
:root[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-2: #e8eef6;
  --panel: rgba(15, 23, 35, .04);
  --panel-2: rgba(15, 23, 35, .075);
  --solid: #ffffff;
  --line: rgba(15, 23, 35, .12);
  --line-2: rgba(15, 23, 35, .2);

  --txt: #0e1620;
  --muted: #4c5c70;
  --dim: #78899d;

  --acc: #16a34a;
  --acc-dark: #f0fff6;
  --acc-2: #0284c7;
  --err: #dc2626;
  --gold: #b45309;

  --bar: rgba(255, 255, 255, .86);
  --glass: rgba(255, 255, 255, .93);
  --scrim: rgba(15, 23, 35, .38);
  --map-bg: #dfe6ee;
  --input-bg: rgba(255, 255, 255, .9);
  --glow-1: rgba(22, 163, 74, .10);
  --glow-2: rgba(2, 132, 199, .08);
  --shadow: 0 10px 30px rgba(15, 23, 35, .16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

body {
  background:
    radial-gradient(1000px 600px at 15% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, var(--glow-2), transparent 55%),
    var(--bg);
}

h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(22px, 5vw, 30px); }
h2 { font-size: clamp(18px, 4vw, 22px); }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
a { color: var(--acc-2); }
svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
#app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
  background: var(--bar);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 30;
}

.brand {
  display: flex; align-items: center; gap: 9px;
  background: none; border: 0; color: var(--txt); cursor: pointer;
  font-size: 17px; font-weight: 800; letter-spacing: .2px; padding: 0;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--acc); position: relative; flex: none;
  box-shadow: 0 0 12px rgba(74, 222, 128, .45);
}
.brand-mark::after {
  content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--acc);
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--txt);
  border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.chip-points { color: var(--acc); border-color: rgba(74, 222, 128, .35); }

/* Prezdivka prihlaseneho hrace. Na uzkem displeji se dlouhe jmeno orizne,
   at nevytlaci body a menu z listy. */
.chip-user { display: flex; align-items: center; gap: 6px; max-width: 38vw; font-weight: 600; }
.chip-user > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-role {
  flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--acc); border: 1px solid rgba(74, 222, 128, .35);
  border-radius: 999px; padding: 1px 6px;
}
.chip-role:empty { display: none; }

.icon-btn {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--panel); color: var(--txt);
  border-radius: 12px; cursor: pointer; padding: 9px;
}
.icon-btn:active { background: var(--panel-2); }

/* isolation: Leaflet i spodni lista mapy maji vysoke z-index (panely 200-800,
   .map-bar 900). Bez vlastniho stackovaciho kontextu prosakuji do korene
   stranky a prekryji formulare (z-index 100), toasty i menu - na mobilu pak
   z "Noveho mista" koukalo jen zelene tlacitko pod listou mapy. */
#views { position: relative; overflow: hidden; isolation: isolate; }

.view { position: absolute; inset: 0; display: none; }
.view.active { display: block; }
.view.scroll { overflow-y: auto; overflow-x: hidden; padding: 16px 14px 26px; -webkit-overflow-scrolling: touch; }
.view.fill { overflow: hidden; }

.tabbar {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--bar);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  position: relative; z-index: 30;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 0; color: var(--dim); cursor: pointer;
  padding: 9px 4px 8px; font-size: 11px; font-weight: 600;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--acc); }
.tab.active svg { filter: drop-shadow(0 0 8px rgba(74, 222, 128, .5)); }

/* ---------- Komponenty ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px; margin-bottom: 12px;
}
.card.tight { padding: 12px; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.card-title h2, .card-title h3 { margin: 0; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.btn {
  border: 0; border-radius: var(--r-md); padding: 12px 16px;
  font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #5df08e, #37c96e); color: var(--acc-dark); }
.btn-ghost { background: var(--panel-2); color: var(--txt); border: 1px solid var(--line); }
.btn-danger { background: rgba(248, 113, 113, .16); color: #fca5a5; border: 1px solid rgba(248, 113, 113, .35); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.ok { background: rgba(74, 222, 128, .14); color: var(--acc); border-color: rgba(74, 222, 128, .3); }
.badge.warn { background: rgba(251, 191, 36, .14); color: var(--warn); border-color: rgba(251, 191, 36, .3); }
.badge.err { background: rgba(248, 113, 113, .14); color: var(--err); border-color: rgba(248, 113, 113, .3); }
.badge.info { background: rgba(56, 189, 248, .14); color: var(--acc-2); border-color: rgba(56, 189, 248, .3); }

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.right { margin-left: auto; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }
/* display z trid (flex, grid) je silnejsi nez atribut hidden - bez tohohle
   by schovane panely dal zabiraly misto. */
[hidden] { display: none !important; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 2px 10px; }
.section-head:first-child { margin-top: 4px; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; padding: 12px 13px; font-size: 16px; font-family: inherit;
  background: var(--input-bg); color: var(--txt);
  border: 1px solid var(--line-2); border-radius: var(--r-md); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(74, 222, 128, .16); }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
/* Na uzkem displeji se tri pole vedle sebe zmackala tak, ze se nedaly precist
   popisky - pod 130 px se radek radeji zalomi. */
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row > * { flex: 1 1 130px; min-width: 0; }

/* Sbalitelna cast formulare. Dlouhy formular se na telefonu neda projit,
   tak jsou veci, ktere se skoro nemeni, schovane pod souhrnem. */
.more { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); margin-bottom: 12px; }
.more > summary {
  list-style: none; cursor: pointer; padding: 11px 12px; display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: '⌄'; margin-left: auto; font-size: 16px; line-height: 1; transition: transform .15s; }
.more[open] > summary::after { transform: rotate(180deg); }
.more > summary .v {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px; font-weight: 600; color: var(--txt);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.more-body { padding: 0 12px 6px; }
.more-body > .field:last-child, .more-body > .switch:last-child { margin-bottom: 0; }

/* Oko pro odkryti hesla. Sedi v poli vpravo, text hesla mu uhne odsazenim. */
.pass-wrap { position: relative; display: block; }
.pass-wrap > input { padding-right: 46px; }
.pass-eye {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  width: 38px; height: 38px; display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--dim); cursor: pointer; padding: 0;
}
.pass-eye:hover { color: var(--txt); }
.pass-eye:active { background: var(--panel-2); }
.pass-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 0; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); position: relative; margin: 0; flex: none; cursor: pointer; transition: background .15s; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--dim); transition: transform .15s, background .15s; }
.switch input:checked { background: rgba(74, 222, 128, .3); border-color: rgba(74, 222, 128, .5); }
.switch input:checked::after { transform: translateX(18px); background: var(--acc); }
.switch span { font-size: 14px; }
/* Prepinac, ktery si rezim mista vynucuje sam (AR brana) - at je videt, ze s nim nehnes. */
.switch.off { opacity: .5; cursor: default; }
.switch.off input { cursor: default; }

.progress { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc-2)); border-radius: 999px; transition: width .4s ease; }

.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .7; }

/* ---------- Karta stopovacky / mista ---------- */
.hunt-card { display: block; width: 100%; text-align: left; cursor: pointer; }
.hunt-card .ico, .place .ico {
  width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center;
  background: var(--panel-2); font-size: 21px; border: 1px solid var(--line);
}

.place {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 12px; margin-bottom: 10px;
}
.place.found { border-color: rgba(74, 222, 128, .35); background: rgba(74, 222, 128, .07); }
.place.active { border-color: rgba(56, 189, 248, .5); box-shadow: 0 0 0 2px rgba(56, 189, 248, .12); }
.place .body { flex: 1; min-width: 0; }
.place .name { font-weight: 700; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.place .hint { color: var(--muted); font-size: 13px; margin-top: 3px; }
.place .meta { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.place .acts { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.pts { color: var(--gold); font-weight: 800; }

/* ---------- Zebricek ---------- */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.lb-row:last-child { border-bottom: 0; }
.lb-row.me { background: rgba(74, 222, 128, .08); border-radius: var(--r-md); }
.lb-rank { width: 28px; text-align: center; font-weight: 800; color: var(--dim); flex: none; }
.lb-row:nth-child(1) .lb-rank { color: var(--gold); }
.lb-row:nth-child(2) .lb-rank { color: #cbd5e1; }
.lb-row:nth-child(3) .lb-rank { color: #d5a06a; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* ---------- Mapa ---------- */
#map { position: absolute; inset: 0; background: var(--map-bg); }
.leaflet-container { background: var(--map-bg); font-family: inherit; }
.leaflet-control-zoom a { background: var(--glass) !important; color: var(--txt) !important; border-color: var(--line) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--solid); color: var(--txt); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; }
.leaflet-popup-content b { display: block; margin-bottom: 4px; }
.leaflet-popup-content .btn { margin-top: 8px; }
.leaflet-bar a { color: var(--txt); }

.me-marker { pointer-events: none; }
.me-rot { width: 100%; height: 100%; transform-origin: 50% 50%; transition: transform .18s cubic-bezier(0.15, 0.85, 0.35, 1); }
.me-cone {
  position: absolute; left: 50%; top: 50%; width: 80px; height: 80px;
  margin-left: -40px; margin-top: -80px;
  background: radial-gradient(ellipse at 50% 100%, rgba(74, 222, 128, .55) 0%, rgba(74, 222, 128, 0) 65%);
  clip-path: polygon(50% 100%, 100% 0, 0 0);
}
.me-dot {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
  margin-left: -7px; margin-top: -7px; border-radius: 50%;
  background: var(--acc); box-shadow: 0 0 0 3px rgba(11, 15, 20, .85), 0 0 10px rgba(74, 222, 128, .7);
}

.pt-marker { pointer-events: auto; }
.pt-pin {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 6px; transform: rotate(-45deg);
  display: grid; place-items: center; font-size: 15px;
  background: linear-gradient(160deg, #38bdf8, #0ea5e9); color: #04212f;
  border: 2px solid rgba(255, 255, 255, .5); box-shadow: 0 6px 14px rgba(0, 0, 0, .5);
}
.pt-pin > span { transform: rotate(45deg); }
.pt-marker.found .pt-pin { background: linear-gradient(160deg, #86efac, #22c55e); color: #052e16; }
.pt-marker.target .pt-pin { background: linear-gradient(160deg, #fde68a, #f59e0b); color: #422006; animation: pulse 1.6s infinite; }
/* Koncept noveho mista - jeste neni ulozeny, proto carkovany okraj a pulzovani. */
.pt-marker.draft .pt-pin {
  background: linear-gradient(160deg, #fdba74, #f97316); color: #431407;
  border-style: dashed; border-color: rgba(255, 255, 255, .85);
  animation: pulse 1.6s infinite; cursor: grab;
}
.pt-marker.draft:active .pt-pin { cursor: grabbing; }
@keyframes pulse { 0%, 100% { box-shadow: 0 6px 14px rgba(0, 0, 0, .5); } 50% { box-shadow: 0 6px 22px rgba(245, 158, 11, .8); } }

/* Mapa v prehledu organizatora - hraci, kteri sdileji polohu */
.dash-map {
  height: 340px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2);
}
.dash-player { pointer-events: auto; }
.dash-dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(160deg, #fde68a, #f59e0b); color: #422006;
  border: 2px solid rgba(255, 255, 255, .65); box-shadow: 0 6px 14px rgba(0, 0, 0, .5);
}
.dash-player.stale .dash-dot { opacity: .45; background: linear-gradient(160deg, #cbd5e1, #94a3b8); color: #1e293b; }
.stat.warn b { color: var(--warn); }

/* Zamerovaci kriz uprostred mapy - ukazuje se jen pri pridavani mista, kde se
   bod da polozit posunutim mapy pod kriz (na mobilu presnejsi nez tapnuti
   prstem). Drzime ho decentni, at neprekryva mapu. */
.map-cross {
  position: absolute; z-index: 450; left: 50%; top: 50%; width: 34px; height: 34px;
  margin: -17px 0 0 -17px; pointer-events: none; opacity: .5;
}
.map-cross::before, .map-cross::after {
  content: ''; position: absolute; background: var(--txt);
}
.map-cross::before { left: 50%; top: 0; bottom: 0; width: 1px; margin-left: -.5px; }
.map-cross::after { top: 50%; left: 0; right: 0; height: 1px; margin-top: -.5px; }
.map-cross > i {
  position: absolute; inset: 11px; border: 1.5px solid var(--acc); border-radius: 50%;
}

.map-tools {
  position: absolute; z-index: 900; right: 10px; top: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.tool-btn {
  width: 42px; height: 42px; flex: none; padding: 10px; border-radius: 12px; cursor: pointer;
  background: var(--glass); backdrop-filter: blur(10px);
  border: 1px solid var(--line); color: var(--txt); display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
.tool-btn:active { transform: scale(.94); }
.tool-btn.on { background: var(--err); color: #2b0a0a; border-color: transparent; }
/* Vyber bodu pod krizem sedi ve spodni liste, kde uz zadny stin nepotrebuje. */
.tool-btn.pick { width: 38px; height: 38px; padding: 8px; box-shadow: none; background: var(--panel-2); }

.map-bar {
  position: absolute; z-index: 900; left: 10px; right: 10px; bottom: 10px;
  border-radius: var(--r-lg); padding: 8px 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.map-row { display: flex; gap: 8px; align-items: center; }
.map-row .grow { flex: 1; min-width: 0; }
.map-info {
  flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.3; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  max-height: 33px;
}
.map-info b { color: var(--txt); }

.calib-panel { border-top: 1px solid var(--line); padding-top: 8px; }
/* Jemna korekce konceptu mista - sipky vlevo, potvrzeni vpravo. Na uzkem
   telefonu se rada zalomi radeji, nez by se tlacitka smackla na nic. */
.addpoint-panel { border-top: 1px solid var(--line); padding-top: 8px; flex-wrap: wrap; }
.addpoint-panel .nudge { display: flex; gap: 4px; flex: none; }
.addpoint-panel .mini { padding: 7px 8px; line-height: 1; font-size: 13px; }
.addpoint-panel .btn-sm { flex: none; padding: 8px 10px; }
.addpoint-panel .grow { min-width: 40px; }
.mini {
  border: 0; border-radius: 9px; background: var(--panel-2); color: var(--txt);
  font-weight: 700; font-size: 14px; padding: 7px 12px; cursor: pointer; flex: none;
}
.calib-val { min-width: 44px; text-align: center; font-weight: 700; font-size: 13px; }

/* Na dotykovem displeji (i na uzkem) se zoomuje prsty - tlacitka jen zabiraji roh mapy. */
@media (pointer: coarse), (max-width: 700px) {
  .leaflet-control-zoom { display: none; }
}
/* Atribuce musi zustat (licence OSM), ale nema sedet na spodni liste. */
.leaflet-control-attribution {
  font-size: 10px; opacity: .75; padding: 1px 5px;
  background: var(--glass) !important; color: var(--muted) !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }
/* --mapbar-h dopocitava map.js podle skutecne vysky spodni listy */
.leaflet-bottom.leaflet-right { bottom: calc(var(--mapbar-h, 58px) + 14px); right: 2px; }

/* ---------- Radar ---------- */
#radar {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 14px; text-align: center;
}
.radar-head { min-height: 44px; }
.radar-target { font-size: 18px; font-weight: 800; }
.radar-sub { font-size: 13px; color: var(--muted); }

.compass { position: relative; width: min(78vw, 320px); height: min(78vw, 320px); flex: none; }
.dial {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #0f1620 0%, #080d14 72%);
  border: 3px solid #1b2532; box-shadow: inset 0 0 40px rgba(74, 222, 128, .08), 0 10px 40px rgba(0, 0, 0, .5);
}
.ring { position: absolute; inset: 0; will-change: transform; transition: none; }
.tick { position: absolute; left: 50%; top: 6px; width: 2px; height: 12px; background: #2c3a49; transform-origin: 50% calc(min(39vw, 160px) - 6px); }
.card-label { position: absolute; left: 50%; transform: translateX(-50%); font-weight: 700; color: #6b7888; font-size: 14px; }
.lbl-n { top: 18px; color: var(--err); }
.lbl-e { right: 18px; top: 50%; left: auto; transform: translateY(-50%); }
.lbl-s { bottom: 18px; }
.lbl-w { left: 18px; top: 50%; transform: translateY(-50%); }

.needle { position: absolute; left: 50%; top: 50%; width: 0; height: 0; will-change: transform; transition: none; }
.needle .arrow {
  position: absolute; left: -14px; top: calc(-1 * min(32vw, 132px));
  width: 28px; height: min(32vw, 132px);
  background: linear-gradient(to top, rgba(74, 222, 128, 0) 0%, var(--acc) 60%, #bbf7d0 100%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.needle .hub { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 12px var(--acc); }

.level {
  position: absolute; left: 50%; top: 50%; width: 84px; height: 84px;
  margin-left: -42px; margin-top: -42px; border-radius: 50%;
  border: 2px solid rgba(140, 160, 180, .35);
  background: radial-gradient(circle, rgba(20, 28, 38, .55) 0%, rgba(20, 28, 38, .15) 70%, transparent 100%);
  pointer-events: none;
}
.level::before, .level::after { content: ''; position: absolute; background: rgba(140, 160, 180, .25); }
.level::before { left: 50%; top: 8px; bottom: 8px; width: 1px; margin-left: -.5px; }
.level::after { top: 50%; left: 8px; right: 8px; height: 1px; margin-top: -.5px; }
.bubble {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px;
  margin-left: -11px; margin-top: -11px; border-radius: 50%;
  background: #94a3b8; box-shadow: 0 0 0 2px rgba(11, 15, 20, .7), 0 0 8px rgba(148, 163, 184, .6);
  transition: transform .15s ease-out, background-color .15s linear, box-shadow .15s linear;
}
.bubble.level-ok { background: var(--acc); box-shadow: 0 0 0 2px rgba(11, 15, 20, .7), 0 0 14px rgba(74, 222, 128, .9); }

.readout .dist { font-size: clamp(34px, 11vw, 48px); font-weight: 800; color: var(--acc); line-height: 1; }
.readout .sub { margin-top: 6px; font-size: 14px; color: var(--muted); }
.radar-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.status { font-size: 13px; color: var(--muted); min-height: 18px; padding: 0 16px; }
.arrived { color: var(--acc) !important; font-weight: 700; }

/* ---------- AR ---------- */
#ar-stage { position: absolute; inset: 0; overflow: hidden; background: #05080d; }
#ar-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#ar-overlay { position: absolute; inset: 0; pointer-events: none; }

.ar-poi {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: left .18s cubic-bezier(0.15, 0.85, 0.35, 1), top .18s cubic-bezier(0.15, 0.85, 0.35, 1), opacity .2s;
}
.ar-poi .ring2 {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 22px;
  border: 2px solid rgba(56, 189, 248, .9); background: rgba(8, 15, 24, .55);
  backdrop-filter: blur(3px); box-shadow: 0 0 22px rgba(56, 189, 248, .5);
}
.ar-poi.found .ring2 { border-color: rgba(74, 222, 128, .9); box-shadow: 0 0 22px rgba(74, 222, 128, .45); }
.ar-poi.near .ring2 { border-color: var(--gold); box-shadow: 0 0 26px rgba(252, 211, 77, .7); animation: pulse 1.4s infinite; }
/* AR brana - checkpoint, ktery jinde nez v kamere neni videt. Krouzi kolem
   sebe, at je v obraze poznat na prvni pohled; dokud hrac neni v radiusu,
   je zeslabena a jen ukazuje, kam dojit. */
/* Toci se jen vnejsi prstenec (::before), ikona uvnitr zustava vzpricena. */
.ar-poi.gate .ring2 {
  position: relative; border-color: rgba(167, 139, 250, .55);
  box-shadow: 0 0 26px rgba(167, 139, 250, .5), inset 0 0 18px rgba(167, 139, 250, .3);
  animation: none;
}
.ar-poi.gate .ring2::before {
  content: ''; position: absolute; inset: -7px; border-radius: 50%;
  border: 3px dashed rgba(167, 139, 250, .95);
  animation: gate-spin 7s linear infinite;
}
@keyframes gate-spin { to { transform: rotate(360deg); } }
.ar-poi.gate.locked { opacity: .5; }
.ar-poi.gate.locked .ring2 { box-shadow: none; }
.ar-poi.gate.locked .ring2::before { animation-duration: 18s; border-color: rgba(167, 139, 250, .5); }
.ar-poi.gate.near .ring2 {
  border-color: rgba(252, 211, 77, .7);
  box-shadow: 0 0 34px rgba(252, 211, 77, .8), inset 0 0 20px rgba(252, 211, 77, .35);
}
.ar-poi.gate.near .ring2::before { border-color: var(--gold); animation-duration: 2.4s; }
.ar-poi.gate.found .ring2::before { animation: none; border-style: solid; border-color: rgba(74, 222, 128, .9); }

.ar-poi .lbl {
  background: rgba(8, 13, 20, .82); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 11px; font-size: 12px; font-weight: 700; white-space: nowrap; max-width: 46vw;
  overflow: hidden; text-overflow: ellipsis;
}
.ar-poi .dst { font-size: 11px; color: var(--acc-2); font-weight: 700; text-shadow: 0 1px 4px #000; }

.ar-edge { position: absolute; top: 50%; transform: translateY(-50%); font-size: 26px; opacity: .85; }

.ar-bar {
  position: absolute; left: 12px; right: 12px; bottom: 12px; border-radius: var(--r-lg);
  padding: 11px 12px; display: flex; gap: 10px; align-items: center; z-index: 5;
}
.ar-info { flex: 1; font-size: 13px; color: var(--muted); min-width: 0; }
.ar-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 26px; background: rgba(5, 8, 13, .9); z-index: 6;
}
.ar-empty p { color: var(--muted); max-width: 340px; }

#ar-scanbox { position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; background: rgba(0, 0, 0, .35); }
.scan-frame {
  width: min(70vw, 260px); height: min(70vw, 260px); border-radius: 22px;
  border: 3px solid var(--acc); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45);
}
.scan-hint { position: absolute; bottom: 26%; font-weight: 700; text-shadow: 0 2px 8px #000; }

/* ---------- Sheet (modal) ---------- */
.sheet-back {
  position: fixed; inset: 0; z-index: 100; background: var(--scrim);
  backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(28px); opacity: .4; } }
/* Roluje vnitrek, ne cely panel - hlavicka zustava videt a spodni lista
   s ulozenim se da prilepit na dno (viz .sheet-actions). */
.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--solid); border: 1px solid var(--line);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 16px 16px calc(18px + var(--safe-b));
  box-shadow: var(--shadow); animation: rise .22s ease;
}
.sheet-body { overflow-y: auto; flex: 1; min-height: 0; }

/* Potvrzeni dlouheho formulare. Bez toho konci tlacitko az za koncem obsahu
   a na telefonu to vypada, ze zadat se da, ale ulozit ne. */
.sheet-actions {
  position: sticky; bottom: 0; z-index: 1;
  margin: 14px -16px calc(-18px - var(--safe-b));
  padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--solid); border-top: 1px solid var(--line);
}

.sheet-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { flex: 1; }
.sheet-close { border: 0; background: var(--panel-2); color: var(--txt); width: 32px; height: 32px; border-radius: 50%; font-size: 18px; cursor: pointer; flex: none; line-height: 1; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(78px + var(--safe-b)); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--solid); border: 1px solid var(--line-2); color: var(--txt);
  padding: 11px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); animation: rise .2s ease; max-width: 90vw; text-align: center;
}
.toast.ok { border-color: rgba(74, 222, 128, .5); color: #d7ffe6; }
.toast.err { border-color: rgba(248, 113, 113, .5); color: #ffdcdc; }

/* ---------- Oslava nalezu ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(105dvh) rotate(720deg); opacity: .2; } }

/* ---------- QR ---------- */
.qr-box { background: #fff; padding: 14px; border-radius: var(--r-md); display: grid; place-items: center; }
.qr-box svg { width: 100%; height: auto; max-width: 260px; stroke: none; }
.qr-code-txt { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 26px; font-weight: 800; letter-spacing: 4px; text-align: center; color: var(--acc); }

/* ---------- Pravidla (jednoduchy markdown) ---------- */
.doc h2 { margin-top: 20px; color: var(--acc); font-size: 18px; }
.doc h2:first-child { margin-top: 0; }
.doc ul, .doc ol { margin: 0 0 12px; padding-left: 22px; }
.doc li { margin-bottom: 5px; }
.doc p { color: var(--muted); }

/* ---------- Sprava ---------- */
.adm-list { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.adm-item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.adm-item:last-child { border-bottom: 0; }

/* Radek hrace ve Sprave: jmeno nahore, ovladani (role, heslo, mazani) pod nim,
   at se na uzkem displeji nemackaji do jedne rady a role je videt. */
.adm-player { flex-direction: column; align-items: stretch; gap: 8px; }
.adm-player-actions { gap: 8px; }
.role-pick { display: flex; align-items: center; gap: 6px; }
.role-pick > span { font-size: 12px; font-weight: 700; color: var(--dim); }
.role-pick select { width: auto; padding: 6px 26px 6px 8px; font-size: 12px; }
.adm-item .grow { flex: 1; min-width: 0; }
.adm-item .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; text-align: center; }
.stat b { display: block; font-size: 22px; color: var(--acc); }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- Menu ---------- */
.menu {
  position: absolute; right: 12px; top: calc(var(--safe-t) + 58px); z-index: 60;
  background: var(--solid); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); overflow: hidden; min-width: 210px; animation: rise .15s ease;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; color: var(--txt); padding: 13px 15px; font-size: 15px; cursor: pointer;
  border-bottom: 1px solid var(--line); font-family: inherit;
}
.menu button:last-child { border-bottom: 0; }
.menu button:active { background: var(--panel-2); }
.menu svg { width: 19px; height: 19px; flex: none; color: var(--muted); }

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  #app { grid-template-columns: 232px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .tabbar {
    grid-row: 2; grid-column: 1; display: flex; flex-direction: column;
    border-top: 0; border-right: 1px solid var(--line); padding: 12px 10px; gap: 4px;
  }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 12px 14px; border-radius: var(--r-md); }
  .tab.active { background: rgba(74, 222, 128, .1); }
  #views { grid-row: 2; grid-column: 2; }
  .view.scroll { padding: 22px 26px 40px; }
  .view.scroll > * { max-width: 880px; margin-left: auto; margin-right: auto; }
  #toast-root { bottom: 26px; }
  .sheet-back { align-items: center; }
  .sheet { border-radius: var(--r-xl); max-height: 82dvh; }
}

/* ---------- Doladeni pro svetly rezim ---------- */
:root[data-theme="light"] {
  --warn: #b45309;
}
:root[data-theme="light"] .btn-danger { background: rgba(220, 38, 38, .1); color: #b91c1c; border-color: rgba(220, 38, 38, .3); }
:root[data-theme="light"] .badge.ok { background: rgba(22, 163, 74, .12); border-color: rgba(22, 163, 74, .3); }
:root[data-theme="light"] .badge.warn { background: rgba(180, 83, 9, .12); border-color: rgba(180, 83, 9, .3); }
:root[data-theme="light"] .badge.err { background: rgba(220, 38, 38, .12); border-color: rgba(220, 38, 38, .3); }
:root[data-theme="light"] .badge.info { background: rgba(2, 132, 199, .12); border-color: rgba(2, 132, 199, .3); }
:root[data-theme="light"] .btn-primary { background: linear-gradient(180deg, #22c55e, #15803d); color: #fff; }
:root[data-theme="light"] .chip-points { border-color: rgba(22, 163, 74, .4); }
:root[data-theme="light"] .lb-row.me { background: rgba(22, 163, 74, .1); }
:root[data-theme="light"] .place.found { background: rgba(22, 163, 74, .08); border-color: rgba(22, 163, 74, .3); }
:root[data-theme="light"] .card { background: #fff; }
:root[data-theme="light"] .adm-item { background: #fff; }
:root[data-theme="light"] .stat { background: #fff; }
:root[data-theme="light"] .qr-code-txt { color: #15803d; }

/* ---------- Nabidka druhu mista ---------- */
.type-list { display: flex; flex-direction: column; gap: 8px; }
.type-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 12px; cursor: pointer; color: var(--txt); font-family: inherit; font-size: 15px;
  transition: transform .08s ease, border-color .15s ease;
}
.type-item:active { transform: scale(.98); }
.type-item:hover { border-color: var(--line-2); }
.type-ico {
  width: 44px; height: 44px; flex: none; border-radius: 13px; display: grid; place-items: center;
  font-size: 22px; background: var(--panel-2); border: 1px solid var(--line);
}
.type-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.type-txt b { font-weight: 700; }

/* ---------- Zamcene misto, fotky, obtiznost ---------- */
.place.locked { opacity: .62; }
.place.locked .ico { background: var(--panel); }
.photo-thumb { width: 100%; max-height: 240px; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); display: block; }
.photo-mini { width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); flex: none; }
.diff { letter-spacing: 2px; }

/* ---------- Ohleduplnost k pohybu ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .ring, .needle, .me-rot { transition: none !important; }
}

/* ---------- Tisk QR cedulek ---------- */
@media print {
  body { background: #fff; color: #000; }
  #app, #toast-root, .sheet-close, .no-print { display: none !important; }
  .sheet-back { position: static; background: none; backdrop-filter: none; }
  .sheet { background: #fff; color: #000; border: 0; box-shadow: none; max-height: none; }
  .qr-code-txt { color: #000; }
}
