/* WayBack — Grafana-like dark UI */
:root, [data-theme="dark"] {
  --bg: #111217;
  --panel: #181b1f;
  --panel2: #22252b;
  --border: rgba(204, 204, 220, .12);
  --border2: rgba(204, 204, 220, .22);
  --text: #ccccdc;
  --strong: #ffffff;
  --muted: #8e8e9e;
  --blue: #6e9fff;
  --blue-bg: #3d71d9;
  --green: #73bf69;
  --orange: #ff9830;
  --red: #f2495c;
  --yellow: #fade2a;
  --shadow: 0 8px 24px rgba(0, 0, 0, .45);
  --tile-filter: brightness(.82) contrast(1.08) saturate(.9);
}
[data-theme="light"] {
  --bg: #f4f5f5;
  --panel: #ffffff;
  --panel2: #f0f1f3;
  --border: rgba(36, 41, 46, .12);
  --border2: rgba(36, 41, 46, .25);
  --text: #24292e;
  --strong: #000;
  --muted: #6e6e80;
  --blue: #1f62e0;
  --blue-bg: #3d71d9;
  --green: #1a7f4b;
  --orange: #d9660f;
  --red: #d10e5c;
  --yellow: #b89000;
  --shadow: 0 8px 24px rgba(0, 0, 0, .18);
  --tile-filter: none;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.4 Inter, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex; flex-direction: column; height: 100dvh;
  padding-top: env(safe-area-inset-top);
}
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* header */
/* Кнопки тримаємо мінімальними: на телефоні карта важливіша за кнопки,
   тож усе службове стиснуте до розміру, за який ще впевнено влучає палець. */
.top {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 8px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.logo { font-size: 17px; }
.brand-txt b { display: block; color: var(--strong); font-size: 13px; letter-spacing: .2px; }
.brand-txt small { display: block; color: var(--muted); font-size: 11px; margin-top: -1px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--strong); font-size: 15px;
  display: grid; place-items: center; flex: none;
}
.icon-btn svg { width: 19px; height: 19px; display: block; }
.icon-btn:active { background: var(--border2); transform: scale(.93); }
.icon-btn:disabled { opacity: .55; }
.icon-btn.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* очищення - дія руйнівна, тож підсвічуємо теплим */

/* швидкі перемикачі під панелями: середовище і спосіб руху.
   Один ряд, щоб не з'їдати карту. */
.quick { display: flex; gap: 4px; padding: 0 5px 5px; background: var(--bg); }
.quick .qseg { flex: 1 1 0; min-width: 0; }
.quick .qseg:first-child { flex: 1.5 1 0; }
.qseg button {
  padding: 5px 2px; font-size: 11px; gap: 3px; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap; overflow: hidden;
}
.qseg button span { font-size: 12px; }
@media (max-width: 370px) { .qseg button { font-size: 10px; gap: 2px; } .qseg button span { font-size: 11px; } }
@media (max-width: 345px) { .qseg button { font-size: 9.5px; gap: 2px; padding: 5px 1px; } .qseg button span { font-size: 11px; } }

