/* ==========================================================================
   Revision 4 Stylesheet: Cosmic Princess Kaguya! Dreamy Preview Enhancements
   Refined to address all user feedback items:
   1. Hide music note glyph when album cover is present
   2. Remove horizontal scrollbar on lyrics & enforce center alignment
   3. Replace ugly vertical scrollbar with circular cosmic orb scroll indicator
   4. Neutralize leftward page layout shift when player dock expands
   5. Hide bottom dock player completely in music view; keep view centered
   6. Smooth animation transitions for mini player, music view, & fortune ritual
   7. Enriched celestial star tracks / orbits & official logo in header
   ========================================================================== */

/* === 1. Site Header with Official 《超かぐや姫！》 Logo === */
.site-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 20px !important;
  padding-block: 18px 14px !important;
  position: relative !important;
}

.site-header-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
}

.site-header-logo-link {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  transition: opacity 220ms ease, transform 220ms ease, filter 220ms ease;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 30%, transparent));
}

.site-header-logo-link:hover {
  opacity: 0.95;
  transform: translateY(-1px) scale(1.02);
  filter: drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 60%, transparent));
}

.site-header-logo-img {
  height: 38px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
}

@media (max-width: 860px) {
  .site-header-logo-img {
    height: 30px;
    max-width: 150px;
  }
}

@media (max-width: 680px) {
  .site-header {
    flex-wrap: wrap !important;
  }
  .site-header-logo-wrap {
    order: 3;
    width: 100%;
    margin-top: 8px;
    justify-content: flex-start;
  }
  .site-header-logo-img {
    height: 28px;
  }
}

/* === 2. Hero Refinement & Enriched Celestial Orbit Tracks === */
.hero {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr) !important;
  gap: 36px !important;
  min-height: 580px !important;
  padding-block: 48px 36px !important;
  align-items: center !important;
}

.hero-astral-container {
  position: relative;
  width: 100%;
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.hero-orbit-svg {
  width: 100%;
  max-width: 470px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 0 32px color-mix(in srgb, var(--accent) 28%, transparent));
}

/* Concentric & Inclined Orbit Lines */
.orbit-line {
  stroke: color-mix(in srgb, var(--edge) 80%, transparent);
  stroke-dasharray: 6 6;
  animation: orbit-rotate 90s linear infinite;
  transform-origin: 250px 250px;
}

.orbit-outer-fine {
  stroke: color-mix(in srgb, var(--ice) 45%, transparent);
  animation: orbit-rotate 160s linear infinite reverse;
}

.orbit-inclined-1 {
  stroke: color-mix(in srgb, var(--accent) 55%, transparent);
  animation: orbit-tilt-1 42s ease-in-out infinite alternate;
  transform-origin: 250px 250px;
}

.orbit-inclined-2 {
  stroke: color-mix(in srgb, var(--edge) 85%, transparent);
  animation: orbit-tilt-2 52s ease-in-out infinite alternate;
  transform-origin: 250px 250px;
}

.orbit-mid-dash {
  stroke: color-mix(in srgb, var(--ice) 60%, transparent);
  animation: orbit-rotate 75s linear infinite;
  transform-origin: 250px 250px;
}

.orbit-inner-fine {
  stroke: color-mix(in srgb, var(--accent) 40%, transparent);
  animation: orbit-rotate 48s linear infinite reverse;
  transform-origin: 250px 250px;
}

.orbit-glow-ring {
  stroke: url(#kaguyaHeroGlow);
  animation: orbit-pulse 8s ease-in-out infinite alternate;
}

.orbit-planet-kaguya {
  fill: var(--accent);
  filter: drop-shadow(0 0 10px var(--accent));
  animation: planet-glide 24s ease-in-out infinite alternate;
}

.orbit-moon-core {
  fill: color-mix(in srgb, var(--surface) 60%, transparent);
  stroke: var(--accent);
  stroke-width: 1.5;
}

/* Starlight Satellites */
.orbit-node {
  filter: drop-shadow(0 0 6px currentColor);
  animation: node-pulse 4s ease-in-out infinite alternate;
}

.node-east { animation-delay: -1s; }
.node-west { animation-delay: -2.5s; }
.node-south { animation-delay: -0.7s; }
.node-star1 { animation-delay: -1.8s; }
.node-star2 { animation-delay: -3.2s; }

@keyframes orbit-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes orbit-tilt-1 {
  0% { transform: rotate(-32deg) scale(0.98); }
  100% { transform: rotate(-22deg) scale(1.02); }
}

@keyframes orbit-tilt-2 {
  0% { transform: rotate(34deg) scale(1.02); }
  100% { transform: rotate(44deg) scale(0.97); }
}

@keyframes orbit-pulse {
  0% { stroke-opacity: 0.35; stroke-width: 1.5; }
  100% { stroke-opacity: 0.85; stroke-width: 2.8; }
}

@keyframes planet-glide {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-8px, 6px); }
  100% { transform: translate(6px, -10px); }
}

