@font-face {
  font-family: "Alan Sans";
  src: url("../Assets/Fonts/AlanSans.ttf") format("truetype");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  /* Guía de color de la marca */
  --lav: #B7A5D2;
  --lav-light: #E6D5FB;
  --ring: #E5D7F2;
  --pink: #EAA8B2;
  --rose: #CE6C82;
  --teal: #7FAFBE;
  --plum: #584B64;
  --white: #FFFFFF;
  --bg: var(--lav-light);
  --ink: var(--plum);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --beat: 0.8108s; /* 74 bpm */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%; min-height: 100%; margin: 0;
  background: var(--bg); color: var(--ink);
  font-family: "Alan Sans", ui-rounded, system-ui, sans-serif;
  overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
html { min-height: -webkit-fill-available; }
body { position: relative; min-height: 100dvh; }
/* iOS instalado: 100lvh es la altura real (misma receta que monoversario) */
@media (display-mode: standalone) {
  html, body { height: 100vh; min-height: 100vh; }
  @supports (height: 100lvh) { html, body { height: 100lvh; min-height: 100lvh; } }
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--rose); outline-offset: 4px; }

/* ── burbujas del fondo: mismo dibujo que las del juego ───────── */
.floaters { position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; transition: opacity 0.6s; }
body:has([data-screen="play"]) .floaters { opacity: 0; }
.floaters i {
  --s: 60px;
  position: absolute; bottom: calc(var(--s) * -1.4); width: var(--s); height: var(--s); border-radius: 50%;
  /* cuerpo lavanda + aro claro interior (84 % del radio) como en la plancha */
  background: radial-gradient(circle closest-side, var(--lav) 0 76%, var(--ring) 77% 87%, var(--lav) 88%);
  box-shadow: 0 calc(var(--s) * 0.06) 0 rgba(88, 75, 100, 0.12);
  opacity: 0.55;
  animation: rise 24s linear infinite;
}
/* brillo curvo + punto de luz */
.floaters i::after {
  content: ""; position: absolute; left: 22%; top: 22%; width: 56%; height: 56%; border-radius: 50%;
  border: calc(var(--s) * 0.075) solid transparent; border-top-color: #fff;
  transform: rotate(-58deg);
}
.floaters i::before { content: ""; position: absolute; left: 21%; top: 47%; width: 8%; height: 8%; border-radius: 50%; background: #fff; }
.floaters i:nth-child(1) { --s: 64px; left: 6%; animation-duration: 26s; }
.floaters i:nth-child(2) { --s: 96px; left: 70%; animation-duration: 34s; animation-delay: -10s; }
.floaters i:nth-child(3) { --s: 40px; left: 38%; animation-duration: 21s; animation-delay: -4s; }
.floaters i:nth-child(4) { --s: 50px; left: 86%; animation-duration: 28s; animation-delay: -18s; }
.floaters i:nth-child(5) { --s: 80px; left: 16%; animation-duration: 36s; animation-delay: -23s; }
.floaters i:nth-child(6) { --s: 56px; left: 54%; animation-duration: 30s; animation-delay: -14s; background: radial-gradient(circle closest-side, var(--pink) 0 76%, var(--rose) 77% 87%, var(--pink) 88%); }
.floaters i:nth-child(7) { --s: 44px; left: 28%; animation-duration: 25s; animation-delay: -8s; background: radial-gradient(circle closest-side, var(--teal) 0 76%, #D3E8EE 77% 87%, var(--teal) 88%); }
@keyframes rise { from { transform: translate(0, 0) rotate(0); } 50% { transform: translate(18px, -60vh) rotate(8deg); } to { transform: translate(-10px, -128vh) rotate(-4deg); } }

/* ── escena ──────────────────────────────────────────────────── */
.stage { position: absolute; inset: 0; width: min(100%, 480px); margin: 0 auto; z-index: 2; }
.screen {
  position: absolute; inset: 0; container-type: size;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.5s var(--ease), visibility 0s 0.5s;
}
.screen.on { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 0.5s var(--ease); }

/* ── botones ─────────────────────────────────────────────────── */
.btn-pill {
  border: 0; border-radius: 999px; background: var(--white); color: var(--lav);
  font-weight: 900; letter-spacing: 0.01em; line-height: 1;
  width: min(78%, 330px); height: clamp(50px, 8cqh, 72px); font-size: clamp(26px, 4.4cqh, 40px);
  box-shadow: 0 0.9cqh 0 -2px #d3c1ef, 0 1.8cqh 3.4cqh rgba(88, 75, 100, 0.14);
  transition: transform 0.18s var(--spring), box-shadow 0.18s;
  animation: nudge 2.6s var(--ease) infinite;
}
.btn-pill:active { transform: translateY(5px) scale(0.98); box-shadow: 0 3px 0 -2px #d3c1ef, 0 6px 14px rgba(88, 75, 100, 0.14); animation: none; }
.btn-pill.small { height: 50px; font-size: 20px; width: auto; padding: 0 32px; animation: none; box-shadow: 0 6px 0 -2px #d3c1ef; }
@keyframes nudge { 0%, 70%, 100% { transform: scale(1); } 78% { transform: scale(1.05); } 86% { transform: scale(0.985); } }
.link { background: none; border: 0; color: var(--plum); opacity: 0.6; font-weight: 700; font-size: clamp(13px, 1.9cqh, 15px); letter-spacing: 0.04em; padding: 6px 16px; }

/* ── SPLASH ──────────────────────────────────────────────────── */
#splash img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.splash-kongi { width: min(34%, 170px); opacity: 0; animation: kongi 1.5s var(--ease) forwards; }
.splash-logo { width: min(66%, 340px); opacity: 0; animation: logoIn 1.1s var(--spring) 1.45s forwards; }
@keyframes kongi { 0% { opacity: 0; transform: translate(-50%, -46%) scale(0.92); } 30%, 72% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -52%) scale(1.02); } }
@keyframes logoIn { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); } 60% { opacity: 1; } 100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); } }

