/* 字体：使用用户系统自带字体栈（无自托管字体，零字体流量）
   中英文均回退到各平台原生无衬线体，视觉接近原普惠体，加载成本归零 */

/* ===== 主题变量（默认：深蓝夜色，护眼面板可切换） ===== */
:root {
  --bg: #070a1a;
  --bg-glow: #152050;
  --card: #121a3a;
  --card-soft: rgba(255, 255, 255, 0.04);
  --text: #e8ecff;
  --text-soft: rgba(255, 255, 255, 0.82);
  --muted: #8a93b8;
  --line: rgba(255, 255, 255, 0.1);
  --line-2: rgba(255, 255, 255, 0.05);
  --accent: #5b8cff;
  --accent2: #9b6bff;
  --accent3: #34f5c5;
  --accent-soft: rgba(91, 140, 255, 0.12);
  --accent-soft-2: rgba(91, 140, 255, 0.25);
  --accent3-soft: rgba(52, 245, 197, 0.14);
  --input-bg: #0b1030;
  --overlay-bg: rgba(4, 6, 18, 0.62);
  --reading-scale: 1;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 去除 iOS 原生控件外观：button/input 默认灰色圆角会被我们自定义样式覆盖，必须先关掉原生 appearance */
button { -webkit-appearance: none; appearance: none; font-family: inherit; }
input { -webkit-appearance: none; appearance: none; }
/* 常驻保留滚动条槽位：词卡较高使页面在“开/关”时滚动条显隐，
   否则滚动条消失会令内容宽度回弹、整页抖动一下 */
html { scrollbar-gutter: stable; overflow-x: clip; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;   /* 回退：老浏览器不支持 dvh 时用此值 */
  min-height: 100dvh;  /* iOS Safari 等动态工具栏场景下，避免页脚被地址栏遮挡 */
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  scrollbar-gutter: stable;
  transition: background-color .4s ease, color .35s ease;
}
/* 背景光晕：独立于底色，切主题时底色平滑过渡，光晕本身柔和、瞬时可接受 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(1200px 800px at 70% -10%, var(--bg-glow), transparent 70%);
  opacity: .85;
}
/* 切主题时的平滑过渡：仅切换瞬间给所有元素启用颜色过渡，切完即撤，不干扰平时 hover */
html.theme-anim, html.theme-anim * {
  transition: background-color .4s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease !important;
}
/* 首屏加载锁：刷新/初次打开时禁用所有过渡，避免主题从默认色渐变到已保存配色、或视图切换闪现 */
html.preload, html.preload * {
  transition: none !important;
  animation: none !important;
}
/* 文章页刷新：首帧即隐藏首页（含搜索框），避免 JS 接管前搜索框闪现 */
html.init-article #home { display: none; }
.topbar {
  position: static; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between;
  /* 顶部安全区（刘海/状态栏）：max() 保证即便设备无安全区也不小于原值
     —— 三处断点（base/768/480）均保持此写法，避免被媒体查询覆盖掉安全区 */
  padding: max(env(safe-area-inset-top, 0px), clamp(14px, 1.4vw, 20px)) clamp(20px, 2vw, 32px); border-bottom: 1px solid var(--line);
}
/* 仅独立文章页顶栏吸附（首页不吸附，避免长首页被顶栏压住） */
body[data-standalone="article"] .topbar { position: sticky; top: 0; z-index: 40; }
.brand { font-weight: 700; font-size: clamp(16px, 1.3vw, 22px); letter-spacing: .5px; }
.top-actions { position: relative; display: flex; align-items: center; gap: clamp(10px, 1.2vw, 18px); }
.nav a { color: var(--muted); text-decoration: none; margin-left: 18px; font-size: clamp(13px, 1.05vw, 16px); }
.nav a.active { color: var(--text); }
.nav a.disabled { opacity: .4; cursor: not-allowed; }

/* ===== 独立文章页顶栏：迷你搜索框 + 文章下拉菜单 ===== */
body[data-standalone="article"] .search-wrap.mini {
  position: relative; flex: 1 1 auto; min-width: 0; max-width: 360px;
}
body[data-standalone="article"] #search {
  width: 100%;
  padding: 9px 14px;
  font-size: clamp(14px, 1.1vw, 16px);
  border-radius: 10px;
}
body[data-standalone="article"] .suggestions {
  top: calc(100% + 8px);
  left: 0; right: auto;
  width: min(460px, calc(100vw - 32px));
}
.article-menu { position: relative; display: inline-flex; }
.article-menu-btn {
  font-family: inherit; cursor: pointer; white-space: nowrap;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-size: clamp(13px, 1.05vw, 15px); display: inline-flex; align-items: center; gap: 6px;
  transition: border-color .2s, background .2s, color .2s;
}
.article-menu-btn:hover, .article-menu-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.article-menu-list {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 45;
  width: min(260px, calc(100vw - 24px)); max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .4); padding: 8px; text-align: left;
  animation: floatIn .22s ease;
}
.article-menu-list.hidden { display: none; }
.ami-group + .ami-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-2); }
.ami-group-title { font-size: 12px; color: var(--muted); letter-spacing: .5px; padding: 8px 10px 4px; }
.ami-item {
  display: block; padding: 8px 10px; border-radius: 9px;
  color: var(--text); text-decoration: none;
  font-size: clamp(13px, 1.05vw, 15px); line-height: 1.4;
  transition: background .15s, color .15s;
}
.ami-item:hover { background: var(--accent-soft); color: var(--accent); }
.ami-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
/* 独立页无需悬浮返回箭头（顶栏已吸附且含文章下拉，返回由下拉/品牌链接承担） */
body[data-standalone="article"] .reader-back { display: none; }

