* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #1e2430;
  --sub: #6b7280;
  --line: #e8ecf3;
  --brand: #4f6ef7;
}
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: .3px; }
.brand span { color: var(--brand); }
.topbar .tagline { font-size: 13px; color: var(--sub); }

.wrap { max-width: 980px; margin: 0 auto; padding: 28px 20px 60px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.page-sub { color: var(--sub); font-size: 14px; margin-bottom: 26px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.book {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; position: relative; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
  display: block;
}
.book:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(60,80,140,.12); }
.book .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }
.book .lv {
  display: inline-block; font-size: 12px; font-weight: 700; color: #fff;
  padding: 3px 10px; border-radius: 999px; margin-bottom: 12px;
}
.book .name { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.book .cn { font-size: 14px; color: var(--sub); margin-bottom: 14px; }
.book .meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); }
.book .count { font-weight: 700; color: var(--ink); }
.book .pbar { height: 6px; background: var(--line); border-radius: 999px; margin-top: 14px; overflow: hidden; }
.book .pbar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--brand); }

/* 学习页 / 测验页 */
.study-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.back { font-size: 22px; color: var(--sub); }
.study-progress { flex: 1; height: 8px; background: #e3e8f2; border-radius: 999px; overflow: hidden; }
.study-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg,#4f6ef7,#7c93ff); transition: width .3s; }
.study-count { font-size: 13px; color: var(--sub); white-space: nowrap; }

.flash {
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  min-height: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 28px; text-align: center; position: relative;
  box-shadow: 0 10px 40px rgba(60,80,140,.08);
}
.flash .word { font-size: 46px; font-weight: 800; letter-spacing: .5px; }
.flash .phon { font-size: 18px; color: var(--sub); margin-top: 8px; }
.flash .pos { font-size: 13px; color: var(--brand); margin-top: 6px; font-weight: 600; }
.flash .meaning { font-size: 24px; font-weight: 700; margin-top: 26px; }
.flash .example { font-size: 16px; color: #374151; margin-top: 18px; line-height: 1.6; max-width: 620px; }
.flash .example_cn { font-size: 14px; color: var(--sub); margin-top: 6px; }
.flash .hint-reveal { margin-top: 22px; font-size: 14px; color: var(--sub); cursor: pointer; user-select: none; }
.flash .back-face { display: none; flex-direction: column; align-items: center; }
.flash.revealed .front-face { display: none; }
.flash.revealed .back-face { display: flex; }

.controls { display: flex; gap: 14px; margin-top: 26px; justify-content: center; }
.btn {
  border: none; cursor: pointer; font-size: 16px; font-weight: 700;
  padding: 14px 30px; border-radius: 14px; transition: transform .12s, opacity .12s;
  min-width: 130px;
}
.btn:active { transform: scale(.97); }
.btn-know { background: #22c55e; color: #fff; }
.btn-unknown { background: #fee2e2; color: #dc2626; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-ghost { background: #eef1f8; color: #374151; }

/* 测验 */
.quiz-qbox { text-align: center; margin-bottom: 6px; }
.quiz-word { font-size: 40px; font-weight: 800; }
.quiz-phon { font-size: 16px; color: var(--sub); margin-top: 6px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; }
.opt {
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  padding: 18px; font-size: 16px; cursor: pointer; text-align: left; transition: all .15s;
}
.opt:hover { border-color: #b9c6f5; }
.opt.correct { border-color: #22c55e; background: #f0fdf4; }
.opt.wrong { border-color: #ef4444; background: #fef2f2; }
.opt.disabled { pointer-events: none; }

.result-bar { text-align: center; margin-top: 22px; font-size: 15px; color: var(--sub); }
.finish {
  text-align: center; padding: 40px 20px;
}
.finish h2 { font-size: 30px; margin-bottom: 10px; }
.finish p { color: var(--sub); margin-bottom: 26px; }

.empty { text-align: center; padding: 60px 20px; color: var(--sub); }
.badge-ok { color: #16a34a; font-weight: 700; }

@media (max-width: 560px) {
  .options { grid-template-columns: 1fr; }
  .flash .word { font-size: 36px; }
  .buttons { flex-direction: column; width: 100%; }
}
