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

:root {
  --primary: #4f8cff;
  --primary-dark: #3a6fd8;
  --bg: #f4f6fb;
  --card-shadow: 0 12px 30px rgba(79, 140, 255, 0.18);
}

html, body {
  height: 100%;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: #2c2c2c;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.title {
  font-size: 22px;
  font-weight: 600;
  color: #1f2937;
  letter-spacing: 1px;
}

/* ---------- 卡片 ---------- */
.card-stage {
  width: 360px;
  height: 240px;
  perspective: 1200px;
  cursor: pointer;
}

.card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
}

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

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: var(--card-shadow);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-front {
  gap: 0;
}

.word {
  font-size: 64px;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: 2px;
  user-select: none;
}

.card-back {
  transform: rotateY(180deg);
  gap: 28px;
}

.phonetic {
  font-size: 38px;
  color: var(--primary-dark);
  font-family: "Lucida Sans Unicode", "Segoe UI", sans-serif;
  letter-spacing: 1px;
}

.speak-btn {
  font-size: 18px;
  padding: 10px 28px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.speak-btn:hover {
  background: var(--primary-dark);
}

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

/* ---------- 底部 ---------- */
.footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.progress {
  font-size: 16px;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  gap: 10px;
}

.unknown-btn {
  font-size: 16px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: #f59e0b;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.unknown-btn:hover {
  background: #d97706;
}

.unknown-btn:active {
  transform: scale(0.97);
}

.next-btn {
  font-size: 16px;
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  background: #1f2937;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.next-btn:hover {
  background: #374151;
}

.next-btn:active {
  transform: scale(0.97);
}

/* ---------- 遮罩弹层 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-mask.show {
  display: flex;
}

.modal {
  width: 300px;
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 20px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  animation: pop 0.25s ease;
}

@keyframes pop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.modal-text {
  font-size: 17px;
  line-height: 1.6;
  color: #1f2937;
  margin-bottom: 22px;
}

.modal-title {
  font-size: 17px;
  line-height: 1.6;
  color: #1f2937;
  margin-bottom: 18px;
  text-align: center;
}

.stats {
  background: #f4f6fb;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.stat-row + .stat-row {
  border-top: 1px solid #e5e9f2;
}

.stat-label {
  font-size: 15px;
  color: #6b7280;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-unknown {
  color: #f59e0b;
}

.stat-rate {
  color: #16a34a;
}

.modal-sub {
  font-size: 13px;
  color: #9ca3af;
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-btn {
  font-size: 15px;
  padding: 9px 22px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #e5e7eb;
  color: #374151;
  transition: background 0.2s;
}

.modal-btn:hover {
  background: #d1d5db;
}

.modal-btn-primary {
  background: var(--primary);
  color: #fff;
}

.modal-btn-primary:hover {
  background: var(--primary-dark);
}

/* ---------- 小屏适配 ---------- */
@media (max-width: 420px) {
  .card-stage {
    width: 88vw;
    height: 58vw;
  }
  .word {
    font-size: 13vw;
  }
  .phonetic {
    font-size: 8vw;
  }
}
