/**
 * Xprees GiftCard — Shared 9:16 Stage Renderer & Public Viewer Styles
 * Used by both Editor Live Preview and Public /s/{slug} Viewer.
 */
.xgc-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0b0b;
  color: #ffffff;
  user-select: none;
}

.xgc-bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 0.6s ease;
}
.xgc-bg-layer.anim-grad {
  background-size: 240% 240%;
  animation: xgc-bg-shift 12s ease-in-out infinite;
}
@keyframes xgc-bg-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.xgc-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.xgc-bg-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Elements */
.xgc-el {
  position: absolute;
  box-sizing: border-box;
  transform-origin: center center;
  will-change: transform, opacity;
}
.xgc-el-inner {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Text */
.xgc-text {
  width: 100%;
  height: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Image Frame Styles */
.xgc-img-wrap {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.xgc-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.frame-none { border-radius: 0; }
.frame-rounded { border-radius: 16px; }
.frame-circle { border-radius: 50%; }
.frame-heart { clip-path: path('M 150 265 C 150 265 20 185 20 95 C 20 45 60 15 100 15 C 125 15 142 30 150 48 C 158 30 175 15 200 15 C 240 15 280 45 280 95 C 280 185 150 265 150 265 Z'); border-radius: 24px; }
.frame-polaroid { background: #ffffff; padding: 8px 8px 28px; border-radius: 4px; box-shadow: 0 12px 28px rgba(0,0,0,0.45); }
.frame-film { background: #111; padding: 12px 6px; border: 2px dashed rgba(255,255,255,0.45); border-radius: 6px; }
.frame-arch { border-radius: 999px 999px 12px 12px; }
.frame-thin-border { border: 1.5px solid rgba(255,255,255,0.75); border-radius: 10px; }
.frame-double-border { border: 4px double rgba(255,255,255,0.8); padding: 4px; border-radius: 12px; }

/* Button Element */
.xgc-btn-el {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 400;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.xgc-btn-el:active { transform: scale(0.96); }

/* Countdown Element */
.xgc-cd-box {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
}
.xgc-cd-grid { display: flex; gap: 10px; align-items: center; justify-content: center; }
.xgc-cd-cell { text-align: center; min-width: 38px; }
.xgc-cd-cell b { display: block; font-size: 20px; font-weight: 600; line-height: 1.1; }
.xgc-cd-cell small { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.7; }

/* Interactive Envelope Reveal */
.xgc-envelope {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,0.38);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.35s var(--ease-pop);
}
.xgc-envelope .env-msg { display: none; font-size: 13.5px; line-height: 1.65; animation: xgc-rise 0.55s var(--ease-rise); }
.xgc-envelope.opened .env-cover { display: none; }
.xgc-envelope.opened .env-msg { display: block; }

/* Interactive Scratch-to-Reveal */
.xgc-scratch {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.22);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
}
.xgc-scratch canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* Interactive Tap-to-Reveal & Message Card */
.xgc-tap-card, .xgc-msg-card {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.24);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}

/* Gallery Slideshow */
.xgc-gallery {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,0.18);
}
.xgc-gallery img { width: 100%; height: 100%; object-fit: cover; }

/* Particles Canvas */
.xgc-particles-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Loop Keyframes */
@keyframes xgc-loop-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes xgc-loop-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes xgc-loop-sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes xgc-loop-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes xgc-loop-spin { to { transform: rotate(360deg); } }
@keyframes xgc-loop-shimmer { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* Public Fullscreen Viewer Shell */
.viewer-body {
  background: #050505;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.viewer-frame {
  width: min(100vw, calc(100dvh * 9 / 16));
  height: min(100dvh, calc(100vw * 16 / 9));
  position: relative;
  overflow: hidden;
  background: #0b0b0b;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.9);
}
@media (max-width: 520px) {
  .viewer-frame { width: 100vw; height: 100dvh; }
}

.viewer-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(11, 11, 11, 0.94);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  gap: 16px;
}

.viewer-hud {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 30;
  display: flex;
  gap: 6px;
}
.viewer-hud button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(11,11,11,0.65);
  color: #fff;
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
}
.viewer-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  gap: 6px;
}
.viewer-dots button {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  border: 0;
  padding: 0;
  background: rgba(255,255,255,0.32);
  transition: width 0.25s, background 0.25s;
}
.viewer-dots button.on { width: 22px; background: #ffffff; }
