:root {
  color-scheme: dark;
  --bg: #050914;
  --bg-soft: rgba(8, 15, 29, 0.92);
  --panel: rgba(10, 16, 31, 0.84);
  --panel-strong: rgba(10, 16, 31, 0.94);
  --panel-border: rgba(122, 157, 255, 0.18);
  --panel-border-strong: rgba(149, 244, 255, 0.22);
  --text: #eff3ff;
  --muted: #9eafd8;
  --accent: #79a8ff;
  --accent-strong: #95f4ff;
  --accent-warm: #ffd18f;
  --accent-danger: #ff95ab;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(52, 81, 151, 0.28), transparent 24%),
    linear-gradient(180deg, #04070d 0%, #08111d 48%, #04060c 100%);
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: auto;
  width: 44rem;
  height: 44rem;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.24;
  pointer-events: none;
  z-index: 0;
}

.aurora-one {
  top: -14rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(149, 244, 255, 0.5), transparent 65%);
}

.aurora-two {
  right: -10rem;
  bottom: -18rem;
  background: radial-gradient(circle, rgba(121, 168, 255, 0.42), transparent 65%);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 24px;
  margin-bottom: 24px;
}

.hero-copy-block {
  padding: 18px 4px 8px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent-strong);
  font-size: 0.76rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 1.01;
  letter-spacing: -0.04em;
  max-width: 12ch;
}

.hero-copy {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.72;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.hero-pills span,
.history-chip {
  border-radius: 999px;
  border: 1px solid rgba(149, 244, 255, 0.18);
  background: rgba(149, 244, 255, 0.08);
  color: #d8f9ff;
  padding: 10px 14px;
  font-size: 0.92rem;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-strong));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-card {
  padding: 24px;
  align-self: end;
}

.hero-card h2 {
  margin-top: 0;
}

.hero-card p {
  color: var(--muted);
  line-height: 1.72;
}

.hero-stats {
  display: grid;
  gap: 14px;
  margin: 22px 0 0;
}

.hero-stats div {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(7, 11, 21, 0.82);
  border: 1px solid rgba(121, 168, 255, 0.12);
}

.hero-stats dt {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.hero-stats dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.form-panel,
.results-panel {
  padding: 24px;
}

.form-panel {
  position: sticky;
  top: 20px;
}

.panel-heading,
.history-header,
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.projection-form {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.projection-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.projection-form input {
  width: 100%;
}

input[type="text"],
input[type="date"] {
  border: 1px solid rgba(121, 168, 255, 0.22);
  border-radius: 14px;
  background: rgba(6, 10, 20, 0.92);
  color: var(--text);
  padding: 14px 16px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="date"]:focus {
  border-color: rgba(149, 244, 255, 0.52);
  box-shadow: 0 0 0 4px rgba(149, 244, 255, 0.12);
  outline: none;
}

input[type="range"] {
  accent-color: var(--accent-strong);
}

.range-row {
  display: grid;
  gap: 10px;
}

.range-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

output {
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.98rem;
}

.action-row,
.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 13px 18px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  color: #04111c;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  box-shadow: 0 14px 32px rgba(121, 168, 255, 0.24);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(121, 168, 255, 0.28);
}

button:disabled {
  opacity: 0.58;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.ghost-button,
.tiny-button {
  color: var(--text);
  background: rgba(121, 168, 255, 0.08);
  border: 1px solid rgba(121, 168, 255, 0.2);
  box-shadow: none;
}

.tiny-button {
  padding: 10px 14px;
  font-size: 0.88rem;
}

.support-note,
.history-panel,
.story-card {
  margin-top: 24px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(121, 168, 255, 0.05);
  border: 1px solid rgba(121, 168, 255, 0.14);
}

.support-note ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.68;
}

.muted {
  color: var(--muted);
}

.badge {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(121, 168, 255, 0.25);
  background: rgba(121, 168, 255, 0.08);
  color: var(--accent-strong);
  font-weight: 700;
  white-space: nowrap;
}

.badge.approximation {
  color: #ffe7bf;
  border-color: rgba(255, 209, 143, 0.3);
  background: rgba(255, 209, 143, 0.09);
}

.badge.error {
  color: #ffd4dd;
  border-color: rgba(255, 149, 171, 0.24);
  background: rgba(255, 149, 171, 0.08);
}

.canvas-shell {
  margin-top: 18px;
  border-radius: 24px;
  border: 1px solid rgba(121, 168, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    radial-gradient(circle at center, rgba(18, 29, 54, 0.86), rgba(4, 8, 18, 0.98));
  overflow: hidden;
}

#heliosphere-canvas {
  width: 100%;
  height: auto;
  display: block;
}

.canvas-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 18px 18px;
  color: var(--muted);
  font-size: 0.9rem;
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(6,10,20,0.28));
}

.legend-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 8px;
  border-radius: 50%;
}

.legend-sun {
  background: #ffd36f;
}

.legend-earth {
  background: #79a8ff;
}

.legend-track {
  background: #95f4ff;
}

.summary-card,
.metric-card,
.source-item,
.history-item {
  border-radius: 18px;
  border: 1px solid rgba(121, 168, 255, 0.16);
  background: rgba(6, 10, 20, 0.72);
}

.summary-card {
  margin-top: 18px;
  padding: 18px;
  line-height: 1.75;
}

.summary-card strong {
  color: var(--accent-strong);
}

.empty-state {
  color: var(--muted);
}

.metrics-grid,
.story-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.story-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.metric-card {
  padding: 16px;
}

.metric-card h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.metric-card p {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.45;
}

.story-body {
  margin-top: 10px;
  line-height: 1.72;
}

.sources {
  margin-top: 24px;
}

.source-list,
.history-list {
  display: grid;
  gap: 12px;
}

.source-item,
.history-item {
  padding: 16px;
}

.source-item h4,
.history-item h4 {
  margin: 0 0 6px;
}

.source-item p,
.source-item a,
.history-item p {
  color: var(--muted);
}

.source-item a {
  word-break: break-all;
}

.history-header {
  margin-bottom: 16px;
}

.history-item-top,
.history-item-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.history-item-top {
  margin-bottom: 10px;
}

.history-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.history-item-actions {
  align-items: center;
}

.history-item-actions .tiny-button {
  padding: 8px 12px;
}

.history-item .badge {
  font-size: 0.76rem;
  padding: 8px 12px;
}

@media (max-width: 1120px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .form-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1360px);
    padding-top: 20px;
  }

  .hero h1 {
    max-width: none;
  }

  .results-header,
  .history-item-top,
  .history-item-actions,
  .panel-heading,
  .history-header {
    flex-direction: column;
    align-items: stretch;
  }

  .results-actions {
    width: 100%;
  }

  .results-actions > * {
    flex: 1 1 auto;
  }

  .form-panel,
  .results-panel,
  .hero-card {
    padding: 18px;
  }
}
