/* ===== Genesis Digital Advent Calendar ===== */

:root {
  --brand-red: #D30C19;
  --brand-red-dark: #a3080f;
  --brand-dark: #222223;
  --brand-white: #ffffff;
  --door-size: clamp(130px, 11vw, 190px);
  --grid-gap: 16px;
  --grid-columns: 6;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, #34343a 0%, var(--brand-dark) 60%);
  color: var(--brand-white);
  font-family: "Segoe UI", Verdana, Arial, sans-serif;
  overflow-x: hidden;
}

/* ---------- Snow ---------- */
.snow-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -10px;
  color: var(--brand-white);
  opacity: 0.85;
  user-select: none;
  animation: snowFall linear infinite;
}

/* Fall + sway combined into a single transform-only animation so it stays
   on the GPU compositor instead of triggering layout/paint every frame. */
@keyframes snowFall {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(var(--sway, 20px), 27vh, 0); }
  50%  { transform: translate3d(0, 55vh, 0); }
  75%  { transform: translate3d(calc(var(--sway, 20px) * -1), 82vh, 0); }
  100% { transform: translate3d(0, 110vh, 0); }
}

/* ---------- Festive scene (reveals more as Christmas approaches) ---------- */
body.festive-4 {
  background: radial-gradient(circle at top, #3a1013 0%, var(--brand-dark) 70%);
}

.scene-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.scene-tree {
  position: absolute;
  bottom: -6px;
  left: 2%;
  font-size: clamp(50px, 8vw, 90px);
  opacity: 0;
  transition: opacity 0.8s ease;
}

body.festive-1 .scene-tree,
body.festive-2 .scene-tree,
body.festive-3 .scene-tree,
body.festive-4 .scene-tree {
  opacity: 1;
}

.scene-presents {
  position: absolute;
  bottom: 0;
  left: calc(2% + 56px);
  display: flex;
  gap: 2px;
  font-size: clamp(22px, 4vw, 36px);
  opacity: 0;
  transition: opacity 0.8s ease;
}

body.festive-2 .scene-presents,
body.festive-3 .scene-presents,
body.festive-4 .scene-presents {
  opacity: 1;
}

.scene-presents span:nth-child(n+4) {
  display: none;
}

body.festive-3 .scene-presents span,
body.festive-4 .scene-presents span {
  display: inline-block;
}

.scene-sleigh {
  position: absolute;
  top: 10%;
  left: -15%;
  font-size: clamp(28px, 4vw, 44px);
  opacity: 0;
  transform: scaleX(-1);
}

body.festive-3 .scene-sleigh,
body.festive-4 .scene-sleigh {
  opacity: 1;
  animation: sleighFly 16s linear infinite;
}

@keyframes sleighFly {
  0% { transform: scaleX(-1) translateX(0) translateY(0); }
  50% { transform: scaleX(-1) translateX(65vw) translateY(-30px); }
  100% { transform: scaleX(-1) translateX(135vw) translateY(0); }
}

/* ---------- Cat sleigh easter egg ---------- */
.cat-sleigh {
  position: absolute;
  top: 15%;
  left: 0;
  width: clamp(90px, 10vw, 150px);
  opacity: 0;
  pointer-events: none;
}

.cat-sleigh img {
  display: block;
  width: 100%;
  height: auto;
}

.cat-sleigh.fly-right {
  animation: catSleighMoveRight 14s linear forwards;
}

.cat-sleigh.fly-left {
  animation: catSleighMoveLeft 14s linear forwards;
}

.cat-sleigh.fly-right img {
  animation: catSleighBob 2.8s ease-in-out infinite;
}

.cat-sleigh.fly-left img {
  animation: catSleighBobFlipped 2.8s ease-in-out infinite;
}

@keyframes catSleighMoveRight {
  0% { transform: translateX(-25vw); opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { transform: translateX(125vw); opacity: 0; }
}

@keyframes catSleighMoveLeft {
  0% { transform: translateX(125vw); opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { transform: translateX(-25vw); opacity: 0; }
}

@keyframes catSleighBob {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-35px) rotate(5deg); }
}

@keyframes catSleighBobFlipped {
  0%, 100% { transform: scaleX(-1) translateY(0) rotate(5deg); }
  50% { transform: scaleX(-1) translateY(-35px) rotate(-5deg); }
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px 16px 10px;
}

.site-header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.logo {
  height: 60px;
  display: inline-block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

.site-title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.site-title span {
  color: var(--brand-red);
}

.site-subtitle {
  margin: 0 0 10px;
  color: #cfcfd1;
  font-size: 0.95rem;
}

.date-banner {
  margin: 0 0 18px;
  color: var(--brand-white);
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.9;
}

.header-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hint-btn,
.open-all-btn,
.time-machine-btn {
  border: none;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hint-btn {
  background: var(--brand-red);
  color: var(--brand-white);
  box-shadow: 0 4px 12px rgba(211, 12, 25, 0.45);
}

.hint-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(211, 12, 25, 0.6);
}

.open-all-btn {
  background: transparent;
  color: var(--brand-white);
  border: 2px solid var(--brand-white);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.open-all-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
}

.time-machine-btn {
  display: none;
  background: #f4c542;
  color: var(--brand-dark);
  box-shadow: 0 4px 12px rgba(244, 197, 66, 0.45);
}

.time-machine-btn.show {
  display: inline-block;
}

.time-machine-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(244, 197, 66, 0.6);
}

.hint-btn:active,
.open-all-btn:active,
.time-machine-btn:active {
  transform: translateY(0);
}

.open-all-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.open-all-btn:disabled:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.05);
}

