/* ================================
   DER CODEX - CHARACTER STYLING
   Animiertes Superhelden-Maskottchen
   ================================ */

#codex-character {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 9999;
    pointer-events: none;
}

.codex-wrapper {
    position: relative;
    pointer-events: all;
}

/* ================================
   CODEX HERO - MAIN CHARACTER
   ================================ */

.codex-hero {
    width: 120px;
    height: 180px;
    position: relative;
    transform: translateY(200px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.codex-hero.codex-active {
    transform: translateY(0);
    opacity: 1;
}

/* Kopf/Helm */
.codex-head {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #00FFFF, #00CED1);
    border: 3px solid #0A0A0A;
    border-radius: 50% 50% 45% 45%;
    margin: 0 auto;
    position: relative;
    animation: float 3s ease-in-out infinite;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.5),
        inset 0 -10px 20px rgba(0, 0, 0, 0.3);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Visor */
.codex-visor {
    width: 30px;
    height: 8px;
    background: #00FF00;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 2px;
    box-shadow: 0 0 10px #00FF00;
    animation: visorScan 2s ease-in-out infinite;
}

@keyframes visorScan {
    0%, 100% { width: 30px; }
    50% { width: 35px; opacity: 0.7; }
}

.codex-visor-glow {
    width: 35px;
    height: 15px;
    background: radial-gradient(ellipse at center, rgba(0, 255, 0, 0.3), transparent);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Körper */
.codex-body {
    width: 80px;
    height: 100px;
    background: linear-gradient(180deg, #00FFFF 0%, #0A0A0A 100%);
    border: 3px solid #0A0A0A;
    border-radius: 10px;
    margin: 5px auto 0;
    position: relative;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.2);
}

/* Quantum Core */
.quantum-core {
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #FF00FF, #C71585);
    border: 2px solid #0A0A0A;
    border-radius: 50%;
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: corePulse 1.5s ease-in-out infinite;
    box-shadow: 
        0 0 20px rgba(255, 0, 255, 0.8),
        inset 0 0 10px rgba(255, 255, 255, 0.3);
}

@keyframes corePulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 20px rgba(255, 0, 255, 0.8);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 0 30px rgba(255, 0, 255, 1);
    }
}

.core-pulse {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: ringPulse 1.5s ease-in-out infinite;
}

@keyframes ringPulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Codex Symbol */
.codex-symbol {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Bangers', cursive;
    font-size: 24px;
    color: #00FFFF;
    text-shadow: 
        2px 2px 0 #0A0A0A,
        0 0 10px #00FFFF;
    animation: symbolGlow 2s ease-in-out infinite;
}

@keyframes symbolGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Code Lines (laufende Codezeilen) */
.code-lines {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    font-family: 'Courier New', monospace;
    font-size: 8px;
    color: #00FF00;
    animation: codeScroll 3s linear infinite;
}

.code-line {
    display: inline-block;
    text-shadow: 0 0 5px #00FF00;
}

@keyframes codeScroll {
    0% { transform: translateX(-50%) translateY(0); }
    100% { transform: translateX(-50%) translateY(-10px); }
}

/* ================================
   DIGITAL WINGS
   ================================ */

.digital-wings {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 60px;
    pointer-events: none;
}

.wing {
    position: absolute;
    width: 40px;
    height: 60px;
    background: linear-gradient(to bottom, 
        rgba(0, 255, 255, 0.6),
        rgba(255, 0, 255, 0.3)
    );
    border: 2px solid rgba(0, 255, 255, 0.5);
    opacity: 0;
    transition: all 0.5s ease;
}

.wing-left {
    left: -5px;
    border-radius: 50% 20% 20% 50%;
    transform: rotate(-30deg);
}

.wing-right {
    right: -5px;
    border-radius: 20% 50% 50% 20%;
    transform: rotate(30deg);
}

.digital-wings.wings-active .wing {
    opacity: 1;
    animation: wingFlap 0.5s ease-in-out;
}

@keyframes wingFlap {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-10deg); }
}

.digital-wings.wings-active .wing-left {
    transform: rotate(-45deg);
}

.digital-wings.wings-active .wing-right {
    transform: rotate(45deg);
}

