/* Themes for the advent page: neon (default), calendar, glass. Loaded after style.css. */
@font-face { font-family: "Oswald"; src: url("fonts/Oswald.ttf") format("truetype"); font-weight: 200 700; font-display: swap; }
@font-face { font-family: "Bangers"; src: url("fonts/Bangers-Regular.ttf") format("truetype"); font-display: swap; }

body {
  --nick-fill: #ffb21e;
  --nick-stroke: #3b1300;
  --closed-fill: #1b2150;
  --closed-line: rgba(255, 196, 64, .55);
  --edge: rgba(255, 255, 255, .45);
  --hole: #ffcf6b;
  --shutter: #23306e;
  --shutter-panel: #2d3c86;
  --shutter-line: rgba(255, 207, 107, .7);
  --page-bg: none;
  background-image: var(--page-bg), var(--theme-bg);
  background-size: cover, auto;
  background-position: center, center;
  background-attachment: fixed;
}

[hidden] { display: none !important; }

/* Title in the squad style: narrow slanted orange-gold letters with a dark outline */
.title {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .01em;
  font-style: italic;
  transform: skewX(-6deg);
  color: #fff3d6;
  -webkit-text-stroke: 1.5px #2a0d00;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #2a0d00, 0 6px 16px rgba(0, 0, 0, .45);
}
.title .sun {
  background: linear-gradient(180deg, #fff27a 0%, #ffc021 45%, #ff7a00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0 .14em 0 .02em;
  -webkit-text-stroke: 1.5px #2a0d00;
  text-shadow: none;
  filter: drop-shadow(0 3px 0 #2a0d00) drop-shadow(0 0 12px rgba(255, 170, 30, .45));
}
.squad-tag {
  display: block;
  font: 600 13px/1 "Oswald", sans-serif;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--nick-fill);
  transform: none;
  -webkit-text-stroke: 0;
  text-shadow: 0 0 10px rgba(255, 178, 30, .6);
  margin-bottom: 4px;
}

/* Glossy pill buttons as in the gift-menu reference */
.btn { border-radius: 999px; position: relative; overflow: hidden; }
.btn::after {
  content: ""; position: absolute; left: 8%; right: 8%; top: 2px; height: 45%;
  border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.btn-ghost::after { opacity: .35; }

/* Puzzle pieces */
.piece-nick {
  font-family: "Bangers", "Oswald", sans-serif;
  font-weight: 400;
  letter-spacing: .03em;
  fill: var(--nick-fill);
  stroke: var(--nick-stroke);
  stroke-width: 5px;
  stroke-linejoin: round;
  paint-order: stroke fill;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .55));
}
a:hover .piece-nick, a:focus .piece-nick { fill: #fff27a; text-decoration: none; }
.piece-num { font-family: "Oswald", sans-serif; font-weight: 700; fill: var(--shutter-line); opacity: .9; }
.piece-closed { fill: var(--closed-fill); stroke: none; }
.piece-outline { fill: none; stroke: var(--closed-line); stroke-width: 2.5; pointer-events: none; }
.piece-edge { stroke: var(--edge); }
.window-hole { fill: var(--hole); filter: drop-shadow(0 0 14px var(--hole)); }
.shutter { transform-box: view-box; transition: transform .9s cubic-bezier(.2, .8, .2, 1); }
.shutter-board { fill: var(--shutter); stroke: var(--shutter-line); stroke-width: 2; }
.shutter-panel { fill: var(--shutter-panel); stroke: var(--shutter-line); stroke-width: 1.5; opacity: .9; }
.shutters.is-open .shutter { transform: scaleX(.1); }
.shutters.is-open .shutter-panel { opacity: 0; }

/* Decorations */
.board { position: relative; }
.garland { display: none; }
.mascot { display: none; }
.snowfall {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, .8), transparent 60%),
    radial-gradient(3px 3px at 120px 80px, rgba(255, 255, 255, .7), transparent 60%),
    radial-gradient(2px 2px at 220px 150px, rgba(255, 255, 255, .6), transparent 60%),
    radial-gradient(2.5px 2.5px at 320px 40px, rgba(255, 255, 255, .75), transparent 60%);
  background-size: 360px 220px;
  animation: snow 18s linear infinite;
  opacity: .55;
}
@keyframes snow { from { background-position: 0 0; } to { background-position: 60px 440px; } }
.top, .page { position: relative; z-index: 1; }

