/* Asteroid Launcher – Split Layout & Leaflet Map Styling */
:root {
  --bg-sidebar: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --accent-black: #000000;
  --accent-blue: #0071e3;
  --accent-crater: #1f2937;
  --accent-fire: #ea580c;
  --accent-shock: #0284c7;
  --accent-wind: #eab308;
  --accent-quake: #9333ea;
  --sidebar-w: 440px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

.app-wrapper {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Map Container (Left Area) */
.map-container {
  flex: 1;
  height: 100vh;
  position: relative;
  z-index: 1;
  background: #cbd5e1;
}

#map {
  width: 100%;
  height: 100%;
  filter: brightness(112%) saturate(155%) hue-rotate(4deg);
}

/* Flash Explosion Overlay Canvas */
#flash-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 500;
}

/* Map Top Navigation Bar */
.map-nav {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.back-hub-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.6rem 1.1rem;
  border-radius: 50px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transition: all 0.2s ease;
}

.back-hub-btn:hover {
  transform: translateY(-2px);
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.map-action-btn {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text-main);
  padding: 0.6rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.map-action-btn:hover {
  background: #ffffff;
  transform: translateY(-2px);
}

/* Floating Map Prompt Badge */
.target-prompt-pill {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #000000;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.75rem 1.6rem;
  border-radius: 50px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 600;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: promptBounce 2s infinite ease-in-out;
  transition: opacity 0.3s ease;
}

@keyframes promptBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

.target-prompt-pill.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Target Custom Marker Pulsing Ring */
.target-pulse-marker {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.target-pulse-dot {
  width: 14px;
  height: 14px;
  background: #ef4444;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  z-index: 2;
}

.target-pulse-wave {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #ef4444;
  animation: markerWave 1.5s infinite ease-out;
  z-index: 1;
}

@keyframes markerWave {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Right Control & Results Sidebar */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.06);
  z-index: 700;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

/* Sidebar Header */
.sidebar-header {
  padding: 1.8rem 1.8rem 1.2rem 1.8rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-title {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-main);
}

.unit-switch-btn {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-switch-btn:hover {
  background: #e5e7eb;
}

/* Setup Panel */
.setup-panel {
  padding: 1.6rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

/* Asteroid 3D Rotating Preview Carousel */
.asteroid-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 1.2rem 1.4rem;
}

.arrow-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: all 0.2s ease;
}

.arrow-btn:hover {
  transform: scale(1.08);
  border-color: var(--text-main);
}

.asteroid-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#asteroid-preview-canvas {
  width: 110px;
  height: 110px;
}

.asteroid-type-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.asteroid-density-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Parameter Sliders */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.slider-val-tag {
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.custom-range {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
  outline: none;
}

.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #000000;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.15s ease;
}

.custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Launch Action Button */
.btn-launch-asteroid {
  background: #000000;
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1.1rem;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

.btn-launch-asteroid:hover {
  transform: translateY(-2px);
  background: #1e293b;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.btn-launch-asteroid:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Results Report Panel */
.results-panel {
  display: none;
  padding: 1.6rem 1.8rem;
  flex-direction: column;
  gap: 1.4rem;
}

.results-panel.active {
  display: flex;
}

.impact-energy-banner {
  background: #0f172a;
  color: #ffffff;
  padding: 1.2rem;
  border-radius: 20px;
  text-align: center;
}

.energy-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.energy-value {
  font-family: 'Space Mono', monospace;
  font-size: 1.6rem;
  font-weight: 900;
  color: #facc15;
  margin: 4px 0;
}

.energy-sub {
  font-size: 0.8rem;
  color: #cbd5e1;
}

/* Scientific Impact Cards */
.impact-card {
  border-radius: 18px;
  padding: 1.2rem;
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.impact-card.card-crater { background: #f9fafb; border-color: #d1d5db; }
.impact-card.card-fireball { background: #fff7ed; border-color: #fed7aa; }
.impact-card.card-shockwave { background: #f0f9ff; border-color: #bae6fd; }
.impact-card.card-wind { background: #fefce8; border-color: #fef08a; }
.impact-card.card-earthquake { background: #faf5ff; border-color: #e9d5ff; }

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-icon {
  font-size: 1.3rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.metric-stat {
  font-family: 'Space Mono', monospace;
  font-size: 1.3rem;
  font-weight: 800;
}

.card-crater .metric-stat { color: #1f2937; }
.card-fireball .metric-stat { color: #c2410c; }
.card-shockwave .metric-stat { color: #0284c7; }
.card-wind .metric-stat { color: #a16207; }
.card-earthquake .metric-stat { color: #7e22ce; }

.impact-desc-list {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  padding-left: 1.2rem;
}

.btn-reset-launcher {
  background: #ffffff;
  color: var(--text-main);
  border: 2px solid #000000;
  font-size: 1rem;
  font-weight: 800;
  padding: 0.9rem;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  margin-top: 0.6rem;
}

.btn-reset-launcher:hover {
  background: #000000;
  color: #ffffff;
}

/* Hidden SEO Article */
.seo-article {
  position: absolute;
  top: 100000px;
  left: 0;
  width: 100%;
}

/* Responsive Mobile Layout */
@media (max-width: 900px) {
  .app-wrapper {
    flex-direction: column;
  }
  .map-container {
    height: 50vh;
  }
  .sidebar {
    width: 100vw;
    height: 50vh;
  }
}
