:root {
  color-scheme: dark;
  font-family: Tahoma, Arial, sans-serif;
  background: #07111f;
  color: #eff8ff;
  --surface: #0d1c2f;
  --surface-soft: #13263d;
  --line: rgba(194, 224, 255, 0.13);
  --muted: #a8bbcc;
  --accent: #2dd4bf;
  --accent-dark: #062b2a;
  --danger: #fb7185;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 10% 0%, rgba(45, 212, 191, 0.12), transparent 36%),
    linear-gradient(180deg, #091728 0%, #06101d 100%);
  padding: max(18px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
}

button, summary { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell { width: min(100%, 700px); margin: 0 auto; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 2px 2px 16px; }
.eyebrow { color: var(--accent); font-size: .82rem; font-weight: 700; margin: 0 0 4px; }
h1 { font-size: clamp(1.45rem, 6vw, 2rem); line-height: 1.3; margin: 0; }
.badge { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .8rem; padding: 7px 11px; white-space: nowrap; }
.badge.active { background: rgba(45, 212, 191, .14); border-color: rgba(45, 212, 191, .35); color: #7df7e8; }

.map-card { position: relative; height: min(49dvh, 420px); min-height: 300px; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: #102338; box-shadow: 0 24px 55px rgba(0, 0, 0, .28); }
#map { height: 100%; width: 100%; z-index: 1; }
.map-placeholder { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 18px; background: radial-gradient(circle at center, #173653, #0c1d30 70%); text-align: center; color: var(--muted); padding: 24px; transition: opacity .25s ease; }
.map-placeholder.hidden { display: none; }
.map-spinner { width: 46px; height: 46px; border: 4px solid rgba(255,255,255,.18); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.recenter { position: absolute; z-index: 500; left: 14px; bottom: 14px; width: 48px; height: 48px; border: 0; border-radius: 15px; background: #fff; color: #0b1728; font-size: 1.75rem; box-shadow: 0 8px 22px rgba(0,0,0,.3); cursor: pointer; }

.panel { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 24px; background: rgba(13, 28, 47, .92); backdrop-filter: blur(16px); }
.status { min-height: 54px; display: flex; align-items: flex-start; gap: 12px; }
.status-icon { color: var(--accent); font-size: .8rem; margin-top: 5px; }
.status strong { display: block; font-size: 1rem; line-height: 1.5; }
.status p { color: var(--muted); font-size: .86rem; line-height: 1.65; margin: 2px 0 0; }
.status.error .status-icon { color: var(--danger); }

.coordinates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.coordinates div { background: #091827; border: 1px solid var(--line); border-radius: 13px; padding: 10px; min-width: 0; }
.coordinates span, .coordinates strong { display: block; }
.coordinates span { color: var(--muted); font-size: .7rem; margin-bottom: 5px; }
.coordinates strong { direction: ltr; font: 700 .78rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; }

.primary-button, .secondary-button { width: 100%; min-height: 54px; border-radius: 16px; font-weight: 700; cursor: pointer; transition: transform .15s ease, opacity .15s ease, background .15s ease; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 15px; border: 0; background: var(--accent); color: var(--accent-dark); box-shadow: 0 10px 25px rgba(45, 212, 191, .18); }
.primary-button:active, .secondary-button:active:not(:disabled) { transform: scale(.985); }
.primary-button.loading { opacity: .72; cursor: wait; }
.secondary-button { margin-top: 9px; border: 1px solid var(--line); background: var(--surface-soft); color: #fff; }
.secondary-button:disabled { opacity: .38; cursor: not-allowed; }

.help { margin-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: .83rem; line-height: 1.8; }
.help summary { color: #d7e7f4; cursor: pointer; padding-top: 13px; }
.help ol { margin: 9px 0 0; padding-right: 22px; }
.help b { color: #fff; }
.toast { position: fixed; z-index: 1000; right: 16px; bottom: max(18px, env(safe-area-inset-bottom)); left: 16px; width: min(calc(100% - 32px), 660px); margin: auto; border: 1px solid rgba(45, 212, 191, .35); border-radius: 14px; background: #10352f; color: #eafffb; padding: 13px 16px; text-align: center; box-shadow: 0 15px 40px rgba(0,0,0,.38); }

.user-location-marker { background: transparent; border: 0; }
.user-dot { width: 22px; height: 22px; border: 4px solid #fff; border-radius: 50%; background: #14b8a6; box-shadow: 0 0 0 7px rgba(20,184,166,.25), 0 3px 12px rgba(0,0,0,.45); }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-popup-content { direction: rtl; margin: 10px 14px; font: 700 14px/1.6 Tahoma, Arial, sans-serif; color: #0b1728; }

@media (min-width: 700px) {
  body { padding-top: 30px; }
  .panel { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