/* ── HOME: posiciones medidas sobre el mock (1138×2000) ──────── */
#home > * { position: absolute; left: 50%; transform: translateX(-50%); }
.logo-wrap { top: 23%; width: min(64%, 46cqh, 330px); }
.home-start { top: 50.5%; width: min(53%, 34cqh, 300px); height: clamp(46px, 7.7cqh, 68px); font-size: clamp(24px, 4.1cqh, 36px); }
.home-start:active { transform: translateX(-50%) translateY(5px) scale(0.98); }
#home .home-start { animation: nudgeX 2.6s var(--ease) infinite; }
@keyframes nudgeX { 0%, 70%, 100% { transform: translateX(-50%) scale(1); } 78% { transform: translateX(-50%) scale(1.05); } 86% { transform: translateX(-50%) scale(0.985); } }
.gear { top: 61.5%; width: clamp(34px, 5.2cqh, 48px); height: clamp(34px, 5.2cqh, 48px); border: 0; background: none; padding: 0; transition: transform 0.4s var(--spring); }
.gear img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 8px rgba(88, 75, 100, 0.12)); }
.gear:active { transform: translateX(-50%) rotate(60deg) scale(0.92); }
.progress-row { top: 69%; display: flex; flex-direction: column; align-items: center; gap: 0.9cqh; width: 90%; }
/* nubecita: qué desbloqueas y en qué nivel */
.cloud {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--white); color: var(--plum); border-radius: 18px; padding: 0.8cqh 14px 0.9cqh;
  box-shadow: 0 4px 0 -1px #d3c1ef; font-size: clamp(10px, 1.45cqh, 12px); font-weight: 700; line-height: 1.15;
  animation: bob 3.2s ease-in-out infinite;
}
.cloud::before, .cloud::after { content: ""; position: absolute; border-radius: 50%; background: var(--white); }
.cloud::before { width: 22px; height: 22px; left: -7px; top: -6px; }
.cloud::after { width: 28px; height: 28px; right: -9px; top: -9px; }
.cloud b { position: relative; z-index: 1; font-size: clamp(12px, 1.85cqh, 15px); font-weight: 900; color: var(--rose); }
.cloud span { position: relative; z-index: 1; opacity: 0.7; }
.cloud i.tail { position: absolute; bottom: -7px; left: 50%; width: 14px; height: 14px; background: var(--white); transform: translateX(-50%) rotate(45deg); border-radius: 3px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.level-pill { display: flex; align-items: center; gap: 8px; height: clamp(26px, 3.6cqh, 32px); padding: 0 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.7); font-size: clamp(12px, 1.7cqh, 14px); font-weight: 800; }
.mini-bar { display: inline-block; width: 46px; height: 6px; border-radius: 9px; background: rgba(183, 165, 210, 0.45); overflow: hidden; }
.mini-bar i { display: block; height: 100%; width: 0; background: var(--rose); border-radius: inherit; transition: width 0.6s var(--ease); }
.meta-row { display: flex; gap: 10px; font-size: clamp(10px, 1.45cqh, 12px); font-weight: 700; opacity: 0.75; }
.meta-row .done { color: var(--rose); opacity: 1; }
.studio-logo { top: 87%; width: min(18%, 74px); }
.version { top: 93.4%; color: var(--white); font-size: clamp(11px, 1.6cqh, 13px); font-weight: 600; letter-spacing: 0.04em; }

