/* Aerovista — tokens del diseño (slate + Roboto) */
:root {
  --slate-950: #0F172A;
  --slate-900: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --line:      #E2E8F0;
  --bg-app:    #F8FAFC;
  --bg-soft:   #F1F5F9;
  --white:     #FFFFFF;

  --blue:        #3B82F6;
  --blue-active: #60A5FA;

  --vfr:        #0D9488;
  --vfr-bg:     #F0FDFA;
  --vfr-line:   #99F6E4;
  --mvfr:       #D97706;
  --mvfr-bg:    #FFFBEB;
  --mvfr-line:  #FDE68A;
  --ifr:        #9F1239;
  --ifr-bg:     #FFF1F2;
  --ifr-line:   #FECDD3;
  --lifr:       #A21CAF;
  --lifr-bg:    #FDF4FF;
  --lifr-line:  #F0ABFC;
  --off:        #64748B;
  --off-bg:     #F1F5F9;
  --off-line:   #CBD5E1;
  --cam:        #0F172A;

  --font: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --cond: Manrope, var(--font);
  --mono: "Roboto Mono", Menlo, Consolas, monospace;

  --sh-sm: 0 1px 2px rgba(15, 23, 42, .08);
  --sh-md: 0 4px 10px rgba(15, 23, 42, .08);
  --sh-lg: 0 12px 28px rgba(15, 23, 42, .14);
  --r: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--slate-950);
  background: var(--slate-950);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1200;
  background: var(--white); padding: .6rem 1rem; color: var(--blue);
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

