/* JustPack New Year Module — Light & Dark Theme Adaptive Styles */
#jpny-snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 995;
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  contain: strict;
  transition: opacity 0.35s ease;
}

.jpny-paused #jpny-snow-canvas,
.jpny-paused #jpny-garland,
.jpny-paused #jpny-top-lights,
.jpny-paused #jpny-santa,
.jpny-paused .jpny-logo-hat {
  display: none !important;
}

/* Top Mini Lights */
#jpny-top-lights {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  pointer-events: none;
  z-index: 996;
  overflow: hidden;
}

.jpny-top-wire {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  width: 100%;
  border-top: 1.5px solid rgba(34, 84, 61, 0.65);
}

.jpny-bulb {
  position: relative;
  width: 5px;
  height: 8px;
  border-radius: 50% 50% 55% 55%;
  margin-top: 1px;
  animation: jpnyTwinkle 2.2s infinite ease-in-out;
}

.jpny-bulb::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 1px;
  width: 3px;
  height: 2px;
  background: #2f3e46;
  border-radius: 1px;
}

.jpny-bulb--red { background: #ef4444; box-shadow: 0 2px 8px rgba(239, 68, 68, 0.85); animation-delay: 0s; }
.jpny-bulb--gold { background: #f59e0b; box-shadow: 0 2px 8px rgba(245, 158, 11, 0.85); animation-delay: 0.55s; }
.jpny-bulb--green { background: #22c55e; box-shadow: 0 2px 8px rgba(34, 197, 94, 0.85); animation-delay: 1.1s; }
.jpny-bulb--blue { background: #38bdf8; box-shadow: 0 2px 8px rgba(56, 189, 248, 0.85); animation-delay: 1.65s; }

/* Bottom Garland Strip — strictly below fixed docks (1007) */
#jpny-garland {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42px;
  pointer-events: none;
  z-index: 997;
  overflow: hidden;
  background-repeat: repeat-x;
  background-position: bottom center;
  background-size: auto 100%;
}

#jpny-garland.jpny-garland--compact { height: 34px; }
#jpny-garland.jpny-garland--normal { height: 42px; }
#jpny-garland.jpny-garland--tall { height: 52px; }

#jpny-garland.jpny-garland--classic {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 56' width='360' height='56'><defs><linearGradient id='g1' x1='0' y1='0' x2='0' y2='1'><stop offset='0%' stop-color='%231f6f3e'/><stop offset='100%' stop-color='%230b2e19'/></linearGradient><linearGradient id='g2' x1='0' y1='0' x2='0' y2='1'><stop offset='0%' stop-color='%232e8d51'/><stop offset='100%' stop-color='%2314532d'/></linearGradient></defs><path d='M0 56 L0 25 L10 17 L18 26 L30 14 L42 25 L54 15 L66 26 L78 13 L92 25 L105 16 L118 26 L132 14 L145 25 L158 17 L172 26 L186 13 L200 25 L214 16 L228 26 L242 14 L256 25 L270 16 L284 26 L298 13 L312 25 L326 16 L340 25 L352 17 L360 24 L360 56 Z' fill='url(%23g1)'/><path d='M-6 56 L8 29 L24 37 L44 23 L64 37 L86 22 L108 38 L132 24 L156 38 L181 23 L206 37 L231 22 L256 38 L280 24 L304 37 L330 23 L365 37 L365 56 Z' fill='url(%23g2)' opacity='0.88'/><rect x='54' y='28' width='22' height='22' rx='2' fill='%23dc2626'/><rect x='63' y='28' width='4' height='22' fill='%23fbbf24'/><rect x='54' y='36' width='22' height='4' fill='%23fbbf24'/><path d='M65 28 C60 22 57 25 65 28 C73 25 70 22 65 28 Z' fill='%23fbbf24'/><circle cx='120' cy='34' r='8.5' fill='%23e11d48'/><circle cx='117' cy='31' r='2.5' fill='%23fda4af' opacity='0.8'/><circle cx='194' cy='36' r='8.5' fill='%23f59e0b'/><circle cx='191' cy='33' r='2.5' fill='%23fef3c7' opacity='0.85'/><path d='M152 49 L152 33 C152 26 163 26 163 32' fill='none' stroke='%23ffffff' stroke-width='5' stroke-linecap='round'/><path d='M152 49 L152 33 C152 26 163 26 163 32' fill='none' stroke='%23dc2626' stroke-width='5' stroke-dasharray='4 4' stroke-linecap='round'/><rect x='250' y='30' width='24' height='20' rx='2' fill='%23f59e0b'/><rect x='260' y='30' width='4' height='20' fill='%23dc2626'/><rect x='250' y='38' width='24' height='4' fill='%23dc2626'/><circle cx='308' cy='35' r='8' fill='%23dc2626'/><circle cx='305' cy='32' r='2.2' fill='%23fecaca' opacity='0.85'/><circle cx='24' cy='38' r='3' fill='%23dc2626'/><circle cx='31' cy='41' r='3' fill='%23dc2626'/><circle cx='28' cy='34' r='2.8' fill='%23ef4444'/><circle cx='226' cy='39' r='3' fill='%23dc2626'/><circle cx='233' cy='42' r='2.8' fill='%23ef4444'/><circle cx='338' cy='39' r='7.5' fill='%23f59e0b'/><circle cx='335' cy='36' r='2' fill='%23fef3c7' opacity='0.85'/></svg>");
}

#jpny-garland.jpny-garland--frosted {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 56' width='320' height='56'><defs><linearGradient id='fg1' x1='0' y1='0' x2='0' y2='1'><stop offset='0%' stop-color='%232d6a4f'/><stop offset='100%' stop-color='%23102a1d'/></linearGradient></defs><path d='M0 56 L0 26 Q32 16 64 28 Q96 14 128 27 Q160 15 192 28 Q224 14 256 27 Q288 16 320 26 L320 56 Z' fill='url(%23fg1)'/><path d='M0 28 Q22 18 46 27 Q74 16 102 27 Q130 16 158 27 Q188 16 218 27 Q248 16 278 27 Q300 18 320 26' fill='none' stroke='%23e0f2fe' stroke-width='3.5' stroke-linecap='round' opacity='0.82'/><circle cx='44' cy='35' r='7' fill='%23bae6fd'/><circle cx='42' cy='33' r='2' fill='%23ffffff'/><circle cx='116' cy='37' r='7.5' fill='%23fbbf24'/><circle cx='114' cy='35' r='2' fill='%23fef9c3'/><circle cx='196' cy='35' r='7' fill='%23ef4444'/><circle cx='194' cy='33' r='2' fill='%23fee2e2'/><circle cx='274' cy='36' r='7.5' fill='%2338bdf8'/><circle cx='272' cy='34' r='2' fill='%23ffffff'/></svg>");
}

#jpny-garland.jpny-garland--minimal {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 48' width='240' height='48'><path d='M0 32 Q30 18 60 32 T120 32 T180 32 T240 32' fill='none' stroke='%23374151' stroke-width='2.2'/><circle cx='30' cy='23' r='5.5' fill='%23ef4444'/><circle cx='90' cy='23' r='5.5' fill='%23fbbf24'/><circle cx='150' cy='23' r='5.5' fill='%2322c55e'/><circle cx='210' cy='23' r='5.5' fill='%2338bdf8'/></svg>");
}

