/* ================================================
   RETRO MODAL WINDOWS - SNES STYLE
   Chunky borders, flat colors, authentic retro feel
   ================================================ */

/* ================================================
   MODAL BACKGROUNDS (Full-Screen Overlays)
   ================================================ */
#characterModal,
#scoreboardModal,
#creditsModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px 10px;
}

/* ================================================
   MODAL CONTENT WINDOWS (SNES-style boxes)
   ================================================ */
.modal-content {
    background: #3a4466; /* SNES blue-gray */
    padding: 24px;
    border-radius: 0; /* No rounded corners! */
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    position: relative;
    
    /* CHUNKY SNES-STYLE BORDER */
    border: none;
    box-shadow: 
        /* Outer border - light */
        0 0 0 4px #6a7a9a,
        /* Middle border - medium */
        0 0 0 8px #4a5a7a,
        /* Inner border - dark */
        0 0 0 12px #2a3a5a,
        /* Bottom shadow for depth */
        0 12px 0 0 #1a2a4a,
        0 16px 0 0 #0a1a3a;
}

/* Alternative: If you want a lighter window style */
.modal-content.light-style {
    background: #d4d4e4;
    box-shadow: 
        0 0 0 4px #ffffff,
        0 0 0 8px #a4a4b4,
        0 0 0 12px #747484,
        0 12px 0 0 #545464,
        0 16px 0 0 #343444;
}

/* ================================================
   MODAL HEADINGS - SNES Menu Style
   ================================================ */
.modal-content h2,
.modal-content h3 {
    color: #ffffff;
    text-align: center;
    margin-bottom: 20px;
    padding: 12px;
    background: #2a3a5a;
    position: relative;
    
    /* Heading border */
    box-shadow: 
        0 0 0 2px #4a5a7a,
        0 4px 0 0 #1a2a4a;
}

#creditsModal h2,
#scoreboardModal h3 {
    background: #2a3a5a;
    color: #ffd700; /* Gold for special headings */
}

/* ================================================
   MODAL BUTTONS (Close, Mute, etc.)
   ================================================ */

/* Modal buttons container - side by side layout */
.modal-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 20px;
}

.modal-buttons button {
    flex: 1;
}

/* Mute button in modal - SNES style */
#modalMuteBtn {
    background: #5a6988 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 16px !important; /* Match close button padding */
    border-radius: 0 !important;
    cursor: pointer !important;
    transition: none !important;
    text-transform: lowercase !important;
    font-family: 'Press Start 2P', monospace !important;
    font-size: 12px !important; /* Match close button font size */
    font-weight: normal !important;
    letter-spacing: 0 !important;
    
    /* SNES chunky border - matching the close button style */
    box-shadow: 
        0 6px 0 #2a3344,
        0 -4px 0 #7a89a8,
        -4px 0 0 #4a5968,
        4px 0 0 #4a5968,
        -4px -4px 0 #6a7988,
        4px -4px 0 #6a7988,
        -4px 6px 0 #1a2334,
        4px 6px 0 #1a2334 !important;
}

#modalMuteBtn:hover {
    background: #00d4ff;
    color: #000000;
    box-shadow: 
        0 6px 0 #006a7f,
        0 -4px 0 #33e0ff,
        -4px 0 0 #00a0bf,
        4px 0 0 #00a0bf,
        -4px -4px 0 #00c4df,
        4px -4px 0 #00c4df,
        -4px 6px 0 #00505f,
        4px 6px 0 #00505f;
}

#modalMuteBtn:active {
    transform: translateY(4px);
    box-shadow: 
        0 2px 0 #2a3344,
        0 -4px 0 #7a89a8,
        -4px 0 0 #4a5968,
        4px 0 0 #4a5968;
}

/* Close button - green SNES style */
#closeModal {
    background: #2ecc71 !important;
    color: #ffffff !important; /* Match modal mute button text color */
    border: none !important;
    padding: 16px !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    transition: none !important;
    text-transform: lowercase !important;
    font-family: 'Press Start 2P', monospace !important;
    font-size: 12px !important;
    font-weight: normal !important;
    letter-spacing: 0 !important;
    
    /* SNES chunky border */
    box-shadow: 
        0 6px 0 #1a7a3a,
        0 -4px 0 #4edd91,
        -4px 0 0 #25a555,
        4px 0 0 #25a555,
        -4px -4px 0 #3ed771,
        4px -4px 0 #3ed771,
        -4px 6px 0 #0f5a2a,
        4px 6px 0 #0f5a2a !important;
}

