.star-replay, .sky-inscriptions { display: none; }

html[data-scene="galaxy"] {
  --sky-ink: #060911;
  --silver: #e5e2df;
  --star-chart-x: 69.5%;
  --ring-radius: clamp(161px, min(25vw, 36svh), 390px);
  --star-chart-y: max(46%, calc(77px + var(--ring-radius)));
}

[data-scene="galaxy"] .atlas-home > header {
  background: linear-gradient(to bottom, #060910c4, #06091024);
  border-bottom: 1px solid #acaab721;
}
[data-scene="galaxy"] .atlas-home .opening {
  background: var(--sky-ink);
  border-bottom: 1px solid #34363b;
}
[data-scene="galaxy"] .scene-field {
  --veil-low: .13;
  --veil-high: .25;
  background: var(--sky-ink) url("assets/approved/silver-river.webp") center / cover no-repeat;
}
[data-scene="galaxy"] .scene-field::before {
  background: radial-gradient(ellipse 36% 25% at 5% 57%, #03060c85, transparent),
    linear-gradient(0deg, #02040a55, transparent 26%);
}
[data-scene="galaxy"] .scene-field .opening-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 46%) 1fr;
  align-items: center;
  width: 100%;
  max-width: none;
  min-height: max(610px, calc(100svh - 73px));
  padding: 80px max(var(--edge), calc((100% - 1440px) / 2)) clamp(96px, 13svh, 152px);
}
[data-scene="galaxy"] .scene-field .opening-copy {
  position: relative;
  z-index: 1;
  align-self: center;
}
[data-scene="galaxy"] .opening-copy .folio-label {
  color: #c0b39f;
  gap: 11px;
  font: 1.03rem/1.5 "Songti SC", "STSong", serif;
  letter-spacing: .29em;
}
[data-scene="galaxy"] .opening-copy .folio-label::before { width: 23px; opacity: .63; }
[data-scene="galaxy"] .opening-copy h1 {
  margin: 12px 0 8px;
  color: #f1eee8;
  font: normal clamp(3.15rem, 5.7vw, 6.5rem)/.99 Georgia, serif;
  letter-spacing: -.052em;
}
[data-scene="galaxy"] .opening-copy h1 em { color: #d9d1c7; }
[data-scene="galaxy"] .opening-copy > #scene-intro {
  max-width: 34em;
  margin-top: 20px;
  font: clamp(1rem, 1.3vw, 1.19rem)/1.5 Georgia, serif;
  color: #dedcda;
}
[data-scene="galaxy"] .opening-actions a {
  margin: 0;
  text-decoration: none;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid #968978a1;
  background: transparent;
  color: #e0d7c9;
  font: 1rem/1.3 Georgia, serif;
}
[data-scene="galaxy"] .opening-actions a::after { content: "→" / ""; padding-left: .8em; }
[data-scene="galaxy"] .opening-actions a:hover { color: white; border-color: currentColor; }
[data-scene="galaxy"] :is(.scene-choices, .sky-head, .star-hint) { display: none; }

[data-scene="galaxy"] .cover-chart {
  position: absolute;
  inset: 0;
  align-self: stretch;
  max-width: none;
  padding: 0;
  margin: 0;
  pointer-events: none;
  animation: none;
}
[data-scene="galaxy"] .cover-chart .night-dial {
  position: absolute;
  left: var(--star-chart-x);
  top: var(--star-chart-y);
  transform: translate(-50%, -50%);
  width: calc(2 * var(--ring-radius));
  min-width: 0;
  margin: 0;
}
[data-scene="galaxy"] .dial-engraving {
  opacity: .21;
  transform: translate(5%, 6%);
  mask-image: radial-gradient(ellipse at 22% 24%, #0006 5%, #000b 37%, #000 67%, #000a 95%);
}
[data-scene="galaxy"] .dial-ring {
  opacity: .5;
  filter: blur(1.4px) grayscale(.65) brightness(1.2);
}
[data-scene="galaxy"] .dipper-foreground { inset-inline: -10% 4%; top: 53%; }
[data-scene="galaxy"] .night-dial .star-lines {
  stroke: #c8d4df;
  stroke-width: 1.15;
  stroke-opacity: .4;
  filter: none;
}
[data-scene="galaxy"] .night-dial .star-point {
  pointer-events: auto;
  --star-color: #e1e8f1;
  --star-size: 4.2px;
}
[data-scene="galaxy"] .night-dial [data-pick="0"] { --star-color: #f4e8d8; --star-size: 4.8px; }
[data-scene="galaxy"] .night-dial [data-pick="3"] { --star-size: 3.2px; }
[data-scene="galaxy"] .night-dial [data-pick="4"] { --star-color: #edf2fa; --star-size: 5px; }
[data-scene="galaxy"] .night-dial .star-point .light {
  width: var(--star-size);
  height: var(--star-size);
  background: var(--star-color);
  box-shadow: 0 0 3px 1px #dce8faab, 0 0 10px 2px #9db1d257;
  animation: none;
}
[data-scene="galaxy"] .night-dial .star-point::before {
  width: 28px;
  height: 28px;
  background: radial-gradient(circle, #f2f2fc88, #acbdd425 30%, transparent 70%);
  animation: none;
}
[data-scene="galaxy"] .night-dial .star-point::after { border-color: transparent; }
[data-scene="galaxy"] .night-dial .star-label {
  color: #ece8e1;
  background: #080b12de;
  opacity: 0;
}
[data-scene="galaxy"] .night-dial .star-point:is(:hover, :focus-visible)::after,
[data-scene="galaxy"] [data-star-inspected] .star-point[aria-pressed="true"]::after {
  border-color: #d3d3d48a;
}
[data-scene="galaxy"] .night-dial .star-point:is(:hover, :focus-visible) .star-label,
[data-scene="galaxy"] [data-star-inspected] .star-point[aria-pressed="true"] .star-label { opacity: 1; }

[data-scene="galaxy"] .cover-note {
  position: absolute;
  transform: translateX(-50%);
  left: var(--star-chart-x);
  top: calc(var(--star-chart-y) + clamp(78px, 12vh, 148px));
  width: max-content;
  max-width: 90%;
  align-items: baseline;
  color: #e2dfda;
  text-shadow: 0 1px 5px #04060c;
  opacity: 0;
}
[data-scene="galaxy"] .cover-note strong { font-size: 1.2rem; }
[data-scene="galaxy"] [data-star-inspected] .cover-note { opacity: 1; }
[data-scene="galaxy"] .dial-caption {
  position: absolute;
  right: max(var(--edge), calc((100% - 1440px) / 2));
  bottom: clamp(28px, 4.5vh, 64px);
  gap: 18px;
}
[data-scene="galaxy"] .dial-caption button {
  min-height: 34px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  color: #b5b5bd;
  text-decoration: none;
  font: .84rem/1.4 Georgia, serif;
}
[data-scene="galaxy"] .dial-caption button:hover { color: #fff; text-decoration: underline; }
[data-scene="galaxy"] .threshold { background: #0d1018; border-color: #948b783d; }
[data-scene="galaxy"] .threshold > a { color: #d3cdc3; }
[data-scene="galaxy"] .threshold > a + a { border-color: #9c958c38; }
[data-scene="galaxy"] .threshold :is(img, svg) { opacity: .78; filter: saturate(.5); }
[data-scene="galaxy"] .plate-0::before {
  background: linear-gradient(90deg, #090e1690, #090e16c4), url("assets/approved/silver-river.webp") center / cover;
}

/* The Northern Dipper is traced from the rim to the tip of the handle.
   The bowl closes as the final ray reaches Yaoguang. */
.traced-stars { display: none; }
[data-scene="galaxy"] .night-dial {
  --arrival: .24s;
  --read-name: 1s;
  --journey: .94s;
  --step: calc(var(--read-name) + var(--journey));
  --convergence: calc(var(--arrival) + 6 * var(--step));
  --radiance-duration: 3.2s;
}
[data-scene="galaxy"] .night-dial .star-lines { display: none; }
[data-scene="galaxy"] .traced-stars {
  display: inline;
  fill: none;
  stroke-linecap: round;
}
[data-scene="galaxy"] .star-thread {
  stroke: #ead8af;
  stroke-width: 1.35px;
  opacity: .74;
}
[data-scene="galaxy"] .traced-stars g:last-child .star-thread { opacity: .40; }
[data-scene="galaxy"] .traveling-light {
  stroke: #fff2c5;
  stroke-width: 2.5px;
  opacity: 0;
  filter: drop-shadow(0 0 3px #eac68d);
}
[data-scene="galaxy"] .night-dial .star-point .light {
  width: calc(var(--star-size) + 1.8px);
  height: calc(var(--star-size) + 1.8px);
  box-shadow: 0 0 4px 1px #fff5d9df, 0 0 10px 3px #e1c78f7d, 0 0 18px 5px #b59f7040;
}
[data-scene="galaxy"] .night-dial .star-point .star-label {
  position: absolute;
  top: auto;
  bottom: calc(50% + 10px);
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 3px;
  background: transparent;
  color: #fff1da;
  opacity: .92;
  text-shadow: 0 1px 3px #060810, 0 0 7px #03060b, 0 0 11px #03060b;
  font: normal clamp(.75rem, 1.05vw, .95rem)/1.2 Georgia, serif;
}
[data-scene="galaxy"] .night-dial :is([data-pick="1"],[data-pick="2"],[data-pick="4"]) .star-label {
  top: calc(50% + 10px);
  bottom: auto;
}
[data-scene="galaxy"] .night-dial [data-pick="6"] .star-label {
  left: calc(50% + 1px);
  transform: none;
}
/* A white core, amber halo, and tapered diffraction rays share each star's center. */
.stellar-flare { display: none; }
[data-scene="galaxy"] .stellar-flare {
  display: block;
  pointer-events: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(65px, 8vw, 124px);
  aspect-ratio: 1;
  translate: -50% -50%;
  rotate: -12deg;
  scale: .66;
  opacity: .14;
  background: radial-gradient(circle closest-side, #fffff6 0 5%, #fff4cd 8%, #ffe5aacc 16%, #ffce7e76 29%, #e7a35730 53%, transparent 92%);
}
[data-scene="galaxy"] .stellar-flare::before,
[data-scene="galaxy"] .stellar-flare::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 100%;
  height: 3px;
  background: radial-gradient(ellipse closest-side, #fff 0%, #fff9df 22%, #ffdf9fc2 52%, transparent 100%);
}
[data-scene="galaxy"] .stellar-flare::after { width: 74%; rotate: 90deg; }
[data-scene="galaxy"] .cover-chart:not([data-sequence-enabled]) .traced-stars .star-thread {
  stroke: #f5dfb0;
  stroke-width: 2.15px;
  opacity: .88;
  filter: drop-shadow(0 0 1.6px #d99e5e90);
}

@keyframes seven-star-bloom {
  0% { opacity: 0; scale: .36; }
  6% { opacity: 1; scale: 1.08; }
  21% { opacity: .95; scale: 1; }
  56% { opacity: .43; scale: .82; }
  100% { opacity: .14; scale: .66; }
}
/* The ring brightens inside the softly breathing veil. */
@keyframes bagua-reveal {
  0%, 100% { opacity: .5; }
  32% { opacity: 1; }
}
@keyframes constellation-radiance {
  0% { stroke-width: 1.35px; }
  6%, 21% {
    stroke: #fff9df;
    stroke-width: 5px;
    opacity: 1;
    filter: drop-shadow(0 0 2px #fff2bc) drop-shadow(0 0 6px #ffc26c);
  }
  100% {
    stroke: #f5dfb0;
    stroke-width: 2.15px;
    opacity: .88;
    filter: drop-shadow(0 0 1.6px #d99e5e90);
  }
}
@keyframes star-arrival { from { opacity: 0; } to { opacity: 1; } }
@keyframes star-ignition {
  0% { transform: scale(.45); }
  35% { transform: scale(1.85); }
  100% { transform: scale(1); }
}
@keyframes name-arrival { from { opacity: 0; } to { opacity: .92; } }
@keyframes trace-segment { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes light-travels {
  0% { stroke-dashoffset: .10; opacity: 0; }
  8% { opacity: 1; }
  95% { opacity: 1; }
  100% { stroke-dashoffset: -1; opacity: 0; }
}
[data-scene="galaxy"] .star-replay:not([hidden]) { display: block; }
@media (prefers-reduced-motion: no-preference) {
  [data-scene="galaxy"] .dial-ring {
    --ring-turn: bagua-turn 300s linear infinite;
    animation: var(--ring-turn);
  }
  [data-scene="galaxy"] .dial-engraving { animation-duration: 24s; }
}
@media (prefers-reduced-motion: reduce) {
  [data-scene="galaxy"] [data-sequence-enabled] .motion-toggle:not([hidden]) { display: block; }
}
@media (max-width: 700px) {
  [data-scene="galaxy"] .night-dial [data-pick="6"] .star-label { top: calc(50% + 10px); bottom: auto; }
  [data-scene="galaxy"] .night-dial [data-pick="4"] .star-label { bottom: calc(50% + 10px); top: auto; }
}
[data-scene="galaxy"] [data-sequence-enabled] .night-dial .star-point {
  --at: calc(var(--arrival) + var(--star-order) * var(--step));
  animation: star-arrival .24s ease-out var(--at) both;
}
[data-scene="galaxy"] [data-sequence-enabled] .night-dial .star-point .light {
  animation: star-ignition .85s ease-out var(--at) both;
}
[data-scene="galaxy"] [data-sequence-enabled] .stellar-flare {
  animation: seven-star-bloom var(--radiance-duration) ease-out var(--convergence) both;
}
[data-scene="galaxy"] [data-sequence-enabled]:not(.trace-reset) .dial-ring {
  animation: var(--ring-turn, none),
    bagua-reveal var(--radiance-duration) cubic-bezier(.45, 0, .35, 1) var(--convergence);
}
[data-scene="galaxy"] [data-sequence-enabled] .night-dial .star-point .star-label {
  animation: name-arrival .25s ease-out var(--at) both;
}
[data-scene="galaxy"] [data-sequence-enabled] .traced-stars > g {
  --depart: calc(var(--arrival) + var(--leg) * var(--step) + var(--read-name));
}
[data-scene="galaxy"] [data-sequence-enabled] .traced-stars .star-thread {
  stroke-dasharray: 1 1;
  animation: trace-segment var(--journey) linear var(--depart) both,
    constellation-radiance var(--radiance-duration) ease-out var(--convergence) forwards;
}
[data-scene="galaxy"] [data-sequence-enabled] .traced-stars .traveling-light {
  stroke-dasharray: .10 1.2;
  animation: light-travels var(--journey) linear var(--depart) both;
}
[data-scene="galaxy"] [data-sequence-enabled] .night-dial .star-point:focus-visible,
[data-scene="galaxy"] [data-sequence-enabled] .night-dial .star-point:focus-visible .star-label { opacity: 1 !important; }
[data-scene="galaxy"] .cover-chart[data-sequence-enabled]:is(:not([data-trace-visible]),[data-motion-paused]) .night-dial :is(.star-point,.star-point .light,.star-point .star-label,.star-thread,.traveling-light,.stellar-flare,.dial-ring,.dial-engraving) {
  animation-play-state: paused;
}
[data-scene="galaxy"] .cover-chart[data-sequence-enabled].trace-reset .night-dial :is(.star-point,.light,.star-label,.star-thread,.traveling-light,.stellar-flare) {
  animation: none !important;
}
@media (max-aspect-ratio: 3/2) and (min-width: 701px) {
  html[data-scene="galaxy"] { --star-chart-x: 71.5%; }
}
@media (max-aspect-ratio: 4/5), (max-width: 700px) and (orientation: portrait) {
  html[data-scene="galaxy"] {
    --star-chart-x: 49.3%;
    --ring-radius: min(47vw, 25.5svh, 305px);
    --star-chart-y: calc(68px + var(--ring-radius));
  }
  [data-scene="galaxy"] .scene-field .opening-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(calc(76px + 2 * var(--ring-radius)), 1fr) auto minmax(70px, .24fr);
    padding: 0 var(--edge);
    gap: 0;
  }
  [data-scene="galaxy"] .scene-field .opening-copy { grid-row: 2; }
  [data-scene="galaxy"] .scene-field {
    background-image: url("assets/approved/silver-river-portrait.webp");
    background-position: center;
  }
}
@media (max-width: 700px) {
  [data-scene="galaxy"] .scene-field .opening-inner {
    min-height: max(560px, calc(100svh - 64px));

  }
  [data-scene="galaxy"] .opening-copy h1 { font-size: clamp(2.55rem, 10.8vw, 4rem); }
  [data-scene="galaxy"] .opening-copy .folio-label { font-size: .9rem; }
  [data-scene="galaxy"] .dial-caption { bottom: 12px; right: var(--edge); }
  [data-scene="galaxy"] .dial-caption button { min-height: 36px; }
  [data-scene="galaxy"] .cover-note { font-size: .83rem; }
}

.mirror-link, #scene-origin:empty { display: none; }
[data-scene="galaxy"] .opening-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 24px;
  margin-top: 20px;
}
[data-scene="galaxy"] .mirror-link { display: inline-block; }
[data-scene="galaxy"] .sky-inscriptions {
  position: absolute;
  display: block;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.sky-letter {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  aspect-ratio: 1;
  translate: -50% -50%;
  opacity: .2;
  background-repeat: no-repeat;
  background-position: var(--col) var(--row);
}
.sky-letter[data-source="fan"] {
  background-image: url("assets/approved/fan-seed-forms.png");
  background-size: 800% 100%;
}
.sky-letter[data-source="mirror"] {
  background-image: url("assets/approved/mirror-inscription-fragments.png");
  background-size: 500% 300%;
}
@keyframes inscription-passage {
  0%, 9% { opacity: 0; transform: translate(0, 0); }
  37% { opacity: var(--ink); }
  65% { opacity: calc(var(--ink) * .8); }
  90%, 100% { opacity: 0; transform: translate(var(--dx), var(--dy)); }
}
@media (prefers-reduced-motion: no-preference) {
  [data-scene="galaxy"] .sky-letter {
    animation: inscription-passage var(--period) ease-in-out var(--phase) infinite;
  }
  [data-scene="galaxy"] [data-motion-paused] .sky-letter { animation-play-state: paused; }
}
@media (max-aspect-ratio: 4/5), (max-width: 700px) and (orientation: portrait) {
  [data-scene="galaxy"] .dial-engraving { transform: translate(1.8%, 3%); }
  [data-scene="galaxy"] .dipper-foreground { inset-inline: -8% -2%; }
}
@media (max-width: 700px) {
  [data-scene="galaxy"] .opening-copy > #scene-intro { max-width: 35em; margin-top: 12px; }
  [data-scene="galaxy"] .opening-actions { gap: 0 14px; margin-top: 10px; }
  [data-scene="galaxy"] .opening-actions a { font-size: .94rem; }
  [data-scene="galaxy"] .opening-actions a::after { padding-left: .4em; }
}
@media (max-width: 700px) and (orientation: landscape) {
  html[data-scene="galaxy"] { --star-chart-x: 72%; }
  [data-scene="galaxy"] .opening-copy h1 { font-size: clamp(2.4rem, 6vw, 3rem); }
}
@media (max-width: 360px) {
  [data-scene="galaxy"] .opening-copy > #scene-intro { font-size: .94rem; margin-top: 10px; }
  [data-scene="galaxy"] .opening-actions a { padding-block: 5px; }
}
