/* Estética de Cubierto (diseño de Pablo, Claude Design). Oscuro, Sora + JetBrains Mono, un color por nivel. */
:root {
  --bg: #000;
  --ink: #f2f0f7;
  --ink-2: #dcd8e6;
  --ink-3: #c9c3d9;
  --muted: #a9a3bc;
  --faint: #8a849c;
  --panel: #0d0b12;
  --panel-2: #16131d;
  --line: #221e2b;
  --line-2: #2a2633;
  --line-3: #3a3545;
  --dot-off: #2a2633;
  --c-calm: #8ec5ff;
  --c-storm: #5fd8e6;
  --c-watch: #d2b1ff;
  --c-protect: #ffa6d0;
  /* nivel activo (lo cambia data-level en <body>) */
  --accent: var(--c-watch);
  --soft: rgba(210, 177, 255, 0.22);
  --deep: #3e1f72;
  color-scheme: dark;
}
body[data-level='calm'] { --accent: var(--c-calm); --soft: rgba(142, 197, 255, 0.22); --deep: #14306b; }
body[data-level='storm'] { --accent: var(--c-storm); --soft: rgba(95, 216, 230, 0.22); --deep: #0d4652; }
body[data-level='watch'] { --accent: var(--c-watch); --soft: rgba(210, 177, 255, 0.22); --deep: #3e1f72; }
body[data-level='protect'] { --accent: var(--c-protect); --soft: rgba(255, 166, 208, 0.28); --deep: #6e1544; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: 'Sora', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
a { color: var(--ink-3); }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px 20px 130px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Separación entre bloques del resultado (como en el diseño: 14 px). */
#screen { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Lugares (arriba) ---------- */
.places-bar {
  align-self: center;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--line);
  max-width: 100%;
  overflow-x: auto;
}
.places-bar button {
  white-space: nowrap;
  height: 34px;
  padding: 0 14px;
  border-radius: 99px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.3s, color 0.3s;
}
.places-bar button[aria-pressed='true'] { background: var(--ink); color: #000; }
.places-bar .more { width: 34px; padding: 0; color: var(--faint); font-size: 16px; }

/* ---------- Logo (auto bajo el domo, un estado por nivel) ---------- */
.hero { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 18px 0 22px; text-align: center; }
.shield { width: min(260px, 72vw); aspect-ratio: 1; margin: -8px 0 -18px; }
car-shield { display: block; width: 100%; height: 100%; }
.kicker { font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent); }
.level { margin: 0; font-size: 54px; line-height: 1; font-weight: 200; letter-spacing: -0.04em; }
.hail {
  margin: 2px 0 4px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.note {
  align-self: center;
  white-space: nowrap;
  font-size: 12px;
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--accent);
}
.hero-text { display: flex; flex-direction: column; gap: 6px; animation: rise 0.8s both; }
.title { margin: 0; font-size: 19px; line-height: 1.35; max-width: 300px; text-wrap: balance; animation: rise 0.8s 0.1s both; }

/* ---------- Tarjetas ---------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  animation: rise 0.8s 0.2s both;
}
.eyebrow { margin: 0; font-size: 11px; font-weight: 400; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dots { display: flex; gap: 5px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot-off); }
.dots i.on { background: var(--accent); }
.models { display: flex; gap: 10px; }
.model { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: var(--panel-2); }
.mini-orb { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.mini-orb.calm { background: radial-gradient(circle at 35% 30%, #fff, var(--c-calm) 60%); }
.mini-orb.storm { background: radial-gradient(circle at 35% 30%, #fff, var(--c-storm) 60%); }
.mini-orb.watch { background: radial-gradient(circle at 35% 30%, #fff, var(--c-watch) 60%); }
.mini-orb.protect { background: radial-gradient(circle at 35% 30%, #fff, var(--c-protect) 60%); }
.model .mono { display: block; font-size: 10px; color: var(--faint); }
.model .lvl { font-size: 13px; }
.notice { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-3); padding-top: 12px; border-top: 1px solid var(--line); }
.notice strong { color: #fff; font-weight: 600; }
.why p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); }

.hours { display: flex; justify-content: space-between; align-items: center; min-height: 36px; gap: 2px; }
.hour { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hour i { display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--dot-off); }
.hour.l1 i { width: 11px; height: 11px; background: var(--c-watch); box-shadow: 0 0 12px var(--c-watch); }
.hour.l2 i { width: 16px; height: 16px; background: var(--c-protect); box-shadow: 0 0 12px var(--c-protect); }
.hour span { font-size: 9px; color: var(--faint); opacity: 0.6; }
.hour.l1 span, .hour.l2 span { opacity: 1; }
.watch-text { margin: 0; font-size: 14px; }

.tech { padding: 0; gap: 0; background: transparent; animation-delay: 0.3s; }
.tech > button { width: 100%; display: flex; justify-content: space-between; padding: 16px 18px; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.tech-body { display: flex; flex-direction: column; gap: 12px; padding: 0 18px 18px; animation: rise 0.4s both; }
.tech-body .eyebrow { margin-top: 6px; }
.tech dl { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.algo-note { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-3); }
.algo-note strong { color: var(--ink); font-weight: 600; }
.rule { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: var(--panel-2); }
.rule-head { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.rule-head .thr { font-size: 10.5px; color: var(--faint); }
.rule-vals { display: flex; flex-wrap: wrap; gap: 6px; }
.val { font-size: 10.5px; padding: 4px 9px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--ink-2); }
.val b { font-weight: 500; }
.val.pass { border-color: var(--accent); }
.val.pass b { color: var(--accent); }
.val.fail { color: var(--faint); }
.tech dl div { display: flex; justify-content: space-between; gap: 10px; font-size: 10.5px; }
.tech dt { color: var(--faint); }
.tech dd { margin: 0; text-align: right; color: var(--ink-2); }
.fine { margin: 4px 0 0; text-align: center; font-size: 11px; line-height: 1.6; color: var(--faint); }
.fine.contact a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line-3); padding-bottom: 1px; }
.fine.contact a:hover { color: var(--ink); }

/* ---------- Confianza (compacta) ---------- */
.conf { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); animation: rise 0.8s 0.25s both; }
.conf-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.conf-label { font-weight: 500; }
.conf-models { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-2); font-size: 12px; }
.conf-model { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.conf-model .mini-orb { width: 10px; height: 10px; }
.conf-model .mono { font-size: 10px; color: var(--faint); }
.conf-reason { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.why .notice { padding-top: 10px; }

/* ---------- Instalar ---------- */
.install {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; border-radius: 24px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 13px;
}
.install:hover { color: var(--ink); border-color: var(--line-3); }
.modal {
  width: min(360px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-2); border-radius: 28px;
  background: var(--panel); color: var(--ink);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal[open] { animation: rise 0.4s both; }
.modal-body { display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.modal-logo { width: 56px; height: 56px; border-radius: 16px; overflow: hidden; background: var(--panel); border: 1px solid var(--line-2); margin-bottom: 6px; }
.modal h2 { margin: 0; font-size: 24px; font-weight: 300; letter-spacing: -0.02em; }
.modal p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.modal .modal-intro { color: var(--ink-2); }
.modal ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.modal .modal-note { font-size: 12.5px; }
.modal .cta { margin-top: 8px; height: 52px; font-size: 15px; }

/* ---------- Cargando y errores: el mismo logo, latiendo o apagado ---------- */
.loading { min-height: 70dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.loading p { margin: 0; font-size: 14px; color: var(--muted); }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
.error { min-height: 70dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; animation: rise 0.6s both; }
.error .shield { position: relative; width: min(220px, 60vw); margin: -8px 0 -24px; }
.error .shield.dim car-shield { filter: grayscale(1); opacity: 0.4; }
.error .badge {
  position: absolute; left: 50%; top: 14%; transform: translateX(-50%);
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line-2); font-size: 22px; font-weight: 300; color: var(--ink);
  animation: float 5s ease-in-out infinite;
}
.error h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 300; letter-spacing: -0.02em; max-width: 300px; }
.error p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); max-width: 290px; }

/* ---------- Lugares (pantalla) ---------- */
.places { display: flex; flex-direction: column; gap: 12px; animation: rise 0.5s both; }
.back { align-self: flex-start; border: 0; background: transparent; color: var(--muted); font-size: 14px; padding: 4px 0; }
.places h1 { margin: 4px 0 8px; font-size: 34px; font-weight: 200; letter-spacing: -0.03em; }
.place { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); }
.place .mini-orb { width: 36px; height: 36px; background: radial-gradient(circle at 35% 30%, #fff, #c7b4ff 50%, #3b2777); }
.place .info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.place .name { font-size: 15px; font-weight: 600; }
.place .addr { font-size: 12px; color: var(--faint); }
.place .tag { font-size: 11px; color: var(--muted); }
.place.off .mini-orb { opacity: 0.35; filter: grayscale(1); }
.place.off .name { color: var(--muted); }
.place .del { border: 0; background: transparent; color: var(--faint); font-size: 18px; width: 36px; height: 36px; border-radius: 50%; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-radius: 22px; border: 1px solid var(--line); font-size: 14px; }
.switch { position: relative; width: 50px; height: 30px; border-radius: 99px; border: 0; background: var(--line-2); transition: background 0.3s; flex: none; }
.switch[aria-checked='true'] { background: #c7b4ff; }
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff;
  transition: left 0.3s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.switch[aria-checked='true']::after { left: 22px; }
.add { height: 54px; border-radius: 99px; border: 1px dashed var(--line-3); background: transparent; font-size: 14px; }
.add-form { display: flex; gap: 8px; }
.add-form input { flex: 1; height: 50px; padding: 0 18px; border-radius: 99px; border: 1px solid var(--line-3); background: var(--panel); color: var(--ink); }
.status { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- Abajo: ventana / acciones ---------- */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 16px max(26px, env(safe-area-inset-bottom)); pointer-events: none; z-index: 6; }
.bottom > * { max-width: 408px; margin: 0 auto; pointer-events: auto; }
.when {
  position: relative; display: flex; padding: 5px; border-radius: 99px;
  background: rgba(30, 26, 38, 0.72); border: 1px solid var(--line-2);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.when .thumb {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 3);
  border-radius: 99px; background: var(--ink);
  transition: transform 0.5s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.when button { position: relative; flex: 1; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.15; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; transition: color 0.3s; }
.when button[aria-checked='true'] { color: #000; }
.when .day { font-size: 10px; font-weight: 400; letter-spacing: 0.02em; opacity: 0.75; }
.ctas { display: flex; flex-direction: column; gap: 8px; }
.cta { width: 100%; height: 58px; border-radius: 99px; border: 0; background: var(--ink); color: #000; font-size: 16px; font-weight: 600; }
.cta.secondary { height: 48px; border: 1px solid var(--line-2); background: #000; color: var(--ink); font-size: 15px; font-weight: 400; }

button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
