:root {
  --brand: #01588a;
  --brand-dark: #013f66;
  --brand-soft: #e8f1f8;
  --gold: #c8a96e;
  --gold-soft: #faf3e5;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d21;
  --text-2: #5f6672;
  --text-3: #8b929e;
  --border: rgba(0, 0, 0, 0.09);
  --border-2: rgba(0, 0, 0, 0.16);
  --ok: #0f6e56;
  --ok-soft: #e3f5ee;
  --warn: #a86a10;
  --warn-soft: #fbf0da;
  --danger: #a32d2d;
  --danger-soft: #fbeaea;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 12px rgba(16, 24, 40, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ------------------------------- 布局骨架 ------------------------------- */

#app { min-height: 100%; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px; flex: 0 0 216px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; letter-spacing: -0.5px;
}
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: 0.4px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 14.5px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  min-height: 44px; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item .ico { width: 20px; height: 20px; flex: 0 0 20px; opacity: 0.9; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 20px; min-width: 20px; text-align: center;
}
.nav-badge.muted { background: var(--border-2); color: var(--text-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-inner { flex: 1; padding: 26px 30px 40px; max-width: 940px; width: 100%; margin: 0 auto; }

.topbar {
  height: 60px; padding: 0 30px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar .spacer { flex: 1; }

.mobile-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
}
.mobile-nav-inner { display: flex; }
.mobile-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 6px; color: var(--text-3); font-size: 11px; font-weight: 500; min-height: 52px;
}
.mobile-nav button.active { color: var(--brand); }
.mobile-nav .ico { width: 22px; height: 22px; }
.mobile-nav .dot {
  position: absolute; top: 6px; margin-left: 20px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--danger);
}

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .mobile-nav { display: block; }
  .main-inner { padding: 18px 16px calc(84px + var(--safe-b)); max-width: 720px; }
  .topbar { padding: 0 16px; height: 54px; }
}