/* ── LOGO ANIMADO (capas del SVG) ────────────────────────────── */
.logo-svg { width: 100%; height: auto; display: block; overflow: visible; }
.logo-svg * { transform-box: fill-box; transform-origin: center; }
#home.on #lg-Logo_whole { animation: logoEnter 0.9s var(--spring) both, float 4.2s ease-in-out 0.9s infinite; }
@keyframes logoEnter { 0% { transform: scale(0.55) rotate(-4deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-0.8deg); } }
#home.on #lg-headphone_ornament { transform-origin: 60% 100%; animation: bop var(--beat) ease-in-out infinite; }
@keyframes bop { 0%, 100% { transform: rotate(0) translateY(0); } 18% { transform: rotate(-4deg) translateY(-2px); } 50% { transform: rotate(1.5deg) translateY(0); } }
#home.on #lg-left_headphone_filling, #home.on #lg-right_headphone_filling { animation: cup var(--beat) ease-in-out infinite; }
@keyframes cup { 0%, 100% { opacity: 1; } 15% { opacity: 0.7; } }
#home.on [id^="lg-line_"] { animation: eq 0.6s ease-in-out infinite alternate; }
#home.on #lg-line_1 { animation-duration: 0.47s; } #home.on #lg-line_2 { animation-duration: 0.71s; animation-delay: -0.2s; }
#home.on #lg-line_3 { animation-duration: 0.53s; animation-delay: -0.4s; } #home.on #lg-line_4 { animation-duration: 0.81s; }
#home.on #lg-line_5 { animation-duration: 0.44s; animation-delay: -0.3s; } #home.on #lg-line_6 { animation-duration: 0.66s; animation-delay: -0.1s; }
#home.on #lg-line_7 { animation-duration: 0.58s; animation-delay: -0.5s; }
@keyframes eq { from { transform: scaleY(0.35); } to { transform: scaleY(1.15); } }
#home.on #lg-_3_accent_lines_ornament > * { animation: zap calc(var(--beat) * 2) ease-out infinite; }
#home.on #lg-_3_accent_lines_ornament > *:nth-child(2) { animation-delay: 0.08s; }
#home.on #lg-_3_accent_lines_ornament > *:nth-child(3) { animation-delay: 0.16s; }
@keyframes zap { 0% { opacity: 0.25; transform: scale(0.7); } 12% { opacity: 1; transform: scale(1.15); } 40%, 100% { opacity: 1; transform: scale(1); } }
#home.on #lg-first_L, #home.on #lg-O1, #home.on #lg-first_F, #home.on #lg-first_I, #home.on #lg-first_P, #home.on #lg-O2, #home.on #lg-second_P, #home.on #lg-exclamation_mark { animation: hop calc(var(--beat) * 4) var(--ease) infinite; }
#home.on #lg-O1 { animation-delay: 0.07s; } #home.on #lg-first_F { animation-delay: 0.14s; } #home.on #lg-first_I { animation-delay: 0.21s; }
#home.on #lg-first_P { animation-delay: 0.28s; } #home.on #lg-O2 { animation-delay: 0.35s; } #home.on #lg-second_P { animation-delay: 0.42s; }
#home.on #lg-exclamation_mark { animation-name: hopWiggle; animation-delay: 0.49s; transform-origin: 50% 100%; }
@keyframes hop { 0%, 22%, 100% { transform: translateY(0); } 8% { transform: translateY(-9%) scale(1.04, 0.97); } 15% { transform: translateY(1%) scale(0.98, 1.03); } }
@keyframes hopWiggle { 0%, 30%, 100% { transform: rotate(0); } 8% { transform: translateY(-8%) rotate(10deg); } 16% { transform: rotate(-8deg); } 23% { transform: rotate(4deg); } }
#home.on #lg-first_O_filling { animation: squish calc(var(--beat) * 4) var(--spring) infinite 1.6s; }
#home.on #lg-second_O_filling { animation: squish calc(var(--beat) * 4) var(--spring) infinite 2.4s; }
@keyframes squish { 0%, 40%, 100% { transform: scale(1); } 46% { transform: scale(1.14, 0.9); } 52% { transform: scale(0.92, 1.08); } 58% { transform: scale(1.03); } }
#home.on [id^="lg-glow"] { animation: twinkle 2.8s ease-in-out infinite; }
#home.on #lg-glow-2 { animation-delay: -0.6s; } #home.on #lg-glow-3 { animation-delay: -1.2s; } #home.on #lg-glow-4 { animation-delay: -1.8s; } #home.on #lg-glow-5 { animation-delay: -2.3s; }
#home.on #lg-glow_curve, #home.on #lg-glow_curve-2 { animation: none; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
#home.on #lg-purple_bubbles_backing { animation: breathe calc(var(--beat) * 2) ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.012); } }

