/* ===== 单词卡片 ===== */
.card-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 26px;
}

.card-controls .btn { padding: 10px 22px; font-size: 14px; }

/* 网格 */
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

/* 卡片 */
.word-card {
  position: relative;
  aspect-ratio: 4 / 5;
  perspective: 900px;
  cursor: pointer;
}

.word-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform .5s cubic-bezier(.4, .2, .2, 1);
  transform-style: preserve-3d;
}

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

.word-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 14px 10px;
  border-radius: 18px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #fff;
  box-shadow: 0 8px 22px rgba(120, 90, 150, .13);
  border: 3px solid #ffe9d6;
}

.word-front { border-color: #ffe0c2; }

.word-back {
  transform: rotateY(180deg);
  border-color: #d7e6ff;
  background: linear-gradient(180deg, #f7fbff, #eef5ff);
}

.word-emoji { font-size: clamp(34px, 6vw, 46px); line-height: 1.1; margin-bottom: 4px; }

.word-en {
  font-size: clamp(17px, 2.6vw, 21px);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: .3px;
  text-align: center;
  word-break: break-word;
}

.word-zh {
  font-size: clamp(18px, 3vw, 23px);
  font-weight: 900;
  color: var(--blue);
}

.word-unit {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #b3aabf;
  font-weight: 600;
  white-space: nowrap;
}

/* 朗读按钮 */
.speak-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: #fff3e6;
  font-size: 16px;
  cursor: pointer;
  transition: .18s;
  z-index: 3;
}

.speak-btn:hover { background: #ffe0c2; transform: scale(1.1); }

.speak-btn:active { transform: scale(.92); }

.speak-btn.playing { background: var(--orange); animation: ring 1s infinite; }

@keyframes ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 138, 61, .5); }
  50% { box-shadow: 0 0 0 8px rgba(255, 138, 61, 0); }
}

/* 随机抽中的卡片高亮 */
.word-card.pop { animation: popIn .5s cubic-bezier(.2, 1.5, .5, 1); }

@keyframes popIn {
  0% { transform: scale(.85); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* 提示条 */
.tts-warn {
  margin: 0 auto 22px;
  max-width: 560px;
  padding: 12px 18px;
  border-radius: 14px;
  background: #fff6e5;
  border: 2px dashed #ffd9a8;
  color: #a8763a;
  font-size: 14px;
  text-align: center;
}

@media (max-width: 480px) {
  .word-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .word-face { border-radius: 14px; border-width: 2px; padding: 10px 6px; }
  .word-unit { font-size: 10px; bottom: 5px; }
  .speak-btn { width: 28px; height: 28px; font-size: 14px; top: 5px; right: 5px; }
}
