/* ======= LANDING PAGE CTAs ======= */
.hero-ctas {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.cta-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 2rem;
  background: var(--accent);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  letter-spacing: 0.01em;
}

.cta-primary:hover {
  background: #7c3aed;
  transform: translateY(-2px);
}

.cta-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 2rem;
  background: transparent;
  color: var(--fg-dim);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(139,92,246,0.25);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.cta-secondary:hover {
  border-color: var(--accent);
  color: #fff;
}

/* ======= GAME NAV ======= */
.game-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(10, 10, 18, 0.95);
  border-bottom: 1px solid rgba(139, 92, 246, 0.12);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.nav-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.01em;
  margin-right: 0.5rem;
}

.nav-logo:hover { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-dim);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover, .nav-link.active {
  background: rgba(139, 92, 246, 0.12);
  color: #fff;
}

.nav-credits {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 8px;
  padding: 0.35rem 0.8rem;
}

.credits-icon { color: var(--gold); font-size: 0.95rem; }
.credits-label { font-size: 0.8rem; color: var(--fg-muted); }
#nav-credits-val { font-family: 'Outfit', sans-serif; font-weight: 700; color: var(--gold); font-size: 0.95rem; }

/* ======= BUILDER LAYOUT ======= */
.builder-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 52px);
  background: var(--bg);
}

/* COMPONENT TRAY */
.component-tray {
  padding: 1.5rem 1rem;
  border-right: 1px solid rgba(139, 92, 246, 0.1);
  background: var(--bg-surface);
  overflow-y: auto;
  max-height: calc(100vh - 52px);
}

.tray-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 1.25rem;
  padding-left: 0.25rem;
}

.component-group { margin-bottom: 1.75rem; }

.group-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
  padding-left: 0.25rem;
  opacity: 0.8;
}

.component-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  cursor: grab;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}

.component-item:hover {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.06);
}

.component-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.component-item.locked {
  opacity: 0.6;
}

.component-item.locked::after {
  content: '🔒';
  font-size: 0.7rem;
  margin-left: auto;
}

.comp-icon { width: 36px; height: 20px; flex-shrink: 0; }
.hull-icon { height: 18px; }
.engine-icon, .shield-icon { width: 24px; height: 24px; }

.comp-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.comp-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}

.comp-stat {
  font-size: 0.72rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

.comp-cost {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
}

/* SHIP FRAME AREA */
.ship-frame-area {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.frame-header { }
.ship-name-row { margin-bottom: 0.5rem; }

.ship-name-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(139, 92, 246, 0.2);
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  outline: none;
  width: 100%;
  max-width: 400px;
  padding-bottom: 0.25rem;
  transition: border-color 0.2s;
}

.ship-name-input:focus { border-color: var(--accent); }

.frame-hint {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* Ship Canvas (drop area) */
.ship-canvas {
  background: var(--bg-card);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  min-height: 280px;
  position: relative;
}

.ship-wings {
  display: flex;
  gap: 3rem;
  align-items: center;
}

/* Drop zones */
.drop-zone {
  border: 2px dashed rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  padding: 0.75rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.drop-zone.drop-active {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.08);
}

.dz-hull { width: 280px; }
.dz-engine, .dz-shield { width: 110px; }

.dz-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.5rem;
}

.dz-content svg { width: 100%; height: auto; display: block; }
.dz-placeholder { opacity: 0.5; }

/* Ship stats */
.ship-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 320px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-muted);
  width: 56px;
  flex-shrink: 0;
  text-align: right;
}

.stat-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.35s ease;
  width: 0%;
}

