/* Dolosegev — mobile-first dark theme, "enrosadira" (the rose glow on Dolomite rock at dusk) */
:root {
  --bg: #0c1016;
  --bg2: #131922;
  --surface: #1a212c;
  --surface2: #222b38;
  --line: #2c3646;
  --text: #eef2f8;
  --muted: #93a1b8;
  --accent: #ff6f91;
  --accent2: #ffb3c6;
  --ice: #7ec8ff;
  --good: #35d07f;
  --warn: #ffd166;
  --danger: #ff5c5c;
  --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--accent2); text-decoration: none; }
img { max-width: 100%; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l));
  background: linear-gradient(180deg, #18202b, #10141b);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-badge {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--accent), #ff9d6b);
  box-shadow: 0 4px 14px rgba(255, 111, 145, .35);
}
.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 17px; letter-spacing: .4px; line-height: 1.15; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; font-size: 17px;
  background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center; flex: 0 0 auto;
}
.icon-btn:active { transform: scale(.94); }

/* ---------- filter bar ---------- */
.filterbar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px calc(10px + var(--safe-r)) 8px calc(10px + var(--safe-l));
  overflow-x: auto; overflow-y: hidden;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.filterbar::-webkit-scrollbar { display: none; }
.chips { display: flex; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 11px; border-radius: 999px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
  flex: 0 0 auto;
}
.chip.on { background: var(--chipc, var(--accent)); border-color: transparent; color: #10131a; font-weight: 700; }
.chip-sep { width: 1px; align-self: stretch; margin: 2px 3px; background: var(--line); flex: 0 0 auto; }
.chip-search { padding: 7px 11px; }
.search-input {
  flex: 0 0 min(58vw, 220px); padding: 7px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  font-size: 16px; /* 16px stops iOS zooming on focus */
  outline: none; min-width: 0;
}
.search-input:focus { border-color: var(--accent); }

/* ---------- screens ---------- */
main { flex: 1 1 auto; position: relative; min-height: 0; }
.screen { position: absolute; inset: 0; }
#map { width: 100%; height: 100%; background: #0a0d12; }
.screen-scroll {
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 10px calc(10px + var(--safe-r)) 18px calc(10px + var(--safe-l));
}

/* category + price chips only mean something on the map & Do tabs */
body[data-tab="treks"] .ev-only, body[data-tab="roads"] .ev-only { display: none; }

.legend {
  font-size: 11.5px; color: var(--muted); line-height: 2;
  padding: 4px 6px 10px;
}

.map-fabs {
  position: absolute; right: calc(12px + var(--safe-r)); bottom: 18px; z-index: 500;
  display: flex; flex-direction: column; gap: 10px;
}
.fab {
  width: 46px; height: 46px; border-radius: 50%; font-size: 20px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); display: grid; place-items: center;
}
.fab:active { transform: scale(.92); }
.lfab { width: 42px; height: 42px; font-size: 18px; align-self: flex-end; }
.lfab.off { opacity: .38; filter: grayscale(1); }
.lfab.on { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(255,111,145,.4), var(--shadow); }
.fab-sep { height: 4px; }
@media (max-height: 700px) {
  .map-fabs { gap: 7px; bottom: 12px; }
  .lfab { width: 38px; height: 38px; font-size: 16px; }
  .fab { width: 42px; height: 42px; font-size: 18px; }
}

