/*
 * The Christmas calendar (/xmas). Loaded by xmas.html only, so the festive
 * look stays on this page. Flat cartoon colours throughout: no glows, no
 * drop shadows. The nav item itself is in styles.css (it's on every page).
 */
body[data-page="xmas"] {
  --x-bg: #0b1220;
  --x-panel: #131c2e;
  --x-panel-2: #0e1626;
  --x-line: #25324d;
  --x-red: #d63d47;
  --x-red-d: #a02730;
  --x-green: #17704a;
  --x-green-d: #0f5235;
  --x-green-l: #3fca8b;
  --x-blue: #22407a;
  --x-blue-d: #172d58;
  --x-gold: #ffcf5a;
  --x-gold-d: #c9982f;
  --x-cream: #fff3d6;
  --x-ink: #0b1220;
  background: var(--x-bg);
}

/* Until the page knows the calendar is open to this visitor (see xmas.js) */
.xmas-wait body { visibility: hidden; }

/* Snow: behind the cards, in front of the page background */
.xmas-snow { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* Lights hanging from the top bar: a wire, and two sets of bulbs that take turns */
.xmas-lights {
  position: absolute;
  top: 66px;
  left: 0;
  right: 0;
  height: 40px;
  z-index: 4;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='40'%3E%3Cpath d='M0 2Q40 20 80 2T160 2' fill='none' stroke='%232d3a55' stroke-width='2.5'/%3E%3C/svg%3E") repeat-x 0 0 / 160px 40px;
}
.xmas-lights::before, .xmas-lights::after {
  content: "";
  position: absolute;
  inset: 0;
  animation: xmas-twinkle 2.4s steps(1, end) infinite;
}
.xmas-lights::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='40'%3E%3Crect x='17.5' y='8' width='5' height='5' rx='1.2' fill='%233d4a66'/%3E%3Cellipse cx='20' cy='20' rx='5' ry='7' fill='%23e8525c'/%3E%3Cellipse cx='18.3' cy='17.4' rx='1.3' ry='2' fill='%23fff' opacity='.55'/%3E%3Crect x='97.5' y='8' width='5' height='5' rx='1.2' fill='%233d4a66'/%3E%3Cellipse cx='100' cy='20' rx='5' ry='7' fill='%233fca8b'/%3E%3Cellipse cx='98.3' cy='17.4' rx='1.3' ry='2' fill='%23fff' opacity='.55'/%3E%3C/svg%3E") repeat-x 0 0 / 160px 40px;
}
.xmas-lights::after {
  animation-delay: -1.2s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='40'%3E%3Crect x='57.5' y='8' width='5' height='5' rx='1.2' fill='%233d4a66'/%3E%3Cellipse cx='60' cy='20' rx='5' ry='7' fill='%23ffcf5a'/%3E%3Cellipse cx='58.3' cy='17.4' rx='1.3' ry='2' fill='%23fff' opacity='.55'/%3E%3Crect x='137.5' y='8' width='5' height='5' rx='1.2' fill='%233d4a66'/%3E%3Cellipse cx='140' cy='20' rx='5' ry='7' fill='%2352b7fe'/%3E%3Cellipse cx='138.3' cy='17.4' rx='1.3' ry='2' fill='%23fff' opacity='.55'/%3E%3C/svg%3E") repeat-x 0 0 / 160px 40px;
}
/* On, then dimmed: bulbs switch, they don't fade */
@keyframes xmas-twinkle { 0% { opacity: 1; } 50% { opacity: .4; } }

/* Layout ----------------------------------------------------------- */
.xmas { position: relative; z-index: 1; padding: 70px 16px 120px; }
.xmas__wrap { width: 100%; max-width: 1129px; margin: 0 auto; }
.xmas h2 { margin: 0; }