button {
  font-family: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

/* ═══ Header ═══ */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  flex: none;
  background: var(--slate-950);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand__txt { display: flex; flex-direction: column; text-align: left; }
.brand__name {
  font: 700 16px var(--cond);
  letter-spacing: .2px;
  color: #F8FAFC;
}
.brand__sub { font: 400 10.5px var(--mono); color: var(--slate-400); }

.topnav { display: none; gap: 4px; margin-left: 24px; }
.topnav__btn {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 8px;
  font: 500 13px var(--font);
  color: var(--slate-500);
  fill: var(--slate-500);
}
.topnav__btn.is-active {
  background: var(--slate-900);
  color: var(--blue-active);
  fill: var(--blue-active);
}

.topbar__search {
  margin-left: auto;
  width: 38px; height: 38px;
  border: 1px solid var(--slate-700);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

/* ═══ Pantallas ═══ */
.screens { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.screen {
  flex: 1;
  min-height: 0;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
}
.screen--light { background: var(--bg-app); overflow-y: auto; }
.screen--white { background: var(--white); }
.screen--map { position: relative; background: #E8EBE6; }

.wrap { margin: 0 auto; padding: 16px 20px 32px; display: flex; flex-direction: column; }
.wrap--detail { max-width: 1360px; gap: 16px; }
.wrap--loop   { max-width: 760px;  gap: 14px; }
.wrap--metars { max-width: 920px;  gap: 12px; }

/* ═══ Cabecera de página ═══ */
.pagehead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pagehead__txt { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 200px; }
.pagehead__title { margin: 0; font: 500 17px var(--font); color: var(--slate-950); }
.pagehead__title--sm { font-size: 16px; }
.pagehead__meta { margin: 0; font: 400 11px var(--mono); color: var(--slate-500); }
.pagehead__stamp { font: 400 11px var(--mono); color: var(--slate-500); }
.pagehead--bare .pagehead__title { flex: none; }
.sqbtn--right { margin-left: auto; }

/* ═══ Botones cuadrados ═══ */
.sqbtn {
  width: 46px; height: 46px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-md);
  flex: none;
}
.sqbtn--line { width: 38px; height: 38px; box-shadow: none; border-radius: 8px; }
.sqbtn--dark {
  width: 36px; height: 36px;
  background: transparent;
  border-color: var(--slate-700);
  box-shadow: none;
  border-radius: 8px;
}

/* ═══ Badges de categoría ═══ */
.badge {
  display: inline-flex; align-items: center;
  height: 26px; padding: 0 10px;
  border-radius: 6px;
  font: 600 11px var(--mono);
  flex: none;
}
.badge--vfr  { color: var(--vfr);  background: var(--vfr-bg);  border: 1px solid var(--vfr-line); }
.badge--mvfr { color: var(--mvfr); background: var(--mvfr-bg); border: 1px solid var(--mvfr-line); }
.badge--ifr  { color: var(--ifr);  background: var(--ifr-bg);  border: 1px solid var(--ifr-line); }
.badge--lifr { color: var(--lifr); background: var(--lifr-bg); border: 1px solid var(--lifr-line); }
.badge--off  { color: var(--off);  background: var(--off-bg);  border: 1px solid var(--off-line); }
.badge--cam  { color: var(--white); background: var(--cam); border: 1px solid var(--cam); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot--vfr  { background: var(--vfr); }
.dot--mvfr { background: var(--mvfr); }
.dot--ifr  { background: var(--ifr); }
.dot--lifr { background: var(--lifr); }
.dot--off  { background: var(--off); }
.dot--cam  { background: var(--cam); }

/* ═══ Mapa ═══ */
#map { position: absolute; inset: 0; }

.map-top {
  position: absolute;
  top: 14px; left: 16px; right: 16px;
  display: flex; gap: 8px;
  max-width: 560px;
  z-index: 600;
}

.searchbox {
  position: relative;
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  height: 46px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0 14px;
  box-shadow: var(--sh-md);
}
.searchbox input {
  flex: 1; min-width: 0;
  border: 0; outline: none;
  font: 400 13.5px var(--font);
  color: var(--slate-950);
  background: transparent;
}
.searchbox input::placeholder { color: var(--slate-500); }
.searchbox--flat { height: 42px; box-shadow: none; border-radius: 9px; padding: 0 13px; }

.searchbox__results {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  margin: 0; padding: 5px;
  list-style: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-lg);
  max-height: 320px;
  overflow-y: auto;
}
.searchbox__results button {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  text-align: left;
}
.searchbox__results button:hover,
.searchbox__results button:focus { background: var(--bg-soft); }
.result__id { font: 600 12px var(--mono); color: var(--slate-950); min-width: 44px; }
.result__name { flex: 1; font: 400 13px var(--font); color: var(--slate-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.basemaps {
  position: absolute;
  top: 72px; left: 16px;
  display: flex; gap: 2px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .06);
  z-index: 600;
}
.basemaps__btn {
  height: 26px;
  display: flex; align-items: center;
  padding: 0 11px;
  border-radius: 6px;
  font: 400 11.5px var(--font);
  color: var(--slate-600);
}
.basemaps__btn.is-on { background: var(--slate-950); color: var(--white); font-weight: 500; }

.legend {
  position: absolute;
  bottom: 20px; left: 16px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
  z-index: 600;
}
.legend__item { display: flex; align-items: center; gap: 4px; font: 500 10px var(--mono); color: var(--slate-700); }
.legend--lifted { bottom: 96px; }

.mapcard {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  max-width: 520px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--sh-lg);
  padding: 13px 14px;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  z-index: 600;
}
.mapcard__thumb {
  width: 56px; height: 44px;
  border-radius: 7px;
  flex: none;
  overflow: hidden;
  background: var(--slate-900);
  display: flex; align-items: center; justify-content: center;
}
.mapcard__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mapcard__txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.mapcard__name { font: 500 14px var(--font); color: var(--slate-950); }
.mapcard__meta {
  font: 400 11.5px var(--font); color: var(--slate-500);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Marcadores Leaflet */
.mk-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--white);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .25);
  background: var(--off);
}
.mk-dot--vfr  { background: var(--vfr); }
.mk-dot--mvfr { background: var(--mvfr); }
.mk-dot--ifr  { background: var(--ifr); }
.mk-dot--lifr { background: var(--lifr); }
.mk-dot--off  { background: var(--off); }
.mk-dot.is-sel { outline: 3px solid rgba(59, 130, 246, .45); outline-offset: 1px; }

.mk-cam {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--slate-950);
  border: 2.5px solid var(--white);
  box-shadow: 0 4px 10px rgba(15, 23, 42, .28);
  display: flex; align-items: center; justify-content: center;
}
.mk-cam.is-sel { outline: 3px solid rgba(59, 130, 246, .45); outline-offset: 1px; }
.mk-cam__dot {
  position: absolute;
  top: -3px; right: -3px;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: var(--off);
}
.mk-cam__dot--vfr  { background: var(--vfr); }
.mk-cam__dot--mvfr { background: var(--mvfr); }
.mk-cam__dot--ifr  { background: var(--ifr); }
.mk-cam__dot--lifr { background: var(--lifr); }

