* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #050712;
  --panel: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e9edf5;
  --muted: #9ba3b5;
  --accent: #7bd8ff;
  --accent-2: #f4bfff;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(123, 216, 255, 0.08), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(244, 191, 255, 0.07), transparent 35%),
    radial-gradient(circle at 50% 90%, rgba(255, 255, 255, 0.06), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100vh;
  height: 100vh;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  color: var(--muted);
}

.controls {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: stretch;
}

.controls label {
  font-weight: 600;
  font-size: 13px;
}

.controls select,
.controls input[type="range"],
.controls button {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
}

.controls button {
  cursor: pointer;
  border-color: rgba(123, 216, 255, 0.25);
  background: linear-gradient(90deg, rgba(123, 216, 255, 0.18), rgba(244, 191, 255, 0.12));
  transition: transform 120ms ease, box-shadow 150ms ease;
}

.controls .primary {
  background: linear-gradient(90deg, rgba(123, 216, 255, 0.25), rgba(244, 191, 255, 0.2));
  border-color: rgba(123, 216, 255, 0.5);
}

.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.control-row label {
  flex: 0 0 auto;
  white-space: nowrap;
}

.control-row input[type="range"] {
  flex: 1 1 0;
  max-width: 150px;
}

.control-row button {
  flex: 0 0 auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 50;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  width: min(360px, 100%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.modal form {
  display: grid;
  gap: 10px;
}

.modal input[type="text"] {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.control-row #mag-limit-value {
  color: var(--accent);
}

.controls button:hover {
  box-shadow: 0 8px 24px rgba(123, 216, 255, 0.2);
  transform: translateY(-1px);
}

.canvas-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  width: 100%;
  min-height: 0;
}

.canvas-frame {
  position: relative;
  background: radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01) 50%),
    radial-gradient(circle at 70% 70%, rgba(123, 216, 255, 0.06), rgba(123, 216, 255, 0) 60%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  flex: 1;
  width: 100%;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#sky {
  width: 100%;
  height: 100%;
  flex: 1;
  display: block;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01) 40%),
    #03060f;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.status strong {
  color: var(--text);
}

.hint {
  color: var(--muted);
}

.inline-hint {
  font-size: 12px;
  flex: 0 0 auto;
  margin-right: auto;
}

.hover-label {
  position: absolute;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
}

@media (max-width: 900px) {
  .page {
    padding: 10px 12px 14px;
  }
}

@media (max-width: 600px) {
  h1 {
    font-size: 22px;
  }

  .canvas-frame {
    padding: 10px;
  }
}