.jpny-garland-lights {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18px 20px, rgba(254, 240, 138, 0.95) 0, rgba(254, 240, 138, 0) 6px),
    radial-gradient(circle at 86px 26px, rgba(253, 224, 71, 0.9) 0, rgba(253, 224, 71, 0) 6px),
    radial-gradient(circle at 142px 18px, rgba(252, 165, 165, 0.9) 0, rgba(252, 165, 165, 0) 6px),
    radial-gradient(circle at 212px 24px, rgba(254, 240, 138, 0.95) 0, rgba(254, 240, 138, 0) 6px);
  background-size: 260px 100%;
  background-repeat: repeat-x;
  animation: jpnyTwinkle 2.8s infinite ease-in-out;
}

/* Santa Widget */
#jpny-santa {
  position: fixed;
  bottom: 4px;
  z-index: 999;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

#jpny-santa.jpny-pos-left { left: 16px; flex-direction: row; }
#jpny-santa.jpny-pos-right { right: 16px; bottom: 84px; flex-direction: row-reverse; }
#jpny-santa.jpny-is-hidden { display: none !important; }

.jpny-santa-figure {
  position: relative;
  pointer-events: auto;
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
  width: 96px;
  height: 112px;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.22));
  transition: transform 0.25s ease;
}

.jpny-santa-figure.jpny-santa--mini {
  width: 80px;
  height: 88px;
}

