@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&family=Roboto+Mono:wght@400;700&display=swap');

/* Floating close chip for small screens */
.floating-close-chip {
  position: fixed;
  right: 10px;
  top: 10px;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2005;
  backdrop-filter: blur(6px);
}

@media (max-width: 480px) {
  .floating-close-chip {
    display: flex;
  }
}

:root {
  /* Color grading themes (can be adjusted via JS) */
  --theme-hue-shift: 0deg; /* 0: neutral, 220deg: cool, 40deg: warm */
  --theme-contrast: 1;
  --theme-brightness: 1;
}

/* ===== Splash screen ===== */
#splash {
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0 */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  z-index: 3000; /* above every UI element */
  opacity: 0;
  animation:
    splashFadeIn 1.6s ease-out 0s forwards,
    splashFadeOut 1.2s ease-in 2.3s forwards;
}

/* Hide UI elements during splash screen */
.ui-container,
#overlay,
#scenarioInfoDisplay,
#scenarioInfoBox,
.mobile-menu-toggle,
.mobile-menu-dropdown {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 1s ease-in,
    visibility 0s linear 1s;
  pointer-events: none;
}

/* Show UI elements after splash */
.ui-container.showUI,
#scenarioInfoDisplay.showUI,
#scenarioInfoBox.showUI,
.mobile-menu-toggle.showUI {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 1s ease-in,
    visibility 0s linear 0s;
  pointer-events: auto;
}

/* Special handling for overlay to include its fade-in animation */
#overlay.showUI {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: fadeInOverlay 1.5s ease-out forwards;
}

/* Mobile menu dropdown should remain hidden until explicitly shown */
.mobile-menu-dropdown.showUI {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 1s ease-in,
    visibility 0s linear 0s;
  pointer-events: auto;
  display: none; /* Keep it hidden even after splash */
}

/* Ensure scenario info box is properly styled when shown with showUI class */
#scenarioInfoBox.showUI {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: scenarioInfoSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
#splash h1 {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: clamp(4rem, 8vw, 8rem);
  letter-spacing: 0.12em;
  color: var(--primary-color);
  text-shadow: 0 0 25px var(--primary-color);
  opacity: 0;
  animation: logoFadeIn 1s ease-out 0.3s forwards;
}

@keyframes logoFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/*  hidden until JS adds .showCanvas  */
#simulationCanvas,
#starfieldCanvas {
  opacity: 0; /* fully transparent       */
  visibility: hidden; /* not rendered at all     */
  transition: opacity 1.2s ease-in; /* fade-in only */
}

/* Apply global color grading to the whole page */
html,
body {
  filter: hue-rotate(var(--theme-hue-shift)) contrast(var(--theme-contrast))
    brightness(var(--theme-brightness));
}

/*  added by JS after splash is gone  */
#simulationCanvas.showCanvas,
#starfieldCanvas.showCanvas {
  visibility: visible; /* render now              */
  opacity: 1; /* and fade up to opaque   */
}

/* --- keyframes --- */
@keyframes splashFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes splashFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

:root {
  --bg-color: #0d0d1a;
  --text-color: #e0e0e0;
  --primary-color: #00aaff;
  --secondary-color: #ffaa00;
  --panel-bg: rgba(20, 20, 40, 0.95);
  --button-bg: #333;
  --button-hover-bg: #555;
  --button-apply-bg: #28a745;
  --button-apply-hover-bg: #218838;
  --separator-color: #00aaff80;
}

/* === layered canvases === */
.sim-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#starfieldCanvas {
  z-index: 1;
} /* back-most */
#simulationCanvas {
  z-index: 2;
} /* front */

/* Responsive layout system */
html {
  box-sizing: border-box;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Poppins', sans-serif;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Ensure clean splash screen start */
html,
body {
  background-color: var(--bg-color);
}

/* Main simulation container */
.simulation-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  opacity: 0;
  animation: fadeInSimulation 1.5s ease-out forwards;
}

@keyframes fadeInSimulation {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#simulationCanvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#starfieldCanvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#overlay {
  position: fixed;
  top: 10px;
  left: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #e0e0e0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  line-height: 1.6;
  z-index: 10;
  max-width: 384px; /* ~1.2x wider than previous 320px */
  word-wrap: break-word;
  overflow-wrap: anywhere;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

/* Enable pointer events for the minimize button */
#overlay .overlay-minimize-btn {
  pointer-events: auto !important;
}

/* When minimized, enable pointer events for the entire overlay */
#overlay.minimized {
  pointer-events: auto !important;
}

/* Overlay minimize button */
.overlay-minimize-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #ffffff;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  z-index: 11;
  pointer-events: auto !important;
  width: 28px;
  height: 28px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  /* Ensure button is always visible when overlay is visible */
  opacity: 1 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  /* Force visibility */
  visibility: visible !important;
}

.overlay-minimize-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.overlay-minimize-btn:active {
  transform: scale(0.95);
}

/* Minimized overlay state */
#overlay.minimized {
  width: auto !important;
  max-width: 200px !important;
  height: auto !important;
  padding: 8px 12px !important;
  pointer-events: auto !important;
  background: rgba(0, 0, 0, 0.5) !important;
}

#overlay.minimized .overlay-minimize-btn {
  transform: rotate(180deg);
}

#overlay.minimized .category-label,
#overlay.minimized .important-stat,
#overlay.minimized .separator-line {
  display: none !important;
}

/* Data panel styling improvements */
#overlay .category-label {
  font-weight: 600;
  color: #ffffff;
}

#overlay .important-stat {
  font-size: 15px;
  font-weight: 500;
}

#overlay .separator-line {
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
  margin: 8px 0;
  border-radius: 1px;
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Hide data panel on mobile devices */
@media (max-width: 1024px) {
  #overlay {
    display: none !important;
  }
}

#scenarioInfoDisplay {
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: min(90%, 640px);
  max-width: 600px;
  padding: 10px 20px;
  background: var(--panel-bg);
  border: 1px solid var(--separator-color);
  border-radius: 8px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 1s ease-in,
    visibility 0s linear 1s;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  animation: fadeInScenarioInfo 1.5s ease-out forwards;
}

@keyframes fadeInScenarioInfo {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 1024px) {
  #scenarioInfoDisplay {
    top: 10px;
    width: 95%;
    max-width: none;
    padding: 8px 16px;
  }

  #scenarioInfoDisplay h4 {
    font-size: 16px;
  }

  #scenarioInfoDisplay p {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  /* General UI scaling for small screens */
  .ui-button {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
  }
  .speed-controls {
    gap: 6px;
    padding: 6px 8px;
  }
  .speed-btn {
    padding: 5px 10px;
    font-size: 11px;
    min-width: 50px;
  }
  .speed-display {
    font-size: 12px;
    min-width: 42px;
  }
  #scenarioInfoDisplay {
    top: 5px;
    width: 98%;
    padding: 6px 12px;
  }

  #scenarioInfoDisplay h4 {
    font-size: 15px;
  }

  #scenarioInfoDisplay p {
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  #scenarioInfoDisplay {
    top: 5px;
    width: 98%;
    padding: 6px 12px;
  }

  #scenarioInfoDisplay h4 {
    font-size: 15px;
  }

  #scenarioInfoDisplay p {
    font-size: 12px;
  }
}

