/* Christmas (2026-11-23, her ask: "网站我想改成圣诞节的背景跟漂浮物…音乐我也想改成圣诞节的音乐").
   Same layout rules as autumn.css (which it replaces while LCS_XMAS=1):
   Home page: a Christmas patchwork tablecloth (tea_scene.PATTERNS_XMAS), 8 Christmas friends + a "Merry Christmas" garland.
   Every page except the games: snow falling down the screen; inner page titles sit on a soft red gingham.
   Music: <html data-season="xmas"> makes sound.js play the Christmas music box medley.
   Only transform/opacity move. Nothing here can be tapped (pointer-events:none), and it all sits below the sticky header (20),
   the round buttons / Book / sound button (30), the WeChat window (60), the coupon window (150), the oven loader (200)
   and the catalog reader (2000).
   Rule of thumb: no friend may sit on text. Big screens keep them in the side margins; phones and tablets only get them
   on the first screen, at the very edges. */

/* ---------- falling snow (every page) ----------
   2026-11-23 her asks (three rounds): it should feel like snow falling slowly far away in the background. So:
   - the snow is on every screen of the page, but it is a "far" layer: when you scroll, it moves the same way at about a
     third of the page's speed (parallax: build.py XM_SNOW_JS slides .xm-snow-in, two identical screens of snow, and wraps
     it every screen height, so it never runs out);
   - it falls slowly on its own, every flake fades in and gently melts away at its own height (--fy);
   - past the first screen it thins out a little (html.xm-deep, a 1.6 s fade), so text further down stays easy to read. */
.xm-snow{position:fixed;inset:0;z-index:14;pointer-events:none;overflow:hidden;transition:opacity 1.6s ease}
html.xm-deep .xm-snow{opacity:.7}
.xm-snow-in{position:absolute;top:0;left:0;right:0;height:200vh;will-change:transform}
.xm-copy{position:relative;height:100vh}
/* outer <i> falls straight down, inner <i> drifts side to side and turns slowly */
.xms{--o:.95;position:absolute;left:var(--x);top:0;width:var(--s);margin-left:calc(var(--s) / -2);opacity:0;
  animation:xm-fall var(--d) linear var(--dl) infinite}
.xms>i{display:block;animation:xm-sway var(--sd) ease-in-out var(--dl) infinite alternate}
.xms:nth-child(even)>i{animation-name:xm-sway2}
.xms svg{display:block;width:100%;height:auto;overflow:visible;color:var(--c)}
@keyframes xm-fall{0%{transform:translate3d(0,-30px,0);opacity:0}12%{opacity:var(--o)}70%{opacity:var(--o)}100%{transform:translate3d(-12px,var(--fy,100vh),0);opacity:0}}
@keyframes xm-sway{from{transform:translate3d(-16px,0,0) rotate(-70deg)}to{transform:translate3d(16px,0,0) rotate(70deg)}}
@keyframes xm-sway2{from{transform:translate3d(14px,0,0) rotate(60deg)}to{transform:translate3d(-14px,0,0) rotate(-80deg)}}
/* big screens: a little less opaque than phones' full white, so a flake passing over a word never hides it */
@media (min-width:1000px){.xms{--o:.85}}
/* phones: only 5 flakes, a little see-through, so a word under a passing flake stays readable */
@media (max-width:700px){.xms{--o:.75}.xms:nth-child(n+6){display:none}}

/* ---------- Christmas friends (home page) ---------- */
.xmf{position:absolute;width:var(--s,56px);animation:xm-bob var(--d,5s) ease-in-out infinite;animation-delay:var(--dl,0s);filter:drop-shadow(0 6px 6px rgba(74,58,63,.18))}
.xmf svg{display:block;width:100%;height:auto;overflow:visible}
@keyframes xm-bob{0%,100%{transform:translateY(0) rotate(-4deg)}50%{transform:translateY(-12px) rotate(4deg)}}
@keyframes xm-spin{0%,100%{transform:rotate(-12deg) translateY(0)}50%{transform:rotate(12deg) translateY(-8px)}}
/* the star friend rides across the greeting banner, tumbling a little */
@keyframes xm-drift{0%{transform:translate(-14vw,0) rotate(-24deg)}25%{transform:translate(18vw,14px) rotate(20deg)}50%{transform:translate(48vw,-10px) rotate(-16deg)}
  75%{transform:translate(80vw,12px) rotate(22deg)}100%{transform:translate(114vw,0) rotate(-24deg)}}