/* ------------------------------- 通用组件 ------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }

.card-title {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  letter-spacing: 0.3px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: var(--r-sm);
  background: var(--brand); color: #fff; font-size: 14.5px; font-weight: 500;
  min-height: 44px; transition: background 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { opacity: 0.85; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--border-2); }
.btn.ghost:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn.subtle { background: var(--bg); color: var(--text-2); }
.btn.subtle:hover { background: #eceef2; }
.btn.gold { background: var(--gold); color: #40320f; }
.btn.gold:hover { background: #b99a5e; }
.btn.lg { padding: 13px 24px; font-size: 15.5px; min-height: 50px; }
.btn .ico { width: 18px; height: 18px; }

.input, .select {
  width: 100%; padding: 11px 13px; min-height: 44px;
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  background: var(--surface); font-size: 15px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(1, 88, 138, 0.1);
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }

/* 密码框：眼睛按钮 + 输入法提示 */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: none; background: transparent;
  border-radius: var(--r-sm); cursor: pointer; font-size: 16px; line-height: 1;
  color: var(--text-3); display: flex; align-items: center; justify-content: center;
}
.pw-eye:hover { background: var(--bg); }
.pw-hint { margin-top: 6px; font-size: 12.5px; color: var(--warn); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500; background: var(--bg); color: var(--text-2);
}
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.gold { background: var(--gold-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }

.grid-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px;
}
.stat .k { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.stat .v { font-size: 25px; font-weight: 600; line-height: 1.15; letter-spacing: -0.5px; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
@media (max-width: 640px) { .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.bar { height: 7px; border-radius: 20px; background: var(--bg); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: var(--brand); transition: width 0.45s ease; }
.bar.gold > i { background: var(--gold); }
.bar.ok > i { background: var(--ok); }

.empty { text-align: center; padding: 54px 20px; color: var(--text-3); }
.empty .ico { width: 46px; height: 46px; opacity: 0.35; margin-bottom: 12px; }
.empty p { font-size: 14px; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--border-2); border-top-color: var(--brand);
  animation: spin 0.75s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 60px 0; text-align: center; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(80px + var(--safe-b)); z-index: 90;
  background: rgba(26, 29, 33, 0.94); color: #fff;
  padding: 10px 18px; border-radius: 22px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  animation: toastIn 0.22s ease;
}
@media (min-width: 1024px) { .toast { bottom: 32px; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ------------------------------- 登录 ------------------------------- */

.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: linear-gradient(160deg, #f6f7f9 0%, var(--brand-soft) 100%);
}
.auth-box { width: 100%; max-width: 400px; }
.auth-hero { text-align: center; margin-bottom: 22px; }
.auth-hero .brand-mark {
  width: 52px; height: 52px; border-radius: 15px; font-size: 24px; margin: 0 auto 14px;
}
.auth-hero h1 { font-size: 22px; margin-bottom: 5px; }
.auth-hero p { font-size: 13.5px; color: var(--text-2); }
.auth-tabs {
  display: flex; background: var(--bg); border-radius: var(--r-sm);
  padding: 3px; margin-bottom: 18px;
}
.auth-tabs button {
  flex: 1; padding: 9px; border-radius: 6px; font-size: 14px; font-weight: 500;
  color: var(--text-2); min-height: 40px;
}
.auth-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.err { color: var(--danger); font-size: 13px; margin-bottom: 10px; text-align: center; }

.user-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 13px 7px 7px; border-radius: 22px;
  border: 1px solid var(--border); background: var(--surface); font-size: 13.5px;
}
.user-chip .av {
  width: 26px; height: 26px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.user-chip:hover { border-color: var(--brand); }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-3); font-size: 12px; margin: 18px 0 12px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ------------------------------- 首页 ------------------------------- */

.hero-card {
  background: linear-gradient(135deg, var(--brand) 0%, #0273b3 100%);
  color: #fff; border-radius: var(--r-lg); padding: 22px 24px;
  box-shadow: 0 6px 20px rgba(1, 88, 138, 0.16);
  border: none; position: relative; overflow: hidden;
}
.hero-card::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}
.hero-greet { font-size: 13px; opacity: 0.82; margin-bottom: 4px; }
.hero-card h2 { font-size: 21px; margin-bottom: 16px; position: relative; }
.hero-rows { display: flex; gap: 26px; position: relative; }
.hero-rows .k { font-size: 12px; opacity: 0.8; }
.hero-rows .v { font-size: 26px; font-weight: 600; line-height: 1.2; }

.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--border);
}
.task-row:last-child { border-bottom: none; }
.task-ico {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.task-ico.gold { background: var(--gold-soft); color: var(--warn); }
.task-main { flex: 1; min-width: 0; }
.task-main .t { font-size: 14.5px; font-weight: 500; }
.task-main .s { font-size: 12.5px; color: var(--text-3); }

.unit-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.unit-row:last-child { border-bottom: none; }
.unit-no {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
  background: var(--bg); color: var(--text-2);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.unit-info { flex: 1; min-width: 0; }
.unit-info .t { font-size: 14.5px; font-weight: 500; }
.unit-info .e { font-size: 12px; color: var(--text-3); }

/* ------------------------------- 学习 / 卡片 ------------------------------- */

.study-wrap { max-width: 620px; margin: 0 auto; padding-top: 6px; }

/* 吸底动作条：学习/答题页的主按钮始终可见，无需滑动寻找。
   桌面端贴视口底；手机端抬起到底部固定导航栏之上。 */
.action-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 10px;
  padding: 14px 0 6px;
  margin-top: 4px;
  background: var(--bg);
}
.action-bar::before {
  /* 顶部渐隐遮罩：滚动内容从按钮下方穿过时有平滑过渡 */
  content: ''; position: absolute; left: -16px; right: -16px; top: -26px; height: 26px;
  background: linear-gradient(to top, var(--bg), rgba(246, 247, 249, 0));
  pointer-events: none;
}
.action-bar .btn { flex: 1; }
@media (max-width: 1023px) {
  .action-bar { bottom: calc(84px + var(--safe-b)); padding-bottom: 8px; }
}
.study-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
.study-head .spacer { flex: 1; }
.progress-ring { position: relative; width: 40px; height: 40px; flex: 0 0 40px; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .lbl {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--brand);
}
/* 学习阶段标签：复习 / 新词 */
.phase-pill {
  flex: 0 0 auto; padding: 4px 12px; border-radius: 14px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.phase-pill.new { background: rgba(200,169,110,.16); color: #8a6d2f; }
/* 复习段结束、进入新词段的提示横幅 */
.group-banner {
  margin-bottom: 12px; padding: 11px 16px; border-radius: var(--r-md);
  background: rgba(200,169,110,.14); border: 1px solid rgba(200,169,110,.35);
  color: #8a6d2f; font-size: 13.5px; font-weight: 500; text-align: center;
  animation: fbIn 0.25s ease;
}

.word-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 30px 26px; text-align: center;
  box-shadow: var(--shadow); min-height: 250px;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
}
.word-big { font-size: 40px; font-weight: 600; letter-spacing: -0.5px; line-height: 1.15; }
.word-ipa { font-size: 16px; color: var(--text-2); font-family: "Times New Roman", serif; }
.speak-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 22px; background: var(--brand-soft); color: var(--brand);
  font-size: 13.5px; font-weight: 500; min-height: 38px; margin: 8px auto 0;
  white-space: nowrap;
}
.speak-btn:hover { background: #d8e8f4; }
.speak-btn.lg { font-size: 15px; padding: 11px 22px; min-height: 46px; }
.speak-btn.playing { background: var(--brand); color: #fff; }

.meaning { font-size: 20px; font-weight: 500; color: var(--brand-dark); margin-top: 8px; }
.pos-tag { font-size: 12.5px; color: var(--text-3); }

.forms-box {
  margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border-2);
  text-align: left;
}
.forms-title { font-size: 12px; color: var(--text-3); margin-bottom: 8px; font-weight: 600; letter-spacing: 0.3px; }
.form-line { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; padding: 3px 0; }
.form-line .lab {
  font-size: 11.5px; color: var(--text-3); background: var(--bg);
  padding: 1px 7px; border-radius: 5px; flex: 0 0 auto;
}
.form-line .f { font-weight: 500; }
.form-line .ipa { font-size: 12.5px; color: var(--text-3); font-family: "Times New Roman", serif; }

.sent-box { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border-2); text-align: left; }
.sent-line { padding: 7px 0; }
.sent-en { font-size: 15px; line-height: 1.55; }
.sent-en b { color: var(--brand); font-weight: 600; }
.sent-zh { font-size: 13px; color: var(--text-3); margin-top: 2px; }

.quiz-q { font-size: 16px; font-weight: 500; margin-bottom: 16px; text-align: center; line-height: 1.5; }
.quiz-sent { font-size: 16px; text-align: center; margin-bottom: 6px; line-height: 1.6; }
.quiz-sent .blank {
  display: inline-block; min-width: 78px; border-bottom: 2px solid var(--brand);
  color: transparent; text-align: center;
}
.quiz-zh { font-size: 13.5px; color: var(--text-3); text-align: center; margin-bottom: 18px; }

.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 16px; min-height: 52px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); font-size: 15px;
  transition: border-color 0.15s, background 0.15s;
}
.option:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.option .key {
  width: 24px; height: 24px; border-radius: 6px; flex: 0 0 24px;
  background: var(--bg); color: var(--text-2);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.option .sub { font-size: 12.5px; color: var(--text-3); margin-left: auto; }
.option:disabled { cursor: default; }
.option.right { border-color: var(--ok); background: var(--ok-soft); }
.option.right .key { background: var(--ok); color: #fff; }
.option.wrong { border-color: var(--danger); background: var(--danger-soft); }
.option.wrong .key { background: var(--danger); color: #fff; }

.spell-input {
  width: 100%; padding: 15px; font-size: 22px; text-align: center; letter-spacing: 1.5px;
  border: 2px solid var(--border-2); border-radius: var(--r-sm); outline: none; min-height: 58px;
}
.spell-input:focus { border-color: var(--brand); }
.spell-input.right { border-color: var(--ok); background: var(--ok-soft); }
.spell-input.wrong { border-color: var(--danger); background: var(--danger-soft); }

.feedback {
  margin-top: 16px; padding: 15px 16px; border-radius: var(--r-md);
  animation: fbIn 0.25s ease;
  scroll-margin-top: 66px; /* 平滑滚动定位时避开吸顶标题栏 */
}
@keyframes fbIn { from { opacity: 0; transform: translateY(6px); } }
.feedback.ok { background: var(--ok-soft); }
.feedback.bad { background: var(--danger-soft); }
.feedback .fh { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.feedback.ok .fh { color: var(--ok); }
.feedback.bad .fh { color: var(--danger); }
.feedback .fb { font-size: 13.5px; color: var(--text-2); line-height: 1.7; }
.feedback .fb .row { display: flex; gap: 8px; padding: 1px 0; }
.feedback .fb .lab { color: var(--text-3); flex: 0 0 54px; }

.stage-track { display: flex; gap: 3px; align-items: center; margin-top: 10px; }
.stage-dot {
  width: 100%; height: 5px; border-radius: 3px; background: var(--border);
  transition: background 0.3s;
}
.stage-dot.on { background: var(--brand); }
.stage-dot.done { background: var(--ok); }

.grad-box { margin-top: 16px; padding: 14px 16px; background: var(--gold-soft); border-radius: var(--r-md); }
.grad-box h4 { font-size: 13.5px; color: var(--warn); margin-bottom: 10px; }
.grad-item { display: flex; align-items: center; gap: 9px; font-size: 13px; padding: 3px 0; color: var(--text-2); }
.grad-item .ck {
  width: 17px; height: 17px; border-radius: 50%; flex: 0 0 17px;
  border: 1.5px solid var(--border-2);
  display: flex; align-items: center; justify-content: center; font-size: 10px;
}
.grad-item.pass { color: var(--ok); }
.grad-item.pass .ck { background: var(--ok); border-color: var(--ok); color: #fff; }

.grad-banner {
  background: linear-gradient(135deg, var(--gold) 0%, #d9bd84 100%);
  color: #40320f; border-radius: var(--r-md); padding: 16px 18px; text-align: center;
  margin-top: 14px; animation: fbIn 0.35s ease;
}
.grad-banner h3 { font-size: 17px; margin-bottom: 3px; }
.grad-banner p { font-size: 13px; opacity: 0.85; }

/* ------------------------------- 口语 ------------------------------- */

.speak-hero {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 26px 20px;
}
.big-speak {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.2s;
}
.big-speak:hover { transform: scale(1.05); }
.big-speak.playing { background: var(--brand-dark); animation: pulse 1s ease-in-out infinite; }
.big-speak:disabled { opacity: 0.4; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(1, 88, 138, 0.32); }
  50% { box-shadow: 0 0 0 14px rgba(1, 88, 138, 0); }
}

.pair-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.pair-opt {
  padding: 20px 14px; border: 1.5px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); text-align: center; min-height: 96px;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  transition: border-color 0.15s, background 0.15s;
}
.pair-opt:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.pair-opt .w { font-size: 21px; font-weight: 600; }
.pair-opt .ipa { font-size: 13px; color: var(--text-2); font-family: "Times New Roman", serif; }
.pair-opt .zh { font-size: 12.5px; color: var(--text-3); }
.pair-opt.right { border-color: var(--ok); background: var(--ok-soft); }
.pair-opt.wrong { border-color: var(--danger); background: var(--danger-soft); }

.rec-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; }
.rec-btn {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--danger); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.rec-btn:hover { transform: scale(1.05); }
.rec-btn.recording { animation: pulseRed 1.1s ease-in-out infinite; }
@keyframes pulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(163, 45, 45, 0.34); }
  50% { box-shadow: 0 0 0 16px rgba(163, 45, 45, 0); }
}
.rec-hint { font-size: 13px; color: var(--text-3); text-align: center; }

.score-ring { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 12px 0; }
.score-num { font-size: 44px; font-weight: 600; line-height: 1; letter-spacing: -1px; }
.score-lv { font-size: 13px; color: var(--text-2); }

.asr-box {
  background: var(--bg); border-radius: var(--r-sm); padding: 11px 14px;
  font-size: 13.5px; color: var(--text-2); text-align: left; width: 100%;
}
.asr-box .lab { font-size: 11.5px; color: var(--text-3); margin-bottom: 3px; }
.asr-box .hit { color: var(--ok); font-weight: 600; }
.asr-box .miss { color: var(--danger); text-decoration: line-through; }

.self-rate { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.self-rate button {
  padding: 8px 14px; border-radius: 20px; border: 1px solid var(--border-2);
  font-size: 13px; color: var(--text-2); min-height: 40px;
}
.self-rate button.sel { background: var(--brand); color: #fff; border-color: var(--brand); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.cat-card {
  padding: 13px 14px; border: 1.5px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); text-align: left; min-height: 66px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  transition: border-color 0.15s, background 0.15s;
}
.cat-card:hover { border-color: var(--brand); }
.cat-card.active { border-color: var(--brand); background: var(--brand-soft); }
.cat-card .t { font-size: 13.5px; font-weight: 500; }
.cat-card .s { font-size: 11.5px; color: var(--text-3); }

.weak-list { display: flex; flex-direction: column; }
.weak-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; min-height: 42px;
  padding: 9px 2px; border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.weak-row:last-child { border-bottom: none; }
.weak-row .wt { flex: 0 0 auto; min-width: 100px; font-weight: 500; }
.weak-row .wbar { flex: 1; height: 6px; border-radius: 20px; background: var(--bg); overflow: hidden; }
.weak-row .wbar > i { display: block; height: 100%; border-radius: 20px; transition: width 0.4s ease; }
.weak-row .wv { flex: 0 0 50px; text-align: right; font-weight: 500; font-size: 13px; }
.weak-row .wl { flex: 0 0 36px; text-align: right; font-size: 12px; color: var(--text-3); }
.weak-row:not(.static):hover .wt { color: var(--brand); }

.tip-box {
  background: var(--gold-soft); border-radius: var(--r-sm);
  padding: 12px 14px; font-size: 13px; color: #6d5216; line-height: 1.65; margin-bottom: 14px;
}
.tip-box b { color: var(--warn); }

/* ------------------------------- 词库 ------------------------------- */

.word-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }
.word-item {
  padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); text-align: left; width: 100%;
  transition: border-color 0.15s;
}
.word-item:hover { border-color: var(--brand); }
.word-item .top { display: flex; align-items: baseline; gap: 8px; }
.word-item .w { font-size: 16px; font-weight: 600; }
.word-item .ipa { font-size: 12.5px; color: var(--text-3); font-family: "Times New Roman", serif; }
.word-item .zh { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.word-item .foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.mini-dots { display: flex; gap: 2px; margin-left: auto; }
.mini-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--border-2); }
.mini-dot.on { background: var(--brand); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 20, 28, 0.42); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn 0.16s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: var(--r-lg);
  width: 100%; max-width: 480px; max-height: 84vh; overflow-y: auto;
  padding: 22px 24px; animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.modal-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.modal-head h3 { font-size: 20px; }
