/* ==========================================================================
   ITOCCHIGAMES — MINIGAMES (PLINKO "THE WALL" & RUOTA DELLA FORTUNA) STYLES
   ========================================================================== */

/* Banner Prominente in Home Page */
.portal-minigames-banner {
  margin: 30px auto;
  max-width: 1200px;
  width: 92vw;
  background: linear-gradient(135deg, #1e1b4b 0%, #311b92 50%, #4a148c 100%);
  border: 2.5px solid #fbbf24;
  border-radius: 24px;
  padding: 24px 30px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(251, 191, 36, 0.3);
  position: relative;
  overflow: hidden;
}

.portal-minigames-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.12) 0%, transparent 60%);
  pointer-events: none;
  animation: bannerGlowPulse 4s infinite alternate ease-in-out;
}

@keyframes bannerGlowPulse {
  0% { transform: scale(0.9); opacity: 0.5; }
  100% { transform: scale(1.1); opacity: 1; }
}

.minigames-banner-header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
}

.minigames-banner-tag {
  display: inline-block;
  background: #f43f5e;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 900;
  padding: 4px 14px;
  border-radius: 99px;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.minigames-banner-title {
  font-size: clamp(1.4rem, 4vw, 2.1rem);
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  margin-bottom: 4px;
}

.minigames-banner-sub {
  font-size: clamp(0.85rem, 2vw, 1rem);
  color: #e2e8f0;
}

/* Griglia delle 2 Schede Minigiochi */
.minigames-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  position: relative;
  z-index: 2;
}

.minigame-card-item {
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid rgba(251, 191, 36, 0.4);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  backdrop-filter: blur(8px);
}

.minigame-card-item:hover {
  transform: translateY(-5px);
  border-color: #fbbf24;
  box-shadow: 0 10px 25px rgba(251, 191, 36, 0.3);
}

.minigame-card-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

.minigame-card-name {
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 4px;
}

.minigame-card-desc {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-bottom: 16px;
  flex-grow: 1;
}

.btn-launch-minigame {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000000;
  font-weight: 900;
  font-size: 0.95rem;
  padding: 10px 22px;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
  transition: all 0.2s ease;
  width: 100%;
}

.btn-launch-minigame:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

/* ==================== MODALE BACKDROP OVERLAY ==================== */
.minigames-modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(2, 6, 23, 0.92) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 10000 !important;
  opacity: 1;
  visibility: visible;
  transition: all 0.3s ease;
}

.minigames-modal-overlay.hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.minigames-modal-box {
  max-width: 600px;
  width: 94vw;
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #09132d 0%, #020617 100%);
  border: 2.5px solid #38bdf8;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(56, 189, 248, 0.3);
  position: relative;
  color: #ffffff;
}

.spades-modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 20;
}

.spades-modal-close:hover {
  background: #f43f5e;
  color: #ffffff;
}

.minigames-tab-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  background: rgba(15, 23, 42, 0.8);
  padding: 5px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.minigame-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 10px 16px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.minigame-tab-btn.active {
  background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
}

/* Area del Gioco */
.minigame-stage-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  position: relative;
}

/* THE WALL SELECTION BAR (1-8) */
.plinko-top-selection-bar {
  width: 100%;
  max-width: 440px;
  margin-bottom: 12px;
  text-align: center;
}

.plinko-instruction-tag {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(15, 23, 42, 0.95);
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  display: inline-block;
  margin-bottom: 8px;
}

.plinko-top-slots-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  width: 100%;
}

.plinko-top-slot-btn {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1.5px solid #38bdf8;
  color: #38bdf8;
  font-size: 0.95rem;
  font-weight: 900;
  padding: 8px 0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.plinko-top-slot-btn:hover {
  transform: translateY(-2px);
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.plinko-top-slot-btn.selected {
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
  border-color: #4ade80;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(74, 222, 128, 0.8);
  transform: scale(1.08);
}

/* PLINKO CANVAS STAGE */
.plinko-canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 460px;
  background: #020617;
  border: 2px solid rgba(56, 189, 248, 0.4);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: inset 0 0 25px rgba(0,0,0,0.9), 0 0 20px rgba(56, 189, 248, 0.2);
}

#plinko-canvas {
  width: 440px;
  height: 460px;
  display: block;
}

/* RUOTA DELLA FORTUNA STAGE (DIMENSIONI IDENTICHE 440x460 PER ZERO LAYOUT SHIFT) */
.wheel-stage-wrapper {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 460px;
  background: #020617;
  border: 2px solid rgba(251, 191, 36, 0.4);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: inset 0 0 25px rgba(0,0,0,0.9), 0 0 20px rgba(251, 191, 36, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-pointer {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 42px;
  z-index: 25;
  font-size: 2.2rem;
  color: #f43f5e;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.8));
}

#wheel-canvas {
  width: 380px;
  height: 380px;
  border-radius: 50%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), 0 0 25px rgba(251, 191, 36, 0.4);
  transition: transform 4s cubic-bezier(0.15, 0.9, 0.2, 1);
}

.wheel-center-cap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  background: radial-gradient(circle, #fbbf24 0%, #b45309 100%);
  border: 3px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
  z-index: 10;
}

/* Bottoni di Azione */
.minigame-action-bar {
  margin-top: 16px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.btn-play-action {
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 900;
  padding: 12px 0;
  width: 320px;
  max-width: 90%;
  text-align: center;
  border-radius: 99px;
  border: 2px solid #86efac;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.btn-play-action:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.6);
}

.btn-play-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  background: #334155;
  border-color: #475569;
}

/* Modale Risultato Vincita */
.win-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 6, 23, 0.94);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: popIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.win-popup-overlay.hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

@keyframes popIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.win-popup-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fbbf24;
  margin-bottom: 6px;
  text-align: center;
}

.win-popup-amount {
  font-size: 2.8rem;
  font-weight: 900;
  color: #4ade80;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.6);
  margin-bottom: 16px;
  text-align: center;
}
