/* Entrenamiento Gamificado (beta) — tema Sistema, oscuro, mobile-first.
   Tres apariencias reversibles: clasica / limpia / esencial.
   Se cambia con data-appearance en <html>. La lógica no cambia.
   Sistema visual original: Rajdhani (títulos/niveles), vacío casi negro
   #05070D, paneles #0B1220, cian #00D4FF luminoso, paneles angulares. */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&display=swap');
:root {
  --radius: 10px;
  --radius-sm: 6px;
  --nav-h: 64px;
  --max-w: 860px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
}
html[data-appearance="clasica"] {
  --bg: #05070d;
  --bg2: #0b1220;
  --surface: #0b1220;
  --surface2: #101a30;
  --border: #1e3a56;
  --text: #eaf6ff;
  --muted: #8fb8d8;
  --accent: #00d4ff;
  --accent2: #7dd3fc;
  --gold: #f5c542;
  --success: #34d399;
  --danger: #f87171;
  --warn: #fbbf24;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --glow: 0 0 24px rgba(0, 212, 255, .28);
}
html[data-appearance="limpia"] {
  --bg: #0e1218;
  --bg2: #141a22;
  --surface: #181f2a;
  --surface2: #1e2733;
  --border: #2c3848;
  --text: #eef2f7;
  --muted: #9aa8ba;
  --accent: #2dd4bf;
  --accent2: #7dd3fc;
  --gold: #fbbf24;
  --success: #34d399;
  --danger: #f87171;
  --warn: #f59e0b;
  --shadow: 0 6px 18px rgba(0, 0, 0, .35);
  --glow: none;
}
html[data-appearance="esencial"] {
  --bg: #050505;
  --bg2: #0a0a0a;
  --surface: #101010;
  --surface2: #161616;
  --border: #262626;
  --text: #e5e5e5;
  --muted: #8a8a8a;
  --accent: #8b7fd4;
  --accent2: #6b6b6b;
  --gold: #d4af37;
  --success: #4ade80;
  --danger: #ef4444;
  --warn: #d4af37;
  --shadow: none;
  --glow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 15px; color: var(--text);
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; font-family: var(--font-display); }
h1 { font-size: 26px; letter-spacing: .07em; text-transform: uppercase; }
h2 { font-size: 20px; letter-spacing: .05em; text-transform: uppercase; }
h3 { font-size: 17px; letter-spacing: .04em; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.gold { color: var(--gold); }
.accent { color: var(--accent); }
.game-icon { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.game-icon.lg { width: 28px; height: 28px; }
.game-icon.sm { width: 16px; height: 16px; }

/* ---------- Vistas ---------- */
.view { display: none; }
.view.active { display: block; }
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 16px 14px calc(var(--nav-h) + 28px); }
.center-wrap { max-width: 480px; margin: 0 auto; padding: 24px 16px 40px; }

/* ---------- Cabecera ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .16em; font-size: 16px; font-family: var(--font-display); text-transform: uppercase; }
.brand .game-icon { color: var(--accent); }
.hunter-chip { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 10px; font-size: 13px; font-weight: 700;
  font-family: var(--font-display); letter-spacing: .04em;
}
.chip .game-icon { width: 15px; height: 15px; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 50%; width: 38px; height: 38px; display: inline-flex;
  align-items: center; justify-content: center; position: relative; flex: none;
}
.badge-dot {
  position: absolute; top: -2px; right: -2px; min-width: 17px; height: 17px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.xpbar { height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.xpbar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 70%, transparent); }
.xp-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Subnavegación ---------- */
.subnav {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 14px 4px;
  max-width: var(--max-w); margin: 0 auto; scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav button {
  flex: none; background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); border-radius: var(--radius-sm); padding: 7px 13px; font-size: 13px; font-weight: 700;
  font-family: var(--font-display); letter-spacing: .05em; text-transform: uppercase;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
}
.subnav button.active { background: var(--accent); border-color: var(--accent); color: #06101f; }
html[data-appearance="limpia"] .subnav button.active { color: #04211c; }
html[data-appearance="esencial"] .subnav button.active { color: #fff; }

/* ---------- Tarjetas y botones ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin: 12px 0; box-shadow: var(--shadow);
  position: relative;
}
.card::before {
  content: ""; position: absolute; top: -1px; left: 14px; right: 14px; height: 2px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 70%, transparent), transparent);
  border-radius: 2px; pointer-events: none;
}
.card h2, .card h3 { display: flex; align-items: center; gap: 8px; }
.card h2 .game-icon, .card h3 .game-icon { color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent); color: #06101f; border: none; border-radius: var(--radius-sm);
  padding: 11px 16px; font-size: 14px; font-weight: 700; text-decoration: none;
  font-family: var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
html[data-appearance="esencial"] .btn { color: #fff; }
.btn.secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.gold { background: var(--gold); color: #241a00; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn-row .btn { flex: 1; min-width: 120px; }
.empty {
  border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 20px 14px; text-align: center; color: var(--muted); margin: 12px 0;
}
.empty .game-icon { width: 30px; height: 30px; color: var(--accent); margin-bottom: 6px; }
.tag {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px;
  border-radius: 3px; background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
}
.tag.gold { color: var(--gold); border-color: var(--gold); }
.tag.accent { color: var(--accent); border-color: var(--accent); }
.tag.locked { color: var(--warn); border-color: var(--warn); }
.tag.danger { color: var(--danger); border-color: var(--danger); }
.tag.success { color: var(--success); border-color: var(--success); }
.rarity-comun { color: #9aa8ba; }
.rarity-raro { color: #38bdf8; }
.rarity-epico { color: #a78bfa; }
.rarity-legendario { color: #f59e0b; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-box {
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px; text-align: center;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.stat-box b { display: block; font-size: 22px; font-family: var(--font-display); letter-spacing: .03em; }
.stat-box span { font-size: 12px; color: var(--muted); }
.list-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
details.workout { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 8px 0; background: var(--surface); }
details.workout summary { cursor: pointer; padding: 11px 12px; list-style: none; display: flex; gap: 8px; align-items: center; }
details.workout summary::-webkit-details-marker { display: none; }
details.workout .body { padding: 0 12px 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--border); }
table.data th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
table.data tr.row-user td { background: rgba(212, 175, 55, 0.10); font-weight: 600; }
.progress { height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent); }
.progress.gold > span { background: linear-gradient(90deg, var(--gold), #ffe082); box-shadow: 0 0 8px rgba(245, 197, 66, .55); }
.progress.danger > span { background: linear-gradient(90deg, #ef4444, #f59e0b); }

/* ---------- TU SEMANA ---------- */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.week-day {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface2); padding: 8px 2px 6px; text-align: center; min-width: 0;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}
.week-day .dow { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-family: var(--font-display); font-weight: 700; }
.week-day .dnum { font-size: 18px; font-weight: 700; line-height: 1.2; font-family: var(--font-display); }
.week-day .mark { font-size: 12px; min-height: 17px; color: var(--success); font-weight: 700; }
.week-day .xp { font-size: 10px; color: var(--gold); min-height: 13px; }
.week-day.today { border-color: var(--accent); box-shadow: var(--glow); background: var(--surface); }
.week-day.today .dow { color: var(--accent); }
.week-day.trained { border-color: var(--success); }

/* ---------- Navegación inferior ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}
.bottomnav-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: end;
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.nav-btn {
  background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 700; padding: 6px 2px;
  font-family: var(--font-display); letter-spacing: .07em; text-transform: uppercase;
}
.nav-btn .game-icon { width: 22px; height: 22px; }
.nav-btn.active { color: var(--accent); }
.nav-central {
  width: 58px; height: 58px; border-radius: 50%; margin: -26px 8px 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 3px solid var(--bg); color: #06101f;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow);
}
html[data-appearance="esencial"] .nav-central { color: #fff; }
.nav-central .game-icon { width: 26px; height: 26px; }

/* ---------- Menú rápido, modales, tutorial ---------- */
.sheet-backdrop, .modal-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .65);
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-backdrop.open, .modal-backdrop.open { display: flex; }
.sheet {
  background: var(--surface); border: 1px solid var(--border); border-bottom: none;
  border-radius: 18px 18px 0 0; width: 100%; max-width: var(--max-w);
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
}
.sheet h3 { text-align: center; margin-bottom: 12px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-action {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 14px 6px; display: flex; flex-direction: column;
  align-items: center; gap: 7px; font-size: 12px; font-weight: 600; text-align: center;
}
.quick-action .game-icon { width: 26px; height: 26px; color: var(--accent); }
.modal-backdrop { align-items: center; padding: 16px; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto; padding: 20px; box-shadow: var(--shadow);
}
.modal h2 { display: flex; align-items: center; gap: 8px; }
.system-msg {
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--bg2); padding: 12px; margin: 10px 0; font-size: 15px;
}
.system-msg b { color: var(--accent); letter-spacing: .08em; }
.tutorial-spot { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
#tutorialCard {
  position: fixed; z-index: 90; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 14px);
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); max-width: 480px; margin: 0 auto;
}
#tutorialCard .steps { font-size: 12px; color: var(--muted); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--nav-h) + 16px); z-index: 120;
  background: var(--surface2); border: 1px solid var(--accent); color: var(--text);
  border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Auth / landing / onboarding ---------- */
