/*
 * wisнblower - jelly wisн Component CSS
 * Jellyfish Animation, Water Effects, Touch System, Bioluminescence
 */

/* ===== JELLY PAGE BODY OVERRIDE ===== */
body.jelly-page {
    background: linear-gradient(135deg, #001a2e 0%, #003366 30%, #004080 60%, #0066cc 100%);
    height: 100vh;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

@media (max-height: 600px) {
    body.jelly-page {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
}

body.jelly-page .sound-toggle {
    position: fixed;
    top: 50%;
    right: 30px;
    width: 44px;
    height: 44px;
    transform: translateY(-35px);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    font-size: 1.4rem;
    z-index: 1000;
}

body.jelly-page .sound-toggle:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: rgba(0, 255, 255, 0.5);
    transform: translateY(-30px) scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

body.jelly-page .sound-toggle.muted {
    opacity: 0.5;
}

/* ===== WASSER-HINTERGRUND SYSTEM ===== */
.water-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 255, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 70%);
    animation: waterFlow 15s ease-in-out infinite;
    z-index: -1;
}

@keyframes waterFlow {
    0%, 100% { 
        transform: translateX(0) translateY(0) scale(1);
        opacity: 0.8;
    }
    25% { 
        transform: translateX(5px) translateY(-3px) scale(1.02);
        opacity: 1;
    }
    50% { 
        transform: translateX(-3px) translateY(5px) scale(0.98);
        opacity: 0.9;
    }
    75% { 
        transform: translateX(3px) translateY(-2px) scale(1.01);
        opacity: 1;
    }
}

.water-surface {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(0, 255, 255, 0.3) 30%, 
        rgba(255, 255, 255, 0.3) 50%, 
        rgba(0, 255, 255, 0.3) 70%, 
        transparent 100%);
    animation: waterSurface 4s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.3);
    pointer-events: none;
    z-index: 5;
    opacity: 0.4;
}

.water-surface::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 100%);
    animation: waterSurface 5s ease-in-out infinite reverse;
    opacity: 0.3;
}

@keyframes waterSurface {
    0%, 100% { 
        transform: scaleX(1) translateX(0);
        opacity: 0.6;
    }
    50% { 
        transform: scaleX(1.1) translateX(15px);
        opacity: 1;
    }
}

/* ===== BLASEN SYSTEM ===== */
.bubbles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.bubble {
    position: absolute;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.3));
    border-radius: 50%;
    animation: floatUp 8s infinite linear;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) translateX(0) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    95% {
        opacity: 0.8;
        transform: translateY(-10vh) translateX(20px) scale(1);
    }
    100% {
        transform: translateY(-20vh) translateX(25px) scale(0.8);
        opacity: 0;
    }
}

/* ===== JELLY MAIN CONTENT OVERRIDE ===== */
body.jelly-page .main-content {
    position: relative;
    z-index: 10;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
}

/* ===== QUALLEN-CONTAINER ===== */
.jellyfish-container {
    width: 400px;
    height: 400px;
    margin: 0 auto;
    position: relative;
    cursor: grab;
    perspective: 800px;
    transform-style: preserve-3d;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.jellyfish-container:active {
    cursor: grabbing;
}

.jellyfish {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.1s ease-out;
    transform-style: preserve-3d;
}

/* ===== QUALLEN-KÖRPER ===== */
.jellyfish-body {
    position: absolute;
    width: 200px;
    height: 120px;
    left: 50%;
    top: 30%;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center top, 
        rgba(255, 182, 193, 0.9) 0%,
        rgba(255, 105, 180, 0.8) 30%,
        rgba(255, 20, 147, 0.7) 60%,
        rgba(199, 21, 133, 0.6) 80%,
        rgba(139, 69, 19, 0.4) 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 
        0 0 30px rgba(255, 105, 180, 0.6),
        inset 0 0 30px rgba(255, 255, 255, 0.3),
        inset 0 -20px 40px rgba(199, 21, 133, 0.4);
    animation: jellyfishPulse 3s ease-in-out infinite;
    overflow: hidden;
}

@keyframes jellyfishPulse {
    0%, 100% { 
        transform: translateX(-50%) scaleY(1) scaleX(1);
    }
    25% { 
        transform: translateX(-50%) scaleY(1.15) scaleX(1.08);
    }
    50% { 
        transform: translateX(-50%) scaleY(1.2) scaleX(1.12);
    }
    75% { 
        transform: translateX(-50%) scaleY(1.1) scaleX(1.05);
    }
}

.jellyfish-body::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 30%;
    width: 40%;
    height: 30%;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 0.8) 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 100%);
    border-radius: 50%;
    filter: blur(1px);
}

