* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

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

header p {
    color: #718096;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.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 {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f7fafc;
    padding: 10px 15px;
    border-radius: 20px;
    border: 2px solid #e2e8f0;
}

.number-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);
}

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

.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);
}

.clear-btn {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: white;
}

.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 101, 101, 0.4);
}

.ladder-container {
    background: #f7fafc;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

#ladderSvg {
    max-width: 100%;
    height: auto;
}

.rail {
    stroke: #4a5568;
    stroke-width: 3;
    stroke-linecap: round;
}

.number-circle {
    fill: #4299e1;
    stroke: #2b6cb0;
    stroke-width: 2;
}

.number-text {
    fill: white;
    font-size: 16px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: middle;
}

.rung-toggle {
    fill: #e2e8f0;
    stroke: #a0aec0;
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.2s ease;
    transform-origin: center;
}

.rung-toggle:hover {
    fill: #cbd5e0;
    stroke: #718096;
    stroke-width: 3;
}

.rung-toggle.active {
    fill: #48bb78;
    stroke: #38a169;
}

.rung {
    stroke: #48bb78;
    stroke-width: 4;
    stroke-linecap: round;
}

.animated-number {
    fill: #e53e3e;
    stroke: #c53030;
    stroke-width: 2;
}

.animated-number-text {
    fill: white;
    font-size: 14px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: middle;
}

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

.status p {
    color: #4a5568;
    font-size: 0.9rem;
    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: 600px) {
    .container {
        margin: 20px;
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .settings-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .number-selector, .animation-mode {
        width: 100%;
        justify-content: center;
    }
    
    .buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .buttons button {
        width: 100%;
        max-width: 200px;
    }
}
