/* =====================================================================
   YG-THAIQ · ธีมคริสต์มาส × ปีใหม่ 2570  (หน้าแรก — $heroMode = 'xmas')
   ทุกกฎผูกกับ .theme-xmas หรือคลาส .xm-* เท่านั้น → ปิดธีมแล้วหน้าเดิมไม่โดนอะไรเลย
   ===================================================================== */
.theme-xmas {
    --xm-night: #060d1f;
    --xm-navy: #0a1530;
    --xm-ice: #d9efff;
    --xm-ice2: #9fd3ff;
    --xm-gold: #ffd27a;
    --xm-gold2: #f5a524;
    --xm-red: #d92d3a;
    --xm-red2: #9e1424;
    --xm-green: #1d9a5b;
    --xm-green2: #0e6b3c;
    --xm-font: 'Sarabun', sans-serif;
}


/* ---------- หิมะทั้งหน้า (canvas เดียว สร้างโดย xmas.js) ---------- */
#xm-snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 900; }

/* =====================================================================
   1) ฉากเปิด
   ===================================================================== */
.xm-hero {
    --mx: 0; --my: 0; --sy: 0;
    position: relative; isolation: isolate; overflow: hidden;
    height: 100vh; height: 100svh; min-height: 760px; max-height: 1180px;
    margin-top: calc(var(--nav-height, 70px) * -1);
    background: var(--xm-night); color: #fff; text-align: center;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    font-family: var(--xm-font);
}
.xm-bg { position: absolute; inset: -3% -3% -2%; z-index: 1;
    transform: translate3d(calc(var(--mx) * -12px), calc(var(--my) * -8px + var(--sy) * .22px), 0) scale(1.04);
    transition: transform .6s cubic-bezier(.2, .7, .2, 1); will-change: transform; }
.xm-bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 62%; display: block;
    filter: saturate(1.08) contrast(1.04); animation: xmBgIn 2.2s ease-out both; }
@keyframes xmBgIn { from { opacity: 0; transform: scale(1.08); filter: blur(6px) saturate(1.08); } to { opacity: 1; transform: none; } }
/* แสงทอง/เงาให้ตัวอักษรอ่านง่าย + ขอบล่างละลายเข้าเนื้อหา */
.xm-hero::before { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    background:
        radial-gradient(52% 40% at 50% 34%, rgba(6, 13, 31, .62), transparent 72%),
        linear-gradient(180deg, rgba(6, 13, 31, .78) 0, rgba(6, 13, 31, .1) 22%, rgba(6, 13, 31, 0) 55%, rgba(6, 13, 31, .35) 80%, var(--xm-night) 100%); }

.xm-sky { position: absolute; inset: 0; z-index: 2; pointer-events: none; mix-blend-mode: screen; }
.xm-aurora { position: absolute; left: -10%; right: -10%; top: -6%; height: 46%; opacity: .42; filter: blur(38px);
    background:
        radial-gradient(40% 60% at 22% 40%, rgba(64, 220, 190, .55), transparent 70%),
        radial-gradient(38% 50% at 58% 30%, rgba(120, 160, 255, .5), transparent 70%),
        radial-gradient(30% 50% at 82% 45%, rgba(190, 120, 255, .35), transparent 70%);
    animation: xmAurora 18s ease-in-out infinite alternate; }
@keyframes xmAurora { 0% { transform: translateX(-4%) skewX(-6deg); opacity: .32; } 50% { opacity: .5; } 100% { transform: translateX(5%) skewX(5deg); opacity: .36; } }
.xm-moon { position: absolute; left: 84%; top: 9%; width: 30vmin; height: 30vmin; transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 246, 214, .55) 0, rgba(255, 236, 190, .18) 30%, transparent 66%);
    animation: xmMoon 6s ease-in-out infinite; }
@keyframes xmMoon { 50% { transform: translate(-50%, -50%) scale(1.12); opacity: .8; } }

/* ขบวนรถเลื่อน GM บินผ่านฟ้า (parade.js) — แทนรถเลื่อนภาพเดียวแบบเดิม */
.xm-parade { position: absolute; z-index: 3; left: 0; right: 0; top: 6%; height: clamp(170px, 30vh, 330px); pointer-events: none; }
.xm-parade canvas { display: block; width: 100%; height: 100%; }
@media (max-width: 900px) { .xm-parade { top: 7%; height: clamp(110px, 18vh, 170px); } }
@media (prefers-reduced-motion: reduce) { .xm-parade { display: none; } }
/* รถเลื่อนซานต้า GM บินผ่านฟ้า (แบบเดิม ไม่ได้ใช้แล้ว) */
.xm-sleigh { position: absolute; z-index: 3; top: 11%; left: 0; width: min(520px, 36vw); pointer-events: none;
    transform: translateX(-120%); opacity: 0; }
