/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Sections */
section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

section h2 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.8rem;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* Reaction Section */
.reaction-container {
    min-height: 200px;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    background: #f7fafc;
}

.equation {
    text-align: center;
    font-size: 1.3rem;
}

.equation p:first-child {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 5px;
}

/* Simulation Section */
.simulation-container {
    position: relative;
    background: #1a202c;
    border-radius: 10px;
    overflow: hidden;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#simulation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.magnesium-ribbon {
    position: absolute;
    width: 200px;
    height: 4px;
    background: linear-gradient(90deg, #c0c0c0, #e8e8e8, #c0c0c0);
    border-radius: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.magnesium-ribbon.burning {
    box-shadow: 0 0 20px #fff, 0 0 40px #fff, 0 0 60px #fff;
}

.flame-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
}

/* Flame effects */
.flame {
    position: absolute;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: radial-gradient(circle, #fff 0%, #ffeb3b 20%, #ff9800 40%, #f44336 70%, transparent 100%);
    animation: flicker 0.1s infinite alternate;
    filter: blur(1px);
}

@keyframes flicker {
    0% { transform: scale(1) rotate(-1deg); }
    100% { transform: scale(1.05) rotate(1deg); }
}

.flame.intense {
    background: radial-gradient(circle, #fff 0%, #fff 30%, #e3f2fd 60%, #bbdefb 80%, transparent 100%);
    box-shadow: 0 0 30px #fff, 0 0 60px #fff, 0 0 90px #fff;
    filter: blur(0.5px);
}

/* Particle effects */
.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
    pointer-events: none;
}

.spark {
    background: linear-gradient(45deg, #fff, #ffeb3b);
    box-shadow: 0 0 6px #fff;
}

.ash {
    background: #f5f5f5;
    opacity: 0.7;
}

/* Controls Section */
.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.btn-tertiary {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
}

.info-panel {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid #667eea;
}

.info-panel h3 {
    color: #4a5568;
    margin-bottom: 15px;
}

#info-display p {
    margin-bottom: 8px;
    font-size: 1rem;
}

#info-display span {
    font-weight: 600;
    color: #667eea;
}

/* Education Section */
.education-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.fact-box, .safety-box {
    padding: 20px;
    border-radius: 10px;
}

.fact-box {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border-left: 4px solid #2196f3;
}

.safety-box {
    background: linear-gradient(135deg, #fff3e0, #fce4ec);
    border-left: 4px solid #ff9800;
}

.fact-box h4, .safety-box h4 {
    margin-bottom: 15px;
    color: #4a5568;
}

.fact-box ul {
    list-style: none;
    padding-left: 0;
}

.fact-box li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.fact-box li::before {
    content: "⚗️";
    position: absolute;
    left: 0;
}

.safety-box p {
    font-weight: 500;
    color: #d84315;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .education-content {
        grid-template-columns: 1fr;
    }
    
    .controls {
        justify-content: center;
    }
    
    .simulation-container {
        height: 300px;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 20px #fff; }
    to { box-shadow: 0 0 40px #fff, 0 0 60px #fff; }
}

