:root {
    color-scheme: light;
    --sky: #111d3a;
    --sky-deep: #0a132c;
    --sky-light: #2b3c65;
    --sky-text: #fff6e8;
    --sky-muted: #e4d8c6;
    --gold: #f8d78a;
    --gold-deep: #ecb86e;
    --paper: #fffaf0;
    --paper-2: #f7ecdb;
    --ink: #271d2d;
    --muted: #665266;
    --line: #e3d3c4;
    --action: #8c2857;
    --action-text: #fff8f8;
    --headline: "Georgia", "Times New Roman", serif;
    --body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-theme="night"] {
    color-scheme: dark;
    --sky: #131313;
    --sky-deep: #080808;
    --sky-light: #2b2b2b;
    --sky-text: #fafafa;
    --sky-muted: #d7d7d7;
    --gold: #e6e6e6;
    --gold-deep: #c9c9c9;
    --paper: #1d1d1d;
    --paper-2: #282828;
    --ink: #f5f5f5;
    --muted: #d2d2d2;
    --line: #555;
    --action: #ededed;
    --action-text: #181818;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--sky-text);
    background-color: var(--sky-deep);
    background-image:
        radial-gradient(ellipse at 50% 4%, var(--sky-light), transparent 34rem),
        linear-gradient(var(--sky), var(--sky-deep) 82rem);
    font-family: var(--body);
    line-height: 1.5;
}
[data-theme="night"] :is(.window, .noto, .story-figure, .signature-img, .card-preview, .garland) { filter: grayscale(1); }
img { max-width: 100%; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--headline); }
h1, h2, h3, p { margin-top: 0; }
:focus-visible { outline: 3px solid #ee9b40; outline-offset: 4px; }
.container { width: min(1120px, calc(100% - 44px)); margin-inline: auto; }
.sr-only, .skip:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.skip:focus { position: absolute; z-index: 20; top: .7rem; left: .7rem; background: var(--paper); color: var(--ink); padding: .6rem; }

.masthead {
    position: relative;
    z-index: 3;
    background: color-mix(in srgb, var(--sky-deep) 88%, transparent);
    border-bottom: 1px solid #ffffff22;
}
.top { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font: bold clamp(1.05rem, 3.5vw, 1.33rem)/1.2 var(--headline); white-space: nowrap; }
.noto { display: inline-grid; place-items: center; width: 44px; height: 44px; font-size: 30px; line-height: 1; }
.noto img { display: block; width: 100%; height: 100%; object-fit: contain; }
.quick { display: flex; gap: 5px; align-items: center; }
.quick a, .quick-label { display: inline-block; padding: 9px 13px; font-size: .88rem; font-weight: 650; text-decoration: none; white-space: nowrap; border-radius: 30px; }
.quick a:hover { background: #ffffff19; }
.quick-label { color: var(--sky-muted); }
.night-button, .preview-form button {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid #ffffff45; border-radius: 30px; background: #ffffff0f;
    color: var(--sky-text); padding: 7px 13px; font-size: .84rem; white-space: nowrap;
}
.night-button span:first-child { font-size: 1.15rem; }
.preview-strip { position: relative; z-index: 2; background: var(--paper-2); color: var(--ink); }
.preview-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px; padding-block: 10px; font-size: .88rem; }
.preview-form button, .preview-arrow { color: var(--ink); border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 4px 11px; }
.preview-form input { padding: 3px 6px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--paper); }
.preview-arrow { text-decoration: none; }

