/* =========================================================
   El Niño AR — hoja de estilo principal
   Dirección de arte: sala de situación hidrológica.
   Fondo tinta, agua turquesa, semáforo ámbar/rojo.
   ========================================================= */

:root {
  --ink:        #050b10;
  --ink-2:      #08131b;
  --ink-3:      #0c1b25;
  --panel:      rgba(10, 22, 31, .82);
  --panel-soft: rgba(12, 26, 36, .62);

  --line:       rgba(255, 255, 255, .09);
  --line-soft:  rgba(255, 255, 255, .055);

  --txt:        #eaf3f7;
  --txt-2:      #b9cdd8;
  --muted:      #7e97a6;

  --water:      #2fd4c4;
  --water-dim:  #1a8f88;
  --evac:       #ff4d5e;
  --alert:      #ffb020;
  --ok:         #35d07f;
  --low:        #5f8499;

  --display: "Instrument Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;

  --shadow: 0 24px 60px -30px rgba(0, 0, 0, .9);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

/* el atributo hidden siempre gana a los display de autor */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 78% -10%, #0d2b33 0%, transparent 60%),
    radial-gradient(900px 600px at 10% 10%, #0a1d27 0%, transparent 55%),
    var(--ink);
  color: var(--txt);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: -.01em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.wrap { width: min(1240px, 100% - 48px); margin-inline: auto; }

/* ---------------------------------------------------------
   Barra superior
   --------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 68px;
  padding: 0 clamp(16px, 3vw, 34px);
  background: linear-gradient(180deg, rgba(5, 11, 16, .96), rgba(5, 11, 16, .72));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand { display: flex; align-items: center; gap: 12px; flex-shrink:0; }
.brand-glyph { width: 30px; height: 30px; fill: none; stroke: var(--water); stroke-width: 2; stroke-linecap: round; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.05; white-space:nowrap; }
.map-territory-source {position:absolute;right:12px;bottom:5px;z-index:25;font-size:9px;line-height:1.4;color:#91b6c6;background:#04131de6;padding:3px 6px;border-radius:4px;}
@media(max-width:900px) { .map-territory-source {right:12px;bottom:22px;font-size:8px;} .hud-legend {margin-bottom:16px;} }
.brand-txt strong { font-family: var(--display); font-size: 22px; letter-spacing: .06em; }
.brand-txt em { font-style: normal; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.nav { display: flex; gap: 26px; margin-left: auto; }
.nav a {
  font-size: 13.5px;
  letter-spacing: .04em;
  color: var(--txt-2);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color .25s var(--ease), border-color .25s var(--ease);
}
.nav a:hover { color: var(--txt); border-bottom-color: var(--water); }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--txt-2);
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(47, 212, 196, .05);
}
.live i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(53, 208, 127, .6);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(53, 208, 127, .55); }
  70%  { box-shadow: 0 0 0 9px rgba(53, 208, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 208, 127, 0); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .01em;
  transition: transform .2s var(--ease), background .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-solid { background: var(--water); color: #04201d; font-weight: 600; }
.btn-solid:hover { background: #4ee6d6; }
.btn-ghost { border-color: var(--line); color: var(--txt); background: rgba(255, 255, 255, .02); }
.btn-ghost:hover { border-color: var(--water); color: var(--water); }

/* ---------------------------------------------------------
   Escenario 3D
   --------------------------------------------------------- */
.stage {
  position: relative;
  height: clamp(560px, 78vh, 880px);
  margin-top: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  background: radial-gradient(70% 60% at 50% 40%, #082029 0%, #04101a 55%, #030a10 100%);
}
.scene { position: absolute; inset: 0; }
.scene canvas { display: block; }

.hud {
  position: absolute;
  z-index: 20;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  backdrop-filter: blur(16px) saturate(120%);
  box-shadow: var(--shadow);
}

.hud-situation {
  top: 22px;
  left: clamp(16px, 2.4vw, 30px);
  width: min(310px, calc(100vw - 40px));
  padding: 18px 20px 16px;
}
.hud-situation header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hud-situation h2 { font-size: 19px; white-space: nowrap; }
.hud-sub { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--muted); }

.stat-list { list-style: none; margin: 12px 0 10px; padding: 0; display: grid; gap: 6px; }
.stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  color: var(--txt-2);
  padding-left: 10px;
  position: relative;
}
.stat::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; border-radius: 2px; }
.stat.is-evac::before { background: var(--evac); box-shadow: 0 0 8px rgba(255, 77, 94, .8); }
.stat.is-alert::before { background: var(--alert); box-shadow: 0 0 8px rgba(255, 176, 32, .6); }
.stat.is-normal::before { background: var(--ok); }
.stat b { font-family: var(--display); font-size: 25px; line-height: 1; color: var(--txt); }
.stat .dot { display: none; }

.hud-river-label { margin: 10px 0 0; font-size: 12px; line-height: 1.35; color: var(--txt-2); }
.hud-rivers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hud-rivers button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .02);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11.5px;
  color: var(--txt-2);
  transition: all .2s var(--ease);
}
.hud-rivers button:hover { border-color: var(--water-dim); color: var(--txt); }
.hud-rivers button.is-on { background: rgba(47, 212, 196, .14); border-color: var(--water); color: var(--water); }
.hud-note { margin-top: 12px; font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.pna-status { margin: 8px 0; font-size: 11px; color: var(--alert); line-height: 1.4; }
.pna-status[hidden] { display: none; }

@media (min-width: 901px) {
  .hud-situation {
    width: 342px;
    max-height: calc(100% - 150px);
    padding: 15px 18px 13px;
    overflow: auto;
    scrollbar-width: thin;
  }
  .hud-rivers { gap: 5px; }
  .hud-rivers button { padding: 4px 9px; }
  .hud-note { margin-top: 9px; }
}
@media (min-width: 1220px) {
  .hud-situation { max-height: calc(100% - 120px); }
}

.hud-legend {
  bottom: 26px;
  right: clamp(16px, 2.4vw, 30px);
  display: flex;
  gap: 14px;
  padding: 9px 15px;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--txt-2);
}
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.lg.is-evac { color: var(--evac); }
.lg.is-alert { color: var(--alert); }
.lg.is-normal { color: var(--ok); }
.lg.is-low { color: var(--low); }

.hud-hint {
  bottom: 26px;
  left: clamp(16px, 2.4vw, 30px);
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-soft);
}
.hud-hint kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--txt-2);
  background: rgba(255, 255, 255, .04);
}

