/* Adventní kalendář spánku: a night street, a house with 24 lit windows, a sky that fills with stars. */

@font-face {
    font-family: "Young Serif";
    src: url("../fonts/young-serif-latin.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Young Serif";
    src: url("../fonts/young-serif-latin-ext.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Figtree";
    src: url("../fonts/figtree-latin.woff2") format("woff2");
    font-weight: 300 900;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Figtree";
    src: url("../fonts/figtree-latin-ext.woff2") format("woff2");
    font-weight: 300 900;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --night: #0b151b;
    --cream: #f4ecdd;
    --on-night: #f3ecdf;
    --on-night-2: #a9b8c0;
    --amber: #ffcf7a;
    --amber-soft: #e9c486;
    --paper: #f7f2e8;
    --paper-2: #ece4d4;
    --ink: #14232c;
    --ink-2: #3a4c55;
    --snow: #e4ebef;
    --facade: #1e3440;
    --pilaster: #243c49;
    --stone: #56656c;
    --serif: "Young Serif", Georgia, serif;
    --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--night);
    color: var(--on-night);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- sky ---------- */

.sky {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(120% 70% at 75% 110%, rgba(70, 108, 126, .38), transparent 60%),
        linear-gradient(#060d12 0%, #0b1820 45%, #14303c 100%);
}
.stars span {
    position: absolute;
    border-radius: 50%;
    background: #fff;
    opacity: var(--o);
    animation: twinkle var(--d) ease-in-out var(--delay) infinite;
}
@keyframes twinkle { 50% { opacity: calc(var(--o) * .25); } }

.moon {
    position: absolute;
    top: clamp(70px, 11vh, 120px);
    right: clamp(24px, 9vw, 160px);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    box-shadow: 15px -9px 0 0 #f3e8cf;
    filter: drop-shadow(0 0 22px rgba(243, 232, 207, .32));
    transform: rotate(-8deg);
}

.shoot {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 130px;
    height: 1.5px;
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 250, 235, .95));
    transform-origin: right center;
    animation: shoot 1.2s cubic-bezier(.3, .6, .4, 1) forwards;
}
@keyframes shoot {
    0% { opacity: 0; transform: rotate(var(--a)) translateX(0) scaleX(.3); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: rotate(var(--a)) translateX(320px) scaleX(1); }
}

/* ---------- header ---------- */

.top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    padding: 22px clamp(20px, 5vw, 56px) 0;
}
.brand { display: inline-flex; border-radius: 6px; }
.brand img { display: block; height: 34px; width: auto; }

/* ---------- scene ---------- */

/* clip sideways only: the snowbank is wider than the page */
.scene { position: relative; overflow-x: clip; }

.scene-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: clamp(24px, 5vh, 56px) clamp(20px, 5vw, 56px) 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 640px);
    gap: clamp(32px, 5vw, 80px);
    align-items: end;
}

.intro { align-self: center; padding-bottom: 6vh; max-width: 560px; }

.eyebrow {
    margin: 0;
    color: var(--amber-soft);
    font-size: 15px;
    font-weight: 500;
}
h1 {
    margin: 12px 0 18px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.5rem, 4.4vw, 4rem);
    line-height: 1.02;
    letter-spacing: -.01em;
    color: var(--cream);
    text-wrap: balance;
}
.lead {
    margin: 0;
    max-width: 32em;
    font-size: clamp(1.05rem, 1.35vw, 1.2rem);
    line-height: 1.6;
    color: var(--on-night-2);
    text-wrap: pretty;
}

