html, body { margin: 0; height: 100%; overflow: hidden; background: #000; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; image-rendering: pixelated; }
#boot-splash { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: #090909; color: #f5f1ea; transition: opacity 420ms ease; }
.mojang-brand { display: flex; align-items: center; gap: 14px; }
.boot-loading { font: 10px/1 monospace; letter-spacing: 3px; color: #aaa69f; animation: loading-pulse 1.2s ease-in-out infinite; }
@keyframes loading-pulse { 50% { opacity: 0.45; } }
#boot-splash.leaving { opacity: 0; pointer-events: none; }
.mojang-mark { position: relative; width: 42px; height: 42px; border: 4px solid #f5f1ea; border-radius: 50%; box-sizing: border-box; transform: rotate(-28deg); }
.mojang-mark::before { content: ""; position: absolute; left: 9px; top: 1px; width: 4px; height: 31px; background: #f5f1ea; transform: rotate(38deg); }
.mojang-mark span { position: absolute; left: 14px; top: 2px; width: 11px; height: 11px; border: 3px solid #f5f1ea; border-radius: 50%; background: #090909; }
.mojang-wordmark { font: 800 22px/1 Arial, sans-serif; letter-spacing: 2px; }
.mojang-wordmark small { display: block; margin-top: 4px; font-size: 9px; letter-spacing: 5px; text-align: right; }
@media (prefers-reduced-motion: reduce) { #boot-splash { transition-duration: 0ms; } }
#gui { pointer-events: none; }

/* touch controls */
#touch { position: fixed; inset: 0; z-index: 2; touch-action: none; }
#touch[hidden] { display: none; }
.t-look { position: absolute; inset: 0; }
.t-btn, .t-dpad { position: absolute; box-sizing: border-box; background: rgba(90, 90, 90, 0.35); border: 2px solid rgba(0, 0, 0, 0.55); box-shadow: inset 2px 2px rgba(255,255,255,0.25), inset -2px -2px rgba(0,0,0,0.3);
  color: #fff; font: 15px/1 monospace; text-shadow: 2px 2px #3f3f3f; display: flex; align-items: center; justify-content: center; padding: 0; touch-action: none; }
.t-btn.on, .t-dpad span.on { background: rgba(200, 200, 230, 0.35); }
.t-back { left: calc(10px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); width: 40px; height: 36px; }
.t-inv { right: calc(10px + env(safe-area-inset-right)); top: calc(10px + env(safe-area-inset-top)); width: 46px; height: 46px; }
.t-chat { left: calc(58px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); width: 48px; height: 36px; font-size: 12px; }
.t-craft { right: calc(62px + env(safe-area-inset-right)); top: calc(10px + env(safe-area-inset-top)); width: 56px; height: 46px; font-size: 12px; }
.t-chat-input { position: fixed; z-index: 4; left: 8px; right: 8px; bottom: calc(10px + env(safe-area-inset-bottom)); box-sizing: border-box; height: 38px; padding: 4px 8px; border: 2px solid #888; border-radius: 0; outline: none; background: rgba(0,0,0,0.9); color: #fff; font: 16px monospace; touch-action: auto; }
.t-dpad { left: calc(14px + env(safe-area-inset-left)); bottom: calc(14px + env(safe-area-inset-bottom)); width: 150px; height: 150px; display: block; }
.t-dpad span { position: absolute; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.t-dpad .up { left: 50px; top: 0; } .t-dpad .down { left: 50px; bottom: 0; } .t-dpad .left { left: 0; top: 50px; } .t-dpad .right { right: 0; top: 50px; }
.t-jump { right: calc(24px + env(safe-area-inset-right)); bottom: calc(60px + env(safe-area-inset-bottom)); width: 64px; height: 56px; }
.t-attack { right: calc(28px + env(safe-area-inset-right)); bottom: calc(126px + env(safe-area-inset-bottom)); width: 58px; height: 50px; }
.t-sneak { right: calc(96px + env(safe-area-inset-right)); bottom: calc(126px + env(safe-area-inset-bottom)); width: 58px; height: 50px; font-size: 11px; }
.t-use { right: calc(96px + env(safe-area-inset-right)); bottom: calc(60px + env(safe-area-inset-bottom)); width: 58px; height: 50px; }

/* tabla de puntajes (mantener apretado) */
.t-score { display: none; left: calc(160px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); width: 48px; height: 36px; font-size: 12px; }
#touch.has-score .t-score { display: flex; }
.t-nick { display: none; left: calc(214px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); width: 48px; height: 36px; font-size: 12px; }
#touch.has-score .t-nick { display: flex; }

/* menu de cambio de nick (tecla N) */
#nick-panel { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); touch-action: manipulation; }
#nick-panel[hidden] { display: none; }
.nk-box { width: min(360px, 92vw); }
.nk-in { display: block; box-sizing: border-box; width: 100%; margin: 6px 0 2px; padding: 9px 8px; background: #000; color: #fff; border: 2px solid #a0a0a0; outline: none; font: 18px monospace; letter-spacing: 1px; -webkit-user-select: text; user-select: text; touch-action: auto; }
.nk-in:focus { border-color: #fff; } .nk-in:disabled { color: #777; border-color: #555; }

/* spray de imagenes */
.t-spray { left: calc(112px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); width: 40px; height: 36px; font-size: 16px; }
.t-spr-go, .t-spr-del, .t-spr-off { display: none; width: 58px; height: 50px; font-size: 11px; bottom: calc(192px + env(safe-area-inset-bottom)); }
.t-spr-go { right: calc(28px + env(safe-area-inset-right)); } .t-spr-del { right: calc(96px + env(safe-area-inset-right)); } .t-spr-off { right: calc(164px + env(safe-area-inset-right)); }
#touch.spray-armed .t-spr-go, #touch.spray-armed .t-spr-del, #touch.spray-armed .t-spr-off { display: flex; }
.sp-keys { margin: 8px 0; padding: 8px 10px; background: #222; border: 2px solid #000; font-size: 13px; line-height: 1.35; color: #eee; }
.sp-keys div { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0; } .sp-keys b { flex: 0 0 auto; min-width: 22px; padding: 1px 4px; background: #ffcc33; color: #000; text-align: center; text-shadow: none; }
#spray-hud { position: fixed; z-index: 3; left: 50%; top: calc(8px + env(safe-area-inset-top)); transform: translateX(-50%); max-width: 92vw; padding: 4px 10px; background: rgba(0,0,0,0.55); color: #fff; font: 12px/1.3 monospace; text-align: center; text-shadow: 1px 1px #222; pointer-events: none; }
#spray-hud[hidden], #spray-panel[hidden] { display: none; }
#spray-panel { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.sp-box { width: min(420px, 92vw); max-height: 94vh; overflow: auto; box-sizing: border-box; padding: 14px 16px; background: #3a3a3a; border: 3px solid #000; box-shadow: inset 3px 3px #6a6a6a, inset -3px -3px #202020; color: #fff; font: 14px/1.35 monospace; text-shadow: 1px 1px #222; touch-action: pan-y; }
.sp-box h2 { margin: 0 0 6px; font-size: 18px; }
.sp-box p { margin: 6px 0; }
.sp-small { font-size: 12px; color: #ccc; }
.sp-msg { min-height: 16px; font-size: 12px; color: #8f8; } .sp-msg.bad { color: #f77; }
.sp-box button, .sp-pick { display: block; box-sizing: border-box; width: 100%; margin: 6px 0; padding: 9px 8px; background: #7a7a7a; color: #fff; border: 2px solid #000; box-shadow: inset 2px 2px #b0b0b0, inset -2px -2px #4a4a4a; font: 14px monospace; text-align: center; text-shadow: 1px 1px #333; cursor: pointer; }
.sp-box button:hover, .sp-box button:focus, .sp-pick:hover { background: #8a93d6; outline: none; }
.sp-ok { background: #5a9a3a !important; }
.sp-prev { height: 150px; margin: 8px 0; background: repeating-conic-gradient(#555 0% 25%, #444 0% 50%) 50% / 16px 16px; border: 2px solid #000; display: flex; align-items: center; justify-content: center; color: #aaa; }
.sp-prev img { max-width: 100%; max-height: 100%; object-fit: contain; image-rendering: auto; } .sp-prev [hidden] { display: none; }
.sp-row { display: flex; gap: 8px; align-items: center; } .sp-row button { margin: 6px 0; }
.sp-lbl { flex: 0 0 auto; min-width: 150px; } .sp-range { flex: 1 1 auto; min-width: 0; }
