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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 600px;
    text-align: center;
    position: relative;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    margin-bottom: 20px;
}

.header-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.icon-btn:hover {
    background: #f8f9fa;
}

/* 通用 Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 40px;
    transition: opacity 0.3s ease;
    opacity: 1;
    pointer-events: auto;
    overflow-y: auto;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    width: 90%;
    max-width: 500px;
    background: white;
    padding-bottom: 40px;
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.overlay-header h2 {
    font-size: 22px;
    color: #2c3e50;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #6c757d;
    cursor: pointer;
    padding: 0 10px;
    line-height: 1;
}

/* 设置面板样式 */
.settings-content {
    max-width: 400px;
}

.setting-group {
    margin-bottom: 25px;
    text-align: left;
}

.setting-label {
    font-size: 16px;
    color: #495057;
    margin-bottom: 10px;
    font-weight: 600;
    display: block;
}

.level-select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ced4da;
    background-color: white;
    font-size: 16px;
}

.title {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 700;
}

.subtitle {
    color: #6c757d;
    font-size: 16px;
    margin-bottom: 20px;
}

/* 等级显示区域 */
.level-container {
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.level-info {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
}

.current-level {
    color: #007bff;
    font-size: 24px;
    margin: 0 5px;
}

.interval-type {
    color: #28a745;
    font-size: 16px;
}

/* 显示区域 */
.display-area {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.correct-state {
    border-color: #28a745;
    background-color: #f0fff4;
}

/* 五线谱显示区域 */
.stave-container {
    width: 100%;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-top: 10px;
    transition: opacity 0.3s ease;
}

.stave {
    width: 100%;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden-stave {
    opacity: 0;
    visibility: hidden;
}

.hidden-info {
    opacity: 0;
    visibility: hidden;
}

/* 音频控制按钮 */
.audio-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.audio-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2);
}

.audio-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.3);
}

.audio-btn:active {
    transform: translateY(0);
}

.play-main-btn {
    background: #6f42c1;
    box-shadow: 0 4px 6px rgba(111, 66, 193, 0.2);
}

.play-main-btn:hover {
    background: #59359a;
    box-shadow: 0 6px 12px rgba(111, 66, 193, 0.3);
}

/* 选择题区域 */
.options-container {
    margin-bottom: 20px;
}

.options {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 12px;
}

.option-btn {
    flex: 1;
    min-width: 100px;
    background: white;
    border: 2px solid #007bff;
    padding: 15px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #007bff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-btn:hover {
    background: #f0f7ff;
    transform: translateY(-2px);
}

.option-btn:active {
    transform: translateY(0);
}

/* 错误反馈动画关键帧 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes highlightCorrect {
    0% { transform: scale(1); box-shadow: none; }
    50% { transform: scale(1.05); box-shadow: 0 0 15px rgba(40, 167, 69, 0.4); }
    100% { transform: scale(1); box-shadow: none; }
}

/* 错误反馈状态 */
.option-btn.error {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
    animation: shake 0.4s ease-in-out;
}

.option-btn.correct-highlight {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.3) !important;
    transform: scale(1.02) !important;
    transition: all 0.3s ease !important;
    animation: highlightCorrect 0.6s ease-in-out;
}

.option-btn.disabled {
    background: #f8f9fa !important;
    border-color: #dee2e6 !important;
    color: #adb5bd !important;
    cursor: not-allowed !important;
    opacity: 0.7;
}

/* 反馈区域 */
.feedback {
    min-height: 40px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 700;
    padding: 10px;
    border-radius: 8px;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback.wrong {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 进度条显示 */
.progress-container {
    margin-bottom: 20px;
}

.progress-text {
    font-size: 16px;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: left;
}

.progress-bar-container {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* 进度条颜色类 */
.progress-bar.red {
    background: linear-gradient(90deg, #dc3545, #c82333);
}

.progress-bar.orange {
    background: linear-gradient(90deg, #fd7e14, #e8590c);
}

.progress-bar.green {
    background: linear-gradient(90deg, #28a745, #20c997);
}

/* 音程信息显示 */
.interval-info {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    font-size: 16px;
    color: #495057;
}

.interval-info div {
    flex: 1;
    text-align: center;
}

#current-interval {
    font-weight: 700;
    color: #007bff;
}

#accuracy-rate {
    font-weight: 700;
    color: #28a745;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: 20px;
        width: 95%;
    }
    
    .title {
        font-size: 24px;
    }
    
    .options {
        flex-direction: column;
    }
    
    .audio-controls {
        flex-wrap: wrap;
    }
    
    .interval-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .stave-container {
        min-height: 200px;
    }
}

/* 音符连线样式 */
.note-connection {
    stroke: #007bff;
    stroke-width: 2;
    fill: none;
}

.note-connection.higher {
    stroke: #28a745;
}

.note-connection.lower {
    stroke: #dc3545;
}

.note-connection.same {
    stroke: #6c757d;
    stroke-dasharray: 5,5;
}
