* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
  font-family: "Courier New", "Consolas", monospace;
  color: #eee;
  user-select: none;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, #1a1a1a 0%, #0a0a0a 70%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.15) 2px, rgba(0,0,0,0.15) 4px);
}

.game-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.game-frame {
  display: flex;
  border: 4px solid #444;
  box-shadow:
    0 0 0 2px #222,
    0 8px 32px rgba(0,0,0,0.7),
    inset 0 0 0 1px #666;
  background: #000;
}

#gameCanvas {
  display: block;
  background: #000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.side-panel {
  width: 96px;
  background: #636363;
  border-left: 3px solid #444;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  gap: 10px;
  font-size: 12px;
  color: #111;
}

.side-section {
  width: 100%;
  text-align: center;
}

.side-label {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 4px;
  color: #111;
}

.enemy-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  justify-items: center;
  min-height: 120px;
  align-content: start;
}

.enemy-icon {
  width: 14px;
  height: 14px;
  background: #111;
  clip-path: polygon(30% 0%, 70% 0%, 70% 25%, 100% 25%, 100% 75%, 70% 75%, 70% 100%, 30% 100%, 30% 75%, 0% 75%, 0% 25%, 30% 25%);
}

.stat-box {
  background: #555;
  border: 2px solid #333;
  padding: 6px 4px;
  font-weight: bold;
  font-size: 16px;
  color: #f5f5f5;
  text-shadow: 1px 1px 0 #000;
}

.lives-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 18px;
  font-weight: bold;
}

.lives-icon {
  width: 18px;
  height: 18px;
  background: #3d8;
  border: 1px solid #1a5;
  position: relative;
}
.lives-icon::before {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 6px; height: 6px;
  background: #1a5;
}

.flag-icon {
  width: 28px;
  height: 28px;
  margin: 0 auto 4px;
  background: #c33;
  clip-path: polygon(20% 10%, 80% 10%, 80% 55%, 55% 55%, 70% 90%, 30% 90%, 45% 55%, 20% 55%);
  border-radius: 2px;
}

.help-bar {
  color: #888;
  font-size: 12px;
  text-align: center;
  line-height: 1.6;
  max-width: 560px;
}

.help-bar kbd {
  display: inline-block;
  background: #2a2a2a;
  border: 1px solid #555;
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 6px;
  color: #ddd;
  font-family: inherit;
  font-size: 11px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.hidden {
  display: none !important;
}

.overlay.hidden {
  display: none !important;
}

.panel {
  text-align: center;
  padding: 36px 48px;
  background: #111;
  border: 3px solid #555;
  box-shadow: 0 0 40px rgba(200,40,40,0.25);
  min-width: 360px;
  max-width: 90vw;
}

.panel h1 {
  font-size: 42px;
  letter-spacing: 4px;
  color: #e33;
  text-shadow: 0 0 12px rgba(255,40,40,0.5), 3px 3px 0 #600;
  margin-bottom: 8px;
}

.panel .subtitle {
  color: #aaa;
  margin-bottom: 28px;
  font-size: 14px;
  letter-spacing: 2px;
}

.panel .menu-hint {
  color: #888;
  font-size: 13px;
  margin-top: 20px;
}

.menu-btn {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 12px 24px;
  background: #222;
  border: 2px solid #666;
  color: #eee;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.menu-btn:hover, .menu-btn:focus {
  background: #3a1a1a;
  border-color: #e33;
  color: #fff;
  outline: none;
}

.menu-btn.primary {
  background: #401010;
  border-color: #c33;
}

.menu-btn.primary:hover {
  background: #602020;
}

.stage-banner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 50;
  font-size: 36px;
  letter-spacing: 6px;
  color: #eee;
  font-weight: bold;
}

.stage-banner.hidden {
  display: none;
}

.flash-text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  z-index: 40;
  opacity: 0;
  transition: opacity 0.2s;
}

.flash-text.show {
  opacity: 1;
}

@media (max-width: 700px) {
  .help-bar { display: none; }
  .side-panel { width: 72px; font-size: 10px; }
}
