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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000000;
    color: white;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

.ui-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 12px;
    min-width: 200px;
    backdrop-filter: blur(10px);
    z-index: 100;
    transition: opacity 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

h1 {
    font-size: 1.1rem;
    margin: 0 0 12px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

.controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    backdrop-filter: blur(5px);
}

button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}



main {
    position: relative;
    width: 100%;
    height: 100%;
}

#simulation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: rgba(0, 0, 0, 0.1);
}

.stats-panel {
    padding: 0;
    min-width: auto;
}

.ui-toggle-corner {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ui-hidden .ui-toggle-corner {
    opacity: 1;
    pointer-events: all;
    animation: fadeInPulse 0.5s ease-out;
}

@keyframes fadeInPulse {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.ui-toggle-corner button {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(15px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    line-height: 1;
    letter-spacing: -1px;
}

.ui-toggle-corner button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.15);
    color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.ui-toggle-corner button:active {
    transform: scale(1.05);
    transition: all 0.1s ease;
}

.ui-hidden .ui-panel {
    opacity: 0;
    pointer-events: none;
}



.stats-panel h3 {
    margin: 0 0 8px 0;
    text-align: center;
    font-size: 0.9rem;
}

#stats-display div {
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

#stats-display span {
    font-weight: bold;
    color: #4CAF50;
}

.params-panel {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.params-panel h3 {
    margin: 0 0 8px 0;
    text-align: center;
    font-size: 0.9rem;
}

.slider-group {
    margin-bottom: 8px;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.8);
}

.slider-group input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #66BB6A;
}

@media (max-width: 768px) {
    main {
        flex-direction: column;
    }

    #simulation-canvas {
        width: 100%;
        height: auto;
    }
}