/* RELICT — „Pęknięta Świadomość”, ilustracja wariantu 2. Fazy na .rp-root: rp-hidden → rp-in → rp-idle → rp-out → rp-gone.
   Położenie (right/bottom) liczy relict-parasite.js: kąt między #side-dock a #bottom-panel. */
.rp-root {
    position: fixed;
    right: 80px;
    bottom: 80px;
    z-index: 4500;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    pointer-events: none;
}
.rp-root.rp-gone { display: none; }
.rp-hidden { visibility: hidden; }

.rp-figure { width: 130px; height: 211px; transition: width .4s, height .4s; overflow: visible; flex: none; pointer-events: auto; cursor: grab; touch-action: none; }

/* chwytanie i rzut */
.rp-held .rp-figure { cursor: grabbing; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .55)); }
.rp-held .rp-sw1, .rp-held .rp-sw2, .rp-held .rp-sw3 { animation-duration: 2s; }
.rp-held .rp-bubble, .rp-flying .rp-bubble { opacity: 0; transition-duration: .15s; pointer-events: none; }
.rp-hit-x .rp-figure { animation: rp-squash-x .5s ease-out forwards; }
.rp-hit-y .rp-figure { animation: rp-squash-y .5s ease-out forwards; }
.rp-hit-x .rp-dust, .rp-hit-y .rp-dust { animation: rp-dust .6s ease-out both; }
@keyframes rp-squash-x { 0% { scale: 1 1; opacity: 1; } 30% { scale: .55 1.25; opacity: 1; } 100% { scale: .4 1.3; opacity: 0; } }
@keyframes rp-squash-y { 0% { scale: 1 1; opacity: 1; } 30% { scale: 1.3 .55; opacity: 1; } 100% { scale: 1.35 .4; opacity: 0; } }
.rp-splat {
    position: fixed; z-index: 4499; width: 120px; height: 120px; margin: -60px 0 0 -60px; pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(208, 92, 255, .85) 0%, rgba(122, 26, 106, .5) 30%, rgba(214, 180, 255, .18) 55%, rgba(0, 0, 0, 0) 70%);
    animation: rp-splat .9s ease-out forwards;
}
@keyframes rp-splat { 0% { transform: scale(.2); opacity: 1; } 40% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.4); opacity: 0; } }

