/* =====================================================================
   Zelpophai AI — Christmas seasonal theme
   Active only while <html> has the "christmas" class (js/christmas.js:
   1 December – 2 January, and only for people allowed to see it).
   Everything is scoped to html.christmas, so the normal themes (dark,
   light, owner silver, admin gold) and Halloween are untouched.
   All the artwork is inline SVG in these rules — no extra files to load.
   ===================================================================== */

html.christmas body {
    --bg: #07101c;
    --sidebar: #0a1726;
    --surface: #0d1c2e;
    --cards: #112437;
    --text: #eef5ff;
    --muted: #9db3cc;
    --input-bg: #0c1a2a;
    --border: #1f3a55;
    --hover-bg: #13283d;
    --accent: linear-gradient(135deg, #e8534e, #c3272b 55%, #8f1d20);
    --accent-solid: #d93b3b;
    --accent-hover: #ef5d58;
    --user-msg: linear-gradient(135deg, #d93b3b, #9c1f23);
    --ai-msg: rgba(10, 23, 38, .86);
    --code-bg: #0a1726;
    --xm-red: #e2443f;
    --xm-green: #2f9e63;
    --xm-gold: #f2c75c;
    --xm-ice: #bfe3ff;
    --xm-line: rgba(242, 199, 92, .38);
    --xm-serif: 'Playfair Display', Georgia, serif;
    --xm-display: 'Mountains of Christmas', 'Playfair Display', Georgia, serif;
    background:
        radial-gradient(60% 45% at 50% 0%, rgba(80, 150, 230, .18), transparent 70%),
        radial-gradient(45% 40% at 85% 100%, rgba(47, 158, 99, .12), transparent 70%),
        linear-gradient(180deg, #0b1b2d 0%, #081524 50%, #06101c 100%) fixed,
        #06101c;
}

/* ======================= the winter scene ======================= */
/* z-index -1: painted above the page background but under every piece of
   real UI, so it can never cover text or swallow a click. */
#xm-fx { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }

/* a soft aurora high in the sky */
#xm-fx .xm-sky {
    position: absolute; inset: 0 0 auto 0; height: 55vh;
    background:
        radial-gradient(45% 60% at 20% 0%, rgba(47, 158, 99, .13), transparent 70%),
        radial-gradient(40% 55% at 75% 5%, rgba(120, 170, 255, .12), transparent 70%);
    animation: xmAurora 30s ease-in-out infinite alternate;
}
@keyframes xmAurora { from { transform: translateX(-3%); opacity: .8; } to { transform: translateX(3%); opacity: 1; } }

/* far-off hills of snow along the bottom */
#xm-fx .xm-hills {
    position: absolute; left: -5%; right: -5%; bottom: 0; height: 260px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 260' preserveAspectRatio='none'%3E%3Cpath fill='%230d2238' d='M0 150c140-55 230 18 360-14s210-72 330-40 190 86 310 56 200-30 200-30v138H0z'/%3E%3Cpath fill='%2314304d' d='M0 196c150-46 250 10 380-16s220-54 340-26 180 64 300 40 180-22 180-22v88H0z'/%3E%3Cpath fill='%231b3e62' d='M0 234c170-30 260 6 400-10s240-30 360-12 200 36 320 20 120-10 120-10v38H0z'/%3E%3C/svg%3E") no-repeat bottom center / 100% 100%;
    opacity: .85;
}
/* a little line of fir trees */
#xm-fx .xm-trees {
    position: absolute; left: 0; right: 0; bottom: 40px; height: 150px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 150'%3E%3Cg fill='%230f2b22'%3E%3Cpath d='M70 140L40 95h18L34 62h16L70 30l20 32h16L82 95h18z'/%3E%3Cpath d='M190 140l-22-33h13L163 83h12l15-24 15 24h12l-18 24h13z'/%3E%3Cpath d='M300 140l-30-45h18l-24-33h16l20-32 20 32h16l-24 33h18z'/%3E%3Cpath d='M470 140l-22-33h13l-18-24h12l15-24 15 24h12l-18 24h13z'/%3E%3Cpath d='M620 140l-34-50h20l-27-37h18l23-36 23 36h18l-27 37h20z'/%3E%3Cpath d='M760 140l-22-33h13l-18-24h12l15-24 15 24h12l-18 24h13z'/%3E%3Cpath d='M860 140l-30-45h18l-24-33h16l20-32 20 32h16l-24 33h18z'/%3E%3C/g%3E%3Cg fill='%23dff0ff' opacity='.55'%3E%3Cpath d='M70 36l10 16H60zM300 38l10 16h-20zM620 40l11 18h-22zM860 38l10 16h-20z'/%3E%3C/g%3E%3C/svg%3E") repeat-x bottom center / 900px auto;
    opacity: .7;
}
/* a drift of snow piled at the very bottom of the window */
#xm-fx .xm-drift {
    position: absolute; left: -2%; right: -2%; bottom: -10px; height: 90px;
    background: radial-gradient(60% 100% at 30% 100%, rgba(223, 240, 255, .16), transparent 70%),
                radial-gradient(50% 100% at 75% 100%, rgba(223, 240, 255, .13), transparent 70%);
}