.hero { text-align: center; padding: 28px 0 8px; }
.hero .logo { width: 72px; height: 72px; color: var(--accent); margin: 0 auto 8px; }
.hero .logo svg { width: 100%; height: 100%; }
.hero h1 { font-size: 28px; letter-spacing: .06em; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-top: 16px; }
.auth-error {
  display: none; background: rgba(248, 113, 113, .12); border: 1px solid var(--danger);
  color: var(--danger); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; font-size: 14px;
}
.auth-error.show { display: block; }
.auth-ok {
  display: none; background: rgba(52, 211, 153, .12); border: 1px solid var(--success);
  color: var(--success); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; font-size: 14px;
}
.auth-ok.show { display: block; }
.tabs-auth { display: flex; gap: 8px; margin-bottom: 6px; }
.tabs-auth button {
  flex: 1; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface2); color: var(--muted); font-weight: 700;
}
.tabs-auth button.active { background: var(--accent); color: #06101f; border-color: var(--accent); }
html[data-appearance="esencial"] .tabs-auth button.active { color: #fff; }
.steps-dots { display: flex; gap: 6px; justify-content: center; margin: 12px 0; }
.steps-dots span { width: 26px; height: 6px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--border); }
.steps-dots span.on { background: var(--accent); border-color: var(--accent); }
.appearance-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.appearance-pick button {
  border: 2px solid var(--border); background: var(--surface2); color: var(--text);
  border-radius: var(--radius-sm); padding: 12px 6px; font-weight: 700; font-size: 13px;
}
.appearance-pick button.on { border-color: var(--accent); color: var(--accent); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: none; }
.switch {
  position: relative; width: 46px; height: 26px; flex: none; appearance: none;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; padding: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--muted); transition: left .15s, background .15s;
}
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { left: 22px; background: #06101f; }
.radar-wrap { display: flex; justify-content: center; }
.radar-wrap svg { max-width: 100%; height: auto; }
.admin-box { border: 1px dashed var(--warn); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.admin-box h3 { color: var(--warn); }
.notif-unread { border-left: 3px solid var(--accent); }
@media (min-width: 640px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Apertura espectacular: landing + El Despertar ----------
   Solo CSS, sin recursos externos. Los estados ocultos viven solo en los
   keyframes (from): sin soporte de animación, todo se ve. Las animaciones
   de entrada usan visibility para que nada invisible reciba toques. */
@keyframes authReveal {
  from { opacity: 0; visibility: hidden; transform: translateY(18px); }
  to { opacity: 1; visibility: visible; transform: translateY(0); }
}
@keyframes heroPop {
  from { opacity: 0; visibility: hidden; transform: scale(.65); }
  to { opacity: 1; visibility: visible; transform: scale(1); }
}
@keyframes titleGlow {
  0%, 100% { text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 42px color-mix(in srgb, var(--accent) 25%, transparent); }
  50% { text-shadow: 0 0 22px color-mix(in srgb, var(--gold) 70%, transparent), 0 0 64px color-mix(in srgb, var(--accent) 40%, transparent); }
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
@keyframes ringSpinRev { to { transform: rotate(-360deg); } }
@keyframes emberRise {
  0% { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
  12% { opacity: .9; }
  70% { opacity: .55; }
  100% { transform: translateY(-94vh) translateX(16px) scale(.35); opacity: 0; }
}
@keyframes orbDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(26px, -18px) scale(1.12); }
}
@keyframes panelBreathe {
  0%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), 0 0 22px color-mix(in srgb, var(--accent) 18%, transparent); }
  50% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 65%, transparent), 0 0 38px color-mix(in srgb, var(--accent) 34%, transparent); }
}
@keyframes despMsgIn {
  from { opacity: 0; visibility: hidden; transform: translateX(-16px); }
  to { opacity: 1; visibility: visible; transform: translateX(0); }
}
@keyframes despTitleIn {
  from { opacity: 0; visibility: hidden; transform: scale(.85); }
  to { opacity: 1; visibility: visible; transform: scale(1); }
}
@keyframes despBtnPulse {
  0%, 100% { box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 45%, transparent); }
  50% { box-shadow: 0 0 30px color-mix(in srgb, var(--gold) 65%, transparent), 0 0 54px color-mix(in srgb, var(--accent) 35%, transparent); }
}

