/* ==================== Fonts & Reset ==================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #6563FF;
  --secondary-color: #FF6B9D;
  --accent-color: #FFD93D;
  --success-color: #00D9A6;
  --text-dark: #2D3436;
  --text-light: #636E72;
  --bg-light: #F8F9FA;
  --card-bg: #FFFFFF;
  --shadow: 0 10px 30px rgba(101, 99, 255, 0.2);
  --shadow-hover: 0 15px 40px rgba(101, 99, 255, 0.3);
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
/* ==================== Game Header ==================== */
.game-header {
  text-align: center;
  padding: 2rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.game-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

.title-icon {
  width: 45px;
  height: 45px;
  stroke: white;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

.game-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0.5rem 0 0;
}

/* ==================== Game Container ==================== */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  gap: 1.5rem;
}

/* ==================== Stats Panel ==================== */
.stats-panel {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: rgba(255, 255, 255, 0.95);
  padding: 1.25rem 2rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-icon {
  width: 40px;
  height: 40px;
  stroke: var(--primary-color);
/* Email: 2952671670@qq.com */
  padding: 8px;
  background: rgba(101, 99, 255, 0.1);
  border-radius: 10px;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-light);
/* Project: GameHub */
  font-weight: 500;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}

.reset-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(101, 99, 255, 0.3);
}

.reset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(101, 99, 255, 0.4);
}

.reset-btn:active {
  transform: translateY(0);
}

.reset-btn svg {
  width: 20px;
  height: 20px;
  stroke: white;
}

/* ==================== Cards Wrapper ==================== */
.wrapper {
  padding: 2rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.cards,
.card,
.view {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cards {
  height: 420px;
  width: 420px;
  flex-wrap: wrap;
  justify-content: space-between;
  list-style: none;
  gap: 12px;
}

.cards .card {
  cursor: pointer;
  list-style: none;
  user-select: none;
  position: relative;
  perspective: 1000px;
  transform-style: preserve-3d;
  height: calc(100% / 4 - 12px);
  width: calc(100% / 4 - 12px);
  transition: transform 0.2s ease;
}

.cards .card:hover {
  transform: scale(1.05);
}
.card.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0) rotate(0deg);
  }
  20% {
    transform: translateX(-10px) rotate(-5deg);
  }
  40% {
    transform: translateX(10px) rotate(5deg);
  }
  60% {
    transform: translateX(-6px) rotate(-3deg);
  }
  80% {
    transform: translateX(6px) rotate(3deg);
  }
}
.card .view {
  width: 100%;
  height: 100%;
  position: absolute;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  pointer-events: none;
  backface-visibility: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card .front-view {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.card .front-view img {
  width: 24px;
  filter: brightness(0) invert(1);
}

.card .back-view {
  transform: rotateY(-180deg);
  background: white;
}

.card .back-view img {
  max-width: 50px;
}

.card.flip .back-view {
  transform: rotateY(0);
}

.card.flip .front-view {
  transform: rotateY(180deg);
}

.card.matched .view {
  animation: matchSuccess 0.6s ease;
}

@keyframes matchSuccess {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* ==================== Victory Modal ==================== */
.victory-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.victory-modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: white;
  padding: 3rem 2.5rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.8);
  transition: transform 0.3s ease;
  max-width: 400px;
  width: 90%;
}

.victory-modal.active .modal-content {
  transform: scale(1);
  animation: modalBounce 0.6s ease;
}

@keyframes modalBounce {
  0% {
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.victory-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: rotate 2s ease-in-out infinite;
}

@keyframes rotate {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(10deg);
  }
}

.modal-content h2 {
  font-size: 2rem;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.modal-content p {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 2rem;
}

.victory-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2rem;
}

.victory-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.victory-stat .label {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 500;
}

.victory-stat .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
}

.play-again-btn {
  padding: 1rem 2.5rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(101, 99, 255, 0.3);
}

.play-again-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(101, 99, 255, 0.4);
}

.play-again-btn:active {
  transform: translateY(0);
}

/* ==================== Responsive Design ==================== */
@media screen and (max-width: 768px) {
  .game-title {
    font-size: 2rem;
  }
/* Made with love by SinceraXY */

  .title-icon {
    width: 35px;
    height: 35px;
  }

  .stats-panel {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .reset-btn {
    width: 100%;
    justify-content: center;
  }

  .cards {
    height: 370px;
    width: 370px;
  }

  .card .front-view img {
    width: 20px;
  }

  .card .back-view img {
    max-width: 42px;
  }

  .wrapper {
    padding: 1.5rem;
  }
}

@media screen and (max-width: 530px) {
  .game-header {
    padding: 1.5rem 1rem;
  }

  .game-title {
    font-size: 1.75rem;
  }

  .game-subtitle {

/* GitHub: https://github.com/nilgpt2024/web-game */

    font-size: 1rem;
  }

  .stats-panel {
    width: 100%;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .cards {
    height: 320px;
    width: 320px;
    gap: 8px;
  }

  .cards .card {
    height: calc(100% / 4 - 8px);
    width: calc(100% / 4 - 8px);
  }

  .card .front-view img {
    width: 18px;
  }

  .card .back-view img {
    max-width: 38px;
  }

  .wrapper {
    padding: 1.25rem;
  }

  .modal-content {
    padding: 2rem 1.5rem;
  }

  .victory-icon {
    font-size: 4rem;
  }

  .modal-content h2 {
    font-size: 1.75rem;
  }

  .victory-stats {
    gap: 2rem;
  }

  .victory-stat .value {
    font-size: 1.75rem;
  }
}