/* 雅思冲分 · IELTS Prep —— 主样式表 */

:root {
  --blue: #2f6fed;
  --purple: #7c5cff;
  --ink: #16233a;
  --sub: #6b7a90;
  --line: #e6e9ef;
  --bg: #f6f8fc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

/* ---------- 顶栏与标签 ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand { font-size: 20px; font-weight: 700; letter-spacing: 0.3px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--sub);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.tab:hover { color: var(--blue); border-color: #c9d9ff; }

.tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(47, 111, 237, 0.28);
}

/* ---------- 视图 ---------- */
.view { display: none; }
.view.active { display: block; animation: fade 0.22s ease; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.view-head { margin-bottom: 16px; }
.view-head h2 { font-size: 19px; margin: 0 0 6px; }
.hint { color: var(--sub); font-size: 13px; margin: 0; }

/* ---------- 按钮 ---------- */
.btn {
  border: none;
  background: var(--blue);
  color: #fff;
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn:hover { background: #245dd0; }

.btn.ghost {
  background: #fff;
  color: var(--sub);
  border: 1px solid var(--line);
}

.btn.ghost:hover { color: var(--blue); border-color: #c9d9ff; }
.btn.ghost.active { color: var(--blue); border-color: var(--blue); background: #f0f6ff; }
.btn.mini { padding: 5px 11px; font-size: 12px; margin-top: 6px; }

/* ---------- 筛选 chip ---------- */
.phrase-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--sub);
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.chip:hover { color: var(--blue); border-color: #c9d9ff; }
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- 词汇开关 ---------- */
.vocab-toolbar { display: flex; gap: 18px; margin-bottom: 4px; flex-wrap: wrap; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--sub); cursor: pointer; }
.switch input { accent-color: var(--blue); }

/* ---------- 翻转卡片 ---------- */
.card-stage { perspective: 1400px; margin: 16px 0; }

.flip-card { width: 100%; max-width: 560px; height: 260px; margin: 0 auto; cursor: pointer; }

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

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

.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: 0 8px 26px rgba(20, 30, 60, 0.09);
}

.flip-face.front { background: linear-gradient(135deg, #4a86ff, #7c5cff); color: #fff; }

.flip-face.back {
  background: #fff;
  border: 1px solid var(--line);
  transform: rotateY(180deg);
  align-items: flex-start;
  text-align: left;
  overflow-y: auto;
}

.flip-face .word { font-size: 34px; font-weight: 700; letter-spacing: 0.5px; }
.flip-face .pos { margin-top: 8px; font-size: 13px; opacity: 0.9; }
.flip-face .pinyin { margin-top: 6px; font-size: 14px; opacity: 0.85; }
.flip-face .tip { position: absolute; bottom: 16px; font-size: 12px; opacity: 0.7; }
.flip-face .meaning { font-size: 20px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.flip-face .example { font-size: 14px; color: #4a5568; line-height: 1.7; }

.card-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.counter { text-align: center; color: var(--sub); font-size: 13px; }

/* ---------- 折叠列表 ---------- */
.grammar-list { display: flex; flex-direction: column; gap: 10px; }

.group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 1px;
  margin: 14px 0 2px;
  text-transform: uppercase;
}

.grammar-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }

.grammar-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.grammar-head .arrow { color: var(--sub); font-size: 11px; transition: transform 0.25s ease; }
.grammar-item.open .arrow { transform: rotate(90deg); }

.grammar-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.grammar-item.open .grammar-body { max-height: 620px; }

.grammar-body-inner { padding: 0 16px 16px; font-size: 14px; color: #44506a; line-height: 1.8; }

.grammar-body-inner .eg {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f5f9ff;
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  font-size: 13.5px;
  color: #2b3d5c;
  white-space: pre-line;
}

/* ---------- 口语列表 ---------- */
.phrase-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }

.phrase-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.phrase-item:hover { box-shadow: 0 6px 20px rgba(20, 30, 60, 0.08); transform: translateY(-2px); }

.phrase-foreign { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.phrase-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f0ff;
  color: var(--blue);
  font-weight: 500;
}

.speak-questions { margin: 10px 0; padding-left: 20px; color: #44506a; font-size: 13.5px; }
.speak-questions li { margin-bottom: 3px; }

.speak-sample {
  font-size: 13.5px;
  color: #2b3d5c;
  background: #f5f9ff;
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  padding: 10px 12px;
  line-height: 1.8;
}

.speak-words { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.word-chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #e9f8f1; color: #0f9d6b; }

/* ---------- 测验 ---------- */
.quiz-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(20, 30, 60, 0.04);
}

.quiz-progress { font-size: 13px; color: var(--sub); margin-bottom: 10px; }
.quiz-question { font-size: 17px; font-weight: 600; margin-bottom: 16px; line-height: 1.6; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }

.quiz-option {
  text-align: left;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14.5px;
  cursor: pointer;
  transition: all 0.16s ease;
  color: var(--ink);
}

.quiz-option:hover:not(.disabled) { border-color: var(--blue); background: #f7faff; }
.quiz-option.correct { border-color: #0f9d6b; background: #e9f8f1; color: #0b7a52; }
.quiz-option.wrong { border-color: #e5484d; background: #fdecec; color: #b3282c; }
.quiz-option.disabled { cursor: default; }

.quiz-feedback { margin-top: 14px; font-size: 13.5px; color: #44506a; min-height: 20px; line-height: 1.7; }

.quiz-result { text-align: center; padding: 26px 20px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.quiz-score { font-size: 17px; font-weight: 600; white-space: pre-line; margin-bottom: 18px; line-height: 1.8; }
.quiz-review { text-align: left; margin-bottom: 18px; }

.review-item {
  font-size: 13.5px;
  padding: 10px 12px;
  background: #fdf6f6;
  border-left: 3px solid #e5484d;
  border-radius: 6px;
  margin-bottom: 8px;
  line-height: 1.8;
}

/* ---------- 词汇量目标 ---------- */
.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.goal-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(20, 30, 60, 0.04);
}

.goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.goal-name { font-size: 14px; font-weight: 600; color: #33415c; }
.goal-num { font-size: 22px; font-weight: 700; color: var(--blue); }
.goal-desc { font-size: 12px; color: var(--sub); margin: 6px 0 12px; }

.goal-track { height: 10px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.goal-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4a86ff, #7c5cff);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.goal-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--sub); margin-top: 8px; gap: 10px; }

/* ---------- 进度 ---------- */
.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.progress-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.progress-num { font-size: 22px; font-weight: 700; color: var(--blue); }
.progress-label { font-size: 12.5px; color: var(--sub); margin-top: 4px; }
.progress-actions { margin-bottom: 24px; }

.star-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }

.star-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.18s ease;
}

.star-item:hover { border-color: var(--blue); }
.star-word { font-weight: 600; font-size: 14.5px; }
.star-meaning { font-size: 13px; color: var(--sub); }
.empty { color: #98a2b3; font-size: 13px; padding: 10px 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .tabs { margin-left: 0; width: 100%; }
  .flip-card { height: 230px; }
  .flip-face .word { font-size: 28px; }
  .brand { font-size: 17px; }
  .goal-foot { flex-direction: column; gap: 2px; }
}

/* 首屏加载遮罩 */
.app-loading { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: #f5f7fa; transition: opacity .3s; }
.app-loading.hide { opacity: 0; pointer-events: none; }
.app-loading-box { text-align: center; color: #6b7280; font-size: 14px; }
.spinner { width: 36px; height: 36px; margin: 0 auto 14px; border: 3px solid #dbeafe; border-top-color: #4c8bf5; border-radius: 50%; animation: appspin .8s linear infinite; }
@keyframes appspin { to { transform: rotate(360deg); } }
