/* ─────────────────────────────────────────────────────────────
   Are You Dead? — web app
   Tema claro: fondo hueso, tarjetas blancas, un acento verde.
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --line: #e2e7ee;
  --line-soft: #eef1f5;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;

  --ok: #12a150;
  --ok-soft: #e9f9ef;
  --warn: #d97706;
  --warn-soft: #fef4e6;
  --danger: #dc2626;
  --danger-soft: #fdeceb;
  --accent: var(--ok);
  --accent-soft: var(--ok-soft);

  --radius: 18px;
  --radius-sm: 12px;
  --shell: 460px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow: 0 2px 6px rgba(16, 24, 40, .05), 0 12px 28px rgba(16, 24, 40, .07);
  color-scheme: light;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(90% 55% at 50% -8%, rgba(18, 161, 80, .07), transparent 62%),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.shell {
  min-height: 100dvh;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 16px 20px calc(18px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}
/* Sin esto, un hijo ancho (la fila de pestañas) estira toda la rejilla y la
   página entera se puede desplazar en horizontal. */
.shell > * { min-width: 0; }

/* ── Barra superior ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
  transition: background .4s ease, box-shadow .4s ease;
}

.icon-btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: color .2s, border-color .2s, transform .12s;
}
.icon-btn:hover { color: var(--ink); border-color: #cfd7e2; }
.icon-btn:active { transform: scale(.97); }

/* ── Pantallas ──────────────────────────────────────────────── */
.screen { display: block; animation: fade .32s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.display {
  font-size: clamp(32px, 8vw, 44px);
  line-height: 1.08;
  letter-spacing: -.03em;
  font-weight: 680;
  margin: 6px 0 16px;
}

.title {
  font-size: 24px;
  letter-spacing: -.02em;
  font-weight: 650;
  margin: 4px 0 18px;
}

.lede { color: var(--ink-2); margin: 0 0 18px; }
.lede strong { color: var(--ink); font-weight: 650; }

.bullets {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  color: var(--muted);
  font-size: 14.5px;
}
.bullets li { padding-left: 22px; position: relative; margin-bottom: 8px; }
.bullets li::before {
  content: "";
  position: absolute; left: 3px; top: .55em;
  width: 7px; height: 7px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
}

/* ── Onboarding ─────────────────────────────────────────────── */
.onboarding {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 18px;
  min-height: min(72dvh, 620px);
}

.slides {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 0 -20px;
  padding: 0 20px;
  gap: 20px;
}
.slides::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 6px;
}

.slide-art {
  width: min(230px, 62vw);
  aspect-ratio: 1;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
}
.slide-art svg { width: 100%; height: 100%; overflow: visible; }

.slide h2 {
  font-size: clamp(24px, 6.5vw, 30px);
  line-height: 1.15;
  letter-spacing: -.025em;
  font-weight: 680;
  margin: 0;
}

.slide p {
  color: var(--muted);
  font-size: 15.5px;
  margin: 10px 0 0;
  max-width: 34ch;
}

.slide p.legal-note {
  font-size: 12.5px;
  color: #98a2b3;
  margin-top: 16px;
  line-height: 1.5;
  max-width: 36ch;
}
.slide p.legal-note a { color: var(--muted); }

.footer-links { display: block; margin-top: 6px; }
.footer-links a { color: #98a2b3; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

.dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.dot-nav {
  width: 8px; height: 8px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: #d3dae3;
  cursor: pointer;
  transition: width .25s ease, background .25s ease;
}
.dot-nav.is-active { width: 22px; background: var(--accent); }

/* ── Formularios ────────────────────────────────────────────── */
.group {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 18px 8px;
  margin: 0 0 16px;
  box-shadow: var(--shadow-sm);
}
.group legend, .group-title {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 0 4px;
  margin: 0 0 4px;
}
.group-title { padding: 0; margin-bottom: 14px; }

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--ink);
}
.field em { font-style: normal; color: var(--muted); font-weight: 400; }

input, select {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  transition: border-color .18s, box-shadow .18s;
}
input::placeholder { color: #9aa4b2; }
input:focus, select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}
select { appearance: none; cursor: pointer; background-image: none; }

.field small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 6px;
  line-height: 1.5;
}

.error {
  color: var(--danger);
  font-size: 14px;
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin: 0 0 14px;
}

.hint { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }

/* ── Botones ────────────────────────────────────────────────── */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 6px; }