.xmas-hero { text-align: center; }
.xmas-hero__title { margin: 0 auto; max-width: 560px; }
.xmas-hero__title img { width: 100%; height: auto; }
.xmas-hero__sub { max-width: 600px; margin: 14px auto 0; color: #b4bdd0; font-size: 17px; line-height: 1.5; text-wrap: pretty; }
.xmas-hero__sub b { color: var(--x-gold); }
.xmas-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }

.xmas-card, .xmas-stage {
  position: relative;
  border: 2px solid var(--x-line);
  border-radius: 22px;
  background: var(--x-panel);
}
.xmas-card { padding: 24px; }
.xmas-card__label { color: var(--x-gold); font-weight: 700; font-size: 13px; letter-spacing: 1.4px; }
.xmas-card__title { color: #f2f4f8; font-weight: 700; font-size: 19px; line-height: 1.3; }
.xmas-small { margin-top: 14px; color: #8f9bb3; font-size: 13px; line-height: 1.5; }
.xmas-small a { color: var(--accent); }

/* The gift box stage ------------------------------------------------ */
.xmas-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 36px;
  padding: 14px 36px 14px 8px;
  overflow: hidden;
}
.xmas-stage::before {
  /* Candy-cane edge */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 8px;
  background: repeating-linear-gradient(-45deg, var(--x-red) 0 14px, var(--x-cream) 14px 28px);
}
.giftbox { position: relative; height: 470px; }
.giftbox__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.giftbox__poster { position: absolute; left: 50%; top: 52%; width: min(78%, 400px); height: auto; translate: -50% -50%; }
/* Once the 3D box has loaded it takes the picture's place */
.giftbox.is-3d .giftbox__poster { visibility: hidden; }
.giftbox:not(.is-3d) .giftbox__canvas { visibility: hidden; }
.giftbox__prize {
  position: absolute;
  left: 0;
  right: 0;
  top: 7%;
  color: var(--x-cream);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .4px;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
}
.giftbox__prize b {
  display: block;
  color: var(--x-gold);
  font-family: var(--display);
  font-weight: 800;
  font-size: 96px;
  line-height: .95;
  -webkit-text-stroke: 6px var(--x-ink);
  paint-order: stroke fill;
}
.giftbox[data-state="open"] .giftbox__prize { opacity: 1; }
.giftbox.is-fresh[data-state="open"] .giftbox__prize { animation: giftbox-prize-in .6s cubic-bezier(.2, .9, .3, 1.3) .42s both; }
@keyframes giftbox-prize-in {
  0% { opacity: 0; transform: translateY(120px) scale(.3); }
  100% { opacity: 1; transform: none; }
}

.xmas-stage__title { margin-top: 8px !important; color: #fff; font-family: var(--display); font-weight: 800; font-size: clamp(28px, 3.2vw, 40px); line-height: 1.05; }
.xmas-stage__sub { margin-top: 10px; color: #b4bdd0; font-size: 16px; line-height: 1.5; }
.xmas-box__steps { margin-top: 20px; }
.xmas-box__note { margin-bottom: 14px; color: #b4bdd0; font-size: 16px; line-height: 1.5; }
.xmas-box__note b { color: #fff; font-variant-numeric: tabular-nums; }

/* Chunky cartoon button: a flat face on a darker base, pressed down on click */
.xmas-btn {
  width: 100%;
  height: 50px;
  border-radius: 14px;
  border-bottom: 5px solid var(--x-red-d);
  background: var(--x-red);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .5px;
}
.xmas-btn--inline { width: auto; padding: 0 24px; margin-top: 14px; }
.xmas-btn:disabled { border-bottom-color: #2a364f; background: #33405c; color: #9aa6bf; cursor: not-allowed; }
.xmas-btn:focus-visible, .xstep__btn:focus-visible, .xday__open:focus-visible { outline: 3px solid var(--x-gold); outline-offset: 2px; }

.xsteps { display: grid; gap: 8px; margin-bottom: 16px; list-style: none; }
.xstep { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 8px 6px 12px; border: 2px solid var(--x-line); border-radius: 12px; background: var(--x-panel-2); }
.xstep__mark { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border: 2px solid #4a587a; border-radius: 50%; color: var(--x-ink); }
.xstep.is-done .xstep__mark { border-color: var(--x-green-l); background: var(--x-green-l); }
.xstep__text { flex: 1; min-width: 0; color: #d5dbe8; font-size: 15px; line-height: 1.3; }
.xstep__text b { color: #fff; }
.xstep.is-done .xstep__text { color: #8f9bb3; }
.xstep__btn {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 9px;
  border-bottom: 3px solid var(--x-gold-d);
  background: var(--x-gold);
  color: var(--x-ink);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .4px;
}

/* Today's prize + my tickets ---------------------------------------- */
.xmas-today { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; }
.xmas-mine[hidden] { display: none; }

.xmas-prize { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 16px; align-content: start; }
.xmas-prize__name { margin-top: 12px !important; color: #fff; font-family: var(--display); font-weight: 800; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.08; text-wrap: balance; }
.xmas-prize__value { margin-top: 8px; color: var(--x-gold); font-weight: 700; font-size: 17px; }
.xmas-prize__last { display: block; margin-top: 10px; padding: 0; color: #b4bdd0; font-size: 14px; text-align: left; cursor: pointer; }
.xmas-prize__last b { color: var(--x-green-l); }
.xmas-prize__last:hover { color: #fff; }
.xmas-prize__last[hidden] { display: none; }
.xmas-prize__img { align-self: center; width: 150px; height: 150px; object-fit: contain; }
.xmas-prize__timer { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; }
.xmas-prize__timer-label { color: #8f9bb3; font-weight: 600; font-size: 12px; letter-spacing: 1.2px; }
.xmas-prize__timer-value { color: #fff; font-weight: 700; font-size: clamp(24px, 2.8vw, 32px); line-height: 1.1; font-variant-numeric: tabular-nums; }
.xmas-prize__stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0 0; }
.xmas-prize__stats div { padding: 10px 12px; border: 2px solid var(--x-line); border-radius: 12px; background: var(--x-panel-2); }
.xmas-prize__stats dt { color: #8f9bb3; font-size: 13px; }
.xmas-prize__stats dd { margin: 3px 0 0; color: #fff; font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }

.xmas-mine__note { margin-top: 10px; color: #b4bdd0; font-size: 15px; line-height: 1.5; }
.xmas-mine__note b { color: #fff; }
.xmas-mine__row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 22px; margin-top: 16px; }
.xmas-mine__total { display: flex; flex-direction: column; align-items: center; min-width: 132px; padding: 14px 16px; border-radius: 16px; border-bottom: 5px solid var(--x-gold-d); background: var(--x-gold); color: var(--x-ink); }
.xmas-mine__total b { font-family: var(--display); font-weight: 800; font-size: 50px; line-height: 1; font-variant-numeric: tabular-nums; }
.xmas-mine__total span { margin-top: 4px; font-weight: 600; font-size: 13px; }
.xbar__head { display: flex; justify-content: space-between; align-items: baseline; color: #d5dbe8; font-size: 15px; }
.xbar__head b { color: #fff; font-variant-numeric: tabular-nums; }
.xbar__track { height: 16px; margin-top: 8px; border: 2px solid var(--x-line); border-radius: 999px; background: var(--x-panel-2); overflow: hidden; }
.xbar__track span { display: block; height: 100%; min-width: 0; border-radius: 999px; background: repeating-linear-gradient(-45deg, var(--x-red) 0 10px, #e8646d 10px 20px); transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.xbar__note { margin-top: 8px; color: #8f9bb3; font-size: 13px; line-height: 1.45; }
.xbar__note b { color: #d5dbe8; }
.xmas-mine__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.xmas-mine__chips li { padding: 5px 12px; border: 2px solid var(--x-line); border-radius: 999px; background: var(--x-panel-2); color: #b4bdd0; font-size: 13px; }
.xmas-mine__chips b { color: #fff; }
.xmas-win { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--x-green); color: #e9fff4; font-size: 15px; line-height: 1.4; }
.xmas-win b { color: #fff; }

/* The calendar: 24 doors -------------------------------------------- */
.xmas-section { margin-top: 56px; }
.xmas-section__title { color: #fff; font-family: var(--display); font-weight: 800; font-size: 32px; line-height: 1.1; letter-spacing: .4px; }
.xmas-section__sub { margin-top: 8px; color: #b4bdd0; font-size: 15px; line-height: 1.5; }
.xmas-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-top: 22px; list-style: none; }
.xday { --door: var(--x-red); --door-d: var(--x-red-d); }
.xday:nth-child(3n + 2) { --door: var(--x-green); --door-d: var(--x-green-d); }
.xday:nth-child(3n) { --door: var(--x-blue); --door-d: var(--x-blue-d); }
.xday__open {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: 214px;
  padding: 12px 12px 14px;
  border-radius: 18px;
  border-bottom: 6px solid var(--door-d);
  background: var(--door);
  color: var(--x-cream);
  text-align: center;
}
/* The stitched edge of a calendar door */
.xday__open::before { content: ""; position: absolute; inset: 6px 6px 4px; border: 2px dashed rgba(255, 243, 214, .32); border-radius: 13px; pointer-events: none; }
button.xday__open { cursor: pointer; transition: filter .2s ease, translate .15s ease; }
@media (hover: hover) and (pointer: fine) { button.xday__open:hover { filter: brightness(.94); } }
button.xday__open:active { translate: 0 2px; }
.xday__num { align-self: flex-start; padding-left: 4px; font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; }
.xday__month { position: absolute; right: 16px; top: 18px; font-weight: 700; font-size: 12px; letter-spacing: 1.2px; opacity: .8; }
.xday__img { width: 76px; height: 76px; margin-top: 2px; object-fit: contain; }
.xday__prize { margin-top: 6px; font-weight: 600; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.xday__value { margin-top: 6px; padding: 2px 10px; border-radius: 999px; background: var(--x-cream); color: var(--x-ink); font-weight: 700; font-size: 13px; }
.xday__state { margin-top: auto; padding-top: 8px; font-size: 12px; line-height: 1.3; opacity: .85; }
.xday__state b { font-weight: 700; }
.xday__state--live { padding: 3px 10px; margin-top: 8px; border-radius: 999px; background: var(--x-gold); color: var(--x-ink); font-weight: 800; letter-spacing: .8px; opacity: 1; }
/* Today: a gold frame */
.xday--live .xday__open { outline: 4px solid var(--x-gold); outline-offset: 0; }
/* Finished days: the door is open, paper behind it */
.xday--drawn .xday__open, .xday--closed .xday__open { border-bottom-color: #d9c79c; background: var(--x-cream); color: var(--x-ink); }
.xday--drawn .xday__open::before, .xday--closed .xday__open::before { border-color: rgba(11, 18, 32, .2); }
.xday--drawn .xday__num, .xday--closed .xday__num { color: var(--x-red); }
.xday--drawn .xday__value, .xday--closed .xday__value { background: var(--x-ink); color: var(--x-cream); }
.xday--drawn .xday__state { color: var(--x-green-d); opacity: 1; }

/* Dialogs: rules, top tickets, a finished day ----------------------- */
.dialog--xmas { width: min(520px, calc(100vw - 32px)); }
.xmas-how { display: grid; gap: 12px; margin: 0; padding-left: 22px; color: #b4bdd0; font-size: 15px; line-height: 1.5; }
.xmas-how b { color: #fff; }
.xmas-how li::marker { color: var(--x-gold); font-weight: 700; }
.xmas-top { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.xmas-top li { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 10px; background: #0d1015; color: #d5dbe8; font-size: 15px; }
.xmas-top__place { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 6px; background: var(--panel); color: #dfe4ee; font-weight: 700; font-size: 13px; }
.xmas-top li:nth-child(1) .xmas-top__place { background: var(--x-gold); color: var(--x-ink); }
.xmas-top__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-weight: 600; }
.xmas-top__tickets { color: #8f9bb3; font-size: 13px; white-space: nowrap; }
.xmas-top__tickets b { color: #fff; font-size: 15px; font-variant-numeric: tabular-nums; }
.xmas-top .xmas-top__empty { justify-content: center; min-height: 64px; color: #8f9bb3; text-align: center; }
.xmas-winners { display: grid; gap: 6px; max-height: 60vh; margin: 0; padding: 0; overflow: auto; list-style: none; }
.xmas-winners__row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 12px 6px 6px; border-radius: 12px; background: #0d1015; text-align: left; cursor: pointer; }
.xmas-winners__row:hover { background: #18202e; }
.xmas-winners__row:focus-visible { outline: 2px solid var(--x-gold); outline-offset: 1px; }
.xmas-winners__row img { flex: none; width: 48px; height: 48px; object-fit: contain; }
.xmas-winners__text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.xmas-winners__day { color: #8f9bb3; font-size: 12px; letter-spacing: .4px; }
.xmas-winners__prize { overflow: hidden; color: #fff; font-weight: 600; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.xmas-winners__name { flex: none; color: var(--x-green-l); font-weight: 700; font-size: 14px; }
.xmas-day__line { color: #8f9bb3; }
.xmas-day__winner { padding: 12px 14px; border-radius: 10px; background: var(--x-green); color: #e9fff4; }
.xmas-hash { display: grid; gap: 4px; }
.xmas-hash span { color: #8f9bb3; font-size: 13px; }
.xmas-hash code { padding: 8px 10px; border-radius: 8px; background: #0d1015; color: #c9d0de; font-size: 12px; line-height: 1.4; word-break: break-all; }
.xmas-verify { padding: 0 16px; margin-top: 4px; }
.xmas-verify__out { margin-top: 10px !important; font-size: 14px; }
.xmas-verify__out.is-ok { color: var(--x-green-l); }
.xmas-verify__out.is-bad { color: #ff8b92; }
.xmas-day__entries { margin-top: 12px; }
.xmas-day__entries summary { color: #c9d0de; cursor: pointer; }
.xmas-day__entries ol { max-height: 220px; margin-top: 8px; padding: 0; overflow: auto; list-style: none; }
.xmas-day__entries li { display: flex; justify-content: space-between; padding: 5px 2px; border-bottom: 1px solid var(--x-line); font-size: 14px; }

/* Smaller screens ---------------------------------------------------- */
@media (max-width: 1100px) {
  .xmas-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .xmas-stage { grid-template-columns: minmax(0, 1fr); padding: 14px 20px 22px; }
  .giftbox { height: 360px; }
  .xmas-stage__side { text-align: center; }
  .xstep { text-align: left; }
  .xmas-today { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .xmas { padding: 60px 16px 88px; }
  .xmas-card { padding: 18px; }
  .xmas-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .xmas-mine__row { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .xmas-mine__total { flex-direction: row; justify-content: center; align-items: baseline; gap: 10px; }
  .xmas-section { margin-top: 40px; }
  .xmas-hero__sub { font-size: 16px; }
  .giftbox { height: 320px; }
  .giftbox__prize b { font-size: 76px; }
}
@media (max-width: 520px) {
  .xmas-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xmas-prize__img { width: 104px; height: 104px; }
  .xmas-prize__stats { grid-template-columns: repeat(2, 1fr); }
  .xmas-prize__stats div:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .xmas-lights::before, .xmas-lights::after, .giftbox__prize { animation: none !important; }
  .xbar__track span { transition: none; }
}
