:root {
  color-scheme: dark;
  --ink: #f1f5f9;
  --muted: #8792a6;
  --line: rgba(255, 255, 255, .13);
  --panel: rgba(7, 10, 18, .73);
  --accent: #e8b86d;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #03050b;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }

.app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 600px;
  background: radial-gradient(circle at 50% 45%, #11172a 0, #050711 43%, #020309 100%);
}

#space {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#space.dragging { cursor: grabbing; }

.topbar {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(3, 5, 11, .85), rgba(3, 5, 11, .08));
  pointer-events: none;
}

.brand, .top-actions { pointer-events: auto; }

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  letter-spacing: .12em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 0 18px rgba(232, 184, 109, .24), 0 0 0 1px rgba(241, 212, 156, .22);
  object-fit: cover;
}

.brand strong { display: block; font-family: Georgia, serif; font-size: 19px; font-weight: 500; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; letter-spacing: .29em; }

.top-actions { display: flex; gap: 8px; }
.view-tabs {
  position: absolute;
  left: 50%;
  top: 21px;
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  background: rgba(5, 8, 15, .58);
  transform: translateX(-50%);
  pointer-events: auto;
}
.view-tabs button {
  height: 34px;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: #778398;
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}
.view-tabs button.active {
  background: rgba(232, 184, 109, .13);
  color: #edc98e;
  box-shadow: inset 0 0 0 1px rgba(232, 184, 109, .24);
}
.icon-button {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(5, 8, 15, .45);
  cursor: pointer;
}
.icon-button:hover, .icon-button[aria-pressed="true"] { border-color: rgba(232, 184, 109, .5); background: rgba(232, 184, 109, .08); }
.button-icon { color: var(--accent); font-family: Georgia, serif; }
.button-text { color: #b8c0ce; font-size: 11px; letter-spacing: .08em; }

.info-card, .scale-panel, .timeline {
  position: absolute;
  z-index: 2;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
  backdrop-filter: blur(18px);
}

.info-card {
  top: 111px;
  left: 32px;
  width: 272px;
  padding: 20px 20px 17px;
}

.sky-card {
  position: absolute;
  z-index: 2;
  top: 105px;
  left: 32px;
  display: none;
  width: 260px;
  padding: 19px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
  backdrop-filter: blur(18px);
}
.sky-card h1 {
  margin: 10px 0 13px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 400;
}
.sky-location {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #c3ccd9;
  font-size: 10px;
}
.sky-location span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px rgba(232, 184, 109, .6);
}
.sky-coordinates { margin: 5px 0 17px; color: #697588; font-size: 9px; }
.sky-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.sky-summary span { color: #697588; font-size: 8px; letter-spacing: .12em; }
.sky-summary strong { color: #d8dee8; font-size: 9px; font-weight: 550; }
.visible-objects { padding-top: 4px; }
.visible-object {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  font-size: 9px;
}
.visible-object i { width: 6px; height: 6px; border-radius: 50%; background: var(--object-color); box-shadow: 0 0 7px var(--object-color); }
.visible-object span { color: #b2bdcb; }
.visible-object small { color: #68758a; font-size: 8px; }
.iss-status {
  margin: 10px 0 0;
  padding-left: 14px;
  color: #71839a;
  font-size: 8px;
  line-height: 1.45;
  position: relative;
}
.iss-status::before {
  position: absolute;
  left: 0;
  top: 3px;
  width: 7px;
  height: 3px;
  border: 1px solid #76d8ff;
  content: "";
  box-shadow: 0 0 7px rgba(118, 216, 255, .55);
}
.iss-status.error { color: #9b7780; }
.sky-accuracy { margin: 12px 0 0; color: #596579; font-size: 8px; line-height: 1.45; }

.app.sky-mode .info-card,
.app.sky-mode .scale-panel,
.app.sky-mode .zoom-indicator { display: none; }
.app.sky-mode .sky-card { display: block; }
.app.sky-mode .constellation-status {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.app.sky-mode #resetView { display: none; }

.eyebrow, .panel-label {
  color: #8993a3;
  font-size: 9px;
  letter-spacing: .22em;
}

.planet-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 14px 0 20px;
}

.planet-swatch {
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 31% 28%, #b9dcff, #487eb3 42%, #18263b 72%);
  box-shadow: 0 0 18px rgba(89, 147, 205, .32);
}

.planet-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 400;
}

.planet-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.stats { border-top: 1px solid var(--line); }
.stats div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.stats span { color: #7f8999; font-size: 10px; }
.stats strong { font-size: 10px; font-weight: 550; }
.hint { margin: 13px 0 0; color: #667184; font-size: 9px; text-align: center; }
.scale-panel {
  top: 111px;
  right: 32px;
  width: 224px;
  padding: 15px;
}
.segmented { display: flex; gap: 3px; margin-top: 10px; padding: 3px; background: rgba(0, 0, 0, .28); }
.segmented button {
  flex: 1;
  height: 28px;
  border: 0;
  background: transparent;
  color: #738094;
  font-size: 10px;
  cursor: pointer;
}
.segmented button.active { background: rgba(232, 184, 109, .15); color: #f0ce96; box-shadow: inset 0 0 0 1px rgba(232, 184, 109, .25); }
.scale-panel p { margin: 10px 1px 0; color: #657083; font-size: 9px; line-height: 1.45; }

.timeline {
  bottom: 26px;
  left: 50%;
  width: min(760px, calc(100% - 64px));
  padding: 15px 20px 13px;
  transform: translateX(-50%);
}
.timeline-head { display: flex; align-items: center; justify-content: space-between; }
.timeline-head strong { display: block; margin-top: 5px; font-family: Georgia, serif; font-size: 15px; font-weight: 400; letter-spacing: .06em; }
.speed-controls { display: flex; align-items: center; gap: 4px; }
.speed-controls button {
  width: 27px;
  height: 27px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .025);
  color: #9aa4b4;
  cursor: pointer;
}
.speed-controls .play { width: 31px; color: var(--accent); }
.speed-controls span { min-width: 76px; margin-left: 7px; color: #7e899b; font-size: 9px; }
.date-step-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
}
.date-step-controls > span {
  margin-right: 4px;
  color: #626d7f;
  font-size: 8px;
  letter-spacing: .13em;
}
.date-step-controls button {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .025);
  color: #8994a5;
  font-size: 8px;
  cursor: pointer;
}
.date-step-controls button:hover {
  border-color: rgba(232, 184, 109, .38);
  background: rgba(232, 184, 109, .08);
  color: #e1bd83;
}
.range-wrap { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 10px; margin-top: 13px; }
.range-wrap span { color: #626d7f; font-size: 8px; text-align: center; }
.sky-time-controls {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.app.sky-mode .sky-time-controls { display: grid; }
.sky-time-row {
  display: grid;
  grid-template-columns: 88px 18px 1fr 18px;
  align-items: center;
  gap: 8px;
}
.sky-time-row strong {
  color: #718096;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: .12em;
}
.sky-time-row strong b { color: #c8d3e2; font-weight: 600; }
.sky-time-row > span { color: #58677d; font-size: 7px; text-align: center; }
.sky-time-row input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, #76b9d3 var(--position), rgba(255, 255, 255, .16) var(--position));
}
input[type="range"] {
  --position: 50%;
  width: 100%;
  height: 12px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: ew-resize;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(90deg, #b8874d var(--position), rgba(255, 255, 255, .16) var(--position));
}
input[type="range"]::-webkit-slider-thumb {
  width: 12px; height: 12px; margin-top: -5px; appearance: none; border: 2px solid #f4d39f; border-radius: 50%; background: #16120d; box-shadow: 0 0 0 4px rgba(232, 184, 109, .11);
}
input[type="range"]::-moz-range-track { height: 2px; background: rgba(255, 255, 255, .16); }
input[type="range"]::-moz-range-progress { height: 2px; background: #b8874d; }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #f4d39f; border-radius: 50%; background: #16120d; }
.timeline-foot { display: flex; justify-content: space-between; margin-top: 8px; color: #5c6676; font-size: 8px; letter-spacing: .04em; }
.timeline-foot button { padding: 0; border: 0; background: none; color: #b8945e; font-size: 8px; letter-spacing: .14em; cursor: pointer; }

.zoom-indicator {
  position: absolute;
  right: 38px;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #667184;
  font-size: 11px;
  transform: rotate(-90deg) translateX(50%);
  transform-origin: right center;
}
.zoom-indicator div { width: 72px; height: 2px; background: rgba(255,255,255,.13); }
.zoom-indicator i { display: block; width: 50%; height: 100%; background: #a97c43; }

.constellation-status {
  position: absolute;
  z-index: 2;
  left: 32px;
  bottom: 31px;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(155, 180, 218, .15);
  background: rgba(6, 10, 19, .72);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  backdrop-filter: blur(12px);
}
.constellation-status.active { display: flex; opacity: 1; transform: translateY(0); }
.constellation-status.active { pointer-events: auto; }
.constellation-status strong {
  display: block;
  color: #a9bad2;
  font-size: 8px;
  font-weight: 550;
  letter-spacing: .14em;
}
.constellation-status small {
  display: block;
  margin-top: 3px;
  color: #64748a;
  font-size: 8px;
}
.constellation-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d9b477;
  box-shadow: 0 0 11px rgba(217, 180, 119, .62);
}
@media (max-width: 820px) {
  .info-card { top: 94px; left: 16px; width: 228px; padding: 15px; }
  .scale-panel { top: 94px; right: 16px; }
  .topbar { height: 70px; padding: 0 18px; }
  .timeline { bottom: 14px; width: calc(100% - 28px); }
  .button-text, .zoom-indicator { display: none; }
  .constellation-status { left: 16px; bottom: 17px; }
  .view-tabs { top: 16px; }
  .view-tabs button { padding: 0 10px; }
  .sky-card { top: 88px; left: 16px; }
}

@media (max-width: 600px) {
  .app { min-height: 500px; }
  .info-card { top: 82px; width: 190px; }
  .stats, .hint { display: none; }
  .planet-heading { margin-bottom: 0; }
  .scale-panel { top: 82px; width: 150px; }
  .scale-panel p { display: none; }
  .timeline { padding: 12px; }
  .sky-time-controls { grid-template-columns: 1fr; }
  .timeline-foot span { display: none; }
  .date-step-controls > span { display: none; }
  .date-step-controls button { padding: 0 3px; font-size: 7px; }
  .constellation-status { display: none; }
  .app.sky-mode .constellation-status { display: none; }
  .view-tabs { left: auto; right: 12px; transform: none; }
  .view-tabs button { padding: 0 7px; font-size: 7px; }
  .top-actions { display: none; }
  .sky-card { width: 190px; }
  .app.sky-mode .sky-card { display: none; }
}
