/* Credits Menu Styles */
.credits-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, 
        rgba(5, 5, 5, 0.95) 0%, 
        rgba(15, 8, 18, 0.95) 50%, 
        rgba(20, 10, 25, 0.95) 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 19000; /* Above main menu (18000) to show as overlay */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.credits-overlay.active {
    display: flex;
    opacity: 1;
}

.credits-container {
    position: relative;
    width: 95vw;
    max-width: 1400px;
    height: 95vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
}

/* Book background */
.credits-book-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.9;
    pointer-events: none;
    z-index: 1;
}

/* Back button */
.credits-back {
    position: absolute;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.3) 0%, rgba(75, 0, 130, 0.4) 100%);
    border: 2px solid rgba(138, 43, 226, 0.6);
    color: #dda0dd;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(14px, 1.5vw, 18px);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: var(--cm-cursor-action, pointer);
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
}

.credits-back:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.5) 0%, rgba(75, 0, 130, 0.6) 100%);
    border-color: rgba(138, 43, 226, 0.8);
    transform: translateX(-2px);
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.3);
}

.back-arrow {
    font-size: 20px;
}

.back-text {
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Scroll area */
.credits-scroll-area {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding: 80px 60px 150px 60px;
    box-sizing: border-box;
}

.credits-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
    transition: transform 0.1s linear;
}

/* Logo container */
.credits-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0 60px 0;
}

.credits-logo {
    max-width: min(90vw, 700px);
    max-height: min(35vh, 280px);
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 30px rgba(138, 43, 226, 0.8))
            drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.9))
            drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.7));
    animation: logoGlow 3s ease-in-out infinite alternate;
}

@keyframes logoGlow {
    from {
        filter: drop-shadow(0 0 25px rgba(138, 43, 226, 0.6))
                drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.9))
                drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.7));
    }
    to {
        filter: drop-shadow(0 0 35px rgba(221, 160, 221, 0.9))
                drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.9))
                drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.7));
    }
}

/* Credits sections */
.credits-section {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.credits-section-title {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(24px, 3vw, 36px);
    color: #8a2be2;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.9),
        3px 3px 6px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(138, 43, 226, 0.6);
    border-bottom: 2px solid rgba(138, 43, 226, 0.4);
    padding-bottom: 10px;
    width: 100%;
    text-align: center;
}

.credits-members {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
}

/* Member entry */
.credits-member {
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 20px;
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.6) 0%, 
        rgba(138, 43, 226, 0.2) 50%, 
        rgba(75, 0, 130, 0.3) 100%);
    border: 2px solid rgba(138, 43, 226, 0.4);
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.credits-member:hover:where(body:not(.gamepad-active) *) {
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.5) 0%, 
        rgba(138, 43, 226, 0.3) 50%, 
        rgba(75, 0, 130, 0.4) 100%);
    border-color: rgba(138, 43, 226, 0.6);
    transform: translateX(10px);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.credits-member-sprite {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(138, 43, 226, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.credits-member-sprite img {
    width: 96px;
    height: 96px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 10px rgba(138, 43, 226, 0.5));
}

.credits-member-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.credits-member-name {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(18px, 2vw, 24px);
    color: #dda0dd;
    font-weight: bold;
    text-shadow: 
        2px 2px 3px rgba(0, 0, 0, 0.9),
        3px 3px 5px rgba(0, 0, 0, 0.7),
        0 0 10px rgba(221, 160, 221, 0.5);
}

.credits-member-role {
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(14px, 1.5vw, 18px);
    color: #b88fd9;
    opacity: 0.95;
    text-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.8),
        2px 2px 4px rgba(0, 0, 0, 0.6);
}

/* Footer */
.credits-footer {
    margin-top: 80px;
    text-align: center;
    color: #b88fd9;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(12px, 1.5vw, 16px);
    opacity: 0.9;
    padding-bottom: 120px;
    text-shadow: 
        1px 1px 3px rgba(0, 0, 0, 0.9),
        2px 2px 5px rgba(0, 0, 0, 0.7);
}

.credits-footer p {
    margin: 10px 0;
}

/* Control hints - Keyboard */
.credits-control-hints {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 100;
}

.credits-keyboard-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid rgba(138, 43, 226, 0.3);
}

.hint-key {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.3) 0%, rgba(75, 0, 130, 0.4) 100%);
    color: #dda0dd;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(12px, 1.4vw, 16px);
    font-weight: bold;
    padding: 5px 10px;
    border: 1px solid rgba(138, 43, 226, 0.5);
    border-radius: 4px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.hint-text {
    color: #999;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(12px, 1.3vw, 15px);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Gamepad hints */
.credits-gamepad-hints {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(138, 43, 226, 0.3);
}

.credits-hint-item {
    color: #999;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: clamp(12px, 1.2vw, 14px);
    display: flex;
    align-items: center;
    gap: 8px;
}

.credits-hint-gamepad {
    font-size: 16px;
    color: #8a2be2;
}

.credits-hint-gamepad-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #cc2222);
    color: #fff;
    font-family: 'SFPixelate', 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid #aa1111;
    border-radius: 50%;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.5),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
}

/* Responsive design */
@media (max-width: 1920px) {
    .credits-container {
        max-width: 1200px;
        max-height: 800px;
    }
    
    .credits-logo {
        max-width: min(80vw, 600px);
        max-height: min(30vh, 240px);
    }
    
    .credits-scroll-area {
        padding: 60px 40px 120px 40px;
    }
    
    .credits-member-sprite {
        width: 105px;
        height: 105px;
    }
    
    .credits-member-sprite img {
        width: 84px;
        height: 84px;
    }
}

@media (max-width: 1366px) {
    .credits-container {
        max-width: 1000px;
        max-height: 700px;
    }
    
    .credits-logo {
        max-width: min(70vw, 500px);
        max-height: min(28vh, 200px);
    }
    
    .credits-scroll-area {
        padding: 50px 30px 100px 30px;
    }
    
    .credits-member {
        padding: 15px;
        gap: 20px;
    }
    
    .credits-member-sprite {
        width: 90px;
        height: 90px;
    }
    
    .credits-member-sprite img {
        width: 72px;
        height: 72px;
    }
}

@media (max-width: 768px) {
    .credits-member {
        flex-direction: column;
        text-align: center;
    }
    
    .credits-member-info {
        align-items: center;
    }
}

/* Animations */
@keyframes creditsFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.credits-content > * {
    animation: creditsFadeIn 0.6s ease-out backwards;
}

.credits-content > *:nth-child(1) { animation-delay: 0.1s; }
.credits-content > *:nth-child(2) { animation-delay: 0.2s; }
.credits-content > *:nth-child(3) { animation-delay: 0.3s; }
.credits-content > *:nth-child(4) { animation-delay: 0.4s; }
.credits-content > *:nth-child(5) { animation-delay: 0.5s; }
.credits-content > *:nth-child(6) { animation-delay: 0.6s; }
.credits-content > *:nth-child(7) { animation-delay: 0.7s; }
.credits-content > *:nth-child(8) { animation-delay: 0.8s; }