/* End Screen Styles - Korrigierte Version ohne grünen Balken */

/* End Screen Overlay */
#end-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    background: linear-gradient(135deg, #000000, #1a1a1a, #2d2d2d);
    z-index: 99;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
    color: #f0f0f0;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 3s ease-in-out, visibility 3s ease-in-out;
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
}

/* End Screen Mystisches Symbol */
.end-seal {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #333333, #1a1a1a);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.end-seal::before {
    content: "✨";
    font-size: 40px;
    animation: gentle-sparkle 4s ease-in-out infinite;
}

.inner-glow {
    position: absolute;
    width: 120px;
    height: 120px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    animation: slow-rotate 20s linear infinite;
}

@keyframes gentle-sparkle {
    0%, 100% { 
        opacity: 0.6; 
        transform: scale(1);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.1);
    }
}

@keyframes slow-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* End Screen Texte */
.end-title {
    font-size: 42px;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    margin-bottom: 15px;
    letter-spacing: 2px;
    font-weight: normal;
    animation: fade-in-up 2s ease-out 0.5s both;
}

.end-subtitle {
    font-size: 22px;
    color: #cccccc;
    margin-bottom: 20px;
    font-style: italic;
    animation: fade-in-up 2s ease-out 1s both;
}

.end-description {
    font-size: 18px;
    color: #999999;
    margin-bottom: 50px;
    animation: fade-in-up 2s ease-out 1.5s both;
}

/* Restart Sektion */
.restart-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: fade-in-up 2s ease-out 2s both;
}

