@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --bg: #f4f1ea;
  --panel: #ffffff;
  --ink: #1c1917;
  --muted: #6b6560;
  --line: #e5e0d8;
  --danger: #b91c1c;
  --shadow: 0 6px 24px rgba(0, 0, 0, .16);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --panel: #262422;
    --ink: #f3efe8;
    --muted: #a8a29a;
    --line: #3a3733;
    --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: Vazirmatn, Tahoma, sans-serif; }
button, input { font: inherit; color: inherit; }

#map { position: absolute; inset: 0; background: var(--bg); }
.leaflet-container { font-family: Vazirmatn, Tahoma, sans-serif; background: var(--bg); }
.leaflet-control-attribution { font-size: 10px; direction: ltr; }

.topbar { position: absolute; top: calc(10px + var(--safe-top)); inset-inline: 12px; z-index: 1000; }
.search { display: flex; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 13px 16px; font-size: 17px; }
.search button { border: 0; background: var(--brand); color: var(--brand-ink); width: 54px; display: grid; place-items: center; }
.suggest { list-style: none; margin: 6px 0 0; padding: 4px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); max-height: 45vh; overflow: auto; }
.suggest li { padding: 11px 14px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.suggest li:active, .suggest li.active { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.suggest li small { color: var(--muted); }

.here { position: absolute; top: calc(72px + var(--safe-top)); inset-inline: 12px; z-index: 900; background: var(--brand); color: var(--brand-ink); padding: 9px 14px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 700; text-align: center; }

.fabs { position: absolute; inset-inline-start: 12px; bottom: calc(24px + var(--safe-bottom)); z-index: 950; display: flex; flex-direction: column; gap: 10px; transition: bottom .2s; }
body.card-open .fabs { bottom: calc(var(--card-h, 260px) + 16px + var(--safe-bottom)); }
.fab { width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); display: grid; place-items: center; }
.fab.on { color: #fff; background: #2563eb; }
.fab.wait { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.menu { position: absolute; inset-inline-start: 72px; bottom: calc(84px + var(--safe-bottom)); z-index: 1001; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 14px; min-width: 210px; }
.menu-title { font-weight: 700; margin-bottom: 4px; }
.menu label { display: flex; gap: 8px; align-items: center; padding: 7px 0; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.link { display: block; width: 100%; text-align: start; background: none; border: 0; padding: 8px 0; color: var(--brand); }
.link.danger { color: var(--danger); }

.card { position: absolute; inset-inline: 0; bottom: 0; z-index: 1000; background: var(--panel); border-radius: 18px 18px 0 0; box-shadow: var(--shadow); padding: 14px 16px calc(14px + var(--safe-bottom)); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; }
.card-title { font-size: 22px; font-weight: 700; }
.card-sub { color: var(--muted); font-size: 13px; min-height: 1em; }
.icon-btn { border: 0; background: var(--bg); width: 36px; height: 36px; border-radius: 50%; font-size: 16px; }
.nav-row { display: flex; align-items: center; gap: 14px; margin: 10px 0; padding: 10px; border-radius: 14px; background: var(--bg); }
.arrow-wrap { width: 58px; height: 58px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; flex: none; }
.arrow { display: grid; place-items: center; color: var(--brand); transition: transform .25s linear; }
.arrow .i-check, .arrow.inside .i-arrow { display: none; }
.arrow.inside .i-check { display: block; }
.arrow.inside { transform: none !important; color: #16a34a; }
.dist { font-size: 22px; font-weight: 700; }
.dir { color: var(--muted); font-size: 14px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.facts div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 0; font-weight: 700; font-size: 14px; direction: rtl; }
.facts .wide { grid-column: 1 / -1; }
.note { margin: -4px 0 12px; font-size: 13px; color: #b45309; }
.card-actions { display: flex; gap: 10px; }
.btn { flex: 1; border: 0; border-radius: 12px; padding: 12px; font-weight: 700; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: var(--bg); }

.toast { position: absolute; top: calc(76px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 1100; background: #1c1917; color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 14px; max-width: 90vw; text-align: center; }
.loading { position: absolute; inset: 0; z-index: 2000; display: grid; place-items: center; background: var(--bg); font-size: 16px; }
.loading[hidden] { display: none; }

.lbl-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 450; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(37, 99, 235, .35), 0 1px 4px rgba(0, 0, 0, .4); }
.me-dot.stale { background: #94a3b8; }