.jpny-santa-figure:hover {
  transform: translateY(-4px) scale(1.03);
}

.jpny-santa-figure svg {
  width: 100%;
  height: 100%;
  display: block;
}

.jpny-santa-arm {
  transform-box: fill-box;
  transform-origin: 80% 80%;
  animation: jpnyWave 2.8s ease-in-out infinite;
}

.jpny-santa-close {
  position: absolute;
  top: 2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.94);
  color: #111827;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  opacity: 0.72;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  z-index: 3;
}

.jpny-santa-close:hover {
  opacity: 1;
  transform: scale(1.08);
  background: #ffffff;
}

.dark-theme .jpny-santa-close {
  background: rgba(24, 24, 27, 0.95);
  color: #f4f4f5;
  border-color: rgba(255, 255, 255, 0.2);
}

.jpny-santa-speech {
  pointer-events: auto;
  position: relative;
  margin-bottom: 42px;
  max-width: 250px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #ffffff;
  color: #18181b;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.jpny-santa-speech::before {
  content: "";
  position: absolute;
  bottom: 10px;
  width: 10px;
  height: 10px;
  background: inherit;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.jpny-pos-left .jpny-santa-speech::before {
  left: -6px;
  transform: rotate(45deg);
}

.jpny-pos-right .jpny-santa-speech::before {
  right: -6px;
  transform: rotate(-135deg);
}

.jpny-santa-speech.jpny-fade {
  opacity: 0.15;
  transform: translateY(3px);
}

.jpny-santa-speech a {
  color: #d9383a;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.jpny-santa-speech a:hover {
  color: #b91c1c;
}

.dark-theme .jpny-santa-speech {
  background: #18181b;
  color: #f4f4f5;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.48);
}

.dark-theme .jpny-santa-speech::before {
  border-color: rgba(255, 255, 255, 0.14);
}

.dark-theme .jpny-santa-speech a {
  color: #ff6b6b;
}

.jpny-mobile-gift-badge {
  display: none;
}

/* Visitor Toggle Pill */
#jpny-user-toggle {
  position: fixed;
  left: 16px;
  bottom: 124px;
  z-index: 998;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: #2563eb;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.48;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  transition: opacity 0.2s ease, transform 0.2s ease, bottom 0.2s ease;
}

#jpny-santa.jpny-is-hidden ~ #jpny-user-toggle {
  bottom: 50px;
}

#jpny-user-toggle:hover,
.jpny-paused #jpny-user-toggle {
  opacity: 1;
  transform: scale(1.06);
}

.jpny-paused #jpny-user-toggle {
  bottom: 16px;
}

.dark-theme #jpny-user-toggle {
  background: rgba(24, 24, 27, 0.92);
  color: #93c5fd;
  border-color: rgba(255, 255, 255, 0.18);
}

/* Santa Hat on Logo */
.jpny-logo-hat {
  position: absolute;
  top: -11px;
  left: -8px;
  width: 24px;
  height: 22px;
  pointer-events: none;
  z-index: 5;
  transform: rotate(-16deg);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

/* Greeting & Promo Modal */
#jpny-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(4px);
}

