/* Opt-in seasonal presentation. Never participates in page layout or input. */
.christmas-home-frame {
  --christmas-brightness: .65;
  --christmas-twinkle-duration: 5s;
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow: hidden;
  pointer-events: none !important;
  user-select: none;
}
.christmas-light-rail {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-around;
  pointer-events: none;
}
.christmas-light-rail[data-edge="top"],
.christmas-light-rail[data-edge="bottom"] {
  flex-direction: row;
  left: 10px;
  right: 10px;
  height: 14px;
}
.christmas-light-rail[data-edge="top"] { top: env(safe-area-inset-top, 0px); }
.christmas-light-rail[data-edge="bottom"] { bottom: env(safe-area-inset-bottom, 0px); }
.christmas-light-rail[data-edge="left"],
.christmas-light-rail[data-edge="right"] {
  flex-direction: column;
  top: 14px;
  bottom: 14px;
  width: 14px;
}
.christmas-light-rail[data-edge="left"] { left: 0; }
.christmas-light-rail[data-edge="right"] { right: 0; }
.christmas-light-rail::before {
  content: "";
  position: absolute;
  background: #8e957f;
  opacity: .45;
}
.christmas-light-rail:is([data-edge="top"],[data-edge="bottom"])::before { left:0;right:0;top:50%;height:1px; }
.christmas-light-rail:is([data-edge="left"],[data-edge="right"])::before { top:0;bottom:0;left:50%;width:1px; }
/* Crisp glass LEDs: a white-hot center, color halo and a few star glints.
   Only opacity and scale animate, so brightness does not re-paint shadows per frame. */
