/* Visor de cartas · Akinori796 */
:root { --oro: #ffd36b; --rosa: #ff4d6d; --texto: #fff8ee; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #07040f; overflow: hidden; color: var(--texto); font-family: 'Poppins', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
#escena { position: fixed; inset: 0; }
#escena canvas { display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui > * { pointer-events: auto; }
#ui > .pista, #ui > .hud, #ui > .puntos { pointer-events: none; }

/* ---------- carga ---------- */
#carga {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: radial-gradient(circle at 50% 40%, #2a1050, #07040f 70%); transition: opacity .7s, visibility .7s;
}
#carga.fuera { opacity: 0; visibility: hidden; }
#carga p { margin: 0; font-size: 1rem; color: #e8dcff; letter-spacing: .5px; text-align: center; padding: 0 24px; }
.sobrecito { font-size: 64px; animation: latido 1.2s ease-in-out infinite; filter: drop-shadow(0 0 24px rgba(255, 77, 109, .6)); }
@keyframes latido { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.15); } 30% { transform: scale(1); } 45% { transform: scale(1.1); } }
.barra { width: 180px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.barra i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--oro), var(--rosa)); transition: width .5s; }

/* ---------- pista ---------- */
.pista {
  position: fixed; left: 50%; bottom: max(28px, calc(env(safe-area-inset-bottom) + 18px)); transform: translate(-50%, 16px);
  padding: 12px 22px; border-radius: 999px; background: rgba(10, 4, 24, .6); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 211, 107, .35); font-weight: 500; font-size: .98rem; text-align: center;
  max-width: 92vw; width: max-content; opacity: 0; transition: opacity .5s, transform .5s;
  animation: respirar 2.4s ease-in-out infinite;
}
.pista.ver { opacity: 1; transform: translate(-50%, 0); }
@keyframes respirar { 50% { box-shadow: 0 0 28px rgba(255, 211, 107, .35); } }

/* ---------- hud ---------- */
.hud {
  position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -20px);
  min-width: 220px; max-width: calc(100vw - 120px); padding: 10px 18px; border-radius: 18px; text-align: center;
  background: rgba(10, 4, 24, .55); backdrop-filter: blur(10px); border: 1px solid rgba(255, 211, 107, .35);
  opacity: 0; transition: opacity .4s, transform .4s;
}
.hud.ver { opacity: 1; transform: translate(-50%, 0); }
.hud-n { font-size: .7rem; letter-spacing: 2.5px; text-transform: uppercase; color: var(--oro); font-weight: 600; }
.hud-t { font-size: .95rem; font-weight: 600; margin: 2px 0; }
.hud-c { font: 700 1.1rem 'Poppins', monospace; color: var(--oro); }
.hud.pop .hud-c { animation: pop .35s; }
@keyframes pop { 50% { transform: scale(1.35); } }

/* ---------- puntos ---------- */
.puntos { position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 10px; opacity: 0; transition: opacity .6s; }
.puntos.ver { opacity: 1; }
.puntos i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .25); transition: .4s; }
.puntos i.ok { background: var(--oro); box-shadow: 0 0 12px var(--oro); transform: scale(1.2); }