/* 护眼按钮 + 弹窗面板 */
.eyecare-btn {
  font-family: inherit; cursor: pointer; white-space: nowrap;
  padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-size: clamp(13px, 1.05vw, 15px); display: inline-flex; align-items: center; gap: 6px;
  transition: border-color .2s, background .2s, color .2s;
}
.eyecare-btn:hover { border-color: var(--accent); }
.eyecare-btn.active { border-color: var(--accent); color: var(--accent); }
/* 顶部栏「单词消消乐」入口 */
.wm-top-btn {
  font-family: inherit; cursor: pointer; white-space: nowrap;
  padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  font-size: clamp(13px, 1.05vw, 15px); font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .2s, color .2s, transform .1s;
}
.wm-top-btn:hover { background: var(--accent); color: #fff; }
.wm-top-btn:active { transform: scale(.96); }
.eye-panel {
  position: absolute; top: calc(100% + 12px); right: 0; z-index: 30;
  width: 268px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  animation: floatIn .25s ease;
}
.eye-panel.hidden { display: none; }
.eye-group + .eye-group { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.eye-label { font-size: 13px; color: var(--muted); margin-bottom: 10px; letter-spacing: .5px; }
.eye-options { display: flex; gap: 8px; flex-wrap: wrap; }
.eye-options button {
  flex: 1 1 auto; min-width: 52px; padding: 9px 8px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card-soft); color: var(--text);
  font-family: inherit; font-size: 14px; transition: border-color .18s, background .18s, color .18s;
}
.eye-options button:hover { border-color: var(--accent); }
.eye-options button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.home {
  flex: 1 0 auto;
  width: min(1000px, 94vw); margin: 0 auto;
  padding: clamp(8vh, 11vh, 14vh) clamp(20px, 3vw, 36px) 40px; text-align: center;
}
.home.hidden { display: none; }
.edat-brand {
  display: flex; justify-content: center; gap: clamp(12px, 1.4vw, 18px); margin-bottom: clamp(26px, 3vw, 40px);
}
.edat-letter {
  width: clamp(58px, 5vw, 80px); height: clamp(58px, 5vw, 80px); border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: clamp(28px, 3vw, 42px); font-weight: 800;
  background: var(--card-soft);
  border: 1px solid var(--line);
  color: var(--text);
  transition: border-color .25s, transform .25s;
}
.edat-letter:hover { border-color: var(--accent); transform: translateY(-3px); }

.search-wrap { position: relative; margin-top: 0; }
#search {
  width: 100%;
  padding: clamp(14px, 1.3vw, 20px) clamp(16px, 1.5vw, 22px);
  font-size: clamp(16px, 1.3vw, 21px); border-radius: 14px;
  border: 2px solid transparent; color: var(--text); outline: none;
  background-image: linear-gradient(var(--input-bg), var(--input-bg)), linear-gradient(90deg, #5b8cff, #9b6bff, #34f5c5);
  background-origin: border-box; background-clip: padding-box, border-box;
  transition: box-shadow .2s;
}
#search::placeholder { color: var(--muted); }
#search.search-focused { box-shadow: 0 0 0 4px var(--accent-soft); }

.suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; text-align: left; max-height: clamp(280px, 32vh, 420px); overflow-y: auto; z-index: 10;
}
.suggestions.hidden { display: none; }
.sug-item {
  padding: clamp(10px, 1vw, 14px) clamp(14px, 1.4vw, 20px); cursor: pointer;
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 1px solid var(--line-2);
}
.sug-item:last-child { border-bottom: none; }
.sug-item:hover, .sug-item.active { background: var(--accent-soft); }
.sug-word { font-weight: 600; font-size: clamp(15px, 1.3vw, 20px); }
.sug-stage {
  flex: 0 0 auto; font-size: clamp(10px, .9vw, 12px); line-height: 1;
  padding: 3px 7px; border-radius: 999px;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2); white-space: nowrap;
  transform: translateY(-1px);
}
.sug-phon { color: var(--muted); font-size: clamp(12px, 1vw, 15px); }
.sug-mean { color: var(--muted); font-size: clamp(12px, 1vw, 15px); margin-left: auto; }
mark { background: var(--accent); color: #fff; border-radius: 3px; padding: 0 2px; }
.empty { padding: 18px; color: var(--muted); text-align: center; }

.card-panel { margin-top: clamp(22px, 2.4vw, 32px); animation: floatIn .35s ease; }
.card-panel.hidden { display: none; }
.word-card {
  position: relative; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: clamp(22px, 2.2vw, 38px); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.card-close {
  position: absolute; top: clamp(14px, 1.4vw, 18px); right: clamp(14px, 1.4vw, 18px);
  width: clamp(32px, 2.6vw, 40px); height: clamp(32px, 2.6vw, 40px); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--card-soft);
  color: var(--muted); cursor: pointer; line-height: 0;
  transition: color .2s, border-color .2s, background .2s, transform .2s;
}
.card-close:hover {
  color: #fff; border-color: var(--accent);
  background: var(--accent-soft); transform: rotate(90deg);
}
.wc-head { display: flex; flex-direction: column; gap: 6px; padding-right: clamp(40px, 4vw, 52px); }
.wc-title { display: flex; align-items: center; gap: 12px; }
.wc-word { font-size: clamp(34px, 3.4vw, 52px); font-weight: 800; line-height: 1.1; }
.wc-phon { color: var(--muted); font-size: clamp(16px, 1.5vw, 22px); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.wc-meta-line { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: clamp(13px, 1vw, 15px); align-items: center; }
.wc-pos {
  display: inline-block; margin-top: clamp(14px, 1.5vw, 20px); padding: 4px 12px; border-radius: 999px;
  background: var(--accent3-soft); color: var(--accent3); font-size: clamp(13px, 1vw, 16px);
}
.wc-mean { font-size: clamp(20px, 1.9vw, 30px); margin-top: 14px; line-height: 1.5; }
.wc-examples { margin-top: clamp(20px, 2vw, 28px); display: flex; flex-direction: column; gap: clamp(12px, 1.2vw, 16px); }
.wc-ex {
  display: flex; align-items: flex-start; gap: 12px;
  padding: clamp(14px, 1.3vw, 20px) clamp(14px, 1.5vw, 22px); background: var(--card-soft);
  border-radius: 12px; border-left: 3px solid var(--accent);
}
.wc-ex-text { flex: 1; }
.wc-ex .en { font-size: clamp(16px, 1.45vw, 23px); line-height: 1.55; }
.wc-ex .zh { color: var(--muted); font-size: clamp(14px, 1.25vw, 19px); margin-top: 6px; line-height: 1.5; }
.mini-speaker {
  flex: 0 0 auto; width: clamp(32px, 2.6vw, 40px); height: clamp(32px, 2.6vw, 40px); margin-top: 2px;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--accent-soft); color: var(--accent); cursor: pointer; font-size: clamp(14px, 1.1vw, 18px);
  transition: background .2s;
}
.mini-speaker:hover { background: var(--accent-soft-2); }
.word-speaker { margin-top: 0; width: clamp(36px, 3vw, 44px); height: clamp(36px, 3vw, 44px); font-size: clamp(16px, 1.3vw, 20px); }
.wc-meta { margin-top: clamp(22px, 2.2vw, 30px); display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: clamp(13px, 1vw, 16px); align-items: center; }
.tag { padding: 5px 12px; border-radius: 999px; background: var(--card-soft); font-size: clamp(13px, 1vw, 16px); }

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

/* ===== 富集词卡：多词义 / 搭配 / 语法 ===== */
.wc-meanings { margin-top: clamp(16px, 1.6vw, 24px); display: flex; flex-direction: column; gap: clamp(10px, 1vw, 14px); }
.wc-pos-block { display: flex; gap: 12px; align-items: flex-start; }
.wc-pos-block .wc-pos { margin-top: 2px; flex: 0 0 auto; }
.wc-defs { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.wc-def { display: flex; flex-direction: column; gap: 2px; }
.wc-def .cn { font-size: clamp(17px, 1.6vw, 23px); line-height: 1.45; }
.wc-def .en { color: var(--muted); font-size: clamp(13px, 1.1vw, 16px); line-height: 1.4; }
.wc-block { margin-top: clamp(20px, 2vw, 28px); }
.wc-section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: clamp(17px, 1.5vw, 22px); font-weight: 700; letter-spacing: 0.5px;
  color: var(--text); margin-bottom: 14px;
}
.wc-section-title::before {
  content: ""; width: 4px; height: 1.05em; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent3));
}
.wc-colloc { display: flex; flex-direction: column; gap: clamp(10px, 1vw, 14px); }
.wc-col { padding: clamp(12px, 1.1vw, 16px) clamp(14px, 1.3vw, 18px); background: var(--card-soft); border-radius: 12px; border-left: 3px solid var(--accent2); }
.wc-col-head { display: flex; align-items: center; gap: 10px; }
.wc-col-phrase { font-weight: 600; font-size: clamp(16px, 1.4vw, 20px); }
.wc-col-cn { color: var(--muted); font-size: clamp(14px, 1.2vw, 17px); margin-top: 4px; }
.wc-col-ex {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 10px; padding: clamp(10px, 1vw, 14px) clamp(12px, 1.1vw, 16px);
  background: var(--card-soft); border-radius: 10px;
}
.wc-col-ex .wc-ex-text { flex: 1; }
.wc-col-ex .en { font-size: clamp(16px, 1.45vw, 23px); line-height: 1.55; }
.wc-col-ex .zh { color: var(--muted); font-size: clamp(14px, 1.25vw, 19px); margin-top: 6px; line-height: 1.5; }
.wc-gram { padding: clamp(12px, 1.1vw, 16px) clamp(14px, 1.3vw, 18px); background: var(--card-soft); border-radius: 12px; border-left: 3px solid var(--accent); margin-bottom: clamp(10px, 1vw, 14px); }
.wc-gram-title { font-weight: 700; font-size: clamp(16px, 1.4vw, 21px); margin-bottom: 8px; color: var(--text); }
.wc-gram-content { color: var(--text-soft); font-size: clamp(16px, 1.4vw, 20px); line-height: 1.7; }
.wc-gram-content :where(p, li) { margin: 4px 0; }
.wc-gram-exs { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }

