:root {
  --bg: #0b1838;
  --bg-2: #13265a;
  --ink: #f6f1e4;
  --muted: #b9c4e0;
  --gold: #f2c94c;
  --red: #c8202f;
  --green: #1f8a47;
  --card: #fffaf0;
  --card-ink: #2a2233;
  --line: #e6dcc6;
  --radius: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% -10%, rgba(80, 120, 220, .35), transparent 60%),
    radial-gradient(ellipse at 90% 10%, rgba(54, 255, 176, .10), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, #08112a 100%);
  background-color: var(--bg);
  min-height: 100vh;
}
button { font: inherit; cursor: pointer; }
.page { max-width: 1400px; margin: 0 auto; padding: 20px 16px 32px; }

/* ----------------------------------------------------------------- hero */
.hero { text-align: center; margin: 4px 0 18px; }
.eyebrow { margin: 0; letter-spacing: .3em; text-transform: uppercase; font-weight: 800; font-size: .8rem; color: var(--gold); }
.hero h1 {
  font-family: "Mountains of Christmas", Georgia, serif;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.05; margin: 6px 0 4px; font-weight: 700;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 30px rgba(242, 201, 76, .25);
}
.days-num { color: var(--gold); font-size: 1.25em; }
.subline { margin: 0; color: var(--muted); font-size: 1.05rem; }
.viewing { margin: 10px 0 0; font-weight: 700; }
.badge { display: inline-block; background: var(--red); color: #fff; font-size: .72rem; padding: 2px 9px; border-radius: 99px; vertical-align: 2px; letter-spacing: .05em; text-transform: uppercase; }
.badge[hidden] { display: none; }
.ticker { display: flex; gap: 10px; justify-content: center; align-items: baseline; flex-wrap: wrap; margin: 12px 0 0; min-height: 1.6em; }
.ticker span { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; padding: 4px 10px; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.ticker i { font-style: normal; font-weight: 400; color: var(--muted); font-size: .72rem; margin-left: 4px; }
.ticker em { font-style: normal; color: var(--muted); font-size: .9rem; }

/* --------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; } }

.soundbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.snd { background: rgba(255, 255, 255, .08); color: var(--ink); border: 1px solid rgba(255, 255, 255, .18); border-radius: 99px; padding: 6px 14px; font-weight: 700; transition: background .2s, border-color .2s; }
.snd:hover { background: rgba(255, 255, 255, .16); }
.snd[aria-pressed="true"] { background: var(--gold); color: #2a1a00; border-color: var(--gold); }
.snd.pending { animation: pending 1.4s ease-in-out infinite; }
@keyframes pending { 50% { opacity: .55; } }
.now-playing { color: var(--muted); font-size: .9rem; margin-left: 4px; }

.scene-wrap {
  position: relative; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9; background: #16295a;
  box-shadow: 0 0 0 6px #6b4226, 0 0 0 10px #4b2d17, 0 20px 50px rgba(0, 0, 0, .5);
}
.scene, .scene svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.chip { position: absolute; top: 12px; left: 12px; background: rgba(8, 17, 42, .7); backdrop-filter: blur(4px); padding: 5px 12px; border-radius: 99px; font-weight: 800; font-size: .82rem; pointer-events: none; border: 1px solid rgba(255, 255, 255, .2); }
.chip-eve, .chip-christmas { background: rgba(200, 32, 47, .85); }
.chip-holiday { background: rgba(30, 155, 215, .85); }

.caption { font-size: 1.08rem; line-height: 1.5; margin: 18px 4px 4px; min-height: 3em; }
.hint { margin: 4px 4px 12px; color: var(--muted); font-size: .9rem; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; }
.controls button { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 800; background: #fff; color: var(--card-ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .3); transition: transform .1s; }
.controls button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.controls button.primary { background: var(--red); color: #fff; }
.controls button:disabled { opacity: .5; cursor: default; }
.controls button.ghost { background: transparent; color: var(--ink); border: 2px solid rgba(255, 255, 255, .35); box-shadow: none; }
.controls button.playing { background: var(--gold); color: #2a1a00; border-color: var(--gold); }
@media (max-width: 560px) {
  .controls button span { display: none; }
  .controls button { flex: 1; }
  .controls button.ghost { flex-basis: 100%; }
  .chip { font-size: .7rem; top: 8px; left: 8px; padding: 3px 9px; }
  .scene-wrap { box-shadow: 0 0 0 4px #6b4226, 0 0 0 7px #4b2d17, 0 12px 30px rgba(0, 0, 0, .5); }
}

/* ---------------------------------------------------------------- cards */
.side { display: grid; gap: 20px; }
.card { background: var(--card); color: var(--card-ink); border-radius: var(--radius); padding: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.card h2 { margin: 0; font-family: "Mountains of Christmas", Georgia, serif; font-size: 1.6rem; color: var(--red); }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-nav { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f1e7d0; font-size: 1.4rem; line-height: 1; color: var(--card-ink); }
.cal-nav:hover { background: #e8dabb; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow span { text-align: center; font-size: .72rem; font-weight: 800; color: #8a7d68; padding: 2px 0; }
.cal-day {
  position: relative; aspect-ratio: 1; border: 0; border-radius: 9px; background: #f3ecdc; color: var(--card-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; line-height: 1.1;
}
.cal-day b { font-size: .95rem; }
.cal-day small { font-size: .62rem; opacity: .75; font-weight: 700; }
.cal-day:hover { outline: 2px solid var(--gold); }
.cal-day.ph-prep { background: color-mix(in srgb, #1f8a47 calc(var(--lvl) * 70% + 12%), #f3ecdc); }
.cal-day.ph-prep[style*="--lvl:0.7"], .cal-day.ph-prep[style*="--lvl:0.8"], .cal-day.ph-prep[style*="--lvl:0.9"], .cal-day.ph-prep[style*="--lvl:1"] { color: #fff; }
.cal-day.ph-eve, .cal-day.ph-christmas { background: var(--red); color: #fff; }
.cal-day.ph-tidy { background: color-mix(in srgb, #8e6cc4 calc(var(--lvl) * 50% + 15%), #f3ecdc); }
.cal-day.ph-holiday { background: #e3f1f8; color: #4a6577; }
.cal-day.is-today::after { content: ""; position: absolute; inset: -2px; border: 2px dashed var(--red); border-radius: 11px; }
.cal-day.selected { outline: 3px solid var(--gold); outline-offset: 1px; box-shadow: 0 0 0 5px rgba(242, 201, 76, .35); }
.jump { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-weight: 700; font-size: .9rem; }
.jump input { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--card-ink); }
.legend { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: #6b5f4d; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.prep { background: #1f8a47; } .sw.eve { background: var(--red); } .sw.tidy { background: #8e6cc4; } .sw.holiday { background: #bfe0f0; }

.milestones { list-style: none; padding: 0; margin: 10px 0 0; max-height: 470px; overflow: auto; }
.ms { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 7px 4px; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.ms:last-child { border-bottom: 0; }
.ms-done { color: #8a7d68; }
.ms-done .ms-label { text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .25); }
.ms-today { background: #fff1c2; border-radius: 8px; font-weight: 800; }
.ms-next { font-weight: 800; }
.tick { color: var(--green); font-weight: 800; }
.pill { font-size: .75rem; background: #f1e7d0; border-radius: 99px; padding: 2px 8px; white-space: nowrap; font-weight: 700; }
.pill.now { background: var(--red); color: #fff; }

.footer { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 28px; }

/* ------------------------------------------------------ scene text */
.sign-text { font-family: "Mountains of Christmas", Georgia, serif; font-weight: 700; font-size: 32px; fill: #fff6dc; }
.board-big { font-family: "Mountains of Christmas", Georgia, serif; font-weight: 700; font-size: 22px; fill: #c8202f; }
.board-small { font-family: Nunito, sans-serif; font-weight: 800; font-size: 12px; fill: #3a200f; }
.chalk { font-family: "Mountains of Christmas", Georgia, serif; font-weight: 700; fill: #f4f4ec; }
.banner-text { font-family: "Mountains of Christmas", Georgia, serif; font-weight: 700; font-size: 110px; fill: #ffd84d; stroke: #7a0c1d; stroke-width: 4; paint-order: stroke; }
.postcard-text { font-family: "Mountains of Christmas", Georgia, serif; font-weight: 700; font-size: 20px; fill: #2a2233; }
.bubble-text { font-family: Nunito, sans-serif; font-weight: 800; font-size: 19px; fill: #1b2a4a; }
.bubble { animation: pop .25s ease-out; transform-box: fill-box; transform-origin: 50% 100%; pointer-events: none; }
.bubble.out { opacity: 0; transition: opacity .35s; }

/* ------------------------------------------------------ interactivity */
[data-hit] { cursor: pointer; }
[data-drag] { cursor: grab; touch-action: none; }
[data-drag].dragging { cursor: grabbing; filter: drop-shadow(0 10px 6px rgba(0, 0, 0, .35)); }
[data-hit]:hover { filter: brightness(1.08); }

.door { transform-box: fill-box; transform-origin: 0% 50%; transition: transform .6s cubic-bezier(.5, 1.6, .6, 1); }
.door.open { transform: scaleX(.12); }
@keyframes beckon { 0%, 100% { opacity: .1; transform: scale(.8); } 50% { opacity: .5; transform: scale(1.15); } }
.beckon { transform-box: fill-box; transform-origin: center; animation: beckon 2s ease-in-out infinite; }
.bell-swing { transform-box: fill-box; transform-origin: 50% 0%; }
.ring .bell-swing { animation: ring .7s ease-in-out; }
.hopper { transform-box: fill-box; transform-origin: 50% 100%; }
.hopper.hop { animation: hop .6s ease-out; }
.hopper.wiggle { animation: wiggle .6s ease-in-out; }
.hat-pop .snow-hat { animation: hatpop .7s ease-out; }
.snow-hat { transform-box: fill-box; transform-origin: 50% 100%; }
#tree { transform-box: fill-box; transform-origin: 50% 100%; }
#tree.shake { animation: treeshake .8s ease-in-out; }
#tree.shake .twinkle { animation-duration: .25s; }
.campfire.roar .flames { animation: roar 1.3s ease-out; }
.flames { transform-box: fill-box; transform-origin: 50% 100%; }

/* --------------------------------------------------------- animations */
.bob { animation: bob 1.4s ease-in-out infinite; }
.walk { animation: bob .55s ease-in-out infinite; }
.jump { animation: jump .8s ease-in-out infinite; }
.swing { transform-box: fill-box; transform-origin: 0% 100%; animation: swing .55s ease-in-out infinite; }
.wave { transform-box: fill-box; transform-origin: 0% 100%; animation: wave 1s ease-in-out infinite; }
.brush { transform-box: fill-box; transform-origin: 0% 50%; animation: brush 1.2s ease-in-out infinite; }
.sweep { transform-box: fill-box; transform-origin: 20% 0%; animation: sweep 1s ease-in-out infinite; }
.saw { animation: saw .45s ease-in-out infinite; }
.twinkle { animation: twinkle 1.6s ease-in-out infinite; }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
.rock { transform-box: fill-box; transform-origin: 50% 100%; animation: rock 3.4s ease-in-out infinite; }
.nod { transform-box: fill-box; transform-origin: 100% 100%; animation: nod 4s ease-in-out infinite; }
.tail { animation: twinkle 2s ease-in-out infinite; }
.smoke { transform-box: fill-box; transform-origin: center; animation: smoke 6.2s linear infinite; }
.steam { animation: steam 2s ease-in-out infinite; }
.zzz { animation: zzz 3s ease-in infinite; }
.spin-slow { transform-box: fill-box; transform-origin: center; animation: shine 2.4s ease-in-out infinite; }
.aurora { animation: aurora 14s ease-in-out infinite alternate; }
.fly { animation: fly 16s linear infinite; }
.firework { transform-box: fill-box; transform-origin: center; animation: firework 2.6s ease-out infinite; }
.flame { transform-box: fill-box; transform-origin: 50% 100%; }
.flame.f1 { animation: flicker .9s ease-in-out infinite; }
.flame.f2 { animation: flicker .7s ease-in-out infinite reverse; }
.flame.f3 { animation: flicker .5s ease-in-out infinite; }
.fire-glow { animation: glowpulse 1.8s ease-in-out infinite; }
.spark { animation: spark 2.1s linear infinite; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } }
@keyframes swing { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(38deg); } }
@keyframes wave { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(18deg); } }
@keyframes brush { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(10deg); } }
@keyframes sweep { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(12deg); } }
@keyframes saw { 0%, 100% { transform: translateX(-4px); } 50% { transform: translateX(5px); } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes rock { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@keyframes nod { 0%, 80%, 100% { transform: rotate(0); } 88% { transform: rotate(-10deg); } }
@keyframes smoke { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 15% { opacity: .8; } 100% { transform: translate(40px, -150px) scale(2.4); opacity: 0; } }
@keyframes steam { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: .8; transform: translateY(-4px); } }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 10px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -24px); } }
@keyframes shine { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.12) rotate(8deg); } }
@keyframes aurora { from { transform: translateX(-40px); } to { transform: translateX(40px) skewX(-4deg); } }
@keyframes fly { 0% { transform: translate(1700px, 60px); } 50% { transform: translate(500px, -20px); } 100% { transform: translate(-900px, 40px); } }
@keyframes firework { 0% { transform: scale(.1); opacity: 0; } 10% { opacity: 1; } 70% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.15); opacity: 0; } }
@keyframes flicker { 0%, 100% { transform: scale(1, 1) skewX(0); } 30% { transform: scale(.94, 1.08) skewX(3deg); } 60% { transform: scale(1.04, .92) skewX(-3deg); } }
@keyframes glowpulse { 0%, 100% { opacity: .8; } 50% { opacity: 1; } }
@keyframes spark { 0% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(14px, -70px); opacity: 0; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(25deg); } 40% { transform: rotate(-22deg); } 60% { transform: rotate(14deg); } 80% { transform: rotate(-8deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1); } 15% { transform: translateY(0) scale(1.1, .9); } 45% { transform: translateY(-26px) scale(.95, 1.05); } 75% { transform: translateY(0) scale(1.05, .95); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(7deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); } }
@keyframes hatpop { 0%, 100% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-40px) rotate(-20deg); } 70% { transform: translateY(-10px) rotate(8deg); } }
@keyframes treeshake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-2.5deg); } 40% { transform: rotate(2deg); } 60% { transform: rotate(-1.5deg); } 80% { transform: rotate(1deg); } }
@keyframes roar { 0% { transform: scale(1); } 30% { transform: scale(1.5, 1.9); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .scene svg *, .bubble { animation: none !important; transition: none !important; }
}