.modal-head .ipa { font-size: 14px; color: var(--text-2); font-family: "Times New Roman", serif; }
.modal-close { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; color: var(--text-3); display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--bg); }

@media (max-width: 640px) {
  .word-big { font-size: 33px; }
  .pair-opts { grid-template-columns: 1fr; }
  .hero-rows { gap: 18px; }
  .hero-rows .v { font-size: 22px; }
  .main-inner { padding: 16px 14px calc(84px + var(--safe-b)); }
  .score-num { font-size: 36px; }
  .weak-row { gap: 8px; font-size: 13px; }
  .weak-row .wt { min-width: 76px; }
  .weak-row .wv { flex: 0 0 42px; font-size: 12px; }
  .weak-row .wl { flex: 0 0 30px; font-size: 11px; }
}

/* ---------------- 词库页单元手风琴 ---------------- */
.unit-acc {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.unit-acc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.unit-acc-head:active { background: var(--bg); }
.chev {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--text-3);
  transition: transform 0.2s;
}
.chev svg { width: 100%; height: 100%; }
.chev.open { transform: rotate(180deg); }
.acc-title { font-size: 15px; font-weight: 500; color: var(--text); }
.acc-pills { margin-left: auto; display: flex; gap: 6px; flex: none; }
.acc-body { padding: 2px 12px 12px; border-top: 1px solid var(--border); }
.acc-body .word-list { margin-top: 10px; }
.acc-loading { padding: 18px 0; text-align: center; color: var(--text-3); font-size: 13px; }

