/* ============================================================
 * features.css — 新功能样式（对齐 style.css 的浅色主题）
 * 全部使用主题变量：--bg / --bg-soft / --line / --ink / --green ...
 * 禁止硬编码深色值，否则会出现"白底白字"
 * ============================================================ */

/* ---------- 通用页头 ---------- */
.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.page-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}
.spacer { flex: 1; }

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  border-radius: 12px;
  flex: 0 0 auto;
}
.btn-icon.is-fav {
  color: var(--gold-d);
  border-color: var(--gold);
  background: var(--gold-l);
}

/* ---------- 首页功能宫格 ---------- */
.feat-wrap {
  padding: 0 0 6px;
}
.feat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px 16px 10px;
}
.feat-grid-primary {
  padding-bottom: 6px;
}

/* ---------- 收纳区 ---------- */
.feat-more {
  margin: 0 16px 8px;
}
.feat-more-head {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
  background: var(--bg-soft);
  border: 2px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
}
.feat-more-head:active {
  background: var(--line);
}
.feat-more-icon {
  display: inline-block;
  font-size: 11px;
  color: var(--ink-3);
  transition: transform .18s;
}
.feat-more-text {
  flex: 1;
}
.feat-more-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
}

.feat-more-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .28s ease;
}
.feat-more.expanded .feat-more-body {
  max-height: 2000px;
}

.feat-grp {
  margin-top: 8px;
}
.feat-grp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
}
.feat-grp-emoji {
  font-size: 15px;
}
.feat-grp-label {
  flex: 1;
}
.feat-grp-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  padding: 1px 7px;
  background: var(--bg-soft);
  border-radius: 99px;
}
.feat-grp-chev {
  font-size: 11px;
  color: var(--ink-3);
  transition: transform .18s;
}
.feat-grp-chev.on {
  transform: rotate(90deg);
}

.feat-grp-grid {
  max-height: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  transition: max-height .28s ease, padding .2s;
}
.feat-grp-grid.on {
  max-height: 1200px;
  padding-top: 4px;
  padding-bottom: 10px;
}
.feat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 6px 12px;
  border-radius: var(--r);
  background: var(--bg);
  border: 2px solid var(--line);
  box-shadow: 0 3px 0 var(--line);
  cursor: pointer;
  transition: transform .1s, background .15s;
  font-family: inherit;
}
.feat-item:active {
  transform: translateY(3px);
  box-shadow: none;
  background: var(--bg-soft);
}
.feat-emoji { font-size: 26px; line-height: 1.15; }
.feat-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.feat-sub {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
}

/* ---------- 单词详情 ---------- */
.word-detail { padding-bottom: 96px; }

.wd-head {
  margin: 8px 16px 14px;
  padding: 22px 18px;
  border-radius: var(--r-lg);
  background: var(--green-bg);
  border: 2px solid var(--green-l);
  text-align: center;
}
.wd-word-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.wd-word {
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: .5px;
}
.btn-speak {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 19px;
  background: var(--bg);
  border: 2px solid var(--green-l);
  color: var(--green-d);
}
.btn-speak.speaking { animation: pulse-speak .7s ease infinite; }
@keyframes pulse-speak {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.wd-pos {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--green-d);
  background: var(--bg);
  border: 1.5px solid var(--green-l);
}
.wd-zh {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.5;
}

.wd-section {
  margin: 0 16px 14px;
  padding: 16px;
  border-radius: var(--r);
  background: var(--bg);
  border: 2px solid var(--line);
}
.wd-section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--green-d);
  margin-bottom: 12px;
}
.root-raw {
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.75;
  margin-bottom: 12px;
  word-break: break-word;
  font-weight: 600;
}
.root-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.root-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--green-bg);
  border: 1.5px solid var(--green-l);
}
.root-chip.suffix {
  background: var(--blue-l);
  border-color: #bfe9ff;
}
.root-chip-text {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}
.root-chip-gloss {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
  font-weight: 600;
}
.wd-hook {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--gold-l);
  border-left: 4px solid var(--gold);
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.65;
  font-weight: 600;
}
.hook-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-d);
  margin-right: 8px;
}

.infl-grid { display: grid; gap: 8px; }
.infl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--bg-soft);
}
.infl-label {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}
.infl-value {
  font-size: 15px;
  font-weight: 800;
  color: var(--green-d);
  font-family: ui-monospace, monospace;
}

.ex-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.ex-en {
  flex: 1;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  font-weight: 600;
}
.ex-zh {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
  margin-bottom: 14px;
  font-weight: 600;
}