.btn {
  font: inherit;
  font-weight: 650;
  font-size: 15.5px;
  border-radius: 14px;
  padding: 14px 20px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, filter .18s, border-color .18s, color .18s, box-shadow .18s;
}
.btn:active { transform: scale(.985); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  flex: 1 1 auto;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 8px 18px color-mix(in srgb, var(--accent) 22%, transparent);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: #cfd7e2; color: var(--ink); }

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}
.btn-danger:hover { background: var(--danger-soft); }

.btn-small { font-size: 14px; padding: 10px 15px; flex: 0 0 auto; border-radius: 11px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }

.link {
  background: none; border: 0; padding: 0;
  font: inherit; font-size: inherit; font-weight: 600;
  color: var(--accent); cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Pantalla principal: el botón ───────────────────────────── */
.screen-main {
  display: grid;
  grid-auto-rows: min-content;
  justify-items: center;
  align-content: center;
  gap: 20px;
  text-align: center;
}

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.status-pill {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  padding: 7px 15px;
  border-radius: 999px;
  transition: color .4s, border-color .4s, background .4s;
}

.streak-pill {
  margin: 0;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 7px 15px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.alert-banner {
  margin: 0;
  width: 100%;
  font-size: 13.5px;
  line-height: 1.5;
  color: #8a4b00;
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 24%, transparent);
  border-radius: 14px;
  padding: 12px 14px;
}
/* El mismo banner, en rojo: alguien ha declarado tu fallecimiento. */
.alert-banner.is-legacy {
  color: #8f1d1d;
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 26%, transparent);
  font-weight: 600;
}

.alive {
  --progress: 1;
  position: relative;
  width: min(272px, 74vw);
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .16s cubic-bezier(.2, .8, .3, 1);
  -webkit-tap-highlight-color: transparent;
}
.alive:active { transform: scale(.96); }
.alive[disabled] { cursor: progress; }

.alive-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--progress) * 360deg), #e6eaf0 0);
  -webkit-mask: radial-gradient(circle, transparent 0 calc(50% - 10px), #000 calc(50% - 10px));
          mask: radial-gradient(circle, transparent 0 calc(50% - 10px), #000 calc(50% - 10px));
  transition: background .8s linear;
}

.alive-face {
  position: relative;
  width: calc(100% - 36px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  align-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow:
    0 10px 30px color-mix(in srgb, var(--accent) 14%, transparent),
    0 2px 6px rgba(16, 24, 40, .06);
  transition: background .5s, border-color .5s, box-shadow .5s;
}

.alive-label { font-size: 25px; font-weight: 680; letter-spacing: -.02em; color: var(--ink); }
.alive-sub { font-size: 13.5px; color: var(--muted); }

.alive.is-done .alive-face { background: var(--accent-soft); }
.alive.is-done .alive-label { color: color-mix(in srgb, var(--accent) 85%, #000); }
.alive.is-pulse .alive-face { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 12%, transparent); }
  50%      { box-shadow: 0 10px 42px color-mix(in srgb, var(--accent) 34%, transparent); }
}

.readout { display: grid; gap: 4px; }
.countdown {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  font-weight: 600;
  color: var(--ink);
}
.countdown-label, .meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.meta { margin-top: 10px; }

.paused-note {
  margin: 0;
  font-size: 13.5px;
  color: #8a4b00;
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 24%, transparent);
  border-radius: 14px;
  padding: 12px 14px;
}
.paused-note .link { color: #8a4b00; }

/* ── Código de recuperación ─────────────────────────────────── */
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(24px, 7.5vw, 34px);
  font-weight: 600;
  letter-spacing: .1em;
  text-align: center;
  background: var(--surface);
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: var(--radius);
  padding: 22px 10px;
  margin: 0 0 6px;
  user-select: all;
}

/* ── Pestañas de ajustes ────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.tab-panel { animation: fade .25s ease both; }

/* ── Casillas ───────────────────────────────────────────────── */
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  color: var(--ink-2);
  margin: 0 0 16px;
  cursor: pointer;
}
.check input {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Listas ─────────────────────────────────────────────────── */
.contacts, .history { list-style: none; margin: 0 0 14px; padding: 0; }

.contacts li, .history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 0;
  font-size: 14px;
}
.contacts li:last-child, .history li:last-child { border-bottom: 0; }
.contacts .who { display: grid; text-align: left; min-width: 0; }
.contacts .who b { font-weight: 650; }
.contacts .who span {
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contacts .tools { display: flex; gap: 6px; flex: 0 0 auto; align-items: center; }
.contacts .tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 999px;
  padding: 3px 9px;
}
.contacts .badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--ok);
  background: var(--ok-soft);
  border-radius: 999px;
  padding: 3px 9px;
}
.contacts li.contact { display: block; }
.contact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.contact-channels {
  margin-top: 12px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 14px;
  display: grid;
  gap: 4px;
  animation: rise .28s cubic-bezier(.2, .8, .3, 1) both;
}
.contact-channels .check { margin-bottom: 6px; }
.contact-channels .field { margin-bottom: 10px; }
.contact-channels .tg {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--muted);
}
.contact-channels .tg-on { color: var(--ok); font-weight: 650; }
.contact-channels .qr {
  width: 100%;
  max-width: 240px;
  margin: 12px auto 4px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 8px;
  animation: pop .3s cubic-bezier(.2, .9, .25, 1) both;
}