@media (max-width: 1024px) {
  #overlay {
    top: 10px;
    left: 10px;
    font-size: 12px;
    max-width: calc(100vw - 20px);
    padding: 8px;
  }

  #overlay .important-stat {
    font-size: 13px;
  }

  #overlay .separator-line {
    margin: 6px 0;
  }

  #scenarioInfoDisplay {
    top: 10px;
    width: 95%;
    max-width: none;
    padding: 8px 16px;
  }

  #scenarioInfoDisplay h4 {
    font-size: 16px;
  }

  #scenarioInfoDisplay p {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  #overlay {
    top: 10px;
    left: 10px;
    font-size: 11px;
    max-width: calc(100vw - 20px);
    padding: 6px;
  }

  #overlay .important-stat {
    font-size: 12px;
  }

  #overlay .separator-line {
    margin: 4px 0;
  }

  #scenarioInfoDisplay {
    top: 5px;
    width: 98%;
    padding: 6px 12px;
  }

  #scenarioInfoDisplay h4 {
    font-size: 15px;
  }

  #scenarioInfoDisplay p {
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  #overlay {
    top: 10px;
    left: 10px;
    font-size: 10px;
    max-width: calc(100vw - 20px);
    padding: 5px;
    line-height: 1.4;
  }

  #overlay .important-stat {
    font-size: 11px;
  }

  #overlay .separator-line {
    margin: 3px 0;
  }
}
#scenarioInfoDisplay.visible {
  opacity: 1;
}
#scenarioInfoDisplay h4 {
  margin: 0 0 5px 0;
  font-size: 18px;
  color: var(--primary-color);
  font-weight: 600;
}
#scenarioInfoDisplay p {
  margin: 0;
  font-size: 14px;
  color: var(--text-color);
  line-height: 1.4;
}

/* Object Inspector Modal */
#objectInspector {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  background: rgba(13, 13, 26, 0.95);
  backdrop-filter: blur(20px);
  border: 2px solid var(--primary-color);
  border-radius: 15px;
  box-shadow: 0 0 40px rgba(0, 170, 255, 0.3);
  z-index: 2000;
  display: none;
  color: var(--text-color);
  font-family: 'Poppins', sans-serif;
  overflow: hidden;
  flex-direction: column;
  /* No transitions by default to prevent jumping */
  transition: none;
  /* Ensure it can be positioned anywhere */
  transform-origin: center;
}

#objectInspector.visible {
  display: flex !important;
  opacity: 1 !important;
  transform: translate(-50%, -50%) scale(1);
  transition: none !important;
}

#objectInspector.minimized {
  width: auto !important;
  max-width: 300px !important;
  height: auto !important;
  max-height: none !important;
}

#objectInspector.minimized .inspector-content {
  display: none !important;
}

#objectInspector.minimized .inspector-header {
  padding: 15px 20px !important;
  border-bottom: none !important;
}

#objectInspector.minimized .inspector-minimize {
  transform: rotate(180deg);
}

/* When dragging, disable transitions */
#objectInspector.dragging {
  transition: none !important;
  user-select: none;
  box-shadow:
    0 0 50px rgba(0, 170, 255, 0.5),
    0 8px 32px rgba(0, 0, 0, 0.3) !important;
  border-color: #00ccff !important;
}

/* Ensure inspector never inherits unwanted transitions */
#objectInspector {
  transition: none !important;
}

/* Allow transitions only for specific elements when not dragging */
#objectInspector:not(.dragging) .inspector-minimize,
#objectInspector:not(.dragging) .inspector-close {
  transition: all 0.2s ease !important;
}

@keyframes inspectorFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px 15px 25px;
  border-bottom: 1px solid var(--separator-color);
  background: linear-gradient(
    135deg,
    rgba(0, 170, 255, 0.1),
    rgba(0, 170, 255, 0.05)
  );
  flex-shrink: 0;
  /* Make header draggable */
  cursor: grab;
  user-select: none;
}

.inspector-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Prevent dragging when clicking on controls */
  cursor: default;
}

.inspector-header:active {
  cursor: grabbing;
}

.inspector-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0;
  display: flex;
  align-items: center;
  text-shadow: 0 0 10px rgba(0, 170, 255, 0.5);
  /* Prevent text selection during drag */
  pointer-events: none;
}

.inspector-minimize {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  padding: 8px;
  border-radius: 5px;
  transition: all 0.2s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
}

.inspector-minimize:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-color);
  transform: scale(1.1);
}

.inspector-close {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: 5px;
  transition: all 0.2s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
}

.inspector-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary-color);
  transform: scale(1.1);
}

.inspector-delete {
  background: none;
  border: none;
  color: #ff6b6b;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 5px;
  transition: all 0.2s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
  margin-right: 8px;
}

.inspector-delete:hover {
  background: rgba(255, 107, 107, 0.2);
  color: #ff4757;
  transform: scale(1.1);
}

.inspector-delete:active {
  background: rgba(255, 107, 107, 0.3);
  transform: scale(0.95);
}

.inspector-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 25px;
  line-height: 1.5;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Custom scrollbar for inspector */
.inspector-content::-webkit-scrollbar {
  width: 8px;
}

/* Stat row styles for object inspector */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  font-weight: 500;
  color: var(--text-color);
  opacity: 0.8;
  font-size: 14px;
}

.stat-value {
  font-weight: 600;
  color: var(--primary-color);
  text-align: right;
  font-size: 14px;
}

.object-description {
  margin-top: 20px;
  padding: 15px;
  background: rgba(0, 170, 255, 0.05);
  border-radius: 8px;
  border-left: 3px solid var(--primary-color);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-color);
}

/* Habitable zone controls inside the object inspector */
.inspector-hz-block {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 170, 255, 0.18);
}

.inspector-hz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.inspector-hz-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  color: #e0e0e0;
}

.inspector-hz-toggle input[type='checkbox'] {
  accent-color: #22c55e;
}

.inspector-hz-description {
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(224, 224, 224, 0.9);
  margin-top: 2px;
}

/* Kepler's 2nd Law area sweep controls inside the object inspector */
.inspector-sweep-block {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 170, 255, 0.18);
}

.inspector-sweep-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  cursor: pointer;
}

.inspector-sweep-description {
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(224, 224, 224, 0.9);
  margin-top: 2px;
}

.object-icon {
  margin-right: 8px;
  font-size: 1.2em;
}

.inspector-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.inspector-content::-webkit-scrollbar-thumb {
  background: rgba(0, 170, 255, 0.6);
  border-radius: 4px;
}

.inspector-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 170, 255, 0.8);
}

.inspector-tabs {
  display: flex;
  margin-bottom: 20px;
  background: linear-gradient(
    135deg,
    rgba(0, 170, 255, 0.05),
    rgba(0, 170, 255, 0.02)
  );
  border: 1px solid rgba(0, 170, 255, 0.15);
  border-radius: 12px;
  padding: 4px;
  backdrop-filter: blur(10px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.2);
}

.inspector-tab {
  flex: 1;
  padding: 12px 20px;
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  opacity: 0.7;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inspector-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 170, 255, 0.1),
    rgba(0, 170, 255, 0.05)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 8px;
}

.inspector-tab:hover::before {
  opacity: 1;
}

