/* 西班牙语陪练 · 练习页样式（移动端优先） */
:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2b2320;
  --muted: #8a7d75;
  --accent: #e8590c;
  --accent-soft: #ffe8d6;
  --ok: #2f9e44;
  --bad: #e03131;
  --line: #ede5dc;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(60, 40, 20, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1714;
    --card: #2a221d;
    --ink: #f3ece4;
    --muted: #a89a8e;
    --accent: #ff922b;
    --accent-soft: #3d2c1d;
    --line: #3d332b;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px 6px;
  max-width: 680px;
  margin: 0 auto;
}
.brand h1 { font-size: 17px; margin: 0; white-space: nowrap; }
.brand select {
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  max-width: 46vw;
}
/* 练习场头部：课程下拉（M1 从顶栏移入练习场） */
.practice-head { margin-bottom: 10px; }
.practice-head select {
  width: 100%;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 6px 14px 10px;
  max-width: 680px;
  margin: 0 auto;
}
.tab {
  flex: 1;
  font-size: 14px;
  padding: 8px 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* 内容 */
.content {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 20px;
  text-align: center;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.vocab-es { font-size: 34px; font-weight: 700; letter-spacing: 0.5px; }
.zh-text { font-size: 22px; }
.cognate {
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 14px;
  margin-top: 6px;
}
.example {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
  font-size: 15px;
  position: relative;
  width: 100%;
}
.example-es { font-style: italic; }
.example-zh { color: var(--muted); font-size: 13px; }
.example .sound-btn { position: absolute; top: 8px; right: 8px; }

/* 按钮 */
.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn:disabled { opacity: 0.4; }
.controls {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.controls .btn { flex: 1; padding: 12px 6px; font-size: 14px; }
.progress { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }

.sound-btn {
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.sound-btn.big { width: auto; height: auto; border-radius: 999px; font-size: 17px; padding: 14px 30px; }
.play-big { display: block; margin: 8px auto 18px; }

/* 听辨 */
.listen-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
}
.score { color: var(--muted); font-size: 14px; }
.listen-options { display: flex; gap: 10px; }
.listen-options .btn {
  flex: 1;
  font-size: 22px;
  font-weight: 700;
  padding: 18px 8px;
}
.btn.correct { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.wrong { background: var(--bad); border-color: var(--bad); color: #fff; }
.feedback {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 15px;
  background: var(--accent-soft);
}
.feedback.ok { background: rgba(47, 158, 68, 0.12); }
.feedback.no { background: rgba(224, 49, 49, 0.12); }
.feedback .btn { margin-top: 10px; }

/* 列表（跟读/听写） */
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.item .es { font-size: 19px; font-weight: 600; }
.item-no {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 6px;
}
.item .zh { color: var(--muted); font-size: 14px; margin-top: 2px; }
.item .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.item .actions .btn { padding: 8px 12px; font-size: 14px; }
.item.recording { border-color: var(--bad); }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); margin-right: 6px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

.dict-input {
  width: 100%;
  margin-top: 10px;
  font-size: 17px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}
.dict-result { margin-top: 8px; font-size: 15px; }
.dict-result.ok { color: var(--ok); }
.dict-result.no { color: var(--bad); }
.dict-answer { color: var(--muted); font-size: 14px; margin-top: 4px; }

.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; white-space: normal; overflow-wrap: break-word; }
.notice {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  margin-bottom: 14px;
}
.hidden { display: none !important; }
.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 20px 0 30px;
}

/* 词汇卡顶部：复习模式开关 */
.vocab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.srs-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}
.srs-toggle input {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.srs-toggle input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: left 0.2s;
}
.srs-toggle input:checked { background: var(--accent); }
.srs-toggle input:checked::after { left: 20px; }
.srs-hint { color: var(--muted); font-size: 12px; text-align: right; white-space: normal; overflow-wrap: break-word; }
.review-empty {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius);
  padding: 30px 14px;
  margin-bottom: 12px;
}

/* 今日统计条（footer 上方） */
.stats-bar {
  max-width: 680px;
  margin: 0 auto;
  padding: 4px 14px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.stats-bar .badge { display: inline-block; }

/* 发音评分结果 */
.score-result {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  background: var(--accent-soft);
  color: var(--ink);
}
.score-result.good { background: rgba(47, 158, 68, 0.12); color: var(--ok); }
.score-result.mid { background: var(--accent-soft); color: var(--accent); }
.score-result.bad { background: rgba(224, 49, 49, 0.12); color: var(--bad); }
.score-result .rec-text { color: var(--muted); font-size: 13px; margin-top: 4px; }
.btn.score-na { opacity: 0.55; }

/* 播放失败提示（固定底部，自动消失） */
.play-toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%) translateY(8px);
  max-width: min(92vw, 520px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(30, 30, 38, 0.92);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 99;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.play-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-theme="light"] .play-toast { background: rgba(40, 40, 48, 0.94); }

