/* Tremo v2 — sistema de diseño. Amable como Duolingo, serio cuando hay alerta.
   Tokens en :root; modo oscuro por preferencia del sistema o elección del usuario. */
@font-face{font-family:'Nunito';font-style:normal;font-weight:500 900;font-display:swap;src:url(/fonts/nunito-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Nunito';font-style:normal;font-weight:500 900;font-display:swap;src:url(/fonts/nunito-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root {
  --bg: #F3F6FA; --surface: #FFFFFF; --surface-2: #EDF2F7; --line: #DCE4EE; --line-2: #C9D4E2;
  --text: #15203A; --muted: #56627C; --faint: #8893A8;
  --brand: #12B3A3; --brand-d: #0A8A7E; --brand-soft: #DDF5F2; --brand-ink: #06594F;
  --sun: #FFB43F; --sun-d: #DA8E12; --sun-soft: #FFF2DB;
  --sky: #2F7FEA; --sky-d: #1C60BE; --sky-soft: #E2EEFD;
  --danger: #E5383B; --danger-d: #B3222A; --danger-soft: #FDE4E4;
  --warn: #F29A0E; --ok: #16A34A; --ok-soft: #DDF6E6;
  --m-micro: #8C98AD; --m-minor: #1FB35B; --m-light: #D9A70B; --m-moderate: #F07B16; --m-strong: #E23B3B; --m-major: #A61E2D; --m-great: #6D35D9;
  --radius: 18px; --radius-s: 12px; --radius-xs: 8px;
  --shadow: 0 2px 0 var(--line), 0 10px 28px rgba(21, 32, 58, .06);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --tabbar-h: 66px; --topbar-h: 60px; --side-w: 236px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0C1220; --surface: #131B2E; --surface-2: #1A2440; --line: #25314E; --line-2: #32406A;
  --text: #E6ECF8; --muted: #A2AECB; --faint: #6F7C99;
  --brand-soft: #0D3A36; --brand-ink: #7BE5D9; --sun-soft: #3A2A0E; --sky-soft: #132A4A; --danger-soft: #3D1418; --ok-soft: #0F3320;
  --shadow: 0 2px 0 #080C16, 0 10px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1220; --surface: #131B2E; --surface-2: #1A2440; --line: #25314E; --line-2: #32406A;
    --text: #E6ECF8; --muted: #A2AECB; --faint: #6F7C99;
    --brand-soft: #0D3A36; --brand-ink: #7BE5D9; --sun-soft: #3A2A0E; --sky-soft: #132A4A; --danger-soft: #3D1418; --ok-soft: #0F3320;
    --shadow: 0 2px 0 #080C16, 0 10px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
img, svg { max-width: 100%; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 900; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .8em; }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; inset-inline-start: 8px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; transform: translateY(-200%); }
.skip:focus { transform: none; }
svg.i { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Estructura ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 8px;
  padding: 0 12px; padding-top: env(safe-area-inset-top); background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.25rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img, .brand svg { width: 34px; height: 34px; }
@media (max-width: 439px) { .brand span { display: none; } .topbar { gap: 6px; } }
.topbar .spacer { flex: 1; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); white-space: nowrap; }
.live-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.8s infinite; will-change: opacity; }
.live-pill.is-stale { background: var(--sun-soft); color: var(--sun-d); }
.live-pill.is-down { background: var(--danger-soft); color: var(--danger); }
.live-pill.is-stale::before, .live-pill.is-down::before { animation: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; position: relative; font: inherit;
}
.icon-btn:hover { border-color: var(--line-2); text-decoration: none; }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 900; display: grid; place-items: center; }
.sos-btn { background: var(--danger); border-color: var(--danger-d); color: #fff; box-shadow: 0 3px 0 var(--danger-d); font-weight: 900; font-size: .8rem; }
.sos-btn:hover { border-color: var(--danger-d); }
.avatar-btn { font-size: 1.3rem; }

.layout { display: grid; grid-template-columns: 1fr; min-height: calc(100dvh - var(--topbar-h)); }
.sidenav { display: none; }
main#app { padding: 14px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); max-width: 880px; width: 100%; min-width: 0; margin: 0 auto; outline: none; }
.rightrail { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 2px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--faint);
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em;
}
.tab svg.i { width: 26px; height: 26px; }
.tab span { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab:hover { text-decoration: none; color: var(--muted); }
.tab.is-active { color: var(--brand-d); }
.tab.is-active svg.i { stroke-width: 2.6; }
:root[data-theme="dark"] .tab.is-active { color: var(--brand); }

@media (min-width: 1024px) {
  .layout { grid-template-columns: var(--side-w) 1fr; }
  .sidenav {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: var(--topbar-h); height: calc(100dvh - var(--topbar-h));
    padding: 16px 12px; border-right: 2px solid var(--line); overflow-y: auto;
  }
  .sidenav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; border: 2px solid transparent;
    color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: .86rem; letter-spacing: .03em;
  }
  .sidenav a svg.i { width: 26px; height: 26px; }
  .sidenav a:hover { background: var(--surface-2); text-decoration: none; }
  .sidenav a.is-active { color: var(--sky); background: var(--sky-soft); border-color: color-mix(in srgb, var(--sky) 45%, transparent); }
  .sidenav .sep { height: 2px; background: var(--line); margin: 8px 6px; }
  .tabbar { display: none; }
  main#app { padding: 22px 24px 48px; max-width: 900px; }
}
@media (min-width: 1320px) {
  .layout { grid-template-columns: var(--side-w) 1fr 340px; }
  .rightrail { display: flex; flex-direction: column; gap: 14px; padding: 22px 18px; position: sticky; top: var(--topbar-h); height: calc(100dvh - var(--topbar-h)); overflow-y: auto; }
}