/* ---------- tab bar ---------- */
.tabbar {
  display: flex; flex: 0 0 auto;
  background: #10141b; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 0 7px; font-size: 19px; color: var(--muted); position: relative;
  min-width: 0;
}
.tab span { font-size: 11px; letter-spacing: .3px; }
.tab.active { color: var(--accent); }
.tab.active::before {
  content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.tab-count {
  position: absolute; top: 3px; inset-inline-start: 50%; margin-inline-start: 9px;
  background: var(--accent); color: #10131a; font-style: normal; font-weight: 800;
  font-size: 10px; min-width: 17px; height: 17px; border-radius: 9px;
  display: grid; place-items: center; padding: 0 4px;
}

/* ---------- banner ---------- */
.banner {
  background: linear-gradient(135deg, #1e2733, #171d27);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 10px;
}
.banner .b-day { font-size: 11.5px; color: var(--muted); letter-spacing: .4px; }
.banner .b-main { font-size: 16px; font-weight: 700; margin: 3px 0 2px; overflow-wrap: anywhere; }
.banner .b-next { font-size: 12.5px; color: var(--muted); }
.banner .b-next b { color: var(--accent2); }
.b-src {
  float: inline-end; font-size: 10.5px; padding: 3px 8px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--line); color: var(--muted);
  margin-inline-start: 8px;
}
.b-progress { height: 5px; background: var(--surface2); border-radius: 3px; margin-top: 9px; overflow: hidden; }
.b-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ff9d6b); border-radius: 3px; }

