/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    min-height: 100vh;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
}

/* 顶部导航 */
.header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
}

.logo i {
    font-size: 2rem;
    color: #fff;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-tabs {
    display: flex;
    gap: 1rem;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: #fff;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 主内容区域 */
.main-content {
    padding: 2rem;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 练习控制面板 */
.practice-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.song-selector label,
.mode-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

#songSelect {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#songSelect:focus {
    outline: none;
    border-color: #667eea;
}

.mode-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mode-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.7rem;
    border: 2px solid #e9ecef;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.mode-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.mode-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: #fff;
}

.audio-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.control-btn {
    padding: 0.8rem 1rem;
    border: none;
    background: #667eea;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.control-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.control-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
}

.tempo-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tempo-control label {
    font-weight: 600;
    color: #333;
}

#tempoSlider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    cursor: pointer;
}

#tempoSlider::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    appearance: none;
}

/* 乐谱显示 */
.score-container {
    background: #fff;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    min-height: 300px;
}

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

.score-placeholder {
    text-align: center;
    color: #adb5bd;
}

.score-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 钢琴键盘 */
.piano-container {
    background: #fff;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.piano-keyboard {
    display: flex;
    height: 200px;
    min-width: 1200px;
    justify-content: center;
    position: relative;
}

.white-key {
    width: 40px;
    height: 200px;
    background: #fff;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
    font-size: 12px;
    color: #666;
    position: relative;
}

.white-key:hover {
    background: #f8f9fa;
}

.white-key.active {
    background: #667eea;
    color: #fff;
}

.white-key.detected {
    background: #28a745;
    color: #fff;
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.5);
}

.black-key {
    width: 24px;
    height: 120px;
    background: #333;
    cursor: pointer;
    transition: all 0.1s ease;
    position: absolute;
    z-index: 2;
    border-radius: 0 0 3px 3px;
}

.black-key:hover {
    background: #555;
}

.black-key.active {
    background: #667eea;
}

.black-key.detected {
    background: #28a745;
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.5);
}

/* 反馈面板 */
.feedback-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.feedback-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.feedback-item label {
    font-weight: 600;
    color: #333;
}

.feedback-item span {
    font-weight: 500;
    color: #667eea;
}

/* 视唱练耳样式 */
.solfege-header {
    text-align: center;
    margin-bottom: 2rem;
}

.solfege-header h2 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 2.2rem;
}

.solfege-header p {
    color: #666;
    font-size: 1.1rem;
}

.solfege-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.solfege-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.solfege-card:hover {
    transform: translateY(-5px);
}

.card-header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #fff;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-header i {
    font-size: 1.8rem;
}

.card-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
}

.card-content {
    padding: 2rem;
}

.solfege-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.solfege-controls select {
    padding: 0.7rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.start-btn {
    padding: 0.8rem 1.5rem;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

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

/* 音准指示器 */
.pitch-indicator {
    margin: 1.5rem 0;
    text-align: center;
}

.pitch-meter {
    width: 200px;
    height: 20px;
    background: linear-gradient(to right, #dc3545 0%, #ffc107 45%, #28a745 50%, #ffc107 55%, #dc3545 100%);
    border-radius: 10px;
    margin: 0 auto 0.5rem;
    position: relative;
    overflow: hidden;
}

.pitch-needle {
    width: 3px;
    height: 20px;
    background: #333;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: left 0.2s ease;
}

.pitch-labels {
    display: flex;
    justify-content: space-between;
    width: 200px;
    margin: 0 auto;
    font-size: 0.8rem;
    color: #666;
}

/* 听谱训练 */
.listen-area {
    margin-top: 1rem;
}

.play-sequence-btn {
    background: #17a2b8;
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.play-sequence-btn:hover:not(:disabled) {
    background: #138496;
    transform: translateY(-2px);
}

.play-sequence-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

.note-input-area p {
    margin-bottom: 1rem;
    font-weight: 500;
    color: #333;
}

.note-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.note-btn {
    padding: 0.8rem 1rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 60px;
}

.note-btn:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.note-btn.selected {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.input-sequence {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    min-height: 50px;
    border: 2px dashed #e9ecef;
}

.submit-btn, .clear-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-right: 0.5rem;
    transition: all 0.3s ease;
}

.submit-btn {
    background: #28a745;
    color: #fff;
}

.submit-btn:hover {
    background: #218838;
}

.clear-btn {
    background: #6c757d;
    color: #fff;
}

.clear-btn:hover {
    background: #5a6268;
}

/* 音程训练 */
.interval-area {
    margin-top: 1rem;
}

.interval-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.interval-btn {
    padding: 0.8rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 0.9rem;
}

.interval-btn:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.interval-btn.correct {
    background: #28a745;
    color: #fff;
    border-color: #28a745;
}

.interval-btn.incorrect {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

/* 节拍训练 */
.rhythm-controls {
    display: flex;
    gap: 2rem;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tempo-setting {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tempo-setting label {
    font-weight: 600;
}

.time-signature {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-signature label {
    font-weight: 600;
}

.time-signature select {
    padding: 0.7rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #fff;
}

.metronome-visual {
    text-align: center;
    margin: 2rem 0;
}

.beats-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.beat-indicator {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #666;
    transition: all 0.1s ease;
}

.beat-indicator.active {
    background: #667eea;
    color: #fff;
    transform: scale(1.2);
}

.rhythm-practice {
    text-align: center;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
}

/* 进度跟踪样式 */
.progress-header {
    text-align: center;
    margin-bottom: 3rem;
}

.progress-header h2 {
    color: #333;
    font-size: 2.2rem;
    margin-bottom: 2rem;
}

.progress-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.summary-card {
    background: #fff;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
}

.summary-card h3 {
    color: #666;
    margin-bottom: 1rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.summary-card span {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
}

.progress-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.chart-container {
    background: #fff;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.chart-container h3 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}

/* 成就系统 */
.achievements {
    background: #fff;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.achievements h3 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
    font-size: 1.5rem;
}

.achievement-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    color: #fff;
}

.achievement-item .icon {
    width: 50px;
    height: 50px;
    background: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
}

.achievement-item.unlocked .icon {
    background: #ffd700;
    color: #333;
}

/* 音乐理论样式 */
.theory-header {
    text-align: center;
    margin-bottom: 3rem;
}

.theory-header h2 {
    color: #333;
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

.theory-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.theory-card {
    background: #fff;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.theory-card:hover {
    transform: translateY(-5px);
}

.theory-card h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.theory-card p {
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.theory-btn {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
}

.theory-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

/* 结果显示 */
.result-display {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

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

.result-display.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .nav-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-content {
        padding: 1rem;
    }

    .practice-controls {
        grid-template-columns: 1fr;
    }

    .audio-controls {
        justify-content: center;
    }

    .mode-buttons {
        flex-direction: column;
    }

    .solfege-modes {
        grid-template-columns: 1fr;
    }

    .piano-keyboard {
        min-width: 800px;
    }

    .progress-summary {
        grid-template-columns: 1fr;
    }

    .progress-charts {
        grid-template-columns: 1fr;
    }

    .rhythm-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.4rem;
    }

    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .piano-keyboard {
        min-width: 600px;
    }

    .white-key {
        width: 30px;
        height: 150px;
    }

    .black-key {
        width: 18px;
        height: 90px;
    }

    .note-buttons {
        justify-content: center;
    }

    .interval-options {
        grid-template-columns: repeat(2, 1fr);
    }
}