:root {
  color-scheme: dark;
  color: #f2ecff;
  background: #090b17;
  --muted: #b9b0cc;
  --line: #ab98d336;
  --purple: #bda6ff;
  --light: #25203a;
  --paper: #111426e8;
  font-family: "Inter", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}
body {
  background: linear-gradient(155deg, #07091622, #090913a8 63%, #090a14f5), url("/milky-way.webp") center top / cover fixed;
}
body:has(#sky-dialog[open]) { overflow: hidden; }
:focus-visible { outline-color: #ceb7ff; }
.site-header { background: #090b17bf; border-color: #b09de326; }
.brand-icon { background: #ad91ff1e; border: 1px solid #b99eff45; }
.local { color: #ddd0fb; background: #ac91f41c; }
.local span { background: #bfa9fd; box-shadow: 0 0 9px #bfa9fd85; }
.hero {
  min-height: 312px;
  display: grid;
  grid-template-columns: 1.04fr 1fr;
  align-items: center;
  background: radial-gradient(ellipse at 72% 52%, #2e205e4a, transparent 53%),
    linear-gradient(95deg, #101123eb, #0d1026a8 60%, #0b0d1f91);
  border: 1px solid var(--line);
  box-shadow: 0 16px 55px #03040e62;
}
.hero h1 { font-family: "Cormorant Garamond", "Songti SC", SimSun, serif; line-height: 1.22; }
.hero-content { pointer-events: none; }
.sky-entry {
  align-self: stretch;
  position: relative;
  border: 0;
  background: transparent;
  border-radius: 20px;
  color: #e4d6ff;
  min-height: 270px;
}
.sky-entry:focus-visible { outline-offset: -6px; }
.sky-entry .hero-art {
  top: 45%; right: 1%; opacity: 1;
  width: min(114%, 530px);
  pointer-events: none;
  transition: filter .3s, transform .45s;
}
.sky-entry:hover .hero-art, .sky-entry:focus-visible .hero-art {
  filter: brightness(1.24) drop-shadow(0 0 17px #b394fa66);
  transform: translateY(-50%) scale(1.04);
}
.sky-entry-label {
  position: absolute;
  bottom: 26px; right: 36%;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid #bfa5f06b;
  background: #17132bd9;
  font-size: 12px;
  white-space: nowrap;
}
.sky-entry-label span { margin-left: 5px; }
.search-panel, .result, .selection, .drawing-note { box-shadow: 0 8px 24px #03040d25; }
.search-row, .picked { background: #1c1b31; border-color: var(--line); }
.search-row:focus-within { border-color: #c5a5ff; }
.search-row input::placeholder { color: #b5adc9; }
.primary { color: #171129; background: #c6b2ff; }
.primary:hover:not(:disabled) { background: #d9cbff; }
.primary:disabled { color: #b6abc9; background: #29263b; }
select, .dialog-close { color: #e7dcfc; background: #1a192e; }
.examples button, .tag, .result-count, .pick { background: #27213e; color: #dfcef9; border-color: var(--line); }
.examples button:hover, .pick:hover, .pick[aria-pressed="true"] { background: #3a2a55; border-color: #b79bd5; }
.rank, .picked h3, .drawing-notes h3, .drawing-references summary, .drawing-preview a { color: #d4baff; }
.quiet, .clear-button, .copy-status { color: #d4baff; }
.selection-heading { border-color: var(--line); }
.placeholder, .drawing-references { background: #16182aeb; border-color: var(--line); }
.error { color: #ffacd0; }
footer { color: var(--muted); }
dialog { color: #f2ecff; background: #121427; border-color: var(--line); }
dialog::backdrop { background: #05060bbb; }
.dialog-header { background: #191930; }
.drawing-note { background: var(--paper); border-color: var(--line); }
#sky-dialog {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  overflow: hidden;
  background: #080a17;
  box-shadow: none;
}
#sky-dialog[open] { animation: sky-arrive .38s ease-out both; }
#sky-dialog.sky-exiting { pointer-events: none; }
#sky-dialog::backdrop { background: transparent; }
@keyframes sky-arrive {
  from { opacity: 0; transform: scale(.985); }
  to { opacity: 1; transform: scale(1); }
}
.sky-stage, .sky-labels { position: absolute; inset: 0; }
.sky-stage {
  background: radial-gradient(ellipse at center, #07081633, #050712b3), url("/milky-way.webp") center / cover;
}
.sky-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.sky-stage canvas:active { cursor: grabbing; }
.sky-stage canvas.is-target { cursor: pointer; }
.sky-stage canvas:focus-visible { outline-offset: -3px; }
.sky-labels { pointer-events: none; }
.sky-label {
  position: absolute;
  left: 0; top: 0;
  border: 1px solid #b5a1dc4c;
  border-radius: 999px;
  color: #f8f0ff;
  background: #100e21de;
  pointer-events: auto;
  padding: 4px 11px;
  white-space: nowrap;
  font-size: 12px;
}
.sky-label:hover, .sky-label:focus-visible { border-color: var(--star-color); }
.sky-label.sky-black-hole-label {
  border: 0;
  padding: 0 3px;
  background: transparent;
  color: #ffe5b5;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: .22em;
  text-shadow: 0 0 10px #e8933caa, 0 1px 5px #04020c;
  pointer-events: auto;
}
.sky-label.sky-black-hole-label:hover { color: #fff5da; text-shadow: 0 0 14px #ffae58; }
.sky-header {
  position: absolute; inset: 0 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start;
  gap: 12px;
  padding: 24px clamp(15px, 3vw, 45px) 33px;
  background: linear-gradient(#070812e8, #07081200);
  pointer-events: none;
}
.sky-header button { pointer-events: auto; justify-self: start; }
.sky-header button:last-child { justify-self: end; }
.sky-heading { text-align: center; }
.sky-heading h2 { font-family: "Cormorant Garamond", "Songti SC", SimSun, serif; font-size: clamp(23px, 3vw, 34px); letter-spacing: .13em; }
.sky-heading p, .sky-detail-heading p { color: var(--muted); font-size: 12px; margin-top: 5px; }
.sky-control {
  color: #f0e7ff;
  padding: 6px 11px;
  border: 1px solid #ad98da5e;
  border-radius: 10px;
  background: #121326e8;
  font-size: 12px;
}
.sky-control:hover:not(:disabled), .sky-control[aria-pressed="true"] { background: #342852; border-color: #b9a1ec; }
.sky-control:disabled { opacity: .5; }
.sky-status {
  position: absolute; top: 100px; left: 50%; max-width: calc(100% - 40px);
  transform: translateX(-50%); border: 1px solid var(--line); border-radius: 10px;
  background: #111426ef; padding: 7px 13px; pointer-events: none;
}
.sky-status:empty { display: none; }
.sky-footer {
  position: absolute; inset: auto 0 0;
  padding: 24px 14px 14px;
  display: flex; flex-direction: column; align-items: center;
  gap: 9px; letter-spacing: 0; text-align: center;
  background: linear-gradient(#07081200, #070812ed);
  pointer-events: none;
}
#sky-clusters { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; pointer-events: auto; }
.sky-dot {
  display: inline-block;
  margin-right: 6px;
  color: var(--star-color, #dcc9ff);
  text-shadow: 0 0 8px var(--star-color, #dcc9ff);
}
.sky-touch-help, .sky-tracking-help { display: none; }
#sky-dialog[data-tracking] :is(.sky-mouse-help, .sky-touch-help) { display: none; }
#sky-dialog[data-tracking] .sky-tracking-help { display: block; }
.sky-detail, .sky-browse {
  position: absolute;
  top: 94px;
  bottom: 108px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid #c6b0ff52;
  border-radius: 15px;
  background: #101225f5;
  box-shadow: 0 12px 40px #02030d80;
  overflow: hidden;
}
.sky-detail { width: min(380px, 36vw); right: clamp(12px, 2.8vw, 42px); animation: sky-reveal .22s ease-out; }
@keyframes sky-reveal { from { transform: translateX(12px); opacity: 0; } }
.sky-browse { width: min(320px, 32vw); left: clamp(12px, 2.8vw, 42px); animation: sky-reveal .22s ease-out; }
.sky-detail-heading {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 14px 15px 10px; border-bottom: 1px solid var(--line);
}
.sky-detail-heading h3 { margin: 0; font-size: 16px; }
.sky-close { font-size: 20px; line-height: 1; padding: 3px 8px 6px; }
.sky-detail-scroll, .sky-list { overflow: auto; overscroll-behavior: contain; }
.sky-detail-text { padding: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sky-related { padding: 0 15px 15px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; }
.sky-related:empty { display: none; }
.sky-list { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.sky-list .sky-control { width: 100%; text-align: left; padding: 7px 8px; }
.sky-list small { display: block; color: var(--muted); margin-left: 16px; }
.sky-pages {
  border-top: 1px solid var(--line); color: var(--muted);
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  flex-wrap: wrap; padding: 8px; font-size: 12px;
}
.sky-jump { display: flex; align-items: center; justify-content: center; gap: 5px; flex: 1; }
.sky-jump input {
  width: 4ch; min-width: 42px; padding: 5px 2px;
  appearance: textfield; text-align: center; font: inherit; color: #f0e7ff;
  background: #1a1c33; border: 1px solid #ad98da5e; border-radius: 8px;
}
.sky-jump input::-webkit-inner-spin-button { appearance: none; }
#sky-page-total { white-space: nowrap; }
.sky-pages button { padding-inline: 7px; white-space: nowrap; }
@media (pointer: coarse) {
  .sky-mouse-help { display: none; }
  .sky-touch-help { display: block; }
}
@media (max-width: 760px) {
  .hero { min-height: 225px; }
  .sky-entry { min-height: 225px; }
  .sky-entry .hero-art { width: 143%; right: -5%; opacity: .85; }
  .sky-entry-label { right: 12%; bottom: 22px; }
  .sky-header { padding-top: 14px; }
  .sky-detail, .sky-browse { top: auto; bottom: 103px; left: auto; right: 10px; width: min(395px, calc(100% - 20px)); max-height: 43%; }
  #sky-dialog:has(.sky-detail:not([hidden])) .sky-browse { display: none; }
}
@media (max-width: 580px) {
  .hero { grid-template-columns: 1fr; }
  .hero-content { padding-bottom: 0; }
  .sky-entry { min-height: 162px; width: 100%; }
  .sky-entry .hero-art { width: min(96%, 360px); right: 7%; }
  .sky-entry-label { right: 25%; bottom: 13px; }
}
@media (max-width: 430px) {
  .sky-heading h2 { font-size: 20px; letter-spacing: .05em; }
  .sky-header .sky-control { padding-inline: 7px; }
  .sky-control { padding-inline: 7px; }
}
@media (max-height: 525px) {
  .sky-heading p { display: none; }
  .sky-header { padding-top: 8px; }
  .sky-detail, .sky-browse { top: 48px; bottom: 65px; max-height: none; }
}
@media (max-height: 525px) and (max-width: 760px) {
  #sky-dialog[data-tracking] .sky-detail { top: auto; max-height: 42%; }
}
@media (prefers-reduced-motion: reduce) {
  #sky-dialog[open], .sky-detail, .sky-browse { animation: none; }
  .sky-entry .hero-art { transition: none; }
}