.mklabel {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: none;
  padding: 1px 6px;
  font: 500 10px var(--mono);
  color: var(--slate-700);
}
.mklabel::before { display: none; }
.mklabel--cam {
  border-radius: 6px;
  padding: 2px 9px;
  font: 500 11px var(--font);
  color: var(--slate-950);
  background: var(--white);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}
/* Etiquetas de aeropuerto solo con zoom suficiente */
#map:not(.show-apt-labels) .mklabel--apt { display: none; }

.leaflet-container { font-family: var(--font); }

/* ═══ Detalle ═══ */
.detail-grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.detail-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.detail-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
#d-camblock { display: flex; flex-direction: column; gap: 10px; }

.viewhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.viewhead__dir { font: 500 14px var(--font); color: var(--slate-950); }
.viewhead__age { font: 400 12px var(--font); color: var(--slate-500); }
.viewhead .seg { margin-left: auto; }

.seg {
  display: flex; gap: 2px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
}
.seg__btn {
  height: 26px;
  display: flex; align-items: center;
  padding: 0 11px;
  border-radius: 5px;
  font: 400 11.5px var(--font);
  color: var(--slate-500);
  white-space: nowrap;
}
.seg__btn.is-on { background: var(--slate-950); color: var(--white); font-weight: 500; }
.seg--sm { border: 0; margin-left: auto; }
.seg--sm .seg__btn { height: 24px; padding: 0 10px; font-size: 11px; }
.seg--sm .seg__btn.is-on {
  background: var(--white); color: var(--slate-950);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}
.seg--dark { background: var(--slate-900); border-color: var(--slate-700); }
.seg--dark .seg__btn { color: var(--slate-400); }
.seg--dark .seg__btn.is-on { background: var(--slate-700); color: var(--white); }

.frames { display: flex; flex-direction: column; gap: 12px; }
.frames.is-both { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.frame {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: var(--r);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--slate-900);
  cursor: zoom-in;
  padding: 0;
  width: 100%;
  display: block;
}
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.frame__tag {
  position: absolute;
  font: 500 10px var(--mono);
  color: var(--white);
  background: rgba(15, 23, 42, .6);
  padding: 3px 8px;
  border-radius: 5px;
  z-index: 2;
  pointer-events: none;
}
.frame__tag--tl { top: 10px; left: 10px; }
.frame__tag--bl { bottom: 10px; left: 10px; font-family: var(--font); font-weight: 400; }
.frame__tag--speed {
  top: 10px; right: 10px;
  background: var(--blue);
  font-weight: 600;
  pointer-events: auto;
  cursor: pointer;
}

.bigbtn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px;
  border-radius: 9px;
  background: var(--slate-950);
  font: 500 14px var(--font);
  color: var(--white);
  letter-spacing: .2px;
}
.bigbtn--half { flex: 1; min-width: 200px; height: 44px; border-radius: 8px; font-size: 13px; }
.bigbtn--ghost {
  flex: 1; min-width: 200px; height: 44px; border-radius: 8px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--slate-600);
  font: 500 13px var(--font);
}

/* Tarjetas */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.card__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card__label { font: 600 11px var(--mono); color: var(--slate-500); letter-spacing: .6px; }
.card__sub { font: 400 11px var(--font); color: var(--slate-400); }

.rawbox {
  margin: 0;
  font: 400 12px/1.65 var(--mono);
  color: var(--slate-950);
  background: var(--bg-app);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.obs {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 16px;
}
.obs > div { display: flex; flex-direction: column; gap: 2px; }
.obs dt { font: 400 11px var(--font); color: var(--slate-500); }
.obs dd { margin: 0; font: 500 13px var(--mono); color: var(--slate-950); }
.obs--card { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

/* Brújula de orientación */
.compasscard {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #E8EBE6;
}
.compasscard svg { display: block; width: 100%; }
.compasscard__chip {
  position: absolute;
  top: 10px; left: 12px;
  display: flex; align-items: center; gap: 6px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 11px;
  box-shadow: var(--sh-sm);
  font: 500 11px var(--font);
  color: var(--slate-700);
  white-space: nowrap;
}

.note { margin: 0; font: 400 12px/1.5 var(--font); color: var(--slate-500); }

/* ═══ Loop ═══ */
.loopframe {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--r);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--slate-900);
}
.loopframe img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.loopctl { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.loopctl__end {
  height: 40px;
  display: flex; align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 500 12px var(--font);
  color: var(--slate-600);
}
.loopctl__round {
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
}
.loopctl__play {
  width: 56px; height: 56px;
  border-radius: 9999px;
  background: var(--slate-950);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(15, 23, 42, .2);
}

.loopstrip { display: flex; flex-direction: column; gap: 6px; }
.loopstrip__track {
  position: relative;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: flex;
  cursor: ew-resize;
  touch-action: none;
}
.loopstrip__seg { flex: 1; }
.loopstrip__cursor {
  position: absolute;
  top: 0; bottom: 0;
  width: 3px;
  background: var(--blue);
  border-radius: 2px;
  pointer-events: none;
}
.loopstrip__knob {
  position: absolute;
  top: -4px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--white);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
  transform: translateX(-5px);
  pointer-events: none;
}
.loopstrip__labels { display: flex; justify-content: space-between; }
.loopstrip__labels span { font: 400 10px var(--mono); color: var(--slate-500); }
.loopstrip__labels .is-now { font-weight: 600; color: var(--blue); }

