html {
    margin: 0;
    height: 100dvh;
    width: 100vw;
    display: grid;
    place-items: center;
    background: #000;
    overflow: hidden;
}

body {
    margin: 0;
    position: relative;
    aspect-ratio: 3 / 2;
    width: min(100vw, calc(100dvh * 1.5));
    background: url(./assets/unison.png) center / cover no-repeat;
}

.light-frame {
    background-color: black;
    width: 100%;
    display: flex;
    gap: 6%;
    top: 0;
    position: absolute;
    align-items: center;
    justify-content: space-around;
    padding: 6%;
    border-radius: 10px;
    z-index: 2;
    box-sizing: border-box;
}

.light-frame div {
    aspect-ratio: 1;
    width: 60%;
    height: auto;
    position: relative;
    border-radius: 9999px;
    background: transparent;
    flex: 0 0 auto;
}

.light-frame div::before {
    content: "";
    position: absolute;
    inset: 8%;
    border-radius: 9999px;
    background: currentColor;
    opacity: 0.3;
}

.light-frame div.active::before {
    opacity: 1;
    box-shadow: 0 0 14px currentColor, 0 0 36px 5px currentColor;
}

.red {
    color: #ff0101;
}

.yellow {
    color: #d9b300;
}

.green {
    color: #00bf00;
}

.pole {
    position: absolute;
    height: 100%;
    background-color: black;
    left: 50%;
    width: 10px;
    transform: translateX(-50%);
}

.car-light {
    aspect-ratio: 0.6;
    height: 44%;
    position: absolute;
    left: 37%;
    bottom: 29%;
}

.car-light .light-frame {
    aspect-ratio: 3.5;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-evenly;
    padding: 4%;
}

.pedestrian-light {
    aspect-ratio: 0.25;
    height: 27%;
    position: absolute;
    left: 3%;
    bottom: 29%;
}

.pedestrian-light .light-frame {
    aspect-ratio: 1/2;
    transform: matrix3d(1, 0.0, 0, 0.004, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: 6%;
}

.car-light .light-frame div {
    width: auto;
    height: 100%;
    flex: 0 0 auto;
}

.pedestrian-light .light-frame div {
    width: 80%;
    height: auto;
    flex: 0 0 auto;
}

.crossing-button {
    aspect-ratio: 0.25;
    height: 17%;
    position: absolute;
    right: 12%;
    bottom: 29%;
}

#button::after {
    content: "OFF";
    font-family: Arial, Helvetica, sans-serif;
    color: white;
    font-size: 12px;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#button.ready::after {
    content: "ON";
}

.crossing-button .light-frame {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: 6%;
}

.crossing-button #button {
    aspect-ratio: 1;
    border-radius: 999px;
    text-decoration: none;
    width: 75%;
    background-color: gray;
}

.menu {
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    width: min(420px, 92vw);
    z-index: 5;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.menu .panel {
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(4px);
    border: 1px solid #222;
    border-radius: 12px;
    padding: 12px;
    color: #e5e5e5;
}

#menu-toggle {
    position: absolute;
    right: 1rem;
    top: 1rem;
    z-index: 6;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 18px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.menu.closed {
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
}

.menu.open {
    pointer-events: auto;
    opacity: 1;
    transition: all 0.2s ease;
}

.menu .row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.menu .row.two {
    grid-template-columns: 1fr 1fr;
}

.menu .row.two>div {
    display: grid;
    gap: 6px;
}

.menu .lbl {
    font-size: 12px;
    color: #cbd5e1;
}

#traffic {
    width: 220px;
}

#trafficVal {
    font-variant-numeric: tabular-nums;
    background: #111;
    border: 1px solid #333;
    padding: 4px 8px;
    border-radius: 6px;
}

.menu input[type="number"][readonly] {
    background: #0d0d0d;
    border: 1px solid #333;
    color: #9ca3af;
}

.menu input[type="number"] {
    background: #111;
    color: #e5e5e5;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 6px 8px;
}