body {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  background-color: #f0f2f5;
  padding: 20px;
}

h1 {
  color: #333;
  margin-bottom: 8px;
}

.game-info {
  margin-bottom: 15px;
  font-size: 1.1rem;
  color: #444;
}

.game-container {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  max-width: 1000px;
  width: 100%;
}

@media (max-width: 900px) {
  .game-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 600px) {
  .game-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .card {
    height: 90px;
    padding: 4px;
  }
  .card-icon {
    font-size: 2rem;
  }
  .card-text {
    font-size: 0.9rem;
  }
  .copy-btn,
  .speak-btn {
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
  }
  h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
  }
  body {
    padding: 10px;
  }
}

.card {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  border: 3px solid transparent;
  padding: 8px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.card.selected {
  border-color: #3498db;
  background-color: #e8f4fc;
  transform: scale(1.05);
}

.card.matched {
  background-color: #2ecc71;
  color: white;
  border-color: #2ecc71;
  cursor: default;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: visibility 0s 0.5s, opacity 0.5s linear;
}

.card.wrong {
  background-color: #e74c3c;
  color: white;
  animation: shake 0.4s;
  border-color: #c0392b;
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: 5px;
  line-height: 1;
}

.card-text {
  font-size: 1rem;
  font-weight: bold;
  color: #444;
  word-break: break-word;
  line-height: 1.2;
}

.card.wrong .card-text,
.card.wrong .card-icon {
  color: white;
}

.speak-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.copy-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.card:hover .copy-btn,
.card:hover .speak-btn {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .copy-btn,
  .speak-btn {
    opacity: 1;
    pointer-events: auto;
  }
}

.card.matched .copy-btn,
.card.matched .speak-btn {
  display: none;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}

.victory-message {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  text-align: center;
  z-index: 100;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.victory-message h2 {
  color: #2ecc71;
  font-size: 2rem;
  margin-top: 0;
  margin-bottom: 10px;
}

.restart-btn {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 30px;
  font-size: 1.1rem;
  cursor: pointer;
  margin-top: 20px;
  font-weight: bold;
  box-shadow: 0 4px 6px rgba(52, 152, 219, 0.3);
  transition: transform 0.1s, box-shadow 0.1s;
}

.restart-btn:hover {
  background-color: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(52, 152, 219, 0.4);
}

.restart-btn:active {
  transform: translateY(1px);
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}
