/* 单词闯关 · 全局样式（多邻国式活泼风） */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "HarmonicOS Sans", "Microsoft YaHei", sans-serif;
  background: #f0f9f0;
  color: #3c3c3c;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}
button { font-family: inherit; border: none; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: #58cc02; color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 2px 12px rgba(88, 204, 2, .3);
}
.topbar .logo { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.points-pill {
  background: #fff; color: #ff9600; font-weight: 800;
  border-radius: 999px; padding: 4px 12px; font-size: 14px;
  display: flex; align-items: center; gap: 4px;
}

/* 主体 */
.page { padding: 16px 14px 90px; }
.section { display: none; }
.section.active { display: block; }

/* 卡片 */
.card {
  background: #fff; border-radius: 18px; padding: 16px;
  margin-bottom: 14px;
  border: 2px solid #e5f3e0;
  box-shadow: 0 2px 0 #e5f3e0;
}
.card-title { font-size: 16px; font-weight: 800; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.muted { color: #999; font-size: 13px; }

/* 任务卡 */
.task-card { display: flex; align-items: center; gap: 12px; }
.task-icon {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  background: #ddf4d0;
}
.task-icon.exam { background: #ffe9c7; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.task-sub { font-size: 12px; color: #999; }
.task-stars { font-size: 13px; letter-spacing: 1px; }

/* 单元关卡 */
.unit-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed #e5f3e0; }
.unit-row:last-child { border-bottom: none; }
.unit-badge {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #58cc02, #89e219);
  color: #fff; font-weight: 800; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 #46a302;
}

/* 按钮 */
.btn-primary {
  width: 100%; padding: 14px; border-radius: 14px;
  background: #58cc02; color: #fff; font-size: 16px; font-weight: 800;
  box-shadow: 0 4px 0 #46a302;
  transition: transform .05s;
}
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #46a302; }
.btn-primary:disabled { background: #b7e39a; box-shadow: 0 4px 0 #a3d488; }
.btn-orange { background: #ff9600; box-shadow: 0 4px 0 #d67e00; }
.btn-orange:active { box-shadow: 0 1px 0 #d67e00; }
.btn-ghost {
  background: #fff; color: #58cc02; border: 2px solid #58cc02; box-shadow: none;
  padding: 10px; font-weight: 700; border-radius: 12px; width: 100%;
}
.btn-small { width: auto; padding: 8px 16px; font-size: 14px; border-radius: 10px; }

/* 表单 */
.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: #666; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 2px solid #e0e0e0; border-radius: 12px;
  outline: none; background: #fafafa;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #58cc02; background: #fff; }
.error-text { color: #ff4b4b; font-size: 13px; min-height: 20px; margin-bottom: 8px; }

/* 底部导航 */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 30;
  background: #fff; border-top: 2px solid #eee;
  display: flex; padding: 6px 0 10px;
}
.nav-item {
  flex: 1; text-align: center; color: #bbb; font-size: 11px; font-weight: 700;
  padding: 4px 0;
}
.nav-item .nav-icon { font-size: 22px; display: block; margin-bottom: 2px; filter: grayscale(1); opacity: .5; }
.nav-item.active { color: #58cc02; }
.nav-item.active .nav-icon { filter: none; opacity: 1; }

/* ===== 答题区 ===== */
.quiz-wrap { position: fixed; inset: 0; z-index: 50; background: #f0f9f0; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; left: 0; right: 0; }
.quiz-top { padding: 14px 16px 8px; display: flex; align-items: center; gap: 12px; }
.quiz-close { font-size: 22px; color: #999; width: 32px; }
.progress-track { flex: 1; height: 14px; background: #e0e0e0; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #58cc02, #89e219); border-radius: 999px; transition: width .3s; }
.quiz-body { flex: 1; overflow-y: auto; padding: 10px 18px; }
.q-type { text-align: center; color: #999; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.q-main {
  text-align: center; font-size: 30px; font-weight: 800; margin: 12px 0 6px;
  word-break: break-word;
}
.q-phonetic { text-align: center; color: #999; font-size: 15px; margin-bottom: 8px; }
.speak-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: #1cb0f6; color: #fff; font-size: 24px;
  box-shadow: 0 4px 0 #1899d6; margin: 8px auto;
}
.speak-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1899d6; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.option-btn {
  background: #fff; border: 2px solid #e0e0e0; border-bottom-width: 4px;
  border-radius: 14px; padding: 16px 10px; font-size: 17px; font-weight: 700;
  color: #3c3c3c; min-height: 60px; word-break: break-word;
}
.option-btn:active { background: #f0f9f0; }
.option-btn.picked { border-color: #84d8ff; background: #ddf4ff; }
.option-btn.right { border-color: #58cc02; background: #d7ffb8; color: #3c9202; }
.option-btn.wrong { border-color: #ff4b4b; background: #ffdfe0; color: #ea2b2b; }

/* 拼写 */
.spell-slots { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px 0; min-height: 52px; }
.spell-slot {
  min-width: 38px; height: 48px; border-bottom: 4px solid #58cc02;
  font-size: 26px; font-weight: 800; color: #3c3c3c;
  display: flex; align-items: center; justify-content: center;
}
.spell-tiles { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.spell-tile {
  min-width: 44px; height: 48px; padding: 0 8px;
  background: #fff; border: 2px solid #e0e0e0; border-bottom-width: 4px; border-radius: 12px;
  font-size: 22px; font-weight: 800; color: #3c3c3c;
}
.spell-tile.used { opacity: .25; pointer-events: none; }

/* 反馈条 */
.feedback-bar {
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: #fff; border-top: 2px solid #eee;
}
.feedback-bar.good { background: #d7ffb8; }
.feedback-bar.bad { background: #ffdfe0; }
.feedback-text { font-weight: 800; font-size: 16px; margin-bottom: 10px; }
.feedback-bar.good .feedback-text { color: #3c9202; }
.feedback-bar.bad .feedback-text { color: #ea2b2b; }
.feedback-answer { font-size: 14px; color: #666; margin-bottom: 10px; }

/* 结果页 */
.result-hero { text-align: center; padding: 30px 0 10px; }
.result-emoji { font-size: 64px; }
.result-title { font-size: 24px; font-weight: 800; margin: 10px 0; }
.result-stats { display: flex; gap: 10px; margin: 18px 0; }
.result-stat {
  flex: 1; border-radius: 14px; padding: 12px 6px; text-align: center;
  border: 2px solid; background: #fff;
}
.result-stat .num { font-size: 22px; font-weight: 800; }
.result-stat .lbl { font-size: 12px; color: #999; margin-top: 2px; }
.wrong-review { text-align: left; margin-top: 10px; }
.wrong-review-item {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; border: 2px solid #ffdfe0; border-radius: 12px;
  padding: 10px 14px; margin-bottom: 8px;
}
.wrong-review-item .w { font-weight: 800; font-size: 16px; }
.wrong-review-item .m { color: #999; font-size: 13px; }

/* 排行榜 */
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px dashed #eee; }
.rank-row:last-child { border-bottom: none; }
.rank-no {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; background: #f0f0f0; color: #999;
}
.rank-no.top1 { background: #ffd700; color: #8a6d00; }
.rank-no.top2 { background: #e0e0e0; color: #666; }
.rank-no.top3 { background: #ffb366; color: #8a4b00; }
.rank-row.me { background: #f0f9f0; border-radius: 12px; }
.rank-name { flex: 1; font-weight: 700; font-size: 15px; }
.rank-pts { color: #ff9600; font-weight: 800; }

/* 错题 */
.wrong-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed #e5f3e0; }
.wrong-item:last-child { border-bottom: none; }
.wrong-word { font-weight: 800; font-size: 17px; }
.wrong-meaning { color: #999; font-size: 13px; margin-top: 2px; }
.wrong-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 700; flex-shrink: 0; }
.wrong-tag.new { background: #ffdfe0; color: #ea2b2b; }
.wrong-tag.doing { background: #fff3d6; color: #d67e00; }
.wrong-tag.done { background: #d7ffb8; color: #3c9202; }

/* 老师后台 */
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 12px 14px 0; }
.admin-tab {
  padding: 8px 16px; border-radius: 999px; background: #fff; border: 2px solid #e0e0e0;
  font-weight: 700; font-size: 14px; color: #666; white-space: nowrap;
}
.admin-tab.active { background: #58cc02; border-color: #58cc02; color: #fff; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.admin-table th, .admin-table td { padding: 8px 6px; border-bottom: 1px solid #eee; text-align: left; }
.admin-table th { color: #999; font-size: 12px; }
.admin-table .op { color: #1cb0f6; cursor: pointer; margin-right: 8px; white-space: nowrap; }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-card { background: #fff; border-radius: 12px; padding: 10px 4px; text-align: center; border: 2px solid #e5f3e0; }
.stat-card .n { font-size: 20px; font-weight: 800; color: #58cc02; }
.stat-card .t { font-size: 11px; color: #999; margin-top: 2px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.practice { background: #ddf4d0; color: #3c9202; }
.pill.exam { background: #ffe9c7; color: #d67e00; }
.pill.off { background: #eee; color: #999; }

/* 周日历 */
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-nav-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: #f0f9f0; color: #58cc02; font-size: 16px; font-weight: 800;
}
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-cell {
  text-align: center; padding: 8px 2px; border-radius: 12px;
  border: 2px solid transparent; cursor: pointer; user-select: none;
}
.day-cell .dow { font-size: 11px; color: #999; font-weight: 700; }
.day-cell .dnum { font-size: 16px; font-weight: 800; margin: 2px 0; }
.day-cell .dmark { font-size: 11px; height: 14px; }
.day-cell.today { border-color: #58cc02; }
.day-cell.selected { background: #ddf4d0; border-color: #58cc02; }
.day-cell.future { opacity: .45; }
.day-cell.has-task .dnum { color: #3c9202; }

/* 逐题批改 */
.grading-item {
  background: #fff; border-radius: 12px; padding: 10px 14px; margin-bottom: 8px;
  border: 2px solid #e5f3e0; display: flex; align-items: center; gap: 10px;
}
.grading-item.wrong { border-color: #ffdfe0; background: #fff8f8; }
.grading-item .g-main { flex: 1; min-width: 0; }
.grading-item .g-word { font-weight: 800; font-size: 15px; }
.grading-item .g-meaning { color: #999; font-size: 12px; margin-top: 2px; }
.grading-item .g-picked { font-size: 13px; margin-top: 4px; }
.grading-item .g-mark { font-size: 18px; flex-shrink: 0; }

.empty { text-align: center; padding: 40px 20px; color: #999; }

/* 闯关页提示语 */
.quest-hint {
  border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.quest-hint.done { background: #d7ffb8; color: #3c9202; }
.quest-hint.todo { background: #fff3d6; color: #d67e00; }
.quest-hint.free { background: #ddf4ff; color: #1899d6; }
.empty .emoji { font-size: 48px; margin-bottom: 10px; }

.toast {
  position: fixed; top: 20%; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 14px; z-index: 99; max-width: 80%;
}
