/* 在线钢琴样式 */

/* 钢琴控制面板 */
.piano-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

.control-select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 150px;
}

.control-range {
    width: 100px;
}

.octave-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.octave-btn {
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.octave-btn:hover {
    background-color: #e0e0e0;
}

.record-controls {
    display: flex;
    gap: 10px;
}

.record-btn, .play-btn, .save-btn {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.record-btn {
    background-color: #fff;
}

.record-btn.recording {
    background-color: #ff5252;
    color: white;
}

.record-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ff5252;
}

.record-btn.recording .record-icon {
    background-color: white;
}

.play-btn {
    background-color: #f0f0f0;
}

.play-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.play-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #333;
}

.save-btn {
    background-color: #4CAF50;
    color: white;
}

.save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 钢琴键盘 */
.piano-container {
    overflow-x: auto;
    margin-bottom: 30px;
    padding: 20px 0;
    background-color: #222;
    border-radius: 8px;
}

.piano {
    display: flex;
    justify-content: center;
    position: relative;
    height: 180px;
    margin: 0 auto;
    min-width: 700px;
}

.piano-key {
    position: relative;
    cursor: pointer;
}

.piano-key.white {
    width: 40px;
    height: 180px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 0 0 4px 4px;
    z-index: 1;
}

.piano-key.black {
    width: 24px;
    height: 110px;
    background-color: black;
    border-radius: 0 0 4px 4px;
    z-index: 2;
    margin-left: -12px;
    margin-right: -12px;
}

.piano-key.active {
    background-color: #4CAF50;
}

.piano-key.white.active {
    background-color: #a7d7a9;
}

.piano-key.black.active {
    background-color: #2e7d32;
}

.key-label {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #666;
}

.piano-key.black .key-label {
    color: white;
    bottom: 5px;
    font-size: 10px;
}

/* 键盘映射 */
.keyboard-mapping {
    margin-bottom: 30px;
}

.mapping-container {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.keyboard-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.key {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-weight: bold;
    position: relative;
}

.key.black {
    background-color: #333;
    color: white;
}

.key.active {
    background-color: #4CAF50;
    color: white;
}

/* 简谱示例 */
.sheet-music-section {
    margin-bottom: 30px;
}

.sheet-music-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tab-btn {
    padding: 8px 15px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab-btn.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.sheet-music-container {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sheet-music {
    display: none;
}

.sheet-music.active {
    display: block;
}

.sheet-music h4 {
    margin-top: 0;
    margin-bottom: 15px;
    text-align: center;
}

.notation {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.notation-line {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.note {
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 50%;
    font-weight: bold;
}

.play-song-btn {
    display: block;
    margin: 0 auto;
    padding: 8px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.play-song-btn:hover {
    background-color: #45a049;
}

/* 使用说明 */
.instructions-section {
    margin-bottom: 30px;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.instruction-item {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.instruction-item h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.instruction-item p {
    margin: 0;
    color: #666;
    line-height: 1.5;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .piano-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .control-group {
        width: 100%;
    }
    
    .control-range {
        flex: 1;
    }
    
    .record-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .keyboard-row {
        flex-wrap: wrap;
    }
    
    .instructions-grid {
        grid-template-columns: 1fr;
    }
}