/* ICP 备案号（登录页底部，个人备案站点要求展示） */
.icp {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}
.icp a { color: inherit; text-decoration: none; }

/* 单元徽章与进度条（词库页手风琴） */
.acc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.acc-line { display: flex; align-items: center; gap: 8px; }
.acc-title {
  font-size: 15px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acc-bar {
  display: block; height: 4px; border-radius: 2px;
  background: var(--bg); overflow: hidden;
}
.acc-bar i {
  display: block; height: 100%; border-radius: 2px;
  background: var(--brand); transition: width 0.35s ease;
}
.acc-bar i.gold { background: linear-gradient(90deg, var(--gold), #e2c98f); }

/* 徽章升级庆祝条 */
.badge-toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + var(--safe-b)); z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, #0b3f63, var(--brand));
  color: #fff; box-shadow: 0 8px 26px rgba(1, 88, 138, 0.32);
  font-size: 14px; font-weight: 500;
  animation: badgePop 0.35s ease;
  max-width: calc(100vw - 32px);
}
.badge-toast .medal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #e6c98d);
  color: #5b4315; font-size: 13px; font-weight: 700;
}
@keyframes badgePop {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 答题反馈里的单元徽章提示 */
.badge-note {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--gold-soft); border: 1px solid rgba(200, 169, 110, 0.35);
  display: flex; flex-direction: column; gap: 3px;
  font-size: 13px; color: #6b5218;
}
.badge-note span { color: #8a6d2f; }

/* 窄屏下隐藏单元的英文副标题，给标题和徽章让位 */
@media (max-width: 460px) {
  .acc-pills .en { display: none; }
}