/* 报告页（v0.6） */
.report-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.report-card { flex: 1; min-width: 120px; padding: 12px 10px; border-radius: 12px; background: var(--card-soft, rgba(128,128,160,0.08)); text-align: center; }
.rc-num { font-size: 26px; font-weight: 700; color: var(--accent, #4c9f6a); }
.rc-label { font-size: 12px; color: var(--muted, #9a9ab0); margin-top: 4px; }
.report-h3 { margin: 16px 0 8px; font-size: 14px; }
.report-heatmap { overflow-x: auto; padding: 4px 0; }
.report-heatmap svg { display: block; }

/* ===================== 游乐场（v0.8） ===================== */
.pg-subnav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pg-chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pg-chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.pg-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pg-chip-sm { font-size: 13px; padding: 6px 12px; font-weight: 500; }

/* 认一认：3D 翻面大卡 */
.pg-flipwrap {
  perspective: 1000px;
  height: 300px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pg-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.pg-card-inner.is-flipped { transform: rotateY(180deg); }
.pg-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
}
.pg-face.pg-back { transform: rotateY(180deg); }
.pg-emoji { font-size: 88px; line-height: 1.1; }
.pg-word { font-size: 40px; font-weight: 700; letter-spacing: 1px; color: var(--accent); }
.pg-word-sm { font-size: 26px; font-weight: 700; color: var(--accent); }
.pg-zh { font-size: 22px; }
.pg-example {
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 15px;
  font-style: italic;
  max-width: 100%;
}
.pg-example span { font-style: normal; color: var(--muted); font-size: 13px; }
.pg-taphint { color: var(--muted); font-size: 12px; }
.pg-ctrls { display: flex; gap: 8px; margin-top: 12px; }
.pg-ctrls .btn { flex: 1; padding: 12px 6px; font-size: 14px; white-space: nowrap; }

/* 配一配 / 听音找图：卡片网格 */
.pg-match-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 28px; }
.pg-taphint-inline { color: var(--muted); font-size: 13px; }
.pg-cheer { color: var(--ok); font-weight: 700; font-size: 15px; }
.pg-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pg-mcard {
  position: relative;
  aspect-ratio: 3 / 4;
  perspective: 600px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pg-minner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.pg-mcard.is-up .pg-minner { transform: rotateY(180deg); }
.pg-mface {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
}
.pg-mback { background: var(--accent-soft); font-size: 24px; }
.pg-mfront {
  transform: rotateY(180deg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.pg-mfront { font-size: 32px; }
.pg-mfront b { font-size: 14px; font-weight: 700; padding: 4px; overflow-wrap: break-word; }
.pg-mcard.is-matched { pointer-events: none; animation: pgPop 0.4s ease; }
.pg-mcard.is-matched .pg-mfront { opacity: 0.28; border-color: var(--ok); }
.pg-mcard.is-shake { animation: pgShake 0.4s ease; }

/* 听音找图选项卡 */
.pg-pick {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px;
  -webkit-tap-highlight-color: transparent;
}
.pg-pick-emoji { font-size: 42px; line-height: 1.15; }
.pg-pick-word { font-size: 13px; font-weight: 700; color: var(--accent); }
.pg-pick.is-right { border-color: var(--ok); background: rgba(47, 158, 68, 0.12); }
.pg-pick.is-wrong { opacity: 0.5; }
.pg-pick:disabled { cursor: default; }
.pg-pick.is-shake { animation: pgShake 0.45s ease; }

/* 字母启蒙卡 */
.pg-letter-card { text-align: left; gap: 8px; padding: 18px 16px; }
.pg-letter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pg-letter { font-size: 56px; font-weight: 800; color: var(--accent); line-height: 1; min-width: 64px; }
.pg-mouth {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 14px;
  padding: 6px;
  width: 136px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pg-mouth-svg { display: block; width: 100%; height: auto; }
.pg-mouth.playing .pg-mouth-svg { animation: pgTalk 0.9s ease; }
.pg-tip { color: var(--muted); font-size: 14px; line-height: 1.55; }

/* 彩带庆祝 */
.pg-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 98;
  overflow: hidden;
}
.pg-confetti span {
  position: absolute;
  top: -40px;
  animation: pgFall 2.6s ease-in forwards;
}

@keyframes pgPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
@keyframes pgShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
@keyframes pgTalk {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.1, 0.92); }
  50% { transform: scale(0.94, 1.06); }
  75% { transform: scale(1.06, 0.96); }
}
@keyframes pgFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0.2; }
}