.hint-icon { margin-right: 4px; }

/* ---------- Calendar grid ---------- */
/* Fixed 6x4 layout on desktop, reflowing to 4x6 / 3x8 below via media queries */
.calendar-grid {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: calc(var(--grid-columns) * var(--door-size) + (var(--grid-columns) - 1) * var(--grid-gap) + 40px);
  margin: 10px auto 14px;
  padding: 10px 20px;
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  gap: var(--grid-gap);
}

.door-cell {
  perspective: 1000px;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.door-cell.locked .door-face {
  cursor: not-allowed;
}

.door-cell.unlocked .door-face {
  cursor: pointer;
}

.door-flip {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.7s cubic-bezier(.4,.2,.2,1);
  transform-style: preserve-3d;
}

.door-cell.open .door-flip {
  transform: rotateY(-180deg);
}

.door-face,
.door-back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.door-face {
  background: linear-gradient(145deg, var(--brand-red) 0%, var(--brand-red-dark) 100%);
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 0 0 2px rgba(255,255,255,0.05);
}

.door-number {
  position: absolute;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--brand-white);
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.door-number.corner-top-left { top: 6px; left: 8px; }
.door-number.corner-top-right { top: 6px; right: 8px; }
.door-number.corner-bottom-left { bottom: 6px; left: 8px; }
.door-number.corner-bottom-right { bottom: 6px; right: 8px; }

.door-icon {
  font-size: 1.6rem;
  opacity: 0.85;
}

.door-back {
  transform: rotateY(180deg);
  background: var(--brand-dark);
  border: 2px solid var(--brand-white);
}

.door-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.door-placeholder {
  font-size: 2rem;
  opacity: 0.6;
}

.door-back-number {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 1.5em;
  padding: 1px 6px;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
  color: var(--brand-white);
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
  z-index: 1;
  pointer-events: none;
}

.door-cell.open .door-back {
  cursor: pointer;
}

.door-cell.open .door-back:hover img {
  transform: scale(1.08);
  filter: brightness(0.75);
}

.door-back .door-back-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-white);
  font-size: 1.6rem;
  opacity: 0;
  background: rgba(0,0,0,0.25);
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.door-cell.open .door-back:hover .door-back-hint {
  opacity: 1;
}

.door-cell.locked .door-face {
  filter: grayscale(0.15) brightness(0.92);
}

/* today highlight */
.door-cell.today .door-face {
  box-shadow: 0 0 0 3px var(--brand-white), 0 4px 14px rgba(0,0,0,0.4);
}

