/* 音乐盒样式 */
.music-box-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
}

/* 控制面板样式 */
.music-controls {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    color: white;
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 150px;
}

.control-label {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
}

select, input[type="range"] {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

select:focus, input[type="range"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

select option {
    background: #6a11cb;
    color: white;
}

input[type="range"] {
    height: 6px;
    padding: 0;
    background: rgba(255, 255, 255, 0.3);
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.range-value {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    margin-top: 5px;
}

/* 可视化面板样式 */
.visualization-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.visualization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.visualization-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.visualization-controls {
    display: flex;
    gap: 10px;
}

.viz-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: #f0f2f5;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.viz-btn.active {
    background: #3498db;
    color: white;
}

.viz-btn:hover {
    background: #e0e0e0;
}

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

#visualizer {
    width: 100%;
    height: 150px;
    border-radius: 10px;
    background: #f8f9fa;
}

/* 钢琴样式 */
.piano-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

.piano {
    display: flex;
    position: relative;
    width: 100%;
    height: 200px;
    margin: 0 auto;
    user-select: none;
}

.piano-key {
    position: relative;
    cursor: pointer;
    transition: all 0.1s ease;
}

.white-key {
    flex: 1;
    height: 200px;
    background: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
    border: 1px solid #ccc;
    border-radius: 0 0 5px 5px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 15px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.white-key:hover {
    background: linear-gradient(to bottom, #f8f8f8 0%, #e8e8e8 100%);
}

.white-key.active {
    background: linear-gradient(to bottom, #e0e0e0 0%, #d0d0d0 100%);
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.black-key {
    width: 30px;
    height: 120px;
    background: linear-gradient(to bottom, #333 0%, #000 100%);
    border-radius: 0 0 3px 3px;
    position: absolute;
    z-index: 2;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 10px;
    color: #aaa;
    font-size: 12px;
}

.black-key:hover {
    background: linear-gradient(to bottom, #444 0%, #111 100%);
}

.black-key.active {
    background: linear-gradient(to bottom, #222 0%, #000 100%);
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.key-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.key-shortcut {
    font-size: 12px;
    color: #666;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.black-key .key-label {
    color: #ddd;
    font-size: 12px;
}

.black-key .key-shortcut {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
}

/* 输出区域样式 */
.output-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.output-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.output-content {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #666;
    text-align: center;
}

.note-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.note-name {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.note-frequency {
    font-size: 18px;
    color: #7f8c8d;
}

/* 键盘提示样式 */
.keyboard-hint {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.keyboard-hint kbd {
    display: inline-block;
    padding: 3px 6px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
    margin: 0 2px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .music-box-container {
        padding: 15px;
    }
    
    .control-row {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .control-group {
        width: 100%;
    }
    
    .piano {
        min-width: 100%;
        overflow-x: auto;
    }
    
    .white-key {
        width: 40px;
    }
    
    .black-key {
        width: 25px;
        margin-left: -12.5px;
    }
}

@media (max-width: 480px) {
    .white-key {
        width: 30px;
    }
    
    .black-key {
        width: 20px;
        margin-left: -10px;
    }
    
    .key-label {
        font-size: 12px;
    }
    
    .key-shortcut {
        font-size: 10px;
        padding: 1px 4px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .music-box-container {
        color: #e0e0e0;
    }
    
    .visualization-panel, 
    .piano-container,
    .output-panel {
        background: #2c3e50;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
    
    .visualization-title,
    .output-title {
        color: #ecf0f1;
    }
    
    .viz-btn {
        background: #34495e;
        color: #bdc3c7;
    }
    
    .viz-btn:hover {
        background: #4a5f7a;
    }
    
    #visualizer {
        background: #34495e;
    }
    
    .output-content {
        background: #34495e;
        color: #bdc3c7;
    }
    
    .note-name {
        color: #ecf0f1;
    }
    
    .keyboard-hint {
        background: #34495e;
        color: #bdc3c7;
    }
    
    .keyboard-hint kbd {
        background: #2c3e50;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
}