:root {
  --bg: #f5f1e8;
  --bg-deep: #ece4d4;
  --surface: #fffdf8;
  --surface-soft: #f9f5ec;
  --line: #e4dccb;
  --line-soft: #efe8da;
  --ink: #211e19;
  --ink-2: #5b554a;
  --ink-3: #948b7c;
  --accent: #1f6f5c;
  --accent-deep: #175647;
  --accent-soft: #e6f0ec;
  --gold: #ad7d37;
  --danger: #b2433a;
  --shadow-sm: 0 1px 2px rgba(48, 40, 24, .06);
  --shadow-md: 0 6px 24px rgba(48, 40, 24, .09);
  --shadow-lg: 0 18px 48px rgba(48, 40, 24, .14);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

button { font-family: inherit; cursor: pointer; }

input, textarea, select { font-family: inherit; }

::selection { background: #d8e8e2; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  transition: all .18s ease;
  white-space: nowrap;
}

.btn:hover { border-color: #d3c8b2; background: #fffefb; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f7fcfa;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(31, 111, 92, .22);
}

.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn-primary:disabled { opacity: .6; cursor: default; box-shadow: none; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(33, 30, 25, .05); border-color: transparent; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  transition: all .16s ease;
}

.icon-btn:hover { background: rgba(33, 30, 25, .06); color: var(--ink); }

.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffefb;
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.input::placeholder { color: #b0a795; }

.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 111, 92, .12); }

select.input { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235b554a' d='M2.2 4.2h7.6L6 8.6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, .7);
  color: var(--ink-2);
  font-size: 13px;
  transition: all .16s ease;
  white-space: nowrap;
}

.chip:hover { border-color: #cfc3ac; color: var(--ink); }

.chip.active { background: var(--ink); border-color: var(--ink); color: #f7f2e6; }

.hidden { display: none !important; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--bg);
}

.auth-hero {
  position: relative;
  padding: 64px 68px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 15% 10%, #245c4e 0%, #143f35 45%, #102f28 100%);
  color: #f2ede0;
}

.auth-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 80% 85%, rgba(190, 152, 82, .28), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M0 39.5h40M39.5 0v40' stroke='%23ffffff' stroke-opacity='.035'/%3E%3C/svg%3E");
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  letter-spacing: .16em;
  color: rgba(242, 237, 224, .78);
}

.auth-brand .seal {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #e9dfc8;
  color: #143f35;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
}

.auth-hero-main { position: relative; z-index: 1; max-width: 520px; }

.auth-hero-main h1 {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: 52px;
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: .02em;
}

.auth-hero-main p {
  margin: 0;
  font-size: 15px;
  line-height: 1.95;
  color: rgba(238, 231, 215, .72);
}

.auth-stats {
  display: flex;
  gap: 32px;
  margin-top: 44px;
}

.auth-stats div { display: flex; flex-direction: column; gap: 4px; }

.auth-stats strong { font-family: var(--serif); font-size: 26px; font-weight: 500; color: #e9dfc8; }

.auth-stats span { font-size: 12px; letter-spacing: .12em; color: rgba(238, 231, 215, .5); }

.auth-hero-foot {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  font-size: 14px;
  color: rgba(238, 231, 215, .5);
  letter-spacing: .04em;
}

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
}

.auth-card { width: 100%; max-width: 380px; }

.auth-card h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
}

.auth-card .sub { margin: 0 0 30px; color: var(--ink-3); font-size: 13px; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #ece5d7;
  border-radius: 11px;
  margin-bottom: 24px;
}

.tabs button {
  flex: 1;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  transition: all .16s ease;
}

.tabs button.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  color: var(--ink-2);
  letter-spacing: .04em;
}

.auth-submit { width: 100%; height: 46px; margin-top: 8px; font-size: 15px; }

.form-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fbeeec;
  border: 1px solid #f0d6d2;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.6;
}

.auth-hint {
  margin-top: 22px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.8;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.auth-hint code {
  padding: 1px 6px;
  border-radius: 5px;
  background: #ece5d7;
  color: var(--ink-2);
  font-size: 12px;
}

/* ---------- 书库页 ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 66px;
  padding: 0 32px;
  background: rgba(250, 247, 240, .88);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: .04em;
  white-space: nowrap;
}

.brand .seal {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #f4f0e4;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 600;
}

/* 图标文件夹里的 logo 换成主题色后当站徽用 */
img.seal {
  display: block;
  object-fit: contain;
  background: transparent;
  border-radius: 8px;
  flex: none;
  box-shadow: 0 1px 2px rgba(48, 40, 24, .14);
}

.auth-brand img.seal { box-shadow: none; }

.search-box {
  position: relative;
  flex: 1;
  max-width: 460px;
}

.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }

.search-box input {
  width: 100%;
  height: 40px;
  padding: 0 68px 0 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffefb;
  font-size: 13px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 111, 92, .1); }

/* 检索只在回车 / 点「查询」时提交，输入过程不发请求，所以按钮要一直在框里可见 */
.search-box .search-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: .3px;
  cursor: pointer;
  transition: background .16s ease, opacity .16s ease;
}

.search-box .search-btn:hover { background: var(--accent-deep); }
.search-box .search-btn:active { background: var(--accent-deep); }
.search-box .search-btn:disabled { opacity: .55; cursor: default; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fffefb;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}
/* 点用户名进设置改昵称：给一点可点的暗示，别让它看着像纯文字 */
.user-chip:hover,
.user-chip:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  outline: none;
}
.user-chip:hover .avatar { background: #fff; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 600;
}

.main { max-width: 1360px; margin: 0 auto; padding: 30px 32px 80px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 6px 0 16px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: .02em;
}

.section-head .count { color: var(--ink-3); font-size: 13px; }

.section-head .spacer { margin-left: auto; }

.recent-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 232px;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scrollbar-width: thin;
}

.recent-card {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  transition: all .18s ease;
}

/* 链接收进内层，右上角腾出位置给删除按钮（button 不能嵌在 a 里） */
.recent-card .rc-link {
  display: flex;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.recent-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #d9cfba; }

/* 卡片右上角的移除按钮：平时半透明，别跟书名抢注意力 */
.rc-del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-3);
  opacity: .55;
  cursor: pointer;
  transition: opacity .15s ease, color .15s ease, background .15s ease, border-color .15s ease;
}
.recent-card:hover .rc-del,
.rc-del:focus-visible { opacity: 1; }
.rc-del:hover {
  color: #b3261e;
  background: #fdf2f1;
  border-color: rgba(179, 38, 30, .35);
}
.rc-del:focus-visible { outline: 2px solid rgba(31, 111, 92, .5); outline-offset: 1px; }
.rc-del:disabled { opacity: .35; cursor: default; }
/* 触屏没有 hover，按钮得一直看得见 */
@media (hover: none) {
  .rc-del { opacity: .85; }
}

/* 移除中的过渡：卡片缩一下再抽走，不硬生生消失 */
.recent-card.rc-out { opacity: 0; transform: translateY(-4px) scale(.97); }
.recent-card.rc-busy { pointer-events: none; }

.recent-card .thumb {
  width: 52px;
  height: 76px;
  border-radius: 6px;
  object-fit: cover;
  background: linear-gradient(150deg, #cfd9d2, #9fb3a9);
  flex: none;
}

.recent-card .rc-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.recent-card .rc-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  /* 右上角有删除按钮，标题别顶到它下面 */
  padding-right: 17px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-card .rc-author { font-size: 11px; color: var(--ink-3); }

.rc-progress { margin-top: auto; }

.rc-progress .bar { height: 3px; border-radius: 2px; background: #e8e0d0; overflow: hidden; }

.rc-progress .bar i { display: block; height: 100%; background: var(--accent); }

.rc-progress span { font-size: 10px; color: var(--ink-3); }

/* ---------- 排行榜（阅读榜 / 点击榜） ---------- */

.rank-tabs {
  display: flex;
  gap: 8px;
  align-self: center;
  margin-left: auto;
}

.rank-tabs .chip {
  height: 26px;
  padding: 0 12px;
  font-size: 12px;
}

.rank-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(304px, 1fr));
  gap: 10px 18px;
  padding-bottom: 6px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 12px 7px 8px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 253, 248, .66);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

/* 空榜占位：虚线框 + 一句话，说明门槛在哪，别让人以为没做 */
.rank-empty {
  grid-column: 1 / -1;
  padding: 18px 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, .5);
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
}

.rank-item:hover {
  border-color: #d9cfba;
  background: var(--surface);
  transform: translateX(2px);
}

/* 名次：前三名染色，不加奖牌图标——纸墨风里挂金银铜会很跳 */
.rank-no {
  flex: none;
  width: 20px;
  text-align: center;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.rank-item.top .rank-no {
  color: var(--accent);
  font-weight: 600;
}

.rank-thumb {
  flex: none;
  width: 32px;
  height: 46px;
  border-radius: 4px;
  object-fit: cover;
  background: linear-gradient(150deg, #e7dfd0, #cdc2ac);
}

.rank-thumb.no-img {
  background: linear-gradient(150deg, #e7dfd0, #cdc2ac);
}

.rank-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rank-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-author {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-val {
  flex: none;
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}

.rank-val i {
  font-style: normal;
  margin-right: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

@media (max-width: 720px) {
  .rank-list { grid-template-columns: 1fr; }
  .rank-val { font-size: 10px; }
  /* 窄屏里标题、称号、两个 tab 挤一行会互相压扁，干脆排成两行 */
  .section-head { flex-wrap: wrap; row-gap: 8px; }
  .section-head h2 { white-space: nowrap; }
  .rank-tabs { margin-left: 0; width: 100%; }
  #rankHint { display: none; }
}

/* 分类多（46 个真实分类 + 名著 / 译作）：默认只占一行，右侧接一个「展开」按钮，
   点开才按容器宽度换行铺满。早先单行横向滚动、滚动条又藏起来，尾部分类等于没了 */
.genres-wrap {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 0 18px;
}

.genres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  /* 收起状态：强制一行，超出部分裁掉（.genres-more 会盖一层渐隐提示还没显示完） */
  max-height: 32px;
  overflow: hidden;
}

.genres-wrap.expanded .genres {
  max-height: none;
  overflow: visible;
}

/* 展开 / 收起按钮：跟 chip 同高，别做成大按钮抢视觉 */
.genres-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, .7);
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
  transition: all .16s ease;
}

.genres-toggle:hover { border-color: #cfc3ac; color: var(--ink); }

.genres-toggle svg {
  width: 13px;
  height: 13px;
  transition: transform .2s ease;
}

.genres-wrap.expanded .genres-toggle svg { transform: rotate(180deg); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  gap: 26px 22px;
}

.card { display: flex; flex-direction: column; gap: 10px; animation: fadeUp .3s ease both; }

.card .cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(150deg, #e7dfd0, #cdc2ac);
  box-shadow: 0 6px 18px rgba(52, 44, 30, .13);
  transition: transform .22s ease, box-shadow .22s ease;
}

.card:hover .cover-wrap { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(52, 44, 30, .2); }

.card .cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cover-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 12px;
  color: #4a4235;
  background: linear-gradient(160deg, #ece2cf 0%, #d8cbb2 55%, #c3b498 100%);
}

.cover-fallback .cf-initial { font-family: var(--serif); font-size: 30px; opacity: .5; }

.cover-fallback .cf-title {
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card.no-img .cover-fallback { display: flex; }

.card.no-img img { visibility: hidden; }

.badge-zh {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10px;
  letter-spacing: .05em;
  color: #f0ece0;
  background: rgba(23, 86, 71, .82);
  backdrop-filter: blur(4px);
}

.card-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, .3);
}

.card-progress i { display: block; height: 100%; background: #d8b06a; }

.card .c-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .c-title-en {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.4;
  font-family: var(--serif);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .c-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: -2px;
  min-width: 0;
}

/* 卡片窄，作者名可压缩省略，分类不压缩 */
.card .c-meta > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* 「译自 xx」放封面左上角，不跟作者名抢那 40px 宽的 meta 行 */
.badge-orig {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10px;
  letter-spacing: .04em;
  color: #453727;
  background: rgba(232, 219, 193, .9);
  backdrop-filter: blur(4px);
}

.c-meta .dot { width: 2px; height: 2px; border-radius: 50%; background: currentColor; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 46px;
  flex-wrap: wrap;
}

.pager button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink-2);
  font-size: 13px;
}

.pager button:hover:not(:disabled) { border-color: #cfc3ac; color: var(--ink); }

.pager button.active { background: var(--ink); border-color: var(--ink); color: #f7f2e6; }

.pager button:disabled { opacity: .45; cursor: default; }

.pager .info { margin-left: 12px; color: var(--ink-3); font-size: 12px; }

.empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--ink-3);
}

.empty h3 { margin: 14px 0 6px; font-family: var(--serif); font-weight: 500; color: var(--ink-2); font-size: 18px; }

.skeleton-card { border-radius: 8px; aspect-ratio: 2/3; background: linear-gradient(100deg, #ece4d5 30%, #f4eee2 50%, #ece4d5 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }

@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 阅读页 ---------- */

.reader-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
  padding: 0 22px;
  background: rgba(250, 247, 240, .92);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.reader-topbar .rt-title { min-width: 0; display: flex; align-items: baseline; gap: 10px; }

.rt-title .zh {
  font-family: var(--serif);
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.rt-title .en {
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--serif);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.rt-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 12px;
  border-radius: 9px;
  font-size: 12px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: #fffdf8;
  user-select: none;
}

.switch {
  position: relative;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: #d8d0c0;
  transition: background .18s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .18s ease;
}

.switch.on { background: var(--accent); }

.switch.on::after { transform: translateX(15px); }

.font-size { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fffdf8; overflow: hidden; }

.font-size button { width: 34px; height: 32px; border: none; background: transparent; color: var(--ink-2); font-size: 13px; }

.font-size button:hover { background: rgba(33, 30, 25, .06); }

.font-size .size { font-family: var(--serif); }

.top-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }

.top-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }

.reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  align-items: start;
  min-height: calc(100vh - 62px);
}

.reader-main { min-width: 0; padding: 46px 40px 140px; }

.reading { max-width: 720px; margin: 0 auto; }

.book-head { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 30px; }

.book-head .bh-cover {
  width: 108px;
  height: 158px;
  border-radius: 6px;
  object-fit: cover;
  background: linear-gradient(150deg, #e2d9c8, #c8bba4);
  box-shadow: 0 10px 26px rgba(52, 44, 30, .2);
  flex: none;
}

.book-head .bh-body { min-width: 0; padding-top: 4px; }

.book-head h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: .01em;
}

.book-head .h-en { font-family: var(--serif); font-size: 16px; color: var(--ink-2); margin-bottom: 14px; }

.book-head .h-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 12px; color: var(--ink-3); align-items: center; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11px;
}

.book-head .h-author { font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }

.divider { height: 1px; background: var(--line); margin: 0 0 34px; }

