@font-face {
  font-family: "Instrument Serif";
  src: url("assets/InstrumentSerif-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page: #0b1019;
  --panel: #101823;
  --chart: #090f18;
  --text: #f1eee8;
  --muted: #a0abba;
  --subtle: #808da0;
  --border: #263241;
  --soft-border: #212c3a;
  --accent: #e6bf84;
  --focus: #f1ce95;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-family: system-ui, sans-serif;
  background: var(--page);
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .35; }
button, input, select, summary { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.shell, .topbar-inner {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding-inline: clamp(18px, 3.4vw, 52px);
}

.topbar { border-bottom: 1px solid var(--soft-border); }
.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 650;
}
.brand svg { color: var(--accent); flex-shrink: 0; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 37px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.reset-button { color: var(--muted); }
.reset-button:hover { background: var(--panel); color: var(--text); }
.export-button { background: var(--accent); color: #161610; border-color: transparent; }
.export-button:hover { background: #f1ce96; }

.intro { padding: 23px 0 19px; }
.intro h1 {
  margin: 0;
  font: 400 clamp(3.1rem, 5vw, 4.8rem)/.98 "Instrument Serif", Georgia, serif;
  letter-spacing: -.015em;
}
.intro p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 354px;
  gap: 16px;
  align-items: stretch;
}
.chart {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: var(--chart);
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}
.chart-stage {
  position: relative;
  flex: 1;
  min-height: 580px;
  background: radial-gradient(ellipse at 50% 48%, #101b2a 0%, #090f18 72%);
}
#sky {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
#sky:active { cursor: grabbing; }
#sky:focus-visible { outline-offset: -4px; }
.chart-reference {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  top: 17px;
  left: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #bdc8d6;
  font: 10px/1.3 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.chart-reference span {
  color: var(--subtle);
  border-left: 1px solid var(--border);
  padding-left: 9px;
}
.projection-control {
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 15px;
}
.projection-control button { min-width: 53px; padding-inline: 8px; }
.chart[data-view="all"] .zoom-controls,
.chart[data-view="all"] .zoom-help { display: none; }
.zoom-controls {
  position: absolute;
  right: 15px;
  bottom: 15px;
  display: flex;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 6px;
}
.zoom-controls button {
  font: 19px/1 var(--mono);
  width: 36px;
  height: 35px;
  border: 0;
  background: transparent;
  color: #c6d0de;
}
.zoom-controls button + button { border-left: 1px solid var(--border); }
.zoom-controls button:hover:enabled { color: var(--accent); background: #1a2432; }
.chart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  min-height: 42px;
  padding: 9px 15px;
  border-top: 1px solid var(--soft-border);
  background: #0d141f;
  color: var(--muted);
}
.chart-footer p { margin: 0; font-size: 11px; }
.touch-help { display: none; }
.chart-coordinates { display: flex; flex-wrap: wrap; gap: 5px 14px; font-family: var(--mono); }
.chart-coordinates b { color: #d0d9e6; font-weight: 500; white-space: nowrap; }
.located-star {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 33px;
  padding: 4px 12px 4px 15px;
  border-top: 1px solid var(--soft-border);
  background: #101c2a;
  color: #abcee4;
}
.located-star p { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 9px; margin: 0; }
.located-star strong { color: #dbeaf4; font-size: 12px; }
.located-star span { font: 10px/1.4 var(--mono); }
.located-star button {
  width: 27px;
  height: 25px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 19px;
  line-height: 1;
}
.located-star button:hover { background: #1c2c3f; }
.star-tooltip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  max-width: calc(100% - 16px);
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #111b29;
  box-shadow: 0 5px 20px #0006;
  white-space: nowrap;
}
.star-tooltip strong { display: block; color: var(--text); font-size: 12px; }
.star-tooltip span { color: var(--muted); font: 10px/1.4 var(--mono); }

.controls { display: grid; align-content: start; gap: 12px; }
.control-panel {
  padding: 14px 15px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  min-width: 0;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}
.section-head h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.012em; }
.finder-tabs {
  display: flex;
  gap: 18px;
  margin: 0 0 11px;
  border-bottom: 1px solid var(--soft-border);
}
.finder-tabs button {
  position: relative;
  padding: 0 1px 7px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  color: var(--muted);
}
.finder-tabs button[aria-selected="true"] { color: var(--text); }
.finder-tabs button[aria-selected="true"]::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--accent);
  content: "";
}
.search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-inline: 9px;
  color: var(--muted);
  background: #0b121c;
  border: 1px solid var(--border);
  border-radius: 5px;
}
.search:focus-within { border-color: var(--focus); }
.search svg { flex-shrink: 0; }
.search input {
  min-width: 0;
  width: 100%;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font-size: 13px;
}
.search input::placeholder { color: var(--subtle); }
.visibility-actions { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 0 7px; }
.quiet-button {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}
.quiet-button:hover { background: #192635; color: var(--text); }
.quiet-button[aria-pressed="true"] { background: #453622; color: #f7d6a3; border-color: #665034; }
.c-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  border-top: 1px solid var(--soft-border);
}
.c-name { min-width: 0; padding: 4px 2px 4px 0; color: #dce4ed; }
.c-name span { display: block; overflow-wrap: anywhere; font-size: 12px; line-height: 1.12; }
.c-name small { display: block; margin-top: 3px; font-size: 9px; line-height: 1; color: var(--subtle); }
.c-row[data-visibility="highlight"] .c-name span { color: var(--accent); }
.c-row[data-visibility="hide"] .c-name span { color: var(--subtle); }
.segmented {
  display: flex;
  padding: 2px;
  gap: 1px;
  border: 1px solid var(--soft-border);
  border-radius: 5px;
  background: #0c131d;
}
.segmented button {
  min-height: 24px;
  padding: 2px 5px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #a0abba;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: #243244; color: #edf1f5; }
.segmented button[data-mode="highlight"][aria-pressed="true"] { background: #453622; color: #f7d6a3; }
.segmented button[data-mode="hide"][aria-pressed="true"] { background: #29303a; color: #dee4ed; }
.center-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 29px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--subtle);
}
.center-button:hover { color: var(--text); background: #1c2939; }
.directory-heading {
  padding: 10px 0 5px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .045em;
}
.directory {
  max-height: 125px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #415065 transparent;
  overscroll-behavior-y: contain;
}
.star-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  padding: 7px 0;
}
.star-results-header .directory-heading { padding: 0; letter-spacing: 0; }
.star-directory { max-height: 270px; }
.star-row { min-height: 39px; }
.star-row .c-name small { font: 9px/1 var(--mono); }
.star-row .quiet-button { min-height: 26px; }
.empty-search { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.range-label, .label-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.label-control {
  margin: 0 0 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--soft-border);
}
.range-label output { font-family: var(--mono); font-size: 11px; color: var(--text); }
input[type="range"] { display: block; width: 100%; height: 19px; margin: 3px 0 7px; accent-color: var(--accent); }
.layer-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 5px;
  padding: 11px 0;
  border-block: 1px solid var(--soft-border);
}
.layer-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #c1cbd7;
  font-size: 12px;
}
.layer-options input { margin: 0; width: 14px; height: 14px; accent-color: var(--accent); }

.sources {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 10px 18px;
  padding: 11px 1px 20px;
  color: var(--subtle);
  font-size: 11px;
}
.sources p { margin: 0; }
.sources details { text-align: right; }
.sources summary { cursor: pointer; color: var(--muted); }
.sources details[open] { grid-column: 1 / -1; text-align: left; }
.sources details p { margin-top: 7px; max-width: 75ch; line-height: 1.55; }

@media (pointer: coarse) {
  .pointer-help { display: none; }
  .touch-help { display: inline; }
  .c-row { min-height: 43px; }
  .segmented button { min-height: 32px; padding-inline: 7px; }
  .center-button { width: 34px; height: 34px; }
  .star-row .quiet-button { min-height: 32px; }
}
@media (max-width: 1000px) {
  .studio { grid-template-columns: minmax(0, 1fr) 322px; gap: 12px; }
  .chart-stage { min-height: 520px; }
}
@media (max-width: 760px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
  .chart-stage { min-height: 0; flex: auto; aspect-ratio: 1.06; }
  .chart[data-view="all"] .chart-stage { aspect-ratio: 1.58; }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .chart-reference { left: 11px; top: 11px; }
  .projection-control { right: 9px; top: 7px; }
  .zoom-controls { bottom: 9px; right: 9px; }
}
@media (max-width: 580px) {
  .controls { grid-template-columns: minmax(0, 1fr); }
  .intro { padding: 19px 0 15px; }
  .intro p { font-size: 12px; }
  .brand { font-size: 11px; gap: 6px; }
  .brand svg { width: 17px; height: 17px; }
  .top-actions { gap: 6px; }
  .button { padding-inline: 8px; gap: 4px; }
  .topbar-inner { min-height: 55px; }
  .chart-footer { padding-inline: 9px; }
  .directory { max-height: 166px; }
  .star-directory { max-height: 228px; }
}
@media (max-width: 330px) {
  .shell, .topbar-inner { padding-inline: 12px; }
  .brand { letter-spacing: .1em; }
  .chart-reference { font-size: 9px; }
  .zoom-controls button { width: 29px; height: 29px; }
  .control-panel { padding-inline: 10px; }
}