/* ===== 文章视图（字号已整体放大，护眼面板可再调） ===== */
.article-view { flex: 1 0 auto; max-width: clamp(720px, 74vw, 1000px); margin: 0 auto; padding: clamp(24px, 4vh, 48px) clamp(20px, 3vw, 36px) 60px; }
.article-view.hidden { display: none; }
.article-h { font-size: clamp(26px, 2.6vw, 38px); font-weight: 800; }
.article-sub { color: var(--muted); margin-top: 8px; font-size: clamp(15px, 1.3vw, 19px); }
.book-block { margin-top: clamp(24px, 3vw, 38px); }
.stage-block { margin-top: clamp(30px, 3.5vw, 46px); }
.stage-block:first-child { margin-top: 0; }
.stage-title { font-size: clamp(22px, 2vw, 30px); font-weight: 800; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid var(--line); }
.book-grade { font-size: clamp(17px, 1.5vw, 22px); font-weight: 700; color: var(--accent); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.unit-card {
  display: block; padding: clamp(14px, 1.4vw, 18px); border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--text);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.unit-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4); }
.unit-name { font-weight: 700; font-size: clamp(16px, 1.4vw, 21px); }
.unit-titles { color: var(--muted); font-size: clamp(13px, 1.1vw, 16px); margin-top: 6px; line-height: 1.5; }