.inspector-tab.active {
  color: #ffffff;
  background: linear-gradient(
    135deg,
    rgba(0, 170, 255, 0.8),
    rgba(0, 170, 255, 0.6)
  );
  opacity: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow:
    0 4px 12px rgba(0, 170, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.inspector-tab.active::before {
  opacity: 0;
}

.inspector-tab:hover:not(.active) {
  opacity: 1;
  color: var(--primary-color);
  transform: translateY(-1px);
}

.inspector-tab:active {
  transform: translateY(0);
  transition: transform 0.1s ease;
}

.tab-icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 16px;
  transition: transform 0.2s ease;
}

.tab-text {
  display: inline-block;
}

.inspector-tab:hover .tab-icon {
  transform: scale(1.1);
}

.inspector-tab.active .tab-icon {
  transform: scale(1.1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.inspector-tab-content {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inspector-tab-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: tabContentFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tabContentFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px 20px;
  margin-bottom: 20px;
}

.stat-card {
  background: rgba(0, 170, 255, 0.08);
  border: 1px solid rgba(0, 170, 255, 0.2);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

.stat-card:hover {
  background: rgba(0, 170, 255, 0.12);
  border-color: rgba(0, 170, 255, 0.4);
  transform: translateY(-2px);
}

.stat-card.highlight {
  background: rgba(255, 170, 0, 0.1);
  border-color: rgba(255, 170, 0, 0.3);
}

.stat-card.warning {
  background: rgba(255, 69, 0, 0.1);
  border-color: rgba(255, 69, 0, 0.3);
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--secondary-color);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  color: var(--text-color);
  font-weight: 600;
}

.stat-large {
  grid-column: 1 / -1;
}

.stat-large .stat-value {
  font-size: 16px;
}

.object-description {
  margin-top: 15px;
  padding: 15px;
  background: linear-gradient(
    135deg,
    rgba(0, 170, 255, 0.1),
    rgba(0, 170, 255, 0.05)
  );
  border-radius: 10px;
  border-left: 4px solid var(--primary-color);
  font-style: italic;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.object-icon {
  font-size: 28px;
  margin-right: 12px;
}

/* Mobile responsive inspector */
@media (max-width: 1024px) {
  #objectInspector {
    width: 95%;
    max-width: none;
    max-height: 90vh;
    top: 5%;
    left: 2.5%;
    transform: none !important;
  }

  #objectInspector.visible {
    transform: none !important;
  }

  .inspector-tabs {
    margin-bottom: 15px;
    padding: 3px;
    border-radius: 10px;
  }

  .inspector-tab {
    padding: 10px 16px;
    font-size: 13px;
    letter-spacing: 0.3px;
  }

  .tab-icon {
    font-size: 14px;
    margin-right: 6px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .inspector-header {
    padding: 15px 20px 12px 20px;
  }

  .inspector-title {
    font-size: 18px;
  }

  .inspector-content {
    padding: 15px 20px;
  }

  .inspector-close {
    width: 44px;
    height: 44px;
    font-size: 28px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
  }

  .inspector-delete {
    width: 44px;
    height: 44px;
    font-size: 24px;
    background: rgba(255, 107, 107, 0.15);
    border-radius: 8px;
    margin-right: 8px;
  }

  .inspector-minimize {
    width: 44px;
    height: 44px;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
  }
}

/* Rendering performance hints for large canvases */
#simulationCanvas,
#starfieldCanvas {
  will-change: transform;
  contain: strict;
}

@media (max-width: 480px) {
  #objectInspector {
    width: 98%;
    max-height: 95vh;
    top: 2.5%;
    left: 1%;
    border-radius: 12px;
    transform: none !important;
  }

  #objectInspector.visible {
    transform: none !important;
  }

  .inspector-tabs {
    margin-bottom: 12px;
    padding: 2px;
    border-radius: 8px;
  }

  .inspector-tab {
    padding: 8px 12px;
    font-size: 12px;
    letter-spacing: 0.2px;
  }

  .tab-icon {
    font-size: 12px;
    margin-right: 4px;
  }

  .inspector-header {
    padding: 12px 16px;
  }

  .inspector-title {
    font-size: 16px;
  }

  .inspector-content {
    padding: 12px 16px;
  }

  .inspector-minimize {
    width: 40px;
    height: 40px;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
  }

  .inspector-close {
    width: 48px;
    height: 48px;
    font-size: 32px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
  }

  .inspector-delete {
    width: 48px;
    height: 48px;
    font-size: 28px;
    background: rgba(255, 107, 107, 0.2);
    border-radius: 10px;
    margin-right: 8px;
  }
}

/* Responsive UI Container */
.ui-container {
  position: fixed;
  top: 15px;
  right: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
  max-width: calc(100vw - 30px);
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeInUI 1.5s ease-out forwards;
}

@keyframes fadeInUI {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hide mobile instructions by default on desktop */
#mobileInstructions {
  display: none;
}

/* Mobile menu styles */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  right: 15px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.mobile-menu-toggle .hamburger {
  width: 24px;
  height: 2px;
  background: white;
  margin: 0 auto;
  transition: all 0.3s ease;
  display: block;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.mobile-menu-toggle .hamburger:nth-child(1) {
  top: 14px;
}

.mobile-menu-toggle .hamburger:nth-child(2) {
  top: 22px;
}

.mobile-menu-toggle .hamburger:nth-child(3) {
  top: 30px;
}

.mobile-menu-toggle.active .hamburger:nth-child(1) {
  transform: translateX(-50%) rotate(45deg) translate(0, 8px);
}

.mobile-menu-toggle.active .hamburger:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger:nth-child(3) {
  transform: translateX(-50%) rotate(-45deg) translate(0, -8px);
}

.mobile-menu-dropdown {
  display: none;
  position: fixed;
  top: 80px;
  right: 15px;
  background: rgba(13, 13, 26, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 170, 255, 0.3);
  border-radius: 12px;
  padding: 15px;
  z-index: 1000;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.mobile-menu-dropdown.show {
  display: flex;
  animation: mobileMenuSlideIn 0.3s ease-out;
}

@keyframes mobileMenuSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.mobile-menu-dropdown .ui-button {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
  border-radius: 8px;
  background: rgba(34, 34, 34, 0.8);
  border: 1px solid rgba(0, 170, 255, 0.2);
  transition: all 0.2s ease;
}

.mobile-menu-dropdown .ui-button:hover {
  background: rgba(44, 44, 44, 0.9);
  border-color: rgba(0, 170, 255, 0.4);
  transform: translateX(5px);
}

.mobile-menu-dropdown .speed-controls {
  width: 100%;
  justify-content: space-between;
  margin: 8px 0;
}

.mobile-menu-dropdown .speed-btn {
  flex: 1;
  margin: 0 4px;
}

/* Mobile object type controls */
.mobile-object-type-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.mobile-object-type-controls .object-type-nav {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 14px;
  border-radius: 8px;
  background: rgba(34, 34, 34, 0.8);
  border: 1px solid rgba(0, 170, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mobile-object-type-controls .object-type-nav:hover {
  background: rgba(0, 170, 255, 0.2);
  border-color: rgba(0, 170, 255, 0.4);
}

.mobile-object-type-controls #mobileObjectTypeBtn {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive breakpoints */
@media (max-width: 1200px) {
  .ui-container {
    gap: 8px;
  }

  .ui-button {
    padding: 8px 12px !important;
    font-size: 13px !important;
    min-height: 36px;
  }

  .speed-controls {
    padding: 8px 10px;
  }

  .speed-btn {
    padding: 6px 10px !important;
    font-size: 12px !important;
    min-width: 55px;
    min-height: 32px;
  }
}

@media (max-width: 1024px) {
  /* Hide desktop UI container on mobile and tablet */
  .ui-container {
    display: none !important;
  }

  /* Show mobile menu toggle */
  .mobile-menu-toggle {
    display: block;
  }

  /* Mobile menu positioning */
  .mobile-menu-toggle {
    top: 10px;
    right: 10px;
    width: 45px;
    height: 45px;
  }

  .mobile-menu-dropdown {
    top: 70px;
    right: 10px;
    left: 10px;
    min-width: auto;
    max-width: none;
  }

  #settingsPanel {
    width: 95%;
    max-width: none;
    height: 95vh;
    max-height: none;
    top: 2.5%;
    left: 2.5%;
    transform: none;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 15px 20px;
  }

  .setting-label {
    justify-self: start;
    text-align: left;
  }

  #mobileInstructions {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(13, 13, 26, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 170, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    z-index: 2000;
    max-width: 300px;
    text-align: center;
  }

  .mobile-instructions-content h3 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
    font-size: 18px;
  }

  .mobile-instructions-content p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.4;
  }
}

@media (max-width: 480px) {
  .mobile-menu-toggle {
    top: 5px;
    right: 5px;
    width: 40px;
    height: 40px;
  }

  .mobile-menu-dropdown {
    top: 55px;
    right: 5px;
    left: 5px;
    padding: 12px;
  }

  .mobile-menu-dropdown .ui-button {
    padding: 10px 14px;
    font-size: 13px;
  }

  #settingsPanel {
    width: 98%;
    height: 98vh;
    top: 1%;
    left: 1%;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  .mobile-menu-toggle {
    top: 3px;
    right: 3px;
    width: 38px;
    height: 38px;
  }

  .mobile-menu-dropdown {
    top: 50px;
    right: 3px;
    left: 3px;
    padding: 10px;
  }

  .mobile-menu-dropdown .ui-button {
    padding: 8px 12px;
    font-size: 12px;
  }

  #objectInspector {
    width: 99%;
    max-height: 98vh;
    top: 1%;
    left: 0.5%;
    transform: none !important;
  }

  #objectInspector.visible {
    transform: none !important;
  }

  .inspector-close {
    width: 52px;
    height: 52px;
    font-size: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
  }
  /* Keep inspector header visible so the X button is always reachable */
  .inspector-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: linear-gradient(
      135deg,
      rgba(0, 170, 255, 0.12),
      rgba(0, 170, 255, 0.06)
    );
  }

  .settings-header {
    padding: 20px 25px;
    font-size: 24px;
  }

  .settings-content {
    padding: 20px 25px;
  }
}