/* ---------- mensaje ---------- */
.msg { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity .5s; pointer-events: none; }
.msg.ver { opacity: 1; }
.msg-caja {
  pointer-events: auto; width: min(460px, 100%); padding: 26px 26px 22px; border-radius: 24px; text-align: center;
  background: linear-gradient(160deg, rgba(34, 14, 66, .82), rgba(10, 4, 24, .86)); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 211, 107, .4); box-shadow: 0 30px 80px rgba(0, 0, 0, .5), 0 0 60px rgba(255, 77, 109, .12);
  transform: translateY(24px) scale(.96); transition: transform .6s cubic-bezier(.2, .9, .3, 1.2);
}
.msg.ver .msg-caja { transform: none; }
.msg.abajo { align-items: flex-end; padding-bottom: max(46px, calc(env(safe-area-inset-bottom) + 36px)); }
.msg.derecha { justify-content: flex-end; padding-right: max(5vw, 24px); }
.msg-et { font-size: .74rem; letter-spacing: 2.5px; text-transform: uppercase; color: var(--oro); font-weight: 600; margin-bottom: 6px; }
.msg-et:empty, .msg-f:empty { display: none; }
.msg-h { margin: 0 0 10px; font-family: 'Great Vibes', Georgia, serif; font-weight: 400; font-size: clamp(2rem, 7vw, 2.7rem); line-height: 1.1; color: #fff; text-shadow: 0 0 22px rgba(255, 211, 107, .45); min-height: 1.1em; }
.msg-p { margin: 0; font-size: 1.02rem; line-height: 1.6; color: #efe6ff; min-height: 1.6em; white-space: pre-line; }
.msg-f { margin-top: 12px; font-family: 'Great Vibes', Georgia, serif; font-size: 1.7rem; color: var(--oro); }

.btn-luz, .btn-sec {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 1rem 'Poppins', sans-serif;
  border-radius: 999px; padding: 12px 24px; cursor: pointer; text-decoration: none; border: 0;
}
.btn-luz { background: linear-gradient(135deg, var(--oro), var(--rosa)); color: #1d0a24; box-shadow: 0 8px 26px rgba(255, 77, 109, .4); }
.msg .btn-luz { margin-top: 18px; opacity: 0; transform: translateY(8px); transition: .4s; pointer-events: none; }
.msg .btn-luz.ver { opacity: 1; transform: none; pointer-events: auto; }
.btn-sec { background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .25); }
.btn-luz:focus-visible, .btn-sec:focus-visible, .btn-musica:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* ---------- final ---------- */
.final { position: fixed; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px max(18px, env(safe-area-inset-bottom)); opacity: 0; transition: opacity 1.2s; pointer-events: none; }
.final.ver { opacity: 1; }
.final-caja {
  pointer-events: auto; width: min(520px, 100%); text-align: center; padding: 22px 22px 18px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(20, 8, 40, .55), rgba(10, 4, 24, .88)); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 211, 107, .35); transform: translateY(30px); transition: transform 1.2s cubic-bezier(.2, .9, .3, 1);
  max-height: 62vh; overflow: auto;
}
.final.ver .final-caja { transform: none; }
.final-gif { width: 84px; height: 84px; margin: 0 auto 8px; border-radius: 50%; overflow: hidden; border: 3px solid var(--oro); box-shadow: 0 0 30px rgba(255, 211, 107, .5); background: #000; }
.final-gif img { width: 100%; height: 100%; object-fit: cover; }
.final-h { margin: 0; font-family: 'Great Vibes', Georgia, serif; font-weight: 400; font-size: clamp(2.6rem, 11vw, 4rem); line-height: 1.05; color: var(--oro); text-shadow: 0 0 30px rgba(255, 211, 107, .6), 0 0 60px rgba(255, 77, 109, .45); }
.final-p { margin: 10px 0 6px; font-size: 1.05rem; line-height: 1.6; color: #fff; white-space: pre-line; }
.final-f { font-family: 'Great Vibes', Georgia, serif; font-size: 1.8rem; color: #ffd6e0; }
.final-acc { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* ---------- otros ---------- */
.btn-musica {
  position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 50; width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(255, 211, 107, .45); background: rgba(10, 4, 24, .55); color: #fff; font-size: 20px; cursor: pointer; backdrop-filter: blur(8px);
}
.btn-musica[hidden] { display: none; }
.ejemplo {
  position: fixed; top: max(14px, env(safe-area-inset-top)); left: 14px; z-index: 50; max-width: calc(100vw - 90px);
  padding: 9px 14px; border-radius: 999px; background: rgba(255, 211, 107, .92); color: #1d0a24; font-size: .82rem; font-weight: 600; text-decoration: none;
}
.destello { position: fixed; inset: 0; z-index: 90; pointer-events: none; background: radial-gradient(circle, var(--c), rgba(255, 255, 255, .85) 60%, var(--c)); opacity: 0; transition: opacity var(--d) ease; }
.destello.on { opacity: 1; }

@media (max-width: 600px) {
  .msg-caja { padding: 22px 20px 18px; }
  .msg-p { font-size: .96rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pista, .sobrecito { animation: none; }
}