/* ── JUEGO ───────────────────────────────────────────────────── */
#play { justify-content: flex-start; }
#field { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.hud { position: absolute; z-index: 3; left: 0; right: 0; top: calc(10px + var(--safe-top)); padding: 0 16px; pointer-events: none; }
.hud-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.time { justify-self: start; display: flex; align-items: baseline; gap: 3px; background: var(--white); color: var(--teal); border-radius: 99px; padding: 6px 12px; min-width: 70px; box-shadow: 0 4px 0 -1px rgba(183, 165, 210, 0.5); }
.time b { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.time small { font-size: 11px; font-weight: 700; opacity: 0.8; }
.time.hurry { background: var(--rose); color: var(--white); animation: hurry 1s var(--spring) infinite; }
@keyframes hurry { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.12); } }
.time.bonus { animation: bonus 0.5s var(--spring); }
@keyframes bonus { 40% { transform: scale(1.25); background: var(--teal); color: var(--white); } }
.score { text-align: center; line-height: 1; }
.score b { display: block; font-size: 40px; font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--plum); text-shadow: 0 3px 0 var(--white); }
.score b.bump { animation: bump 0.22s var(--spring); }
@keyframes bump { 50% { transform: scale(1.1); } }
.score small { display: block; margin-top: 4px; font-size: 11px; font-weight: 700; opacity: 0.55; letter-spacing: 0.06em; }
.mult { justify-self: end; min-width: 54px; text-align: center; background: var(--white); color: var(--lav); border-radius: 99px; padding: 6px 10px; font-size: 22px; font-weight: 900; box-shadow: 0 4px 0 -1px rgba(183, 165, 210, 0.5); transition: background 0.2s, color 0.2s; }
.mult[data-m="2"] { color: var(--teal); } .mult[data-m="3"] { color: var(--rose); }
.mult[data-m="4"], .mult[data-m="6"], .mult[data-m="8"] { background: var(--rose); color: var(--white); }
.mult.bump { animation: bump 0.3s var(--spring); }
.groove { position: relative; margin: 12px auto 0; width: 78%; height: 16px; border-radius: 99px; background: rgba(255, 255, 255, 0.7); overflow: hidden; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9); }
.groove i { position: absolute; inset: 0; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--teal), var(--lav) 55%, var(--pink)); border-radius: inherit; }
.groove span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 900; letter-spacing: 0.22em; color: var(--plum); opacity: 0.55; }
.fever .groove i { background: linear-gradient(90deg, var(--rose), var(--pink), var(--rose)); background-size: 200% 100%; animation: shimmer 0.8s linear infinite; }
.fever .groove span { color: var(--white); opacity: 1; }
@keyframes shimmer { to { background-position: -200% 0; } }
/* metrónomo: 4 puntos, el del pulso actual se enciende */
.beats { display: flex; justify-content: center; gap: 10px; margin-top: 9px; }
.beats i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.75); box-shadow: inset 0 0 0 2px rgba(183, 165, 210, 0.6); transition: transform 0.08s, background 0.08s; }
.beats i.on { background: var(--teal); box-shadow: none; transform: scale(1.45); }
.beats i:first-child.on { background: var(--rose); }
.fever .beats i.on { background: var(--rose); }
.beats.demo { margin: 0 0 16px; }
.beats.demo i { animation: demo calc(var(--beat) * 4) steps(1) infinite; }
.beats.demo i:nth-child(2) { animation-delay: var(--beat); } .beats.demo i:nth-child(3) { animation-delay: calc(var(--beat) * 2); } .beats.demo i:nth-child(4) { animation-delay: calc(var(--beat) * 3); }
@keyframes demo { 0% { background: var(--teal); transform: scale(1.45); } 25%, 100% { background: rgba(183, 165, 210, 0.35); transform: scale(1); } }
.combo { margin-top: 6px; text-align: center; font-size: 15px; font-weight: 900; letter-spacing: 0.08em; color: var(--plum); min-height: 20px; }
.combo.bump { animation: bump 0.18s var(--spring); }
.combo.lost { color: var(--rose); animation: lost 0.5s ease; }
@keyframes lost { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-2px); } }
[data-theme-dark] .score b, [data-theme-dark] .combo, [data-theme-dark] .groove span { color: var(--lav-light); text-shadow: none; }