.cloze-box {
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1.5px dashed var(--line-strong);
}
.cloze-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--green-d);
  margin-bottom: 8px;
}
.cloze-prompt {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink);
  margin-bottom: 12px;
  font-weight: 600;
}
.cloze-blank {
  display: inline-block;
  min-width: 70px;
  padding: 0 6px;
  border-bottom: 2px solid var(--green);
  color: var(--green-d);
  text-align: center;
  letter-spacing: 2px;
  font-weight: 800;
}
.cloze-answer {
  display: inline-block;
  padding: 0 6px;
  color: var(--green-d);
  font-weight: 800;
  background: var(--green-l);
  border-radius: 5px;
}
.cloze-actions { display: flex; gap: 8px; }

.wd-mistake { border-color: #ffb3b3; }
.mis-row {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--ink-2);
  flex-wrap: wrap;
  font-weight: 600;
}
.mis-resolved { color: var(--green-d); font-weight: 800; }

.note-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
  font-weight: 600;
}
.note-input:focus {
  outline: none;
  border-color: var(--green);
  background: var(--bg);
}
.note-input::placeholder { color: var(--ink-3); }

.wd-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  z-index: 30;
}

/* ---------- 生词本 ---------- */
.fav-toolbar { padding: 12px 16px 10px; display: grid; gap: 10px; }
.fav-count {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 700;
}
.input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
}
.input:focus {
  outline: none;
  border-color: var(--green);
  background: var(--bg);
}
.input::placeholder { color: var(--ink-3); }

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
  background: var(--bg);
  border: 2px solid var(--line);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.chip.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green-d);
}

.fav-actions { display: flex; gap: 8px; }
.fav-list { padding: 0 16px 96px; }
.fav-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
}
.fav-group-n {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 700;
}
.fav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  margin-bottom: 9px;
  border-radius: var(--r);
  background: var(--bg);
  border: 2px solid var(--line);
}
.fav-main { flex: 1; min-width: 0; cursor: pointer; }
.fav-word-row { display: flex; align-items: baseline; gap: 8px; }
.fav-word {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  word-break: break-word;
}
.fav-pos {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-d);
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--green-bg);
  border: 1px solid var(--green-l);
}
.fav-zh {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.fav-note {
  font-size: 12px;
  color: var(--gold-d);
  margin-top: 5px;
  line-height: 1.5;
  font-weight: 600;
}
.fav-del {
  color: var(--red);
  border-color: #ffb3b3;
  background: var(--red-l);
}

.empty-icon { font-size: 52px; margin-bottom: 14px; line-height: 1; }
.empty-screen { padding: 56px 30px; text-align: center; }
.empty-screen h2 {
  font-size: 18px;
  margin: 0 0 10px;
  color: var(--ink);
  font-weight: 800;
}
.empty-screen p {
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.75;
  margin: 0;
  font-weight: 600;
}

/* ============================================================
 * 自绘确认弹窗（替代原生 confirm）
 * ============================================================ */
.wq-dlg-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background: rgba(17, 24, 39, .45);
  animation: wqdlg-fade .16s ease;
}
.wq-dlg-overlay.closing {
  animation: wqdlg-fade-out .16s ease forwards;
}
@keyframes wqdlg-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes wqdlg-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.wq-dlg-card {
  width: 100%;
  max-width: 340px;
  padding: 26px 22px 20px;
  border-radius: var(--r-lg);
  background: var(--bg);
  border: 2px solid var(--line);
  box-shadow: 0 18px 50px rgba(17, 24, 39, .25);
  text-align: center;
  animation: wqdlg-pop .24s cubic-bezier(.34, 1.35, .64, 1);
}
@keyframes wqdlg-pop {
  from { transform: scale(.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.wq-dlg-icon {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 14px;
}
.wq-dlg-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 10px;
}
.wq-dlg-msg {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
  font-weight: 600;
  margin-bottom: 22px;
  word-break: break-word;
}

.wq-dlg-actions {
  display: grid;
  gap: 9px;
}
.wq-dlg-btn {
  width: 100%;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 800;
  border-radius: var(--r);
}
.wq-dlg-cancel {
  color: var(--ink-2);
  background: var(--bg);
  border: 2px solid var(--line-strong);
  box-shadow: 0 3px 0 var(--line-strong);
}
.wq-dlg-cancel:active {
  transform: translateY(3px);
  box-shadow: none;
}
.wq-dlg-ok {
  color: #fff;
  background: var(--green);
  border: 2px solid var(--green-d);
  box-shadow: 0 4px 0 var(--green-d);
}
.wq-dlg-ok:active {
  transform: translateY(4px);
  box-shadow: none;
}
.wq-dlg-ok.danger {
  background: var(--red);
  border-color: var(--red-d);
  box-shadow: 0 4px 0 var(--red-d);
}
.wq-dlg-ok.danger:active {
  box-shadow: none;
}

/* 空态里的按钮组：并排、不撑满 */
.empty-screen .rc-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}
.empty-screen .rc-actions .btn {
  min-width: 120px;
  padding: 12px 22px;
  font-size: 15px;
}

/* ---------- 错题本 ---------- */
.mis-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px 12px;
  flex-wrap: wrap;
}
.mis-count {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 700;
}
.mis-list { padding: 0 16px 96px; }
.mis-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  margin-bottom: 9px;
  border-radius: var(--r);
  background: var(--bg);
  border: 2px solid var(--line);
}
.mis-rank {
  flex: 0 0 26px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-3);
  text-align: center;
}
.mis-main { flex: 1; min-width: 0; cursor: pointer; }
.mis-word-row { display: flex; align-items: baseline; gap: 8px; }
.mis-word {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}
.mis-pos {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-d);
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--green-bg);
  border: 1px solid var(--green-l);
}
.mis-zh {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.mis-meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.mis-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}
.mis-badge.err { color: var(--red-d); background: var(--red-l); }
.mis-badge.ok { color: var(--green-d); background: var(--green-l); }
.mis-badge.streak { color: var(--gold-d); background: var(--gold-l); }
.mis-more {
  text-align: center;
  padding: 16px;
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 600;
}