/* ─── fairy lights strung across the top of the window ─── */
#xm-lights {
    position: fixed; top: 0; left: 0; right: 0; height: 42px;
    pointer-events: none; z-index: 60; overflow: hidden;
}
#xm-lights .wire {
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 42' preserveAspectRatio='none'%3E%3Cpath d='M0 4Q50 26 100 4T200 4T300 4T400 4' stroke='%23123049' stroke-width='2.5' fill='none'/%3E%3C/svg%3E") repeat-x top left / 400px 42px;
}
#xm-lights i {
    position: absolute; top: 0; width: 10px; height: 16px; border-radius: 50% 50% 55% 55%;
    transform-origin: 50% -6px;
    animation: xmGlow 2.6s ease-in-out infinite, xmSway 5s ease-in-out infinite;
}
#xm-lights i::before {
    content: ''; position: absolute; top: -6px; left: 3px; width: 4px; height: 6px;
    border-radius: 2px; background: #1a3a55;
}
@keyframes xmGlow { 0%, 100% { filter: brightness(1); opacity: .95; } 50% { filter: brightness(1.7); opacity: 1; } }
@keyframes xmSway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

/* ─── falling snow (built in js, one flake per element) ─── */
#xm-snow { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
#xm-snow span {
    position: absolute; top: -12px; color: #eaf6ff; opacity: .85; user-select: none;
    text-shadow: 0 0 6px rgba(190, 225, 255, .5);
    animation: xmFall linear forwards;
}
@keyframes xmFall {
    0% { transform: translate(0, -20px) rotate(0deg); opacity: 0; }
    8% { opacity: .9; }
    100% { transform: translate(var(--dx, 20px), 102vh) rotate(var(--rot, 180deg)); opacity: .15; }
}