.christmas-led {
  flex:0 0 auto;
  display:block;
  position:relative;
  width:5.5px;
  height:5.5px;
  border-radius:50%;
  background:radial-gradient(circle,#fff 0 20%,currentColor 48%,currentColor 75%,transparent 100%);
  color:var(--christmas-led-color);
  opacity:var(--christmas-brightness);
  box-shadow:0 0 2px 1px currentColor,0 0 6px 2px currentColor,0 0 14px 1px currentColor;
  transform:scale(1);
}
.christmas-led:nth-child(5n+2)::before,
.christmas-led:nth-child(5n+2)::after {
  content:"";
  position:absolute;
  left:50%;top:50%;
  background:linear-gradient(90deg,transparent,#fff9,transparent);
  transform:translate(-50%,-50%);
  width:15px;height:1px;
}
.christmas-led:nth-child(5n+2)::after { transform:translate(-50%,-50%) rotate(90deg); }
[data-twinkle="true"] .christmas-led {
  animation:christmas-led-twinkle var(--christmas-twinkle-duration) ease-in-out infinite;
  animation-delay:var(--led-delay,0s);
}
@keyframes christmas-led-twinkle {
  0%,100% {opacity:calc(var(--christmas-brightness)*.32);transform:scale(.78)}
  28% {opacity:calc(var(--christmas-brightness)*.57);transform:scale(.96)}
  45% {opacity:var(--christmas-brightness);transform:scale(1.3)}
  60% {opacity:calc(var(--christmas-brightness)*.71);transform:scale(1.07)}
  76% {opacity:calc(var(--christmas-brightness)*.92);transform:scale(1.14)}
}

/* Section strands live in the real spaces between the existing content rows. */
.christmas-home-gaps {
  position:absolute;inset:0 0 auto;height:0;z-index:5;
  pointer-events:none!important;user-select:none;
}
.christmas-section-strand {
  position:absolute;height:16px;
  transform:translateY(-50%);
  pointer-events:none!important;
}
.christmas-section-strand .christmas-light-rail[data-edge="middle"] {
  inset:0;flex-direction:row;
}
.christmas-section-strand .christmas-light-rail::before {
  inset:auto 0;height:1px;top:50%;
  background:linear-gradient(90deg,transparent,#9b9879 8%,#9b9879 92%,transparent);
}
.christmas-section-strand .christmas-led { width:4.5px;height:4.5px; }
.christmas-section-strand[data-cane="true"]::after {
  content:"";position:absolute;left:50%;top:50%;
  width:30px;height:29px;transform:translate(-50%,-50%);
  background:#101319 url("/assets/images/christmas/candy-canes.svg") center/contain no-repeat;
  border-radius:50%;box-shadow:0 0 8px #ecc88d45;
}
.christmas-section-strand[data-offscreen="true"] .christmas-led { animation-play-state:paused!important; }

/* The theme is behind the message feed, not the composer or existing banner.
   The dark tint keeps incoming messages and role colors readable. No layout changes. */
#chat-messages[data-christmas-theme],
.christmas-chat-flight[data-christmas-theme],
.christmas-lounge-preview[data-christmas-theme],
.christmas-scene-frame[data-christmas-theme] {
  background: linear-gradient(rgba(7,10,15,var(--christmas-dim,.48)),rgba(7,10,15,var(--christmas-dim,.48))), var(--christmas-art) var(--christmas-position,center)/cover no-repeat !important;
}
/* Only Christmas mode makes the original message bubbles translucent. */
#chat-messages[data-christmas-theme] .chat-text {
  background-color: rgba(13,19,28,.76) !important;
}
#chat-messages[data-christmas-theme] .chat-meta {
  text-shadow: 0 1px 4px #000;
}
#chat-messages[data-christmas-theme] .chat-meta time {
  color: #c0c7d2;
}
[data-christmas-theme="classic"] {
  --christmas-art: url("/assets/images/christmas/classic.webp");
  --christmas-position: left center;
  --garland-filter: none;
  --christmas-accent: #e7c47f;
}
[data-christmas-theme="winter"] {
  --christmas-art: url("/assets/images/christmas/winter.webp");
  --garland-filter: saturate(.45) hue-rotate(155deg) brightness(1.35);
  --christmas-accent: #caeaff;
}
[data-christmas-theme="fireside"] {
  --christmas-art: url("/assets/images/christmas/fireside.webp");
  --christmas-position: left center;
  --garland-filter: sepia(.38) saturate(.83) brightness(1.12);
  --christmas-accent: #ffcf91;
}
[data-christmas-theme="village"] {
  --christmas-art:url("/assets/images/christmas/village.webp");
  --garland-filter:none;--christmas-accent:#f7ce91;
}
[data-christmas-theme="plaza"] {
  --christmas-art:url("/assets/images/christmas/plaza.webp");
  --garland-filter:none;--christmas-accent:#edc478;
}
[data-christmas-theme="aurora"] {
  --christmas-art:url("/assets/images/christmas/aurora.webp");
  --garland-filter:saturate(.7) hue-rotate(85deg);--christmas-accent:#acead8;
}
[data-christmas-theme="alpine-retreat"] {
  --christmas-art:url("/assets/images/christmas/alpine-retreat.webp");
  --christmas-dim:.34;--garland-filter:none;--christmas-accent:#ffc490;
}
[data-christmas-theme="forest-trail"] {
  --christmas-art:url("/assets/images/christmas/forest-trail.webp");
  --christmas-dim:.34;--garland-filter:none;--christmas-accent:#f4cf86;
}
[data-christmas-theme="riverside-bridge"] {
  --christmas-art:url("/assets/images/christmas/riverside-bridge.webp");
  --christmas-dim:.34;--garland-filter:none;--christmas-accent:#e5cba1;
}
[data-christmas-theme="mountain-resort"] {
  --christmas-art:url("/assets/images/christmas/mountain-resort.webp");
  --christmas-dim:.34;--garland-filter:none;--christmas-accent:#f3c88e;
}
[data-christmas-theme="winter-harbor"] {
  --christmas-art:url("/assets/images/christmas/winter-harbor.webp");
  --christmas-dim:.34;--garland-filter:none;--christmas-accent:#f3c6ab;
}
.lounge-backdrop[data-christmas-theme] .backdrop-copy {
  z-index: 3;
}
.christmas-lounge-ornaments {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none !important;
  user-select: none;
}
.christmas-garland {
  position: absolute;
  inset: 0 0 auto;
  height: 26px;
  background: url("/assets/images/christmas/garland.svg") repeat-x top left / 260px 28px;
  filter: var(--garland-filter);
  opacity: .97;
}
/* New dedicated layer: snow falls over the whole visible conversation area. */
.christmas-chat-snow {
  position:absolute;z-index:4;overflow:hidden;
  pointer-events:none!important;user-select:none;
}
.christmas-flake {
  position:absolute;top:-8px;left:var(--flake-x);
  width:var(--flake-size);height:var(--flake-size);
  border-radius:50%;background:#f7fbff;
  box-shadow:0 0 5px #dcf5ff;
  opacity:.78;
  animation:christmas-chat-snowfall var(--flake-time) linear infinite;
  animation-delay:var(--flake-delay);
}
@keyframes christmas-chat-snowfall {
  0% {transform:translate3d(0,-8px,0);opacity:0}
  7% {opacity:.83}
  38% {opacity:.65}
  90% {opacity:.82}
  100% {transform:translate3d(var(--flake-drift),var(--snow-distance),0);opacity:0}
}