.ui-button {
  padding: 8px 16px;
  background-color: var(--button-bg);
  color: var(--text-color);
  border: 1px solid #666;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  transition:
    background-color 0.2s ease,
    transform 0.1s ease;
  text-align: center;
}

.ui-button:hover {
  background-color: var(--button-hover-bg);
}
.ui-button:active {
  transform: scale(0.98);
}

.speed-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 20, 40, 0.8);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 170, 255, 0.3);
}

.speed-btn {
  padding: 6px 12px;
  font-size: 12px;
  min-width: 60px;
}

.speed-display {
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  color: var(--primary-color);
  text-shadow: 0 0 10px var(--primary-color);
  min-width: 50px;
  text-align: center;
  font-weight: bold;
}

#settingsPanel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 800px;
  height: 90vh;
  max-height: 850px;
  background: rgba(13, 13, 26, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(0, 170, 255, 0.2);
  border-radius: 20px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1200px) {
  #settingsPanel {
    width: 92%;
    max-width: 700px;
    height: 88vh;
  }
}

@media (max-width: 1024px) {
  #settingsPanel {
    width: 95%;
    max-width: none;
    height: 95vh;
    max-height: none;
    top: 2.5%;
    left: 2.5%;
    transform: none;
    border-radius: 15px;
  }
}

@media (max-width: 480px) {
  #settingsPanel {
    width: 98%;
    height: 98vh;
    top: 1%;
    left: 1%;
    border-radius: 12px;
  }
  /* Keep settings header visible with close/cancel access */
  .settings-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: linear-gradient(
      135deg,
      rgba(0, 170, 255, 0.12),
      rgba(0, 170, 255, 0.06)
    );
  }
}

#settingsPanel.hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
  pointer-events: none;
  filter: blur(10px);
}

.settings-header {
  padding: 25px 30px;
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  color: var(--primary-color);
  background: linear-gradient(
    135deg,
    rgba(0, 170, 255, 0.1),
    rgba(0, 170, 255, 0.05)
  );
  border-bottom: 1px solid rgba(0, 170, 255, 0.2);
  border-radius: 20px 20px 0 0;
  text-shadow: 0 0 20px rgba(0, 170, 255, 0.5);
}

.settings-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 25px 35px;
  background: rgba(0, 0, 0, 0.1);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px 35px;
  align-items: center;
}

@media (max-width: 1200px) {
  .settings-grid {
    gap: 20px 25px;
  }
}

@media (max-width: 1024px) {
  .settings-grid {
    gap: 15px 20px;
  }

  .setting-label {
    justify-self: start;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .settings-grid {
    gap: 12px 15px;
  }
}

.setting-item,
.setting-special-button {
  display: contents;
}

.setting-label {
  justify-self: end;
  text-align: right;
  font-size: 15px;
  color: rgba(224, 224, 224, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.setting-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.setting-control input[type='range'] {
  flex-grow: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(
    90deg,
    rgba(0, 170, 255, 0.3),
    rgba(0, 170, 255, 0.1)
  );
  border-radius: 10px;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.setting-control input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, var(--primary-color), #0088cc);
  border-radius: 50%;
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(0, 170, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
}
.setting-control input[type='range']::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow:
    0 4px 12px rgba(0, 170, 255, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.setting-control .value-display {
  min-width: 60px;
  text-align: left;
  font-family: 'Roboto Mono', monospace;
  color: rgba(224, 224, 224, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.setting-control select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(34, 34, 34, 0.92);
  border: 1.5px solid rgba(0, 170, 255, 0.25);
  color: var(--text-color);
  border-radius: 10px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    background 0.2s;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

.setting-control select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 170, 255, 0.18);
  background: rgba(44, 44, 64, 0.98);
}

.setting-control select:hover {
  background: rgba(44, 44, 64, 0.98);
  border-color: rgba(0, 170, 255, 0.45);
}

/* Custom arrow for select (optional, for modern look) */
.setting-control select {
  background-image: url('data:image/svg+xml;utf8,<svg fill="%2300aaff" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
}

/* Style dropdown options (limited support, but improves look on some browsers) */
.setting-control select option {
  border-radius: 8px;
  padding: 8px 14px;
  background: #23233a;
  color: #fff;
  font-size: 15px;
  transition: background 0.18s;
}

.setting-control select option:checked,
.setting-control select option:focus,
.setting-control select option:active {
  background: #00aaff;
  color: #fff;
}

/* For browsers that support option:hover */
.setting-control select option:hover {
  background: #2e2e4d;
  color: #fff;
}

.setting-control input[type='color'] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 50px;
  height: 30px;
  background-color: transparent;
  border: 2px solid rgba(0, 170, 255, 0.3);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.setting-control input[type='color']:hover {
  border-color: rgba(0, 170, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.setting-control input[type='color']::-webkit-color-swatch {
  border-radius: 6px;
  border: none;
}

.setting-separator {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 20px 0;
}
.setting-separator h3 {
  margin: 0;
  color: var(--secondary-color);
  font-size: 18px;
  white-space: nowrap;
  text-shadow: 0 0 15px rgba(255, 170, 0, 0.5);
}
.setting-separator .line {
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--separator-color),
    transparent
  );
  box-shadow: 0 0 10px rgba(0, 170, 255, 0.3);
}

.settings-footer {
  padding: 25px 30px;
  display: flex;
  justify-content: center;
  gap: 15px;
  background: linear-gradient(
    135deg,
    rgba(0, 170, 255, 0.05),
    rgba(0, 170, 255, 0.1)
  );
  border-top: 1px solid rgba(0, 170, 255, 0.2);
  border-radius: 0 0 20px 20px;
}

.footer-button {
  padding: 12px 28px;
  font-size: 16px;
  background: rgba(40, 40, 40, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 170, 255, 0.3);
  border-radius: 10px;
  transition: all 0.3s ease;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.footer-button:hover {
  background: rgba(50, 50, 50, 0.9);
  border-color: rgba(0, 170, 255, 0.5);
  transform: translateY(-2px);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
#settingsApply {
  background: linear-gradient(
    135deg,
    rgba(40, 167, 69, 0.8),
    rgba(40, 167, 69, 0.6)
  );
  border-color: rgba(40, 167, 69, 0.4);
}
#settingsApply:hover {
  background: linear-gradient(
    135deg,
    rgba(40, 167, 69, 0.9),
    rgba(40, 167, 69, 0.7)
  );
  border-color: rgba(40, 167, 69, 0.6);
}

/* Demo mode button styling */
.demo-mode-btn {
  background: linear-gradient(
    135deg,
    rgba(255, 107, 53, 0.8),
    rgba(247, 147, 30, 0.6)
  );
  border-color: rgba(255, 107, 53, 0.4);
  transition: all 0.3s ease;
}

.demo-mode-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 122, 68, 0.9),
    rgba(255, 167, 38, 0.7)
  );
  border-color: rgba(255, 107, 53, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.demo-mode-btn.active {
  background: linear-gradient(
    135deg,
    rgba(255, 68, 68, 0.9),
    rgba(204, 51, 51, 0.7)
  );
  border-color: rgba(255, 68, 68, 0.6);
  animation: demoPulse 2s infinite;
}

@keyframes demoPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
  }
}

#bhMassesModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 450px;
  background-color: var(--panel-bg);
  border: 1px solid var(--primary-color);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
  z-index: 1001;
  display: flex;
  flex-direction: column;
}

#bhMassesModal.hidden {
  display: none;
}
.bh-masses-header {
  text-align: center;
  padding: 15px;
  font-size: 20px;
  color: var(--primary-color);
}
.bh-masses-content {
  padding: 20px 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 50vh;
  overflow-y: auto;
}
/* Keep BH masses modal header visible */
.bh-masses-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(13, 13, 26, 0.95);
}
.bh-mass-item {
  display: grid;
  grid-template-columns: 1fr 2fr;
  align-items: center;
  gap: 15px;
}
.bh-mass-item label {
  justify-self: end;
  text-align: right;
}
.bh-mass-control {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bh-mass-control input[type='range'] {
  flex-grow: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  background: #444;
  border-radius: 5px;
  outline: none;
}
.bh-mass-control input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
}
.bh-mass-control .value-display {
  min-width: 60px;
  text-align: left;
  font-family: 'Roboto Mono', monospace;
}
.bh-masses-footer {
  padding: 15px;
  text-align: center;
}

