:root {
  --color-background: #080401;
  --color-text: #fff9f5;
  --color-text-muted: rgb(255 161 94 / 58%);
  --color-text-subtle: rgb(255 161 94 / 55%);
  --color-text-button: rgb(255 161 94 / 72%);
  --color-border: rgb(255 255 255 / 10%);
  --color-border-subtle: rgb(255 255 255 / 7%);
  --color-surface: rgb(255 161 94 / 82%);
  --color-surface-hover: rgb(255 255 255 / 8%);
  --color-surface-subtle: rgb(255 255 255 / 3.5%);
  --color-accent: #fcad78;
  --color-accent-light: #fcbc92;
  --font-family: inter, ui-sans-serif, system-ui, -apple-system, blinkmacsystemfont, 'Segoe UI', sans-serif;
  --radius-panel: 16px;
  --radius-control: 8px;
  --transition-fast: 150ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  width: 100%;
}

body {
  background: radial-gradient(circle at 70% 30%, rgb(255 161 94 / 14%), transparent 35%), var(--color-background);
  color: var(--color-text);
  font-family: var(--font-family);
  font-synthesis: none;
  text-rendering: optimizelegibility;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

canvas {
  display: block;
  height: 100%;
  width: 100%;
}

.ui {
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  box-shadow:
    0 20px 50px rgb(0 0 0 / 40%),
    inset 0 1px 0 rgb(255 255 255 / 5%);
  color: #fff5ee;
  left: 24px;

  
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  position: fixed;
  top: 24px;
  width: 280px;
  z-index: 10;
}

.ui__header {
  margin-bottom: 22px;
}

.ui__header h1 {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0;
}

.ui__header p {
  color: var(--color-text-subtle);
  font-size: 12px;
  margin: 6px 0 0;
}

.ui__section {
  border-top: 1px solid var(--color-border-subtle);
  padding: 16px 0;
}

.ui__section:first-of-type {
  border-top: 0;
}

.ui__section-title {
  color: rgb(255 161 94 / 55%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

.planet-list {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, 1fr);
}

.planet-button {
  align-items: center;
  background: var(--color-surface-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: var(--color-text-button);
  cursor: pointer;
  display: flex;
  font-size: 12px;
  gap: 8px;
  padding: 9px 10px;
  text-align: left;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
  width: 100%;
}

.planet-button:hover {
  background: var(--color-surface-hover);
  color: #fff;
  transform: translateY(-1px);
}

.planet-button:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 2px;
}

.planet-button--active {
  background: rgb(255 161 94 / 14%);
  border-color: rgb(255 161 94 / 35%);
  color: #fff;
}

.planet-button__dot {
  background: rgb(255 161 94 / 40%);
  border-radius: 50%;
  flex: 0 0 6px;
  height: 6px;
  width: 6px;
}

.planet-button--active .planet-button__dot {
  background: var(--color-accent-light);
  box-shadow: 0 0 8px rgb(255 161 94 / 80%);
}

.ui__planet-info h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
}

.ui__planet-info p {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
}

.speed-header {
  align-items: center;
  color: rgb(255 161 94 / 70%);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.speed-header strong {
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.speed-slider {
  appearance: none;
  background: rgb(255 255 255 / 12%);
  border-radius: 999px;
  cursor: pointer;
  height: 4px;
  width: 100%;
}

.speed-slider:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 4px;
}

.speed-slider::-webkit-slider-thumb {
  appearance: none;
  background: var(--color-accent);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 12px rgb(255 161 94 / 70%);
  height: 14px;
  width: 14px;
}

.speed-slider::-moz-range-thumb {
  background: var(--color-accent);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 12px rgb(255 161 94 / 70%);
  height: 14px;
  width: 14px;
}

.ui__actions {
  border-top: 1px solid var(--color-border-subtle);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, 1fr);
  padding-top: 16px;
}

.ui-button {
  background: rgb(255 161 94 / 14%);
  border: 1px solid rgb(255 161 94 / 35%);
  border-radius: var(--radius-control);
  color: #fef3eb;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 9px 10px;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.ui-button:hover {
  background: rgb(255 161 94 / 24%);
  border-color: rgb(255 161 94 / 50%);
}

.ui-button:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 2px;
}

.ui-button--secondary {
  background: rgb(255 255 255 / 4%);
  border-color: rgb(255 255 255 / 10%);
}

.ui-button--secondary:hover {
  background: rgb(255 255 255 / 9%);
}

@media (prefers-reduced-motion: reduce) {
  .planet-button,
  .ui-button {
    transition: none;
  }
}

.ui__toggle,
.ui__summary {
  display: none;
}

@media (width <= 640px) {
  .ui {
    left: 12px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 16px;
    top: 12px;
    width: 260px;
  }

  .ui__header {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
  }

  .ui__toggle {
    display: block;
    flex-shrink: 0;
    font-size: 12px;
    padding: 6px 10px;
    width: auto;
  }

  
  .ui[data-folded] {
    width: auto;
  }

  .ui[data-folded] .ui__body,
  .ui[data-folded] .ui__subtitle {
    display: none;
  }

  .ui[data-folded] .ui__header {
    margin-bottom: 0;
  }

  .ui[data-folded] .ui__summary {
    color: var(--color-text-muted);
    display: block;
    font-size: 13px;
    margin: 2px 0 0;
  }
}

.loader {
  align-items: center;
  background: var(--color-background);
  display: flex;
  flex-direction: column;
  gap: 14px;
  inset: 0;
  justify-content: center;
  opacity: 1;
  position: fixed;
  transition: opacity 500ms ease;
  z-index: 20;
}

.loader--hidden {
  opacity: 0;
  pointer-events: none;
}

.loader__title {
  color: var(--color-text);
  font-size: 15px;
  letter-spacing: 0.18em;
  margin: 0;
  text-transform: uppercase;
}

.loader__track {
  background: var(--color-surface-subtle);
  border-radius: 999px;
  height: 3px;
  overflow: hidden;
  width: min(240px, 60vw);
}

.loader__bar {
  background: var(--color-accent);
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 200ms ease;
  width: 100%;
}

.loader__status {
  color: var(--color-text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.loader__status--error {
  color: var(--color-text);
  max-width: 34ch;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .loader,
  .loader__bar {
    transition: none;
  }
}

#follow-button {
  margin-top: 12px;
  width: 100%;
}

.follow-status {
  color: rgb(255 255 255 / 70%);
  font-size: 12px;
  margin-top: 8px;
  min-height: 1.4em;
}

.labels {
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 5;
}

.planet-label {
  background: rgb(255 161 94 / 55%);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text);
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  pointer-events: auto;
  user-select: none;
  white-space: nowrap;
}

.planet-label:hover {
  border-color: var(--color-accent);
}

.view-options {
  display: grid;
  gap: 10px;
}

.view-option {
  align-items: center;
  color: var(--color-text-button);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  gap: 8px;
}

.view-option input {
  accent-color: var(--color-accent);
}