@keyframes node-pulse {
  0% { opacity: 0.45; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1.25); }
}

/* === 3. Mini Player: Always visible cover & Hide Note Icon when Cover exists === */
.mini-cover {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  border: 1px solid var(--control-edge);
  background: var(--raised);
  box-shadow: 0 4px 12px #0004;
}

.dock-summary {
  display: flex;
  align-items: center;
  gap: 12px !important;
  padding: 10px 14px !important;
}

/* Hide musical note icon completely when cover is present */
#mini-glyph[hidden],
.dock-summary .music-symbol[hidden],
.dock-summary:has(#mini-cover:not([hidden])) .music-symbol,
.music-dock.has-cover .dock-summary .music-symbol {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* === 4. Neutralize Page Layout Shift on Player Expand (Keep Original Layout Untouched) === */
:root[data-music-open="true"] .wrap,
html[data-music-open="true"] .wrap,
body[data-music-open="true"] .wrap,
:root[data-music-open="true"] #main.wrap,
:root[data-music-open="true"] .site-header.wrap,
:root[data-music-open="true"] #view-music.wrap {
  width: min(1280px, calc(100% - 112px)) !important;
  max-width: 1280px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-inline: auto !important;
  transform: none !important;
  padding-right: 0 !important;
}

@media (max-width: 1100px) {
  :root[data-music-open="true"] .wrap,
  html[data-music-open="true"] .wrap,
  body[data-music-open="true"] .wrap {
    width: calc(100% - 64px) !important;
  }
}

@media (max-width: 700px) {
  :root[data-music-open="true"] .wrap,
  html[data-music-open="true"] .wrap,
  body[data-music-open="true"] .wrap {
    width: calc(100% - 40px) !important;
  }
}

/* === 5. Standalone Music View & Dock Auto-Hide === */
:root[data-route="music"] #music-dock,
body[data-route="music"] #music-dock,
#music-dock.route-music-hidden,
#view-music:not([hidden]) ~ #music-dock {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(120%) !important;
}

#view-music.wrap,
.view-music-wrap {
  width: min(1280px, calc(100% - 112px)) !important;
  max-width: 1280px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-inline: auto !important;
  transform: none !important;
}

@media (max-width: 1100px) {
  #view-music.wrap,
  .view-music-wrap {
    width: calc(100% - 64px) !important;
  }
}

@media (max-width: 700px) {
  #view-music.wrap,
  .view-music-wrap {
    width: calc(100% - 40px) !important;
  }
}

.view-music {
  padding-block: 28px 80px;
  min-height: calc(100vh - 120px);
}

.music-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 20px;
  margin-bottom: 32px;
}

.music-back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 24px;
  border: 1px solid var(--control-edge);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.music-back-link:hover {
  background: var(--raised);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(-2px);
}

.music-view-title h1 {
  font-size: 26px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.04em;
}

.music-view-title small {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.music-stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.music-deck {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 16px 48px #0006;
}

.deck-cover-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 420px;
  margin: 0 auto 24px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 36px #0008;
  background: var(--raised);
}

.deck-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 600ms ease;
}

.deck-track-info {
  text-align: center;
  margin-bottom: 24px;
}

.deck-track-info h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
}

.deck-track-info p {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 8px;
}

.deck-track-info small {
  font-size: 11px;
  color: var(--quiet);
}

.music-aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.music-standalone-lyrics-card,
.music-standalone-playlist-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 24px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 10px;
}

.standalone-lyrics {
  height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-block: 40px;
  text-align: center;
}

.standalone-track-list {
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 0;
  margin: 0;
  list-style: none;
}

.standalone-track-list button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 0;
  background: none;
  font-size: 13px;
  color: var(--muted);
  border-radius: 8px;
  transition: background 160ms ease, color 160ms ease;
}