#closeModal:hover {
    background: #27ae60;
    box-shadow: 
        0 6px 0 #156a30,
        0 -4px 0 #3ecd71,
        -4px 0 0 #1f9545,
        4px 0 0 #1f9545,
        -4px -4px 0 #2ebd61,
        4px -4px 0 #2ebd61,
        -4px 6px 0 #0a4a20,
        4px 6px 0 #0a4a20;
}

#closeModal:active {
    transform: translateY(4px);
    box-shadow: 
        0 2px 0 #1a7a3a,
        0 -4px 0 #4edd91,
        -4px 0 0 #25a555,
        4px 0 0 #25a555;
}

/* Credits button in scoreboard */
#creditsBtn {
    background: #2a3a5a;
    color: #ffd700;
    border: none;
    padding: 12px 24px;
    border-radius: 0;
    cursor: pointer;
    margin-top: 16px;
    transition: none;
    text-transform: lowercase;
    font-weight: normal;
    
    /* SNES chunky border */
    box-shadow: 
        0 0 0 2px #4a5a7a,
        0 4px 0 0 #1a2a4a;
}

#creditsBtn:hover {
    background: #4a5a7a;
    box-shadow: 
        0 0 0 2px #6a7a9a,
        0 4px 0 0 #2a3a5a;
}

/* Submit initials button */
#submitInitials {
    background: #2ecc71;
    color: #000000;
    border: none;
    padding: 12px 24px;
    border-radius: 0;
    cursor: pointer;
    margin-top: 16px;
    transition: none;
    text-transform: lowercase;
    font-weight: normal;
    
    /* SNES chunky border */
    box-shadow: 
        0 0 0 2px #4edd91,
        0 4px 0 0 #1a7a3a;
}

#submitInitials:hover {
    background: #27ae60;
    box-shadow: 
        0 0 0 2px #2ecc71,
        0 4px 0 0 #0a5a2a;
}

/* ================================================
   CHARACTER SELECTOR GRID
   ================================================ */
#characterGrid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px; /* Padding inside the scrollable area */
    padding-right: 8px; /* Less padding on right for scrollbar */
    
    /* Limit to 3 rows visible, then scroll */
    max-height: calc((100px + 16px + 16px + 4px) * 3 + 12px * 2 + 24px); 
    /* Calculation: (preview height + padding-top + padding-bottom + bottom shadow) * 3 rows + gap * 2 + extra padding */
    overflow-y: scroll; /* Changed from 'auto' to 'scroll' - always visible! */
    overflow-x: hidden;
    
    /* Retro inset border around the grid */
    background: #2a3a5a;
    box-shadow: 
        inset 3px 3px 0 #1a2a4a,
        inset -3px -3px 0 #3a4a6a;
    
    /* Firefox scrollbar - always visible */
    scrollbar-width: auto; /* Changed from 'thin' to 'auto' for chunky bar */
    scrollbar-color: #4a5a7a #1a2a4a;
}

/* Webkit browsers (Chrome, Safari, Edge) scrollbar styling - CHUNKY SNES STYLE */
#characterGrid::-webkit-scrollbar {
    width: 20px; /* Wider for that chunky retro feel */
}

#characterGrid::-webkit-scrollbar-track {
    background: #1a2a4a; /* Dark inset background */
    border: 3px solid #2a3a5a;
    border-radius: 0;
    
    /* Inset shadow effect like old scroll wells */
    box-shadow: 
        inset 2px 2px 0 #0a1a3a,
        inset -2px -2px 0 #3a4a6a;
}

#characterGrid::-webkit-scrollbar-thumb {
    background: #4a5a7a; /* Medium gray-blue */
    border: none;
    border-radius: 0; /* Square edges! */
    
    /* Chunky 3D button effect like SNES UI */
    box-shadow: 
        inset -2px -2px 0 #2a3a5a,    /* Bottom-right shadow (dark) */
        inset 2px 2px 0 #6a7a9a,      /* Top-left highlight (light) */
        inset -4px -4px 0 #1a2a4a,    /* Inner bottom shadow */
        inset 4px 4px 0 #7a89a8;      /* Inner top highlight */
}

#characterGrid::-webkit-scrollbar-thumb:hover {
    background: #5a6a8a; /* Slightly lighter on hover */
    
    /* Enhanced 3D effect on hover */
    box-shadow: 
        inset -2px -2px 0 #3a4a6a,
        inset 2px 2px 0 #7a8aaa,
        inset -4px -4px 0 #2a3a5a,
        inset 4px 4px 0 #8a99b8;
}

#characterGrid::-webkit-scrollbar-thumb:active {
    background: #3a4a6a; /* Darker when pressed */
    
    /* Inverted shadow when "pressed" */
    box-shadow: 
        inset 2px 2px 0 #1a2a4a,
        inset -2px -2px 0 #4a5a7a;
}

