.content:has(> .winter-snowflake) { position: relative; }
.winter-event-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  margin-bottom: 1rem;
  padding: .65rem .9rem;
  position: relative;
  overflow: hidden;
  color: #eefbff;
  background: linear-gradient(100deg, #17364d, #25546b);
  border: 2px solid #82bed5;
  border-radius: 8px;
}
.winter-event-strip > :not(.winter-sleigh) { position: relative; z-index: 1; }
.winter-event-strip .winter-santa-button { margin-inline-start: auto; gap: .65rem; color: #541f29; }
.winter-sleigh {
  position: absolute;
  top: .2rem;
  right: .7rem;
  width: 116px;
  height: 48px;
  background: url('./assets/ui/themes/winter-sleigh.png') center / contain no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
  opacity: 0;
}
.winter-santa-preview { position: relative; min-height: 5rem; margin-top: .65rem; overflow: hidden; background: #16394b; }
.winter-santa-preview .winter-sleigh { top: .45rem; right: 40%; }
.winter-santa-preview .winter-gift { position: absolute; bottom: .5rem; left: 60%; }
.winter-gift {
  display: inline-block;
  width: 20px;
  height: 19px;
  background:
    linear-gradient(90deg, transparent 40%, #ffe087 40% 60%, transparent 60%),
    linear-gradient(#d8545e 0 28%, #972b40 28%);
  border: 2px solid #732c42;
  box-shadow: inset 0 1px #f89288;
  flex: 0 0 auto;
}
.winter-snowflake {
  position: absolute;
  z-index: 4;
  top: clamp(3rem, calc(6rem + var(--winter-position) * 6rem), max(3rem, calc(100% - 3rem)));
  inset-inline-end: .25rem;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid #173867;
  border-radius: 11px;
  color: #d9fbff;
  background: #224978;
  box-shadow: 0 0 0 2px #a2e4ff, 0 0 15px #7fdbff;
  cursor: pointer;
}
.winter-snowflake:focus-visible { outline: 3px solid #f5c862; outline-offset: 3px; }
.winter-snowflake.is-left { inset-inline: .25rem auto; }

@media (min-width: 1180px) {
  .winter-snowflake { inset-inline-end: -3.25rem; }
  .winter-snowflake.is-left { inset-inline: -3.25rem auto; }
}

@media (max-width: 1179px) {
  .content:has(> .winter-snowflake:not(.is-left)) { padding-inline-end: 3.25rem; }
  .content:has(> .winter-snowflake.is-left) { padding-inline-start: 3.25rem; }
}
.winter-snowflake > span {
  width: 25px;
  height: 25px;
  background: currentColor;
  clip-path: polygon(44% 0, 56% 0, 56% 34%, 79% 11%, 89% 21%, 66% 44%, 100% 44%, 100% 56%,
    66% 56%, 89% 79%, 79% 89%, 56% 66%, 56% 100%, 44% 100%, 44% 66%, 21% 89%, 11% 79%,
    34% 56%, 0 56%, 0 44%, 34% 44%, 11% 21%, 21% 11%, 44% 34%);
}
.winter-event-feedback {
  position: fixed;
  z-index: 60;
  right: 1rem;
  bottom: 1rem;
  max-width: min(24rem, calc(100% - 2rem));
  margin: 0;
  padding: .8rem 1rem;
  border-radius: 8px;
  background: #17364d;
  color: #eefbff;
}
.winter-admin-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.winter-admin-grid fieldset { min-width: 0; border: 1px solid #8db3c6; border-radius: 8px; }
.winter-admin-grid legend { padding: 0 .3rem; font-weight: 800; }
.winter-admin-grid .field { margin-bottom: .65rem; }
.winter-reward-dialog {
  box-sizing: border-box;
  width: min(36rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: clamp(1rem, 4vw, 2rem);
  color: #15374f;
  background: linear-gradient(155deg, #fff, #d9f4ff);
  border: 3px solid #76bce1;
  border-radius: 12px;
}
.winter-reward-dialog::backdrop { background: rgba(4, 21, 44, .73); }
.winter-reward-dialog h2 { margin-top: 0; }
.winter-rewards-preview { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .85rem; margin-block: 1rem; }
.winter-rewards-preview > div { display: grid; gap: .6rem; }
.winter-reward-avatar { justify-items: center; }

@property --winter-ice-glint {
  syntax: "<angle>";
  inherits: false;
  initial-value: 15deg;
}

.avatar-stage.frame-winter-snow-hunt {
  --winter-crystal-frame: url("./assets/ui/themes/winter-crystal-frame.png");
  --winter-photo-top: 12%;
  --winter-photo-left: 8%;
  --winter-photo-width: 84%;
  --winter-photo-height: 87%;
  --winter-photo-background: linear-gradient(150deg, #1b426e, #081e45 74%);
  isolation: isolate;
  border: 3px solid transparent;
  box-shadow: none;
  background: none;
}
.avatar-stage.frame-winter-snow-hunt::before,
.avatar-stage.frame-winter-snow-hunt::after {
  content: "";
  position: absolute;
  inset: -12%;
  pointer-events: none;
  image-rendering: pixelated;
}
.avatar-stage.frame-winter-snow-hunt::before {
  z-index: 1;
  background: var(--winter-crystal-frame) center / 100% 100% no-repeat;
}
.avatar-stage.frame-winter-snow-hunt::after {
  z-index: 2;
  mask: var(--winter-crystal-frame) center / 100% 100% no-repeat;
  background: conic-gradient(from var(--winter-ice-glint, 15deg),
    transparent 0deg 8deg, #94e8ff70 14deg, #f9ffffcf 20deg, transparent 28deg);
}
.avatar-stage:is(.frame-winter-snow-hunt, .frame-frost-night) > .avatar-ring {
  overflow: visible;
  border-color: transparent;
  background: none;
}
/* Keep the avatar ring in layout and paint the photo in the PNG opening. */
.avatar-stage:is(.frame-winter-snow-hunt, .frame-frost-night) > .avatar-ring::before,
.avatar-stage:is(.frame-winter-snow-hunt, .frame-frost-night) > .avatar-ring > img {
  position: absolute;
  top: var(--winter-photo-top);
  left: var(--winter-photo-left);
  width: var(--winter-photo-width);
  height: var(--winter-photo-height);
  clip-path: polygon(8% 0, 92% 0, 100% 8%, 100% 92%, 92% 100%, 8% 100%, 0 92%, 0 8%);
}
.avatar-stage:is(.frame-winter-snow-hunt, .frame-frost-night) > .avatar-ring::before {
  content: "";
  background: var(--winter-photo-background);
  pointer-events: none;
}
.avatar-stage:is(.frame-winter-snow-hunt, .frame-frost-night) .avatar-fallback {
  position: relative;
  color: #ecfbff;
}
.user-chip-badge.badge-winter-snow-hunt {
  color: #effcff;
  border-color: #a3e7ff;
  background: linear-gradient(150deg, #294f89, #132a54 64%);
  box-shadow: inset 0 1px 0 #a9e8ff6e, 0 0 0 1px #224a81;
}
.user-chip-badge.badge-winter-snow-hunt::before {
  content: "";
  flex: 0 0 .7em;
  aspect-ratio: 1;
  margin-inline-end: .38em;
  background: #b0eeff;
  clip-path: polygon(42% 0, 58% 0, 58% 33%, 85% 15%, 94% 29%, 66% 50%,
    94% 71%, 85% 85%, 58% 67%, 58% 100%, 42% 100%, 42% 67%, 15% 85%, 6% 71%,
    34% 50%, 6% 29%, 15% 15%, 42% 33%);
}

.chat-msg.chat-style-winter {
  position: relative;
  isolation: isolate;
  border: 2px solid #4aade2;
  border-radius: 5px;
}
.chat-msg.chat-style-winter:not(.is-selected) {
  background: linear-gradient(102deg, #d9f5ff 8%, #c0ebfb 42%, #55c5e9 72%, #04a5cf);
}
.chat-msg.chat-style-winter.is-selected { border-color: #397cb5; background: #b8e2f9; }
.chat-msg.chat-style-winter::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -2px;
  pointer-events: none;
  border: clamp(24px, 5vw, 31px) solid transparent;
  border-image: url("./assets/ui/themes/winter-crystal-chat-edge.png") 27% stretch;
  image-rendering: pixelated;
}
.chat-msg.chat-style-winter::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 38%;
  border-radius: inherit;
  pointer-events: none;
  mask-image: linear-gradient(90deg, transparent, #000 52%);
  background-image: url("./assets/ui/themes/winter-chat-snow.png"), url("./assets/ui/themes/winter-chat-snow.png");
  background-size: 207px 161px, 113px 88px;
  background-position: 100% 14px, 100% -23px;
  image-rendering: pixelated;
}
.chat-style-winter .chat-msg-body { color: #0d2852; }
.chat-style-winter .chat-msg-author { color: #0d2a57; }
.chat-style-winter .chat-msg-meta > .muted { color: #254364; }

@media (prefers-reduced-motion: no-preference) {
  .winter-sleigh { animation: winter-sleigh-flight 2.6s ease-out both; }
  .winter-santa-button { animation: winter-gift-arrives .01s 2.1s both; }
  .winter-santa-preview .winter-gift, .winter-santa-button .winter-gift { animation: winter-flake-drop .65s 2.1s ease-out both; }
  .winter-snowflake { animation: winter-flake-drop .8s ease-out both; }
  .avatar-stage.frame-winter-snow-hunt::after { animation: winter-ice-glint 8s steps(80) infinite; }
  .chat-msg.chat-style-winter::before { animation: winter-chat-snow 13s linear infinite; }
}
@keyframes winter-ice-glint {
  0%, 22% { --winter-ice-glint: 15deg; }
  82%, 100% { --winter-ice-glint: 375deg; }
}
@keyframes winter-chat-snow {
  to { background-position: 100% 175px, 100% 153px; }
}
@keyframes winter-sleigh-flight {
  0% { transform: translateX(100%); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateX(-min(75vw, 60rem)); opacity: 0; }
}
@keyframes winter-flake-drop {
  from { transform: translateY(-3rem); opacity: 0; }
}
@keyframes winter-gift-arrives {
  from { visibility: hidden; }
  to { visibility: visible; }
}

@media (max-width: 430px) {
  .winter-rewards-preview { grid-template-columns: 1fr; }
  .winter-reward-avatar { justify-items: start; }
}