/* Header garland, two rim-light strands, and a greeting in unused desktop space.
   No layout/role badge changes, and the layer cannot take mouse or touch input. */
.christmas-header-ornaments {
  position:absolute;inset:0;z-index:1;
  overflow:hidden;pointer-events:none!important;user-select:none;
}
.christmas-header-garland {
  position:absolute;inset:0 0 auto;height:17px;
  background:url("/assets/images/christmas/garland.svg") repeat-x left top/210px 22px;
  opacity:.94;
}
.christmas-header-ornaments .christmas-light-rail[data-edge="top"] { top:12px;height:10px;left:14px;right:14px; }
.christmas-header-ornaments .christmas-light-rail[data-edge="bottom"] { bottom:3px;height:8px;left:14px;right:14px; }
.christmas-lounge-ornaments .christmas-light-rail[data-edge="top"] { top:17px;height:9px;left:9px;right:9px; }
.christmas-lounge-ornaments .christmas-light-rail[data-edge="bottom"] { bottom:3px;height:9px;left:9px;right:9px; }
.christmas-lounge-ornaments .christmas-led,.christmas-header-ornaments .christmas-led { width:4.5px;height:4.5px; }
.christmas-holiday-greeting {
  position:absolute;right:25px;top:33px;bottom:10px;
  line-height:1.56;
  color:#ffe8bf;font-weight:900;font-size:clamp(15px,1.45vw,23px);
  font-family:Georgia,serif;letter-spacing:.085em;
  text-shadow:0 0 8px #ffb75a,0 0 19px #ff9c3d80;
  white-space:nowrap;
}
/* The larger snowman remains centered below the greeting's leading star.
   The greeting itself owns this decorative artwork, so OFF removes both. */
.christmas-holiday-greeting::after {
  content:"";
  position:absolute;
  left:.5em;top:calc(1.56em + 2px);
  width:108px;height:clamp(0px,calc(100% - 1.56em - 2px),138px);
  transform:translateX(-50%);
  background:url("/assets/images/christmas/snowman.svg") center/contain no-repeat;
  filter:drop-shadow(0 1px 2px #0008);
  pointer-events:none;
}
.christmas-header-ornaments[data-twinkle="true"] .christmas-holiday-greeting {
  animation:christmas-greeting-glow 4.8s ease-in-out infinite;
}
@keyframes christmas-greeting-glow {
  0%,100% {opacity:.72} 50% {opacity:1}
}

/* Outdoor artwork + Santa paint behind the scrollable message feed, never over
   chat text or controls. This sibling is clipped to the measured chat viewport. */
.christmas-chat-flight {
  position:absolute;z-index:0;overflow:hidden;
  pointer-events:none!important;user-select:none;
}
#chat-messages[data-christmas-flight="true"] {
  background:transparent!important;
  z-index:1;
}
/* The artwork is the same full-color sleigh. Native animation transforms are
   scheduled independently of refresh polling; the track stays hidden between passes. */