.standalone-track-list button:hover {
  background: var(--raised);
  color: var(--ink);
}

.standalone-track-list button[aria-current=true] {
  background: var(--raised);
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
}

/* === 6. Lyrics: No horizontal scrolling & Perfectly Centered === */
.lyrics,
.standalone-lyrics,
.lyrics-lines,
#lyrics-lines,
#deck-lyrics-lines {
  overflow-x: hidden !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.lyric-line {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  text-align: center !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  overflow-x: hidden !important;
  text-wrap: balance !important;
  box-sizing: border-box !important;
  padding-inline: 12px !important;
  margin-inline: auto !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 6px;
  transition: color 280ms ease, transform 280ms cubic-bezier(0.2, 0, 0, 1) !important;
}

.lyric-line::before,
.lyric-line::after {
  display: none !important;
}

.lyric-line:hover {
  background: transparent !important;
  color: var(--ink) !important;
}

.lyric-line[aria-current=true] {
  background: transparent !important;
  box-shadow: none !important;
  color: var(--accent) !important;
  font-weight: 650 !important;
  transform: scale(1.04) !important;
  text-shadow: 0 0 14px color-mix(in srgb, var(--accent) 55%, transparent) !important;
}

/* === 7. Replace Vertical Scrollbar with Circular Cosmic Orb === */
.lyrics,
.standalone-lyrics {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
.lyrics::-webkit-scrollbar,
.standalone-lyrics::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.lyrics-track-wrapper {
  position: relative;
  width: 100%;
  display: flex;
}

.lyrics-track-wrapper .lyrics,
.lyrics-track-wrapper .standalone-lyrics {
  flex: 1 1 auto;
}

.lyric-scroll-rail {
  position: absolute;
  top: 14px;
  bottom: 14px;
  right: 4px;
  width: 12px;
  cursor: pointer;
  z-index: 5;
  transition: opacity 240ms ease;
  user-select: none;
  touch-action: none;
}

.lyric-scroll-rail::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--edge) 45%, transparent);
  transition: background 200ms ease;
}

.lyric-scroll-rail:hover::before,
.lyric-scroll-rail.dragging::before {
  background: color-mix(in srgb, var(--accent) 50%, transparent);
}

