@import url("https://fonts.googleapis.com/css2?family=Mountains+of+Christmas:wght@700&family=Fredoka:wght@400;500;600&display=swap");

/* ============ Palette & base ============ */
:root {
  --sky-top: #070d24;
  --sky-mid: #12285a;
  --sky-low: #1f4f7a;
  --gold: #f4c95d;
  --gold-deep: #c8912a;
  --red: #c8202f;
  --red-dark: #9a1422;
  --green: #17693d;
  --green-dark: #0e4a2a;
}
body {
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--sky-top);
  background-image: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-low) 100%);
  background-attachment: fixed;
  background-size: auto;
  overflow-x: hidden;
}
main, header.site { position: relative; z-index: 2; }

/* ============ Scenery (fixed background) ============ */
.scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.scene .aurora {
  position: absolute; width: 90vw; height: 40vh; border-radius: 50%;
  filter: blur(60px); opacity: .35; mix-blend-mode: screen;
}
.scene .a1 { background: radial-gradient(closest-side, #3ef0a5, transparent); top: -8vh; left: -20vw; animation: aurora 18s ease-in-out infinite alternate; }
.scene .a2 { background: radial-gradient(closest-side, #7a6bff, transparent); top: 2vh; right: -25vw; animation: aurora 23s ease-in-out infinite alternate-reverse; }
@keyframes aurora {
  0% { transform: translate(0, 0) scale(1, .8) rotate(-6deg); }
  100% { transform: translate(18vw, 4vh) scale(1.2, 1) rotate(8deg); }
}
.scene .star {
  position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px 1px rgba(255,255,255,.8);
  animation: twinkle 3s ease-in-out infinite;
}
.scene .star.big { width: 3px; height: 3px; }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.3); } }
.scene .moon {
  position: absolute; top: 7vh; right: 8vw; width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffbe8, #f6e7b0 60%, #e9d28a);
  box-shadow: 0 0 40px 12px rgba(255, 240, 190, .35), 0 0 120px 40px rgba(255, 240, 190, .12);
}
.scene .moon::after { /* craters */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle at 62% 58%, rgba(200,170,90,.35) 0 7px, transparent 8px),
    radial-gradient(circle at 40% 70%, rgba(200,170,90,.25) 0 4px, transparent 5px),
    radial-gradient(circle at 70% 30%, rgba(200,170,90,.25) 0 3px, transparent 4px);
}
.scene .sleigh {
  position: absolute; top: 13vh; left: 0; width: 230px; height: auto;
  filter: drop-shadow(0 0 6px rgba(255, 236, 180, .5));
  animation: sleigh 26s linear infinite;
  animation-delay: 2s;
  transform: translateX(-260px);
}
@keyframes sleigh {
  0% { transform: translate(-260px, 30px) rotate(-4deg); }
  25% { transform: translate(25vw, -10px) rotate(-2deg); }
  50% { transform: translate(55vw, 20px) rotate(-6deg); }
  70%, 100% { transform: translate(calc(100vw + 260px), -40px) rotate(-8deg); }
}
.scene .sleigh .nose { animation: nose 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes nose { 50% { opacity: .5; transform: scale(.7); } }
.scene .sleigh .legs-a { animation: gallop .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: top; }
.scene .sleigh .legs-b { animation: gallop .5s ease-in-out infinite alternate-reverse; transform-box: fill-box; transform-origin: top; }
@keyframes gallop { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }

.scene .hills { position: absolute; bottom: 0; left: 0; width: 100%; height: 26vh; min-height: 150px; }
.scene .window { animation: flicker 3s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: .82; } 50% { opacity: .95; } 70% { opacity: .78; } }
.scene .smoke { animation: smoke 4s ease-out infinite; opacity: 0; transform-box: fill-box; transform-origin: center; }
.scene .smoke:nth-child(2) { animation-delay: 1.3s; }
.scene .smoke:nth-child(3) { animation-delay: 2.6s; }
@keyframes smoke {
  0% { opacity: 0; transform: translate(0, 0) scale(.5); }
  20% { opacity: .55; }
  100% { opacity: 0; transform: translate(18px, -60px) scale(2.2); }
}

#snow { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 50; pointer-events: none; }
#hide-btn { display: block; margin: .5rem auto 0; }