/* ─── the layer you can touch: baubles to catch, and bursts ─── */
#xm-play { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
#xm-play .xm-catch { pointer-events: auto; cursor: pointer; border: 0; background: transparent; padding: 0; }
.xm-bauble {
    position: absolute; width: 34px; height: 34px; opacity: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 46'%3E%3Crect x='17' y='1' width='6' height='7' rx='1.5' fill='%23e3b94a'/%3E%3Cpath d='M20 1v-1' stroke='%23e3b94a' stroke-width='2'/%3E%3Ccircle cx='20' cy='27' r='17' fill='%23d93b3b'/%3E%3Cpath d='M3 27a17 17 0 0 0 34 0' fill='%23b32b2d' opacity='.55'/%3E%3Cpath d='M6 20q14 8 28 0' stroke='%23f2c75c' stroke-width='2.4' fill='none'/%3E%3Ccircle cx='14' cy='20' r='4.5' fill='%23ffffff' opacity='.28'/%3E%3C/svg%3E") no-repeat center / contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45));
}
.xm-bauble.fall { animation: xmBauble 9s linear forwards, xmSpin 3s linear infinite; }
@keyframes xmBauble {
    0% { opacity: 0; transform: translate(0, -40px); }
    7% { opacity: 1; }
    92% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--xm-dx, 30px), 104vh); }
}
@keyframes xmSpin { from { rotate: -8deg; } 50% { rotate: 8deg; } to { rotate: -8deg; } }
#xm-play .xm-spark {
    position: absolute; font-size: 20px; pointer-events: none;
    animation: xmSpark 1.1s ease-out forwards;
}
@keyframes xmSpark {
    0% { transform: translate(0, 0) scale(.5) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(var(--rot)); opacity: 0; }
}
.xm-score {
    position: fixed; right: 14px; bottom: 14px; z-index: 71;
    display: flex; align-items: center; gap: 7px;
    padding: 7px 12px; border-radius: 999px;
    background: rgba(10, 23, 38, .86); border: 1px solid var(--xm-line);
    color: #ffe9b8; font: 600 12.5px/1 Inter, system-ui, sans-serif;
    box-shadow: 0 8px 26px rgba(0, 0, 0, .45);
}

