:root {
  color-scheme: dark;
  --bg-top: #160f1c;
  --bg-bottom: #24131d;
  --panel: rgba(18, 14, 24, 0.76);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f7f2eb;
  --text-muted: rgba(247, 242, 235, 0.72);
  --accent: #f7b34d;
  --accent-strong: #ff6b4a;
  --track: rgba(255, 255, 255, 0.12);
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top, rgba(251, 160, 71, 0.12), transparent 34%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero {
  display: grid;
  gap: 20px;
  margin-bottom: 24px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 12px;
  font-family: "Fraunces", serif;
  font-size: clamp(2.6rem, 6vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.lede {
  margin: 0;
  max-width: 60ch;
  color: var(--text-muted);
  line-height: 1.6;
}

.preset-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-button,
.ghost-button {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease,
    background 150ms ease;
}

.preset-button:hover,
.ghost-button:hover,
.preset-button:focus-visible,
.ghost-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.preset-button.is-active {
  border-color: rgba(255, 190, 112, 0.48);
  background: linear-gradient(
    135deg,
    rgba(255, 168, 76, 0.24),
    rgba(255, 91, 71, 0.12)
  );
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}

.sky-panel,
.control-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.sky-panel {
  position: relative;
  overflow: hidden;
  border-radius: 30px;
  min-height: 580px;
}

#skyCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
}

.legend {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(7, 8, 12, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-label {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.control-panel {
  border-radius: 26px;
  padding: 22px 18px 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.2rem;
}

.controls {
  display: grid;
  gap: 16px;
}

.control {
  display: grid;
  gap: 8px;
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.control-name {
  font-weight: 500;
}

.control-value {
  color: var(--accent);
  font-size: 0.92rem;
}

.control-help {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.control-input {
  width: 100%;
  margin: 0;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  outline: none;
}

.control-input::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #fff5df;
  box-shadow: 0 0 0 3px rgba(255, 165, 74, 0.24);
}

.control-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #fff5df;
  box-shadow: 0 0 0 3px rgba(255, 165, 74, 0.24);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    order: -1;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 20px;
  }

  .sky-panel {
    border-radius: 22px;
    min-height: 0;
  }

  .legend {
    left: 14px;
    right: 14px;
    bottom: 14px;
    flex-direction: column;
  }

  .control-panel {
    border-radius: 22px;
    padding: 18px 14px;
  }
}
