/* Ладони — сцена: звёздный круг, парящая ладонь, сканирование и прорисовка четырёх линий.
   Один цикл чтения длится 18 секунд: скан → сердце → ум → жизнь → судьба → все линии вместе. */
.scene {
  --cycle: 18s;
  --cycle-delay: 1s;
  position: relative;
  z-index: 1;
  margin: 0;
  width: 100%;
  height: clamp(560px, calc(100svh - 150px), 790px);
  isolation: isolate;
  overflow: hidden;
  container-type: size;
}
.intro .scene { animation: scene-in 1.4s var(--ease) both; }
.scene [aria-hidden="true"] { pointer-events: none; }
.scene::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 22%; z-index: 6; background: linear-gradient(180deg, rgba(21, 12, 36, 0), var(--bg) 82%); pointer-events: none; }
@keyframes scene-in { from { opacity: 0; } }

/* Background field */
.scene-field { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.aura { position: absolute; left: 50%; top: 46%; width: 92%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(158, 98, 214, .5) 0%, rgba(110, 60, 170, .22) 38%, transparent 66%); animation: aura 10s ease-in-out infinite; }
.ring { position: absolute; left: 50%; top: 47%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); }
.ring-outer { width: 88%; width: min(94cqw, 86cqh); color: #e7c27a; opacity: .85; animation: ring-turn 150s linear infinite; }
.ring-outer svg { width: 100%; height: 100%; overflow: visible; }
.ring-line { fill: none; stroke: currentColor; stroke-width: .9; opacity: .55; }
.ring-line.faint { opacity: .22; stroke-dasharray: 2 7; }
.ring-ticks { fill: none; stroke: currentColor; stroke-width: 1.1; opacity: .7; }
.ring-stars { fill: #f6dc9d; stroke: none; filter: drop-shadow(0 0 6px rgba(255, 214, 130, .9)); }
.ring-inner { width: 70%; width: min(75cqw, 68cqh); border: 1px dashed rgba(231, 194, 122, .28); animation: ring-turn 95s linear infinite reverse; }
.orbit { position: absolute; left: 50%; top: 47%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); }
.orbit-a { width: 70%; width: min(75cqw, 68cqh); animation: ring-turn 28s linear infinite; }
.orbit-b { width: 88%; width: min(94cqw, 86cqh); animation: ring-turn 46s linear infinite reverse; }
.planet { position: absolute; left: 50%; top: -6px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6da, #f0c46e 55%, #b47a2c); box-shadow: 0 0 16px 3px rgba(255, 205, 110, .65); }
.moonlet { position: absolute; left: 50%; bottom: -9px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; box-shadow: inset -5px -2px 0 0 #f4d896; filter: drop-shadow(0 0 6px rgba(255, 220, 150, .8)); }
.stars { position: absolute; inset: 0; }
.stars i { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); border-radius: 50%; background: #fbe6bb; box-shadow: 0 0 10px 2px rgba(240, 200, 120, .4); opacity: .2; animation: twinkle var(--d) ease-in-out var(--delay) infinite alternate; }
@keyframes twinkle { 0% { opacity: .12; transform: translate3d(0, 6px, 0) scale(.6); } 100% { opacity: .95; transform: translate3d(6px, -14px, 0) scale(1); } }
@keyframes aura { 0%, 100% { transform: translate(-50%, -50%) scale(.94); opacity: .85; } 50% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; } }
@keyframes ring-turn { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Hand */
.hand-float { position: absolute; inset: 0; z-index: 3; animation: hand-float 10s ease-in-out infinite; }
.intro .hand-float { animation: hand-in 1.5s var(--ease) .1s both, hand-float 10s ease-in-out 1.6s infinite; }
.hand-tilt { position: absolute; inset: 0; transition: transform .6s var(--ease); will-change: transform; }
.hand { position: absolute; top: 2.5%; left: 50%; height: 113%; aspect-ratio: 1122 / 1402; transform: translateX(-50%); }
.hand-img { width: 100%; height: 100%; object-fit: contain; -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 90%); mask-image: linear-gradient(180deg, #000 72%, transparent 90%); filter: drop-shadow(0 0 28px rgba(190, 140, 255, .18)); }
.palm-overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
@keyframes hand-in { from { opacity: 0; transform: translateY(46px) scale(.96); } }
@keyframes hand-float { 0%, 100% { transform: translate3d(0, 0, 0) rotate(-.6deg); } 50% { transform: translate3d(0, -12px, 0) rotate(.6deg); } }

/* Viewfinder and scan */
.finder { fill: none; stroke: #f6d78f; stroke-width: 4; stroke-linecap: round; transform-origin: 557px 617px; opacity: 0; animation: finder var(--cycle) var(--cycle-delay) infinite both; filter: drop-shadow(0 0 6px rgba(255, 210, 120, .8)); }
.scan-beam { opacity: 0; animation: scan var(--cycle) var(--cycle-delay) infinite both; }
@keyframes finder {
  0% { opacity: 0; transform: scale(1.14); }
  4%, 90% { opacity: .95; transform: scale(1); }
  96%, 100% { opacity: 0; transform: scale(1); }
}
@keyframes scan {
  0% { opacity: 0; transform: translateY(0); animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  1.5% { opacity: 1; }
  12% { opacity: 1; transform: translateY(560px); }
  13.5%, 100% { opacity: 0; transform: translateY(560px); }
}

/* Palm lines */
.pl { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.lines .pl { stroke: #ffe4a6; stroke-width: 5; }
.lines-glow .pl { stroke: #ffc75e; stroke-width: 16; }
.lines-glow { opacity: .85; }
.pl-1 { animation: pl-1 var(--cycle) var(--cycle-delay) infinite both; }
.pl-2 { animation: pl-2 var(--cycle) var(--cycle-delay) infinite both; }
.pl-3 { animation: pl-3 var(--cycle) var(--cycle-delay) infinite both; }
.pl-4 { animation: pl-4 var(--cycle) var(--cycle-delay) infinite both; }
@keyframes pl-1 { 0%, 13% { stroke-dashoffset: 100; opacity: 1; } 20% { stroke-dashoffset: 0; opacity: 1; } 30% { opacity: 1; } 34%, 84% { stroke-dashoffset: 0; opacity: .3; } 87%, 93% { stroke-dashoffset: 0; opacity: 1; } 98%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes pl-2 { 0%, 31% { stroke-dashoffset: 100; opacity: 1; } 38% { stroke-dashoffset: 0; opacity: 1; } 48% { opacity: 1; } 52%, 84% { stroke-dashoffset: 0; opacity: .3; } 87%, 93% { stroke-dashoffset: 0; opacity: 1; } 98%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes pl-3 { 0%, 49% { stroke-dashoffset: 100; opacity: 1; } 56% { stroke-dashoffset: 0; opacity: 1; } 66% { opacity: 1; } 70%, 84% { stroke-dashoffset: 0; opacity: .3; } 87%, 93% { stroke-dashoffset: 0; opacity: 1; } 98%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes pl-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; } }

/* Leaders and chips */
.ld { --from: 0px; opacity: 0; }
.ld path { stroke: #f6d78f; stroke-width: 2.5; stroke-dasharray: 3 7; fill: none; }
.ld circle { fill: #fff2cf; stroke: none; filter: drop-shadow(0 0 6px #ffd27a); }
.ld-1, .chip-1 { animation: show-1 var(--cycle) var(--cycle-delay) infinite both; }
.ld-2, .chip-2 { animation: show-2 var(--cycle) var(--cycle-delay) infinite both; }
.ld-3, .chip-3 { animation: show-3 var(--cycle) var(--cycle-delay) infinite both; }
.ld-4, .chip-4 { animation: show-4 var(--cycle) var(--cycle-delay) infinite both; }
@keyframes show-1 { 0%, 17% { opacity: 0; translate: var(--from) 0; } 19.5%, 30% { opacity: 1; translate: 0 0; } 32.5%, 86% { opacity: 0; translate: 0 0; } 88%, 94% { opacity: 1; translate: 0 0; } 97%, 100% { opacity: 0; translate: 0 0; } }
@keyframes show-2 { 0%, 35% { opacity: 0; translate: var(--from) 0; } 37.5%, 48% { opacity: 1; translate: 0 0; } 50.5%, 86% { opacity: 0; translate: 0 0; } 88%, 94% { opacity: 1; translate: 0 0; } 97%, 100% { opacity: 0; translate: 0 0; } }
@keyframes show-3 { 0%, 53% { opacity: 0; translate: var(--from) 0; } 55.5%, 66% { opacity: 1; translate: 0 0; } 68.5%, 86% { opacity: 0; translate: 0 0; } 88%, 94% { opacity: 1; translate: 0 0; } 97%, 100% { opacity: 0; translate: 0 0; } }
@keyframes show-4 { 0%, 71% { opacity: 0; translate: var(--from) 0; } 73.5%, 94% { opacity: 1; translate: 0 0; } 97%, 100% { opacity: 0; translate: 0 0; } }

.chip { --from: 14px; position: absolute; z-index: 4; display: flex; flex-direction: column; gap: 3px; padding: 9px 14px 10px; border: 1px solid rgba(246, 215, 143, .55); border-radius: 14px; background: rgba(24, 13, 40, .78); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .6), 0 0 22px rgba(236, 190, 100, .18); white-space: nowrap; opacity: 0; transform: translateY(-50%); }
.chip b { font: italic 400 23px/1 var(--serif); color: var(--gold-2); }
.chip small { font: 700 10.5px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.chip-left { text-align: right; align-items: flex-end; }
.chip-right { --from: -14px; }
.chip-1 { right: 69%; top: 34.1%; }
.chip-2 { right: 65%; top: 45.6%; }
.chip-3 { left: 63.6%; top: 52.1%; }
.chip-4 { right: 60.6%; top: 57%; }

/* Fingertip sparkles */
.tip { fill: #fff3cf; transform-box: fill-box; transform-origin: center; opacity: 0; filter: drop-shadow(0 0 8px #ffd27a); animation: tip 6.5s ease-in-out var(--t) infinite; }
@keyframes tip { 0%, 70%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); } 80% { opacity: 1; transform: scale(1) rotate(45deg); } 90% { opacity: 0; transform: scale(.5) rotate(90deg); } }

/* Legend */
.legend { position: absolute; z-index: 8; left: 50%; bottom: 14px; display: flex; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: rgba(18, 10, 32, .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transform: translateX(-50%); white-space: nowrap; }
.lg { padding: 7px 13px; border-radius: 999px; color: var(--dim); font: 700 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.lg-1 { animation: lg-1 var(--cycle) var(--cycle-delay) infinite both; }
.lg-2 { animation: lg-2 var(--cycle) var(--cycle-delay) infinite both; }
.lg-3 { animation: lg-3 var(--cycle) var(--cycle-delay) infinite both; }
.lg-4 { animation: lg-4 var(--cycle) var(--cycle-delay) infinite both; }
@keyframes lg-1 { 0%, 12.5% { color: var(--dim); background: transparent; } 14%, 31% { color: var(--ink); background: var(--gold); } 33%, 85.5% { color: var(--dim); background: transparent; } 87%, 94% { color: var(--ink); background: var(--gold); } 96%, 100% { color: var(--dim); background: transparent; } }
@keyframes lg-2 { 0%, 30.5% { color: var(--dim); background: transparent; } 32%, 49% { color: var(--ink); background: var(--gold); } 51%, 85.5% { color: var(--dim); background: transparent; } 87%, 94% { color: var(--ink); background: var(--gold); } 96%, 100% { color: var(--dim); background: transparent; } }
@keyframes lg-3 { 0%, 48.5% { color: var(--dim); background: transparent; } 50%, 67% { color: var(--ink); background: var(--gold); } 69%, 85.5% { color: var(--dim); background: transparent; } 87%, 94% { color: var(--ink); background: var(--gold); } 96%, 100% { color: var(--dim); background: transparent; } }
@keyframes lg-4 { 0%, 66.5% { color: var(--dim); background: transparent; } 68%, 94% { color: var(--ink); background: var(--gold); } 96%, 100% { color: var(--dim); background: transparent; } }

/* Pause button */
.motion-toggle { position: absolute; z-index: 9; 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(21, 12, 36, .6); color: var(--gold-2); cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .2s, border-color .2s; }
.scene-js .motion-toggle { display: grid; }
.motion-toggle[hidden] { display: none !important; }
.motion-toggle:hover { background: rgba(236, 201, 127, .14); border-color: var(--gold); }
.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; }
.motion-paused .hand-tilt { transition: none; }

@media (max-width: 1100px) {
  .chip b { font-size: 20px; }
  .chip small { font-size: 10px; }
}
@media (max-width: 920px) {
  .scene { height: clamp(520px, 74vw, 640px); max-width: 680px; margin-inline: auto; }
}
@media (max-width: 720px) {
  .scene { width: 100vw; max-width: none; height: clamp(440px, 132vw, 560px); margin: 6px calc(50% - 50vw) 0; }
  .lines .pl { stroke-width: 7; }
  .lines-glow .pl { stroke-width: 20; }
  .finder { stroke-width: 6; }
  .ld path { stroke-width: 3.5; }
  .ld circle { r: 9px; }
  .chip { padding: 6px 10px 7px; border-radius: 10px; }
  .chip b { font: 700 13px/1.1 var(--sans); font-style: normal; letter-spacing: .02em; }
  .chip small { display: none; }
  .legend { bottom: 10px; gap: 2px; padding: 4px; }
  .lg { padding: 6px 9px; font-size: 10.5px; letter-spacing: .05em; }
  .motion-toggle { top: 8px; right: 8px; }
}
@media (max-width: 359px) {
  .lg { padding: 6px 7px; font-size: 10px; letter-spacing: .02em; }
}

@media (prefers-reduced-motion: reduce) {
  .scene, .scene *, .scene *::before, .scene *::after { animation: none !important; transition: none !important; }
  .motion-toggle { display: none !important; }
  .pl { stroke-dashoffset: 0; opacity: 1; }
  .lines-glow { opacity: .45; }
  .finder { opacity: .9; }
  .scan-beam { opacity: 0; }
  .ld, .chip { opacity: 1; }
  .tip { opacity: 0; }
  .stars i { opacity: .5; }
  .lg { color: var(--gold-2); }
}
