* {
    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, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    min-height: 100vh;
    padding: 20px;
}

.doppler-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, #1e3c72 0%, #2a5298 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.3fr 0.7fr;
    gap: 30px;
    margin-bottom: 40px;
}

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

/* Visual Panel */
.visual-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
}

.visual-panel h3 {
    color: #1e3c72;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

#mainCanvas {
    width: 100%;
    height: 350px;
    background: linear-gradient(180deg, #87ceeb 0%, #e0f6ff 60%, #4a7c59 60%, #3d6b4f 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.info-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.info-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.info-item span:first-child {
    color: #555;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 5px;
}

.highlight {
    color: #e74c3c;
    font-weight: 700;
    font-size: 1.3rem;
}

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

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

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

.play-button {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
}

.stop-button {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    color: white;
}

.reset-button {
    background: linear-gradient(135deg, #7f8c8d 0%, #95a5a6 100%);
    color: white;
}

.play-button:hover:not(:disabled), .stop-button:hover:not(:disabled), .reset-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.icon {
    font-size: 1.2rem;
}

/* Sound Control */
.sound-control {
    margin-bottom: 25px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.toggle-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Speed & Frequency Controls */
.speed-control, .frequency-control, .sound-speed-control {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.speed-control h4, .frequency-control h4, .sound-speed-control h4 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.speed-control label, .frequency-control label, .sound-speed-control label {
    display: block;
    color: #555;
    margin-bottom: 10px;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #3498db 0%, #e74c3c 100%);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid #1e3c72;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid #1e3c72;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.mach-display {
    margin-top: 10px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 8px;
    text-align: center;
    color: #1e3c72;
    font-weight: 600;
}

/* Presets */
.presets-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.presets-section h4 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

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

.preset-btn {
    padding: 12px;
    border: 2px solid #1e3c72;
    background: white;
    color: #1e3c72;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #1e3c72;
    color: white;
}

/* Graph Section */
.graph-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 40px;
}

.graph-section h3 {
    color: #1e3c72;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

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

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

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* Formulas Section */
.formulas-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 40px;
}

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

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

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

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

.formula {
    font-size: 1.3rem;
    color: #1e3c72;
    font-weight: 600;
    text-align: center;
}

.formula-card.highlight {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

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

/* Explanation Section */
.explanation {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.explanation h3 {
    color: #2a5298;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

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

.wave-animation-explanation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 25px 0;
}

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

.explanation-card {
    padding: 20px;
    border-radius: 12px;
}

.explanation-card.approaching {
    background: linear-gradient(135deg, #ffe5e5 0%, #ffcccc 100%);
}

.explanation-card.receding {
    background: linear-gradient(135deg, #e5f0ff 0%, #cce5ff 100%);
}

.explanation-card h4 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.explanation-card.approaching h4 {
    color: #c0392b;
}

.explanation-card.receding h4 {
    color: #2980b9;
}

.explanation-card p {
    color: #555;
    line-height: 1.6;
}

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

.applications-list li {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 10px;
    border-left: 4px solid #1e3c72;
    color: #555;
    line-height: 1.7;
}

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

.tip-card {
    background: linear-gradient(135deg, #f0f4ff 0%, #e5eeff 100%);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #1e3c72;
}

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

.tip-card p {
    color: #555;
    line-height: 1.6;
}

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

    main {
        padding: 20px;
    }

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

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

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