:root {
    --bg-top: #2f5f4b;
    --bg-bottom: #14211d;
    --panel: #2d241a;
    --panel-light: #51402c;
    --accent: #f59a3d;
    --accent-soft: #ffc56f;
    --ink: #20170f;
    --text: #fff5d6;
    --muted: #d4c19b;
    --pixel-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
    --ui-transition: 0.24s steps(3, end);
}

* {
    box-sizing: border-box;
    image-rendering: pixelated;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: #120d09;
    color: var(--text);
    font-family: "IBM Plex Sans", sans-serif;
}

body {
    overflow-x: hidden;
    overflow-y: hidden;
}

button {
    font: inherit;
}

.scene {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(13, 11, 10, 0.18), rgba(13, 11, 10, 0.18)),
        url("../assets/images/backgrounds/cafe_day.png") center / cover no-repeat,
        linear-gradient(180deg, var(--bg-top) 0%, #243229 45%, var(--bg-bottom) 100%);
    transition: background-color 0.3s ease, filter 0.3s ease;
}

.scene::before,
.scene::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.scene::before {
    background:
        repeating-linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.015) 0 1px,
            transparent 1px 4px
        );
    opacity: 0.22;
}

.scene::after {
    background:
        radial-gradient(circle at center, transparent 52%, rgba(0, 0, 0, 0.22) 100%);
    opacity: 0.7;
}

.background,
.background::before,
.background::after {
    position: absolute;
    inset: 0;
}

.background::before {
    content: "";
    background:
        linear-gradient(180deg, rgba(255, 204, 131, 0.18), transparent 28%),
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.03) 0 2px,
            transparent 2px 14px
        );
    opacity: 0.6;
    filter: brightness(0.92);
    animation: roomBreath 10s steps(5, end) infinite;
}

.background::after {
    content: "";
    top: auto;
    height: 42%;
    background:
        linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.05) 42%, rgba(0, 0, 0, 0.16) 100%);
    filter: brightness(1.01);
}

.stars {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 10% 15%, rgba(255, 255, 255, 0.85) 0 1px, transparent 2px),
        radial-gradient(circle at 26% 8%, rgba(255, 255, 255, 0.7) 0 1px, transparent 2px),
        radial-gradient(circle at 62% 12%, rgba(255, 255, 255, 0.8) 0 1px, transparent 2px),
        radial-gradient(circle at 81% 18%, rgba(255, 255, 255, 0.7) 0 1px, transparent 2px),
        radial-gradient(circle at 90% 7%, rgba(255, 255, 255, 0.7) 0 1px, transparent 2px);
    opacity: 0;
    transition: opacity var(--ui-transition);
}

.counter {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 18%;
    height: 18%;
    border-top: none;
    border-bottom: none;
    background: transparent;
    box-shadow: none;
    filter: none;
    pointer-events: none;
}

.floor {
    position: absolute;
    inset: auto 0 0;
    height: 18%;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.06) 48%, rgba(0, 0, 0, 0.14) 100%);
    border-top: none;
    filter: none;
    pointer-events: none;
}

.topbar {
    position: absolute;
    top: 18px;
    left: 20px;
    right: 20px;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.brand,
.status-strip {
    border: 4px solid #000;
    background: rgba(36, 25, 18, 0.92);
    box-shadow: var(--pixel-shadow);
    padding: 10px 14px;
    transition: background-color 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.brand {
    font-family: "Press Start 2P", cursive;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--accent-soft);
}

.status-strip {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--muted);
}

.status-strip span + span::before {
    content: "/";
    margin-right: 12px;
    color: #8a7154;
}

.window-frame {
    position: absolute;
    inset: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.3s ease, filter 0.35s ease;
}

.window-frame::before,
.window-frame::after {
    content: none;
}

#weather-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
    image-rendering: pixelated;
}

.light {
    position: absolute;
    inset: 0;
    opacity: 1;
    transition: background-color 0.35s ease, opacity 0.35s ease;
    z-index: 1;
    pointer-events: none;
}

.light.day {
    background: rgba(255, 220, 160, 0.08);
}

.light.night {
    background: rgba(0, 0, 60, 0.35);
    animation: lightFlicker 6s steps(2, end) infinite;
}

.light.rain,
.light.snow {
    background: rgba(180, 200, 255, 0.08);
}

.light.snow {
    opacity: 0.8;
}

.weather-night {
    --bg-top: #15213f;
    --bg-bottom: #0f131f;
    background-image:
        linear-gradient(180deg, rgba(8, 10, 18, 0.28), rgba(8, 10, 18, 0.28)),
        url("../assets/images/backgrounds/cafe_night.png"),
        linear-gradient(180deg, var(--bg-top) 0%, #243229 45%, var(--bg-bottom) 100%);
    filter: saturate(0.92) brightness(0.95);
}

.weather-night .stars {
    opacity: 1;
}

.weather-rain {
    --bg-top: #425c6f;
    --bg-bottom: #161f29;
    background-image:
        linear-gradient(180deg, rgba(14, 20, 28, 0.26), rgba(14, 20, 28, 0.26)),
        url("../assets/images/backgrounds/cafe_rain.png"),
        linear-gradient(180deg, var(--bg-top) 0%, #243229 45%, var(--bg-bottom) 100%);
    filter: saturate(0.82) brightness(0.9);
}

.weather-snow {
    --bg-top: #7ca0ba;
    --bg-bottom: #314657;
    background-image:
        linear-gradient(180deg, rgba(18, 22, 28, 0.16), rgba(18, 22, 28, 0.16)),
        url("../assets/images/backgrounds/cafe_snow.png"),
        linear-gradient(180deg, var(--bg-top) 0%, #243229 45%, var(--bg-bottom) 100%);
    filter: saturate(0.9) brightness(0.97);
}

.scene.is-playing .window-frame {
    opacity: 1;
}

.scene.player-focus .window-frame {
    filter: brightness(1.02);
}

@keyframes roomBreath {
    0%,
    100% {
        opacity: 0.58;
    }

    50% {
        opacity: 0.66;
    }
}

@keyframes lightFlicker {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.97;
    }
}

@media (max-width: 1280px) {
    .topbar {
        left: 16px;
        right: 16px;
        gap: 12px;
    }

    .brand,
    .status-strip {
        padding: 9px 12px;
    }
}

@media (max-width: 960px) {
    body {
        overflow-y: auto;
    }

    .scene {
        min-height: 100svh;
        padding: 86px 16px 28px;
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
        align-content: start;
        background-position: center top;
    }

    .topbar,
    .window-frame {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        width: 100%;
    }

    .topbar {
        padding-top: 0;
        margin: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .window-frame {
        position: absolute;
        inset: 0;
    }

    .brand {
        font-size: 0.72rem;
    }

    .status-strip {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .scene {
        padding: 74px 12px 20px;
        gap: 12px;
    }

    .topbar {
        gap: 10px;
    }

    .brand,
    .status-strip {
        padding: 8px 10px;
        border-width: 3px;
    }

    .brand {
        font-size: 0.62rem;
        line-height: 1.45;
    }

    .status-strip {
        font-size: 0.78rem;
    }

    .status-strip span + span::before {
        margin-right: 8px;
    }
}

@media (max-width: 420px) {
    .scene {
        padding: 70px 10px 18px;
    }

    .brand {
        font-size: 0.56rem;
    }

    .status-strip {
        gap: 8px;
        font-size: 0.72rem;
    }

    .status-strip span + span::before {
        margin-right: 6px;
    }
}
