.polarized-scratch-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  aspect-ratio: var(--polarized-aspect, 3 / 2);
  border-radius: 12px;
  padding: 8px;
  background: transparent;
}

.polarized-scratch-card[data-shape="square"],
.polarized-scratch-card[data-shape="circle"] {
  aspect-ratio: 1 / 1;
}

/* Structural shape wrapper: visuals + clipping live here. */
.polarized-scratch-shape {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #d4d4d4;
  border-radius: 12px;
  clip-path: var(--polarized-shape-path, none);
  box-sizing: border-box;
}

.polarized-scratch-shape[data-shape="rectangle"],
.polarized-scratch-shape[data-shape="square"] {
  clip-path: none;
}

.polarized-shape--square,
.polarized-shape--circle {
  aspect-ratio: 1 / 1;
}

.polarized-shape--circle {
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
}


.elementor-widget-polarized-scratch-card {
  width: 100%;
  flex: 1 1 0;
  min-width: 0;
}

.polarized-scratch-content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: var(--polarized-fallback-justify, center);
  padding-top: calc(1rem + var(--polarized-fallback-offset, 0px));
  padding-bottom: calc(1rem - var(--polarized-fallback-offset, 0px));
  gap: 0.35rem;
  text-align: center;
  background: #ffffff;
  border-radius: inherit;
  overflow: hidden;
  z-index: 1;
}

.polarized-scratch-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #111827;
  color: #ffffff;
  font-size: 0.95rem;
  cursor: pointer;
  opacity: 1;
  transform: none;
}

.polarized-scratch-card[data-fallback-vertical="top"] .polarized-scratch-fallback {
  margin-top: 0.25rem;
}

.polarized-scratch-card[data-fallback-vertical="bottom"] .polarized-scratch-fallback {
  margin-top: auto;
}

.polarized-scratch-card[data-fallback-vertical="top"] .polarized-scratch-content {
  --polarized-fallback-justify: flex-start;
}

.polarized-scratch-card[data-fallback-vertical="center"] .polarized-scratch-content {
  --polarized-fallback-justify: center;
}

.polarized-scratch-card[data-fallback-vertical="bottom"] .polarized-scratch-content {
  --polarized-fallback-justify: flex-end;
}

.polarized-scratch-card--fallback-visible .polarized-scratch-fallback {
  display: inline-flex;
}

.polarized-scratch-card--fallback-visible .polarized-scratch-content {
  opacity: 1;
  visibility: visible;
}

.polarized-scratch-card--fallback-visible[data-fallback-anim="fade"] .polarized-scratch-fallback {
  animation: polarized-fallback-fade var(--polarized-fallback-anim-duration, 300ms) ease forwards;
}

.polarized-scratch-card--fallback-visible[data-fallback-anim="slide"] .polarized-scratch-fallback {
  animation: polarized-fallback-slide var(--polarized-fallback-anim-duration, 300ms) ease forwards;
}

@keyframes polarized-fallback-fade {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes polarized-fallback-slide {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.polarized-scratch-card--loading .polarized-scratch-content {
  opacity: 0;
  visibility: hidden;
}

.elementor-widget-polarized-scratch-card.polarized-scratch-card--show-back .polarized-scratch-content {
  opacity: 1;
  visibility: visible;
}

.polarized-scratch-card--reveal-fade .polarized-scratch-mask {
  transition: opacity var(--polarized-reveal-duration, 400ms) ease;
}

.polarized-scratch-card--reveal-fade.is-revealed .polarized-scratch-mask {
  opacity: 0;
}

.polarized-scratch-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}

.polarized-scratch-confetti-piece {
  position: absolute;
  top: var(--polarized-confetti-start-y, 0px);
  left: 0;
  width: 8px;
  height: 12px;
  opacity: 0.95;
  background: var(--polarized-confetti-color, #facc15);
  transform: translateX(var(--polarized-confetti-x, 0)) rotate(var(--polarized-confetti-rotate, 0deg));
  animation: polarized-confetti-fall var(--polarized-confetti-duration, 1200ms) ease-out var(--polarized-confetti-delay, 0ms) forwards;
}

@keyframes polarized-confetti-fall {
  0% {
    transform: translateX(var(--polarized-confetti-x, 0)) translateY(0) rotate(var(--polarized-confetti-rotate, 0deg));
  }
  100% {
    transform: translateX(calc(var(--polarized-confetti-x, 0) + 10px)) translateY(var(--polarized-confetti-end-y, 240px))
      rotate(calc(var(--polarized-confetti-rotate, 0deg) + 180deg));
    opacity: 0;
  }
}

.polarized-scratch-card--loading[data-mask-type="solid"] .polarized-scratch-mask {
  background-color: var(--polarized-mask-color, #d4a43f) !important;
}

.polarized-scratch-card--loading[data-mask-type="gradient"] .polarized-scratch-mask {
  background-image: linear-gradient(
    var(--polarized-mask-gradient-angle, 90deg),
    var(--polarized-mask-gradient-start, #d39326),
    var(--polarized-mask-gradient-end, #dfad2e)
  ) !important;
}

.polarized-scratch-mask {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  z-index: 2;
}

.polarized-scratch-card.is-revealed .polarized-scratch-mask {
  pointer-events: none;
}

.polarized-scratch-canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: transparent;
  touch-action: none;
}

.polarized-scratch-reset {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 3;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.polarized-scratch-reset:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.polarized-scratch-reset:active {
  transform: translateY(0);
}

.elementor-widget-polarized-scratch-card.polarized-scratch-card--show-back .polarized-scratch-mask {
  display: none;
}