.article-reader { animation: floatIn .35s ease; }
.back-link { display: inline-block; color: var(--accent); text-decoration: none; font-size: clamp(13px, 1.1vw, 16px); margin-bottom: 18px; }
.back-link:hover { text-decoration: underline; }
.reader-back {
  position: fixed;
  top: calc(clamp(68px, 8.2vw, 92px) + env(safe-area-inset-top, 0px));
  right: calc(clamp(14px, 3vw, 40px) + env(safe-area-inset-right, 0px));
  z-index: 55;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(42px, 11vw, 48px);
  height: clamp(42px, 11vw, 48px);
  padding: 0;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: clamp(20px, 5vw, 24px);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color .18s, color .18s, transform .18s, background .18s;
}
.reader-back:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.reader-back:active { transform: translateY(0) scale(.96); }
.reader-meta { color: var(--muted); font-size: clamp(14px, 1.2vw, 18px); margin-bottom: clamp(18px, 2vw, 28px); max-width: calc(100% - 150px); }
.passage { margin-bottom: clamp(26px, 3vw, 40px); padding-bottom: clamp(20px, 2vw, 28px); border-bottom: 1px solid var(--line); }
.passage:last-child { border-bottom: none; }
.passage-head { margin-bottom: 16px; }
.passage-section { color: var(--accent3); font-size: clamp(13px, 1.1vw, 16px); letter-spacing: 1px; }
.passage-title { font-size: calc(clamp(22px, 2.1vw, 30px) * var(--reading-scale)); font-weight: 800; margin-top: 4px; line-height: 1.35; }
.passage-title-cn { color: var(--muted); font-size: calc(clamp(15px, 1.4vw, 19px) * var(--reading-scale)); margin-top: 4px; }
.para { margin-top: clamp(16px, 1.6vw, 24px); }
.para-en { font-size: calc(clamp(19px, 1.8vw, 26px) * var(--reading-scale)); line-height: 1.9; letter-spacing: .2px; display: flex; align-items: flex-start; gap: .5em; }
.para-text { flex: 1; }
.para-speaker {
  flex: 0 0 auto; margin-top: .2em;
  width: clamp(30px, 2.4vw, 38px); height: clamp(30px, 2.4vw, 38px);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: clamp(14px, 1.1vw, 17px); line-height: 1;
  border-radius: 50%; cursor: pointer;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
  transition: transform .15s ease, background .15s ease, color .15s ease;
}
.para-speaker:hover { background: var(--accent); color: #fff; transform: scale(1.08); }
.para-speaker:active { transform: scale(.94); }
.para-speaker .ico { display: inline-flex; line-height: 1; pointer-events: none; }
/* 朗读状态：播放中（实心 + 脉冲）/ 暂停中（描边 + 继续图标） */
.para-speaker.playing { background: var(--accent); color: #fff; }
.para-speaker.playing .ico { animation: spk-pulse 1.1s ease-in-out infinite; }
.para-speaker.paused { background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft-2) inset; }
@keyframes spk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.para-cn { color: var(--muted); font-size: calc(clamp(16px, 1.5vw, 22px) * var(--reading-scale)); margin-top: 10px; line-height: 1.8; }
.anno-row { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.anno-chip {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); text-decoration: none;
  font-size: clamp(12px, 1vw, 15px); transition: background .2s;
}
.anno-chip:hover { background: var(--accent-soft-2); }
.anno-chip[data-id] { cursor: pointer; }
.anno-chip.static { background: var(--card-soft); color: var(--muted); cursor: default; }

/* 课文精读：语法 / 文化 / 要点摘要 */
.anno-notes { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.anno-gram {
  padding: clamp(10px, 1vw, 14px) clamp(12px, 1.1vw, 16px);
  background: var(--card-soft); border-radius: 10px; border-left: 3px solid var(--accent3);
}
.anno-gram-point { font-weight: 700; font-size: calc(clamp(14px, 1.2vw, 17px) * var(--reading-scale)); color: var(--accent3); margin-bottom: 6px; }
.anno-gram-explain { color: var(--text-soft); font-size: calc(clamp(14px, 1.2vw, 17px) * var(--reading-scale)); line-height: 1.7; }
.anno-gram-explain :where(p, li) { margin: 4px 0; }
.anno-culture {
  padding: clamp(10px, 1vw, 14px) clamp(12px, 1.1vw, 16px);
  background: var(--card-soft); border-radius: 10px; border-left: 3px solid var(--accent2);
}
.anno-culture-label { font-size: clamp(11px, .9vw, 13px); font-weight: 600; color: var(--accent2); letter-spacing: 1px; margin-bottom: 4px; }
.anno-culture-text { color: var(--text-soft); font-size: calc(clamp(14px, 1.2vw, 17px) * var(--reading-scale)); line-height: 1.7; }
.anno-summaries { margin-top: clamp(16px, 1.6vw, 24px); padding: clamp(14px, 1.3vw, 20px) clamp(16px, 1.5vw, 22px); background: var(--card-soft); border-radius: 12px; }
.anno-summaries-title { font-size: clamp(15px, 1.3vw, 18px); font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.anno-summaries ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.anno-summaries li { color: var(--text-soft); font-size: calc(clamp(14px, 1.2vw, 17px) * var(--reading-scale)); line-height: 1.6; padding-left: 16px; position: relative; }
.anno-summaries li::before { content: "•"; position: absolute; left: 0; color: var(--accent); }

/* ===== 悬浮浮层词卡（文章内点词弹出，不离开阅读） ===== */
.card-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  /* 四边安全区：刘海屏下词卡不被状态栏/底部 Home 指示条遮挡 */
  padding: calc(clamp(20px, 7vh, 96px) + env(safe-area-inset-top, 0px)) calc(clamp(16px, 4vw, 40px) + env(safe-area-inset-right, 0px)) calc(clamp(20px, 7vh, 96px) + env(safe-area-inset-bottom, 0px)) calc(clamp(16px, 4vw, 40px) + env(safe-area-inset-left, 0px));
  background: var(--overlay-bg); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  animation: overlayFade .2s ease;
}
.card-overlay.hidden { display: none; }
.overlay-inner { width: min(680px, 100%); margin: auto; }
.overlay-inner .word-card { animation: floatIn .3s ease; }
@keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }

/* ===== 主题：护眼绿（柔和豆沙绿，降亮度降对比） ===== */
html[data-theme="eyecare"] {
  --bg: #c9d8cc;
  --bg-glow: #bfcfc3;
  --card: #d4e0d6;
  --card-soft: rgba(46, 64, 52, 0.045);
  --text: #41584a;
  --text-soft: rgba(65, 88, 74, 0.8);
  --muted: #7e9183;
  --line: rgba(46, 64, 52, 0.14);
  --line-2: rgba(46, 64, 52, 0.07);
  --accent: #3f8f6a;
  --accent2: #568ca0;
  --accent3: #9a7a2f;
  --accent-soft: rgba(63, 143, 106, 0.14);
  --accent-soft-2: rgba(63, 143, 106, 0.24);
  --accent3-soft: rgba(154, 122, 47, 0.16);
  --input-bg: #cddccf;
  --overlay-bg: rgba(46, 64, 52, 0.4);
}
/* ===== 主题：米黄护眼（柔和暖纸，降亮度降对比） ===== */
html[data-theme="sepia"] {
  --bg: #e7dcc4;
  --bg-glow: #ddd1b7;
  --card: #efe6d2;
  --card-soft: rgba(74, 64, 52, 0.045);
  --text: #574c3b;
  --text-soft: rgba(87, 76, 59, 0.8);
  --muted: #92866f;
  --line: rgba(74, 64, 52, 0.14);
  --line-2: rgba(74, 64, 52, 0.07);
  --accent: #a9791f;
  --accent2: #8f7fc0;
  --accent3: #3f7f5e;
  --accent-soft: rgba(169, 121, 31, 0.14);
  --accent-soft-2: rgba(169, 121, 31, 0.24);
  --accent3-soft: rgba(63, 127, 94, 0.16);
  --input-bg: #ece1c9;
  --overlay-bg: rgba(74, 64, 52, 0.34);
}
/* ===== 主题：夜间（纯黑低眩光） ===== */
html[data-theme="night"] {
  --bg: #000000;
  --bg-glow: #0c0c0c;
  --card: #141414;
  --card-soft: rgba(255, 255, 255, 0.05);
  --text: #e8e8e8;
  --text-soft: rgba(255, 255, 255, 0.78);
  --muted: #9a9a9a;
  --line: rgba(255, 255, 255, 0.12);
  --line-2: rgba(255, 255, 255, 0.06);
  --accent: #4f8cff;
  --accent2: #9b6bff;
  --accent3: #34f5c5;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --accent-soft-2: rgba(79, 140, 255, 0.26);
  --accent3-soft: rgba(52, 245, 197, 0.14);
  --input-bg: #111111;
  --overlay-bg: rgba(0, 0, 0, 0.72);
}

/* ===== 回到顶部（长文章） ===== */
.to-top {
  position: fixed;
  right: calc(clamp(24px, 3vw, 46px) + env(safe-area-inset-right, 0px));
  bottom: calc(clamp(24px, 3vw, 46px) + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  width: clamp(42px, 4vw, 52px); height: clamp(42px, 4vw, 52px);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(20px, 2vw, 26px); line-height: 1; color: #fff;
  background: var(--accent); border: none; border-radius: 50%;
  cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  opacity: .92; transition: transform .18s ease, opacity .18s ease, background .18s ease;
}
.to-top:hover { transform: translateY(-3px); opacity: 1; background: var(--accent2); }
.to-top:active { transform: translateY(0) scale(.94); }
.to-top.hidden { display: none; }
.game-fab.hidden { display: none; }

/* ===== 全站页脚（横向平铺，减小垂直占用） ===== */
.site-footer {
  margin-top: clamp(16px, 2vw, 24px);
  padding: clamp(16px, 2vw, 24px) clamp(16px, 4vw, 40px) max(env(safe-area-inset-bottom, 0px), clamp(16px, 2vw, 24px));
  border-top: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--muted);
  font-size: clamp(12px, 1vw, 14px);
  line-height: 1.6;
  flex-shrink: 0;
}
.footer-inner { max-width: 960px; margin: 0 auto; }
.footer-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: clamp(18px, 3vw, 40px); flex-wrap: wrap;
}

