/* === BASE LAYOUT === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    overflow-y: auto;
    min-height: 100vh;
    background: #0a0a0a;
    font-family: 'Georgia', 'Times New Roman', serif;
    color: #e0d8c8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* === GAME WRAPPER / FRAME === */
#game-wrapper {
    position: relative;
    width: 480px;
    max-width: 100vw;
    border: 1px solid #40ffd0;
    box-shadow: 0 0 20px rgba(64, 255, 208, 0.3), inset 0 0 10px rgba(64, 255, 208, 0.1);
    overflow: hidden;
}

/* === FOOTER === */
#game-footer {
    width: 480px;
    max-width: 100vw;
    text-align: center;
    padding: 12px 8px;
}

.tip-jar-section {
    margin-top: 8px;
    text-align: center;
}

/* === CANVAS === */
#game-canvas {
    display: block;
    width: 100%;
    height: auto;
    z-index: 0;
}

@media (min-width: 769px) {
    #game-canvas {
        width: 100%;
        height: auto;
    }
}

/* === OVERLAYS === */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(5, 5, 15, 0.92);
    transition: opacity 0.4s ease;
}

.overlay.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

/* === MAIN MENU === */
#main-menu {
    background: url('../assets/images/title-bg.png') center center / cover no-repeat;
    background-color: rgba(5, 5, 15, 0.92);
}

#menu-logo {
    max-width: 80%;
    max-height: 45vh;
    width: auto;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px rgba(80, 200, 180, 0.3));
}

.game-title {
    font-size: 3rem;
    color: #6fe8d0;
    text-shadow: 0 0 20px rgba(80, 200, 180, 0.5);
    margin-bottom: 0.5rem;
    text-align: center;
}

.game-subtitle {
    font-size: 1.1rem;
    color: #7a9990;
    margin-bottom: 2rem;
    font-style: italic;
}

.menu-btn {
    font-family: 'Georgia', serif;
    font-size: 1.2rem;
    padding: 0.8rem 2rem;
    background: linear-gradient(180deg, #1a2f2a, #0f1f1a);
    color: #6fe8d0;
    border: 1px solid #3d7a6a;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-btn:hover {
    background: linear-gradient(180deg, #254a42, #1a2f2a);
    border-color: #5dbaa8;
    box-shadow: 0 0 15px rgba(93, 186, 168, 0.3);
}

.menu-btn:active {
    transform: scale(0.97);
}

/* === SCORE HUD (removed — not needed) === */
#score-hud {
    display: none;
}

/* === GET READY === */
#get-ready {
    background: rgba(5, 5, 15, 0.7);
}

.get-ready-text {
    font-size: 2.5rem;
    color: #6fe8d0;
    text-shadow: 0 0 25px rgba(80, 200, 180, 0.6);
    animation: pulseGlow 1s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    from { text-shadow: 0 0 15px rgba(80, 200, 180, 0.4); }
    to { text-shadow: 0 0 35px rgba(80, 200, 180, 0.8); }
}

/* === GAME OVER === */
#game-over h2 {
    font-size: 2rem;
    color: #40ffd0;
    font-style: italic;
    text-shadow: 0 0 15px rgba(64, 255, 208, 0.5);
    margin-bottom: 1rem;
}

.score-line {
    font-size: 1.3rem;
    margin: 0.3rem 0;
    color: #b0d8d0;
}

#game-over .menu-btn {
    margin-top: 1.5rem;
}

.new-best-text {
    font-size: 1.4rem;
    color: #40ffd0;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(64, 255, 208, 0.6);
    animation: pulse-best 1s ease-in-out infinite;
    margin-top: 0.5rem;
}

@keyframes pulse-best {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

/* === RESUME OVERLAY === */
#resume-overlay p {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #6fe8d0;
}

/* === PIANO KEYBOARD === */
#keyboard {
    position: absolute;
    bottom: 3%;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    max-width: 450px;
    height: 90px;
    z-index: 30;
    display: flex;
    align-items: flex-end;
    user-select: none;
    -webkit-user-select: none;
    background: linear-gradient(180deg, #0a1518, #061012);
    border: 2px solid #1a3a3a;
    border-radius: 4px;
    padding: 4px 3px;
    box-shadow: 0 0 10px rgba(40, 80, 80, 0.3), inset 0 0 8px rgba(0, 0, 0, 0.5);
}

#keyboard.disabled {
    pointer-events: none;
}

.key {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 6px;
    cursor: pointer;
    border-radius: 0 0 3px 3px;
    transition: background 0.1s ease, box-shadow 0.1s ease;
}

.key-white {
    flex: 1;
    height: 100%;
    background: linear-gradient(180deg, #c8c0a8, #b8ad94, #a89a80);
    border: 1px solid #3a3530;
    border-top: 2px solid #2a2a28;
    z-index: 1;
    /* Aged ivory texture via box shadow */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 -2px 3px rgba(255, 255, 240, 0.1);
}

.key-black {
    position: absolute;
    width: 9%;
    height: 62%;
    background: linear-gradient(180deg, #1a1028, #120a1e, #0a0612);
    border: 1px solid #2a1a3a;
    border-top: none;
    z-index: 2;
    border-radius: 0 0 3px 3px;
    justify-content: flex-end;
    box-shadow: inset 0 2px 4px rgba(60, 20, 80, 0.3);
}

.key-white:active,
.key-white.active {
    background: linear-gradient(180deg, #b8b098, #a89a80, #988a70);
}

.key-black:active,
.key-black.active {
    background: linear-gradient(180deg, #2a1838, #1a1028, #120a1e);
}

.key-label {
    display: none;
}

/* Note color highlight on press — dramatic glow */
.key.highlight {
    box-shadow: inset 0 0 30px var(--note-color), 0 0 20px var(--note-color), 0 0 40px var(--note-color);
    border-color: var(--note-color);
}

.key-white.highlight {
    background: linear-gradient(180deg, var(--note-color), #c8c0a8) !important;
}

.key-black.highlight {
    background: linear-gradient(180deg, var(--note-color), #1a1028) !important;
}

/* === MOBILE LAYOUT === */
@media (max-width: 768px) {
    #game-wrapper {
        width: 100vw;
        border: none;
        box-shadow: none;
    }

    #game-footer {
        width: 100vw;
    }

    #keyboard {
        position: fixed;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-width: none;
        height: 100px;
        border-top: 1px solid #2a2a3a;
        background: rgba(10, 10, 18, 0.95);
        padding: 4px;
    }

    .key-white {
        min-width: 44px;
    }

    .key-black {
        min-width: 30px;
        min-height: 44px;
    }

    .key-label {
        display: none;
    }

    #menu-logo {
        max-width: 90%;
        max-height: 35vh;
    }

    .game-title {
        font-size: 2rem;
    }

    .game-subtitle {
        font-size: 0.95rem;
    }
}

/* === LOAD ERROR === */
#load-error {
    margin-top: 1.5rem;
    text-align: center;
    color: #e84848;
}

#load-error .menu-btn {
    margin-top: 0.8rem;
}
