/* Jamcat's Christmas Jazz Card. Mobile first, nothing loaded from other sites. */
@font-face { font-family: "Caveat"; src: url("/xmas/fonts/caveat-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("/xmas/fonts/caveat-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/xmas/fonts/fraunces-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --night: #0A1322; --navy: #12223A; --cream: #F4F1EA; --paper: #F8F2E7; --ink: #4A3426;
  --amber: #FFC86B; --gold: #FFD27A; --red: #C23B4E; --mint: #6CF5D6;
  --hand: "Caveat", "Kaiti TC", "STKaiti", "KaiTi", cursive;
  --serif: "Fraunces", Georgia, "Songti TC", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--night); }
body {
  margin: 0; min-height: 100vh; color: var(--cream); font-family: var(--sans);
  background: linear-gradient(180deg, #08101E 0%, #12223A 55%, #1D2F48 100%) fixed;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 8px; }

/* ---------- snow: lots of it ---------- */
.snowfall { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.snowfall i, .scene::after {
  position: absolute; inset: -40px 0 0 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.95) 2.2px, transparent 3px),
    radial-gradient(circle, rgba(255,255,255,.8) 1.6px, transparent 2.3px),
    radial-gradient(circle, rgba(255,255,255,.55) 1.2px, transparent 1.8px);
  background-size: 140px 140px, 90px 90px, 52px 52px;
  background-position: 0 0, 40px 60px, 20px 30px;
  animation: snow 12s linear infinite;
}
.snowfall i:nth-child(2) { background-size: 200px 200px, 120px 120px, 70px 70px; animation-duration: 18s; opacity: .8; filter: blur(.6px); }
.snowfall i:nth-child(3) { background-size: 260px 260px, 170px 170px, 96px 96px; animation-duration: 9s; opacity: .55; }
[data-snow="light"] .snowfall i:nth-child(n+2) { display: none; }
[data-snow="cosy"] .snowfall i:nth-child(3) { display: none; }
@keyframes snow { to { background-position: 30px 560px, 80px 420px, -20px 300px; } }

/* ---------- layout ---------- */
.wrap { position: relative; z-index: 2; max-width: 440px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 18px 40px; display: flex; flex-direction: column; align-items: center; }

.music {
  position: relative; z-index: 4; display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border: 0; border-radius: 999px; background: var(--amber); color: #1A1207; font: 600 16px/1 var(--sans); cursor: pointer;
  animation: pulse 2s ease-out infinite;
}
.music svg { width: 18px; height: 18px; }
.music .eq { display: none; align-items: flex-end; gap: 3px; height: 14px; }
.music .eq span { width: 3px; height: 14px; border-radius: 2px; background: var(--amber); transform-origin: bottom; animation: eq .9s ease-in-out infinite; }
.music .eq span:nth-child(2) { animation-delay: .3s; } .music .eq span:nth-child(3) { animation-delay: .6s; }
.music #playing-label { display: none; }
.music.on { background: rgba(244,241,234,.1); border: 1px solid rgba(244,241,234,.2); color: var(--cream); animation: none; font-weight: 500; font-size: 14px; }
.music.on .note-icon, .music.on #music-label { display: none; }
.music.on .eq, .music.on #playing-label { display: inline-flex; }
.music.on #playing-label b { color: var(--amber); font-weight: 500; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,200,107,.55); } 100% { box-shadow: 0 0 0 20px rgba(255,200,107,0); } }
@keyframes eq { 0%,100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.scene { position: relative; width: 100%; margin: 18px 0 0; border-radius: 22px; overflow: hidden; box-shadow: 0 24px 50px rgba(0,0,0,.45); aspect-ratio: 360 / 300; background: #1C2F57; }
.scene svg { display: block; width: 100%; height: 100%; }
.scene::after { content: ""; position: absolute; pointer-events: none; background-size: 90px 90px, 60px 60px, 36px 36px; animation-duration: 8s; }
.scene::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background-image: radial-gradient(circle, rgba(255,255,255,.9) 2.6px, transparent 3.4px); background-size: 120px 120px; background-position: 30px 10px; animation: snow 6s linear infinite; }
.where { margin: 12px 0 0; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; letter-spacing: .04em; color: rgba(244,241,234,.75); }
.where svg { width: 14px; height: 14px; }

.note {
  position: relative; width: calc(100% - 16px); margin: 22px 0 0; padding: 22px 24px 18px; background: var(--paper); color: var(--ink);
  border-radius: 6px; transform: rotate(-1.2deg); box-shadow: 0 18px 34px rgba(0,0,0,.35);
}
.note::before { content: ""; position: absolute; top: -10px; left: 50%; width: 84px; height: 22px; margin-left: -42px; background: rgba(255,210,122,.75); transform: rotate(2deg); }
.dear { margin: 0; font: 600 30px/1.1 var(--hand); }
.msg { margin: 8px 0 0; font: 500 24px/1.3 var(--hand); white-space: pre-line; }
.sign { margin: 10px 0 0; text-align: right; font: 600 28px/1 var(--hand); color: #B23A48; }
.note.long .msg { font-size: 21px; line-height: 1.28; } .note.longer .msg { font-size: 19px; }
html[lang^="zh"] .note.long .msg { font-size: 17px; } html[lang^="zh"] .note.longer .msg { font-size: 16px; }
html[lang^="zh"] .dear { font-size: 24px; } html[lang^="zh"] .msg { font-size: 19px; line-height: 1.6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 0 28px; margin-top: 28px;
  border-radius: 999px; background: var(--amber); color: #1A1207; text-decoration: none; font: 600 17px/1 var(--sans);
}
.btn svg { width: 20px; height: 20px; }

/* ---------- gift ---------- */
.gift { width: 100%; margin-top: 56px; padding-top: 24px; text-align: center; scroll-margin-top: 16px; }
.gift h2 { margin: 0; font: 500 30px/1.15 var(--serif); }
.gift .sub { margin: 8px 0 0; font-size: 15px; color: rgba(244,241,234,.72); }
.tv { position: relative; margin: 22px 0 0; border-radius: 18px; overflow: hidden; aspect-ratio: 16 / 9; background: linear-gradient(180deg, #0E1C30, #2B3B52); box-shadow: 0 18px 36px rgba(0,0,0,.4); }
.tv iframe, .tv video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.tv-play { position: absolute; inset: 0; width: 100%; border: 0; padding: 0; background: none; cursor: pointer; color: var(--cream); }
.tv-play .xscene-mini { position: absolute; inset: 0; width: 100%; height: 100%; }
.tv-play .play { position: absolute; left: 50%; top: 50%; width: 66px; height: 66px; margin: -40px 0 0 -33px; border-radius: 50%; background: var(--amber); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 22px rgba(0,0,0,.4); }
.tv-play .play svg { width: 26px; height: 26px; margin-left: 4px; }
.tv-play #tv-title { position: absolute; left: 14px; bottom: 12px; font-size: 13px; font-weight: 500; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.label { margin: 24px 0 10px; font-size: 13px; color: rgba(244,241,234,.7); }
.listen { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 46px; padding: 0 18px; border-radius: 14px; background: rgba(244,241,234,.1); border: 1px solid rgba(244,241,234,.2); color: var(--cream); text-decoration: none; font-size: 15px; font-weight: 500; }
.chip:hover { background: rgba(244,241,234,.18); }
.love { margin: 36px 0 0; font: 600 26px/1.2 var(--hand); color: var(--gold); }
.share { margin-top: 14px; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 0; background: none; color: rgba(244,241,234,.78); font: 15px var(--sans); cursor: pointer; }
.share svg { width: 18px; height: 18px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 9; transform: translate(-50%, 20px); opacity: 0; padding: 12px 18px; border-radius: 12px; background: var(--cream); color: #1A1207; font-size: 14px; transition: .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- scene life ---------- */
.xb { animation: tw 2.4s ease-in-out infinite; }
.xs { animation: tw 1.6s ease-in-out infinite; }
.xstar { animation: tw 3s ease-in-out infinite; }
.xfw { transform-box: fill-box; transform-origin: center; animation: burst 2.8s ease-out infinite; }
.xfw:nth-of-type(2) { animation-delay: .9s; } .xfw:nth-of-type(3) { animation-delay: 1.8s; }
.xwheel { transform-origin: 112px 130px; animation: spin 60s linear infinite; }
.xwave { transform-origin: 250px 258px; animation: wave 1.6s ease-in-out infinite; }
.xeyes { transform-origin: 210px 146px; animation: blink 5s infinite; }
.xwalk { animation: walk 2.8s cubic-bezier(.3,.7,.4,1) both; }
.xbob { animation: hop .35s ease-in-out 8 both, breathe 3.2s 3s ease-in-out infinite; }
.xp { opacity: 0; animation: print .3s ease-out forwards; }
.xnote { opacity: 0; transform-box: fill-box; transform-origin: center; }
.playing .xnote { animation: float 3.2s ease-out infinite; }
@keyframes walk { from { transform: translateX(-200px); } to { transform: translateX(0); } }
@keyframes hop { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes breathe { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes print { to { opacity: .8; } }
@keyframes float { 0% { opacity: 0; transform: translate(0, 0) rotate(-8deg); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -70px) rotate(10deg); } }
@keyframes tw { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes burst { 0% { transform: scale(.2); opacity: 0; } 15% { opacity: 1; } 70% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.1); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wave { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-16deg); } }
@keyframes blink { 0%,92%,100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }

@media (prefers-reduced-motion: reduce) {
  .snowfall i, .music, .xb, .xs, .xstar, .xfw, .xwheel, .xwave, .xeyes, .xwalk, .xbob, .xnote { animation: none !important; }
  .xp { opacity: .8; animation: none; }
}
