body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    text-align: center;
    max-width: 900px;
    width: 100%;
}

.sequence-player {
    background-color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.sequence-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 15px;
}

.sequence-form label {
    font-weight: bold;
    margin-bottom: 5px;
    text-align: left;
    color: #444;
}

#sequence-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: monospace;
    font-size: 16px;
    resize: vertical;
}

.sequence-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

#play-speed {
    width: 150px;
}

#speed-value {
    min-width: 60px;
    text-align: left;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2rem;
}

.piano {
    background-color: #222;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

.keys {
    position: relative;
    display: flex;
    height: 180px;
}

.key {
    position: relative;
    cursor: pointer;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 10px;
    box-sizing: border-box;
}

.key.white {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 0 0 5px 5px;
    flex: 1;
    z-index: 1;
    height: 100%;
    color: #333;
}

.key.black {
    background-color: #111;
    border-radius: 0 0 4px 4px;
    width: 36px;
    height: 60%;
    margin-left: -18px;
    margin-right: -18px;
    z-index: 2;
    color: white;
}

.key.white.active {
    background-color: #e0e0e0;
}

.key.black.active {
    background-color: #444;
}

.note-name {
    font-size: 12px;
    margin-bottom: 5px;
}

.key-label {
    font-size: 14px;
    font-weight: bold;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    padding: 2px 5px;
}

.key.black .key-label {
    background-color: rgba(255, 255, 255, 0.2);
}

.controls {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.volume-control, .instrument-select {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-control label, .instrument-select label {
    font-weight: bold;
    min-width: 70px;
}

input[type="range"] {
    width: 150px;
}

select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    background-color: white;
}

.keyboard-help, .key-history {
    margin-top: 20px;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    background-color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.keyboard-help h2, .key-history h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.keyboard-help h3 {
    margin-top: 10px;
    margin-bottom: 5px;
    font-size: 16px;
    color: #444;
}

.keyboard-map {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.octave-group {
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
    border-left: 3px solid #3498db;
}

.note {
    margin-top: 15px;
    font-style: italic;
    color: #777;
    font-size: 13px;
    text-align: center;
}

#key-history-container {
    min-height: 40px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.history-key {
    display: inline-block;
    padding: 5px 10px;
    margin: 3px;
    background-color: #e0e0e0;
    border-radius: 3px;
    font-size: 12px;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.history-key.white {
    background-color: #fff;
    border: 1px solid #ddd;
}

.history-key.black {
    background-color: #333;
    color: white;
}

.scroll-hint {
    display: none;
    text-align: center;
    color: #777;
    font-style: italic;
    font-size: 12px;
    margin: 5px 0;
}

/* Mobile-specific styles */
@media (max-width: 900px) {
    .keyboard-map {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Apply scrolling only on mobile */
    .piano {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .keys {
        min-width: 1200px; /* Only apply fixed width on mobile */
        height: 140px;
    }
    
    .key.black {
        width: 28px;
        margin-left: -14px;
        margin-right: -14px;
    }
    
    .note-name {
        font-size: 10px;
    }
    
    .key-label {
        font-size: 12px;
    }
    
    .keyboard-help {
        font-size: 12px;
    }
    
    /* Show scroll hint on mobile */
    .scroll-hint {
        display: block;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        max-width: 100%;
    }

    .keyboard-map {
        grid-template-columns: 1fr;
    }

    .sequence-player {
        padding: 15px;
    }

    .sequence-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .sequence-controls > * {
        width: 100%;
        margin: 5px 0;
    }

    .btn {
        width: 100%;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .volume-control, .instrument-select {
        justify-content: space-between;
        width: 100%;
    }

    input[type="range"] {
        width: 65%;
    }

    .keyboard-help, .key-history {
        padding: 15px;
        font-size: 13px;
    }
}