/* Galaxy Sandbox Styles */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: #000;
  overflow: hidden;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
}

#gpu-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: grab;
}

#gpu-canvas:active {
  cursor: grabbing;
}

/* Loading Screen */
.loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  text-align: center;
  z-index: 1000;
}

.loader {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top: 3px solid #fff;
  border-radius: 50%;
  margin: 20px auto;
  animation: spin 1s linear infinite;
}

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

  100% {
    transform: rotate(360deg);
  }
}

/* Error Display */
.error {
  color: #ff4444;
  background: rgba(0, 0, 0, 0.9);
  padding: 20px;
  border-radius: 8px;
  max-width: 600px;
  border: 1px solid #ff4444;
}

.error ul {
  text-align: left;
  margin: 15px 0;
}

.error li {
  margin: 5px 0;
}

.error code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
}

/* On-screen controls */
#controls {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 18px;
  background: rgba(10, 14, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #c7d2fe;
  user-select: none;
  z-index: 100;
}

#controls-toggle {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  margin: 0;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  font: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.75;
  cursor: grab; /* the panel drags by this handle */
  touch-action: none; /* let pointer-drag work on touch */
  user-select: none;
}

#controls-toggle:hover {
  opacity: 1;
}

#controls-toggle:active {
  cursor: grabbing;
}

#controls-icon {
  font-size: 16px;
  line-height: 1;
}

#controls-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Collapsed: a discreet circular ⚙ button only — no panel chrome or body. */
#controls.collapsed {
  padding: 0;
  background: none;
  border-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#controls.collapsed #controls-body,
#controls.collapsed #controls-label {
  display: none;
}

#controls.collapsed #controls-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center; /* perfectly centre the cog (align-items is on the base) */
  border-radius: 50%; /* a true circle, since width == height */
  background: rgba(10, 14, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0.85;
}

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

.control label {
  width: 72px;
  text-transform: uppercase;
  font-size: 11px;
  opacity: 0.8;
}

.control input[type="range"] {
  width: 200px;
  accent-color: #7aa2f7;
  cursor: pointer;
}

.control select {
  width: 200px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.control select option {
  background: #0a0e1c;
  color: #fff;
}

.control span {
  min-width: 4ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #fff;
}

/* Mute toggle — a compact icon button sitting in the volume row */
.mute {
  appearance: none;
  -webkit-appearance: none;
  width: 4ch;
  padding: 2px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  text-align: right;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.mute:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.mute[aria-pressed="true"] {
  opacity: 0.6;
}

/* Restart button — re-seeds the current scenario */
.restart {
  appearance: none;
  -webkit-appearance: none;
  align-self: center;
  margin-top: 4px;
  padding: 6px 20px;
  background: rgba(122, 162, 247, 0.18);
  color: #c7d2fe;
  border: 1px solid rgba(122, 162, 247, 0.5);
  border-radius: 8px;
  font: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.restart:hover {
  background: rgba(122, 162, 247, 0.32);
  transform: translateY(-1px);
}

/* Self-styled Ko-fi link — sits at the bottom of the controls panel */
#kofi {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  margin-top: 2px;
  padding: 6px 13px;
  border: 1px solid rgba(116, 189, 255, 0.28);
  border-radius: 999px;
  color: rgba(214, 230, 255, 0.72);
  background: rgba(116, 189, 255, 0.06);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  transition:
    color 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

#kofi:hover,
#kofi:focus-visible {
  color: #fff;
  border-color: rgba(116, 189, 255, 0.58);
  background: rgba(116, 189, 255, 0.13);
  transform: translateY(-1px);
  outline: none;
}
