/* Game UI elements styles */

/* Score display */
#score {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 24px;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 10px;
    border-radius: 10px;
    display: inline-block;
}

.memory-counter {
    display: inline-block;
    margin-right: 15px;
    background-color: rgba(0, 0, 50, 0.4);
    padding: 5px 10px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 18px;
    vertical-align: middle;
}

.memory-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: #80ffff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(128, 255, 255, 0.8);
    margin-right: 8px;
    vertical-align: middle;
}

/* Lyrics display - positioned higher to avoid overlap with joystick */
#lyrics {
    position: absolute;
    bottom: 150px; /* Increased from 100px to avoid joystick overlap */
    left: 50%;
    transform: translateX(-50%);
    font-size: 22px;
    font-style: italic;
    max-width: 500px;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.5s;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    z-index: 11; /* Ensure it's above other elements */
}

/* Game messages - positioned higher to avoid blocking player's view */
#message {
    position: absolute;
    top: 30%; /* Changed from 50% to 30% to move it higher */
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    color: white;
    text-shadow: 0 0 10px rgba(255, 130, 220, 0.8);
    background-color: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.5s;
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

/* Memory display */
#memoryImage {
    position: absolute;
    width: 220px;
    height: 170px;
    background-size: cover;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.9);
    opacity: 0;
    transition: opacity 1s, transform 1s;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0.9);
    overflow: hidden;
}

#memoryImage.show {
    opacity: 1;
    transform: scale(1);
}

#memoryCaption {
    position: absolute;
    bottom: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    width: 100%;
    padding: 5px;
    text-align: center;
    font-style: italic;
    font-size: 14px;
}

.memory-tafel {
    position: absolute;
    width: 200px;
    height: 150px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    color: white;
    font-weight: bold;
    font-size: 22px;
    text-align: center;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    pointer-events: none;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    /* Position moved higher to avoid blocking player's view */
    top: 25% !important;
}

/* Start screen */
#startScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #4a0072, #00205a);
    z-index: 20;
    overflow: hidden;
}

#title {
    font-size: 60px;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
    letter-spacing: 3px;
}

.subtitle {
    font-size: 28px;
    margin-bottom: 40px;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#startButton {
    padding: 15px 40px;
    font-size: 26px;
    background: linear-gradient(45deg, #ff6ec4, #7873f5);
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 0 20px rgba(255, 110, 196, 0.7);
    position: relative;
    overflow: hidden;
}

#startButton:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 110, 196, 0.9);
}

#startButton:after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(30deg);
    transition: transform 0.5s;
}

#startButton:hover:after {
    transform: rotate(30deg) translate(10%, 10%);
}

#artist {
    position: absolute;
    bottom: 20px;
    width: 100%;
    text-align: center;
    font-size: 18px;
}

/* Artist links styling */
#artist a, .credits-section a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

#artist a:hover, .credits-section a:hover {
    color: #FDC840;
    border-bottom: 1px solid #FDC840;
    text-shadow: 0 0 10px rgba(253, 200, 64, 0.5);
}

/* Die .infoPanel wurde in ruckenwind-theme.css neu definiert */

/* Game over screen */
#gameOver {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 15;
}

.gameOverTitle {
    font-size: 54px;
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 130, 220, 0.7);
}

#finalScore {
    font-size: 40px;
    margin-bottom: 40px;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 20px;
    border-radius: 15px;
}

#restartButton {
    padding: 15px 30px;
    font-size: 26px;
    background: linear-gradient(45deg, #ff6ec4, #7873f5);
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    transition: transform 0.3s;
    box-shadow: 0 0 20px rgba(255, 110, 196, 0.7);
}

#restartButton:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 110, 196, 0.9);
}

/* Floating words */
.floating-word {
    position: absolute;
    color: white;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    pointer-events: none;
    opacity: 0;
    font-size: 24px;
    font-weight: bold;
    transition: opacity 0.5s;
    z-index: 5;
}

/* Pause button */
#pauseButton {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #ff6ec4, #7873f5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(255, 110, 196, 0.7);
    z-index: 20;
    pointer-events: auto;
    transition: transform 0.2s;
}

/* Pause-Button auf Desktop ausblenden */
@media (min-width: 1024px) {
    #pauseButton {
        display: none;
    }
}

#pauseButton:hover {
    transform: scale(1.1);
}

/* Pause menu */
#pauseMenu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 25;
}

#pauseMenu h2 {
    font-size: 54px;
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 130, 220, 0.7);
}

#pauseMenu button {
    padding: 15px 30px;
    font-size: 26px;
    background: linear-gradient(45deg, #ff6ec4, #7873f5);
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    transition: transform 0.3s;
    box-shadow: 0 0 20px rgba(255, 110, 196, 0.7);
    margin: 10px 0;
}

#pauseMenu button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 110, 196, 0.9);
}

/* Loading indicator in pause menu */
#pauseLoadingIndicator {
    margin-bottom: 20px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #fff;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
}

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

/* Mobile joystick - now initially hidden */
#mobileJoystick {
    position: absolute;
    bottom: 80px;
    left: 80px;
    display: none; /* Initially hidden */
    z-index: 20;
    pointer-events: none;
}

#joystickBase {
    width: 120px;
    height: 120px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    position: relative;
    pointer-events: auto;
}

#joystickThumb {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #ff6ec4, #7873f5);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(255, 110, 196, 0.7);
}

/* Credits screen - made scrollable for mobile */
#creditsScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 30;
    opacity: 0;
    transition: opacity 0.5s ease;
    overflow-y: auto; /* Enable scrolling */
}

