:root {
  --pink: #ff7eb3;
  --pink-soft: #ffe3ef;
  --teal: #2bb3a3;
  --teal-soft: #d9f5f0;
  --yellow: #ffd166;
  --ink: #3a3a4a;
  --muted: #8a8aa0;
  --bg: #fff7fb;
  --card: #ffffff;
  --ok: #2ecc71;
  --ok-soft: #e6f9ee;
  --no: #b8b8c8;
  --shadow: 0 6px 18px rgba(255, 126, 179, 0.15);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  background: linear-gradient(120deg, var(--pink-soft), var(--teal-soft));
  border-bottom: 3px solid #fff;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 34px; }
.site-header h1 {
  margin: 0;
  font-size: 26px;
  color: var(--pink);
  letter-spacing: 0.5px;
}
.subtitle { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.header-right { display: flex; align-items: center; gap: 12px; }
.global-stat { font-size: 13px; color: var(--teal); font-weight: 600; }
.ghost-btn {
  border: 2px solid var(--teal);
  background: #fff;
  color: var(--teal);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
}
.ghost-btn:hover { background: var(--teal); color: #fff; }

/* ---------- Week / Day nav ---------- */
.week-nav {
  display: flex;
  gap: 8px;
  padding: 12px 22px 4px;
  flex-wrap: wrap;
}
.week-tab {
  border: none;
  background: #fff;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
/* 完成态: 蓝色填充 (active 当前选中优先于 done) */
.week-tab.done { background: #3b82f6; color: #fff; }
.week-tab.active { background: var(--pink); color: #fff; font-weight: 700; }

.day-nav {
  display: flex;
  gap: 6px;
  padding: 8px 22px 14px;
  flex-wrap: wrap;
  border-bottom: 1px dashed #ffe0ee;
}
.day-chip {
  min-width: 38px;
  border: 2px solid #ffe0ee;
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 5px 8px;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: 0.15s;
}
.day-chip:hover { border-color: var(--pink); }
/* 完成态: 蓝色填充 (active 当前选中优先于 done) */
.day-chip.done { background: #3b82f6; border-color: #3b82f6; color: #fff; font-weight: 700; }
.day-chip.done .dot { background: #fff; }
.day-chip.active { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 700; }
.day-chip.today { box-shadow: 0 0 0 3px var(--yellow); }
.day-chip .dot {
  display: block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin: 3px auto 0;
  background: var(--no);
}
.day-chip .dot.done { background: var(--ok); }

/* ---------- Progress ---------- */
.progress-wrap {
  padding: 10px 22px;
  font-size: 14px;
  color: var(--ink);
}
.progress-line { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.progress-line b { color: var(--pink); }
.bar {
  flex: 1;
  min-width: 160px;
  height: 12px;
  background: #ffe6f1;
  border-radius: 999px;
  overflow: hidden;
}
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--teal)); width: 0; }

/* ---------- Sections ---------- */
.container { padding: 6px 22px 40px; }
.section { margin-top: 18px; }
.section-title { font-size: 19px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.count-pill {
  font-size: 12px;
  background: var(--pink-soft);
  color: var(--pink);
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* ---------- Word card ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 2px solid #fff;
  transition: 0.2s;
}
.card.passed { border-color: var(--ok); background: var(--ok-soft); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.word-block { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.word { font-size: 22px; font-weight: 800; color: var(--ink); }
.phon { font-size: 13px; color: var(--muted); }
.pos { font-size: 12px; color: var(--teal); background: var(--teal-soft); padding: 1px 7px; border-radius: 6px; }

/* 音节拆分: 纯文本展示, 如 fam-i-ly (不发音) */
.syllables { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 2px; font-size: 14px; color: var(--muted); }
.syll-label { font-size: 12px; color: var(--teal); background: var(--teal-soft); padding: 1px 7px; border-radius: 6px; font-weight: 700; }
.syllables .syll-text { color: var(--ink); font-weight: 700; letter-spacing: 0.5px; }
.badge {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 700;
}
.badge.ok { background: var(--ok); color: #fff; }
.badge.no { background: var(--no); color: #fff; }

.meaning { margin: 6px 0 8px; font-size: 15px; color: var(--ink); }
.example {
  font-size: 14px;
  color: #555;
  background: #fff8fc;
  border-left: 3px solid var(--pink);
  padding: 7px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}
/* 中文译文 */
.ex-zh {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: var(--teal);
  font-weight: 600;
}

.audio-btn {
  border: none;
  background: var(--yellow);
  color: #6b4e00;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
  margin: 3px 4px 0 0;
  font-weight: 700;
}
.audio-btn:hover { filter: brightness(1.05); }
.audio-btn:active { transform: scale(0.96); }

.actions { margin-top: 6px; }
.practice-btn {
  border: 2px solid var(--teal);
  background: #fff;
  color: var(--teal);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 700;
}
.practice-btn:hover { background: var(--teal); color: #fff; }

.reset-btn {
  border: 2px solid #c9c9d6;
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 700;
}
.reset-btn:hover { background: #c9c9d6; color: #fff; }
/* 未通过时置灰, 表示"恢复"暂不可用(通过后才可点) */
.reset-btn.is-disabled { opacity: 0.45; cursor: not-allowed; border-color: #eee; color: #bbb; background: #fafafa; }
.reset-btn.is-disabled:hover { background: #fafafa; color: #bbb; }

.practice {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #eee;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
/* 未点击"练习"前必须隐藏: 覆盖上面的 display:flex (否则输入框默认就显示) */
.practice[hidden] { display: none; }
/* 练习时模糊化: 原文/单词/音节/中英译文看不清, 但音频按钮仍可点 */
.card.blur-mode .word-block,
.card.blur-mode .syllables,
.card.blur-mode .meaning .blur-target,
.card.blur-mode .example .ex-text,
.card.blur-mode .example .ex-zh {
  filter: blur(7px);
  user-select: none;
  pointer-events: none;
}

.practice input {
  flex: 1;
  min-width: 120px;
  border: 2px solid #ffe0ee;
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 15px;
  outline: none;
}
.practice input:focus { border-color: var(--pink); }
.submit-btn {
  border: none;
  background: var(--pink);
  color: #fff;
  border-radius: 10px;
  padding: 7px 16px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 700;
}
.submit-btn:hover { filter: brightness(1.05); }
.pf { font-size: 13px; font-weight: 700; }
.pf.ok { color: var(--ok); }
.pf.no { color: #e74c3c; }

/* ---------- Test placeholder + 测试弹窗 ---------- */
.test-placeholder {
  margin-top: 26px;
  background: linear-gradient(120deg, #fff6e0, #ffe9f3);
  border: 2px dashed var(--pink);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
}
.test-placeholder h3 { margin: 0 0 6px; color: var(--pink); }
.test-placeholder p { margin: 4px 0; color: var(--ink); font-size: 14px; }
.test-start-btn {
  margin-top: 10px;
  border: none;
  background: var(--pink);
  color: #fff;
  border-radius: 999px;
  padding: 9px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255,126,179,0.3);
}
.test-start-btn:hover { filter: brightness(1.05); }
.test-start-btn.ghost {
  background: #fff;
  color: var(--pink);
  border: 2px solid var(--pink);
  box-shadow: none;
}

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(58,58,74,0.45);
  display: none;                 /* 默认隐藏, 由 .open 类控制显示 */
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}
.modal.open { display: flex; }  /* 显示弹窗的唯一开关 */
.modal[hidden] { display: none; }
.modal-box {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 26px 28px;
  width: min(560px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 18px 50px rgba(0,0,0,0.25);
}
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  z-index: 5;
  border: none;
  background: #f3e6ee;
  color: var(--muted);
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: var(--pink); color: #fff; }

.test-progress {
  font-size: 13px;
  color: var(--teal);
  font-weight: 700;
  margin-bottom: 14px;
}
.test-q {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 14px;
}
.test-q b { color: var(--pink); }
.test-input-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.test-input-row input {
  flex: 1;
  min-width: 140px;
  border: 2px solid #ffe0ee;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  outline: none;
}
.test-input-row input:focus { border-color: var(--pink); }
.test-feedback {
  margin-top: 12px;
  font-size: 15px;
  font-weight: 700;
  min-height: 22px;
}
.test-feedback.ok { color: var(--ok); }
.test-feedback.no { color: #e74c3c; }
.test-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed #ecd9e4;
}
.test-exit-btn {
  background: #f3e6ee;
  color: var(--muted);
  border: 1.5px solid #e6c6d6;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.test-exit-btn:hover { background: var(--pink); color: #fff; border-color: var(--pink); }
.test-summary { text-align: center; }
.test-summary h3 { color: var(--pink); margin: 0 0 10px; }
.test-summary p { font-size: 15px; margin: 6px 0; }
.test-summary b { color: var(--pink); }
.wrong-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 10px 0;
}
.wrong-chip {
  background: #fff0f5;
  border: 1.5px solid var(--pink);
  color: var(--pink);
  border-radius: 999px;
  padding: 4px 13px;
  font-weight: 700;
  font-size: 14px;
}
.test-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 18px;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid #f3e6ee;
}

@media (max-width: 520px) {
  .site-header h1 { font-size: 21px; }
  .card-grid { grid-template-columns: 1fr; }
}