/* Door dialog: two leaves swing open over the video */
.video-dialog { max-height: calc(100dvh - 24px); overflow: auto; }
.video-dialog video { max-height: 62vh; }
.video-dialog .doors { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; perspective: 1400px; }
.video-dialog .door {
  position: absolute; top: 0; bottom: 0; width: 50%; pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 207, 107, .35) 0 18px, transparent 19px),
    linear-gradient(180deg, var(--shutter-panel), var(--shutter));
  border: 3px solid var(--shutter-line);
  transition: transform 1s cubic-bezier(.2, .8, .2, 1);
}
.video-dialog .door-l { left: 0; transform-origin: left center; }
.video-dialog .door-r { right: 0; transform-origin: right center; }
.video-dialog.doors-open .door-l { transform: rotateY(-105deg); }
.video-dialog.doors-open .door-r { transform: rotateY(105deg); }
.video-head #video-title { font: 700 22px/1.1 "Oswald", sans-serif; text-transform: uppercase; color: var(--nick-fill); letter-spacing: .02em; }
.video-foot { display: flex; justify-content: center; padding: 12px; }

/* Admin preview bar */
.look-bar {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  max-width: calc(100vw - 24px);
  padding: 8px 12px; border-radius: 16px;
  background: rgba(10, 14, 40, .88); border: 1px solid rgba(255, 196, 64, .6);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .55); color: #eef3ff; font-size: 14px;
}
.look-bar label { display: flex; align-items: center; gap: 6px; }
.look-bar select { font: inherit; padding: 4px 6px; border-radius: 8px; background: #0c1230; color: #eef3ff; border: 1px solid rgba(169, 181, 218, .4); }
.look-bar .msg { margin: 0 !important; min-height: 0; }
.look-bar .btn { width: auto; }
body.has-look-bar .page { padding-bottom: 110px; }

/* Points, tickets and the prize menu */
.balance-chip {
  display: inline-flex; white-space: nowrap; align-items: center; padding: 5px 12px; border-radius: 999px;
  font: 700 15px/1.2 "Oswald", sans-serif; letter-spacing: .03em; text-decoration: none;
  color: #2a1400; background: linear-gradient(180deg, #ffe27a, #ffad1f);
  box-shadow: 0 0 0 2px rgba(42, 13, 0, .6), 0 0 14px rgba(255, 170, 30, .55);
}
.first-hint {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 3;
  width: min(86%, 460px); margin: 0; padding: 14px 18px; text-align: center; pointer-events: none;
  font: 600 clamp(15px, 3.6vw, 20px)/1.3 "Oswald", sans-serif; color: #fff3d6;
  background: rgba(8, 10, 34, .82); border-radius: 18px;
  box-shadow: 0 0 0 2px rgba(255, 207, 74, .8), 0 0 24px rgba(255, 170, 40, .45);
}
.wallet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.wallet-label { display: block; color: var(--muted); font-size: 14px; }
.wallet-sum { font: 700 clamp(28px, 7vw, 40px)/1.1 "Oswald", sans-serif; color: var(--nick-fill); text-shadow: 0 0 16px rgba(255, 178, 30, .5); }
.wallet-head .btn { width: auto; }
.tickets { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.tickets li { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid rgba(169, 181, 218, .12); }
.tickets a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: inherit; font-weight: 600; text-decoration: none; }
.chip { flex: none; padding: 2px 8px; border-radius: 999px; font-size: 12px; color: var(--muted); border: 1px dashed rgba(169, 181, 218, .45); }
.chip.on { color: #1d1300; background: var(--nick-fill); border: 1px solid var(--nick-fill); font-weight: 700; }

.prize-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 18px 0; }
.prize-card {
  position: relative; display: flex; flex-direction: column; border-radius: 20px; overflow: hidden;
  background: linear-gradient(180deg, rgba(30, 34, 96, .95), rgba(10, 12, 40, .95));
  box-shadow: 0 0 0 2px rgba(255, 207, 74, .75), 0 0 18px rgba(255, 170, 40, .3), var(--shadow);
}
.prize-card.off { filter: grayscale(.85); opacity: .75; }
.prize-card.mine { box-shadow: 0 0 0 3px #8be3a5, 0 0 22px rgba(139, 227, 165, .45), var(--shadow); }
.prize-img { aspect-ratio: 1 / 1; background: radial-gradient(circle at 50% 40%, rgba(255, 207, 107, .35), rgba(20, 24, 70, .9)); display: grid; place-items: center; }
.prize-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prize-img .ph { font: 700 64px/1 "Bangers", "Oswald", sans-serif; color: var(--nick-fill); text-shadow: 0 3px 0 var(--nick-stroke), 0 0 14px rgba(255, 170, 30, .6); }
.prize-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.prize-body h3 { margin: 0; font: 700 20px/1.15 "Oswald", sans-serif; }
.prize-body p { margin: 0; color: var(--muted); font-size: 14px; }
.prize-meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; padding-top: 6px; }
.prize-cost { font: 700 22px/1 "Oswald", sans-serif; color: var(--nick-fill); }
.prize-left { font-size: 13px; color: var(--muted); }
.prize-card .btn { width: 100%; margin-top: 8px; }
.prize-tag { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px; font: 700 13px/1.3 "Oswald", sans-serif; background: #8be3a5; color: #0b2a14; }

.prize-dialog {
  width: min(92vw, 460px); padding: 22px; border: 0; border-radius: 22px; text-align: center; color: var(--snow);
  background: linear-gradient(180deg, #1c2160, #0a0c28);
  box-shadow: 0 0 0 2px #ffcf4a, 0 0 30px rgba(255, 170, 40, .5), 0 20px 60px rgba(0, 0, 0, .7);
}
.prize-dialog::backdrop { background: rgba(3, 6, 20, .8); }
.prize-dialog h2 { margin: 0 0 8px; font: 700 26px/1.15 "Oswald", sans-serif; color: var(--nick-fill); }
.prize-dialog .row { justify-content: center; margin-top: 16px; }
.prize-dialog .btn { width: auto; }
.drum {
  width: 180px; height: 180px; margin: 6px auto 14px; border-radius: 50%; position: relative;
  background: conic-gradient(#ff5a5a 0 45deg, #ffe066 0 90deg, #6be0ff 0 135deg, #a98bff 0 180deg,
                             #ff5a5a 0 225deg, #ffe066 0 270deg, #6be0ff 0 315deg, #a98bff 0 360deg);
  box-shadow: 0 0 0 6px #ffcf4a, 0 0 0 10px #2a0d00, 0 0 30px rgba(255, 170, 40, .6);
}
.drum::after { content: ""; position: absolute; inset: 38%; border-radius: 50%; background: #2a0d00; box-shadow: 0 0 0 4px #ffcf4a; }
.drum.spin { animation: drum 2.2s cubic-bezier(.15, .7, .2, 1) both; }
@keyframes drum { from { transform: rotate(0); } to { transform: rotate(1800deg); } }
.studio { font: 700 clamp(30px, 8vw, 44px)/1 "Bangers", "Oswald", sans-serif; letter-spacing: .04em; color: var(--nick-fill); text-shadow: 0 3px 0 var(--nick-stroke), 0 0 18px rgba(255, 170, 30, .7); margin: 6px 0; animation: pop .6s ease-out both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } to { transform: scale(1); opacity: 1; } }
.won-img { width: 160px; height: 160px; object-fit: cover; border-radius: 18px; margin: 8px auto; display: block; box-shadow: 0 0 0 3px #ffcf4a; }
.mine-list { margin: 0; padding-left: 20px; }

body[data-theme="glass"] .first-hint { background: rgba(255, 255, 255, .8); color: #1a1f4a; box-shadow: 0 0 0 2px #8a7dff, 0 10px 30px rgba(60, 50, 160, .25); }
body[data-theme="glass"] .wallet-sum, body[data-theme="glass"] .prize-cost { color: #6a4dff; text-shadow: none; }
body[data-theme="glass"] .chip.on { background: #6a4dff; border-color: #6a4dff; color: #fff; }
body[data-theme="glass"] .prize-card { background: rgba(255, 255, 255, .45); color: #1a1f4a; box-shadow: 0 0 0 1px rgba(255, 255, 255, .9), 0 10px 30px rgba(60, 50, 160, .2); }
body[data-theme="glass"] .prize-dialog { background: rgba(245, 247, 255, .96); color: #1a1f4a; box-shadow: 0 0 0 2px #8a7dff, 0 20px 60px rgba(60, 50, 160, .35); }
body[data-theme="glass"] .prize-dialog h2 { color: #6a4dff; }
body[data-theme="calendar"] .prize-card { background: linear-gradient(180deg, #8c2430, #5f121c); }
@media (prefers-reduced-motion: reduce) { .drum.spin, .studio { animation: none; } }
@media (max-width: 480px) { .prize-img { aspect-ratio: 16 / 10; } .prize-grid { gap: 12px; } }

/* ---------- neon: the squad invite look ---------- */
body[data-theme="neon"] {
  --theme-bg:
    radial-gradient(900px 500px at 15% -10%, rgba(120, 60, 255, .35), transparent 70%),
    radial-gradient(900px 500px at 90% 0%, rgba(0, 170, 255, .25), transparent 70%),
    radial-gradient(1200px 520px at 50% -160px, rgba(246, 196, 69, .2), transparent 70%),
    linear-gradient(180deg, #0b1033 0%, #070a22 100%);
}
body[data-theme="neon"] .board {
  margin-top: 34px;
  background: linear-gradient(180deg, rgba(20, 24, 70, .85), rgba(8, 10, 34, .9));
  box-shadow:
    0 0 0 2px #ffcf4a, 0 0 0 5px rgba(255, 120, 40, .35), 0 0 18px 4px rgba(255, 170, 40, .55),
    0 0 0 9px rgba(80, 90, 255, .55), 0 0 40px 10px rgba(110, 80, 255, .4), var(--shadow);
}
body[data-theme="neon"] .garland {
  display: block; position: absolute; left: 14px; right: 14px; top: -18px; height: 24px; pointer-events: none;
  background:
    radial-gradient(circle at 12px 12px, #ffe680 0 5px, rgba(255, 200, 60, .5) 6px, transparent 11px) 0 0 / 34px 24px repeat-x;
  filter: drop-shadow(0 0 6px rgba(255, 190, 60, .9));
  animation: twinkle 1.6s steps(2) infinite;
}
@keyframes twinkle { 50% { opacity: .55; } }
body[data-theme="neon"] .mascot-snow,
body[data-theme="calendar"] .mascot-snow {
  display: block; position: absolute; width: 150px; left: -150px; bottom: -10px; pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .5));
}

/* ---------- calendar: a festive house front with shuttered windows ---------- */
body[data-theme="calendar"] {
  --theme-bg:
    radial-gradient(900px 480px at 50% -120px, rgba(255, 196, 90, .28), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .025) 0 14px, transparent 14px 28px),
    linear-gradient(180deg, #5a0f1c 0%, #2a0710 100%);
  --closed-fill: #7a1a24;
  --closed-line: rgba(255, 214, 120, .75);
  --shutter: #1f5a3a;
  --shutter-panel: #2b7a4f;
  --shutter-line: #ffd36e;
  --hole: #ffd27a;
}
body[data-theme="calendar"] .board {
  margin-top: 40px;
  border-radius: 10px;
  background: linear-gradient(180deg, #8c2430, #5f121c);
  box-shadow: 0 0 0 4px #ffd36e, 0 0 0 10px #4a0c14, 0 0 30px rgba(255, 196, 90, .35), var(--shadow);
}
body[data-theme="calendar"] .board::before {
  /* snow cap on the roof line */
  content: ""; position: absolute; left: -12px; right: -12px; top: -26px; height: 34px; z-index: 2; pointer-events: none;
  background:
    radial-gradient(22px 16px at 22px 26px, #fff 98%, transparent) 0 0 / 44px 34px repeat-x,
    linear-gradient(#fff, #f1f6ff);
  background-size: 44px 34px, 100% 14px;
  background-repeat: repeat-x, no-repeat;
  background-position: 0 6px, 0 0;
  border-radius: 14px 14px 0 0;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .25));
}
body[data-theme="calendar"] .garland {
  display: block; position: absolute; left: 10px; right: 10px; bottom: -14px; height: 20px; pointer-events: none;
  background:
    radial-gradient(circle at 10px 8px, #ff5a5a 0 5px, transparent 6px) 0 0 / 60px 20px repeat-x,
    radial-gradient(circle at 30px 12px, #ffe066 0 5px, transparent 6px) 0 0 / 60px 20px repeat-x,
    radial-gradient(circle at 50px 8px, #6be0ff 0 5px, transparent 6px) 0 0 / 60px 20px repeat-x;
  filter: drop-shadow(0 0 5px rgba(255, 230, 140, .9));
  animation: twinkle 1.2s steps(2) infinite;
}

/* ---------- glass: frosty liquid glass ---------- */
body[data-theme="glass"] {
  color-scheme: light;
  color: #1a1f4a;
  --theme-bg:
    radial-gradient(700px 500px at 10% 10%, rgba(160, 120, 255, .55), transparent 70%),
    radial-gradient(700px 500px at 90% 20%, rgba(90, 200, 255, .5), transparent 70%),
    radial-gradient(800px 600px at 50% 100%, rgba(255, 170, 220, .45), transparent 70%),
    linear-gradient(180deg, #dfe6ff 0%, #c9d3ff 100%);
  --closed-fill: rgba(255, 255, 255, .38);
  --closed-line: rgba(255, 255, 255, .95);
  --edge: rgba(255, 255, 255, .8);
  --shutter: rgba(255, 255, 255, .55);
  --shutter-panel: rgba(220, 230, 255, .7);
  --shutter-line: #8a7dff;
  --hole: #fff6c8;
  --muted: #4a5590;
  --snow: #1a1f4a;
}
html:has(body[data-theme="glass"]) { background: #cfd8ff; }
body[data-theme="glass"] .snowfall { opacity: .9; }
body[data-theme="glass"] .board,
body[data-theme="glass"] .panel,
body[data-theme="glass"] .video-dialog {
  background: rgba(255, 255, 255, .32);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 10px 40px rgba(60, 50, 160, .25);
  color: #1a1f4a;
}
body[data-theme="glass"] .board { margin-top: 18px; border-radius: 26px; }
body[data-theme="glass"] .panel h2 { color: #6a4dff; }
body[data-theme="glass"] .field { background: rgba(255, 255, 255, .6); color: #1a1f4a; border-color: rgba(255, 255, 255, .9); box-shadow: inset 0 2px 6px rgba(60, 50, 160, .12); }
body[data-theme="glass"] .btn-ghost { background: rgba(255, 255, 255, .55); color: #1a1f4a; }
body[data-theme="glass"] .btn-gold { background: linear-gradient(180deg, #7fe0ff, #6a6bff); color: #fff; }
body[data-theme="glass"] .nick { color: #6a4dff; }
body[data-theme="glass"] .rules, body[data-theme="glass"] .count { color: #39447a; }
body[data-theme="glass"] .rules h2 { color: #1a1f4a; }
body[data-theme="glass"] .banner { background: rgba(255, 255, 255, .45); border-color: rgba(255, 255, 255, .9); }
body[data-theme="glass"] .cd-tile { background: rgba(255, 255, 255, .5); border-color: rgba(255, 255, 255, .9); }
body[data-theme="glass"] .cd-tile b { color: #6a4dff; text-shadow: none; }
body[data-theme="glass"] .cd-label { color: #4b3cc4; }
body[data-theme="glass"] .msg.ok { color: #127a3a; }
body[data-theme="glass"] .msg.err { color: #b3261e; }
body[data-theme="glass"] .code-line code { color: #6a4dff; text-shadow: none; }
body[data-theme="glass"] .mascot-joy {
  display: block; position: absolute; width: 130px; right: -120px; bottom: -6px; pointer-events: none;
  filter: drop-shadow(0 8px 16px rgba(60, 50, 160, .35));
}
body[data-theme="glass"] .video-dialog .door {
  background: linear-gradient(135deg, rgba(255, 255, 255, .85), rgba(200, 210, 255, .75));
  border-color: rgba(255, 255, 255, .95);
}

/* Mascots only where there is room beside the board */
@media (max-width: 1150px) {
  body[data-theme="neon"] .mascot-snow, body[data-theme="calendar"] .mascot-snow {
    width: 70px; left: auto; right: 6px; top: -78px; bottom: auto;
  }
  body[data-theme="glass"] .mascot-joy { width: 64px; right: 6px; bottom: auto; top: -60px; }
}
@media (max-width: 480px) {
  body[data-theme="neon"] .mascot-snow, body[data-theme="calendar"] .mascot-snow { width: 52px; top: -60px; }
  .title { font-size: 24px; }
  .look-bar { font-size: 13px; padding: 6px 10px; gap: 6px 8px; }
  .look-bar b { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .snowfall, .garland { animation: none; }
  .shutter, .video-dialog .door { transition: none; }
}
