/* 记单词 · mobile-first, ~480px centered column */
* { box-sizing: border-box; }
:root {
  --bg: #f0f4f8;
  --card: #fff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #6d28d9;
  --brand2: #4f46e5;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
}
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}
#app { max-width: 480px; margin: 0 auto; padding: 0 12px 92px; min-height: 100vh; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--red); }
h1, h2, h3 { margin: 0 0 8px; }
h3 { font-size: 16px; }

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.gradient { background: linear-gradient(135deg, #7c3aed, #4f46e5); color: #fff; }
.gradient .muted { color: rgba(255,255,255,.85); }

/* top bar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 4px 4px;
}
.logo { font-weight: 800; font-size: 18px; }
.top-actions { display: flex; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 14px; cursor: pointer;
}

/* auth */
.auth-card { margin-top: 20vh; }
.auth-tabs { display: flex; gap: 8px; margin: 12px 0; }
.auth-tab {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line);
  background: #f9fafb; cursor: pointer; font-size: 15px;
}
.auth-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* forms */
label { display: block; font-size: 14px; margin: 10px 0 4px; }
input[type="text"], input[type="password"], input[type="search"], textarea {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 16px; margin-top: 4px; background: #fff;
}
textarea { resize: vertical; }
.btn {
  border: none; border-radius: 12px; padding: 12px 16px; font-size: 15px;
  cursor: pointer; background: #f3f4f6; color: var(--ink);
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.light { background: rgba(255,255,255,.95); color: var(--brand2); font-weight: 700; }
.btn.block { display: block; width: 100%; margin-top: 10px; }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 8px; flex-wrap: wrap; }

/* home */
.greet-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 8px 4px 0; }
.streak { font-size: 15px; font-weight: 700; background: #fff; border-radius: 999px; padding: 6px 12px; }
.hero { display: flex; justify-content: space-between; align-items: center; }
.hero-num { font-size: 24px; font-weight: 800; }
.hero-sub { opacity: .9; font-size: 14px; margin-top: 4px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick { margin: 0; text-align: left; font-size: 15px; font-weight: 700; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.goal-ctl button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; font-size: 18px; cursor: pointer; margin: 0 4px;
}
.progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #7c3aed, #4f46e5); width: 0%; transition: width .3s; }
.stat-grid, .stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { margin: 0; text-align: center; }
.stat-num { font-size: 24px; font-weight: 800; }
.quiz-center { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quiz-center button {
  padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: #f9fafb; font-size: 15px; cursor: pointer;
}
.tips { margin: 8px 0 0; padding-left: 18px; }
.tips li { margin: 6px 0; }

/* flashcard */
.flash { text-align: center; min-height: 260px; }
.flash-word-row { display: flex; justify-content: center; align-items: center; gap: 10px; }
.flash-word { font-size: 30px; font-weight: 800; }
.flash-phonetic { margin: 6px 0 12px; }
.flash-meaning { font-size: 20px; font-weight: 700; margin: 12px 0 6px; }
.flash-example { font-size: 14px; }
.grade-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 18px; }
.grade.unknown { background: #fee2e2; }
.grade.fuzzy { background: #fef3c7; }
.grade.known { background: #dcfce7; }
.speaker {
  border: 1px solid var(--line); background: #fff; border-radius: 50%;
  width: 44px; height: 44px; font-size: 20px; cursor: pointer; flex: none;
}
.speaker.big { width: auto; height: auto; border-radius: 999px; padding: 10px 18px; font-size: 16px; }
.speaker.playing { background: #ede9fe; border-color: var(--brand); }

/* quiz */
.hero-mini { display: flex; justify-content: space-between; align-items: center; }
.quiz-list { display: grid; gap: 10px; }
.quiz-type { display: flex; flex-direction: column; gap: 2px; text-align: left; font-size: 15px; font-weight: 700; cursor: pointer; margin: 0; }
.quiz-prompt { font-size: 20px; font-weight: 700; margin: 16px 0; text-align: center; }
.quiz-options { display: grid; gap: 10px; margin-top: 12px; }
.quiz-options button {
  padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: #f9fafb; font-size: 16px; cursor: pointer; text-align: left;
}
.quiz-options button.picked { background: #ede9fe; border-color: var(--brand); }
.quiz-options button.right { background: #dcfce7; border-color: var(--green); }
.quiz-options button.wrong { background: #fee2e2; border-color: var(--red); }
.big-score { font-size: 40px; font-weight: 800; }
.quiz-review { text-align: left; margin: 12px 0; }
.quiz-review .qr { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }

/* word book */
.book-tools { margin: 12px 0 8px; }
.word-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.word-row .w-main { flex: 1; min-width: 0; }
.word-row .w-word { font-weight: 700; }
.word-row .w-mean { color: var(--muted); font-size: 14px; }
.word-row .speaker { width: 38px; height: 38px; font-size: 17px; }
.icon-btn { border: none; background: none; font-size: 17px; cursor: pointer; padding: 6px; }
.stage-tag { font-size: 11px; background: #ede9fe; color: var(--brand); border-radius: 999px; padding: 2px 8px; }

/* add */
.add-tabs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 12px 0; }
.add-tab {
  padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-size: 14px; cursor: pointer;
}
.add-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.mode-pick { display: grid; gap: 8px; margin: 8px 0; }
.mode-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  cursor: pointer; display: flex; gap: 8px; align-items: center; margin: 0;
}
.mode-card:has(input:checked) { border-color: var(--brand); background: #f5f3ff; }
.dropzone {
  display: block; text-align: center; border: 2px dashed var(--line);
  border-radius: 12px; padding: 28px 12px; cursor: pointer; margin: 12px 0;
}
.cand-list { display: grid; gap: 6px; }
.cand-item { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* bottom nav */
.bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.bottomnav button {
  border: none; background: none; font-size: 20px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  color: var(--muted); padding: 4px 0;
}
.bottomnav button span { font-size: 11px; }
.bottomnav button.active { color: var(--brand); font-weight: 700; }

/* toast + modal bits */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 14px; z-index: 50; max-width: 90vw; text-align: center;
}
.edit-form input { margin-bottom: 8px; }