/* --- Preset title / summary box --- */
.preset-info {
  margin: 18px 0 10px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--separator-color);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.4;
}
.preset-info h4 {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--primary-color);
}

/* --- Preset Scenario Dropdown Custom Styles --- */
#settingsGrid select,
.settings-grid select,
.setting-control select {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1.5px solid rgba(0, 170, 255, 0.25);
  background: rgba(34, 34, 44, 0.95);
  color: #e0e0e0;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    background 0.2s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

#settingsGrid select:focus,
.settings-grid select:focus,
.setting-control select:focus {
  border-color: #00aaff;
  box-shadow: 0 0 0 2px rgba(0, 170, 255, 0.18);
  background: rgba(34, 34, 64, 1);
}

#settingsGrid select:hover,
.settings-grid select:hover,
.setting-control select:hover {
  background: rgba(44, 44, 64, 1);
  border-color: #00aaff;
}

/* Option hover/focus workaround for modern browsers */
#settingsGrid select option:checked,
.settings-grid select option:checked,
.setting-control select option:checked {
  background: #1e293b;
  color: #fff;
}

/* For browsers that support it, highlight hovered option */
#settingsGrid select option:hover,
.settings-grid select option:hover,
.setting-control select option:hover {
  background: #2563eb !important;
  color: #fff !important;
}

/* Add a dropdown arrow (optional, for style) */
#settingsGrid select,
.settings-grid select,
.setting-control select {
  background-image: url('data:image/svg+xml;utf8,<svg fill="%23e0e0e0" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
  padding-right: 38px;
}

/* Scenario List Modal Styles */
#scenarioListModal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(13, 13, 26, 0.92);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.5s ease-out,
    visibility 0s linear 0.5s;
}
#scenarioListModal:not(.hidden) {
  display: flex !important;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.5s ease-out,
    visibility 0s linear 0s;
  animation: scenarioMenuFadeIn 0.5s ease-out;
}
#scenarioListContent {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 20px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 8px 32px rgba(79, 172, 254, 0.15);
  border: 1px solid rgba(79, 172, 254, 0.2);
  padding: 40px 32px;
  min-width: 320px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  color: #fff;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}
#scenarioListContent::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(79, 172, 254, 0.05) 0%,
    rgba(0, 242, 254, 0.05) 100%
  );
  border-radius: 20px;
  pointer-events: none;
}
.scenario-list-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(79, 172, 254, 0.3);
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(26, 26, 46, 0.9);
}

.scenario-list-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
  border-radius: 1px;
}

.scenario-list-header h3 {
  margin: 0;
  font-size: 1.5em;
  font-weight: 700;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.02em;
  text-shadow: 0 0 30px rgba(79, 172, 254, 0.3);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: calc(100% - 60px);
  line-height: 1.3;
}

#closeScenarioList {
  font-size: 1.4em;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  position: fixed;
  top: 40px;
  right: calc(50% - 45vw + 32px);
  flex-shrink: 0;
  z-index: 1002;
}

#closeScenarioList:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
#scenarioListItems {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}

/* Custom scrollbar styling for WebKit browsers */
#scenarioListItems::-webkit-scrollbar {
  width: 6px;
}

#scenarioListItems::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

#scenarioListItems::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
  transition: background 0.2s ease;
}

#scenarioListItems::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* Custom scrollbar styling for main scenario list content */
#scenarioListContent::-webkit-scrollbar {
  width: 6px;
}

#scenarioListContent::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

#scenarioListContent::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
  transition: background 0.2s ease;
}

#scenarioListContent::-webkit-scrollbar-thumb:hover {
  background: #777;
}

.scenario-list-item {
  cursor: pointer;
  padding: 16px;
  background: linear-gradient(135deg, #1e1e3f 0%, #3a3a5c 100%);
  border-radius: 8px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease-in-out;
  position: relative;
  border: 1px solid rgba(79, 172, 254, 0.1);
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(10px);
  animation: scenarioCardFadeIn 0.6s ease-out forwards;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.scenario-list-item:last-child {
  margin-bottom: 0;
}

.scenario-list-item:hover,
.scenario-list-item:focus {
  transform: scale(1.02);
  background: linear-gradient(135deg, #2a2a4f 0%, #4a4a6c 100%);
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.3),
    0 4px 12px rgba(79, 172, 254, 0.2),
    0 0 20px rgba(79, 172, 254, 0.1);
  border-color: rgba(79, 172, 254, 0.3);
  outline: none;
}

.scenario-list-item:active {
  transform: scale(1.01);
  background: linear-gradient(135deg, #252545 0%, #424262 100%);
  box-shadow:
    0 4px 15px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(79, 172, 254, 0.15);
}

/* Scenario card containers */
.scenario-title {
  margin-bottom: 0.75rem;
}

.scenario-title strong {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  display: block;
  margin-bottom: 0.25rem;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
  overflow: hidden;
}

.scenario-title span {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #888888;
  line-height: 1.4;
  display: block;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  margin: 0;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scenario-separator {
  margin: 8px 0;
  border: none;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(79, 172, 254, 0.3) 20%,
    rgba(79, 172, 254, 0.5) 50%,
    rgba(79, 172, 254, 0.3) 80%,
    transparent 100%
  );
  opacity: 0.7;
  width: 100%;
}

.scenario-description {
  margin: 0;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.scenario-description span {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #cccccc;
  line-height: 1.5;
  display: block;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Responsive typography */
@media (max-width: 1024px) {
  .scenario-list-item {
    padding: 16px;
    margin-bottom: 8px;
  }

  .scenario-title strong {
    font-size: 18px;
    margin-bottom: 0.4rem;
    line-height: 1.5;
  }

  .scenario-title span {
    font-size: 12px;
    line-height: 1.4;
  }

  .scenario-separator {
    margin: 6px 0;
    opacity: 0.6;
  }

  .scenario-description span {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow: hidden;
  }
}

@media (max-width: 600px) {
  .scenario-list-item {
    padding: 16px;
    margin-bottom: 8px;
  }

  .scenario-title strong {
    font-size: 18px;
    margin-bottom: 0.35rem;
    line-height: 1.5;
  }

  .scenario-title span {
    font-size: 12px;
    line-height: 1.4;
  }

  .scenario-separator {
    margin: 5px 0;
    opacity: 0.5;
  }

  .scenario-description span {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  .scenario-list-item {
    padding: 14px;
    margin-bottom: 6px;
    width: 100%;
    box-sizing: border-box;
  }

  .scenario-title strong {
    font-size: 18px;
    margin-bottom: 0.3rem;
    line-height: 1.5;
  }

  .scenario-title span {
    font-size: 12px;
    line-height: 1.4;
  }

  .scenario-separator {
    margin: 4px 0;
    opacity: 0.4;
  }

  .scenario-description span {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow: hidden;
  }
}

@media (max-width: 360px) {
  .scenario-list-item {
    padding: 12px;
    margin-bottom: 4px;
    width: 100%;
    box-sizing: border-box;
  }

  .scenario-title strong {
    font-size: 18px;
    margin-bottom: 0.25rem;
    line-height: 1.5;
  }

  .scenario-title span {
    font-size: 12px;
    line-height: 1.4;
  }

  .scenario-separator {
    margin: 3px 0;
    opacity: 0.3;
  }

  .scenario-description span {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow: hidden;
  }
}
#closeScenarioList {
  background: #23233a;
  color: #fff;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition:
    background 0.2s,
    transform 0.18s;
}
#closeScenarioList:hover {
  background: #2e2e4d;
  transform: scale(1.08);
}
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes scenarioMenuFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scenarioCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  #scenarioListContent {
    min-width: 0;
    width: 95vw;
    padding: 1.5rem 1.25rem;
    max-height: 90vh;
    border-radius: 16px;
  }

  #closeScenarioList {
    top: 24px;
    right: calc(50% - 47.5vw + 20px);
  }

  .scenario-list-header h3 {
    font-size: 1.3rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: calc(100% - 60px);
    line-height: 1.3;
  }

  .scenario-list-item {
    padding: 16px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
  }

  #scenarioListItems {
    gap: 8px;
  }
}

