/* Taglio Perfetto — mini-gioco dashboard */
#perfect-cut-modal.perfect-cut-open {
  display: flex !important;
}

.perfect-cut-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(251, 146, 60, 0.22), transparent 55%),
    rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(8px);
}

.perfect-cut-panel {
  position: relative;
  z-index: 2;
  width: min(92vw, 400px);
  max-height: min(94vh, 700px);
  overflow: auto;
  padding: 1.25rem 1.25rem 1.4rem;
  border-radius: 1.5rem;
  background: linear-gradient(165deg, #1e293b 0%, #0f172a 55%, #020617 100%);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
  color: #e2e8f0;
}

.perfect-cut-eyebrow {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fb923c;
  margin-bottom: 0.3rem;
}

.perfect-cut-title {
  font-size: 1.45rem;
  font-weight: 900;
  color: #fff;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.perfect-cut-sub {
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 0 0 1rem;
  line-height: 1.4;
}

.perfect-cut-stage {
  position: relative;
  width: min(72vw, 280px);
  height: min(72vw, 280px);
  margin: 0.5rem auto 1rem;
  touch-action: manipulation;
  cursor: pointer;
  user-select: none;
}

.perfect-cut-pizza {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, #fde68a 0%, #f59e0b 35%, #c2410c 78%, #7c2d12 100%);
  box-shadow:
    inset 0 0 0 10px #b45309,
    inset 0 0 0 14px #fbbf24,
    0 8px 24px rgba(0, 0, 0, 0.4);
}

.perfect-cut-pizza::before {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15), transparent 40%),
    repeating-conic-gradient(from 0deg, #ef4444 0deg 18deg, #dc2626 18deg 36deg);
  opacity: 0.55;
}

.perfect-cut-guide {
  position: absolute;
  left: 50%;
  top: 8%;
  bottom: 8%;
  width: 2px;
  margin-left: -1px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.55) 0 6px,
    transparent 6px 12px
  );
  z-index: 2;
  pointer-events: none;
}

.perfect-cut-blade-orbit {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  will-change: transform;
  transform: translateZ(0);
}

