* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
#game { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); image-rendering: pixelated; touch-action: none; }
#loader { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #000; color: #fff; font-family: monospace; z-index: 100; }
#loader-spinner { width: 60px; height: 60px; border: 4px solid #333; border-top-color: #ffd700; border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 20px; }
#loader-text { font-size: 18px; margin-bottom: 15px; color: #aaa; }
#loader-progress { width: 300px; height: 8px; background: #222; border-radius: 4px; overflow: hidden; }
#loader-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #ffd700, #c850ff); border-radius: 4px; transition: width 0.3s; }
@keyframes spin { to { transform: rotate(360deg); } }

#rotate-device { position: fixed; inset: 0; z-index: 9999; display: none; flex-direction: column; align-items: center; justify-content: center; background: #111; color: #fff; font-family: Silkscreen, monospace; text-align: center; touch-action: none; }
#rotate-device .icon { font-size: 80px; margin-bottom: 30px; animation: rotatePhone 2s ease-in-out infinite; }
#rotate-device p { font-size: 20px; line-height: 1.6; color: #ccc; }
@keyframes rotatePhone { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(90deg); } }

@media (orientation: portrait) {
  #rotate-device { display: flex; }
  #game, #touch-controls, #name-input, #loader { display: none !important; }
}

#touch-controls { position: fixed; inset: 0; pointer-events: none; z-index: 10; display: none; touch-action: none; }
#touch-controls.show { display: block; }
#joystick-area { position: absolute; bottom: 40px; left: 40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.25); touch-action: none; pointer-events: auto; }
#joystick-knob { position: absolute; width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0.2) 100%); border: 2px solid rgba(255,255,255,0.4); transform: translate(-50%, -50%); left: 50%; top: 50%; transition: none; pointer-events: none; }
#action-btn { position: absolute; bottom: 40px; right: 40px; width: 80px; height: 80px; border-radius: 50%; background: rgba(255,215,0,0.2); border: 3px solid rgba(255,215,0,0.5); touch-action: none; pointer-events: auto; transition: background 0.15s, border-color 0.15s; }
#action-btn::after { content: '📷'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 32px; color: rgba(255,215,0,0.8); }
#action-btn.pressed { background: rgba(255,215,0,0.5); border-color: #ffd700; }
#action-btn.hidden { display: none; }
#back-btn { position: absolute; top: 16px; left: 16px; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,50,50,0.15); border: 2px solid rgba(255,50,50,0.4); touch-action: none; pointer-events: auto; transition: background 0.15s, border-color 0.15s; }
#back-btn::after { content: '✕'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; color: rgba(255,50,50,0.6); }
#back-btn.pressed { background: rgba(255,50,50,0.4); border-color: #ff3333; }
#back-btn.hidden { display: none; }
#fullscreen-btn { position: absolute; top: 72px; right: 16px; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.25); touch-action: none; pointer-events: auto; display: flex; align-items: center; justify-content: center; font-size: 22px; color: rgba(255,255,255,0.5); transition: background 0.15s, border-color 0.15s; }
#fullscreen-btn::after { content: '⛶'; }
#fullscreen-btn.exit::after { content: '⤡'; font-size: 26px; }
#fullscreen-btn.pressed { background: rgba(255,255,255,0.3); border-color: rgba(255,255,255,0.5); }

#name-input { position: fixed; z-index: 20; display: none; background: transparent; border: none; outline: none; color: transparent; font-family: Silkscreen, monospace; text-align: center; caret-color: transparent; pointer-events: auto; touch-action: none; }