/* Fondo animado de la landing: brasas que ascienden + resplandores. */
#view-auth { position: relative; }
.auth-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#view-auth .center-wrap { position: relative; z-index: 1; }
.orb { position: absolute; border-radius: 50%; animation: orbDrift 11s ease-in-out infinite; }
.orb-gold {
  width: 340px; height: 340px; top: -90px; right: -110px;
  background: radial-gradient(circle, color-mix(in srgb, var(--gold) 20%, transparent) 0%, transparent 65%);
}
.orb-blue {
  width: 420px; height: 420px; bottom: -140px; left: -140px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent) 0%, transparent 65%);
  animation-duration: 14s; animation-delay: -6s;
}
.ember {
  position: absolute; bottom: -12px; width: 5px; height: 5px; border-radius: 50%;
  background: radial-gradient(circle, var(--gold) 0%, color-mix(in srgb, var(--gold) 30%, transparent) 60%, transparent 70%);
  animation: emberRise linear infinite;
}
.ember:nth-child(3) { left: 7%; animation-duration: 9s; animation-delay: 0s; }
.ember:nth-child(4) { left: 19%; width: 4px; height: 4px; animation-duration: 12s; animation-delay: -4s; background: radial-gradient(circle, var(--accent) 0%, color-mix(in srgb, var(--accent) 30%, transparent) 60%, transparent 70%); }
.ember:nth-child(5) { left: 33%; animation-duration: 10s; animation-delay: -7s; }
.ember:nth-child(6) { left: 47%; width: 6px; height: 6px; animation-duration: 13s; animation-delay: -2s; }
.ember:nth-child(7) { left: 61%; width: 4px; height: 4px; animation-duration: 8s; animation-delay: -5s; background: radial-gradient(circle, var(--accent) 0%, color-mix(in srgb, var(--accent) 30%, transparent) 60%, transparent 70%); }
.ember:nth-child(8) { left: 74%; animation-duration: 11s; animation-delay: -9s; }
.ember:nth-child(9) { left: 86%; width: 4px; height: 4px; animation-duration: 10s; animation-delay: -3s; }
.ember:nth-child(10) { left: 94%; width: 6px; height: 6px; animation-duration: 14s; animation-delay: -8s; background: radial-gradient(circle, var(--accent) 0%, color-mix(in srgb, var(--accent) 30%, transparent) 60%, transparent 70%); }