.contacts .level {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 7px;
  width: auto;
}

.history li { color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }

.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 10px; }
.inline-form input { font-size: 14px; padding: 11px; }
@media (max-width: 440px) {
  .inline-form { grid-template-columns: 1fr; }
}

.danger-zone { border-color: color-mix(in srgb, var(--danger) 20%, var(--line)); }

/* ── Elegir papel ───────────────────────────────────────────── */
.role-card {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, border-color .18s, box-shadow .18s;
  animation: rise .4s cubic-bezier(.2, .8, .3, 1) both;
}
.role-card:nth-of-type(2) { animation-delay: .07s; }
.role-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.role-card:active { transform: scale(.99); }
.role-card b { display: block; font-size: 19px; letter-spacing: -.015em; margin-bottom: 6px; }
.role-card span { color: var(--muted); font-size: 14.5px; line-height: 1.5; }

/* ── Personas que cuido ─────────────────────────────────────── */
#self-block { display: contents; }

.watched {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  animation: row-in .35s cubic-bezier(.2, .8, .3, 1) both;
}
.watched .ring {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.watched .ring i { width: 14px; height: 14px; border-radius: 50%; display: block; }
.watched .info { flex: 1; min-width: 0; }
.watched .info b { display: block; font-size: 16px; }
.watched .info span { display: block; font-size: 13px; color: var(--muted); }
.watched .tools { display: flex; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }

.watch-summary {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
}
.watch-summary.bad {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.invite-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: clamp(24px, 8vw, 32px);
  letter-spacing: .16em;
  font-weight: 600;
  text-align: center;
  background: var(--surface-2);
  border-radius: 14px;
  padding: 18px 10px;
  margin: 14px 0 8px;
  animation: pop .35s cubic-bezier(.2, .9, .25, 1) both;
}
.invite-qr {
  display: block;
  margin: 12px auto;
  width: 100%;
  max-width: 230px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 8px;
}

/* ── Círculos ───────────────────────────────────────────────── */
.circle {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 15px;
  margin-bottom: 12px;
}
.circle h4 { margin: 0 0 2px; font-size: 15.5px; font-weight: 650; }
.circle .code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .1em;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: left;
}
.circle ul { list-style: none; margin: 12px 0 0; padding: 0; }
.circle li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.circle .dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block; margin-right: 9px; flex: 0 0 auto;
}
.circle .when { color: var(--muted); font-size: 12.5px; }

/* ── Pie y avisos ───────────────────────────────────────────── */
.footer {
  text-align: center;
  font-size: 12px;
  color: #98a2b3;
  padding-top: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 13px 18px;
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(16, 24, 40, .22);
  max-width: min(420px, calc(100vw - 40px));
  text-align: center;
  animation: toast-in .28s cubic-bezier(.2, .9, .3, 1) both;
  z-index: 50;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ── Movimiento ─────────────────────────────────────────────── */

/* Entrada de pantalla */
.screen { animation: screen-in .4s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(12px) scale(.99); }
}

/* El dibujo del slide activo entra con un pequeño rebote */
.slide.is-current .slide-art svg { animation: art-in .65s cubic-bezier(.2, .9, .25, 1) both; }
@keyframes art-in {
  from { opacity: 0; transform: scale(.86) translateY(12px); }
  60%  { opacity: 1; transform: scale(1.03) translateY(0); }
  to   { opacity: 1; transform: scale(1); }
}