/* Scrollbar arrows/buttons - make them chunky boxes */
#characterGrid::-webkit-scrollbar-button {
    background: #4a5a7a;
    height: 20px;
    border: none;
    border-radius: 0;
    
    /* Same 3D effect as thumb */
    box-shadow: 
        inset -2px -2px 0 #2a3a5a,
        inset 2px 2px 0 #6a7a9a;
}

#characterGrid::-webkit-scrollbar-button:hover {
    background: #5a6a8a;
    box-shadow: 
        inset -2px -2px 0 #3a4a6a,
        inset 2px 2px 0 #7a8aaa;
}

#characterGrid::-webkit-scrollbar-button:active {
    background: #3a4a6a;
    box-shadow: 
        inset 2px 2px 0 #1a2a4a,
        inset -2px -2px 0 #4a5a7a;
}

.character-option {
    background: #2a3a5a;
    border: none;
    padding: 16px;
    border-radius: 0;
    cursor: pointer;
    text-align: center;
    transition: none;
    
    /* Chunky border for character boxes */
    box-shadow: 
        0 0 0 3px #4a5a7a,
        0 4px 0 0 #1a2a4a;
}

.character-option:hover {
    background: #4a5a7a;
    box-shadow: 
        0 0 0 3px #6a7a9a,
        0 4px 0 0 #2a3a5a;
}

.character-option.selected {
    background: #2ecc71;
    box-shadow: 
        0 0 0 3px #4edd91,
        0 4px 0 0 #1a7a3a;
}

.character-option.selected:hover {
    background: #27ae60;
}

.character-preview {
    width: 100px;
    height: 100px;
    margin: 0 auto 10px;
    position: relative;
    border: 2px solid #1a2a4a;
    background: #1a1a2e;
}

.character-name {
    color: #ffffff;
}

.character-option.selected .character-name {
    color: #000000;
    font-weight: normal;
}

/* ================================================
   SCOREBOARD / HIGH SCORES
   ================================================ */
#scoreboard {
    margin: 0;
    text-align: center;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: auto;
}

#scoreList {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    padding-bottom: 10px;
}

.scoreColumn {
    background: #2a3a5a;
    padding: 16px;
    border-radius: 0;
    flex: 1;
    min-width: 250px;
    max-width: 450px;
    
    /* Column borders */
    box-shadow: 
        0 0 0 2px #4a5a7a,
        0 4px 0 0 #1a2a4a;
}

.columnTitle {
    font-weight: normal;
    color: #ffd700;
    text-align: center;
    margin-bottom: 12px;
    padding: 8px;
    background: #1a2a4a;
    
    /* Title bar effect */
    box-shadow: 
        0 0 0 2px #2a3a5a;
}

.scoreEntry {
    padding: 10px;
    margin-bottom: 8px;
    background: #4a5a7a;
    border-radius: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    /* Entry borders */
    box-shadow: 
        0 0 0 2px #6a7a9a,
        inset 0 0 0 1px #3a4a6a;
}

.scoreEntry.newScore {
    background: #2ecc71;
    box-shadow: 
        0 0 0 2px #4edd91,
        inset 0 0 0 1px #1a7a3a;
    animation: none; /* Remove smooth animation */
}

.scoreEntry.newScore .scoreInitials,
.scoreEntry.newScore .scoreRank {
    color: #000000;
}

.scoreRank {
    font-weight: normal;
    color: #aaaaaa;
    min-width: 35px;
}

.scoreInitials {
    font-weight: normal;
    color: #ffffff;
    min-width: 50px;
}

.scoreValue {
    font-weight: normal;
    color: #ffd700;
}

/* ================================================
   CREDITS CONTENT
   ================================================ */
.credits-content {
    text-align: left;
    margin: 0 auto 30px;
    max-width: 600px;
}

.credits-content p {
    color: #ffffff;
    margin: 16px 0;
    padding: 16px;
    background: #2a3a5a;
    border-radius: 0;
    
    /* Credit box borders */
    box-shadow: 
        0 0 0 2px #4a5a7a,
        0 4px 0 0 #1a2a4a;
}

.credits-content strong {
    color: #ffd700;
    display: block;
    margin-bottom: 8px;
    text-transform: lowercase;
    font-weight: normal;
}

/* ================================================
   INITIALS PROMPT (High Score Entry)
   ================================================ */
#initialsPrompt {
    display: none;
    margin: 10px auto;
    padding: 20px;
    background: #3a4466;
    border: none;
    border-radius: 0;
    max-width: 500px;
    
    /* SNES-style border */
    box-shadow: 
        0 0 0 4px #6a7a9a,
        0 0 0 8px #4a5a7a,
        0 8px 0 0 #2a3a5a,
        0 12px 0 0 #1a2a4a;
}

