:root {
  --bg: #0a0d14;
  --panel: #141a26;
  --panel2: #1c2434;
  --border: #2a3550;
  --accent: #e8a33d;
  --accent-dim: #b5792b;
  --text: #e8ecf4;
  --muted: #8a93a8;
  --ok: #3dd68c;
  --hp: #e84a4a;
  --nav-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", ui-monospace, monospace;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#screen {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding-bottom: var(--nav-h);
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  gap: 12px;
}

.view.hidden { display: none; }

.title {
  margin: 8vh 0 0;
  text-align: center;
  font-size: 34px;
  letter-spacing: 4px;
  color: var(--accent);
  text-shadow: 0 0 14px var(--accent-dim);
}

.subtitle {
  text-align: center;
  color: var(--muted);
  margin: 4px 0 0;
  letter-spacing: 2px;
  text-transform: lowercase;
}

.menu-buttons, .nav-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.nav-row {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
}

.view-title {
  margin: 4px 0 0;
  color: var(--accent);
  text-align: center;
  letter-spacing: 3px;
  text-transform: lowercase;
}

.btn {
  background: var(--panel2);
  color: var(--text);
  border: 2px solid var(--border);
  padding: 14px;
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 2px;
  text-transform: lowercase;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #00000055;
  cursor: pointer;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #201505;
  font-weight: 700;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.panel-list { display: flex; flex-direction: column; gap: 8px; }

.panel {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.panel.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.panel.locked { opacity: 0.5; }

.panel .name { font-weight: 700; letter-spacing: 1px; }
.panel .meta { color: var(--muted); font-size: 12px; }
.panel .right { text-align: right; }
.panel button { margin-left: 6px; }

.chip {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  border-radius: 3px;
  border: 1px solid;
  padding: 1px 4px;
  font-size: 11px;
}

.hangar-stats {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.hangar-stats b { color: var(--text); }

/* mission / game */
#game-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 2px solid var(--border);
  background: #05070c;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

#run-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
#run-hud.hidden { display: none; }

.hud-bar {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 34%;
  height: 12px;
  border: 1px solid var(--border);
  background: #000a;
  border-radius: 2px;
}
.hud-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--hp), var(--accent));
  transition: width 0.1s linear;
}

.hud-center {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text);
  font-size: 13px;
  letter-spacing: 1px;
  text-align: center;
  text-shadow: 0 1px 2px #000;
}

.hud-right {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--accent);
  font-size: 13px;
  text-align: right;
  text-shadow: 0 1px 2px #000;
}

.hud-mats {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hud-mats .chip {
  background: #0009;
  color: var(--text);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #05070cee;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 20px;
}
.overlay.hidden { display: none; }
.overlay h2 { color: var(--accent); letter-spacing: 3px; margin: 0; }
.overlay p { color: var(--muted); margin: 0; max-width: 260px; }

#bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-h);
  display: flex;
  background: var(--panel);
  border-top: 2px solid var(--border);
  z-index: 20;
}
#bottom-nav button {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: lowercase;
  cursor: pointer;
}
#bottom-nav button.active {
  color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}

@media (min-width: 720px) {
  #screen { padding-bottom: 0; }
  #bottom-nav { left: 50%; transform: translateX(-50%); width: 480px; }
}