.lyric-scroll-bead {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, var(--accent) 65%, color-mix(in srgb, var(--accent) 80%, #000) 100%);
  border: 1px solid color-mix(in srgb, #ffffff 70%, transparent);
  box-shadow: 0 0 10px var(--accent), 0 0 3px #ffffff;
  cursor: grab;
  transition: transform 180ms ease, box-shadow 200ms ease;
}

.lyric-scroll-rail:hover .lyric-scroll-bead,
.lyric-scroll-rail.dragging .lyric-scroll-bead {
  transform: translateX(-50%) scale(1.25);
  box-shadow: 0 0 16px var(--accent), 0 0 5px #ffffff;
}

.lyric-scroll-rail.dragging .lyric-scroll-bead {
  cursor: grabbing;
}

/* === 8. Smooth Transitions: Mini-Player & Views === */
.music-dock {
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 320ms ease,
              border-color 280ms ease,
              background-color 280ms ease !important;
}

.music-dock .player-content {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(8px);
  transition: max-height 360ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 280ms ease,
              transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.music-dock.expanded .player-content {
  max-height: min(540px, calc(100dvh - 122px));
  opacity: 1;
  transform: translateY(0);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.view-transition-in {
  animation: viewFadeIn 340ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

:root.page-hidden .view-transition-in,
:root[data-motion="off"] .view-transition-in {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

@keyframes viewFadeIn {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === 9. Fortune Drawing Ritual Ceremony === */
.fortune-ritual-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  perspective: 800px;
  margin: 12px 0 20px;
}

.fortune-tube {
  position: relative;
  width: 72px;
  height: 120px;
  margin-bottom: 12px;
  transition: transform 300ms ease, opacity 300ms ease;
}

.fortune-tube-body {
  width: 100%;
  height: 100%;
  border-radius: 8px 8px 14px 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 90%, #fff 10%), color-mix(in srgb, var(--raised) 90%, #000 10%));
  border: 1.5px solid var(--control-edge);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 15%, transparent), inset 0 2px 4px color-mix(in srgb, #fff 25%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.fortune-tube-crest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.fortune-stick {
  position: absolute;
  top: -16px;
  width: 7px;
  height: 38px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(to bottom, #ffe4a0 0%, var(--accent) 70%, #9c6c2e 100%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent);
  z-index: 1;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1), top 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.fortune-stick-1 { left: 18px; transform: rotate(-8deg); }
.fortune-stick-2 { left: 32px; top: -22px; }
.fortune-stick-3 { left: 46px; transform: rotate(10deg); }

/* Shaking state */
.fortune-ritual-stage[data-state="shaking"] .fortune-tube {
  animation: tube-shake 280ms ease-in-out infinite alternate;
}

@keyframes tube-shake {
  0% { transform: rotate(-7deg) translateY(0); }
  50% { transform: rotate(6deg) translateY(-4px); }
  100% { transform: rotate(-5deg) translateY(-2px); }
}

/* Emerging stick */
.fortune-ritual-stage[data-state="emerging"] .fortune-stick-2 {
  top: -65px;
  transform: scale(1.15);
  box-shadow: 0 0 18px var(--accent), 0 0 6px #fff;
}

/* Fortune paper parchment reveal */
.fortune-paper {
  position: relative;
  transition: opacity 360ms ease, transform 380ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 360ms ease;
}

.fortune-ritual-stage[data-state="shaking"] .fortune-paper {
  opacity: 0.25;
  filter: blur(2px);
  transform: scale(0.96);
  pointer-events: none;
}

.fortune-ritual-stage[data-state="emerging"] .fortune-paper {
  opacity: 0.6;
  filter: blur(1px);
  transform: scale(0.98) translateY(6px);
  pointer-events: none;
}

.fortune-ritual-stage[data-state="revealed"] .fortune-tube {
  display: none;
}

.fortune-ritual-stage[data-state="revealed"] .fortune-paper {
  opacity: 1;
  filter: none;
  transform: scale(1) translateY(0);
  animation: fortune-unfold 480ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-shadow: 0 12px 36px color-mix(in srgb, var(--accent) 22%, transparent);
}

@keyframes fortune-unfold {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.92);
  }
  60% {
    transform: translateY(-4px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.fortune-sparkles {
  position: absolute;
  top: -14px;
  right: 18px;
  display: flex;
  gap: 8px;
  color: var(--accent);
  font-size: 14px;
  pointer-events: none;
  animation: sparkle-glow 2s ease-in-out infinite alternate;
}

@keyframes sparkle-glow {
  0% { opacity: 0.3; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1.2); text-shadow: 0 0 10px var(--accent); }
}

/* === 10. Organic Gallery Masonry === */
.gallery {
  display: block !important;
  columns: 3 320px !important;
  column-gap: 24px !important;
  margin-top: 20px;
}

.gallery .piece {
  break-inside: avoid !important;
  display: inline-block !important;
  width: 100% !important;
  margin: 0 0 28px 0 !important;
  grid-column: auto !important;
  grid-row: auto !important;
  order: 0 !important;
}

.gallery .piece .mat {
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  position: relative;
}

.gallery .piece .mat img {
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  display: block !important;
  object-fit: contain !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 320ms cubic-bezier(0.2, 0, 0, 1), box-shadow 320ms ease;
}

.gallery .piece-open:hover .mat img,
.gallery .piece-open:focus-visible .mat img {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--control-edge);
}

.gallery[data-filter="sticker"] {
  columns: 4 200px !important;
  column-gap: 18px !important;
}

.piece figcaption {
  padding-top: 10px;
}

.piece .credit {
  font-size: 11px;
  color: var(--quiet);
  margin-top: 4px;
}

/* === 11. Responsive Overrides === */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr !important;
  }
  .hero-astral-container {
    height: 320px;
  }
  .music-stage-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .gallery {
    columns: 2 160px !important;
    column-gap: 14px !important;
  }
  .mini-cover {
    width: 38px;
    height: 38px;
    display: block !important;
  }
  .dock-summary {
    gap: 8px !important;
  }
}

/* === Revision 4.1: focused celestial tracks, one expanded identity, restrained motion === */
/* The large moon belongs to scene-moon.svg. The hero SVG is an orbital map, not a second moon. */
.hero-orbit-svg {
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--ice) 16%, transparent));
}
.orbit-line {
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.orbit-outer-fine {
  stroke: color-mix(in srgb, var(--ice) 34%, transparent);
  animation: orbit-trace-slow 120s linear infinite reverse;
}
.orbit-track-primary {
  stroke: color-mix(in srgb, var(--ice) 62%, var(--accent) 18%);
  stroke-dasharray: 42 12 118 18;
  animation: orbit-trace-primary 54s linear infinite;
}
.orbit-track-secondary {
  stroke: color-mix(in srgb, var(--accent) 46%, var(--ice) 20%);
  stroke-dasharray: 76 18 32 22;
  animation: orbit-trace-secondary 68s linear infinite reverse;
}
.orbit-track-tertiary {
  stroke: color-mix(in srgb, var(--ice) 38%, transparent);
  stroke-dasharray: 2 13;
  animation: orbit-trace-slow 92s linear infinite;
}
.orbit-mid-dash {
  stroke: color-mix(in srgb, var(--accent) 28%, var(--ice) 20%, transparent);
  animation: orbit-trace-slow 110s linear infinite reverse;
}
.orbit-focus-dot {
  fill: var(--ice);
  opacity: .36;
  filter: drop-shadow(0 0 5px var(--ice));
  animation: orbit-focus-breathe 5s ease-in-out infinite;
}
.orbit-node {
  filter: drop-shadow(0 0 4px currentColor);
}
@keyframes orbit-trace-primary {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -320; }
}
@keyframes orbit-trace-secondary {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 260; }
}
@keyframes orbit-trace-slow {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 180; }
}
@keyframes orbit-focus-breathe {
  0%, 100% { opacity: .22; transform: scale(.82); }
  50% { opacity: .62; transform: scale(1.18); }
}