/* ── Componentes ────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.divider { height: 2px; background: var(--line); margin: 14px 0; border: 0; }

.btn {
  --b: var(--brand); --bd: var(--brand-d); --c: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border: 0; border-radius: 14px; background: var(--b); color: var(--c); box-shadow: 0 4px 0 var(--bd);
  font: inherit; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; font-size: .9rem; cursor: pointer;
  transition: transform .06s, box-shadow .06s, filter .15s; text-align: center; user-select: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--bd); }
.btn[disabled] { --b: var(--surface-2); --bd: var(--line); --c: var(--faint); cursor: not-allowed; }
.btn.sky { --b: var(--sky); --bd: var(--sky-d); }
.btn.sun { --b: var(--sun); --bd: var(--sun-d); --c: #3B2500; }
.btn.danger { --b: var(--danger); --bd: var(--danger-d); }
.btn.ghost { --b: var(--surface); --bd: var(--line-2); --c: var(--text); border: 2px solid var(--line-2); box-shadow: 0 3px 0 var(--line-2); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .78rem; border-radius: 11px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--sky); font: inherit; font-weight: 800; cursor: pointer; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; border: 2px solid var(--line);
  background: var(--surface); color: var(--muted); font: inherit; font-size: .85rem; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--line-2); text-decoration: none; }
.chip.is-on { background: var(--sky-soft); border-color: var(--sky); color: var(--sky-d); }
:root[data-theme="dark"] .chip.is-on { color: #9CC4FF; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 720px) { .chips { flex-wrap: wrap; overflow-x: visible; } } /* en pantallas anchas nada queda escondido */

