/* The SVG and Canvas share one finite timeline; layout stays stable at reveal. */
.sample-night {
  --duration: 5600ms;
  --accent: #ead3af;
  --button: #ead3af;
  --button-text: #17202b;
  --dim: #aebcc8;
  background: radial-gradient(ellipse at 90% 30%, #6a9bb51c, transparent 48%), radial-gradient(ellipse at 12% 80%, #a6697e16, transparent 48%), #0b1420;
}
.sample-night .hero { padding-top: 26px; }
.sample-night .hero h2 em { color: #ead3af; }
.sample-night .duo { margin-top: 20px; }
.sample-night .art {
  position: relative;
  isolation: isolate;
  aspect-ratio: 600 / 460;
  max-width: none;
  width: 100%;
  margin: -8px 0 0;
  overflow: hidden;
}
.sample-night .art-caption { margin-top: -4px; color: #bac4d0; }
.cinematic-art .planet-left,
.cinematic-art .planet-right {
  filter: none;
  transform-origin: 0 0;
  offset-path: none;
  transition: none !important;
}
.cinematic-art .orbit-camera { transform-origin: 0 0; }
.cinematic-art { position: relative; z-index: 1; overflow: hidden; }
.cinematic-art image { pointer-events: none; }
.cinematic-art .nebula-art { transform-origin: 300px 230px; }
.cinematic-art .near-thread, .cinematic-art .stardust, .cinematic-art .constellation-node, .cinematic-art .orbit-ribbons path { opacity: 0; }
.nebula-canvas { position: absolute; pointer-events: none; z-index: 0; }
.starlight-canvas { position: absolute; pointer-events: none; z-index: 2; }
.scene-aura {
  position: absolute;
  inset: -4% -7%;
  z-index: -1;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, #000 10%, #000a 42%, transparent 70%);
  background: radial-gradient(ellipse at 25% 62%, #82bfd344, transparent 47%), radial-gradient(ellipse at 77% 38%, #edb0bb45, transparent 45%), radial-gradient(ellipse at 51% 57%, #e7ca9b26, transparent 55%);
  mix-blend-mode: screen;
}
.cinematic-art .near-thread { filter: drop-shadow(0 0 2px #f6d4a56b); }
.fate-thread, .fate-map, .fate-names { opacity: 0; }
.fate-map { transform-origin: 0 0; }
.fate-ring { stroke-dashoffset: inherit; }
.fate-names { font: 14px var(--serif); letter-spacing: .12em; }
.fate-names text { paint-order: stroke fill; stroke: #0b142080; stroke-width: 1.5px; stroke-linejoin: round; filter: drop-shadow(0 1px 3px #06101a); }
.fate-names .fate-caption { stroke: none; }
.fate-names .fate-caption { font: 11px var(--sans); letter-spacing: .08em; }
.sample-night .night-reading { display: grid; isolation: isolate; }
.sample-night .night-intro, .sample-night .result { grid-area: 1 / 1; align-self: start; }
.sample-night .connect { display: flex; }
.sample-night .prelude { display: block; }
.sample-night .night-intro { opacity: 1; visibility: visible; transition: opacity 240ms ease; }
.sample-night .result {
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 420ms ease, transform 500ms cubic-bezier(.2,.65,.3,1);
}
.sample-night.revealed .night-intro { opacity: 0; visibility: hidden; pointer-events: none; }
.sample-night.revealed .result { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
.sample-night.is-moving .connect { background: transparent; color: #ead3af; border-color: #ead3af77; }
.planet-detail-trigger { border-color: #445e75; color: #334d63; }
.planet-detail {
  width: min(1120px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  height: min(780px, calc(100dvh - 40px));
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #bcb69d35;
  border-radius: 6px;
  color: #f4eae1;
  background: radial-gradient(ellipse at 90% 24%, #527d9530, transparent 48%), radial-gradient(ellipse at 64% 86%, #aa687b24, transparent 52%), #0b1420;
  box-shadow: 0 30px 120px #0008, inset 0 1px #e9d1b41c;
  color-scheme: dark;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b7a08050 #09111b;
  position: fixed;
}
.planet-detail[open] { display: block; }
.planet-detail:focus { outline: none; }
.detail-cover { --journey-progress: 0; --journey-meet: 0; --journey-opacity: 1; position: relative; z-index: 1; isolation: isolate; overflow: hidden; min-height: 620px; height: min(780px, calc(100dvh - 42px)); display: grid; grid-template-columns: minmax(280px, .78fr) minmax(0, 1.5fr); grid-template-rows: auto 1fr auto; }
.detail-atmosphere { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: var(--journey-opacity); }
.detail-atmosphere::before, .detail-atmosphere::after { content: ''; position: absolute; inset: -15%; pointer-events: none; }
.detail-atmosphere::before { background: radial-gradient(ellipse at 15% 12%, #82b6e047, transparent 45%), radial-gradient(ellipse at 83% 88%, #edaa8a40, transparent 44%); opacity: calc(.35 + var(--journey-meet) * .65); transform: translateY(calc(30px - var(--journey-progress) * 60px)) rotate(calc(-8deg + var(--journey-progress) * 16deg)); }
.detail-atmosphere::after { background: radial-gradient(ellipse at 50% 58%, #f0d3a72b, transparent 51%); opacity: var(--journey-meet); transform: scale(calc(.65 + var(--journey-progress) * .7)); }
.detail-atmosphere svg { width: 100%; height: 100%; opacity: calc(.2 + var(--journey-meet) * .55); }
.journey-stream { stroke-width: 32px; opacity: .14; }
.journey-thread { stroke-width: 1px; stroke-dasharray: .16 .84; stroke-dashoffset: calc(.18 - var(--journey-progress)); }
.journey-thread.warm { stroke-dashoffset: calc(.4 - var(--journey-progress)); }
.journey-dust { opacity: calc(.15 + var(--journey-meet) * .7); transform: translateY(calc(18px - var(--journey-progress) * 36px)); }
.detail-tools { display: flex; align-items: center; gap: 12px; }
.detail-language { display: flex; }
.detail-language button { min-height: 44px; min-width: 35px; padding: 0 5px; border: 0; background: transparent; color: #758899; font: 10px var(--sans); }
.detail-language button[aria-pressed="true"] { color: #e7cfab; }
.detail-reading[hidden], .detail-continue[hidden] { display: none !important; }
.detail-reading { position: relative; border-top: 1px solid #d8bd8b25; background: #09131f; }
.detail-return { display: block; min-height: 46px; margin: 0 auto; padding: 12px 24px; background: transparent; color: #d4bea0; border: 1px solid #d4bea04d; font: 12px var(--sans); letter-spacing: .05em; }
.detail-reading { padding-bottom: 48px; }
.planet-detail::backdrop { background: #050a12ee; backdrop-filter: blur(16px); }
.planet-detail .detail-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 36px;
  padding: 15px 0;
  border-bottom: 1px solid #d9c8a923;
  z-index: 4;
}
.planet-detail .detail-edition { font: 9px var(--sans); letter-spacing: .2em; color: #c6b99f; }
.planet-detail .detail-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  color: #e9e6dc;
  background: transparent;
  border: 1px solid #c4b69630;
  font: 22px var(--sans);
}
.planet-detail .detail-heading { grid-column: 1; grid-row: 2; text-align: left; position: relative; z-index: 2; padding: 56px 0 0 42px; transform: translateY(calc(var(--journey-progress) * -15px)); }
.planet-detail .detail-whisper { margin: 0 0 24px; font: 13px/1.7 var(--serif); letter-spacing: .12em; color: #d1d2cd; }
.planet-detail h2 { margin: 0; font: 400 clamp(48px, 5.6vw, 74px)/.95 var(--serif); letter-spacing: -.04em; }
.planet-detail h2 span { display: block; }
.planet-detail h2 span:first-child { transform: translate(calc(-9px + var(--journey-progress) * 9px), calc(-9px + var(--journey-progress) * 9px)); }
.planet-detail h2 span:last-child { transform: translate(calc(9px - var(--journey-progress) * 9px), calc(9px - var(--journey-progress) * 9px)); }
.planet-detail h2 i { display: block; color: #d5b787; font: italic 35px/1.3 var(--serif); margin: 5px 0 2px 6px; }
.planet-detail .detail-dates { margin: 24px 0 0; font-size: 9px; color: #98a9bb; letter-spacing: .08em; }
.planet-detail .detail-chapter { display: flex; align-items: center; gap: 10px; margin: 31px 0 25px; color: #9f9b8e; font: 8px var(--sans); letter-spacing: .12em; }
.planet-detail .detail-chapter span { font: italic 22px var(--serif); color: #cdbb9d; }
.planet-detail .detail-chapter b { font: inherit; letter-spacing: .15em; }
.planet-detail .detail-chapter b::before { content: ''; display: inline-block; width: 22px; height: 1px; margin: 0 10px 3px 0; background: #cdbb9d55; }
.planet-detail .detail-scene { grid-column: 2; grid-row: 2 / 4; align-self: center; position: relative; isolation: isolate; width: calc(100% + 25px); margin-left: -25px; aspect-ratio: 600 / 460; overflow: hidden; }
.planet-detail .cinematic-art { display: block; width: 100%; height: auto; }
.planet-detail .detail-controls { grid-column: 1; grid-row: 3; display: flex; align-items: flex-start; flex-direction: column; gap: 14px; position: relative; z-index: 2; padding: 5px 0 25px 42px; }
.detail-actions { position: relative; width: 100%; min-height: 100px; }
.planet-detail .detail-play, .planet-detail .detail-continue {
  min-width: 225px;
  min-height: 50px;
  padding: 14px 24px;
  border: 1px solid #e5ceaa9c;
  border-radius: 2px;
  color: #f2dfbd;
  background: linear-gradient(110deg, #cda56a22, #cda56a07);
  font-size: 12px;
  letter-spacing: .09em;
  position: absolute;
  top: 0;
  left: 0;
}
.planet-detail.motion-revealed .detail-play { top: 55px; min-height: 44px; border-color: transparent; background: none; padding: 8px; color: #9bacbc; font-size: 11px; }
.planet-detail .detail-continue { color: #101c28; background: #e2caa6; border-color: #e2caa6; }
.planet-detail .detail-play:hover { background-color: #cda56a16; box-shadow: 0 0 35px #e6c0821a, 0 0 55px #a2cce716; }
.planet-detail .detail-caption { max-width: 24em; text-align: left; margin: 0; font: 12px/1.8 var(--serif); letter-spacing: .025em; color: #bac5cd; }
.planet-detail .detail-story { display: grid; align-items: start; width: 100%; min-height: 55px; padding-right: 10px; }
.planet-detail .detail-caption, .planet-detail .detail-ending { grid-area: 1 / 1; transition: opacity 400ms ease, transform 500ms ease; }
.planet-detail .detail-ending { visibility: hidden; opacity: 0; transform: translateY(7px); text-align: left; margin: 0; font: 17px/1.7 var(--serif); color: #ead3af; }
.planet-detail.motion-revealed .detail-caption { opacity: 0; visibility: hidden; }
.planet-detail.motion-revealed .detail-ending { visibility: visible; opacity: 1; transform: translateY(0); }
.planet-detail .detail-disclaimer { margin: -7px 0 0; font-size: 8px; color: #8293a4; text-align: left; }
.planet-art-status { padding: 9px 22px; color: #f2d6b2; font-size: 11px; line-height: 1.7; text-align: center; }
@media (max-width: 760px) {
  .fate-names { font-size: 22px; letter-spacing: .08em; }
  .fate-names .fate-caption { font-size: 18px; letter-spacing: .03em; }
  .sample-night .art { width: 100%; margin-left: 0; }
  .planet-detail { width: 100%; height: 100dvh; max-height: 100dvh; min-height: 0; border: 0; border-radius: 0; margin: 0; inset: 0; }
  .planet-detail[open] { display: block; }
  .detail-cover { display: block; height: 100dvh; min-height: 650px; }
  .planet-detail .detail-header { position: fixed; inset: 0 20px auto; margin: 0; padding: max(10px, env(safe-area-inset-top)) 0 8px; border-bottom-color: #d9c8a917; background: linear-gradient(#0b1420ef, #0b1420aa); backdrop-filter: blur(8px); }
  .planet-detail .detail-edition { font-size: 8px; letter-spacing: .08em; max-width: 145px; line-height: 1.8; }
  .planet-detail .detail-heading { position: absolute; inset: 15% 0 auto; padding: 0 18px; text-align: center; pointer-events: none; }
  .planet-detail h2 { font-size: clamp(48px, 13.4vw, 68px); line-height: 1.1; }
  .planet-detail h2 span { display: inline-block; }
  .planet-detail h2 span:first-child { transform: translate(calc(-17px + var(--journey-progress) * 17px), calc(-18px + var(--journey-progress) * 18px)); }
  .planet-detail h2 span:last-child { transform: translate(calc(17px - var(--journey-progress) * 17px), calc(18px - var(--journey-progress) * 18px)); }
  .planet-detail h2 i { display: inline; font-size: 28px; margin: 0 9px; }
  .planet-detail .detail-dates { margin-top: 23px; font-size: 9px; }
  .planet-detail .detail-chapter { display: flex; justify-content: center; margin: 20px 0 0; font-size: 9px; }
  .planet-detail .detail-chapter span { font-size: 16px; }
  .planet-detail .detail-scene { position: absolute; top: 33%; left: -15%; width: 130%; margin: 0; aspect-ratio: 600 / 460; overflow: visible; pointer-events: none; }
  .planet-detail .detail-controls { position: absolute; inset: auto 25px max(16px, env(safe-area-inset-bottom)); padding: 0; align-items: center; gap: 8px; }
  .planet-detail .detail-actions { max-width: 310px; }
  .planet-detail .detail-play, .planet-detail .detail-continue { width: 100%; min-width: 0; max-width: none; font-size: 13px; }
  .planet-detail .detail-story { padding: 0; min-height: 52px; align-items: center; }
  .planet-detail .detail-caption { font-size: 14px; text-align: center; max-width: none; }
  .planet-detail .detail-ending { font-size: 16px; text-align: center; }
  .planet-detail .detail-whisper { margin-bottom: 32px; font-size: 13px; letter-spacing: .12em; }
  .planet-detail .detail-disclaimer { font-size: 9px; text-align: center; margin: 0; }
  .planet-detail-trigger { order: -1; }
}
@media (max-width: 760px) and (max-height: 740px) {
  .planet-detail .detail-heading { top: 12%; }
  .planet-detail .detail-whisper { margin-bottom: 25px; }
  .planet-detail .detail-chapter { margin-top: 12px; }
  .planet-detail .detail-scene { top: 28%; left: -7.5%; width: 115%; }
  .planet-detail .detail-controls { gap: 4px; }
  .planet-detail .detail-story { min-height: 45px; }
  .planet-detail .detail-actions { min-height: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  .planet-detail .detail-heading, .planet-detail h2 span,
  .journey-dust, .detail-atmosphere::before, .detail-atmosphere::after { transform: none !important; }
  .detail-atmosphere svg { opacity: .2; }
  .scene-aura { transform: none !important; }
  .cinematic-art *, .sample-night .planet-left, .sample-night .planet-right,
  .planet-detail .planet-left, .planet-detail .planet-right { animation: none !important; transition: none !important; }
}