/* Expanded mode is a detail deck: keep the mini summary controls, not a second cover/title. */
.music-dock[data-presentation="expanded"] .dock-summary {
  justify-content: flex-end;
  min-height: 48px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
}
.music-dock[data-presentation="expanded"] .dock-summary .mini-cover,
.music-dock[data-presentation="expanded"] .dock-summary .dock-title {
  display: none !important;
  flex: 0 0 0 !important;
  width: 0 !important;
  max-width: 0 !important;
  min-width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  overflow: hidden !important;
  pointer-events: none !important;
}
.music-dock[data-presentation="expanded"] .dock-summary .icon-button {
  animation: dock-control-arrive 300ms cubic-bezier(.2,.8,.2,1) both;
}
.music-dock[data-presentation="expanded"] .dock-summary .icon-button:nth-last-child(1) {
  animation-delay: 55ms;
}
.music-dock[data-presentation="expanded"] .track-heading {
  animation: detail-heading-arrive 360ms cubic-bezier(.2,.8,.2,1) both;
}
.music-dock[data-presentation="expanded"] .player-tabs,
.music-dock[data-presentation="expanded"] .lyrics-track-wrapper,
.music-dock[data-presentation="expanded"] .seek-sample,
.music-dock[data-presentation="expanded"] .player-buttons,
.music-dock[data-presentation="expanded"] .volume-sample {
  animation: detail-section-arrive 420ms cubic-bezier(.2,.8,.2,1) both;
}
.music-dock[data-presentation="expanded"] .player-tabs { animation-delay: 35ms; }
.music-dock[data-presentation="expanded"] .lyrics-track-wrapper { animation-delay: 70ms; }
.music-dock[data-presentation="expanded"] .seek-sample { animation-delay: 105ms; }
.music-dock[data-presentation="expanded"] .player-buttons { animation-delay: 140ms; }
.music-dock[data-presentation="expanded"] .volume-sample { animation-delay: 175ms; }
@keyframes dock-control-arrive {
  from { opacity: 0; transform: translateY(-4px) scale(.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes detail-heading-arrive {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes detail-section-arrive {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* A small amount of motion in the two scenes; no duplicated particle swarm. */
.scene-plane-city .cable-flow {
  stroke-width: 2.2px;
  stroke-linecap: round;
  stroke-dasharray: 48 952;
  opacity: .65;
  filter: drop-shadow(0 0 2.5px currentColor);
}
.scene-plane-moon .moon-orbit {
  opacity: .52;
}

@media (max-width: 700px) {
  .music-dock[data-presentation="expanded"] .dock-summary {
    min-height: 44px;
  }
  .hero-orbit-svg {
    max-width: 390px;
  }
}

/* Decorative orbit motion follows the same visibility/motion contract as the scene. */
:root[data-motion-paused="true"] .hero-orbit-svg *,
:root.page-hidden .hero-orbit-svg * {
  animation-play-state: paused !important;
}


/* Revision 4.2: open orbital trails are readable at a glance and never form a second moon. */
.hero-orbit-svg {
  opacity: .78;
}
.orbit-route {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 86 18 34 22;
  stroke-dashoffset: 0;
}
.orbit-route-primary {
  stroke: color-mix(in srgb, var(--ice) 70%, var(--accent) 12%);
  stroke-width: 1.35;
  animation: orbit-route-flow 58s linear infinite;
}
.orbit-route-secondary {
  stroke: color-mix(in srgb, var(--accent) 52%, var(--ice) 18%);
  stroke-width: .95;
  stroke-dasharray: 64 20 20 28;
  animation: orbit-route-flow-reverse 72s linear infinite;
}
.orbit-route-tertiary {
  stroke: color-mix(in srgb, var(--ice) 46%, transparent);
  stroke-width: .75;
  stroke-dasharray: 2 14;
  animation: orbit-route-flow 96s linear infinite;
}
.orbit-route-faint {
  stroke: color-mix(in srgb, var(--accent) 25%, var(--ice) 22%, transparent);
  stroke-width: .65;
  stroke-dasharray: 1 18;
  animation: orbit-route-flow-reverse 116s linear infinite;
}
@keyframes orbit-route-flow {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -280; }
}
@keyframes orbit-route-flow-reverse {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 240; }
}
:root[data-motion-paused="true"] .orbit-route,
:root.page-hidden .orbit-route,
:root[data-motion="off"] .orbit-route {
  animation-play-state: paused !important;
}

/* A small, staged lift for the compact dock itself; audio state is untouched. */
.music-dock:not(.expanded) .dock-summary {
  transition: background-color 240ms ease, padding 300ms cubic-bezier(.2,.8,.2,1);
}
.music-dock:not(.expanded):hover .dock-summary,
.music-dock:not(.expanded):focus-within .dock-summary {
  background: color-mix(in srgb, var(--raised) 72%, transparent);
}
.music-dock:not(.expanded) .mini-cover {
  transition: opacity 260ms ease, transform 360ms cubic-bezier(.2,.8,.2,1), box-shadow 260ms ease;
}
.music-dock:not(.expanded):hover .mini-cover,
.music-dock:not(.expanded):focus-within .mini-cover {
  transform: translateY(-1px) scale(1.035);
  box-shadow: 0 7px 18px #0006, 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent);
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion-preference="on"]) .orbit-route,
  :root:not([data-motion-preference="on"]) .music-dock .mini-cover,
  :root:not([data-motion-preference="on"]) .music-dock .dock-summary {
    animation: none !important;
    transition: none !important;
  }
}

/* === Revision 4.3: the moon scene owns one moon; orbit trails share its coordinates === */
.scene-plane-orbits {
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 900ms ease;
}
:root[data-theme="moon"] .scene-plane-orbits {
  opacity: 1;
}
:root[data-theme="city"] .scene-plane-orbits {
  opacity: 0;
}
.scene-plane-orbits svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.scene-plane-orbits .scene-orbit {
  fill: none;
  stroke: color-mix(in srgb, var(--ice) 58%, var(--accent) 18%);
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 18 42 52 24;
  opacity: .54;
  vector-effect: non-scaling-stroke;
}
.scene-plane-orbits .scene-orbit-a {
  stroke: color-mix(in srgb, var(--ice) 72%, white 8%);
  stroke-width: 1.7;
  animation: scene-orbit-drift 58s linear infinite;
}
.scene-plane-orbits .scene-orbit-b {
  stroke: color-mix(in srgb, var(--accent) 48%, var(--ice) 24%);
  opacity: .42;
  stroke-dasharray: 54 34 22 48;
  animation: scene-orbit-drift-reverse 76s linear infinite;
}
.scene-plane-orbits .scene-orbit-c {
  opacity: .3;
  stroke-width: 1;
  stroke-dasharray: 2 28;
  animation: scene-orbit-drift 94s linear infinite;
}
.scene-plane-orbits .scene-orbit-d {
  opacity: .25;
  stroke-width: .9;
  stroke-dasharray: 1 34;
  animation: scene-orbit-drift-reverse 112s linear infinite;
}
.scene-plane-orbits .scene-orbit-e {
  stroke: #b8d9ef;
  stroke-width: 1.45;
  stroke-dasharray: 12 23 42 37;
  opacity: .58;
  animation: scene-orbit-drift 38s linear infinite;
  animation-delay: -11s;
}
.scene-plane-orbits .scene-orbit-f {
  stroke: #d2c49f;
  stroke-width: 1.25;
  stroke-dasharray: 2 16 22 32;
  opacity: .5;
  animation: scene-orbit-drift-reverse 47s linear infinite;
  animation-delay: -19s;
}
.scene-plane-orbits .scene-orbit-node {
  fill: var(--accent);
  opacity: .68;
  filter: drop-shadow(0 0 5px currentColor);
  animation: scene-orbit-node-breathe 4.8s ease-in-out infinite;
}
.scene-plane-orbits .scene-orbit-node-b { animation-delay: -1.7s; }
.scene-plane-orbits .scene-orbit-node-c { animation-delay: -3.1s; fill: var(--ice); }
@keyframes scene-orbit-drift {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -260; }
}
@keyframes scene-orbit-drift-reverse {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 220; }
}
@keyframes scene-orbit-node-breathe {
  0%, 100% { opacity: .34; transform: scale(.86); }
  50% { opacity: .9; transform: scale(1.12); }
}
:root[data-motion="on"][data-motion-paused="false"][data-theme="moon"] .scene-plane-orbits .env-anim,
:root[data-motion="on"][data-motion-paused="false"][data-theme="moon"] .scene-plane-orbits .scene-orbit,
:root[data-motion="on"][data-motion-paused="false"][data-theme="moon"] .scene-plane-orbits .scene-orbit-node {
  animation-play-state: running !important;
}
:root[data-theme="city"] .scene-plane-orbits *,
:root[data-motion="off"] .scene-plane-orbits *,
:root[data-motion-paused="true"] .scene-plane-orbits *,
:root.page-hidden .scene-plane-orbits * {
  animation-play-state: paused !important;
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion-preference="on"]) .scene-plane-orbits * {
    animation: none !important;
  }
}