#initialsPrompt h3 {
    color: #ffd700;
    margin-bottom: 16px;
    padding: 12px;
    background: #2a3a5a;
    
    /* Heading border */
    box-shadow: 
        0 0 0 2px #4a5a7a,
        0 4px 0 0 #1a2a4a;
}

/* ================================================
   TITLE OVERLAY (Start Screen)
   ================================================ */
#titleOverlay {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    text-align: center;
    background: #3a4466;
    padding: 30px 40px;
    border-radius: 0;
    
    /* SNES window border */
    box-shadow: 
        0 0 0 4px #6a7a9a,
        0 0 0 8px #4a5a7a,
        0 0 0 12px #2a3a5a,
        0 12px 0 0 #1a2a4a,
        0 16px 0 0 #0a1a3a;
}

#asciiTitle {
    font-family: monospace;
    color: #ffd700;
    margin: 0;
    line-height: 1.2;
    text-shadow: none;
    white-space: pre;
}

#titleMessage {
    color: #ffffff;
    margin-top: 20px;
    font-weight: normal;
}

/* ================================================
   READY OVERLAY (Instructions Screen)
   ================================================ */
#readyOverlay {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    text-align: center;
    background: #3a4466;
    padding: 40px 50px;
    border-radius: 0;
    
    /* SNES window border */
    box-shadow: 
        0 0 0 4px #6a7a9a,
        0 0 0 8px #4a5a7a,
        0 0 0 12px #2a3a5a,
        0 12px 0 0 #1a2a4a,
        0 16px 0 0 #0a1a3a;
}

#readyContent h2 {
    color: #ffd700;
    margin-bottom: 20px;
    padding: 12px;
    background: #2a3a5a;
    text-shadow: none;
    
    /* Heading border */
    box-shadow: 
        0 0 0 2px #4a5a7a,
        0 4px 0 0 #1a2a4a;
}

#readyContent p {
    color: #ffffff;
    margin: 10px 0;
}

#readyContent strong {
    color: #ffd700;
    font-weight: normal;
}

#readyMessage {
    color: #ffffff;
    margin-top: 30px;
    font-weight: normal;
}

/* ================================================
   GAME OVER OVERLAY
   ================================================ */
#gameOver {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: normal;
    color: #ff0000;
    background: #1a1a2e;
    padding: 30px 50px;
    border-radius: 0;
    text-shadow: none;
    z-index: 100;
    
    /* Red SNES border for danger! */
    box-shadow: 
        0 0 0 4px #ff3333,
        0 0 0 8px #cc0000,
        0 0 0 12px #990000,
        0 12px 0 0 #660000,
        0 16px 0 0 #330000;
    
    animation: none; /* Remove pulse animation */
}

/* ================================================
   MOBILE RESPONSIVE ADJUSTMENTS
   ================================================ */
@media (max-width: 768px) {
    .modal-content {
        padding: 20px 15px;
        width: 95%;
        box-shadow: 
            0 0 0 3px #6a7a9a,
            0 0 0 6px #4a5a7a,
            0 0 0 9px #2a3a5a,
            0 9px 0 0 #1a2a4a;
    }
    
    #characterGrid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .character-option {
        padding: 12px 8px;
    }
    
    .character-preview {
        width: 60px;
        height: 60px;
    }
    
    #titleOverlay,
    #readyOverlay {
        padding: 20px 25px;
        box-shadow: 
            0 0 0 3px #6a7a9a,
            0 0 0 6px #4a5a7a,
            0 0 0 9px #2a3a5a,
            0 9px 0 0 #1a2a4a;
    }
    
    /* Match button sizes on mobile */
    #modalMuteBtn,
    #closeModal {
        font-size: 10px;
        padding: 14px;
    }
}

@media (max-width: 480px) {
    #characterGrid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .scoreColumn {
        min-width: 200px;
    }
}

/* ================================================
   REMOVE SMOOTH ANIMATIONS
   ================================================ */
.modal-content,
.character-option,
.scoreEntry,
#titleOverlay,
#readyOverlay,
#gameOver {
    transition: none !important;
    animation: none !important;
}

/* ================================================
   DESIGN NOTES
   ================================================ */
/*
   Color Palette (SNES Blue-Gray Theme):
   - Background: #3a4466 (main window)
   - Dark: #2a3a5a (inner elements)
   - Medium: #4a5a7a (borders)
   - Light: #6a7a9a (outer borders)
   - Accent: #ffd700 (gold for important text)
   - Success: #2ecc71 (green for selected/new scores)
   - Danger: #ff0000 (red for game over)
   
   Border Style:
   - 3-5 nested borders using box-shadow
   - Light to dark gradient (outside to inside)
   - Bottom shadow for depth
   - No rounded corners (sharp pixel edges)
*/