/* ============ Header: lights, hat, title, countdown ============ */
.lights { position: absolute; top: 0; left: 0; width: 100%; height: 60px; z-index: 3; pointer-events: none; }
.lights .bulb { animation: glow 1.8s ease-in-out infinite; }
.lights .bulb.c1 { animation-delay: .6s; }
.lights .bulb.c2 { animation-delay: 1.2s; }
@keyframes glow {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 6px currentColor) drop-shadow(0 0 12px currentColor); }
  50% { opacity: .35; filter: none; }
}
header.site { padding-top: 3.6rem; }
header.site h1 {
  font-family: "Mountains of Christmas", Georgia, serif;
  font-size: clamp(2.4rem, 10vw, 3.8rem);
  line-height: 1.05;
  text-shadow: 0 3px 0 rgba(0,0,0,.25), 0 0 24px rgba(255,255,255,.15);
  position: relative;
  display: inline-block;
}
header.site h1 span {
  background: linear-gradient(100deg, #f4c95d 0%, #fff4c9 25%, #f4c95d 50%, #e3a63a 75%, #f4c95d 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 4s linear infinite;
  text-shadow: none;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.25));
}
@keyframes shimmer { to { background-position: -200% center; } }
.santa-hat {
  position: absolute; width: .85em; height: .85em; left: -.32em; top: -.42em;
  transform: rotate(-24deg); animation: hatbob 3s ease-in-out infinite;
}
@keyframes hatbob { 50% { transform: rotate(-16deg) translateY(-2px); } }
.countdown {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: .7rem; padding: .3rem .85rem; border-radius: 999px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  color: #fff; font-weight: 500; font-size: .95rem; backdrop-filter: blur(4px);
}
.countdown b { color: var(--gold); font-size: 1.1rem; }
header.site p#hello { font-size: 1.1rem; opacity: .95; }

