:root {
  color-scheme: dark;
  --ink: #edf3f4;
  --muted: #a5b6ba;
  --faint: #617277;
  --line: rgba(180, 214, 215, 0.22);
  --paper: #0d171a;
  --panel: rgba(18, 34, 37, 0.94);
  --accent: #f2c879;
  --focus: #8ed5d0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(circle at 50% -15%, #20383a 0, transparent 52%);
}

button { font: inherit; }
button:focus-visible, canvas:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 30px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow, .panel-kicker, .time-label { margin: 0 0 8px; color: var(--accent); font-size: 0.68rem; letter-spacing: 0.16em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 5vw, 3.8rem); letter-spacing: -0.05em; line-height: 1; font-weight: 650; }
.subtitle { margin-bottom: 0; color: var(--muted); font-size: 0.95rem; }
.time-card { min-width: 190px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(9, 20, 22, 0.55); text-align: right; }
#sim-time { display: block; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.speed-control { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.speed-control .time-label { margin: 0; color: var(--muted); font-size: 0.7rem; letter-spacing: 0.02em; }
.speed-control select { min-width: 74px; max-width: 100%; padding: 3px 22px 3px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: rgba(9, 20, 22, 0.8); font: inherit; font-size: 0.75rem; }
.speed-control select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.speed-control select:disabled, .text-button:disabled { cursor: not-allowed; opacity: 0.55; }
.time-speed { display: block; margin-top: 5px; color: var(--faint); font-size: 0.7rem; }
.text-button { margin-top: 8px; padding: 0; border: 0; color: var(--focus); background: transparent; cursor: pointer; font-size: 0.78rem; }
.text-button:hover { color: var(--ink); }
.stellar-life { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid rgba(216, 127, 101, 0.38); border-radius: 12px; background: rgba(32, 20, 21, 0.64); }
.stellar-life h2 { margin: 0 0 4px; color: var(--ink); font-size: 1rem; }
.stellar-life p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.stellar-kicker { margin-bottom: 5px !important; color: #e39a7f !important; font-size: 0.62rem !important; letter-spacing: 0.14em; }
.stellar-life-button { flex: 0 0 auto; padding: 9px 14px; border: 1px solid rgba(227, 154, 127, 0.7); border-radius: 8px; color: #ffe3d7; background: rgba(111, 48, 38, 0.42); cursor: pointer; font-size: 0.82rem; }
.stellar-life-button:hover { border-color: #ffd0bd; color: #fff; background: rgba(130, 58, 43, 0.6); }
.stellar-life-button[aria-pressed="true"] { color: #fff; background: rgba(142, 59, 43, 0.78); }
.stellar-life-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.orbit-card { position: relative; min-height: min(72vh, 760px); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: rgba(7, 15, 17, 0.7); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18); }
.canvas-wrap { position: relative; min-height: min(72vh, 760px); height: min(72vh, 760px); }
canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
canvas.is-dragging { cursor: grabbing; }
.canvas-hint { position: absolute; bottom: 16px; left: 20px; color: var(--faint); font-size: 0.76rem; pointer-events: none; }
.stellar-status { position: absolute; top: 16px; left: 20px; max-width: calc(100% - 40px); padding: 7px 10px; border: 1px solid rgba(227, 154, 127, 0.5); border-radius: 7px; color: #ffe3d7; background: rgba(37, 20, 22, 0.82); font-size: 0.78rem; line-height: 1.35; pointer-events: none; }
.noscript-note { position: absolute; inset: 45% 20px auto; margin: 0; color: var(--muted); text-align: center; }
.planet-panel { position: absolute; top: 20px; right: 20px; width: min(285px, calc(100% - 40px)); padding: 20px; border: 1px solid rgba(142, 213, 208, 0.35); border-radius: 14px; background: var(--panel); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-kicker { margin-bottom: 6px; font-size: 0.6rem; }
.planet-panel h2 { margin-bottom: 12px; font-size: 1.5rem; }
.close-button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer; font-size: 1.35rem; line-height: 1; }
.close-button:hover { color: var(--ink); border-color: var(--focus); }
.planet-summary { min-height: 3.2em; color: var(--muted); font-size: 0.87rem; line-height: 1.55; }
.planet-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.planet-facts div { min-width: 0; }
.planet-facts dt { color: var(--faint); font-size: 0.7rem; }
.planet-facts dd { margin: 4px 0 0; color: var(--ink); font-size: 0.82rem; }
.satellite-info { margin: 0 0 18px; }
.satellite-info h3 { margin: 0 0 6px; color: var(--faint); font-size: 0.7rem; font-weight: 500; }
.satellite-info p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.secondary-button { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: transparent; cursor: pointer; }
.secondary-button:hover { border-color: var(--focus); color: var(--focus); }
.page-footer { display: flex; justify-content: space-between; gap: 20px; padding: 16px 2px 0; color: var(--faint); font-size: 0.72rem; line-height: 1.45; }
.page-footer p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 650px) {
  .page-shell { width: min(100% - 20px, 1180px); padding-top: 24px; }
  .page-header { display: block; }
  .time-card { margin-top: 18px; text-align: left; }
  .stellar-life { align-items: flex-start; flex-direction: column; }
  .stellar-life-button { width: 100%; }
  .speed-control { justify-content: flex-start; }
  .speed-control select { flex: 1; min-width: 0; }
  .orbit-card { min-height: 0; height: auto; }
  .canvas-wrap { min-height: 68vh; height: 68vh; }
  .planet-panel { position: static; top: auto; right: auto; bottom: auto; left: auto; width: auto; margin: 10px; padding: 14px; }
  .planet-summary { margin-bottom: 10px; }
  .planet-facts { margin: 10px 0; }
  .page-footer { display: block; }
  .page-footer p + p { margin-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
