:root {
  color-scheme: dark;
  --glass: rgba(16, 19, 25, .62);
  --glass-strong: rgba(14, 17, 22, .82);
  --stroke: rgba(255, 255, 255, .13);
  --text: #f7f8fb;
  --muted: rgba(247, 248, 251, .62);
  --red: #ff3d3d;
  --orange: #ff6a2b;
  --amber: #ffb547;
  --green: #43d58c;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #080a0e; }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); }
button { font: inherit; color: inherit; }

.app-shell { position: relative; width: 100%; height: 100%; min-height: 100dvh; overflow: hidden; background: #080a0e; }
.map { position: absolute; z-index: 0; inset: 0; isolation: isolate; background: radial-gradient(circle at 48% 42%, #1d242e, #080a0e 72%); }
.map-shade { position: absolute; z-index: 2; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(3,5,8,.48), transparent 24%, transparent 70%, rgba(3,5,8,.72)); }
.glass { background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.025)), var(--glass); border: 1px solid var(--stroke); box-shadow: inset 0 1px rgba(255,255,255,.13), 0 16px 42px rgba(0,0,0,.34); backdrop-filter: blur(22px) saturate(145%); -webkit-backdrop-filter: blur(22px) saturate(145%); }

.topbar { position: absolute; z-index: 20; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; min-height: 58px; border-radius: 22px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 9px 12px 9px 16px; }
.brand { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.brand strong { font-size: 16px; letter-spacing: .08em; }
.brand span { margin-top: 4px; font-size: 8px; letter-spacing: .22em; color: var(--muted); }
.region-button { height: 40px; border: 1px solid rgba(255,255,255,.1); border-radius: 15px; padding: 0 12px; background: rgba(255,255,255,.065); display: flex; align-items: center; gap: 5px; font-weight: 650; white-space: nowrap; }
.selecting-feature .region-button { pointer-events: none; }
.region-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.connection { justify-self: end; display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; color: var(--muted); }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #7c8490; box-shadow: 0 0 0 4px rgba(124,132,144,.1); }
.connection[data-state="online"] .status-dot { background: var(--green); box-shadow: 0 0 12px rgba(67,213,140,.65); }
.connection[data-state="reconnecting"] .status-dot { background: var(--amber); animation: breathe 1.8s ease-in-out infinite; }
.connection[data-state="offline"] .status-dot { background: #81858c; }

.status-banner { position: absolute; z-index: 18; top: calc(max(12px, env(safe-area-inset-top)) + 70px); left: 50%; transform: translate(-50%, 0); display: flex; align-items: center; gap: 9px; border-radius: 16px; padding: 10px 14px; color: var(--muted); font-size: 12px; transition: opacity .28s var(--ease), transform .28s var(--ease); }
.status-banner.hidden { opacity: 0; transform: translate(-50%, -8px); pointer-events: none; }
.status-spinner { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 10px rgba(255,106,43,.6); }

.floating-button { position: absolute; z-index: 19; right: 14px; top: calc(max(12px, env(safe-area-inset-top)) + 82px); width: 48px; height: 48px; border-radius: 17px; display: grid; place-items: center; }
.floating-button, .icon-button { border: 1px solid var(--stroke); }
.floating-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.journal-button { top: calc(max(12px, env(safe-area-inset-top)) + 140px); }
.journal-button b { position: absolute; right: -4px; top: -5px; min-width: 21px; height: 21px; padding: 0 5px; display: grid; place-items: center; border: 2px solid #11151b; border-radius: 12px; background: var(--orange); color: #fff; font-size: 10px; line-height: 1; }
.pressable { cursor: pointer; transition: transform .18s var(--ease), background-color .18s; -webkit-tap-highlight-color: transparent; }
.pressable:active { transform: scale(.96); }

.filters-panel { position: absolute; z-index: 18; right: 70px; top: calc(max(12px, env(safe-area-inset-top)) + 82px); width: min(260px, calc(100vw - 84px)); padding: 16px; border-radius: 22px; opacity: 0; transform: translateY(-8px) scale(.96); transform-origin: top right; pointer-events: none; transition: .24s var(--ease); }
.filters-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.panel-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.filter-row { min-height: 46px; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.filter-row img { width: 30px; height: 30px; object-fit: cover; clip-path: polygon(50% 0,94% 25%,94% 75%,50% 100%,6% 75%,6% 25%); }
.filter-row span { flex: 1; font-size: 13px; }
.toggle { width: 38px; height: 23px; padding: 2px; border: 0; border-radius: 20px; background: rgba(255,255,255,.12); }
.toggle::after { content: ""; display: block; width: 19px; height: 19px; border-radius: 50%; background: #fff; transform: translateX(0); transition: transform .24s var(--ease), background .24s; }
.toggle.on { background: rgba(255,85,55,.65); }
.toggle.on::after { transform: translateX(15px); }

.alert-banner { position: absolute; z-index: 35; top: max(12px, env(safe-area-inset-top)); left: 50%; width: min(420px, calc(100vw - 28px)); min-height: 64px; border-radius: 21px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; opacity: 0; transform: translate(-50%, -120%) scale(.96); pointer-events: none; transition: .32s var(--ease); }
.alert-banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }
.alert-banner img { width: 42px; height: 42px; object-fit: cover; clip-path: polygon(50% 0,94% 25%,94% 75%,50% 100%,6% 75%,6% 25%); }
.alert-banner div { display: flex; flex-direction: column; }
.alert-banner strong { font-size: 14px; }
.alert-banner span { color: var(--muted); font-size: 12px; margin-top: 3px; }

.bottom-sheet { position: absolute; z-index: 31; left: 50%; top: 50%; width: min(430px, calc(100vw - 24px)); height: min(76dvh, 700px); border-radius: 28px; overflow: hidden; opacity: 0; pointer-events: none; transform: translate(-50%, calc(-50% + 18px)) scale(.96); transition: opacity .25s var(--ease), transform .32s var(--ease); }
.bottom-sheet[data-state="open"] { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.sheet-content { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 18px 14px 22px; }
.sheet-heading { position: sticky; z-index: 2; top: -18px; display: flex; align-items: center; justify-content: space-between; margin: -2px -2px 14px; padding: 14px 6px 10px; background: linear-gradient(#171b22 70%, transparent); }
.sheet-heading span { color: var(--muted); font-size: 9px; letter-spacing: .22em; }
.sheet-heading h1, .sheet-heading h2 { margin: 3px 0 0; font-size: 24px; letter-spacing: -.03em; }
.icon-button { width: 42px; height: 42px; border-radius: 15px; background: rgba(255,255,255,.06); font-size: 26px; font-weight: 250; }
.event-list { display: grid; gap: 9px; }
.event-card { width: 100%; border: 1px solid rgba(255,255,255,.085); border-radius: 20px; background: rgba(255,255,255,.045); color: inherit; padding: 11px; display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 11px; text-align: left; }
.event-card.selected { border-color: rgba(255,99,50,.92); background: rgba(255,99,50,.16); box-shadow: 0 0 0 2px rgba(255,99,50,.12), 0 10px 28px rgba(0,0,0,.28); }
.event-card img { width: 46px; height: 46px; object-fit: cover; clip-path: polygon(50% 0,94% 25%,94% 75%,50% 100%,6% 75%,6% 25%); }
.event-copy { min-width: 0; display: flex; flex-direction: column; }
.event-copy strong { font-size: 14px; }
.event-copy span { margin-top: 4px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-meta { text-align: right; display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
.event-meta b { color: #ff8c70; font-weight: 600; }
.empty-state { min-height: 230px; display: none; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-state.visible { display: grid; }
.empty-state strong { color: var(--text); margin-top: 13px; }
.empty-state p { margin: 6px 0; font-size: 12px; }
.safe-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 20px rgba(67,213,140,.5); }

.modal-backdrop { position: absolute; z-index: 29; inset: 0; background: rgba(2,4,7,.52); opacity: 0; pointer-events: none; transition: opacity .25s; }
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.region-select { position: absolute; z-index: 4300; inset: 0; display: none; overflow: hidden; background: #020407; color: #fff; }
.region-select.open { display: block; }
.region-select-title { position: absolute; z-index: 3; top: max(22px, env(safe-area-inset-top)); left: 50%; width: min(720px, calc(100% - 36px)); transform: translateX(-50%); text-align: center; pointer-events: none; }
.region-select-title span { color: #63a8ff; font-size: 10px; font-weight: 800; letter-spacing: .24em; }
.region-select-title h2 { margin: 6px 0 4px; font-size: clamp(24px, 4vw, 42px); letter-spacing: -.04em; }
.region-select-title p { margin: 0 auto; max-width: 610px; color: #8f9bab; font-size: 12px; line-height: 1.45; }
#region-map { position: absolute; inset: 0; width: 100%; height: 100%; shape-rendering: geometricPrecision; }
.region-shape { fill: #07101b; fill-opacity: .96; stroke: #2386ff; stroke-width: 5; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .2s, stroke-width .2s, filter .2s; }
.region-shape:hover, .region-shape.selected { fill: #102947; stroke: #6bb3ff; stroke-width: 7; filter: drop-shadow(0 0 10px rgba(35,134,255,.72)); }
.region-svg-label { cursor: pointer; color: #fff; filter: drop-shadow(0 2px 7px #000); }
.region-svg-title { fill: #fff; font: 800 24px/1 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; letter-spacing: .02em; }
.region-svg-subtitle { fill: #8097b2; font: 600 9px/1 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.region-svg-label.selected .region-svg-title { fill: #73b7ff; }
.region-select-hint { position: absolute; z-index: 3; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); color: #7890ac; font-size: 10px; letter-spacing: .08em; white-space: nowrap; }
.region-cancel { position: absolute; z-index: 4; right: 18px; top: max(18px, env(safe-area-inset-top)); min-width: 84px; height: 40px; border: 1px solid rgba(99,168,255,.35); border-radius: 14px; background: rgba(12,25,40,.85); color: #dcecff; }

.toast { position: absolute; z-index: 40; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom)); padding: 10px 14px; border-radius: 15px; color: var(--muted); font-size: 12px; opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: .25s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.hazard-marker { position: relative; width: var(--marker-size, 26px); height: var(--marker-size, 26px); filter: drop-shadow(0 4px 7px rgba(0,0,0,.5)); animation: marker-in .32s var(--ease); }
.marker-icons { width: 100%; height: 100%; display: flex; overflow: hidden; clip-path: polygon(50% 0,94% 25%,94% 75%,50% 100%,6% 75%,6% 25%); }
.hazard-marker img { width: 100%; height: 100%; display: block; object-fit: cover; }
.hazard-marker.multi img { width: 50%; }
.zone-label { display: none; position: absolute; left: 50%; top: calc(100% + 3px); width: max-content; max-width: 180px; transform: translateX(-50%); padding: 4px 7px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: rgba(8,10,14,.82); color: #fff; font: 600 10px/1.2 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 4px 12px rgba(0,0,0,.32); }
.zoom-close .zone-label { display: block; }
.route-arrow { width: 12px; height: 12px; display: grid; place-items: center; color: var(--route-color, #ff6332); font-size: 13px; line-height: 1; filter: drop-shadow(0 1px 3px #000); transform-origin: 50% 50%; }
.route-label { width: max-content; max-width: 170px; padding: 4px 7px; border: 1px dashed var(--route-color, #ff6332); border-radius: 8px; background: rgba(8,10,14,.84); color: #fff; font: 650 10px/1.2 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,.34); }

@keyframes marker-in { 0% { opacity: 0; transform: scale(.84); } 70% { transform: scale(1.05); } 100% { opacity: 1; transform: scale(1); } }
@keyframes breathe { 50% { opacity: .42; } }

@media (min-width: 760px) {
  .topbar { width: min(650px, calc(100% - 32px)); left: 50%; right: auto; transform: translateX(-50%); }
  .bottom-sheet { left: 24px; top: 88px; bottom: 18px; width: 410px; height: auto; transform: translateX(-18px) scale(.97); transform-origin: left center; }
  .bottom-sheet[data-state="open"] { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}


/* PROLET ALERT — REAL REGION PUSH + GUIDES V1 */
.guides-button { top: calc(max(12px, env(safe-area-inset-top)) + 198px); }
.guides-button svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }

.region-notify { position: absolute; z-index: 5; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); width: min(430px, calc(100% - 36px)); min-height: 64px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 19px; }
.region-notify > div { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.region-notify strong { font-size: 13px; }
.region-notify span { color: #8f9bab; font-size: 11px; line-height: 1.35; }
.region-notify .notify-toggle { flex: 0 0 auto; cursor: pointer; }
.region-select-hint { bottom: calc(max(24px, env(safe-area-inset-bottom)) + 78px); }

.guides-modal { position: absolute; z-index: 4500; inset: 0; display: none; overflow: hidden; background: #07090d; color: var(--text); }
.guides-modal.open { display: block; }
.guides-shell { width: min(920px, 100%); height: 100%; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
.guides-head { position: sticky; z-index: 3; top: calc(-1 * max(18px, env(safe-area-inset-top))); display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: calc(-1 * max(18px, env(safe-area-inset-top))) -18px 18px; padding: max(18px, env(safe-area-inset-top)) 18px 14px; background: linear-gradient(180deg, rgba(7,9,13,.98) 72%, rgba(7,9,13,.84)); backdrop-filter: blur(18px); }
.guides-head span { color: #6baeff; font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.guides-head h2 { margin: 3px 0 0; font-size: 28px; letter-spacing: -.04em; }
.guides-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.guide-card { position: relative; min-height: 190px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); border-radius: 24px; background: #11151b; color: inherit; padding: 0; text-align: left; box-shadow: 0 18px 50px rgba(0,0,0,.26); }
.guide-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, rgba(6,8,11,.22) 48%, rgba(6,8,11,.96) 100%); pointer-events: none; }
.guide-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.guide-card-number { position: absolute; z-index: 2; top: 12px; left: 12px; min-width: 29px; height: 29px; padding: 0 7px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; background: rgba(7,9,13,.64); font-size: 11px; font-weight: 800; backdrop-filter: blur(12px); }
.guide-card-copy { position: absolute; z-index: 2; left: 15px; right: 15px; bottom: 15px; display: flex; flex-direction: column; gap: 5px; }
.guide-card-copy strong { font-size: 17px; line-height: 1.15; }
.guide-card-copy span { color: rgba(255,255,255,.68); font-size: 11px; line-height: 1.35; }
.guide-detail { max-width: 760px; margin: 0 auto; padding-bottom: 30px; }
.guide-back { margin: 0 0 14px; border: 0; border-radius: 14px; background: rgba(255,255,255,.07); color: #cbd9ea; padding: 10px 13px; }
.guide-hero { display: grid; grid-template-columns: minmax(160px, 290px) 1fr; gap: 20px; align-items: center; margin-bottom: 18px; padding: 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 26px; background: rgba(255,255,255,.04); }
.guide-hero img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 18px; }
.guide-hero span { color: #6baeff; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.guide-hero h3 { margin: 7px 0 7px; font-size: clamp(22px, 4vw, 34px); line-height: 1.05; letter-spacing: -.04em; }
.guide-hero p { margin: 0; color: var(--muted); line-height: 1.45; }
.guide-steps { display: grid; gap: 10px; }
.guide-step { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 18px; background: rgba(255,255,255,.035); }
.guide-step > b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: rgba(78,155,255,.15); color: #7bb8ff; }
.guide-step strong { font-size: 14px; }
.guide-step p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.guide-dont { margin-top: 14px; padding: 15px 17px; border: 1px solid rgba(255,93,75,.22); border-radius: 18px; background: rgba(255,75,55,.07); }
.guide-dont strong { color: #ff8d7d; }
.guide-dont ul { margin: 9px 0 0; padding-left: 18px; color: #d5c4c2; font-size: 12px; line-height: 1.55; }
.guide-source { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 11px; }
.guide-source a { color: #75b6ff; text-decoration: none; }

@media (max-width: 620px) {
  .guides-grid { grid-template-columns: 1fr; }
  .guide-card { min-height: 170px; }
  .guide-hero { grid-template-columns: 1fr; }
  .guide-hero img { max-height: 240px; }
}