/* Tooltip del mapa */
.tooltip {
  position: fixed;
  z-index: 90;
  min-width: 190px;
  max-width: 260px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: rgba(6, 16, 22, .96);
  border: 1px solid rgba(47, 212, 196, .35);
  box-shadow: 0 18px 40px -18px #000;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
}
.tt-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tt-top strong { font-size: 13.5px; letter-spacing: .01em; }
.tt-rio { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.tt-level { display: flex; align-items: baseline; gap: 4px; margin-top: 6px; }
.tt-level b { font-family: var(--display); font-size: 30px; line-height: 1; }
.tt-level span { font-size: 12px; color: var(--muted); }
.tt-level em { font-style: normal; margin-left: auto; font-family: var(--mono); font-size: 11px; }
.tt-level em.up { color: var(--alert); }
.tt-level em.down { color: var(--ok); }
.tt-state { margin-top: 4px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.tt-meta { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); font-size: 11px; color: var(--txt-2); display: grid; gap: 2px; }

.scene-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding: 40px; text-align: center; color: var(--txt-2); z-index: 15;
  background: rgba(4, 10, 16, .9);
}

/* ---------------------------------------------------------
   Cajón lateral (ficha de puerto)
   --------------------------------------------------------- */
.drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 100%);
  z-index: 40;
  background: linear-gradient(180deg, rgba(8, 20, 28, .98), rgba(5, 13, 19, .99));
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px -40px #000;
  overflow-y: auto;
  animation: slideIn .32s var(--ease);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  font-size: 20px; line-height: 1;
  color: var(--txt-2);
  z-index: 2;
}
.drawer-close:hover { color: var(--txt); border-color: var(--water); }
.drawer-body { padding: 26px 26px 34px; }

.ficha-head { display: flex; flex-direction: column; gap: 4px; padding-right: 40px; }
.ficha-rio { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--water); }
.ficha-name { font-family: var(--display); font-size: 32px; line-height: 1.05; }
.ficha-when { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 4px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid currentColor;
}
.pill.evac { color: var(--evac); background: rgba(255, 77, 94, .1); }
.pill.alert { color: var(--alert); background: rgba(255, 176, 32, .1); }
.pill.ok { color: var(--ok); background: rgba(53, 208, 127, .09); }
.pill.low { color: var(--low); background: rgba(95, 132, 153, .1); }

.ficha-level { display: flex; align-items: flex-end; gap: 10px; margin: 18px 0 6px; }
.ficha-level b { font-family: var(--display); font-size: 64px; line-height: .9; letter-spacing: -.02em; }
.ficha-level span { font-size: 13px; color: var(--muted); padding-bottom: 8px; }
.ficha-delta { display: flex; gap: 14px; font-size: 12px; color: var(--txt-2); }
.ficha-delta em { font-style: normal; font-family: var(--mono); }

.gauge { margin: 20px 0 8px; }
.gauge-track { position: relative; height: 10px; border-radius: 999px; background: linear-gradient(90deg, #123 0%, #17313f 100%); overflow: visible; }
.gauge-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, var(--water-dim), var(--water)); }
.gauge-mark { position: absolute; top: -6px; width: 2px; height: 22px; background: var(--txt); opacity: .5; }
.gauge-mark.alert { background: var(--alert); opacity: 1; }
.gauge-mark.evac { background: var(--evac); opacity: 1; }
.gauge-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10px; color: var(--muted); font-family: var(--mono); }

.ficha-block { margin-top: 26px; }
.ficha-block h4,
#drawer-foro > h3 {
  display: flex;
  align-items: center;
  margin: 0 0 10px;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #39ffe5;
  font-weight: 700;
}
.ficha-block h4 .info-dot { flex: none; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 12.5px; }
.kv dt { color: var(--txt-2); }
.kv dd { margin: 0; font-family: var(--mono); text-align: right; }
.kv dd strong { color: var(--txt); }

.spark { width: 100%; height: 74px; display: block; }
.spark-line { fill: none; stroke: var(--water); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: url(#gradWater); stroke: none; }
.spark-dot { fill: #fff; }

.forecast { display: grid; gap: 7px; }
.fc-row { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px; font-size: 12px; }
.fc-row span:first-child { font-family: var(--mono); color: var(--muted); font-size: 11px; }
.fc-bar { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.fc-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--water-dim), var(--water)); }
.fc-val { font-family: var(--mono); font-size: 12px; }
.fc-note { font-size: 10.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }

.weather { display: flex; align-items: center; gap: 16px; }
.wx-icon { font-size: 30px; line-height: 1; }
.wx-temp { font-family: var(--display); font-size: 38px; line-height: 1; }
.wx-meta { display: grid; gap: 3px; font-size: 11.5px; color: var(--txt-2); }
.wx-days { display: flex; gap: 6px; margin-top: 12px; }
.wx-day { flex: 1; text-align: center; padding: 7px 4px; border-radius: var(--r-sm); background: rgba(255, 255, 255, .03); border: 1px solid var(--line-soft); }
.wx-day b { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 400; }
.wx-day span { font-size: 11px; }

/* ---------------------------------------------------------
   Secciones
   --------------------------------------------------------- */
.section { padding: clamp(64px, 9vw, 112px) 0 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; flex-wrap: wrap; margin-bottom: 34px; }
.eyebrow { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--water); margin-bottom: 12px; }
.section h2 { font-size: clamp(30px, 4vw, 46px); line-height: 1.06; }
.section-lead { max-width: 430px; font-size: 14.5px; color: var(--txt-2); line-height: 1.6; }

.filters { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.search input {
  width: min(320px, 100%);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--txt);
  font: inherit; font-size: 13px;
  outline: none;
  transition: border-color .2s var(--ease);
}
.search input:focus { border-color: var(--water); }
.search input::placeholder { color: var(--muted); }

.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .02); margin-left: auto; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-size: 12.5px; color: var(--muted); }
.seg button.is-active { background: rgba(47, 212, 196, .14); color: var(--water); }

