/* =====================================================================================
   Samesies: Christmas theme
   Night-sky background, falling snow (christmas.js), snow building up on every panel,
   festive lights along the top, a Santa hat on the logo and candy-cane accents.
   Everything is scoped to html[data-theme="christmas"] so switching back is instant.
   ===================================================================================== */

html[data-theme="christmas"] {
  --brand: #d62839;
  --brand-dark: #a91d2c;
  --sun: #f7c948;
  --match: #1e8a52;
  --match-soft: #dcf3e6;
  --you: #fff1c4;
  --night-1: #0b1f30;
  --night-2: #12324a;
  --night-3: #1b4664;
  --snow: #ffffff;
  --snow-shadow: rgba(18, 50, 74, .22);
  --xmas-snow-depth: .3; /* starts as a dusting; christmas.js builds it up */
}

html[data-theme="christmas"] body {
  background:
    radial-gradient(900px 500px at 15% -5%, rgba(80, 140, 190, .35), transparent 70%),
    radial-gradient(800px 450px at 90% 0%, rgba(214, 40, 57, .14), transparent 70%),
    linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 55%, var(--night-3) 100%);
  background-attachment: fixed;
  padding-top: 38px; /* room for the lights */
}

/* Content sits above the snow canvas */
html[data-theme="christmas"] .page { position: relative; z-index: 1; }
html[data-theme="christmas"] .ad-anchor { z-index: 50; }

/* ---------- text that sits on the dark background ---------- */

html[data-theme="christmas"] .logo-word { color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
html[data-theme="christmas"] .top { border-bottom-color: rgba(255, 255, 255, .14); }
html[data-theme="christmas"] .foot { border-top-color: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .6); }
html[data-theme="christmas"] .foot a,
html[data-theme="christmas"] .foot .link-btn { color: rgba(255, 255, 255, .82); }
html[data-theme="christmas"] .foot > div::before { content: '❄  Merry Christmas from Samesies  ❄'; display: block; margin-bottom: 4px; color: #fff; font-weight: 700; }
html[data-theme="christmas"] .loading { color: rgba(255, 255, 255, .75); }
html[data-theme="christmas"] main > .center .btn.brand { box-shadow: 0 6px 20px -6px rgba(214, 40, 57, .7); }

/* Ad placeholders on the dark background */
html[data-theme="christmas"] .ad-placeholder {
  border-color: rgba(255, 255, 255, .22);
  color: rgba(255, 255, 255, .45);
  background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(255, 255, 255, .03) 10px 20px);
}
html[data-theme="christmas"] .ad-anchor { background: var(--night-1); border-top-color: rgba(255, 255, 255, .12); }
html[data-theme="christmas"] .ad-anchor-close { background: var(--night-1); color: rgba(255, 255, 255, .8); border-color: rgba(255, 255, 255, .15); }

/* ---------- snow building up on every panel ---------- */
/* The drift starts thin and builds up over a couple of minutes. christmas.js sets one shared
   --xmas-snow-depth for the whole page, so a panel that appears later matches the others. */

html[data-theme="christmas"] .card { position: relative; }
html[data-theme="christmas"] .card::before {
  content: '';
  position: absolute;
  left: -6px;
  right: -6px;
  top: -24px;
  height: 40px;
  pointer-events: none;
  /* a 200px-wide drift tile repeated along the edge, so lumps look the same at any width */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40' preserveAspectRatio='none'%3E%3Cpath d='M0 40V17C9 17 13 5 27 4C40 3 45 15 54 15C63 15 66 2 82 2C98 2 103 14 113 14C122 14 127 6 139 6C153 6 157 16 167 16C177 16 181 9 190 10C196 11 196 17 200 17V40Z' fill='%23ffffff'/%3E%3C/svg%3E") repeat-x 0 0 / 200px 100%;
  border-radius: 20px 20px 12px 12px; /* rounded ends to the drift */
  /* frosty blue edge on top only (the shadow is pushed upwards so none lands on the panel) */
  filter: drop-shadow(0 -1.5px 0 rgba(160, 200, 225, .95)) drop-shadow(0 -4px 6px rgba(255, 255, 255, .25));
  transform-origin: 50% 100%;
  transform: scaleY(var(--xmas-snow-depth, 1));
  opacity: calc(.55 + .45 * var(--xmas-snow-depth, 1));
  transition: transform 2.2s linear, opacity 2.2s linear;
  z-index: 2;
}
/* Rounded panels: hide the drift's square bottom corners inside the card edge */
html[data-theme="christmas"] .card { border-top-color: transparent; }


/* A few icicles hanging off the bottom of the big score panel */
html[data-theme="christmas"] .score-card::after {
  content: '';
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: -11px;
  height: 12px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 12' preserveAspectRatio='none'%3E%3Cg fill='%23e8f4fb'%3E%3Cpath d='M10 0l4 10 4-10z'/%3E%3Cpath d='M42 0l3 7 3-7z'/%3E%3Cpath d='M78 0l4 12 4-12z'/%3E%3Cpath d='M120 0l3 6 3-6z'/%3E%3Cpath d='M158 0l4 11 4-11z'/%3E%3Cpath d='M196 0l3 7 3-7z'/%3E%3Cpath d='M232 0l4 10 4-10z'/%3E%3Cpath d='M272 0l3 8 3-8z'/%3E%3C/g%3E%3C/svg%3E") no-repeat;
  background-size: 100% 100%;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .12));
}

