@font-face {
    font-family: Barlow;
    src: url("lights-out/fonts/barlow-semi-condensed-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    color-scheme: dark;
    color: #f7e8cd;
    background: #171917;
    font: 700 16px/1.2 Barlow, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
        max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: radial-gradient(ellipse at 50% 28%, #464132, #191916 74%);
}

.console {
    width: min(100%, 28rem, max(0px, calc((100dvh - 140px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * .8)));
}

header { padding: 0 3px 9px; }
h1, h2, p { margin: 0; }
header p { color: #dec099; font-size: .72rem; text-transform: uppercase; letter-spacing: .18em; }
h1 { font-size: clamp(1.65rem, 6.5vmin, 2.35rem); line-height: 1.03; }
footer { padding-top: 10px; text-align: center; }
footer p { color: #ead6b1; font-size: .92rem; }
#open-privacy { min-height: 44px; font: inherit; font-size: .8rem; color: #ead6b1; background: transparent; border: 0; cursor: pointer; }

.atlas {
    position: relative;
    isolation: isolate;
    aspect-ratio: 4 / 5;
    border: 1px solid #ac8b64;
    border-radius: 8px;
    background: #3c332a url("ironspan-viaduct.jpg") left center / 200% 100% no-repeat;
    box-shadow: 0 0 0 3px #3c3328, 0 10px 30px #090a08aa, inset 0 0 38px #160e11a0;
}

.settlement, .pending-town {
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
    min-width: 44px;
    min-height: 44px;
    display: grid;
    justify-items: center;
    align-items: center;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 1px;
    padding: 0 5px;
    color: #ffe8b5;
    text-decoration: none;
    font-size: .93rem;
}

.settlement span:last-child, .pending-town span {
    padding: 3px 9px;
    border: 1px solid #b08053;
    border-radius: 4px;
    background: #211b16;
    box-shadow: 0 3px 8px #17120fbb;
}

.pending-town {
    grid-template-rows: none;
    border: 0;
    background: none;
    font: inherit;
    font-size: .81rem;
    color: #eadac0;
    cursor: pointer;
}
.pending-town span { border-color: #8e775b; }

.beacon {
    grid-row: 2;
    width: 15px;
    height: 15px;
    border: 2px solid #ffe2a3;
    border-radius: 50%;
    background: #31271d;
    box-shadow: 0 0 0 3px #211911a0;
}

[data-state="repair"] .beacon { background: #f7b94c; box-shadow: 0 0 0 3px #211911ba, 0 0 12px #ffba4d; }
[data-state="restored"] .beacon { background: #c4e78d; box-shadow: 0 0 0 3px #211911ba, 0 0 12px #c4e78d; }
:is(.settlement, .pending-town):is(:hover, :focus-visible) span:last-child { background: #493622; }
:is(button, a):focus-visible { outline: 2px solid #fff1bd; outline-offset: 2px; }

dialog {
    width: min(calc(100% - 32px), 320px);
    padding: 18px;
    border: 1px solid #ac8b64;
    border-radius: 8px;
    background: #242019;
    color: #f7e8cd;
}
dialog::backdrop { background: #100e09b8; }
dialog form { float: right; margin: -8px -8px 0 6px; }
dialog h2 { font-size: 1.5rem; margin-bottom: 8px; }
#privacy { max-height: calc(100dvh - 24px); }
#privacy summary { display: none; }
#privacy p { margin: 8px 0; font-weight: 400; }
#privacy details button { min-height: 44px; }
#town-status { font-weight: 400; }
.close-notice, #observatory-link {
    min-height: 44px;
    border: 1px solid #997c52;
    border-radius: 4px;
    background: #33291c;
    color: #ffe8b5;
}
.close-notice { width: 44px; font: inherit; font-size: 1.35rem; cursor: pointer; }
#observatory-link:not([hidden]) { display: grid; place-items: center; margin-top: 12px; text-decoration: none; }

@media (orientation: landscape) and (max-height: 500px) {
    .console {
        width: min(100%, 580px);
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: center;
        gap: 8px 16px;
    }
    .atlas {
        grid-column: 1;
        grid-row: 1 / 3;
        width: min(100%, calc((100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * .8));
        justify-self: center;
    }
    header { align-self: end; }
    footer { align-self: start; text-align: left; padding: 0 3px; }
}