/* Los trazos marcados se dibujan solos cada vez que se llega al slide */
.slide.is-current .draw {
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: draw 1.3s .25s cubic-bezier(.3, .8, .3, 1) forwards;
}
.slide.is-current .draw-short {
  stroke-dasharray: 95;
  stroke-dashoffset: 95;
  animation: draw .6s .35s cubic-bezier(.3, .9, .3, 1) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Título y texto del slide, escalonados */
.slide.is-current h2 { animation: rise .5s .1s cubic-bezier(.2, .8, .3, 1) both; }
.slide.is-current p  { animation: rise .5s .2s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
}

.onboarding-actions {
  display: grid;
  gap: 10px;
  animation: rise .5s .28s cubic-bezier(.2, .8, .3, 1) both;
}
.onboarding-actions .btn { width: 100%; }

/* Botones: se levantan un pelín al pasar por encima */
.btn-primary:hover, .icon-btn:hover { transform: translateY(-1px); }

/* Confirmación: la cara del botón da un salto y sale una onda */
.alive::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}
.alive.is-success::after { animation: ripple .85s cubic-bezier(.2, .8, .3, 1); }
@keyframes ripple {
  0%   { opacity: .6; transform: scale(.92); }
  100% { opacity: 0;  transform: scale(1.22); }
}
.alive.is-success .alive-face { animation: success-pop .6s cubic-bezier(.2, .9, .3, 1); }
@keyframes success-pop {
  0%   { transform: scale(1); }
  38%  { transform: scale(1.055); }
  100% { transform: scale(1); }
}

/* La racha aparece con un pop */
.streak-pill { animation: pop .45s cubic-bezier(.2, .9, .25, 1) both; }
@keyframes pop {
  from { opacity: 0; transform: scale(.9); }
  60%  { transform: scale(1.04); }
  to   { opacity: 1; transform: scale(1); }
}

/* Banner de aviso: entra deslizando */
.alert-banner, .paused-note { animation: rise .4s cubic-bezier(.2, .8, .3, 1) both; }

/* Filas de listas, escalonadas */
.contacts li, .circle li, .history li { animation: row-in .35s cubic-bezier(.2, .8, .3, 1) both; }
.contacts li:nth-child(2), .circle li:nth-child(2), .history li:nth-child(2) { animation-delay: .04s; }
.contacts li:nth-child(3), .circle li:nth-child(3), .history li:nth-child(3) { animation-delay: .08s; }
.contacts li:nth-child(n+4), .circle li:nth-child(n+4), .history li:nth-child(n+4) { animation-delay: .12s; }
@keyframes row-in {
  from { opacity: 0; transform: translateX(-6px); }
}

/* Tarjetas de ajustes al cambiar de pestaña */
.tab-panel .group { animation: rise .4s cubic-bezier(.2, .8, .3, 1) both; }
.tab-panel .group:nth-child(2) { animation-delay: .06s; }
.tab-panel .group:nth-child(3) { animation-delay: .12s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Todo Bien Plus y legado ────────────────────────────────── */

.plan-card { position: relative; }
.plan-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
}
.plan-badge.is-plus {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 22%, transparent);
}

.plan-list { list-style: none; margin: 0 0 4px; padding: 0; }
.plan-list li {
  position: relative;
  padding: 9px 0 9px 28px;
  font-size: 14.5px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-soft);
}
.plan-list li:last-child { border-bottom: 0; }
.plan-list li::before {
  content: '✓';
  position: absolute;
  left: 4px;
  top: 8px;
  font-weight: 700;
  color: var(--ok);
}
.plan-list li.is-off { color: var(--muted); }
.plan-list li.is-off::before { content: '·'; color: var(--muted); font-size: 20px; top: 3px; }

.plan-price {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink);
  margin: 2px 0 12px;
}
.plan-price small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 8px; }

/* Un aviso destacado dentro de una tarjeta (fallecimiento declarado) */
.group.notice {
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  background: var(--warn-soft);
}
.group.notice .group-title { color: var(--warn); }

textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  resize: vertical;
  transition: border-color .18s, box-shadow .18s;
}
textarea::placeholder { color: #9aa4b2; }
textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}

.stacked-form { display: grid; gap: 10px; margin-bottom: 6px; }
.stacked-form .inline-form { margin: 0; }

/* Contacto que aún no ha confirmado que le llegan los avisos */
.warn-mark {
  display: block;
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 3px;
}

/* ── Pedir ayuda ────────────────────────────────────────────── */

.help-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: 22px;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  color: var(--danger);
  background: var(--surface);
  border: 1.5px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 14px;
  padding: 15px 18px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color .2s, transform .12s;
}
.help-btn:active { transform: scale(.99); }
.help-btn.is-holding { border-color: var(--danger); }

/* La barra que se llena mientras se mantiene pulsado */
.help-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--danger-soft);
  pointer-events: none;
}
.help-btn.is-holding .help-fill { width: 100%; transition: width 2.5s linear; }

.help-label { position: relative; }

/* Aviso de ayuda en marcha */
.alert-banner.is-help {
  color: #8f1d1d;
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  font-weight: 600;
}