.intro { text-align: center; position: relative; isolation: isolate; max-width: 720px; margin: auto; padding: 72px 0 42px; }
.intro h1 {
    margin: 0 auto 17px;
    color: var(--sky-text);
    font-size: clamp(3rem, 8.3vw, 6.1rem);
    line-height: .96;
    letter-spacing: -.06em;
    text-shadow: 0 5px 35px #0e132678;
}
.intro h1 em { font-weight: inherit; color: var(--gold); }
.edition { margin: 0 0 17px; color: var(--gold); font-size: .77rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.intro > p:not(.edition) { font-size: clamp(.98rem, 3.5vw, 1.12rem); color: var(--sky-muted); margin: 20px 0 0; }
.intro .btn { margin-top: 18px; }
.garland { position: absolute; top: 10px; left: 50%; width: min(82%, 394px); height: 35px; transform: translateX(-50%); border-bottom: 1px solid #e8bb737d; border-radius: 0 0 52% 52%; display: flex; justify-content: space-around; pointer-events: none; }
.garland i { --offset: 18px; position: relative; top: var(--offset); width: 7px; height: 9px; border-radius: 65%; background: #ffdf97; box-shadow: 0 0 10px 3px #ffd78b70; animation: shimmer 5s ease-in-out infinite alternate; }
.garland i:nth-child(2), .garland i:nth-child(6) { --offset: 28px; background: #fdacc3; animation-delay: -2s; }
.garland i:nth-child(3), .garland i:nth-child(5) { --offset: 33px; animation-delay: -4s; background: #a7e9d8; }
.garland i:nth-child(4) { --offset: 34px; }
@keyframes shimmer { 40% { box-shadow: 0 0 15px 4px #ffdb9cba; } 100% { opacity: .63; } }

.snow { position: fixed; inset: 0; overflow: hidden; z-index: 4; pointer-events: none; }
.snow i {
    position: absolute; inset: -400px 0 0; opacity: .24; animation: snowfall 35s linear infinite;
    background-image:
        radial-gradient(2px 2px at 40px 70px, #fff 96%, transparent),
        radial-gradient(1.5px 1.5px at 182px 190px, #fff 96%, transparent),
        radial-gradient(1px 1px at 304px 325px, #fff 96%, transparent);
    background-size: 340px 400px;
}
.snow i:nth-child(2) { animation-duration: 55s; animation-delay: -20s; opacity: .18; background-position: 70px 165px; }
.snow i:nth-child(3) { animation-duration: 75s; animation-delay: -35s; opacity: .15; background-position: 135px 85px; }
@keyframes snowfall { to { transform: translateY(400px); } }

.doors {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-rows: clamp(125px, 16vw, 174px);
    grid-auto-flow: row dense;
    gap: clamp(11px, 2vw, 21px);
    padding-block: 6px 45px;
}
.tile { min-width: 0; height: 100%; position: relative; z-index: 1; }
.shape-0 { transform: translateY(6px) rotate(-2.2deg) scale(.96); }
.shape-1 { transform: translateY(2px) rotate(1.7deg); }
.shape-2 { transform: translateY(-4px) rotate(-.6deg) scale(.92); }
.shape-3 { transform: translateY(5px) rotate(1.3deg) scale(.95); }
.shape-4 { transform: translateY(-3px) rotate(-1.3deg); }
.tile.finale { grid-column: 3 / span 2; grid-row: 3 / span 2; transform: rotate(.5deg); }
.window {
    width: 100%; height: 100%; display: grid; place-items: center; position: relative; isolation: isolate;
    border-radius: clamp(13px, 2.8vw, 24px) clamp(13px, 2.8vw, 24px) 12px 12px;
}
.window.closed {
    color: #382437;
    border: 1px solid #fff9;
    background:
        repeating-linear-gradient(45deg, #fff1 0 1px, transparent 1px 12px),
        linear-gradient(142deg, #fff4, transparent 58%, #80504c19), var(--door);
    box-shadow: inset 0 3px 6px #fff2, 0 7px 20px #0005;
}
.door-frame { position: absolute; inset: 8px; border: 1px solid #5b313248; border-radius: inherit; box-shadow: inset 0 0 0 2px #fff4; }
.door-number { color: inherit; font: 700 clamp(2.3rem, 7vw, 4.2rem)/1 var(--headline); text-shadow: 0 2px 0 #fff8; }
.finale .door-number { font-size: clamp(4.5rem, 13vw, 8.2rem); }
.finale .window { border-radius: 34% 34% 15px 15px / 24% 24% 15px 15px; }
.finale .door-frame { border-color: #9c632377; inset: 10px; box-shadow: inset 0 0 0 3px #fff6; }
.blinkies { position: absolute; inset: 2px; pointer-events: none; }
.blinkies i {
    position: absolute; top: 0; left: 0; width: 4px; height: 4px; border-radius: 50%;
    background: #fffaf0; box-shadow: 0 0 6px 1px #fff6cf; opacity: .8;
    animation: orbit 6s linear infinite;
    animation-delay: var(--delay, 0s);
}
.blinkies i:nth-child(2) { animation-delay: calc(var(--delay, 0s) - 1.5s); background: #fff0ab; }
.blinkies i:nth-child(3) { animation-delay: calc(var(--delay, 0s) - 3s); }
.blinkies i:nth-child(4) { animation-delay: calc(var(--delay, 0s) - 4.5s); background: #fff0ab; }
@keyframes orbit {
    0% { top: 0; left: 10%; }
    25% { top: 0; left: calc(100% - 7px); }
    50% { top: calc(100% - 6px); left: calc(100% - 7px); }
    75% { top: calc(100% - 6px); left: 1px; }
    96% { top: 0; left: 1px; }
    100% { top: 0; left: 10%; }
}
.finale .blinkies { inset: 15% 2% 2%; }
.window.open {
    overflow: hidden; text-decoration: none; background: var(--door); color: #fff;
    box-shadow: 0 0 18px #ffca7959, 0 4px 25px #0009;
    border: 1px solid #f7d888cf;
    transition: box-shadow .2s, transform .2s;
}
.window.open:hover { box-shadow: 0 0 28px #ffce8185; transform: translateY(-3px); }
.open img { width: 100%; height: 100%; object-fit: cover; object-position: center 43%; }
.open::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 46%, #141022df); pointer-events: none; }
.window.open .date-number, .window.open .window-title { position: absolute; }
.window.open .date-number { z-index: 2; }
.date-number { inset: 9px auto auto 9px; font: bold 1.09rem/1 var(--headline); padding: 7px; background: #2b2034e8; border: 1px solid #ffdd96b0; border-radius: 50%; min-width: 34px; text-align: center; }
.finale .date-number { inset: 15% auto auto 12%; min-width: 42px; font-size: 1.35rem; padding: 10px; }
.window.open .window-title {
    bottom: 11px;
    left: 10px;
    right: 10px;
    z-index: 1;
    font: 700 clamp(.625rem, 1.15vw, .85rem)/1.2 Verdana, Geneva, sans-serif;
    overflow-wrap: anywhere;
    max-height: 3.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}
.finale .window.open .window-title {
    font-size: clamp(.78rem, 1.65vw, 1.1rem);
    bottom: 16px;
    left: 14px;
    right: 14px;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .55em;
    padding: 11px 17px; min-height: 44px; border: 1px solid transparent; border-radius: 12px;
    font-weight: 750; line-height: 1.25; text-decoration: none;
}
.btn:hover { box-shadow: inset 0 0 0 2px currentColor; }
.btn.warm { color: #30243b; background: var(--gold); }
.btn.action { color: var(--action-text); background-color: var(--action); }
.btn.neutral { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn svg { flex: 0 0 auto; }

.opening {
    max-width: min(calc(100vw - 30px), 445px); max-height: calc(100dvh - 26px); text-align: center; overflow: auto;
    border: 1px solid #f6d88da0; border-radius: 24px; padding: 28px 22px 23px;
    background: var(--sky); color: var(--sky-text); box-shadow: 0 10px 80px #08051acc;
}
[data-theme="night"] .opening { filter: grayscale(1); }
.opening::backdrop { background: #080d21c4; backdrop-filter: blur(5px); }
.opening h2 { margin: 2px 22px 16px; font-size: clamp(1.45rem, 6vw, 2.22rem); line-height: 1.04; text-wrap: balance; }
.close-opening { position: absolute; top: 8px; right: 9px; border: 1px solid #ffffff55; color: var(--sky-text); background: var(--sky-deep); width: 37px; height: 37px; border-radius: 50%; font-size: 1.45rem; line-height: 1; }
.reveal { position: relative; perspective: 700px; width: min(100%, 340px); aspect-ratio: 1.35; margin: 0 auto 18px; border: 1px solid #f6d88dc0; border-radius: 18px; background: var(--door); }
.reveal img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.reveal-door {
    position: absolute; inset: 0; display: grid; place-items: center; transform-origin: left center;
    color: #382437; background: linear-gradient(140deg, #fff6, transparent), var(--door);
    box-shadow: inset 0 0 0 8px #fff3, 0 4px 13px #0005;
    backface-visibility: hidden;
    border: 2px solid #b88d5d; border-radius: inherit;
    font: bold 5rem/1 var(--headline);
}
.opening[open] .reveal-door { animation: open-door 1.2s cubic-bezier(.15,.55,.24,1) .38s both; }
@keyframes open-door { to { transform: rotateY(-114deg); } }

.story-shell { width: min(820px, calc(100% - 38px)); margin-block: 27px 48px; }
.back-calendar { display: inline-block; color: var(--gold); text-decoration: none; font-weight: 720; font-size: .95rem; padding: 9px 0; margin-bottom: 10px; }
.back-calendar:hover { text-decoration: underline; }
.story-paper, .activity {
    overflow: hidden; background: var(--paper); color: var(--ink);
    border: 1px solid var(--line); border-radius: 25px; box-shadow: 0 9px 36px #00102c45;
}
.story-figure { margin: 0; background: var(--paper-2); }
.story-figure img { width: 100%; height: auto; max-height: min(70svh, 650px); object-fit: contain; display: block; }
.readable { padding: clamp(21px, 5vw, 54px); max-width: 74ch; margin-inline: auto; }
.story-heading { margin-bottom: 27px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.date-label { color: var(--action); font-size: .83rem; text-transform: uppercase; letter-spacing: .13em; margin: 0 0 8px; font-weight: 800; }
.story-heading h1 { font-size: clamp(2.05rem, 7vw, 3.9rem); line-height: 1.02; letter-spacing: -.045em; margin: 0 0 12px; }
.summary { color: var(--muted); font-size: 1.03rem; margin-bottom: 0; }
.story-text { font-family: var(--headline); font-size: clamp(1.13rem, 3vw, 1.32rem); line-height: 1.66; }
.story-text p { margin: 0 0 1em; }
.story-text p:last-child { margin-bottom: 0; }
.story-text h3 { color: var(--action); margin: 1.3em 0 .45em; font-size: 1.2em; }
.activities { display: grid; gap: 15px; margin: 17px 0; }
.activity { padding: clamp(20px, 5vw, 31px); text-align: center; scroll-margin-top: 16px; }
.activity h2 { line-height: 1.1; font-size: clamp(1.75rem, 4vw, 2.18rem); margin: 0 0 8px; }
.activity p { color: var(--muted); margin: 0 0 12px; }
.color-preview, .card-preview { display: block; width: fit-content; margin: 15px auto; }
.color-preview img, .card-preview img { display: block; width: auto; height: auto; max-height: 470px; border-radius: 12px; border: 1px solid var(--line); }
.signature-img { display: block; width: auto; max-height: 340px; margin: 15px auto; }
.import-status { padding-top: 10px; }
.manual-color { display: block; }
.noel-shortcut {
    position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 5;
    display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; text-decoration: none;
    color: var(--ink); border: 1px solid var(--gold); background: var(--paper); box-shadow: 0 4px 15px #10193a66;
}
.noel-shortcut .tree { animation: tree-sway 5s ease-in-out infinite; transform-origin: center 85%; }
@keyframes tree-sway { 32%, 53% { transform: rotate(0); } 40% { transform: rotate(5deg); } 47% { transform: rotate(-4deg); } }
.footer { display: grid; justify-items: center; gap: 6px; color: var(--sky-muted); text-align: center; padding: 23px 0 34px; font-size: .78rem; border-top: 1px solid #ffffff30; }
.footer p { margin: 0; }
.noto-credit { opacity: .86; font-size: .74rem; }
.pi { display: grid; place-items: center; width: 38px; height: 38px; font: 1.45rem/1 var(--headline); color: inherit; text-decoration: none; opacity: .67; border-radius: 50%; }

.admin-shell { padding-block: 29px 44px; }
.admin-shell > h1 { font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.02; }
.admin-toolbar, .editor-heading { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-toolbar { margin-bottom: 16px; }
.admin-workspace { display: grid; grid-template-columns: minmax(145px, 190px) minmax(0, 1fr); align-items: start; gap: 17px; }
.admin-panel { background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: clamp(14px, 3vw, 27px); }
.login-panel { max-width: 440px; }
.admin-panel h2 { line-height: 1.14; margin: 0 0 .6em; }
.admin-panel label { display: block; margin: 0 0 13px; font-size: .98rem; font-weight: 700; }
.admin-panel input:not([type="hidden"]), .admin-panel textarea {
    display: block; width: 100%; margin-top: 4px; padding: 9px 10px; background: var(--paper);
    color: var(--ink); border: 1px solid var(--line); border-radius: 7px;
}
.admin-panel input[type="color"] { width: 72px; height: 46px; }
.admin-panel textarea { min-height: 64px; resize: vertical; font-weight: 450; }
.admin-panel small { font-weight: 450; color: var(--muted); }
.admin-edit { display: grid; gap: 13px; }
.editor-heading { justify-content: space-between; margin-bottom: 8px; }
.editor-heading h2 { margin: 0; }
.days-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 11px; }
.days-menu a { text-align: center; text-decoration: none; padding: 7px 4px; border-radius: 7px; background: var(--paper-2); font-weight: 700; }
.days-menu a[aria-current] { background: var(--action); color: var(--action-text); }
.upload-row { display: flex; gap: 8px; align-items: flex-end; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.upload-row label { margin: 0; min-width: 0; }
.upload-row button { flex-shrink: 0; }
.scan { margin-bottom: 14px; }
.notice, .error { padding: 11px 14px; border-radius: 9px; color: var(--ink); background-color: var(--paper-2); }
.error { border-left: 4px solid #ca3458; }

@media (max-width: 900px) {
    .doors { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .tile.finale { grid-column: 3 / span 2; grid-row: 3 / span 2; }
}
@media (max-width: 660px) {
    .container { width: calc(100% - 24px); }
    .top { min-height: 61px; flex-wrap: wrap; justify-content: space-between; column-gap: 6px; row-gap: 1px; padding: 4px 0; }
    .top .quick { order: 3; width: 100%; justify-content: center; border-top: 1px solid #ffffff24; }
    .quick a, .quick-label { padding: 8px 11px; }
    .intro { padding-top: 63px; padding-bottom: 29px; }
    .doors { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: clamp(105px, 26vw, 156px); gap: 13px 10px; }
    .tile.finale { grid-column: 2 / span 2; grid-row: 5 / span 2; }
    .preview-form { gap: 6px 8px; }
    .admin-workspace { grid-template-columns: 1fr; }
    .days-menu { grid-template-columns: repeat(8, 1fr); }
    .story-figure img { max-height: min(63svh, 530px); }
}
@media (max-width: 350px) {
    .upload-row { flex-wrap: wrap; }
    .tile:not(.finale) .window.open .window-title { left: 6px; right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
    .opening[open] .reveal-door { display: none; }
    .snow { display: none; }
}