.christmas-sleigh-track {
  position:absolute;inset:0;opacity:0;
  pointer-events:none!important;user-select:none;
}
.christmas-sleigh-sprite {
  position:absolute;left:0;top:0;width:min(238px,44%);aspect-ratio:3/1;
  background:url("/assets/images/christmas/sleigh-color.webp") center/contain no-repeat;
  transform-origin:center;
  filter:drop-shadow(0 0 4px #fff3) drop-shadow(0 2px 2px #0007);
}
.christmas-chat-flight .christmas-sleigh-sprite {width:min(260px,42%);}

/* Decorative-only components: paused in background tabs; never cover clip player. */
:is(.christmas-home-frame,.christmas-home-gaps,.christmas-lounge-ornaments,.christmas-header-ornaments,.christmas-chat-snow)[data-paused="true"] * {
  animation-play-state:paused!important;
}
@media (max-width:1100px) {
  .christmas-holiday-greeting {display:none}
}
@media (max-width:820px) {
  /* In in-app browsers the visual viewport can move independently of the
     page. Horizontal fixed rails would cross text as the viewport scrolls.
     Keep the vertical fringe outside content and use real section gaps for
     horizontal lights. Does not change the Lounge or Admin preview. */
  .christmas-home-frame > .christmas-light-rail:is([data-edge="top"],[data-edge="bottom"]) { display:none }
  .christmas-home-frame > .christmas-light-rail:is([data-edge="left"],[data-edge="right"]) { top:0;bottom:0;width:6px }
  .christmas-home-frame { z-index:1 }
  .christmas-home-gaps { z-index:1 }
  body[data-home-theme] #home-section-grid > [data-home-section] { position:relative;z-index:2 }
  .christmas-section-strand[data-cane="true"]::after { display:none }
  .christmas-light-rail[data-edge="top"],.christmas-light-rail[data-edge="bottom"] {height:9px}
  .christmas-light-rail[data-edge="left"],.christmas-light-rail[data-edge="right"] {width:9px}
  .christmas-led,.christmas-section-strand .christmas-led,.christmas-header-ornaments .christmas-led,.christmas-lounge-ornaments .christmas-led {
    width:3.5px;height:3.5px;box-shadow:0 0 3px 1px currentColor,0 0 7px currentColor
  }
  .christmas-light-rail:is([data-edge="top"],[data-edge="bottom"]) .christmas-led:nth-child(n+29) {display:none}
  .christmas-light-rail:is([data-edge="left"],[data-edge="right"]) .christmas-led:nth-child(n+30) {display:none}
  .christmas-garland {height:11px;background-size:118px 12px}
  .christmas-header-garland {height:10px;background-size:118px 12px}
  .christmas-header-ornaments .christmas-light-rail[data-edge="top"] {top:7px;height:5px}
  .christmas-header-ornaments .christmas-light-rail[data-edge="bottom"] {bottom:1px;height:5px}
  .christmas-lounge-ornaments .christmas-light-rail[data-edge="top"] {top:8px;height:5px}
  .christmas-lounge-ornaments .christmas-light-rail[data-edge="bottom"] {bottom:1px;height:5px}
  .christmas-lounge-ornaments .christmas-sleigh-track {display:none}
  .christmas-chat-flight .christmas-sleigh-sprite {width:min(160px,40%)}
  .christmas-flake:nth-child(n+21) {display:none}
  .christmas-section-strand .christmas-led:nth-child(n+21) {display:none}
}
@media (prefers-reduced-motion:reduce) {
  .christmas-led,.christmas-holiday-greeting {animation:none!important}
  .christmas-flake,.christmas-sleigh-track {display:none!important}
}

/* Admin-only, scoped compact controls and visual samples. */
#dashboard .christmas-controls-active > .card-label,
#dashboard .christmas-controls-active > #activity-list { display:none !important; }
.christmas-admin-card { display:grid; gap:10px; min-width:0; }
.christmas-admin-head { display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap; }
.christmas-admin-head .card-label { margin:0 0 4px; }
.christmas-admin-head p { margin:0; }
.christmas-admin-switch {
  width:auto !important; min-width:165px; min-height:38px;
}
.christmas-admin-switch[aria-checked="true"] { color:#14240b!important; background:linear-gradient(180deg,#d5f79e,#83b94e)!important; }
.christmas-admin-fields { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px;align-items:end; }
.christmas-admin-fields label { display:grid;gap:4px;min-width:0;font-size:11px;font-weight:800;color:#e2decd; }
.christmas-admin-fields select,.christmas-admin-fields input[type=color] {
  width:100%;min-height:35px; padding:5px 7px;border:1px solid #50535f;border-radius:7px;background:#0c1118;color:#fff;
}
.christmas-admin-fields input[type=range] { width:100%;min-width:0;accent-color:#e5bd71; }
.christmas-option { display:flex!important; align-items:center; gap:8px!important; min-height:35px; }
.christmas-option input { width:16px;height:16px;accent-color:#d6b16a; }
.christmas-admin-preview { --christmas-brightness:.65;--christmas-twinkle-duration:5s;position:relative;min-height:48px;border:1px solid #50535f;border-radius:10px;background:#0c1118;overflow:hidden;display:grid;place-items:center;color:#e5dfce;font-size:10px;letter-spacing:.1em; }
.christmas-admin-preview .christmas-light-rail { left:10px;right:10px; }
.christmas-lounge-preview { position:relative;overflow:hidden;min-height:100px;border:1px solid #50535f;border-radius:10px;display:grid;place-items:center; }
.christmas-lounge-preview strong { position:relative; z-index:1;border:1px solid var(--christmas-accent);border-radius:8px;background:#11151deb;color:#fff2db;padding:8px 18px;letter-spacing:.12em;font-size:13px;box-shadow:0 0 10px var(--christmas-accent); }
.christmas-admin-status { margin:0!important; color:#71dee9!important; font-size:11px!important; min-height:16px; }
.christmas-lounge-admin { margin:0 0 12px; }
@media(max-width:1100px) { .christmas-admin-fields { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:560px) { .christmas-admin-fields { grid-template-columns:1fr; } .christmas-admin-switch { width:100%!important; } }

/* A separate scenery viewport crossfades underneath Santa and all messages. */
.christmas-chat-scenery{position:absolute;z-index:0;overflow:hidden;pointer-events:none!important;user-select:none}
.christmas-scene-frame{position:absolute;inset:0;pointer-events:none!important}
#chat-messages[data-christmas-scenery="true"]{background:transparent!important;z-index:2}
.chat-panel[data-christmas-scenery="true"]>.christmas-chat-flight{background:transparent!important;z-index:1}
.christmas-rotation{margin:6px 0;padding:12px;border:1px solid #66502a;border-radius:10px;background:#11151bdd}
.christmas-rotation legend{font-size:12px;font-weight:900;color:#f4d38a;letter-spacing:.05em;padding:0 6px}
.christmas-rotation-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:3px 10px;margin-top:8px}
.christmas-rotation-choices label{font-size:11px;min-height:30px;color:#e2decd}
.christmas-rotation-help{font-size:11px;color:#bac4cc;margin:7px 0 0}