/* ============================ sidebar ============================ */
html.christmas body .sidebar {
    background:
        linear-gradient(180deg, rgba(10, 23, 38, .95) 0%, rgba(8, 20, 33, .92) 50%, rgba(8, 20, 33, .95) 100%),
        var(--sidebar);
    border-right: 1px solid rgba(242, 199, 92, .16);
}
html.christmas body .z-logo {
    background: linear-gradient(135deg, #e8534e, #b02226) !important;
    box-shadow: 0 0 22px rgba(217, 59, 59, .45), inset 0 1px 0 rgba(255, 255, 255, .25) !important;
}
html.christmas body .brand h2 .hw-ai,
html.christmas body .brand h2 span { color: var(--xm-gold); text-shadow: 0 0 14px rgba(242, 199, 92, .45); }
html.christmas body .btn.primary {
    background: linear-gradient(135deg, #e8534e, #b02226) !important;
    box-shadow: 0 0 22px rgba(217, 59, 59, .4), inset 0 1px 0 rgba(255, 255, 255, .22) !important;
}
html.christmas body .btn.primary:hover { filter: brightness(1.07); box-shadow: 0 0 30px rgba(217, 59, 59, .55) !important; }
html.christmas body .chat-item:hover { background: rgba(242, 199, 92, .07); }
html.christmas body .chat-item.active { background: rgba(217, 59, 59, .14); border-left: 2px solid var(--xm-red); }
html.christmas body .bottom-bar .btn svg { color: #9fd9bb; }
html.christmas body .bottom-bar .btn:hover { background: rgba(47, 158, 99, .10); }
html.christmas body .user-profile-bar { border-top: 1px solid rgba(242, 199, 92, .16); }
html.christmas body .user-profile-bar .user-avatar {
    background: linear-gradient(135deg, #2f9e63, #176b41) !important;
    box-shadow: 0 0 14px rgba(47, 158, 99, .4) !important;
}

/* ============================ messages ============================ */
html.christmas body .assistant .msg-bubble {
    background: var(--ai-msg);
    border: 1px solid rgba(242, 199, 92, .18);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
html.christmas body .assistant .msg-bubble h1,
html.christmas body .assistant .msg-bubble h2,
html.christmas body .assistant .msg-bubble h3 { font-family: var(--xm-serif); letter-spacing: .2px; }
html.christmas body .assistant .msg-bubble h1 { color: #ffe3a8; }
html.christmas body .assistant .msg-bubble h2 { color: #ffd98f; }
html.christmas body .assistant .msg-bubble h3 { color: #bfe3ff; }
html.christmas body .assistant .msg-bubble strong { color: #ffd98f; }
html.christmas body .assistant .msg-bubble a { color: #7fd1a3; }
html.christmas body .assistant .msg-bubble blockquote { border-left-color: var(--xm-green); }
html.christmas body .user .msg-bubble {
    background: var(--user-msg);
    box-shadow: 0 8px 24px rgba(176, 34, 38, .3);
}

/* ============================ composer ============================ */
html.christmas body .composer-box {
    background: rgba(10, 23, 38, .9);
    border: 1px solid rgba(242, 199, 92, .22);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
}
html.christmas body .composer-box:focus-within {
    border-color: rgba(242, 199, 92, .5);
    box-shadow: 0 0 0 1px rgba(242, 199, 92, .3), 0 14px 44px rgba(0, 0, 0, .5);
}
html.christmas body .composer-icon { color: #b9cde3; }
html.christmas body .composer-icon:hover { color: #ffe3a8; }
html.christmas body .composer-icon.active { color: #fff !important; background: rgba(217, 59, 59, .22) !important; }
html.christmas body .ct-sep { background: rgba(242, 199, 92, .2); }
html.christmas body #send-btn {
    background: linear-gradient(135deg, #e8534e, #b02226) !important;
    box-shadow: 0 0 18px rgba(217, 59, 59, .45) !important;
}

/* ============================ welcome ============================ */
html.christmas body .welcome-z-logo {
    background: linear-gradient(135deg, #e8534e, #b02226) !important;
    box-shadow: 0 0 34px rgba(217, 59, 59, .45) !important;
}
html.christmas body .welcome-message h2 { font-family: var(--xm-serif); }
html.christmas body .welcome-message h2 span { color: var(--xm-gold); }
html.christmas body .template-card {
    background: rgba(13, 28, 46, .8);
    border: 1px solid rgba(242, 199, 92, .16);
}
html.christmas body .template-card:hover {
    border-color: rgba(242, 199, 92, .42);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .4);
}

/* a sprig of holly in the corner of the greeting card */
html.christmas body .zp-greetcard { border-color: rgba(242, 199, 92, .25); position: relative; }
html.christmas body .zp-greetcard::after {
    content: ''; position: absolute; top: -10px; right: -6px; width: 46px; height: 34px; pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 44'%3E%3Cpath d='M30 20c-7-9-18-11-26-7 6 2 9 6 10 11-6 1-10 5-12 10 9 2 20-2 28-9z' fill='%232f9e63'/%3E%3Cpath d='M32 20c7-9 18-11 26-7-6 2-9 6-10 11 6 1 10 5 12 10-9 2-20-2-28-9z' fill='%23247a4d'/%3E%3Ccircle cx='28' cy='26' r='5' fill='%23d93b3b'/%3E%3Ccircle cx='37' cy='29' r='4.2' fill='%23b32b2d'/%3E%3Ccircle cx='33' cy='21' r='3.6' fill='%23e8534e'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ============================ landing page ============================ */
html.christmas body .landing-title span,
html.christmas body .wl-title span { color: var(--xm-gold); }
html.christmas body .start-btn {
    background: linear-gradient(135deg, #e8534e, #b02226) !important;
    box-shadow: 0 0 26px rgba(217, 59, 59, .45) !important;
}

/* ============================ kinder on small screens ============================ */
@media (max-width: 760px) {
    #xm-lights { height: 30px; }
    #xm-lights i { width: 8px; height: 13px; }
    #xm-fx .xm-trees { height: 100px; background-size: 650px auto; }
    #xm-fx .xm-hills { height: 170px; }
    .xm-score { right: 10px; bottom: 76px; font-size: 11.5px; padding: 6px 10px; }
}

/* Anyone who asked their device for less movement gets a still scene. */
@media (prefers-reduced-motion: reduce) {
    #xm-snow, #xm-play { display: none; }
    #xm-lights i, #xm-fx .xm-sky { animation: none !important; }
}
/* Same when Animations are switched off in Settings. */
html.zst-no-anim #xm-snow, html.zst-no-anim #xm-play { display: none; }
html.zst-no-anim #xm-lights i { animation: none !important; }