@media (max-width: 600px) {
  #scenarioListContent {
    width: 100vw;
    padding: 1rem 0.75rem;
    border-radius: 12px;
    max-height: 95vh;
    margin: 0;
  }

  #closeScenarioList {
    top: 16px;
    right: 12px;
  }

  .scenario-list-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .scenario-list-header h3 {
    font-size: 1.2rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: calc(100% - 60px);
    line-height: 1.3;
  }

  .scenario-list-item {
    padding: 16px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
  }

  #scenarioListItems {
    gap: 8px;
    width: 100%;
  }
}

@media (max-width: 480px) {
  #scenarioListContent {
    width: 100vw;
    padding: 0.75rem 0.5rem;
    border-radius: 10px;
    max-height: 98vh;
    margin: 0;
  }

  #closeScenarioList {
    top: 12px;
    right: 8px;
  }

  .scenario-list-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
  }

  .scenario-list-header h3 {
    font-size: 1.1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: calc(100% - 60px);
    line-height: 1.3;
  }

  .scenario-list-item {
    padding: 14px;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
  }

  #scenarioListItems {
    gap: 6px;
    width: 100%;
  }
}

@media (max-width: 360px) {
  #scenarioListContent {
    width: 100vw;
    padding: 0.5rem 0.25rem;
    border-radius: 8px;
    max-height: 100vh;
    margin: 0;
  }

  #closeScenarioList {
    top: 8px;
    right: 4px;
  }

  .scenario-list-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
  }

  .scenario-list-header h3 {
    font-size: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: calc(100% - 60px);
    line-height: 1.3;
  }

  .scenario-list-item {
    padding: 12px;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
  }

  #scenarioListItems {
    gap: 4px;
    width: 100%;
  }
}

/* Enhanced Scenario Info Box Styles */
.scenario-info-box {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

/* Ensure close button is always clickable when parent is visible */
.scenario-info-box.show .scenario-info-close {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.scenario-info-box.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: scenarioInfoSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scenario-info-box.show .scenario-info-close {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.scenario-info-content {
  background: var(--panel-bg);
  border: 1px solid var(--separator-color);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  padding: 10px 20px;
  width: 95%;
  max-width: 900px;
  position: relative;
  text-align: left;
}

.scenario-info-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  position: relative;
}

.scenario-info-header h3 {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: calc(100% - 50px);
  line-height: 1.3;
}

.scenario-info-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  justify-content: flex-end;
}

.sonification-panel {
  margin-top: 36px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.sonification-panel.showUI {
  opacity: 1;
  transform: translateY(0);
}

#overlay.minimized .sonification-panel {
  display: none;
}

.sonification-toggle {
  background: rgba(79, 172, 254, 0.12);
  border: 1px solid rgba(79, 172, 254, 0.45);
  color: #e8f6ff;
  font-size: 12px;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  pointer-events: auto;
}

.sonification-toggle:hover {
  border-color: rgba(79, 172, 254, 0.8);
  background: rgba(79, 172, 254, 0.25);
  box-shadow: 0 0 10px rgba(79, 172, 254, 0.35);
}

.sonification-toggle[data-state='active'] {
  background: rgba(79, 172, 254, 0.25);
  border-color: rgba(79, 172, 254, 0.9);
  color: #fff;
  box-shadow: 0 0 12px rgba(79, 172, 254, 0.45);
}

.sonification-toggle[data-state='disabled'] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.sonification-description {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
}

.overlay-stats {
  margin-top: 12px;
}

.scenario-info-close {
  background: none !important;
  border: none !important;
  color: var(--text-color) !important;
  font-size: 18px !important;
  cursor: pointer !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  transition: all 0.2s ease !important;
  box-shadow: none !important;
  transform: none !important;
  text-shadow: none !important;
  font-weight: normal !important;
  min-width: auto !important;
  width: auto !important;
  height: auto !important;
  line-height: 1 !important;
  display: inline-block !important;
  position: relative !important;
  top: auto !important;
  right: auto !important;
  z-index: 1001 !important;
  pointer-events: auto !important;
  flex-shrink: 0 !important;
}

.scenario-info-close:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  color: var(--primary-color) !important;
  box-shadow: 0 0 8px rgba(79, 172, 254, 0.3) !important;
  transform: scale(1.1) !important;
  text-shadow: none !important;
}

.scenario-info-close:active {
  background: rgba(255, 255, 255, 0.2) !important;
  box-shadow: none !important;
  transform: none !important;
  text-shadow: none !important;
}

.scenario-info-close:focus {
  outline: 2px solid var(--primary-color) !important;
  outline-offset: 2px !important;
}

.scenario-info-body {
  color: var(--text-color);
  line-height: 1.4;
  text-align: left;
}

.scenario-info-body p {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--text-color);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
  line-height: 1.5;
  overflow: hidden;
  text-align: left;
}

.scenario-info-details {
  margin-top: 8px;
}

.scenario-info-key {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 4px;
  font-size: 14px;
}

.scenario-info-details ul {
  margin: 0;
  padding-left: 16px;
  list-style: none;
}

.scenario-info-details li {
  margin: 2px 0;
  padding-left: 12px;
  position: relative;
  color: var(--text-color);
  font-size: 13px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
  line-height: 1.4;
  overflow: hidden;
}

.scenario-info-details li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--primary-color);
}

.scenario-info-details li.merging-disabled-notice {
  color: #f5a623;
}

.scenario-info-details li.merging-disabled-notice::before {
  content: '⚠';
  color: #f5a623;
}

@keyframes scenarioInfoSlideIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 1024px) {
  .scenario-info-box {
    top: 15px;
    left: 10px;
    right: 10px;
    transform: none;
  }

  .scenario-info-content {
    width: 95%;
    max-width: none;
    padding: 8px 16px;
  }

  .scenario-info-header h3 {
    font-size: 16px;
    max-width: calc(100% - 40px);
  }

  .scenario-info-close {
    font-size: 20px !important;
    padding: 6px 10px !important;
    top: auto !important;
    right: auto !important;
  }

  .scenario-info-body p {
    font-size: 13px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    line-height: 1.5;
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  .scenario-info-box {
    top: 10px;
    left: 8px;
    right: 8px;
  }

  .scenario-info-content {
    width: 98%;
    padding: 8px 14px;
  }

  .scenario-info-header h3 {
    font-size: 15px;
    max-width: calc(100% - 45px);
  }

  .scenario-info-close {
    font-size: 22px !important;
    padding: 8px 12px !important;
    top: auto !important;
    right: auto !important;
    background: rgba(0, 0, 0, 0.8) !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .scenario-info-body p {
    font-size: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    line-height: 1.5;
    overflow: hidden;
  }

  .scenario-info-details li {
    font-size: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    line-height: 1.4;
    overflow: hidden;
  }
}

@media (max-width: 360px) {
  .scenario-info-box {
    top: 8px;
    left: 6px;
    right: 6px;
  }

  .scenario-info-content {
    width: 99%;
    padding: 6px 12px;
  }

  .scenario-info-header h3 {
    font-size: 14px;
    max-width: calc(100% - 50px);
  }

  .scenario-info-close {
    font-size: 20px !important;
    padding: 6px 10px !important;
    top: auto !important;
    right: auto !important;
    width: 32px !important;
    height: 32px !important;
  }
}

/* ===== Settings Info Icons ===== */
.setting-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 10;
}

.setting-info-icon:hover {
  background: linear-gradient(135deg, #3a8be8 0%, #00d0e0 100%);
  transform: scale(1.1);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.3),
    0 0 10px rgba(0, 255, 255, 0.3);
}

.setting-info-icon:active {
  transform: scale(0.95);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.setting-info-icon:focus {
  outline: 2px solid #00aaff;
  outline-offset: 2px;
}

.setting-label-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-label {
  flex: 1;
}

/* Responsive adjustments for info icons */
@media (max-width: 1024px) {
  .setting-info-icon {
    width: 16px;
    height: 16px;
    font-size: 11px;
    margin-left: 6px;
  }
}

@media (max-width: 480px) {
  .setting-info-icon {
    width: 15px;
    height: 15px;
    font-size: 10px;
    margin-left: 4px;
  }
}

/* ===== Mass Adjustment Slider Styles ===== */
.stat-separator {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--separator-color),
    transparent
  );
  margin: 15px 0;
}

