:root {
  --bg: #060913;
  --panel: rgba(12, 17, 34, 0.78);
  --border: rgba(186, 210, 255, 0.15);
  --text: #eef2ff;
  --muted: rgba(210, 224, 255, 0.65);
  --accent: #7ce8d6;
  --gold: #ffd485;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

canvas#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 20px;
}

.top-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.sector-card {
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 11px 16px;
  max-width: 420px;
}

.sector-card h1 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: 0.015em;
  color: var(--text);
}

.sector-card p {
  margin-top: 4px;
  font-size: 12.2px;
  line-height: 1.45;
  color: var(--muted);
}

.telemetry {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric strong {
  font-size: 14px;
  color: var(--text);
}

.fuel-track {
  width: 96px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.fuel-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.08s linear;
}

.bottom-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.level-bar, .quick-actions {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  padding: 6px 10px;
}

.lvl-btn, .icon-btn {
  appearance: none;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.lvl-btn:hover, .icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.lvl-btn.current {
  background: rgba(124, 232, 214, 0.18);
  border-color: rgba(124, 232, 214, 0.5);
  color: #d6fff8;
}

.lvl-btn.done {
  color: var(--gold);
}

.keys-hint {
  pointer-events: none;
  font-size: 11.5px;
  color: rgba(210, 224, 255, 0.45);
}

/* Overlay modal */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 18, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal {
  width: min(440px, calc(100vw - 32px));
  background: rgba(15, 21, 40, 0.94);
  border: 1px solid rgba(186, 210, 255, 0.22);
  border-radius: 22px;
  padding: 26px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.modal-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(255, 212, 133, 0.12);
  border: 1px solid rgba(255, 212, 133, 0.35);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.modal h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.modal p {
  font-size: 13.8px;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.cta {
  appearance: none;
  border: 1px solid rgba(124, 232, 214, 0.5);
  background: rgba(124, 232, 214, 0.18);
  color: #dcfff9;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
}

.cta:hover {
  background: rgba(124, 232, 214, 0.28);
}

.cta.secondary {
  border-color: rgba(186, 210, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

@media (max-width: 760px) {
  .keys-hint { display: none; }
}