.reading-body { font-family: var(--serif); font-size: var(--reading-size, 19px); line-height: 1.95; color: #2a261f; }

.reading-body p { margin: 0 0 22px; }

.reading-body .p-en { letter-spacing: .002em; }

.reading-body .p-zh {
  font-family: var(--sans);
  font-size: calc(var(--reading-size, 19px) - 3px);
  line-height: 1.9;
  color: #6a6357;
  padding: 12px 16px;
  margin: -8px 0 30px;
  background: rgba(233, 226, 210, .45);
  border-left: 3px solid #cdbfa2;
  border-radius: 0 8px 8px 0;
}

body.hide-zh .p-zh { display: none; }

/* AI 引用的那一段：淡底 + 左侧竖线。
   只用背景和 inset 阴影——它们不占盒模型，不会把分栏宽度挤变、分页错位 */
.reading-body .p-en.ai-para {
  background: rgba(31, 111, 92, .055);
  box-shadow: inset 3px 0 0 rgba(31, 111, 92, .45);
  border-radius: 4px;
}

.reading-body .p-zh.ai-para {
  background: rgba(31, 111, 92, .07);
  border-left-color: rgba(31, 111, 92, .55);
}

.reading-body h3 {
  margin: 34px 0 14px;
  font-family: var(--serif);
  font-size: calc(var(--reading-size, 19px) + 1px);
  font-weight: 600;
  letter-spacing: .02em;
  color: #3d372c;
}

.reading-body em { font-style: italic; }

.w {
  border-radius: 3px;
  cursor: pointer;
  transition: background .12s ease;
  padding: 0 1px;
}

.w:hover { background: #e4efe9; }

.w.active { background: #cfe4da; box-shadow: 0 1px 0 #1f6f5c inset; }

.author-block {
  margin-top: 40px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.author-block summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: .04em;
  outline: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.author-block summary::-webkit-details-marker { display: none; }

.author-block summary::before { content: "＋"; color: var(--ink-3); }

.author-block[open] summary::before { content: "－"; }

.author-block .bio { margin-top: 16px; font-size: 13px; line-height: 1.9; color: var(--ink-2); }

.author-block .bio .en { font-family: var(--serif); color: var(--ink-3); margin-top: 10px; }

.book-foot-note { margin-top: 36px; font-size: 11px; color: var(--ink-3); line-height: 1.8; }

/* 侧栏 */

.aside {
  position: sticky;
  top: 62px;
  height: calc(100vh - 62px);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line-soft);
  background: var(--surface);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  flex: none;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.panel-head .ph-title { font-weight: 600; color: var(--ink-2); }

.panel-head .ph-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.word-panel { flex: none; max-height: 46%; display: flex; flex-direction: column; border-bottom: 1px solid var(--line-soft); }

.word-scroll { overflow-y: auto; padding: 18px; flex: 1; }

.word-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px 18px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.8;
}

.word-empty svg { opacity: .45; }

.word-top { display: flex; align-items: flex-start; gap: 10px; }

.word-top .w-word {
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: .01em;
  word-break: break-word;
}

.word-top .speak {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fffdf8;
  display: grid;
  place-items: center;
  color: var(--accent);
  flex: none;
  margin-top: 3px;
}

.word-top .speak:hover { background: var(--accent-soft); }

.word-phonetic {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-3);
  font-family: var(--serif);
  letter-spacing: .02em;
}

.meaning { padding: 14px 0; border-bottom: 1px dashed var(--line-soft); }

.meaning:last-of-type { border-bottom: none; }

.meaning .m-head { display: flex; gap: 8px; align-items: baseline; }

.pos {
  flex: none;
  font-size: 11px;
  color: var(--gold);
  font-family: var(--serif);
  font-style: italic;
}

.m-zh { font-size: 14px; line-height: 1.7; color: var(--ink); }

.m-en { margin-top: 4px; font-size: 12px; line-height: 1.7; color: var(--ink-3); font-family: var(--serif); }

.m-ex {
  margin-top: 8px;
  padding-left: 10px;
  border-left: 2px solid var(--line);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-2);
  font-family: var(--serif);
}

.m-ex .ex-zh { color: var(--ink-3); font-family: var(--sans); font-size: 11.5px; }

.word-note { margin-top: 12px; font-size: 11.5px; line-height: 1.8; color: var(--ink-3); }

.word-actions { display: flex; gap: 8px; margin-top: 16px; }

.word-source { margin-top: 14px; font-size: 10.5px; color: #b3a897; letter-spacing: .04em; }

/* 变形词标签页：当前词形 / 原型 */

.word-tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.word-tabs::-webkit-scrollbar { display: none; }

.w-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 10px 8px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
}

.w-tab .tab-word { font-family: var(--serif); font-size: 15.5px; letter-spacing: .01em; }

.w-tab .tab-badge {
  padding: 1px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.6;
}

.w-tab:hover { color: var(--ink-2); }

.w-tab.active { color: var(--ink); border-bottom-color: var(--accent); }

.w-tab.active .tab-badge {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.word-pane.hidden { display: none; }

.word-hint {
  margin-top: 10px;
  padding: 7px 10px;
  border-left: 2px solid var(--gold);
  background: var(--surface-soft);
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--ink-2);
}

.word-phonetic .ph-item + .ph-item { margin-left: 14px; }

.word-detail {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 16px;
  padding-bottom: 1px;
  font-size: 12px;
  color: var(--accent);
  border-bottom: 1px solid rgba(31, 111, 92, .4);
  letter-spacing: .02em;
  cursor: pointer;
}

.word-detail .wd-arrow { font-style: normal; font-size: 12px; transition: transform .16s ease; }

.word-detail:hover { color: var(--accent-deep); border-bottom-color: currentColor; }

.word-detail:hover .wd-arrow { transform: translateX(2px); }

.word-detail:active { color: var(--accent-deep); }

.word-loading { display: flex; align-items: center; gap: 9px; color: var(--ink-3); font-size: 12.5px; padding: 8px 0; }

.word-loading .spinner { border-color: rgba(31, 111, 92, .2); border-top-color: var(--accent); }

.word-error { color: var(--danger); font-size: 12.5px; line-height: 1.8; padding: 6px 0; }

/* 对话 */

.chat-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface-soft); }

.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 16px 8px; }

.msg { display: flex; gap: 8px; margin-bottom: 14px; animation: fadeUp .2s ease both; }

.msg .bubble {
  max-width: 100%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.75;
  word-break: break-word;
}

.msg.user { justify-content: flex-end; }

.msg.user .bubble { background: var(--accent); color: #f6fbf9; border-bottom-right-radius: 4px; white-space: pre-wrap; }

.msg.bot .bubble { background: #fffdf8; border: 1px solid var(--line-soft); color: var(--ink); border-bottom-left-radius: 4px; }

.msg.bot .bubble p { margin: 0 0 8px; }

.msg.bot .bubble p:last-child { margin-bottom: 0; }

.msg.bot .bubble code { background: #efe9db; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.msg .dot-typing { display: inline-flex; gap: 3px; padding: 4px 2px; }

.msg .dot-typing i { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }

.msg .dot-typing i:nth-child(2) { animation-delay: .2s; }

.msg .dot-typing i:nth-child(3) { animation-delay: .4s; }

@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.chat-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 16px 10px; }

.chat-quick button {
  height: 27px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink-2);
  font-size: 11.5px;
}

.chat-quick button:hover { border-color: var(--accent); color: var(--accent-deep); }

.composer { flex: none; padding: 10px 12px 12px; border-top: 1px solid var(--line-soft); background: var(--surface); }

.composer-box {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fffefb;
  padding: 8px 8px 6px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 111, 92, .1); }

.composer textarea {
  width: 100%;
  min-height: 38px;
  max-height: 120px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  padding: 2px 4px;
}

.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.composer-foot .hint { font-size: 10.5px; color: #b3a897; padding-left: 4px; }

.hint-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }

.para-hint {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 10px;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* AI 引用的段落：面板顶部这条常驻，段号可点回跳 */
.para-anchor {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 8px 16px 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(31, 111, 92, .16);
  font-size: 11px;
  line-height: 1.5;
  color: var(--accent-deep);
}

.para-anchor[hidden] { display: none; }

.pa-tag {
  flex: none;
  font-size: 9.5px;
  letter-spacing: .08em;
  opacity: .75;
}

.pa-jump {
  flex: none;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent-deep);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.pa-jump:hover { color: var(--accent); }

.pa-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
  font-size: 10.5px;
  font-family: var(--serif);
}

.send-btn {
  height: 30px;
  padding: 0 14px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #f5fbf8;
  font-size: 12.5px;
}

.send-btn:disabled { opacity: .5; cursor: default; }

.chat-banner {
  margin: 10px 16px 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fdf3e3;
  border: 1px solid #f0dfbe;
  color: #8a6a2f;
  font-size: 11.5px;
  line-height: 1.7;
}

.chat-banner code { background: rgba(138, 106, 47, .1); padding: 1px 4px; border-radius: 4px; }

.drawer-toggle { display: none; }

/* 响应式 */

@media (max-width: 1180px) {
  .read-aside-backdrop { display: none; }
}

@media (max-width: 1080px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .reader-layout { grid-template-columns: 1fr; }
  .aside {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(392px, 92vw);
    height: 100vh;
    z-index: 60;
    transform: translateX(102%);
    transition: transform .25s ease;
    box-shadow: -10px 0 40px rgba(40, 33, 20, .16);
    border-left: 1px solid var(--line);
  }
  .aside.open { transform: translateX(0); }
  .drawer-toggle { display: inline-flex; }
  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(30, 26, 18, .34);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .drawer-backdrop.show { opacity: 1; pointer-events: auto; }
}

@media (max-width: 760px) {
  .app-header { padding: 0 16px; gap: 12px; }
  .app-header .brand span.name { display: none; }
  /* 书库页窄屏：一行里已经塞了站徽、赞助、排序、头像，再挤一个「查询」按钮就没法用了，
     所以把检索框整行折下去。只认 .app-header-search，别的页面页头不动。 */
  .app-header-search { flex-wrap: wrap; height: auto; padding: 10px 16px; row-gap: 10px; }
  .app-header-search .search-box { order: 9; flex: 1 0 100%; max-width: none; }
  .app-header-search .search-box input { padding-right: 66px; }
  .search-box { max-width: none; }
  .header-right .user-name { display: none; }
  .main { padding: 20px 16px 60px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 14px; }
  .reader-main { padding: 26px 18px 110px; }
  .book-head { gap: 16px; }
  .book-head .bh-cover { width: 78px; height: 114px; }
  .book-head h1 { font-size: 24px; }
  .rt-title .en { display: none; }
  .rt-title .zh { max-width: 34vw; }
  .reader-topbar { padding: 0 8px; gap: 6px; }
  /* 中文开关窄屏收进了 Aa 浮层（见文件末尾），浮层里有位置放「中文」两个字 */
}

/* 流式输出光标 */
.caret {
  display: inline-block;
  margin-left: 1px;
  color: var(--accent);
  animation: caretBlink 1s steps(2, start) infinite;
}

@keyframes caretBlink { to { opacity: 0; } }

/* 中英切换关闭时隐藏分隔 */
body.hide-zh .p-zh { display: none; }

/* ---------- 整页翻页阅读 ---------- */

body.reading-mode { overflow: hidden; }

.reader-layout { height: calc(100vh - 62px); min-height: 0; align-items: stretch; }

.reader-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding: 16px 34px 12px;
}

.book-strip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.bs-cover {
  width: 54px;
  height: 78px;
  object-fit: cover;
  border-radius: 4px;
  flex: none;
  background: linear-gradient(150deg, #e2d9c8, #c8bba4);
  box-shadow: 0 6px 16px rgba(52, 44, 30, .18);
}

.bs-text { min-width: 0; }

.bs-text h1 {
  margin: 0 0 3px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bs-en {
  font-family: var(--serif);
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bs-author { font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }

.bs-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 11.5px; color: var(--ink-3); }

.bs-meta .tag { height: 20px; font-size: 10.5px; }

.page-viewport { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }

/* ---------- 正文最前面的中英文简介（是正文的一部分，不单独占页） ---------- */
.page-track .ip-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--ink-3);
  margin: 0 0 10px;
}

.page-track .ip-label + .ip-label,
.page-track .ip-zh + .ip-label,
.page-track .ip-en + .ip-label { margin-top: 20px; }

.page-track .ip-label:first-child { margin-top: 0; }

.page-track .ip-zh {
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: calc(var(--reading-size, 19px) - 3px);
  line-height: 1.85;
  color: #5f584d;
}

.page-track .ip-en { margin: 0 0 12px; }

/* 简介固定中英并排：不跟「中文」开关走（开关管的是正文译文，简介本来就是双语介绍） */

.ip-rule {
  height: 1px;
  margin: 20px 0 28px;
  background: var(--line);
  break-inside: avoid;
}

.page-track {
  height: 100%;
  column-fill: auto;
  column-gap: 56px;
  will-change: transform;
  transition: transform .13s cubic-bezier(.25, .6, .3, 1);
  padding-right: 4px;
}

/* 换字号、开合译文、初次落位时不要跨几十页滑过去 */
.page-track.track-instant { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .page-track { transition: none; }
}

.page-track p { margin: 0 0 20px; }

.page-track h3 { break-after: avoid; }

.page-track .p-h-zh {
  display: block;
  margin-top: 4px;
  font-family: var(--sans);
  font-size: .7em;
  font-weight: 400;
  color: var(--ink-3);
  letter-spacing: 0;
}

.page-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, .94);
  color: var(--ink-2);
  font-size: 21px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s ease;
  box-shadow: var(--shadow-sm);
}

.page-viewport:hover .page-arrow:not(:disabled) { opacity: 1; }
.page-arrow.prev { left: -8px; }
.page-arrow.next { right: -8px; }
.page-arrow:disabled { display: none; }

.pager-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--ink-3);
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink-2);
  font-size: 12.5px;
}

.pager-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-deep); }
.pager-btn:disabled { opacity: .42; cursor: default; }

/* 当前段号本身就是输入框：点进去全选，输数字回车就跳过去（不用一页页翻）。
   平时看着只是加粗的数字，只留一条浅底边暗示可以点；聚焦才长出完整边框 */
.pager-seek {
  width: 3.8em;
  margin: 0 2px;
  padding: 1px 3px;
  border: 1px solid transparent;
  border-bottom-color: #ddd0b9;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.pager-seek:hover { background: #f6efe1; border-bottom-color: #c8b795; }
.pager-seek:focus {
  outline: none;
  border-color: var(--accent);
  background: #fffdf8;
}

.pager-hint { margin-left: 10px; font-size: 11px; color: #b3a897; }

/* 底栏里的按钮/输入框一律不收缩、文字不折行：
   窄屏时宁可整行换行，也别把「上一页」压成「上一 / 页」 */
.pager-bar > button,
.pager-bar > span:not(.pager-copy) { flex: 0 0 auto; }
.pager-btn,
.pager-info { white-space: nowrap; }

.page-loading { padding: 40px 8px; color: var(--ink-3); font-size: 13px; }

.link { color: var(--accent-deep); text-decoration: underline; }

/* ---------- 模型设置页 ---------- */

/* 左栏标签 + 右栏内容：总宽比单栏时代放宽，右栏正文宽度仍和原来差不多 */
.settings-main { max-width: 1020px; margin: 0 auto; padding: 34px 24px 80px; }

.settings-head { margin-bottom: 24px; }

.settings-head h1 { font-family: var(--serif); font-size: 28px; font-weight: 500; margin: 0 0 8px; }

.settings-head p { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.9; }

.settings-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.settings-card + .settings-card { margin-top: 18px; }

.field { margin-bottom: 18px; }

.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 7px; letter-spacing: .02em; }

.field .help { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.7; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.settings-card .input { width: 100%; height: 40px; }

.key-wrap { display: flex; gap: 8px; }

.key-wrap .input { flex: 1; }

.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.preset {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink-2);
  font-size: 12px;
}

.preset:hover, .preset.on { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }

.settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }

.settings-status { margin-top: 14px; font-size: 12.5px; line-height: 1.8; }

.settings-status.ok { color: var(--accent-deep); }
.settings-status.err { color: var(--danger); }
.settings-status.info { color: var(--ink-3); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #c9a227; }

.status-pill.ok i { background: var(--accent); }
.status-pill.off i { background: var(--danger); }

@media (max-width: 1080px) {
  .reader-main { height: 100%; }
}

@media (max-width: 760px) {
  .reader-main { padding: 10px 16px 8px; }
  .bs-cover { width: 40px; height: 58px; }
  .bs-text h1 { font-size: 17px; }
  .pager-hint { display: none; }
  .pager-bar { flex-wrap: wrap; gap: 8px 10px; }
  .pager-seek { width: 3.4em; }
  .field-row { grid-template-columns: 1fr; }
  .settings-main { padding: 22px 16px 60px; }
}

/* 标题里的中文行不套用段落的底色内边距 */
.page-track h3 .p-h-zh {
  background: none;
  border: none;
  padding: 0;
  margin: 4px 0 0;
}

/* ---------------- 单词详情页（临时版式） ---------------- */

body.word-page { min-height: 100%; background: var(--bg); }

.wp-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 20px;
  background: rgba(245, 241, 232, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}

.wp-title { font-size: 14px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; }

/* 左栏宽度固定在 720px（窄屏占满一行），不跟内容走：
   它是 .wp-layout 的 grid 子项，一旦只写 margin:0 auto 就不会 stretch，
   会按内容收缩/撑开（短词 771px、长词撑到 1065px），整页宽度每次查词都在跳。
   所以显式 width:100% 撑满列 + min-width:0 允许长内容压缩换行。 */
.wp-main {
  width: 100%;
  min-width: 0;
  max-width: 720px;
  margin: 0 auto;
  padding: 30px 20px 70px;
}

.wp-loading { padding: 40px 0; text-align: center; color: var(--ink-3); font-size: 13px; }

.wp-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 30px 32px 26px;
}

.wp-head { display: flex; align-items: flex-start; gap: 12px; }

.wp-word {
  margin: 0;
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: .01em;
  word-break: break-word;
}

.wp-head .speak {
  flex: none;
  width: 32px;
  height: 32px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fffdf8;
  color: var(--accent);
  display: grid;
  place-items: center;
}

.wp-head .speak:hover { background: var(--accent-soft); }

.wp-phonetic {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-3);
}

.wp-phonetic .ph-item + .ph-item { margin-left: 16px; }

.wp-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }

.wp-chip {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface-soft);
}

.wp-chip.accent { border-color: transparent; background: var(--accent-soft); color: var(--accent-deep); }

.wp-chip.gold { border-color: transparent; background: #f6ecd8; color: var(--gold); }

.wp-hint {
  margin-top: 16px;
  padding: 9px 12px;
  border-left: 2px solid var(--gold);
  background: var(--surface-soft);
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-2);
}

.wp-section { margin-top: 26px; }

.wp-section-title {
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.wp-meaning { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line-soft); }

.wp-meaning:last-child { border-bottom: none; }

.wp-def { font-size: 14.5px; line-height: 1.75; color: var(--ink); }

.wp-empty { color: var(--ink-3); font-size: 12.5px; }

.wp-near-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }

/* 邻近词是正文卡片里最后一块（AI 分析下面）：上面拉一条细线，
   和前面几个栏目分开，看着像「继续查下一个词」的出口 */
.word-page .wp-card > .wp-section:last-of-type .wp-near-row {
  padding-top: 12px;
  border-top: 1px dashed var(--line-soft);
}

.wp-near-group { display: flex; align-items: center; gap: 8px; }

.wp-near-label { flex: none; font-size: 11px; letter-spacing: .08em; color: var(--ink-3); }

.wp-neighbor {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink-2);
  font-size: 13px;
  font-family: var(--serif);
}

.wp-neighbor i { margin-left: 6px; font-family: var(--sans); font-style: normal; font-size: 10.5px; color: var(--ink-3); }