.toast { position: absolute; z-index: 5; left: 0; right: 0; top: 42%; text-align: center; pointer-events: none; font-weight: 900; font-size: 46px; letter-spacing: -0.01em; color: var(--white); text-shadow: 0 4px 0 var(--rose), 0 8px 24px rgba(88, 75, 100, 0.3); opacity: 0; }
.toast.show { animation: toast 1.1s var(--spring) forwards; }
.toast.teal { text-shadow: 0 4px 0 var(--teal), 0 8px 24px rgba(88, 75, 100, 0.3); }
.toast.plum { text-shadow: 0 4px 0 var(--plum), 0 8px 24px rgba(88, 75, 100, 0.3); }
.toast.small { font-size: 26px; }
@keyframes toast { 0% { opacity: 0; transform: scale(0.4); } 18% { opacity: 1; transform: scale(1.08); } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px) scale(1); } }

.tip { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(88, 75, 100, 0.28); padding: 24px; }
.tip-card { background: var(--white); border-radius: 28px; padding: 26px 24px 22px; max-width: 340px; text-align: center; box-shadow: 0 20px 50px rgba(88, 75, 100, 0.25); animation: logoEnter 0.5s var(--spring) both; }
.tip-card > b { font-size: 24px; font-weight: 900; }
.tip-card p { font-size: 15px; line-height: 1.45; margin: 10px 0 16px; opacity: 0.85; }
.tip-card em, .legend em { font-style: normal; font-weight: 800; color: var(--rose); }

