body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2), 0 0 100px rgba(42, 82, 152, 0.3);
    max-width: 1200px;
    width: 90%;
    backdrop-filter: blur(10px);
}

h1 {
    text-align: center;
    color: #1e3c72;
    margin: 0 0 30px 0;
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.main-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.left-panel {
    flex: 1;
}

.simulation-wrapper {
    position: relative;
    background: #1a1a2e;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 20px;
}

#plinkoCanvas {
    display: block;
    margin: 0 auto;
    border-radius: 10px;
}

.stats {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 5px 0;
}

.stat-item span:last-child {
    font-weight: bold;
    color: #4a90e2;
}

.controls {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    width: 350px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.control-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    gap: 8px;
}

.control-group label {
    color: #555;
    font-weight: 500;
    margin-bottom: 5px;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #4a90e2;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4a90e2;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: none;
}

.control-group span {
    text-align: center;
    font-weight: bold;
    color: #4a90e2;
    font-size: 1.1em;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
}

.btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-start {
    background: #4a90e2;
    color: white;
}

.btn-start:hover:not(:disabled) {
    background: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.btn-stop {
    background: #e74c3c;
    color: white;
}

.btn-stop:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.btn-reset {
    background: #95a5a6;
    color: white;
}

.btn-reset:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(149, 165, 166, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.histogram {
    background: #1a1a2e;
    border-radius: 10px;
    padding: 10px;
    border: 1px solid #2a2a3e;
}

#histogramCanvas {
    display: block;
    margin: 0 auto;
    width: 600px;
    height: 150px;
}

@media (max-width: 968px) {
    .main-layout {
        flex-direction: column;
    }
    
    .controls {
        width: 100%;
        position: static;
        order: -1;
        margin-bottom: 20px;
    }
    
    .button-group {
        flex-direction: row;
    }
    
    .container {
        padding: 20px;
        width: 95%;
    }
}

@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}