.restart-instruction {
    font-size: 20px;
    color: #ffffff;
    margin-bottom: 10px;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

/* Haupt-Restart-Button */
.main-restart-button {
    margin-top: 20px;
    padding: 18px 35px;
    background: linear-gradient(145deg, #8b6b43, #a68153);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: #ffffff;
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.main-restart-button:hover {
    background: linear-gradient(145deg, #9b7b53, #b69163);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(139, 107, 67, 0.4);
    transform: translateY(-3px);
}

.main-restart-button:active {
    transform: translateY(-1px);
}

/* Exit-Hinweis */
.exit-hint {
    position: absolute;
    bottom: 30px;
    font-size: 14px;
    color: #666666;
    font-style: italic;
}

/* Fade-in Animation */
@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mystischer Nebel-Effekt */
#end-screen-overlay::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(30, 59, 30, 0.3) 100%);
    z-index: -1;
}

/* Sichtbarkeits-Klasse für Animation */
#end-screen-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Content Container */
.end-screen-content {
    text-align: center;
    color: #ffffff;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    padding: 40px;
    box-sizing: border-box;
    transform: translateY(20px);
    transition: transform 1s ease 0.5s;
}

#end-screen-overlay.visible .end-screen-content {
    transform: translateY(0);
}

/* Buttons */
.end-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    animation: fade-in-up 2s ease-out 2.4s both;
}

.restart-button, .close-button {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.restart-button:hover, .close-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.restart-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.restart-button:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Music Toggle Button - Mystische Version */
.music-toggle-button {
    position: relative;
    background: linear-gradient(145deg, #4a4a4a, #2a2a2a);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    padding: 12px 28px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        inset 0 1px 3px rgba(255, 255, 255, 0.1);
}

.music-toggle-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent
    );
    transition: left 0.5s ease;
}

.music-toggle-button:hover::before {
    left: 100%;
}

.music-toggle-button:hover {
    background: linear-gradient(145deg, #5a5a5a, #3a3a3a);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 255, 255, 0.1),
        inset 0 1px 3px rgba(255, 255, 255, 0.15);
}

/* Musik läuft - Goldener Glow */
.music-toggle-button.playing {
    background: linear-gradient(145deg, #8b6914, #6b5010);
    border-color: rgba(255, 215, 0, 0.4);
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 25px rgba(255, 215, 0, 0.3),
        inset 0 1px 3px rgba(255, 215, 0, 0.2);
    animation: music-pulse 2s ease-in-out infinite;
}

.music-toggle-button.playing::before {
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 215, 0, 0.2), 
        transparent
    );
}

.music-toggle-button.playing:hover {
    background: linear-gradient(145deg, #9b7914, #7b6010);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.5),
        0 0 35px rgba(255, 215, 0, 0.5),
        inset 0 1px 3px rgba(255, 215, 0, 0.3);
}

/* Musik-Pulsations-Animation */
@keyframes music-pulse {
    0%, 100% { 
        box-shadow: 
            0 8px 25px rgba(0, 0, 0, 0.4),
            0 0 25px rgba(255, 215, 0, 0.3),
            inset 0 1px 3px rgba(255, 215, 0, 0.2);
    }
    50% { 
        box-shadow: 
            0 8px 25px rgba(0, 0, 0, 0.4),
            0 0 35px rgba(255, 215, 0, 0.5),
            inset 0 1px 3px rgba(255, 215, 0, 0.3);
    }
}

/* Musik pausiert - Sanfter silberner Glow */
.music-toggle-button:not(.playing) {
    animation: music-idle 3s ease-in-out infinite;
}

@keyframes music-idle {
    0%, 100% { 
        box-shadow: 
            0 8px 25px rgba(0, 0, 0, 0.4),
            inset 0 1px 3px rgba(255, 255, 255, 0.1);
    }
    50% { 
        box-shadow: 
            0 8px 25px rgba(0, 0, 0, 0.4),
            0 0 15px rgba(255, 255, 255, 0.1),
            inset 0 1px 3px rgba(255, 255, 255, 0.15);
    }
}

/* Siegel-Zentrierung Fix */
.end-seal {
    margin: 0 auto 40px auto;
}

/* Animationen aus JS */
@keyframes sealAppear {
    from {
        opacity: 0;
        transform: scale(0.5) rotateY(180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
}

@keyframes textAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.end-screen-overlay.fade-out-restart {
    opacity: 0 !important;
    transform: scale(0.95) !important;
    transition: opacity 1.5s ease-out, transform 1.5s ease-out !important;
}

.end-screen-overlay.fade-out-restart .end-screen-content {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 1s ease-out 0.2s, transform 1s ease-out 0.2s;
}

/* ===== FLOATING AUDIO BUTTON ===== */
.floating-audio-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 4000;
    
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    backdrop-filter: blur(10px);
    
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: all 0.5s ease;
    
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        inset 0 1px 3px rgba(255, 255, 255, 0.1);
}

.floating-audio-button.visible {
    opacity: 0.7;
    visibility: visible;
    transform: scale(1);
}

.floating-audio-button:hover {
    opacity: 1;
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(255, 255, 255, 0.2),
        inset 0 1px 3px rgba(255, 255, 255, 0.2);
}

/* Musik läuft - Goldener Glow */
.floating-audio-button.playing {
    background: linear-gradient(145deg, #8b6914, #6b5010);
    border-color: rgba(255, 215, 0, 0.4);
    color: #ffd700;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.3),
        inset 0 1px 3px rgba(255, 215, 0, 0.2);
    animation: floating-music-pulse 2s ease-in-out infinite;
}

.floating-audio-button.playing:hover {
    background: linear-gradient(145deg, #9b7914, #7b6010);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 215, 0, 0.5),
        inset 0 1px 3px rgba(255, 215, 0, 0.3);
}

/* Button verstecken wenn End Screen aktiv */
body.journey-ended .floating-audio-button {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(0.8) !important;
    transition: all 1s ease !important;
}

/* Animationen */
@keyframes floating-music-pulse {
    0%, 100% { 
        box-shadow: 
            0 8px 25px rgba(0, 0, 0, 0.3),
            0 0 20px rgba(255, 215, 0, 0.3),
            inset 0 1px 3px rgba(255, 215, 0, 0.2);
    }
    50% { 
        box-shadow: 
            0 8px 25px rgba(0, 0, 0, 0.3),
            0 0 30px rgba(255, 215, 0, 0.5),
            inset 0 1px 3px rgba(255, 215, 0, 0.3);
    }
}
