/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.piano-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    overflow: hidden;
}

/* 控制面板样式 */
.controls {
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.control-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.control-group label {
    margin-bottom: 5px;
    font-weight: bold;
}

.control-group input[type="range"] {
    width: 100%;
}

.control-group.buttons {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

button, select {
    padding: 8px 12px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #357abd;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

select {
    background-color: #fff;
    color: #333;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 4px;
    margin-top: 5px;
}

/* 加载指示器 */
.loading-text {
    font-size: 14px;
    color: #4a90e2;
    margin-top: 5px;
    height: 20px;
    font-weight: bold;
}

/* 音源控制 */
#oscillator-controls,
#sample-controls {
    margin-top: 10px;
}

/* 活动区域指示器 */
.active-keys {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.active-area {
    padding: 5px 10px;
    border-radius: 4px;
    background-color: #eee;
    font-size: 14px;
}

.active-area.active {
    background-color: #4a90e2;
    color: white;
}

/* 音符显示 */
.note-display {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    height: 24px;
}

/* 钢琴键盘容器 */
.piano-keyboard-container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 20px;
    padding-bottom: 10px;
}

/* 钢琴键盘 */
.piano-keyboard {
    display: flex;
    position: relative;
    height: 180px;
    min-width: max-content;
    background-color: #222;
    padding: 5px;
    border-radius: 8px;
}

/* 钢琴键 */
.piano-key {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s ease;
}

/* 白键 */
.white-key {
    width: 40px;
    height: 170px;
    background: linear-gradient(to bottom, #fff 0%, #f9f9f9 100%);
    border: 1px solid #ccc;
    border-radius: 0 0 5px 5px;
    z-index: 1;
    color: #333;
}

.white-key:hover {
    background: linear-gradient(to bottom, #f9f9f9 0%, #eee 100%);
}

.white-key.active {
    background: linear-gradient(to bottom, #e6f0ff 0%, #b3d1ff 100%);
    transform: translateY(2px);
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
}

/* 黑键 */
.black-key {
    width: 24px;
    height: 100px;
    background: linear-gradient(to bottom, #333 0%, #000 100%);
    border: 1px solid #000;
    border-radius: 0 0 3px 3px;
    margin-left: -12px;
    margin-right: -12px;
    z-index: 2;
    color: #fff;
}

.black-key:hover {
    background: linear-gradient(to bottom, #444 0%, #222 100%);
}

.black-key.active {
    background: linear-gradient(to bottom, #666 0%, #444 100%);
    transform: translateY(2px);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
}

/* 键盘映射指南 */
.keyboard-guide {
    margin-top: 20px;
    text-align: center;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
}

.keyboard-guide h3 {
    margin-bottom: 10px;
    color: #333;
}

.keyboard-guide p {
    margin-bottom: 5px;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .control-panel {
        flex-direction: column;
        align-items: center;
    }
    
    .control-group {
        width: 100%;
        max-width: 300px;
    }
    
    .white-key {
        width: 30px;
    }
    
    .black-key {
        width: 20px;
        margin-left: -10px;
        margin-right: -10px;
    }
}

@media (max-width: 480px) {
    .white-key {
        width: 25px;
    }
    
    .black-key {
        width: 16px;
        margin-left: -8px;
        margin-right: -8px;
    }
    
    .piano-keyboard {
        height: 150px;
    }
    
    .white-key {
        height: 140px;
    }
    
    .black-key {
        height: 80px;
    }
}