* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;

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

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:
        linear-gradient(
            145deg,
            #111827,
            #020617
        );

    color: white;
}


.app {
    width: min(92vw, 430px);

    background: rgba(255, 255, 255, 0.07);

    border: 1px solid rgba(255, 255, 255, 0.12);

    border-radius: 28px;

    padding: 28px;

    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.45);
}


h1 {
    margin: 0;

    text-align: center;

    font-size: 27px;

    font-weight: 600;
}


.status {
    margin-top: 10px;

    text-align: center;

    font-size: 17px;

    opacity: 0.8;
}


#state {
    margin-top: 5px;

    text-align: center;

    font-size: 26px;

    font-weight: 700;
}


/* Garage */

.garage {
    position: relative;

    height: 240px;

    margin: 30px 0;

    background: #111827;

    border: 8px solid #374151;

    border-bottom-width: 12px;

    border-radius: 12px 12px 4px 4px;

    overflow: hidden;
}


.interior {
    position: absolute;

    inset: 0;

    display: flex;

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

    padding-bottom: 18px;

    font-size: 14px;

    opacity: 0.35;
}


.door {
    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    height: 100%;

    background:
        repeating-linear-gradient(
            to bottom,
            #d1d5db 0px,
            #d1d5db 43px,
            #9ca3af 44px,
            #9ca3af 46px
        );

    transform: translateY(0);
}


.door.closed {
    animation: none;
    transform: translateY(0);
}


.door.open {
    animation: none;
    transform: translateY(-88%);
}


.door.partial {
    animation: none;
    transform: translateY(-44%);
}


.door.unknown {
    animation: none;
    transform: translateY(-44%);
}


.door.sensor_error {
    animation: none;
    transform: translateY(-44%);
}


.door.opening {
    animation:
        doorOpening
        15s
        linear
        forwards;
}


.door.closing {
    animation:
        doorClosing
        15s
        linear
        forwards;
}


.door.moving {
    animation:
        doorMoving
        1.5s
        ease-in-out
        infinite
        alternate;
}

@keyframes doorMoving {

    from {
        transform: translateY(-25%);
    }

    to {
        transform: translateY(-65%);
    }
}


@keyframes doorClosing {

    from {
        transform: translateY(-88%);
    }

    to {
        transform: translateY(0);
    }
}


@keyframes unknownMovement {

    from {
        transform: translateY(-35%);
    }

    to {
        transform: translateY(-55%);
    }
}


/* Sensors */

.sensors {
    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 12px;

    margin-bottom: 22px;
}


.sensor {
    padding: 13px;

    background:
        rgba(255, 255, 255, 0.07);

    border-radius: 14px;

    text-align: center;

    font-size: 13px;
}


.sensor-value {
    display: block;

    margin-top: 4px;

    font-size: 15px;

    font-weight: 700;
}


/* Button */

button {
    width: 100%;

    border: none;

    border-radius: 16px;

    padding: 18px;

    font-size: 18px;

    font-weight: 700;

    cursor: pointer;

    background: white;

    color: #111827;

    transition:
        transform 0.1s ease,
        opacity 0.2s ease;
}


button:active {
    transform: scale(0.98);
}


button:disabled {
    opacity: 0.45;
    cursor: default;
}


.footer {
    margin-top: 16px;

    text-align: center;

    font-size: 12px;

    opacity: 0.45;
}