:root {
    --navy: #0B2545;
    --cream: #FBF7EF;
    --sand: #EFE6D2;
    --line: #E4DAC4;
    --red: #A61E22;
    --red-dark: #7F1518;
    --green: #1E5B3A;
    --gold: #E0B252;
    --ice: #8DA9C7;
    --text: #1C2733;
    --muted: #6B6F76;
    --page: var(--cream);
    --surface: #fff;
    --gold-soft: #FBF0D5;
    /* red and green as text, the dark theme needs them lighter than as a background */
    --red-text: var(--red);
    --green-text: var(--green);
    --radius: 10px;
    --topbar: 56px;
    --festive: Georgia, "Times New Roman", serif;
    --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* dark theme, toggled by theme.js. The top bar, the hero and the doors stay as they are */
:root.dark {
    color-scheme: dark;
    --page: #0E1824;
    --surface: #16212E;
    --sand: #233142;
    --line: #2B3A4C;
    --text: #E8E3D9;
    --muted: #9AA4B0;
    --gold-soft: #2E2817;
    --red-text: #F08A8C;
    --green-text: #74C99A;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
}

a {
    color: var(--red-text);
}

h1, h2 {
    font-family: var(--festive);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 2rem;
    margin: 0 0 12px;
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.3rem;
    margin: 0 0 12px;
}

code {
    background: var(--sand);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: .9em;
}

/* snow, see snow.js */

#snow {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 30;
    pointer-events: none;
}

.no-snow #snow {
    display: none;
}

/* the snow and theme buttons in the top bar, dimmed when off */

.snow-toggle, .theme-toggle {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(251, 247, 239, .35);
    border-radius: 50%;
    background: none;
    color: var(--cream);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: transform .4s ease, opacity .2s ease;
}

.snow-toggle:hover {
    transform: rotate(60deg);
}

.theme-toggle:hover {
    transform: rotate(-25deg);
}

.no-snow .snow-toggle, :root:not(.dark) .theme-toggle {
    opacity: .45;
}

/* layout */

/* the column can't grow past the screen, so something wide scrolls or wraps on its own instead of widening the page */
.shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--topbar) 1fr auto;
    grid-template-areas: "top" "main" "foot";
    min-height: 100vh;
}

.topbar {
    grid-area: top;
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    background-color: var(--navy);
    /* a light dusting of snow */
    background-image:
        radial-gradient(circle at 12% 30%, rgba(255, 255, 255, .25) 1px, transparent 2px),
        radial-gradient(circle at 37% 70%, rgba(255, 255, 255, .2) 1px, transparent 2px),
        radial-gradient(circle at 63% 25%, rgba(255, 255, 255, .25) 1px, transparent 2px),
        radial-gradient(circle at 88% 65%, rgba(255, 255, 255, .2) 1px, transparent 2px);
    background-size: 180px 56px;
    color: var(--cream);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    font-family: var(--festive);
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
}

.brand img {
    height: 26px;
}

/* the program name sits as a small line above the title, so the bar gets no wider on phones */
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-program {
    color: var(--gold);
    font-family: var(--sans);
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.spacer {
    flex: 1;
}

/* fairy lights hanging under the top bar */

.lights {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 20px;
    display: flex;
    overflow: hidden;
    pointer-events: none;
}

.lights span {
    --bulb: #E5484D;
    position: relative;
    flex: none;
    width: 34px;
    height: 20px;
}

.lights span:nth-child(4n+2) {
    --bulb: #F6C65B;
}

.lights span:nth-child(4n+3) {
    --bulb: #3BB273;
}

.lights span:nth-child(4n+4) {
    --bulb: #6FB7F0;
}

/* the wire */
.lights span::before {
    content: "";
    position: absolute;
    top: -3px;
    left: 0;
    right: 0;
    height: 8px;
    border-bottom: 1.5px solid rgba(11, 37, 69, .75);
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
}

.dark .lights span::before {
    border-bottom-color: rgba(141, 169, 199, .45);
}

/* the bulb, with a dark socket on top */
.lights span::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 50%;
    width: 7px;
    height: 12px;
    margin-left: -3.5px;
    border-top: 3px solid #2B3A4A;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    background: var(--bulb);
    animation: bulb 1.8s ease-in-out infinite alternate;
}