/* ============ Cards ============ */
.card {
  position: relative;
  border-top: 0;
  padding-top: 1.6rem;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf7, #fbf3e3);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255,255,255,.4) inset;
  animation: rise .7s cubic-bezier(.2, .9, .3, 1.2) both;
}
.card::before { /* candy-cane ribbon */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 10px;
  background: repeating-linear-gradient(-45deg, var(--red) 0 12px, #fff 12px 24px);
  background-size: 34px 10px;
  animation: candy 1.6s linear infinite;
}
@keyframes candy { to { background-position: 34px 0; } }
.card::after { /* holly sprig */
  content: ""; position: absolute; top: 4px; right: 6px; width: 54px; height: 40px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 54 40'%3E%3Cpath d='M27 18 C20 6 8 4 2 8 C6 10 6 14 3 16 C8 16 9 20 7 23 C14 22 22 22 27 18Z' fill='%2317693d'/%3E%3Cpath d='M27 18 C34 6 46 4 52 8 C48 10 48 14 51 16 C46 16 45 20 47 23 C40 22 32 22 27 18Z' fill='%230e4a2a'/%3E%3Ccircle cx='23' cy='22' r='5' fill='%23c8202f'/%3E%3Ccircle cx='31' cy='22' r='5' fill='%23c8202f'/%3E%3Ccircle cx='27' cy='15' r='5' fill='%23e0293a'/%3E%3Ccircle cx='25.5' cy='13.5' r='1.5' fill='%23fff' opacity='.7'/%3E%3C/svg%3E") no-repeat center / contain;
  transform-origin: 50% 40%;
  animation: holly 4s ease-in-out infinite;
}
@keyframes holly { 50% { transform: rotate(6deg); } }
.card h2 { font-family: "Mountains of Christmas", Georgia, serif; font-size: 1.7rem; color: var(--red-dark); padding-right: 50px; }
@keyframes rise { from { opacity: 0; transform: translateY(30px) scale(.96); } to { opacity: 1; transform: none; } }
main > .card:nth-child(2), #home > .card:nth-child(2), #app > .card:nth-child(2) { animation-delay: .12s; }
main > .card:nth-child(3), #home > .card:nth-child(3), #app > .card:nth-child(3) { animation-delay: .24s; }

/* ============ Buttons & inputs ============ */
button, .btn {
  position: relative; overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(180deg, #e0303f, var(--red-dark));
  box-shadow: 0 4px 0 #6d0e18, 0 8px 16px rgba(0,0,0,.2);
  transition: transform .12s, box-shadow .12s;
  font-family: inherit;
}
button:hover { background: linear-gradient(180deg, #ea3d4c, var(--red)); transform: translateY(-1px); }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #6d0e18, 0 3px 8px rgba(0,0,0,.2); }
button::after { /* shine sweep */
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-20deg);
  transition: left .5s;
}
button:hover::after { left: 120%; }
button.secondary { background: linear-gradient(180deg, #1f8a50, var(--green-dark)); box-shadow: 0 4px 0 #083220, 0 8px 16px rgba(0,0,0,.2); }
button.secondary:hover { background: linear-gradient(180deg, #25a05e, var(--green)); }
button.ghost { background: #fff; box-shadow: 0 2px 0 #e2d6bf; border: 1px solid #e8dcc5; }
button.ghost:hover { background: #fff8ea; }
button.small { box-shadow: 0 3px 0 rgba(0,0,0,.18); }
button.ghost.small { box-shadow: 0 2px 0 #e2d6bf; }
#logout-btn { background: rgba(255,255,255,.1) !important; border-color: rgba(255,255,255,.3) !important; box-shadow: none !important; }
input:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(244, 201, 93, .35); }
textarea {
  background: #fff repeating-linear-gradient(180deg, transparent 0 1.9rem, #f1e6cf 1.9rem calc(1.9rem + 1px));
  background-position: 0 .55rem;
  line-height: 1.9rem;
}
.tabs { background: #f1e5cc; }
.tabs .tab, .tabs .tab:hover { box-shadow: none; transform: none; }
.tabs .tab.active { background: #fff; color: var(--red-dark); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.tabs .tab::after { display: none; }

/* ============ Gift lists with ornament bullets ============ */
ul.gifts { list-style: none; padding-left: 0; }
ul.gifts li {
  position: relative; padding: .45rem .6rem .45rem 2.1rem; margin: .4rem 0;
  background: #fff; border-radius: 12px; border: 1px solid #f0e4cb;
  animation: pop-in .45s cubic-bezier(.2, .9, .3, 1.4) both;
}
ul.gifts li::before { /* ornament */
  content: ""; position: absolute; left: .6rem; top: 50%; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0 2px, var(--orn, #c8202f) 3px, color-mix(in srgb, var(--orn, #c8202f) 70%, #000) 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
ul.gifts li::after { /* ornament cap */
  content: ""; position: absolute; left: calc(.6rem + 5px); top: 50%; margin-top: -10px; width: 6px; height: 4px;
  background: var(--gold-deep); border-radius: 1px;
}
ul.gifts li:nth-child(4n+2) { --orn: #17693d; }
ul.gifts li:nth-child(4n+3) { --orn: #d99a1e; }
ul.gifts li:nth-child(4n+4) { --orn: #2b6cd4; }
@keyframes pop-in { from { opacity: 0; transform: translateX(-14px) scale(.9); } to { opacity: 1; transform: none; } }

/* ============ Gift box reveal ============ */
.gift-btn {
  background: none !important; box-shadow: none !important; padding: 0; border: 0; min-height: 0;
  display: block; margin: .25rem auto 0; cursor: pointer; overflow: visible;
}
.gift-btn::after { display: none; }
.gift-btn:hover { transform: none; }
.gift-svg { width: 190px; max-width: 60vw; overflow: visible; animation: wiggle 2.8s ease-in-out infinite; transform-origin: 50% 95%; }
.gift-btn:hover .gift-svg, .gift-btn:focus-visible .gift-svg { animation-duration: .9s; }
@keyframes wiggle {
  0%, 60%, 100% { transform: rotate(0); }
  66% { transform: rotate(-6deg) scale(1.03); }
  72% { transform: rotate(6deg) scale(1.03); }
  78% { transform: rotate(-4deg); }
  84% { transform: rotate(3deg); }
}
.gift-svg .lid { transform-box: fill-box; transform-origin: 50% 100%; }
.gift-svg .beam { opacity: 0; transform-box: fill-box; transform-origin: 50% 100%; }
.gift-btn.opening .gift-svg { animation: shake .35s linear 1; }
.gift-btn.opening .lid { animation: lid-off .8s .3s cubic-bezier(.3, .6, .4, 1) forwards; }
.gift-btn.opening .beam { animation: beam .9s .35s ease-out forwards; }
@keyframes shake { 25% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } 75% { transform: rotate(-5deg); } }
@keyframes lid-off {
  0% { transform: none; }
  30% { transform: translateY(-30px) rotate(-6deg); }
  100% { transform: translate(90px, -210px) rotate(70deg); opacity: 0; }
}
@keyframes beam { 0% { opacity: 0; transform: scaleY(.2); } 40% { opacity: .9; transform: scaleY(1); } 100% { opacity: 0; transform: scaleY(1.2); } }
.tap-hint { font-weight: 600; color: var(--red-dark); margin: .4rem 0 0; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.reveal .who {
  font-family: "Mountains of Christmas", Georgia, serif;
  font-size: clamp(2.8rem, 13vw, 4rem);
  color: var(--red);
  text-shadow: 0 2px 0 #fff, 0 0 18px rgba(244, 201, 93, .9), 0 0 40px rgba(244, 201, 93, .5);
  position: relative; display: inline-block;
  animation: name-pop .9s cubic-bezier(.2, 1.4, .4, 1) both;
}
.reveal .who::before, .reveal .who::after {
  content: "✦"; position: absolute; color: var(--gold); font-size: .45em; animation: sparkle 1.4s ease-in-out infinite;
}
.reveal .who::before { left: -.6em; top: .1em; }
.reveal .who::after { right: -.6em; bottom: .2em; animation-delay: .7s; }
@keyframes sparkle { 0%, 100% { transform: scale(.4) rotate(0); opacity: .3; } 50% { transform: scale(1.2) rotate(90deg); opacity: 1; } }
@keyframes name-pop {
  0% { opacity: 0; transform: translateY(40px) scale(.2); }
  60% { opacity: 1; transform: translateY(-8px) scale(1.15); }
  100% { transform: none; }
}

/* ============ Snowman (waiting card) ============ */
.snowman { float: right; width: 96px; margin: -.4rem -.2rem .2rem .6rem; animation: bob 3s ease-in-out infinite; transform-origin: 50% 100%; }
.snowman .arm-r { transform-box: fill-box; transform-origin: 0% 100%; animation: wave 1.2s ease-in-out infinite; }
.snowman .eyes { transform-box: fill-box; transform-origin: center; animation: blink 4s infinite; }
@keyframes bob { 50% { transform: rotate(3deg) translateY(-2px); } }
@keyframes wave { 50% { transform: rotate(-28deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }

/* ============ Organizer list ============ */
ul.people > li { animation: pop-in .4s both; }
.temp-pw { animation: pop-in .4s both; }

@media (max-width: 600px) {
  .scene .moon { width: 44px; height: 44px; top: 150px; right: 12px; }
  .scene .sleigh { width: 170px; }
}

/* ============ Respect reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
  .scene .sleigh { display: none; }
}

/* ============ Music button ============ */
.music-btn {
  position: fixed; left: 16px; bottom: 16px; z-index: 40;
  width: 56px; height: 56px; min-height: 0; padding: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a6, var(--gold) 55%, var(--gold-deep)) !important;
  box-shadow: 0 6px 18px rgba(0,0,0,.4), 0 0 0 3px rgba(255,255,255,.35) !important;
  font-size: 1.5rem; overflow: visible;
}
.music-btn::after { display: none; }
.music-btn.on { animation: music-pulse 1.4s ease-in-out infinite; }
@keyframes music-pulse { 50% { box-shadow: 0 6px 18px rgba(0,0,0,.4), 0 0 0 8px rgba(244,201,93,.35); } }
.music-btn .notes i {
  position: absolute; left: 50%; top: 0; font-style: normal; color: #fff; font-size: 1rem;
  text-shadow: 0 0 6px var(--gold); opacity: 0; animation: note-float 2.4s ease-out infinite;
}
.music-btn .notes i:nth-child(2) { animation-delay: .8s; left: 30%; }
.music-btn .notes i:nth-child(3) { animation-delay: 1.6s; left: 70%; }
@keyframes note-float {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -48px) rotate(20deg); }
}
.music-toast {
  position: fixed; left: 82px; bottom: 26px; z-index: 40;
  background: rgba(7, 13, 36, .85); color: #fff; padding: .45rem .8rem; border-radius: 999px;
  font-size: .9rem; border: 1px solid rgba(255,255,255,.2);
  opacity: 0; transform: translateX(-10px); transition: opacity .4s, transform .4s; pointer-events: none;
}
.music-toast.show { opacity: 1; transform: none; }
main { padding-bottom: 6rem; }

/* ============ Anonymous chat ============ */
.chat-box { margin-top: 1.25rem; padding-top: 1rem; border-top: 2px dashed #efdfbf; }
.chat-box h3 { font-family: "Mountains of Christmas", Georgia, serif; font-size: 1.45rem; color: var(--green-dark); margin: 0 0 .25rem; }
.chat { display: flex; flex-direction: column; gap: .45rem; margin: .75rem 0; max-height: 320px; overflow-y: auto; padding: .2rem; }
.chat-empty { text-align: center; font-style: italic; margin: .25rem 0; }
.bubble { max-width: 85%; padding: .5rem .75rem; border-radius: 16px; overflow-wrap: anywhere; animation: pop-in .35s both; white-space: pre-wrap; }
.bubble .who-said { display: block; font-size: .75rem; font-weight: 600; opacity: .75; margin-bottom: .1rem; }
.bubble.mine { align-self: flex-end; background: linear-gradient(180deg, #1f8a50, var(--green-dark)); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: #fff; border: 1px solid #f0e4cb; border-bottom-left-radius: 4px; }
.chat-form { display: flex; gap: .5rem; align-items: flex-end; }
.chat-form textarea { min-height: 0; height: 3.2rem; background: #fff; line-height: 1.4; resize: none; }
.chat-form button { flex-shrink: 0; }
.pill { display: inline-block; font-family: "Fredoka", sans-serif; font-size: .8rem; background: var(--red); color: #fff; border-radius: 999px; padding: .1rem .55rem; vertical-align: middle; animation: pulse 1.2s infinite; }
.new-badge { text-align: center; margin: .25rem 0 0; font-weight: 600; color: var(--green-dark); animation: pulse 1.6s infinite; }