.wp-neighbor:hover { border-color: var(--accent); color: var(--accent-deep); }

.wp-foot { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: 11px; color: #b3a897; }

@media (max-width: 640px) {
  .wp-card { padding: 22px 18px 20px; border-radius: 12px; }
  .wp-word { font-size: 30px; }
}

/* ---------------- 顶部导航（书库 / 生词本 / 复习） ---------------- */

.top-nav { display: flex; align-items: center; gap: 4px; margin-left: 18px; }

.top-nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: .02em;
  transition: background .15s, color .15s;
}

.top-nav a:hover { background: var(--surface-soft); color: var(--ink); }

.top-nav a.active { color: var(--accent-deep); background: var(--accent-soft); font-weight: 600; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 16px);
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(33, 30, 25, .92);
  color: #f8f4ea;
  font-size: 13px;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 生词本 ---------------- */

body.vocab-page { background: var(--bg); }

.vocab-main { max-width: 1322px; margin: 0 auto; padding: 30px 24px 80px; }

.vocab-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

.vocab-hero h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: .01em;
}

.vocab-hero p { margin: 0; color: var(--ink-3); font-size: 13px; line-height: 1.7; }

.btn-lg { height: 44px; padding: 0 22px; font-size: 14px; border-radius: 10px; }

.vocab-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 22px 0 18px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.stat-card:hover { border-color: #d5cab5; box-shadow: var(--shadow); }
.stat-card:active { transform: translateY(1px); }
.stat-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.stat-card.accent { background: var(--accent-soft); border-color: #cfe3db; }
.stat-card.accent:hover { border-color: var(--accent); }

.stat-num { font-family: var(--serif); font-size: 26px; line-height: 1.2; color: var(--ink); }

.stat-card.accent .stat-num { color: var(--accent-deep); }

.stat-label { font-size: 11.5px; color: var(--ink-3); letter-spacing: .06em; }

.vocab-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.seg { display: inline-flex; padding: 3px; background: var(--surface-soft); border-radius: 9px; }

.seg button {
  border: none;
  background: none;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

/* 标签上的词数：数字小一号、灰一点，选中时加深，0 更淡 */
.seg-num {
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(120, 108, 88, .1);
  color: var(--ink-3);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 18px;
  text-align: center;
}

.seg-num.zero { opacity: .45; }
.seg button.on .seg-num { background: var(--accent-soft); color: var(--accent-deep); opacity: 1; }

.vocab-search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdf8;
  color: var(--ink-3);
  min-width: 180px;
  margin-left: auto;
}

.vocab-search input { border: none; outline: none; background: none; font-size: 13px; color: var(--ink); width: 150px; }

.import-wrap { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.select-sm { height: 34px; padding: 0 8px; font-size: 12.5px; border-radius: 9px; }

.vocab-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }

.vocab-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.vocab-empty.error { color: var(--danger); }

.vrow {
  display: grid;
  grid-template-columns: 190px 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s, opacity .2s, transform .2s;
}

.vrow:hover { border-color: #d5cab5; box-shadow: var(--shadow-sm); }

.vrow.leaving { opacity: 0; transform: translateX(12px); }

.vrow-head { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.vrow-word {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
}

.vrow-word:hover { color: var(--accent-deep); }

.vrow-ph { font-family: var(--serif); font-size: 12px; color: var(--ink-3); }

.vrow-def {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.65;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.vrow-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.vstate { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }

.vstate.new { background: #f2ead9; color: var(--gold); }
.vstate.learn { background: var(--accent-soft); color: var(--accent-deep); }
.vstate.done { background: #eeeae1; color: var(--ink-3); }

.vtag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f6f1e4;
  color: #8a7448;
  border: 1px solid #ece2cc;
  white-space: nowrap;
}

.vsrc { font-size: 11px; color: #b3a897; white-space: nowrap; }

.vrow-del {
  border: 1px solid transparent;
  background: none;
  color: var(--ink-3);
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 7px;
}

.vrow-del:hover { border-color: #e6c9c4; color: var(--danger); background: #fbefed; }

.vocab-page .pager { margin-top: 18px; }

/* ---------------- 复习 ---------------- */

body.review-page { background: var(--bg); }

.review-main { max-width: 1240px; margin: 0 auto; padding: 26px 24px 70px; }

.review-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

.review-head h1 { margin: 0 0 6px; font-family: var(--serif); font-size: 28px; font-weight: 600; }

.review-head p { margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; max-width: 560px; }

.review-summary { display: flex; gap: 10px; }

.rs-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 16px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 108px;
}

.rs-item.due { background: var(--accent-soft); border-color: #cfe3db; }

.rs-item b { font-family: var(--serif); font-size: 20px; line-height: 1.2; }

.rs-item.due b { color: var(--accent-deep); }

.rs-item span { font-size: 11px; color: var(--ink-3); }

.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 20px; align-items: start; }

.review-col { min-width: 0; }

.review-col-head { display: flex; align-items: center; gap: 10px; }

.review-col-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .02em; }

.review-badge {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f2ead9;
  color: var(--gold);
}

.review-badge.due { background: var(--accent-soft); color: var(--accent-deep); }

/* 出词方式：顺序 / 随机，弱化处理，只是提示 */
.review-badge.mode {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-weight: 400;
}

.review-hint { margin: 6px 0 12px; font-size: 11.5px; color: #a99f8e; line-height: 1.7; }

.review-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }

.rcard {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 14px 14px 12px;
  transition: opacity .22s, transform .22s;
}

.rcard.leaving { opacity: 0; transform: translateY(-8px) scale(.97); }

.rcard-detail {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 3;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink-3);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  /* 是 <a target="_blank">，不是按钮：去掉下划线，保持胶囊大小 */
  display: inline-block;
  line-height: 1.5;
  text-decoration: none;
}

.rcard-detail:hover { border-color: var(--accent); color: var(--accent-deep); }

.rcard-flip {
  position: relative;
  height: 118px;
  transform-style: preserve-3d;
  transition: transform .52s cubic-bezier(.4, .16, .2, 1);
  cursor: pointer;
}

.rcard.flipped .rcard-flip { transform: rotateY(180deg); }

.rcard-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 42px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 10px;
  text-align: center;
}

.rcard-front { background: linear-gradient(#fffdf8, #faf5ea); border: 1px solid var(--line-soft); }

.rcard-back { background: #f7f3e9; border: 1px solid var(--line-soft); transform: rotateY(180deg); overflow: hidden; }

.rcard-word {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--ink);
  word-break: break-word;
  line-height: 1.2;
}

.rcard-word-sm { font-family: var(--serif); font-size: 17px; font-weight: 700; color: var(--ink-2); }

.rcard-ph { font-family: var(--serif); font-size: 12.5px; color: var(--accent-deep); }

.rcard-def {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.rcard-meta { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }

.rcard-tip { font-size: 10.5px; color: #c3b9a8; letter-spacing: .08em; }

.rcard-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }

.ract {
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fffdf8;
  font-size: 13px;
  color: var(--ink-2);
  transition: background .15s, border-color .15s, color .15s;
}

.ract:hover { border-color: #cfc4af; }

.ract.ok { border-color: #bfd9cf; background: #eef6f1; color: var(--accent-deep); font-weight: 600; }
.ract.ok:hover { background: #ddeee5; }

.ract.mid { border-color: #e6d6b4; background: #fbf3e2; color: #8a6a30; }
.ract.mid:hover { background: #f6e9cf; }

.ract.no { border-color: #e8cbc6; background: #fdf1ef; color: var(--danger); }
.ract.no:hover { background: #fae3df; }

.ract.kill { border-color: #d9d3c7; background: #f1ede4; color: #5b554a; }
.ract.kill:hover { background: #e7e1d4; }

.ract:disabled { opacity: .5; cursor: default; }

.review-done {
  padding: 30px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.review-done.error { color: var(--danger); }

@media (max-width: 980px) {
  .review-grid { grid-template-columns: 1fr; }
  .vocab-stats { grid-template-columns: repeat(2, 1fr); }
  .vrow { grid-template-columns: 1fr auto; row-gap: 8px; }
  .vrow-def { grid-column: 1 / -1; }
  .vrow-meta { justify-content: flex-start; grid-column: 1 / -1; }
  .vrow-del { grid-row: 1; grid-column: 2; }
  .import-wrap { margin-left: 0; }
}

/* ---------------- 查词首页 ---------------- */

body.home-page {
  background:
    radial-gradient(60% 46% at 50% 0%, #fbf7ec 0%, rgba(251, 247, 236, 0) 70%),
    var(--bg);
}

.home-main { max-width: 960px; margin: 0 auto; padding: 0 24px 70px; }

.home-hero { padding: 78px 0 0; text-align: center; }

.home-eyebrow {
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.home-hero h1 {
  margin: 16px 0 10px;
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: .01em;
}

.home-sub { margin: 0; font-size: 13.5px; color: var(--ink-3); line-height: 1.8; }

.br-mobile { display: none; }

/* 搜索框 */
.dict-search { position: relative; max-width: 660px; margin: 30px auto 0; z-index: 20; }

.dict-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 0 8px 0 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.dict-search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 111, 92, .1), var(--shadow-md);
}

.dict-search-field > svg { color: var(--ink-3); flex: none; }

#wordInput {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: .01em;
}

#wordInput::placeholder { color: #b7ae9c; font-size: 15px; }

.dict-clear {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(33, 30, 25, .06);
  color: var(--ink-3);
  transition: background .15s, color .15s;
}

.dict-clear:hover { background: rgba(33, 30, 25, .12); color: var(--ink); }

.dict-go { flex: none; height: 44px; padding: 0 20px; border-radius: 11px; }

/* 下拉提示 */
.dict-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeUp .14s ease;
  text-align: left;
}

.ds-list { max-height: 428px; overflow-y: auto; padding: 6px; }

.ds-list::-webkit-scrollbar { width: 8px; }
.ds-list::-webkit-scrollbar-thumb { background: #e2d9c7; border-radius: 4px; }

.ds-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background .12s ease;
}

.ds-item.on { background: var(--accent-soft); }

.ds-word {
  flex: none;
  min-width: 108px;
  max-width: 200px;
  font-family: var(--serif);
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-word em { font-style: normal; color: var(--accent-deep); font-weight: 700; }

/* 本地词库下拉：词形 + 一行简单释义（释义随词库一起下发，不再打开详情页才看到） */
.ds-item.is-word { padding: 9px 14px; gap: 14px; }
.ds-item.is-word .ds-word {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 46%;
  font-size: 16.5px;
  letter-spacing: .01em;
}
.ds-item.is-word .ds-def { font-size: 12.5px; }

/* 中文下拉：标题是中文词条本身（用户输入的几个字加深），英文写法在右边当副标题 */
.ds-word.cn {
  min-width: 96px;
  max-width: 260px;
  font-size: 15.5px;
  letter-spacing: .01em;
}

.ds-word.cn b { color: var(--accent-deep); font-weight: 700; }

/* 中文模式下右边是英文写法，弱化一点，别和中文标题抢注意力 */
.ds-def.cn { color: var(--ink-3); font-size: 12px; }

.ds-ph {
  flex: none;
  width: 84px;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-def {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-lemma { flex: none; font-size: 10.5px; color: var(--gold); white-space: nowrap; }

.ds-tag {
  flex: none;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid #e9ddc3;
  background: #f7f0e0;
  font-size: 10px;
  color: #8b6a35;
  white-space: nowrap;
}

/* 汉英提示：命中的中文词条（用户输入的那几个字加深） */
.ds-tag.cn {
  border-color: #cfe3da;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.ds-tag.cn b { font-weight: 700; color: var(--accent); }

.ds-foot {
  padding: 8px 14px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-soft);
  font-size: 11.5px;
  color: var(--ink-3);
}

.ds-empty { padding: 20px 16px; text-align: center; font-size: 12.5px; color: var(--ink-3); }

.home-meta {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .02em;
}

.home-meta .dot { opacity: .45; }

/* 入口卡片 */
.home-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 62px;
}

.home-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.home-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #d9cfba;
}

.hc-icon {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.hc-icon.vocab { background: #f7eeda; color: var(--gold); }
.hc-icon.conf { background: #efeade; color: var(--ink-2); }

.hc-body { flex: 1; min-width: 0; }

.hc-body h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}

.hc-body p { margin: 0; font-size: 12px; line-height: 1.7; color: var(--ink-3); }

.hc-badge {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .02em;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fbeceb;
  border: 1px solid #f0d6d2;
  color: var(--danger);
}

.hc-arrow { align-self: center; color: #cabfab; font-size: 14px; }

.home-foot { margin-top: 46px; text-align: center; font-size: 11.5px; color: var(--ink-3); }

.home-foot code {
  padding: 1px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--surface-soft);
  font-size: 11px;
}

/* 登录页回查词入口 */
.auth-back { margin-top: 18px; text-align: center; font-size: 12px; color: var(--ink-3); }
.auth-back a { color: var(--ink-2); border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.auth-back a:hover { color: var(--accent-deep); border-color: var(--accent); }

@media (max-width: 860px) {
  .home-main { padding: 0 16px 56px; }
  .home-hero { padding-top: 48px; }
  .home-hero h1 { font-size: 31px; }
  .br-mobile { display: inline; }
  .home-cards { grid-template-columns: 1fr; gap: 10px; margin-top: 42px; }
  .dict-search-field { height: 54px; padding-left: 14px; }
  #wordInput { font-size: 16px; }
  .dict-go { height: 40px; padding: 0 14px; font-size: 13px; }
  .ds-list { max-height: 60vh; }
  .ds-ph { display: none; }
  .ds-word { min-width: 88px; }
  .ds-lemma { display: none; }
  /* 窄屏：词形最多占一半，剩下的给释义（释义单行省略，不换行） */
  .ds-item.is-word { gap: 10px; padding: 9px 12px; }
  .ds-item.is-word .ds-word { min-width: 0; max-width: 50%; font-size: 16px; }
  .app-header { gap: 12px; padding: 0 16px; }
  .top-nav { margin-left: 0; gap: 0; overflow-x: auto; }
  .top-nav a { padding: 7px 8px; }
  .user-name { display: none; }
}

/* ---------------- 滑动校验（防爬虫） ---------------- */

body.guard-open { overflow: hidden; }

.guard-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(33, 30, 25, .42);
  backdrop-filter: blur(3px);
}

.guard-mask.show { display: flex; animation: guardFade .16s ease; }

@keyframes guardFade { from { opacity: 0; } to { opacity: 1; } }

.guard-card {
  width: 344px;
  max-width: 100%;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  animation: guardIn .2s ease;
}

@keyframes guardIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.guard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.guard-head h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .01em;
}

.guard-head p { margin: 0; font-size: 12px; line-height: 1.65; color: var(--ink-3); }

.guard-close {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  transition: background .15s, color .15s;
}

.guard-close:hover { background: rgba(33, 30, 25, .06); color: var(--ink); }

.guard-stage { margin: 16px 0 8px; }

.guard-track {
  position: relative;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-soft);
}

.guard-bg {
  display: block;
  width: 280px;
  height: 56px;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.guard-piece {
  position: absolute;
  left: 0;
  top: 8px;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  border: 1px solid #bda986;
  background: linear-gradient(180deg, #f4ecda, #e2d4b6);
  box-shadow: 0 4px 10px rgba(72, 58, 30, .28);
  pointer-events: none;
  transition: box-shadow .18s ease;
}

.guard-rail {
  position: relative;
  height: 40px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #efe9dc;
}

.guard-rail-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--ink-3);
  transition: opacity .15s ease;
}

.guard-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, rgba(31, 111, 92, .1), rgba(31, 111, 92, .2));
}

.guard-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #f7fcfa;
  box-shadow: 0 2px 8px rgba(31, 111, 92, .35);
  cursor: grab;
  touch-action: none;
}

.guard-card.dragging .guard-handle { cursor: grabbing; }
.guard-card.busy .guard-handle { opacity: .75; cursor: default; }

.guard-card.ok .guard-piece {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(31, 111, 92, .35), 0 4px 10px rgba(72, 58, 30, .22);
}

.guard-card.error .guard-track,
.guard-card.error .guard-rail { animation: guardShake .34s ease; }

@keyframes guardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.guard-msg {
  min-height: 17px;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .01em;
}

.guard-msg.error { color: var(--danger); }
.guard-msg.ok { color: var(--accent-deep); }

.guard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.guard-refresh {
  flex: none;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-size: 11.5px;
  color: var(--ink-2);
}

.guard-refresh:hover { background: var(--surface-soft); border-color: var(--line-soft); }

.guard-note {
  font-size: 10.5px;
  line-height: 1.5;
  color: #b3aa99;
  text-align: right;
}

/* ---------------- 门禁确认（L2 公众号） ---------------- */

.gate-card { width: 476px; max-width: calc(100vw - 24px); }

.gate-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-top: 14px;
}

.gate-left { min-width: 0; }

.gate-label { font-size: 12px; color: var(--ink-3); }

.gate-code {
  margin: 8px 0 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 30px;
  letter-spacing: .26em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  cursor: pointer;
  user-select: all;
  transition: color .2s ease;
}

.gate-card.ok .gate-code { color: var(--accent-deep); }

.gate-count { font-size: 11.5px; color: var(--ink-3); }

.gate-refresh {
  margin-top: 8px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-size: 11.5px;
  color: var(--ink-2);
}

.gate-refresh:hover { background: var(--surface-soft); border-color: var(--line-soft); }

.gate-right { text-align: center; }

.gate-qr {
  width: 108px;
  height: 108px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: var(--surface-soft);
  object-fit: cover;
}

.gate-account { margin-top: 6px; font-size: 12px; color: var(--ink-2); }

.gate-hint {
  margin-top: 4px;
  max-width: 148px;
  font-size: 10.5px;
  line-height: 1.5;
  color: #b3aa99;
}

.gate-foot {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.gate-msg { font-size: 11.5px; color: var(--ink-3); }
.gate-msg.error { color: var(--danger); }
.gate-msg.ok { color: var(--accent-deep); }

@media (max-width: 520px) {
  .gate-body { grid-template-columns: 1fr; gap: 14px; }
  .gate-right { display: flex; align-items: center; gap: 12px; text-align: left; }
  .gate-qr { width: 84px; height: 84px; flex: none; }
  .gate-hint { max-width: none; }
  .gate-code { font-size: 26px; }
}

/* ---------------- 关于 / 下载 ---------------- */

.doc-page { background: radial-gradient(70% 40% at 50% 0%, #fbf7ec, rgba(251, 247, 236, 0) 70%), var(--bg); }

.doc-main { max-width: 880px; margin: 0 auto; padding: 0 24px 80px; }

.doc-hero { padding: 64px 0 10px; text-align: center; }

.dh-seal {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #f4f0e4;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(31, 111, 92, .24);
}

img.dh-seal {
  background: transparent;
  border-radius: 14px;
  object-fit: contain;
}

.dh-logo {
  width: 64px;
  height: 64px;
  box-shadow: 0 10px 26px rgba(31, 111, 92, .22);
}

.doc-hero h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: .02em;
}

.dh-sub { margin: 0; font-size: 13px; line-height: 1.85; color: var(--ink-3); }

.doc-prose {
  margin-top: 40px;
  padding: 38px 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  font-size: 14.5px;
  line-height: 2.05;
  color: var(--ink-2);
}

.doc-prose p { margin: 0 0 18px; }

.doc-prose strong { color: var(--ink); font-weight: 600; }

.doc-prose blockquote {
  margin: 30px 0;
  padding: 20px 24px;
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
  border-radius: 0 12px 12px 0;
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.95;
  color: var(--ink);
}

.doc-sign {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.doc-sign .sign-name { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.doc-sign .sign-meta { font-size: 12px; color: var(--ink-3); }
.doc-sign .btn { margin-left: auto; }

/* 下载 */

.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 38px; }

.dl-card {
  display: flex;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.dl-icon {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.dl-icon.android { background: #f1f7ea; color: #4c7a2c; }

.dl-body h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 16px; font-weight: 600; }
.dl-body p { margin: 0 0 6px; font-size: 12.5px; line-height: 1.85; color: var(--ink-2); }
.dl-body p strong { color: var(--accent-deep); }
.dl-note { color: var(--ink-3) !important; font-size: 11.5px !important; }

.dl-block {
  margin-top: 18px;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.dl-block-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dl-block-head h2 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 600; }

.dl-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 10.5px;
  letter-spacing: .02em;
}

.dl-tag.old { background: #f4efe3; color: #8a6a2f; }

.dl-desc { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); }

.dl-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 22px;
  margin: 0 0 18px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-2);
}

.dl-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.dl-code {
  padding: 5px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 12px;
  color: var(--ink-3);
}

.dl-warn { margin: 14px 0 0; font-size: 11.5px; color: var(--danger); }

/* ---------------- FAQ 页 ---------------- */

.doc-main-wide { max-width: 1060px; }

.faq-layout {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
  margin-top: 22px;
}

.faq-toc {
  position: sticky;
  top: 16px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.faq-toc-title {
  margin: 0 0 8px 8px;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--ink-3);
}

.faq-toc a {
  display: block;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

.faq-toc a:hover { background: var(--accent-soft); color: var(--accent-deep); }

.faq-group { margin-bottom: 30px; }

.faq-group-title {
  margin: 0 0 12px;
  padding-left: 11px;
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--ink-3);
}

.faq-item {
  margin-bottom: 12px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  scroll-margin-top: 18px;
}

.faq-q {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.faq-a { font-size: 13.5px; line-height: 1.95; color: var(--ink-2); }
.faq-a p { margin: 0 0 11px; }
.faq-a p:last-child { margin-bottom: 0; }
.faq-a ul, .faq-a ol { margin: 0 0 11px; padding-left: 20px; }
.faq-a li { margin-bottom: 5px; }
.faq-a strong { color: var(--ink); font-weight: 600; }
.faq-a a { color: var(--accent-deep); border-bottom: 1px solid rgba(0, 0, 0, .08); }
.faq-note { color: var(--ink-3); font-size: 12.5px; }

.faq-sign {
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  font-family: var(--serif);
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: right;
}

@media (max-width: 860px) {
  .faq-layout { grid-template-columns: 1fr; gap: 16px; }
  .faq-toc { position: static; }
  .faq-item { padding: 16px 16px; }
}

/* 登录页的校验状态 */
.guard-state {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: center;
  letter-spacing: .01em;
}

.guard-state.ok { color: var(--accent-deep); }

/* 已在生词本 */
.btn-added {
  background: var(--accent-soft);
  border-color: #cfe2da;
  color: var(--accent-deep);
}

.btn-added:disabled { opacity: 1; cursor: default; }

@media (max-width: 760px) {
  .doc-main { padding: 0 16px 56px; }
  .doc-hero { padding-top: 40px; }
  .doc-hero h1 { font-size: 24px; }
  .doc-prose { padding: 24px 20px; font-size: 14px; line-height: 1.95; }
  .doc-sign .btn { margin-left: 0; width: 100%; }
  .dl-grid { grid-template-columns: 1fr; }
  .dl-list { grid-template-columns: 1fr; }
  .dl-block { padding: 20px; }
}

/* 详情页的加入生词本 */
.wp-actions { margin: 16px 0 4px; }

/* ---------------- 阅读页版式修正 ---------------- */

/* 侧栏宽度跟着窗口走，正文至少留出可读宽度；窄屏仍然走抽屉 */
@media (min-width: 1081px) {
  .reader-layout { grid-template-columns: minmax(0, 1fr) clamp(340px, 26vw, 392px); }
}

/* 分栏容器不能再有内边距，否则每翻一页会累计偏移，右侧文字被切 */
.page-track { padding-right: 0; padding-left: 0; }

.reading-body p,
.reading-body h3 { overflow-wrap: break-word; word-break: break-word; }

.word-panel { max-height: 50%; }

.aside .chat-panel { min-height: 0; }

/* ---------- 阅读页：段落复制按钮 ---------- */

.p-copy,
.p-say {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0;
  vertical-align: -4px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #c2b8a5;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease, background .15s ease;
}

/* 段落悬停时复制按钮显形；朗读按钮常驻可见（否则长段落末尾很难发现） */
.p-en:hover .p-copy,
.p-copy:focus-visible { opacity: 1; }
.p-say { opacity: .55; }
.p-en:hover .p-say,
.p-say:focus-visible { opacity: 1; }

.p-copy:hover,
.p-say:hover { background: #ece4d4; color: #1f6f5c; }
.p-copy:active,
.p-say:active { transform: scale(.92); }

@media (hover: none) {
  .p-copy { opacity: .5; }
}

/* 朗读按钮：在复制按钮右边，朗读时变绿并轻微脉冲 */
.p-say.is-speaking {
  opacity: 1;
  color: var(--accent);
  background: #e3efe9;
  animation: pSayPulse 1.1s ease-in-out infinite;
}
@keyframes pSayPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}


/* ---------- 阅读页：考试词汇划线（按勾选的考试取最高阶的那个颜色） ---------- */

.w-exam {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-skip-ink: none;
}

.w-exam[data-exam="高考"] { text-decoration-color: #c08a2e; }
.w-exam[data-exam="四级"] { text-decoration-color: #3b74c9; }
.w-exam[data-exam="六级"] { text-decoration-color: #7a55c9; }
.w-exam[data-exam="专四"] { text-decoration-color: #159c86; }
.w-exam[data-exam="专八"] { text-decoration-color: #2f8f45; }
.w-exam[data-exam="考研"] { text-decoration-color: #c4643a; }
.w-exam[data-exam="托福"] { text-decoration-color: #bf4a72; }
.w-exam[data-exam="雅思"] { text-decoration-color: #8f7420; }
.w-exam[data-exam="GRE"]  { text-decoration-color: #6b53b8; }

/* ---------- 阅读页：考试词汇勾选菜单 ---------- */

.exam-filter { position: relative; }

.exam-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}

.exam-btn:hover { border-color: var(--accent); color: var(--accent-deep); }
/* 窄屏被挤压时「四级」会折成两行，一个字一行，必须禁止换行 */
.exam-btn { white-space: nowrap; }
.exam-btn.off { color: var(--ink-3); }
.exam-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-deep); }

.exam-menu {
  position: absolute;
  top: 38px;
  right: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
  width: 214px;
  padding: 12px 14px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.exam-menu[hidden] { display: none; }

.exam-menu-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

.exam-menu-head em { font-style: normal; font-size: 10.5px; color: var(--ink-3); }

.exam-menu label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}

.exam-menu label:hover { color: var(--accent-deep); }
.exam-menu input { accent-color: var(--accent); margin: 0; }

.exam-menu-note {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-3);
}

/* ---------- 复习页：标签更小一点 ---------- */

.review-page .rcard-meta { gap: 3px; margin-top: 6px; }

.review-page .vtag {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 5px;
  line-height: 1.5;
}

/* ---------- 生词本：最近两周学习柱状图 ---------- */

.vocab-chart {
  margin: 0 0 18px;
  padding: 18px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.vc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.vc-title h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
}

.vc-title p { margin: 0; font-size: 11.5px; color: var(--ink-3); }

.vc-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.vc-legend span { display: inline-flex; align-items: center; gap: 5px; }

.vc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.vc-dot.review { background: var(--accent); }
.vc-dot.fresh { background: #d8ac66; }

.vc-streak {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11px;
}

.vc-body {
  display: flex;
  gap: 4px;
  height: 148px;
  margin: 14px 0 4px;
}

.vc-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.vc-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 100%;
  flex: 1;
  min-height: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 4px 4px 0 0;
}

.vc-col:hover .vc-bars { background: rgba(31, 111, 92, .05); }

.vc-fill {
  display: block;
  width: 40%;
  max-width: 12px;
  border-radius: 3px 3px 0 0;
  transition: height .3s ease;
}

.vc-fill.review { background: var(--accent); }
.vc-fill.fresh { background: #d8ac66; }

.vc-x {
  height: 12px;
  font-size: 9.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.vc-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--ink-3);
  font-size: 12px;
}

.vc-empty.error { color: var(--danger); }

.vc-progress { margin-top: 14px; }

.vc-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-2);
}

.vc-progress-head b {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-deep);
}

.vc-bar {
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: #eee7d8;
  overflow: hidden;
}

.vc-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f8a72, #1f6f5c);
  transition: width .4s ease;
}

.vc-hint { margin: 8px 0 0; font-size: 11px; color: var(--ink-3); }

/* ---------- 生词本：已导入的词库 ---------- */

.vocab-imports {
  margin: 0 0 18px;
  padding: 16px 20px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.vi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.vi-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.vi-head h2 { margin: 0; font-family: var(--serif); font-size: 15px; font-weight: 600; }
.vi-head span { font-size: 11px; line-height: 1.6; color: var(--ink-3); }

.vi-list { display: flex; flex-wrap: wrap; gap: 8px; }

.vi-empty { font-size: 12px; color: var(--ink-3); padding: 2px 0 4px; }

.vi-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.vi-name { font-size: 12.5px; color: var(--ink); }
.vi-name em { margin-left: 6px; font-style: normal; font-size: 11px; color: var(--ink-3); }
.vi-date { font-size: 10.5px; color: var(--ink-3); }

.vi-del {
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3);
  font-size: 11px;
}

.vi-del:hover { color: var(--danger); border-color: #f0d6d2; background: #fbeeec; }

/* ---------- 生词本：归档恢复条 ---------- */

.vocab-restore {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 18px 0 0;
  padding: 14px 18px;
  background: #fdf6e6;
  border: 1px solid #ecdcb8;
  border-radius: 14px;
}

.vres-text b { font-size: 13.5px; color: #7a5a20; }
.vres-text p { margin: 4px 0 0; font-size: 12px; color: #8d7442; line-height: 1.7; max-width: 720px; }

/* ---------- 生词本：今日任务 + 每日新词设置 ---------- */

.vocab-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin: 18px 0 0;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.vt-left { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }

.vt-title h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
}

.vt-title p { margin: 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.6; max-width: 380px; }

.vt-nums { display: flex; gap: 22px; }

.vt-num { display: flex; flex-direction: column; gap: 2px; }
.vt-num b { font-family: var(--serif); font-size: 20px; color: var(--ink); line-height: 1.2; }
.vt-num span { font-size: 10.5px; color: var(--ink-3); letter-spacing: .05em; }
.vt-num.due b { color: var(--accent-deep); }
.vt-num.state b { font-size: 15px; }
.vt-num.state b.is-done { color: var(--gold); }
.vt-num.state b.is-due { color: var(--danger); }
.vt-num.state b.is-going { color: var(--accent-deep); }

.vt-set { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vt-set label { font-size: 12px; color: var(--ink-2); }

.vt-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdf8;
  overflow: hidden;
}

.vt-stepper button {
  width: 30px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1;
}

.vt-stepper button:hover { background: var(--surface-soft); color: var(--accent-deep); }

.vt-stepper input {
  width: 52px;
  height: 34px;
  border: none;
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  background: transparent;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink);
  -moz-appearance: textfield;
}

.vt-stepper input::-webkit-outer-spin-button,
.vt-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.vt-saved { font-size: 11px; color: var(--accent-deep); min-width: 42px; }

/* 出词方式：顺序 / 随机（分段控件，点一下就保存） */
.vt-sep { width: 1px; height: 20px; background: var(--line); }

.vt-mode {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdf8;
  overflow: hidden;
}

.vt-mode button {
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  padding: 8px 14px;
  line-height: 1;
  transition: background .16s, color .16s;
}

.vt-mode button + button { border-left: 1px solid var(--line-soft); }
.vt-mode button:hover { background: var(--surface-soft); color: var(--accent-deep); }
.vt-mode button.on { background: var(--accent); color: #fff; font-weight: 600; }
.vt-mode button.on:hover { background: var(--accent-deep); color: #fff; }
.vt-mode button:disabled { opacity: .6; }

/* ---------- 生词本：记忆曲线 ---------- */

.vocab-curve {
  margin: 18px 0;
  padding: 18px 20px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.vocab-curve .vc-head { margin-bottom: 6px; }

.mc-scroll { overflow-x: auto; overflow-y: hidden; }

.mc-chart { min-width: 620px; }

.mc-sides {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 2px;
}

.mc-side {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  transition: border-color .15s, background .15s;
}

.mc-side span { font-size: 11px; color: var(--ink-3); }
.mc-side b { font-family: var(--serif); font-size: 14px; color: var(--ink); }
.mc-side.new b { color: var(--gold); }
.mc-side.done b { color: var(--ink-2); }
.mc-side:hover { border-color: #cfe0d8; background: var(--accent-soft); }
.mc-side.on { border-color: var(--accent); background: var(--accent-soft); }

.mc-sides-tip { font-size: 10.5px; color: var(--ink-3); }

.mc-svg { display: block; width: 100%; height: 200px; }

.mc-grid { stroke: var(--line-soft); stroke-width: 1; }

.mc-axis { fill: var(--ink-3); font-size: 10px; }

.mc-area { fill: url(#mcFill); }

.mc-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.mc-pt { cursor: pointer; }

.mc-hit { fill: transparent; }

.mc-pt:hover .mc-hit { fill: rgba(31, 111, 92, .06); }

.mc-dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
  transition: r .15s, fill .15s;
}

.mc-pt.new .mc-dot { stroke: #c9973f; }
.mc-pt.done .mc-dot { stroke: #a8a091; }
.mc-pt.active .mc-dot,
.mc-pt:hover .mc-dot { fill: var(--accent); }
.mc-pt.new.active .mc-dot,
.mc-pt.new:hover .mc-dot { fill: #c9973f; }
.mc-pt.done.active .mc-dot,
.mc-pt.done:hover .mc-dot { fill: #a8a091; }

.mc-val { fill: var(--ink-2); font-size: 11px; font-weight: 600; }

.mc-lab { fill: var(--ink-3); font-size: 10.5px; }

.mc-pt.active .mc-lab { fill: var(--accent-deep); font-weight: 600; }

.vc-dot.done { background: #a8a091; }

.mc-panel {
  margin-top: 12px;
  padding: 12px 14px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}

.mc-panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.mc-panel-head b { font-family: var(--serif); font-size: 14px; font-weight: 600; }
.mc-panel-head span { font-size: 11px; color: var(--ink-3); }

.mc-close {
  margin-left: auto;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 11px;
}

.mc-close:hover { color: var(--ink); border-color: #d5cab5; }

.mc-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.mc-group { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.mc-group + .mc-group { margin-top: 10px; }

.mc-group-title {
  width: 100%;
  font-size: 10.5px;
  letter-spacing: .08em;
  color: var(--ink-3);
  margin-bottom: 2px;
}

.mc-word {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  padding: 5px 9px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  transition: border-color .15s, color .15s;
}

.mc-word:hover { border-color: #cfe0d8; }

.mc-word b { font-family: var(--serif); font-size: 13.5px; color: var(--ink); }
.mc-word span { font-size: 11px; color: var(--ink-3); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-word em { font-style: normal; font-size: 10px; padding: 1px 6px; border-radius: 999px; }

.mc-state.new { background: #f2ead9; color: var(--gold); }
.mc-state.learn { background: var(--accent-soft); color: var(--accent-deep); }
.mc-state.done { background: #eeeae1; color: var(--ink-3); }

.mc-empty { width: 100%; padding: 16px 4px; font-size: 12px; color: var(--ink-3); }
.mc-empty.error { color: var(--danger); }

/* ---------------- 生词本：右侧明细栏（宽屏常驻，窄屏滑出） ---------------- */

.vocab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 22px;
  align-items: start;
}

.vocab-col { min-width: 0; }

/* 宽屏：就是右栏，一直显示，不需要遮罩 */
.vdrawer {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 108px);
  min-height: 260px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(33, 30, 25, .03);
  overflow: hidden;
}

.vdrawer-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--line-soft);
}

.vd-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.vd-titles b {
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vd-titles span { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

.vd-close {
  flex: none;
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 16px;
  line-height: 1;
}

.vd-close:hover { color: var(--ink); border-color: #d5cab5; }

/* 默认（未选中任何一档）→ 空态；有内容时才滚动 */
.vdrawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 18px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
}

/* 右栏里一条一个词，释义可以显示得比卡群更长 */
.vdrawer-body .mc-word { width: 100%; }
.vdrawer-body .mc-word span { max-width: none; flex: 1; }
.vdrawer-body .mc-word em { flex: none; }

.vdrawer-mask { display: none; }

/* 选中的那一档 / 那天 / 那个词根高亮 */
.mc-pt.active .mc-lab { fill: var(--accent-deep); font-weight: 600; }

@media (max-width: 1180px) {
  .vocab-layout { grid-template-columns: minmax(0, 1fr); }

  /* 窄屏：默认收起，点一下就滑出（一次性，不是每点一次都重新弹出） */
  .vdrawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    width: min(400px, 92vw);
    max-height: none;
    border-radius: 0;
    border-left: 1px solid var(--line);
    box-shadow: -10px 0 40px rgba(40, 33, 20, .16);
    transform: translateX(102%);
    transition: transform .26s cubic-bezier(.32, .72, 0, 1);
    visibility: hidden;
  }

  .vdrawer.open { transform: translateX(0); visibility: visible; }
  .vd-close { display: inline-flex; }

  .vdrawer-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 68;
    background: rgba(30, 26, 18, .28);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }

  .vdrawer-mask.show { opacity: 1; pointer-events: auto; }
}

@media (max-width: 760px) {
  .vdrawer { width: 100%; }
}


.vc-col { cursor: pointer; outline: none; }
.vc-col.active .vc-bars { background: rgba(31, 111, 92, .08); }
.vc-col:focus-visible .vc-bars { box-shadow: inset 0 0 0 2px #cfe0d8; }

/* ---------- 生词本：按词根分组 ---------- */

.vocab-roots {
  margin: 0 0 18px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.vr-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.vr-head h2 { margin: 0 0 4px; font-family: var(--serif); font-size: 16px; font-weight: 600; }
.vr-head p { margin: 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.6; max-width: 620px; }

.vr-groups { display: flex; flex-wrap: wrap; gap: 8px; }

.vr-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s, background .15s;
}

.vr-chip:hover { border-color: #cfe0d8; background: #f2f7f4; }
.vr-chip.on { border-color: var(--accent); background: var(--accent-soft); }

.vr-chip b { font-family: var(--serif); font-size: 14.5px; color: var(--ink); }
.vr-chip .vr-type {
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #efe8da;
  color: #8a7448;
}
.vr-chip .vr-mean { font-size: 11.5px; color: var(--ink-3); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vr-chip em {
  font-style: normal;
  font-family: var(--serif);
  font-size: 12.5px;
  color: var(--accent-deep);
  padding-left: 2px;
}

.vr-chip.word .vr-type { background: #edf0f4; color: #5d6b7a; }

@media (max-width: 760px) {
  .vocab-chart { padding: 14px; }
  .vc-body { height: 112px; }
  .vc-x { font-size: 8.5px; }
  .vi-head span { display: none; }
  .vocab-task { padding: 14px 16px; }
  .vt-left { gap: 16px; }
  .vt-nums { gap: 16px; }
  .vocab-curve, .vocab-roots { padding: 14px 16px; }
  .mc-chart { min-width: 560px; }
  .mc-svg { height: 180px; }
  .vr-head .btn { width: 100%; }
}

/* ---------------- 词根页 ---------------- */

.roots-main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 14px 28px 16px;
  height: calc(100vh - 66px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.roots-hero {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  flex: none;
  margin-bottom: 10px;
}

.roots-hero-text { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.roots-hero-text h1 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  margin: 0;
  letter-spacing: .02em;
}

.roots-hero-text p { margin: 0; color: var(--ink-3); font-size: 12px; }

/* 考试词库下拉框：选一张词库，左边就按覆盖词数列出它用到的词根 */
.roots-picker {
  flex: none;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}

.roots-select {
  width: 100%;
  height: 36px;
  padding: 0 30px 0 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fffefb url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8b84' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  font-size: 12.5px;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.roots-select:hover { border-color: #b9c8c1; }

.roots-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 111, 92, .1); }

.roots-select:disabled { color: var(--ink-3); cursor: not-allowed; background-color: #f6f4ef; }

.ri-type.tword { color: #6c5aa0; border-color: #ddd4ee; background: #f2eefb; }

/* 右侧：这张词库里有多少单词靠它构成 */
.rp-chip {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #cfe2da;
  background: #eef6f2;
  color: var(--accent-deep);
  font-size: 11.5px;
  letter-spacing: .01em;
}

.rp-note {
  margin: 0;
  padding: 18px 24px 0;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink-3);
}

.rp-actions { padding: 14px 24px 24px; }

.rp-more {
  padding: 10px 2px 2px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.rp-more-btn {
  display: block;
  width: 100%;
  margin: 10px 0 2px;
  padding: 9px 12px;
  border: 1px dashed var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease;
}

.rp-more-btn:hover { border-color: var(--accent); color: var(--accent-deep); }

.rp-more-btn:disabled { opacity: .6; cursor: default; }

.roots-search {
  position: relative;
  flex: none;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}

.roots-search svg {
  position: absolute;
  left: 23px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

.roots-search input {
  width: 100%;
  height: 36px;
  padding: 0 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fffefb;
  font-size: 12.5px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.roots-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 111, 92, .1); }

.roots-clear {
  position: absolute;
  right: 19px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(33, 30, 25, .06);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.roots-clear:hover { background: rgba(33, 30, 25, .12); }

.roots-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.roots-side {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.roots-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: none;
  padding: 8px 13px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-soft);
  font-size: 11.5px;
  color: var(--ink-2);
}

.roots-side-tip { color: var(--ink-3); font-size: 11px; }

.roots-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }

.root-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  padding: 5px 10px 6px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: background .14s ease, border-color .14s ease;
}

.root-item:hover { background: var(--surface-soft); }

.root-item.active { background: var(--accent-soft); border-color: rgba(31, 111, 92, .22); }

/* 第一行：词根写法 + 类型 + 词数 */
.ri-top { display: flex; align-items: center; gap: 7px; min-width: 0; width: 100%; }

.ri-word {
  flex: none;
  max-width: 52%;
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.35;
  color: var(--ink);
  letter-spacing: .01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ri-type {
  flex: none;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #fffefb;
  color: var(--ink-2);
  font-size: 10px;
  line-height: 15px;
}

.ri-type.tpre { color: #8a5a22; border-color: #e8d3b6; background: #fbf3e6; }
.ri-type.tsuf { color: #215a7d; border-color: #c9ddec; background: #eef5fa; }
.ri-type.troot { color: var(--accent-deep); border-color: #cfe2da; background: #eef6f2; }

.ri-count { flex: none; margin-left: auto; font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* 第二行：含义，单独一行，放不下就省略 */
.ri-mean {
  display: block;
  min-width: 0;
  padding-left: 1px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roots-pager { margin: 4px 8px 8px; flex: none; gap: 6px; }
.roots-pager.hidden { display: none; }
.roots-pager .btn { min-width: 0; padding: 3px 8px; font-size: 11.5px; }
.roots-pager .pager-info { font-size: 11px; }
.rp-pager .btn { padding: 4px 10px; font-size: 12px; }

.roots-loading, .roots-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.7;
}

.roots-empty .btn { margin: 10px auto 0; display: inline-flex; }

.root-panel {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.root-blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 100%;
  padding: 56px 30px;
  box-sizing: border-box;
  text-align: center;
  color: var(--ink-3);
}

.root-blank svg { color: #cdbfa6; }
.root-blank h3 { margin: 6px 0 0; font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink-2); }
.root-blank p { margin: 0; max-width: 430px; font-size: 12.5px; line-height: 1.75; }

.root-loading { padding: 64px 20px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

.rp-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--line-soft); }

.rp-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line-soft); }

.rp-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.rp-title h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .01em;
}

.rp-count { margin-left: auto; font-size: 12px; color: var(--ink-3); }

.rp-sm {
  display: inline-block;
  margin-top: 7px;
  padding: 1px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11.5px;
}

.rp-meaning { margin: 8px 0 0; font-size: 13px; line-height: 1.8; color: var(--ink-2); }

.rp-meta { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ink-3); }
.rp-meta i { font-style: normal; color: #b9ad98; margin-right: 7px; }

.rp-words-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 2px;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink-3);
}

.rp-words {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 7px;
  padding: 6px 16px 0;
}

.rw-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #fffefb;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.rw-item:hover { border-color: #d6c9b1; box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.rw-top { display: flex; align-items: baseline; gap: 7px; }

.rw-word { font-family: var(--serif); font-size: 14.5px; color: var(--ink); }
.rw-ph { font-size: 10.5px; color: var(--ink-3); }

/* 关系表的 sub_word：这个词根在这个单词里实际出现的那一段 */
.rw-sub {
  color: var(--accent-deep);
  font-weight: 600;
  background: rgba(31, 111, 92, .09);
  border-radius: 3px;
  padding: 0 1px;
}

.rw-def {
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rw-tags { font-size: 10.5px; color: var(--gold); }

.rp-pager { margin: 12px 0 6px; }

/* ---------------- 单词详情：词根模块 ---------------- */

.wp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.wp-section-head .wp-section-title { margin-bottom: 0; }

.wp-mode {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.wp-mode button {
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  transition: background .15s ease, color .15s ease;
}

.wp-mode button.active {
  background: #fffefb;
  color: var(--accent-deep);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

/* 词根模块：1 2 3 4 一路竖排，是单词就显示单词、是词根就显示词根，不加类型标签 */

.root-steps { display: flex; flex-direction: column; gap: 5px; }

.root-steps + .root-steps { margin-top: 10px; }

.root-step {
  display: flex;
  align-items: baseline;
  gap: 9px;
  width: 100%;
  padding: 7px 12px;
  text-align: left;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #fffefb;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.rs-no {
  flex: none;
  width: 15px;
  font-size: 10.5px;
  color: #b6ab97;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rs-word {
  flex: none;
  max-width: 42%;
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rs-def {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.55;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 词根那一行用主色，和单词区分开，不额外加标签 */
.root-step.is-root { background: var(--accent-soft); border-color: rgba(31, 111, 92, .18); }
.root-step.is-root .rs-word { color: var(--accent-deep); font-weight: 600; }
.root-step.is-root .rs-def { color: var(--accent-deep); opacity: .8; }
.root-step.is-root:hover { border-color: rgba(31, 111, 92, .38); }

.root-step.is-word:hover { border-color: var(--accent); background: #f6fbf9; }

@media (max-width: 1080px) {
  .roots-main { height: auto; padding: 14px 18px 30px; }
  .roots-layout { grid-template-columns: 1fr; }
  .roots-side { height: auto; }
  .roots-list { max-height: 40vh; }
  .root-panel { height: auto; max-height: none; overflow: visible; }
}

@media (max-width: 760px) {
  .roots-main { padding: 12px 14px 26px; }
  .rp-head, .rp-words-head { padding-left: 14px; padding-right: 14px; }
  .rp-words { grid-template-columns: 1fr; padding: 6px 12px 0; }
}

/* ---------- 试用 ---------- */

.auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: var(--ink-3);
  font-size: 11.5px;
  letter-spacing: .06em;
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

.auth-notice {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid rgba(31, 111, 92, .18);
  color: var(--accent-deep);
  font-size: 12.5px;
  line-height: 1.75;
}

.auth-notice.warn {
  background: #fdf4e5;
  border-color: #f0e0c4;
  color: #8a6423;
}

/* ---------------- 权威词源（etymonline + ec_ahdr_words） ---------------- */

.wp-ety-tools { display: flex; align-items: center; gap: 8px; }

.wp-ety-src {
  margin: -4px 0 12px;
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-3);
}

.we-entry {
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fffefb;
}

.we-entry + .we-entry { margin-top: 10px; }

.we-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.we-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-deep);
  letter-spacing: .01em;
}

.we-tag {
  padding: 0 6px;
  border: 1px solid #cfe2da;
  border-radius: 5px;
  background: #eef6f2;
  color: var(--accent-deep);
  font-size: 9.5px;
  line-height: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.we-text p {
  margin: 0 0 9px;
  font-size: 13px;
  line-height: 1.95;
  color: var(--ink-2);
  text-align: justify;
}

.we-text p:last-child { margin-bottom: 0; }

.we-pos {
  display: inline-block;
  margin-right: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--ink-3);
  font-size: 10.5px;
  line-height: 16px;
  vertical-align: 1px;
}

.we-en p {
  font-family: var(--serif);
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink);
}

.we-en p::first-letter { text-transform: uppercase; }

.we-versions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-soft);
}

.we-versions summary {
  font-size: 11.5px;
  color: var(--ink-3);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.we-versions summary::-webkit-details-marker { display: none; }

.we-versions summary::before {
  content: '＋';
  display: inline-block;
  width: 14px;
  color: var(--ink-3);
}

.we-versions[open] summary::before { content: '－'; }

.we-versions summary:hover { color: var(--accent-deep); }

.we-version { margin-top: 10px; }

.we-version-head {
  margin-bottom: 5px;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--gold);
}

.we-version p {
  margin: 0 0 8px;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink-3);
  text-align: justify;
}

.we-version p:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .we-entry { padding: 12px 13px; }
  .we-text p { font-size: 12.5px; line-height: 1.85; }
}

/* ---- 阅读页点词抽屉：「权威词源」 ---- */
.rd-ety {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.rd-ety-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--accent);
  margin-bottom: 8px;
}
.rd-ety-entry + .rd-ety-entry {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-soft);
}
.rd-ety-name {
  font-size: 13px;
  font-weight: 600;
  color: #2b2b2b;
  margin-bottom: 4px;
}
.rd-ety-text {
  font-size: 13px;
  line-height: 1.75;
  color: #3a3a3a;
}
.rd-ety-text p { margin: 0 0 6px; }
.rd-ety-text p:last-child { margin-bottom: 0; }
.rd-ety-en { color: #5c5c5c; }
.rd-ety-more { margin-top: 6px; }
.rd-ety-more > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
  list-style: none;
}
.rd-ety-more > summary::-webkit-details-marker { display: none; }
.rd-ety-more > summary::before { content: '▸ '; }
.rd-ety-more[open] > summary::before { content: '▾ '; }
.rd-ety-item { margin-top: 8px; }
.rd-ety-src {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: .04em;
  margin-bottom: 2px;
}

/* ---- 单词页「权威词源」标签页：词源网 / AHDR4 / BNC / Chambers ---- */
.wp-ety-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  /* 上下都留足空间：和上面的栏目标题、下面的词源正文都拉开 */
  margin: 14px 0 20px;
  padding-bottom: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.wp-ety-tabs::-webkit-scrollbar { display: none; }
.wp-ety-tabs button {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid #cfe2da;
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
  white-space: nowrap;
  transition: all .16s ease;
}
.wp-ety-tabs button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #dcebe5;
}
.wp-ety-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #f7fcfa;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(31, 111, 92, .22);
}

/* ---- 生词本：备份 / 恢复 ---- */
.vocab-backup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 14px 0 0;
  padding: 14px 18px;
  background: var(--accent-soft);
  border: 1px solid #cfe2da;
  border-radius: 14px;
}
.vocab-backup .vb-text b {
  font-size: 14px;
  color: #24483e;
}
.vocab-backup .vb-text p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #5d7370;
  line-height: 1.6;
}

/* 危险操作按钮：全部删除这类不可恢复的动作 */
.btn-danger {
  background: #fff5f4;
  border-color: #e8bdb8;
  color: #b2433a;
}
.btn-danger:hover { background: #fdecea; border-color: #d79a93; color: #8f2f27; }
.btn-danger:disabled { opacity: .6; cursor: default; }

.vocab-backup .vb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- 查词页：最近查过（沿用词根页单词表的卡片样式） ---- */
.home-history {
  margin: 20px 0 0;
  padding: 16px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(33, 30, 25, .03);
}
.hh-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.hh-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--ink-3);
}
.hh-count {
  margin-left: 8px;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--ink-3);
}
.hh-clear {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all .15s ease;
}
.hh-clear:hover { color: #b2433a; background: #fdf0ee; }

/* 卡片网格：和词根页 .rp-words 一样的排布 */
.hh-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 7px;
}

/* 卡片内的小标记：原型 / 汉英 / 查询次数 */
.rw-lemma {
  font-size: 10.5px;
  color: #9a8b6c;
  background: #f7f2e6;
  border-radius: 3px;
  padding: 0 4px;
}
.rw-kind {
  font-size: 10.5px;
  color: #7a5c1f;
  background: #fbf1d9;
  border-radius: 3px;
  padding: 0 4px;
}
.rw-kind.un { color: var(--ink-3); background: #f1f1f1; }
.rw-hits { font-size: 10.5px; color: var(--ink-3); }
/* 查词历史：释义固定一行，超出用省略号（词根页仍用两行截断的 .rw-def） */
.home-history .rw-item { gap: 3px; }
.home-history .rw-def {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}



/* ---- 汉英：下方完整页 ---- */
.wp-loading-inline {
  padding: 18px 0;
  font-size: 13px;
  color: var(--ink-3);
}
.wed-tag {
  font-size: 10.5px;
  color: var(--gold);
  background: #fbf6e8;
  border-radius: 3px;
  padding: 1px 5px;
}
.wed-miss-tag {
  font-size: 11px;
  color: #9a9a9a;
  background: #f1f1f1;
  border-radius: 4px;
  padding: 1px 7px;
}
.wed-miss { background: #fbfaf7; }
/* 完整页里的词根 / 词源区块，和主页面留同样的呼吸感 */
.wp-en-detail .wp-section {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.wp-en-detail .wp-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--ink-3);
  margin-bottom: 8px;
}

/* ---- 复习卡片：第一次背错后放回队列，标记「再来一次」 ---- */
.rcard-retry {
  position: absolute;
  top: -8px;
  left: 14px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fdf0ee;
  border: 1px solid #e8bdb8;
  color: #b2433a;
  font-size: 10.5px;
  letter-spacing: .02em;
  pointer-events: none;
}
/* 放回时轻微高亮一下，提示位置变了 */
.rcard.re-queued {
  animation: rcardRequeue .9s ease;
}
@keyframes rcardRequeue {
  0%   { box-shadow: 0 0 0 0 rgba(178, 67, 58, .35); }
  100% { box-shadow: 0 0 0 10px rgba(178, 67, 58, 0); }
}

/* ---------------- 页脚版权 ---------------- */

/* 独立页脚：书库、生词本、词根、复习、设置等页面 */
.site-foot {
  margin-top: 46px;
  padding: 20px 0 4px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-3);
  letter-spacing: .03em;
}

/* 已经自带 .home-foot 的页面，版权接在原有文案下面 */
.site-copy {
  margin-top: 8px;
  font-size: 11px;
  color: #b3a897;
  letter-spacing: .03em;
}

/* 阅读页：贴在下方的翻页栏里，右侧小字 */
.pager-bar { position: relative; }

.pager-copy {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10.5px;
  color: #b3a897;
  letter-spacing: .03em;
  pointer-events: none;
}

@media (max-width: 960px) {
  .pager-copy { display: none; }
}

/* ---------- 生词本：批量导入单词页 ---------- */

.bi-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 30px 24px 80px;
}

.bi-head { margin-bottom: 20px; }
.bi-head h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: .01em;
}
.bi-head p {
  margin: 0;
  max-width: 780px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-2);
}
.bi-head p b { color: var(--accent-deep); font-weight: 600; }

.bi-card,
.bi-result {
  padding: 16px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.bi-result { margin-top: 18px; }

.bi-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* label 当按钮用：点它等于点隐藏的 file input */
.bi-file { cursor: pointer; }

.bi-hint {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--ink-3);
}

.bi-textarea {
  display: block;
  width: 100%;
  min-height: 260px;
  max-height: 56vh;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.95;
  resize: vertical;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.bi-textarea::placeholder { color: #b0a795; }
.bi-textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(31, 111, 92, .1);
}

.bi-tip {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--ink-3);
}
.bi-tip code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  font-size: 11px;
}

.bi-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.bi-stat {
  flex: 1 1 130px;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-soft);
}
.bi-stat b {
  display: block;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.3;
  color: var(--ink);
}
.bi-stat span { font-size: 11px; color: var(--ink-3); letter-spacing: .04em; }
.bi-stat.ok b { color: var(--accent-deep); }
.bi-stat.skip b { color: var(--gold); }
.bi-stat.miss b { color: #9a9a9a; }

.bi-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0 10px;
}

/* 四个标签在窄屏放不下：让这一条自己横向滚，别把「可导入」挤成两行 */
.bi-filter .seg {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.bi-filter .seg::-webkit-scrollbar { display: none; }
.bi-filter .seg button { flex: 0 0 auto; white-space: nowrap; }

.bi-stale {
  font-size: 11.5px;
  color: var(--danger);
}

.bi-list {
  max-height: 52vh;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-soft);
}

.bi-row {
  display: grid;
  grid-template-columns: 168px 132px minmax(0, 1fr) 88px;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.bi-row:last-child { border-bottom: 0; }
.bi-row:hover { background: #fffefb; }

.bi-word {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bi-word:hover { color: var(--accent); }

.bi-ph {
  font-size: 12px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bi-def {
  min-width: 0;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bi-state {
  justify-self: end;
  padding: 1px 8px;
  border-radius: 999px;
  font-style: normal;
  font-size: 11px;
  white-space: nowrap;
}
.bi-state.ready { color: var(--accent-deep); background: var(--accent-soft); }
.bi-state.inVocab { color: #7a5c1f; background: #fbf1d9; }
.bi-state.missing { color: #8d8d8d; background: #f1f1f1; }

/* 词库没有的词整行淡下去，一眼看出这些是导不进来的 */
.bi-row.missing .bi-word { color: var(--ink-3); }
.bi-row.inVocab .bi-word { color: var(--ink-2); }

.bi-empty {
  padding: 26px 14px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
}

.bi-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.bi-note {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.7;
}

@media (max-width: 760px) {
  .bi-main { padding: 22px 16px 60px; }
  .bi-hint { margin-left: 0; order: 9; width: 100%; }
  .bi-row { grid-template-columns: minmax(0, 1fr) 84px; row-gap: 2px; }
  .bi-ph { display: none; }
  .bi-def { grid-column: 1 / 2; font-size: 12px; }
  .bi-state { grid-row: 1 / 2; grid-column: 2 / 3; }
}

/* ---------- 设置页：账号安全（改密码 / 换手机号） ---------- */

.card-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-title b {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.card-title span {
  font-size: 11.5px;
  color: var(--ink-3);
}

.card-note {
  margin: -6px 0 16px;
  font-size: 12px;
  line-height: 1.85;
  color: var(--ink-3);
}

/* 「修改用户名」里的当前值预览：左边头像 + 右边名字，和书架右上角那块保持一致 */
.nickname-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-soft);
}
.nickname-preview .avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
  flex: none;
}
.nickname-preview strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  word-break: break-all;
}
.nickname-preview span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* 「已绑定微信」：一条可点的状态条 + 展开后的详情与约定 */
.wechat-bind {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefb;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .16s ease, background .16s ease;
}
.wechat-bind:hover,
.wechat-bind:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.wb-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--ink-3);
}
.wb-dot.on {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 92, .14);
}
.wb-text { flex: 1; min-width: 0; }
.wb-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.wb-text i {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 11.5px;
  color: var(--ink-3);
}
.wb-arrow {
  flex: none;
  color: var(--ink-3);
  transition: transform .18s ease;
}
.wechat-bind.is-open .wb-arrow { transform: rotate(90deg); }

.wechat-detail { margin-top: 16px; }
.wb-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-soft);
}
.wb-facts dt {
  font-size: 11.5px;
  color: var(--ink-3);
}
.wb-facts dd {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.6;
  word-break: break-all;
}

.wb-rule {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--accent-soft);
}
.wb-rule b {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--accent-deep);
}
.wb-rule ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.95;
  color: var(--ink-2);
}
.wb-rule b b, .wb-rule li b { display: inline; font-weight: 600; }

.wb-warn {
  border-left-color: var(--danger);
  background: #fdf2f0;
}
.wb-warn b { color: var(--danger); }

@media (max-width: 560px) {
  .wb-facts { grid-template-columns: 1fr; gap: 10px; }
}

/* 「显示密码」勾选框：和按钮同高，看着像一排 */
.pwd-show {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.pwd-show input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }

@media (max-width: 640px) {
  .card-title { margin-bottom: 14px; }
}

/* ---------- 设置页：左侧标签栏 ---------- */

.set-layout {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.set-nav {
  position: sticky;
  top: 82px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.set-tab {
  position: relative;
  width: 100%;
  padding: 10px 12px 10px 15px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .16s ease;
}
.set-tab b {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--ink-2);
  transition: color .16s ease;
}
.set-tab i {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-3);
}

/* 选中时左侧一道竖条，比整块变色克制些 */
.set-tab::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 3px;
  background: var(--accent);
  transform: translateY(-50%);
  transition: height .18s ease;
}

.set-tab:hover { background: var(--surface-soft); }
.set-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.set-tab.is-on { background: var(--accent-soft); }
.set-tab.is-on b { color: var(--accent-deep); font-weight: 600; }
.set-tab.is-on i { color: var(--accent-deep); opacity: .65; }
.set-tab.is-on::before { height: 19px; }

.set-panes { min-width: 0; }

/* 右栏第一张卡片别顶出额外的上边距 */
.set-pane > .settings-card:first-child { margin-top: 0; }

@media (max-width: 860px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  /* 窄屏改成横排标签；项数多了（现在是七项）就按内容宽度换行，
     硬挤成一行的话「修改用户名」只剩「修改用…」，点了都不知道进了哪 */
  .set-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    padding: 5px;
  }
  .set-tab {
    /* 基础样式是 width:100%（竖排时占满一列），横排下必须放开，
       否则 flex-wrap 会把每个标签都撑成一整行 */
    width: auto;
    flex: 0 1 auto;
    min-width: 0;
    padding: 9px 8px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .set-tab b { font-size: 13px; }
  .set-tab i { display: none; }
  .set-tab::before { display: none; }
}

/* ---------- 设置页：读书榜 ---------- */

/* 榜单整体是一张表格：行与行之间只画细线，不套卡片，省得在设置卡片里再套一层「卡片感」 */
.board {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.board-item + .board-item { border-top: 1px solid var(--line-soft); }

.board-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 13px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  transition: background .16s ease;
  -webkit-tap-highlight-color: transparent;
}

.board-row:hover { background: var(--surface-soft); }
.board-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.board-row[aria-expanded="true"] { background: var(--surface-soft); }

/* 名次沿用书架页排行那套：前三名染绿，不挂金银铜 */
.board-no {
  flex: none;
  width: 20px;
  text-align: center;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.board-item.top .board-no { color: var(--accent); font-weight: 600; }

.board-thumb {
  flex: none;
  display: block;
  width: 30px;
  height: 43px;
  border-radius: 4px;
  object-fit: cover;
  background: linear-gradient(150deg, var(--line-soft), var(--line));
}
.board-thumb.empty { background: linear-gradient(150deg, var(--line-soft), var(--line)); }

.board-avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}
.board-avatar.sm { width: 24px; height: 24px; font-size: 11.5px; }

.board-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.board-main b {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-main i {
  font-style: normal;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-count {
  flex: none;
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}
.board-count b {
  margin-right: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.board-arrow {
  flex: none;
  display: flex;
  color: var(--ink-3);
  transition: transform .18s ease;
}
.board-row[aria-expanded="true"] .board-arrow { transform: rotate(90deg); }

/* 明细缩进到书名/昵称下面，一眼能看出它属于上面那一行 */
.board-detail {
  padding: 2px 13px 11px 45px;
  background: var(--surface-soft);
}
.board-detail-head {
  padding: 2px 0 7px;
  font-size: 11px;
  color: var(--ink-3);
}

.board-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}
.board-sub + .board-sub { border-top: 1px dashed var(--line); }
.board-sub-link:hover .board-sub-main b { color: var(--accent-deep); }

.board-sub-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.board-sub-main b {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-sub-main i {
  font-style: normal;
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 进度条只做粗略对比，精确值在右边 */
.board-bar {
  display: block;
  height: 4px;
  margin-top: 4px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}
.board-bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width .3s ease;
}

.board-sub-val {
  flex: none;
  width: 40px;
  text-align: right;
  font-size: 11.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.board-sub-date {
  flex: none;
  width: 76px;
  text-align: right;
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.board-loading,
.board-empty {
  padding: 18px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
}
.board-empty.err { color: var(--danger); }

@media (max-width: 640px) {
  .board-detail { padding-left: 13px; }
  .board-sub-date { display: none; }
}

/* ---------- 登录页：微信扫码确认 ---------- */

.scan-title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
}

.scan-sub { margin: 0 0 20px; color: var(--ink-3); font-size: 13px; line-height: 1.8; }
.scan-sub span { color: var(--accent-deep); font-weight: 500; }

.scan-card {
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.scan-qr {
  display: block;
  width: 196px;
  height: 196px;
  margin: 0 auto 14px;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
}

/* 6 位数字要一眼看清、方便照着敲，字距拉开 */
.scan-code {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: .14em;
  line-height: 1.25;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  user-select: all;
}

.scan-timer {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.scan-track {
  height: 3px;
  margin: 8px auto 0;
  max-width: 220px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}
.scan-track i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .45s linear, background .2s ease;
}
.scan-track i.low { background: var(--danger); }

.scan-expired {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--danger);
}
.scan-expired button { margin-left: 8px; }

.scan-steps {
  margin: 18px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 2;
  color: var(--ink-2);
}
.scan-steps b { font-family: var(--serif); font-size: 13.5px; letter-spacing: .08em; }

.scan-state {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.7;
}
.scan-state.ok { color: var(--accent-deep); }
.scan-state.warn { color: var(--danger); }

/* 「一直没收到公众号回复？」：平时折叠，数字过期才自动展开 */
.scan-help {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 12.5px;
  color: var(--ink-2);
}
.scan-help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-2);
  list-style: none;
}
.scan-help summary::-webkit-details-marker { display: none; }
.scan-help summary::before {
  content: '？';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  vertical-align: 1px;
}
.scan-help ul {
  margin: 8px 0 0;
  padding-left: 16px;
  line-height: 1.9;
}
.scan-help b { color: var(--ink); }

.scan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

@media (max-width: 420px) {
  .scan-qr { width: 164px; height: 164px; }
  .scan-code { font-size: 30px; }
}

/* ---------- 登录页：忘记密码入口 / 找回密码面板 ---------- */
.auth-forgot {
  display: flex;
  justify-content: flex-end;
  margin: -6px 0 14px;
  font-size: 13px;
}
.auth-forgot a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}
.auth-forgot a:hover {
  border-bottom-color: var(--accent);
}
/* 「← 返回登录」单独一行、居中，别再吃上面那个负 margin 压到状态行上 */
#resetBack {
  justify-content: center;
  margin: 14px 0 0;
}
#resetPanel h2 { margin: 0 0 6px; }
#resetPanel .sub { margin: 0 0 18px; }
#resetPanel .auth-submit { margin-top: 6px; }

/* ---------- 我的推荐码（设置页第四块） ---------- */

.refer-code {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.refer-code code {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 26px;
  letter-spacing: 4px;
  color: var(--accent-deep);
  font-weight: 600;
  user-select: all;
}

.refer-status {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  border: 1px solid var(--line-soft);
  background: var(--surface-soft);
  color: var(--ink-2);
}
.refer-status.ok {
  border-color: #cfe4da;
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.refer-status.err {
  border-color: #e7ccc6;
  background: #fbf0ee;
  color: var(--danger);
}
.refer-status b { font-weight: 600; }

.refer-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 4px;
}
.refer-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
}
.refer-stats strong {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}
.refer-stats span {
  font-size: 11.5px;
  color: var(--ink-3);
}

.refer-list-head {
  margin: 20px 0 8px;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-3);
}
.refer-list {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
}
.refer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  font-size: 13px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
}
.refer-row:last-child { border-bottom: 0; }
.refer-who { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.refer-when { color: var(--ink-3); font-size: 12px; }
.refer-empty {
  padding: 22px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}

/* ---------- 账号受限说明页 ---------- */

.access-main {
  max-width: 520px;
  margin: 0 auto;
  padding: 46px 20px 70px;
}
.access-card {
  padding: 30px 26px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.access-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 20px;
  font-weight: 600;
  font-family: var(--serif);
}
.access-badge.warn {
  background: #fbf0ee;
  color: var(--danger);
}
.access-card h1 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .01em;
}
.access-sub {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-2);
}
.access-sub b { color: var(--ink); font-weight: 600; }

.access-code {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: left;
}
.access-code span {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}
.access-code code {
  flex: 1;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 21px;
  letter-spacing: 3px;
  font-weight: 600;
  color: var(--accent-deep);
  user-select: all;
}

.access-progress { margin: 14px 0 0; }
.access-track {
  height: 7px;
  border-radius: 999px;
  background: var(--bg-deep);
  overflow: hidden;
}
.access-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width .5s ease;
}
.access-track i.done { background: var(--accent-deep); }
.access-nums {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.access-hint {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink-3);
  text-align: left;
}
.access-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}
.access-foot {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--ink-3);
}

@media (max-width: 420px) {
  .refer-code code { font-size: 21px; letter-spacing: 2px; }
  .access-main { padding: 26px 14px 50px; }
  .access-card { padding: 24px 18px 20px; }
}

/* ==================== 赞助（顶部入口 + 赞助页） ==================== */

/* 顶栏那个小胶囊：金色，不和主色按钮抢注意力 */
.sponsor-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(173, 125, 55, .32);
  background: linear-gradient(180deg, #fdf8ee, #f8efdd);
  color: var(--gold);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color .16s ease, box-shadow .16s ease, color .16s ease;
}
.sponsor-btn:hover {
  border-color: rgba(173, 125, 55, .62);
  color: #8a5f22;
  box-shadow: 0 2px 10px rgba(173, 125, 55, .18);
}
.sponsor-btn:active { transform: translateY(1px); }
.sponsor-btn svg { width: 13px; height: 13px; flex: none; }

/* 页头：两句话讲清钱花在哪 */
.sponsor-uses {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 34px;
}
.sponsor-use {
  padding: 20px 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.su-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.sponsor-use h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.sponsor-use p { margin: 0; font-size: 13px; line-height: 1.75; color: var(--ink-2); }

/* 两张收款码 */
.sponsor-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}
.sponsor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 20px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.sc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.sc-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.sc-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.sc-wx { background: #e7f4ea; color: #1a7f37; }
.sc-ali { background: #e6f1fd; color: #1668c4; }
.sc-qr {
  padding: 0;
  border: none;
  background: none;
  line-height: 0;
  border-radius: 10px;
  cursor: zoom-in;
  transition: transform .16s ease, box-shadow .16s ease;
}
.sc-qr img {
  display: block;
  /* 两张码原图比例不一样（微信 3:4、支付宝 2:3），按同一高度缩放才不会一张高一张矮 */
  height: 330px;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
}
.sc-qr:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.sc-hint { margin: 12px 0 0; font-size: 11.5px; color: var(--ink-3); }

/* 「不改变任何功能」这句必须够显眼，别让人以为赞助才能用 */
.sponsor-note {
  margin-top: 22px;
  padding: 22px 26px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: var(--surface-soft);
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-2);
}
.sponsor-note p { margin: 0 0 10px; }
.sponsor-note p:last-child { margin-bottom: 0; }
.sponsor-note strong { color: var(--ink); }
.sn-thanks { color: var(--ink-3); font-size: 12.5px; }

/* 点开的大图层：手机上要靠它长按识别 */
.qr-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 20, 14, .78);
}
.qr-layer.hidden { display: none; }
.ql-body {
  max-width: min(420px, 88vw);
  max-height: 88vh;
  overflow: auto;
  padding: 18px 18px 14px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.ql-title { margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.ql-body img { display: block; width: 100%; height: auto; border-radius: 10px; }
.ql-hint { margin-top: 10px; font-size: 11.5px; line-height: 1.6; color: var(--ink-3); }
.ql-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}
.ql-close:hover { background: rgba(255, 255, 255, .22); }

@media (max-width: 720px) {
  .sponsor-uses,
  .sponsor-codes { grid-template-columns: minmax(0, 1fr); }
  .sc-qr img { height: 300px; }
  .sponsor-note { padding: 18px; }
  .ql-close { top: 10px; right: 12px; }
}

/* 窄屏顶栏放不下文字，只留一颗心 */
@media (max-width: 520px) {
  .sponsor-btn { width: 30px; padding: 0; justify-content: center; }
  .sponsor-btn span { display: none; }
}

/* 窄屏顶栏：导航不换行、改成一条可横滑的带子。
   以前 390px 下 8 个导航项被压成「查\n词」这种竖排，加了赞助按钮后更挤。 */
@media (max-width: 720px) {
  .app-header { gap: 10px; padding: 0 14px; }
  .top-nav {
    /* basis 必须是 0：wrap 容器按 basis 分行，写 auto 会先把右侧图标挤到下一行 */
    flex: 1 1 0;
    min-width: 0;
    margin-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .top-nav::-webkit-scrollbar { display: none; }
  .top-nav a { flex: none; white-space: nowrap; }
  .header-right { gap: 8px; flex: none; }
}

/* 阅读列表页：顶栏现在是「搜索 + 主题 + 头像」，窄屏只让导航让位；
   排序与划线/收藏已经移到列表工具栏，不再跟着顶栏一起消失。 */
@media (max-width: 760px) {
  .hide-narrow { display: none; }
  .books-page .search-box { min-width: 0; }
  .list-tools { gap: 8px; }
  .sort-select { min-width: 0; max-width: 132px; }
}

/* ---------- 阅读页：划线 / 书签 ---------- */

/* 顶栏两个入口：风格跟「考试词汇」一致，数字变绿表示有内容 */
.note-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}

.note-btn:hover { border-color: var(--accent); color: var(--accent-deep); }
.note-btn b { font-weight: 600; font-size: 11.5px; color: var(--ink-3); }
.note-btn b.has { color: var(--accent-deep); }
.note-btn.on { border-color: var(--accent); background: #f1f7f4; color: var(--accent-deep); }

/* 右侧抽屉：和词典抽屉（.aside）是两层东西，可以同时开 */
.notes-mask {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(30, 27, 22, .26);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.notes-mask.open { opacity: 1; pointer-events: auto; }

.notes-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  display: flex;
  flex-direction: column;
  width: min(380px, 92vw);
  background: #fbf7ee;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 42px rgba(40, 34, 24, .14);
  transform: translateX(102%);
  visibility: hidden;
  transition: transform .24s cubic-bezier(.22, .7, .3, 1), visibility .24s;
}

.notes-drawer.open { transform: none; visibility: visible; }

.nd-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 12px 10px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.nd-tabs { flex: 1; display: flex; gap: 6px; }

.nd-tab {
  height: 30px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  cursor: pointer;
}

.nd-tab b { margin-left: 2px; font-size: 11.5px; font-weight: 600; }
.nd-tab.on { background: #fffdf8; border-color: var(--line); color: var(--ink); }

.nd-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}

.nd-close:hover { background: rgba(33, 30, 25, .06); color: var(--ink); }

.nd-body { flex: 1; overflow-y: auto; padding: 8px 10px 30px; }

.nd-item {
  position: relative;
  padding: 10px 34px 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}

.nd-item:hover { background: #fffdf8; border-color: var(--line-soft); }

.nd-text {
  display: block;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  word-break: break-word;
}

.nd-meta {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .02em;
}

/* 书库页的条目是跨书的，得让人一眼看出这条出自哪本 */
.nd-book {
  margin-right: 6px;
  font-weight: 500;
  color: var(--accent-deep);
}

/* 书库页：划线 / 收藏入口放在「全部藏书」标题栏右侧。
   放页头会把站名和导航挤成竖排——那一行本来就满了。 */
.note-entry {
  display: flex;
  gap: 6px;
  align-self: center;
}

.note-entry .note-btn { height: 28px; }

/* 列表被 limit 截断时，底部说明还有多少条没显示 */
.nd-more {
  padding: 14px 12px 6px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-3);
}

.nd-del {
  position: absolute;
  top: 8px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #c3b7a2;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.nd-del:hover { background: #f7e6e2; color: #b2433a; }

.nd-empty {
  padding: 46px 18px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink-3);
}

.nd-empty svg { display: block; margin: 0 auto 10px; opacity: .45; }
.nd-empty b { display: block; margin-bottom: 4px; color: var(--ink-2); font-weight: 500; }

/* 选中文字后的浮动「划线」按钮：贴着选区上沿 */
.sel-pop {
  position: fixed;
  z-index: 65;
  padding: 4px;
  border-radius: 10px;
  background: #22302b;
  box-shadow: 0 12px 26px rgba(20, 30, 26, .3);
  transform: translate(-50%, -100%);
}

/* hidden 必须显式写成 display:none：下面这些元素自己带 display，
   作者样式优先级高于浏览器对 [hidden] 的默认处理，不写就关不掉 */
.sel-pop[hidden],
.sel-hl[hidden],
.sel-tip[hidden] { display: none; }

.sel-hl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f4efe2;
  font-size: 12.5px;
  cursor: pointer;
}

.sel-hl:hover { background: rgba(255, 255, 255, .14); }

/* 用户划线：荧光笔效果，压在考试词下划线之上，不遮文字 */
mark.u-hl {
  padding: 0;
  color: inherit;
  background: linear-gradient(180deg, transparent 44%, #ffe08a 44%, #ffe08a 92%, transparent 92%);
}

/* 定位到某一段时闪一下，告诉眼睛「就是这里」 */
@keyframes hl-flash {
  0% { background-color: rgba(255, 209, 102, .7); }
  100% { background-color: transparent; }
}

.p-en.flash, .p-zh.flash, .p-h.flash {
  animation: hl-flash 1.5s ease-out 1;
  border-radius: 4px;
}

@media (max-width: 760px) {
  /* 窄屏顶栏放不下：划线/收藏只留图标和数字，书名与「设置」让位
     （书名正文上方有，设置从书库页头像进） */
  .note-btn .nb-text { display: none; }
  .note-btn { padding: 0 8px; }
  .notes-drawer { width: min(340px, 92vw); }
  .reader-topbar .rt-title { display: none; }
  .rt-actions { gap: 6px; }
  /* 考试按钮去掉图标只留「四级」，宽度省下来给两个新按钮 */
  .exam-btn svg { display: none; }
  .exam-btn { padding: 0 9px; }
}

.sel-tip {
  display: block;
  height: 30px;
  padding: 0 10px;
  line-height: 30px;
  font-size: 12px;
  color: #cfc6b4;
  white-space: nowrap;
}

/* 书签面板顶上那条「给当前段加书签」 */
.nd-add {
  display: block;
  width: 100%;
  margin: 4px 0 8px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--accent-deep);
  font-size: 12.5px;
  text-align: center;
  cursor: pointer;
}

.nd-add:hover { border-color: var(--accent); }
.nd-add.on { border-style: solid; background: #f1f7f4; }

/* ==========================================================================
   夜间模式
   --------------------------------------------------------------------------
   浅色主题是「米黄纸」，暗色就做「墨底暖白字」——不用纯黑（#000）和纯白（#fff），
   纯黑在 OLED 上对比过强、纯白字长时间读会发散。

   这套的做法是：先把 :root 的 12 个颜色变量整体换掉，绝大多数组件（都写了 var()）
   自动跟着变；剩下 100 多处硬编码的浅色按「结构 / 状态」分组覆盖，不逐条改原规则——
   原规则保持浅色，暗色是一层可整段删掉的补丁，回退风险最小。

   color-scheme 必须写：滚动条、输入光标、原生 select 下拉都会跟着变暗，
   否则深色页面里弹出一个白灿灿的系统下拉框。
   ========================================================================== */

/* 顶栏的日/月按钮：尺寸与 .icon-btn 对齐，两个主题下都在 */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  transition: background .16s ease, color .16s ease;
}
.theme-toggle:hover { background: var(--accent-soft); color: var(--accent-deep); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #14161a;
  --bg-deep: #0e1013;
  --surface: #1c1f24;
  --surface-soft: #23272d;
  --line: #2f343b;
  --line-soft: #262a30;
  --ink: #e7e3db;
  --ink-2: #aca69c;
  --ink-3: #8a847b;
  --accent: #5cc3a4;
  --accent-deep: #86d9bd;
  --accent-soft: #1d3a33;
  --gold: #d8ad6d;
  --danger: #e37a71;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .62);
}

[data-theme="dark"] ::selection { background: #2a4d43; }

/* ---------- 吸顶栏：半透明毛玻璃，底色得跟着变 ---------- */
[data-theme="dark"] .app-header { background: rgba(18, 20, 24, .88); }
[data-theme="dark"] .reader-topbar { background: rgba(18, 20, 24, .92); }

/* ---------- 输入类 ---------- */
[data-theme="dark"] .input,
[data-theme="dark"] .search-box input,
[data-theme="dark"] .composer-box,
[data-theme="dark"] .vocab-search,
[data-theme="dark"] .roots-search input,
[data-theme="dark"] .roots-select,
[data-theme="dark"] .pager-seek:focus {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] .input::placeholder,
[data-theme="dark"] .search-box input::placeholder,
[data-theme="dark"] .composer-box::placeholder { color: var(--ink-3); }
[data-theme="dark"] .roots-select:disabled { background: var(--surface-soft); color: var(--ink-3); }

/* ---------- 卡片 / 按钮 / 面板：浅底一律换成 surface ---------- */
[data-theme="dark"] .btn:hover,
[data-theme="dark"] .user-chip,
[data-theme="dark"] .switch-label,
[data-theme="dark"] .font-size,
[data-theme="dark"] .pager button,
[data-theme="dark"] .pager-btn,
[data-theme="dark"] .chat-quick button,
[data-theme="dark"] .preset,
[data-theme="dark"] .ract,
[data-theme="dark"] .seg button.on,
[data-theme="dark"] .vt-mode,
[data-theme="dark"] .vt-mode button.on,
[data-theme="dark"] .vt-stepper,
[data-theme="dark"] .wp-mode button.active,
[data-theme="dark"] .wp-ety-tabs button.active,
[data-theme="dark"] .nd-tab.on,
[data-theme="dark"] .chip.active,
[data-theme="dark"] .root-step,
[data-theme="dark"] .rw-item,
[data-theme="dark"] .we-entry,
[data-theme="dark"] .wechat-bind,
[data-theme="dark"] .wp-neighbor,
[data-theme="dark"] .word-top .speak,
[data-theme="dark"] .wp-head .speak,
[data-theme="dark"] .msg.bot .bubble,
[data-theme="dark"] .rcard-front,
[data-theme="dark"] .rcard-detail,
[data-theme="dark"] .rcard-back,
[data-theme="dark"] .nd-item:hover,
[data-theme="dark"] .nd-add,
[data-theme="dark"] .ql-close,
[data-theme="dark"] .bi-row:hover,
[data-theme="dark"] .guard-handle,
[data-theme="dark"] .scan-qr,
[data-theme="dark"] .user-chip:hover .avatar {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

/* 抽屉比卡片再深一档，才分得清「浮在上面」 */
[data-theme="dark"] .notes-drawer,
[data-theme="dark"] .ds-list,
[data-theme="dark"] .page-arrow,
[data-theme="dark"] .wp-bar { background: #191c21; }

/* 书签面板顶上那条要保持「可点」的强调色 */
[data-theme="dark"] .nd-add { color: var(--accent-deep); background: var(--surface); }
[data-theme="dark"] .nd-add.on { background: rgba(92, 195, 164, .14); border-color: var(--accent); }

/* 开关的圆点：暗底上仍要亮，但别用纯白 */
[data-theme="dark"] .switch::after { background: #d9d5cd; }

/* 主按钮：暗色下 --accent 更亮，字得反过来用深色 */
[data-theme="dark"] .btn-primary { color: #0f1a16; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }

/* 危险按钮 */
[data-theme="dark"] .btn-danger { background: rgba(227, 122, 113, .14); border-color: #6b3a35; color: #f0a9a2; }
[data-theme="dark"] .btn-danger:hover { background: rgba(227, 122, 113, .22); }

/* ---------- 状态色：绿色（成功 / 已收录 / 命中） ---------- */
[data-theme="dark"] .w:hover,
[data-theme="dark"] .note-btn.on,
[data-theme="dark"] .rp-chip,
[data-theme="dark"] .ri-type.troot,
[data-theme="dark"] .we-tag,
[data-theme="dark"] .ract.ok,
[data-theme="dark"] .ract.ok:hover,
[data-theme="dark"] .wc-icon.vocab,
[data-theme="dark"] .sc-wx { background: rgba(92, 195, 164, .16); color: #9adcc5; }
[data-theme="dark"] .w.active { background: rgba(92, 195, 164, .3); color: #b9ecdb; }
[data-theme="dark"] .p-say.is-speaking { background: rgba(92, 195, 164, .3); color: #b9ecdb; }

/* 用户划线：亮黄荧光带配浅色字在暗底上等于互相抵消（对比度约 1.3:1，
   远看就是一块空格子）。暗色换成半透明琥珀压在正文上，字提回正文色 —— 
   .p-zh 的译文本来用 --ink-2，落在琥珀上只有 2.5:1，必须一并提亮 */
[data-theme="dark"] mark.u-hl {
  background: linear-gradient(180deg, transparent 44%, rgba(255, 196, 64, .40) 44%, rgba(255, 196, 64, .40) 92%, transparent 92%);
  color: var(--ink);
}

/* ---------- 状态色：金色（复习 / 标记 / 待办） ---------- */
[data-theme="dark"] .vstate.new,
[data-theme="dark"] .mc-state.new,
[data-theme="dark"] .review-badge,
[data-theme="dark"] .rw-lemma,
[data-theme="dark"] .rw-kind,
[data-theme="dark"] .wp-chip.gold,
[data-theme="dark"] .ds-tag,
[data-theme="dark"] .badge-orig,
[data-theme="dark"] .chat-banner,
[data-theme="dark"] .auth-notice.warn { background: rgba(216, 173, 109, .16); color: #e0bb85; }

/* ---------- 状态色：红色（错误 / 删除 / 危险） ---------- */
[data-theme="dark"] .form-error,
[data-theme="dark"] .ract.no,
[data-theme="dark"] .ract.no:hover,
[data-theme="dark"] .rcard-retry,
[data-theme="dark"] .wb-warn,
[data-theme="dark"] .refer-status.err,
[data-theme="dark"] .access-badge.warn,
[data-theme="dark"] .auth-notice.warn,
[data-theme="dark"] .vrow-del:hover,
[data-theme="dark"] .vi-del:hover,
[data-theme="dark"] .hh-clear:hover,
[data-theme="dark"] .nd-del:hover,
[data-theme="dark"] .rc-del:hover,
[data-theme="dark"] .ract.no:hover { background: rgba(227, 122, 113, .16); color: #eda9a2; }

/* ---------- 中性标签（灰底小方块） ---------- */
[data-theme="dark"] .vstate.done,
[data-theme="dark"] .mc-state.done,
[data-theme="dark"] .vtag,
[data-theme="dark"] .rw-kind.un,
[data-theme="dark"] .wed-miss-tag,
[data-theme="dark"] .bi-state.missing,
[data-theme="dark"] .ri-type,
[data-theme="dark"] .vt-stepper { background: rgba(255, 255, 255, .07); color: var(--ink-2); }

[data-theme="dark"] .rp-chip:hover,
[data-theme="dark"] .vr-chip:hover { background: rgba(92, 195, 164, .2); }

/* ---------- 通用浅色底（进度条、分隔、悬停、代码块） ---------- */
[data-theme="dark"] .tabs,
[data-theme="dark"] .auth-hint code,
[data-theme="dark"] .msg.bot .bubble code,
[data-theme="dark"] .pager-seek:hover,
[data-theme="dark"] .ds-list::-webkit-scrollbar-thumb,
[data-theme="dark"] .guard-rail,
[data-theme="dark"] .vc-bar,
[data-theme="dark"] .rc-progress .bar,
[data-theme="dark"] .p-copy:hover,
[data-theme="dark"] .p-say:hover,
[data-theme="dark"] .rp-chip { background: rgba(255, 255, 255, .06); }

[data-theme="dark"] .reading-body .p-zh { background: rgba(255, 255, 255, .045); }

/* 图标底色那几块（生词本/设置/下载页的彩色小方块）压暗，别在深色里发光 */
[data-theme="dark"] .hc-icon.conf,
[data-theme="dark"] .dl-icon.android,
[data-theme="dark"] .dl-tag.old,
[data-theme="dark"] .wechat-bind { background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .sc-ali { background: rgba(122, 162, 227, .16); color: #a8c4f0; }

/* 封面 / 插图在暗底上略压一点亮度，白封面不至于刺眼 */
[data-theme="dark"] .book-cover img,
[data-theme="dark"] .cover img { filter: brightness(.88) contrast(1.02); }

/* 硬编码深色文字的几处（原样式里只有这几处没走变量） */
[data-theme="dark"] .ract.kill { background: rgba(255, 255, 255, .07); color: var(--ink-2); }
[data-theme="dark"] .ract.kill:hover { background: rgba(227, 122, 113, .18); }
[data-theme="dark"] .rd-ety-name,
[data-theme="dark"] .rd-ety-text,
[data-theme="dark"] .auth-brand .seal { color: var(--ink); }

/* ---------- 第二遍补齐：截图里还在发白的块 ---------- */

/* 书库页的分类 chip 是半透明白，rank 空榜是虚线白框，rank 卡片也是硬编码近白纸片 */
[data-theme="dark"] .chip { background: rgba(255, 255, 255, .06); border-color: var(--line); color: var(--ink-2); }
[data-theme="dark"] .chip:hover { background: rgba(255, 255, 255, .1); color: var(--ink); }
[data-theme="dark"] .rank-empty,
[data-theme="dark"] .wp-chat-empty { background: rgba(255, 255, 255, .035); border-color: var(--line); }
[data-theme="dark"] .rank-item { background: rgba(28, 31, 36, .72); border-color: var(--line); }
[data-theme="dark"] .rank-item:hover { background: var(--surface-soft); border-color: #3c4a44; }
[data-theme="dark"] .genres-toggle { background: rgba(255, 255, 255, .06); }

/* 榜单里的书封面跟其它页面一样压一档亮度，彩色封面别在深底上发飘 */
[data-theme="dark"] .rank-thumb,
[data-theme="dark"] .board-thumb { filter: brightness(.88) contrast(1.02); }

/* 单词页：搜索条、例句高亮块、提问输入条 */
[data-theme="dark"] .wp-search { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .wp-search input { color: var(--ink); }
[data-theme="dark"] .wp-search input::placeholder { color: var(--ink-3); }
[data-theme="dark"] .we-q { background: rgba(216, 173, 109, .12); color: var(--ink); }
[data-theme="dark"] .wp-chat-form { background: var(--surface); border-color: var(--line); }

/* 首页那几个彩色图标底：一律压成低饱和，别在深底上发光 */
[data-theme="dark"] .hc-icon.vocab,
[data-theme="dark"] .hc-icon.conf,
[data-theme="dark"] .hc-icon.read { background: rgba(255, 255, 255, .07); }

/* ---------- 第三遍：整块渐变（首页光晕、封面占位、骨架屏） ---------- */

/* 首页顶上那圈近白径向光是浅色主题的「天光」，暗色下会糊成一块雾，换成墨绿微光 */
[data-theme="dark"] body.home-page,
[data-theme="dark"] body.doc-page {
  background: radial-gradient(56% 42% at 50% 0%, #1a2622 0%, rgba(26, 38, 34, 0) 72%), var(--bg);
}

[data-theme="dark"] .sponsor-btn {
  background: linear-gradient(180deg, #2b2418, #221c12);
  border-color: rgba(216, 173, 109, .34);
  color: #e0bb85;
}
[data-theme="dark"] .sponsor-btn:hover { border-color: rgba(216, 173, 109, .55); }

/* 没有封面时的占位渐变：浅米色在深底上最刺眼，统一换成深灰 */
[data-theme="dark"] .recent-card .thumb,
[data-theme="dark"] .rank-thumb,
[data-theme="dark"] .rank-thumb.no-img,
[data-theme="dark"] .card .cover-wrap,
[data-theme="dark"] .cover-fallback,
[data-theme="dark"] .book-head .bh-cover,
[data-theme="dark"] .bs-cover {
  background: linear-gradient(150deg, #2a2d33, #1d2024);
}

[data-theme="dark"] .skeleton-card {
  background: linear-gradient(100deg, #22262c 30%, #2b3037 50%, #22262c 70%);
  background-size: 200% 100%;
}

[data-theme="dark"] .rcard-front { background: linear-gradient(#1f2329, #1a1d22); }

/* 滑块门禁的轨道 */
[data-theme="dark"] .guard-piece { background: linear-gradient(180deg, #2a2e35, #1e2227); }

/* ---------- 第四遍：硬编码的深色文字（浅色主题里是墨色，暗色下会糊进背景） ---------- */

/* 正文是阅读页的主角：英文用暖白，中文译文低一档但必须够读 */
[data-theme="dark"] .reading-body { color: var(--ink); }
[data-theme="dark"] .reading-body .p-zh { color: var(--ink-2); border-left-color: #4a4438; }
[data-theme="dark"] .reading-body h3 { color: var(--ink); }
[data-theme="dark"] .page-track .ip-zh { color: var(--ink-2); }

/* AI 引用段落：暗色下换成半透明青绿，别用浅色底把字压暗 */
[data-theme="dark"] .reading-body .p-en.ai-para {
  background: rgba(92, 195, 164, .09);
  box-shadow: inset 3px 0 0 rgba(92, 195, 164, .55);
}
[data-theme="dark"] .reading-body .p-zh.ai-para {
  background: rgba(92, 195, 164, .10);
  border-left-color: rgba(92, 195, 164, .6);
}

[data-theme="dark"] .rd-ety-name,
[data-theme="dark"] .rd-ety-text { color: var(--ink); }
[data-theme="dark"] .rd-ety-en { color: var(--ink-2); }
[data-theme="dark"] .cover-fallback { color: var(--ink-3); }

[data-theme="dark"] .vres-text b,
[data-theme="dark"] .vocab-backup .vb-text b { color: var(--ink); }

/* 词根类型那几个彩色小标签：深底上要提亮，不然字和底一样暗 */
[data-theme="dark"] .ri-type.tword { background: rgba(150, 130, 214, .18); color: #c3b4f0; }
[data-theme="dark"] .ri-type.tpre { background: rgba(216, 173, 109, .18); color: #e2bd88; }
[data-theme="dark"] .ri-type.tsuf { background: rgba(122, 162, 227, .18); color: #a8c4f0; }
[data-theme="dark"] .rw-kind,
[data-theme="dark"] .bi-state.inVocab,
[data-theme="dark"] .badge-orig { color: #e0bb85; }

[data-theme="dark"] .p-copy:hover,
[data-theme="dark"] .p-say:hover { color: var(--accent-deep); }

/* ---------- 第五遍：对比度不足的实心按钮与提示条 ---------- */

/* 亮绿底 + 白字在暗色下只有 2:1，读不清。--accent 已经提亮，字反过来用深墨 */
[data-theme="dark"] .search-box .search-btn,
[data-theme="dark"] .send-btn,
[data-theme="dark"] .wps-go,
[data-theme="dark"] .pager button.active { color: #0f1a16; }

[data-theme="dark"] .hc-badge { background: rgba(227, 122, 113, .18); color: #f0a9a2; }
[data-theme="dark"] .vocab-restore { background: rgba(216, 173, 109, .13); border-color: rgba(216, 173, 109, .3); }
[data-theme="dark"] .vocab-restore .vr-hint { color: #c9bfae; }

[data-theme="dark"] .vocab-backup .vb-text p { color: var(--ink-2); }
[data-theme="dark"] .vocab-backup .vb-text b { color: var(--ink); }

/* 窄屏给主题按钮腾地方：阅读页顶栏本来就塞满（考试词 / 划线 / 书签 / 中文 / 字号 / 设置），
   多一个 34px 的按钮会横向溢出，这里收紧间距并把按钮收小一圈 */
@media (max-width: 520px) {
  /* 阅读页顶栏本来就塞满，多一个按钮就会顶出 13px 横向滚动：收紧内边距和间距，
     按钮也小一圈，正好放得下 */
  .reader-topbar { padding: 0 8px; gap: 6px; }
  .reader-topbar .rt-actions { gap: 6px; }
  .reader-topbar .theme-toggle { width: 28px; height: 28px; }
  .app-header .theme-toggle { width: 30px; height: 30px; }
}

/* ==========================================================================
   顶栏右上：统一组件（header.js）
   --------------------------------------------------------------------------
   改造前每个页面各写一份右上角，书架 7 个控件、复习页 2 个、单词页 0 个，
   同一件事（设置）有导航、齿轮、头像三个入口，退出紧挨着齿轮。
   现在只有两样东西：页面动作留在页面里，全站通用的收进「主题 + 账号菜单」。
   ========================================================================== */

.header-right { gap: 6px; min-height: 36px; }

.hdr-slot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

/* 顶栏图标按钮的统一样式（主题开关也用它） */
.hdr-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.hdr-icon:hover { background: var(--accent-soft); color: var(--accent-deep); }
.hdr-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hdr-icon svg { width: 17px; height: 17px; }

.hdr-link {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--ink-2);
}
.hdr-link:hover { background: var(--accent-soft); color: var(--accent-deep); }

.hdr-login { height: 34px; }

/* ---------- 账号按钮 + 下拉菜单 ---------- */

.acct { position: relative; flex: none; }

.acct-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}

.acct-btn:hover { background: var(--surface-soft); }
.acct-btn[aria-expanded="true"] { background: var(--surface-soft); border-color: var(--line); }
.acct-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.acct-name {
  max-width: 7.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-chev { color: var(--ink-3); transition: transform .18s ease; flex: none; }
.acct-btn[aria-expanded="true"] .acct-chev { transform: rotate(180deg); }

/* 阅读页 / 单词页只留头像，不占书名的位置 */
.acct.is-compact .acct-name,
.acct.is-compact .acct-chev { display: none; }
.acct.is-compact .acct-btn { padding: 3px; height: 36px; }
.acct.is-compact .avatar { width: 30px; height: 30px; }

.acct-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: 244px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: acct-in .14s ease-out;
}

.acct-menu[hidden] { display: none; }

@keyframes acct-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.acct-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}

.acct-head .avatar.lg { width: 36px; height: 36px; font-size: 15px; flex: none; }

.acct-head-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acct-head-text b {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-head-text i {
  font-style: normal;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .02em;
}

.acct-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.acct-item svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.acct-item:hover { background: var(--surface-soft); color: var(--ink); }
.acct-item:hover svg { color: var(--ink-2); }
.acct-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 帮助类：关于 / FAQ / 下载，三个短链排在一条里，省得菜单太长 */
.acct-links {
  display: flex;
  gap: 2px;
  margin: 4px 0;
  padding: 2px 4px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.acct-links a {
  flex: 1;
  padding: 8px 0;
  border-radius: 7px;
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
}
.acct-links a:hover { background: var(--surface-soft); color: var(--ink); }

.acct-logout { color: var(--danger); }
.acct-logout svg { color: var(--danger); opacity: .8; }
.acct-logout:hover { background: rgba(168, 69, 47, .08); color: var(--danger); }
.acct-logout.is-armed {
  background: rgba(168, 69, 47, .12);
  color: var(--danger);
  font-weight: 600;
}

/* ---------- 页面里的工具栏：以前塞在顶栏的东西都回这儿 ---------- */

.list-tools { display: flex; align-items: center; gap: 10px; }

.sort-select {
  width: auto;
  min-width: 132px;
  height: 32px;
  padding: 0 30px 0 11px;
  border-radius: 9px;
  background-color: var(--surface);
  font-size: 12.5px;
  color: var(--ink-2);
}

.review-head-side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.review-head-side .btn { height: 36px; }

/* ---------- 阅读页顶栏：三组，组间一条竖线 ---------- */

.rt-group { display: flex; align-items: center; gap: 6px; }

.rt-sep {
  flex: none;
  width: 1px;
  height: 18px;
  margin: 0 3px;
  background: var(--line);
}

.rt-actions .hdr-icon { width: 30px; height: 30px; }
.rt-actions .hdr-icon svg { width: 16px; height: 16px; }

/* 当前段已是书签：笔记按钮右上角一颗金点 */
.note-btn.bookmarked { position: relative; }
.note-btn.bookmarked::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--bg);
}

/* ---------- 单词页顶栏：左返回 / 中搜索 / 右账号 ---------- */

.wp-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.wp-search { width: 100%; justify-self: center; }

.wp-acct { justify-self: end; display: inline-flex; align-items: center; gap: 4px; }

/* ---------- 暗色 ---------- */

[data-theme="dark"] .acct-menu { background: #1e2127; border-color: #323840; }
[data-theme="dark"] .acct-head { border-bottom-color: #2b3138; }
[data-theme="dark"] .acct-links { border-color: #2b3138; }
[data-theme="dark"] .acct-item:hover { background: #262b32; }
[data-theme="dark"] .acct-btn:hover,
[data-theme="dark"] .acct-btn[aria-expanded="true"] { background: #23272d; }
[data-theme="dark"] .acct-logout { color: #e38c83; }
[data-theme="dark"] .acct-logout:hover { background: rgba(227, 122, 113, .12); }
[data-theme="dark"] .acct-logout.is-armed { background: rgba(227, 122, 113, .2); }
[data-theme="dark"] .list-tools .sort-select { background-color: var(--surface); }

/* ---------- 窄屏 ---------- */

@media (max-width: 980px) {
  /* 名字让位，头像本身已经能认出是谁 */
  .acct-name { display: none; }
  .acct-btn { padding: 3px; }
}

@media (max-width: 760px) {
  .rt-sep { display: none; }
  .rt-actions { gap: 6px; }
  .rt-group { gap: 6px; }
  .header-right { gap: 4px; }
  .acct-menu { width: min(244px, calc(100vw - 24px)); }
}

@media (max-width: 560px) {
  .wp-bar { padding: 0 10px; gap: 8px; }
  .wp-search { max-width: none; }
}

/* 阅读页「显示方式」：桌面平铺，窄屏收进 Aa 浮层 */
.display-tools { display: flex; align-items: center; gap: 6px; }
.display-toggle { display: none; }
.rt-group { position: relative; }

@media (max-width: 520px) {
  .display-toggle { display: inline-flex; }
  .display-tools { display: none; }
  .display-tools.open {
    display: flex;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 45;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
  }
  /* 窄屏字号按钮收窄一点 */
  .font-size button { width: 30px; }
}

/* 书库页窄屏：主导航保留（横滑），搜索框折到第二行 —— 别把入口一起藏了 */
@media (max-width: 760px) {
  .app-header-search {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 14px;
    row-gap: 10px;
  }
  .app-header-search .search-box { order: 9; flex: 1 0 100%; max-width: none; }
  .app-header-search .search-box input { padding-right: 66px; }
}

/* 菜单里标出当前页（设置/关于这些已不在主导航，得让用户知道自己在哪） */
.acct-item.is-current { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.acct-item.is-current svg { color: var(--accent-deep); }
.acct-links a.is-current { color: var(--accent-deep); font-weight: 600; }
[data-theme="dark"] .acct-item.is-current { background: #1d3a33; color: #86d9bd; }

/* 浮层里空间紧，两字的标签不能被挤成竖排 */
.switch-label { white-space: nowrap; }
