/* 
  Matchify Stylesheet - Creative Theme
  © 2025 Techxedo. All rights reserved.
*/

:root {
  --primary-color: #6a11cb;
  --secondary-color: #2575fc;
  --accent-color: #ff9a76;
  --desert-orange: #ff8c42;
  --desert-yellow: #ffda3d;
  --desert-green: #17b890;
  --card-color: #ffeadb;
  --text-light: #ffffff;
  --text-dark: #333333;
}

/* body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Poppins", sans-serif;
  background-image: url("../../../../images/25/aug/hero/assets/background.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  overflow-x: hidden;
} */

/* Welcome Screen Styles */
#welcome-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  overflow: hidden;
}

/* Card animation for the welcome screen */
.card-animation {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

.floating-card {
  position: absolute;
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: float 15s infinite linear;
  transform: scale(0.5);
}

@keyframes float {
  0% {
    transform: translateY(100vh) rotate(0deg) scale(0.5);
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  90% {
    opacity: 1;
  }

  100% {
    transform: translateY(-100px) rotate(360deg) scale(0.5);
    opacity: 0;
  }
}

#welcome-screen h1 {
  font-size: 7rem;
  font-weight: 800;
  margin: 0 0 2rem;
  background: linear-gradient(to right, var(--accent-color), #ffffff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
  letter-spacing: -3px;
  text-transform: uppercase;
  position: relative;
}

#welcome-screen h1::before {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transform: translateX(-10px) translateY(10px);
  filter: blur(15px);
  opacity: 0.8;
}

#welcome-screen p {
  color: var(--text-light);
  font-size: 1.2rem;
  max-width: 600px;
  text-align: center;
  margin-bottom: 2rem;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  animation: fadeIn 2s ease-in-out;
}

#play-button {
  padding: 15px 60px;
  font-size: 1.5rem;
  font-weight: 600;
  background: linear-gradient(
    45deg,
    var(--desert-orange),
    var(--desert-yellow)
  );
  color: var(--text-dark);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

#play-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    45deg,
    var(--desert-yellow),
    var(--desert-orange)
  );
  z-index: -1;
  transition: transform 0.6s cubic-bezier(0.8, 0, 0.2, 1);
  transform: scale(0);
  border-radius: 50px;
}

#play-button:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

#play-button:hover::before {
  transform: scale(1);
}

#play-button:active {
  transform: translateY(0);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Game screen styles continue below */
#game-screen {
  padding: 20px;
}

.difficulty {
  margin: 20px auto;
  text-align: center;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  max-width: 95%;
  width: 100%;
  max-width: 600px;
}

.difficulty-controls {
  margin: 20px auto;
}

.difficulty label {
  font-size: 1.2em;
  color: var(--text-dark);
  margin-bottom: 15px;
  font-weight: 600;
}

.difficulty select {
  padding: 12px 20px;
  font-size: 1em;
  border: 2px solid rgba(206, 155, 34, 0.3);
  border-radius: 12px;
  margin-bottom: 15px;
  width: 100%;
  max-width: 250px;
  background: white;
  color: var(--text-dark);
  transition: all 0.3s ease;
}

.difficulty select:focus {
  border-color: var(--desert-yellow);
  box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.2);
  outline: none;
}

.difficulty button {
  padding: 12px 30px;
  font-size: 1.1em;
  font-weight: 600;
  background: linear-gradient(
    to right,
    var(--desert-orange),
    var(--desert-yellow)
  );
  color: var(--text-dark);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 250px;
  box-shadow: 0 5px 15px rgba(255, 140, 66, 0.3);
}

.difficulty button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(255, 140, 66, 0.4);
}

.difficulty button:active {
  transform: translateY(0);
}

.game-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
  /* background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 20px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3); */
}

/* Easy difficulty (4x4) */
.game-container.easy {
  max-width: min(95%, 600px);
  gap: 10px;
  top: 10.4%;
  position: relative;
}

.game-container.easy .card {
  width: 100%;
  padding-top: 100%;
}

/* Medium difficulty (6x6) */
.game-container.medium {
  max-width: min(95%, 600px);
  gap: 8px;
}

.game-container.medium .card {
  width: 100%;
  padding-top: 100%;
}

/* Hard difficulty (10x10) */
.game-container.hard {
  max-width: min(95%, 800px);
  gap: 6px;
}

.game-container.hard .card {
  width: 100%;
  padding-top: 100%;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .game-container.easy {
    gap: 8px;
  }

  .game-container.medium {
    gap: 6px;
  }

  .game-container.hard {
    gap: 4px;
  }

  .card-back img {
    width: 90%;
    height: 90%;
  }
}

/* Small mobile screens */
@media (max-width: 480px) {
  #game-screen {
    width: 100%;
  }
  .game-container.easy {
    gap: 6px;
    position: relative;
    top: 13%;
    max-width: min(100%, 600px);
  }

  .game-container {
    padding: 20px 0;
  }

  .game-container.medium {
    gap: 4px;
  }

  .game-container.hard {
    gap: 3px;
  }

  .card-back img {
    width: 85%;
    height: 85%;
  }

  /* Adjust difficulty selector for mobile */
  .difficulty {
    padding: 10px;
  }

  .difficulty select,
  .difficulty button {
    width: 100%;
    margin: 5px 0;
  }
}

.card {
  position: relative;
  perspective: 1000px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.card-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 0;
}