/* Héroe: portal giratorio tras el logo y título con resplandor. */
.hero .logo { position: relative; }
.hero .logo::before, .hero .logo::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero .logo::before {
  inset: -10px; border: 2px solid transparent;
  border-top-color: var(--accent); border-right-color: color-mix(in srgb, var(--accent) 35%, transparent);
  animation: ringSpin 6s linear infinite;
}
.hero .logo::after {
  inset: -20px; border: 1px dashed color-mix(in srgb, var(--gold) 55%, transparent);
  animation: ringSpinRev 14s linear infinite;
}
.hero .logo svg { position: relative; z-index: 1; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 65%, transparent)); }

/* Entrada escalonada de la landing (se repite cada vez que se muestra). */
#view-auth.active .hero .logo { animation: heroPop .8s cubic-bezier(.2, .9, .3, 1.4) both .1s; }
#view-auth.active .hero h1 { animation: authReveal .6s ease both .35s, titleGlow 3.2s ease-in-out 1.1s infinite; }
#view-auth.active .hero p { animation: authReveal .6s ease both .55s; }
#view-auth.active .center-wrap > .card { animation: authReveal .7s ease both .8s; }
#view-auth.active .center-wrap > .auth-card { animation: authReveal .7s ease both 1.05s; }

/* El formulario como panel del SISTEMA: borde acento + respiración. */
#view-auth .auth-card {
  position: relative;
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  animation: panelBreathe 4s ease-in-out infinite;
}
#view-auth .auth-card::before {
  content: ""; position: absolute; top: -1px; left: 18px; right: 18px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--gold), var(--accent), transparent);
  border-radius: 2px;
}