.rp-bubble {
    pointer-events: auto;
    width: 260px;
    margin-bottom: 150px;
    padding: 14px 18px 16px;
    box-sizing: border-box;
    background: rgba(13, 10, 16, .9);
    border: 1px solid rgba(160, 58, 200, .25);
    border-top: 1px solid rgba(214, 180, 255, .55);
    border-radius: 4px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .6);
    color: #e9dec8;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .4s, transform .4s;
    pointer-events: none;
}
.rp-idle.rp-talking .rp-bubble { opacity: 1; transform: none; pointer-events: auto; }
.rp-out .rp-bubble { opacity: 0; transition-duration: .25s; }
.rp-bubble__head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.rp-dot { width: 6px; height: 6px; border-radius: 50%; background: #a03ac8; box-shadow: 0 0 8px #a03ac8; animation: rp-beat 1.6s ease-in-out infinite; }
.rp-name { font-family: Cinzel, serif; font-size: 11px; letter-spacing: .38em; color: #d6b4ff; flex: 1; }
.rp-close {
    width: 28px; height: 28px; margin: -6px -8px -6px 0;
    border: 0; background: transparent; color: #8a8070; font-size: 18px; line-height: 1; cursor: pointer; border-radius: 4px;
}
.rp-close:hover, .rp-close:focus-visible { color: #e9dec8; background: rgba(255, 255, 255, .06); }
.rp-text { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: 21px; line-height: 1.3; min-height: 54px; }
.rp-cursor { color: #d6b4ff; animation: rp-blink 1s steps(1) infinite; }

/* Pęknięta Świadomość: jedna ilustracja z alfą, osobno animowane oko i trzy macki. */
@keyframes rp-beat { 0%, 40%, 100% { opacity: .5; } 8%, 22% { opacity: 1; } 14% { opacity: .7; } }
@keyframes rp-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes rp-hov {
    0%, 100% { transform: translateY(0) rotate(-.4deg); }
    50% { transform: translateY(-22px) rotate(.4deg); }
}
@keyframes rp-sw {
    0%, 100% { transform: rotate(-7deg) skewX(-1deg); }
    50% { transform: rotate(9deg) skewX(1.5deg); }
}
@keyframes rp-eyeblink {
    0%, 91%, 97%, 100% { transform: scaleY(1); }
    93%, 94% { transform: scaleY(.06); }
    96% { transform: scaleY(.9); }
}
@keyframes rp-eye-pulse { 0%, 100% { opacity: .18; } 50% { opacity: .65; } }
@keyframes rp-orbit-wobble {
    0%, 100% { transform: rotate(-2deg) scaleY(.96); }
    50% { transform: rotate(2deg) scaleY(1.05); }
}
@keyframes rp-materialize {
    from { opacity: 0; transform: translateY(85px) scale(.85); }
    to { opacity: 1; transform: none; }
}
@keyframes rp-tendril-reveal {
    from { opacity: 0; transform: scale(.65); }
    to { opacity: 1; transform: none; }
}
@keyframes rp-dust {
    0% { opacity: 0; transform: none; }
    30% { opacity: .8; }
    100% { opacity: 0; transform: translateY(-160px); }
}

.rp-hover, .rp-shell, .rp-tendril-reveal { transform-box: view-box; transform-origin: 531px 730px; }
.rp-idle .rp-hover { animation: rp-hov 5.5s ease-in-out infinite; }
.rp-sw1, .rp-sw2, .rp-sw3 { transform-box: view-box; animation: rp-sw 5.2s ease-in-out infinite; }
.rp-sw1 { transform-origin: 641px 390px; }
.rp-sw2 { transform-origin: 663px 425px; animation-duration: 6.8s; animation-delay: -2s; animation-direction: reverse; }
.rp-sw3 { transform-origin: 679px 459px; animation-duration: 4.7s; animation-delay: -3s; }
.rp-tendril-reveal { transform-origin: 660px 440px; }
.rp-eyeb { transform-box: view-box; transform-origin: 531px 730px; animation: rp-eyeblink 7.2s ease-in-out infinite; }
.rp-eye-glow { animation: rp-eye-pulse 3.8s ease-in-out infinite; pointer-events: none; }
.rp-orbit-arrival { pointer-events: none; transform-box: view-box; transform-origin: 531px 730px; }
.rp-orbit-wobble { transform-origin: 0 0; animation: rp-orbit-wobble 8s ease-in-out infinite; }
.rp-orbit--middle .rp-orbit-wobble { animation-duration: 6.4s; animation-delay: -2s; }
.rp-orbit--lower .rp-orbit-wobble { animation-duration: 9.2s; animation-delay: -4s; animation-direction: reverse; }
.rp-orbit-shadow { fill: none; stroke: #24202c; stroke-width: 15; }
.rp-orbit-metal { fill: none; stroke: url(#rp-orbit-metal); stroke-width: 10; }
.rp-orbit-rim { fill: none; stroke: #d1cdd0; stroke-width: 1.7; }
.rp-orbit--upper .rp-orbit-shadow { stroke-width: 30; }
.rp-orbit--upper .rp-orbit-metal { stroke-width: 25; }
.rp-orbit-rune { fill: none; stroke: #3b3343; stroke-width: 2.7; stroke-linecap: round; stroke-linejoin: round; }
.rp-orbit-gem-halo { fill: #4cbde4; opacity: .13; }
[data-rp-orbits="back"] { opacity: .65; }
.rp-dust { opacity: 0; }

.rp-in .rp-shell { animation: rp-materialize 1.1s .25s cubic-bezier(.2, .8, .3, 1) both; }
.rp-in .rp-orbit-arrival { animation: rp-materialize 1.1s .25s cubic-bezier(.2, .8, .3, 1) both; }
.rp-in .rp-tendril-reveal { animation: rp-tendril-reveal 1.1s 1s ease-out both; }
.rp-in .rp-tendril-reveal:nth-child(2) { animation-delay: 1.15s; }
.rp-in .rp-tendril-reveal:nth-child(3) { animation-delay: 1.3s; }
.rp-out .rp-shell { animation: rp-materialize .85s .4s ease-in reverse both; }
.rp-out .rp-orbit-arrival { animation: rp-materialize .85s .4s ease-in reverse both; }
.rp-out .rp-tendril-reveal { animation: rp-tendril-reveal .65s ease-in reverse both; }
.rp-out .rp-dust { animation: rp-dust 1.1s .5s ease-out both; }
.rp-held .rp-hover, .rp-flying .rp-hover { animation-play-state: paused; }
.rp-paused *, .rp-hidden * { animation-play-state: paused !important; }

/* panel Consciousness: mniejszy, bez dymka, żeby nie zasłaniał */
.rp-bot .rp-figure { width: 96px; height: 156px; }
.rp-bot .rp-bubble { display: none; }

/* macki sięgające do postaci na mapie (półprzezroczyste; przy pracującym bocie jeszcze bardziej) */
.rp-reach { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 4498; pointer-events: none; overflow: visible; opacity: .55; }
.rp-reach--bot { opacity: .38; }
.rp-reach path { fill: none; stroke-linecap: round; transition: stroke-dashoffset .7s cubic-bezier(.3, .7, .3, 1); }
.rp-reach__base { stroke: #120e16; stroke-width: 5; opacity: .85; }
.rp-reach__vein { stroke: url(#rp-reach-g); stroke-width: 2; filter: drop-shadow(0 0 4px rgba(160, 58, 200, .8)); }
.rp-reaching .rp-tend { opacity: .15; transition: opacity .3s; }
.rp-touch {
    position: fixed; z-index: 4499; width: 36px; height: 36px; margin: -18px 0 0 -18px; pointer-events: none; border-radius: 50%;
    border: 2px solid rgba(192, 74, 224, .7); box-shadow: 0 0 12px rgba(160, 58, 200, .5), inset 0 0 8px rgba(92, 224, 208, .4);
    opacity: 0;
}
.rp-touch.is-on { animation: rp-touch 1.6s ease-in-out infinite; }
.rp-touch.rp-reach--bot.is-on { animation-duration: 2.2s; }
@keyframes rp-touch { 0%, 100% { transform: scale(.85); opacity: .35; } 50% { transform: scale(1.15); opacity: .8; } }

/* telefon: mała figura w rogu nad dolnym paskiem, dymek nad nią */
@media (max-width: 640px) {
    .rp-root { flex-direction: column; align-items: flex-end; gap: 4px; }
    .rp-figure, .rp-bot .rp-figure { width: 76px; height: 124px; }
    .rp-bubble { width: min(250px, calc(100vw - 24px)); margin-bottom: 0; padding: 10px 14px 12px; }
    .rp-text { font-size: 17px; min-height: 0; }
}

/* ślady, gdy relicta nie widać: żyła po ramce panelu bocznego (M2) i oko w ikonie docku (M3) */
.rp-ghost { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 4499; pointer-events: none; overflow: visible; }
.rp-ghost path, .rp-ghost polyline { fill: none; stroke-linecap: round; }
.rp-ghost__base { stroke: #120e16; stroke-width: 4.4; stroke-dasharray: 1; animation: rp-g-vein 5.2s ease-in-out both; }
.rp-ghost__vein { stroke: url(#rp-ghost-g); stroke-width: 1.6; stroke-dasharray: 1; filter: drop-shadow(0 0 3px rgba(160, 58, 200, .9)); animation: rp-g-vein 5.2s ease-in-out both; }
.rp-ghost__pulse { stroke: #f1e4ff; stroke-width: 3; stroke-dasharray: .04 .96; filter: drop-shadow(0 0 4px #c04ae0); animation: rp-g-run 2.4s linear infinite, rp-g-pulse 5.2s ease-in-out both; }
.rp-ghost__br { stroke: #a03ac8; stroke-width: 1.2; stroke-dasharray: 1; filter: drop-shadow(0 0 3px rgba(160, 58, 200, .9)); animation: rp-g-br 5.2s ease-in-out both; }
@keyframes rp-g-vein { 0% { stroke-dashoffset: 1; } 35%, 62% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 1; } }
@keyframes rp-g-br { 0%, 30% { stroke-dashoffset: 1; } 45%, 60% { stroke-dashoffset: 0; } 80%, 100% { stroke-dashoffset: 1; } }
@keyframes rp-g-run { to { stroke-dashoffset: -1; } }
@keyframes rp-g-pulse { 0%, 28% { opacity: 0; } 38%, 62% { opacity: 1; } 75%, 100% { opacity: 0; } }
.rp-ghost__eye { transform-box: fill-box; transform-origin: center; animation: rp-g-eye 4.3s ease-in-out both; }
.rp-ghost__eye ellipse, .rp-ghost__lid polygon { filter: drop-shadow(0 0 3px #c04ae0); }
.rp-ghost__lid { transform-box: fill-box; transform-origin: center; animation: rp-g-blink 4.3s ease-in-out both; }
.rp-ghost__cracks polyline { stroke: #c04ae0; stroke-width: 1; stroke-dasharray: 1; filter: drop-shadow(0 0 3px #c04ae0); animation: rp-g-crack 4.3s ease-in-out both; }
@keyframes rp-g-eye { 0% { opacity: 0; transform: scale(.3); } 14%, 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.3); } }
@keyframes rp-g-blink { 0%, 44%, 52%, 100% { transform: scaleX(1); } 48% { transform: scaleX(.1); } }
@keyframes rp-g-crack { 0%, 10% { stroke-dashoffset: 1; } 30%, 75% { stroke-dashoffset: 0; } 95%, 100% { stroke-dashoffset: 1; } }

/* N1: napis drga i na moment mówi WE SEE YOU */
@keyframes rp-jit { 0%, 100% { transform: none; text-shadow: none; } 20% { transform: translateX(-2px); text-shadow: 2px 0 #c04ae0, -2px 0 #5ce0d0; } 40% { transform: translateX(2px); } 60% { transform: translateX(-1px); text-shadow: 1px 0 #c04ae0; } }
.rp-glitch { display: inline-block; animation: rp-jit .3s steps(1) 2; }
.rp-glitch--we { color: #d6b4ff !important; letter-spacing: .12em; text-shadow: 0 0 8px rgba(192, 74, 224, .8); animation: rp-jit .25s steps(1) 3; }
/* N2: nić do kursora */
.rp-thread__base, .rp-thread__vein { fill: none; stroke-linecap: round; }
.rp-thread__base { stroke: #120e16; stroke-width: 3; }
.rp-thread__vein { stroke: url(#rp-thread-g); stroke-width: 1.2; stroke-dasharray: 6 6; filter: drop-shadow(0 0 3px rgba(160, 58, 200, .9)); animation: rp-g-run6 .6s linear infinite; }
.rp-thread__tip { fill: #f1e4ff; filter: drop-shadow(0 0 5px #c04ae0); }
.rp-ghost--thread { animation: rp-g-fadein .3s both; }
.rp-ghost--thread.is-snap path, .rp-ghost--thread.is-snap .rp-thread__tip { opacity: 0; transition: opacity .25s; }
.rp-thread__bit { fill: #c88aff; filter: drop-shadow(0 0 3px #c04ae0); animation: rp-g-bit .9s ease-out both; }
@keyframes rp-g-run6 { to { stroke-dashoffset: -12; } }
@keyframes rp-g-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes rp-g-bit { 0% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(18px); } }
/* N5: bicie serca ramek paneli */
@keyframes rp-hb { 0%, 100% { box-shadow: 0 0 0 0 rgba(160, 58, 200, 0); } 12% { box-shadow: 0 0 0 2px rgba(192, 74, 224, .6), 0 0 26px rgba(160, 58, 200, .45); } 24% { box-shadow: 0 0 0 0 rgba(160, 58, 200, 0); } 36% { box-shadow: 0 0 0 2px rgba(192, 74, 224, .5), 0 0 20px rgba(160, 58, 200, .35); } 60% { box-shadow: 0 0 0 0 rgba(160, 58, 200, 0); } }
.rp-hb { animation: rp-hb 1.8s var(--rp-hb-delay, 0s) ease-out both !important; }

/* O5: panel boczny wybrzusza się od tyłu, przez niego prześwitują żyły */
@keyframes rp-bulge { 0%, 100% { transform: none; } 35%, 60% { transform: perspective(700px) translateZ(12px) scale(1.01); box-shadow: inset 0 0 60px rgba(160, 58, 200, .35), 0 0 30px rgba(160, 58, 200, .25); } }
.rp-bulge { animation: rp-bulge 4s ease-in-out both !important; }
.rp-bulge__veins { fill: none; stroke: #a03ac8; stroke-width: 1.3; stroke-linecap: round; filter: drop-shadow(0 0 3px rgba(160, 58, 200, .9)); animation: rp-g-through 4s ease-in-out both; }
.rp-bulge__veins circle { fill: #a03ac8; stroke: none; opacity: .4; }
@keyframes rp-g-through { 0%, 15%, 90%, 100% { opacity: 0; } 38%, 62% { opacity: .55; } }

@media (prefers-reduced-motion: reduce) {
    .rp-reach, .rp-touch, .rp-ghost { display: none; }
    .rp-hb, .rp-glitch, .rp-glitch--we, .rp-bulge { animation: none !important; }
    .rp-root *, .rp-root { animation: none !important; transition: opacity .3s !important; }
    .rp-out { opacity: 0; transition: opacity .6s !important; }
}