.xm-sleigh.is-on { animation: xmSleigh 34s linear 1.5s infinite; }
.xm-sleigh img { position: relative; display: block; width: 100%; height: auto; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .5)); animation: xmBob 2.4s ease-in-out infinite; }
.xm-sleigh-trail { position: absolute; right: 88%; top: 52%; width: 70%; height: 22px; transform: translateY(-50%);
    background:
        radial-gradient(circle, #fff6cf 0 1.5px, transparent 2px) 0 0 / 22px 11px,
        radial-gradient(circle, #ffd27a 0 1.2px, transparent 1.6px) 9px 5px / 18px 12px;
    -webkit-mask: linear-gradient(90deg, transparent, #000); mask: linear-gradient(90deg, transparent, #000);
    filter: drop-shadow(0 0 6px rgba(255, 210, 122, .9)); animation: xmTrail .5s linear infinite; }
@keyframes xmTrail { to { background-position: -22px 0, -9px 5px; } }
@keyframes xmBob { 50% { transform: translateY(-7px) rotate(-1.2deg); } }
@keyframes xmSleigh {
    0% { transform: translate(-120%, 30px) rotate(-4deg); opacity: 0; }
    2% { opacity: 1; }
    40% { transform: translate(calc(100vw + 20%), -40px) rotate(-7deg); opacity: 1; }
    41%, 100% { transform: translate(calc(100vw + 20%), -40px); opacity: 0; }
}

.xm-fog { position: absolute; left: 0; right: 0; bottom: 8%; height: 34%; z-index: 4; pointer-events: none; opacity: .5; }
.xm-fog i { position: absolute; inset: 0; background: radial-gradient(50% 50% at 50% 60%, rgba(200, 225, 255, .22), transparent 70%); animation: xmFog 26s ease-in-out infinite alternate; }
.xm-fog i + i { animation-duration: 34s; animation-direction: alternate-reverse; transform: translateX(-20%); }
@keyframes xmFog { from { transform: translateX(-18%); } to { transform: translateX(18%); } }

/* ตัวละครสองฝั่ง: สองทีมปาหิมะใส่กัน (ซ้าย girls4 หันขวา / ขวา trio_snowball หันซ้าย) */
.xm-chars { position: absolute; bottom: 0; z-index: 5; height: 100%; width: 40vw; pointer-events: none;
    transform: translate3d(calc(var(--mx) * 16px), calc(var(--my) * 6px), 0); transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.xm-chars--l { left: 0; }
.xm-chars--r { right: 0; transform: translate3d(calc(var(--mx) * 22px), calc(var(--my) * 7px), 0); }
.xm-c { position: absolute; bottom: 0; filter: drop-shadow(0 18px 28px rgba(0, 0, 0, .6)); }
.xm-c-team { bottom: 1vh; height: min(60vh, 640px); width: auto; max-width: 34vw; object-fit: contain; object-position: 50% 100%; transform-origin: 50% 100%; }
.xm-chars--l .xm-c-team { left: -1vw; animation: xmInL 1.2s .25s cubic-bezier(.2, .8, .2, 1) both, xmBreath 4.8s 1.8s ease-in-out infinite; }
.xm-chars--r .xm-c-team { right: -1vw; animation: xmInR 1.2s .35s cubic-bezier(.2, .8, .2, 1) both, xmBreath 5.2s 2.2s ease-in-out infinite; }
@keyframes xmInL { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: none; } }
@keyframes xmInR { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
@keyframes xmBreath { 50% { transform: scaleY(1.012) translateY(-2px); } }
.xm-balls--hero { z-index: 6; }


/* เนื้อหากลาง */
.xm-content { position: relative; z-index: 8; width: min(820px, 92vw); margin: 0 auto;
    padding-top: calc(var(--nav-height, 70px) + clamp(18px, 4vh, 54px));
    display: flex; flex-direction: column; align-items: center; }
.xm-eyebrow { font-size: clamp(12px, 1vw, 15px); font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--xm-ice);
    text-shadow: 0 0 14px rgba(159, 211, 255, .8); opacity: 0; animation: xmFade 1s .2s ease-out forwards; }
.xm-dot { display: inline-block; width: 15px; height: 17px; margin: 0 .6em; vertical-align: -2px; background: url(ui/dot_active.webp) center / contain no-repeat; animation: xmSpin 6s linear infinite; filter: drop-shadow(0 0 6px rgba(255, 210, 122, .8)); }
@keyframes xmSpin { to { transform: rotate(360deg); } }
@keyframes xmFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.xm-logo { position: relative; width: min(740px, 100%); margin: clamp(4px, 1.4vh, 16px) auto 0;
    transform: translate3d(calc(var(--mx) * 6px), calc(var(--my) * 4px), 0); transition: transform .5s ease-out; }
.xm-logo img { display: block; width: 100%; height: auto; max-height: 40vh; object-fit: contain;
    filter: drop-shadow(0 10px 26px rgba(0, 0, 0, .55)) drop-shadow(0 0 22px rgba(159, 211, 255, .35));
    animation: xmLogoIn 1.4s .35s cubic-bezier(.2, .9, .25, 1.15) both, xmFloat 6s 1.8s ease-in-out infinite; }
@keyframes xmLogoIn { from { opacity: 0; transform: scale(.82); filter: blur(10px); } to { opacity: 1; transform: none; } }
@keyframes xmFloat { 50% { transform: translateY(-8px); } }
/* แสงน้ำแข็งกวาดผ่านโลโก้ (ใช้รูปโลโก้เป็น mask จึงเงาเฉพาะตัวโลโก้) */
.xm-logo-shine { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
    -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat;
    background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, .85) 50%, rgba(190, 230, 255, .5) 54%, transparent 62%) 0 0 / 260% 100% no-repeat;
    animation: xmShine 5.5s 2.2s ease-in-out infinite, xmFloat 6s 1.8s ease-in-out infinite; }
@keyframes xmShine { 0% { background-position: 130% 0; } 40%, 100% { background-position: -40% 0; } }

.xm-sub { margin: clamp(6px, 1.6vh, 18px) 0 0; padding: 12px 22px; font-size: clamp(17px, 1.45vw, 24px); font-weight: 600; line-height: 1.45; text-wrap: balance;
    color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .9);
    background: linear-gradient(90deg, transparent, rgba(6, 13, 31, .7) 18%, rgba(6, 13, 31, .7) 82%, transparent);
    border-top: 1px solid rgba(159, 211, 255, .35); border-bottom: 1px solid rgba(159, 211, 255, .35);
    opacity: 0; animation: xmFade 1s .8s ease-out forwards; }
.xm-actions { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: clamp(14px, 2.6vh, 28px); opacity: 0; animation: xmFade 1s 1s ease-out forwards; }
.xm-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 250px; height: 62px; padding: 0 52px 3px;
    font-family: var(--xm-font); font-size: 19px; font-weight: 700; color: #fff; text-decoration: none; text-shadow: 0 2px 3px rgba(0, 0, 0, .55);
    border: 0; border-style: solid; border-image-slice: 0 96 fill; border-image-width: 0 50px; border-image-repeat: stretch; background: none;
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .45)); transition: transform .25s ease, filter .25s ease; }
.xm-btn--red { border-image-source: url(ui/btn_red.webp); }
.xm-btn--green { border-image-source: url(ui/btn_green.webp); }
.xm-btn:hover { transform: translateY(-3px) scale(1.03); filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5)) brightness(1.12); color: #fff; }
.xm-btn:active { transform: translateY(0) scale(.98); }
.xm-info { margin-top: 14px; font-family: 'Sarabun', sans-serif; font-size: 14px; color: #c8d8ee; display: inline-flex; align-items: center; gap: 8px;
    background: rgba(6, 13, 31, .62); padding: 5px 15px; border-radius: 15px; border: 1px solid rgba(159, 211, 255, .15); opacity: 0; animation: xmFade 1s 1.2s ease-out forwards; }