.mass-adjustment-section {
  background: linear-gradient(
    135deg,
    rgba(0, 170, 255, 0.1),
    rgba(0, 170, 255, 0.05)
  );
  border: 1px solid rgba(0, 170, 255, 0.2);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
}

.mass-slider-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mass-slider-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-color);
  text-align: center;
  margin: 0;
  text-shadow: 0 0 8px rgba(0, 170, 255, 0.3);
}

.mass-slider-control {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.mass-slider {
  flex: 1;
  min-width: 150px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mass-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--primary-color), #00aaff);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 170, 255, 0.5);
  transition: all 0.2s ease;
}

.mass-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(0, 170, 255, 0.7);
}

.mass-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--primary-color), #00aaff);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px rgba(0, 170, 255, 0.5);
  transition: all 0.2s ease;
}

.mass-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(0, 170, 255, 0.7);
}

.mass-value-display {
  background: rgba(0, 170, 255, 0.1);
  border: 1px solid rgba(0, 170, 255, 0.3);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
  min-width: 80px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 0 8px rgba(0, 170, 255, 0.2);
}

/* Responsive design for mass slider */
@media (max-width: 1024px) {
  .mass-slider-control {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .mass-slider {
    min-width: auto;
  }

  .mass-value-display {
    align-self: center;
    min-width: 100px;
  }
}

@media (max-width: 480px) {
  .mass-adjustment-section {
    padding: 12px;
  }

  .mass-slider-label {
    font-size: 14px;
  }

  .mass-value-display {
    font-size: 12px;
    padding: 6px 10px;
  }
}

/* ===== Transformation Notification Styles ===== */
.transformation-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(
    135deg,
    rgba(0, 170, 255, 0.95),
    rgba(0, 255, 170, 0.95)
  );
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 15px 20px;
  color: white;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 16px;
  z-index: 10000;
  box-shadow: 0 8px 32px rgba(0, 170, 255, 0.4);
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.transformation-notification.visible {
  transform: translateX(0);
  opacity: 1;
}

.transformation-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.transformation-icon {
  font-size: 20px;
  animation: sparkle 1.5s ease-in-out infinite;
}

.transformation-text {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes sparkle {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.2) rotate(180deg);
  }
}

/* Responsive design for transformation notification */
@media (max-width: 1024px) {
  .transformation-notification {
    top: 10px;
    right: 10px;
    left: 10px;
    font-size: 14px;
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .transformation-notification {
    font-size: 13px;
    padding: 10px 14px;
  }

  .transformation-icon {
    font-size: 18px;
  }
}

/* Energy tab styles */
/* TODO: REMOVE - Energy tab styles to be replaced */

/* Current Energy Values Display */
.energy-values-container {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.energy-values-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.energy-value-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 12px;
  text-align: center;
  transition: all 0.2s ease;
}

.energy-value-box:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.energy-value-label {
  font-size: 11px;
  color: #ffaa00;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.energy-value-display {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  font-family: 'Roboto Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.energy-chart-container {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  position: relative;
  width: 100%;
  min-height: 350px;
  height: auto;
}

.energy-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.energy-chart-header h3 {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.energy-chart-controls {
  display: flex;
  gap: 8px;
}

.energy-chart-wrapper {
  position: relative;
  width: 100%;
  height: 300px;
}

.export-button,
.clear-button {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.export-button:hover {
  background: rgba(0, 122, 204, 0.8);
  border-color: rgba(0, 122, 204, 0.5);
}

.clear-button:hover {
  background: rgba(255, 59, 48, 0.8);
  border-color: rgba(255, 59, 48, 0.5);
}

.export-button span,
.clear-button span {
  font-size: 12px;
}

#energyChart {
  width: 100% !important;
  height: 300px !important;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(0, 170, 255, 0.3);
  border-radius: 6px;
  display: block;
  margin: 0 auto;
  min-width: 300px;
  min-height: 200px;
}

.energy-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.energy-controls .ui-button {
  padding: 8px 16px;
  font-size: 14px;
  background: rgba(0, 170, 255, 0.2);
  border: 1px solid rgba(0, 170, 255, 0.4);
  color: var(--text-color);
  transition: all 0.2s ease;
}

.energy-controls .ui-button:hover {
  background: rgba(0, 170, 255, 0.3);
  border-color: rgba(0, 170, 255, 0.6);
  transform: translateY(-1px);
}

.energy-controls .ui-button:active {
  transform: translateY(0);
}

/* Refresh button specific styling */
#refreshEnergyChart {
  background: rgba(0, 255, 136, 0.2);
  border-color: rgba(0, 255, 136, 0.4);
}

#refreshEnergyChart:hover {
  background: rgba(0, 255, 136, 0.3);
  border-color: rgba(0, 255, 136, 0.6);
}

#refreshEnergyChart:active {
  background: rgba(0, 255, 136, 0.4);
}

#refreshEnergyChart.auto-refresh-active {
  background: rgba(0, 255, 136, 0.3);
  border-color: rgba(0, 255, 136, 0.8);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
  }
  50% {
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.6);
  }
}

/* Energy tab styles */
/* TODO: REMOVE - Energy stats styles to be replaced */
.energy-stats-container {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.energy-stats-header h3 {
  margin: 0 0 15px 0;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.energy-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.energy-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.energy-stat {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 12px;
  text-align: center;
  transition: all 0.2s ease;
}

.energy-stat:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.energy-stat-label {
  font-size: 11px;
  color: #aaa;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.energy-stat-value {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  font-family: 'Courier New', monospace;
}

/* Responsive design for energy tab */
/* TODO: REMOVE - Energy tab responsive styles to be replaced */
@media (max-width: 1024px) {
  .energy-values-container {
    padding: 10px;
  }

  .energy-values-grid {
    gap: 8px;
  }

  .energy-value-box {
    padding: 10px;
  }

  .energy-value-label {
    font-size: 10px;
  }

  .energy-value-display {
    font-size: 12px;
  }

  .energy-chart-container {
    padding: 10px;
  }

  #energyChart {
    width: 100%;
    height: 200px;
  }

  .energy-stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .energy-values-container {
    padding: 8px;
  }

  .energy-values-grid {
    gap: 6px;
  }

  .energy-value-box {
    padding: 8px;
  }

  .energy-value-label {
    font-size: 9px;
  }

  .energy-value-display {
    font-size: 11px;
  }

  .energy-chart-container {
    padding: 8px;
  }

  #energyChart {
    height: 150px;
  }

  .energy-controls .ui-button {
    padding: 6px 12px;
    font-size: 13px;
  }
}

/* Collecting data message styles */
.collecting-message {
  display: none;
  text-align: center;
  padding: 40px 20px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin: 15px 0;
}