/* uneven delays and durations, so the string twinkles instead of blinking in step */
.lights span:nth-child(3n)::after {
    animation-delay: -.7s;
    animation-duration: 2.3s;
}

.lights span:nth-child(3n+1)::after {
    animation-delay: -1.3s;
}

.lights span:nth-child(5n)::after {
    animation-duration: 1.3s;
}

.lights span:nth-child(7n)::after {
    animation-delay: -.4s;
    animation-duration: 2.9s;
}

@keyframes bulb {
    from {
        opacity: 1;
        box-shadow: 0 0 9px 2px var(--bulb);
    }

    to {
        opacity: .4;
        box-shadow: 0 0 0 0 var(--bulb);
    }
}

.content {
    grid-area: main;
    padding: 32px 40px 64px;
    max-width: 1040px;
    width: 100%;
    margin: 0 auto;
}

/* the few pages there are, as links in the top bar */
.topnav {
    display: flex;
    gap: 18px;
    margin-right: 6px;
}

.topnav a {
    color: inherit;
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.topnav a:hover {
    color: var(--gold);
}

.footer {
    grid-area: foot;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px 22px;
    padding: 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .85rem;
}

.footer a {
    color: inherit;
}

/* the snow and theme buttons again, shown here instead of in the top bar on small phones */
.footer-toggles {
    display: none;
    flex-basis: 100%;
    justify-content: center;
    gap: 12px;
}

.footer .snow-toggle, .footer .theme-toggle {
    border-color: var(--line);
    color: var(--muted);
}

/* calendar */

/* a winter night in ECIT navy */
.hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 36px;
    padding: 34px 36px 104px;
    border-radius: 16px;
    background-color: var(--navy);
    background-image:
        radial-gradient(circle at 6% 22%, rgba(255, 255, 255, .7) 0 1px, transparent 1.5px),
        radial-gradient(circle at 19% 64%, rgba(255, 255, 255, .5) 0 1px, transparent 1.5px),
        radial-gradient(circle at 33% 12%, rgba(255, 255, 255, .6) 0 1px, transparent 1.5px),
        radial-gradient(circle at 47% 48%, rgba(255, 255, 255, .5) 0 1px, transparent 1.5px),
        radial-gradient(circle at 58% 18%, rgba(255, 255, 255, .7) 0 1px, transparent 1.5px),
        radial-gradient(circle at 71% 58%, rgba(255, 255, 255, .5) 0 1px, transparent 1.5px),
        radial-gradient(circle at 79% 9%, rgba(255, 255, 255, .6) 0 1px, transparent 1.5px),
        radial-gradient(circle at 94% 52%, rgba(255, 255, 255, .5) 0 1px, transparent 1.5px),
        linear-gradient(180deg, #071A33 0%, var(--navy) 55%, #1B3F6B 100%);
    color: var(--cream);
}

/* twinkling stars */
.hero::before {
    content: "";
    position: absolute;
    inset: 0 0 70px;
    background-image:
        radial-gradient(circle at 12% 40%, #fff 0 1.5px, transparent 2.5px),
        radial-gradient(circle at 26% 20%, #fff 0 1px, transparent 2px),
        radial-gradient(circle at 41% 30%, #fff 0 1.5px, transparent 2.5px),
        radial-gradient(circle at 53% 70%, #fff 0 1px, transparent 2px),
        radial-gradient(circle at 66% 35%, #fff 0 1.5px, transparent 2.5px),
        radial-gradient(circle at 86% 30%, #fff 0 1px, transparent 2px),
        radial-gradient(circle at 97% 18%, #fff 0 1.5px, transparent 2.5px);
    animation: twinkle 3.2s ease-in-out infinite alternate;
}

/* the moon */
.hero::after {
    content: "";
    position: absolute;
    top: 26px;
    right: 40px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #FFFDF6, #EADFC0);
    box-shadow: 0 0 28px 8px rgba(251, 247, 239, .22);
}

.hero h1, .hero p, .hero-news {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 2.6rem;
    color: var(--cream);
    text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}

.hero-year {
    color: var(--gold);
}

.hero p {
    margin: 0;
    max-width: 560px;
    font-size: 1.1rem;
    color: rgba(251, 247, 239, .82);
}

/* the way to the rules and the newest message, so they are seen without scrolling */
.hero-news {
    display: inline-block;
    max-width: 100%;
    margin-top: 16px;
    margin-right: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: top;
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
}

.hero-news:hover {
    filter: brightness(1.08);
}

.hero-hills {
    position: absolute;
    left: 0;
    bottom: 0;
    display: block;
    width: 100%;
    height: 90px;
}

.hero-window {
    animation: window 2.6s ease-in-out infinite alternate;
}

.hero-window + .hero-window {
    animation-delay: -1.1s;
}

.shooting-star {
    position: absolute;
    top: 14%;
    left: 12%;
    width: 90px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, #fff);
    opacity: 0;
    animation: shooting-star 9s ease-in 3s infinite;
}

@keyframes twinkle {
    from {
        opacity: .2;
    }

    to {
        opacity: 1;
    }
}

@keyframes window {
    from {
        opacity: .7;
    }

    to {
        opacity: 1;
    }
}

@keyframes shooting-star {
    0% {
        opacity: 0;
        transform: translate(0, 0) rotate(10deg);
    }

    2% {
        opacity: 1;
    }

    10%, 100% {
        opacity: 0;
        transform: translate(560px, 100px) rotate(10deg);
    }
}

/* a week per row, monday first */
.calendar {
    container-type: inline-size;
}

.weekdays, .doors {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 16px;
}

/* clear of the snow on the first row of roofs */
.weekdays {
    margin-bottom: 14px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* a day without a door, weekends and the days around the calendar */
.door-blank {
    aspect-ratio: 1;
    border-radius: var(--radius);
    background: var(--sand);
    opacity: .6;
    animation: door-in .45s ease-out backwards;
    animation-delay: calc(var(--i, 0) * 30ms);
}

.door {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    text-decoration: none;
    user-select: none;
    animation: door-in .45s ease-out backwards;
    animation-delay: calc(var(--i, 0) * 30ms);
}

/* snow on the roof of every door */
.door::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: -7px;
    left: -3px;
    right: -3px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 18' preserveAspectRatio='none'%3E%3Cpath d='M0 8 C0 3 4 1 9 1 H91 C96 1 100 3 100 8 V10 C97 10 95 11 94 13 C93 17 89 17 88 13 C87 11 85 10 82 10 H64 C61 10 60 12 59 15 C58 18 54 18 53 15 C52 12 50 10 47 10 H30 C27 10 26 11 25 13 C24 15 21 15 20 13 C19 11 17 10 14 10 H4 C1 10 0 9 0 8Z' fill='white'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    filter: drop-shadow(0 1px 1px rgba(11, 37, 69, .22));
    pointer-events: none;
}

.door-number {
    font-family: var(--festive);
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
}

.door-badge {
    margin-top: 6px;
    font-size: .78rem;
    font-weight: 600;
}

/* frosted window */
.door.locked {
    background: linear-gradient(160deg, #F8FAFC 0%, #E3EAF2 100%);
    border: 2px solid #D5DFEA;
    color: #6F7F92;
}

.dark .door.locked {
    background: linear-gradient(160deg, #1B2838 0%, #142030 100%);
    border-color: #2A3B50;
    color: #8093A8;
}

/* rattles the handle, no peeking */
.door.locked:hover {
    animation: door-in .45s ease-out backwards, locked .35s ease-in-out;
    animation-delay: calc(var(--i, 0) * 30ms), 0s;
}

.door.open {
    background-color: var(--red);
    text-shadow: 0 1px 3px rgba(0, 0, 0, .45);
    /* ribbon, so open doors look like presents */
    background-image:
        linear-gradient(90deg, transparent 44%, rgba(224, 178, 82, .45) 44%, rgba(224, 178, 82, .45) 56%, transparent 56%),
        linear-gradient(0deg, transparent 44%, rgba(224, 178, 82, .45) 44%, rgba(224, 178, 82, .45) 56%, transparent 56%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
    transition: transform .15s ease, box-shadow .15s ease;
}

/* door-in stays in the list so leaving the hover doesn't replay the entrance */
.door.open:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .2);
    animation: door-in .45s ease-out backwards, wiggle .5s ease-in-out;
    animation-delay: calc(var(--i, 0) * 30ms), 0s;
}

.door.open.answered {
    background-color: var(--green);
}

.door.today::after {
    content: "";
    position: absolute;
    z-index: 1;
    inset: -6px;
    border: 3px solid var(--gold);
    border-radius: 14px;
    animation: today 2.2s ease-in-out infinite;
    pointer-events: none;
}

/* seven doors to a row get small on phones, the colors and the ring tell what the badge did */
@container (max-width: 640px) {
    /* rows further apart than columns, the roofs stick up */
    .weekdays, .doors {
        gap: 14px 8px;
    }

    .door-number {
        font-size: 1.5rem;
    }

    .door-badge {
        display: none;
    }
}

@container (max-width: 400px) {
    .weekdays, .doors {
        gap: 10px 5px;
    }

    .weekdays {
        font-size: .68rem;
        letter-spacing: 0;
    }

    .door-number {
        font-size: 1.15rem;
    }

    .door.locked {
        border-width: 1px;
    }

    .door::before {
        top: -5px;
        height: 12px;
    }

    .door.today::after {
        inset: -3px;
        border-width: 2px;
        border-radius: 12px;
    }
}

@keyframes door-in {
    from {
        opacity: 0;
        transform: translateY(-14px) scale(.95);
    }
}

/* shaking a present */
@keyframes wiggle {
    0%, 100% {
        transform: translateY(-3px) rotate(0);
    }

    20% {
        transform: translateY(-3px) rotate(-4deg);
    }

    40% {
        transform: translateY(-3px) rotate(3deg);
    }

    60% {
        transform: translateY(-3px) rotate(-2deg);
    }

    80% {
        transform: translateY(-3px) rotate(1deg);
    }
}

@keyframes locked {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

@keyframes today {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(224, 178, 82, .6);
    }

    50% {
        box-shadow: 0 0 18px 4px rgba(224, 178, 82, .55);
    }
}

/* door page */

.challenge, .answer, .notice, .ticket, .page {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 20px;
}

/* the door swings open */
.challenge {
    transform-origin: left center;
    animation: door-swing .7s cubic-bezier(.2, .8, .3, 1) backwards;
}

.challenge ~ .answer, .challenge ~ .winner {
    animation: rise .5s .25s ease-out backwards;
}

@keyframes door-swing {
    from {
        opacity: 0;
        transform: perspective(1400px) rotateY(50deg);
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

.challenge-meta {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

/* the answer form redirects to #svar, and the sticky top bar would cover the heading */
.answer {
    scroll-margin-top: calc(var(--topbar) + 16px);
}

/* the way on from a door without going back to the calendar, big enough for a thumb */
.door-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
}

.door-nav a {
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.door-nav a:hover {
    border-color: var(--gold);
}

.door-nav .next {
    justify-self: end;
}

.door-nav .previous {
    justify-self: start;
}

.markdown img {
    max-width: 100%;
    border-radius: 8px;
}

/* a long link breaks instead of running off the card */
.markdown {
    overflow-wrap: break-word;
}

/* images are made for a light page, so a transparent one gets white behind it */
.dark .markdown img {
    background: #fff;
}

/* quotes are the highlight box for riddles and rebuses */
.markdown blockquote {
    margin: 20px 0;
    padding: 18px 26px;
    background: var(--page);
    border-left: 4px solid var(--gold);
    border-radius: 8px;
    font-family: var(--festive);
    font-size: 1.35rem;
    line-height: 1.6;
}

.markdown blockquote p, .markdown blockquote ol, .markdown blockquote ul {
    margin: 0;
}

/* code blocks are secret messages. They wrap at the spaces on a phone, and only a line without any scrolls */
.markdown pre {
    padding: 18px 22px;
    background: var(--navy);
    color: var(--cream);
    border-radius: 8px;
    font-size: 1.3rem;
    letter-spacing: .12em;
    white-space: pre-wrap;
    overflow-x: auto;
}

.markdown pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* quiz layout: questions as a numbered list, options as a nested list */
.markdown > ol > li + li {
    margin-top: 10px;
}

.markdown li > ul {
    list-style: none;
    padding-left: 8px;
}

.markdown table {
    border-collapse: collapse;
}

.markdown th, .markdown td {
    border: 1px solid var(--line);
    padding: 6px 10px;
}

.answer textarea, .inline-form input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: inherit;
    font: inherit;
    resize: vertical;
}

.answer textarea:focus, .inline-form input:focus {
    outline: 2px solid var(--gold);
    border-color: transparent;
}

/* the robot check, in the page's colors */
altcha-widget {
    display: block;
    margin-bottom: 12px;
    --altcha-color-base: var(--surface);
    --altcha-color-base-content: var(--text);
    --altcha-color-neutral: var(--line);
    --altcha-color-neutral-content: var(--muted);
    --altcha-color-primary: var(--green);
    --altcha-color-success: var(--green);
    --altcha-color-error: var(--red);
    --altcha-border-radius: 8px;
}

.btn {
    display: inline-block;
    padding: 9px 20px;
    border: none;
    border-radius: 8px;
    background-color: var(--red);
    /* candy cane stripes, they start moving on hover */
    background-image: linear-gradient(45deg, rgba(255, 255, 255, .1) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .1) 50%, rgba(255, 255, 255, .1) 75%, transparent 75%);
    background-size: 24px 24px;
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform .1s ease;
}

.btn:hover {
    background-color: var(--red-dark);
    animation: candy 1s linear infinite;
}

/* pressed in, so a click is felt */
.btn:active {
    transform: scale(.96);
}

/* sent and waiting for the next page, see forms.js: the stripes run faster and a ring turns before the text */
.btn.busy {
    background-color: var(--red-dark);
    animation: candy .5s linear infinite;
    cursor: progress;
    transform: none;
}

.btn.busy::before {
    content: "";
    display: inline-block;
    width: .9em;
    height: .9em;
    margin-right: 8px;
    vertical-align: -.12em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.btn-quiet.busy {
    background-color: var(--line);
}

@keyframes candy {
    to {
        background-position: 24px 0;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn:disabled, .btn.disabled {
    opacity: .5;
    pointer-events: none;
}

.notice {
    max-width: 560px;
    margin: 40px auto;
    text-align: center;
}

.weekend-line {
    font-size: 1.2rem;
}

.banner {
    background: var(--gold-soft);
    border: 1px solid var(--gold);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
}

.muted {
    color: var(--muted);
}

.error {
    color: var(--red-text);
}

.saved {
    position: relative;
    color: var(--green-text);
    font-weight: 600;
}

.saved.fresh {
    transform-origin: left center;
    animation: pop .45s cubic-bezier(.3, 1.6, .5, 1);
}

/* stars and snowflakes flying out from the check mark */
.burst {
    position: absolute;
    left: .35em;
    top: .8em;
}

.burst i {
    position: absolute;
    font-style: normal;
    font-size: .95rem;
    color: var(--gold);
    opacity: 0;
    animation: burst .9s ease-out forwards;
}

.burst i:nth-child(3n+1) {
    color: var(--ice);
}

.burst i:nth-child(3n+2) {
    color: var(--red);
}

.burst i:nth-child(1) { --x: 46px; --y: 0px; }
.burst i:nth-child(2) { --x: 32px; --y: -26px; }
.burst i:nth-child(3) { --x: 14px; --y: -46px; }
.burst i:nth-child(4) { --x: -12px; --y: -38px; }
.burst i:nth-child(5) { --x: -40px; --y: -30px; }
.burst i:nth-child(6) { --x: -38px; --y: 2px; }
.burst i:nth-child(7) { --x: -30px; --y: 26px; }
.burst i:nth-child(8) { --x: -10px; --y: 44px; }
.burst i:nth-child(9) { --x: 14px; --y: 36px; }
.burst i:nth-child(10) { --x: 38px; --y: 28px; }

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(.6);
    }
}

@keyframes burst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(.3);
    }

    60% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1) rotate(160deg);
    }
}

.winner {
    position: relative;
    overflow: hidden;
    background: var(--gold-soft);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 20px;
    font-family: var(--festive);
    font-size: 1.25rem;
}

/* a glint passing over the gold */
.winner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .7) 50%, transparent 65%);
    transform: translateX(-100%);
    animation: shimmer 5s ease-in-out 1s infinite;
    pointer-events: none;
}

.dark .winner::after {
    background: linear-gradient(105deg, transparent 35%, rgba(224, 178, 82, .18) 50%, transparent 65%);
}

/* a line under the winner */
.winner-message {
    margin: 6px 0 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.winner .winner-message {
    margin-top: 10px;
    font-family: var(--sans);
    font-size: 1rem;
}

@keyframes shimmer {
    35%, 100% {
        transform: translateX(100%);
    }
}

/* the weekend door is asleep */
.zzz {
    position: relative;
    height: 52px;
    font-family: var(--festive);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ice);
}

.zzz span {
    position: absolute;
    left: 50%;
    bottom: 0;
    opacity: 0;
    animation: zzz 3s ease-out infinite;
}

.zzz span:nth-child(2) {
    font-size: 1.4rem;
    animation-delay: 1s;
}

.zzz span:nth-child(3) {
    font-size: 1.8rem;
    animation-delay: 2s;
}

@keyframes zzz {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) rotate(-10deg);
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50% + 30px), -40px) rotate(10deg);
    }
}

