/* Carte à gratter — plein écran, foil animé, révélation */

body.scratch-fullscreen {
  background: linear-gradient(165deg, #f8fafc 0%, #eef2ff 45%, #fff7ed 100%);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  margin: 0;
}

.scratch-root {
  min-height: 100vh;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-sizing: border-box;
}

.scratch-game-page {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.scratch-game-hero {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 1.35rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow:
    0 16px 48px rgba(15, 23, 42, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  padding: 1.15rem 1rem 1.35rem;
  position: relative;
  overflow: hidden;
}

.scratch-game-hero::before {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background: radial-gradient(circle at 30% 20%, rgba(99, 102, 241, 0.12), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(244, 114, 182, 0.1), transparent 45%);
  pointer-events: none;
  animation: scratch-bg-drift 14s ease-in-out infinite alternate;
}

@keyframes scratch-bg-drift {
  from {
    transform: translate(-2%, 0) rotate(0deg);
  }
  to {
    transform: translate(2%, 1%) rotate(2deg);
  }
}

.scratch-game-title {
  font-size: clamp(1.28rem, 4vw, 1.72rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
  text-align: center;
  margin: 0;
  position: relative;
  z-index: 1;
}

.scratch-game-subtitle {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #64748b;
  text-align: center;
  margin: 0.55rem 0 0;
  position: relative;
  z-index: 1;
}

.scratch-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.9rem;
  position: relative;
  z-index: 1;
  min-height: 3rem;
  justify-content: center;
}

.scratch-hud__pill {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.35s ease;
}

.scratch-hud__pill--pulse {
  animation: scratch-hud-breathe 2.4s ease-in-out infinite;
}

.scratch-hud__pill--hot {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #f59e0b;
  color: #92400e;
  animation: scratch-hud-shake 0.85s ease-in-out infinite;
}

.scratch-hud__pill--done {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
  animation: none;
}

@keyframes scratch-hud-breathe {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.2);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0);
    transform: scale(1.02);
  }
}

@keyframes scratch-hud-shake {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-1.2deg);
  }
  75% {
    transform: rotate(1.2deg);
  }
}

.scratch-hud__hint {
  font-size: 0.72rem;
  color: #94a3b8;
  text-align: center;
  min-height: 1.1rem;
}

.scratch-card-stage {
  margin-top: 1rem;
  position: relative;
  z-index: 1;
  perspective: 900px;
}

.scratch-card-frame {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-height: 240px;
  margin: 0 auto;
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(15, 23, 42, 0.06);
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.34, 1.35, 0.64, 1);
}

.scratch-card-frame.is-scratching {
  transform: rotateX(2deg) scale(1.01);
}

.scratch-card-frame.is-reveal {
  animation: scratch-frame-pop 0.65s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
}

@keyframes scratch-frame-pop {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  40% {
    transform: scale(1.04);
    filter: brightness(1.08);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.scratch-card-glow {
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.35), transparent 55%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 0;
}

.scratch-card-glow.is-on {
  opacity: 1;
  animation: scratch-glow-pulse 1.2s ease-in-out infinite;
}

@keyframes scratch-glow-pulse {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.scratch-prize-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #fff 0%, #f8fafc 50%, #eef2ff 100%);
  z-index: 1;
}

.scratch-prize-placeholder {
  text-align: center;
  animation: scratch-placeholder-float 3s ease-in-out infinite;
}

.scratch-prize-q {
  display: block;
  font-size: clamp(2.5rem, 12vw, 3.75rem);
  font-weight: 900;
  background: linear-gradient(120deg, #6366f1, #a855f7, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 16px rgba(99, 102, 241, 0.35));
  line-height: 1;
}

.scratch-prize-sub {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scratch-prize-layer--sparkle .scratch-prize-q::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  background: #fbbf24;
  border-radius: 50%;
  animation: scratch-sparkle 2s ease-in-out infinite;
  opacity: 0;
}

@keyframes scratch-placeholder-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes scratch-sparkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.scratch-prize-layer .scratch-prize-result {
  text-align: center;
  padding: 1rem;
  animation: scratch-result-in 0.7s cubic-bezier(0.34, 1.35, 0.64, 1) both;
}

@keyframes scratch-result-in {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.scratch-prize-result__title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1.25;
}

.scratch-prize-result__sub {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}

.scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  z-index: 2;
  transition: opacity 0.55s ease;
}

.scratch-canvas:active {
  cursor: grabbing;
}

.scratch-canvas.is-revealed {
  opacity: 0;
  pointer-events: none;
}

/* Foil accents (class on frame) */
.scratch-card-frame--foil-0 {
  box-shadow:
    0 20px 50px rgba(217, 119, 6, 0.18),
    0 0 0 1px rgba(251, 191, 36, 0.35);
}

.scratch-card-frame--foil-1 {
  box-shadow:
    0 20px 50px rgba(100, 116, 139, 0.2),
    0 0 0 1px rgba(148, 163, 184, 0.45);
}

.scratch-card-frame--foil-2 {
  box-shadow:
    0 20px 50px rgba(99, 102, 241, 0.22),
    0 0 0 1px rgba(167, 139, 250, 0.4);
}

.scratch-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.1rem;
  position: relative;
  z-index: 1;
}

/* Boutons = .button-main du site (voir output-scss.css) */
.game-cta-btn {
  width: 100%;
  max-width: 280px;
  display: inline-block;
  text-align: center;
  box-sizing: border-box;
}

.game-cta-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.scratch-exit-link {
  font-size: 0.8125rem;
  color: #64748b;
  text-decoration: none;
}

.scratch-exit-link:hover {
  color: #7c3aed;
}

/* Modal */
.scratch-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.scratch-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.scratch-modal {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 1.25rem;
  padding: 1.75rem 1.5rem;
  text-align: center;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.18);
  transform: translateY(18px) scale(0.94) rotate(-1deg);
  transition: transform 0.45s cubic-bezier(0.34, 1.35, 0.64, 1);
}

.scratch-overlay.is-open .scratch-modal {
  transform: translateY(0) scale(1) rotate(0deg);
}

.scratch-modal__icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 8px 20px rgba(234, 88, 12, 0.35));
  animation: scratch-modal-icon 0.9s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes scratch-modal-icon {
  from {
    opacity: 0;
    transform: scale(0.3) rotate(-25deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.scratch-modal__title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #111827;
  margin: 0 0 0.5rem;
}

.scratch-modal__body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #4b5563;
  margin: 0;
}

.scratch-modal__code {
  font-family: ui-monospace, monospace;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.65rem 1rem;
  margin: 0.85rem 0 0;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border: 1px dashed rgba(234, 88, 12, 0.45);
  color: #9a3412;
  word-break: break-all;
}

.scratch-modal__code.hidden {
  display: none;
}

.scratch-modal__actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scratch-modal__close {
  margin-top: 1rem;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: underline;
}

.scratch-modal__link-back {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #7c3aed;
  text-decoration: none;
  margin-top: 0.35rem;
}

.scratch-modal__link-back:hover {
  text-decoration: underline;
}

.scratch-confetti {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  overflow: hidden;
}

.scratch-confetti span {
  position: absolute;
  width: 9px;
  height: 9px;
  top: -14px;
  left: var(--x);
  background: var(--c);
  border-radius: 2px;
  animation: scratch-fall var(--d) linear forwards;
  opacity: 0.95;
}

@keyframes scratch-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.55;
  }
}

.hidden {
  display: none !important;
}