.card-front {
  background-image: url("../../../../images/25/aug/hero/assets/img/locker.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-back {
  background-color: #ffffff;
  transform: rotateY(180deg);
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-back img {
  width: 80%;
  height: 80%;
  border-radius: 10px;
}

.card.matched .card-inner {
  transform: rotateY(180deg);
}

.card.matched .card-back {
  background-color: antiquewhite;
  animation: happyBounce 0.6s ease-in-out;
}

@keyframes happyBounce {
  0%,
  100% {
    transform: rotateY(180deg) scale(1);
  }

  50% {
    transform: rotateY(180deg) scale(1.1);
  }
}

/* .popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  color: #333;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: none;
  z-index: 1000;
  text-align: center;
  width: 90%;
  max-width: 300px;
}

.popup h2 {
  margin: 0 0 15px;
  font-size: 1.8em;
  color: #4caf50;
}

.popup button {
  padding: 12px 24px;
  font-size: 1.1em;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
}

.popup button:hover {
  background: #45a049;
} */

canvas.confetti {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
}

/* Add these new animations */
@keyframes shake {
  0%,
  100% {
    transform: rotateY(180deg) translateX(0);
  }

  20%,
  60% {
    transform: rotateY(180deg) translateX(-5px);
  }

  40%,
  80% {
    transform: rotateY(180deg) translateX(5px);
  }
}

@keyframes flipIn {
  from {
    transform: rotateY(0);
  }

  to {
    transform: rotateY(180deg);
  }
}

.card.flipped .card-inner {
  animation: flipIn 0.6s ease-out forwards;
}

.card.no-match .card-inner {
  animation: shake 0.5s ease-in-out;
}

/* Update the existing matched animation */
.card.matched .card-back {
  background-color: antiquewhite;
  animation: happyBounce 0.6s ease-in-out;
}

@keyframes happyBounce {
  0%,
  100% {
    transform: rotateY(180deg) scale(1);
  }

  50% {
    transform: rotateY(180deg) scale(1.1);
  }
}

.timer-display {
  font-size: 1.2em;
  color: #333;
  padding: 10px;
  margin-top: 10px;
  border-top: 1px solid #eee;
}

#timer {
  font-family: monospace;
  font-weight: bold;
  color: #4caf50;
  font-size: 1.3em;
}

.game-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 10px 0;
  font-size: 1.1em;
  color: #333;
  flex-wrap: wrap;
  background-color: white;
  padding: 12px;
  border-radius: 8px;
}

.game-stats span {
  display: flex;
  align-items: center;
  gap: 5px;
}

#matches-count,
#pairs-left {
  font-weight: bold;
  color: #4caf50;
  min-width: 20px;
  display: inline-block;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .timer-display {
    font-size: 1.1em;
  }

  .game-stats {
    font-size: 1em;
    gap: 20px;
  }
}

/* Music Control Button Styles */
.music-control {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
}

#music-toggle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(
    45deg,
    var(--desert-orange),
    var(--desert-yellow)
  );
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  overflow: hidden;
}

#music-toggle:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

#music-toggle:active {
  transform: translateY(0);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#music-toggle svg {
  fill: var(--text-dark);
  width: 24px;
  height: 24px;
  transition: all 0.3s ease;
}

#music-toggle:hover svg {
  transform: scale(1.1);
}

.congrats-popup {
  visibility: hidden;
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
  #welcome-screen h1 {
    font-size: 4rem;
    letter-spacing: -2px;
  }

  #play-button {
    padding: 12px 40px;
    font-size: 1.2rem;
  }

  .difficulty {
    padding: 15px;
  }

  .difficulty-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .difficulty label {
    margin-bottom: 10px;
  }

  .game-stats {
    padding: 8px;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  #game-screen {
    padding: 15px;
  }
  #welcome-screen h1 {
    font-size: 3rem;
    letter-spacing: -1px;
  }

  #play-button {
    padding: 10px 30px;
    font-size: 1.1rem;
  }

  .music-control {
    bottom: 15px;
    right: 15px;
  }

  #music-toggle {
    width: 45px;
    height: 45px;
  }

  #music-toggle svg {
    width: 20px;
    height: 20px;
  }

  .card-front::after {
    font-size: 1.8rem;
  }

  /* .popup {
    padding: 20px;
    max-width: 280px;
  }

  .popup h2 {
    font-size: 1.5em;
  } */
}

/* Extra small screens */
@media (max-width: 360px) {
  #welcome-screen h1 {
    font-size: 2.5rem;
  }

  .game-container.easy,
  .game-container.medium,
  .game-container.hard {
    gap: 4px;
    padding: 10px;
  }

  .music-control {
    bottom: 10px;
    right: 10px;
  }

  #music-toggle {
    width: 40px;
    height: 40px;
  }

  #music-toggle svg {
    width: 18px;
    height: 18px;
  }

  /* .popup {
    padding: 15px;
    max-width: 250px;
  } */
}

/* Fix touch actions for mobile */
.card {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Fix for iOS devices */
* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Support for landscape mode */
@media (max-height: 500px) and (orientation: landscape) {
  #game-screen {
    padding: 10px;
  }

  .difficulty {
    margin: 10px auto;
    padding: 10px;
  }

  .game-container {
    margin: 10px auto;
    padding: 10px;
  }

  .music-control {
    bottom: 10px;
    right: 10px;
  }

  #music-toggle {
    width: 40px;
    height: 40px;
  }
}