/* ---------- 例句填空 ---------- */
.cloze-prog {
  height: 6px;
  margin: 0 16px 16px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.cloze-prog-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
  transition: width .3s;
}
.cloze-prog-text {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 800;
}
.cloze-body { padding: 0 16px 96px; }

.cloze-sentence {
  padding: 20px 18px;
  margin-bottom: 22px;
  border-radius: var(--r-lg);
  background: var(--green-bg);
  border: 2px solid var(--green-l);
}
.cloze-line {
  font-size: 19px;
  line-height: 1.85;
  color: var(--ink);
  font-weight: 700;
}
/* 填空槽位：纯 inline，靠字符下划线体现，不撑断行 */
.cz-slot {
  display: inline;
  color: var(--green-d);
  font-weight: 800;
  letter-spacing: 2px;
  border-bottom: 2px solid var(--green);
  padding-bottom: 1px;
  background: rgba(88, 204, 2, .07);
  border-radius: 2px;
}
.cz-slot.revealed {
  color: var(--green-d);
  background: var(--green-l);
  border-bottom-color: transparent;
  letter-spacing: 0;
  padding: 0 3px;
  border-radius: 5px;
  font-weight: 800;
}
.cz-before, .cz-after { white-space: pre-wrap; }
.cloze-hint-zh {
  margin-top: 12px;
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 700;
}
.cloze-speak { margin-top: 12px; }

.cloze-options { display: grid; gap: 11px; margin-bottom: 20px; }
.cloze-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-radius: var(--r);
  background: var(--bg);
  border: 2px solid var(--line);
  box-shadow: 0 3px 0 var(--line-strong);
  cursor: pointer;
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  transition: all .12s;
  font-family: inherit;
}
.cloze-opt:active {
  transform: translateY(3px);
  box-shadow: none;
}
.cloze-opt-key {
  flex: 0 0 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  color: var(--ink-2);
}
.cloze-opt-text { flex: 1; }
.cloze-opt.correct {
  background: var(--green-bg);
  border-color: var(--green);
  box-shadow: 0 3px 0 var(--green-d);
}
.cloze-opt.correct .cloze-opt-key {
  background: var(--green);
  border-color: var(--green-d);
  color: #fff;
}
.cloze-opt.wrong {
  background: var(--red-l);
  border-color: var(--red);
  box-shadow: 0 3px 0 var(--red-d);
}
.cloze-opt.wrong .cloze-opt-key {
  background: var(--red);
  border-color: var(--red-d);
  color: #fff;
}
.cloze-foot { display: flex; justify-content: center; padding-bottom: 8px; }

/* 「看这个单词」按钮：给足视觉重量，别像禁用态 */
.cloze-foot .btn {
  color: var(--blue-d);
  border-color: #bfe9ff;
  background: var(--blue-l);
  font-weight: 800;
  padding: 11px 26px;
}
.cloze-foot .btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #bfe9ff;
}