.infobar {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  background: var(--bg-app);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.infobar svg { flex: none; margin-top: 2px; }
.infobar span { font: 400 12px/1.4 var(--font); color: var(--slate-600); }

.loopactions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═══ METARs ═══ */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 26px;
  display: flex; align-items: center; gap: 4px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 9999px;
  font: 500 11px var(--font);
  color: var(--slate-700);
}
.chip .dot { width: 7px; height: 7px; }
.chip.is-on { background: var(--blue); border-color: var(--blue); color: var(--white); }
.chip.is-on .dot { background: var(--white); }

.metargrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
}

.metarcard {
  background: var(--white);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--r);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 7px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  text-align: left;
}
.metarcard--vfr  { border-left-color: var(--vfr); }
.metarcard--mvfr { border-left-color: var(--mvfr); }
.metarcard--ifr  { border-left-color: var(--ifr); }
.metarcard--lifr { border-left-color: var(--lifr); }
.metarcard--off  { border-left-color: var(--off-line); }

.metarcard__head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.metarcard__icao { font: 600 13px var(--mono); color: var(--slate-950); flex: none; }
.metarcard__name {
  font: 400 12px var(--font); color: var(--slate-600);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.metarcard__badge {
  margin-left: auto;
  font: 600 10.5px var(--mono);
  padding: 2px 8px;
  border-radius: 5px;
  flex: none;
}
.metarcard__raw { font: 400 11px/1.6 var(--mono); color: var(--slate-700); word-break: break-word; }
.metarcard__cam { display: flex; align-items: center; gap: 6px; font: 400 10.5px var(--font); color: var(--slate-500); }

/* ═══ Nav inferior ═══ */
.bottomnav {
  display: flex;
  background: var(--slate-950);
  border-top: 1px solid var(--slate-900);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 10px));
  flex: none;
}
.bottomnav__btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding-top: 6px;
  font: 500 10.5px var(--font);
  color: var(--slate-500);
  fill: var(--slate-500);
}
.bottomnav__btn.is-active { color: var(--blue-active); fill: var(--blue-active); }

