:root {
  --bg-dark: #05070a;
  --panel: #0b1116;
  --accent: #8fe9ff;
  --accent-warm: #ff8a5a;
  --accent-dim: rgba(143, 233, 255, 0.35);
  --text: #d9e6ea;
  --hud-font: "Bahnschrift", "Consolas", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body { touch-action: manipulation; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #0c1216 0%, #04070a 70%);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
}

#appRoot {
  width: 1044px;
  max-width: 100%;
  padding: 10px;
}

#appRoot:fullscreen,
#appRoot:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  max-width: none;
  background: var(--bg-dark);
}

#appRoot:fullscreen h1 { display: none; }

#appRoot:fullscreen .hud,
#appRoot:fullscreen .toolbar {
  position: absolute;
  z-index: 4;
  max-width: none;
  width: auto;
  margin: 0;
  padding: 3px 8px;
  background: rgba(5, 7, 10, 0.55);
  border-radius: 4px;
  font-size: 11px;
}

#appRoot:fullscreen .hud { top: 6px; left: 6px; }
#appRoot:fullscreen .toolbar { top: 6px; right: 6px; }
#appRoot:fullscreen .toolbar input[type="range"] { display: none; }

#appRoot:fullscreen .game-wrap,
#appRoot:-webkit-full-screen .game-wrap {
  max-width: none;
  width: min(100vw, 100vh * 4 / 3);
}

.game-wrap {
  position: relative;
  display: block;
  max-width: 1024px;
  width: 100%;
  margin: 0 auto;
}

h1 {
  text-align: center;
  margin: 0 0 10px;
  letter-spacing: 3px;
  font-size: 20px;
  font-family: var(--hud-font);
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(143, 233, 255, 0.35);
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1024px;
  width: 100%;
  margin: 0 auto 8px;
  font-size: 13px;
  font-family: var(--hud-font);
  color: var(--text);
  opacity: 0.9;
  flex-wrap: wrap;
  gap: 4px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 1024px;
  width: 100%;
  margin: 0 auto 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.85;
}

.toolbar input[type="range"] { width: 70px; }

.icon-btn {
  background: rgba(143, 233, 255, 0.08);
  border: 1px solid var(--accent-dim);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
}

.icon-btn:hover {
  background: rgba(143, 233, 255, 0.16);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  background: #05070a;
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  box-shadow: 0 0 24px rgba(143, 233, 255, 0.1), inset 0 0 40px rgba(0,0,0,0.6);
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 8, 11, 0.9);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  text-align: center;
  padding: 20px;
  z-index: 5;
}

.overlay.hidden { display: none; }

.overlay h2 {
  font-size: 24px;
  margin: 0 0 10px;
  font-family: var(--hud-font);
  letter-spacing: 2px;
  color: var(--accent-warm);
  text-shadow: 0 0 10px rgba(255, 138, 90, 0.4);
}

.overlay p {
  margin: 4px 0 20px;
  font-size: 15px;
  color: var(--text);
}

.overlay .hint {
  font-size: 12px;
  font-family: var(--hud-font);
  opacity: 0.55;
  margin-top: 18px;
}

button {
  background: linear-gradient(180deg, rgba(143,233,255,0.9), rgba(60,140,165,0.9));
  color: #04141a;
  border: 1px solid rgba(143, 233, 255, 0.6);
  padding: 11px 26px;
  font-size: 14px;
  font-family: var(--hud-font);
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1.5px;
  box-shadow: 0 0 14px rgba(143, 233, 255, 0.25);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(143, 233, 255, 0.4);
}

button:active { transform: translateY(0); }

.mobile-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 12px;
  z-index: 3;
}

@media (pointer: coarse) {
  .mobile-controls { display: flex; }
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(2, 42px);
  gap: 6px;
  pointer-events: auto;
}

.dpad button {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: rgba(143, 233, 255, 0.1);
  border: 1px solid var(--accent-dim);
  color: var(--text);
  font-size: 17px;
  padding: 0;
  box-shadow: none;
  touch-action: none;
  user-select: none;
}

.dpad .pad-up { grid-column: 2; grid-row: 1; }
.dpad .pad-left { grid-column: 1; grid-row: 2; }
.dpad .pad-right { grid-column: 3; grid-row: 2; }
.dpad .pad-down { grid-column: 2; grid-row: 2; }

