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

body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.2em;
    opacity: 0.95;
}

.content {
    padding: 40px;
}

.rules-section {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 40px;
}

.rules-section h2 {
    color: #2d3436;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.rule-box {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 5px solid #e17055;
}

.rule-box:last-child {
    margin-bottom: 0;
}

.rule-box h3 {
    color: #e17055;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.rule-box p {
    color: #2d3436;
    line-height: 1.8;
    font-size: 1.05em;
}

.rule-formula {
    background: #2d3436;
    color: #ffeaa7;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    text-align: center;
    font-weight: bold;
}

.section-title {
    font-size: 1.8em;
    color: #333;
    margin: 40px 0 25px 0;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
}

.intervals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.interval-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
    cursor: pointer;
}

.interval-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    border-color: #667eea;
}

.interval-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ebf5 100%);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

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

.interval-title {
    font-size: 1.3em;
    color: #333;
    font-weight: bold;
}

.interval-ratio {
    background: #667eea;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1em;
}

.interval-info {
    margin-bottom: 15px;
}

.interval-notes {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 5px;
}

.interval-desc {
    color: #555;
    line-height: 1.6;
}

.harmony-stars {
    margin: 10px 0;
}

.star {
    color: #ffd700;
    font-size: 1.2em;
}

.star.empty {
    color: #ddd;
}

.play-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.play-btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95em;
}

.play-btn-single {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.play-btn-interval {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.play-btn.playing {
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
}

.calculator-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 40px;
}

.calculator-title {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 25px;
    text-align: center;
}

.calculator-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.interval-selector {
    background: white;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 15px 20px;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 150px;
    text-align: center;
}

.interval-selector:hover {
    background: #667eea;
    color: white;
}

.operator-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.4);
}

.operator-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.6);
}

.operator-btn.selected {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.equals-sign {
    font-size: 3em;
    color: #667eea;
    font-weight: bold;
}

.calculation-display {
    background: white;
    border: 3px solid #667eea;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
}

.calculation-formula {
    font-size: 1.8em;
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-family: 'Courier New', monospace;
}

.calculation-steps {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 15px;
}

.calculation-step {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #555;
    font-family: 'Courier New', monospace;
}

.calculation-result {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 20px;
}

.result-play-btn {
    background: white;
    color: #00b894;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s;
}

.result-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.examples-section {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: 30px;
    border-radius: 15px;
    margin-top: 40px;
}

.examples-section h3 {
    color: #2e7d32;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.example-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 5px solid #4caf50;
}

.example-card h4 {
    color: #2e7d32;
    margin-bottom: 10px;
}

.example-formula {
    background: #f1f8f4;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    margin: 10px 0;
}

.example-explanation {
    color: #555;
    line-height: 1.6;
    margin-top: 10px;
}

.try-it-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s;
}

.try-it-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.4);
}

.expression-display {
    background: white;
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 30px;
    min-height: 120px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.empty-expression {
    color: #999;
    font-size: 1.2em;
}

.term-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.term-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.term-operator {
    font-size: 1.8em;
    color: #667eea;
    font-weight: bold;
    margin: 0 5px;
}

.term-select {
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 1em;
    font-weight: bold;
    color: #333;
    min-width: 200px;
}

.operator-select {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
}

.remove-term-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s;
}

.remove-term-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.control-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.add-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.clear-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.calc-btn {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
}

.control-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.audio-playback-fallback { margin-top: 20px; padding: 16px; background: #fff; color: #333; border: 2px solid #667eea; border-radius: 10px; }
.audio-playback-fallback p { margin-bottom: 10px; }
.audio-playback-fallback audio { display: block; width: 100%; }
