* {
    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, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    padding: 20px;
}

.echo-reverb-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, #1a1a2e 0%, #16213e 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;
    }
}

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

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

#roomCanvas {
    width: 100%;
    height: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
}

.room-info {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.room-stat {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #2c3e50;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

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

.playback-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.play-button, .stop-button {
    flex: 1;
    padding: 12px 20px;
    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 4px 12px rgba(102, 126, 234, 0.4);
}

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

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

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

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

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

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

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

.room-parameters {
    margin-bottom: 20px;
}

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

.parameter-group {
    margin-bottom: 15px;
}

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

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

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

.parameter-hint {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 5px;
}

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

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

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.preset-btn {
    padding: 10px 15px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #2c3e50;
}

.preset-btn:hover {
    border-color: #667eea;
    background: #f0f3ff;
}

.calculations-section {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

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

.calc-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

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

.calc-item {
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
}

.calc-item span:first-child {
    display: block;
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

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

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

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

#waveformCanvas {
    width: 100%;
    height: 200px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
}

.waveform-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #2c3e50;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.direct-sound {
    background: #27ae60;
}

.reflected-sound {
    background: #e74c3c;
}

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

.timeline-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.timeline-number {
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.timeline-info {
    flex: 1;
}

.timeline-type {
    font-weight: 600;
    color: #2c3e50;
}

.timeline-delay {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.timeline-amplitude {
    font-weight: 600;
    color: #667eea;
}

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

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

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

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

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

.formula-card.highlight h4,
.formula-card.highlight .formula-variables {
    color: white;
}

.formula-card h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1rem;
}

.formula {
    font-size: 1.3rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
}

.formula-card.highlight .formula {
    color: white;
}

.formula-variables {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.formula-explanation {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

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

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

.explanation h3 {
    color: #34495e;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

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

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

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

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

.tip-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    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: #555;
    line-height: 1.6;
    font-size: 0.95rem;
}

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

    main {
        padding: 20px;
    }

    .preset-buttons {
        grid-template-columns: 1fr;
    }
}