.perfect-cut-blade-orbit.is-snapping {
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.perfect-cut-blade {
  position: absolute;
  left: 50%;
  top: 4%;
  width: 4px;
  height: 46%;
  margin-left: -2px;
  border-radius: 2px 2px 1px 1px;
  background: linear-gradient(to bottom, #f8fafc 0%, #94a3b8 55%, #64748b 100%);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
  transform-origin: 50% 100%;
}

.perfect-cut-blade::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #cbd5e1 60%, #64748b);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.perfect-cut-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7d6, #f59e0b 50%, #b45309);
  border: 2px solid #fff;
  pointer-events: none;
}

.perfect-cut-hint {
  font-size: 0.8rem;
  color: #cbd5e1;
  margin: 0 0 0.75rem;
  min-height: 1.2em;
}

.perfect-cut-result {
  display: none;
  margin: 0.5rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.perfect-cut-result.is-visible {
  display: block;
}

.perfect-cut-result.is-lose {
  background: rgba(100, 116, 139, 0.2);
  border-color: rgba(148, 163, 184, 0.35);
}

.perfect-cut-result-prize {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-top: 0.25rem;
}

.perfect-cut-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.perfect-cut-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  font-weight: 800;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.perfect-cut-btn:active {
  transform: scale(0.98);
}

.perfect-cut-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.perfect-cut-btn-primary {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.35);
}

.perfect-cut-btn-secondary {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

/* Card in dashboard */
.perfect-cut-card {
  display: none;
  width: 100%;
  text-align: left;
  padding: 1rem 1.1rem;
  border-radius: 1.15rem;
  border: 1px solid rgba(251, 146, 60, 0.35);
  background: linear-gradient(120deg, #fff7ed 0%, #ffedd5 55%, #fed7aa 100%);
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.12);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.perfect-cut-card.is-visible {
  display: block;
}

.perfect-cut-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(234, 88, 12, 0.18);
}

.perfect-cut-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #9a3412;
}

.perfect-cut-card-sub {
  font-size: 0.75rem;
  color: #c2410c;
  margin-top: 0.2rem;
  line-height: 1.35;
}

.perfect-cut-card.is-won {
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(120deg, #ecfdf5 0%, #d1fae5 100%);
}

.perfect-cut-card.is-won .perfect-cut-card-title {
  color: #065f46;
}

.perfect-cut-card.is-won .perfect-cut-card-sub {
  color: #047857;
}

.perfect-cut-card.is-done:not(.is-won) {
  opacity: 0.85;
  border-color: rgba(148, 163, 184, 0.4);
  background: linear-gradient(120deg, #f8fafc, #e2e8f0);
}

.perfect-cut-card.is-done:not(.is-won) .perfect-cut-card-title,
.perfect-cut-card.is-done:not(.is-won) .perfect-cut-card-sub {
  color: #64748b;
}

/* Win celebration overlay */
.perfect-cut-win-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  border-radius: 1.25rem;
  overflow: hidden;
}

.perfect-cut-win-overlay:not(.hidden) {
  display: flex;
}

.perfect-cut-win-card {
  position: relative;
  z-index: 2;
  width: min(88%, 300px);
  padding: 1.35rem 1.2rem 1.15rem;
  border-radius: 1.25rem;
  text-align: center;
  background: linear-gradient(165deg, #064e3b 0%, #065f46 45%, #047857 100%);
  border: 1px solid rgba(110, 231, 183, 0.45);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    0 0 40px rgba(16, 185, 129, 0.25);
  animation: perfect-cut-win-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes perfect-cut-win-pop {
  0% {
    opacity: 0;
    transform: scale(0.82) translateY(12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.perfect-cut-trophy {
  font-size: 3.25rem;
  line-height: 1;
  margin-bottom: 0.35rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
  animation: perfect-cut-trophy-bounce 0.9s ease-out 0.15s both;
}

@keyframes perfect-cut-trophy-bounce {
  0% { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  55% { transform: scale(1.12) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

.perfect-cut-win-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a7f3d0;
  margin: 0 0 0.25rem;
}

.perfect-cut-win-prize {
  font-size: 1.65rem;
  font-weight: 900;
  color: #fff;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.perfect-cut-win-sub {
  font-size: 0.78rem;
  color: #d1fae5;
  margin: 0 0 1rem;
  line-height: 1.35;
}

.perfect-cut-win-dismiss {
  margin-top: 0.15rem;
}

/* Confetti particles */
.perfect-cut-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.perfect-cut-confetti::before,
.perfect-cut-confetti::after {
  content: "";
  position: absolute;
  inset: -20%;
  background-image:
    radial-gradient(circle, #fbbf24 0 3px, transparent 4px),
    radial-gradient(circle, #34d399 0 2.5px, transparent 3.5px),
    radial-gradient(circle, #fb923c 0 2px, transparent 3px),
    radial-gradient(circle, #fff 0 2px, transparent 3px);
  background-size: 120px 120px, 90px 90px, 110px 110px, 80px 80px;
  background-position: 0 0, 30px 20px, 60px 10px, 15px 45px;
  opacity: 0.85;
  animation: perfect-cut-confetti-fall 2.8s linear infinite;
}

.perfect-cut-confetti::after {
  animation-duration: 3.4s;
  animation-delay: -1.2s;
  opacity: 0.65;
  transform: scale(1.1);
}

@keyframes perfect-cut-confetti-fall {
  0% { transform: translateY(-8%) rotate(0deg); }
  100% { transform: translateY(18%) rotate(18deg); }
}

@media (prefers-reduced-motion: reduce) {
  .perfect-cut-blade-orbit {
    transition: none !important;
  }

  .perfect-cut-win-card,
  .perfect-cut-trophy,
  .perfect-cut-confetti::before,
  .perfect-cut-confetti::after {
    animation: none !important;
  }
}
