* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#game-canvas {
    background: linear-gradient(180deg, #0f0f23 0%, #1a1a3e 100%);
    border: 2px solid #4a4a8a;
    border-radius: 8px;
}

#piano {
    display: flex;
    position: relative;
    height: 150px;
}

.key {
    cursor: pointer;
    transition: background 0.1s;
}

.key.white {
    width: 50px;
    height: 150px;
    background: linear-gradient(180deg, #fff 0%, #e8e8e8 100%);
    border: 1px solid #999;
    border-radius: 0 0 6px 6px;
    z-index: 1;
}

.key.white:hover,
.key.white.active {
    background: linear-gradient(180deg, #ddd 0%, #ccc 100%);
}

.key.black {
    width: 30px;
    height: 100px;
    background: linear-gradient(180deg, #333 0%, #000 100%);
    border-radius: 0 0 4px 4px;
    margin-left: -15px;
    margin-right: -15px;
    z-index: 2;
}

.key.black:hover,
.key.black.active {
    background: linear-gradient(180deg, #555 0%, #222 100%);
}

.key.hit {
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%) !important;
}

#ui {
    display: flex;
    align-items: center;
    gap: 30px;
}

#scores {
    display: flex;
    gap: 20px;
    color: #fff;
}

#score {
    font-size: 24px;
    font-weight: bold;
}

#high-score {
    font-size: 16px;
    color: #fbbf24;
}

#last-score {
    font-size: 16px;
    color: #888;
}

#start-btn {
    padding: 12px 30px;
    font-size: 18px;
    background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

#start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

#start-btn:active {
    transform: translateY(0);
}

#start-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#level-control {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

#level-selector {
    display: flex;
    gap: 5px;
}

.level-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #4a4a8a;
    background: transparent;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.level-btn:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.2);
}

.level-btn.active {
    background: #6366f1;
    border-color: #6366f1;
}

.level-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#level-name {
    color: #888;
    font-size: 14px;
    min-width: 70px;
}

/* Mobile styles */
@media (max-width: 650px) {
    body {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }

    #game-container {
        width: 100%;
        gap: 15px;
    }

    #game-canvas {
        width: 100%;
        max-width: 100%;
        height: auto;
    }

    #piano {
        height: 120px;
        justify-content: center;
    }

    .key.white {
        width: 40px;
        height: 120px;
    }

    .key.black {
        width: 24px;
        height: 80px;
        margin-left: -12px;
        margin-right: -12px;
    }

    #ui {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    #scores {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    #score {
        font-size: 20px;
    }

    #high-score,
    #last-score {
        font-size: 14px;
    }

    #level-control {
        flex-wrap: wrap;
        justify-content: center;
    }

    #level-name {
        width: 100%;
        text-align: center;
        min-width: auto;
    }

    #start-btn {
        width: 100%;
        max-width: 200px;
        padding: 15px 30px;
        font-size: 16px;
    }
}

/* Prevent zoom on double-tap for piano keys */
.key {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Larger touch targets on mobile */
@media (max-width: 650px) {
    .level-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* Hide black keys on mobile - not used in game */
    .key.black {
        display: none;
    }

    /* Make white keys bigger without black keys */
    .key.white {
        width: calc((100vw - 40px) / 7);
        max-width: 50px;
    }
}