/* 右侧版权 / 备案 / 声明，平铺一行（窄屏自动换行） */
.footer-meta {
  flex: 1 1 280px; min-width: 240px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px;
  text-align: left;
}
.footer-copy { color: var(--text-soft); font-weight: 600; margin: 0; }
.footer-beian { margin: 0; }
.footer-beian a { color: var(--accent); text-decoration: none; }
.footer-beian a:hover { text-decoration: underline; }
.footer-disclaimer { margin: 0; color: var(--muted); opacity: .8; flex-basis: 100%; }
.footer-disclaimer a { color: var(--accent); text-decoration: none; }
.footer-disclaimer a:hover { text-decoration: underline; }

/* ===== 响应式：手机 / 窄屏适配（原站无媒体查询，移动端偏拥挤） ===== */
@media (max-width: 768px) {
  .topbar { padding: max(env(safe-area-inset-top, 0px), 12px) 16px; }
  .top-actions { gap: 10px; }
  /* 手机端独立文章页：移除顶栏迷你搜索框（避免窄屏拥挤/下拉溢出；桌面端保留） */
  body[data-standalone="article"] .search-wrap.mini { display: none; }
  .nav a { margin-left: 14px; font-size: 14px; }
  .eyecare-btn { padding: 7px 13px; font-size: 13px; }
  .home { padding: clamp(5vh, 7vh, 9vh) 16px 32px; }
  .edat-brand { gap: 12px; margin-bottom: 22px; }
  .edat-letter { width: 56px; height: 56px; border-radius: 15px; font-size: 26px; }
  #search { padding: 13px 16px; font-size: 16px; }
  .word-card { padding: 20px 18px; }
  .wc-word { font-size: 32px; }
  .unit-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .article-view { padding: 20px 16px 48px; }
  .reader-meta { max-width: 100%; }
  .footer-row { gap: 16px; }
}