/* ===== TENTAKELN ===== */
.tentacles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.tentacle {
    position: absolute;
    width: 4px;
    background: linear-gradient(to bottom, 
        rgba(255, 105, 180, 0.8) 0%,
        rgba(255, 20, 147, 0.6) 50%,
        rgba(199, 21, 133, 0.4) 100%);
    border-radius: 2px;
    transform-origin: top center;
    box-shadow: 0 0 10px rgba(255, 105, 180, 0.4);
}

.tentacle:nth-child(1) {
    left: 45%;
    top: 50%;
    height: 150px;
    animation: tentacleFloat1 4s ease-in-out infinite;
}

.tentacle:nth-child(2) {
    left: 50%;
    top: 50%;
    height: 180px;
    animation: tentacleFloat2 4.5s ease-in-out infinite;
}

.tentacle:nth-child(3) {
    left: 55%;
    top: 50%;
    height: 160px;
    animation: tentacleFloat3 3.8s ease-in-out infinite;
}

.tentacle:nth-child(4) {
    left: 40%;
    top: 52%;
    height: 140px;
    animation: tentacleFloat4 4.2s ease-in-out infinite;
}

.tentacle:nth-child(5) {
    left: 60%;
    top: 52%;
    height: 170px;
    animation: tentacleFloat5 3.9s ease-in-out infinite;
}

@keyframes tentacleFloat1 {
    0%, 100% { transform: rotate(-10deg) scaleY(1); }
    25% { transform: rotate(5deg) scaleY(1.1); }
    50% { transform: rotate(-5deg) scaleY(1.05); }
    75% { transform: rotate(8deg) scaleY(1.08); }
}

@keyframes tentacleFloat2 {
    0%, 100% { transform: rotate(0deg) scaleY(1); }
    25% { transform: rotate(-8deg) scaleY(1.12); }
    50% { transform: rotate(3deg) scaleY(1.06); }
    75% { transform: rotate(-5deg) scaleY(1.09); }
}

@keyframes tentacleFloat3 {
    0%, 100% { transform: rotate(10deg) scaleY(1); }
    25% { transform: rotate(-3deg) scaleY(1.08); }
    50% { transform: rotate(7deg) scaleY(1.11); }
    75% { transform: rotate(-8deg) scaleY(1.04); }
}

@keyframes tentacleFloat4 {
    0%, 100% { transform: rotate(-15deg) scaleY(1); }
    25% { transform: rotate(8deg) scaleY(1.07); }
    50% { transform: rotate(-3deg) scaleY(1.13); }
    75% { transform: rotate(12deg) scaleY(1.05); }
}

@keyframes tentacleFloat5 {
    0%, 100% { transform: rotate(15deg) scaleY(1); }
    25% { transform: rotate(-12deg) scaleY(1.09); }
    50% { transform: rotate(5deg) scaleY(1.07); }
    75% { transform: rotate(-7deg) scaleY(1.11); }
}

/* ===== BIOLUMINESZENZ ===== */
.bioluminescence {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.bioluminescence.active {
    opacity: 1;
}

.bio-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, 
        rgba(0, 255, 255, 1) 0%, 
        rgba(0, 255, 255, 0.5) 50%, 
        transparent 100%);
    border-radius: 50%;
    animation: bioGlow 2s ease-out forwards;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
}