/* Final motion contract for scene-aligned tracks: auto/reduce and off are truly static. */
:root[data-motion="off"] .scene-plane-orbits .scene-orbit,
:root[data-motion="off"] .scene-plane-orbits .scene-orbit-node,
:root[data-motion-paused="true"] .scene-plane-orbits .scene-orbit,
:root[data-motion-paused="true"] .scene-plane-orbits .scene-orbit-node,
:root.page-hidden .scene-plane-orbits .scene-orbit,
:root.page-hidden .scene-plane-orbits .scene-orbit-node {
  animation-name: none !important;
  animation-duration: 0s !important;
  animation-play-state: paused !important;
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion-preference="on"]) .scene-plane-orbits .scene-orbit,
  :root:not([data-motion-preference="on"]) .scene-plane-orbits .scene-orbit-node {
    animation-name: none !important;
    animation-duration: 0s !important;
    animation-play-state: paused !important;
  }
}


/* === Revision 5: latest user feedback === */
/* Logo takes the former motion-toggle position; the page no longer has a motion switch. */
.site-header .header-right { align-items: center; }
.header-motion-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 4px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  filter: none;
  box-shadow: none;
  transition: transform 240ms ease;
}
.header-motion-logo:hover, .header-motion-logo:focus-visible {
  opacity: 1;
  filter: none;
  transform: translateY(-1px);
  box-shadow: none;
}
.header-motion-logo .site-header-logo-img {
  height: 48px;
  max-width: 224px;
  /* Alpha-shaped edge light only: no rectangle or altered source artwork. */
  filter: drop-shadow(.45px 0 0 #e2e7ee99) drop-shadow(-.45px 0 0 #e2e7ee66) drop-shadow(0 0 4px #ccdcf026);
}

/* The expanded player starts directly with the note and its collapse button. */
.music-dock[data-presentation="expanded"] .dock-summary { display: none !important; }
.music-dock.is-collapsing .track-heading { visibility: hidden; }
.music-dock .player-content { overflow-x: hidden; scrollbar-width: none; }
.music-dock .player-content::-webkit-scrollbar { display: none; }
.player-note-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding-block: 5px;
  margin: 0 0 8px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
}
.player-note-row .player-note { flex: 1 1 auto; min-width: 0; margin: 0 !important; }
#dock-toggle-detail-slot { display: inline-flex; flex: 0 0 auto; margin-left: auto; }
#dock-toggle-detail-slot #dock-toggle {
  width: 40px;
  min-height: 40px;
  border: 1px solid var(--control-edge);
  background: var(--raised);
  border-radius: 50%;
}