.finish-screen { text-align: center; padding: 40px 20px; }
.finish-icon { font-size: 66px; margin-bottom: 16px; line-height: 1; }
.finish-screen h2 {
  font-size: 22px;
  margin: 0 0 26px;
  color: var(--ink);
  font-weight: 800;
}
.finish-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 30px;
}
.finish-stat { display: flex; flex-direction: column; gap: 4px; }
.fs-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--green-d);
}
.fs-label {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 700;
}
.finish-actions {
  display: grid;
  gap: 10px;
  max-width: 320px;
  margin: 0 auto;
}

/* ---------- 每日目标 ---------- */
.goal-today {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 8px 16px 16px;
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--green-bg);
  border: 2px solid var(--green-l);
  flex-wrap: wrap;
  justify-content: center;
}
.goal-ring-wrap { position: relative; width: 176px; height: 176px; flex: 0 0 auto; }
.goal-ring { width: 100%; height: 100%; }

/* CSS conic-gradient 环形进度（比 SVG 在 WebView 里更稳） */
.goal-ring-css {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: background .6s ease;
}
.goal-ring-inner {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--green-bg);
}
.goal-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}
.goal-ring-pct {
  font-size: 32px;
  font-weight: 800;
  color: var(--green-d);
}
.goal-ring-label {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 700;
}

.goal-parts { flex: 1; min-width: 170px; display: grid; gap: 14px; }
.goal-part-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.goal-part-label { color: var(--ink-2); font-weight: 700; }
.goal-part-val { color: var(--ink); font-weight: 800; }
.goal-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--green-l);
  overflow: hidden;
}
.goal-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
  transition: width .5s;
}
.goal-done-banner {
  margin: 0 16px 16px;
  padding: 14px;
  border-radius: var(--r);
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: var(--green);
  box-shadow: 0 4px 0 var(--green-d);
}

.goal-settings {
  margin: 0 16px 16px;
  padding: 18px;
  border-radius: var(--r);
  background: var(--bg);
  border: 2px solid var(--line);
}
.goal-settings-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 14px;
}
.goal-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.goal-field:last-of-type { border-bottom: none; }
.goal-field-label {
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
}
.goal-field-ctrl { display: flex; align-items: center; gap: 12px; }
.goal-field-val {
  min-width: 72px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--green-d);
}
.goal-settings .btn-wide { margin-top: 16px; }

.goal-heat {
  margin: 0 16px 96px;
  padding: 18px;
  border-radius: var(--r);
  background: var(--bg);
  border: 2px solid var(--line);
}
.heat-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.heat-cell {
  aspect-ratio: 1;
  border-radius: 7px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.heat-cell.lv1 { background: #eafbe0; border-color: var(--green-l); }
.heat-cell.lv2 { background: var(--green-l); border-color: var(--green-l); }
.heat-cell.lv3 { background: #8fe04a; border-color: #8fe04a; }
.heat-cell.lv4 { background: var(--green); border-color: var(--green-d); }
.heat-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 10px;
  font-weight: 600;
}
.heat-legend .heat-cell { width: 14px; height: 14px; aspect-ratio: auto; }
.goal-heat-summary {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 600;
}

/* ---------- 排行榜 ---------- */
.lb-status {
  padding: 0 16px 10px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
}
.lb-my { padding: 0 16px 14px; }
.lb-my-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r);
  background: var(--green-bg);
  border: 2px solid var(--green-l);
}
.lb-my-rank {
  font-size: 24px;
  font-weight: 800;
  color: var(--green-d);
}
.lb-my-info { flex: 1; }
.lb-my-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.lb-my-tier { font-size: 12px; margin-top: 2px; font-weight: 700; }
.lb-my-score {
  font-size: 24px;
  font-weight: 800;
  color: var(--green-d);
}

.lb-list { padding: 0 16px 96px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  margin-bottom: 8px;
  border-radius: var(--r);
  background: var(--bg);
  border: 2px solid var(--line);
}
.lb-row.me {
  background: var(--green-bg);
  border-color: var(--green-l);
}
.lb-row.top1 { background: var(--gold-l); border-color: var(--gold); }
.lb-row.top2 { background: var(--bg-soft); border-color: var(--line-strong); }
.lb-row.top3 { background: #fff0e6; border-color: #ffd4b3; }
.lb-rank {
  flex: 0 0 34px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink-2);
}
.lb-row.top1 .lb-rank,
.lb-row.top2 .lb-rank,
.lb-row.top3 .lb-rank { font-size: 22px; }
.lb-info { flex: 1; min-width: 0; }
.lb-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--ink-3);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.lb-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
  font-weight: 600;
}
.lb-tier { font-weight: 800; }
.lb-score {
  font-size: 18px;
  font-weight: 800;
  color: var(--green-d);
  flex: 0 0 auto;
}
.lb-more {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
}

