@font-face {
    font-family: Barlow;
    src: url("../lights-out/fonts/barlow-semi-condensed-600.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
@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; --amber: #ffce7c; font-family: Barlow, system-ui, sans-serif; background: #171917; color: #f1e2c7; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    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));
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 25%, #3e4139, #191916 70%);
}
button, input { font: inherit; }
button { cursor: pointer; }
button, a, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #fff4c0; outline-offset: 2px; }
.instrument {
    width: max(0px, min(100%, 442px, calc((100dvh - 125px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * .8)));
}
header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 3px 8px; }
.city-heading { display: flex; align-items: center; gap: 8px; }
.region-back {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid #8a7559;
    border-radius: 5px;
    background: #2c2821;
    color: #ffde9d;
    font-size: 2rem;
    line-height: 1;
    text-decoration: none;
}
header p { font-size: .75rem; color: #d2ab7a; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1; font-size: clamp(1.65rem, 8vmin, 2.35rem); }
#city-summary { font-size: .875rem; color: #ebd5af; text-align: right; }
.scene {
    position: relative;
    isolation: isolate;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: 1px solid #aa8c65;
    border-radius: 7px;
    box-shadow: 0 0 0 3px #3c3328, 0 10px 30px #090a08aa;
    background: #2a302c;
}
.art, .paint { position: absolute; inset: 0; background: url("ruined.jpg") 50% 50% / 100% 100%; pointer-events: none; }
[data-restored="true"] .art { background-image: url("thriving.jpg?v=warm-materials"); }
.paint {
    background-image: url("restored.jpg");
    clip-path: var(--area);
    opacity: var(--strength, 0);
    transition: opacity .65s ease-out;
}
.scene::after, .location-viewport::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 38px #160e11a0; }
.ambience {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}
.pin {
    --pin-face: #282620;
    --pin-edge: #e4d0a8;
    --pin-dot: transparent;
    --pin-dot-edge: #f4e1be;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
    z-index: 2;
}
.pin::before, .pin::after { content: ""; grid-area: 1 / 1; }
.pin::before {
    width: 19px;
    height: 19px;
    border-radius: 50% 50% 50% 2px;
    background: var(--pin-face);
    border: 1px solid var(--pin-edge);
    box-shadow: 0 0 0 1.5px #161510db, 0 2px 4px #14110fbd;
    transform: translateY(-1px) rotate(-45deg);
}
.pin::after {
    width: 6px;
    height: 6px;
    border: 1px solid var(--pin-dot-edge);
    border-radius: 50%;
    background: var(--pin-dot);
    transform: translateY(-1px);
}
.pin[data-state="repair"] {
    --pin-edge: #ffd799;
    --pin-dot: #ffc164;
    --pin-dot-edge: #ffd799;
}
.pin[data-state="restored"] {
    --pin-face: #d7eab7;
    --pin-edge: #f3ffd6;
    --pin-dot: #304b32;
    --pin-dot-edge: #304b32;
}
.pin:is(:hover, :focus-visible)::before { box-shadow: 0 0 0 1.5px #161510, 0 0 10px #ffda8f; }
footer { padding-top: 8px; text-align: center; }
.observatory-shortcut {
    width: 100%;
    min-height: 44px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 3px 8px;
    padding: 5px 10px;
    border: 1px solid #9d7c54;
    border-radius: 5px;
    background: #2c2821;
    color: #ffde9d;
}
#observatory-progress { font-size: .85rem; color: #ead6b1; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.presets button, .close, .play {
    min-height: 44px;
    color: #f5e3bc;
    background: linear-gradient(#3d382b, #29271f);
    border: 1px solid #967552;
    border-radius: 4px;
}
.presets button[aria-pressed="true"], .play { color: #24190e; background: linear-gradient(#ffd084, #b78649); }
dialog {
    border: 1px solid #b08d64;
    border-radius: 8px;
    background: #22251f;
    color: inherit;
    margin: auto;
    padding: 10px;
    width: min(calc(100% - 18px), 420px);
    max-height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow: hidden;
    box-shadow: 0 12px 55px #040804dd;
}
dialog::backdrop { background: #101410ce; }
.detail { display: grid; gap: 7px; }
.detail header { padding-bottom: 0; }
.close { width: 44px; flex: none; font-size: 1.5rem; }
.location-view {
    position: relative;
    height: clamp(125px, calc(100dvh - 292px), 345px);
    background: #302a23;
    border: 1px solid #7e6650;
    border-radius: 4px;
}
.location-viewport { position: absolute; inset: 0; overflow: hidden; container-type: size; }
.location-art {
    --art-height: max(calc(100cqh * var(--zoom)), 125cqw);
    --art-width: calc(var(--art-height) * .8);
    position: absolute;
    height: var(--art-height);
    width: var(--art-width);
    top: clamp(calc(100cqh - var(--art-height)), calc(50cqh - var(--art-height) * var(--focus-y)), 0px);
    left: clamp(calc(100cqw - var(--art-width)), calc(50cqw - var(--art-width) * var(--focus-x)), 0px);
}
.location-art .paint { clip-path: none; }
.location-art .observatory-piece { clip-path: var(--area); }
.description p { font-size: .9rem; }
#location-work { color: var(--amber); }
.progress { display: grid; grid-template-columns: 1fr auto; font-size: .875rem; }
.progress input { grid-column: span 2; width: 100%; height: 44px; margin: 0; accent-color: #e9b676; }
.progress progress { grid-column: span 2; width: 100%; height: 12px; accent-color: #e9b676; }
.play { display: grid; place-items: center; text-decoration: none; font-weight: 700; }
.fireworks { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.fireworks i {
    position: absolute;
    left: var(--x);
    top: var(--y);
    height: 4px;
    width: 4px;
    border-radius: 50%;
    background: var(--spark);
    box-shadow: 0 0 0 1px #3d22237a, 0 0 9px var(--spark);
    animation: burst 1.2s var(--delay) ease-out both;
}
@keyframes burst { 0% { opacity: 0; transform: translateY(33px); } 19% { opacity: 1; transform: translate(0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)); } }
@media (orientation: landscape) and (max-height: 500px) {
    .instrument {
        width: min(100%, 660px);
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: center;
        gap: 8px 16px;
    }
    .instrument > .scene {
        grid-column: 1;
        grid-row: 1 / 3;
        width: min(100%, calc((100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * .8));
        justify-self: center;
    }
    .instrument > header { align-self: end; }
    .instrument > footer { align-self: start; }
    dialog { width: min(calc(100% - 18px), 635px); }
    .detail { grid-template-columns: 1.2fr 1fr; }
    .detail header { grid-column: 1 / -1; }
    .location-view { grid-column: 1; grid-row: 2 / 5; height: 100%; min-height: 170px; }
    .detail :is(.description, .progress, .play) { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .fireworks { display: none; }
}