/* ═══ Visor ampliado ═══ */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .82);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 1100;
}
.lightbox__inner {
  width: min(1080px, 100%);
  max-height: 100%;
  background: var(--slate-950);
  border: 1px solid var(--slate-700);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.lightbox__head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.lightbox__head h2 {
  margin: 0; flex: 1; min-width: 160px;
  font: 500 14px var(--font); color: #F8FAFC;
}
.lightbox__body { min-height: 0; overflow: auto; }
.lightbox__body img { display: block; width: 100%; }
.lightbox__foot { padding: 10px 16px; font: 400 11px var(--mono); color: var(--slate-400); }

/* ═══ Escritorio ═══ */
@media (min-width: 900px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  .screen { border-radius: 14px 14px 0 0; }
}

@media (max-width: 560px) {
  .viewhead .seg { margin-left: 0; width: 100%; }
  .viewhead .seg__btn { flex: 1; justify-content: center; }
  .frames.is-both { grid-template-columns: 1fr; }
  .leaflet-control-zoom { display: none; }
}

/* Aerovista · dirección clara inspirada en Waymo (DESIGN.md, 2026-10-20) */
:root {
  --bg-app: oklch(95.8% 0.012 255);
  --bg-soft: oklch(93.5% 0.015 255);
  --white: oklch(99.6% 0.002 255);
  --line: oklch(87.8% 0.015 255);
  --slate-950: oklch(20% 0.033 258);
  --blue: #1769d2;
  --blue-active: #1769d2;
  --r: 24px;
  --sh-md: 0 5px 20px rgb(24 42 68 / .08);
}
body { background: var(--bg-app); }
button, a, [role="slider"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, [role="slider"]:focus-visible, input:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 3px;
}
button:disabled { opacity: .42; cursor: default; }
.topbar { background: var(--bg-app); padding: 16px 24px; gap: 16px; }
.brand__name { font: 800 21px var(--font); letter-spacing: -.8px; color: var(--slate-950); }
.brand__sub { font: 500 11px var(--font); color: var(--slate-500); letter-spacing: .2px; }
.brand > svg { width: 38px; height: 38px; }
.brand > svg rect { rx: 15px; }
.topbar__search { width: 44px; height: 44px; border-radius: 50%; border-color: var(--line); background: var(--white); }
.topbar__search svg { fill: var(--slate-950); }
.topnav { padding: 4px; background: var(--white); border-radius: 32px; gap: 4px; }
.topnav__btn { height: 42px; border-radius: 28px; padding: 0 20px; font-weight: 600; color: var(--slate-600); }
.topnav__btn.is-active { background: var(--bg-soft); color: var(--slate-950); fill: var(--slate-950); }
.screen, .screen--white { background-color: var(--bg-app); border-radius: 28px 28px 0 0; }
.screen--map { background-color: #e8ebe6; }
.wrap { padding: 24px 28px 40px; gap: 24px; }
.wrap--loop { max-width: 1040px; }
.wrap--detail { max-width: 1440px; }
.pagehead { gap: 16px; }
.pagehead__title, .pagehead__title--sm { font-size: 24px; font-weight: 700; letter-spacing: -.8px; line-height: 1.25; }
.pagehead__meta { margin-top: 6px; font-size: 11px; line-height: 1.7; }
.sqbtn, .sqbtn--line { border-radius: 50%; width: 46px; height: 46px; background: var(--white); }
.map-top { top: 20px; left: 24px; right: 24px; max-width: 520px; }
.searchbox { height: 54px; border-radius: 32px; padding: 0 20px; border-color: transparent; }
.searchbox input { font-size: 14px; }
.searchbox:focus-within { outline: 2px solid var(--blue); }
.searchbox__results { border-radius: 24px; padding: 8px; }
.searchbox__results button { border-radius: 16px; padding: 12px; }
.basemaps { top: 86px; left: 24px; border-radius: 30px; padding: 4px; border-color: transparent; }
.basemaps__btn { border-radius: 24px; height: 34px; padding: 0 14px; font-weight: 600; }
.basemaps__btn.is-on { background: var(--bg-soft); color: var(--slate-950); }
.mapcard { border-radius: 28px; border: 0; padding: 16px; background: var(--white); }
.mk-cam { width: var(--marker-size, 34px); height: var(--marker-size, 34px); border-width: 2px; border-radius: 50%; box-shadow: 0 2px 6px rgb(20 38 60 / .2); }
.mk-cam > svg { width: 55%; height: 55%; }
.mk-cam__dot { width: max(6px, calc(var(--marker-size, 34px) * .27)); height: max(6px, calc(var(--marker-size, 34px) * .27)); top: -2px; right: -2px; border-width: 1.5px; }
.mklabel--cam { border-radius: 18px; }
#map.compact-cameras .mklabel--cam { display: none; }
.leaflet-marker-icon:focus-visible { outline: 3px solid var(--blue); outline-offset: 5px; }
.detail-grid { gap: 24px; }
.detail-main, .detail-side { gap: 24px; }
#d-camblock { gap: 16px; }
.viewhead { gap: 10px; }
.viewhead__dir { font-weight: 700; }
.seg { border-radius: 28px; padding: 4px; background: var(--white); border-color: transparent; gap: 4px; }
.seg__btn { min-height: 36px; height: auto; padding: 8px 14px; border-radius: 24px; font-size: 12px; font-weight: 600; }
.seg__btn.is-on { background: var(--slate-950); }
.seg--sm .seg__btn { height: auto; }
.badge { border-radius: 24px; padding: 0 12px; height: 30px; }
.frames { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 24px; }
.camera-view { min-width: 0; }
.frame { aspect-ratio: 16/9; border: 0; border-radius: 24px; }
.frame img, .loopframe img { object-fit: contain; }
.frame__tag { border-radius: 12px; padding: 6px 10px; font-size: 10px; }
.frame__tag--tl { top: 14px; left: 14px; }
.frame__tag--bl { bottom: 14px; left: 14px; }
.frame__tag--speed { top: 14px; right: 14px; min-width: 44px; min-height: 44px; border-radius: 50%; font: 700 13px var(--font); color: var(--white); background: var(--blue); }
.camera-view__footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 4px 0; font-size: 13px; font-weight: 700; }
.camera-history { min-height: 44px; color: var(--blue); font-size: 12px; font-weight: 700; text-align: right; }
.camera-history:hover, .history-refresh:hover { text-decoration: underline; }
.bigbtn { border-radius: 28px; height: 50px; font-size: 14px; font-weight: 700; }
.bigbtn--half, .bigbtn--ghost { border-radius: 28px; }
.card, .metarcard, .compasscard { border-radius: 24px; padding: 20px; border: 0; background: var(--white); }
.metarcard { border-left: 0; }
.card__label { font: 700 12px var(--font); letter-spacing: .2px; }
.rawbox { border-radius: 16px; padding: 16px; }
.note { font-size: 12px; line-height: 1.8; max-width: 75ch; }
.loopframe { border: 0; border-radius: 28px; background: var(--slate-950); }
.loopframe img { filter: none; }
.loop-status { position: absolute; inset: 0; display: grid; place-content: center; margin: 0; padding: 64px 24px; text-align: center; color: #e8edf4; font-size: 16px; background: rgb(15 23 42 / .75); z-index: 1; }
.loop-cameras { align-self: flex-start; }
.loopctl { gap: 12px; }
.loopctl__end { min-height: 44px; border-radius: 26px; background: var(--white); font-size: 13px; }
.loopctl__round { background: var(--white); border: 0; width: 48px; height: 48px; }
.loopctl__play { background: var(--blue); box-shadow: none; width: 60px; height: 60px; }
.loopstrip { gap: 12px; }
.loopstrip__track { height: 52px; border-radius: 16px; background: var(--bg-soft); border-color: transparent; }
.loopstrip__preview { position: absolute; top: 0; height: 100%; width: 12.5%; object-fit: cover; transform: translateX(-50%); opacity: .8; pointer-events: none; }
.loopstrip__cursor { width: 3px; z-index: 1; transform: translateX(-1.5px); }
.loopstrip__knob { top: 17px; width: 18px; height: 18px; z-index: 2; transform: translateX(-9px); }
.loopstrip__labels span { font-size: 10px; }
.infobar { border: 0; background: transparent; padding: 0 4px; gap: 10px; }
.infobar span { font: 400 12px/1.7 var(--font); }
.loopactions { align-items: center; gap: 12px; }
.history-refresh { min-height: 44px; font: 600 12px var(--font); color: var(--blue); padding: 0 12px; }
.chip { height: 36px; border-radius: 24px; font-weight: 600; }
.metargrid { gap: 16px; }
.bottomnav { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(360px, calc(100% - 32px)); background: var(--white); border: 1px solid var(--line); border-radius: 42px; padding: 6px; z-index: 700; box-shadow: 0 8px 28px rgb(24 42 68 / .1); }
.bottomnav__btn { border-radius: 32px; padding: 10px 14px; min-height: 56px; font: 600 11px var(--font); gap: 4px; }
.bottomnav__btn.is-active { background: var(--bg-soft); color: var(--slate-950); fill: var(--slate-950); }
.bottomnav__btn:not(.is-active) { color: var(--slate-500); fill: var(--slate-500); }
.lightbox__inner { border-radius: 28px; }
@media (min-width: 900px) {
  .screen { border-radius: 28px 28px 0 0; }
  .topbar { padding-inline: 28px; }
}
@media (max-width: 899px) {
  .wrap { padding: 20px 16px 120px; }
  .mapcard { bottom: 100px; }
  .legend { bottom: 100px; }
  .legend--lifted { bottom: 210px; }
  .topbar { padding: 12px 18px; }
  .pagehead__title, .pagehead__title--sm { font-size: 21px; }
  .pagehead__txt { min-width: 160px; }
}
@media (max-width: 560px) {
  .map-top { left: 16px; right: 16px; top: 16px; }
  .basemaps { left: 16px; top: 82px; }
  .camera-view__footer { font-size: 12px; }
  .pagehead { gap: 10px; }
  .frames.is-both { grid-template-columns: 1fr; }
  .loopstrip__labels span { font-size: 9px; }
  .loopactions .bigbtn { min-width: 0; width: 100%; flex-basis: 100%; }
  .loop-cameras { width: 100%; }
  .loop-cameras .seg__btn { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