/* A quiet field of independent twinkles, not whole constellations being dragged around. */
.scene-plane-moon .moon-stars { animation: none; opacity: 1; }
.scene-plane-moon .moon-stars > * {
  transform-box: fill-box;
  transform-origin: center;
  animation: sky-twinkle var(--star-time, 7.7s) ease-in-out var(--star-phase, -2s) infinite;
  animation-play-state: paused;
}
.stars-a > :nth-child(1) { --star-time: 7.7s; --star-phase: -2.4s; }
.stars-a > :nth-child(2) { --star-time: 10.9s; --star-phase: -8.8s; }
.stars-a > :nth-child(3) { --star-time: 8.3s; --star-phase: -5.2s; }
.stars-a > :nth-child(4) { --star-time: 12.1s; --star-phase: -10.7s; }
.stars-a > :nth-child(5) { --star-time: 9.6s; --star-phase: -6.1s; }
.stars-b > :nth-child(1) { --star-time: 11.3s; --star-phase: -9.2s; }
.stars-b > :nth-child(2) { --star-time: 6.8s; --star-phase: -4.3s; }
.stars-b > :nth-child(3) { --star-time: 13.1s; --star-phase: -7.5s; }
.stars-b > :nth-child(4) { --star-time: 8.9s; --star-phase: -7.6s; }
.stars-b > :nth-child(5) { --star-time: 10.4s; --star-phase: -2.9s; }
.stars-c > :nth-child(1) { --star-time: 9.1s; --star-phase: -3.2s; }
.stars-c > :nth-child(2) { --star-time: 12.2s; --star-phase: -9.4s; }
.stars-c > :nth-child(3) { --star-time: 7.2s; --star-phase: -6.8s; }
@keyframes sky-twinkle {
  0%, 100% { opacity: .23; transform: scale(.84); }
  19% { opacity: .58; transform: scale(1.02); }
  48% { opacity: .32; transform: scale(.91); }
  73% { opacity: .9; transform: scale(1.13); }
}
:root[data-theme="moon"][data-motion-paused="false"] .scene-plane-moon .moon-stars > * {
  animation-play-state: running;
}
:root[data-motion-paused="true"] .scene-plane-moon .moon-stars > *,
:root.page-hidden .scene-plane-moon .moon-stars > * { animation-play-state: paused !important; }
.scene-traveller { opacity: 0; transform-origin: 0 0; pointer-events: none; }

