* {
    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;
}

.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;
}

.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: 10px;
    margin-bottom: 20px;
}

.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: 12px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    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: 8px 12px;
    font-size: 0.95em;
    font-weight: bold;
    color: #333;
    min-width: 180px;
}

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

.remove-term-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.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);
}

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

.calculation-formula {
    font-size: 1.5em;
    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.1em;
    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);
}

.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%; }