.port-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 12px; }
.port {
  position: relative;
  text-align: left;
  padding: 15px 16px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: linear-gradient(160deg, rgba(14, 30, 40, .86), rgba(8, 18, 26, .72));
  transition: border-color .2s var(--ease), transform .2s var(--ease), background .2s var(--ease);
}
.port:hover { border-color: rgba(47, 212, 196, .45); transform: translateY(-2px); }
.port.is-active { border-color: var(--water); background: linear-gradient(160deg, rgba(20, 52, 58, .9), rgba(9, 24, 30, .8)); }
.port-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.port-name { font-size: 13.5px; font-weight: 600; letter-spacing: .01em; }
.port-rio { font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.port-level { display: flex; align-items: baseline; gap: 5px; margin-top: 12px; }
.port-level b { font-family: var(--display); font-size: 30px; line-height: 1; }
.port-level span { font-size: 11px; color: var(--muted); }
.port-level em { font-style: normal; margin-left: auto; font-family: var(--mono); font-size: 10.5px; }
.port-level em.up { color: var(--alert); }
.port-level em.down { color: var(--ok); }
.port-bar { height: 4px; margin-top: 11px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.port-bar i { display: block; height: 100%; border-radius: 999px; }
.port-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; margin-top: 8px; font-size: 10px; color: var(--muted); font-family: var(--mono); }

.port.is-evac { box-shadow: inset 0 0 0 1px rgba(255, 77, 94, .25); }
.port.is-alert { box-shadow: inset 0 0 0 1px rgba(255, 176, 32, .2); }

.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.card {
  padding: 26px 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: linear-gradient(170deg, rgba(12, 27, 36, .9), rgba(7, 16, 23, .6));
}
.card-n { font-family: var(--mono); font-size: 11px; color: var(--water); letter-spacing: .1em; }
.card h3 { font-size: 25px; margin: 14px 0 10px; line-height: 1.1; }
.card p { font-size: 13.5px; color: var(--txt-2); line-height: 1.65; }

.source-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  margin-top: 44px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--line-soft);
}
.source-strip > div { display: flex; flex-direction: column; gap: 3px; padding: 18px 20px; background: #071019; }
.src-label { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--water); }
.source-strip strong { font-size: 13.5px; font-weight: 600; }
.source-strip em { font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

/* Planes */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: stretch; }
.plan {
  position: relative;
  display: flex; flex-direction: column; gap: 16px;
  padding: 28px 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  background: linear-gradient(170deg, rgba(12, 27, 36, .9), rgba(7, 16, 23, .6));
}
.plan-featured { border-color: rgba(47, 212, 196, .5); background: linear-gradient(170deg, rgba(15, 42, 48, .95), rgba(7, 18, 24, .85)); box-shadow: 0 40px 90px -60px var(--water); }
.plan h3 { font-size: 27px; }
.price { display: flex; align-items: baseline; gap: 6px; font-family: var(--display); font-size: 46px; line-height: 1; }
.price span { font-size: 22px; color: var(--txt-2); }
.price small { font-family: var(--sans); font-size: 12px; color: var(--muted); font-weight: 400; }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 13px; color: var(--txt-2); }
.plan li { display: flex; gap: 9px; line-height: 1.45; }
.plan li::before { content: "→"; color: var(--water); font-size: 12px; }
.plan .btn { margin-top: auto; }
.badge {
  position: absolute; top: 18px; right: 18px;
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
  color: var(--water); border: 1px solid rgba(47, 212, 196, .4);
}
.badge-alt { color: var(--txt-2); border-color: var(--line); }
.fineprint { margin-top: 18px; font-size: 11px; color: var(--muted); }

