html, body { margin: 0; height: 100%; background: #000; color: #fff; font-family: sans-serif; overflow: hidden; }
body { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
canvas { display: block; }
#hud { position: fixed; top: 16px; left: 20px; font-size: 24px; line-height: 1.4; text-shadow: 0 0 4px #000; pointer-events: none; }
#banner { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; white-space: pre-line; font: bold 56px sans-serif; pointer-events: none; }
#menu { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center; padding: 16px 0 90px; box-sizing: border-box; overflow-y: auto; background: rgba(0,0,0,.75); }
#menu section { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(1000px, 92vw); }
#menu section[hidden] { display: none; }
#menu h1 { font-size: 64px; margin: 0; letter-spacing: 8px; }
#menu h2 { font-size: 40px; margin: 0; }
#menu p { margin: 0; font-size: 22px; text-align: center; }
#menu button { font-size: 22px; padding: 12px 32px; min-width: 260px; cursor: pointer; border: 2px solid #fff; background: #112; color: #fff; border-radius: 8px; }
#menu button:hover, #menu button:focus { background: #335; }
#menu button.on { background: #2a6; border-color: #8f8; }
#menu button:disabled { opacity: .45; cursor: default; background: #112; }

/* нижние вкладки */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 8px; padding: 12px; background: #0a0a1a; border-top: 2px solid #335; }
#tabs button { min-width: 0; flex: 0 1 220px; font-size: 18px; padding: 10px 12px; }

/* боевой пропуск: зелёная, жёлтая, красная части */
#pass-bar { display: flex; gap: 3px; width: 100%; }
.seg { position: relative; height: 34px; border-radius: 4px; overflow: hidden; }
.seg .fill { position: absolute; inset: 0 auto 0 0; }
.seg span { position: relative; display: block; text-align: center; line-height: 34px; font-size: 14px; font-weight: bold; text-shadow: 0 0 3px #000; }
.green { background: #143a1c; } .green .fill { background: #2ecc40; }
.yellow { background: #3d3510; } .yellow .fill { background: #f1c40f; }
.red { background: #3d1414; } .red .fill { background: #e74c3c; }
#pass-rewards { list-style: none; padding: 0; margin: 0; font-size: 20px; line-height: 1.6; }

/* шкафчик: вкладки слева, выбор посередине, модель корабля справа */
#locker-body { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; width: 100%; align-items: start; }
.col { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
#menu #tab-locker button { min-width: 0; font-size: 18px; padding: 8px 18px; }
#locker-model { height: 340px; border: 2px solid #335; border-radius: 12px; background: radial-gradient(#1c1c40, #05050f); overflow: hidden; }
#locker-model p { padding: 8px; }

/* узкое окно: всё в один столбец */
@media (max-width: 640px) {
  #locker-body { grid-template-columns: minmax(0, 1fr); }
  #locker-tabs { flex-direction: row; flex-wrap: wrap; }
  #locker-model { height: 240px; }
}

/* телефон горизонтально: всё мельче */
@media (max-height: 500px) {
  #hud { font-size: 16px; top: 8px; left: 12px; }
  #banner { font-size: 32px; }
  #menu { padding: 8px 0 64px; }
  #menu section { gap: 8px; }
  #menu h1 { font-size: 36px; }
  #menu h2 { font-size: 24px; }
  #menu p, #pass-rewards { font-size: 15px; }
  #menu button { font-size: 16px; padding: 6px 20px; min-width: 200px; }
  #menu #tab-locker button { font-size: 15px; padding: 6px 12px; }
  #tabs { padding: 6px; }
  #tabs button { font-size: 15px; padding: 6px 10px; }
  .seg, .seg span { height: 26px; line-height: 26px; font-size: 11px; }
  #locker-model { height: 55vh; }
}

/* джойстик на телефоне: появляется там, где коснулся пальцем */
#stick { position: fixed; display: none; width: 100px; height: 100px; margin: -52px 0 0 -52px; border: 2px solid rgba(255,255,255,.5); border-radius: 50%; pointer-events: none; }
#stick div { position: absolute; left: 28px; top: 28px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.6); }

/* телефон вертикально: просим повернуть */
#rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  #rotate { display: flex; position: fixed; inset: 0; z-index: 10; align-items: center; justify-content: center; padding: 24px; text-align: center; font-size: 26px; background: #000; }
}
