/* Estilos comunes: tema oscuro, botones, barras, animaciones */
:root {
  --bg: #0a0a1a;
  --fg: #f4f4ff;
  --muted: #a4a7c8;
  --card: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.09);
  --accent: #a855f7;
  --accent2: #22d3ee;
  --ink: #0a0a1a;
  --ok: #34d399;
  --bad: #fb7185;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  min-height: 100vh; min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  line-height: 1.45; overflow-x: hidden;
}
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
main { position: relative; z-index: 1; max-width: 420px; margin: 0 auto; padding: 22px 16px 40px; transition: opacity .25s; }
body:not(.ready) main { opacity: 0; }
a { color: var(--accent2); }
.hidden { display: none !important; }
.center { text-align: center; }

/* Cabecera */
.kicker { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink); background: linear-gradient(90deg, var(--accent), var(--accent2)); padding: 5px 10px; border-radius: 999px; }
h1 { font-size: 34px; line-height: 1.05; margin: 14px 0 8px; font-weight: 900; letter-spacing: -.02em; }
h1 .grad, .grad { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: 22px; margin: 6px 0 10px; font-weight: 850; }
.tag { color: var(--muted); font-size: 16px; margin: 0 0 18px; }

/* Tarjetas y formularios */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px; margin: 14px 0;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
label.lbl { display: block; font-weight: 700; font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.input { width: 100%; min-height: 56px; padding: 0 16px; font-size: 18px; font-weight: 700; color: var(--fg);
  background: rgba(255,255,255,.06); border: 2px solid var(--line); border-radius: 16px; outline: none; transition: border-color .2s, box-shadow .2s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.input + .input { margin-top: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 12px 2px 4px; }
.check input { width: 22px; height: 22px; flex: 0 0 22px; accent-color: var(--accent); margin: 0; }
.err { color: var(--bad); font-size: 14px; font-weight: 700; min-height: 20px; margin: 6px 2px 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Botones */
.btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 58px;
  margin-top: 14px; padding: 0 18px; border: 0; border-radius: 18px; cursor: pointer; font: inherit; font-size: 19px; font-weight: 900;
  color: var(--ink); text-decoration: none; text-align: center; line-height: 1.2; background: linear-gradient(90deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--accent) 70%, transparent); transition: transform .12s; overflow: hidden; }
.btn:active { transform: scale(.97); }
.btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.45) 50%, transparent 80%);
  transform: translateX(-120%); animation: sheen 2.8s ease-in-out infinite; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn.ghost { background: rgba(255,255,255,.07); color: var(--fg); box-shadow: none; border: 1px solid var(--line); font-size: 16px; min-height: 52px; }
.btn.ghost::after { display: none; }
.linkbtn { display: block; width: 100%; background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; padding: 12px; cursor: pointer; }

