:root {
  --ink: #1d2433;
  --muted: #5d6779;
  --card: rgba(255, 255, 255, 0.9);
  --line: rgba(29, 36, 51, 0.1);
  --live: #1f9d55;
  --schedule: #2f6db3;
  --off: #8a93a3;
  --error: #c0392b;
  --r: 16px;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; color: var(--ink); background: #dfe6ee; -webkit-tap-highlight-color: transparent; }
#map { position: fixed; inset: 0; z-index: 0; background: #dfe6ee; }
body.is-night #map { background: #0e1117; }
#tint, #fx { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#tint { transition: background 3s; }
#fx { width: 100%; height: 100%; }

.card {
  background: var(--card);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-radius: var(--r);
  box-shadow: 0 6px 24px rgba(20, 30, 60, 0.18);
}
.brand, .search, .panel, .tools, .fab, .attrib, .heli-ui { z-index: 10; }
.brand { position: fixed; top: 14px; left: 14px; padding: 12px 16px; min-width: 210px; }
.brand-name { font-weight: 800; font-size: 15px; }
.clock { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 2px; }
.date { color: var(--muted); font-size: 13px; }
.date::first-letter { text-transform: uppercase; }
.suninfo { color: var(--muted); font-size: 12px; margin-top: 4px; }

.search { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); width: min(440px, calc(100vw - 600px)); min-width: 260px; display: flex; align-items: center; padding: 0 12px; }
.s-icon { font-size: 20px; color: var(--muted); margin-right: 6px; }
.search input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 15px; padding: 13px 0; outline: none; color: var(--ink); min-width: 0; }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(20, 30, 60, 0.22); overflow: hidden; max-height: 60vh; overflow-y: auto; }
.results[hidden] { display: none; }
.results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 14px; font: inherit; cursor: pointer; border-top: 1px solid var(--line); color: var(--ink); }
.results button:first-child { border-top: 0; }
.results button:hover, .results button:focus { background: #f1f5fa; outline: none; }
.results b { display: block; font-size: 14px; }
.results span { display: block; font-size: 12px; color: var(--muted); }
.r-msg { padding: 12px 14px; color: var(--muted); font-size: 13px; }

.panel { position: fixed; top: 14px; right: 14px; width: 300px; display: flex; flex-direction: column; gap: 10px; }
.weather { padding: 14px 16px; }
.w-main { display: flex; align-items: center; gap: 10px; }
.w-icon { font-size: 32px; line-height: 1; }
.w-temp { font-size: 36px; font-weight: 800; }
.w-cond { font-weight: 700; margin-top: 2px; }
.w-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.w-grid span:empty { display: none; }
#w-aqi { grid-column: 1 / -1; }
.aqi { font-weight: 700; }
.aqi-g { color: var(--live); } .aqi-y { color: #b58900; } .aqi-o { color: #d35400; } .aqi-r { color: var(--error); }
.layers { padding: 12px 14px; }
.layers h2 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.lyr { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.lyr:first-of-type { border-top: 0; }
.lyr input { accent-color: var(--schedule); width: 16px; height: 16px; margin: 0; }
.lyr select { font: inherit; font-size: 12.5px; border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; background: #fff; }
.lyr-name { flex: 1; font-weight: 600; }
.lyr .sub { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
label.lyr { cursor: pointer; }
.legend { margin: 8px 0 0; font-size: 11px; color: var(--muted); line-height: 1.7; }
.badge { flex: none; font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 99px; color: #fff; background: var(--off); white-space: nowrap; }
.b-sim { background: #8a4fd1; }
.b-live { background: var(--live); } .b-schedule { background: var(--schedule); } .b-off { background: var(--off); } .b-error { background: var(--error); }
.b-live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #fff; margin-right: 4px; vertical-align: 1px; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.tools { position: fixed; left: 14px; bottom: 34px; display: flex; gap: 2px; padding: 6px; }
.tools button, .fab { border: 0; background: transparent; color: var(--ink); cursor: pointer; font: inherit; }
.tools button { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 54px; padding: 6px 8px; border-radius: 12px; font-size: 20px; }
.tools button span { font-size: 11px; font-weight: 700; }
.tools button:hover { background: rgba(29, 36, 51, 0.07); }
.tools button.on { background: #e4572e; color: #fff; }
.tools button.busy { animation: pulse 1s infinite; }
.fab { display: none; position: fixed; top: 14px; right: 14px; width: 46px; height: 46px; font-size: 20px; }

.attrib { position: fixed; left: 50%; transform: translateX(-50%); bottom: 4px; font-size: 10.5px; color: var(--muted); background: rgba(255, 255, 255, 0.75); padding: 2px 10px; border-radius: 99px; white-space: nowrap; }
.attrib a { color: inherit; }
body.is-night .attrib { background: rgba(20, 24, 32, 0.7); color: #aab3c2; }
.nojs { position: fixed; inset: 40% 0 auto; text-align: center; font-weight: 700; }

/* noche: el mapa baja su brillo con la luz real (--night va de 0 a 1) */
:root { --night: 0; }
#map .maplibregl-canvas { filter: brightness(calc(1 - var(--night) * 0.55)) saturate(calc(1 - var(--night) * 0.35)) hue-rotate(calc(var(--night) * 12deg)); transition: filter 3s; }
.map-msg { position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 12; padding: 14px 18px; font-weight: 700; }
.map-msg[hidden] { display: none; }
.maplibregl-ctrl-bottom-right { margin-bottom: 22px; }
.maplibregl-ctrl-bottom-left { margin-bottom: 96px; }
.maplibregl-popup-content { border-radius: 14px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(20, 30, 60, 0.25); }
.me { width: 18px; height: 18px; border-radius: 50%; background: #2f6db3; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47, 109, 179, 0.25); }

/* unidades de transporte */
.u { position: relative; width: 30px; height: 30px; cursor: pointer; }
.u-arrow { position: absolute; inset: 0; border-radius: 50%; background: var(--c); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); border: 2px solid #fff; transition: transform 0.3s; }
.u-arrow::after { content: ""; position: absolute; left: 50%; top: -7px; transform: translateX(-50%); border: 6px solid transparent; border-bottom: 7px solid var(--c); border-top: 0; }
.u-rail .u-arrow { border-radius: 8px; }
.u-l { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35); pointer-events: none; }
.plane { position: relative; width: 28px; height: 28px; cursor: pointer; }
.pl { width: 28px; height: 28px; transition: transform 0.4s; filter: drop-shadow(5px 10px 3px rgba(0, 0, 0, 0.3)); }
.pl-cs { position: absolute; left: 50%; top: 30px; transform: translateX(-50%); font-size: 10px; font-weight: 800; white-space: nowrap; color: #1d2433; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
body.is-night .pl-cs { color: #ffd27a; text-shadow: 0 0 3px #000; }
.pl svg { fill: #1d2433; stroke: #fff; stroke-width: 1.1; }
body.is-night .pl svg { fill: #ffd27a; stroke: #1d2433; }
.pl-gnd .pl { opacity: 0.6; filter: none; }
.pop { font: 13px/1.5 ui-rounded, "Nunito", system-ui, sans-serif; color: var(--ink); min-width: 200px; }
.pop-h { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.pop .dot { width: 12px; height: 12px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); flex: none; }
.pop div:not(.pop-h) { color: var(--muted); }
.pop .badge { display: inline-block; margin-top: 6px; }

/* helicóptero: va abajo del centro, la cámara lo sigue por detrás */
.heli, .heli-shadow, .heli-ui { display: none; }
body.flying .heli, body.flying .heli-shadow, body.flying .heli-ui { display: block; }
body.flying .search, body.flying .fab, body.flying .brand { display: none; }
body.flying:not(.panel-open) .panel { display: none; }
body.flying.panel-open .panel { top: 108px; bottom: auto; transform: none; z-index: 20; max-height: calc(100vh - 120px); overflow-y: auto; }
.layers-fly { position: fixed; right: 14px; top: 62px; border: 0; padding: 8px 14px; font: inherit; font-weight: 800; cursor: pointer; color: var(--ink); z-index: 21; }
body.flying.panel-open .layers-fly { background: #1d2433; color: #fff; }
.heli { position: fixed; left: 50%; top: 71%; width: 96px; height: 96px; z-index: 6; pointer-events: none; transform: translate(-50%, -50%); filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.3)); }
.heli svg { width: 100%; height: 100%; }
.heli-shadow { position: fixed; left: 50%; top: 71%; width: 70px; height: 34px; z-index: 5; pointer-events: none; border-radius: 50%; background: rgba(0, 0, 0, 0.6); filter: blur(5px); transform: translate(-50%, -50%); }
.rotor { position: absolute; left: 50%; top: 40%; width: 118px; height: 118px; margin: -59px 0 0 -59px; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(40, 50, 70, 0.6) 0 5deg, transparent 5deg 90deg, rgba(40, 50, 70, 0.6) 90deg 95deg, transparent 95deg 180deg, rgba(40, 50, 70, 0.6) 180deg 185deg, transparent 185deg 270deg, rgba(40, 50, 70, 0.6) 270deg 275deg, transparent 275deg);
  animation: spin 0.16s linear infinite; }
.rotor::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(40, 50, 70, 0.08); }
@keyframes spin { to { transform: rotate(360deg); } }
.hud { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); padding: 8px 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hint { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); padding: 6px 12px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.joy { position: fixed; left: 24px; bottom: 150px; width: 124px; height: 124px; border-radius: 50%; background: rgba(255, 255, 255, 0.6); border: 2px solid rgba(29, 36, 51, 0.15); touch-action: none; cursor: grab; backdrop-filter: blur(6px); }
.knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: #e4572e; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3); }
.alt-btns { position: fixed; right: 18px; bottom: 150px; display: flex; flex-direction: column; gap: 10px; }
.alt-btns button { width: 66px; height: 66px; border: 0; font-size: 20px; color: var(--ink); touch-action: none; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.alt-btns span { font-size: 10px; font-weight: 700; }
.exit { position: fixed; right: 14px; top: 14px; border: 0; padding: 10px 16px; font: inherit; font-weight: 800; cursor: pointer; color: #e4572e; }
body.flying .maplibregl-ctrl-bottom-right, body.flying .maplibregl-ctrl-bottom-left { display: none; }
@media (pointer: coarse) { .hint { display: none; } }

@media (max-width: 900px) {
  .search { left: 14px; right: 74px; transform: none; width: auto; top: auto; bottom: 96px; }
  .results { top: auto; bottom: calc(100% + 6px); }
  .attrib { max-width: calc(100vw - 20px); }
}
@media (max-width: 760px) {
  .brand { min-width: 0; padding: 10px 12px; }
  .clock { font-size: 24px; }
  .fab { display: block; }
  .search { right: 14px; bottom: 92px; }
  .panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; padding: 10px 10px 26px; gap: 8px; transform: translateY(105%); transition: transform 0.25s ease; z-index: 20; }
  body.panel-open .panel { transform: none; }
  .tools { bottom: 26px; }
    }

/* 1.5: sismos, gasolineras, incendios */
.lyr .mini { display: block; margin-top: 3px; padding: 2px 8px; border: 0; border-radius: 8px; background: #e8f4ec; color: #17693b; font: inherit; font-size: 11.5px; font-weight: 700; text-align: left; cursor: pointer; }
.lyr .mini:hover { background: #d4ecdc; }
.lyr select#opt-fuel { margin-left: 4px; padding: 1px 4px; font-size: 11.5px; vertical-align: 1px; }
.pop .prices { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0; color: var(--ink) !important; }
.pop .prices b { color: var(--ink); }
.pop a { color: var(--schedule); font-weight: 700; }
.alerta { position: fixed; z-index: 30; top: 74px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 24px)); padding: 10px 12px 10px 14px; background: #fff3ef; border: 2px solid #e4572e; font-size: 13.5px; font-weight: 700; color: #7a2412; }
.alerta[hidden] { display: none; }
.alerta .a-x { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; padding: 0 2px; }
.panel { max-height: calc(100vh - 28px); overflow-y: auto; scrollbar-width: thin; }
@media (max-width: 760px) { .alerta { top: auto; bottom: 86px; } }

/* 1.6: carteles de gasolinera tipo tótem */
:root { --gas-glow: 0.4; }
.gas-sign { --k: 1; position: relative; width: 0; height: 0; overflow: visible; cursor: pointer; }
.gs-board { position: absolute; bottom: calc(46px * var(--k)); left: 50%; translate: -50% 0; width: 150px; padding: 5px 5px 4px; border-radius: 9px;
  transform: scale(var(--k)); transform-origin: 50% 100%; background: linear-gradient(#262b33, #14171c); border: 2px solid #3d4552; box-shadow: 0 6px 14px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
  font: 700 10px/1 ui-rounded, "Nunito", system-ui, sans-serif; color: #fff; transition: transform .15s; }
.gas-sign:hover .gs-board { transform: scale(calc(var(--k) * 1.07)); }
.gs-head { display: flex; align-items: center; gap: 4px; padding: 2px 3px 5px; border-bottom: 1px solid rgba(255, 255, 255, .12); margin-bottom: 4px; }
.gs-pump { font-size: 12px; }
.gs-name { font-size: 10px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e8ecf2; }
.gs-row { position: relative; display: flex; align-items: center; height: 19px; margin-top: 3px; border-radius: 4px; overflow: hidden; background: #0b0d10; }
.gs-lbl { width: 46px; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 8px; letter-spacing: .04em; color: #fff; }
.mg .gs-lbl { background: #1f9d55; } .pr .gs-lbl { background: #d7263d; } .ds .gs-lbl { background: #5b6472; }
.gs-led { flex: 1; text-align: right; padding-right: 6px; font: 700 14px/1 "DS-Digital", "Courier New", ui-monospace, monospace; letter-spacing: .04em;
  color: #ffb13b; text-shadow: 0 0 calc(2px + 6px * var(--gas-glow)) rgba(255, 150, 30, calc(.3 + .7 * var(--gas-glow))); }
.gs-led b { font-weight: 700; margin: 0 -1px; } .gs-led small { font-size: 10px; }
.gs-row.na .gs-led { color: #4a3a22; text-shadow: none; }
.gs-row.sel { box-shadow: 0 0 0 1.5px #fff; }
.gs-row i { width: 34px; flex: none; text-align: center; font-style: normal; font-size: 8px; font-weight: 800; border-left: 1px solid rgba(255, 255, 255, .08); }
.gs-row i.eq { color: #8b95a5; }
.gs-row i.down { color: #7dffb0; } .gs-row i.up { color: #ff8f8f; }
.gs-foot { margin-top: 4px; font-size: 7px; font-weight: 600; color: #8b95a5; text-align: center; letter-spacing: .03em; }
.gs-best { position: absolute; top: -14px; left: 50%; translate: -50% 0; white-space: nowrap; padding: 2px 7px; border-radius: 99px; background: #1f9d55; color: #fff;
  font-size: 9px; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.gs-pole { position: absolute; bottom: 4px; left: 50%; translate: -50% 0; width: 7px; height: calc(44px * var(--k)); background: linear-gradient(90deg, #6b7380, #c9ced6 45%, #59606b); border-radius: 2px; transform: none; }
.gs-foot-base { position: absolute; bottom: 0; left: 50%; translate: -50% 0; width: 20px; height: 6px; border-radius: 50%; background: rgba(0, 0, 0, .35); filter: blur(1px); transform: none; }

/* 1.7: noticias */
.ticker { position: fixed; z-index: 9; left: 214px; right: 330px; bottom: 40px; display: flex; align-items: center; height: 40px; padding: 0; overflow: hidden; }
.ticker[hidden] { display: none; }
.tk-lbl { flex: none; align-self: stretch; display: flex; align-items: center; padding: 0 12px; background: #d7263d; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.tk-track { position: relative; flex: 1; display: flex; overflow: hidden; height: 100%; mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); --dur: 90s; }
.tk-run { display: flex; flex: none; align-items: center; gap: 26px; padding-right: 26px; animation: tk var(--dur) linear infinite; }
.tk-track:hover .tk-run { animation-play-state: paused; }
@keyframes tk { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.tk-item { flex: none; display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; }
.tk-item:hover { text-decoration: underline; }
.tk-item i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tk-item em { font-style: normal; font-size: 11px; font-weight: 800; color: #fff; background: #3b4250; padding: 2px 6px; border-radius: 6px; }
.tk-item.nogeo { color: var(--muted); }
body.flying .ticker { display: none; }
@media (max-width: 900px) { .ticker { left: 14px; right: 14px; bottom: 150px; } }
@media (max-width: 760px) { .ticker { display: none; } }
@media (prefers-reduced-motion: reduce) { .tk-run { animation: none; } .tk-track { overflow-x: auto; } }
.news-pop .np-st { font-weight: 800; font-size: 12px; }
.news-pop .np-t { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.news-pop .np-title { display: block; margin: 4px 0; font-size: 14px; line-height: 1.35; color: var(--ink); }

/* cdmx: Ciudad de México */
.brand-top { display: flex; align-items: center; gap: 10px; }
.brand-top .brand-name { flex: 1; }
.lang { font-size: 11px; font-weight: 800; color: var(--ink); text-decoration: none; border: 1.5px solid var(--line); border-radius: 7px; padding: 1px 6px; }
.lang:hover { background: rgba(29, 36, 51, .07); }
.bullet { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 3px; border-radius: 99px; font-weight: 800; font-size: 13px; line-height: 1; flex: none; }
.bullet.sm { min-width: 18px; height: 18px; font-size: 11px; }
.pop .arr { display: flex; align-items: center; gap: 7px; padding: 3px 0; border-top: 1px solid var(--line); color: var(--ink) !important; }
.pop .arr:first-of-type { border-top: 0; }
.pop .arr-h { flex: 1; font-size: 12.5px; color: var(--muted); }
.pop .arr b { font-size: 12.5px; }
.pop .muted { color: var(--muted); font-size: 12px; }
.pop .alert-line { margin-top: 4px; padding: 4px 6px; border-radius: 6px; background: #fff5e6; color: #7a4a00 !important; font-size: 12px; }
.pop .bike-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0; color: var(--ink) !important; }
.cam-pop { min-width: 300px; }
.cam-img { display: block; width: 100%; border-radius: 8px; margin: 6px 0 4px; background: #111; aspect-ratio: 4 / 3; object-fit: cover; }
.cam-off { margin: 6px 0; padding: 30px 10px; border-radius: 8px; background: #20252d; color: #c9ced6 !important; text-align: center; font-size: 12px; }
.cam-t { font-size: 11.5px; }
.rec { width: 10px; height: 10px; border-radius: 50%; background: #e4572e; animation: pulse 1.2s infinite; flex: none; }
.speed-scale { display: flex; align-items: center; gap: 2px; margin-top: 3px; }
.speed-scale i { width: 16px; height: 5px; border-radius: 2px; }
.speed-scale em { font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--muted); margin-left: 5px; }
