* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    background: #ebebeb;
    color: #1e1e1e;
    overflow: hidden;
}

.app {
    width: 100%;
    height: 100vh;

    display: flex;
    flex-direction: column;
}

.header {
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
}

.header h1 {
    margin: 0;

    font-size: 18px;
    font-weight: 500;
}

.simulation-container {
    flex: 1;
    min-height: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 10px 20px;
}

#simulation {
    display: block;

    width: 100%;
    height: 100%;
}

.controls {
    width: 100%;

    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));

    gap: 8px 20px;

    padding: 8px 20px 0;

    flex-shrink: 0;
}

.control {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.control label {
    font-size: 13px;
    white-space: nowrap;
}

.control input[type="range"] {
    width: 100%;
    margin: 0;
    accent-color: #286edc;
}

.switch-container {
    grid-column: 1 / -1;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;

    gap: 8px 12px;

    font-size: 13px;
}

.switch {
    position: relative;

    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;

    background: #999;
    border-radius: 28px;
    cursor: pointer;
    transition: 0.2s;
}

.slider::before {
    content: "";

    position: absolute;

    width: 20px;
    height: 20px;

    left: 4px;
    top: 4px;

    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.switch input:checked + .slider {
    background: #28b45a;
}

.switch input:checked + .slider::before {
    transform: translateX(24px);
}

#resetButton,
#circleButton,
#gyroButton {
    padding: 6px 16px;

    font-size: 13px;
    font-family: inherit;
    color: #fff;

    background: #286edc;
    border: none;
    border-radius: 6px;

    cursor: pointer;
    touch-action: manipulation;
}

#resetButton:hover,
#circleButton:hover,
#gyroButton:hover {
    background: #1f5bbb;
}

#resetButton:active,
#circleButton:active,
#gyroButton:active {
    background: #184a99;
}

#gyroButton.active {
    background: #28b45a;
}

footer {
    text-align: center;

    font-size: 12px;
    color: #555;

    padding: 4px 10px 8px;

    flex-shrink: 0;
}

@media (max-width: 650px) {

    body {
        overflow: auto;
    }

    .app {
        height: auto;
        min-height: 100vh;
    }

    .simulation-container {
        height: 55vh;
        flex: none;
        padding: 5px 10px;
    }

    .controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));

        gap: 8px 14px;
        padding: 8px 14px;
    }

    .control label {
        white-space: normal;
        font-size: 12px;
    }

    .switch-container {
        grid-column: 1 / -1;
        justify-content: center;
    }

    footer {
        padding-bottom: 12px;
    }
}