/* These three stars remain still. Only the surrounding draw ritual has motion. */
.fortune-sparkles, .fortune-sparkles span,
:root[data-motion="on"] .fortune-sparkles,
:root[data-motion="on"] .fortune-sparkles span {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

/* Per-art captions are names only; provenance stays in the manifest and source document. */
.gallery .piece figcaption { justify-content: flex-start; }
.lightbox-caption { justify-content: flex-end; }

@media (max-width: 700px) {
  .site-header, :root[data-music-open="true"] .site-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    gap: 10px 12px !important;
    padding-block: 18px 14px !important;
  }
  .site-header .brand { grid-column: 1; grid-row: 1; margin: 0; }
  .site-header .header-right { display: contents !important; }
  .header-motion-logo { grid-column: 2; grid-row: 1; padding: 4px; justify-self: end; }
  .header-motion-logo .site-header-logo-img { height: 34px; max-width: 146px; }
  .site-header .theme { grid-column: 1; grid-row: 2; width: max-content; }
  .site-header .links {
    grid-column: 2;
    grid-row: 2;
    position: static !important;
    width: auto;
    gap: 12px;
    font-size: 11px;
    justify-content: flex-end;
    align-items: center;
  }
  .site-header .links a { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; }
  .site-header .theme button { padding-inline: 8px; font-size: 11px; gap: 4px; }
}


/* Match the original wrap breakpoints, including the ID-specific legacy expanded rule. */
@media (max-width: 1100px) {
  :root[data-music-open="true"] #main.wrap,
  :root[data-music-open="true"] #view-music.wrap,
  :root[data-music-open="true"] .site-header.wrap {
    width: calc(100% - 64px) !important;
  }
}
@media (max-width: 700px) {
  :root[data-music-open="true"] #main.wrap,
  :root[data-music-open="true"] #view-music.wrap,
  :root[data-music-open="true"] .site-header.wrap {
    width: calc(100% - 40px) !important;
  }
}