.door-cell.hint-pulse .door-face {
  animation: hintPulse 1s ease-in-out 4;
}

@keyframes hintPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.9), 0 4px 10px rgba(0,0,0,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(255,255,255,0), 0 4px 10px rgba(0,0,0,0.4); }
}

/* shake for no peeking */
.door-cell.shake .door-flip {
  animation: shake 0.5s;
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

/* ---------- No peeking overlay ---------- */
.no-peek-overlay {
  position: fixed;
  inset: 0;
  background: rgba(211, 12, 25, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.no-peek-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.no-peek-box {
  text-align: center;
  animation: popIn 0.35s ease;
}

.no-peek-eyes {
  font-size: 4rem;
  animation: shakeBig 0.6s ease;
}

.no-peek-text {
  font-size: 2rem;
  font-weight: 800;
  margin: 8px 0 2px;
}

.no-peek-sub {
  font-size: 1rem;
  opacity: 0.9;
}

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes shakeBig {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.lightbox.show {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-card {
  position: relative;
  background: var(--brand-dark);
  border: 2px solid var(--brand-red);
  border-radius: var(--radius);
  padding: 6px 24px;
  max-width: min(92vw, 640px);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  text-align: center;
  animation: popIn 0.3s ease;
  touch-action: pan-y;
  transition: max-width 0.25s ease;
}

/* Widened variant for days with a landscape still/video (see LANDSCAPE_DAYS in script.js) */
.lightbox-card.is-landscape {
  max-width: min(96vw, 820px);
}

.lightbox-day {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--brand-white);
  margin: 0 0 10px;
  font-size: 1.5rem;
  line-height: 1.1;
}

.lightbox-media {
  position: relative;
  flex: 0 0 auto;
  width: min(52vh, 420px, 100%);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}

/* Landscape media keeps the same height as the square box, but widens to fit a 16:9 clip
   instead of cropping it to a square — width is the driven dimension so the aspect-ratio
   always holds, and it only falls short of that height on screens too narrow to fit it. */
.lightbox-media.is-landscape {
  width: min(94vw, calc(52vh * 16 / 9), calc(420px * 16 / 9));
  max-width: 100%;
  aspect-ratio: 16 / 9;
}

.lightbox-media img,
.lightbox-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.lightbox-media video { display: none; }

.lightbox-media.has-video[data-video-state="playing"] img,
.lightbox-media.has-video[data-video-state="ended"] img,
.dance-special.has-video[data-video-state="playing"] img,
.dance-special.has-video[data-video-state="ended"] img {
  display: none;
}

.lightbox-media.has-video[data-video-state="playing"] video,
.lightbox-media.has-video[data-video-state="ended"] video,
.dance-special.has-video[data-video-state="playing"] video,
.dance-special.has-video[data-video-state="ended"] video {
  display: block;
}

.lightbox-play-btn,
.lightbox-replay-btn {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(34, 34, 35, 0.72);
  color: var(--brand-white);
  border: 2px solid var(--brand-white);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.lightbox-play-btn {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  padding: 0 0 0 4px;
}

.lightbox-replay-btn {
  width: auto;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.lightbox-play-btn:hover,
.lightbox-replay-btn:hover {
  background: var(--brand-red);
  transform: translate(-50%, -50%) scale(1.06);
}

.lightbox-media.has-video[data-video-state="idle"] .lightbox-play-btn,
.dance-special.has-video[data-video-state="idle"] .lightbox-play-btn {
  display: flex;
}

.lightbox-media.has-video[data-video-state="ended"] .lightbox-replay-btn,
.dance-special.has-video[data-video-state="ended"] .lightbox-replay-btn {
  display: flex;
}

.lightbox-video-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--brand-white);
  border-radius: 50%;
  animation: lightboxSpin 0.8s linear infinite;
}

.lightbox-media.has-video[data-video-state="loading"] .lightbox-video-spinner,
.dance-special.has-video[data-video-state="loading"] .lightbox-video-spinner {
  display: block;
}

@keyframes lightboxSpin {
  to { transform: rotate(360deg); }
}

.lightbox-loop-btn {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-white);
  background: rgba(34, 34, 35, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  cursor: pointer;
  z-index: 1;
}

.lightbox-loop-btn.active {
  background: var(--brand-red);
  border-color: var(--brand-white);
}

.lightbox-media.has-video[data-video-state="playing"] .lightbox-loop-btn,
.lightbox-media.has-video[data-video-state="ended"] .lightbox-loop-btn,
.dance-special.has-video[data-video-state="playing"] .lightbox-loop-btn,
.dance-special.has-video[data-video-state="ended"] .lightbox-loop-btn {
  display: flex;
}

.lightbox-key-hint {
  display: none;
  flex: 0 0 auto;
  margin: 10px 0 0;
  color: #8f8f92;
  font-size: 0.8rem;
}

@media (min-width: 700px) {
  .lightbox-card {
    max-width: min(80vw, 760px);
    max-height: 92vh;
    padding: 6px 40px;
  }

  .lightbox-card.is-landscape {
    max-width: min(92vw, 1200px);
  }

  .lightbox-media {
    width: min(70vh, 620px);
  }

  .lightbox-media.is-landscape {
    width: min(90vw, calc(70vh * 16 / 9), calc(620px * 16 / 9));
  }

  .lightbox-day {
    font-size: 1.7rem;
  }

  .lightbox-title {
    font-size: 1.7rem;
  }

  .lightbox-message {
    font-size: 1.1rem;
  }

  .lightbox-key-hint {
    display: block;
  }
}

@keyframes lightboxSlideInRight {
  from { transform: translateX(32px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes lightboxSlideInLeft {
  from { transform: translateX(-32px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.lightbox-card.slide-in-right {
  animation: lightboxSlideInRight 0.28s ease;
}

.lightbox-card.slide-in-left {
  animation: lightboxSlideInLeft 0.28s ease;
}

.lightbox-title {
  flex: 0 0 auto;
  margin: 16px 0 6px;
  font-size: 1.4rem;
  color: var(--brand-white);
}

.lightbox-message {
  flex: 0 0 auto;
  margin: 0 0 6px;
  color: #cfcfd1;
  font-size: 1rem;
  line-height: 1.4;
}

.lightbox-special {
  color: inherit;
  font: inherit;
}

.lightbox-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: var(--brand-white);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 61;
  background: var(--brand-red);
  color: var(--brand-white);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}

.lightbox-nav:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:disabled {
  background: rgba(255,255,255,0.15);
  cursor: not-allowed;
  opacity: 0.5;
}

.lightbox-prev { left: clamp(8px, 4vw, 32px); }
.lightbox-next { right: clamp(8px, 4vw, 32px); }

@media (max-width: 600px) {
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

/* pop emphasis when a door opens during the "open all" cascade */
.door-cell.just-opened .door-flip {
  animation: justOpened 0.6s ease;
}

@keyframes justOpened {
  0% { transform: rotateY(0deg) scale(1); }
  40% { transform: rotateY(-100deg) scale(1.12); }
  100% { transform: rotateY(-180deg) scale(1); }
}

/* ---------- Christmas mode ---------- */
.christmas-mode-btn {
  display: none;
  border: 2px solid var(--brand-white);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--brand-red);
  color: var(--brand-white);
  box-shadow: 0 4px 14px rgba(211, 12, 25, 0.55);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: hintPulse 2s ease-in-out infinite;
}

.christmas-mode-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(211, 12, 25, 0.7);
}

.christmas-mode-btn.show {
  display: inline-block;
}

.christmas-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: radial-gradient(circle at top, #3a1013 0%, var(--brand-dark) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow: hidden;
}

.christmas-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.christmas-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  width: 9px;
  height: 14px;
  opacity: 0.9;
  animation-name: confettiFall, confettiSpin;
  animation-timing-function: linear, linear;
  animation-iteration-count: infinite, infinite;
}

@keyframes confettiFall {
  to { transform: translateY(110vh); }
}

@keyframes confettiSpin {
  to { transform: rotate(360deg); }
}

.christmas-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1500px;
  width: 94vw;
  height: 94vh;
  max-height: 94vh;
  overflow: hidden;
  text-align: center;
  padding: clamp(8px, 1.5vh, 16px) 20px;
  animation: popIn 0.4s ease;
}

.christmas-title {
  flex: 0 0 auto;
  font-size: clamp(1.1rem, 2.8vh, 2.2rem);
  margin: 0 0 clamp(2px, 0.6vh, 6px);
  color: var(--brand-white);
}

.christmas-sub {
  flex: 0 0 auto;
  font-size: clamp(0.75rem, 1.6vh, 1.05rem);
  margin: 0 0 clamp(6px, 1.4vh, 14px);
  color: #e8c9cb;
}

.dance-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vw, 28px);
  width: 100%;
  margin: 0 auto clamp(6px, 1.4vh, 14px);
}

.dance-side {
  flex: 0 0 auto;
  width: clamp(64px, 9vw, 150px);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(6px, 1.2vh, 14px);
}

.dance-slot {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  opacity: 1;
  transition: opacity 1.2s ease;
  z-index: 1;
}

.dance-slot.fade { opacity: 0; }

.dance-slot-inner {
  width: 100%;
  height: 100%;
  background: var(--brand-white);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.dance-slot-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.dance-special {
  flex: 1 1 auto;
  height: 100%;
  min-width: 0;
  max-width: 100%;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: var(--brand-white);
  border-radius: var(--radius);
  box-shadow: 0 0 0 4px var(--brand-red), 0 8px 24px rgba(0,0,0,0.55);
  animation: specialGlow 2.6s ease-in-out infinite;
}

.dance-special img,
.dance-special video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

.dance-special video { display: none; }

@media (max-width: 860px) {
  .dance-side { display: none; }
  .dance-stage { gap: 0; }

  /* Narrow screens are width-constrained, so size the square image by width
     (capped at the stage's full height) instead of forcing it to 100% height,
     which would otherwise leave large empty bars above and below. */
  .dance-special {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: 100%;
  }

  .dance-special img,
  .dance-special video { height: 100%; }
}

@keyframes specialGlow {
  0%, 100% { box-shadow: 0 0 0 4px var(--brand-red), 0 8px 24px rgba(0,0,0,0.55), 0 0 16px 2px rgba(244,197,66,0.3); }
  50% { box-shadow: 0 0 0 4px var(--brand-red), 0 8px 24px rgba(0,0,0,0.55), 0 0 38px 12px rgba(244,197,66,0.7); }
}

@keyframes dance1 {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-7px) rotate(3deg); }
}

@keyframes dance2 {
  0%, 100% { transform: translateX(0) rotate(0deg) scale(1); }
  25% { transform: translateX(-3px) rotate(-4deg) scale(1.02); }
  75% { transform: translateX(3px) rotate(4deg) scale(0.98); }
}

@keyframes dance3 {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(-5deg) scale(1.03); }
}

.christmas-close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 2;
  background: none;
  border: none;
  color: var(--brand-white);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}

.christmas-dismiss-btn {
  display: block;
  flex: 0 0 auto;
  margin: clamp(10px, 2vh, 24px) auto 0;
  padding: clamp(10px, 1.8vh, 18px) clamp(32px, 6vw, 56px);
  border: 3px solid var(--brand-white);
  border-radius: 999px;
  background: var(--brand-red);
  color: var(--brand-white);
  font-size: clamp(1rem, 2.2vh, 1.4rem);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(211, 12, 25, 0.6);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.christmas-dismiss-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(211, 12, 25, 0.7);
}

.christmas-dismiss-btn:active {
  transform: translateY(0);
}

/* ---------- Santa's Time Machine ---------- */
.time-machine-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 65;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.time-machine-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.time-machine-card {
  position: relative;
  background: var(--brand-dark);
  border: 2px solid #f4c542;
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  max-width: min(92vw, 420px);
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  animation: popIn 0.3s ease;
}

.time-machine-title {
  margin: 0 0 10px;
  font-size: 1.4rem;
  color: #f4c542;
}

.time-machine-joke {
  margin: 0 0 18px;
  color: #cfcfd1;
  font-size: 0.9rem;
  line-height: 1.4;
}

.time-machine-slider-wrap {
  margin: 0 0 18px;
}

.time-machine-slider-wrap input[type="range"] {
  width: 100%;
  accent-color: #f4c542;
}

.time-machine-date-label {
  margin: 10px 0 0;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--brand-white);
}