.fire-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.fire-btn {
  pointer-events: auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9d70, #b3492b);
  border: 1px solid rgba(255, 138, 90, 0.6);
  box-shadow: 0 0 16px rgba(255, 138, 90, 0.45);
  font-size: 12px;
  font-family: var(--hud-font);
  font-weight: 700;
  color: #2a0f05;
  touch-action: none;
  user-select: none;
}

.bomb-btn {
  pointer-events: auto;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2a0, #b38a1a);
  border: 1px solid rgba(255, 225, 77, 0.6);
  box-shadow: 0 0 14px rgba(255, 225, 77, 0.45);
  font-size: 9px;
  font-family: var(--hud-font);
  font-weight: 700;
  color: #2a1f05;
  touch-action: none;
  user-select: none;
}

/* --- Hangar / aircraft upgrade UI --- */
.overlay.hangar-overlay {
  justify-content: flex-start;
  padding: 14px 14px 18px;
  overflow-y: auto;
}

.hangar-overlay h2 { margin-bottom: 2px; }

.credits-badge {
  display: inline-block;
  margin: 2px 0 10px;
  padding: 4px 12px;
  border-radius: 3px;
  background: rgba(255, 200, 90, 0.08);
  border: 1px solid rgba(255, 200, 90, 0.4);
  color: #ffd85a;
  font-family: var(--hud-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.aircraft-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  margin: 6px 0 10px;
}

@media (max-width: 700px) {
  .aircraft-grid { grid-template-columns: repeat(2, 1fr); }
}

.aircraft-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  padding: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.aircraft-card:hover { border-color: rgba(143, 233, 255, 0.6); }

.aircraft-card.selected {
  border-color: var(--accent);
  background: rgba(143, 233, 255, 0.08);
  box-shadow: 0 0 12px rgba(143, 233, 255, 0.25);
}

.aircraft-card.locked {
  cursor: default;
  filter: grayscale(0.75);
  opacity: 0.7;
}

.aircraft-card.locked:hover { border-color: var(--accent-dim); }

.unlock-btn {
  width: 100%;
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 11px;
  box-shadow: none;
}

.unlock-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.aircraft-thumb {
  width: 100%;
  height: 76px;
  object-fit: contain;
  display: block;
  margin-bottom: 4px;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.5));
}

.aircraft-card .name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-family: var(--hud-font);
  font-weight: 700;
}

.aircraft-card .swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
  flex: none;
}

.aircraft-card .tagline {
  font-size: 10.5px;
  opacity: 0.65;
  margin-top: 3px;
  line-height: 1.3;
}

.aircraft-desc {
  font-size: 12px;
  opacity: 0.85;
  text-align: left;
  width: 100%;
  margin: 0 0 10px;
  min-height: 30px;
}

.upgrade-list {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.upgrade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px;
  padding: 6px 8px;
}

.upgrade-info { text-align: left; flex: 1; min-width: 0; }

.upgrade-info .label {
  font-size: 12px;
  font-family: var(--hud-font);
  font-weight: 700;
}

.upgrade-dots { display: flex; gap: 3px; margin-top: 3px; }

.upgrade-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: rgba(255,255,255,0.12);
}

.upgrade-dots .dot.filled {
  background: var(--accent);
  box-shadow: 0 0 5px rgba(143, 233, 255, 0.6);
}

.buy-btn {
  flex: none;
  padding: 6px 10px;
  font-size: 11px;
  box-shadow: none;
}

.buy-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.buy-btn.maxed {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-color: rgba(255,255,255,0.2);
}

.signature-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 0 0 12px;
  padding: 8px 10px;
  background: rgba(255, 200, 90, 0.05);
  border: 1px solid rgba(255, 200, 90, 0.3);
  border-radius: 4px;
}

.signature-info { text-align: left; flex: 1; min-width: 0; }

.signature-info .label {
  font-size: 12px;
  font-family: var(--hud-font);
  font-weight: 700;
  color: #ffd85a;
}

.signature-info .desc {
  font-size: 10.5px;
  opacity: 0.75;
  margin-top: 3px;
  line-height: 1.3;
}

.signature-panel .unlock-btn {
  width: auto;
  flex: none;
  margin-top: 0;
  white-space: nowrap;
}

.signature-badge {
  flex: none;
  font-family: var(--hud-font);
  font-size: 11px;
  font-weight: 700;
  color: #7cff8a;
  border: 1px solid rgba(124, 255, 138, 0.4);
  border-radius: 3px;
  padding: 6px 10px;
}