#creditsScreen.visible {
    display: flex;
    opacity: 1;
}

.credits-content {
    position: relative;
    width: 80%;
    max-width: 1000px;
    background: linear-gradient(135deg,
                rgba(99, 29, 118, 0.7) 0%,
                rgba(214, 41, 65, 0.7) 100%);
    border-radius: 20px;
    padding: 40px;
    color: white;
    box-shadow: 0 0 40px rgba(214, 41, 65, 0.4);
    animation: creditsGlow 4s infinite alternate;
    max-height: 90vh;
    overflow-y: auto; /* Ensure content is scrollable if needed */
    margin: 20px 0; /* Add margin to ensure it's not flush with edges on mobile */
}

/* Song button in Game Over screen */
.song-button {
    display: inline-flex;
    align-items: center;
    margin-top: 20px;
    padding: 12px 25px;
    background: linear-gradient(45deg, #FDC840, #D62941);
    border-radius: 25px;
    color: white;
    text-decoration: none;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(253, 200, 64, 0.6);
}

.song-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 25px rgba(253, 200, 64, 0.8);
    background: linear-gradient(45deg, #D62941, #631D76);
}

.music-note {
    font-size: 24px;
    margin-right: 10px;
    animation: musicPulse 2s infinite alternate;
}

@keyframes musicPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.3); }
}

/* Media query for mobile devices - adjusted to fix overlapping UI */
@media (max-width: 768px) {
    /* Only show joystick when the game is active, not on start screen */
    body.game-active #mobileJoystick {
        display: block;
    }
    
    /* Adjust lyrics position for mobile screens */
    #lyrics {
        bottom: 180px; /* More space on mobile for joystick */
        max-width: 90%; /* Wider on mobile */
        font-size: 18px; /* Slightly smaller font */
    }
    
    /* Fix overlapping UI elements at the top */
    #score {
        top: 20px;
        left: 10px;
        font-size: 18px;
        padding: 8px;
        max-width: 40%;
    }
    
    .memory-counter {
        margin-right: 5px;
        padding: 4px 8px;
        font-size: 16px;
    }
    
    .memory-icon {
        width: 16px;
        height: 16px;
        margin-right: 5px;
    }
    
    /* Adjust pause button position */
    #pauseButton {
        top: 20px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
    
    /* Adjust lives container positioning */
    .lives-container {
        top: 70px; /* Move below score and pause button */
        right: 10px;
        padding: 6px 10px;
    }
    
    .life-icon {
        width: 28px;
        height: 28px;
        margin-left: 6px;
    }
    
    /* Make floating messages smaller on mobile */
    .floating-word {
        font-size: 20px;
    }
    
    .memory-tafel {
        width: 180px;
        height: 130px;
        font-size: 18px;
        top: 20% !important; /* Even higher on mobile */
    }
    
    /* Adjust game over and pause menu text sizes */
    .gameOverTitle {
        font-size: 40px;
    }
    
    #finalScore {
        font-size: 30px;
    }
    
    #pauseMenu h2 {
        font-size: 40px;
    }
    
    /* Better credits screen handling for mobile */
    .credits-content {
        width: 90%;
        padding: 30px 20px;
        margin: 10px 0;
    }
    
    .credits-layout {
        flex-direction: column;
    }
    
    .credits-cover img {
        max-width: 80%;
    }
    
    /* Song button adjustments for mobile */
    .song-button {
        padding: 10px 20px;
        font-size: 18px;
    }
}

/* Styles für die Lebensanzeige */
.lives-container {
    position: absolute;
    top: 20px;
    right: 70px; /* Moved from 20px to 70px to avoid overlap with pause button */
    display: flex;
    padding: 8px 12px;
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.4);
    align-items: center;
}

.life-icon {
    width: 32px;
    height: 32px;
    margin-left: 8px; /* Abstand nach links statt rechts */
    display: flex;
    justify-content: center;
    align-items: center;
    filter: drop-shadow(0 0 8px rgba(253, 200, 64, 0.5));
    transition: transform 0.3s ease;
}

/* Ersten Leben-Icon anders stylen (kein linker Margin) */
.life-icon:first-child {
    margin-left: 0;
}

.life-icon:hover {
    transform: scale(1.1);
}

.life-icon img {
    width: 100%;
    height: auto;
    transition: all 0.3s ease;
}

/* Animation für verlorene Leben */
@keyframes lostLife {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.7; }
    100% { transform: scale(0); opacity: 0; }
}

.life-icon.lost img {
    animation: lostLife 0.5s forwards;
}

/* Puls-Animation für den letzten Papierflieger wenn nur noch 1 Leben übrig ist */
@keyframes lastLifePulse {
    0% { filter: drop-shadow(0 0 5px rgba(214, 41, 65, 0.5)); }
    50% { filter: drop-shadow(0 0 12px rgba(214, 41, 65, 0.8)); }
    100% { filter: drop-shadow(0 0 5px rgba(214, 41, 65, 0.5)); }
}

.life-icon.last-life img {
    animation: lastLifePulse 1.5s infinite;
}

/* Animation für neu erhaltene Leben */
@keyframes extraLifeGlow {
    0% { filter: drop-shadow(0 0 5px rgba(253, 200, 64, 0.5)); }
    50% { filter: drop-shadow(0 0 20px rgba(253, 200, 64, 1)); }
    100% { filter: drop-shadow(0 0 5px rgba(253, 200, 64, 0.5)); }
}

.life-icon.extra-life img {
    animation: extraLifeGlow 1.5s;
}