/* ---------- accordion ---------- */
.acc-divider {
  margin: 16px 4px 8px; font-size: 11px; letter-spacing: .4px;
  color: var(--muted); display: flex; align-items: center; gap: 10px;
}
.acc-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.acc-sec {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 8px; overflow: hidden;
}
.acc-sec.current { border-color: rgba(255, 111, 145, .55); box-shadow: 0 0 0 1px rgba(255, 111, 145, .25), var(--shadow); }
.acc-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; text-align: left;
}
.acc-num {
  width: 28px; height: 28px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 800;
  background: var(--surface2); border: 1px solid var(--line); color: var(--muted);
}
.acc-num.planned { background: rgba(255,111,145,.16); border-color: rgba(255,111,145,.45); color: var(--accent2); }
.acc-sec.current .acc-num { background: var(--accent); border-color: transparent; color: #10131a; }
.acc-title { flex: 1 1 auto; min-width: 0; }
.acc-title b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-title small { color: var(--muted); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-right { text-align: end; flex: 0 0 auto; }
.acc-right .dist { font-size: 12px; color: var(--accent2); font-weight: 700; display: block; }
.acc-right .cnt { font-size: 11px; color: var(--muted); white-space: nowrap; }
.acc-chev { color: var(--muted); font-size: 12px; transition: transform .2s; margin-inline-start: 2px; flex: 0 0 auto; }
.acc-sec.open .acc-chev { transform: rotate(180deg); }
.acc-body { display: none; padding: 2px 8px 10px; }
.acc-sec.open .acc-body { display: block; }
.acc-empty { color: var(--muted); font-size: 12.5px; padding: 6px 8px 8px; }
.here-tag {
  font-size: 10px; font-weight: 800; letter-spacing: .6px; color: #10131a;
  background: var(--accent); border-radius: 6px; padding: 2px 6px; margin-inline-start: 6px;
  vertical-align: 2px;
}

/* ---------- cards ---------- */
.ev {
  display: flex; gap: 10px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px; margin-top: 8px;
  min-width: 0;
}
.ev-thumb {
  width: 86px; height: 86px; border-radius: 10px; flex: 0 0 auto;
  position: relative; overflow: hidden;
  background: linear-gradient(140deg, var(--c1, #333), var(--c2, #222));
  display: grid; place-items: center;
}
.ev-thumb::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120% 70% at 100% 0%, rgba(255,255,255,.16), transparent 55%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.05) 0 8px, transparent 8px 16px);
}
.ev-thumb .em { font-size: 34px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); position: relative; }
.ev-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.ev-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ev-title { font-size: 14px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.ev-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 2px; }
.badge {
  font-size: 10px; font-weight: 800; letter-spacing: .4px;
  padding: 2px 7px; border-radius: 6px;
  white-space: nowrap;
}
/* season/closure badges carry a whole sentence, so they are the one kind that wraps */
.badge.season, .badge.warn { white-space: normal; overflow-wrap: anywhere; }
.badge.now { background: var(--danger); color: #fff; }
.badge.match { background: rgba(53, 208, 127, .18); color: var(--good); border: 1px solid rgba(53,208,127,.4); }
.badge.near { background: rgba(122, 205, 255, .14); color: #8fd0ff; border: 1px solid rgba(122,205,255,.35); }
.badge.miss { background: rgba(255, 209, 102, .15); color: var(--warn); border: 1px solid rgba(255,209,102,.35); }
.badge.live { background: rgba(124, 92, 255, .2); color: #b5a3ff; border: 1px solid rgba(124,92,255,.45); }
.badge.est { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.badge.res-req { background: rgba(255, 92, 92, .16); color: #ff8a8a; border: 1px solid rgba(255,92,92,.4); }
.badge.res-rec { background: rgba(255, 209, 102, .14); color: var(--warn); border: 1px solid rgba(255,209,102,.35); }
.badge.res-ok { background: rgba(53, 208, 127, .14); color: var(--good); border: 1px solid rgba(53,208,127,.35); }
.badge.diff-easy { background: rgba(53, 208, 127, .14); color: var(--good); border: 1px solid rgba(53,208,127,.35); }
.badge.diff-moderate { background: rgba(255, 209, 102, .14); color: var(--warn); border: 1px solid rgba(255,209,102,.35); }
.badge.diff-hard, .badge.diff-extreme { background: rgba(255, 92, 92, .16); color: #ff8a8a; border: 1px solid rgba(255,92,92,.4); }
.badge.warn { background: rgba(255, 92, 92, .16); color: #ff8a8a; border: 1px solid rgba(255,92,92,.4); }
.badge.season { background: var(--surface2); color: #b7c2d2; border: 1px solid var(--line); }
.badge.ctype { background: rgba(126, 200, 255, .14); color: var(--ice); border: 1px solid rgba(126,200,255,.35); }
.badge.fam-all { background: rgba(74, 163, 255, .16); color: #8ec5ff; border: 1px solid rgba(74,163,255,.4); }
.badge.fam-teen { background: rgba(255, 209, 102, .14); color: var(--warn); border: 1px solid rgba(255,209,102,.35); }
.badge.fam-hard { background: rgba(255, 92, 92, .16); color: #ff8a8a; border: 1px solid rgba(255,92,92,.4); }
.badge.sev-scenic { background: rgba(126, 200, 255, .14); color: var(--ice); border: 1px solid rgba(126,200,255,.35); }
.badge.sev-spicy { background: rgba(255, 159, 26, .16); color: #ffbb63; border: 1px solid rgba(255,159,26,.4); }
.badge.sev-gnarly { background: rgba(255, 92, 92, .18); color: #ff8a8a; border: 1px solid rgba(255,92,92,.45); }
.badge.ferrata { background: rgba(200, 92, 255, .16); color: #d9a2ff; border: 1px solid rgba(200,92,255,.4); }
.res-note { font-size: 11.5px; color: #aeb9c9; margin-top: 3px; overflow-wrap: anywhere; }
.res-note b { color: var(--accent2); }
.ev-meta { font-size: 11.8px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
.ev-meta b { color: var(--accent2); font-weight: 600; }
.ev-desc { font-size: 12.3px; color: #c3cddc; margin-top: 3px; overflow-wrap: anywhere; }
.ev-foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 7px; flex-wrap: wrap; row-gap: 7px; }
.pill {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.ev-foot .pill { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pill.price { color: var(--good); }
.pill.price.free { color: #9be8c0; background: rgba(53,208,127,.12); border-color: rgba(53,208,127,.3); }
.ev-actions { margin-inline-start: auto; display: flex; gap: 6px; flex: 0 0 auto; }
.ev-act {
  width: 36px; height: 36px; border-radius: 10px; font-size: 15px;
  background: var(--surface2); border: 1px solid var(--line);
  display: grid; place-items: center; flex: 0 0 auto;
}
.ev-act:active { transform: scale(.92); }

.list-footer { color: var(--muted); font-size: 11.5px; text-align: center; padding: 14px 8px 4px; }

/* pinned "rules" strip on the Roads screen */
.rules-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 12px; width: 100%; text-align: left;
  background: linear-gradient(135deg, #2a1c22, #1d1820);
  border: 1px solid rgba(255,92,92,.35); border-radius: var(--r);
}
.rules-head b { font-size: 14px; }
.rules-head small { display: block; color: var(--muted); font-size: 11.5px; }
.rules-wrap.open .rules-head { border-radius: var(--r) var(--r) 0 0; }
.rules-body { display: none; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); padding: 2px 8px 10px; background: var(--surface); }
.rules-wrap.open .rules-body { display: block; }
.rules-wrap { margin-bottom: 10px; }

/* ---------- map bits ---------- */
.zone-marker {
  min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px;
  background: #1a212c; border: 2px solid var(--accent);
  color: var(--accent2); font-size: 11.5px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.5); white-space: nowrap;
}
.zone-marker.unplanned { border-color: #56606f; color: #97a3b4; }
.ev-marker {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 4px;
  background: var(--mc, #555);
  display: grid; place-items: center; font-size: 15px;
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 3px 8px rgba(0,0,0,.5);
}
.user-dot { position: relative; width: 18px; height: 18px; }
.user-dot::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: #2f9bff; border: 2.5px solid #fff;
  box-shadow: 0 0 10px rgba(47,155,255,.9);
}
.user-dot::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 2px solid rgba(47,155,255,.55);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(.55); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.cluster-ico {
  background: var(--accent); color: #10131a; font-weight: 800;
  border-radius: 50%; display: grid; place-items: center;
  border: 3px solid rgba(255,255,255,.85); font-size: 12.5px;
  box-shadow: 0 3px 10px rgba(0,0,0,.5);
}

/* leaflet dark-ish popup */
.leaflet-popup-content-wrapper {
  background: var(--surface); color: var(--text);
  border-radius: 12px; box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 10px 12px; line-height: 1.4; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop { width: min(70vw, 230px); }
.pop .pt { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; overflow-wrap: anywhere; }
.pop .pm { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; overflow-wrap: anywhere; }
.pop .pm b { color: var(--accent2); }
.pop .pd { font-size: 12px; color: #c3cddc; overflow-wrap: anywhere; }
.pop .pthumb {
  width: 100%; height: 82px; border-radius: 8px; margin-bottom: 6px;
  background: linear-gradient(140deg, var(--c1,#333), var(--c2,#222));
  display: grid; place-items: center; font-size: 30px; overflow: hidden; position: relative;
}
.pop .pthumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pop .pbtns { display: flex; gap: 6px; margin-top: 8px; }
.pop .pbtn {
  flex: 1; text-align: center; padding: 7px 4px; border-radius: 8px; font-size: 11.5px; font-weight: 700;
  background: var(--surface2); border: 1px solid var(--line); color: var(--text);
}
.pop .pbtn.primary { background: var(--accent); border-color: transparent; color: #10131a; }
.leaflet-control-attribution {
  background: rgba(12, 16, 22, .75) !important; color: #7d8899 !important; font-size: 9.5px !important;
}
.leaflet-control-attribution a { color: #9aa7ba !important; }
.leaflet-bar a { background: var(--surface); color: var(--text); border-bottom-color: var(--line); }
.leaflet-bar a:hover { background: var(--surface2); }

/* ---------- modal ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5, 7, 10, .66); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  width: 100%; max-width: 560px; max-height: 88dvh;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 16px calc(18px + var(--safe-b)); }
.set-group { padding: 14px 0 6px; border-bottom: 1px solid var(--line); }
.set-group:last-child { border-bottom: 0; }
.set-group h3 { margin: 0 0 8px; font-size: 14px; }
.radio { display: block; padding: 7px 2px; font-size: 13.5px; color: #cdd6e2; }
.radio b { color: var(--text); }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0; overflow-wrap: anywhere; }
.select, .text-input {
  width: 100%; padding: 10px 12px; margin-top: 6px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; font-size: 16px; outline: none;
}
.text-input:focus, .select:focus { border-color: var(--accent); }
.row-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn {
  padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 700;
  background: var(--surface2); border: 1px solid var(--line);
}
.btn:active { transform: scale(.97); }
.dates-editor { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.date-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 6px; align-items: center; }
.date-row label { font-size: 12.5px; color: #cdd6e2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-row input {
  padding: 6px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font-size: 12px; width: 116px;
  color-scheme: dark;
}
@media (max-width: 380px) {
  .date-row { grid-template-columns: minmax(0,1fr) auto; }
  .date-row input { width: 100%; }
  .date-row label { grid-column: 1 / -1; }
  .ev-thumb { width: 72px; height: 72px; }
  .ev-thumb .em { font-size: 28px; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(76px + var(--safe-b)); transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 12.5px; z-index: 1200;
  box-shadow: var(--shadow); max-width: 86vw; text-align: center;
}

@media (min-width: 760px) {
  .modal-wrap { align-items: center; }
  .modal { border-radius: 18px; }
  .screen-scroll { padding-left: max(14vw, 16px); padding-right: max(14vw, 16px); }
}

/* ---------- RTL / bidi ----------
   The UI is Hebrew, but place names, addresses and URLs stay in Latin script so
   they match the road signs. `unicode-bidi: plaintext` lets each line pick its own
   direction from its first strong character, so a Latin title reads left-to-right
   inside a right-to-left card — while the explicit alignment keeps the column tidy. */
.ev-title, .ev-meta, .ev-desc, .res-note,
.acc-title b, .acc-title small,
.pop .pt, .pop .pm, .pop .pd,
.banner .b-main, .banner .b-next, .hint, .legend {
  unicode-bidi: plaintext;
  text-align: right;
}
/* Leaflet positions its own controls with physical left/right, so the map stays
   LTR; only the text inside popups flips. */
#map { direction: ltr; }
.leaflet-popup-content { direction: rtl; text-align: right; }
.leaflet-container { direction: ltr; }
.leaflet-popup-content .ev-badges { direction: rtl; }
.leaflet-control-attribution { direction: ltr; }

/* numbers, times and prices read left-to-right even mid-sentence */
.acc-right .dist, .tab-count, .b-progress { unicode-bidi: isolate; }
.date-row input { direction: ltr; text-align: center; }
#tm-key { direction: ltr; }

/* thin, dark scrollbars — the default light one is loud against this theme */
.screen-scroll, .modal-body {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.screen-scroll::-webkit-scrollbar, .modal-body::-webkit-scrollbar { width: 6px; }
.screen-scroll::-webkit-scrollbar-track, .modal-body::-webkit-scrollbar-track { background: transparent; }
.screen-scroll::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 3px;
}

/* a distance, a price or a time must never break across lines mid-unit */
.ev-meta b, .pop .pm b, .acc-right .dist { white-space: nowrap; }

/* On a phone the map is short; a rich popup would run off the top and take its
   buttons with it. Cap the body and let it scroll inside the bubble instead. */
.leaflet-popup-content { max-height: min(46vh, 340px); overflow-y: auto; overscroll-behavior: contain; }
.leaflet-popup-content::-webkit-scrollbar { width: 4px; }
.leaflet-popup-content::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
@media (max-height: 700px) {
  .pop .pthumb { height: 62px; font-size: 24px; }
}

.badge.verified { background: rgba(53, 208, 127, .14); color: var(--good); border: 1px solid rgba(53,208,127,.35); }

.banner .b-warn {
  margin-top: 7px; padding: 6px 9px; border-radius: 9px; font-size: 12px; font-weight: 700;
  background: rgba(255, 209, 102, .12); color: var(--warn);
  border: 1px solid rgba(255, 209, 102, .32);
}

/* the arrival transfer — its own colour, apart from the scenic/spicy/gnarly scale */
.badge.sev-transfer { background: rgba(139, 92, 246, .18); color: #c4b5fd; border: 1px solid rgba(139,92,246,.45); }
.pill.transfer { background: rgba(139, 92, 246, .14); color: #c4b5fd; border-color: rgba(139,92,246,.4); }