/* big screens (1200px+): 5 friends in the side margins of the first screen; they scroll away with the page */
.xm-float{position:absolute;top:0;left:0;width:100%;height:100vh;pointer-events:none;z-index:15;overflow:hidden}
.xmf.snowman{left:2%;top:24vh;--s:74px;--d:5.5s}
.xmf.reindeer{right:2%;top:33vh;--s:80px;--d:6s;--dl:-2s}
.xmf.gift{right:1.5%;top:max(45vh,330px);--s:58px;--d:4.5s;--dl:-1s}
.xmf.ornament{right:3%;top:max(59vh,440px);--s:52px;--d:5s;--dl:-3s;animation-name:xm-spin}
.xmf.gingerbread{left:1.5%;bottom:13vh;--s:66px;--d:6.5s;--dl:-4s}
.xm-float .xmf.star{display:none}   /* big screens: the star flies across the banner instead (below) */
/* ...and 3 friends riding on the greeting banner, so they scroll away with it and never sit over the text further down.
   The words are stacked above them: the flying star passes in front of the flags but behind the letters. */
.xmb-friends{position:absolute;inset:0;z-index:1;pointer-events:none}
.xmb-friends .xmf.cocoa{left:16%;top:12px;--s:50px;--d:4.8s;--dl:-2.4s;z-index:2}
.xmb-friends .xmf.tree{right:11%;top:18px;--s:52px;--d:3.6s;--dl:-1s;z-index:2}
.xmb-friends .xmf.star{left:0;top:18px;--s:48px;animation:xm-drift 32s linear infinite;z-index:1}   /* passes behind the cocoa and the tree */
/* QA 2026-11-23: between 1200 and 1500px the scene fills the whole width, so there is no side margin: the ornament would sit
   on "Meet Chef Chloe" (Spanish label is longest) and, on tall windows, the gingerbread on "Class Menu" */
@media (max-width:1499px){.xmf.ornament{display:none}}
@media (max-width:1399px),(max-aspect-ratio:3/2){.xmf.gingerbread{display:none}}

/* phones + tablets (up to 1199px): 4 friends peek in from the screen edges on the first screen only and scroll away with it */
@media (max-width:1199px){
  .xm-float{position:absolute;top:0;left:0;right:auto;bottom:auto;width:100vw;height:100vh;height:100svh}
  .xm-snow{right:auto;width:100vw}
  .xmb-friends,.xmf.ornament,.xmf.gingerbread{display:none}
  .xmf.snowman{left:-4px;top:max(36vh,280px);--s:52px}
  .xmf.reindeer{right:-6px;top:max(40vh,300px);--s:56px}
  .xm-float .xmf.star{display:block;left:-2px;top:max(60vh,400px);--s:42px;--d:5s;--dl:-1.5s}
  .xmf.gift{right:-2px;top:max(64vh,440px);top:min(max(64vh,440px),calc(100% - 170px));--s:48px}  /* stays clear of the Book button */
}
@media (max-width:700px){
  .xmf.snowman{top:256px;--s:42px}
  .xmf.reindeer{right:-4px;top:470px;--s:46px}
  .xm-float .xmf.star{top:max(58vh,380px);--s:34px}
  .xmf.gift{right:0;top:600px;top:min(600px,calc(100% - 170px));--s:40px}
}
@media (max-width:700px) and (max-height:700px){.xmf.gift{display:none}}
@media (max-width:1199px) and (max-height:560px){.xm-float{display:none}}  /* phones turned sideways */

/* wiggly bits inside the friends (scarf, waving arm, antlers, sparkles, bow, steam, tree-top star) */
.xmf .wig{transform-box:fill-box;animation:xm-wig 2.6s ease-in-out infinite alternate}
.xmf .wig-bl{transform-origin:0 100%}
.xmf .wig-b{transform-origin:50% 100%}
.xmf.cocoa .wig{animation-name:xm-steam;animation-duration:2.2s}
.xmf.star .wig,.xmf.tree .wig{animation-name:xm-twinkle;animation-duration:1.6s}
@keyframes xm-wig{from{transform:rotate(-9deg)}to{transform:rotate(9deg)}}
@keyframes xm-steam{0%{transform:translateY(2px) scaleY(.9);opacity:.5}100%{transform:translateY(-2px) skewX(-8deg);opacity:1}}
@keyframes xm-twinkle{0%{transform:scale(.85) rotate(-8deg);opacity:.75}100%{transform:scale(1.08) rotate(8deg);opacity:1}}

