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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

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

.header {
    text-align: center;
    margin-bottom: 30px;
}

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

.header p {
    color: #7f8c8d;
    font-size: 1.2rem;
}

.lab-scene {
    position: relative;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 50%, #F0F8FF 100%);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    min-height: 600px;
    overflow: hidden;
}

/* Allow UI controls to be clickable above the 3D scene */
#threejs-container {
    pointer-events: none;
}

/* Window styling */
.window {
    position: absolute;
    top: 20px;
    right: 30px;
    width: 200px;
    height: 150px;
}

.window-frame {
    width: 100%;
    height: 100%;
    background: #8B4513;
    border-radius: 10px;
    padding: 10px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 5px;
}

.window-pane {
    background: linear-gradient(45deg, #87CEEB, #B0E0E6);
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.window-pane::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 50%);
}

/* Sunlight beam */
.sunlight-beam {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 100px solid transparent;
    border-right: 100px solid transparent;
    border-top: 300px solid rgba(255, 255, 0, 0.2);
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

.sunlight-beam.active {
    opacity: 1;
    animation: sunlightPulse 3s ease-in-out infinite;
}

@keyframes sunlightPulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.4; }
}

/* Lab table */
.lab-table {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 200px;
    background: linear-gradient(to bottom, #D2B48C, #DEB887);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* China dish */
.china-dish {
    position: relative;
    width: 120px;
    height: 120px;
}

.dish-rim {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 8px solid #F5F5DC;
    border-radius: 50%;
    box-shadow: 
        inset 0 0 20px rgba(0,0,0,0.1),
        0 5px 15px rgba(0,0,0,0.2);
}

.dish-bottom {
    position: absolute;
    top: 8px;
    left: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    background: radial-gradient(circle, #FFFFFF 0%, #F8F8FF 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

/* Silver chloride sample */
.silver-chloride {
    width: 60px;
    height: 60px;
    background: #FFFFFF;
    border-radius: 50%;
    position: relative;
    transition: background-color 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.agcl-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(240,240,240,0.6) 100%);
    transition: all 0.5s ease;
}

/* Sample label */
.sample-label {
    position: absolute;
    bottom: 50px;
    right: -80px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
    font-weight: bold;
}

.label-line {
    width: 40px;
    height: 2px;
    background: #2c3e50;
}

/* Control panel */
.control-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(255,255,255,0.9);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 10;
}

.control-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn.primary {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.control-btn.primary:hover {
    background: linear-gradient(45deg, #2980b9, #1f5f8b);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.control-btn.secondary {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
}

.control-btn.secondary:hover {
    background: linear-gradient(45deg, #7f8c8d, #6c7b7d);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(149, 165, 166, 0.4);
}

.control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.time-display {
    text-align: center;
    font-size: 1.1rem;
    color: #2c3e50;
}

#timeCounter {
    font-weight: bold;
    color: #e74c3c;
}

/* Information panel */
.info-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255,255,255,0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-width: 300px;
}

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

.color-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #34495e;
}

.color-sample {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #bdc3c7;
}

.color-sample.initial {
    background: #FFFFFF;
}

.color-sample.final {
    background: linear-gradient(45deg, #8e44ad, #9b59b6);
}

.reaction-equation {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.reaction-equation p {
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 5px;
}

.reaction-equation p:last-child {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 0;
}

/* Color change states */
.silver-chloride.stage-1 {
    background: linear-gradient(45deg, #FFFFFF, #F5F5F5);
}

.silver-chloride.stage-2 {
    background: linear-gradient(45deg, #F0F0F0, #E8E8E8);
}

.silver-chloride.stage-3 {
    background: linear-gradient(45deg, #D3D3D3, #C0C0C0);
}

.silver-chloride.stage-4 {
    background: linear-gradient(45deg, #A9A9A9, #808080);
}

.silver-chloride.stage-5 {
    background: linear-gradient(45deg, #8e44ad, #9b59b6);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .lab-scene {
        padding: 20px;
        min-height: 500px;
    }
    
    .window {
        width: 150px;
        height: 120px;
        top: 10px;
        right: 10px;
    }
    
    .lab-table {
        width: 300px;
        height: 150px;
    }
    
    .info-panel {
        position: static;
        margin-bottom: 20px;
        max-width: none;
    }
    
    .control-panel {
        position: static;
        margin-top: 20px;
    }
}

