/* Созвездие ладони — ладонь из звёзд: контур рисуется, загораются звёзды-узлы,
   по линиям пролетает свет и появляются подписи. Цикл 16 секунд; касание кнопки — ручной выбор линии. */
.sky-scene {
  --cycle: 16s;
  --cycle-delay: 2.6s;
  --cap: 112px;
  position: relative;
  z-index: 1;
  margin: 0;
  width: 100%;
  height: clamp(620px, calc(100svh - 190px), 800px);
  isolation: isolate;
  overflow: hidden;
  container-type: size;
}
.sky-scene [aria-hidden="true"] { pointer-events: none; }

/* Sky */
.sky-field { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.sky-glow { position: absolute; left: 50%; top: 44%; width: 90%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(110, 130, 255, .32), rgba(120, 90, 220, .12) 42%, transparent 66%); animation: glow-breathe 9s ease-in-out infinite; }
.orbit { position: absolute; left: 50%; top: 44%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); }
.orbit-1 { width: 90%; width: min(98cqw, 84cqh); border: 1px dashed rgba(190, 200, 255, .2); animation: orbit-turn 160s linear infinite; }
.orbit-2 { width: 72%; width: min(80cqw, 68cqh); border: 1px solid rgba(190, 200, 255, .12); animation: orbit-turn 34s linear infinite; }
.orbit-3 { width: 52%; width: min(58cqw, 50cqh); border: 1px dotted rgba(255, 207, 138, .22); animation: orbit-turn 90s linear infinite reverse; }
.orbit-star { position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #fff4dc; box-shadow: 0 0 16px 4px rgba(255, 210, 140, .75); }
.twinkles { position: absolute; inset: 0; }
.twinkles i { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); border-radius: 50%; background: #fff; box-shadow: 0 0 8px 1px rgba(200, 210, 255, .7); animation: twinkle var(--d) ease-in-out var(--delay) infinite alternate; }
.shooting { position: absolute; top: 12%; left: 70%; width: 150px; height: 1.6px; border-radius: 2px; background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff); transform: rotate(152deg); transform-origin: right center; opacity: 0; animation: shoot 11s ease-in 3s infinite; }
.shooting-2 { top: 30%; left: 30%; width: 110px; animation-duration: 15s; animation-delay: 8s; }
@keyframes glow-breathe { 0%, 100% { transform: translate(-50%, -50%) scale(.94); opacity: .8; } 50% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; } }
@keyframes orbit-turn { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes twinkle { from { opacity: .12; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@keyframes shoot { 0%, 88% { opacity: 0; translate: 0 0; } 89% { opacity: 1; } 96% { opacity: 0; translate: -260px 140px; } 100% { opacity: 0; translate: -260px 140px; } }

/* Hand */
.hand-drift { position: absolute; inset: 0 0 var(--cap); z-index: 3; animation: drift 12s ease-in-out 3s infinite; }
.constellation-hand { position: absolute; top: 2.5%; left: 50%; height: 96%; aspect-ratio: 600 / 800; width: auto; transform: translateX(-50%); overflow: visible; }
@keyframes drift { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -10px, 0); } }

.hand-fill { fill: url(#sky-fill); stroke: none; }
.intro .hand-fill { animation: fade-in 1.6s ease 1.4s both; }
.hand-outline, .hand-outline-glow { fill: none; stroke-dasharray: 100; stroke-dashoffset: 0; stroke-linecap: round; stroke-linejoin: round; }
.intro .hand-outline, .intro .hand-outline-glow { stroke-dashoffset: 100; animation: outline-draw 2.6s cubic-bezier(.5, 0, .3, 1) .3s both; }
.hand-outline { stroke: #e3e8ff; stroke-width: 2.2; }
.hand-outline-glow { stroke: #9fb0ff; stroke-width: 9; opacity: .55; }
.mesh { fill: none; stroke: rgba(170, 185, 255, .4); stroke-width: 1.1; stroke-dasharray: 100; stroke-dashoffset: 0; }
.intro .mesh { stroke-dashoffset: 100; animation: outline-draw 2.2s ease-in-out 1.3s both; }
.node { fill: #fff; transform-box: fill-box; transform-origin: center; filter: drop-shadow(0 0 5px rgba(210, 220, 255, .95)); animation: node-twinkle 3.6s ease-in-out calc(var(--i) * -.41s) infinite; }
.intro .node { animation: node-in .7s cubic-bezier(.3, 1.6, .5, 1) calc(1.1s + var(--i) * 70ms) both, node-twinkle 3.6s ease-in-out calc(var(--i) * -.41s) infinite; }
.node-tip { fill: #fff8e8; filter: drop-shadow(0 0 7px rgba(255, 220, 160, .95)); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes outline-draw { to { stroke-dashoffset: 0; } }
@keyframes node-in { from { scale: 0; } to { scale: 1; } }
@keyframes node-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* Palm lines */
.sl { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.sky-lines .sl { stroke: #ffdca2; stroke-width: 3.4; }
.sky-lines-glow .sl { stroke: #ffb45e; stroke-width: 12; }
.sky-lines-glow { opacity: .75; }
.sl-1 { animation: sl-1 var(--cycle) var(--cycle-delay) infinite both; }
.sl-2 { animation: sl-2 var(--cycle) var(--cycle-delay) infinite both; }
.sl-3 { animation: sl-3 var(--cycle) var(--cycle-delay) infinite both; }
.sl-4 { animation: sl-4 var(--cycle) var(--cycle-delay) infinite both; }
@keyframes sl-1 { 0%, 13% { stroke-dashoffset: 100; opacity: 1; } 20% { stroke-dashoffset: 0; opacity: 1; } 30% { opacity: 1; } 34%, 84% { stroke-dashoffset: 0; opacity: .28; } 87%, 93% { stroke-dashoffset: 0; opacity: 1; } 98%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sl-2 { 0%, 31% { stroke-dashoffset: 100; opacity: 1; } 38% { stroke-dashoffset: 0; opacity: 1; } 48% { opacity: 1; } 52%, 84% { stroke-dashoffset: 0; opacity: .28; } 87%, 93% { stroke-dashoffset: 0; opacity: 1; } 98%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sl-3 { 0%, 49% { stroke-dashoffset: 100; opacity: 1; } 56% { stroke-dashoffset: 0; opacity: 1; } 66% { opacity: 1; } 70%, 84% { stroke-dashoffset: 0; opacity: .28; } 87%, 93% { stroke-dashoffset: 0; opacity: 1; } 98%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sl-4 { 0%, 67% { stroke-dashoffset: 100; opacity: 1; } 74% { stroke-dashoffset: 0; opacity: 1; } 93% { stroke-dashoffset: 0; opacity: 1; } 98%, 100% { stroke-dashoffset: 0; opacity: 0; } }

/* Labels along the lines */
.tl { fill: #f6f2ff; font: 800 19px var(--sans); letter-spacing: 6px; opacity: 0; paint-order: stroke; stroke: rgba(8, 18, 39, .85); stroke-width: 5px; stroke-linejoin: round; }
.tl-1 { animation: tl-1 var(--cycle) var(--cycle-delay) infinite both; }
.tl-2 { animation: tl-2 var(--cycle) var(--cycle-delay) infinite both; }
.tl-3 { animation: tl-3 var(--cycle) var(--cycle-delay) infinite both; }
.tl-4 { animation: tl-4 var(--cycle) var(--cycle-delay) infinite both; }
@keyframes tl-1 { 0%, 17% { opacity: 0; } 19.5%, 30% { opacity: 1; } 32.5%, 100% { opacity: 0; } }
@keyframes tl-2 { 0%, 35% { opacity: 0; } 37.5%, 48% { opacity: 1; } 50.5%, 100% { opacity: 0; } }
@keyframes tl-3 { 0%, 53% { opacity: 0; } 55.5%, 66% { opacity: 1; } 68.5%, 100% { opacity: 0; } }
@keyframes tl-4 { 0%, 71% { opacity: 0; } 73.5%, 85% { opacity: 1; } 87.5%, 100% { opacity: 0; } }

/* Comets */
.comet { opacity: 0; }
.comet-core { fill: #fff; }
.comet-halo { fill: #ffcf8a; opacity: .55; filter: url(#sky-glow); }
.comet-outline .comet-halo { fill: #b8c4ff; }

/* Caption with line choices */
.sky-caption { position: absolute; z-index: 7; left: 12px; right: 12px; bottom: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.line-choices { display: none; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: rgba(10, 20, 46, .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.scene-js .line-choices { display: flex; }
.lc { min-height: 44px; padding: 10px 18px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 700 13.5px/1.2 var(--sans); cursor: pointer; transition: background .25s, color .25s; }
.lc:hover { color: #fff; }
.lc[aria-pressed="true"] { background: var(--silver); color: var(--sky); }
.lc-1 { animation: lc-1 var(--cycle) var(--cycle-delay) infinite both; }
.lc-2 { animation: lc-2 var(--cycle) var(--cycle-delay) infinite both; }
.lc-3 { animation: lc-3 var(--cycle) var(--cycle-delay) infinite both; }
.lc-4 { animation: lc-4 var(--cycle) var(--cycle-delay) infinite both; }
@keyframes lc-1 { 0%, 12.5% { background: transparent; color: var(--muted); } 14%, 31% { background: #ffe0ad; color: #0b1530; } 33%, 100% { background: transparent; color: var(--muted); } }
@keyframes lc-2 { 0%, 30.5% { background: transparent; color: var(--muted); } 32%, 49% { background: #ffe0ad; color: #0b1530; } 51%, 100% { background: transparent; color: var(--muted); } }
@keyframes lc-3 { 0%, 48.5% { background: transparent; color: var(--muted); } 50%, 67% { background: #ffe0ad; color: #0b1530; } 69%, 100% { background: transparent; color: var(--muted); } }
@keyframes lc-4 { 0%, 66.5% { background: transparent; color: var(--muted); } 68%, 85% { background: #ffe0ad; color: #0b1530; } 87%, 100% { background: transparent; color: var(--muted); } }
.line-caption { position: relative; width: 100%; min-height: 22px; text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.cap { position: absolute; left: 0; right: 0; top: 0; opacity: 0; }
.cap-1 { animation: cap-1 var(--cycle) var(--cycle-delay) infinite both; }
.cap-2 { animation: cap-2 var(--cycle) var(--cycle-delay) infinite both; }
.cap-3 { animation: cap-3 var(--cycle) var(--cycle-delay) infinite both; }
.cap-4 { animation: cap-4 var(--cycle) var(--cycle-delay) infinite both; }
@keyframes cap-1 { 0%, 13% { opacity: 0; } 15%, 30% { opacity: 1; } 32%, 100% { opacity: 0; } }
@keyframes cap-2 { 0%, 31% { opacity: 0; } 33%, 48% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes cap-3 { 0%, 49% { opacity: 0; } 51%, 66% { opacity: 1; } 68%, 100% { opacity: 0; } }
@keyframes cap-4 { 0%, 67% { opacity: 0; } 69%, 94% { opacity: 1; } 96%, 100% { opacity: 0; } }

/* Manual choice */
.is-manual .sl, .is-manual .tl, .is-manual .lc, .is-manual .cap { animation: none; }
.is-manual .comet { display: none; }
.is-manual .sl { stroke-dashoffset: 0; opacity: .22; }
.is-manual .tl { opacity: 0; }
.is-manual[data-active="0"] .sl-1, .is-manual[data-active="1"] .sl-2, .is-manual[data-active="2"] .sl-3, .is-manual[data-active="3"] .sl-4 { opacity: 1; animation: sl-once 1.3s var(--ease) both; }
.is-manual[data-active="0"] .tl-1, .is-manual[data-active="1"] .tl-2, .is-manual[data-active="2"] .tl-3, .is-manual[data-active="3"] .tl-4 { opacity: 1; animation: fade-in .6s ease .7s both; }
.is-manual[data-active="0"] .cap-1, .is-manual[data-active="1"] .cap-2, .is-manual[data-active="2"] .cap-3, .is-manual[data-active="3"] .cap-4 { opacity: 1; }
@keyframes sl-once { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }

/* Pause button */
.motion-toggle { position: absolute; z-index: 8; top: 14px; right: 14px; display: none; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-2); border-radius: 50%; background: rgba(10, 20, 46, .65); color: var(--silver); cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .2s, color .2s; }
.scene-js .motion-toggle { display: grid; }
.motion-toggle[hidden] { display: none !important; }
.motion-toggle:hover { background: var(--silver); color: var(--sky); }
.motion-toggle svg { width: 18px; height: 18px; stroke-width: 2.2; }
.motion-toggle .i-play { display: none; fill: currentColor; stroke-width: 1.5; }
.motion-toggle[aria-pressed="true"] .i-pause { display: none; }
.motion-toggle[aria-pressed="true"] .i-play { display: block; }

.motion-paused *, .motion-paused *::before, .motion-paused *::after { animation-play-state: paused !important; }

@media (max-width: 920px) {
  .sky-scene { height: clamp(600px, 86vw, 720px); max-width: 680px; margin-inline: auto; }
}
@media (max-width: 720px) {
  .sky-scene { width: 100vw; max-width: none; height: clamp(540px, 150vw, 660px); margin: 0 calc(50% - 50vw); }
  .sky-lines .sl { stroke-width: 4.6; }
  .sky-lines-glow .sl { stroke-width: 15; }
  .hand-outline { stroke-width: 2.8; }
  .tl { font-size: 25px; letter-spacing: 5px; stroke-width: 6px; }
  .lc { padding: 10px 13px; font-size: 13px; }
  .line-caption { font-size: 12.5px; }
  .motion-toggle { top: 10px; right: 12px; }
}
@media (max-width: 380px) {
  .sky-scene { --cap: 104px; }
  .lc { padding: 10px 10px; font-size: 12.5px; }
  .line-choices { gap: 2px; padding: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .sky-scene, .sky-scene *, .sky-scene *::before, .sky-scene *::after { animation: none !important; transition: none !important; }
  .motion-toggle { display: none !important; }
  .comet, .shooting { display: none; }
  .hand-outline, .hand-outline-glow, .mesh, .intro .hand-outline, .intro .hand-outline-glow, .intro .mesh { stroke-dashoffset: 0; }
  .sl { stroke-dashoffset: 0; opacity: .25; }
  .sl-1, .tl-1, .cap-1 { opacity: 1; }
  .sky-scene:not(.is-manual) .lc-1 { background: #ffe0ad; color: #0b1530; }
  .twinkles i { opacity: .6; }
  .is-manual .sl { opacity: .25; }
  .is-manual .tl-1, .is-manual .cap-1 { opacity: 0; }
  .is-manual[data-active="0"] .sl-1, .is-manual[data-active="1"] .sl-2, .is-manual[data-active="2"] .sl-3, .is-manual[data-active="3"] .sl-4 { opacity: 1; }
  .is-manual[data-active="0"] :is(.tl-1, .cap-1), .is-manual[data-active="1"] :is(.tl-2, .cap-2), .is-manual[data-active="2"] :is(.tl-3, .cap-3), .is-manual[data-active="3"] :is(.tl-4, .cap-4) { opacity: 1; }
}