.legend { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 9px; text-align: left; font-size: 14px; font-weight: 600; }
.legend li { display: flex; align-items: center; gap: 10px; line-height: 1.3; }
.legend li.locked { opacity: 0.45; }
.legend small { font-size: 11px; font-weight: 800; color: var(--rose); margin-left: 4px; }
.dot { flex: none; width: 24px; height: 24px; border-radius: 50%; position: relative; background: radial-gradient(circle closest-side, var(--c, var(--lav)) 0 74%, var(--r, var(--ring)) 75% 86%, var(--c, var(--lav)) 87%); }
.dot::after { content: ""; position: absolute; left: 20%; top: 20%; width: 58%; height: 58%; border-radius: 50%; border: 2px solid transparent; border-top-color: #fff; transform: rotate(-58deg); }
.dot.pink { --c: var(--pink); --r: var(--rose); } .dot.clock { --c: var(--plum); --r: var(--lav); } .dot.chain { --c: var(--teal); --r: #D3E8EE; }
.dot.ice { --c: #DDF0F6; --r: #fff; box-shadow: inset 0 0 0 2px var(--teal); } .dot.metal { --c: #B9B1C6; --r: #E8E3EF; box-shadow: inset 0 0 0 2px var(--plum); }
.dot.row { --c: var(--lav); background-image: linear-gradient(transparent 30%, #fff 30% 40%, transparent 40% 60%, #fff 60% 70%, transparent 70%); } .dot.gift { --c: var(--rose); --r: var(--pink); }

#stage.fever .score b { color: var(--rose); }
#stage.fever .mult { background: var(--rose); color: var(--white); }

/* ── RESULTADOS: todo en una pantalla ────────────────────────── */
#results { justify-content: center; }
.res { width: min(92%, 420px); height: 100%; padding: calc(var(--safe-top) + 2.2cqh) 0 calc(var(--safe-bottom) + 1.6cqh); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(5px, 1.3cqh, 12px); }
.res-kicker { margin: 0; font-size: clamp(10px, 1.5cqh, 12px); font-weight: 900; letter-spacing: 0.24em; opacity: 0.6; }
.res-score b { display: block; font-size: clamp(40px, 8.4cqh, 76px); font-weight: 900; letter-spacing: -0.03em; line-height: 1; color: var(--plum); text-shadow: 0 4px 0 var(--white); font-variant-numeric: tabular-nums; }
.res-best { margin: 0; min-height: 1.4em; font-size: clamp(12px, 1.8cqh, 15px); font-weight: 700; }
.res-best.record { padding: 0.5cqh 14px; border-radius: 99px; background: var(--rose); color: var(--white); animation: logoEnter 0.6s var(--spring) both; }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.res-stats div { background: rgba(255, 255, 255, 0.62); border-radius: 16px; padding: 0.9cqh 4px; text-align: center; }
.res-stats b { display: block; font-size: clamp(18px, 2.9cqh, 24px); font-weight: 900; }
.res-stats small { font-size: clamp(10px, 1.35cqh, 11px); font-weight: 700; opacity: 0.65; }
.card { width: 100%; background: var(--white); border-radius: 20px; padding: 1.4cqh 16px; box-shadow: 0 5px 0 -2px #d3c1ef; }
.card-title { margin: 0 0 0.8cqh; font-size: clamp(10px, 1.4cqh, 12px); font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.55; }
.xp-head { display: flex; justify-content: space-between; align-items: baseline; }
.xp-head b { font-size: clamp(15px, 2.2cqh, 18px); font-weight: 900; }
.xp-head span { font-size: clamp(12px, 1.7cqh, 14px); font-weight: 800; color: var(--teal); }
.xp-bar { height: 12px; border-radius: 99px; background: var(--lav-light); margin: 0.8cqh 0; overflow: hidden; }
.xp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--lav), var(--rose)); border-radius: inherit; }
.xp-next { margin: 0; font-size: clamp(11px, 1.6cqh, 13px); font-weight: 700; opacity: 0.8; }
.xp-next b { color: var(--rose); }
.missions ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9cqh; }
.missions li { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center; font-size: clamp(12px, 1.7cqh, 14px); font-weight: 700; }
.missions li span { font-size: clamp(10px, 1.5cqh, 12px); font-weight: 800; opacity: 0.6; }
.missions li i { grid-column: 1 / -1; height: 5px; border-radius: 9px; background: var(--lav-light); overflow: hidden; }
.missions li i u { display: block; height: 100%; width: 0; background: var(--teal); border-radius: inherit; transition: width 0.9s var(--ease) 0.3s; }
.missions li.done { color: var(--teal); }
.missions li.done span { opacity: 1; }
.missions li.fresh { animation: bump 0.5s var(--spring) 0.6s; }
#again { margin-top: 0.6cqh; }
/* celebración de desbloqueos */
.unlock-layer { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(88, 75, 100, 0.35); padding: 24px; }
.unlock-card { width: min(100%, 320px); background: var(--white); border-radius: 30px; padding: 26px 22px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 24px 60px rgba(88, 75, 100, 0.3); animation: unlockIn 0.6s var(--spring) both; }
.unlock-card small { font-size: 12px; font-weight: 900; letter-spacing: 0.22em; color: var(--rose); }
.unlock-icon { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-size: 42px; color: var(--white); animation: spinIn 0.9s var(--spring) both 0.1s; }
.unlock-icon .dot { width: 92px; height: 92px; }
.unlock-icon .dot::after { border-width: 6px; }
.unlock-card b { font-size: 24px; font-weight: 900; }
.unlock-card p { margin: 0 0 8px; font-size: 15px; font-weight: 600; opacity: 0.7; }
@keyframes unlockIn { 0% { opacity: 0; transform: scale(0.6) rotate(-3deg); } 100% { opacity: 1; transform: none; } }
@keyframes spinIn { 0% { transform: scale(0) rotate(-120deg); } 100% { transform: none; } }

/* ── AJUSTES ─────────────────────────────────────────────────── */
.sheet { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; background: rgba(88, 75, 100, 0.3); }
.sheet-card { width: 100%; max-height: 90%; overflow-y: auto; background: var(--white); border-radius: 30px 30px 0 0; padding: 20px 22px calc(24px + var(--safe-bottom)); animation: sheetUp 0.4s var(--ease); }
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.sheet-head b { font-size: 24px; font-weight: 900; }
.x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--lav-light); font-size: 24px; line-height: 1; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--lav-light); font-size: 17px; font-weight: 700; }
.row input[type="checkbox"] { width: 46px; height: 28px; accent-color: var(--rose); }
.seg { display: flex; background: var(--lav-light); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-weight: 900; font-size: 14px; color: var(--plum); opacity: 0.6; }
.seg button.sel { background: var(--white); opacity: 1; color: var(--rose); box-shadow: 0 2px 0 #d3c1ef; }
.sheet .card-title { margin-top: 16px; }
.themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.theme { position: relative; aspect-ratio: 1; border-radius: 18px; border: 3px solid transparent; display: grid; place-items: center; padding: 0; box-shadow: inset 0 0 0 1px rgba(88, 75, 100, 0.08); }
.theme i { width: 54%; height: 54%; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.7); }
.theme.sel { border-color: var(--rose); }
.theme.locked i { opacity: 0.3; }
.theme small { position: absolute; bottom: 3px; left: 0; right: 0; font-size: 9px; font-weight: 900; text-align: center; }
.theme-name { margin: 6px 0 0; font-size: 12px; font-weight: 700; opacity: 0.6; text-align: center; }
.noises { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.noise { border: 0; border-radius: 12px; padding: 9px 4px; font-size: 13px; font-weight: 800; background: var(--lav-light); color: var(--plum); display: flex; align-items: center; justify-content: center; gap: 6px; }
.noise i { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(88, 75, 100, 0.25); }
.noise.sel { background: var(--plum); color: var(--white); }
.vol { display: flex; align-items: center; gap: 12px; padding: 12px 0 2px; font-size: 14px; font-weight: 700; }
.vol input { flex: 1; accent-color: var(--rose); }

/* háptica iOS: interruptores reales invisibles sobre cada burbuja */
.hx-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.hx { position: absolute; margin: 0; padding: 0; transform-origin: 0 0; opacity: 0.02; border-radius: 50%; pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent; }

.diag { position: fixed; z-index: 99; left: 10px; right: 10px; top: calc(60px + var(--safe-top)); padding: 12px 14px; border-radius: 14px; background: rgba(40, 30, 50, 0.92); color: #fff; font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; -webkit-user-select: text; user-select: text; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* botones dentro de tarjetas blancas: rosa para que se distingan */
.tip-card .btn-pill, .unlock-card .btn-pill { background: var(--rose); color: var(--white); box-shadow: 0 6px 0 -2px #a8566a; }
[data-theme-dark] .score small { color: var(--lav-light); opacity: 0.7; }

/* Variante de marca nicosavestheworld (build: npm run build -- nstw). El logo es muy horizontal. */
.brand-nstw .splash-kongi { width: min(66%, 320px); }
.brand-nstw .studio-logo { top: 88.5%; width: min(36%, 150px); }

/* la capa háptica (interruptores invisibles) solo existe durante la ronda: nunca puede tapar botones */
#play:not(.on) .hx-layer { display: none !important; }