.today {
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
}
.btn-today {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 24px 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--amber);
    color: #1d1405;
    font-size: 16px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 12px 34px -10px rgba(255, 207, 122, .6);
    transition: background .2s, transform .15s;
}
.btn-today:hover { background: #ffdb98; }
.btn-today:active { transform: translateY(1px); }
.btn-today svg { width: 20px; height: 20px; }
.today-note { margin: 0; max-width: 30em; color: var(--on-night-2); font-size: 15px; }
.today-note:empty { display: none; }

.skymap {
    margin: 44px 0 0;
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 22px;
    align-items: center;
}
#constellation { display: block; width: 100%; height: auto; overflow: visible; }
.skymap-count {
    margin: 0 0 6px;
    font-family: var(--serif);
    font-size: 22px;
    color: var(--cream);
}
.skymap-text { margin: 0; font-size: 15px; line-height: 1.55; color: var(--on-night-2); text-wrap: pretty; }
.skymap-done { margin: 10px 0 0; font-size: 14px; color: var(--amber-soft); }
.skymap-done:empty { display: none; }

/* constellation */
.c-edge {
    stroke: rgba(240, 222, 182, .6);
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 1s ease, stroke .6s;
}
.c-edge.is-lit { stroke-dashoffset: 0; }
.c-dot {
    fill: #c8d6de;
    opacity: .22;
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(.65);
    transition: opacity .4s, transform .4s, fill .4s;
}
.c-halo { fill: rgba(255, 228, 170, .16); opacity: 0; transition: opacity .6s; }
.c-star.is-lit .c-dot { fill: #fff6df; opacity: 1; transform: scale(1); }
.c-star.is-lit .c-halo { opacity: 1; }
.c-star.is-ornament.is-lit .c-dot { fill: var(--amber); }
.c-star.is-top .c-dot { opacity: .3; }
.c-star.is-top.is-lit .c-dot { fill: var(--amber); opacity: 1; }
.c-star.just-lit .c-dot { animation: pop .8s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { 0% { transform: scale(2.6); } 100% { transform: scale(1); } }

.is-complete .c-edge { stroke: rgba(255, 214, 140, .95); }
.is-complete .c-star.is-top .c-dot { animation: shine 3.2s ease-in-out infinite; }
@keyframes shine { 50% { transform: scale(1.25) rotate(45deg); } }

/* ---------- street and house ---------- */

.street-house {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.lamppost {
    position: absolute;
    bottom: 0;
    left: -34px;
    width: 6px;
    height: 58%;
    background: linear-gradient(90deg, #0a1318, #1b2930 50%, #0a1318);
    border-radius: 3px 3px 0 0;
}
.lamppost-head {
    position: absolute;
    top: -34px;
    left: 50%;
    width: 24px;
    height: 34px;
    transform: translateX(-50%);
    border: 4px solid #0a1318;
    border-radius: 4px 4px 7px 7px;
    background: #ffd590;
    box-shadow: 0 0 40px 16px rgba(255, 196, 110, .26), 0 0 120px 50px rgba(255, 196, 110, .08);
}
.lamppost-head::before {
    content: "";
    position: absolute;
    left: -8px;
    right: -8px;
    top: -10px;
    height: 8px;
    border-radius: 6px 6px 2px 2px;
    background: #0a1318;
}

.house {
    container-type: inline-size;
    position: relative;
    z-index: 1;
    width: min(100%, 640px);
}

.roof {
    display: block;
    width: 110%;
    height: auto;
    margin: 0 0 -1px -5%;
    overflow: visible;
}
.smoke { filter: blur(3px); }
.smoke circle {
    fill: rgba(190, 206, 215, .14);
    transform-box: fill-box;
    transform-origin: center;
    animation: smoke 7.5s linear infinite;
    opacity: 0;
}
.smoke circle:nth-child(2) { animation-delay: -2.5s; }
.smoke circle:nth-child(3) { animation-delay: -5s; }
@keyframes smoke {
    0% { transform: translate(0, 0) scale(.6); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: translate(-34px, -56px) scale(2.6); opacity: 0; }
}

.facade {
    position: relative;
    background:
        linear-gradient(90deg, rgba(255, 205, 130, .07), transparent 40%),
        linear-gradient(var(--facade), #1a2e39);
    box-shadow: inset 3.4cqi 0 0 var(--pilaster), inset -3.4cqi 0 0 var(--pilaster);
}

.windows {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    column-gap: 3.6cqi;
    row-gap: 4.6cqi;
    padding: 4.6cqi 6.4cqi 5.4cqi;
}

/* one window: stone surround, glass, a room behind it */
.win {
    grid-row: var(--r6);
    grid-column: var(--c6);
    position: relative;
    aspect-ratio: 5 / 6.6;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: var(--stone);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.win[data-top-wide], .win[data-top-wide] .glass { border-radius: 50% 50% 2px 2px / 24% 24% 2px 2px; }

/* the sill, snow on top */
.win::after {
    content: "";
    position: absolute;
    left: -1.2cqi;
    right: -1.2cqi;
    bottom: calc(-1 * max(5px, 1.3cqi));
    height: max(8px, 2cqi);
    border-radius: 4px 4px 2px 2px;
    background: linear-gradient(var(--snow) 0 52%, #7d8d95 52%);
    box-shadow: 0 3px 5px rgba(0, 0, 0, .28);
}

.glass {
    position: absolute;
    inset: max(4px, 1.1cqi);
    overflow: hidden;
    border-radius: 1px;
    background: linear-gradient(160deg, #1a3240, #0b181f 70%);
}
/* moonlight on the glass, seen best once the room is dark */
.glass::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 6;
    background: linear-gradient(125deg, transparent 28%, rgba(255, 255, 255, .07) 36%, transparent 44%);
    pointer-events: none;
}

.light {
    position: absolute;
    inset: 0;
    background: radial-gradient(130% 90% at 50% 78%, #ffe6ad 0%, #f6bd62 48%, #c27a2c 100%);
    transition: opacity .5s ease, filter .25s;
}
.win[data-light="soft"] .light { background: radial-gradient(130% 90% at 50% 72%, #fff3d6 0%, #efd59e 52%, #b18d56 100%); }
.win[data-light="tv"] .light {
    background: radial-gradient(130% 100% at 38% 82%, #d5ebf5 0%, #84b4cf 50%, #3d6a83 100%);
    animation: tv 4.2s steps(1) infinite;
}
@keyframes tv {
    0% { filter: brightness(1); }
    11% { filter: brightness(.8); }
    19% { filter: brightness(1.1) hue-rotate(-10deg); }
    33% { filter: brightness(.9); }
    48% { filter: brightness(1.14); }
    61% { filter: brightness(.84) hue-rotate(12deg); }
    77% { filter: brightness(1); }
    89% { filter: brightness(.92); }
}

.thing {
    position: absolute;
    z-index: 1;
    left: 16%;
    bottom: 0;
    width: 68%;
    height: auto;
    color: rgba(18, 30, 37, .6);
    fill: currentColor;
}

/* the window bars, in front of everything in the room */
.bars {
    position: absolute;
    inset: 0;
    z-index: 5;
    --bar: max(2px, .55cqi);
    background:
        linear-gradient(90deg, transparent calc(50% - var(--bar)), #46555c calc(50% - var(--bar)) calc(50% + var(--bar)), transparent calc(50% + var(--bar))),
        linear-gradient(transparent calc(34% - var(--bar)), #46555c calc(34% - var(--bar)) calc(34% + var(--bar)), transparent calc(34% + var(--bar)));
}

.cur {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 2;
    width: 21%;
    --fabric: rgba(255, 232, 186, .86);
    background: repeating-linear-gradient(90deg, rgba(60, 30, 10, .14) 0, rgba(255, 255, 255, .1) 3px, rgba(60, 30, 10, .14) 6px), var(--fabric);
    transition: width .9s cubic-bezier(.6, .1, .3, 1), clip-path .9s cubic-bezier(.6, .1, .3, 1), filter .6s;
}
.win[data-curtain="red"] .cur { --fabric: rgba(206, 88, 58, .8); }
.win[data-curtain="blue"] .cur { --fabric: rgba(118, 158, 186, .82); }
/* tied back in the middle */
.cur-l { left: 0; clip-path: polygon(0 0, 100% 0, 55% 56%, 100% 100%, 0 100%); }
.cur-r { right: 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 45% 56%); }

/* a window that can't be opened yet: curtains drawn, the light glowing through */
.win.is-locked { cursor: default; }
.win.is-locked .cur { width: 51%; }
.win.is-locked .cur-l { clip-path: polygon(0 0, 100% 0, 100% 56%, 100% 100%, 0 100%); }
.win.is-locked .cur-r { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 56%); }
.win.is-locked .light { filter: saturate(.85) brightness(.92); }

.win.is-available:hover .light,
.win.is-available:focus-visible .light { filter: brightness(1.12); }

/* asleep: light off, blind down */
.blind {
    position: absolute;
    inset: 0;
    z-index: 4;
    transform: scaleY(0);
    transform-origin: top;
    background: repeating-linear-gradient(#21333c 0 3px, #182831 3px 4px);
    transition: transform .8s cubic-bezier(.55, 0, .2, 1) .3s;
}
.win.is-asleep .light { opacity: 0; }
.win.is-asleep .blind { transform: scaleY(1); }
.win.is-asleep .cur { filter: brightness(.3); }
.win.just-asleep .light { animation: flicker .6s steps(1); }
@keyframes flicker {
    0% { opacity: 1; }
    18% { opacity: .2; }
    32% { opacity: 1; }
    52% { opacity: .1; }
    68% { opacity: .65; }
    100% { opacity: 0; }
}

.tag {
    position: absolute;
    z-index: 7;
    left: 50%;
    top: 34%;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    min-width: 2.1em;
    height: 1.65em;
    padding: 0 .35em;
    border-radius: .45em;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(12px, 2.3cqi, 15px);
    line-height: 1;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .25);
    transition: background .4s, color .4s, box-shadow .4s;
    pointer-events: none;
}
.win.is-today .tag { background: var(--amber); }
.win.is-asleep .tag { background: rgba(247, 242, 232, .14); color: rgba(247, 242, 232, .78); box-shadow: none; }

/* today's window breathes */
.win.is-today::before {
    content: "";
    position: absolute;
    inset: calc(-1 * max(6px, 1.6cqi));
    border-radius: 12px;
    box-shadow: 0 0 0 2px rgba(255, 214, 140, .9), 0 0 34px 8px rgba(255, 190, 100, .34);
    animation: breathe 2.8s ease-in-out infinite;
    pointer-events: none;
}
.win.is-today[data-top-wide]::before { border-radius: 50% 50% 12px 12px / 26% 26% 12px 12px; }
@keyframes breathe { 50% { opacity: .45; } }

.win.is-shaking { animation: shake .42s; }
@keyframes shake {
    20% { transform: translateX(-3px) rotate(-1deg); }
    45% { transform: translateX(3px) rotate(1deg); }
    70% { transform: translateX(-2px); }
}

/* finale: fairy lights along the cornice once the whole house sleeps */
.belt::after {
    content: "";
    position: absolute;
    left: 2%;
    right: 2%;
    top: calc(100% + 2px);
    height: 10px;
    opacity: 0;
    background:
        radial-gradient(circle, #ffcf7a 0 2.2px, transparent 3px) 0 0 / 24px 10px repeat-x,
        radial-gradient(circle, #ff8f6b 0 2.2px, transparent 3px) 12px 3px / 24px 10px repeat-x;
    filter: drop-shadow(0 0 4px rgba(255, 190, 100, .9));
    transition: opacity 1.2s;
}
.is-complete .belt::after { opacity: 1; animation: fairy 1.8s steps(2) infinite; }
@keyframes fairy { 50% { filter: drop-shadow(0 0 6px rgba(255, 190, 100, 1)) brightness(.75); } }

/* the cornice over the ground floor */
.belt {
    height: max(9px, 2.2cqi);
    margin: 0 -1.6cqi;
    border-radius: 2px;
    background: linear-gradient(var(--snow) 0 34%, #34505c 34%);
    box-shadow: 0 4px 6px rgba(0, 0, 0, .3);
    position: relative;
    z-index: 1;
}

.groundfloor {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    justify-items: center;
    height: 19cqi;
    padding: 0 6.4cqi;
}
.gf-window {
    align-self: center;
    width: 9cqi;
    aspect-ratio: 1;
    border: max(3px, .9cqi) solid #3f4c53;
    border-bottom-width: max(5px, 1.4cqi);
    border-radius: 50% 50% 2px 2px / 40% 40% 2px 2px;
    background: repeating-linear-gradient(90deg, #102027 0 3px, #0b171d 3px 6px);
}
.door {
    grid-column: 3;
    position: relative;
    width: 13cqi;
    height: 16cqi;
    border: max(3px, .9cqi) solid #3f4c53;
    border-bottom: 0;
    border-radius: 6.5cqi 6.5cqi 0 0;
    background: linear-gradient(90deg, #3a2a1c 0 48.5%, #241911 48.5% 51.5%, #3a2a1c 51.5%);
}
.door-lamp {
    position: absolute;
    top: -4.4cqi;
    left: 50%;
    width: 2.2cqi;
    height: 2.2cqi;
    transform: translateX(-50%);
    border-radius: 50%;
    background: #ffd590;
    box-shadow: 0 0 18px 7px rgba(255, 196, 110, .34);
}
.wreath {
    position: absolute;
    top: 26%;
    left: 50%;
    width: 6.4cqi;
    height: 6.4cqi;
    transform: translateX(-50%);
    border-radius: 50%;
    border: 1.5cqi solid #2c4a3a;
    box-shadow: inset 0 0 0 .3cqi #213a2d;
}
.wreath::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -1.7cqi;
    width: 1.3cqi;
    height: 1.3cqi;
    transform: translateX(-50%);
    border-radius: 50%;
    background: #c9553c;
    box-shadow: 1.3cqi -.5cqi 0 #c9553c, -1.3cqi -.5cqi 0 #c9553c;
}
/* a Prague house-number plate */
.plate {
    position: absolute;
    top: 12%;
    right: -7.2cqi;
    padding: .4cqi 1.1cqi;
    border: .35cqi solid #e8edf0;
    border-radius: .8cqi;
    background: #23508a;
    color: #fff;
    font-size: clamp(8px, 1.9cqi, 12px);
    font-weight: 700;
    line-height: 1.2;
}

/* narrow house: four windows a floor, six floors */
@container (max-width: 560px) {
    .windows {
        grid-template-columns: repeat(4, 1fr);
        column-gap: 5cqi;
        row-gap: 5.4cqi;
        padding: 5.4cqi 7.4cqi 6.4cqi;
    }
    .win { grid-row: var(--r4); grid-column: var(--c4); aspect-ratio: 5 / 6.4; }
    .win[data-top-wide], .win[data-top-wide] .glass { border-radius: 2px; }
    .win[data-top-wide] .glass { border-radius: 1px; }
    .win[data-top-narrow], .win[data-top-narrow] .glass { border-radius: 50% 50% 2px 2px / 24% 24% 2px 2px; }
    .win.is-today[data-top-wide]::before { border-radius: 12px; }
    .win.is-today[data-top-narrow]::before { border-radius: 50% 50% 12px 12px / 26% 26% 12px 12px; }
    .tag { font-size: clamp(12px, 3.6cqi, 15px); }
    .groundfloor { grid-template-columns: repeat(3, 1fr); height: 27cqi; padding: 0 7.4cqi; }
    .gf-window:first-child, .gf-window:last-child { display: none; }
    .gf-window { width: 13cqi; }
    .door { grid-column: 2; width: 19cqi; height: 23cqi; border-radius: 9.5cqi 9.5cqi 0 0; }
    .door-lamp { top: -5.6cqi; width: 3cqi; height: 3cqi; }
    .wreath { width: 9cqi; height: 9cqi; border-width: 2cqi; }
    .wreath::after { width: 1.8cqi; height: 1.8cqi; bottom: -2.2cqi; box-shadow: 1.8cqi -.7cqi 0 #c9553c, -1.8cqi -.7cqi 0 #c9553c; }
    .plate { right: -10.5cqi; font-size: clamp(8px, 2.8cqi, 12px); }
}

/* the snow the house stands in */
.snowbank {
    position: relative;
    z-index: 2;
    height: 74px;
    margin: -24px -10% 0;
    border-radius: 50% 50% 0 0 / 34px 34px 0 0;
    background:
        radial-gradient(40% 60% at 50% 0%, rgba(255, 214, 150, .16), transparent 70%),
        linear-gradient(#e6edf1, #c4d1d8);
}

.foot {
    position: relative;
    z-index: 2;
    padding: 4px 24px 36px;
    background: #c4d1d8;
    color: #33464f;
    font-size: 14px;
    text-align: center;
}
.foot p { margin: 0 auto; max-width: 40em; text-wrap: balance; }
.foot a { font-weight: 600; text-underline-offset: 2px; }

/* ---------- the sheet behind a window: the cat on the left, the tip on the right ---------- */

.sheet {
    width: min(660px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 0;
    border-radius: 24px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .65);
    overflow: hidden auto;
    overscroll-behavior: contain;
}
.sheet[open] { display: grid; grid-template-columns: 236px minmax(0, 1fr); animation: sheet-in .42s cubic-bezier(.2, .8, .2, 1); }
.sheet::backdrop { background: rgba(4, 9, 12, .64); animation: fade .3s; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(18px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }

/* the picture is anchored to the panel's width; whatever is left below is the same dark ground */
.sheet-art {
    position: relative;
    min-height: 400px;
    overflow: hidden;
    background: #14161c;
}
.sheet-cat {
    position: absolute;
    inset: 0 0 auto;
    aspect-ratio: 600 / 1015;
    animation: cat-drift 16s ease-in-out infinite alternate;
}
.sheet-cat img { display: block; width: 100%; height: 100%; }
.sheet-cat::after {
    content: "";
    position: absolute;
    inset: auto 0 -1px;
    height: 30%;
    background: linear-gradient(rgba(20, 22, 28, 0), #14161c 85%);
}
@keyframes cat-drift { to { transform: scale(1.045) translateY(-1.5%); } }

/* the moon eyes glow and now and then the cat blinks */
.cat-eye {
    position: absolute;
    translate: -50% -50%;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 18px 4px rgba(255, 190, 90, .45);
    animation: eye-glow 3.2s ease-in-out infinite;
}
.cat-eye-l { left: 43.5%; top: 29.9%; width: 16.4%; aspect-ratio: 1; }
.cat-eye-r { left: 65.7%; top: 27.8%; width: 15%; aspect-ratio: 1; animation-delay: .15s; }
.cat-eye i {
    position: absolute;
    inset: 0;
    background: #11131a;
    transform: scaleY(0);
    transform-origin: top;
    animation: blink 5.6s infinite;
}
@keyframes eye-glow { 50% { box-shadow: 0 0 30px 9px rgba(255, 190, 90, .6); } }
@keyframes blink {
    0%, 90%, 100% { transform: scaleY(0); }
    93%, 94% { transform: scaleY(1); }
}
.cat-moon {
    position: absolute;
    left: 53.5%;
    top: 10.6%;
    width: 13%;
    aspect-ratio: 1;
    translate: -50% -50%;
    border-radius: 50%;
    background: radial-gradient(rgba(255, 226, 160, .45), transparent 65%);
    animation: twinkle 4.5s ease-in-out infinite;
}
.cat-twinkle {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 7px;
    height: 7px;
    translate: -50% -50%;
    background: #ffe3a6;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    opacity: 0;
    animation: twinkle 3.4s ease-in-out var(--d) infinite;
}
@keyframes twinkle {
    0%, 100% { opacity: .15; transform: scale(.6); }
    50% { opacity: 1; transform: scale(1.15); }
}
.cat-shoot {
    position: absolute;
    left: 70%;
    top: 4%;
    width: 60px;
    height: 1.5px;
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(255, 233, 180, 0), #fff2cf);
    transform: rotate(150deg);
    opacity: 0;
    animation: shoot 9s ease-in 2.5s infinite;
}
@keyframes shoot {
    0% { opacity: 0; translate: 0 0; }
    2% { opacity: 1; }
    8% { opacity: 0; translate: -110px 64px; }
    100% { opacity: 0; translate: -110px 64px; }
}

.sheet-main {
    display: flex;
    flex-direction: column;
    padding: 30px 30px 28px;
}
/* the text arrives a beat after the card */
.sheet[open] .sheet-main > :not(.sheet-x) { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.sheet[open] .sheet-main > :nth-child(3) { animation-delay: .06s; }
.sheet[open] .sheet-main > :nth-child(4) { animation-delay: .12s; }
.sheet[open] .sheet-main > :nth-child(n+5) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* the dialog is fixed, so this sits in its corner */
.sheet-x {
    position: absolute;
    z-index: 1;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-2);
    cursor: pointer;
    transition: background .2s, transform .3s;
}
.sheet-x:hover { background: var(--paper-2); transform: rotate(90deg); }
.sheet-x svg { width: 20px; height: 20px; }

.sheet-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 44px 14px 0;
    font-size: 14px;
    font-weight: 600;
    color: #7a6440;
}
.sheet-meta span:last-child::first-letter { text-transform: uppercase; }
/* the number sits in a tiny copy of the window: lit, or asleep */
.sheet-num {
    flex: none;
    display: grid;
    place-items: center;
    width: 28px;
    height: 34px;
    border-radius: 14px 14px 2px 2px;
    background: radial-gradient(130% 90% at 50% 78%, #ffe6ad, #f6bd62 55%, #c27a2c);
    box-shadow: 0 0 0 2px var(--stone), 0 0 14px rgba(255, 196, 110, .45);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 14px;
    font-weight: 400;
}
.sheet.is-asleep .sheet-num {
    background: repeating-linear-gradient(#21333c 0 3px, #182831 3px 4px);
    box-shadow: 0 0 0 2px var(--stone);
    color: var(--on-night);
}

.sheet h2 {
    margin: 0 0 12px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: 28px;
    line-height: 1.15;
    text-wrap: balance;
}
.sheet-text { margin: 0 0 24px; font-size: 16.5px; line-height: 1.62; color: var(--ink-2); text-wrap: pretty; }

.sheet-gift {
    margin: -6px 0 24px;
    padding: 14px;
    border: 1.5px dashed #d7a24c;
    border-radius: 14px;
    background: #fff6e1;
}
.sheet-gift[hidden] { display: none; }
.sheet-gift-title { margin: 0 0 10px; font-family: var(--serif); font-size: 18px; line-height: 1.2; }
.coupon {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 6px 6px 14px;
    border: 1px solid #ecd9b2;
    border-radius: 12px;
    background: #fff;
}
.coupon[hidden] { display: none; }
.coupon-code { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; letter-spacing: .12em; overflow-wrap: anywhere; }
.coupon-copy {
    flex: none;
    height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: var(--ink);
    color: var(--paper);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.sheet-link {
    display: inline-flex;
    margin-top: 12px;
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.sheet-link[hidden] { display: none; }

.btn-play {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    margin-top: auto;
    padding: 0 18px;
    border: 0;
    border-radius: 16px;
    background: var(--ink);
    color: var(--paper);
    font-size: 17px;
    font-weight: 650;
    cursor: pointer;
    transition: background .2s, transform .15s;
}
.btn-play:hover { background: #1f3542; }
.btn-play:active { transform: scale(.98); }
.btn-play svg { flex: none; width: 20px; height: 20px; color: var(--amber); }

/* on a phone the sheet comes up from the bottom, the cat looks down from a strip on top */
@media (max-width: 560px) {
    .sheet {
        width: 100%;
        max-width: 100%;
        max-height: 92dvh;
        margin: auto 0 0;
        border-radius: 24px 24px 0 0;
    }
    .sheet[open] { grid-template-columns: none; animation: sheet-up .38s cubic-bezier(.2, .8, .2, 1); }
    .sheet-art { min-height: 0; height: 190px; }
    .sheet-cat { top: -60px; right: auto; left: 50%; width: min(100%, 420px); translate: -50% 0; }
    .sheet-main { padding: 22px 22px max(22px, env(safe-area-inset-bottom)); }
    .sheet-x { background: rgba(10, 16, 20, .45); color: var(--on-night); }
    .sheet-x:hover { background: rgba(10, 16, 20, .7); }
    @keyframes sheet-up { from { transform: translateY(40%); opacity: .4; } }
}

@media (prefers-reduced-motion: reduce) {
    .sheet-cat, .cat-eye, .cat-eye i, .cat-moon, .cat-twinkle, .cat-shoot,
    .sheet[open] .sheet-main > * { animation: none; }
    .cat-twinkle { opacity: .7; }
}

/* ---------- the game, full screen ---------- */

.game {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: #07111a;
    color: var(--on-night);
    overflow: hidden;
}
.game[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); animation: fade .25s; }
.game::backdrop { background: #07111a; }
.game-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 12px 10px 20px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: #0b1821;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
/* on a narrow bar the title gives way (ellipsis) and the score stays on one line */
.game-title { flex: 0 1 auto; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--serif); font-weight: 400; font-size: 19px; white-space: nowrap; }
.game-hud { flex: 1 0 auto; margin: 0; text-align: right; font-size: 15px; font-weight: 600; color: var(--amber-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 480px) {
    .game-bar { gap: 12px; padding-left: 16px; }
    .game-title { font-size: 17px; }
    .game-hud { font-size: 14px; }
}
.game-x {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    cursor: pointer;
}
.game-x:hover { background: rgba(255, 255, 255, .16); }
.game-x svg { width: 20px; height: 20px; }
.game-stage { grid-row: 2; grid-column: 1; position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
/* shares the stage's grid cell, so it covers the game but not the bar */
.game-screen {
    grid-row: 2;
    grid-column: 1;
    position: relative;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 11, 16, .66);
    backdrop-filter: blur(3px);
    animation: fade .3s;
}
.game-card {
    width: min(420px, 100%);
    padding: 26px 24px 22px;
    border-radius: 22px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
    text-align: center;
}
.game-card h3 { margin: 0 0 10px; font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.15; }
.game-card p { margin: 0 0 22px; font-size: 16px; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.game-actions { display: flex; flex-direction: column; gap: 10px; }
.game-primary, .game-secondary {
    height: 50px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 650;
    cursor: pointer;
}
.game-primary { border: 0; background: var(--ink); color: var(--paper); }
.game-primary:hover { background: #1f3542; }
.game-secondary { border: 1.5px solid #cdbf9f; background: transparent; color: var(--ink); }

/* ---------- Kočičí koledy ---------- */

.kol {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background:
        radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent),
        radial-gradient(1px 1px at 28% 42%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 47% 12%, #fff, transparent),
        radial-gradient(1px 1px at 63% 33%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 78% 20%, #fff, transparent),
        radial-gradient(1px 1px at 90% 46%, #fff, transparent),
        radial-gradient(1px 1px at 8% 55%, #fff, transparent),
        radial-gradient(1px 1px at 37% 60%, #fff, transparent),
        linear-gradient(#060d12, #173341);
}
.kol-hint {
    position: absolute;
    top: 7%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0 20px;
    text-align: center;
    font-size: 16px;
    color: var(--on-night-2);
}
/* how the choir sounds: something sour, or in harmony (with the bars counting up) */
.kol-hint { transition: color .3s; }
.kol-hint.is-sour { color: #f0a08c; }
.kol-hint.is-sweet { color: var(--amber); letter-spacing: .02em; }
.kol-roof {
    position: relative;
    height: 30%;
    min-height: 120px;
    background: linear-gradient(#e4ebef 0 9px, #132028 9px);
}
.kol-cats {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% - 4px);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: clamp(4px, 2vw, 28px);
    padding: 0 10px;
}
@media (max-width: 600px) {
    .kol-roof { height: 40%; }
}
.kcat {
    position: relative;
    width: clamp(62px, 17vw, 150px);
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.kcat:nth-child(2), .kcat:nth-child(4) { width: clamp(56px, 15vw, 132px); }
.kcat-svg { display: block; width: 100%; height: auto; overflow: visible; transform-origin: 50% 100%; transition: filter .3s; }
.kcat .eyes-happy { display: none; }
.kcat.is-on .eyes-open { display: none; }
.kcat.is-on .eyes-happy { display: inline; }
.kcat.is-on .kcat-svg { animation: sway var(--beat) ease-in-out infinite alternate; filter: drop-shadow(0 0 18px rgba(255, 207, 122, .35)); }
.kcat:nth-child(even).is-on .kcat-svg { animation-direction: alternate-reverse; }
@keyframes sway { from { transform: rotate(-3deg) translateY(0); } to { transform: rotate(3deg) translateY(-4%); } }
.kcat-name {
    position: absolute;
    top: calc(100% + 18px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: clamp(12px, 1.6vw, 15px);
    font-weight: 600;
    color: var(--on-night-2);
}
.kcat.is-on .kcat-name { color: var(--amber); }
.kcat:focus-visible { outline: 3px solid var(--amber); outline-offset: 6px; border-radius: 12px; }
.kcat-notes { position: absolute; left: 50%; top: 0; width: 0; height: 0; }
.kol-note {
    position: absolute;
    left: -8px;
    top: 0;
    width: 16px;
    height: 20px;
    fill: var(--amber);
    animation: note 1.6s ease-out forwards;
    pointer-events: none;
}
.kol-note svg { display: block; width: 100%; height: 100%; }
@keyframes note {
    0% { opacity: 0; transform: translate(0, 0) scale(.6); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx), -90px) scale(1); }
}

/* ---------- a star on its way to the sky ---------- */

.flying-star {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 80;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: #fff8e4;
    box-shadow: 0 0 10px 4px rgba(255, 226, 160, .85), 0 0 34px 12px rgba(255, 200, 120, .35);
    pointer-events: none;
}
.trail {
    position: fixed;
    z-index: 79;
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
    border-radius: 50%;
    background: rgba(255, 236, 196, .9);
    pointer-events: none;
    animation: trail .7s ease-out forwards;
}
@keyframes trail { to { opacity: 0; transform: scale(.2); } }

/* ---------- toast and preview bar ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: max(22px, env(safe-area-inset-bottom));
    z-index: 100;
    max-width: calc(100vw - 32px);
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
    font-size: 15px;
    font-weight: 550;
    text-align: center;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
    opacity: 0;
    transform: translate(-50%, 16px);
    transition: opacity .3s, transform .3s;
    pointer-events: none;
}
.toast:empty { visibility: hidden; }
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.has-preview .toast { bottom: 76px; }

.preview {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border-radius: 14px;
    background: rgba(247, 242, 232, .96);
    color: var(--ink);
    font: 500 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.preview button {
    height: 32px;
    min-width: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: 9px;
    background: #e3d8c2;
    cursor: pointer;
}
.preview button:hover { background: #d8cbb0; }
.preview select {
    height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 9px;
    background: var(--ink);
    color: var(--paper);
    font: inherit;
    cursor: pointer;
}
.preview-label { padding: 0 6px 0 8px; font-weight: 700; }
.preview-day { min-width: 11ch; text-align: center; }
@media (max-width: 560px) {
    .preview { left: 10px; right: 10px; bottom: 10px; justify-content: space-between; font-size: 12px; }
    .preview-label { display: none; }
    .preview-day { flex: 1; min-width: 0; }
}

/* ---------- layout ---------- */

@media (max-width: 980px) {
    .scene-inner { grid-template-columns: minmax(0, 1fr); gap: 40px; }
    .intro { padding-bottom: 0; max-width: 640px; }
    .street-house { justify-self: center; width: 100%; }
    .lamppost { display: none; }
}
@media (max-width: 560px) {
    .top { padding-top: 18px; }
    .brand img { height: 30px; }
    .skymap { grid-template-columns: 116px minmax(0, 1fr); gap: 16px; margin-top: 34px; }
    .skymap-count { font-size: 19px; }
    .moon { top: 64px; width: 44px; height: 44px; box-shadow: 11px -7px 0 0 #f3e8cf; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        transition-delay: 0s !important;
    }
}

/* ---------- the mute button: always on screen, top right (js/sound.js moves it around) ---------- */

.mute {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: var(--on-night);
    cursor: pointer;
    transition: background .2s, color .2s;
}
.mute:hover { background: rgba(255, 255, 255, .16); }
.mute svg { width: 22px; height: 22px; overflow: visible; }
.mute-x { display: none; }
.mute.is-muted { color: var(--on-night-2); }
.mute.is-muted .mute-waves { display: none; }
.mute.is-muted .mute-x { display: inline; }

/* on the page: fixed in the corner, over the night sky */
.mute[data-place="page"] {
    position: fixed;
    z-index: 30;
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    background: rgba(11, 21, 27, .55);
    backdrop-filter: blur(4px);
}
.mute[data-place="page"]:hover { background: rgba(11, 21, 27, .8); }
/* in the game's bar it simply sits before the close button */
/* on the sheet: left of the sheet's own close button */
.mute[data-place="sheet"] {
    position: absolute;
    z-index: 1;
    top: 12px;
    right: 56px;
    background: transparent;
    color: var(--ink-2);
}
.mute[data-place="sheet"]:hover { background: var(--paper-2); }
@media (max-width: 560px) {
    .mute[data-place="sheet"] { background: rgba(10, 16, 20, .45); color: var(--on-night); }
    .mute[data-place="sheet"]:hover { background: rgba(10, 16, 20, .7); }
}

/* sound is playing: the waves pulse outwards; muted, the speaker wiggles now and then */
.mute.is-playing:not(.is-muted) .mute-w1 { animation: wave 1.1s ease-in-out infinite; }
.mute.is-playing:not(.is-muted) .mute-w2 { animation: wave 1.1s ease-in-out .18s infinite; }
@keyframes wave {
    0%, 100% { opacity: .35; }
    50% { opacity: 1; }
}
.mute.is-playing.is-muted { color: var(--amber); }
.mute.is-playing.is-muted svg { animation: nudge 1.6s ease-in-out infinite; transform-origin: 50% 60%; }
@keyframes nudge {
    0%, 60%, 100% { transform: rotate(0); }
    68% { transform: rotate(-12deg); }
    76% { transform: rotate(10deg); }
    84% { transform: rotate(-6deg); }
    92% { transform: rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) {
    .mute.is-playing .mute-w1, .mute.is-playing .mute-w2, .mute.is-playing svg { animation: none; }
}

/* a choir of six or seven on a phone: the cats share the width, and every other name drops a
   line so neighbouring names don't run into each other */
@media (max-width: 560px) {
    .kol-cats { gap: 2px; padding: 0 6px; }
    .kcat, .kcat:nth-child(2), .kcat:nth-child(4) { flex: 1 1 0; width: auto; min-width: 0; max-width: 96px; }
    .kcat-name { font-size: 12px; }
    .kcat:nth-child(even) .kcat-name { top: calc(100% + 36px); }
    .kol--rolnicky .kcat:nth-child(even) .kcat-name { top: calc(100% + 70px); }
}
