/* =============================================
   sliding.css — Sliding Puzzle Game Styles
   Mini Games Hub — Premium Gaming UI
   ============================================= */

/* Difficulty Selector */
.slide-difficulty {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.diff-btn {
  background: var(--clr-bg-secondary);
  border: 1.5px solid var(--clr-border);
  color: var(--clr-text-secondary);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 6px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.diff-btn:hover {
  border-color: #7c3aed;
  color: #a78bfa;
}

.diff-btn.active {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border-color: #7c3aed;
  color: #fff;
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.45);
}

/* Board Wrapper */
.slide-board-wrap {
  position: relative;
  width: fit-content;
  margin: 0 auto;
  /* Clip the overlay so it never bleeds outside the board */
  overflow: hidden;
  border-radius: var(--radius-lg);
  /* Ensure the wrap always has a minimum footprint even before tiles render */
  min-width: 280px;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Board Grid */
.slide-board {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: rgba(124, 58, 237, 0.06);
  border: 1.5px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.12), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: grid-template-columns 0.3s ease;
}

/* Tiles */
.slide-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}

.slide-tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
  border-radius: 10px 10px 0 0;
  pointer-events: none;
}

.slide-tile:not(.empty):hover {
  transform: scale(1.04);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.5);
}

.slide-tile:not(.empty):active {
  transform: scale(0.96);
}

.slide-tile.empty {
  background: rgba(124, 58, 237, 0.05) !important;
  border: 2px dashed rgba(124, 58, 237, 0.2);
  cursor: default;
  box-shadow: none;
}

.slide-tile.empty::before { display: none; }

/* Tile colors — gradient by number zone */
.slide-tile.zone-1 {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124,58,237,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}
.slide-tile.zone-2 {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  box-shadow: 0 4px 12px rgba(139,92,246,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}
.slide-tile.zone-3 {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #fff;
  box-shadow: 0 4px 12px rgba(167,139,250,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}
.slide-tile.zone-4 {
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6);
  color: #1e1b4b;
  box-shadow: 0 4px 12px rgba(196,181,253,0.3), inset 0 1px 0 rgba(255,255,255,0.25);
}

/* Correct-position highlight */
.slide-tile.correct {
  box-shadow: 0 0 0 2px #a78bfa, 0 0 18px rgba(167,139,250,0.5) !important;
}

/* Slide animation */
@keyframes slideIn {
  from { transform: scale(0.85); opacity: 0.6; }
  to   { transform: scale(1);    opacity: 1; }
}

.slide-tile.slide-anim {
  animation: slideIn 0.12s ease-out;
}

/* Win flash */
@keyframes winPulse {
  0%, 100% { box-shadow: 0 0 0 2px #a78bfa, 0 0 20px rgba(167,139,250,0.5); }
  50%       { box-shadow: 0 0 0 4px #c4b5fd, 0 0 40px rgba(196,181,253,0.8); }
}

.slide-board.win-flash .slide-tile:not(.empty) {
  animation: winPulse 0.5s ease 3;
}

/* Overlays — must fill the entire board wrap */
.slide-board-wrap .game-overlay {
  border-radius: 0;           /* wrap already has border-radius + overflow:hidden */
  background: rgba(13, 13, 26, 0.88);
  backdrop-filter: blur(6px);
  position: absolute;
  inset: 0;
  z-index: 20;
  width: 100%;
  height: 100%;
}

/* Responsive sizing handled via JS inline styles */
@media (max-width: 480px) {
  .slide-board { gap: 5px; padding: 8px; }
  .diff-btn { padding: 5px 12px; font-size: 11px; }
}