/* Pie */
.foot { margin-top: clamp(70px, 9vw, 120px); padding: 40px 0 54px; border-top: 1px solid var(--line-soft); }
.foot-in { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.foot strong { font-family: var(--display); font-size: 20px; letter-spacing: .08em; }
.foot p { max-width: 620px; margin-top: 10px; font-size: 11.5px; line-height: 1.6; color: var(--muted); }
.foot-meta { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-align: right; }

/* ---------------------------------------------------------
   Adaptación a pantallas chicas
   --------------------------------------------------------- */
@media (max-width: 900px) {
  .nav { display: none; }
  .stage { height: 74vh; min-height: 520px; }
  .hud-legend, .hud-hint { display: none; }
  .hud-situation { top: 14px; left: 14px; right: 14px; width: auto; padding: 14px 16px; }
  .stat-list { grid-template-columns: repeat(3, 1fr); }
  .stat { grid-template-columns: auto 1fr; grid-template-rows: auto auto; border-bottom: 0; padding: 4px 0; }
  .stat b { grid-row: 1; font-size: 24px; }
  .stat span { grid-column: 2; font-size: 10.5px; }
  .stat .dot { display: none; }
  .drawer { position: fixed; top: 0; bottom: 0; }
  .ficha-name { font-size: 27px; }
  .ficha-level b { font-size: 52px; }
  .foot-meta { text-align: left; }
  .section-head { gap: 18px; }
  .seg { margin-left: 0; }
  .wrap { width: calc(100% - 32px); }
}

/* =========================================================
   TEMA EL NIÑO AR
   Azul dominante, turquesa de apoyo, negro de fondo y blanco
   para el texto. Bordes y halos neón.
   ========================================================= */

:root {
  --blue:      #2f7bff;
  --blue-2:    #1b5cf0;
  --blue-soft: rgba(47, 123, 255, .16);
  --cyan:      #23e0e8;
  --water:     #23e0e8;
  --water-dim: #1aa6b4;
  --ok:        #23e0e8;
  --low:       #5b8fb9;

  --glow-blue: 0 0 0 1px rgba(47, 123, 255, .18), 0 0 30px -12px rgba(47, 123, 255, .85);
  --glow-cyan: 0 0 0 1px rgba(35, 224, 232, .14), 0 0 26px -12px rgba(35, 224, 232, .8);
  --edge-blue: 1px solid rgba(47, 123, 255, .42);
  --edge-cyan: 1px solid rgba(35, 224, 232, .34);
}

body {
  background:
    radial-gradient(1200px 760px at 82% -12%, rgba(47, 123, 255, .22) 0%, transparent 62%),
    radial-gradient(900px 620px at 6% 6%, rgba(35, 224, 232, .12) 0%, transparent 58%),
    radial-gradient(1000px 700px at 50% 110%, rgba(47, 123, 255, .10) 0%, transparent 60%),
    #04070d;
}

/* ---------- marca ---------- */
.brand-glyph { stroke: var(--blue); filter: drop-shadow(0 0 8px rgba(47, 123, 255, .8)); }
.brand-txt strong {
  background: linear-gradient(92deg, #ffffff 0%, #9cc4ff 55%, #23e0e8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: .1em;
}
.brand-txt em { color: #6f90b8; letter-spacing: .06em; text-transform: none; font-size: 10.5px; }

/* ---------- bordes neón ---------- */
.topbar { border-bottom: 1px solid rgba(47, 123, 255, .22); box-shadow: 0 12px 40px -30px rgba(47, 123, 255, .9); }

.hud, .drawer, .tooltip, .card, .plan, .port, .seg, .search input, .wx-day, .source-strip {
  border-color: rgba(47, 123, 255, .34);
  box-shadow: var(--glow-blue);
}
.hud { border-width: 1px; }
.hud-situation { border-color: rgba(35, 224, 232, .3); box-shadow: var(--glow-cyan); }
.hud-legend { border-color: rgba(35, 224, 232, .28); }
.tooltip { border-color: rgba(35, 224, 232, .45); box-shadow: 0 0 40px -14px rgba(35, 224, 232, .9); }
.drawer { border-left: 1px solid rgba(47, 123, 255, .45); box-shadow: -30px 0 90px -40px rgba(47, 123, 255, .65); }
.port { background: linear-gradient(160deg, rgba(18, 34, 58, .92), rgba(7, 13, 24, .86)); }
.port:hover { border-color: rgba(35, 224, 232, .6); box-shadow: 0 0 0 1px rgba(35, 224, 232, .25), 0 0 34px -12px rgba(35, 224, 232, .8); }
.port.is-active { border-color: var(--blue); box-shadow: 0 0 0 1px rgba(47, 123, 255, .5), 0 0 40px -12px rgba(47, 123, 255, .95); }
.port.is-evac { box-shadow: inset 0 0 0 1px rgba(255, 77, 94, .4), 0 0 26px -16px rgba(255, 77, 94, .9); }
.port.is-alert { box-shadow: inset 0 0 0 1px rgba(255, 176, 32, .34), 0 0 26px -16px rgba(255, 176, 32, .8); }

.live { border-color: rgba(47, 123, 255, .4); background: rgba(47, 123, 255, .08); }
.live i { background: var(--cyan); box-shadow: 0 0 10px rgba(35, 224, 232, .9); }

/* ---------- botones ---------- */
.btn-solid {
  background: linear-gradient(135deg, #3a86ff, #1b5cf0);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(120, 170, 255, .35), 0 0 26px -6px rgba(47, 123, 255, .95);
}
.btn-solid:hover { background: linear-gradient(135deg, #5a9bff, #2f7bff); box-shadow: 0 0 0 1px rgba(150, 190, 255, .5), 0 0 34px -4px rgba(47, 123, 255, 1); }
.btn-ghost { border-color: rgba(47, 123, 255, .45); color: #d7e6ff; background: rgba(47, 123, 255, .06); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 24px -8px rgba(35, 224, 232, .9); }
.btn-help { padding: 10px 16px; }

.nav a:hover { border-bottom-color: var(--blue); color: #fff; }
.eyebrow { color: var(--blue); }
.hud-rivers button.is-on { background: var(--blue-soft); border-color: var(--blue); color: #bcd4ff; }
.hud-rivers button:hover { border-color: var(--blue); color: #fff; }
.seg button.is-active { background: var(--blue-soft); color: #bcd4ff; }
.search input:focus { border-color: var(--blue); box-shadow: 0 0 22px -8px rgba(47, 123, 255, .9); }
.lg.is-normal { color: var(--cyan); }
.pill.ok { color: var(--cyan); background: rgba(35, 224, 232, .1); }
.pill.low { color: var(--low); }
.ficha-rio { color: var(--cyan); }
.plan-featured { border-color: rgba(47, 123, 255, .6); box-shadow: 0 0 0 1px rgba(47, 123, 255, .3), 0 40px 100px -60px rgba(47, 123, 255, 1); }
.badge { color: var(--blue); border-color: rgba(47, 123, 255, .5); }
.src-label { color: var(--cyan); }
.spark-line { stroke: var(--cyan); }
.fc-bar i { background: linear-gradient(90deg, var(--blue-2), var(--cyan)); }

/* botón de ayuda dentro de las fichas */
.info-dot {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid rgba(47, 123, 255, .55);
  background: rgba(47, 123, 255, .12);
  color: #cfe0ff; font-size: 11px; line-height: 1;
  display: inline-grid; place-items: center;
  margin-left: 8px; vertical-align: middle;
  transition: all .2s var(--ease);
}
.info-dot:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 20px -6px rgba(35, 224, 232, .9); }

/* ---------- ventana explicativa ---------- */
.ayuda {
  border: 0; padding: 0; background: transparent;
  width: min(560px, calc(100vw - 32px));
  max-height: min(86vh, 720px);
  color: var(--txt);
}
.ayuda::backdrop {
  background: rgba(2, 6, 12, .72);
  backdrop-filter: blur(6px);
}
.ayuda-in {
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  padding: 30px 30px 24px;
  border-radius: 20px;
  background: linear-gradient(165deg, rgba(16, 32, 56, .99), rgba(6, 12, 22, .99));
  border: 1px solid rgba(47, 123, 255, .55);
  box-shadow: 0 0 0 1px rgba(35, 224, 232, .18), 0 0 70px -20px rgba(47, 123, 255, .95), inset 0 0 60px -40px rgba(35, 224, 232, .9);
  overflow-y: auto;
}
.ayuda-x {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(47, 123, 255, .4);
  background: rgba(47, 123, 255, .08);
  color: #cfe0ff; font-size: 19px; line-height: 1;
}
.ayuda-x:hover { border-color: var(--cyan); color: var(--cyan); }
.ayuda h3 { font-family: var(--display); font-size: 30px; line-height: 1.1; padding-right: 34px; }
.ayuda-cuerpo { font-size: 14.5px; line-height: 1.72; color: var(--txt-2); display: grid; gap: 12px; }
.ayuda-cuerpo strong { color: #fff; font-weight: 600; }
.ayuda-cuerpo em { color: var(--cyan); font-style: normal; }
.ayuda-cuerpo .ayuda-ejemplo {
  padding: 12px 14px; border-radius: 12px;
  background: rgba(47, 123, 255, .09);
  border: 1px solid rgba(47, 123, 255, .28);
  font-size: 13.5px; color: #cfe0ff;
}
.ayuda-cuerpo ul { margin: 0; padding-left: 18px; display: grid; gap: 7px; }
.ayuda-cuerpo li::marker { color: var(--cyan); }
.ayuda-pie { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.ayuda-check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.ayuda-check input { accent-color: var(--blue); }
.ayuda-pie .btn { padding: 10px 22px; }

@media (max-width: 900px) {
  .btn-help { display: none; }
  .ayuda-in { padding: 24px 20px 20px; }
  .ayuda h3 { font-size: 25px; }
}
/* =========================================================
   Ventanas modales (acceso y administración)
   ========================================================= */

.modal {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(2, 6, 12, .74);
  backdrop-filter: blur(6px);
}
.modal-card {
  position: relative;
  width: min(540px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 30px;
  border-radius: 20px;
  background: linear-gradient(165deg, rgba(16, 32, 56, .99), rgba(6, 12, 22, .99));
  border: 1px solid rgba(47, 123, 255, .55);
  box-shadow: 0 0 0 1px rgba(35, 224, 232, .16), 0 0 70px -20px rgba(47, 123, 255, .95), inset 0 0 60px -40px rgba(35, 224, 232, .9);
  animation: modalIn .25s var(--ease);
}
@keyframes modalIn { from { transform: translateY(10px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card h3 { font-family: var(--display); font-size: 30px; line-height: 1.1; padding-right: 34px; margin-bottom: 10px; }
.modal-text { font-size: 14px; color: var(--txt-2); line-height: 1.6; margin-bottom: 18px; }
.modal-reason {
  font-size: 13px; color: #cfe0ff; line-height: 1.5;
  background: rgba(47, 123, 255, .1);
  border: 1px solid rgba(47, 123, 255, .3);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
}
.modal-actions { display: grid; gap: 10px; }
.modal-fine { font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 4px; }

/* ---------- administración ---------- */
.modal-card.adm { width: min(600px, 100%); }
.modal-card.adm.adm-panel { width: min(920px, 100%); }
.adm-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.adm-top h3 { font-size: 26px; padding-right: 0; }
.adm-lead { font-size: 13.5px; color: var(--txt-2); line-height: 1.6; margin-bottom: 16px; }
.adm-note { font-size: 11.5px; color: var(--muted); line-height: 1.55; margin-top: 14px; }

.adm-form { display: grid; gap: 12px; margin-top: 4px; }
.adm-form label, .adm-field {
  display: grid; gap: 6px;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.adm-form input, .adm-form textarea, .adm-field input, .adm-field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid rgba(47, 123, 255, .34);
  background: rgba(6, 14, 26, .9);
  color: var(--txt);
  font: inherit; font-size: 13.5px; letter-spacing: 0;
  text-transform: none;
  outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.adm-form input:focus, .adm-field input:focus, .adm-form textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 22px -10px rgba(35, 224, 232, .95);
}
.adm-form input:disabled, .adm-field input:disabled, .adm-field textarea:disabled { opacity: .55; }
.adm-error {
  font-size: 12.5px; color: #ffb3bb;
  background: rgba(255, 77, 94, .1);
  border: 1px solid rgba(255, 77, 94, .35);
  border-radius: 10px; padding: 9px 12px;
}
.adm-link {
  justify-self: start;
  background: none; border: 0; padding: 2px 0;
  font-size: 12.5px; color: var(--cyan);
  border-bottom: 1px solid rgba(35, 224, 232, .35);
}
.adm-link:hover { color: #fff; border-bottom-color: #fff; }
.adm-code {
  font-family: var(--mono); font-size: 13px; color: #cfe0ff;
  background: rgba(47, 123, 255, .1); border: 1px dashed rgba(47, 123, 255, .45);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 8px;
}
.adm-code strong { font-size: 18px; letter-spacing: .18em; color: #fff; }

.adm-tabs { display: flex; gap: 6px; margin: 18px 0 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line-soft); padding-bottom: 12px; }
.adm-tabs button {
  border: 1px solid transparent; background: none;
  padding: 8px 14px; border-radius: 999px;
  font-size: 12.5px; color: var(--muted);
}
.adm-tabs button:hover { color: var(--txt); }
.adm-tabs button.is-active { background: var(--blue-soft); color: #cfe0ff; border-color: rgba(47, 123, 255, .45); }
.adm-tabs .adm-salir { margin-left: auto; color: #ffb3bb; border-color: rgba(255, 77, 94, .3); }
.adm-tabs .adm-salir:hover { color: #fff; border-color: rgba(255, 77, 94, .7); }

.adm-body { display: grid; gap: 16px; }
.adm-tabla { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.adm-tabla th {
  text-align: left; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.adm-tabla td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.adm-tabla td span { display: block; font-size: 11px; color: var(--muted); }
.adm-tabla strong { font-weight: 600; }
.adm-chip {
  display: inline-block; font-size: 10.5px; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid rgba(47, 123, 255, .35); color: #cfe0ff;
  background: rgba(47, 123, 255, .08);
}
.adm-chip.ok { color: var(--cyan); border-color: rgba(35, 224, 232, .45); background: rgba(35, 224, 232, .1); }
.adm-chip.warn { color: var(--alert); border-color: rgba(255, 176, 32, .45); background: rgba(255, 176, 32, .1); }
.adm-caja {
  padding: 16px 18px; border-radius: 14px;
  border: 1px solid rgba(47, 123, 255, .28);
  background: rgba(10, 22, 40, .7);
}
.adm-caja h5 { margin: 0 0 10px; font-family: var(--sans); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.adm-caja p { font-size: 12.5px; color: var(--txt-2); line-height: 1.6; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.adm-grid div { display: grid; gap: 3px; }
.adm-grid span { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.adm-grid strong { font-size: 13px; font-weight: 600; }

@media (max-width: 700px) {
  .modal-card { padding: 22px; }
  .adm-tabs .adm-salir { margin-left: 0; }
  .adm-tabla { font-size: 11.5px; }
  .adm-tabla th:nth-child(3), .adm-tabla td:nth-child(3) { display: none; }
}
/* =========================================================
   Mapa 3D: controles, escala, brújula y carga
   ========================================================= */

.scene { cursor: grab; }
.scene:active { cursor: grabbing; }

/* etiquetas de los puertos principales */
.map-label {
  position: absolute;
  transform: translate(-50%, -160%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #e4f6ff;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(4, 12, 20, .62);
  border: 1px solid rgba(47, 123, 255, .28);
  text-shadow: 0 2px 8px #000;
  pointer-events: none;
  transition: opacity .18s linear;
  backdrop-filter: blur(3px);
}

/* controles de zoom */
.map-tools {
  position: absolute;
  right: clamp(14px, 2vw, 26px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 22;
  display: grid;
  gap: 8px;
}
.map-tools button {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px; line-height: 1;
  color: #d6e9ff;
  background: rgba(8, 18, 32, .82);
  border: 1px solid rgba(47, 123, 255, .45);
  box-shadow: 0 0 0 1px rgba(35, 224, 232, .1), 0 0 22px -10px rgba(47, 123, 255, .95);
  backdrop-filter: blur(10px);
  transition: all .18s var(--ease);
}
.map-tools button:hover {
  color: #fff;
  border-color: var(--cyan);
  box-shadow: 0 0 24px -6px rgba(35, 224, 232, .95);
  transform: scale(1.06);
}
.map-tools button:active { transform: scale(.96); }
.map-view-control { display:grid; justify-items:center; gap:5px; width:148px; padding:10px 5px; background:#04121deb; border:1px solid #2f7bff55; border-radius:22px; }
.map-view-title,.map-tilt-label {font:10px var(--sans);color:#9bb5c4;}
.map-view-title {text-transform:uppercase;letter-spacing:.1em;}
#map-view-toggle {display:none;}
.stage {scroll-margin-top:72px;}
.map-orbit { display:grid; grid-template:repeat(3,44px)/repeat(3,44px); gap:0; border:1px solid #2f7bff44;border-radius:50%;background:radial-gradient(circle,#12324888,#04121d); }
.map-orbit [data-orbit="up"] {grid-area:1/2;}
.map-orbit [data-orbit="left"] {grid-area:2/1;}
.map-orbit #map-north {grid-area:2/2;font-size:12px;color:#7ebfc7;}
.map-orbit [data-orbit="right"] {grid-area:2/3;}
.map-orbit [data-orbit="down"] {grid-area:3/2;}
.map-tools .map-orbit button {width:44px;height:44px;border:0;box-shadow:none;background:transparent;backdrop-filter:none;touch-action:manipulation;}
#map-tilt {width:108px;margin:2px 0 4px;accent-color:#3194b3;cursor:pointer;}
.map-tools { justify-items:center; }
.map-source { position:absolute; left:12px; bottom:5px; z-index:25; font-size:10px; color:#91b6c6; max-width:calc(100% - 24px); background:#04131de6; padding:3px 6px; border-radius:4px; line-height:1.4; }

/* escala gráfica */
.map-scale {
  position: absolute;
  left: clamp(14px, 2vw, 30px);
  bottom: 76px;
  z-index: 22;
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 10px; color: #9fc0d8;
  letter-spacing: .06em;
}
.map-scale span {
  display: block;
  height: 8px;
  min-width: 30px;
  border-left: 1px solid rgba(35, 224, 232, .8);
  border-right: 1px solid rgba(35, 224, 232, .8);
  border-bottom: 1px solid rgba(35, 224, 232, .8);
  box-shadow: 0 2px 12px -4px rgba(35, 224, 232, .8);
}
.map-scale em { font-style: normal; }

/* brújula */
.map-compass {
  position: absolute;
  right: clamp(14px, 2vw, 26px);
  top: 22px;
  z-index: 22;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(47, 123, 255, .35);
  background: rgba(8, 18, 32, .72);
  backdrop-filter: blur(8px);
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: #bcd4ff;
}
.map-compass i {
  position: absolute; top: 6px; left: 50%;
  width: 1px; height: 9px; background: var(--cyan);
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(35, 224, 232, .9);
}

/* pantalla de carga */
.scene-loading {
  position: absolute; inset: 0; z-index: 30;
  display: grid; place-items: center; gap: 14px;
  grid-auto-flow: row;
  background: radial-gradient(60% 60% at 50% 45%, #071725 0%, #030a12 100%);
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: #7fa6c0;
  transition: opacity .5s var(--ease), visibility .5s;
}
.scene-loading.is-done { opacity: 0; visibility: hidden; }
.scene-loading i {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(47, 123, 255, .25);
  border-top-color: var(--cyan);
  animation: girar 1s linear infinite;
  box-shadow: 0 0 26px -6px rgba(35, 224, 232, .8);
}
@keyframes girar { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .map-tools { right: 10px; }
  .map-tools button { width: 34px; height: 34px; font-size: 15px; }
  .map-compass, .map-scale { display: none; }
}
/* =========================================================
   Correcciones de la revisión 1
   ========================================================= */

/* portada con titular */
.hero { padding: 38px 0 26px; }
.hero .eyebrow { margin-bottom: 10px; }
.hero h1 {
  font-family: var(--display);
  font-size: clamp(34px, 5.2vw, 62px);
  line-height: 1.02;
  letter-spacing: -.015em;
  max-width: 15ch;
}
.hero-sub { margin-top: 12px; max-width: 58ch; font-size: 15px; color: var(--txt-2); line-height: 1.6; }
.stage { height: clamp(520px, 68vh, 780px); }

/* foco visible en todo el sitio */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}
.btn:focus-visible, .map-tools button:focus-visible { outline-offset: 4px; }

/* controles que se corren cuando el cajón está abierto */
body.drawer-open .map-tools { right: calc(min(440px, 100%) + 18px); }
body.drawer-open .map-compass { right: calc(min(440px, 100%) + 18px); }
body.drawer-open .hud-legend { opacity: 0; pointer-events: none; }
@media (max-width: 900px) {
  body.drawer-open .map-tools { right: auto; left: 12px; }
}

/* badge de dato viejo */
.live.is-stale i { background: var(--alert); animation: none; box-shadow: none; }
.live { max-width:265px; white-space:nowrap; flex-shrink:1; }
.live span { overflow:hidden; text-overflow:ellipsis; }
@media (min-width:901px) and (max-width:1200px) { .live {display:none;} .topbar-right {gap:10px;} .nav {gap:18px;} }
@media(max-width:1200px) { .hud-hint {display:none;} }
.nav a { white-space:nowrap; }

/* tendencia en la leyenda */
.lg.is-trend { color: var(--txt-2); }
.lg.is-trend::before { background: transparent; border: 1px solid currentColor; border-radius: 50%; }

/* fila de descargas */
.dl-row { display: flex; gap: 8px; flex-wrap: wrap; }
.dl-row .btn { padding: 9px 16px; font-size: 12.5px; }
.dl-row .btn.is-locked::after { content: " 🔒"; font-size: 10px; }

/* chips del panel: que no se estiren */
.adm-tabla td > span:not(.adm-chip) { display: block; font-size: 11px; color: var(--muted); }
.adm-tabla .adm-chip { display: inline-block; }

/* encabezado en pantallas chicas: una línea, con la acción visible */
@media (max-width: 900px) {
  .topbar { gap: 10px; padding: 0 12px; height: 60px; }
  .brand-txt em { display: none; }
  .brand-txt strong { font-size: 17px; letter-spacing: .06em; }
  .brand-glyph { width: 24px; height: 24px; }
  .topbar-right { gap: 8px; }
  .topbar-right .btn-solid { padding: 9px 14px; font-size: 12.5px; }
  .live { display: none; }
  .hero { padding: 24px 0 18px; }
  .hero h1 { font-size: clamp(28px, 8vw, 38px); max-width: none; }
  .hero-sub { font-size: 13.5px; }
  .stage { height: clamp(420px, 58vh, 560px); }
  .hud-situation { max-height: 44vh; overflow: auto; }
  .hud-legend { display: flex; bottom: 12px; right: 12px; left: 12px; justify-content: center; flex-wrap: wrap; gap: 10px; font-size: 9.5px; }
  .hud-hint { display: none; }
}

/* objetivos táctiles cómodos */
@media (pointer: coarse) {
  .info-dot { width: 28px; height: 28px; font-size: 12px; }
  .hud-rivers button { padding: 8px 13px; }
  .map-tools button { width: 44px; height: 44px; }
}

/* menos movimiento para quien lo pide */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  html { scroll-behavior: auto; }
  .live i { animation: none; }
}
/* =========================================================
   Correcciones de la revisión 2
   ========================================================= */

/* la barra fija tapaba el título de la ficha */
#mapa, section[id] { scroll-margin-top: 76px; }

/* aguja del compás: media barra que rota sobre el centro del dial */
.map-compass i {
  top: 0;
  left: 50%;
  width: 1px;
  height: 50%;
  transform-origin: bottom center;
  background: linear-gradient(180deg, var(--cyan), rgba(35, 224, 232, 0));
}

/* leyenda del pico */
.lg.is-pico { color: #ffe9b0; }
.lg.is-pico::before { background: transparent; border: 0; content: "◆"; width: auto; height: auto; color: #ffe9b0; }

/* etiquetas del gauge alineadas con sus marcas */
.gauge-labels { position: relative; height: 14px; margin-top: 8px; }
.gauge-labels span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 9.5px;
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing: .02em;
}
.gauge-labels span:first-child { transform: none; }
.gauge-labels span:last-child { transform: translateX(-100%); }

/* eje del mini gráfico */
.spark-axis {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 9.5px; color: var(--muted);
  margin-top: -4px;
}

/* estado vacío de la grilla y nota de escalas sin mapa */
.grid-empty {
  grid-column: 1 / -1;
  padding: 34px 20px;
  border: 1px dashed rgba(47, 123, 255, .35);
  border-radius: 14px;
  text-align: center;
  color: var(--txt-2);
  font-size: 13.5px;
}
.grid-note { margin-top: 14px; font-size: 11.5px; color: var(--muted); }

/* menú en pantallas chicas */
.nav-toggle {
  display: none;
  width: 38px; height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(47, 123, 255, .45);
  background: rgba(47, 123, 255, .08);
  padding: 8px 9px;
  gap: 5px;
  flex-direction: column;
  justify-content: center;
}
.nav-toggle span { display: block; height: 1.5px; background: #cfe0ff; border-radius: 2px; }

@media (max-width: 900px) {
  .nav-toggle { display: flex; margin-left: auto; }
  .nav {
    position: fixed;
    top: 60px; left: 0; right: 0;
    z-index: 70;
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 8px 20px 16px;
    background: linear-gradient(180deg, rgba(6, 14, 24, .99), rgba(4, 10, 18, .98));
    border-bottom: 1px solid rgba(47, 123, 255, .35);
    box-shadow: 0 24px 60px -30px #000;
  }
  body.nav-open .nav { display: flex; }
  .nav a { padding: 13px 0; font-size: 15px; border-bottom: 1px solid var(--line-soft); }
  .map-tools { top: auto; bottom: 84px; right: 10px; }
  body.drawer-open .map-tools { left: auto; right: 10px; }
}
/* =========================================================
   Correcciones de la revisión 3
   ========================================================= */

/* el gauge ahora usa una leyenda debajo, sin etiquetas superpuestas */
.gauge-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 12px;
  font-family: var(--mono); font-size: 10px; color: var(--txt-2);
}
.gauge-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gauge-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* fechas del gráfico: una a cada punta, sin corrimientos */
.gauge-labels { position: relative; height: 14px; margin-top: 6px; }
.gauge-labels span {
  position: absolute; top: 0;
  font-family: var(--mono); font-size: 9.5px; color: var(--muted);
  white-space: nowrap;
}
.gauge-labels span:first-child { left: 0; transform: none; }
.gauge-labels span:last-child { left: auto; right: 0; transform: none; }

/* la X de la ficha queda siempre a la vista aunque la ficha scrollee */
.drawer { display: flex; flex-direction: column; }
.drawer-close {
  position: sticky;
  top: 12px;
  align-self: flex-end;
  margin: 12px 12px -46px 0;
  z-index: 3;
  backdrop-filter: blur(6px);
}

/* celular: controles abajo al centro, no sobre la tarjeta; marca en una línea */
@media (max-width: 900px) {
  .brand-txt strong { white-space: nowrap; font-size: 16px; }
  .map-tools {
    top: auto;
    bottom: 64px;
    right: 50%;
    transform: translateX(50%);
    grid-auto-flow: column;
    gap: 10px;
  }
  body.drawer-open .map-tools { left: auto; right: 50%; transform: translateX(50%); }
  .stage { height: clamp(460px, 62vh, 620px); }
  .hud-situation { max-height: 38vh; }
}

/* el cajón, debajo de la barra fija, para que la X se pueda tocar */
@media (max-width: 900px) {
  .drawer {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 90;
  }
  .drawer-close { margin: 10px 10px -44px 0; }
}


/* móvil: el panel deja respirar al mapa */
@media (max-width: 900px) {
  .hud-situation { padding: 12px 14px; max-height: 30vh; }
  .hud-situation h2 { font-size: 16px; }
  .stat-list { gap: 3px; margin: 8px 0; }
  .stat b { font-size: 21px; }
  .stat { font-size: 11px; }
  .hud-rivers {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .hud-rivers::-webkit-scrollbar { display: none; }
  .hud-rivers button { flex: 0 0 auto; }
  .hud-note { display: none; }
}


/* nombres de río: texto suelto sobre el cauce, sin caja */
.map-label-river {
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: #9fd8e4;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .9);
  transform: translate(-50%, -50%);
}

/* viñeta: el diorama se disuelve en los bordes, sin canto recto */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  background:
    radial-gradient(125% 95% at 50% 46%, transparent 62%, rgba(4, 10, 16, .34) 88%, rgba(3, 8, 13, .78) 100%);
}


/* panel colapsable (útil sobre todo en celular) */
.hud-toggle {
  display: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(47, 123, 255, .5);
  background: rgba(47, 123, 255, .12);
  color: #cfe0ff;
  font-size: 14px; line-height: 1;
  place-items: center;
}
@media (max-width: 900px) {
  .hud-toggle { display: grid; margin-left: 6px; }
  body.hud-min .stat-list,
  body.hud-min .hud-river-label,
  body.hud-min .hud-rivers,
  body.hud-min .hud-note { display: none; }
  body.hud-min .hud-situation { padding-bottom: 10px; }
  .hud-situation header { align-items: center; }
}


/* línea de tiempo de la crecida */
.timeline {
  position: absolute;
  left: 50%;
  bottom: 68px;
  transform: translateX(-50%);
  z-index: 24;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background: rgba(8, 18, 32, .86);
  border: 1px solid rgba(47, 123, 255, .4);
  box-shadow: 0 0 30px -14px rgba(47, 123, 255, .9);
  backdrop-filter: blur(12px);
  width: min(430px, calc(100% - 150px));
}
.tl-play {
  width: 32px; height: 32px; flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(35, 224, 232, .5);
  background: rgba(35, 224, 232, .12);
  color: #bff6f2;
  font-size: 11px;
  display: grid; place-items: center;
}
.tl-play:hover { border-color: var(--cyan); color: #fff; }
.tl-track { flex: 1; display: flex; align-items: center; gap: 10px; }
.tl-track input[type="range"] {
  flex: 1;
  -webkit-appearance: none; appearance: none;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(47,123,255,.85), rgba(35,224,232,.85));
  outline: none;
}
.tl-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: #eafcff;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 14px rgba(35, 224, 232, .9);
  cursor: pointer;
}
.tl-track input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: #eafcff; border: 2px solid var(--cyan);
}
.tl-date {
  flex: 0 0 auto;
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em;
  color: #cfe0ff; white-space: nowrap;
}
@media (max-width: 900px) {
  .timeline { width: calc(100% - 28px); bottom: 116px; padding: 7px 12px 7px 7px; }
  .tl-date { font-size: 9px; }
}


.tl-note {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .04em;
  color: #7fa6c0;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(47, 123, 255, .3);
  background: rgba(47, 123, 255, .08);
  cursor: help;
}
@media (max-width: 900px) { .tl-note { font-size: 8px; padding: 2px 5px; } }

/* =========================================================
   Ajuste fino para pantallas angostas (≤420 px)
   ========================================================= */
html, body { overflow-x: clip; }
.official-table-wrap { max-width:100%; overflow-x:auto; margin:10px 0; }
.official-table { width:100%; border-collapse:collapse; font-size:12px; line-height:1.5; }
.official-table th, .official-table td { padding:7px 6px; border-bottom:1px solid #ffffff20; text-align:left; vertical-align:top; overflow-wrap:anywhere; }
.official-table th { color:var(--txt-2); font-weight:600; }
.meteorology-table th:first-child { white-space:nowrap; min-width:76px; }
.map-tools { align-items:center; }
@media (max-width:900px) {
  .map-tools { display:flex; gap:5px; bottom:68px; padding:4px; border-radius:20px; background:#03101bdb; }
  .map-view-control {width:148px;gap:3px;padding:6px 3px;border-radius:14px;}
  .map-orbit {grid-template:repeat(3,44px)/repeat(3,44px);border-radius:45px;}
  .map-tools .map-orbit button {width:44px;height:44px;}
  .map-view-title {display:none;}
  .map-tools > button { width:44px; height:44px; }
  .map-source { font-size:9px; }
}
.drawer { background:linear-gradient(180deg,#08141c,#050d13); }
.ina-summary th { white-space: normal; }
.ina-summary td { white-space: nowrap; }
.ina-summary .ina-no-forecast { white-space: normal; }
.ina-source { display: block; margin-top: 2px; color: var(--txt-2); font-size: 11px; font-weight: 400; }
.fc-note a { color:#68e0f2; text-decoration:underline; }
.port.is-normal .pill { max-width:150px; }

@media (max-width: 420px) {
  .topbar { height: 56px; padding: 0 10px; gap: 8px; }
  .brand-txt strong { font-size: 15px; letter-spacing: .05em; }
  .brand-glyph { width: 22px; height: 22px; }
  .topbar-right { gap: 6px; }
  .topbar-right .btn-ghost { padding: 8px 10px; font-size: 11.5px; }
  .topbar-right .btn-solid { padding: 8px 12px; font-size: 12px; }
  .nav-toggle { width: 34px; height: 30px; padding: 7px 8px; }

  .hero { padding: 18px 0 14px; }
  .hero h1 { font-size: clamp(25px, 8.6vw, 34px); }
  .hero-sub { font-size: 12.5px; }

  .stage { height: clamp(400px, 56vh, 520px); }
  .hud-situation { padding: 10px 12px; }
  .hud-situation h2 { font-size: 15px; }
  .stat b { font-size: 19px; }
  .stat span { font-size: 9.5px; line-height: 1.25; }
  .hud-rivers button { padding: 6px 10px; font-size: 10.5px; }

  .timeline { width: calc(100% - 20px); bottom: 100px; padding: 6px 10px 6px 6px; gap: 8px; }
  .tl-note { display: none; }
  .tl-date { font-size: 8.5px; }
  .tl-play { width: 28px; height: 28px; }

  .map-tools { bottom: 54px; }
  .map-tools button { width: 38px; height: 38px; font-size: 14px; }
  .hud-legend { font-size: 9px; gap: 8px; padding: 7px 10px; }
}
/* el min-height heredado impedía que el mapa entrara en pantalla */
@media (max-width: 420px) {
  .stage { height: clamp(360px, 52vh, 480px); min-height: 0; }
  .hero { padding: 16px 0 12px; }
  .hero-sub {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
  }
  .hud-situation { max-height: 30vh; }
}
@media (max-width: 900px) and (min-width: 421px) {
  .stage { height: clamp(420px, 58vh, 560px); min-height: 0; }
}
/* Reserve separate mobile rows for navigation, chronology and attribution. */
@media (max-width:900px) {
  .stage { min-height:560px; }
  .map-tools { bottom:100px; }
  .map-tools button { width:44px; height:44px; }
  .timeline { bottom:210px; }
  .hud-situation { max-height:245px; }
  .hud-legend { bottom:24px; }
}

/* Versión 6: navegación 3D y línea de tiempo sin superposiciones táctiles. */
@media(max-width:900px) {
  .stage {height:max(640px,70vh);min-height:640px;}
  .hud-situation {max-height:180px;}
  .map-tools,body.drawer-open .map-tools {top:auto;bottom:88px;right:50%;left:auto;transform:translateX(50%);}
  #map-view-toggle {display:grid;width:92px;height:44px;border-radius:16px;font-size:12px;white-space:nowrap;}
  .map-tools .map-view-control {display:none;position:absolute;right:0;bottom:calc(100% + 10px);padding:10px 5px;background:#04121df5;box-shadow:0 10px 30px #0008;}
  .map-tools.is-view-open .map-view-control {display:grid;}
  .timeline {bottom:150px;}
  body.map-view-open .timeline {bottom:380px;}
}
.comunidad { overflow-wrap: anywhere; }
.comunidad > p:not(.eyebrow) { max-width: 65ch; }
.foro-form { max-width: 42rem; }
.foro-form textarea {
  width: 100%;
  padding: .7rem;
  border: 1px solid #346174;
  border-radius: .6rem;
  background: #081925;
  color: inherit;
  font: inherit;
  resize: vertical;
}
#foro-mensajes, .foro-mensajes { display: grid; gap: .75rem; margin-top: 1rem; }
#foro-mensajes article, .foro-mensajes article { padding: .9rem 1.2rem; border: 1px solid #294557; border-radius: .75rem; }
#foro-mensajes h3, .foro-mensajes h3 { margin: 0 0 .3rem; }
#foro-mensajes time, .foro-mensajes time { font-size: .8rem; }
#foro-mensajes article p, .foro-mensajes article p, .foro-texto { white-space: pre-wrap; overflow-wrap: anywhere; }
