* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #0b0c0e; color: #e9d1a3; font-family: system-ui, sans-serif; }
body { display: flex; flex-direction: column; height: 100svh; }
header { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 4px max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left)); font-size: 12px; }
header strong { margin-right: auto; letter-spacing: 2px; }
header span { margin-right: auto; }
button { border: 1px solid #987845; color: #f9e4c0; background: #24201a; border-radius: 6px; font: inherit; padding: 5px 10px; min-height: 36px; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .7; cursor: wait; }
button:focus-visible, a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
[hidden] { display: none !important; }
main { position: relative; display: flex; flex: 1; min-height: 0; align-items: center; justify-content: center; overflow: hidden; }
#g { position: relative; width: min(100vw, calc((100svh - 82px) * 16 / 9)); aspect-ratio: 16 / 9; background: #000; }
#c { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }
#ts { position: absolute; inset: 20% 0 auto; text-align: center; color: white; font-size: clamp(12px, 2vw, 23px); pointer-events: none; }
#ts h1 { font-size: clamp(44px, 11vw, 140px); margin: 0; text-shadow: 0 5px #3a2918; }
#start { position: absolute; bottom: 15%; left: 50%; transform: translateX(-50%); min-height: 44px; white-space: nowrap; }
#h, #a { position: absolute; bottom: 3%; font-size: clamp(18px, 3.2vw, 42px); font-weight: bold; color: #fff; text-shadow: 2px 2px #000; pointer-events: none; }
#h { left: 36%; }
#a { right: 36%; }
#msg { display: none; position: absolute; top: 15%; width: 100%; text-align: center; font-size: clamp(12px, 1.8vw, 24px); color: #fff; text-shadow: 2px 2px #000; pointer-events: none; }
footer { min-height: 34px; flex-shrink: 0; padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)); text-align: center; font-size: 11px; }
a { color: #b5d8ef; }
#m { width: 70px; height: 12px; vertical-align: middle; }
#mi { vertical-align: middle; }
.mobile-help, #touch-controls, #look-zone { display: none; }
@media (pointer: coarse), (max-width: 700px) {
  .desktop-help, .mouse-settings { display: none; }
  .mobile-help { display: inline; }
  header { font-size: 9px; gap: 5px; }
  header strong { letter-spacing: 0; }
  header button { padding: 4px 6px; }
  footer { font-size: 9px; }
  .playing #look-zone { display: block; position: absolute; inset: 0 0 0 40%; touch-action: none; }
  .playing #touch-controls { display: flex; position: absolute; inset: auto 12px max(10px, env(safe-area-inset-bottom)); justify-content: space-between; align-items: end; pointer-events: none; }
  #move-pad { width: 112px; height: 112px; border: 2px solid #c3aa7f9e; border-radius: 50%; background: #181b1cac; color: #fff0cd; display: grid; place-items: center; text-align: center; line-height: 1.5; font-size: 15px; user-select: none; touch-action: none; pointer-events: auto; }
  #move-pad.active { background: #65512bcd; }
  .actions { display: grid; grid-template-columns: 60px 60px; gap: 8px; pointer-events: auto; }
  .actions button { min-height: 54px; touch-action: none; background: #2d241dd9; font-size: 14px; }
  #fire { grid-column: 1 / 3; background: #673827d9; }
}
@media (pointer: coarse) and (orientation: landscape) {
  #move-pad { width: 92px; height: 92px; font-size: 13px; }
  .actions { gap: 5px; grid-template-columns: 58px 58px; }
  .actions button { min-height: 44px; }
}
@media (max-width: 700px) and (orientation: portrait) {
  #g { margin-bottom: 100px; }
}
