*, *::before, *::after {
  box-sizing: border-box;
  font-family: 'Pacifico', cursive;
  margin: 0;
  padding: 0;
}

body {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(255, 182, 193, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 105, 180, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(255, 20, 147, 0.1) 0%, transparent 50%);
  animation: float 6s ease-in-out infinite;
  z-index: -1;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

.portrait-warning {
  display: none;
  position: fixed;
  z-index: 9999;
  background: white;
  color: black;
  font-family: 'Poppins', sans-serif;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  padding: 2rem;
}

@media screen and (orientation: portrait) {
  .container, .game-area, .success-animation {
    display: none !important;
  }

  .portrait-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
  }
}


.container {
  max-width: 100%;
  text-align: center;
}

.title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #d63384;
  margin-bottom: 30px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.game-area {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.board-container {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.board {
  width: 320px;
  height: 320px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 2px;
  background: linear-gradient(45deg, #ff6b9d, #ff8fab);
  border-radius: 15px;
  padding: 10px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
}

.slot {
  width: 100%;
  height: 100%;
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.slot:hover {
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.slot.drag-over {
  border-color: #28a745;
  background: rgba(40, 167, 69, 0.1);
  transform: scale(1.1);
}

.pieces-container {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 540px;
}

.pieces {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 500px;
  height: 320px;
  align-content: flex-start;
  min-height: 200px;
  border-radius: 15px;
  background: linear-gradient(45deg, #ffeaa7, #fab1a0);
  padding: 15px;
}

.piece {
  width: 70px;
  height: 70px;
  background-size: 280px 280px;
  background-repeat: no-repeat;
  border: none;
  cursor: grab;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
}

.piece::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.piece:hover::before {
  transform: translateX(100%);
}

.piece:hover {
  transform: scale(1.1) rotate(2deg);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  z-index: 10;
}

.piece:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.piece.dragging {
  opacity: 0.8;
  transform: scale(1.1);
  z-index: 1000;
}

.buttons {
  text-align: center;
  margin-top: 20px;
}

.buttons button {
  padding: 12px 30px;
  margin: 0 10px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 25px;
  background: linear-gradient(45deg, #ff6b9d, #ff8fab);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.buttons button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.buttons button:hover::before {
  left: 100%;
}

.buttons button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 107, 157, 0.6);
}

.buttons button:active {
  transform: translateY(-1px);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  margin: 20px 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #28a745, #20c997);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.stats {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
  flex-wrap: wrap;
}

.stat-item {
  background: rgba(255, 255, 255, 0.9);
  padding: 15px 20px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  margin: 5px;
  min-width: 120px;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: #d63384;
}

.stat-label {
  font-size: 0.9rem;
  color: #666;
  margin-top: 5px;
}

@media (max-width: 1024px) {
  .game-area {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .board, .pieces {
    width: 280px;
    height: 280px;
  }

  .piece {
    width: 60px;
    height: 60px;
    background-size: 240px 240px;
  }

  .pieces {
    width: 280px;
    height: auto;
  }

  .pieces-container {
    width: auto;
  }

  .buttons {
    flex-direction: column;
    gap: 10px;
  }

  .buttons button {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .title {
    font-size: 2rem;
  }

  .container {
    padding: 15px;
  }

  .board, .pieces {
    width: 250px;
    height: 250px;
  }

  .piece {
    width: 50px;
    height: 50px;
    background-size: 200px 200px;
  }

  .stat-item {
    padding: 10px 15px;
    min-width: 100px;
  }

  .buttons button {
    font-size: 14px;
    padding: 10px 20px;
  }

  .continue-button {
    width: 200px;
    font-size: 15px;
    padding: 10px 20px;
  }
}

@media (max-width: 480px) {
  .title {
    font-size: 1.6rem;
  }

  .board, .pieces {
    width: 220px;
    height: 220px;
  }

  .piece {
    width: 45px;
    height: 45px;
    background-size: 180px 180px;
  }

  .buttons button,
  .continue-button {
    font-size: 13px;
    padding: 8px 18px;
  }

  .success-content {
    padding: 25px;
  }

  .success-icon {
    font-size: 3rem;
  }
}

.success-animation {
  position: fixed;
  top: 0;               
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center; 
  align-items: center; 
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s ease;
}

.success-animation img{
  border-radius: 15%;
  width: 200px;
}

.success-animation.show {
  opacity: 1;
  visibility: visible;
}

.success-content {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  transform: scale(0.8);
  transition: transform 0.5s ease;
}

.success-animation.show .success-content {
  transform: scale(1);
}

.success-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.continue-button {
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #28a745, #218838);
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(40, 167, 69, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.continue-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.6s ease;
  z-index: 1;
}

.continue-button:hover::before {
  left: 100%;
}

.continue-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(40, 167, 69, 0.6);
}

.continue-button:active {
  transform: scale(0.98);
}