#jpny-modal.jpny-modal--open {
  display: flex;
  animation: jpnyFadeIn 0.22s ease;
}

.jpny-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 440px;
  border-radius: 18px;
  padding: 26px 24px 22px;
  background: #ffffff;
  color: #18181b;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.dark-theme .jpny-modal-dialog {
  background: #18181b;
  color: #f4f4f5;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.jpny-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.dark-theme .jpny-modal-close {
  background: rgba(255, 255, 255, 0.1);
}

.jpny-modal-icon {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 10px;
}

.jpny-modal-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
}

.jpny-modal-body {
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 16px;
}

.jpny-modal-body a {
  color: #d9383a;
  font-weight: 600;
  text-decoration: underline;
}

.dark-theme .jpny-modal-body a {
  color: #ff6b6b;
}

.jpny-countdown-wrap {
  margin: 0 0 16px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(217, 56, 58, 0.07);
}

.dark-theme .jpny-countdown-wrap {
  background: rgba(255, 255, 255, 0.05);
}

.jpny-countdown-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
  margin-bottom: 8px;
}

.jpny-countdown-grid {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.jpny-countdown-box {
  min-width: 54px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.dark-theme .jpny-countdown-box {
  background: #27272a;
  border-color: rgba(255, 255, 255, 0.12);
}

.jpny-countdown-num {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #d9383a;
}

.dark-theme .jpny-countdown-num {
  color: #ff6b6b;
}

.jpny-countdown-unit {
  display: block;
  font-size: 11px;
  opacity: 0.72;
}

.jpny-promo-box {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed #d9383a;
  background: rgba(217, 56, 58, 0.05);
}

.jpny-promo-label {
  font-size: 12px;
  margin-bottom: 6px;
  opacity: 0.8;
}

.jpny-promo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.jpny-promo-code {
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
}

.dark-theme .jpny-promo-code {
  background: rgba(255, 255, 255, 0.1);
}

.jpny-promo-copy {
  border: 0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  background: #18181b;
  color: #ffffff;
  cursor: pointer;
}

.dark-theme .jpny-promo-copy {
  background: #f4f4f5;
  color: #18181b;
}

.jpny-modal-cta {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 8px;
  background: #d9383a;
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background 0.2s ease, transform 0.15s ease;
}

.jpny-modal-cta:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

/* Mobile UX Safeguards (< 768px) */
@media (max-width: 767px) {
  #jpny-top-lights {
    height: 10px;
  }

  #jpny-garland {
    height: 24px !important;
  }

  #jpny-garland.jpny-garland-mob-hide {
    display: none !important;
  }

  #jpny-santa.jpny-santa-mob-hide {
    display: none !important;
  }

  #jpny-santa {
    left: 4px !important;
    right: auto !important;
    bottom: 2px !important;
  }

  .jpny-santa-figure {
    width: 66px;
    height: 76px;
  }

  .jpny-santa-figure.jpny-santa--mini {
    width: 58px;
    height: 64px;
  }

  .jpny-santa-speech {
    display: none !important;
  }

  .jpny-mobile-gift-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: 10px;
    left: 46px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #d9383a;
    color: #ffffff;
    font-size: 11px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    pointer-events: none;
  }

  .jpny-santa-close {
    width: 20px;
    height: 20px;
    top: -4px;
    right: -4px;
    font-size: 13px;
  }

  #jpny-user-toggle {
    display: none;
  }

  .jpny-paused #jpny-user-toggle {
    display: flex;
    left: 8px;
    bottom: 12px;
    width: 28px;
    height: 28px;
  }
}

@keyframes jpnyWave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-14deg); }
  50% { transform: rotate(6deg); }
  75% { transform: rotate(-10deg); }
}

@keyframes jpnyTwinkle {
  0%, 100% { opacity: 0.45; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes jpnyFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
