:root {
  color-scheme: dark;
  --bg: #090d13;
  --panel: #111923;
  --panel-soft: #182333;
  --line: #2a3848;
  --text: #edf4fb;
  --muted: #98a8b9;
  --accent: #48c2a7;
  --accent-2: #f6b65a;
  --danger: #ef6a6a;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 14%, rgba(72, 194, 167, 0.13), transparent 26rem),
    linear-gradient(135deg, #070a10 0%, #101721 52%, #11131b 100%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.sim-stage,
.control-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 18, 26, 0.82);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

.sim-stage {
  position: relative;
  overflow: hidden;
  min-height: 560px;
  border-radius: 8px;
}

.topbar {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 3.4rem);
  line-height: 1;
}

h2 {
  color: #dce8f3;
  font-size: 1rem;
}

.readout {
  min-width: 160px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(9, 13, 19, 0.78);
  text-align: right;
}

.readout span,
.hud span,
.control span,
.planet-button span {
  color: var(--muted);
  font-size: 0.82rem;
}

.readout strong,
.hud strong {
  display: block;
  margin-top: 2px;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 560px;
}

.hud {
  position: absolute;
  z-index: 2;
  left: 20px;
  right: 20px;
  bottom: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.hud div {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 12px;
  background: rgba(9, 13, 19, 0.72);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: auto;
  max-height: calc(100vh - 36px);
  border-radius: 8px;
  padding: 20px;
}

.planet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.planet-button {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.planet-button::before {
  content: "";
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--planet-color);
  box-shadow: 0 0 18px var(--planet-glow);
}

.planet-button strong,
.planet-button span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planet-button.is-active {
  border-color: var(--accent);
  background: #19312f;
}

.control-stack {
  display: grid;
  gap: 16px;
}

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

.control span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

output {
  color: #dce8f3;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.toggles {
  display: grid;
  gap: 10px;
  color: #dce8f3;
}

.toggles label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggles input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}

.actions button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #243244;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.actions button:first-child {
  background: var(--accent);
  color: #06110f;
}

.actions button:hover,
.planet-button:hover {
  filter: brightness(1.08);
}

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

  .control-panel {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .hud {
    left: 12px;
    right: 12px;
  }

  .topbar {
    flex-direction: column;
    padding: 14px 12px;
  }

  .readout {
    text-align: left;
  }

  .hud,
  .planet-grid,
  .actions {
    grid-template-columns: 1fr;
  }

  canvas,
  .sim-stage {
    min-height: 540px;
  }
}