.speed-fill { background: linear-gradient(90deg, #38bdf8, #818cf8); }
.defense-fill { background: linear-gradient(90deg, var(--accent), #a78bfa); }
.thrust-fill { background: linear-gradient(90deg, var(--gold), #fb923c); }

/* Builder actions */
.builder-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.build-message {
  font-size: 0.9rem;
  min-height: 1.4em;
  flex: 1;
}
.msg-success { color: #4ade80; }
.msg-error { color: #f87171; }

.btn-primary, .btn-forge {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.75rem;
  background: var(--accent);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.btn-primary:hover, .btn-forge:hover { background: #7c3aed; transform: translateY(-1px); }
.btn-primary:disabled, .btn-forge:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary, .btn-launch {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.75rem;
  background: transparent;
  color: var(--fg-dim);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  border: 1px solid rgba(139, 92, 246, 0.3);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.btn-secondary:hover, .btn-launch:hover { border-color: var(--accent); color: #fff; }

/* Saved ships */
.saved-ships { border-top: 1px solid rgba(139, 92, 246, 0.1); padding-top: 1.5rem; }

.saved-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 1rem;
}

.fleet-empty { font-size: 0.9rem; color: var(--fg-muted); }

.fleet-list { display: flex; flex-direction: column; gap: 0.75rem; }

.fleet-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.fleet-card:hover { border-color: rgba(139, 92, 246, 0.3); }
.fleet-card.selected { border-color: var(--accent); background: rgba(139, 92, 246, 0.06); }

.fleet-card-info { display: flex; flex-direction: column; gap: 0.2rem; }
.fleet-ship-name { font-weight: 700; font-size: 0.95rem; color: #fff; }
.fleet-ship-config { font-size: 0.8rem; color: var(--fg-muted); }

.fleet-card-meta { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.fleet-credits { font-weight: 700; color: var(--gold); font-size: 0.9rem; }

.btn-select-ship {
  padding: 0.35rem 0.85rem;
  background: transparent;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 8px;
  color: var(--fg-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-select-ship:hover { border-color: var(--accent); color: #fff; }

/* ======= GAME WRAPPER ======= */
.game-wrapper {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 52px);
  padding-bottom: 1rem;
}

/* HUD */
.game-hud {
  width: 100%;
  max-width: 800px;
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  gap: 1rem;
}

.hud-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.hud-center { flex: 1; align-items: center; }
.hud-right { align-items: flex-end; min-width: 120px; }

.hud-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.hud-value {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--fg);
}

.hud-hp { width: 120px; height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.hp-bar { height: 100%; background: var(--accent); border-radius: 4px; width: 100%; transition: width 0.2s, background 0.3s; }

/* CANVAS */
#game-canvas {
  display: block;
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 12px;
  background: #050510;
  image-rendering: pixelated;
}

/* OVERLAYS */
.game-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 16, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.overlay-card {
  background: var(--bg-card);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  max-width: 460px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.overlay-card h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
}

.overlay-card p {
  font-size: 0.95rem;
  color: var(--fg-dim);
  line-height: 1.65;
}

.overlay-controls {
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control-hint {
  font-size: 0.85rem;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.4rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: monospace;
  color: var(--fg);
}

/* Ship info in overlay */
.overlay-ship-info .ship-summary {
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-align: left;
}

.ss-name { font-weight: 700; font-size: 1rem; color: #fff; }
.ss-config { font-size: 0.8rem; color: var(--fg-muted); }
.ss-stats { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--fg-dim); }

.overlay-no-ship {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.overlay-no-ship p { color: #f87171; font-size: 0.9rem; }

.btn-launch-game {
  margin-top: 0.25rem;
}

/* Result overlay */
.result-icon { font-size: 3.5rem; line-height: 1; }

.result-stats {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.result-stat {
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 90px;
}

.accent-stat {
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.05);
}

.rs-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-muted); }
.rs-value { font-family: 'Outfit', sans-serif; font-size: 1.15rem; font-weight: 800; color: #fff; }
.accent-stat .rs-value { color: var(--gold); }

.result-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ======= RESPONSIVE ======= */
@media (max-width: 768px) {
  .builder-layout {
    grid-template-columns: 1fr;
  }

  .component-tray {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    padding: 1rem;
  }

  .ship-wings {
    gap: 1.5rem;
  }

  .dz-hull { width: 220px; }
  .dz-engine, .dz-shield { width: 90px; }

  .ship-frame-area { padding: 1.25rem; }

  .game-hud { padding: 0.4rem 0.5rem; gap: 0.5rem; }
  .hud-value { font-size: 0.8rem; }

  .overlay-card { padding: 1.5rem 1.25rem; }
  .overlay-card h2 { font-size: 1.4rem; }
}
