/* Mass Driver Construction Web Experience CSS */

:root {
  --mass-emerald: #10b981;
  --mass-cyan: #06b6d4;
  --mass-gold: #fbbf24;
  --mass-bg: #020617;
  --mass-glass: rgba(15, 23, 42, 0.72);
  --mass-glass-border: rgba(255, 255, 255, 0.12);
}

body {
  background-color: var(--mass-bg);
  color: #f8fafc;
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  overflow-x: hidden;
  user-select: none;
}

#massdriver-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#massdriver-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* Cybernetic HUD Overlay Layer */
.hud-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1rem, 2vw, 1.75rem);
  box-sizing: border-box;
}

.hud-interactive {
  pointer-events: auto;
}

.hud-glass-panel {
  background: var(--mass-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--mass-glass-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
  border-radius: 14px;
}

/* 1. Top Telemetry Bar */
.hud-top-bar {
  display: flex;
  align-items: center;
  width: fit-content;
  max-width: calc(100% - 410px);
  padding: 0.75rem 1.4rem;
  margin-top: 3.5rem; /* Space below sticky global knav */
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.telemetry-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-family: "JetBrains Mono", monospace;
}

.telemetry-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  color: #f1f5f9;
}

/* 2. Right Phase Info Panel */
.hud-phase-card {
  position: absolute;
  right: clamp(1rem, 2vw, 1.75rem);
  top: 4.75rem; /* Neatly aligned below global knav */
  width: min(370px, calc(100vw - 2rem));
  max-height: calc(100vh - 17rem);
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.3s ease;
}

.phase-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  width: fit-content;
}

.phase-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
}

.phase-subtitle {
  font-size: 0.82rem;
  color: #38bdf8;
  font-family: "JetBrains Mono", monospace;
}

.phase-desc {
  font-size: 0.88rem;
  line-height: 1.65;
  color: #cbd5e1;
}

.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.spec-box {
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
}

.spec-k {
  font-size: 0.62rem;
  font-family: "JetBrains Mono", monospace;
  color: #94a3b8;
  text-transform: uppercase;
}

.spec-v {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  color: #f8fafc;
}

/* 3. Bottom Control Dock */
.hud-bottom-dock {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.slider-container {
  width: 100%;
  padding: 1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
}

.build-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.build-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
  cursor: grab;
  box-shadow: 0 0 14px #10b981;
  transition: transform 0.1s;
}

.build-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
}

.phase-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  width: 100%;
  padding-bottom: 0.25rem;
}

.phase-pill-btn {
  flex: 1;
  min-width: 130px;
  padding: 0.55rem 0.75rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border-radius: 8px;
  font-size: 0.75rem;
  font-family: "JetBrains Mono", monospace;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.phase-pill-btn:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.phase-pill-btn.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

/* Action Controls Buttons Bar */
.actions-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 23, 42, 0.6);
  color: #f1f5f9;
}

.hud-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.35);
}

.hud-btn-primary {
  background: linear-gradient(135deg, #059669, #0d9488);
  border-color: #34d399;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
}

.hud-btn-primary:hover {
  background: linear-gradient(135deg, #10b981, #14b8a6);
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.6);
}

.hud-btn-launch {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
}

.hud-btn-launch:hover {
  background: linear-gradient(135deg, #0ea5e9, #3b82f6);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.65);
}

/* Dragging cursor hint */
.canvas-hint {
  position: absolute;
  top: 4.8rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: #94a3b8;
  font-family: "JetBrains Mono", monospace;
  background: rgba(2, 6, 23, 0.65);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.5s;
}

@media (max-width: 768px) {
  .hud-phase-card {
    position: static;
    width: 100%;
    margin-top: 0.5rem;
    max-height: 180px;
    padding: 1rem;
  }
  .hud-top-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .actions-bar {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Cybernetic Preloader Overlay */
.cyber-loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #020617;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s;
}

.cyber-loader-overlay.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: min(440px, 90vw);
  text-align: center;
}

.loader-logo {
  font-family: "Outfit", sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  color: #34d399;
  text-transform: uppercase;
}

.loader-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.05em;
}

.loader-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.loader-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #059669, #10b981, #38bdf8);
  box-shadow: 0 0 16px #10b981;
  transition: width 0.15s ease-out;
}

.loader-status {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: #94a3b8;
}

#loader-percent {
  color: #34d399;
  font-weight: 700;
}