.xm-scroll { position: absolute; z-index: 8; bottom: 22px; left: 50%; transform: translateX(-50%); background: none; border: 0; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--xm-navy); font-family: var(--xm-font); }
.xm-scroll-ball { width: 30px; height: auto; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .5)); animation: xmRoll 1.8s ease-in-out infinite; }
.xm-scroll small { font-size: 12px; font-weight: 600; color: #e6f2ff; letter-spacing: .05em; text-shadow: 0 2px 6px rgba(0, 0, 0, .9); }
@keyframes xmRoll { 0% { transform: translateY(0) rotate(0); } 50% { transform: translateY(8px) rotate(30deg); } 100% { transform: translateY(0) rotate(60deg); } }

/* ปาหิมะเมื่อคลิกบนฉาก */
.xm-splat { position: absolute; z-index: 9; width: 0; height: 0; pointer-events: none; }
.xm-splat i { position: absolute; left: 0; top: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 8px rgba(200, 230, 255, .9); }

/* =====================================================================
   2) แถบศึกปาหิมะ + นับถอยหลัง
   ===================================================================== */
.xm-band { position: relative; isolation: isolate; overflow: hidden; z-index: 21; min-height: 620px; padding: 0 0 40px; background: var(--xm-night); font-family: var(--xm-font); color: #fff; text-align: center; }
.xm-band-bg { position: absolute; inset: 0; z-index: 0; }
.xm-band-bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 55%; display: block; }
.xm-band::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(180deg, var(--xm-night) 0, rgba(6, 13, 31, .35) 22%, rgba(6, 13, 31, .25) 60%, rgba(6, 13, 31, .85) 100%),
                radial-gradient(45% 55% at 50% 40%, rgba(6, 13, 31, .55), transparent 75%); }
.xm-band-inner { position: relative; z-index: 6; padding-top: 70px; width: min(860px, 92vw); margin: 0 auto; }
.xm-kicker { font-size: 13px; font-weight: 600; letter-spacing: .3em; color: var(--xm-gold); text-shadow: 0 0 12px rgba(255, 210, 122, .6); }
.xm-title { margin: 6px 0 4px; font-family: var(--xm-font); font-size: clamp(32px, 4vw, 58px); font-weight: 800; line-height: 1.15; letter-spacing: .01em;
    background: linear-gradient(180deg, #fff 0, #e8f5ff 45%, #9fd3ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 3px 0 #1a3a66) drop-shadow(0 8px 18px rgba(0, 0, 0, .6)); }
.xm-lead { margin: 0 auto; font-size: clamp(15px, 1.2vw, 19px); color: #d6e6fa; text-shadow: 0 2px 8px rgba(0, 0, 0, .8); }
.xm-cds { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 26px; }
.xm-cd { position: relative; isolation: isolate; width: 390px; aspect-ratio: 720 / 518; padding: 13% 9% 9%; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center;
    filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .5)); }
.xm-cd::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: url(ui/frame_ice_card.webp) center / 100% 100% no-repeat; }
.xm-cd > * { position: relative; z-index: 1; }
.xm-cd::before { content: ''; position: absolute; inset: 7% 5.5% 6.5%; z-index: -1; border-radius: 6px;
    background: radial-gradient(120% 90% at 50% 0, rgba(30, 60, 120, .92), rgba(8, 18, 42, .94)); }