@keyframes bioGlow {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

.water-ripple {
    position: absolute;
    border: 2px solid rgba(0, 255, 255, 0.6);
    border-radius: 50%;
    transform: scale(0);
    animation: rippleWater 1s ease-out;
    pointer-events: none;
}

@keyframes rippleWater {
    to {
        transform: scale(6);
        opacity: 0;
    }
}

/* ===== FARB-MENÜ ===== */
.color-menu {
    position: fixed;
    top: 50%;
    right: 30px;
    transform: translateY(5px);
    z-index: 1000;
}

.color-toggle {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 1.4rem;
    position: relative;
}

.color-toggle::before {
    content: '';
    position: absolute;
    width: 19px;
    height: 19px;
    background: conic-gradient(
        from 0deg,
        #ff69b4 0deg,
        #ff1493 90deg,
        #00bfff 180deg,
        #1e90ff 270deg,
        #9370db 315deg,
        #8a2be2 360deg
    );
    border-radius: 50%;
    z-index: 1;
}

.color-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.color-options {
    position: absolute;
    top: 54px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.color-options.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.jellyfish-option {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.jellyfish-option:hover {
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
}

.jellyfish-option.active {
    border-color: #00ffff;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.8);
}

.pink-jellyfish {
    background: radial-gradient(circle, rgba(255, 182, 193, 0.9) 0%, rgba(255, 105, 180, 0.6) 100%);
}

.blue-jellyfish {
    background: radial-gradient(circle, rgba(173, 216, 230, 0.9) 0%, rgba(0, 191, 255, 0.6) 100%);
}

.purple-jellyfish {
    background: radial-gradient(circle, rgba(221, 160, 221, 0.9) 0%, rgba(147, 112, 219, 0.6) 100%);
}

.green-jellyfish {
    background: radial-gradient(circle, rgba(152, 251, 152, 0.9) 0%, rgba(0, 255, 127, 0.6) 100%);
}

/* ===== WUNSCH-ENERGIE SYSTEM ===== */
.wish-energy-container {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.wish-energy-container.visible {
    opacity: 1;
}

.wish-energy-bar {
    width: 8px;
    height: 200px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.wish-energy-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(to top, 
        rgba(0, 255, 255, 0.8) 0%,
        rgba(255, 105, 180, 0.8) 50%,
        rgba(255, 255, 255, 1) 100%);
    border-radius: 3px;
    transition: height 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.wish-energy-label {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap;
}

.wish-mode-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 30%, rgba(255, 255, 255, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
    z-index: 50;
}

.wish-mode-overlay.active {
    opacity: 1;
    animation: wishPulse 2s ease-in-out infinite;
}

@keyframes wishPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.wish-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.5rem;
    font-weight: 300;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 1001;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.wish-message.visible {
    opacity: 1;
    animation: wishGlow 1s ease-in-out infinite alternate;
}

@keyframes wishGlow {
    from { text-shadow: 0 0 20px rgba(255, 255, 255, 0.8); }
    to { text-shadow: 0 0 30px rgba(255, 255, 255, 1), 0 0 40px rgba(0, 255, 255, 0.5); }
}

/* ===== RESPONSIVE JELLY WISH ===== */
@media (max-width: 768px) {
    .jellyfish-container {
        width: 300px;
        height: 300px;
    }
    
    body.jelly-page .main-content {
        padding: 1rem;
    }
    
    .jellyfish-option {
        width: 35px;
        height: 35px;
    }
    
    .wish-energy-container {
        left: 10px;
    }
    
    .wish-energy-bar {
        height: 150px;
    }
    
    body.jelly-page .sound-toggle {
        transform: translateY(-30px);
    }
    
    .color-menu {
        transform: translateY(10px);
    }
}

/* Smaller breakpoint comes after larger one in cascade - no !important needed */
@media (max-width: 400px) {
    body.jelly-page .sound-toggle {
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
        transform: translateY(-30px);
    }

    body.jelly-page .color-toggle {
        width: 35px;
        height: 35px;
    }

    .color-menu {
        right: 15px;
        transform: translateY(10px);
    }
}

/* ===== ACCESSIBILITY OVERRIDES ===== */
/* !important is JUSTIFIED here: Accessibility override must take precedence */
@media (prefers-reduced-motion: reduce) {
    body.jelly-page * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}