/* IRON COMMANDO — retro arcade shell */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: #0a0a12; overflow: hidden; }
body {
  display: flex; align-items: center; justify-content: center;
  font-family: "Courier New", monospace;
  background:
    radial-gradient(ellipse at 50% 30%, #1a1a2e 0%, #0a0a12 70%);
}
#wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#frame {
  position: relative;
  border: 4px solid #2a2a3e;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(255, 210, 63, 0.08), inset 0 0 20px rgba(0,0,0,0.6);
  background: #000;
  width: min(96vw, calc((100vh - 70px) * 16 / 9));
  aspect-ratio: 16 / 9;
}
#game { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#footer { color: #3a4a6a; font-size: 12px; letter-spacing: 1px; }
#btn-rank {
  position: absolute; top: 8px; right: 8px;
  background: #1a1a2e; color: #8a9ab8;
  border: 1px solid #3a4a6a; border-radius: 4px;
  font-family: inherit; font-size: 11px; padding: 3px 8px;
  cursor: pointer; z-index: 10;
}
#btn-rank:hover { color: #ffd23f; border-color: #ffd23f; }

/* touch UI — shown on coarse pointers only.
   버튼을 캔버스 위가 아니라 캔버스 바깥(프레임 하단 영역)에 배치해 게임 화면을 가리지 않게 함 */
#touch-ui { display: none; }
@media (pointer: coarse) {
  /* 프레임 아래 컨트롤 바: 캔버스와 겹치지 않음 */
  #touch-ui {
    display: flex; align-items: center; justify-content: space-between;
    position: static;
    width: 100%;
    padding: 6px 10px 2px;
    pointer-events: none;
    background: transparent;
  }
  #dpad { position: static; display: grid;
    grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 40px); gap: 3px; }
  #btn-up { grid-column: 2; grid-row: 1; }
  #btn-left { grid-column: 1; grid-row: 2; }
  #btn-down { grid-column: 2; grid-row: 2; }
  #btn-right { grid-column: 3; grid-row: 2; }
  #acts { position: static; display: flex; gap: 6px; align-items: center; }
  .tbtn {
    pointer-events: auto;
    width: 44px; height: 40px; border-radius: 8px;
    background: rgba(26,26,46,0.85); color: #8a9ab8;
    border: 1px solid #3a4a6a; font-family: inherit; font-size: 12px;
    touch-action: none; user-select: none; -webkit-user-select: none;
  }
  .tbtn.fire { width: 58px; height: 44px; background: rgba(224,69,58,0.7); color: #fff; border-color: #e0453a; font-weight: bold; }
  .tbtn.jump { width: 58px; height: 44px; background: rgba(63,163,77,0.7); color: #fff; border-color: #3fa34d; font-weight: bold; }
  .tbtn.ride { font-size: 10px; }
  .tbtn:active { filter: brightness(1.5); }
  /* 컨트롤 바가 생기므로 게임 프레임 높이를 줄여 화면에 맞춤 */
  #frame {
    width: min(96vw, calc((100vh - 200px) * 16 / 9));
  }
}
