:root {
  --primario: #002A5C;
  --primario-2: #0B3D75;
  --verde: #3A5A40;
  --fondo: #f4f6f8;
  --superficie: #ffffff;
  --texto: #1f2a24;
  --tenue: #55606b;
  --borde: #dde3ea;
  --aviso: #b45309;
  --aviso-fondo: #fff7e6;
  --alerta: #b91c1c;
  --alerta-fondo: #fdecec;
  --radio: 16px;
  --sombra: 0 4px 18px rgba(0, 42, 92, .10);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif; font-size: 16px; line-height: 1.45;
}
a { color: var(--primario-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tenue { color: var(--tenue); }

.cab { background: var(--primario); color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.cab-in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marca { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.marca-ic { font-size: 1.9rem; line-height: 1; }
.marca b { display: block; font-size: 1.08rem; white-space: nowrap; }
.marca small { display: block; color: #aecbe6; font-size: .8rem; white-space: nowrap; }
.btn-canal { background: #229ED9; color: #fff; text-decoration: none; font-weight: 700; padding: 8px 14px; border-radius: 999px; font-size: .9rem; white-space: nowrap; }

.cont { max-width: 1180px; margin: 0 auto; padding: 14px 16px 28px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) {
  .cont { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
  .avisos, .mapa-tarjeta, .fuentes, .tabla-tarjeta { grid-column: 1 / -1; }
}
.tarjeta { background: var(--superficie); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; min-width: 0; }
h2 { font-size: 1.08rem; margin: 0 0 10px; color: var(--primario); }
h3 { font-size: .98rem; margin: 14px 0 6px; color: var(--primario); }
.nota { font-size: .84rem; color: var(--tenue); margin: 8px 0 0; }

/* Avisos */
.avisos { display: grid; gap: 8px; }
.aviso { border-radius: 12px; padding: 10px 14px; border-left: 5px solid var(--aviso); background: var(--aviso-fondo); font-size: .95rem; }
.aviso.alerta { border-left-color: var(--alerta); background: var(--alerta-fondo); }
.aviso b { color: var(--aviso); }
.aviso.alerta b { color: var(--alerta); }

/* Ahora */
.ahora-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ahora-cab select {
  font: inherit; font-weight: 700; font-size: 1.12rem; color: var(--primario); border: 1.5px solid var(--borde);
  border-radius: 10px; padding: 8px 34px 8px 12px; background: #fff; max-width: 100%; min-height: 44px;
}
.ahora-cuerpo { display: flex; align-items: center; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.ahora-temp { display: flex; align-items: center; gap: 8px; }
.ic-grande { font-size: 3.2rem; line-height: 1; }
#ahora-t { font-size: 3.4rem; font-weight: 800; color: var(--primario); letter-spacing: -.02em; }
.ahora-datos { flex: 1; min-width: 220px; }
.ahora-cielo { font-weight: 700; font-size: 1.05rem; }
.chips { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chips li { background: #eef3f9; border-radius: 12px; padding: 8px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.chips b { font-size: 1.02rem; }
.chips small { color: var(--tenue); font-size: .75rem; }

.dias { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.dia { border: 1.5px solid var(--borde); border-radius: 12px; padding: 8px 6px; text-align: center; background: #fff; }
.dia.hoy { border-color: var(--primario-2); background: #f1f6fc; }
.dia .d-n { font-size: .8rem; font-weight: 700; color: var(--tenue); text-transform: capitalize; }
.dia .d-ic { font-size: 1.6rem; line-height: 1.3; }
.dia .d-t { font-weight: 800; }
.dia .d-t span { color: var(--tenue); font-weight: 600; }
.dia .d-p { font-size: .78rem; color: #1d4ed8; }
.dia .d-a { font-size: .74rem; font-weight: 700; color: var(--aviso); }

.grafica { position: relative; height: 240px; }

/* Sol, luna y UV */
.sol { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.sol span { background: #f5f7fa; border-radius: 999px; padding: 5px 11px; font-size: .86rem; color: var(--texto); white-space: nowrap; }
.sol .uv { color: #fff; font-weight: 700; }
.comparacion { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: #f1f6fc; font-size: .9rem; line-height: 1.5; }
.comparacion b.frio { color: #1d4ed8; }
.comparacion b.calor { color: #c2410c; }

/* 10 días */
.extendido { display: grid; gap: 2px; }
.ext-fila { display: grid; grid-template-columns: 74px 30px 1fr 64px 44px; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--borde); font-size: .92rem; }
.ext-fila:last-child { border-bottom: none; }
.ext-dia { font-weight: 700; text-transform: capitalize; }
.ext-ic { font-size: 1.3rem; text-align: center; }
.ext-barra { position: relative; height: 8px; background: #eef2f7; border-radius: 6px; }
.ext-barra i { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, #60a5fa, #fbbf24, #f97316); }
.ext-t { display: flex; justify-content: space-between; font-size: .82rem; color: var(--tenue); margin-top: 2px; }
.ext-t b { color: var(--texto); }
.ext-ll { font-size: .8rem; color: #1d4ed8; text-align: right; }
.ext-uv { font-size: .72rem; font-weight: 700; color: #fff; border-radius: 6px; padding: 2px 0; text-align: center; }

/* Aire */
.aire { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.aire-ica { border-radius: 14px; padding: 12px 16px; color: #fff; min-width: 140px; }
.aire-ica b { display: block; font-size: 2rem; line-height: 1.1; }
.aire-ica span { font-weight: 700; font-size: .9rem; }
.aire-dat { display: grid; grid-template-columns: repeat(3, auto); gap: 4px 16px; font-size: .9rem; }
.aire-dat small { display: block; color: var(--tenue); font-size: .75rem; }

/* Mapa */
.mapa-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.mapa-cab h2 { margin: 0; }
.segmento, .tabs { display: flex; gap: 4px; background: #eef3f9; padding: 4px; border-radius: 10px; flex-wrap: wrap; }
.segmento button { font: inherit; font-size: .86rem; font-weight: 700; border: none; background: transparent; color: var(--tenue); padding: 6px 10px; border-radius: 8px; cursor: pointer; min-height: 34px; }
.segmento button.sel { background: #fff; color: var(--primario); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.mapa-marco { position: relative; }
.mapa { height: 460px; border-radius: 12px; overflow: hidden; background: #e8eef4; }
.mapa-capas { position: absolute; top: 10px; right: 10px; z-index: 600; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mapa-capas .segmento { background: rgba(255,255,255,.92); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.btn-nubes { font: inherit; font-size: .86rem; font-weight: 700; border: none; border-radius: 10px; padding: 6px 12px; min-height: 42px; cursor: pointer;
  background: rgba(255,255,255,.92); color: var(--tenue); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.btn-nubes.sel { background: var(--primario); color: #fff; }
.etq { background: transparent; border: none; box-shadow: none; text-align: center; font-weight: 800; font-size: 12px; color: #0f172a; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; white-space: nowrap; }
.etq small { display: block; font-weight: 600; font-size: 10px; }
.leyenda { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: .82rem; color: var(--tenue); flex-wrap: wrap; }
.leyenda .barra { height: 10px; width: 180px; border-radius: 6px; }

/* Tabla */
.tabla-env { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tenue); border-bottom: 2px solid var(--borde); padding: 8px; }
.tabla td { padding: 9px 8px; border-bottom: 1px solid var(--borde); white-space: nowrap; }
.tabla tr { cursor: pointer; }
.tabla tr:hover td, .tabla tr.sel td { background: #f1f6fc; }
.tabla td:first-child { font-weight: 700; white-space: normal; }

.fuentes ul { margin: 0; padding-left: 18px; font-size: .92rem; }
.fuentes li { margin: 4px 0; }

.pie { text-align: center; font-size: .8rem; color: #647082; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }

@media (max-width: 560px) {
  .cont { padding: 10px 10px 24px; gap: 10px; }
  .tarjeta { padding: 14px 12px; }
  .marca small { display: none; }
  .btn-canal { padding: 7px 11px; font-size: .82rem; }
  #ahora-t { font-size: 3rem; }
  .ic-grande { font-size: 2.7rem; }
  .dias { gap: 6px; }
  .mapa { height: 380px; }
  .grafica { height: 210px; }
  .ext-fila { grid-template-columns: 58px 26px 1fr 52px 38px; gap: 6px; font-size: .86rem; }
  .tabla th:nth-child(5), .tabla td:nth-child(5), .tabla th:nth-child(6), .tabla td:nth-child(6) { display: none; }
  .btn-canal .largo { display: none; }
  .marca b { font-size: 1rem; }
}
