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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.beat-frequency-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.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

main {
    padding: 40px;
}

.simulation-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 1024px) {
    .simulation-layout {
        grid-template-columns: 1fr;
    }
}

.waveform-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
}

.waveform-panel h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.wave-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .wave-row {
        grid-template-columns: 1fr;
    }
}

.wave-display {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wave-display h4 {
    color: #34495e;
    font-size: 1rem;
    margin-bottom: 10px;
}

.wave-display canvas {
    width: 100%;
    height: 100px;
    background: #fafafa;
    border-radius: 8px;
    display: block;
}

.wave-label {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.combined-wave {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.combined-wave h3 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.combined-wave canvas {
    width: 100%;
    height: 150px;
    background: #fafafa;
    border-radius: 8px;
    display: block;
}

.beat-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.beat-stat {
    font-size: 1rem;
    color: #34495e;
}

.beat-stat .highlight {
    color: #667eea;
    font-weight: 700;
    font-size: 1.2rem;
}

.envelope-display {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.envelope-display h4 {
    color: #34495e;
    font-size: 1rem;
    margin-bottom: 10px;
}

.envelope-display canvas {
    width: 100%;
    height: 120px;
    background: #fafafa;
    border-radius: 8px;
    display: block;
}

.envelope-info {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #7f8c8d;
    text-align: center;
}

.controls-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
}

.playback-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.play-button, .stop-button {
    flex: 1;
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.play-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.play-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.play-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stop-button {
    background: #e74c3c;
    color: white;
}

.stop-button:hover:not(:disabled) {
    background: #c0392b;
}

.stop-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.volume-control {
    margin-bottom: 25px;
}

.volume-control label {
    display: block;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 8px;
}

.volume-control input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.frequency-controls {
    margin-bottom: 25px;
}

.frequency-controls h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.frequency-group {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

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

.frequency-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.frequency-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.frequency-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.note-info {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.beat-summary {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    color: #2c3e50;
}

.beat-value {
    color: #667eea;
    font-weight: 700;
    font-size: 1.1rem;
}

.presets-section {
    margin-bottom: 25px;
}

.presets-section h4 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.preset-btn {
    padding: 10px 15px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.wave-type-control {
    margin-bottom: 25px;
}

.wave-type-control h4 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.wave-type-buttons {
    display: flex;
    gap: 8px;
}

.wave-type-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wave-type-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.wave-type-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

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

.formulas-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

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

.formula-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.formula-card h4 {
    color: #34495e;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.formula-card .formula {
    color: #667eea;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 600;
}

.formula-card.highlight {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 2px solid #667eea;
}

.formula-explanation {
    background: white;
    border-radius: 10px;
    padding: 15px;
    color: #555;
    line-height: 1.6;
}

.explanation {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
}

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

.explanation h3 {
    color: #34495e;
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.explanation p {
    color: #555;
    line-height: 1.7;
    margin-bottom: 15px;
}

.applications-list {
    list-style: none;
    padding: 0;
}

.applications-list li {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    color: #555;
    line-height: 1.6;
}

.applications-list li strong {
    color: #667eea;
}

.listening-tips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tip-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tip-card h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.tip-card p {
    color: #666;
    line-height: 1.6;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    main {
        padding: 20px;
    }

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

    .listening-tips {
        grid-template-columns: 1fr;
    }
}