@media (max-width: 480px) {
  .topbar { padding: max(env(safe-area-inset-top, 0px), 10px) 12px; }
  .brand { font-size: 15px; }
  .nav a { margin-left: 12px; font-size: 13px; }
  .eyecare-btn { padding: 6px 11px; }
  .article-menu-btn { padding: 6px 11px; font-size: 13px; }
  .wm-top-btn { padding: 6px 11px; }
  .wm-top-btn .wm-txt { display: none; }
  .home { padding: 4vh 14px 28px; }
  .edat-letter { width: 50px; height: 50px; border-radius: 14px; font-size: 22px; }
  .edat-brand { gap: 9px; margin-bottom: 18px; }
  #search { padding: 12px 14px; }
  .word-card { padding: 17px 15px; }
  .wc-word { font-size: 28px; }
  .wc-head { padding-right: 38px; }
  .unit-grid { grid-template-columns: 1fr; gap: 12px; }
  .unit-card { padding: 14px; }
  .card-close { width: 34px; height: 34px; }
  .article-view { padding: 16px 14px 44px; }
  .passage-head { margin-bottom: 12px; }
  .reader-meta { font-size: 14px; }
  .to-top { right: 18px; bottom: 22px; }
  /* 手机端底部栏：版权/备案/侵权邮箱均保留（备案号依法必展示，邮箱为侵权联系方式） */
  .footer-row { justify-content: center; gap: 0; }
  .site-footer { text-align: center; }
}

/* ===== 无障碍：用户开启「减少动态效果」时关闭动画/过渡（晕动症友好） ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