.digital-wings.wings-flutter .wing {
    animation: wingFlutter 1s ease-in-out infinite;
}

@keyframes wingFlutter {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

/* ================================
   SPEECH BUBBLE
   ================================ */

.codex-speech {
    position: absolute;
    bottom: 200px;
    right: 0;
    background: white;
    border: 4px solid #0A0A0A;
    border-radius: 20px;
    padding: 15px 20px;
    min-width: 200px;
    max-width: 300px;
    box-shadow: 
        5px 5px 0 #0A0A0A,
        8px 8px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: scale(0.5) translateY(20px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.codex-speech.speech-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.codex-speech::before {
    content: '';
    position: absolute;
    bottom: -20px;
    right: 40px;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 20px solid #0A0A0A;
}

.codex-speech::after {
    content: '';
    position: absolute;
    bottom: -15px;
    right: 43px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 17px solid white;
}

.speech-content {
    font-family: var(--font-text);
    font-size: 14px;
    color: #0A0A0A;
    line-height: 1.5;
    text-align: center;
}

/* ================================
   CONTROLS
   ================================ */

.codex-controls {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.codex-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #00FFFF, #00CED1);
    border: 3px solid #0A0A0A;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 0 #0A0A0A,
        0 6px 15px rgba(0, 0, 0, 0.3);
}

.codex-btn:hover {
    background: linear-gradient(135deg, #FF00FF, #C71585);
    transform: translateY(-3px);
    box-shadow: 
        0 7px 0 #0A0A0A,
        0 10px 20px rgba(255, 0, 255, 0.5);
}

.codex-btn:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 0 #0A0A0A,
        0 3px 10px rgba(0, 0, 0, 0.3);
}

/* ================================
   ANIMATIONS - TALKING
   ================================ */

.codex-hero.codex-talking .codex-head {
    animation: talking 0.3s ease-in-out infinite;
}

@keyframes talking {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.05); }
}

.codex-hero.codex-talking .codex-visor {
    animation: visorTalk 0.2s ease-in-out infinite;
}

@keyframes visorTalk {
    0%, 100% { height: 8px; }
    50% { height: 3px; }
}

/* ================================
   ANIMATIONS - FLYING
   ================================ */

.codex-hero.codex-flying {
    animation: flyBounce 0.5s ease-in-out infinite;
}

@keyframes flyBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.codex-hero.codex-flying .digital-wings .wing {
    animation: wingFly 0.3s ease-in-out infinite;
}

@keyframes wingFly {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(-5deg) scale(1.1); }
}

/* ================================
   ANIMATIONS - POWER UP
   ================================ */

.codex-hero.codex-power-up {
    animation: powerShake 0.1s ease-in-out infinite;
    filter: brightness(1.5) drop-shadow(0 0 20px #00FFFF);
}

@keyframes powerShake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-2px, 0); }
    75% { transform: translate(2px, 0); }
}

.codex-hero.codex-power-up .quantum-core {
    animation: powerCore 0.3s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(255, 0, 255, 1);
}

@keyframes powerCore {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.5); }
}

/* Screen Effect beim Power-Up */
body.power-effect::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, 
        rgba(0, 255, 255, 0.2), 
        rgba(255, 0, 255, 0.2)
    );
    z-index: 9998;
    animation: screenPulse 0.5s ease-in-out;
    pointer-events: none;
}

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

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    #codex-character {
        bottom: 20px;
        left: 20px;
        transform: scale(0.8);
    }
    
    .codex-speech {
        max-width: 200px;
        font-size: 12px;
    }
    
    .codex-controls {
        bottom: -40px;
        gap: 5px;
    }
    
    .codex-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #codex-character {
        transform: scale(0.7);
    }
}

/* ================================
   ZUSÄTZLICHE EFFEKTE
   ================================ */

/* Partikel-Effekt beim Hover */
.codex-hero:hover::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, 
        rgba(0, 255, 255, 0.2), 
        transparent
    );
    transform: translate(-50%, -50%);
    border-radius: 50%;
    animation: particlePulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes particlePulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0;
    }
}

/* Glow-Effekt bei Interaktion */
.codex-hero:active {
    filter: drop-shadow(0 0 30px #00FFFF);
}