/* ---------- 海报 ---------- */
.poster-preview {
  margin: 0 16px 16px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-soft);
  border: 2px solid var(--line);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 600;
}

/* canvas 按容器宽度等比缩放，绝不能超出屏幕 */
.poster-preview canvas,
.poster-preview img {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
  object-fit: contain;
}

.poster-actions {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}
.poster-tip {
  padding: 0 16px 44px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.75;
  font-weight: 600;
}

/* ---------- 学习页收藏按钮 ---------- */
.learn-fav {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 10;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 19px;
  line-height: 1;
  border-radius: 12px;
  background: var(--bg);
  border: 2px solid var(--line);
  color: var(--ink-3);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.learn-fav:active { transform: scale(.92); }
.learn-fav.is-fav {
  color: var(--gold-d);
  border-color: var(--gold);
  background: var(--gold-l);
}
.card-stage { position: relative; }

.wb-practice {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-d);
  background: var(--blue-l);
  border: 1px solid #bfe9ff;
}

/* ---------- 应用内更新弹窗 ---------- */
.upd-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 24, 39, .55);
  animation: upd-fade-in .18s ease;
}
.upd-overlay.closing {
  animation: upd-fade-out .16s ease forwards;
}
@keyframes upd-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes upd-fade-out { from { opacity: 1; } to { opacity: 0; } }

.upd-card {
  width: 100%;
  max-width: 360px;
  padding: 26px 22px 22px;
  border-radius: var(--r-lg);
  background: var(--bg);
  border: 2px solid var(--line);
  box-shadow: 0 16px 48px rgba(17, 24, 39, .22);
  text-align: center;
  animation: upd-pop .24s cubic-bezier(.34, 1.4, .64, 1);
}
@keyframes upd-pop {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.upd-icon { font-size: 48px; line-height: 1; margin-bottom: 14px; }
.upd-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 12px;
}
.upd-ver {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
  font-family: ui-monospace, monospace;
}
.upd-from {
  font-size: 14px;
  color: var(--ink-3);
  text-decoration: line-through;
  font-weight: 600;
}
.upd-arrow { font-size: 13px; color: var(--green-d); font-weight: 800; }
.upd-to {
  font-size: 17px;
  font-weight: 800;
  color: var(--green-d);
}
.upd-size {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 16px;
  font-weight: 600;
}

.upd-notes {
  text-align: left;
  padding: 13px 14px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  max-height: 180px;
  overflow-y: auto;
}
.upd-notes-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.upd-note-line {
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-2);
  word-break: break-word;
  font-weight: 600;
}

.upd-actions { display: grid; gap: 9px; }
.upd-now:disabled { opacity: .65; cursor: default; }

/* ---------- 设置页版本区块 ---------- */
.upd-section { margin-bottom: 20px; }
.upd-ver-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.upd-ver-label {
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 700;
}
.upd-ver-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--green-d);
  font-family: ui-monospace, monospace;
}

/* ============================================================
 * 词库选择器（学段 Tab + 地区分组）
 * ============================================================ */
.deck-picker {
  padding: 0 16px 8px;
}

.deck-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.deck-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-3);
  background: var(--bg-soft);
  border: 2px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
}
.deck-tab.on {
  color: var(--green-d);
  background: var(--green-bg);
  border-color: var(--green);
  box-shadow: 0 3px 0 var(--green-d);
}
.deck-tab-emoji {
  font-size: 16px;
}
.deck-tab-n {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  background: rgba(0,0,0,.06);
  border-radius: 99px;
}
.deck-tab.on .deck-tab-n {
  background: var(--green-l);
}

.deck-list {
  display: grid;
  gap: 9px;
}

.deck-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 6px;
  margin-top: 4px;
  border-bottom: 1px solid var(--line);
}
.deck-group-head:first-child {
  margin-top: 0;
}
.deck-group-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
}
.deck-group-head.exam .deck-group-label {
  color: var(--gold-d);
}
.deck-group-n {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  padding: 1px 7px;
  background: var(--bg-soft);
  border-radius: 99px;
}

.deck-card-sm {
  padding: 13px 15px;
}
.deck-card-sm .deck-title h3 {
  font-size: 15px;
}
.deck-card-sm .deck-title p {
  font-size: 12px;
}
.deck-card.current {
  border-color: var(--green);
  background: var(--green-bg);
  box-shadow: 0 3px 0 var(--green-d);
}
.deck-card.current .deck-title h3 {
  color: var(--green-d);
}