.xm-cd--gold::before { background: radial-gradient(120% 90% at 50% 0, rgba(110, 30, 40, .92), rgba(40, 8, 18, .94)); }
.xm-cd-h { font-size: 17px; font-weight: 700; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.xm-cd-h small { font-weight: 500; font-size: 12px; color: #9fb7d6; }
.xm-cd-t { display: flex; align-items: baseline; justify-content: center; gap: 3px; margin-top: 10px; }
.xm-cd-t b { min-width: 46px; padding: 6px 3px; border-radius: 9px; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1;
    background: linear-gradient(180deg, #fff, #dbeeff); color: #12305a; box-shadow: inset 0 -3px 0 rgba(18, 48, 90, .18), 0 3px 8px rgba(0, 0, 0, .3); }
.xm-cd--gold .xm-cd-t b { background: linear-gradient(180deg, #fff6dc, #ffd27a); color: #6b3a00; }
.xm-cd-t i { font-style: normal; font-size: 11px; color: #d4e2f4; margin: 0 4px 0 2px; }
.xm-cd.is-done .xm-cd-t { font-size: 26px; font-weight: 800; color: var(--xm-gold); text-shadow: 0 0 18px rgba(255, 210, 122, .7); }

.xm-band-team { position: absolute; bottom: 0; z-index: 4; width: 34vw; height: 100%; pointer-events: none; }
.xm-band-team--l { left: 0; } .xm-band-team--r { right: 0; }
.xm-bt-group { position: absolute; bottom: 18px; height: min(78%, 500px); width: auto; filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .55)); }
.xm-band-team--l .xm-bt-group { left: -2vw; } .xm-band-team--r .xm-bt-group { right: -2vw; }
.xm-bt-kid { position: absolute; bottom: 6px; height: min(44%, 290px); width: auto; z-index: 2; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .55)); }
.xm-band-team--l .xm-bt-kid { left: 22vw; } .xm-band-team--r .xm-bt-kid { right: 22vw; }
.xm-band .xm-reveal { opacity: 0; transform: translateY(30px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .8, .2, 1); }
.xm-band .xm-reveal.is-in, .xm-finale .xm-reveal.is-in { opacity: 1; transform: none; }
.xm-balls { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.xm-ball { position: absolute; left: 0; top: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff, #e3f1ff 55%, #a9c8e6); box-shadow: 0 3px 8px rgba(0, 0, 0, .35); }

/* พวงไฟ (ใช้ทั้งแถบและฉากปิดท้าย) */
.xm-garland { position: absolute; left: 0; right: 0; top: 0; height: 56px; z-index: 3; pointer-events: none;
    background:
        radial-gradient(circle at 50% 0, transparent 0 22px, rgba(25, 70, 45, .95) 23px 27px, transparent 28px) 0 -6px / 56px 40px repeat-x; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .5)); }

/* =====================================================================
   3) ส่วนเนื้อหาเดิม (สถิติ / จัดอันดับ / ฟีด) — แค่เปลี่ยนบรรยากาศ ไม่แตะโครง
   ===================================================================== */
.theme-xmas .content-section { background-color: var(--xm-night); background-attachment: scroll; background-size: cover; box-shadow: none; }
.theme-xmas .content-overlay { background: linear-gradient(180deg, var(--xm-night) 0, rgba(6, 13, 31, .9) 14%, rgba(6, 13, 31, .86) 60%, var(--xm-night) 100%); }
.theme-xmas .content-section > div[style*="linear-gradient(to top"] { background: linear-gradient(to top, var(--xm-night) 0%, transparent 100%) !important; }
.theme-xmas .content-char.c-char-left,
.theme-xmas .content-char.c-char-right { mix-blend-mode: normal; filter: drop-shadow(0 20px 30px rgba(0, 0, 0, .6)) brightness(.92) saturate(1.05); height: 760px; bottom: 0; transform: none; opacity: .95; }
.theme-xmas .content-char.c-char-left { left: -170px; }
.theme-xmas .content-char.c-char-right { right: -130px; }
/* หิมะเกาะขอบบนของแผง (xmas.js ใส่ <i class="xm-cap"> ให้) */
.xm-cap { position: absolute; left: 4px; right: 4px; top: -9px; height: 18px; z-index: 30; pointer-events: none;
    background:
        radial-gradient(9% 70% at 7% 100%, #fff 97%, transparent), radial-gradient(14% 95% at 24% 100%, #f2f9ff 97%, transparent),
        radial-gradient(10% 70% at 41% 100%, #fff 97%, transparent), radial-gradient(16% 100% at 58% 100%, #f4faff 97%, transparent),
        radial-gradient(10% 75% at 76% 100%, #fff 97%, transparent), radial-gradient(12% 85% at 92% 100%, #f2f9ff 97%, transparent),
        linear-gradient(#f6fbff, #f6fbff) 0 100% / 100% 3px no-repeat;
    border-radius: 10px 10px 0 0; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
.xm-cap::after { content: ''; position: absolute; left: 12%; right: 12%; top: 100%; height: 12px;
    background: radial-gradient(3px 10px at 10% 0, rgba(230, 245, 255, .9) 96%, transparent), radial-gradient(2px 7px at 38% 0, rgba(230, 245, 255, .85) 96%, transparent),
                radial-gradient(3px 9px at 63% 0, rgba(230, 245, 255, .9) 96%, transparent), radial-gradient(2px 6px at 88% 0, rgba(230, 245, 255, .8) 96%, transparent); }

/* เส้นคั่นก่อนส่วนแนะนำอาชีพ / ฉากปิดท้าย */
.xm-divider { position: relative; z-index: 25; height: 0; }
.xm-divider::before { content: ''; position: absolute; left: 0; right: 0; top: -2px; height: 5px; background: repeating-linear-gradient(-45deg, #e8343f 0 10px, #fff 10px 20px); box-shadow: 0 0 14px rgba(232, 52, 63, .4); }
.xm-divider::after { content: ''; position: absolute; left: 0; right: 0; top: 3px; height: 16px;
    background: radial-gradient(3px 14px at 50% 0, rgba(225, 242, 255, .85) 96%, transparent) 0 0 / 46px 16px repeat-x,
                radial-gradient(2px 9px at 50% 0, rgba(225, 242, 255, .7) 96%, transparent) 23px 0 / 46px 12px repeat-x; }

/* =====================================================================
   4) ฉากปิดท้าย Merry Christmas
   ===================================================================== */
.xm-finale { position: relative; isolation: isolate; overflow: hidden; min-height: 900px; padding: 90px 0 0; background: var(--xm-night); color: #fff; text-align: center; font-family: var(--xm-font); }
.xm-finale-bg { position: absolute; inset: 0; z-index: 0; }
.xm-finale-bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 70%; display: block; }
.xm-finale::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(180deg, var(--xm-night) 0, rgba(6, 13, 31, .5) 18%, rgba(6, 13, 31, .15) 45%, rgba(6, 13, 31, .55) 82%, var(--xm-night) 100%); }
.xm-lights { position: absolute; left: 0; right: 0; top: 0; height: 110px; z-index: 3; pointer-events: none; }
.xm-lights svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.xm-bulb { position: absolute; width: 11px; height: 17px; margin-left: -5.5px; border-radius: 50% 50% 46% 46%; background: var(--c); box-shadow: 0 0 10px 2px var(--c), 0 0 22px var(--c);
    animation: xmTwinkle var(--t, 2.4s) ease-in-out var(--d, 0s) infinite; }
.xm-bulb::before { content: ''; position: absolute; left: 3px; top: -5px; width: 5px; height: 6px; border-radius: 2px; background: #2c3e2f; }
@keyframes xmTwinkle { 0%, 100% { opacity: 1; filter: brightness(1.15); } 50% { opacity: .35; filter: brightness(.7); box-shadow: 0 0 3px var(--c); } }

.xm-finale-head { position: relative; z-index: 6; width: min(900px, 92vw); margin: 0 auto; }
.xm-title--big { font-size: clamp(34px, 4.6vw, 68px); background: linear-gradient(180deg, #fff 0, #ffeec2 50%, var(--xm-gold) 100%); -webkit-background-clip: text; background-clip: text;
    filter: drop-shadow(0 3px 0 #7a1420) drop-shadow(0 10px 24px rgba(0, 0, 0, .6)); }
.xm-title--big span { display: block; font-size: .62em; background: linear-gradient(180deg, #fff, #cfe8ff); -webkit-background-clip: text; background-clip: text; }

.xm-stage { position: relative; z-index: 5; width: min(1500px, 100%); height: 600px; margin: 8px auto 0; }
.xm-boss { position: absolute; bottom: 168px; height: 400px; width: auto; z-index: 1; filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .6)) brightness(.92); }
.xm-boss--l { left: -40px; } .xm-boss--r { right: -40px; }
.xm-row { position: absolute; left: 50%; display: flex; align-items: flex-end; justify-content: center; transform: translateX(-50%); width: max-content; }
.xm-row--back { bottom: 172px; z-index: 2; }
.xm-row--front { bottom: 58px; z-index: 4; }
.xm-guest { position: relative; margin: 0 -26px; outline: none; cursor: default; }
.xm-row--back .xm-guest img { height: 250px; }
.xm-row--front .xm-guest img { height: 300px; }
.xm-guest img { display: block; width: auto; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .45)); transform-origin: 50% 100%;
    transition: transform .35s cubic-bezier(.2, .9, .3, 1.3), filter .35s ease; }
.xm-guest:hover, .xm-guest:focus-visible { z-index: 5; }
.xm-guest:hover img, .xm-guest:focus-visible img { transform: translateY(-14px) scale(1.07); filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .6)) drop-shadow(0 0 16px rgba(255, 210, 122, .65)); }
.xm-guest figcaption { position: absolute; left: 50%; bottom: calc(100% - 4px); transform: translate(-50%, 8px); white-space: nowrap; pointer-events: none;
    padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; color: #fff; opacity: 0; transition: opacity .25s ease, transform .25s ease;
    background: linear-gradient(180deg, #e8434e, #a5182a); border: 1px solid rgba(255, 255, 255, .6); box-shadow: 0 6px 14px rgba(0, 0, 0, .4); }
.xm-guest:hover figcaption, .xm-guest:focus-visible figcaption { opacity: 1; transform: translate(-50%, -12px); }
.xm-finale .xm-guest { opacity: 0; transform: translateY(40px); }
.xm-finale.is-in .xm-guest { animation: xmGuestIn .8s calc(var(--i) * 90ms) cubic-bezier(.2, .9, .3, 1.2) forwards; }
@keyframes xmGuestIn { to { opacity: 1; transform: none; } }
.xm-pets { position: absolute; bottom: 0; height: 210px; width: auto; z-index: 4; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .55)); }
.xm-pets--l { left: 2%; } .xm-pets--r { right: 2%; }
.xm-snowbank { position: absolute; left: calc(50% - 50vw); width: 100vw; pointer-events: none; background-repeat: no-repeat; background-size: 100% 100%; }
/* ลานหิมะสองชั้น: ชั้นหลังรองเท้าแถวหลัง/บอส · ชั้นหน้ารองเท้าแถวหน้า — ตัวละครยืนจมหิมะนิดๆ ไม่ลอย */
.xm-snowbank--back { bottom: 92px; height: 120px; z-index: 3; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 200' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23dfeaf7'/%3E%3Cstop offset='1' stop-color='%236f8fb4'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 78 C120 54 230 68 340 74 S560 52 700 66 S940 80 1080 64 S1330 50 1460 68 S1580 76 1600 70 V200 H0Z' fill='url%28%23g%29'/%3E%3Cpath d='M0 78 C120 54 230 68 340 74 S560 52 700 66 S940 80 1080 64 S1330 50 1460 68 S1580 76 1600 70 V200 H0Z' fill='none' stroke='%23f2f8ff' stroke-width='3' opacity='.9'/%3E%3C/svg%3E"); filter: drop-shadow(0 -4px 10px rgba(0, 0, 0, .35)); }
.xm-snowbank--front { bottom: 0; height: 110px; z-index: 5; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 200' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23f7fbff'/%3E%3Cstop offset='1' stop-color='%239fbbd8'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 58 C120 34 230 48 340 54 S560 32 700 46 S940 60 1080 44 S1330 30 1460 48 S1580 56 1600 50 V200 H0Z' fill='url%28%23g%29'/%3E%3Cpath d='M0 58 C120 34 230 48 340 54 S560 32 700 46 S940 60 1080 44 S1330 30 1460 48 S1580 56 1600 50 V200 H0Z' fill='none' stroke='%23ffffff' stroke-width='3' opacity='.9'/%3E%3C/svg%3E"); filter: drop-shadow(0 -6px 14px rgba(0, 0, 0, .4)); }
.xm-snowbank--front::after { content: ''; position: absolute; inset: auto 0 0; height: 46px; background: linear-gradient(180deg, transparent, rgba(6, 13, 31, .55)); }
.xm-actions--finale { position: relative; z-index: 6; opacity: 1; animation: none; margin-top: 18px; }

/* =====================================================================
   จอเล็ก / ลดการเคลื่อนไหว
   ===================================================================== */
@media (max-width: 1300px) {
    .xm-stage { height: 540px; }
    .xm-row--back .xm-guest img { height: 210px; }
    .xm-row--front .xm-guest img { height: 250px; }
    .xm-boss { height: 330px; }
}
@media (max-width: 1100px) and (min-width: 901px) {
    .xm-chars { opacity: .55; }
}
@media (max-width: 1100px) {
    .xm-band-team { width: 30vw; }
    .xm-bt-kid { display: none; }
}
@media (max-width: 900px) {
    .xm-hero { min-height: 720px; max-height: none; }
    .xm-fog, .xm-sleigh { display: none; }
    .xm-chars { opacity: 1; width: 50vw; transform: none; }
    .xm-c-team { height: min(28vh, 260px); max-width: 52vw; }
    .xm-cd { width: min(340px, 92vw); }
    .xm-scroll { display: none; }
    .xm-bg img { object-position: center 70%; }
    .xm-hero::before { background: linear-gradient(180deg, rgba(6, 13, 31, .85) 0, rgba(6, 13, 31, .35) 30%, rgba(6, 13, 31, .2) 60%, var(--xm-night) 100%); }
    .xm-content { padding-top: calc(var(--nav-height, 64px) + 26px); }
    .xm-logo img { max-height: 30vh; }
    .xm-btn { min-width: 0; flex: 1 1 200px; font-size: 17px; height: 52px; }
    .xm-band { min-height: 0; padding-bottom: 210px; }
    .xm-band-inner { padding-top: 46px; }
    .xm-band-team { width: 50vw; height: 230px; top: auto; }
    .xm-bt-group { height: 210px; bottom: 6px; }
    .xm-cd-t b { min-width: 44px; font-size: 24px; }
    .xm-finale { min-height: 0; padding: 70px 0 0; }
    .xm-stage { height: auto; padding: 10px 0 46px; }
    .xm-snowbank--back { display: none; }
    .xm-snowbank--front { height: 70px; }
    .xm-boss { display: none; }
    .xm-row { position: relative; left: auto; bottom: auto; transform: none; width: 100%; flex-wrap: wrap; row-gap: 6px; }
    .xm-guest { margin: 0 -10px; }
    .xm-row--back .xm-guest img { height: 130px; }
    .xm-row--front .xm-guest img { height: 150px; }
    .xm-guest figcaption { display: none; }
    .xm-pets { height: 100px; }
    .theme-xmas .content-char { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .xm-hero *, .xm-band *, .xm-finale * { animation: none !important; transition: none !important; }
    .xm-eyebrow, .xm-sub, .xm-actions, .xm-info, .xm-finale .xm-guest { opacity: 1 !important; transform: none !important; }
    .xm-sleigh { display: none; }
}

/* ---------- ป้ายหัวข้อ: ริบบิ้นแดง / ป้ายงาช้าง (ภาพจาก assets/xmas2570/ui) ---------- */
.xm-ribbon { display: inline-flex; align-items: center; justify-content: center; margin: 8px auto 6px; min-width: min(560px, 90vw); height: 96px; padding: 14px 96px 0; box-sizing: border-box;
    border: 0; border-style: solid; border-image: url(ui/ribbon.webp) 0 108 fill / 0 80px stretch; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .5)); }
.xm-ribbon span { font-family: var(--xm-font); font-size: clamp(24px, 2.6vw, 38px); font-weight: 800; color: #fff; line-height: 1; white-space: nowrap;
    text-shadow: 0 2px 0 #8d0f19, 0 4px 10px rgba(80, 0, 10, .6); }
.xm-plate { display: inline-flex; align-items: center; justify-content: center; margin: 4px auto 10px; height: 74px; min-width: min(520px, 88vw); padding: 0 84px; box-sizing: border-box;
    border: 0; border-style: solid; border-image: url(ui/plate_ivory.webp) 0 100 fill / 0 54px stretch; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .5)); }
.xm-plate span { font-family: var(--xm-font); font-size: clamp(20px, 2vw, 30px); font-weight: 800; color: #17305c; white-space: nowrap; }
.xm-title--big { margin-bottom: 0; }

/* ---------- กรอบตกแต่งแผงเดิม (xmas.js ใส่ให้ — ไม่แตะโครงแผง) ---------- */
@media (max-width: 900px) {
    .xm-ribbon { height: 70px; padding: 10px 64px 0; border-image-width: 0 58px; }
    .xm-plate { height: 58px; padding: 0 60px; border-image-width: 0 42px; }
}

/* ---------- เลื่อนเมาส์แล้วล็อกทีละฉาก (proximity: ล็อกเมื่อเลื่อนเข้าใกล้หัวฉาก ไม่บังคับ ส่วนยาวอย่างตารางจัดอันดับยังเลื่อนอ่านได้อิสระ) ---------- */
html:has(body.theme-xmas.page-home) { scroll-snap-type: y proximity; scroll-padding-top: var(--nav-height, 70px); }
.theme-xmas .xm-hero, .theme-xmas .xm-band, .theme-xmas .content-section, .theme-xmas .job-section, .theme-xmas .xm-finale { scroll-snap-align: start; }
.xm-band { min-height: max(620px, calc(100vh - var(--nav-height, 70px))); }
@media (max-width: 900px) { html:has(body.theme-xmas.page-home) { scroll-snap-type: none; } .xm-band { min-height: 0; } }

/* ---------- สถิติเซิร์ฟเวอร์ = ฉากของตัวเอง (สูงหนึ่งจอ ตัวละครซ้ายขวาเต็มความสูง) ---------- */
.theme-xmas .xm-stats-sec { min-height: calc(100vh - var(--nav-height, 70px)); padding: 40px 0 50px; display: flex; flex-direction: column; justify-content: center; }
.theme-xmas .xm-stats-sec .content-wrapper { width: 100%; }
.theme-xmas .xm-stats-sec .content-char { height: min(90vh, 860px); }
.theme-xmas .xm-stats-sec .content-char.c-char-left { left: -40px; }
.theme-xmas .xm-stats-sec .content-char.c-char-right { right: -30px; }

/* ---------- หอเกียรติยศ: จัดอันดับ + ความเคลื่อนไหว สูงพอดีหนึ่งจอ เลื่อนอ่านในกรอบ ไม่ยาวทั้งหน้า ---------- */
.theme-xmas .xm-hall { --xm-hall-h: max(600px, calc(100vh - var(--nav-height, 70px) - 274px)); padding: 26px 0 40px; box-shadow: none;
    background: radial-gradient(60% 50% at 50% 0, rgba(80, 140, 230, .14), transparent 70%), linear-gradient(180deg, #071228, var(--xm-night)); }
.theme-xmas .xm-hall .content-overlay { background: linear-gradient(180deg, var(--xm-night) 0, rgba(6, 13, 31, .5) 16%, rgba(6, 13, 31, .55) 78%, var(--xm-night) 100%); }
/* หอเกียรติยศ รอบ 2: พื้นหลังย่านกังหันน้ำ · จอมยุทธ์แว่นทอง (ซ้าย) · นักดาบลูกหิมะ (ขวา) · ริบบิ้นกำมะหยี่แดงทองสไตล์วูเซีย */
.theme-xmas .xm-hall[style*="background-image"] { background-size: cover; background-position: center 30%; overflow: hidden; }
.theme-xmas .xm-hall .content-wrapper { position: relative; z-index: 2; }
.xm-hall-char { position: absolute; bottom: 0; z-index: 1; height: min(88vh, 880px); width: auto; pointer-events: none; user-select: none;
    filter: drop-shadow(0 16px 28px rgba(0, 0, 0, .65)) brightness(.95); }
.xm-hall-char--l { left: -40px; }
.xm-hall-char--r { right: -40px; }
.theme-xmas .xm-hall-title.xm-ribbon { border: 0; border-image: none; background: url(ui/ribbon_wuxia.webp) center / 100% 100% no-repeat;
    width: min(760px, 94vw); min-width: 0; height: auto; aspect-ratio: 1100 / 375; padding: 1.3% 0 0; margin: -40px auto -14px; }
.theme-xmas .xm-hall-title.xm-ribbon span { font-size: clamp(22px, 2.4vw, 36px); text-shadow: 0 2px 0 #6e0a12, 0 4px 10px rgba(60, 0, 8, .7); }
@media (max-width: 1024px) { .xm-hall-char { display: none; } }
.xm-hall-title { display: flex; margin: 0 auto 34px; width: max-content; }
.theme-xmas .xm-hall .rank-container { height: var(--xm-hall-h); overflow-y: auto; overscroll-behavior: contain; }
.theme-xmas .xm-hall .home-split-right .lf-list { overflow-y: auto; overscroll-behavior: contain; }
.theme-xmas .xm-hall .rank-container, .theme-xmas .xm-hall .home-split-right .lf-list { scrollbar-width: thin; scrollbar-color: rgba(159, 211, 255, .55) transparent; }
.theme-xmas .xm-hall .rank-container::-webkit-scrollbar, .theme-xmas .xm-hall .lf-list::-webkit-scrollbar { width: 6px; }
.theme-xmas .xm-hall .rank-container::-webkit-scrollbar-thumb, .theme-xmas .xm-hall .lf-list::-webkit-scrollbar-thumb { background: rgba(159, 211, 255, .5); border: 0; border-radius: 6px; }
.theme-xmas .xm-hall .rank-container::-webkit-scrollbar-track, .theme-xmas .xm-hall .lf-list::-webkit-scrollbar-track { background: transparent; }
.theme-xmas .xm-hall { scroll-snap-align: start; }
@media (max-width: 1024px) {
    .theme-xmas .xm-hall .rank-container { height: auto; overflow: visible; }
    .theme-xmas .xm-stats-sec { min-height: 0; }
}

/* ---------- ฉากสถิติ รอบ 2: บอสสองแก๊งมุมล่าง · สถิติยกขึ้น · ซานต้า GM ลอยตรงกลางใต้สถิติ ---------- */
.theme-xmas .xm-stats-sec { justify-content: flex-start; padding-top: 34px; padding-bottom: 0; }
.theme-xmas .xm-stats-sec .content-char { height: auto; width: min(40vw, 760px); bottom: 0; opacity: 1; filter: drop-shadow(0 16px 28px rgba(0, 0, 0, .65)) brightness(.95); }
.theme-xmas .xm-stats-sec .content-char.c-char-left { left: -50px; }
.theme-xmas .xm-stats-sec .content-char.c-char-right { right: -50px; }
.xm-stats-santa { position: relative; width: min(820px, 50vw); margin: 18px auto 0; pointer-events: none; animation: xmSantaFly 6s ease-in-out infinite; }
.xm-stats-santa img { position: relative; z-index: 2; display: block; width: 100%; height: auto; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .55)) drop-shadow(0 0 18px rgba(255, 210, 122, .25)); }
@keyframes xmSantaFly { 0%, 100% { transform: translate(-10px, 0) rotate(-1.2deg); } 50% { transform: translate(10px, -14px) rotate(1deg); } }
/* แสงทองนุ่มๆ ด้านหลัง (แสงไฟจากถุงของขวัญ) */
.xm-ss-glow { position: absolute; left: 12%; right: 12%; top: 10%; bottom: 5%; z-index: 0; border-radius: 50%;
    background: radial-gradient(50% 50% at 50% 55%, rgba(255, 220, 150, .30), rgba(159, 211, 255, .12) 55%, transparent 75%); filter: blur(18px); animation: xmGlowPulse 3.2s ease-in-out infinite; }
@keyframes xmGlowPulse { 50% { opacity: .55; transform: scale(1.06); } }
/* หางประกายหลังรถเลื่อน (ลากไปทางซ้าย เพราะรถวิ่งไปขวา) */
.xm-ss-trail { position: absolute; z-index: 1; right: 86%; top: 46%; width: 58%; height: 30px; transform: translateY(-50%) rotate(4deg);
    background: radial-gradient(circle, #fff6cf 0 1.6px, transparent 2.2px) 0 0 / 24px 12px, radial-gradient(circle, #ffd27a 0 1.3px, transparent 1.8px) 10px 6px / 19px 13px, radial-gradient(circle, #cfeaff 0 1.2px, transparent 1.7px) 5px 3px / 15px 9px;
    -webkit-mask: linear-gradient(90deg, transparent, #000 85%); mask: linear-gradient(90deg, transparent, #000 85%);
    filter: drop-shadow(0 0 6px rgba(255, 210, 122, .95)); animation: xmSSTrail .45s linear infinite; }
@keyframes xmSSTrail { to { background-position: -24px 0, -9px 6px, -10px 3px; } }
/* ฝุ่นประกายวิบวับรอบรถเลื่อน */
.xm-ss-dust { position: absolute; inset: -6% -4%; z-index: 3; pointer-events: none;
    background: radial-gradient(circle, #fff 0 1.5px, transparent 2px) 8% 30% / 120px 90px, radial-gradient(circle, #ffe7a8 0 1.3px, transparent 1.8px) 40% 70% / 150px 110px, radial-gradient(circle, #d7eeff 0 1.2px, transparent 1.7px) 70% 20% / 90px 70px;
    animation: xmDust 3s linear infinite; opacity: .9; }
.xm-ss-dust--2 { background-size: 170px 130px, 110px 95px, 140px 120px; animation-duration: 4.6s; animation-direction: reverse; opacity: .7; }
@keyframes xmDust { 0% { background-position: 8% 30%, 40% 70%, 70% 20%; opacity: .25; } 50% { opacity: 1; } 100% { background-position: 8% 0%, 40% 40%, 70% -10%; opacity: .25; } }
@media (max-width: 1024px) { .xm-stats-santa { width: 90vw; } .theme-xmas .xm-stats-sec .content-char { display: none; } }
@media (prefers-reduced-motion: reduce) { .xm-stats-santa, .xm-stats-santa * { animation: none !important; } }

/* ลุงช่างตีเหล็กแทนซานต้า: ยืนบนพื้น ไม่บิน · หายใจช้าๆ · แสงเตาหลอมอุ่นๆ เต้นตามจังหวะตีเหล็ก */
.xm-stats-smith { width: auto; display: flex; justify-content: center; margin-top: 10px; animation: none; }
.xm-stats-smith img { width: auto; height: min(42vh, 420px); transform-origin: 50% 100%; animation: xmSmithBreath 4.2s ease-in-out infinite; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .6)) drop-shadow(0 0 22px rgba(255, 170, 80, .25)); }
@keyframes xmSmithBreath { 50% { transform: scale(1.015) translateY(-3px); } }
.xm-stats-smith .xm-ss-glow { left: 50%; right: auto; width: min(520px, 60vw); transform: translateX(-50%); top: 5%; bottom: 0;
    background: radial-gradient(50% 45% at 50% 65%, rgba(255, 170, 80, .34), rgba(255, 120, 40, .12) 50%, transparent 72%); animation: xmForge 1.6s ease-in-out infinite; }
@keyframes xmForge { 0%, 100% { opacity: .65; } 12% { opacity: 1; } 30% { opacity: .75; } }
.xm-stats-smith .xm-ss-dust { inset: -4% 30%; }

/* ---------- สถิติแบบสลับหน้า (ทีละ 2 การ์ด หมุนเอง เหมือน feed_embed ในรันเชอร์) — xmas.js ใส่คลาส xm-paged ---------- */
.theme-xmas .xm-stats-sec .stats-heading { justify-content: center; max-width: 860px; }
.theme-xmas .xm-stats-sec .stats-grid.xm-paged { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; max-width: 860px; margin: 0 auto 6px; position: relative; }
.theme-xmas .stats-grid.xm-paged > .stat-card { grid-row: 1; animation: none !important; transition: opacity .7s ease, transform .8s cubic-bezier(.2, .9, .25, 1.1), filter .7s ease, visibility 0s; }
.theme-xmas .stats-grid.xm-paged > .stat-card:nth-child(odd) { grid-column: 1; }
.theme-xmas .stats-grid.xm-paged > .stat-card:nth-child(even) { grid-column: 2; }
.theme-xmas .stats-grid.xm-paged > .stat-card.xm-pg-off { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(26px) scale(.94) rotateX(8deg); filter: blur(4px);
    transition: opacity .45s ease, transform .45s ease, filter .45s ease, visibility 0s .45s; }
.theme-xmas .stats-grid.xm-paged > .stat-card.xm-pg-on:nth-child(even) { transition-delay: .12s; }
/* แถบแท็บ + เส้นนับเวลา */
.xm-stat-tabs { display: flex; justify-content: center; gap: 12px; margin: 0 auto 16px; position: relative; z-index: 12; }
.xm-stat-tab { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 22px; border-radius: 999px; cursor: pointer; overflow: hidden;
    font-family: var(--xm-font); font-size: 15px; font-weight: 600; color: #b9cbe3; background: rgba(10, 24, 54, .7); border: 1px solid rgba(159, 211, 255, .25); transition: color .25s, border-color .25s, background .25s; }
.xm-stat-tab i { width: 14px; height: 16px; background: url(ui/dot.webp) center / contain no-repeat; }
.xm-stat-tab:hover { color: #fff; border-color: rgba(159, 211, 255, .5); }
.xm-stat-tab.is-on { color: #17305c; background: linear-gradient(180deg, #fff, #dbeeff); border-color: #fff; box-shadow: 0 0 18px rgba(159, 211, 255, .45); }
.xm-stat-tab.is-on i { background-image: url(ui/dot_active.webp); }
.xm-stat-tab b { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: linear-gradient(90deg, #ff4b5c, #ffd25a); }
.xm-stat-tab.is-on.is-run b { animation: xmTabRun var(--dur, 8s) linear forwards; }
@keyframes xmTabRun { to { width: 100%; } }
.xm-stats-smith img { height: min(36vh, 380px); }
@media (max-width: 760px) { .theme-xmas .xm-stats-sec .stats-grid.xm-paged { grid-template-columns: 1fr !important; } .theme-xmas .stats-grid.xm-paged > .stat-card { grid-column: 1 !important; grid-row: auto; } .theme-xmas .stats-grid.xm-paged > .stat-card.xm-pg-off { display: none; } }

/* ลุงช่างตีเหล็ก: ยืนนิ่งเท่ๆ ไม่ลอยไม่ขยับ · ไอเย็น (shader) อยู่ด้านหลัง */
.xm-stats-smith { display: block; width: max-content; padding: 0 150px; margin: 4px auto 0; position: relative; }
.xm-stats-smith img { animation: none !important; transform: none !important; position: relative; z-index: 2; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .6)) drop-shadow(0 0 16px rgba(159, 211, 255, .35)); }
.xm-stats-smith .xm-ss-glow, .xm-stats-smith .xm-ss-dust { display: none; }

/* เนื้อหาการ์ดสถิติหลบกรอบการ์ดน้ำแข็ง (ขอบกรอบ ~40px) ไม่ให้ตัวหนังสือจมใต้ขอบ */
.theme-xmas .stats-grid.xm-paged > .stat-card { padding: 46px 46px 42px; border-color: transparent; }
@media (max-width: 900px) { .theme-xmas .stats-grid.xm-paged > .stat-card { padding: 36px 32px 32px; } }

/* ---------- จัดตัวหนังสือในริบบิ้นให้อยู่กลางแถบแดงจริง (วัดจากภาพ + หมึกฟอนต์ Sarabun) ----------
   แถบแดง: ribbon.webp อยู่ 16.2–72.3% ของความสูง (กลาง 44.2%) · ribbon_wuxia.webp อยู่ 36.8–66.1% (กลาง 51.5%)
   หมึกตัวหนังสือไทย (มีสระบน/ล่าง) อยู่ต่ำกว่ากลางกล่องบรรทัด ≈ 0.12em จึงยกขึ้นชดเชย */
.xm-ribbon { padding-top: 0; }
.xm-ribbon span { display: block; font-size: clamp(22px, 2.1vw, 30px); transform: translateY(calc(-5.8px - .12em)); }
@media (max-width: 900px) {
    .xm-ribbon { padding-top: 0; }
    .xm-ribbon span { font-size: 21px; transform: translateY(calc(-4.3px - .12em)); }
}
.theme-xmas .xm-hall-title.xm-ribbon { padding-top: 0; }
.theme-xmas .xm-hall-title.xm-ribbon span { font-size: clamp(20px, 2.3vw, 34px); transform: translateY(calc(min(760px, 94vw) * .00501 - .12em - .25px)); }