/* El Despertar: secuencia por etapas; cada mensaje entra tras el anterior. */
#despertarBackdrop.open .modal { animation: heroPop .5s ease both; }
#despertarBackdrop.open .desp-title { animation: despTitleIn .7s cubic-bezier(.2, .9, .3, 1.3) both .15s, titleGlow 3.2s ease-in-out 1.1s infinite; }
#despertarBackdrop.open .desp-1 { animation: despMsgIn .55s ease both .7s; }
#despertarBackdrop.open .desp-2 { animation: despMsgIn .55s ease both 1.5s; }
#despertarBackdrop.open .desp-3 { animation: despMsgIn .55s ease both 2.3s; }
#despertarBackdrop.open .desp-4 { animation: despMsgIn .55s ease both 3.1s; }
#despertarBackdrop.open .desp-final { animation: authReveal .6s ease both 3.9s; }
#despertarBackdrop.open #btnDespertar { animation: despBtnPulse 2.2s ease-in-out 4.6s infinite; }
/* Atajo: tocar dentro del modal adelanta toda la secuencia. */
#despertarBackdrop.desp-skip .modal,
#despertarBackdrop.desp-skip .desp-title,
#despertarBackdrop.desp-skip .system-msg,
#despertarBackdrop.desp-skip .desp-final,
#despertarBackdrop.desp-skip #btnDespertar { animation: none; opacity: 1; visibility: visible; transform: none; }