/* ---------- Santa hat on the logo ---------- */

html[data-theme="christmas"] .logo { position: relative; }
html[data-theme="christmas"] .logo::before {
  content: '';
  position: absolute;
  left: -6px;
  top: -16px;
  width: 30px;
  height: 26px;
  transform: rotate(-16deg);
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 26'%3E%3Cpath d='M4 19C6 10 11 4 19 4c4 0 7 2 7 6-2-1-4-1-6 1-3 3-5 6-6 9z' fill='%23d62839'/%3E%3Cpath d='M19 4c4 0 7 2 7 6-1 0-2-1-3-1 0-2-2-4-4-5z' fill='%23a91d2c'/%3E%3Crect x='1' y='17' width='19' height='6' rx='3' fill='%23fff'/%3E%3Ccircle cx='26.5' cy='11' r='3.2' fill='%23fff'/%3E%3C/svg%3E") no-repeat center / contain;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25));
}

/* ---------- festive accents ---------- */

/* Candy-cane buttons */
html[data-theme="christmas"] .btn.brand {
  background: repeating-linear-gradient(-45deg, #d62839 0 14px, #e1434f 14px 28px);
  background-size: 200% 200%;
  box-shadow: 0 6px 18px -8px rgba(214, 40, 57, .8);
}
html[data-theme="christmas"] .btn.brand:hover { animation: xmas-cane 1.2s linear infinite; }
@keyframes xmas-cane { to { background-position: 40px 0; } }

/* Candy-cane progress on the current question */
html[data-theme="christmas"] .progress span.now {
  background: repeating-linear-gradient(-45deg, #d62839 0 5px, #fff 5px 10px);
  background-size: 28px 6px;
  animation: xmas-cane-bar 1s linear infinite;
  box-shadow: 0 0 0 1px rgba(214, 40, 57, .35);
}
html[data-theme="christmas"] .progress span.done { background: var(--match); }
@keyframes xmas-cane-bar { to { background-position: 28px 0; } }

/* Little snowflakes either side of small headings */
html[data-theme="christmas"] .score-title::before,
html[data-theme="christmas"] .score-title::after { content: ' ❄ '; color: #8cc6e7; }

/* Highlighted answer glows gold */
html[data-theme="christmas"] .bar.you { box-shadow: 0 0 0 3px rgba(247, 201, 72, .35); }

/* Chips and the help button pick up a frosty edge */
html[data-theme="christmas"] .chip,
html[data-theme="christmas"] .icon-btn { border-color: rgba(255, 255, 255, .6); box-shadow: 0 2px 10px -4px rgba(0, 0, 0, .4); }

/* ---------- festive lights (built by christmas.js) ---------- */

.xmas-lights {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}
.xmas-lights svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.xmas-bulb {
  position: absolute;
  width: 11px;
  height: 16px;
  margin-left: -5.5px;
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background: var(--c);
  box-shadow: 0 0 6px 2px var(--c), 0 0 18px 4px var(--glow);
  animation: xmas-twinkle var(--speed, 2.4s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.xmas-bulb::before {
  content: '';
  position: absolute;
  left: 2.5px;
  top: -4px;
  width: 6px;
  height: 5px;
  border-radius: 1px;
  background: #3d4a52;
}
.xmas-bulb::after { /* shine */
  content: '';
  position: absolute;
  left: 2px;
  top: 3px;
  width: 3px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .7);
}
.xmas-bulb.red    { --c: #ff4057; --glow: rgba(255, 64, 87, .45); }
.xmas-bulb.green  { --c: #3fe08a; --glow: rgba(63, 224, 138, .4); }
.xmas-bulb.gold   { --c: #ffd34d; --glow: rgba(255, 211, 77, .45); }
.xmas-bulb.blue   { --c: #4cc3ff; --glow: rgba(76, 195, 255, .45); }

@keyframes xmas-twinkle {
  0%, 100% { opacity: 1; filter: brightness(1.15); }
  50%      { opacity: .35; filter: brightness(.6); box-shadow: 0 0 2px 0 var(--c); }
}

/* ---------- snow canvas ---------- */

#xmas-snow {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

/* ---------- people who prefer less motion get a still version ---------- */

@media (prefers-reduced-motion: reduce) {
  html[data-theme="christmas"] .card::before { transition: none; }
  html[data-theme="christmas"] .btn.brand:hover,
  html[data-theme="christmas"] .progress span.now { animation: none; }
  .xmas-bulb { animation: none; }
}

/* Smaller screens: smaller lights, a little less padding */
@media (max-width: 520px) {
  html[data-theme="christmas"] body { padding-top: 32px; }
  .xmas-lights { height: 38px; }
  .xmas-bulb { transform: scale(.85); }
}
