:root {
  --fondo: #03040d;
  --texto: #eef1ff;
  --suave: #9aa3c7;
  --tenue: #5d6690;
  --vidrio: rgba(10, 13, 32, 0.62);
  --borde: rgba(160, 175, 255, 0.14);
  --c0: #36f1cd;
  --c1: #b388ff;
  --c2: #ff5d8f;
  --c3: #ffc94a;
  --oro: #ffc94a;
  --display: 'Unbounded', system-ui, sans-serif;
  --ui: 'Outfit', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--fondo); color: var(--texto); font-family: var(--ui); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
.oculta { display: none !important; }

#lienzo { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#velo {
  position: fixed; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(3, 4, 13, 0.88) 0%, rgba(3, 4, 13, 0.55) 34%, rgba(3, 4, 13, 0) 62%);
  transition: opacity 0.6s ease;
}
body.jugando #velo { opacity: 0; }

/* ------------------------------------------------------------ pantallas */
.pantalla { position: fixed; inset: 0; z-index: 10; overflow-y: auto; }
.pantalla.centro { display: grid; place-items: center; padding: 16px; background: rgba(3, 4, 13, 0.45); backdrop-filter: blur(3px); }

.menu-col {
  width: min(480px, 100%); min-height: 100%;
  padding: clamp(20px, 5vh, 56px) clamp(16px, 4vw, 56px);
  display: flex; flex-direction: column; gap: 22px;
}
.marca h1 {
  font-family: var(--display); font-weight: 900; letter-spacing: -0.02em; text-transform: uppercase;
  font-size: clamp(44px, 7.5vw, 70px); line-height: 0.95; margin: 0;
  background: linear-gradient(100deg, var(--c0) 0%, var(--c1) 45%, var(--c2) 80%, var(--c3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(179, 136, 255, 0.35));
}
.marca p { margin: 10px 0 0; color: var(--suave); font-size: 18px; font-weight: 300; letter-spacing: 0.01em; }

.zona-subir {
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; border-radius: 18px; cursor: pointer;
  background: linear-gradient(135deg, rgba(54, 241, 205, 0.12), rgba(179, 136, 255, 0.10));
  border: 1.5px dashed rgba(54, 241, 205, 0.45);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.zona-subir:hover { transform: translateY(-2px); border-color: var(--c0); background: linear-gradient(135deg, rgba(54, 241, 205, 0.2), rgba(179, 136, 255, 0.16)); }
.zona-subir input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.icono-subir {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--c0) 0 22%, transparent 23%), conic-gradient(from 0deg, var(--c0), var(--c1), var(--c2), var(--c3), var(--c0));
  box-shadow: 0 0 22px rgba(54, 241, 205, 0.45);
  mask: radial-gradient(circle, transparent 0 34%, #000 35%);
  -webkit-mask: radial-gradient(circle, #000 0 22%, transparent 23% 34%, #000 35%);
  animation: girar 6s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
.zona-texto { display: flex; flex-direction: column; gap: 3px; }
.zona-texto strong { font-size: 18px; font-weight: 600; }
.zona-texto small { color: var(--suave); font-size: 14px; line-height: 1.35; }

.fila-opciones { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dificultad { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--vidrio); border: 1px solid var(--borde); backdrop-filter: blur(8px); }
.dificultad button { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--suave); transition: all 0.2s ease; }
.dificultad button:hover { color: var(--texto); }
.dificultad button.activa { background: var(--texto); color: #0b0e22; box-shadow: 0 0 18px rgba(238, 241, 255, 0.35); }
.btn-icono { border: 1px solid var(--borde); background: var(--vidrio); padding: 9px 14px; border-radius: 999px; font-size: 14px; color: var(--suave); backdrop-filter: blur(8px); }
.btn-icono:hover { color: var(--texto); }

.estado-ia { margin: -8px 0 0; font-size: 13px; color: var(--tenue); display: flex; align-items: center; gap: 8px; }
.estado-ia::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--tenue); flex: none; }
.estado-ia.activa { color: var(--suave); }
.estado-ia.activa::before { background: var(--c0); box-shadow: 0 0 10px var(--c0); }
.motor { margin: -10px 0 14px; font-size: 13px; color: var(--tenue); }
.motor.ia { color: var(--c0); }
.biblioteca h2 { font-family: var(--display); font-size: 13px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--tenue); margin: 0 0 10px; }
.vacia { color: var(--tenue); margin: 0; font-size: 15px; }
#lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#lista li { display: flex; gap: 6px; }
.cancion {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--borde); background: var(--vidrio); backdrop-filter: blur(8px);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.cancion:hover { transform: translateX(4px); border-color: rgba(54, 241, 205, 0.5); }
.cancion .play { flex: none; width: 32px; height: 32px; border-radius: 50%; background: rgba(54, 241, 205, 0.14); position: relative; }
.cancion .play::after { content: ''; position: absolute; left: 12px; top: 9px; border-left: 11px solid var(--c0); border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.cancion .datos { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cancion .datos strong { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cancion .datos small { color: var(--suave); font-size: 13px; }
.medallas { display: flex; gap: 4px; flex: none; }
.medalla { font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--suave); }
.medalla.nota-S { background: rgba(255, 201, 74, 0.2); color: var(--oro); }
.medalla.nota-A { background: rgba(54, 241, 205, 0.16); color: var(--c0); }
.borrar { flex: none; width: 40px; border-radius: 14px; border: 1px solid var(--borde); background: var(--vidrio); color: var(--tenue); font-size: 13px; transition: all 0.15s ease; }
.borrar:hover { color: var(--c2); }
.borrar.confirmar { width: auto; padding: 0 10px; color: var(--c2); border-color: rgba(255, 93, 143, 0.5); }

.ayuda { margin-top: auto; color: var(--tenue); font-size: 14px; line-height: 1.45; }
.ayuda p { margin: 10px 0 0; }
.ayuda b { color: var(--suave); font-weight: 500; }
.teclas { display: flex; gap: 8px; }
.tecla { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--borde); background: var(--vidrio); font-weight: 600; font-size: 14px; color: var(--texto); }
.tecla svg { width: 14px; height: 14px; }
.teclas { flex-wrap: wrap; }
.tecla b { font-weight: 600; }
.tecla b:empty { display: none; }
.tecla.r2t strong { font-family: var(--display); font-weight: 900; font-size: 12px; }
.tecla.r2t b { color: var(--suave); font-weight: 500; }
.c0 svg { fill: var(--c0); } .c1 svg { fill: var(--c1); } .c2 svg { fill: var(--c2); } .c3 svg { fill: var(--c3); }

/* ------------------------------------------------------------ tarjetas */
.tarjeta {
  width: min(560px, 100%); padding: clamp(22px, 4vw, 34px); border-radius: 24px;
  background: rgba(9, 11, 28, 0.78); border: 1px solid var(--borde); backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: entrar 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes entrar { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.tarjeta h2 { font-family: var(--display); font-weight: 700; font-size: clamp(22px, 4vw, 30px); margin: 4px 0 6px; line-height: 1.15; word-break: break-word; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--c0); font-weight: 600; }
.meta { margin: 0 0 16px; color: var(--suave); }
.paso { color: var(--suave); margin: 10px 0 0; min-height: 1.2em; }

.barra { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 18px; }
#carga-barra { height: 100%; transform-origin: left; transform: scaleX(0.02); background: linear-gradient(90deg, var(--c0), var(--c1), var(--c2)); transition: transform 0.25s ease; box-shadow: 0 0 14px var(--c1); }

#previa-curva { width: 100%; height: 120px; display: block; border-radius: 12px; background: rgba(255, 255, 255, 0.03); }
.leyenda { font-size: 12.5px; color: var(--tenue); margin: 8px 0 18px; }
.punto-subidon { display: inline-block; width: 2px; height: 10px; background: var(--oro); vertical-align: -1px; margin-right: 4px; }
.record { color: var(--oro); font-size: 14px; min-height: 1.2em; margin: 12px 0 0; }

.acciones { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.acciones.vertical { flex-direction: column; align-items: stretch; }
.btn-pri, .btn-sec { border-radius: 999px; padding: 12px 22px; font-weight: 600; font-size: 15px; border: 0; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.btn-pri { background: linear-gradient(100deg, var(--c0), var(--c1)); color: #071019; box-shadow: 0 6px 24px rgba(54, 241, 205, 0.35); }
.btn-pri:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgba(54, 241, 205, 0.5); }
.btn-sec { background: rgba(255, 255, 255, 0.07); color: var(--texto); border: 1px solid var(--borde); }
.btn-sec:hover { background: rgba(255, 255, 255, 0.12); }
.btn-sec.chico { padding: 7px 14px; font-size: 13px; }

.pausa { width: min(340px, 100%); text-align: center; }

.resultados { text-align: center; }
.nota-grande {
  font-family: var(--display); font-weight: 900; font-size: clamp(90px, 18vw, 140px); line-height: 1; margin: 8px 0 0;
  background: linear-gradient(160deg, #fff 10%, var(--c1) 60%, var(--c2)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(179, 136, 255, 0.55));
  animation: sello 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.nota-grande[data-nota='S'] { background-image: linear-gradient(160deg, #fff 10%, var(--oro) 55%, var(--c2)); filter: drop-shadow(0 0 34px rgba(255, 201, 74, 0.6)); }
@keyframes sello { from { transform: scale(2.2); opacity: 0; } }
.sello { color: var(--oro); font-weight: 600; min-height: 1.2em; margin: 4px 0 14px; }
.cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cifras div { padding: 12px 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); display: flex; flex-direction: column; gap: 2px; }
.cifras small { color: var(--suave); font-size: 12px; }
.cifras strong { font-size: clamp(17px, 3.4vw, 22px); font-weight: 700; }
.desglose { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 14px; color: var(--suave); }
.desglose b { color: var(--texto); }
.j-perfecto b { color: var(--c0); } .j-genial b { color: var(--c1); } .j-bien b { color: var(--c3); } .j-fallo b { color: #8a8fa8; }
.resultados .acciones { justify-content: center; }

.ajustes .campo { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.ajustes .campo > span { font-weight: 600; }
.ajustes em { font-style: normal; color: var(--c0); font-weight: 500; margin-left: 6px; }
.ayuda-campo { margin: 0; color: var(--suave); font-size: 13.5px; line-height: 1.4; }
.fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input[type='range'] { width: 100%; accent-color: var(--c0); }

.calibrar { text-align: center; }
.calib-boton {
  width: 120px; height: 120px; margin: 22px auto 0; display: block; border-radius: 50%;
  border: 2px solid var(--c0); background: radial-gradient(circle, rgba(54, 241, 205, 0.25), rgba(54, 241, 205, 0.04) 70%);
  box-shadow: 0 0 30px rgba(54, 241, 205, 0.3);
}
.calib-boton.golpe { animation: toque 0.25s ease-out; }
@keyframes toque { from { transform: scale(0.88); box-shadow: 0 0 60px rgba(54, 241, 205, 0.8); } }
.calibrar .acciones { justify-content: center; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.hud-arriba { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; gap: 16px; padding: 16px clamp(16px, 3vw, 28px); }
.hud-cancion { flex: 1; min-width: 0; max-width: 420px; }
#hud-titulo { display: block; font-size: 13px; color: var(--suave); letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.hud-progreso { position: relative; height: 26px; }
#hud-curva { width: 100%; height: 100%; display: block; opacity: 0.75; }
.hud-cabezal-pista { position: absolute; inset: 0; }
#hud-cabezal { position: absolute; inset: 0; will-change: transform; }
#hud-cabezal i { position: absolute; left: 0; top: -3px; bottom: -3px; width: 2px; background: #fff; box-shadow: 0 0 10px #fff; }
.hud-puntaje { margin-left: auto; text-align: right; display: flex; align-items: baseline; gap: 10px; }
#hud-puntos { font-family: var(--display); font-weight: 700; font-size: clamp(22px, 3.4vw, 34px); font-variant-numeric: tabular-nums; text-shadow: 0 0 18px rgba(255, 255, 255, 0.35); }
#hud-mult { font-family: var(--display); font-weight: 700; font-size: 16px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: var(--suave); transition: all 0.2s ease; }
#hud-mult[data-nivel='2'], #hud-mult[data-nivel='3'] { color: var(--c0); background: rgba(54, 241, 205, 0.16); }
#hud-mult[data-nivel='4'], #hud-mult[data-nivel='5'] { color: var(--c1); background: rgba(179, 136, 255, 0.2); }
#hud-mult[data-nivel='6'], #hud-mult[data-nivel='7'] { color: var(--c2); background: rgba(255, 93, 143, 0.2); }
#hud-mult[data-nivel='8'] { color: #1a1200; background: var(--oro); box-shadow: 0 0 20px var(--oro); }
.btn-pausa { pointer-events: auto; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--borde); background: rgba(9, 11, 28, 0.5); color: var(--suave); font-size: 11px; letter-spacing: -2px; flex: none; }

.mult-caja { display: inline-flex; flex-direction: column; align-items: stretch; gap: 4px; }
.mult-pista { display: block; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
#hud-mult-barra { display: block; height: 100%; background: linear-gradient(90deg, var(--c0), var(--c1), var(--c2)); transform-origin: left; transform: scaleX(0); transition: transform 0.12s ease-out; }
#hud-mult.sube { animation: sube 0.45s cubic-bezier(0.2, 1.8, 0.4, 1); }
@keyframes sube { from { transform: scale(1.9); filter: brightness(2.2); } }

#hud-efecto { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: 0.14em; padding: 7px 16px 8px; border-radius: 999px; background: rgba(9, 11, 28, 0.6); border: 1px solid var(--col); color: var(--col); text-shadow: 0 0 12px var(--col); box-shadow: 0 0 24px color-mix(in srgb, var(--col) 45%, transparent); --col: var(--oro); }
#hud-efecto[data-tipo='lento'] { --col: #8fdcff; }
.efecto-pista { display: block; width: 130px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
#hud-efecto-barra { display: block; height: 100%; background: var(--col); transform-origin: left; }

#hud-hito { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); text-align: center; opacity: 0; pointer-events: none; --col: #fff; }
#hud-hito strong { display: block; font-family: var(--display); font-weight: 900; font-size: clamp(26px, 4.4vw, 52px); line-height: 1; letter-spacing: 0.02em; color: #fff; text-shadow: 0 0 30px var(--col), 0 0 70px var(--col); white-space: nowrap; }
#hud-hito small { display: block; margin-top: 6px; font-size: clamp(12px, 1.6vw, 16px); letter-spacing: 0.32em; text-transform: uppercase; color: var(--col); }
#hud-hito[data-tipo='turbo'], #hud-hito[data-tipo='fuego'], #hud-hito[data-tipo='hito'] { --col: var(--oro); }
#hud-hito[data-tipo='lento'] { --col: #8fdcff; }
#hud-hito[data-tipo='escudo'] { --col: #8dffb8; }
#hud-hito.mostrar { animation: hito 1.15s ease-out forwards; }
@keyframes hito { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.9); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 62% { opacity: 0.95; } 100% { opacity: 0; transform: translate(-50%, -70%) scale(1.03); } }

#hud-vel { position: absolute; left: clamp(16px, 3vw, 28px); top: 74px; display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 6px; --col: var(--suave); }
#hud-vel strong { font-family: var(--display); font-weight: 700; font-size: clamp(20px, 2.6vw, 30px); font-variant-numeric: tabular-nums; color: var(--texto); text-shadow: 0 0 16px color-mix(in srgb, var(--col) 70%, transparent); transition: color 0.25s ease; min-width: 2.4ch; text-align: right; }
#hud-vel small { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--col); transition: color 0.25s ease; }
#hud-vel[data-marcha='sube'] { --col: var(--oro); }
#hud-vel[data-marcha='sube'] strong { color: #fff3d0; }
#hud-vel[data-marcha='baja'] { --col: #8fdcff; }
.vel-pista { grid-column: 1 / -1; display: block; width: clamp(96px, 12vw, 150px); height: 3px; margin-top: 5px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
#hud-vel-barra { display: block; height: 100%; background: linear-gradient(90deg, var(--c0), var(--c1) 55%, var(--c2)); transform-origin: left; transform: scaleX(0.3); }
#hud-poderes { position: absolute; left: clamp(14px, 3vw, 30px); bottom: calc(clamp(16px, 3vh, 30px) + clamp(56px, 6.4vw, 68px) + 26px); display: flex; align-items: center; gap: 12px; }
#hud-escudos { display: flex; gap: 4px; }
#hud-escudos svg { width: 22px; height: 22px; fill: rgba(255, 255, 255, 0.14); transition: all 0.2s ease; }
#hud-escudos[data-n='1'] svg:nth-child(1), #hud-escudos[data-n='2'] svg { fill: #8dffb8; filter: drop-shadow(0 0 8px #8dffb8); }
.item { pointer-events: auto; touch-action: none; position: relative; width: clamp(54px, 7vw, 66px); height: clamp(54px, 7vw, 66px); border-radius: 18px; border: 2px dashed rgba(255, 255, 255, 0.2); background: rgba(9, 11, 28, 0.55); backdrop-filter: blur(6px); display: grid; place-items: center; --col: var(--oro); transition: border-color 0.2s ease; }
.item svg { width: 54%; height: 54%; fill: var(--col); filter: drop-shadow(0 0 8px var(--col)); transition: opacity 0.2s ease; }
.item span { position: absolute; bottom: -17px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--suave); white-space: nowrap; text-shadow: 0 1px 4px #000; }
.item[data-tipo='lento'] { --col: #8fdcff; }
.item.vacio svg { opacity: 0; }
.item.vacio span { opacity: 0.45; }
.item.listo { border: 2px solid var(--col); animation: listo 0.9s ease-in-out infinite alternate; }
.item:not(.vacio):not(.listo) svg { opacity: 0.35; }
@keyframes listo { from { box-shadow: 0 0 12px color-mix(in srgb, var(--col) 40%, transparent); } to { box-shadow: 0 0 34px var(--col); transform: scale(1.06); } }
#hud[data-efecto='turbo'] #hud-puntos { color: var(--oro); text-shadow: 0 0 22px var(--oro); }
#hud[data-efecto='lento'] #hud-puntos { color: #bfeaff; }

.premios { line-height: 1.75; }
.premios svg { width: 15px; height: 15px; fill: var(--suave); vertical-align: -3px; margin: 0 3px 0 2px; }
.premios svg:first-child { margin-left: 0; }

#hud-combo { position: absolute; left: 50%; top: 11%; transform: translateX(-50%); text-align: center; opacity: 0; transition: opacity 0.2s ease; }
#hud-combo.visible { opacity: 1; }
#hud-combo strong { display: block; font-family: var(--display); font-weight: 900; font-size: clamp(28px, 4.6vw, 46px); line-height: 1; text-shadow: 0 0 24px rgba(255, 255, 255, 0.45); font-variant-numeric: tabular-nums; }
#hud-combo small { font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--suave); }

#hud-juicio { position: absolute; left: 50%; top: 25%; transform: translateX(-50%); font-family: var(--display); font-weight: 900; font-size: clamp(20px, 3.4vw, 32px); letter-spacing: 0.06em; color: var(--color, #fff); text-shadow: 0 0 18px var(--color, #fff); opacity: 0; }
#hud-juicio.mostrar { animation: juicio 0.5s ease-out forwards; }
#hud-juicio[data-tipo='fallo'] { text-shadow: none; }
@keyframes juicio { 0% { opacity: 1; transform: translateX(-50%) scale(1.35); } 20% { transform: translateX(-50%) scale(1); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-10px); } }
#hud-desfase { position: absolute; left: 50%; top: calc(25% + 40px); transform: translateX(-50%); font-size: 12px; color: var(--tenue); }

#hud-cuenta { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 900; font-size: clamp(60px, 12vw, 130px); text-shadow: 0 0 40px rgba(179, 136, 255, 0.8); }
#hud-cuenta.latido { animation: latido 0.9s ease-out; }
@keyframes latido { from { transform: translate(-50%, -50%) scale(1.5); opacity: 0; } 30% { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* Controles: a la izquierda te mueves, a la derecha el rombo de botones con R2 arriba */
#hud-mover { position: absolute; left: clamp(14px, 3vw, 30px); bottom: clamp(16px, 3vh, 30px); display: flex; gap: 10px; }
#hud-rombo { --b: clamp(46px, 5vw, 58px); position: absolute; right: clamp(14px, 3vw, 30px); bottom: clamp(16px, 3vh, 30px); display: grid; grid-template-columns: repeat(3, var(--b)); grid-template-rows: repeat(3, var(--b)); gap: 3px; }
.mover, .forma, .r2 {
  pointer-events: auto; touch-action: none; position: relative; padding: 0;
  border: 2px solid var(--col); background: rgba(9, 11, 28, 0.55); backdrop-filter: blur(6px);
  display: grid; place-items: center; transition: transform 0.08s ease, opacity 0.2s ease;
  box-shadow: 0 0 18px color-mix(in srgb, var(--col) 30%, transparent);
}
.mover { --col: rgba(238, 241, 255, 0.5); width: clamp(56px, 6.4vw, 68px); height: clamp(56px, 6.4vw, 68px); border-radius: 18px; }
.mover svg { width: 42%; height: 42%; fill: var(--texto); }
.forma { width: var(--b); height: var(--b); border-radius: 50%; }
.forma svg { width: 48%; height: 48%; fill: var(--col); filter: drop-shadow(0 0 6px var(--col)); }
.forma[data-forma='2'] { grid-area: 1 / 2; } .forma[data-forma='0'] { grid-area: 2 / 1; } .forma[data-forma='3'] { grid-area: 2 / 3; } .forma[data-forma='1'] { grid-area: 3 / 2; }
.forma.c0 { --col: var(--c0); } .forma.c1 { --col: var(--c1); } .forma.c2 { --col: var(--c2); } .forma.c3 { --col: var(--c3); }
.forma.apagada { opacity: 0.16; filter: grayscale(1); }
.mover span, .forma span { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--suave); text-shadow: 0 1px 4px #000; white-space: nowrap; }
.r2 { --col: #fff; grid-area: 1 / 3; align-self: start; width: var(--b); height: calc(var(--b) * 0.82); border-radius: 16px 16px 10px 10px; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.r2 strong { font-family: var(--display); font-weight: 900; font-size: 15px; letter-spacing: 0.02em; text-shadow: 0 0 10px #fff; line-height: 1; }
.r2 span { font-size: 9px; font-weight: 600; color: var(--suave); line-height: 1; }
.r2 span:empty { display: none; }
.mover.golpe, .forma.golpe, .r2.golpe { animation: boton 0.22s ease-out; }
@keyframes boton { from { transform: scale(0.86); background: color-mix(in srgb, var(--col) 55%, transparent); box-shadow: 0 0 34px var(--col); } }

#destello { position: fixed; inset: 0; z-index: 6; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 55%, rgba(255, 255, 255, 0.4), rgba(255, 201, 74, 0.18) 40%, transparent 72%); }
#destello.activo { animation: destello 0.75s ease-out; }
@keyframes destello { from { opacity: 0.85; } to { opacity: 0; } }
#borde-fallo { position: fixed; inset: 0; z-index: 6; pointer-events: none; opacity: 0; box-shadow: inset 0 0 120px rgba(120, 130, 170, 0.55); }
#borde-fallo.activo { animation: fallo 0.45s ease-out; }
@keyframes fallo { from { opacity: 1; } to { opacity: 0; } }

#soltar-aqui { position: fixed; inset: 12px; z-index: 30; border-radius: 26px; border: 2px dashed var(--c0); background: rgba(3, 4, 13, 0.7); display: none; place-items: center; pointer-events: none; }
#soltar-aqui span { font-family: var(--display); font-size: clamp(22px, 4vw, 36px); color: var(--c0); }
body.arrastrando #soltar-aqui { display: grid; }

#aviso { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); z-index: 40; padding: 12px 18px; border-radius: 14px; background: rgba(9, 11, 28, 0.92); border: 1px solid var(--borde); color: var(--texto); font-size: 14px; opacity: 0; pointer-events: none; max-width: calc(100vw - 32px); }
#aviso.visible { animation: aviso 3.6s ease forwards; }
@keyframes aviso { 0% { opacity: 0; transform: translate(-50%, 30px); } 8%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }

@media (max-width: 640px) {
  #hud-poderes { left: 12px; bottom: 104px; }
  #hud-vel { top: 66px; left: 14px; }
  #hud-rombo { right: 10px; bottom: 18px; --b: 50px; }
  #hud-mover { left: 10px; bottom: 22px; }
  #hud-efecto { top: 62px; }
  #velo { background: linear-gradient(180deg, rgba(3, 4, 13, 0.85) 0%, rgba(3, 4, 13, 0.6) 60%, rgba(3, 4, 13, 0.3) 100%); }
  .hud-cancion { max-width: 50vw; }
  .medallas { display: none; }
}
/* Celular echado: poca altura, la racha y el «PERFECTO» no deben chocar */
@media (max-height: 500px) {
  #hud-combo { top: 9%; }
  #hud-combo strong { font-size: 30px; }
  #hud-combo small { font-size: 10px; }
  #hud-juicio { top: 33%; }
  .hud-cancion { max-width: min(420px, 36vw); }
}
/* Pantallas táctiles: botones más grandes para los pulgares (sin chocar en celulares de 360 px) */
@media (pointer: coarse) {
  #hud-rombo { --b: min(62px, 15.5vw); gap: 4px; }
  .mover { width: min(70px, 17.5vw); height: min(70px, 17.5vw); border-radius: 20px; }
  .r2 strong { font-size: 17px; }
  #hud-poderes { bottom: calc(clamp(16px, 3vh, 30px) + min(70px, 17.5vw) + 22px); }
}
@media (prefers-reduced-motion: reduce) {
  .icono-subir { animation: none; }
}
