/* GymOrbita — sistema de diseño
   Tipografía: Inter, 4 tamaños (12 / 15 / 20 / 28) y 2 pesos (500 / 700); Sora solo para la marca
   Espaciado: rejilla de 4/8 px
   Color 60/30/10: azul noche #0B0F1A · lavanda #E0E7FF · degradado azul #3B82F6 → violeta #A855F7 para acción e indicadores */

:root {
  --bg: #0b0f1a;
  --surface: #11162e;
  --surface-2: #19203f;
  --navy: #1e2a5b;
  --line: rgb(224 231 255 / 0.08);
  --text: #eef1ff;
  --text-2: rgb(224 231 255 / 0.72);
  --text-3: rgb(224 231 255 / 0.5);
  --blue: #3b82f6;
  --violet: #a855f7;
  --accent: #7c8cff;
  --accent-ink: #ffffff;
  --grad: linear-gradient(90deg, #3b82f6, #a855f7);
  --accent-soft: rgb(99 102 241 / 0.16);
  --accent-line: rgb(139 124 255 / 0.5);
  --danger: #ff5a7a;
  --danger-soft: rgb(255 90 122 / 0.12);
  --gold: #ffc94d;

  --fs-sm: 12px;
  --fs-md: 15px;
  --fs-lg: 20px;
  --fs-xl: 28px;
  --fw: 500;
  --fw-bold: 700;

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --shadow: 0 8px 24px rgb(0 0 0 / 0.35);
  --glow: 0 8px 24px rgb(124 58 237 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.25);
  --tabbar-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-md);
  font-weight: var(--fw);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.has-tabbar main { padding-bottom: calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }
body.has-cta main { padding-bottom: calc(var(--tabbar-h) + 104px + env(safe-area-inset-bottom)); }
body.has-cta:not(.has-tabbar) main { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.bold { font-weight: var(--fw-bold); }
.accent { color: var(--accent); }

/* ---------- iconos ---------- */
.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 24px; height: 24px; }

/* ---------- cabecera ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px; min-height: 56px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  background: rgb(11 15 26 / 0.82);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  margin: 0; flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: var(--fw-bold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px;
  border-radius: 50%; background: none; color: var(--text); padding: 0;
}
.icon-btn:active { background: var(--surface-2); }

main { max-width: 560px; margin: 0 auto; padding: 16px; }

/* ---------- secciones ---------- */
.section { margin-top: 32px; }
.section:first-child { margin-top: 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-title { margin: 0; font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.section-link { color: var(--accent); text-decoration: none; font-size: var(--fs-md); }
.hint { margin: -4px 0 16px; color: var(--text-2); }

/* ---------- tarjetas y listas ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  color: inherit; text-decoration: none; text-align: left; font: inherit;
  justify-content: flex-start; white-space: normal; min-height: 0;
}
a.card:active, button.card:active { background: var(--surface-2); }
.card .grow { flex: 1; min-width: 0; }
.card .title { font-weight: var(--fw-bold); }
.card .meta { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; }
.card .chev { color: var(--text-3); }
.card.selected { border-color: var(--accent-line); background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface); }
.card.dashed { border-style: dashed; border-color: rgb(255 255 255 / 0.16); background: transparent; }
.panel { padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.panel > * + * { margin-top: 12px; }

.tile-icon {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2);
}
.tile-icon.accent { background: var(--accent-soft); color: var(--accent); }

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 32px 16px; border-radius: var(--r-md); border: 1px dashed rgb(255 255 255 / 0.12);
  color: var(--text-2);
}
.empty .icon { width: 32px; height: 32px; color: var(--text-3); }
.empty .title { color: var(--text); font-weight: var(--fw-bold); }
.empty .button { margin-top: 8px; }

/* ---------- botones ---------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--r-sm);
  font: inherit; font-weight: var(--fw-bold); text-decoration: none; white-space: nowrap; cursor: pointer;
  background: var(--surface-2); color: var(--text);
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
button:active, .button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; pointer-events: none; }
.primary { background: var(--grad); color: var(--accent-ink); box-shadow: var(--glow); }
.ghost { background: transparent; color: var(--text-2); }
.danger { background: var(--danger-soft); color: var(--danger); }
.block { display: flex; width: 100%; min-height: 52px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; }
.row.wrap { flex-wrap: wrap; }

/* CTA fija en la zona del pulgar */
.cta-bar {
  position: fixed; left: 0; right: 0; z-index: 9;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 16px; background: linear-gradient(transparent, var(--bg) 40%);
}
body:not(.has-tabbar) .cta-bar { bottom: 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.cta-bar > * { max-width: 528px; margin: 0 auto; }

/* ---------- barra de pestañas ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgb(11 15 26 / 0.9);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar[hidden] { display: none; }
.tabbar a {
  flex: 1; max-width: 112px; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--text-3); text-decoration: none; font-size: var(--fs-sm);
}
.tabbar a.on { color: var(--accent); }
.tabbar a .icon { width: 24px; height: 24px; }

/* ---------- formularios ---------- */
input, select {
  width: 100%; min-width: 0; min-height: 48px; padding: 0 16px;
  font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-sm); outline: none;
}
input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
input::placeholder { color: var(--text-3); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); }
.inline { display: flex; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.search { position: relative; }
.search .icon { position: absolute; left: 16px; top: 14px; color: var(--text-3); pointer-events: none; }
.search input { padding-left: 48px; }

/* ---------- chips y selectores ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 12px -16px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-bold); text-decoration: none; white-space: nowrap;
}
.chip.on { background: var(--grad); border-color: transparent; color: var(--accent-ink); }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap;
}
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.gold { background: rgb(255 201 77 / 0.14); color: var(--gold); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--r-sm); background: var(--surface-2); }
.segmented button { min-height: 36px; padding: 0 8px; background: transparent; color: var(--text-2); font-size: var(--fs-sm); border-radius: 8px; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.day-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-picker button { min-height: 44px; padding: 0; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); color: var(--text-2); }
.day-picker button.on { background: var(--grad); border-color: transparent; color: var(--accent-ink); box-shadow: var(--glow); }

.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option {
  flex-direction: column; align-items: flex-start; gap: 8px; min-height: 88px; padding: 16px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-align: left; white-space: normal;
}
.option .icon { color: var(--text-2); }
.option.on { border-color: var(--accent-line); background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface); }
.option.on .icon { color: var(--accent); }

/* ---------- avatar ---------- */
.avatar {
  display: grid; place-items: center; flex: none; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); color: var(--text); font-weight: var(--fw-bold);
}

/* ---------- inicio ---------- */
.greeting { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.greeting .hello { font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: 1.15; }
.greeting .where { display: flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--text-2); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week button {
  flex-direction: column; gap: 4px; min-height: 64px; padding: 8px 0;
  border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
}
.week .d { font-size: var(--fs-sm); }
.week .n { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text); }
.week .dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.week button.has .dot { background: var(--grad); }
.week button.done .dot { background: var(--text); }
.week button.today { border-color: var(--accent-line); }
.week button.sel { background: var(--grad); border-color: transparent; color: var(--accent-ink); }
.week button.sel .n { color: var(--accent-ink); }
.week button.sel .dot { background: var(--accent-ink); }

.hero-card {
  position: relative; overflow: hidden; padding: 24px; border-radius: var(--r-lg);
  background: radial-gradient(120% 80% at 100% 0%, rgb(124 92 255 / 0.28), transparent 60%), var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.hero-card .eyebrow { color: var(--accent); font-size: var(--fs-sm); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.08em; }
.hero-card .big { margin: 8px 0 4px; font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: 1.15; }
.hero-card .thumbs { display: flex; margin: 16px 0 24px; }
.hero-card .thumbs img, .hero-card .thumbs .more {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #fff;
  border: 2px solid var(--surface); margin-left: -8px;
}
.hero-card .thumbs :first-child { margin-left: 0; }
.hero-card .thumbs .more { display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); }
.hero-card + .hero-card { margin-top: 8px; }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--r-md);
  background: var(--grad); color: var(--accent-ink); text-decoration: none; box-shadow: var(--glow);
}
.banner .grow { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats.two { grid-template-columns: 1fr 1fr; }
.stat { padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.stat .v { font-size: var(--fs-lg); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .k { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }

/* ---------- imágenes de ejercicios ---------- */
.thumb { width: 56px; height: 56px; flex: none; border-radius: var(--r-sm); object-fit: cover; background: #fff; }
.thumb.ph { display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.demo { position: relative; aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--r-md); background: #fff; }
.demo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.demo img:nth-child(2) { animation: demo-swap 2.4s steps(1, end) infinite; }
@keyframes demo-swap { 0% { opacity: 0; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .demo img:nth-child(2) { animation: none; opacity: 0; } }

/* ---------- plantillas ---------- */
.template { overflow: hidden; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.template .strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; background: #fff; }
.template .strip img, .template .strip .ph { width: 100%; aspect-ratio: 1; object-fit: cover; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.template .body { padding: 16px; }
.template .body > * + * { margin-top: 12px; }
.ex-list { list-style: none; margin: 0; padding: 0; }
.ex-list li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); color: var(--text-2); }
.ex-list li span:last-child { color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- catálogo ---------- */
.catalog { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 480px) { .catalog { grid-template-columns: repeat(3, 1fr); } }
.cat-card {
  position: relative; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px;
  min-height: 0; padding: 0 0 12px; overflow: hidden; white-space: normal; text-align: left;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
}
.cat-card img, .cat-card .ph { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: #fff; display: grid; place-items: center; }
.cat-card .ph { background: var(--surface-2); color: var(--text-3); }
.cat-card .t { padding: 8px 12px 0; line-height: 1.3; }
.cat-card .m { padding: 0 12px; color: var(--text-3); font-size: var(--fs-sm); font-weight: var(--fw); }
.cat-card .tag { position: absolute; top: 8px; left: 8px; }

/* ---------- panel inferior ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; background: rgb(0 0 0 / 0.6); }
.sheet-backdrop[hidden] { display: none; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
  border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--bg); border-top: 1px solid var(--line);
  animation: sheet-up 0.22s ease-out;
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto 16px; border-radius: 4px; background: var(--surface-2); }
.sheet > * + * { margin-top: 16px; }
@keyframes sheet-up { from { transform: translateY(48px); opacity: 0; } }

/* ---------- entreno ---------- */
.progress { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; border-radius: 8px; background: var(--grad); transition: width 0.3s ease; }
.exercise { padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.exercise + .exercise { margin-top: 12px; }
.exercise.complete { border-color: var(--accent-line); }
.exercise .demo { aspect-ratio: auto; height: 160px; margin-bottom: 16px; }
.exercise .demo img { object-fit: cover; }
.exercise .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.exercise .head .title { font-size: var(--fs-lg); font-weight: var(--fw-bold); line-height: 1.25; }
.sets { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sets li { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 4px 0 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.sets .n { width: 24px; color: var(--text-3); font-size: var(--fs-sm); }
.sets .v { flex: 1; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.sets button { min-height: 36px; width: 36px; padding: 0; background: none; color: var(--text-3); }
.log { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.log button { min-height: 48px; }

/* ---------- resumen / celebración ---------- */
.celebrate { position: relative; text-align: center; padding: 32px 16px 24px; }
.celebrate .badge {
  display: grid; place-items: center; width: 96px; height: 96px; margin: 0 auto 24px; border-radius: 50%;
  background: var(--grad); color: var(--accent-ink);
  box-shadow: 0 0 0 12px var(--accent-soft), 0 16px 48px rgb(124 58 237 / 0.45);
  animation: pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.celebrate .badge .icon { width: 48px; height: 48px; stroke-width: 2.5; }
.celebrate h2 { margin: 0; font-size: var(--fs-xl); font-weight: var(--fw-bold); }
.celebrate p { margin: 8px 0 0; color: var(--text-2); }
.spark { position: absolute; width: 8px; height: 8px; border-radius: 2px; opacity: 0; animation: spark 1.4s ease-out forwards; }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } }
@keyframes spark {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(240deg); }
}
@media (prefers-reduced-motion: reduce) { .celebrate .badge, .spark { animation: none; } .spark { display: none; } }
.record {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--r-md);
  background: linear-gradient(rgb(255 201 77 / 0.1), rgb(255 201 77 / 0.1)), var(--surface); border: 1px solid rgb(255 201 77 / 0.3);
}
.record .tile-icon { background: rgb(255 201 77 / 0.16); color: var(--gold); }

/* ---------- gráficas ---------- */
.chart { display: block; width: 100%; height: auto; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .area { fill: url(#chart-fill); }
.chart .dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.chart .grid { stroke: var(--line); }
.chart text { fill: var(--text-3); font-size: 11px; font-family: inherit; }

/* ---------- login ---------- */
.login { display: flex; flex-direction: column; min-height: calc(100vh - 120px); padding-top: 48px; }
.login .logo {
  width: 96px; height: 96px; margin: 0 auto; border-radius: 28px;
  box-shadow: 0 0 0 1px var(--line), 0 16px 64px rgb(124 58 237 / 0.35);
}
.login h2 { margin: 32px 0 8px; text-align: center; font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: 1.15; }
.login p { margin: 0 auto; max-width: 320px; text-align: center; color: var(--text-2); }
.login .actions { margin-top: auto; padding-top: 48px; display: flex; flex-direction: column; gap: 8px; }
.provider {
  position: relative; min-height: 44px; font-size: var(--fs-md);
  background: var(--surface); color: var(--text); border: 1px solid rgb(255 255 255 / 0.12);
}
.provider:active { background: var(--surface-2); }
.provider .brand { position: absolute; left: 16px; width: 18px; height: 18px; color: var(--text); }
.dev-login { margin-top: 16px; }

/* ---------- avisos ---------- */
#toast {
  position: fixed; left: 50%; z-index: 40;
  bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-weight: var(--fw-bold); box-shadow: var(--shadow);
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

details summary { cursor: pointer; color: var(--text-2); padding: 8px 0; }
.credit { margin-top: 24px; text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
.skeleton { height: 72px; border-radius: var(--r-md); background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- login (plantilla GymOrbita) ---------- */
body.bare .topbar { display: none; }
body.bare main { padding-top: 0; }
.auth { display: flex; flex-direction: column; gap: 16px; padding-bottom: 32px; }

.space {
  position: relative; height: 320px; margin: 0 -16px; overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 100%, rgb(59 130 246 / 0.35), transparent 70%),
    radial-gradient(80% 60% at 50% 30%, rgb(30 42 91 / 0.6), transparent 70%),
    var(--bg);
}
.space::after {
  content: ""; z-index: 4; position: absolute; left: 0; right: 0; bottom: 0; height: 140px;
  background: linear-gradient(transparent, var(--bg));
}
.space .stars {
  position: absolute; inset: 0; opacity: 0.8;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 28% 42%, #cdd6ff, transparent),
    radial-gradient(1px 1px at 44% 12%, #fff, transparent), radial-gradient(1.5px 1.5px at 66% 28%, #cdd6ff, transparent),
    radial-gradient(1px 1px at 78% 56%, #fff, transparent), radial-gradient(1px 1px at 88% 20%, #fff, transparent),
    radial-gradient(1px 1px at 8% 60%, #cdd6ff, transparent), radial-gradient(1.5px 1.5px at 56% 64%, #fff, transparent),
    radial-gradient(1px 1px at 36% 74%, #fff, transparent), radial-gradient(1px 1px at 92% 70%, #cdd6ff, transparent);
}
/* Luna con la media luna izquierda iluminada (el lado que mira al cohete) */
.space .moon {
  position: absolute; top: 40px; right: -24px; width: 104px; height: 104px; border-radius: 50%; overflow: hidden;
  background:
    radial-gradient(circle at 30% 40%, rgb(255 255 255 / 0.25) 0 6%, transparent 7%),
    radial-gradient(circle at 22% 66%, rgb(30 42 91 / 0.5) 0 7%, transparent 8%),
    linear-gradient(90deg, #dbe2ff, #a5b4fc 22%, #6366f1 42%, #1e2a5b 62%, #0d1330);
  box-shadow: -6px 0 24px rgb(165 180 252 / 0.45), -2px 0 6px rgb(219 226 255 / 0.5);
}
/* Sombra: un disco oscuro desplazado a la derecha deja solo la media luna izquierda */
.space .moon::after {
  content: ""; position: absolute; inset: -4px -4px -4px 30%; border-radius: 50%;
  background: radial-gradient(circle at 40% 50%, #0b0f1a, #10173a 70%, rgb(16 23 58 / 0.6));
  box-shadow: -10px 0 18px rgb(11 15 26 / 0.85);
}
/* Aterrizaje: el cohete baja frenando, se posa en el horizonte (a 200px de la parte de arriba) y se queda quieto.
   Las animaciones arrancan cuando la escena tiene la clase .go */
.space .launch {
  position: absolute; z-index: 1; left: 50%; top: 70px; width: 80px; height: 280px; margin-left: -40px;
  transform: translateY(-460px) scale(0.75);
}
/* Secuencia: aterriza (0-4 s), espera a que lleguen los iconos al logo y despega disparado (6,2 s) */
.space.go .launch { animation: land 4s linear forwards, blastoff 1.1s cubic-bezier(0.55, 0, 0.9, 0.35) 6.2s forwards; }
@keyframes blastoff {
  0% { transform: translateY(0) scale(1); }
  14% { transform: translateY(5px) scale(1.04, 0.95); }
  100% { transform: translateY(-600px) scale(0.78); }
}
@keyframes land {
  0% { transform: translateY(-460px) scale(0.75); animation-timing-function: ease-out; }
  35% { transform: translateY(-190px) scale(0.88); animation-timing-function: ease-out; }
  62% { transform: translateY(-60px) scale(0.96); animation-timing-function: ease-out; }
  82% { transform: translateY(-6px) scale(1); animation-timing-function: ease-in; }
  90% { transform: translateY(3px) scale(1.03, 0.96); animation-timing-function: ease-out; }
  100% { transform: translateY(0) scale(1); }
}
.space .rocket {
  position: relative; display: block; width: 80px; height: 280px; overflow: visible;
  filter: drop-shadow(0 0 14px rgb(168 85 247 / 0.45));
}
.space .thrust { transform-box: view-box; transform-origin: 60px 197px; }
.space.go .thrust { animation: thrust 4s ease-in forwards, reignite 0.5s ease-out 5.95s forwards; }
@keyframes reignite {
  0% { transform: scale(0, 0); opacity: 0; }
  60% { transform: scale(1.25, 1.35); opacity: 1; }
  100% { transform: scale(1.15, 1.3); opacity: 1; }
}
@keyframes thrust {
  0%, 70% { transform: scale(1); opacity: 1; }
  86% { transform: scale(0.45, 0.3); opacity: 0.8; }
  94%, 100% { transform: scale(0, 0); opacity: 0; }
}
.space .flame { transform-box: view-box; transform-origin: 60px 197px; }
.space .f1 { animation: flicker 0.22s ease-in-out infinite alternate; }
.space .f2 { animation: flicker 0.16s ease-in-out infinite alternate-reverse; }
.space .f3 { animation: flicker 0.11s ease-in-out infinite alternate; }
@keyframes flicker {
  from { transform: scale(0.92, 0.86); opacity: 0.85; }
  to { transform: scale(1.06, 1.12); opacity: 1; }
}
/* Chispas del fuego de frenado (se apagan al aterrizar) */
.space .sparks { position: absolute; left: 50%; top: 150px; }
.space.go .sparks { animation: sparks-off 4s linear forwards, sparks-on 0.2s linear 6s forwards; }
@keyframes sparks-on { to { opacity: 1; } }
/* Estela al despegar */
.space .trail {
  position: absolute; left: 50%; top: 196px; width: 20px; height: 560px; margin-left: -10px;
  border-radius: 10px; filter: blur(8px); opacity: 0; transform-origin: 50% 0;
  background: linear-gradient(rgb(233 213 255 / 0.95), rgb(168 85 247 / 0.6) 25%, rgb(59 130 246 / 0.25) 60%, transparent);
}
.space.go .trail { animation: trail 1.2s ease-out 6.15s forwards; }
@keyframes trail { 0% { opacity: 0; transform: scaleY(0.1); } 30% { opacity: 1; } 100% { opacity: 1; transform: scaleY(1); } }
@keyframes sparks-off { 0%, 80% { opacity: 1; } 92%, 100% { opacity: 0; } }
.space .sparks i {
  position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #e9d5ff;
  box-shadow: 0 0 6px #a855f7; opacity: 0; animation: spark-fall 0.9s linear infinite;
}
.space .sparks i:nth-child(1) { --sx: -14px; animation-delay: 0s; }
.space .sparks i:nth-child(2) { --sx: 10px; animation-delay: 0.1s; }
.space .sparks i:nth-child(3) { --sx: -6px; animation-delay: 0.2s; }
.space .sparks i:nth-child(4) { --sx: 16px; animation-delay: 0.3s; }
.space .sparks i:nth-child(5) { --sx: -18px; animation-delay: 0.4s; }
.space .sparks i:nth-child(6) { --sx: 4px; animation-delay: 0.5s; }
.space .sparks i:nth-child(7) { --sx: -10px; animation-delay: 0.6s; }
.space .sparks i:nth-child(8) { --sx: 12px; animation-delay: 0.7s; }
.space .sparks i:nth-child(9) { --sx: -2px; animation-delay: 0.75s; }
.space .sparks i:nth-child(10) { --sx: 20px; animation-delay: 0.85s; }
@keyframes spark-fall {
  0% { opacity: 1; transform: translate(0, 0); }
  100% { opacity: 0; transform: translate(var(--sx), 110px); }
}
/* Impacto al tocar el suelo (~3,4 s): fogonazo, ondas expansivas, haz de luz, polvo y resplandor general */
.space .flare {
  position: absolute; z-index: 3; left: 50%; top: 130px; width: 560px; height: 150px; margin-left: -280px;
  border-radius: 50%; mix-blend-mode: screen; opacity: 0;
  background: radial-gradient(closest-side, #fff, rgb(255 255 255 / 0.95) 12%, rgb(233 213 255 / 0.8) 28%, rgb(168 85 247 / 0.5) 55%, transparent);
}
.space.go .flare { animation: flare 5s ease-out forwards; }
@keyframes flare {
  0%, 64% { opacity: 0; transform: scale(0.2, 0.3); }
  69% { opacity: 1; transform: scale(1.05, 1.1); }
  100% { opacity: 0; transform: scale(1.6, 1.2); }
}
.space .shock {
  position: absolute; z-index: 3; left: 50%; top: 192px; width: 60px; height: 16px; margin-left: -30px;
  border-radius: 50%; border: 2px solid rgb(233 213 255 / 0.95); opacity: 0;
  box-shadow: 0 0 12px rgb(196 181 253 / 0.9), inset 0 0 8px rgb(168 85 247 / 0.7);
}
.space.go .shock { animation: shock 4.6s cubic-bezier(0.1, 0.6, 0.3, 1) forwards; }
.space.go .s2 { animation-delay: 0.18s; }
@keyframes shock {
  0%, 73% { opacity: 0; transform: scale(0.3); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(9, 4); }
}
.space .beam {
  position: absolute; z-index: 3; left: 50%; top: -20px; width: 120px; height: 230px; margin-left: -60px;
  mix-blend-mode: screen; opacity: 0; transform-origin: 50% 100%;
  background: radial-gradient(50% 100% at 50% 100%, rgb(255 255 255 / 0.9), rgb(196 181 253 / 0.45) 40%, transparent 75%);
}
.space.go .beam { animation: beam 4.6s ease-out forwards; }
@keyframes beam {
  0%, 72% { opacity: 0; transform: scaleY(0.2); }
  75% { opacity: 1; transform: scaleY(1.1); }
  100% { opacity: 0; transform: scaleY(1.3); }
}
.space .whiteout {
  position: absolute; inset: 0; z-index: 4; mix-blend-mode: screen; opacity: 0;
  background: radial-gradient(70% 60% at 50% 62%, rgb(233 213 255 / 0.55), rgb(124 92 255 / 0.25) 50%, transparent 80%);
}
.space.go .whiteout { animation: whiteout 4.6s ease-out forwards; }
@keyframes whiteout { 0%, 72% { opacity: 0; } 75% { opacity: 1; } 100% { opacity: 0; } }
.space .dust { position: absolute; z-index: 3; left: 50%; top: 196px; }
.space .dust i {
  position: absolute; width: 4px; height: 4px; border-radius: 50%; opacity: 0;
  background: #e9d5ff; box-shadow: 0 0 8px #a855f7;
}
.space.go .dust i { animation: dust 4.4s cubic-bezier(0.1, 0.7, 0.3, 1) forwards; }
.space .dust i:nth-child(odd) { --side: -1; }
.space .dust i:nth-child(even) { --side: 1; }
.space .dust i:nth-child(n) { --d: 60px; }
.space .dust i:nth-child(3n) { --d: 110px; --up: -14px; }
.space .dust i:nth-child(3n+1) { --d: 150px; --up: -6px; }
.space .dust i:nth-child(3n+2) { --d: 85px; --up: -22px; }
@keyframes dust {
  0%, 76% { opacity: 0; transform: translate(0, 0) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(var(--side) * var(--d)), var(--up)) scale(0.4); }
}
/* Luz del fuego sobre el planeta: crece al acercarse el cohete y queda un brillo suave */
.space .earthlight {
  position: absolute; z-index: 3; left: -20%; right: -20%; top: 100px; bottom: 0; pointer-events: none;
  mix-blend-mode: screen;
  background:
    radial-gradient(120px 60px at 50% 100px, rgb(233 213 255 / 0.85), transparent),
    radial-gradient(200px 85px at 50% 100px, rgb(168 85 247 / 0.5), transparent),
    radial-gradient(260px 96px at 50% 100px, rgb(59 130 246 / 0.3), transparent);
  opacity: 0.2;
}
.space.go .earthlight { animation: earthlight 4.8s ease-out forwards, liftglow 2.2s ease-out 6.1s forwards; }
@keyframes liftglow { 0% { opacity: 0.3; } 18% { opacity: 1; } 100% { opacity: 0.25; } }
/* Fogonazo del despegue */
.space .liftflash {
  position: absolute; z-index: 3; left: 50%; top: 150px; width: 420px; height: 110px; margin-left: -210px;
  border-radius: 50%; mix-blend-mode: screen; opacity: 0;
  background: radial-gradient(closest-side, #fff, rgb(233 213 255 / 0.8) 25%, rgb(168 85 247 / 0.45) 55%, transparent);
}
.space.go .liftflash { animation: liftflash 1.6s ease-out 6.15s forwards; }
@keyframes liftflash { 0% { opacity: 0; transform: scale(0.3); } 20% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.5, 1.2); } }
@keyframes earthlight {
  0% { opacity: 0.1; }
  75% { opacity: 1; }
  100% { opacity: 0.3; }
}
/* Logo: reacciona a la secuencia del cohete */
.auth-brand { position: relative; z-index: 6; }
/* Subida rápida y seca ("pam"): se pasa un poco de largo y rebota a su sitio, cerca del borde superior */
.auth-brand.go { animation: brand-rise 0.95s linear 6.35s forwards; }
@keyframes brand-rise {
  0% { margin-top: -118px; animation-timing-function: cubic-bezier(0.55, 0, 0.85, 0.5); }
  70% { margin-top: 12px; transform: scale(1.03, 0.97); animation-timing-function: ease-out; }
  85% { margin-top: 28px; transform: scale(0.99, 1.01); animation-timing-function: ease-in-out; }
  100% { margin-top: 24px; transform: none; }
}
.space.go { animation: space-out 0.75s cubic-bezier(0.55, 0, 0.85, 0.5) 6.35s forwards; }
@keyframes space-out { to { height: 0; opacity: 0; } }
.auth-brand.go .wordmark { animation: logo-pulse 1.1s ease-out 4.95s; }
@keyframes logo-pulse {
  0%, 100% { filter: drop-shadow(0 0 0 rgb(168 85 247 / 0)); transform: scale(1); }
  35% { filter: drop-shadow(0 0 18px rgb(168 85 247 / 0.9)) drop-shadow(0 0 32px rgb(59 130 246 / 0.6)); transform: scale(1.04); }
}
.auth-brand .orbit { background-size: 200% 100%; background-image: linear-gradient(90deg, #6366f1, #a855f7, #e9d5ff, #a855f7, #6366f1); }
/* El logo aparece con el destello del aterrizaje; la O (disco) y la t (barra) llegan volando desde la luna */
.auth-brand .w-gym, .auth-brand .orbit, .auth-brand .orbit-a, .auth-brand .tagline, .auth-brand .glyph { opacity: 0; }
.auth-brand.go .w-gym, .auth-brand.go .orbit-a, .auth-brand.go .tagline { animation: reveal 0.6s ease-out 3.35s both; }
.auth-brand.go .orbit { animation: reveal 0.6s ease-out 3.35s both, shimmer 1.4s ease-in-out 5s; }
.auth-brand.go .glyph-o { animation: glyph-in 0.7s cubic-bezier(0.2, 0.9, 0.25, 1.2) 3.7s both; }
@keyframes reveal { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: blur(0); } }
@keyframes glyph-in {
  0% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2) rotate(-220deg); }
  25% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) {
  .space.go .launch, .space .launch { animation: none; transform: none; }
  .space.go .thrust, .space .thrust { animation: none; opacity: 0; }
  .space .sparks, .space .flare, .space .shock, .space .beam, .space .whiteout, .space .dust, .space .trail, .space .liftflash { display: none; }
  .auth-brand.go, .auth-brand.go .wordmark, .auth-brand.go .orbit, .space.go { animation: none; }
  .burst, .screenflash { display: none; }
  .auth-brand .w-gym, .auth-brand .orbit, .auth-brand .orbit-a, .auth-brand .tagline, .auth-brand .glyph { opacity: 1; animation: none !important; }
  .space.go .earthlight { animation: none; opacity: 0.3; }
}
.space .planet {
  position: absolute; z-index: 2; left: -35%; right: -35%; bottom: -300px; height: 420px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 0%, #1a2452, #0e1533 30%, var(--bg) 55%);
  box-shadow: 0 -1px 0 #9db4ff, 0 -6px 24px rgb(96 165 250 / 0.9), 0 -24px 64px rgb(59 130 246 / 0.55), 0 -48px 96px rgb(168 85 247 / 0.35);
}

.auth-brand { text-align: center; margin-top: -118px; }
.wordmark {
  font-family: "Sora", "Inter", system-ui, sans-serif; font-weight: 700; font-size: 44px;
  line-height: 1; letter-spacing: -0.02em; color: #f2f4ff;
}
.wordmark { display: inline-flex; align-items: baseline; }
.wordmark .orbit { background: linear-gradient(90deg, #6366f1, #a855f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark .orbit-a { color: #a855f7; margin-left: 0.01em; }
.glyph { display: inline-block; overflow: visible; }
.glyph-o { width: 0.76em; height: 0.76em; margin: 0 0.08em 0 0.07em; }
.orbit-moon { fill: #f5f3ff; filter: drop-shadow(0 0 2px #c084fc) drop-shadow(0 0 4px #a855f7); }
/* Explosión blanca al llegar el logo arriba (~7 s): destello en pantalla, núcleo, ondas y rayos */
.screenflash { position: fixed; inset: 0; z-index: 20; pointer-events: none; background: #fff; opacity: 0; }
.auth:has(.auth-brand.go) .screenflash { animation: screenflash 0.5s ease-out 7s; }
@keyframes screenflash { 0% { opacity: 0; } 12% { opacity: 0.75; } 100% { opacity: 0; } }
.burst { position: absolute; left: 50%; top: 24px; width: 0; height: 0; pointer-events: none; z-index: -1; }
.burst > * { position: absolute; left: 0; top: 0; opacity: 0; }
.burst-core {
  width: 360px; height: 160px; margin: -80px 0 0 -180px; border-radius: 50%;
  background: radial-gradient(closest-side, #fff, rgb(255 255 255 / 0.9) 30%, rgb(233 213 255 / 0.55) 55%, transparent);
}
.burst-ring {
  width: 80px; height: 80px; margin: -40px 0 0 -40px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 24px #fff, 0 0 48px rgb(196 181 253 / 0.9);
}
.burst-rays i {
  position: absolute; left: 0; top: 0; width: 70px; height: 2px; margin-top: -1px; border-radius: 2px;
  background: linear-gradient(90deg, #fff, rgb(233 213 255 / 0));
  transform-origin: 0 50%; transform: rotate(var(--a)) translateX(30px) scaleX(0.2);
}
.burst-rays { opacity: 1; }
.auth-brand.go .burst-core { animation: burst-core 0.8s ease-out 7s; }
.auth-brand.go .burst-ring { animation: burst-ring 0.7s cubic-bezier(0.1, 0.6, 0.3, 1) 7s; }
.auth-brand.go .burst-ring.r2 { animation-delay: 7.1s; }
.auth-brand.go .burst-rays i { animation: burst-ray 0.6s cubic-bezier(0.1, 0.7, 0.3, 1) 7s both; }
@keyframes burst-core { 0% { opacity: 0; transform: scale(0.3); } 15% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.8, 1.4); } }
@keyframes burst-ring { 0% { opacity: 1; transform: scale(0.2); } 100% { opacity: 0; transform: scale(5, 2.6); } }
@keyframes burst-ray {
  0% { opacity: 0; transform: rotate(var(--a)) translateX(20px) scaleX(0.2); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(150px) scaleX(1); }
}

/* Lema con aire de otro planeta: tipografía sci-fi con brillo */
.tagline {
  margin-top: 12px; font-family: "Orbitron", "Sora", sans-serif; font-weight: 500; font-size: var(--fs-sm);
  letter-spacing: 0.42em; color: #c7d2fe; white-space: nowrap;
  text-shadow: 0 0 6px rgb(124 140 255 / 0.8), 0 0 18px rgb(168 85 247 / 0.55);
}

.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.auth-field {
  position: relative; display: flex; align-items: center;
  border-radius: var(--r-md); background: rgb(17 22 46 / 0.6); border: 1px solid rgb(124 140 255 / 0.25);
}
.auth-field:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-field > .icon { position: absolute; left: 16px; color: var(--text-2); }
.auth-field input { min-height: 56px; padding-left: 48px; background: transparent; border: 0; box-shadow: none; }
.auth-field input:focus { box-shadow: none; }
.auth-field .eye { position: absolute; right: 4px; min-height: 48px; width: 48px; padding: 0; background: none; color: var(--text-2); }
.auth-form .primary { min-height: 56px; border-radius: var(--r-md); margin-top: 4px; }
.auth-error { padding: 12px 16px; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); }

.auth-divider { display: flex; align-items: center; gap: 16px; color: var(--text-2); margin-top: 8px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-providers { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 12px; }
.auth-providers .button {
  min-height: 52px; border-radius: var(--r-md); background: rgb(17 22 46 / 0.6);
  border: 1px solid rgb(124 140 255 / 0.25); color: #fff; gap: 10px;
}
.auth-providers .button .icon { color: #c4b5fd; }
.auth-providers .button:active { background: var(--surface-2); }
.auth-providers .brand { width: 20px; height: 20px; }
.auth-switch { margin: 0; text-align: center; color: var(--text-2); }
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: var(--fw-bold); }

/* ---------- aliens haciendo ejercicio (public/aliens.js) ---------- */
.alien { display: block; width: 100%; height: 100%; }
.alien-stage { background: radial-gradient(120% 90% at 50% 0%, #1d2760, #0e1330); overflow: hidden; }
.al-limb { fill: none; stroke: #a5b4fc; stroke-width: 7.5; stroke-linecap: round; stroke-linejoin: round; }
.al-back { stroke: #6f7be0; }
.al-outline { stroke: #161d45; stroke-width: 12; }
.al-torso { fill: none; stroke: #a5b4fc; stroke-width: 17; stroke-linecap: round; }
.al-skin { fill: #a5b4fc; }
.al-antenna { fill: none; stroke: #a5b4fc; stroke-width: 3; stroke-linecap: round; }
.al-tip { fill: #c084fc; }
.al-eye { fill: #0b0f1a; }
.al-shine { fill: #fff; }
.al-cheek { fill: #c084fc; opacity: 0.35; }
.al-effort path { fill: none; stroke: #c084fc; stroke-width: 2; stroke-linecap: round; }
.al-plate { fill: url(#al-grad); }
.al-ring { fill: none; stroke: rgb(255 255 255 / 0.35); stroke-width: 2; }
.al-hub { fill: #e0e7ff; }
.al-bar { fill: none; stroke: #c7d2fe; stroke-width: 3.5; stroke-linecap: round; }
.al-frame { fill: none; stroke: #3b4785; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.al-thin { stroke: #2c3670; stroke-width: 2; }
.al-pad { fill: #4a3fa8; }
.al-pad-line { fill: none; stroke: #4a3fa8; stroke-width: 9; stroke-linecap: round; }
.al-pulley { fill: #161d45; stroke: #7c8cff; stroke-width: 2.5; }
.al-cable { fill: none; stroke: #c7d2fe; stroke-opacity: 0.7; stroke-width: 1.5; }
.al-stack { fill: #2c3670; }
.al-lift { fill: url(#al-grad); }
.al-stack-lines { stroke: #161d45; stroke-width: 1.5; }
.al-shadow { fill: rgb(0 0 0 / 0.35); }
.alien:not(.still) .al-blink { transform-box: fill-box; transform-origin: center; animation: al-blink 4.2s infinite; }
.alien:not(.still) .al-antennae { transform-box: fill-box; transform-origin: 50% 100%; animation: al-wobble 1.3s ease-in-out infinite alternate; }
.alien:not(.still) .al-ant-left { transform-origin: 100% 100%; }
.alien:not(.still) .al-breathe { animation: al-breathe 2.2s ease-in-out infinite; }
@keyframes al-blink { 0%, 90%, 100% { transform: scaleY(1); } 93% { transform: scaleY(0.1); } 96% { transform: scaleY(1); } }
@keyframes al-wobble { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
@keyframes al-breathe { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-1.5px); } }
@media (prefers-reduced-motion: reduce) { .al-blink, .al-antennae, .al-breathe { animation: none !important; } }

/* Miniaturas con alien en lugar de foto */
.thumb.alien-stage { width: 56px; height: 56px; flex: none; border-radius: var(--r-sm); }
.hero-card .thumbs .mini {
  width: 48px; height: 48px; border-radius: 50%; margin-left: -8px; border: 2px solid var(--surface);
}
.hero-card .thumbs .mini:first-child { margin-left: 0; }
.template .strip { background: var(--surface-2); }
.template .strip-alien, .template .strip .ph { aspect-ratio: 1; }
.cat-card .cat-alien { width: 100%; aspect-ratio: 4 / 3; }
.al-lever { fill: none; stroke: #3b4785; stroke-width: 4.5; stroke-linecap: round; }
.al-thin-lever { stroke-width: 3; }
.al-ring-handle { fill: none; stroke: url(#al-grad); stroke-width: 3; }
.al-rope { fill: none; stroke: #c7d2fe; stroke-width: 2.5; stroke-linecap: round; }
.al-box { fill: #2c3670; stroke: #3b4785; stroke-width: 2; }

/* ---------- panel de progreso (public/charts.js) ---------- */
.range { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.range button { min-height: 36px; background: transparent; color: var(--text-2); font-size: var(--fs-sm); border-radius: 8px; }
.range button.on { background: var(--surface-2); color: var(--text); }
.dash.loading { opacity: 0.5; transition: opacity 0.2s; }
.hero-figure { padding: 24px 16px 16px; border-radius: var(--r-lg); background: radial-gradient(120% 90% at 100% 0%, rgb(124 92 255 / 0.22), transparent 60%), var(--surface); border: 1px solid var(--line); }
.hero-figure .k { color: var(--text-2); }
.hero-figure .big { font-size: 48px; font-weight: var(--fw-bold); line-height: 1.1; letter-spacing: -0.02em; margin: 4px 0 8px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: var(--fw-bold); padding: 2px 8px; border-radius: 999px; }
.delta.up { background: rgb(52 211 153 / 0.14); color: #6ee7b7; }
.delta.down { background: var(--danger-soft); color: #ff8fa3; }
.delta.flat { background: var(--surface-2); color: var(--text-2); }
.chart-card { padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.chart-card .sub { color: var(--text-3); font-size: var(--fs-sm); margin: -4px 0 12px; }
.chart { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-axis { fill: var(--text-3); font-size: 10px; font-family: inherit; font-variant-numeric: tabular-nums; }
.chart-value { fill: var(--text); font-size: 11px; font-weight: 700; font-family: inherit; }
.chart-mark { transition: opacity 0.15s; }
.chart-svg rect[tabindex]:focus { outline: none; }
.chart-svg rect[tabindex]:hover + *, .chart-mark:hover { opacity: 0.85; }
.chart-tip {
  position: absolute; z-index: 2; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  padding: 6px 10px; border-radius: 10px; background: #e0e7ff; color: #0b0f1a; box-shadow: var(--shadow); text-align: center;
}
.chart-tip .v { font-weight: 700; }
.chart-tip .l { font-size: 11px; opacity: 0.7; }
.chart-data { margin-top: 8px; }
.chart-data summary { font-size: var(--fs-sm); color: var(--text-3); padding: 4px 0; }
.chart-data table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.chart-data th, .chart-data td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.chart-data th { color: var(--text-3); font-weight: 500; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: 8px; font-size: 10px; color: var(--text-3); }
.heat-legend i { width: 10px; height: 10px; border-radius: 2px; }
.heat-legend span { margin: 0 4px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 84px 1fr 40px; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.hbar-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 12px; }
.hbar-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--muted, #36459a); background: #36459a; }
.hbar-fill.em { background: #7c8cff; }
.hbar-value { text-align: right; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.lift { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; }
.lift + .lift { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.lift .thumb.alien-stage { width: 44px; height: 44px; }
.lift .name { font-weight: 700; }
.lift .meta { color: var(--text-3); font-size: var(--fs-sm); }

/* Estrellas del login: aparecen tras la explosión y titilan */
.login-stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; }
.auth:has(.auth-brand.go) .login-stars { animation: stars-in 1.2s ease-out 7.1s forwards; }
.auth > :not(.login-stars):not(.screenflash) { position: relative; z-index: 1; }
@keyframes stars-in { to { opacity: 1; } }
.login-stars i {
  position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #e0e7ff;
  box-shadow: 0 0 6px rgb(196 181 253 / 0.9);
  animation: twinkle var(--d) ease-in-out var(--delay) infinite alternate;
}
.login-stars i.sparkle {
  width: calc(var(--s) * 2.6); height: calc(var(--s) * 2.6); border-radius: 0; box-shadow: none;
  background: linear-gradient(#fff, #c4b5fd);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  filter: drop-shadow(0 0 4px #a855f7);
}
@keyframes twinkle {
  from { opacity: 0.15; transform: scale(0.6) rotate(0deg); }
  to { opacity: 1; transform: scale(1.15) rotate(20deg); }
}
@media (prefers-reduced-motion: reduce) {
  .auth:has(.auth-brand.go) .login-stars, .login-stars { animation: none; opacity: 1; }
  .login-stars i { animation: none; opacity: 0.7; }
}

/* ---------- logo siempre presente en la cabecera ---------- */
.topbar-brand { flex: 1; display: flex; align-items: center; text-decoration: none; min-height: 40px; }
.topbar-brand .wordmark { font-size: 24px; }
.topbar-mark { display: grid; place-items: center; width: 40px; height: 40px; margin-right: -4px; }
.logo-mark .glyph-o { display: block; width: 22px; height: 22px; margin: 0; overflow: visible; }
.page-title { margin: 8px 0 0; font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: 1.15; }
button.near.on { background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent-line); }