/* ---------- "Merry Christmas" garland + greeting at the top of the home page ---------- */
.xm-banner{position:relative;z-index:5;text-align:center;padding:4px 12px 26px;background:linear-gradient(#fffaf6,#fdecec);overflow:hidden}
/* a soft snow drift along the bottom edge */
.xm-banner::after{content:"";position:absolute;left:0;right:0;bottom:0;height:16px;z-index:0;
  background:radial-gradient(circle at 12px 18px,#fff 11px,transparent 12px) 0 0/24px 16px repeat-x;filter:drop-shadow(0 -1px 0 rgba(143,188,214,.45))}
.xmb-flags{display:flex;justify-content:center;gap:clamp(4px,1.2vw,12px);position:relative;padding-top:8px}
.xmb-flags::before{content:"";position:absolute;left:-5%;right:-5%;top:6px;height:18px;border-top:2px dashed #b9524f;border-radius:50%/0 0 100% 100%;opacity:.5}
.xmb-f{position:relative;display:grid;place-items:center;width:clamp(30px,5vw,46px);height:clamp(36px,6vw,54px);font-style:normal;font-size:clamp(14px,2.3vw,22px);
  clip-path:polygon(0 0,100% 0,100% 72%,50% 100%,0 72%);padding-bottom:10px;transform-origin:50% 0;animation:xmb-sway 3.4s ease-in-out infinite}
.xmb-f.c0{background:#f08c8c}.xmb-f.c1{background:#a8dcb8}.xmb-f.c2{background:#f2cf6b}.xmb-f.c3{background:#f8b4cc}.xmb-f.c4{background:#cfe9f5}
.xmb-f:nth-child(odd){animation-delay:-1.7s;margin-top:4px}
@keyframes xmb-sway{0%,100%{transform:rotate(-5deg)}50%{transform:rotate(5deg)}}
.xmb-text,.xmb-sub{position:relative;z-index:2}   /* above the banner friends */
.xmb-text{margin:10px 0 0;font-family:var(--display);font-weight:800;font-size:clamp(22px,4.4vw,40px);line-height:1.2;color:#d9534f;
  letter-spacing:.02em;text-wrap:balance;text-shadow:2px 2px 0 #fff,4px 4px 0 #8cc59b}
html[lang=zh] .xmb-text{text-shadow:2px 2px 0 #fff,3px 3px 0 #bfe0c8}   /* thin Chinese strokes: a softer outline */
.xmb-e{font-style:normal;text-shadow:none}
.xmb-text span{display:inline-block;animation:xmb-bob 4s ease-in-out infinite}
@keyframes xmb-bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-4px)}}
.xmb-sub{margin:6px 0 0;font-family:var(--body);font-weight:600;font-size:clamp(14px,1.9vw,18px);color:#3f7552;text-wrap:balance}   /* #3f7552: 4.7:1 on the banner pink */
@media (max-width:700px){.xmb-f:nth-child(n+10){display:none}.xmb-text{text-shadow:1.5px 1.5px 0 #fff,2.5px 2.5px 0 #a6d4b2}}   /* small screens: a thinner shadow keeps the letters crisp */

/* ---------- inner pages: the title card sits on a soft red Christmas gingham instead of the pink one ---------- */
html.cute .page-hero{background:linear-gradient(90deg,rgba(233,120,120,.22) 50%,transparent 50%) 0 0/28px 28px,
  linear-gradient(rgba(233,120,120,.22) 50%,transparent 50%) 0 0/28px 28px,#fff7f5}

/* ---------- reduce motion: nothing moves, no snow ---------- */
@media (prefers-reduced-motion:reduce){
  .xm-snow{display:none}
  .xmf,.xmf .wig,.xmb-f,.xmb-text span{animation:none!important}
  .xmb-friends .xmf.star{left:2.5%}
}