.collecting-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.collecting-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top: 3px solid #00ff88;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.collecting-text {
  color: #e0e0e0;
  font-size: 14px;
  font-weight: 500;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 480px) {
  .collecting-message {
    padding: 30px 15px;
  }

  .collecting-spinner {
    width: 25px;
    height: 25px;
    border-width: 2px;
  }

  .collecting-text {
    font-size: 13px;
  }
}

/* Enhanced tooltip styling */
.stat-row[title]:hover,
.energy-value-box[title]:hover,
.mass-slider-tooltip[title]:hover {
  cursor: help;
  position: relative;
}

.stat-row[title]:hover::after,
.energy-value-box[title]:hover::after,
.mass-slider-tooltip[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-5px);
  background: rgba(15, 15, 35, 0.95);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  white-space: normal;
  max-width: 250px;
  min-width: 150px;
  text-align: center;
  line-height: 1.4;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 170, 255, 0.3);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.stat-row[title]:hover::after,
.energy-value-box[title]:hover::after,
.mass-slider-tooltip[title]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Ensure tooltips don't go off-screen */
.stat-row[title]:hover::after {
  left: 50%;
  transform: translateX(-50%) translateY(0);
}

/* Adjust positioning for energy value boxes to prevent overflow */
.energy-value-box[title]:hover::after {
  left: 50%;
  transform: translateX(-50%) translateY(0);
  max-width: 200px;
  bottom: auto;
  top: 120%; /* Position tooltip below the energy value box instead of above */
  z-index: 1001; /* Ensure tooltip appears above tab buttons */
}

/* Adjust positioning for mass slider tooltip */
.mass-slider-tooltip[title]:hover::after {
  left: 50%;
  transform: translateX(-50%) translateY(0);
  max-width: 220px;
  bottom: 120%; /* Position above like other tooltips */
  top: auto; /* Override any top positioning */
}

.mass-slider-tooltip {
  text-align: center;
  color: #00aaff;
  font-size: 12px;
  margin-top: 8px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

/* Remove the hover effect that was causing flashing */
.mass-slider-tooltip:hover {
  opacity: 0.8; /* Keep consistent opacity to prevent flashing */
}

/* Prevent flashing by ensuring tooltip positioning is stable */
.mass-slider-tooltip[title]:hover::after {
  z-index: 1001; /* Ensure tooltip appears above other elements */
  pointer-events: none; /* Prevent tooltip from interfering with hover state */
  transform: translateX(-50%) translateY(0) !important; /* Force stable positioning */
  opacity: 1 !important; /* Force stable opacity */
}

.three-view-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 650px;
  height: 500px;
  background: rgba(5, 9, 22, 0.95);
  border: 1px solid rgba(0, 180, 255, 0.35);
  border-radius: 12px;
  box-shadow:
    0 15px 60px rgba(0, 0, 0, 0.55),
    0 4px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  z-index: 160;
  display: flex;
  flex-direction: column;
  min-width: 280px;
  min-height: 240px;
}

.three-view-container.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Disable transitions during drag/resize interactions to prevent lag */
.three-view-container.interacting {
  transition: none;
  user-select: none;
}

.three-view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: linear-gradient(
    135deg,
    rgba(0, 122, 255, 0.18),
    rgba(0, 0, 0, 0)
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: grab; /* Indicates draggable */
  flex-shrink: 0;
}

.three-view-toolbar:active {
  cursor: grabbing;
}

.three-view-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  pointer-events: none; /* Let clicks pass through to toolbar for dragging */
}

.three-view-title {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  color: #c9e8ff;
}

.three-view-status {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.three-toolbar-actions {
  display: flex;
  gap: 6px;
}

.three-toolbar-btn {
  background: rgba(9, 15, 32, 0.75);
  border-radius: 6px;
  border: 1px solid rgba(0, 180, 255, 0.4);
  color: #dff5ff;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.three-toolbar-btn:hover {
  background: rgba(14, 24, 55, 0.85);
  border-color: rgba(0, 227, 255, 0.6);
}

.three-view-stage {
  position: relative;
  width: 100%;
  flex: 1; /* Take remaining height */
  min-height: 0;
  background: #000;
}

.three-view-stage canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.three-view-hint {
  font-size: 11px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.three-view-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 10;
  background: linear-gradient(315deg, transparent 50%, rgba(0, 180, 255, 0.4) 50%);
  border-top-left-radius: 12px;
}

.three-view-resize-handle:hover {
  background: linear-gradient(315deg, transparent 50%, rgba(0, 180, 255, 0.8) 50%);
}

@media (max-width: 768px) {
  .three-view-container {
    right: 10px;
    left: 10px;
    bottom: 80px;
    width: auto;
    height: 300px;
    transform: none !important; /* Disable complex transforms on mobile */
  }
  
  .three-view-container.visible {
    transform: none !important;
  }
}

/* ── Light Curve Panel ──────────────────────────────────────────── */

.light-curve-container {
  position: fixed;
  left: 20px;
  bottom: 120px;
  width: 420px;
  height: 320px;
  background: rgba(5, 9, 22, 0.95);
  border: 1px solid rgba(0, 180, 255, 0.3);
  border-radius: 12px;
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.5),
    0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  overflow: hidden;
  z-index: 160;
  display: flex;
  flex-direction: column;
  min-width: 280px;
  min-height: 220px;
}

.light-curve-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: linear-gradient(
    135deg,
    rgba(0, 122, 255, 0.15),
    rgba(0, 0, 0, 0)
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.light-curve-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.light-curve-title {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  color: #c9e8ff;
}

.light-curve-status {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
}

.light-curve-actions {
  display: flex;
  gap: 6px;
}

.light-curve-btn {
  background: rgba(9, 15, 32, 0.75) !important;
  border-radius: 6px !important;
  border: 1px solid rgba(0, 180, 255, 0.35) !important;
  color: #dff5ff !important;
  font-size: 11px !important;
  padding: 4px 10px !important;
  cursor: pointer !important;
  min-width: auto !important;
  box-shadow: none !important;
}

.light-curve-btn:hover {
  background: rgba(0, 120, 255, 0.3) !important;
  transform: none !important;
}

.light-curve-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.15);
}

.light-curve-angle-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  min-width: 110px;
}

.light-curve-controls input[type="range"] {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(79, 172, 254, 0.2);
  accent-color: #4facfe;
  cursor: pointer;
  padding: 0 !important;
  margin: 0;
  box-shadow: none !important;
  border: none !important;
  min-width: 0;
}

.light-curve-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 6px 8px;
}

.light-curve-stage canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.light-curve-hint {
  font-size: 10px;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.light-curve-info-btn {
  background: transparent !important;
  border: 1px solid rgba(0, 180, 255, 0.35) !important;
  border-radius: 50% !important;
  color: #9cd4ff !important;
  font-size: 13px !important;
  width: 24px !important;
  height: 24px !important;
  min-width: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer !important;
  box-shadow: none !important;
  line-height: 1 !important;
}

.light-curve-info-btn:hover {
  background: rgba(0, 120, 255, 0.2) !important;
  border-color: rgba(0, 180, 255, 0.6) !important;
  transform: none !important;
}

.light-curve-info-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(5, 9, 22, 0.97);
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.light-curve-info-overlay h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #c9e8ff;
  letter-spacing: 0.03em;
}

.light-curve-info-overlay p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.72);
}

.light-curve-info-overlay .lc-info-close {
  align-self: flex-end;
  background: rgba(9, 15, 32, 0.75) !important;
  border: 1px solid rgba(0, 180, 255, 0.35) !important;
  border-radius: 6px !important;
  color: #dff5ff !important;
  font-size: 11px !important;
  padding: 4px 14px !important;
  cursor: pointer !important;
  min-width: auto !important;
  box-shadow: none !important;
  margin-top: auto;
}

.light-curve-info-overlay .lc-info-close:hover {
  background: rgba(0, 120, 255, 0.3) !important;
  transform: none !important;
}

@media (max-width: 768px) {
  .light-curve-container {
    left: 10px;
    right: 10px;
    bottom: 80px;
    width: auto;
    height: 260px;
  }
}