@media (prefers-reduced-motion: reduce) {
  #view-auth.active .hero .logo, #view-auth.active .hero h1, #view-auth.active .hero p,
  #view-auth.active .center-wrap > .card, #view-auth.active .center-wrap > .auth-card,
  #view-auth .auth-card,
  #despertarBackdrop.open .modal, #despertarBackdrop.open .desp-title,
  #despertarBackdrop.open .system-msg, #despertarBackdrop.open .desp-final,
  #despertarBackdrop.open #btnDespertar,
  .hero .logo::before, .hero .logo::after, .ember, .orb { animation: none !important; }
  .hero .logo svg { filter: none; }
}

/* ---------- Ventana de Estado (Status Window) ----------
   El panel héroe del Sistema: nivel gigante, rango, XP, oro, racha,
   récords y los 6 atributos. Datos de derived (nada inventado). */
.status-window {
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: var(--glow), inset 0 0 34px color-mix(in srgb, var(--accent) 6%, transparent);
}
.status-window::before {
  background: linear-gradient(90deg, transparent, var(--accent), var(--gold), var(--accent), transparent);
}
.status-head { display: flex; align-items: center; gap: 14px; }
.status-level {
  font-family: var(--font-display); font-size: 58px; font-weight: 700; line-height: .9;
  color: var(--accent); text-shadow: 0 0 20px color-mix(in srgb, var(--accent) 55%, transparent);
}
.status-level small { display: block; font-size: 11px; letter-spacing: .22em; color: var(--muted); text-shadow: none; }
.status-rank {
  font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: .12em;
  color: var(--gold); text-transform: uppercase;
}
.attr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.attr-cell {
  background: var(--bg2); border: 1px solid var(--border); padding: 8px 6px; text-align: center;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
}
.attr-cell .attr-name { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-display); font-weight: 700; }
.attr-cell .attr-lv { font-family: var(--font-display); font-size: 21px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.attr-cell .attr-xp { font-size: 11px; color: var(--muted); }
.section-label {
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 14px 0 4px;
}
.rank-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid var(--gold); color: var(--gold); padding: 2px 10px; border-radius: 3px; font-size: 14px;
}

/* ---------- Bosses: barra de vida y héroe ---------- */
.boss-hp { height: 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.boss-hp > span { display: block; height: 100%; background: linear-gradient(90deg, #ef4444, #f59e0b); box-shadow: 0 0 10px rgba(239, 68, 68, .55); }
.boss-hero { display: flex; gap: 12px; align-items: flex-start; }
.boss-hero .game-icon { width: 54px; height: 54px; flex: none; color: var(--danger); filter: drop-shadow(0 0 10px rgba(239, 68, 68, .45)); }
.boss-hero .game-icon.portal { color: var(--accent); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 55%, transparent)); }
.overtrain-tag {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px;
  border-radius: 3px; color: var(--warn); border: 1px solid var(--warn); margin-left: 6px;
}
.overtrain-box { border: 1px solid var(--warn); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warn) 8%, transparent); padding: 12px; margin: 12px 0; }
.overtrain-box b { color: var(--warn); }

/* ---------- Compañero: héroe con imagen SVG ---------- */
.companion-hero { text-align: center; padding: 14px 6px 6px; }
.companion-hero .game-icon {
  width: 88px; height: 88px; color: var(--accent);
  filter: drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 55%, transparent));
}
.companion-hero .comp-name { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-top: 6px; }
.comp-stage { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 10px 0 4px; }
.comp-stage .tag.on { color: var(--accent); border-color: var(--accent); }

/* ---------- Cofres y recompensas ---------- */
.chest-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.chest-row:last-child { border-bottom: none; }
.chest-row .game-icon { width: 34px; height: 34px; flex: none; color: var(--gold); filter: drop-shadow(0 0 8px rgba(245, 197, 66, .4)); }
.miss-text { color: var(--warn); font-size: 13px; }
.cost-line { font-size: 13px; color: var(--muted); }
.cost-line b { color: var(--text); }
.cost-line .missing { color: var(--danger); font-weight: 700; }
