/* 全局样式 - 现代化音乐应用设计 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2c3e50;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 1s ease-in-out;
}

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

/* 标题区域 */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #fff, #f8f9fa);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    font-weight: 700;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.usage-tip {
    margin-top: 15px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 主播放控制按钮 */
.main-controls {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.main-play-btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.3);
    min-width: 150px;
}

.main-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
    background: linear-gradient(45deg, #2ecc71, #27ae60);
}

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

.main-control-btn {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 25px;
    background: linear-gradient(45deg, #95a5a6, #bdc3c7);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.main-control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 信息面板 - 重新设计 */
.info-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.info-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.info-item {
    flex: 1;
    min-width: 120px;
}

.info-item label {
    font-size: 0.9rem;
    color: #7f8c8d;
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.info-item span {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    display: block;
    padding: 8px 12px;
    background: rgba(52, 73, 94, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(52, 73, 94, 0.1);
}

/* 图表容器 */
.chart-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    height: 500px;
}

.chart-container canvas {
    border-radius: 15px;
}

/* 简化的播放控制 */
.simple-controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    text-align: center;
}

/* 详细设置容器 */
.settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

/* 控制面板 - 现代化重设计 */
.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.control-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.control-section:hover {
    transform: translateY(-3px);
}

.control-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(45deg, #95a5a6, #bdc3c7);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.control-btn.primary {
    background: linear-gradient(45deg, #3498db, #2980b9);
}

.control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

.control-group {
    flex: 1;
    min-width: 200px;
}

.control-group.wide {
    min-width: 100%;
}

.control-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: #34495e;
    margin-bottom: 8px;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e0e0e0, #bdc3c7);
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #3498db, #2980b9);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.3);
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.5);
}

.control-group span {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #3498db;
    padding: 4px 8px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 6px;
    min-width: 50px;
    text-align: center;
}

/* 复选框样式 */
.checkbox-label {
    display: flex !important;
    align-items: center;
    cursor: pointer;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.checkbox-label:hover {
    background: rgba(52, 152, 219, 0.05);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    border-color: #27ae60;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: -1px;
    left: 3px;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* 钢琴键盘 - 增强样式 */
.piano-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow-x: auto;
}

.piano-keyboard {
    position: relative;
    display: flex;
    justify-content: center;
    min-width: 1200px;
    margin: 0 auto;
}

.white-keys-container {
    display: flex;
    position: relative;
}

.white-key {
    width: 40px;
    height: 200px;
    background: linear-gradient(180deg, #ffffff, #f8f9fa);
    border: 2px solid #e9ecef;
    border-radius: 0 0 8px 8px;
    margin-right: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 15px;
    font-size: 10px;
    color: #6c757d;
    font-weight: 500;
    position: relative;
    user-select: none;
}

.white-key:hover {
    background: linear-gradient(180deg, #f8f9fa, #e9ecef);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.white-key.active {
    background: linear-gradient(180deg, #3498db, #2980b9);
    color: white;
    transform: translateY(3px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
}

.black-key {
    width: 28px;
    height: 130px;
    background: linear-gradient(180deg, #2c3e50, #34495e);
    border: 2px solid #1a252f;
    border-radius: 0 0 6px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    z-index: 10;
    user-select: none;
}

.black-key:hover {
    background: linear-gradient(180deg, #34495e, #2c3e50);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.black-key.active {
    background: linear-gradient(180deg, #e74c3c, #c0392b);
    transform: translateY(2px);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

/* 统计面板 */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-3px);
}

.stat-item label {
    font-size: 0.9rem;
    color: #7f8c8d;
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-item span {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
}

/* 加载和错误状态 */
.loading-overlay, .audio-start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content, .audio-start-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.audio-start-content h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #2c3e50;
}

.start-audio-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.start-audio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.loading {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.3);
    z-index: 1000;
    max-width: 400px;
}

.error-content h3 {
    margin-bottom: 10px;
}

.error-content button {
    margin-top: 15px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.error-content button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 2rem;
    }

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

    .control-row {
        flex-direction: column;
        gap: 15px;
    }

    .info-panel {
        grid-template-columns: 1fr;
    }

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

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

    .black-key {
        width: 20px;
        height: 100px;
    }
}

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

    .control-section {
        padding: 15px;
    }

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

    .white-key {
        width: 25px;
        height: 120px;
        font-size: 8px;
    }

    .black-key {
        width: 18px;
        height: 80px;
        font-size: 7px;
    }
}

/* 动画效果 */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.playing-indicator {
    animation: pulse 1s infinite;
}

/* 音乐可视化效果 - 增强版 */
.rhythm-indicator {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 20px;
    border-radius: 4px;
    opacity: 0.8;
    animation: rhythmPulse 0.5s ease-in-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.rhythm-whole { 
    background: linear-gradient(45deg, #e74c3c, #c0392b); 
    animation: rhythmGlow 2s ease-in-out infinite;
}
.rhythm-half { 
    background: linear-gradient(45deg, #f39c12, #e67e22); 
    animation: rhythmGlow 1s ease-in-out infinite;
}
.rhythm-quarter { 
    background: linear-gradient(45deg, #f1c40f, #f39c12); 
    animation: rhythmGlow 0.5s ease-in-out infinite;
}
.rhythm-eighth { 
    background: linear-gradient(45deg, #27ae60, #2ecc71); 
    animation: rhythmGlow 0.25s ease-in-out infinite;
}
.rhythm-sixteenth { 
    background: linear-gradient(45deg, #3498db, #2980b9); 
    animation: rhythmGlow 0.125s ease-in-out infinite;
}
.rhythm-thirtysecond { 
    background: linear-gradient(45deg, #9b59b6, #8e44ad); 
    animation: rhythmGlow 0.0625s ease-in-out infinite;
}

@keyframes rhythmPulse {
    0% { transform: translateX(-50%) scale(0.8) translateY(10px); opacity: 0; }
    50% { transform: translateX(-50%) scale(1.1) translateY(-5px); opacity: 1; }
    100% { transform: translateX(-50%) scale(1) translateY(0); opacity: 0.8; }
}

@keyframes rhythmGlow {
    0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4); }
}

/* 蜡烛图增强效果 */
.candlestick-bull {
    filter: drop-shadow(0 2px 4px rgba(39, 174, 96, 0.3));
    animation: candleBullGlow 3s ease-in-out infinite;
}

.candlestick-bear {
    filter: drop-shadow(0 2px 4px rgba(231, 76, 60, 0.3));
    animation: candleBearGlow 3s ease-in-out infinite;
}

@keyframes candleBullGlow {
    0%, 100% { filter: drop-shadow(0 2px 4px rgba(39, 174, 96, 0.3)); }
    50% { filter: drop-shadow(0 4px 8px rgba(39, 174, 96, 0.5)); }
}

@keyframes candleBearGlow {
    0%, 100% { filter: drop-shadow(0 2px 4px rgba(231, 76, 60, 0.3)); }
    50% { filter: drop-shadow(0 4px 8px rgba(231, 76, 60, 0.5)); }
}

/* 当前播放位置增强指示 */
.current-position-marker {
    position: relative;
}

.current-position-marker::before {
    content: '♪';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    color: #ff6b6b;
    animation: musicNote 2s ease-in-out infinite;
    text-shadow: 0 2px 4px rgba(255, 107, 107, 0.5);
}

@keyframes musicNote {
    0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
    25% { transform: translateX(-50%) translateY(-5px) scale(1.1); }
    50% { transform: translateX(-50%) translateY(-10px) scale(1.2); }
    75% { transform: translateX(-50%) translateY(-5px) scale(1.1); }
}

/* 音频波形视觉效果 */
.audio-visualizer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(90deg, transparent 0%, rgba(52, 152, 219, 0.1) 50%, transparent 100%);
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.audio-wave {
    position: absolute;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, transparent, #3498db, transparent);
    animation: audioWave 0.5s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes audioWave {
    0%, 100% { height: 20px; }
    50% { height: 45px; }
}

/* 磨砂玻璃效果增强 */
.glass-panel {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.37),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* 悬浮效果增强 */
.hover-lift {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hover-lift:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 8px 25px rgba(0, 0, 0, 0.1);
}

/* 渐变文字效果 */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    font-weight: 700;
}

/* 节奏强度指示器 */
.intensity-meter {
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, 
        #27ae60 0%, 
        #f1c40f 50%, 
        #e74c3c 100%);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.intensity-indicator {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.2);
}

/* 专业级按钮动画 */
.control-btn-enhanced {
    position: relative;
    overflow: hidden;
}

.control-btn-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.control-btn-enhanced:hover::before {
    left: 100%;
}

/* 音乐理论可视化 */
.chord-visualization {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
}

.chord-note {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    animation: chordPulse 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chord-note.root { 
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    animation-delay: 0s;
}
.chord-note.third { 
    background: linear-gradient(45deg, #f39c12, #e67e22);
    animation-delay: 0.2s;
}
.chord-note.fifth { 
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    animation-delay: 0.4s;
}

@keyframes chordPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* 加载状态增强动画 */
.enhanced-loading {
    position: relative;
    width: 60px;
    height: 60px;
}

.enhanced-loading::before,
.enhanced-loading::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #3498db;
    animation: enhancedSpin 1.5s linear infinite;
}

.enhanced-loading::before {
    width: 60px;
    height: 60px;
    top: 0;
    left: 0;
}

.enhanced-loading::after {
    width: 40px;
    height: 40px;
    top: 10px;
    left: 10px;
    border-top-color: #e74c3c;
    animation-direction: reverse;
    animation-duration: 1s;
}

@keyframes enhancedSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}