* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #050508;
  touch-action: none;
}

body.pixel-ui {
  font-family: "Press Start 2P", monospace;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

#app-root {
  position: relative;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #050508;
}

#game-container {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container canvas {
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Bouton tir (mobile) : fixe au viewport, au-dessus du canvas, sous l’overlay menu (z-index 1000) */
.missile-touch-btn {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 900;
  width: 76px;
  height: 76px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 4px solid #1a2030;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a68b8 0%, #283c78 55%, #101828 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    0 4px 0 #080810,
    0 0 0 2px #000;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.missile-touch-btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 0 rgba(0, 0, 0, 0.25),
    0 2px 0 #080810;
}

.missile-touch-btn.hidden {
  display: none !important;
}

.missile-touch-btn-icon {
  display: block;
  width: auto;
  height: 52px;
  max-width: 44px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Fond semi-transparent : on voit le jeu (étoiles / vaisseau) derrière */
.startup-overlay.pixel-overlay {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  background: rgba(5, 5, 12, 0.48);
  backdrop-filter: blur(1px);
}

.startup-overlay.overlay-hidden {
  display: none;
  pointer-events: none;
}

.pixel-panel {
  width: 100%;
  max-width: 400px;
  padding: 20px 18px;
  background: #0c0c14;
  color: #c8d8e8;
  border: 4px solid #1a1a28;
  box-shadow:
    0 0 0 2px #000,
    0 0 0 4px #4a6a9a,
    0 0 0 6px #000,
    0 8px 24px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(120, 160, 220, 0.12);
}

.panel-wide {
  max-width: 460px;
}

.panel-menu {
  min-height: min(78vh, 720px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.panel.hidden {
  display: none;
}

.panel-title {
  margin: 0 0 14px;
  font-size: 11px;
  line-height: 1.6;
  font-weight: normal;
  color: #88c8ff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-shadow: 2px 2px 0 #000;
}

.panel-text {
  margin: 0 0 14px;
  font-size: 7px;
  line-height: 1.8;
  color: #9aacbc;
}

.panel-list {
  margin: 0 0 16px;
  padding-left: 14px;
  font-size: 6px;
  line-height: 2;
  color: #8a9cac;
}

.panel-list li {
  margin-bottom: 8px;
}

.panel-list strong {
  color: #aac8ff;
}

.panel-input {
  width: 100%;
  padding: 12px 10px;
  margin-bottom: 14px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  line-height: 1.5;
  border: 3px solid #2a3548;
  background: #06060c;
  color: #e0f0ff;
  box-shadow: inset 2px 2px 0 #000;
}

.panel-input::placeholder {
  color: #456;
}

.panel-input:focus {
  outline: none;
  border-color: #5a8ac8;
}

.panel-btn {
  display: inline-block;
  width: 100%;
  padding: 14px 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  line-height: 1.5;
  cursor: pointer;
  border: 3px solid #000;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-btn.primary {
  background: linear-gradient(180deg, #3a58a8 0%, #284078 100%);
  color: #e8f0ff;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.15),
    0 4px 0 #101828;
}

.panel-btn.primary:hover {
  filter: brightness(1.12);
}

.panel-btn.primary:active {
  transform: translateY(2px);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.3);
}

.panel-btn.secondary {
  background: #1a2030;
  color: #a8b8c8;
  box-shadow: 0 3px 0 #080810;
}

.panel-btn.secondary:hover {
  background: #242c40;
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.panel-hint {
  margin: 10px 0 0;
  font-size: 5px;
  line-height: 1.9;
  color: #567;
}

.leaderboard-wrap {
  margin: 10px 0 6px;
  flex: 1 1 auto;
  min-height: 280px;
  max-height: min(48vh, 420px);
  overflow: auto;
  border: 3px solid #1a2030;
  background: #06060c;
  box-shadow: inset 2px 2px 0 #000;
}

.panel-menu .leaderboard-wrap {
  max-height: min(52vh, 460px);
}

.lb-title {
  margin: 0;
  padding: 8px 10px;
  font-size: 6px;
  font-weight: normal;
  color: #7a9cbc;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 3px solid #1a2030;
  background: #0a0a12;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 6px;
  line-height: 1.6;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 8px 8px;
  text-align: left;
  border-bottom: 2px solid #12121c;
}

.leaderboard-table th {
  color: #5a7090;
  font-weight: normal;
  text-transform: uppercase;
}

.leaderboard-table td:last-child,
.leaderboard-table th:last-child {
  text-align: right;
}

.leaderboard-table tbody tr:nth-child(even) {
  background: rgba(20, 28, 40, 0.35);
}

.lb-empty {
  text-align: center;
  color: #456;
  font-style: normal;
  font-size: 6px;
}
