:root { --bg: #0b0710; --red: #e0402f; --amber: #ffb43a; --text: #f4e9dd; --muted: #a8998f; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; overscroll-behavior: none; touch-action: none; }
#stage { position: fixed; inset: 0; display: grid; place-items: center; background: #000; }
canvas { display: block; background: #000; image-rendering: auto; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }

#topbtns { position: fixed; top: calc(env(safe-area-inset-top) + 10px); right: calc(env(safe-area-inset-right) + 12px); display: flex; gap: 8px; z-index: 5; }
#topbtns button { width: 40px; height: 40px; border-radius: 12px; background: rgba(10, 8, 16, .55); font-size: 16px; backdrop-filter: blur(6px); }
#topbtns button.off { opacity: .45; text-decoration: line-through; }

#touch { position: fixed; inset: auto 0 0 0; z-index: 4; display: flex; justify-content: space-between; padding: 0 calc(env(safe-area-inset-right) + 18px) calc(env(safe-area-inset-bottom) + 16px) calc(env(safe-area-inset-left) + 18px); pointer-events: none; }
#touch .pad { display: flex; gap: 14px; pointer-events: auto; touch-action: none; }
#touch button { width: 78px; height: 78px; border-radius: 50%; background: rgba(255, 255, 255, .13); border: 2px solid rgba(255, 255, 255, .3); color: rgba(255, 255, 255, .85); font-size: 28px; backdrop-filter: blur(4px); touch-action: none; }
#touch button:active, #touch button.on { background: rgba(255, 255, 255, .3); }
#touch .atk { background: rgba(224, 64, 47, .25); border-color: rgba(224, 64, 47, .6); }
#touch .jmp { background: rgba(255, 180, 58, .22); border-color: rgba(255, 180, 58, .6); }
#touch .pad.r { align-items: flex-end; }
#touch .pad.r .jmp { width: 92px; height: 92px; }
@media (pointer: fine) { #touch { display: none !important; } }

#screens { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; background: radial-gradient(ellipse at 50% 40%, rgba(70, 14, 20, .55), rgba(6, 3, 10, .94)); pointer-events: auto; overflow-y: auto; }
.screen[hidden] { display: none; }
.skull { font-size: 64px; color: var(--red); text-shadow: 0 0 30px rgba(224, 64, 47, .8); }
h1 { margin: 0; font-size: clamp(38px, 9vw, 74px); letter-spacing: 6px; font-weight: 900; color: #ffe9c0; text-shadow: 0 3px 0 #7a1812, 0 0 40px rgba(224, 64, 47, .6); }
h2 { margin: 0 0 6px; font-size: 30px; letter-spacing: 2px; }
.tag { margin: 0 0 12px; color: var(--muted); font-size: 18px; }
.screen button { min-width: 230px; padding: 13px 22px; border-radius: 14px; background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .18); font-weight: 700; letter-spacing: .5px; }
.screen button:hover { background: rgba(255, 255, 255, .17); }
.screen button.big { background: var(--red); border-color: #ff7a68; font-size: 20px; padding: 15px 26px; box-shadow: 0 6px 26px rgba(224, 64, 47, .45); }
#levelList { display: grid; gap: 12px; width: min(560px, 100%); }
#levelList button { display: flex; align-items: center; justify-content: space-between; text-align: left; gap: 14px; padding: 14px 18px; }
#levelList small { display: block; color: var(--muted); font-weight: 400; }
#levelList .st { color: var(--amber); white-space: nowrap; font-size: 18px; }
#levelList button[disabled] { opacity: .4; cursor: default; }
.help { width: min(620px, 100%); text-align: left; background: rgba(255, 255, 255, .06); padding: 16px 20px; border-radius: 14px; font-size: 15px; }
.help p { margin: 0 0 10px; } .tiny { color: var(--muted); font-size: 13px; }
.stars { font-size: 44px; color: var(--amber); letter-spacing: 8px; text-shadow: 0 0 20px rgba(255, 180, 58, .5); }
.stats { display: grid; grid-template-columns: auto auto; gap: 6px 22px; text-align: left; background: rgba(255, 255, 255, .06); padding: 14px 22px; border-radius: 14px; }
.stats b { color: var(--amber); text-align: right; }

#rotate { position: fixed; inset: 0; z-index: 30; background: #0b0710; display: grid; place-content: center; text-align: center; font-size: 18px; }
#rotate div { font-size: 80px; color: var(--red); }
@media (max-height: 480px) { .screen { gap: 8px; padding: 12px; } h1 { font-size: 40px; } .skull { display: none; } .screen button { padding: 9px 18px; } h2 { font-size: 22px; } }
#rotate[hidden], #topbtns[hidden], #touch[hidden] { display: none !important; }

/* ───── versión 3D ───── */
.screen a.alt { display: block; text-align: center; margin-top: 6px; padding: 10px; color: var(--text); opacity: .75; text-decoration: underline; }
#floaters { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.floater { position: absolute; left: 0; top: 0; font-weight: 800; font-size: 18px; text-shadow: 0 2px 4px #000; white-space: nowrap; }
#flash { position: fixed; inset: 0; background: #ffd9a0; opacity: 0; pointer-events: none; z-index: 3; }
#hud { position: fixed; top: calc(env(safe-area-inset-top) + 10px); left: calc(env(safe-area-inset-left) + 14px); z-index: 5; display: flex; gap: 14px; font-weight: 800; font-size: 18px; text-shadow: 0 2px 4px #000; pointer-events: none; }
#hud[hidden] { display: none !important; }
#joy { position: relative; width: 150px; height: 150px; border-radius: 50%; background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .25); pointer-events: auto; touch-action: none; align-self: flex-end; }
#knob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: rgba(255, 255, 255, .28); border: 2px solid rgba(255, 255, 255, .5); }
#touch { align-items: flex-end; }
