
:root {
    color-scheme: dark;
    --ink: #090f20;
    --panel: #111a2a;
    --text: #f7f0e2;
    --muted: #bec8d3;
    --gold: #f2cf89;
    --border: #354353;
    --evergreen: #143b33;
    --display: Georgia, "Times New Roman", serif;
    --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body.advent {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(ellipse at 38% 38%, #192b3b 0, var(--ink) 70%) var(--ink);
    color: var(--text);
    font: 1rem/1.55 var(--sans);
}
[hidden] { display: none !important; }
a { color: var(--gold); text-underline-offset: .24em; }
a:hover { color: #ffebc1; }
:focus-visible { outline: 2px solid #ffdc94; outline-offset: 4px; }
button, input, textarea, select { font: inherit; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: normal; line-height: 1.08; }
h1 { font-size: clamp(2.5rem, 7vw, 5rem); letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.55rem, 3vw, 2rem); }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
}
.masthead, .advent-shell { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.masthead {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.masthead a { text-decoration: none; }
.brand { color: var(--text); font: 1.23rem/1.15 var(--display); white-space: nowrap; }
.brand span { color: var(--gold); margin-inline-end: 4px; }
.masthead nav { text-align: right; font-size: .9rem; }
.advent-shell { padding-block-end: 64px; }
.hero {
    position: relative;
    isolation: isolate;
    min-height: clamp(294px, 36vw, 404px);
    display: flex;
    align-items: center;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid #a692684d;
    background: linear-gradient(90deg, #0b1429 0%, #0b1429d4 26%, #0c193050 68%, #10203505 100%),
        #152c45 url("../images/advent-village.webp") center 58% / cover no-repeat;
    box-shadow: 0 14px 44px #050a1687;
}
.theme-forest .hero {
    background-image:
        linear-gradient(90deg, #0e241f 0%, #102b21d9 26%, #173c295c 70%, #14352015 100%),
        url("../images/advent-village.webp");
}
.hero-content { position: relative; z-index: 1; padding: 34px clamp(23px, 5vw, 67px); max-width: 720px; }
.hero-content h1 { margin-block: 8px 14px; text-wrap: balance; text-shadow: 0 3px 22px #080f24; }
.hero-content > p:not(.eyebrow) { max-width: 34ch; color: #f3eadc; font-size: clamp(1rem, 2vw, 1.2rem); }
.eyebrow { color: var(--gold); font-size: .88rem; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }
.hero .button { margin-top: 20px; }
.snow { position: absolute; inset: 0; pointer-events: none; overflow: hidden; opacity: .63; }
.snow i {
    position: absolute;
    top: -8px;
    left: var(--left);
    width: var(--size, 3px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: #fff3da;
    box-shadow: 0 0 8px #f7ebdbaa;
    animation: drift var(--speed, 15s) var(--delay, -8s) linear infinite;
}
.snow i:nth-child(1) { --left: 17%; --speed: 22s; }
.snow i:nth-child(2) { --left: 37%; --delay: -2s; }
.snow i:nth-child(3) { --left: 55%; --speed: 18s; --delay: -13s; --size: 4px; }
.snow i:nth-child(4) { --left: 65%; --delay: -5s; }
.snow i:nth-child(5) { --left: 76%; --speed: 20s; --delay: -11s; --size: 2px; }
.snow i:nth-child(6) { --left: 86%; --delay: -14s; --size: 2px; }
.snow i:nth-child(7) { --left: 94%; --speed: 24s; --delay: -17s; --size: 4px; }
@keyframes drift { to { translate: 45px 420px; } }
.calendar-switcher { margin-top: 18px; padding: 13px 17px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.calendar-switcher summary span { margin-inline-start: .6em; color: var(--muted); font-size: .88rem; }
.calendar-switcher ul { display: grid; gap: 5px; padding: 0; margin: 12px 0 0; list-style: none; }
.calendar-switcher a { display: block; padding: 7px 9px; border-radius: 7px; }
.calendar-switcher a[aria-current] { background: var(--evergreen); }
.calendar-banner { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
.hero:has(.calendar-banner)::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #0b1429ee, #0b142999 54%, #0b14291a); }
.surprise-banner { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; margin-bottom: 20px; }
.banner-preview { width: min(100%, 560px); max-height: 160px; object-fit: cover; border-radius: 10px; }
.surprise-navigation { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.advent-richtext .richtext-toolbar { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 10px; }
.advent-richtext button { cursor: pointer; min-width: 39px; min-height: 38px; border: 1px solid var(--border); border-radius: 6px; background: #19273a; color: var(--text); }
.advent-richtext .muted { color: var(--muted); font-size: .875rem; }
.calendar-info {
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    margin-block: 24px 20px;
    padding: 16px 21px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #0e1828c4;
}
.progress-block label { display: flex; justify-content: space-between; gap: 8px; }
.progress-block span, .countdown strong { color: var(--gold); font-variant-numeric: tabular-nums; }
.progress-block progress {
    display: block;
    width: 100%;
    height: .42rem;
    margin-top: 8px;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    background: #28394a;
    accent-color: var(--gold);
}
.progress-block progress::-webkit-progress-bar { background: #28394a; }
.progress-block progress::-webkit-progress-value { background: linear-gradient(90deg, #b37f3f, var(--gold)); }
.progress-block progress::-moz-progress-bar { background: var(--gold); }
.countdown { min-height: 2.7rem; display: grid; align-content: center; justify-items: end; color: var(--muted); font-size: .88rem; }
.countdown strong { min-height: 1.35em; }
.doors {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(9px, 1.6vw, 18px);
    list-style: none;
    padding: 0;
    margin: 0;
}
.door-slot { min-width: 0; perspective: 700px; }
.door-form { height: 100%; }
.door {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    min-height: clamp(108px, 14vw, 148px);
    padding: 11px 5px 12px;
    border: 1px solid #546477;
    border-radius: 48% 48% 10px 10px / 23% 23% 10px 10px;
    color: var(--text);
    background: linear-gradient(150deg, #25344a, #111b2b);
    transform-origin: left center;
    transition: transform .24s ease, box-shadow .22s ease, border-color .2s ease;
}
.door::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 5px;
    border: 1px solid currentColor;
    border-radius: inherit;
    opacity: .23;
    pointer-events: none;
}
.door.locked { color: #9babbe; }
.door.pending { color: #eddbbd; border-style: dashed; background: linear-gradient(155deg, #342c33, #201e2b); }
.door.available {
    color: #ffe4a8;
    border-color: #e0b576;
    background: radial-gradient(ellipse at top, #396348, #122e2b 82%);
    box-shadow: 0 0 22px #e4b67624, inset 0 0 18px #efd28c14;
}
.door.opened { color: #e3eee8; border-color: #789a96; background: linear-gradient(156deg, #254751, #162e3a); }
.door.opened .door-emblem { font-size: 0; }
.door.opened .door-emblem::after { content: "✓"; font-size: .98rem; }
.finale .door { box-shadow: inset 0 0 20px #f4bf6724, 0 0 13px #dca35b22; }
.theme-forest .door.locked { background: linear-gradient(155deg, #253c37, #142625); }
button.door { cursor: pointer; }
button.door:hover { transform: translateY(-3px); border-color: #ffeecc; box-shadow: 0 4px 23px #dcac6566; }
button.door.is-opening { transform: rotateY(-27deg); box-shadow: 0 0 45px #ffd29588; }
.door-emblem { align-self: end; font-size: .95rem; line-height: 1; }
.door-day { display: block; font: clamp(2.15rem, 5vw, 3.75rem)/.98 var(--display); }
.door-state { font-size: .875rem; line-height: 1.15; text-align: center; }
.finale .door { border-color: #ad8752; background: radial-gradient(ellipse at 50% 12%, #523949, #2b2332 85%); color: #ffdf9a; }
.finale .door.available { background: radial-gradient(ellipse at 50% 24%, #80513d, #38232f 83%); box-shadow: 0 0 28px #eab36758; }
.finale .door-emblem { font-size: 1.25rem; }
.finale .door.opened { background: radial-gradient(ellipse at 50% 18%, #526348, #253229 84%); }
.back-link { display: inline-block; margin-block: 3px 18px; }
.surprise {
    width: min(100%, 790px);
    margin-inline: auto;
    border: 1px solid #b0916266;
    border-radius: 20px;
    padding: clamp(22px, 5vw, 58px);
    background: linear-gradient(147deg, #222b3c, #111b2a 74%);
    animation: reveal .52s cubic-bezier(.15, .65, .25, 1) both;
}
.surprise-finale { border-color: #edbe80; box-shadow: 0 0 48px #dd9f5b2b; }
.surprise h1 { margin-block: 9px 24px; font-size: clamp(2rem, 5.2vw, 3.65rem); }
.surprise-cover, .surprise video { display: block; max-width: 100%; max-height: 540px; object-fit: contain; border-radius: 12px; margin-block: 10px 22px; }
.surprise .entry-content { overflow-wrap: anywhere; color: var(--text); }
.surprise .entry-content :is(p, ul, ol) { margin-block: .8em; }
.surprise .entry-content img { max-width: 100%; height: auto; }
.surprise .entry-content iframe { display: block; width: 100%; max-width: 100%; }
.surprise-media { margin-top: 22px; }
.surprise-media h2 { font-size: 1.45rem; }
@keyframes reveal {
    from { opacity: 0; transform: translateY(12px) scale(.981); filter: brightness(1.21); }
    to { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
}
.studio { max-width: 940px; margin-inline: auto; }
.studio-title { margin-block: 8px 26px; }
.studio-title h1 { margin-block: 7px 10px; font-size: clamp(2.3rem, 5vw, 4.3rem); }
.studio-title > p:last-child { color: var(--muted); }
.panel, .notice {
    padding: clamp(15px, 3vw, 25px);
    margin-block: 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.notice { border-color: #507e66; }
.notice-error { border-color: #bf776d; background: #3c212b; color: #ffe2d4; }
.editor-form { display: grid; gap: 15px; }
.editor-form label:not(.check) { display: grid; gap: 6px; min-width: 0; }
.editor-form :is(input:not([type=checkbox]), textarea, select) {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid #4b5c6e;
    border-radius: 7px;
    background: #0e1826;
    color: var(--text);
}
.editor-form textarea { resize: vertical; }
.editor-form fieldset { min-width: 0; border: 1px solid var(--border); border-radius: 8px; margin: 0; padding: 12px; }
.editor-form legend { padding-inline: 5px; }
.field-help, small, .section-title > p { color: var(--muted); font-size: .875rem; }
.reset-check { color: #f2d4ac; }
.check { display: flex; align-items: baseline; gap: 9px; }
.check input { align-self: start; margin: .32em 0 0; accent-color: var(--gold); flex: 0 0 auto; }
.settings-grid, .media-fields, .recipients { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.file-field small { display: block; margin-block: 4px; }
.form-actions { display: flex; align-items: start; flex-wrap: wrap; gap: 10px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 14px;
    background: var(--gold);
    color: #271a11;
    text-decoration: none;
    font-weight: 650;
    cursor: pointer;
}
.button:hover { color: #20170d; background: #ffe6b4; }
.button.secondary { color: var(--gold); background: transparent; border-color: #8d7658; }
.button.secondary:hover { background: #422f25; }
.section-title { display: flex; justify-content: space-between; gap: 8px; align-items: end; flex-wrap: wrap; }
.editor-days, .owned-calendars { padding: 0; list-style: none; display: grid; gap: 8px; }
.editor-days { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.owned-calendars { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
:is(.editor-days, .owned-calendars) a {
    display: grid;
    gap: 3px;
    height: 100%;
    padding: 7px 9px;
    border: 1px solid #3a4b60;
    border-radius: 8px;
    text-decoration: none;
}
:is(.editor-days, .owned-calendars) a:hover { background: #213245; }
:is(.editor-days, .owned-calendars) span { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
summary { cursor: pointer; color: var(--gold); }
.openings-panel table { width: 100%; border-collapse: collapse; }
.openings-panel :is(th, td) { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.openings-panel > :not(summary) { margin-top: 14px; }
@media (max-width: 680px) {
    .masthead, .advent-shell { width: calc(100% - 26px); }
    .masthead { min-height: 62px; }
    .hero {
        min-height: 236px;
        align-items: flex-end;
        background-image: linear-gradient(0deg, #0b142af5, #0b142a6b 64%, #0c193015), url("../images/advent-village.webp");
        background-position: center, 63% 55%;
    }
    .theme-forest .hero { background-image: linear-gradient(0deg, #10271ef5, #10271e6b 64%, #0c193015), url("../images/advent-village.webp"); }
    .hero-content { padding: 28px 20px; }
    .calendar-info { grid-template-columns: 1fr; gap: 12px; padding: 12px 14px; margin-block: 15px; }
    .countdown { justify-items: start; }
    .doors { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .finale { grid-column: span 3; }
    .finale .door { min-height: 128px; }
    .editor-days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .media-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .snow { display: none; }
    .door, .surprise { transition: none; animation: none; }
    button.door:hover, button.door.is-opening { transform: none; }
}
.advent .ui-language-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
    margin-block: .75rem;
}
.advent .ui-language-form :is(select, button) {
    font: inherit;
    min-height: 2rem;
    padding-inline: .5rem;
    color: var(--gold);
    background: #101e2b;
    border: 1px solid var(--border);
    border-radius: .4rem;
}
.advent-challenge { margin-block: 1.5rem; }
.advent-challenge > p { margin: .55rem 0 1rem; }
.challenge-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.challenge-box {
    min-height: 10.2rem;
    padding: .8rem .65rem;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: .38rem;
    border-radius: .8rem;
    border: 1px solid #b7925b;
    color: #fff3da;
    background: linear-gradient(160deg, #274957 0%, #142835 49%, #101e2b 50%);
    box-shadow: inset 0 0 0 3px #162b37, inset 0 0 0 4px #b7925b40;
    text-align: center;
    cursor: pointer;
}
.challenge-box:hover, .challenge-box:focus-visible { border-color: #ffda92; background-color: #26415b; }
.challenge-mark { color: #ffd883; font-size: 2rem; line-height: 1.05; }
.challenge-box > span:last-child { font-size: .88rem; line-height: 1.4; }
.challenge-box.is-retry { animation: advent-retry 270ms ease both; }
.challenge-box.is-solved { border-color: #ffe3a2; box-shadow: 0 0 16px #f4bf6777; animation: advent-solved 440ms ease both; }
.challenge-result { margin-top: .9rem; }
.challenge-result [role=status] { min-height: 1.5rem; }
.challenge-reward { color: #ffe3a2; font-weight: 700; margin-block: .35rem; }
.challenge-result [data-challenge-explanation] { margin-top: .6rem; }
.advent-treasures { margin-block: .9rem; padding: .65rem .95rem; border: 1px solid #3c5265; border-radius: .65rem; }
.advent-treasures summary { color: #ffdb9a; cursor: pointer; }
@keyframes advent-retry { 25%, 75% { transform: translateX(-3px); } 50% { transform: translateX(3px); } }
@keyframes advent-solved { 45% { transform: translateY(-4px) scale(1.035); } }
@media (max-width: 575px) {
    .challenge-options { grid-template-columns: 1fr; }
    .challenge-box { grid-template-columns: 2.4rem 1fr; min-height: 4.7rem; justify-items: start; text-align: left; }
    .challenge-mark { grid-row: span 2; align-self: center; }
}
@media (prefers-reduced-motion: reduce) {
    .challenge-box.is-retry, .challenge-box.is-solved { animation: none; }
}