.seg { display: inline-flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 800; font-size: .84rem; padding: 7px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.seg button.is-on { background: var(--surface); color: var(--text); box-shadow: 0 2px 0 var(--line); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span, .label { font-weight: 800; font-size: .88rem; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--sky); outline: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: .92rem; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; margin-top: 1px; }
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--sky); outline-offset: 2px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 2px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .txt { flex: 1; min-width: 0; }
.setting .txt b { display: block; }
.setting .txt small { color: var(--muted); }
input[type=range] { width: 100%; accent-color: var(--brand); height: 28px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { min-width: 72px; text-align: end; font-weight: 900; }

/* Magnitud e intensidad */
.mag {
  --c: var(--m-micro); display: inline-grid; place-items: center; min-width: 52px; height: 52px; padding: 0 6px; border-radius: 16px;
  background: var(--c); color: #fff; font-weight: 900; font-size: 1.15rem; box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 70%, #000);
  flex: none; font-variant-numeric: tabular-nums;
}
.mag.sm { min-width: 40px; height: 40px; font-size: .95rem; border-radius: 12px; }
.c-micro { --c: var(--m-micro); } .c-minor { --c: var(--m-minor); } .c-light { --c: var(--m-light); }
.c-moderate { --c: var(--m-moderate); } .c-strong { --c: var(--m-strong); } .c-major { --c: var(--m-major); } .c-great { --c: var(--m-great); }
.mmi { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 8px; font-size: .78rem; font-weight: 900; background: var(--c, var(--surface-2)); color: #13203A; }
.mmi-1 { --c: #E9EEF5; } .mmi-2 { --c: #BFD0FF; } .mmi-3 { --c: #A6E8FF; } .mmi-4 { --c: #89FFF0; } .mmi-5 { --c: #8BFF9E; }
.mmi-6 { --c: #FFF15C; } .mmi-7 { --c: #FFC43D; } .mmi-8 { --c: #FF8F2E; } .mmi-9 { --c: #FF4B3A; color: #fff; } .mmi-10 { --c: #C81E1E; color: #fff; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 8px; font-size: .74rem; font-weight: 900; background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--sun-soft); color: var(--sun-d); }
.badge.bad { background: var(--danger-soft); color: var(--danger); } .badge.info { background: var(--sky-soft); color: var(--sky-d); }

/* Lista de sismos */
.quake-list { display: flex; flex-direction: column; }
.quake {
  display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 2px solid var(--line); cursor: pointer; color: inherit;
  border-radius: 12px;
}
.quake:hover { background: var(--surface-2); text-decoration: none; }
.quake:last-child { border-bottom: 0; }
.quake .info { flex: 1; min-width: 0; }
.quake .place { font-weight: 800; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.quake .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .8rem; color: var(--muted); margin-top: 3px; }
.quake .side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: end; font-size: .78rem; color: var(--muted); flex: none; }
.quake.is-new .place::after { content: " ●"; color: var(--danger); }
.empty { text-align: center; padding: 26px 12px; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; height: 60px; margin: 8px 0; }

/* Estado / héroe con mascota */
.hero { display: flex; gap: 14px; align-items: center; }
.hero .mascot { width: 104px; height: 104px; flex: none; }
.bubble {
  position: relative; flex: 1; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 12px 14px;
  font-weight: 700;
}
.bubble::before { content: ""; position: absolute; left: -11px; top: 26px; border: 10px solid transparent; border-right-color: var(--line); border-left: 0; }
.bubble::after { content: ""; position: absolute; left: -7px; top: 28px; border: 8px solid transparent; border-right-color: var(--surface); border-left: 0; }
[dir="rtl"] .bubble::before { left: auto; right: -11px; border-right-color: transparent; border-left-color: var(--line); border-left: 10px solid var(--line); border-right: 0; }
[dir="rtl"] .bubble::after { left: auto; right: -7px; border-right: 0; border-left: 8px solid var(--surface); }
.status-calm { background: linear-gradient(135deg, var(--brand-soft), var(--surface) 70%); }
.status-watch { background: linear-gradient(135deg, var(--sun-soft), var(--surface) 70%); }
.status-alert { background: linear-gradient(135deg, var(--danger-soft), var(--surface) 70%); border-color: var(--danger); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.35rem; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: .7rem; line-height: 1.3; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }

/* Mascota */
.tremo-svg { overflow: visible; }
/* Parpadeo: lo dispara un solo temporizador (mascot.js) 0,3 s cada ~5 s; una animación SVG continua mantenía
   el hilo principal recalculando estilos en cada fotograma. */
.tremo-svg .blink { transform-origin: center 46%; transform-box: fill-box; }
.tremo.blink-now .blink { animation: blink .3s; }
/* Envoltorio HTML: salto, temblor y sismógrafo con transform (los mueve la tarjeta gráfica, no la CPU). */
.tremo { position: relative; display: inline-block; flex: none; line-height: 0; }
.tremo.is-alert { animation: shake .45s infinite; will-change: transform; }
.tremo.is-happy { animation: hop 1.2s ease-in-out infinite; will-change: transform; }
.tremo-ecg { position: absolute; left: 27.5%; top: 53.08%; width: 42.5%; height: 30.77%; overflow: hidden; }
.tremo-ecg i { position: absolute; inset: 0 auto 0 0; width: 200%; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 51 40'%3E%3Cpath d='M0 20h8l4-8 6 16 6-20 6 20 5-12 4 4h12' stroke='%230A8A7E' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0 / 50% 100% repeat-x; animation: wave 2.4s linear infinite; will-change: transform; }

/* Alertas / overlay: cabe en cualquier pantalla (tamaños por ancho Y alto; si aun así no cabe, se
   desplaza sin cortar arriba: margin:auto en flex centra solo cuando sobra espacio). */
.alert-overlay {
  position: fixed; inset: 0; z-index: 90; display: none; padding: 16px; overflow-y: auto; overscroll-behavior: contain;
  background: radial-gradient(circle at 50% 30%, rgba(229,56,59,.96), rgba(120,12,20,.97));
  color: #fff; text-align: center;
}
.alert-overlay.is-open { display: flex; animation: flash 1s ease-in-out 3; }
.alert-overlay .box { max-width: 560px; width: 100%; margin: auto; }
.alert-overlay h2 { font-size: clamp(1.25rem, min(1.2rem + 3vw, 5.5vh), 2.6rem); margin: 6px 0; }
.alert-overlay .big { font-size: clamp(2.4rem, min(2rem + 8vw, 12vh), 5.6rem); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.alert-overlay .kicker { font-weight: 900; letter-spacing: .12em; text-transform: uppercase; opacity: .9; }
.alert-overlay .facts { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: min(12px, 1.6vh) 0; }
.alert-overlay .facts span { background: rgba(255,255,255,.16); padding: 5px 12px; border-radius: 12px; font-weight: 800; }
.alert-overlay .count { margin: min(14px, 1.8vh) auto; width: clamp(96px, 19vh, 150px); height: clamp(96px, 19vh, 150px); border-radius: 50%; border: 6px solid rgba(255,255,255,.85); display: grid; place-items: center; font-size: clamp(2.2rem, 6.5vh, 3.4rem); font-weight: 900; }
.alert-overlay .count small { display: block; font-size: .8rem; font-weight: 800; }
.alert-overlay .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: min(16px, 2vh); }
.alert-overlay .note { font-size: .8rem; opacity: .85; margin: min(12px, 1.5vh) 0 0; }
.alert-overlay .btn.ghost { --b: rgba(255,255,255,.14); --bd: rgba(0,0,0,.25); --c: #fff; border-color: rgba(255,255,255,.5); }
@media (min-width: 720px) { .alert-overlay .box { max-width: 760px; } .alert-overlay .actions { grid-template-columns: repeat(4, 1fr); } }
.alert-overlay.is-info { background: radial-gradient(circle at 50% 30%, #1d5fbf, #0c2a5c); }
.drop { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.drop div { background: rgba(255,255,255,.15); border-radius: 14px; padding: 10px 6px; font-weight: 900; font-size: .9rem; }
.drop div span { display: block; font-size: clamp(1.3rem, 4vh, 1.8rem); }

.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 14px; margin-bottom: 12px; font-weight: 700; border: 2px solid transparent; }
.banner.info { background: var(--sky-soft); border-color: color-mix(in srgb, var(--sky) 40%, transparent); }
.banner.warning { background: var(--sun-soft); border-color: color-mix(in srgb, var(--sun) 50%, transparent); }
.banner.danger { background: var(--danger-soft); border-color: var(--danger); }
.banner .grow { flex: 1; }

/* Hojas (bottom sheet) y diálogos */
.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(8, 12, 22, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  width: 100%; max-width: 620px; max-height: 88dvh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease-out;
}
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 12px; }
@media (min-width: 720px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 22px; } .sheet::before { display: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; }
.toasts { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 800; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: up .2s; pointer-events: auto; }
.toast.err { background: var(--danger); color: #fff; }
@media (min-width: 1024px) { .toasts { bottom: 24px; } }

/* Mapa */
.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 2px solid var(--line); background: var(--surface-2); }
#quake-map { height: min(68dvh, 620px); min-height: 360px; }
.map-full #quake-map { height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - 40px); }
.map-tools { position: absolute; z-index: 500; top: 10px; left: 10px; right: 60px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.map-tools > * { pointer-events: auto; }
.map-tools .chip { box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.map-legend { position: absolute; z-index: 500; bottom: 10px; left: 10px; background: var(--surface); border-radius: 12px; padding: 6px 10px; font-size: .74rem; font-weight: 800; display: flex; gap: 8px; flex-wrap: wrap; box-shadow: 0 2px 8px rgba(0,0,0,.15); max-width: calc(100% - 20px); }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 4px; vertical-align: -1px; }
.maplibregl-map { font-family: var(--font); background: var(--surface-2); }
/* Un selector más fuerte que el de MapLibre: su CSS carga después y dejaba el fondo blanco con el texto claro del
   modo oscuro encima (casi no se leía). */
.maplibregl-popup .maplibregl-popup-content { background: var(--surface); color: var(--text); border-radius: 16px; padding: 14px 14px 12px; font-size: .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.3); border: 1px solid var(--line); }
.maplibregl-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.maplibregl-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.maplibregl-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.maplibregl-popup .maplibregl-popup-close-button { color: var(--muted); font-size: 22px; padding: 2px 8px; }
.qpop { display: grid; gap: 10px; min-width: 250px; }
.qpop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qpop-actions .btn { font-size: .74rem; line-height: 1.15; white-space: normal; padding: 8px 8px; min-height: 44px; }
.qpop-head { display: flex; gap: 10px; align-items: center; padding-right: 18px; }
.qpop-head b { display: block; line-height: 1.25; }
.qpop-head small { color: var(--muted); }
.qpop-facts { display: flex; gap: 6px; margin: 0; }
.qpop-facts div { flex: 1; background: var(--surface-2); border-radius: 10px; padding: 6px 8px; min-width: 0; }
.qpop-facts dt { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.qpop-facts dd { margin: 0; font-weight: 800; }
.maplibregl-ctrl-group { border-radius: 12px !important; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.18) !important; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.map-key { display: flex; gap: 12px; flex-wrap: wrap; font-size: .8rem; font-weight: 800; margin: -8px 0 14px; }
.map-key i { display: inline-block; width: 18px; height: 0; border-top: 2px dashed #F07B16; vertical-align: middle; margin-inline-end: 6px; }
.map-key b { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #E23B3B; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); vertical-align: -2px; margin-inline-end: 6px; }
.calc-panel { position: absolute; z-index: 500; right: 10px; bottom: 10px; width: min(300px, calc(100% - 20px)); background: var(--surface); border-radius: 16px; padding: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: .88rem; }
.q-pulse { width: var(--s); height: var(--s); border-radius: 50%; pointer-events: none; }
.q-pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--c); animation: qpulse 1.8s ease-out infinite; will-change: transform, opacity; }
@keyframes qpulse { from { transform: scale(1); opacity: .8; } to { transform: scale(3.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .q-pulse::after { animation: none; opacity: .6; } }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--sky); border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(47,127,234,.3); }
.place-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: 0 0 0 3px rgba(18,179,163,.3); }

/* Tabla */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: start; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }

/* Laboratorio */
.gauge { position: relative; width: 190px; margin: 0 auto; text-align: center; }
.gauge svg { width: 190px; height: 110px; }
.gauge .val { position: absolute; left: 0; right: 0; top: 52px; font-size: 2.1rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.gauge .lbl { font-size: .74rem; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin-top: -6px; }
.method { display: grid; grid-template-columns: 92px 1fr 64px; gap: 10px; align-items: center; margin: 8px 0; font-weight: 800; font-size: .88rem; }
.method .bar { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.method .bar i { display: block; height: 100%; border-radius: 99px; background: var(--c, var(--sky)); transition: width .5s; }
.method output { text-align: end; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 90px; display: block; }
.spark rect { fill: var(--sky); } .spark rect.hi { fill: var(--danger); }
.gr-plot { width: 100%; height: 200px; display: block; }
.gr-plot .pt { fill: var(--sky); } .gr-plot .fit { stroke: var(--danger); stroke-width: 2; fill: none; stroke-dasharray: 5 4; }
.gr-plot .ax { stroke: var(--line-2); stroke-width: 1; } .gr-plot text { fill: var(--muted); font-size: 10px; font-family: var(--font); font-weight: 700; }
.kpi { background: var(--surface-2); border-radius: 14px; padding: 12px; }
.kpi b { display: block; font-size: 1.4rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .76rem; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }

/* Comunidad */
.chat { display: flex; flex-direction: column; height: min(62dvh, 620px); min-height: 380px; }
.chat-feed { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 2px 10px; overscroll-behavior: contain; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg .av { width: 34px; height: 34px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.2rem; flex: none; cursor: pointer; border: 0; }
.msg .body { background: var(--surface-2); border-radius: 16px 16px 16px 4px; padding: 8px 12px; cursor: pointer; min-width: 0; }
.msg .who { font-size: .76rem; font-weight: 900; color: var(--sky-d); display: flex; gap: 6px; align-items: center; }
:root[data-theme="dark"] .msg .who { color: #8DB8FF; }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .time { font-size: .7rem; color: var(--faint); }
.msg .quote { border-inline-start: 3px solid var(--brand); padding: 2px 8px; margin: 2px 0 4px; font-size: .8rem; color: var(--muted); background: color-mix(in srgb, var(--brand) 8%, transparent); border-radius: 6px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.mine .body { background: var(--brand-soft); border-radius: 16px 16px 4px 16px; }
.msg.pending { opacity: .65; }
.post-hero { display: block; width: 100%; height: auto; border-radius: 16px; margin: 6px 0 14px; background: var(--surface-2); }
.post-thumb { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; margin-bottom: 8px; background: var(--surface-2); }
/* Anti-spam: el reto de Turnstile y el campo trampa (invisible para las personas). */
.captcha { margin: 10px 0; min-height: 65px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.composer { display: flex; gap: 8px; align-items: flex-end; border-top: 2px solid var(--line); padding-top: 10px; }
.composer textarea { min-height: 46px; max-height: 120px; resize: none; }
.reply-bar { display: flex; align-items: center; gap: 8px; font-size: .82rem; background: var(--surface-2); border-radius: 10px; padding: 6px 10px; margin-bottom: 6px; }
.people { display: flex; flex-direction: column; gap: 4px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; border: 0; background: none; font: inherit; color: inherit; text-align: start; width: 100%; }
.person:hover { background: var(--surface-2); }
.person .av { width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.3rem; }
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; }
.avatar-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.avatar-pick button { height: 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-size: 1.5rem; cursor: pointer; }
.avatar-pick button.is-on { border-color: var(--brand); background: var(--brand-soft); }

/* Aprende: camino tipo Duolingo */
.path { display: flex; flex-direction: column; align-items: center; gap: 46px; padding: 10px 0 40px; }
.unit-head { width: 100%; border-radius: 18px; padding: 14px 16px; color: #fff; background: var(--u, var(--brand)); box-shadow: 0 4px 0 color-mix(in srgb, var(--u, var(--brand)) 70%, #000); }
.unit-head small { opacity: .9; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.node {
  --n: var(--brand); width: 78px; height: 72px; border-radius: 50%; border: 0; background: var(--n); color: #fff; cursor: pointer; display: grid; place-items: center;
  font-size: 1.9rem; box-shadow: 0 7px 0 color-mix(in srgb, var(--n) 68%, #000); transition: transform .08s; position: relative;
}
.node:active { transform: translateY(5px); box-shadow: 0 2px 0 color-mix(in srgb, var(--n) 68%, #000); }
.node.locked { --n: var(--line-2); cursor: not-allowed; filter: grayscale(1); }
.node.quiz { border-radius: 26px; }
.node.done { --n: var(--sun); }
.node .lbl { position: absolute; top: 100%; margin-top: 12px; font-size: .78rem; font-weight: 800; color: var(--muted); width: 150px; text-align: center; line-height: 1.2; }
.path .node:nth-of-type(4n+1) { transform: translateX(-54px); } .path .node:nth-of-type(4n+3) { transform: translateX(54px); }
.path-gap { height: 22px; }
.xpbar { height: 16px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.lesson { max-width: 620px; margin: 0 auto; }
.lesson-card { min-height: 240px; }
.choice { display: block; width: 100%; text-align: start; padding: 14px 16px; margin: 8px 0; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--line); color: var(--text); }
.choice:hover { background: var(--surface-2); }
.choice.is-right { border-color: var(--ok); background: var(--ok-soft); box-shadow: 0 3px 0 var(--ok); }
.choice.is-wrong { border-color: var(--danger); background: var(--danger-soft); box-shadow: 0 3px 0 var(--danger); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.badge-item { text-align: center; font-size: .74rem; font-weight: 800; color: var(--muted); }
.badge-item .medal { width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 50%; display: grid; place-items: center; font-size: 1.9rem; background: var(--sun-soft); border: 3px solid var(--sun); }
.badge-item.locked .medal { filter: grayscale(1); opacity: .45; border-color: var(--line-2); background: var(--surface-2); }
.prose { font-size: 1.04rem; line-height: 1.7; }
.prose h2 { margin-top: 1.4em; } .prose ul, .prose ol { padding-inline-start: 1.3em; } .prose li { margin: .3em 0; }
.prose blockquote { margin: 1em 0; padding: 10px 14px; border-inline-start: 4px solid var(--brand); background: var(--surface-2); border-radius: 10px; }
.prose .lead { font-size: 1.12rem; color: var(--muted); }
.post-card { display: block; color: inherit; }
.post-card:hover { text-decoration: none; border-color: var(--line-2); }

/* Emergencia */
.sos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sos-big { min-height: 120px; flex-direction: column; font-size: 1rem; border-radius: 22px; }
.sos-big span { font-size: 2.4rem; line-height: 1; }
.numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.number { display: block; padding: 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--text); box-shadow: 0 3px 0 var(--line); }
.number b { display: block; font-size: 1.5rem; font-weight: 900; color: var(--danger); }
.number:hover { text-decoration: none; background: var(--surface-2); }
.steps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.steps3 div { background: var(--surface-2); border-radius: 16px; padding: 12px 8px; font-weight: 900; }
.steps3 div span { display: block; font-size: 2rem; }
.steps3 div small { display: block; font-weight: 600; color: var(--muted); margin-top: 4px; }
.strobe { position: fixed; inset: 0; z-index: 99; background: #fff; display: grid; place-items: center; color: #000; font-weight: 900; }
.strobe.off { background: #000; color: #333; }
/* Modo atrapado: negro fijo (en pantallas OLED el negro casi no gasta batería) y botones grandes. */
.trapped { position: fixed; inset: 0; z-index: 95; overflow-y: auto; background: #000; color: #E6ECF8; }
.trapped-in { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.trapped .icon-btn { color: #E6ECF8; background: #111; border-color: #333; }
.trapped ol { margin: 0; padding-left: 20px; color: #C9D1E3; }
.trapped ol li { margin-bottom: 6px; }
.tr-btn { display: grid; gap: 4px; width: 100%; min-height: 64px; padding: 14px 16px; border: 2px solid #3A2226; border-radius: 16px; background: #140A0C; color: #fff; font: inherit; font-size: 1.05rem; text-align: start; cursor: pointer; }
.tr-btn small { color: #B9A4A8; font-size: .8rem; font-weight: 600; }
.tr-btn[aria-pressed="true"] { background: #7A1020; border-color: #FF4D5E; }
.tr-msg { margin: 0 0 8px; padding: 10px; border-radius: 10px; background: #111; overflow-wrap: anywhere; }

/* Diagnóstico */
.check-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 2px solid var(--line); }
.check-item:last-child { border-bottom: 0; }
.check-item .st { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; flex: none; }
.check-item .st.ok { background: var(--ok-soft); color: var(--ok); } .check-item .st.bad { background: var(--danger-soft); color: var(--danger); } .check-item .st.warn { background: var(--sun-soft); color: var(--sun-d); }
.check-item .txt { flex: 1; min-width: 0; } .check-item .txt small { display: block; color: var(--muted); }

.cookie { position: fixed; z-index: 80; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
@media (min-width: 1024px) { .cookie { bottom: 20px; } }
/* Bloque de AdSense: rotulado, al final de la página; si Google no tiene anuncio, desaparece. */
.ad-slot { margin: 18px 0; text-align: center; }
.ad-slot small { display: block; margin-bottom: 4px; color: var(--faint); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }
.footer { margin: 26px 0 8px; padding-top: 16px; border-top: 2px solid var(--line); color: var(--faint); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.footer a { color: var(--muted); font-weight: 700; }
.prerendered { display: block; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes blink { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px) rotate(-2deg); } 75% { transform: translateX(3px) rotate(2deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes wave { to { transform: translateX(-50%); } }
@keyframes flash { 50% { filter: brightness(1.35); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
[dir="rtl"] .path .node:nth-of-type(4n+1) { transform: translateX(54px); } [dir="rtl"] .path .node:nth-of-type(4n+3) { transform: translateX(-54px); }

/* Perfil público, amigos y clasificación */
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-av { width: 84px; height: 84px; border-radius: 26px; background: var(--brand-soft); display: grid; place-items: center; font-size: 3rem; flex: none; }
.profile-bio { font-size: 1.05rem; margin: 0 0 14px; }
.link-kpi { border: 0; font: inherit; color: inherit; text-align: start; cursor: pointer; text-decoration: none; }
.link-kpi:hover { outline: 2px solid var(--brand); }
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.board li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.board li.is-me { background: var(--brand-soft); }
.board li a { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.board .rank { width: 28px; text-align: center; font-weight: 900; }
.board .av { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.15rem; }
.board b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.points-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.points-list div { display: flex; gap: 10px; align-items: baseline; }
.points-list b { color: var(--brand-d); min-width: 42px; }

/* Curso: libro, meta diaria, examen, diploma */
.book-card { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.book-card img { width: 120px; height: auto; border-radius: 8px; box-shadow: 0 10px 24px rgba(0,0,0,.28); }
.book-card > div { flex: 1; min-width: 220px; }
.goal-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.goal-dots { display: flex; gap: 6px; }
.goal-dots i { width: 16px; height: 16px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--line-2); }
.goal-dots i.on { background: var(--sun); border-color: var(--sun-d); }
.choice.is-picked { border-color: var(--sky); background: var(--sky-soft); }
.diploma-card { padding: 10px; }
.diploma-card canvas { width: 100%; height: auto; display: block; border-radius: 10px; }
@media print {
  body * { visibility: hidden; }
  #diploma-canvas, #diploma-canvas * { visibility: visible; }
  #diploma-canvas { position: fixed; inset: 0; width: 100%; }
  @page { size: landscape; margin: 0; }
}

/* ── Visitantes: qué se gana con una cuenta ── */
.gate .hero { margin-bottom: 12px; }
.gate-perks { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.gate-perks li { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: .9rem; }

/* ── Apoyar (mismos métodos que Arkemu) ── */
.support-hero h1 { margin: 2px 0 6px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; color: var(--brand-d); }
.support-methods { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: stretch; margin-bottom: 14px; }
.support-methods .way { margin: 0; display: grid; gap: 10px; align-content: start; }
.support-methods .way h2 { margin: 0; }
.way-paypal { text-align: center; border-color: var(--sun); align-content: center !important; }
.bn-pay { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bn-id { flex: 1 1 170px; display: grid; gap: 6px; min-width: 0; }
.bn-id .copy-row code { white-space: nowrap; } /* el Pay ID es corto: en una línea */
.wallets summary { cursor: pointer; font-weight: 800; padding: 8px 2px; color: var(--brand-ink); }
.wallets[open] summary { margin-bottom: 6px; }
.wallets .copy-row + .copy-row { margin-top: 8px; }
.way-free { border-color: var(--ok); }
.amounts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.amount { min-width: 58px; padding: 8px 12px; border-radius: var(--radius-xs); border: 2px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 800; cursor: pointer; transition: transform .12s, border-color .12s; }
.amount:hover { transform: translateY(-1px); border-color: var(--sun); }
.amount.is-on { border-color: var(--sun-d); background: var(--sun-soft); }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 8px 10px; border-radius: var(--radius-xs); background: var(--surface-2); border: 1px solid var(--line); }
.copy-label { grid-column: 1 / -1; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.copy-row code { min-width: 0; overflow-wrap: anywhere; font-size: .82rem; line-height: 1.35; color: var(--brand-ink); }
.bn-pay .qr { width: 132px; height: 132px; flex: none; object-fit: contain; border-radius: var(--radius-s); background: #fff; padding: 6px; }
.support-thanks { text-align: center; color: var(--muted); margin: 18px 0 8px; }

/* ── Pantalla de carga (antes de que arranque la app; main.js la quita) ── */
/* Solo transform/opacity en elementos HTML (regla 10). Si la app no arrancara, se retira sola a los 12 s. */
.splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg); transition: opacity .35s ease; animation: splash-failsafe 0s 12s forwards; }
.splash.out { opacity: 0; pointer-events: none; }
@keyframes splash-failsafe { to { opacity: 0; visibility: hidden; } }
.splash-in { display: grid; justify-items: center; gap: 12px; }
.splash-mascot { width: 120px; height: 130px; animation: splash-hop 1.1s ease-in-out infinite; will-change: transform; }
@keyframes splash-hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.splash-bubble { position: relative; margin-bottom: 4px; padding: 8px 18px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow); color: var(--text); font-weight: 800; }
.splash-bubble::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px; background: var(--surface); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg); }
.splash-bar { width: 180px; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.splash-bar i { display: block; width: 45%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--sky)); animation: splash-bar 1.2s ease-in-out infinite; will-change: transform; }
@keyframes splash-bar { from { transform: translateX(-110%); } to { transform: translateX(240%); } }
@media (prefers-reduced-motion: reduce) { .splash-mascot, .splash-bar i { animation: none; } }

/* Avatar con foto o con la mascota: suelto mide lo que un emoji; dentro de su caja la llena. */
.av-img { width: 1.15em; height: 1.15em; border-radius: 30%; object-fit: cover; vertical-align: -0.2em; }
.av .av-img, .profile-av .av-img, .avatar-pick .av-img { width: 100%; height: 100%; border-radius: inherit; vertical-align: top; }
.av, .profile-av, .avatar-pick button { overflow: hidden; }
.avatar-pick button { padding: 0; }

/* Laboratorio: lo que explica la IA (resumen de la semana y "Explícamelo"). */
.lab-ai { display: flex; gap: 12px; align-items: flex-start; background: var(--brand-soft); border-radius: 16px; padding: 12px 14px; margin: 10px 0; }
.lab-ai img { flex: none; }
.lab-ai p { margin: 0 0 4px; }

/* Histórico en CSV (mapa): un botón por periodo; el número de sismos y la magnitud mínima, en pequeño. */
.hist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.hist-grid .btn { justify-content: flex-start; text-align: start; white-space: normal; }
.hist-grid .btn small { font-weight: 600; text-transform: none; letter-spacing: 0; }