/* winners */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.table th, .table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.winner-note {
    margin: 4px 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* a ticket number in a sentence, kept on one line */
.ticket-inline {
    white-space: nowrap;
}

/* messages */

.message-image {
    display: block;
    max-width: 100%;
    margin-top: 12px;
    border-radius: 8px;
}

.pill {
    display: inline-block;
    margin-left: 6px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--sand);
    color: var(--muted);
    font-size: .75rem;
}

.pill.gold {
    background: var(--gold);
    color: var(--navy);
    font-weight: 600;
}

/* the ticket */

.ticket-label {
    margin: 0;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* swapping or removing the ticket, folded away since few need it */
.ticket-more {
    margin-bottom: 20px;
    padding: 0 4px;
}

.ticket-more summary {
    cursor: pointer;
    color: var(--muted);
}

.ticket-more[open] summary {
    margin-bottom: 12px;
}

.ticket-more .inline-form {
    justify-content: flex-start;
}

.ticket-code {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 6px 0 14px;
}

.ticket-code code {
    padding: 8px 14px;
    font-size: 1.15rem;
    word-break: break-word;
}

/* the moment a visitor gets their ticket, gold so it isn't missed */
.ticket-new {
    margin: 0 0 20px;
    padding: 16px 20px;
    border: 2px solid var(--gold);
    border-radius: var(--radius);
    background: var(--gold-soft);
}

.ticket-new .saved {
    margin-top: 0;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.inline-form input {
    flex: 1 1 260px;
    width: auto;
    margin-bottom: 0;
}

.btn-small {
    padding: 5px 14px;
    font-size: .9rem;
}

.btn-quiet {
    background: var(--sand);
    color: var(--text);
}

.btn-quiet:hover {
    background-color: var(--line);
}

.small {
    font-size: .85rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* phones */

@media (max-width: 800px) {
    .topbar {
        gap: 10px;
        padding: 0 12px;
    }

    .brand {
        gap: 8px;
        font-size: 1.05rem;
    }

    .content {
        padding: 28px 16px 48px;
    }

    .hero {
        padding: 24px 20px 96px;
    }

    .hero h1 {
        font-size: 2rem;
        padding-right: 40px;
    }

    .hero::after {
        top: 18px;
        right: 18px;
        width: 34px;
        height: 34px;
    }

    .challenge, .answer, .notice, .ticket, .page {
        padding: 20px;
    }

    .topnav {
        gap: 12px;
        margin-right: 0;
    }

    .topnav a {
        font-size: .85rem;
    }

    .markdown pre {
        padding: 14px 16px;
        font-size: 1.1rem;
        letter-spacing: .08em;
    }

    .markdown blockquote {
        padding: 14px 18px;
        font-size: 1.2rem;
    }
}

/* small phones: the year is in the hero on the front page anyway, and the snow and theme buttons go to the footer so the top bar fits */

@media (max-width: 420px) {
    .brand-year {
        display: none;
    }

    .topbar .snow-toggle, .topbar .theme-toggle {
        display: none;
    }

    .footer-toggles {
        display: flex;
    }

    .door-nav {
        gap: 6px;
    }

    .door-nav a {
        padding: 10px;
        font-size: .85rem;
    }

    /* the door number is the date, so the winner list can do without the date column */
    .table .date {
        display: none;
    }
}

/* still for people who asked their system for less motion, snow.js starts with the snow off for them */

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