.time-machine-confirm {
  width: 100%;
  padding: 12px 10px;
  font-size: 0.95rem;
}

.time-machine-divider {
  height: 1px;
  background: rgba(255,255,255,0.15);
  margin: 18px 0;
}

.time-machine-rewind-label {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: #cfcfd1;
}

.time-machine-rewind {
  width: 100%;
}

.time-machine-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: var(--brand-white);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.time-warp-effect {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: radial-gradient(circle, rgba(244,197,66,0.9) 0%, rgba(211,12,25,0.85) 55%, rgba(0,0,0,0.95) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.time-warp-effect.show {
  animation: timeWarpFlash 0.9s ease;
}

.time-warp-spinner {
  font-size: 5rem;
  animation: timeWarpSpin 0.9s linear;
}

@keyframes timeWarpFlash {
  0% { opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes timeWarpSpin {
  from { transform: rotate(0deg) scale(0.4); }
  50% { transform: rotate(360deg) scale(1.3); }
  to { transform: rotate(720deg) scale(1); }
}

/* ---------- Help popup ---------- */
.help-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 70;
  background: var(--brand-red);
  color: var(--brand-white);
  border: 2px solid var(--brand-white);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(211, 12, 25, 0.55);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.help-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(211, 12, 25, 0.7);
}

.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 85;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.help-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.help-card {
  position: relative;
  background: var(--brand-dark);
  border: 2px solid #f4c542;
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  width: min(92vw, 680px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
  animation: popIn 0.3s ease;
}

.help-title {
  flex-shrink: 0;
  margin: 0 0 14px;
  font-size: 1.4rem;
  color: #f4c542;
  text-align: center;
}

.help-content {
  overflow-y: auto;
  flex: 1 1 auto;
  color: #cfcfd1;
  font-size: 0.95rem;
  line-height: 1.5;
}

.help-content p {
  margin: 0 0 12px;
}

.help-content h3 {
  margin: 18px 0 8px;
  font-size: 1.05rem;
  color: var(--brand-white);
}

.help-content h3:first-child {
  margin-top: 0;
}

.help-img {
  display: block;
  width: 100%;
  border-radius: 8px;
  margin: 0 0 12px;
}

.help-img-row {
  display: flex;
  gap: 10px;
  margin: 0 0 12px;
}

.help-img-row .help-img {
  width: calc(50% - 5px);
  margin: 0;
}

.help-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: var(--brand-white);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

/* ---------- Early visit notice ---------- */
.early-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 86;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.early-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.early-card {
  position: relative;
  background: var(--brand-dark);
  border: 2px solid #f4c542;
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  width: min(92vw, 420px);
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  animation: popIn 0.3s ease;
}

.early-icon {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.early-title {
  margin: 0 0 10px;
  font-size: 1.4rem;
  color: #f4c542;
}

.early-message {
  margin: 0;
  color: #cfcfd1;
  font-size: 0.95rem;
  line-height: 1.5;
}

.early-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: var(--brand-white);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

/* ---------- Dev mode ---------- */
.dev-mode-toggle {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 70;
  background: var(--brand-dark);
  color: var(--brand-white);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dev-mode-toggle:hover {
  opacity: 1;
  transform: rotate(45deg);
}

.dev-panel {
  position: fixed;
  bottom: 68px;
  right: 16px;
  z-index: 70;
  background: var(--brand-dark);
  border: 1px solid var(--brand-red);
  border-radius: var(--radius);
  padding: 16px;
  width: 260px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  display: none;
}

.dev-panel.show { display: block; }

.dev-panel h2 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--brand-red);
}

.dev-panel-desc {
  font-size: 0.78rem;
  color: #cfcfd1;
  margin: 0 0 10px;
}

.dev-panel label {
  font-size: 0.8rem;
  display: block;
  margin-bottom: 4px;
}

.dev-panel input[type="date"] {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #fff;
  color: #222;
  margin-bottom: 10px;
}

.dev-panel-actions {
  display: flex;
  gap: 8px;
}

.dev-panel-quick-label {
  font-size: 0.78rem;
  color: #cfcfd1;
  margin: 12px 0 6px;
}

.dev-panel-quick-dates {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.dev-quick-date {
  flex: initial;
  padding: 6px 8px;
  font-size: 0.75rem;
}

.btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand-red);
  color: var(--brand-white);
}

.btn-ghost {
  background: transparent;
  color: var(--brand-white);
  border: 1px solid rgba(255,255,255,0.3);
}

.btn-danger {
  width: 100%;
  margin-top: 10px;
  background: transparent;
  color: var(--brand-red);
  border: 1px solid var(--brand-red);
}

.btn-danger:hover {
  background: var(--brand-red);
  color: var(--brand-white);
}

.dev-panel-status {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: #cfcfd1;
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 16px 20px;
  color: #8f8f92;
  font-size: 0.8rem;
}

.footer-ai-note {
  max-width: 640px;
  margin: 0 auto 16px;
  color: #8f8f92;
  font-size: 0.75rem;
  line-height: 1.5;
}

.social-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin: 0 0 10px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--brand-white);
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.social-link:hover,
.social-link:focus-visible {
  background: var(--brand-red);
  color: var(--brand-white);
  text-decoration: none;
  transform: translateY(-2px);
}

.footer-contact-line {
  margin: 0 0 6px;
}

.footer-contact-line a {
  color: var(--brand-white);
  font-weight: 600;
  text-decoration: none;
}

.footer-contact-line a:hover,
.footer-contact-line a:focus-visible {
  color: var(--brand-red);
  text-decoration: underline;
}

.footer-divider {
  margin: 0 8px;
  color: #5a5a5d;
}

.footer-legal-links {
  margin: 0 0 6px;
  font-size: 0.7rem;
}

.footer-legal-links a {
  color: #8f8f92;
  text-decoration: none;
}

.footer-legal-links a:hover,
.footer-legal-links a:focus-visible {
  color: var(--brand-red);
  text-decoration: underline;
}

/* ---------- Cookie consent banner ---------- */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(20, 20, 22, 0.97);
  border-top: 2px solid var(--brand-red);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  animation: cookieBannerSlideUp 0.35s ease;
}

.cookie-banner.show {
  display: flex;
}

@keyframes cookieBannerSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.cookie-banner-text {
  flex: 1 1 360px;
  max-width: 760px;
  margin: 0;
  color: var(--brand-white);
  font-size: 0.85rem;
  line-height: 1.5;
}

.cookie-banner-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
}

.cookie-decline-btn,
.cookie-accept-btn {
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cookie-decline-btn {
  background: transparent;
  color: var(--brand-white);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.cookie-decline-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.cookie-accept-btn {
  background: var(--brand-red);
  color: var(--brand-white);
  border: 2px solid var(--brand-white);
  box-shadow: 0 4px 14px rgba(211, 12, 25, 0.55);
}

.cookie-accept-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(211, 12, 25, 0.7);
}

@media (max-width: 600px) {
  .cookie-banner {
    justify-content: stretch;
    padding: 14px 16px;
  }

  .cookie-banner-actions {
    width: 100%;
  }

  .cookie-decline-btn,
  .cookie-accept-btn {
    flex: 1;
  }
}

@media (max-width: 900px) {
  :root { --grid-columns: 4; --door-size: 110px; }
}

@media (max-width: 600px) {
  :root { --grid-columns: 3; --door-size: 92px; --grid-gap: 10px; }
  .door-number { font-size: 1.4rem; }
  .calendar-grid { padding: 10px 12px; }
}

@media (max-width: 380px) {
  :root { --door-size: 80px; }
  .door-number { font-size: 1.2rem; }
}