/* stat panels */
.stats { display: grid; grid-template-columns: 1.35fr 1.1fr .85fr .75fr; gap: 4px; padding: 5px; background: var(--bg); }
/* панель-кнопка: виглядає як сусіди, але натискається */
.panel.tap { text-align: left; font: inherit; cursor: pointer; }
.panel.tap:active { background: var(--panel2); transform: scale(.96); }
.c-violet { color: #b388ff; }
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 6px 5px; min-width: 0;
}
.p-title { font-size: 11px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-val {
  font-size: 17px; font-weight: 600; color: var(--strong); line-height: 1.15; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 4px;
}
#vDist { color: var(--green); }
.c-blue { color: var(--blue); }
.c-orange { color: var(--orange); }
.c-green { color: var(--green); }
.c-yellow { color: var(--yellow); }
.c-red { color: var(--red); }
.mini-arrow { display: inline-block; color: var(--green); font-size: 13px; transition: transform .25s; transform: rotate(-90deg); }
.mini-arrow.off { opacity: .25; }
#pTarget { cursor: pointer; }

/* map */
.map-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 0; background: #e8e6e1; }
.leaflet-container { font: inherit; background: #e8e6e1; }
.wb-tile { overflow: hidden; }
.wb-tile img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; image-rendering: auto; }
.leaflet-control-attribution { font-size: 9px; background: rgba(17,18,23,.6) !important; color: #aaa; }
.leaflet-control-attribution a { color: #bbb; }
[data-theme="light"] .leaflet-control-attribution { background: rgba(255,255,255,.7) !important; color: #555; }

.fabs { position: absolute; right: 8px; top: 8px; z-index: 500; display: flex; flex-direction: column; gap: 5px; }
.fab {
  width: 42px; height: 42px; border-radius: 5px; background: var(--panel); border: 1px solid var(--border2);
  font-size: 19px; box-shadow: var(--shadow); display: grid; place-items: center; color: var(--text);
}
.fab.on { color: var(--blue); border-color: var(--blue); }

.rec-badge {
  position: absolute; left: 8px; top: 70px; z-index: 500; display: flex; align-items: center; gap: 5px;
  background: var(--panel); border: 1px solid var(--red); color: var(--red); font-weight: 600; font-size: 9.5px;
  padding: 3px 7px; border-radius: 3px; letter-spacing: .5px;
}
.rec-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* markers */
.me { position: relative; width: 26px; height: 26px; }
.me-dot { position: absolute; left: 6px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: #3d8bff; border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(61,139,255,.35); }
.me-dir { position: absolute; inset: -14px; display: none; }
.me-dir.on { display: block; }
.me-dir::before {
  content: ""; position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  border-left: 11px solid transparent; border-right: 11px solid transparent; border-bottom: 22px solid rgba(61,139,255,.55);
}
.pin { position: relative; width: 34px; height: 42px; }
.pin::before {
  content: ""; position: absolute; left: 3px; top: 0; width: 28px; height: 28px;
  background: var(--panel); border: 2px solid var(--blue); border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  box-shadow: 0 3px 8px rgba(0,0,0,.4);
}
.pin span { position: absolute; left: 0; top: 4px; width: 34px; text-align: center; font-size: 15px; }
.pin.tgt::before { border-color: var(--green); box-shadow: 0 0 0 4px rgba(115,191,105,.3), 0 3px 8px rgba(0,0,0,.4); }
.pin-label {
  position: absolute; top: 32px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--panel); color: var(--text); border: 1px solid var(--border2); font-size: 10px; padding: 0 5px; border-radius: 3px;
}

/* bottom bar */
.bottom {
  display: grid; grid-template-columns: 1fr 1.2fr 1fr 1fr; gap: 4px; padding: 4px 5px calc(4px + env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--border);
}
/* 40 px - нижня межа, за яку палець ще влучає не задумуючись */
.bbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  height: 40px; border-radius: 4px; border: 1px solid var(--border); background: var(--panel2);
  font-size: 10px; font-weight: 500;
}
.bbtn .ico { font-size: 15px; line-height: 1.05; }
.bbtn.primary { background: var(--blue-bg); border-color: var(--blue-bg); color: #fff; font-weight: 600; }
.bbtn.stop { background: var(--red); border-color: var(--red); color: #fff; }
.bbtn.on { border-color: var(--green); color: var(--green); }
.bbtn:active, .btn:active, .fab:active { transform: scale(.97); }

/* nav card */
.nav { position: absolute; left: 0; right: 0; bottom: 0; z-index: 600; padding: 8px; pointer-events: none; }
.nav-card {
  pointer-events: auto; background: var(--panel); border: 1px solid var(--border2); border-radius: 6px;
  box-shadow: var(--shadow); padding: 10px 12px 12px; max-width: 560px; margin: 0 auto;
}
.nav-head { display: flex; justify-content: space-between; align-items: flex-start; }
.nav-name { font-size: 16px; font-weight: 600; color: var(--strong); }
.nav-body { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.compass { width: min(46vw, 190px); height: min(46vw, 190px); flex: none; }
.compass .ring { fill: var(--panel2); stroke: var(--border2); stroke-width: 2; }
.compass .tick { stroke: var(--muted); stroke-width: 1.5; }
.compass .tick.major { stroke: var(--text); stroke-width: 2.5; }
.compass text { text-anchor: middle; dominant-baseline: middle; font-weight: 700; font-size: 15px; fill: var(--muted); }
.compass .card-n { fill: var(--red); font-size: 18px; }
.compass .arrow { fill: var(--green); stroke: rgba(0,0,0,.35); stroke-width: 1.5; stroke-linejoin: round; }
.compass .arrow.north { fill: var(--yellow); }
.compass .hub { fill: var(--panel); stroke: var(--text); stroke-width: 2; }
#rose, #arrow { transition: transform .2s linear; }
.nav-info { min-width: 0; flex: 1; }
.nav-dist { font-size: 34px; font-weight: 700; color: var(--green); line-height: 1.1; font-variant-numeric: tabular-nums; }
.nav-dist.arrived { font-size: 24px; }
.nav-sub { color: var(--text); margin-top: 4px; font-size: 13px; }
.nav-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.nav-hint button { margin-top: 6px; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 1000; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.sheet-body {
  /* однакова висота для всіх вкладок і для архіву: вікно не «стрибає», довге прокручується всередині */
  position: absolute; left: 0; right: 0; bottom: 0; height: 88vh; height: 88dvh; overflow-y: auto;
  background: var(--bg); border-top: 1px solid var(--border2); border-radius: 10px 10px 0 0;
  padding: 0 12px calc(16px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.sheet-head h2 { margin: 0; font-size: 18px; color: var(--strong); }
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 10px; position: sticky; top: 56px; background: var(--bg); z-index: 2; }
.tabs button { flex: 1; background: none; border: 0; padding: 9px 4px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button.on { color: var(--strong); border-bottom-color: var(--orange); }

.sec-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 14px 0 6px; font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 10px; margin-bottom: 10px; }
.note { color: var(--muted); font-size: 12px; margin: 8px 2px; }
.field { margin: 8px 0; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.kv { display: flex; justify-content: space-between; align-items: center; }
.kv b { color: var(--strong); }
.dl-info { font-size: 12px; color: var(--text); margin: 8px 0; }

.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--border2); border-radius: 4px; overflow: hidden; }
.seg button { flex: 1; background: var(--panel2); border: 0; border-right: 1px solid var(--border); padding: 8px 4px; font-size: 13px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--blue-bg); color: #fff; }
.seg.small button { padding: 5px 9px; font-size: 12px; }

.list { display: flex; flex-direction: column; gap: 6px; }
.item {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 10px;
}
.item.tgt { border-color: var(--green); }
.i-ico { font-size: 20px; width: 28px; text-align: center; flex: none; }
.i-main { flex: 1; min-width: 0; }
.i-main b { display: block; color: var(--strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.i-main small { display: block; color: var(--muted); font-size: 12px; }
.i-acts { display: flex; gap: 4px; flex: none; }
.i-acts button { width: 34px; height: 34px; border: 1px solid var(--border); background: var(--panel2); border-radius: 4px; font-size: 15px; }
.i-acts button.on { border-color: var(--green); color: var(--green); }
.chev { color: var(--muted); font-size: 20px; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; border: 1px dashed var(--border2); border-radius: 4px; }

.row-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.row-btns.end { justify-content: flex-end; }
.row-btns .btn { flex: 1; }
.row-btns.end .btn { flex: none; }
.btn {
  background: var(--panel2); border: 1px solid var(--border2); border-radius: 4px; padding: 9px 14px; font-weight: 500;
  white-space: nowrap;
}
.btn.primary { background: var(--blue-bg); border-color: var(--blue-bg); color: #fff; }
.btn.danger { color: var(--red); border-color: rgba(242,73,92,.5); }
.btn:disabled { opacity: .45; }

.progress { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress div { height: 100%; width: 0; background: var(--green); transition: width .2s; }

/* switch */
.sw { appearance: none; width: 40px; height: 22px; border-radius: 11px; background: var(--panel2); border: 1px solid var(--border2); position: relative; flex: none; cursor: pointer; transition: background .15s; }
.sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.sw:checked { background: var(--blue-bg); border-color: var(--blue-bg); }
.sw:checked::after { transform: translateX(18px); background: #fff; }

/* modal */
/* Висота = видима частина екрана (--vvh), тому коли вилазить клавіатура,
   вікно стискається над нею, а не ховається під неї. */
.modal {
  position: fixed; left: 0; right: 0; top: var(--vvt, 0px);
  height: var(--vvh, 100dvh); z-index: 1100; background: rgba(0,0,0,.55);
  display: grid; place-items: center; padding: 12px;
}
.modal-card {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border2);
  border-radius: 6px; padding: 14px; box-shadow: var(--shadow);
  max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
}
/* кнопки завжди на видноті, навіть коли вміст довгий */
.modal-card .row-btns.end {
  position: sticky; bottom: -14px; margin: 12px -14px -14px; padding: 10px 14px;
  background: var(--panel); border-top: 1px solid var(--border);
}
.modal-card h3 { margin: 0 0 10px; color: var(--strong); font-size: 16px; }
.inp {
  width: 100%; background: var(--bg); color: var(--strong); border: 1px solid var(--border2); border-radius: 4px;
  padding: 9px 10px; font: inherit; font-size: 16px; outline: none;
}
.inp:focus { border-color: var(--blue); }
.emojis { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.emojis button { width: 40px; height: 40px; font-size: 20px; border-radius: 4px; border: 1px solid var(--border); background: var(--panel2); }
.emojis button.on { border-color: var(--blue); background: rgba(61,113,217,.25); }
.chk { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--text); }

.toast {
  position: fixed; left: 50%; bottom: calc(62px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1200;
  background: var(--panel); color: var(--strong); border: 1px solid var(--border2); border-left: 3px solid var(--blue);
  padding: 9px 14px; border-radius: 4px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); font-size: 13px;
}
.toast.good { border-left-color: var(--green); }
.toast.warn { border-left-color: var(--orange); }

@media (max-width: 380px) {
  .p-val { font-size: 15px; }
  .brand-txt .tag { display: none; }
  .nav-dist { font-size: 28px; }
}
@media (min-width: 700px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .p-val { font-size: 20px; }
  .bbtn { height: 46px; font-size: 11px; }
  .bbtn .ico { font-size: 17px; }
}

/* QR і сканер */
.qr-box { display: flex; justify-content: center; background: #fff; border-radius: 6px; padding: 8px; }
.qr-box canvas { width: 100%; max-width: 250px; height: auto; image-rendering: pixelated; }
.scan { position: fixed; inset: 0; z-index: 1300; background: #000; display: flex; align-items: center; justify-content: center; }
.scan video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; width: min(68vw, 300px); aspect-ratio: 1; border: 3px solid var(--green);
  border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .55);
}
.scan-hint { position: absolute; top: calc(50% + min(34vw, 150px) + 20px); color: #fff; font-size: 14px; text-shadow: 0 1px 4px #000; }
.scan #scanX { position: absolute; bottom: calc(28px + env(safe-area-inset-bottom)); background: var(--panel); }


/* ---- режим повернення ---- */
.seg.rmode { margin-top: 8px; border-color: var(--border2); }
.seg.rmode button {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 9px 4px; font-size: 12.5px; color: var(--text); font-weight: 500;
}
.seg.rmode button span { font-size: 14px; line-height: 1; }
.seg.rmode button.on { background: var(--blue-bg); color: #fff; font-weight: 600; }
.rmode-info { margin-top: 6px; font-size: 12px; color: var(--dim); line-height: 1.45; min-height: 17px; }

/* ---- шеврони напрямку вздовж маршруту ---- */
.chev { pointer-events: none; }
.chev i {
  display: block; width: 12px; height: 12px;
  background: #fff; opacity: .9;
  clip-path: polygon(50% 0%, 100% 100%, 50% 76%, 0% 100%);
  filter: drop-shadow(0 0 1.5px rgba(0,0,0,.9));
}



.tracks-kv { background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; font-size: 12.5px; color: var(--dim); }


/* ---- версія і оновлення ---- */
#verTag { opacity: .75; }


/* ---- підказка «Як це працює» ---- */
.help { background: var(--panel); border: 1px solid var(--border); border-radius: 4px; margin: 2px 0 12px; }
.help summary {
  padding: 10px 12px; font-size: 13.5px; font-weight: 600; color: var(--strong);
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
}
.help summary::-webkit-details-marker { display: none; }
.help summary::before { content: '💡'; font-size: 15px; }
.help summary::after { content: '▾'; margin-left: auto; color: var(--muted); transition: transform .2s; }
.help[open] summary::after { transform: rotate(180deg); }
.help-steps { margin: 0; padding: 0 12px 4px 30px; }
.help-steps li { margin: 7px 0; font-size: 13px; color: var(--text); line-height: 1.5; }
.help-steps li b { color: var(--strong); }
.help .note { padding: 0 12px 10px; margin: 2px 0 0; }
#mBody .help-steps { padding-left: 20px; }

.note.lead { font-size: 12.5px; color: var(--text); margin: 2px 2px 10px; line-height: 1.5; }
.note.tiny { font-size: 11.5px; margin: 4px 2px 0; }
.item .btn { flex: 0 0 auto; padding: 7px 11px; font-size: 12.5px; }
.btn.mini { padding: 6px 10px; font-size: 12.5px; margin-top: 7px; }


/* ---- вихід ---- */
#exitBtn { font-size: 17px; }


/* ---- пошук місця ---- */
.find-res { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.find-item {
  text-align: left; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 4px; padding: 9px 10px; font-size: 12.5px; color: var(--text); line-height: 1.4;
}
.find-item:active { border-color: var(--blue); }
.find-ok { background: rgba(115,191,105,.12); border: 1px solid var(--green); border-radius: 4px; padding: 9px 10px; font-size: 13px; color: var(--strong); }
.find-ok small { color: var(--dim); font-family: Consolas, monospace; }
.find-err { background: rgba(242,73,92,.1); border: 1px solid var(--red); border-radius: 4px; padding: 9px 10px; font-size: 12.5px; color: var(--text); line-height: 1.45; }
.find-wait { padding: 9px 10px; font-size: 12.5px; color: var(--dim); }

/* ---- месенджери ---- */
.msg-row { display: flex; gap: 6px; margin-top: 10px; }
.btn.msg { flex: 1; color: #fff; border: 0; font-weight: 600; font-size: 13px; padding: 11px 4px; }
.btn.msg.tg { background: #2aabee; }
.btn.msg.vb { background: #7360f2; }
.btn.msg.wa { background: #25d366; }

/* ---------- оновлення: як в EnergyUA Junior ---------- */
.icon-btn.hot { background: var(--yellow); color: #1a1500; border-color: var(--yellow); animation: updPulse 1.6s ease-in-out infinite; }
@keyframes updPulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--yellow) 30%, transparent); } }
.brand-txt small #verTag.hot { color: var(--yellow); font-weight: 600; }
.um { font-size: 14px; color: var(--text); line-height: 1.45; }
.um-h { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.um-list { margin: 0 0 10px; }
.um-warn { margin: 0 0 8px; font-size: 12.5px; color: var(--yellow); }
.um-cur { margin: 0; font-size: 12.5px; color: var(--muted); }

/* ---------- компас на карті ---------- */
.map-cmp {
  position: absolute; left: 8px; top: 8px; z-index: 500; width: 56px; padding: 3px 0 2px;
  background: var(--panel); border: 1px solid var(--border2); border-radius: 6px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--text); cursor: pointer;
}
.map-cmp svg { width: 40px; height: 40px; display: block; }
.map-cmp .mc-ring { fill: none; stroke: var(--border2); stroke-width: 3; }
.map-cmp .mc-n { fill: #ff3b30; }
.map-cmp .mc-s { fill: var(--muted); }
.map-cmp .mc-l { fill: var(--strong); font-size: 15px; font-weight: 700; text-anchor: middle; dominant-baseline: middle; }
.map-cmp .mc-hub { fill: var(--panel); stroke: var(--strong); stroke-width: 2; }
.map-cmp #mcRose { transition: transform .25s linear; }
.map-cmp .mc-deg { font-size: 9.5px; font-weight: 600; line-height: 1.1; white-space: nowrap; }
.map-cmp.off svg { opacity: .45; }
.map-cmp.off .mc-deg { color: var(--muted); font-weight: 400; }
.map-cmp:active { transform: scale(.95); }

/* ---------- характеристики маршруту в архіві ---------- */
.item.trk { flex-wrap: wrap; }
.item.trk .i-main { cursor: pointer; }
.trk-stats { flex-basis: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.trk-stats div { background: var(--panel2); border-radius: 4px; padding: 5px 7px; min-width: 0; }
.trk-stats span { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.2; }
.trk-stats b { display: block; color: var(--strong); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trk-notes { flex-basis: 100%; margin-top: 6px; color: var(--muted); font-size: 11.5px; }
.trk-stats .wide { grid-column: 1 / -1; }

/* ---------- картка маршруту з архіву (внизу карти) ---------- */
.trk-dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 600; padding: 8px; pointer-events: none; }
.trk-card {
  pointer-events: auto; background: var(--panel); border: 1px solid var(--border2); border-radius: 6px;
  box-shadow: var(--shadow); padding: 8px 10px 8px; max-width: 560px; margin: 0 auto;
  max-height: 58vh; overflow-y: auto; overscroll-behavior: contain;
}
.trk-head { display: flex; align-items: center; gap: 6px; }
.trk-title { flex: 1; min-width: 0; }
.trk-name { font-size: 15px; font-weight: 600; color: var(--strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trk-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 7px; }
.trk-sum div { background: var(--panel2); border-radius: 4px; padding: 4px 6px; min-width: 0; }
.trk-sum span { display: block; color: var(--muted); font-size: 10px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trk-sum b { display: block; color: var(--strong); font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trk-toggle { display: block; width: 100%; margin-top: 6px; padding: 5px; background: none; border: 0; color: var(--blue); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.trk-full .trk-stats { margin-top: 2px; }

/* слід з архіву на світлій карті: написи на плитках видно крізь червону лінію */
.leaflet-pane.blend { mix-blend-mode: multiply; }

/* під час ведення спливаючі повідомлення - над карткою, а не поверх неї */
body.nav-open .toast { bottom: calc(var(--navh, 300px) + 70px + env(safe-area-inset-bottom)); }
/* під час ведення є великий компас у картці - малий на карті ховаємо */
/* під час ведення компас на карті показує, де північ, і перемикає режим «за рухом / північ угорі» */

/* ---------- компактний рядок режимів ---------- */
.quick { flex-wrap: wrap; }
.quick .qseg { display: none; }
.quick.open .qseg { display: flex; }
.quick.open .mode-chip i { transform: rotate(180deg); }
.mode-chip {
  flex: 1 1 100%; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px; color: var(--strong);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.mode-chip i { font-style: normal; color: var(--muted); transition: transform .2s; }
.quick.open .mode-chip { margin-bottom: 0; }
.p-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

/* ---------- розміри для пальця й читабельність надворі ---------- */
.rec-badge { font-size: 11px; padding: 4px 8px; }
.pin-label { font-size: 11.5px !important; }
.map-cmp .mc-deg { font-size: 10.5px; }
.nav-btns { display: flex; gap: 6px; }
/* згорнута картка ведення: назва, відстань і маленька стрілка */
.nav.min .rmode, .nav.min .rmode-info, .nav.min .nav-hint { display: none; }
.nav.min .compass { width: 64px; height: 64px; }
.nav.min .nav-dist { font-size: 26px; }
.nav.min .nav-body { margin-top: 2px; gap: 10px; }

/* ---------- кошик ---------- */
.trash-head { width: 100%; margin-top: 10px; padding: 10px 12px; text-align: left; background: none; border: 1px dashed var(--border2); border-radius: 4px; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; }
.trash-item { opacity: .8; }

/* ---------- карта, що повертається за рухом ---------- */
body.maprot #map { transition: transform .45s linear; transform-origin: 50% 50%; will-change: transform; }
/* значки точок повертаємо назад - підписи лишаються рівними */
body.maprot .pin { transform: rotate(var(--brg, 0deg)); transform-origin: 17px 40px; }
/* підпис карти в поверненому квадраті опинився б за краєм - показуємо окремо */
body.maprot .leaflet-control-container { display: none; }
.rot-attr { display: none; position: absolute; right: 4px; bottom: calc(var(--navh, 0px) + 10px); z-index: 550; font-size: 9px; color: #555; background: rgba(255,255,255,.7); padding: 0 4px; border-radius: 2px; pointer-events: none; }
body.maprot .rot-attr { display: block; }

/* ---------- заголовок у стилі WordHunter: «Way» сірим, «Back» синім ---------- */
.brand-txt b.wb-title { font-family: Inter, Roboto, 'Segoe UI', system-ui, sans-serif; font-size: 18px; font-weight: 700; letter-spacing: -.4px; line-height: 1.1; }
.wb-title .bw, .eua .bw { color: #ccccdc; }
.wb-title .bh, .eua .bh { color: #6e9fff; }
[data-theme="light"] .wb-title .bw, [data-theme="light"] .eua .bw { color: #24292e; }
[data-theme="light"] .wb-title .bh, [data-theme="light"] .eua .bh { color: #1f62e0; }
/* EnergyUA - канал автора */
.item.eua { text-decoration: none; margin-top: 10px; }
.item.eua .i-ico .bolt { width: 18px; height: 28px; display: block; margin: 0 auto; }
.item.eua .i-main b { font-family: Inter, Roboto, 'Segoe UI', system-ui, sans-serif; font-weight: 700; letter-spacing: -.3px; }