/* Pasos */
.steps { display: flex; gap: 6px; margin: 4px 0 12px; }
.steps i { flex: 1; height: 5px; border-radius: 9px; background: rgba(255,255,255,.12); }
.steps i.on { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.steps-txt { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }

/* Columnas de energía */
.cols { display: flex; gap: 10px; align-items: flex-end; margin: 10px 0 4px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.tube { position: relative; width: 100%; height: 140px; border-radius: 14px; background: rgba(255,255,255,.06); overflow: hidden; border: 1px solid var(--line); }
.fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; border-radius: 12px;
  background: linear-gradient(to top, var(--accent), var(--accent2)); transition: height 1.3s cubic-bezier(.2,.8,.2,1); }
.col .val { font-weight: 900; font-size: 16px; }
.col .name { font-size: 11px; color: var(--muted); font-weight: 700; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.locked .fill { height: 50% !important; filter: saturate(.5) blur(1.5px); opacity: .75; }
.locked .fill::after, .shimmer::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.35) 50%, transparent 80%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
.locked .val { filter: blur(6px); user-select: none; }
.lockrow { display: flex; align-items: center; gap: 8px; justify-content: center; color: var(--muted); font-size: 13px; font-weight: 800; margin-top: 8px; }

/* Barras horizontales (rankings, sub-scores) */
.hbar { margin: 10px 0; }
.hbar .top { display: flex; justify-content: space-between; font-weight: 800; font-size: 14px; margin-bottom: 5px; }
.hbar .track { height: 12px; background: rgba(255,255,255,.07); border-radius: 9px; overflow: hidden; position: relative; }
.hbar .bar { height: 100%; width: 0; border-radius: 9px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.hbar.locked .bar { width: 50% !important; position: relative; opacity: .7; }
.hbar.locked .top b { filter: blur(5px); }

/* Bloque bloqueado genérico */
.blurred { filter: blur(7px); user-select: none; pointer-events: none; }
.lockbox { position: relative; border-radius: 18px; overflow: hidden; }
.lockbox .veil { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(180deg, rgba(10,10,26,.2), rgba(10,10,26,.85)); font-weight: 900; text-align: center; padding: 14px; }
.lockbox .veil .ico { font-size: 30px; animation: pulse 1.6s ease-in-out infinite; }

/* Resultado grande */
.big { font-size: 72px; line-height: 1; font-weight: 950; letter-spacing: -.03em; margin: 6px 0; }
.mid { font-size: 26px; font-weight: 900; margin: 4px 0; }
.sub { color: var(--muted); font-size: 15px; margin: 4px 0; }
.pop { animation: pop .7s cubic-bezier(.34,1.56,.64,1) both; }
.fade-up { animation: fadeUp .5s ease both; }

/* Escaneo */
.scan { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; }
.scan .pct { font-size: 48px; font-weight: 950; font-variant-numeric: tabular-nums; }
.scan .msg { color: var(--muted); font-weight: 800; }
.orb { width: 170px; height: 170px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 35%, #fff 0, var(--accent2) 18%, var(--accent) 55%, transparent 72%);
  animation: breathe 1s ease-in-out infinite; filter: drop-shadow(0 0 30px var(--accent)); }
.orb::before, .orb::after { content: ""; position: absolute; inset: -18px; border-radius: 50%; border: 2px solid var(--accent2); opacity: .6; animation: ring 1.4s ease-out infinite; }
.orb::after { animation-delay: .7s; border-color: var(--accent); }

/* Card final (lienzo) */
.cardwrap { border-radius: 24px; overflow: hidden; margin: 16px auto; max-width: 300px; animation: glow 2.2s ease-in-out infinite; }
.cardwrap canvas { display: block; width: 100%; height: auto; }

/* Compartir */
.share { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.share .btn { margin: 0; min-height: 52px; font-size: 15px; }
.share .wa { grid-column: 1 / -1; background: linear-gradient(90deg, #25d366, #128c7e); color: #fff; }

/* Rankings */
.rank { list-style: none; margin: 8px 0 0; padding: 0; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.04); margin-bottom: 8px; border: 1px solid var(--line); }
.rank li .pos { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 13px; background: rgba(255,255,255,.1); }
.rank li:nth-child(1) .pos { background: linear-gradient(135deg, #fde047, #f59e0b); color: var(--ink); }
.rank li .who { flex: 1; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank li .pts { font-weight: 950; }
.rank li.me { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent) inset; }

/* Selección de opciones */
.opts { display: grid; gap: 10px; margin-top: 12px; }
.opt { min-height: 56px; border-radius: 16px; border: 2px solid var(--line); background: rgba(255,255,255,.05); color: var(--fg);
  font: inherit; font-size: 17px; font-weight: 800; text-align: start; padding: 12px 16px; cursor: pointer; transition: transform .1s, border-color .2s, background .2s; }
.opt:active { transform: scale(.98); }
.opt.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.dots { display: flex; gap: 10px; justify-content: center; margin: 10px 0 4px; flex-wrap: wrap; }
.dot { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: transform .15s; box-shadow: 0 0 18px -2px currentColor; }
.dot.sel { border-color: #fff; transform: scale(1.15); }
.progress { height: 6px; border-radius: 9px; background: rgba(255,255,255,.1); overflow: hidden; margin: 6px 0 14px; }
.progress b { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; }

/* Varios */
.mute { position: fixed; top: 12px; right: 12px; z-index: 50; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(10,10,26,.7); color: #fff; font-size: 20px; cursor: pointer; backdrop-filter: blur(6px); }
[dir="rtl"] .mute { right: auto; left: 12px; }
.disc { font-size: 12px; color: var(--muted); text-align: center; margin-top: 26px; opacity: .8; }
.disc a { color: var(--muted); }
.social { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--muted); margin: 0 0 6px; }
.social .live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 1.4s infinite; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.vs .side { font-weight: 900; }
.vs .side .n { font-size: 38px; }
.vs .x { font-size: 28px; font-weight: 950; color: var(--accent2); animation: pulse 1s infinite; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #fff; color: var(--ink); font-weight: 900; padding: 12px 18px; border-radius: 999px; z-index: 60; animation: fadeUp .3s ease both; }
.gatebox { text-align: center; }
.spinner-dots { display: inline-flex; gap: 6px; }
.spinner-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent2); animation: bounce 1s infinite; }
.spinner-dots i:nth-child(2) { animation-delay: .15s; }
.spinner-dots i:nth-child(3) { animation-delay: .3s; }

@keyframes pop { 0% { transform: scale(.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeUp { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes sheen { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 22px -4px var(--accent); } 50% { box-shadow: 0 0 55px 4px var(--accent2); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.12); opacity: .75; } }
@keyframes breathe { 0%, 100% { transform: scale(.94); } 50% { transform: scale(1.06); } }
@keyframes ring { from { transform: scale(.85); opacity: .8; } to { transform: scale(1.5); opacity: 0; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
