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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

header h1 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 2.5rem;
    font-weight: 300;
    text-align: center;
}

header p {
    color: #718096;
    margin-bottom: 20px;
    font-size: 1rem;
    text-align: center;
}

.controls {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.settings-row {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.number-selector,
.speed-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f7fafc;
    padding: 10px 15px;
    border-radius: 20px;
    border: 2px solid #e2e8f0;
}

.number-selector select,
.speed-selector select {
    padding: 5px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    color: #4a5568;
    cursor: pointer;
}

.animation-mode {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f7fafc;
    padding: 10px 15px;
    border-radius: 20px;
    border: 2px solid #e2e8f0;
}

.setting-label {
    font-weight: 600;
    color: #4a5568;
    margin-right: 5px;
    white-space: nowrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: #718096;
    cursor: pointer;
    transition: color 0.2s ease;
}

.radio-label:hover {
    color: #4a5568;
}

.radio-label input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.controls button {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.start-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.start-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.run-again-btn {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
}

.run-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(237, 137, 54, 0.4);
}

.reset-btn {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(66, 153, 225, 0.4);
}

.rotate-btn {
    background: linear-gradient(135deg, #9f7aea, #805ad5);
    color: white;
}

.rotate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(159, 122, 234, 0.4);
}

.rotate-btn.active {
    background: linear-gradient(135deg, #38a169, #2f855a);
}

.scene-container {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    min-height: 600px;
}

#threeContainer {
    flex: 1;
    background: #f7fafc;
    border-radius: 15px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.rung-controls {
    width: 250px;
    background: #f7fafc;
    border-radius: 15px;
    padding: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.rung-controls h3 {
    color: #4a5568;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.1rem;
}

#rungControlsContainer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rung-level {
    background: white;
    border-radius: 10px;
    padding: 10px;
    border: 2px solid #e2e8f0;
}

.rung-level-title {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.rung-toggles {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.rung-toggle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #a0aec0;
    background: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: #718096;
}

.rung-toggle:hover {
    border-color: #718096;
    background: #cbd5e0;
    transform: scale(1.1);
}

.rung-toggle.active {
    background: #48bb78;
    border-color: #38a169;
    color: white;
}

.status {
    background: #edf2f7;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}

.status p {
    color: #4a5568;
    font-size: 0.9rem;
    margin: 0;
    text-align: center;
}

.info-panel {
    background: #ebf8ff;
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid #4299e1;
}

.info-panel h3 {
    color: #2b6cb0;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.info-panel p {
    color: #2c5282;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

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

.fade-out {
    animation: fadeOut 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.8); }
}

/* Responsive design */
@media (max-width: 900px) {
    .scene-container {
        flex-direction: column;
    }
    
    .rung-controls {
        width: 100%;
        order: -1;
    }
    
    #threeContainer {
        min-height: 400px;
    }
}

@media (max-width: 600px) {
    .container {
        margin: 10px;
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .settings-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .number-selector, 
    .animation-mode,
    .speed-selector {
        width: 100%;
        justify-content: center;
    }
    
    .buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .buttons button {
        width: 100%;
        max-width: 200px;
    }
}
