.scratch-card {
  width: min(560px, calc(100vw - 2rem));
  height: 310px;
  margin: 2rem auto;
  position: relative;
  overflow: visible;
  border-radius: 22px;
  background: linear-gradient(135deg, #5a294f 0%, #a94e6b 48%, #d58b75 100%);
  box-shadow: 0 24px 70px rgba(71, 36, 63, 0.25);
  transform: translateZ(0);
  transition:
    transform 0.35s,
    box-shadow 0.35s;
}

.scratch-card:hover {
  transform: translateY(-5px) rotate(-0.4deg);
  box-shadow: 0 30px 85px rgba(71, 36, 63, 0.3);
}

.scratch-card::before,
.scratch-card::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--cream);
  transform: translateY(-50%);
}

.scratch-card::before {
  left: -15px;
}
.scratch-card::after {
  right: -15px;
}

.scratch-card canvas {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  cursor: crosshair;
  touch-action: none;
  transition:
    opacity 0.6s,
    transform 0.6s;
}

.scratch-message {
  position: absolute;
  z-index: 1;
  inset: 14px;
  display: grid;
  place-items: center;
  padding: 2rem;
  border: 1px dashed rgba(255, 255, 255, 0.42);
  border-radius: 10px;
  color: white;
  text-align: center;
  background: linear-gradient(135deg, #d78b72, #bc6076 50%, #6b365f);
}

.scratch-message strong {
  display: block;
  color: var(--gold);
  font: italic clamp(2rem, 6vw, 3.1rem) "DM Serif Display";
}

/* Keep the revealed title and description visually centered on every width. */
.scratch-message > div {
  width: 100%;
  display: grid;
  justify-items: center;
  text-align: center;
}

.scratch-message > div > .eyebrow,
.scratch-message > div > strong,
.scratch-message > div > p:last-child {
  width: 100%;
  text-align: center;
}

/* Center the complete scratch-card section heading and supporting copy. */
.scratch-section > .wrap > .eyebrow,
.scratch-section > .wrap > .section-title,
.scratch-section > .wrap > .scratch-hint {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.scratch-section > .wrap > .scratch-hint {
  display: block;
}

.scratch-shimmer {
  position: absolute;
  z-index: 5;
  inset: -40%;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 42%,
    rgba(255, 255, 255, 0.32) 48%,
    transparent 54%
  );
  animation: scratchFoilSweep 4s ease-in-out infinite;
}

.scratch-progress {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 27px;
  width: 150px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
  transform: translateX(-50%);
}

.scratch-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
  transition: width 0.25s;
}

.scratch-spark {
  position: absolute;
  z-index: 7;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff2c8;
  box-shadow: 0 0 14px #fff2c8;
  pointer-events: none;
  animation: scratchSparkPop 0.6s ease-out forwards;
}

.scratch-status {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: 42px;
  color: #fff5df;
  font:
    600 0.62rem "DM Sans",
    sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(43, 28, 43, 0.35);
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
}

.scratch-card.revealed {
  background: linear-gradient(135deg, #d78b72, #bc6076 50%, #6b365f);
  box-shadow:
    0 0 0 6px rgba(223, 185, 120, 0.2),
    0 30px 90px rgba(71, 36, 63, 0.32);
}

@keyframes scratchFoilSweep {
  0%,
  35% {
    transform: translateX(-25%) rotate(12deg);
  }
  70%,
  100% {
    transform: translateX(25%) rotate(12deg);
  }
}

@keyframes scratchSparkPop {
  to {
    transform: translate(var(--sx), var(--sy)) scale(0);
    opacity: 0;
  }
}

@media (max-width: 760px) {
  .scratch-card {
    width: min(560px, calc(100vw - 1.5rem));
    height: 270px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scratch-card,
  .scratch-card canvas,
  .scratch-shimmer,
  .scratch-spark {
    animation: none;
    transition: none;
  }
}
