/* ============================================================
   EnglishWord · macOS 全面风格
   系统灰 #F5F5F7 / 磨砂玻璃 / Finder 侧边栏 / 交通灯窗口
   ============================================================ */

:root {
  --bg: #F5F5F7;
  --ink: #1D1D1F;
  --ink-2: #515154;
  --ink-3: #86868B;
  --accent: #007AFF;
  --accent-hover: #0071E3;
  --accent-soft: rgba(0, 122, 255, .1);
  --green: #28C840;
  --red: #FF5F57;
  --amber: #FEBC2E;
  --orange: #F5A623;

  /* 磨砂玻璃材质 */
  --glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-blur: blur(30px) saturate(180%);
  --glass-blur-lg: blur(50px) saturate(190%);
  --border: rgba(0, 0, 0, .08);
  --border-strong: rgba(0, 0, 0, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 30px rgba(0, 0, 0, .07);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .16);

  --radius: 16px;
  --radius-sm: 10px;
  --menu-h: 30px;
  --sb-w: 216px;
  --font: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(120, 140, 200, .10), transparent 60%),
    radial-gradient(1000px 600px at -5% 105%, rgba(140, 160, 220, .08), transparent 55%),
    var(--bg);
}

button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input { font-family: inherit; }
.hidden { display: none !important; }

/* ============================================================
   顶部菜单栏
   ============================================================ */
.menu-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--menu-h);
  z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: rgba(255, 255, 255, .68);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: .5px solid var(--border);
  font-size: 14px;
  user-select: none;
}
.menu-left { display: flex; align-items: center; gap: 20px; }
.menu-app { font-weight: 700; letter-spacing: .2px; }
.menu-items { display: flex; gap: 15px; color: var(--ink-2); }
.menu-items span { padding: 2px 5px; border-radius: 5px; cursor: default; }
.menu-right { display: flex; align-items: center; gap: 13px; }
.menu-chip {
  font-size: 13px; color: var(--ink-2);
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .045);
}
.menu-chip b { color: var(--ink); font-variant-numeric: tabular-nums; }
.menu-user {
  font-size: 13px; font-weight: 700; color: var(--accent);
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  transition: background .15s ease, transform .15s ease;
}
.menu-user:hover { background: rgba(0, 122, 255, .18); transform: scale(1.03); }
.menu-admin {
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .05);
  transition: background .15s ease, transform .15s ease, color .15s ease;
}
.menu-admin:hover { background: rgba(255, 149, 0, .16); color: #d97706; transform: scale(1.03); }
.menu-clock {
  font-size: 14px; color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-width: 54px; text-align: right;
}

/* ============================================================
   登录页
   ============================================================ */
#view-login { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.login-wrap { width: 100%; max-width: 380px; }
.login-card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  backdrop-filter: var(--glass-blur-lg);
  border: .5px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  border-radius: 26px;
  padding: 46px 36px 34px;
  text-align: center;
  animation: pop-in .45s cubic-bezier(.34, 1.56, .64, 1);
}
.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto;
  border-radius: 20px;
  background: var(--accent);
  display: grid; place-items: center;
  font-size: 32px;
  box-shadow: 0 14px 30px rgba(0, 122, 255, .3);
}
.login-card h1 { font-size: 26px; font-weight: 800; margin-top: 16px; }
.login-sub { font-size: 13.5px; color: var(--ink-2); margin-top: 5px; }
.login-card input {
  width: 100%;
  margin-top: 26px;
  border: .5px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px; color: var(--ink);
  background: rgba(255, 255, 255, .7);
  outline: none;
  text-align: center;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.login-card input:focus {
  border-color: rgba(0, 122, 255, .55);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .15);
}
.login-btn {
  width: 100%;
  margin-top: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 16px; font-weight: 700;
  background: var(--accent); color: #fff;
  box-shadow: 0 8px 22px rgba(0, 122, 255, .3);
  transition: transform .16s ease;
}
.login-btn:hover { transform: translateY(-1px); }
.login-btn:active { transform: scale(.98); }
.login-error {
  margin-top: 14px;
  font-size: 13px; font-weight: 700;
  color: var(--red);
  min-height: 18px;
}

/* ============================================================
   主界面:侧边栏 + 内容
   ============================================================ */
.app-body {
  position: fixed; inset: var(--menu-h) 0 0 0;
  display: flex;
}

/* Finder 侧边栏 */
.sidebar {
  width: var(--sb-w);
  flex-shrink: 0;
  padding: 12px 10px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(246, 246, 248, .58);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-right: .5px solid var(--border);
  display: flex; flex-direction: column; gap: 18px;
  transition: width .28s cubic-bezier(.4, 0, .2, 1), padding .28s cubic-bezier(.4, 0, .2, 1);
}

/* 收缩按钮 */
.sb-toggle {
  align-self: flex-end;
  width: 30px; height: 24px;
  border-radius: 7px;
  display: grid; place-items: center;
  color: var(--ink-3);
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease, transform .25s ease;
  flex-shrink: 0;
}
.sb-toggle:hover { background: rgba(0, 0, 0, .07); color: var(--ink); }
.sb-toggle:active { transform: scale(.92); }
.sb-toggle svg { transition: transform .28s cubic-bezier(.4, 0, .2, 1); }

.sb-group { display: flex; flex-direction: column; gap: 2px; }
.sb-title {
  font-size: 12px; font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .6px;
  padding: 0 10px 5px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .2s ease;
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 14.5px; color: var(--ink);
  text-align: left;
  transition: background .15s ease;
  position: relative;
  white-space: nowrap;
}
.sb-item svg { flex-shrink: 0; color: var(--ink-3); }
.sb-item:hover { background: rgba(0, 0, 0, .05); }
.sb-item.active { background: var(--accent-soft); color: var(--accent); }
.sb-item.active svg { color: var(--accent); }
.sb-item.static { cursor: default; }
.sb-item.static:hover { background: none; }
.sb-label { flex: 1; overflow: hidden; }
.sb-badge {
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-2);
  background: rgba(0, 0, 0, .06);
  padding: 2px 9px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.sb-item.active .sb-badge { background: var(--accent); color: #fff; }

/* 折叠态小圆点(收缩时替代徽章) */
.sb-dot {
  position: absolute;
  top: 4px; right: 5px;
  min-width: 15px; height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 9px; font-weight: 700;
  display: grid; place-items: center;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .2s ease, transform .2s ease;
}
.sb-dot.is-hot { background: var(--red); }

/* 折叠态 */
.sidebar.collapsed {
  width: 62px;
  padding: 10px 7px 18px;
}
.sidebar.collapsed .sb-title {
  text-align: center;
  padding: 0;
  font-size: 9.5px;
  letter-spacing: .3px;
}
.sidebar.collapsed .sb-item {
  justify-content: center;
  padding: 8px 4px;
}
.sidebar.collapsed .sb-label,
.sidebar.collapsed .sb-badge { display: none; }
.sidebar.collapsed .sb-dot { opacity: 1; transform: scale(1); }
.sidebar.collapsed .sb-toggle { align-self: center; }
.sidebar.collapsed .sb-toggle svg { transform: rotate(180deg); }

/* 内容区 */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 38px 46px 90px;
}
.content-head { margin-bottom: 24px; }
.content-head h1 { font-size: 29px; font-weight: 800; letter-spacing: .2px; }
.content-head p { font-size: 14.5px; color: var(--ink-2); margin-top: 5px; }

.view { max-width: 920px; margin: 0 auto; }

/* ============================================================
   通用磨砂卡片
   ============================================================ */
.card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
}

/* ============================================================
   继续上次
   ============================================================ */
.continue-bar {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 122, 255, .28);
  text-align: left;
  margin-bottom: 22px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.continue-bar:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(0, 122, 255, .34); }
.continue-bar:active { transform: scale(.99); }
.cb-ico {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, .22);
  display: grid; place-items: center;
  font-size: 15px;
}
.cb-text { flex: 1; min-width: 0; }
.cb-text strong { font-size: 15.5px; font-weight: 700; display: block; }
.cb-text small { font-size: 13px; color: rgba(255, 255, 255, .8); display: block; margin-top: 1px; }
.cb-arrow { font-size: 22px; opacity: .7; }

/* ============================================================
   统计卡
   ============================================================ */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 13px; margin-bottom: 28px;
}
/* 学习统计(今日/累计时长 + 累计测试) */
.study-title { margin-top: -6px; }
.study-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.study-stats { grid-template-columns: repeat(3, 1fr); }
.study-stats .stat-dur-today .stat-num { color: var(--orange); }
.study-stats .stat-dur-total .stat-num { color: var(--accent); }
.study-stats .stat-test-total .stat-num { color: #1FB06D; }
.stat-card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
  transition: transform .2s ease;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-num {
  font-size: 34px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat-card.stat-faulty .stat-num { color: var(--red); }
.stat-card.stat-mastered .stat-num { color: #1FB06D; }
.stat-card.stat-today .stat-num { color: var(--orange); }
.stat-label { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.stat-label .streak-fire { font-weight: 700; color: var(--orange); }

/* ============================================================
   分区标题
   ============================================================ */
.section-title { display: flex; align-items: baseline; gap: 9px; margin-bottom: 15px; }
.title-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  align-self: center;
}
.section-title h2 { font-size: 18.5px; font-weight: 700; }

/* ============================================================
   单元网格
   ============================================================ */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}
.unit-card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 15px 15px 13px;
  display: flex; flex-direction: column; gap: 5px;
  text-align: left;
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease;
}
.unit-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0, 0, 0, .1); }
.unit-card:active { transform: scale(.97); }
.unit-card .u-name { font-size: 15.5px; font-weight: 700; }
.unit-card .u-count { font-size: 13px; color: var(--ink-3); }
.unit-card .u-flag {
  position: absolute; top: 11px; right: 13px;
  font-size: 12.5px; font-weight: 700; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.unit-card .u-bar {
  height: 4px; border-radius: 4px;
  background: rgba(0, 0, 0, .08);
  margin-top: 5px; overflow: hidden;
}
.unit-card .u-bar i {
  display: block; height: 100%;
  background: var(--accent); border-radius: 4px;
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}
.unit-card .u-bar-txt { font-size: 11.5px; color: var(--ink-3); }
.unit-card.is-empty { opacity: .5; }

/* ============================================================
   模式卡
   ============================================================ */
.mode-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}
.mode-card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 19px 21px;
  display: flex; align-items: center; gap: 16px;
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.mode-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0, 0, 0, .1); border-color: rgba(0, 122, 255, .4); }
.mode-card:active { transform: scale(.98); }
.mode-ico {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 13px;
  background: var(--accent-soft);
  display: grid; place-items: center;
  font-size: 22px;
}
.mode-card strong { font-size: 16px; font-weight: 700; display: block; }
.mode-card small { font-size: 13px; color: var(--ink-3); margin-top: 2px; display: block; }

/* ============================================================
   背单词:单元单词列表
   ============================================================ */
.wordlist { margin-top: 24px; }
.unit-wordlist { width: 100%; max-width: 780px; margin-top: 4px; }
.wordlist-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 13px;
  padding: 0 2px;
}
.wordlist-head h2 { font-size: 18px; font-weight: 800; }
.wordlist-head span { font-size: 12.5px; color: var(--ink-3); }
.wl-row {
  width: 100%;
  display: flex; align-items: center; gap: 16px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 13px 18px;
  margin-bottom: 9px;
  text-align: left;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.wl-row:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 122, 255, .4);
  background: rgba(0, 122, 255, .045);
}
.wl-row:active { transform: scale(.995); }
.wl-main { flex: 1; min-width: 0; }
.wl-word { font-size: 16.5px; font-weight: 800; color: var(--ink); }
.wl-pron {
  font-size: 12.5px; color: var(--ink-3);
  font-family: "SF Mono", Consolas, monospace;
  margin-left: 9px; font-weight: 500;
}
.wl-mean {
  font-size: 13.5px; color: var(--ink);
  margin-top: 4px; line-height: 1.55;
}
.wl-method {
  font-size: 12px; color: var(--ink-2); opacity: .85;
  margin-top: 4px; line-height: 1.7;
}
.wl-method:empty { display: none; }
.wl-speak {
  flex-shrink: 0;
  font-size: 17px;
  color: var(--accent);
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
  transition: transform .15s ease, background .15s ease;
}
.wl-row:hover .wl-speak { transform: scale(1.12); background: rgba(0, 122, 255, .16); }

@media (max-width: 768px) {
  .wl-row { flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
  .wl-main { flex: 1 1 100%; }
  .wl-speak { width: 42px; height: 42px; font-size: 19px; }
}

/* ============================================================
   生词本(内容区内)
   ============================================================ */
.book-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.book-tabs {
  display: flex; gap: 2px;
  background: rgba(0, 0, 0, .06);
  border-radius: 9px;
  padding: 3px;
}
.book-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 14px; font-weight: 600;
  color: var(--ink-2);
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.book-tab .tab-num {
  font-size: 11.5px; font-weight: 700;
  background: rgba(0, 0, 0, .08);
  padding: 1px 8px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.book-tab.active {
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.book-tab.active .tab-num { background: var(--accent); color: #fff; }

.book-search {
  flex: 1; min-width: 200px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, .05);
  border: .5px solid transparent;
  border-radius: 9px;
  padding: 8px 13px;
  transition: border-color .18s ease, background .18s ease;
}
.book-search:focus-within { background: var(--glass-strong); border-color: rgba(0, 122, 255, .5); box-shadow: 0 0 0 3px rgba(0, 122, 255, .14); }
.bs-ico { font-size: 15px; color: var(--ink-3); }
.book-search input { flex: 1; border: none; outline: none; background: transparent; font-size: 14.5px; color: var(--ink); }
.book-search input::placeholder { color: var(--ink-3); }
.bs-clear { font-size: 13px; color: var(--ink-3); padding: 2px 6px; border-radius: 50%; }
.bs-clear:hover { color: var(--ink); background: rgba(0, 0, 0, .08); }

.book-list { display: flex; flex-direction: column; gap: 10px; }
.book-item {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex; align-items: flex-start; gap: 15px;
  transition: transform .18s ease;
}
.book-item:hover { transform: translateY(-1px); }
.book-item .bi-word { font-size: 17px; font-weight: 700; }
.bi-state { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 4px; vertical-align: 2px; background: rgba(0,0,0,.06); }
.bi-state.st-f { color: var(--red); background: rgba(255, 95, 87, .1); }
.bi-state.st-m { color: #1FB06D; background: rgba(40, 200, 64, .12); }
.bi-state.st-n { color: var(--ink-3); }
.book-item .bi-pron { font-size: 13px; color: var(--ink-3); margin-top: 2px; font-family: "SF Mono", Consolas, monospace; }
.book-item .bi-body { flex: 1; min-width: 0; }
.book-item .bi-mean { font-size: 14px; color: var(--ink); margin-top: 6px; line-height: 1.55; }
.book-item .bi-method { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; margin-top: 5px; opacity: .85; }
.book-item .bi-method:empty { display: none; }
.book-item .bi-speak { color: var(--accent); font-size: 16px; flex-shrink: 0; padding: 5px; }
.book-item .bi-toggle {
  font-size: 12.5px; font-weight: 600;
  padding: 6px 13px; border-radius: 7px;
  color: var(--ink-2);
  background: rgba(0, 0, 0, .05);
  transition: background .15s ease;
}
.book-item .bi-toggle:hover { background: rgba(0, 0, 0, .1); }
.book-item.toggle-to-mastered .bi-toggle { color: #1FB06D; }
.book-item.toggle-to-mastered .bi-toggle:hover { background: rgba(40, 200, 64, .12); }
.book-item.toggle-to-faulty .bi-toggle { color: var(--red); }
.book-item.toggle-to-faulty .bi-toggle:hover { background: rgba(255, 95, 87, .1); }
.book-item .bi-remove { color: var(--ink-3); font-size: 15px; flex-shrink: 0; padding: 5px 7px; border-radius: 50%; }
.book-item .bi-remove:hover { color: var(--red); background: rgba(255, 95, 87, .1); }

.book-empty {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 56px 30px;
  text-align: center;
}
.book-empty .be-emoji { font-size: 50px; }
.book-empty p { font-size: 16px; font-weight: 700; margin-top: 12px; }
.book-empty small { display: block; font-size: 13.5px; color: var(--ink-3); margin-top: 5px; }

/* ============================================================
   macOS 窗口(测试 / 完成)
   ============================================================ */
.window {
  position: fixed; inset: 0;
  z-index: 60;
  display: flex; flex-direction: column;
  background: var(--bg);
  animation: win-in .3s cubic-bezier(.32, 1.2, .5, 1);
}
@keyframes win-in {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: scale(1); }
}

.win-bar {
  height: 50px; flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: rgba(255, 255, 255, .7);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: .5px solid var(--border);
}
.traffic { display: flex; gap: 8px; }
.win-back {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .15s ease, color .15s ease, background .15s ease;
  flex-shrink: 0;
}
.win-back:hover { color: var(--accent); background: var(--accent-soft); transform: scale(1.06); }
.win-back:active { transform: scale(.93); }
.tl {
  width: 12.5px; height: 12.5px;
  border-radius: 50%;
  position: relative;
  display: block;
  transition: transform .12s ease;
}
.tl-red { background: var(--red); cursor: pointer; }
.tl-red:hover { transform: scale(1.15); }
.tl-red::after {
  content: '✕'; position: absolute; inset: 0;
  font-size: 7px; font-weight: 700; color: #8f2626;
  display: grid; place-items: center;
  opacity: 0; transition: opacity .12s ease;
}
.tl-red:hover::after { opacity: 1; }
.tl-yellow { background: var(--amber); }
.tl-green { background: var(--green); }
.win-title {
  flex: 1; text-align: center;
  font-size: 14.5px; font-weight: 600; color: var(--ink-2);
  user-select: none;
}
.win-right { min-width: 70px; display: flex; justify-content: flex-end; }
.win-chip {
  font-size: 12.5px; font-weight: 700; color: var(--red);
  background: rgba(255, 95, 87, .1);
  padding: 4px 12px; border-radius: 999px;
}

.win-body {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
  align-items: center;
  padding: 30px 20px 48px;
  position: relative;
}

/* 测试窗口双层(题干区 / 底部操作条):桌面/平板默认不产生额外盒 → 视觉与旧版一致;
   仅窄屏移动端(见下方 ≤768)切成分层滚动布局 */
#view-test .test-stage,
#view-test .test-dock { display: contents; }

/* 进度条 */
.win-top { width: 100%; max-width: 620px; margin-bottom: 6px; }
.progress-wrap { display: flex; align-items: center; gap: 14px; }
.progress-bar {
  flex: 1; height: 6px;
  background: rgba(0, 0, 0, .08);
  border-radius: 6px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0;
  background: var(--accent);
  border-radius: 6px;
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
}
.progress-num {
  font-size: 13.5px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 左右箭头 */
.nav-arrow {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .1);
  font-size: 28px; font-weight: 300; line-height: 1;
  color: var(--ink-2);
  display: grid; place-items: center;
  z-index: 40;
  transition: transform .16s ease, color .16s ease, opacity .16s ease;
  user-select: none;
}
.nav-prev { left: 20px; }
.nav-next { right: 20px; }
.nav-arrow:hover { color: var(--accent); transform: translateY(-50%) scale(1.06); }
.nav-arrow:active { transform: translateY(-50%) scale(.94); }
.nav-arrow:disabled { opacity: 0; pointer-events: none; }

/* 单词区 */
.word-area { text-align: center; margin-top: 18px; }
.word-badge {
  display: inline-block;
  font-size: 12px; font-weight: 700;
  color: var(--ink-2);
  background: rgba(0, 0, 0, .05);
  border-radius: 999px;
  padding: 5px 16px;
  letter-spacing: 1.2px;
}
.word-big {
  font-size: clamp(52px, 10vw, 76px);
  font-weight: 800;
  letter-spacing: 1.5px;
  margin-top: 18px;
  line-height: 1.15;
  color: var(--ink);
  word-break: break-word;
}
.word-pron {
  font-size: 18px; color: var(--ink-2);
  margin-top: 10px;
  letter-spacing: .5px;
  font-family: "SF Mono", "Segoe UI", Consolas, monospace;
}
.speak-btn {
  margin-top: 22px;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 28px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--accent);
  font-size: 15px; font-weight: 600;
  transition: transform .16s ease, box-shadow .16s ease;
}
.speak-btn:hover { transform: scale(1.04); box-shadow: 0 10px 26px rgba(0, 122, 255, .18); }
.speak-btn:active { transform: scale(.95); }
.speak-btn.speaking {
  background: var(--accent); color: #fff; border-color: transparent;
  animation: pulse-ring 1.2s ease infinite;
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(0, 122, 255, .35); }
  70%  { box-shadow: 0 0 0 15px rgba(0, 122, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 122, 255, 0); }
}

/* 刮刮乐 */
.scratch-zone { margin-top: 30px; display: flex; justify-content: center; width: 100%; }
.scratch-card {
  position: relative;
  width: 100%; max-width: 600px;
  height: 236px;
  border-radius: var(--radius);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
#scratch-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: var(--radius);
  cursor: grab;
  touch-action: none;
  z-index: 2;
}
#scratch-canvas.scratching { cursor: grabbing; }
.scratch-card.revealed #scratch-canvas { opacity: 0; pointer-events: none; transition: opacity .5s ease; }

.scratch-answer {
  position: absolute; inset: 0;
  padding: 26px 32px;
  display: flex; flex-direction: column; justify-content: center;
  gap: 13px;
  text-align: left;
  /* 始终可见 —— 涂层(canvas)刮到哪里,答案就在哪里露出(真·刮奖) */
  opacity: 1;
}
.scratch-card.revealed .scratch-answer { opacity: 1; }
/* 学习模式:无涂层直接摊开(浏览阶段不盖 canvas) */
.scratch-card.learn-open #scratch-canvas { display: none; }

/* 学习模式阶段横幅 */
.learn-stage {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(0, 122, 255, .12), rgba(88, 86, 214, .10));
  border: .5px solid rgba(0, 122, 255, .28);
  color: var(--ink-2);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  max-width: 600px;
  backdrop-filter: var(--glass-blur);
}
.learn-stage .ls-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
  animation: pulse-ring 1.6s infinite;
}
.learn-stage.is-review {
  background: linear-gradient(135deg, rgba(255, 159, 10, .14), rgba(255, 69, 58, .08));
  border-color: rgba(255, 159, 10, .35);
}
.learn-stage.is-review .ls-dot { background: #ff9f0a; }
.answer-mean {
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 800;
  line-height: 1.45;
  color: var(--ink);
}
.answer-method {
  font-size: 15px; line-height: 1.8;
  color: var(--ink-2);
  background: rgba(0, 122, 255, .06);
  border-left: 3px solid var(--accent);
  padding: 12px 17px;
  border-radius: 0 10px 10px 0;
  max-height: 92px; overflow-y: auto;
}
.method-tag {
  display: inline-block;
  font-size: 12px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px; border-radius: 999px;
  margin-right: 8px;
  vertical-align: 2px;
}

/* ============================================================
   AI 答案检测
   ============================================================ */
.answer-check {
  width: 100%; max-width: 600px;
  margin-top: 20px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.ac-row { display: flex; gap: 10px; }
.ac-row input {
  flex: 1; min-width: 0;
  border: .5px solid var(--border);
  border-radius: 9px;
  padding: 12px 16px;
  font-size: 15.5px; color: var(--ink);
  background: rgba(255, 255, 255, .65);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.ac-row input::placeholder { color: var(--ink-3); }
.ac-row input:focus {
  border-color: rgba(0, 122, 255, .55);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .15);
  background: #fff;
}
.ac-btn {
  flex-shrink: 0;
  padding: 12px 26px;
  border-radius: 9px;
  font-size: 15.5px; font-weight: 700;
  background: var(--accent); color: #fff;
  box-shadow: 0 6px 18px rgba(0, 122, 255, .28);
  transition: transform .16s ease, opacity .2s ease;
}
.ac-btn:hover { transform: translateY(-1px); }
.ac-btn:active { transform: scale(.96); }
.ac-btn:disabled { opacity: .6; transform: none; cursor: default; }

.ac-mic {
  position: relative;   /* 供转圈定位 */
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .15s ease, color .15s ease, background .15s ease;
  touch-action: none;
}
.ac-mic:hover { color: var(--accent); background: var(--accent-soft); transform: scale(1.06); }
.ac-mic:active { transform: scale(.94); }
.ac-mic.recording {
  color: #fff;
  background: var(--red);
  border-color: transparent;
  animation: mic-pulse 1.1s ease infinite;
}
@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 95, 87, .45); }
  70%  { box-shadow: 0 0 0 14px rgba(255, 95, 87, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 95, 87, 0); }
}

/* 识别中(非录音态,收尾窗口):麦克风周围转圈 */
.ac-mic.mic-waiting::after {
  content: '';
  position: absolute; inset: -5px;
  border-radius: 50%;
  border: 2.5px solid rgba(0, 122, 255, .2);
  border-top-color: var(--accent);
  animation: mic-spin .75s linear infinite;
}
@keyframes mic-spin { to { transform: rotate(360deg); } }

.ac-feedback {
  margin-top: 10px;
  font-size: 14px; font-weight: 700;
  display: none;
  align-items: center; gap: 8px;
  animation: feedback-in .3s cubic-bezier(.34, 1.56, .64, 1);
}
.ac-feedback.show { display: flex; }
@keyframes feedback-in {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ac-feedback.ok { color: #1FB06D; }
.ac-feedback.bad { color: var(--red); }
.ac-feedback.err { color: var(--amber); }
.ac-feedback .ai-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(0, 122, 255, .25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ai-spin .7s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ac-hint {
  margin-top: 10px;
  font-size: 12px; color: var(--ink-3);
  line-height: 1.6;
}

/* 麦克风电平检测条 */
.mic-level {
  margin-top: 10px;
  display: none;
  align-items: center; gap: 10px;
  font-size: 12px; color: var(--ink-2);
}
.mic-level.mic-on { display: flex; }
.ml-label { font-weight: 700; flex-shrink: 0; }
.ml-track {
  flex: 1; height: 8px;
  background: rgba(0, 0, 0, .07);
  border-radius: 6px; overflow: hidden;
}
.ml-bar {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #28C840, #FEBC2E);
  border-radius: 6px;
  transition: width .08s linear;
}
.ml-text { flex-shrink: 0; font-weight: 600; }

/* 通过 / 未通过反馈动画 */
.answer-check.ai-pass {
  animation: ai-pass-pop .6s cubic-bezier(.34, 1.56, .64, 1);
  border-color: rgba(31, 176, 109, .5);
}
@keyframes ai-pass-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(31, 176, 109, .14); }
  100% { transform: scale(1); }
}
.answer-check.ai-fail { animation: ai-shake .45s ease; }
@keyframes ai-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* 通过后自动跳转前的"通过"印章 */
.answer-check .ai-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 800;
  color: #fff;
  background: #1FB06D;
  padding: 5px 14px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(31, 176, 109, .35);
  animation: pop-in .4s cubic-bezier(.34, 1.56, .64, 1);
}

/* 操作区 */
.test-actions {
  margin-top: 28px;
  display: flex; gap: 12px; justify-content: center;
  flex-wrap: wrap;
}.act-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 15px 30px;
  border-radius: 999px;
  font-size: 15.5px; font-weight: 600;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .16s ease, background .2s ease, color .2s ease;
}
.act-btn:active { transform: scale(.96); }
.act-mastered { color: #1FB06D; }
.act-mastered:hover { box-shadow: 0 8px 22px rgba(40, 200, 64, .2); }
.act-mastered.is-mastered { background: #1FB06D; color: #fff; border-color: transparent; }
.act-faulty { color: var(--red); }
.act-faulty:hover { box-shadow: 0 8px 22px rgba(255, 95, 87, .2); }
.act-faulty.is-faulty { background: var(--red); color: #fff; border-color: transparent; }
.act-next {
  background: var(--accent); color: #fff; border-color: transparent;
  box-shadow: 0 8px 22px rgba(0, 122, 255, .3);
}
.act-next:hover { transform: translateY(-1px) scale(1.02); box-shadow: 0 12px 28px rgba(0, 122, 255, .38); }
.next-arrow { font-size: 17px; line-height: 1; }
.act-next.hidden-btn { opacity: 0; pointer-events: none; }

/* ============================================================
   完成窗口内容
   ============================================================ */
.done-body { justify-content: center; }
.done-card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: 24px;
  padding: 50px 46px;
  max-width: 480px; width: 100%;
  text-align: center;
  position: relative; overflow: hidden;
  animation: pop-in .5s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.88) translateY(18px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.done-emoji { font-size: 62px; line-height: 1; }
.done-card h2 { font-size: 27px; font-weight: 800; margin-top: 13px; }
.done-sub { font-size: 14.5px; color: var(--ink-2); margin-top: 7px; line-height: 1.7; }
.done-streak {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 13px;
  font-size: 14px; font-weight: 700; color: var(--orange);
  background: rgba(245, 166, 35, .12);
  border: .5px solid rgba(245, 166, 35, .3);
  padding: 7px 16px; border-radius: 999px;
}
.done-streak b { font-size: 15px; }
.done-stats { display: flex; justify-content: center; gap: 12px; margin: 24px 0 8px; }
.done-stat {
  flex: 1; max-width: 110px;
  background: rgba(0, 0, 0, .04);
  border-radius: 12px;
  padding: 14px 10px;
}
.done-stat b { font-size: 23px; font-weight: 800; display: block; font-variant-numeric: tabular-nums; }
.done-stat span { font-size: 12.5px; color: var(--ink-2); }
.done-stat.faulty-stat b { color: var(--red); }
.done-stat.pass-stat b { color: #1FB06D; }
.done-actions { margin-top: 24px; display: flex; gap: 11px; justify-content: center; flex-wrap: wrap; }
.btn-primary {
  background: var(--accent); color: #fff;
  padding: 13px 30px; border-radius: 999px;
  font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 122, 255, .3);
  transition: transform .16s ease;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-faulty-quick {
  background: var(--red); color: #fff;
  padding: 13px 30px; border-radius: 999px;
  font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 20px rgba(255, 95, 87, .3);
  transition: transform .16s ease;
}
.btn-faulty-quick:hover { transform: translateY(-1px); }
.btn-ghost {
  padding: 13px 30px; border-radius: 999px;
  font-size: 15px; font-weight: 600;
  color: var(--ink-2);
  background: rgba(0, 0, 0, .05);
  transition: transform .16s ease, color .16s ease;
}
.btn-ghost:hover { transform: translateY(-1px); color: var(--accent); }

/* confetti */
.confetti-piece {
  position: absolute; top: -12px;
  width: 9px; height: 9px;
  border-radius: 2px;
  pointer-events: none;
  animation: confetti-fall var(--dur, 2.2s) cubic-bezier(.2, .6, .4, 1) forwards;
  z-index: 5;
}
@keyframes confetti-fall {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx, 40px), 520px) rotate(var(--rot, 540deg)) scale(.7); opacity: 0; }
}

/* ============================================================
   判定反馈特效(绿勾/红叉 + 粒子)
   ============================================================ */
.fx-overlay {
  position: absolute; inset: 0;
  z-index: 28;
  pointer-events: none;
  display: none;
  align-items: center; justify-content: center;
  overflow: hidden;
}
.fx-overlay.fx-show { display: flex; }
.fx-overlay canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.fx-mark { position: absolute; width: 116px; height: 116px; }
.fx-mark .fx-badge {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: center;
}
.fx-mark .fx-stroke {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60 60;
  stroke-dashoffset: 60;
}
.fx-mark.fx-on .fx-badge { animation: fx-badge-in .38s cubic-bezier(.34, 1.56, .64, 1) forwards; }
.fx-mark.fx-on .fx-stroke { animation: fx-draw .32s ease .12s forwards; }
@keyframes fx-badge-in {
  0%   { transform: scale(.3); opacity: 0; }
  70%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes fx-draw { to { stroke-dashoffset: 0; } }

/* ============================================================
   管理员统计窗口
   ============================================================ */
.admin-note {
  font-size: 12.5px; color: var(--ink-3);
  margin-bottom: 14px;
}
.admin-table {
  width: 100%;
  max-width: 760px;
  background: var(--card, #fff);
  border: .5px solid var(--border, rgba(0,0,0,.08));
  border-radius: 14px;
  overflow: hidden;
}
.admin-row {
  display: grid;
  grid-template-columns: 1.2fr 1.1fr 1fr 1fr 1.1fr;
  align-items: center;
  padding: 13px 16px;
  font-size: 13.5px;
}
.admin-row.head {
  font-size: 12px; font-weight: 700; color: var(--ink-3);
  background: rgba(0, 0, 0, .03);
  border-bottom: .5px solid var(--border, rgba(0,0,0,.08));
}
.admin-row:not(.head) { border-bottom: .5px solid rgba(0, 0, 0, .04); }
.admin-row:last-child { border-bottom: none; }
.admin-row .u { font-weight: 700; color: var(--ink); }
.admin-row .v { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.admin-row .v.hot { color: #d97706; font-weight: 700; }
.admin-empty {
  padding: 26px; text-align: center;
  font-size: 13px; color: var(--ink-3);
}
.admin-refresh {
  border: none; cursor: pointer;
  font-size: 12.5px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 14px; border-radius: 999px;
  transition: transform .12s ease;
}
.admin-refresh:active { transform: scale(.94); }

/* ============================================================
   macOS 对话框
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .22);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: fade-in .2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  backdrop-filter: var(--glass-blur-lg);
  border: .5px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  border-radius: 18px;
  padding: 26px 26px 18px;
  width: 100%; max-width: 380px;
  text-align: center;
  animation: pop-in .3s cubic-bezier(.34, 1.56, .64, 1);
}
.modal-card h3 { font-size: 20px; font-weight: 700; }
.modal-sub { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.modal-btn {
  display: flex; align-items: center; gap: 13px;
  background: rgba(0, 0, 0, .04);
  border-radius: 12px;
  padding: 13px 16px;
  text-align: left;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.modal-btn:hover { transform: translateY(-1px); background: rgba(0, 0, 0, .07); box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }
.modal-btn:active { transform: scale(.97); }
.modal-btn .mb-ico {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px;
  background: var(--accent-soft);
  display: grid; place-items: center; font-size: 19px;
}
.modal-btn strong { font-size: 15px; font-weight: 700; display: block; }
.modal-btn small { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; display: block; }
.modal-close {
  margin-top: 14px;
  font-size: 14px; font-weight: 600; color: var(--ink-3);
  padding: 8px 22px; border-radius: 8px;
}
.modal-close:hover { color: var(--ink); background: rgba(0, 0, 0, .06); }

/* ============================================================
   入场动画 / Toast
   ============================================================ */
.word-area.enter { animation: word-in .5s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes word-in {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.toast {
  position: fixed;
  top: calc(var(--menu-h) + 16px); left: 50%;
  transform: translate(-50%, -10px);
  background: rgba(40, 42, 48, .92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 11px 24px;
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .24);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease, transform .28s cubic-bezier(.34, 1.56, .64, 1);
  z-index: 200;
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   响应式
   ============================================================ */
/* 平板(≤900px) */
@media (max-width: 900px) {
  .nav-arrow { width: 44px; height: 44px; font-size: 24px; }
  .nav-prev { left: 10px; }
  .nav-next { right: 10px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .study-stats { grid-template-columns: repeat(3, 1fr); }   /* 学习统计保持 3 列紧凑 */
}

/* ============================================================
   手机(≤768px):底部导航替代侧边栏 + 紧凑布局
   ============================================================ */
@media (max-width: 768px) {
  /* ---------- 底部导航 ---------- */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto;
    flex-direction: row; gap: 0;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    border-right: none;
    border-top: .5px solid var(--border);
    background: rgba(248, 249, 252, .92);
    z-index: 50;
    overflow: visible;
  }
  .sidebar.collapsed { width: 100%; padding: 5px 6px calc(5px + env(safe-area-inset-bottom)); }
  .sb-toggle { display: none; }
  .sb-group { flex-direction: row; gap: 0; }
  .sb-group:first-of-type { flex: 3; }      /* 概览/单元/整书 */
  .sb-group:nth-of-type(2) { flex: 1; }     /* 生词本 */
  .sb-group:nth-of-type(3), .sb-title, .sb-item.static { display: none; }
  .sb-item[data-book-tab="mastered"] { display: none; }   /* 已掌握并入生词本页内切换 */
  .sb-group-rank { display: none; }   /* 手机底栏:今日榜单并入「好友」页,点好友进页内查看 */
  .sb-group-social { flex: 1; }       /* 好友底栏项与生词本同宽,布局均衡 */
  .sb-item {
    flex: 1;
    flex-direction: column; gap: 2px;
    padding: 5px 2px;
    font-size: 10px; font-weight: 600;
    border-radius: 10px;
    justify-content: center;
  }
  .sb-item svg { width: 20px; height: 20px; }
  .sb-item .sb-label { flex: none; overflow: visible; }
  .sb-item.active { background: var(--accent-soft); }
  .sb-dot { top: 0; right: 16px; min-width: 13px; height: 13px; font-size: 8px; padding: 0 3px; }

  /* ---------- 菜单栏 ---------- */
  .menu-bar { padding: 0 10px; }
  .menu-left { gap: 10px; }
  .menu-items { display: none; }
  .menu-right { gap: 8px; }
  .menu-chip { font-size: 11.5px; padding: 3px 8px; }
  .menu-clock { font-size: 13px; min-width: 44px; }
  .menu-user { font-size: 12px; padding: 3px 10px; }

  /* ---------- 内容区 ---------- */
  .content { padding: 16px 14px 96px; }
  .content-head { margin-bottom: 16px; }
  .content-head h1 { font-size: 23px; }
  .content-head p { font-size: 13px; }

  /* 统计卡 */
  .stats { gap: 9px; margin-bottom: 20px; }
  .stat-card { padding: 14px 8px; }
  .stat-num { font-size: 26px; }
  .stat-label { font-size: 11.5px; }

  /* 单元网格 2 列 */
  .unit-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .unit-card { padding: 13px 12px; }

  /* 模式卡 */
  .mode-row { grid-template-columns: 1fr; }
  .mode-card { padding: 15px 16px; gap: 13px; }
  .mode-ico { width: 42px; height: 42px; font-size: 19px; }

  /* 生词本 */
  .book-toolbar { gap: 9px; }
  .book-search { flex: 1 1 100%; min-width: 0; }
  .book-item { flex-wrap: wrap; padding: 14px 16px; gap: 10px; }
  .book-item .bi-body { flex: 1 1 100%; }
  .book-item .bi-toggle { order: 2; }
  .book-item .bi-remove { order: 3; }

  /* 继续上次 */
  .continue-bar { padding: 12px 14px; }

  /* ---------- 测试窗口(移动版):题干滚动区 + 底部悬浮操作条 ----------
     布局在键盘态/普通态完全一致(窗口不缩、词卡不重排不缩放):
     - 题干区(进度/单词/刮卡):锚定原位,超高时内部可滚动;
     - 操作条(按钮+输入框):position:fixed 悬浮,普通态贴安全区底部,
       键盘弹出时 bottom=--ew-kb(键盘高)→ 只它上移盖住题干下缘,其余不动。 */
  /* 其它窗口(PK/自定义)移动端内边距兜底,保持旧观感 */
  .win-body { padding: 18px 12px 32px; }
  #view-test .win-body { padding: 0; overflow: hidden; align-items: stretch; }
  #view-test .test-stage {
    flex: 1 1 auto; min-height: 0;
    display: flex; flex-direction: column; align-items: center;
    width: 100%;
    padding: 8px 12px 10px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  /* 操作条:fixed 悬浮,普通态 bottom 安全区;键盘态 bottom=--ew-kb(键盘高) → 贴键盘上沿 */
  #view-test .test-dock {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(var(--ew-kb, 0px) + env(safe-area-inset-bottom, 0px));
    width: 100%;
    display: flex; flex-direction: column; align-items: center;
    padding: 6px 12px 8px;
    background: var(--bg);
    border-top: .5px solid var(--border);
    box-shadow: 0 -8px 22px rgba(0, 0, 0, .05);
    z-index: 20;
  }
  .win-top { padding: 0 4px; margin-bottom: 0; width: 100%; max-width: 600px; flex: 0 0 auto; }
  #view-test .word-area { margin-top: 24px; flex: 0 0 auto; }
  .word-badge { font-size: 10.5px; padding: 3px 12px; }
  #view-test .word-big { font-size: clamp(50px, 13.5vw, 74px); margin-top: 12px; line-height: 1.08; }
  .word-pron { font-size: 16px; margin-top: 6px; }
  .speak-btn { margin-top: 12px; padding: 8px 20px; font-size: 13px; }
  /* 刮刮乐:固定像素高度(随屏宽微调,不随窗口/键盘/剩余空间变化) → 涂层永不跑位 */
  #view-test .scratch-zone {
    margin-top: 22px;
    width: 100%; max-width: 600px;
    flex: 0 0 auto;
    display: flex; justify-content: center;
  }
  #view-test .scratch-card {
    width: 100%; max-width: 600px;
    height: clamp(180px, 55.5vw, 248px);
  }
  #view-test .scratch-answer { padding: 12px 20px; gap: 8px; }
  .answer-mean { font-size: 20px; }
  .answer-method { font-size: 13px; line-height: 1.65; max-height: 100px; padding: 10px 14px; }
  .nav-arrow { width: 38px; height: 38px; font-size: 22px; opacity: .85; }
  .nav-prev { left: 6px; }
  .nav-next { right: 6px; }
  /* 操作三按钮:整行等宽、字号随屏收缩(杜绝溢出),位于输入框正上方 */
  #view-test .test-actions {
    width: 100%; max-width: 600px;
    flex-direction: row; flex-wrap: nowrap;
    justify-content: center; align-items: stretch;
    gap: 7px; margin: 8px auto 0; padding-top: 0;
    flex: 0 0 auto;
  }
  #view-test .act-btn {
    width: auto; flex: 1 1 0; min-width: 0;
    padding: 12px 4px;
    font-size: clamp(13px, 3.6vw, 15px);
    gap: 4px; white-space: nowrap; overflow: hidden;
  }
  #view-test .act-btn span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  #view-test .act-btn .mastered-ico, #view-test .act-btn .faulty-ico,
  #view-test .act-btn .next-arrow { font-size: 14px; line-height: 1; flex: none; }
  #view-test .answer-check { margin-top: 10px; padding: 10px 12px; flex: 0 0 auto; }
  /* 题干区底部预留操作条高度,滚到底内容不被遮挡 */
  #view-test .test-stage { padding-bottom: calc(10px + 180px); }

  /* ---------- 登录页 ---------- */
  .login-card { padding: 36px 24px 26px; }
  .login-card input { font-size: 17px; }

  /* ---------- 完成页 ---------- */
  .done-card { padding: 32px 18px; }
  .done-stats { gap: 8px; }
  .done-stat { padding: 12px 6px; }
  .done-stat b { font-size: 20px; }
  .done-actions { flex-direction: column; align-items: stretch; }
  .done-actions .btn-primary, .done-actions .btn-faulty-quick, .done-actions .btn-ghost { width: 100%; }
}

/* 小屏手机(≤480px) */
@media (max-width: 480px) {
  .stat-num { font-size: 23px; }
  .unit-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mode-ico { width: 38px; height: 38px; }
  .scratch-card { height: 230px; }
  .word-big { font-size: clamp(36px, 11vw, 50px); }
  .menu-chip b { display: inline; }
  .test-actions { gap: 5px; margin-top: 14px; }
  .act-btn { padding: 12px 3px; font-size: clamp(11.5px, 3.4vw, 13px); gap: 2px; }
  .act-btn .mastered-ico, .act-btn .faulty-ico, .act-btn .next-arrow { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   自定义单词本(📓)
   ============================================================ */
.custom-card {
  background: linear-gradient(135deg, #007AFF, #5856D6);
  border: none;
  box-shadow: 0 10px 26px rgba(0, 90, 200, .28);
  color: #fff;
}
.custom-card:hover { box-shadow: 0 16px 36px rgba(0, 90, 200, .36); }
.custom-card .u-name { color: #fff; }
.custom-card .u-count { color: rgba(255, 255, 255, .82); }
.custom-card .u-flag { color: rgba(255, 255, 255, .95); }
.custom-card .u-bar { background: rgba(255, 255, 255, .3); }
.custom-card .u-bar i { background: #fff; }
.custom-card .u-bar-txt { color: rgba(255, 255, 255, .85); }

/* 浏览窗口:右上角添加按钮 */
.custom-add {
  color: #fff;
  background: linear-gradient(135deg, #007AFF, #5856D6);
  padding: 6px 16px;
  box-shadow: 0 4px 12px rgba(0, 122, 255, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.custom-add:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 122, 255, .45); }
.custom-add:active { transform: scale(.96); }

/* 浏览列表:状态徽章 + 删除按钮 */
.wl-state {
  flex-shrink: 0;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.wl-state.st-f { color: #C0362C; background: rgba(255, 95, 87, .12); }
.wl-state.st-m { color: #1FB06D; background: rgba(40, 200, 64, .12); }
.wl-del {
  flex-shrink: 0;
  font-size: 13px; color: var(--ink-3);
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  transition: color .15s ease, background .15s ease;
}
.wl-del:hover { color: var(--red); background: rgba(255, 95, 87, .1); }

/* 添加单词表单 */
.custom-add-card { width: 430px; max-width: 92vw; }
.caf-field { margin-top: 14px; text-align: left; }
.caf-field label {
  display: block;
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  margin-bottom: 6px;
}
.caf-ai {
  font-size: 11.5px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px; border-radius: 999px;
  margin-left: 4px;
}
.caf-field input, .caf-field textarea {
  width: 100%;
  font-size: 14.5px; color: var(--ink);
  background: rgba(0, 0, 0, .045);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 10px;
  padding: 10px 13px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.caf-field input:focus, .caf-field textarea:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .14);
}
.caf-field textarea { resize: vertical; min-height: 52px; line-height: 1.6; }
.caf-pron-row, .caf-ai-row { display: flex; gap: 8px; }
.caf-pron-row input { flex: 1; font-family: "SF Mono", Consolas, monospace; }
.caf-ai-row input { flex: 1; }
.caf-pron-btn, .caf-ai-btn {
  flex-shrink: 0; width: 42px;
  border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 16px;
  transition: transform .15s ease, background .15s ease;
}
.caf-pron-btn:hover, .caf-ai-btn:hover { background: rgba(0, 122, 255, .18); }
.caf-pron-btn:active, .caf-ai-btn:active { transform: scale(.94); }
.caf-pron-btn:disabled, .caf-ai-btn:disabled { opacity: .5; pointer-events: none; }
.caf-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin-top: 22px;
}
.caf-cancel { margin-top: 0; }
@media (max-width: 480px) {
  .custom-add-card { padding: 22px 18px !important; }
}

/* ============================================================
 * 2026-09-07 账号体系 + 多本词书 + 今日榜单 样式
 * ============================================================ */
/* ---- 登录卡片(邮箱登录 / 注册 / 找回 / 老账号直登) ---- */
.auth-card { padding: 34px 32px 26px; max-height: 92vh; overflow-y: auto; }
.auth-tabs {
  display: flex; margin-top: 24px; padding: 3px;
  background: rgba(0, 0, 0, .05); border-radius: 10px; gap: 2px;
}
.auth-tab {
  flex: 1; padding: 8px 0; border-radius: 8px;
  font-size: 13.5px; font-weight: 700; color: var(--ink-2);
  background: transparent; transition: all .18s ease;
}
.auth-tab.active { background: #fff; color: var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.auth-panel { margin-top: 4px; }
.auth-panel input {
  width: 100%; margin-top: 14px;
  border: .5px solid var(--border); border-radius: 11px;
  padding: 12px 15px; font-size: 15px; color: var(--ink);
  background: rgba(255, 255, 255, .75); outline: none; text-align: left;
  transition: border-color .18s ease, box-shadow .18s ease;
  box-sizing: border-box;
}
.auth-panel input:focus {
  border-color: rgba(0, 122, 255, .55);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .15);
}
.auth-panel .login-btn { margin-top: 20px; }
.cap-row, .code-row { display: flex; gap: 8px; align-items: center; }
.cap-row input, .code-row input { flex: 1; margin-top: 14px; }
.cap-img {
  margin-top: 14px; width: 118px; height: 44px; flex: none;
  border: .5px solid var(--border); border-radius: 10px; background: #fff;
  cursor: pointer; object-fit: cover;
}
.auth-send {
  margin-top: 14px; flex: none; width: 132px;
  padding: 12px 8px; border-radius: 10px; font-size: 13.5px; font-weight: 700;
  color: var(--accent); background: rgba(0, 122, 255, .1);
  transition: transform .16s ease, opacity .2s ease;
}
.auth-send:hover { transform: translateY(-1px); }
.auth-send:disabled { opacity: .5; cursor: default; transform: none; }
.auth-links { margin-top: 14px; text-align: right; }
.auth-link { font-size: 13px; color: var(--accent); font-weight: 600; padding: 4px; }
.auth-link:hover { text-decoration: underline; }
.auth-tip { margin-top: 12px; font-size: 12px; color: var(--ink-3); text-align: left; line-height: 1.6; }
.auth-err {
  margin-top: 14px; padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 95, 87, .12); color: #c0392b;
  font-size: 13px; text-align: left; line-height: 1.5;
}
.legacy-login { margin-top: 22px; padding-top: 18px; border-top: .5px solid rgba(0, 0, 0, .07); }
.legacy-title { font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: .4px; }
.legacy-btns { display: flex; gap: 8px; margin-top: 12px; justify-content: center; flex-wrap: wrap; }
.legacy-btn {
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, #34c759, #1fb06d);
  box-shadow: 0 6px 16px rgba(52, 199, 89, .25);
  transition: transform .16s ease;
}
.legacy-btn:hover { transform: translateY(-1px); }
.legacy-btn:active { transform: scale(.97); }
@media (max-width: 480px) {
  .auth-card { padding: 26px 18px 20px; }
  .cap-img { width: 96px; }
  .auth-send { width: 118px; }
}

/* ---- 今日榜单 ---- */
.board-sort { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
#board-tabs { display: inline-flex; }
.board-table { margin-top: 2px; }
.admin-row .rank { width: 44px; text-align: center; font-size: 14px; flex: none; }
.admin-row .rank-num { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); }
.board-row.me {
  background: rgba(0, 122, 255, .07);
  box-shadow: inset 3px 0 0 var(--accent);
}
.board-row.me .u { color: var(--accent); }
.board-row .u em { font-style: normal; font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: var(--accent); color: #fff; margin-left: 4px; font-weight: 700; }
.board-head .rank, .board-head .u, .board-head .v { font-weight: 800 !important; }
/* 榜单 6 列(名次/用户/今日时长/今日单词/累计时长/累计单词),覆盖管理员 5 列模板 */
#board-table .admin-row {
  grid-template-columns: 46px 1.8fr 1fr 1fr 1fr 1fr;
}
@media (max-width: 700px) {
  #board-table .admin-row {
    grid-template-columns: 34px 1.5fr 1fr 1fr;
  }
  #board-table .admin-row .rank { grid-row: span 1; }
  #board-table .admin-row .v:nth-of-type(4),
  #board-table .admin-row .v:nth-of-type(5) { display: none; }
  #board-table .admin-row.head .v:nth-of-type(4),
  #board-table .admin-row.head .v:nth-of-type(5) { display: none; }
}

/* ---- 自定义词书(多本)窗口 ---- */
.books-list { display: flex; flex-direction: column; gap: 10px; }
.book-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(255, 255, 255, .72); border: .5px solid var(--border);
  border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .04);
}
.book-row .br-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.book-row .br-name { font-size: 15.5px; font-weight: 700; color: var(--ink); }
.book-row .br-count { font-size: 12.5px; color: var(--ink-3); }
.book-row .br-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.wl-chip {
  padding: 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 700;
  color: var(--accent); background: rgba(0, 122, 255, .1);
  transition: transform .14s ease;
}
.wl-chip:hover { transform: translateY(-1px); }
.wl-chip:active { transform: scale(.97); }
.wl-chip.danger { color: #ff5f57; background: rgba(255, 95, 87, .1); }
@media (max-width: 640px) {
  .book-row { flex-direction: column; align-items: stretch; }
  .book-row .br-actions { justify-content: flex-start; }
}
.win-chip { cursor: pointer; }
.win-chip:disabled { opacity: .5; cursor: default; }

/* ---- 安全验证弹窗 ---- */
.cap-modal-card {
  width: 344px; max-width: calc(100vw - 36px);
  text-align: center; padding: 26px 24px 20px;
}
.cap-head { display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 8px; }
.cap-head h3 { margin: 0; font-size: 19px; font-weight: 800; }
.cap-shield {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #007AFF, #30c9a8);
  box-shadow: 0 8px 18px rgba(0, 122, 255, .28);
}
.cap-modal-card .modal-sub { margin: 0 auto 14px; max-width: 260px; line-height: 1.6; font-size: 12.5px; }
.cap-box {
  background: #F5F5F7; border: .5px solid rgba(0, 0, 0, .06);
  border-radius: 14px; padding: 12px;
}
.cap-box-top { display: flex; align-items: center; justify-content: center; gap: 8px; }
.cap-box .cap-img {
  width: 176px; height: 54px; border-radius: 9px;
  border: .5px solid var(--border); background: #fff;
  cursor: pointer; object-fit: cover; user-select: none;
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .02);
}
.cap-refresh {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: grid; place-items: center; color: var(--accent);
  background: #fff; border: .5px solid var(--border);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .06);
  transition: transform .15s ease;
}
.cap-refresh:hover { transform: rotate(180deg); }
.cap-refresh:active { transform: scale(.92); }
.cap-box input {
  width: 100%; margin-top: 10px; box-sizing: border-box; text-align: center;
  border: .5px solid var(--border); border-radius: 9px;
  padding: 10px 12px; font-size: 15px; letter-spacing: 6px;
  color: var(--ink); background: #fff; outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.cap-box input:focus {
  border-color: rgba(0, 122, 255, .55);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .15);
}
.cap-err {
  margin-top: 10px; padding: 8px 10px; border-radius: 9px;
  background: rgba(255, 95, 87, .12); color: #c0392b;
  font-size: 12.5px; text-align: left; line-height: 1.5;
}
.cap-actions { margin-top: 16px; }
.cap-actions .btn-primary { width: 100%; }
.btn-primary:disabled { opacity: .55; cursor: default; transform: none; }

/* ============================================================
 * 自定义单词书 打磨(词书卡片 + 书内单词快速标记)
 * ============================================================ */
.books-list { gap: 12px; }
.book-row {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, .6));
  border: .5px solid var(--border); box-shadow: 0 6px 18px rgba(0, 0, 0, .05);
  transition: transform .16s ease, box-shadow .16s ease;
}
.book-row:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0, 0, 0, .09); }
.book-row { cursor: pointer; }
.book-row.is-empty { opacity: .72; }
.br-cover {
  width: 54px; height: 54px; flex: none; border-radius: 15px;
  display: grid; place-items: center; font-size: 25px; color: #fff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, .14);
}
.br-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.br-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.br-name {
  font-size: 16.5px; font-weight: 800; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.book-row .br-count {
  flex: none; font-size: 12px; font-weight: 700;
  color: #fff !important;              /* 深色底上必须白字(旧规则 ink-3 会覆盖) */
  background: var(--accent); border-radius: 999px; padding: 2px 10px;
}
.br-sub { font-size: 12px; color: var(--ink-3); }
.br-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.wl-chip:disabled { opacity: .45; cursor: default; transform: none; }
.br-count.zero { background: #9AA0A6 !important; }
.book-row.is-empty .br-cover { filter: saturate(.3); opacity: .75; }

/* 书内单词:汇总 + 快速标记 */
.custom-summary {
  margin-bottom: 10px; font-size: 12.5px; color: var(--ink-2);
  background: rgba(0, 0, 0, .035); border-radius: 10px; padding: 8px 14px;
}
.wl-row { border-left: 3px solid transparent; }
.wl-row .wl-main { cursor: pointer; }
.bi-body { cursor: pointer; }
.wl-row.row-f { border-left-color: #ff5f57; }
.wl-row.row-m { border-left-color: #1fb06d; }
.wl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.wl-quick { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.wl-ops { display: flex; gap: 4px; }
.quick-chip {
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  transition: transform .14s ease, filter .14s ease; cursor: pointer;
}
.quick-chip.q-bad { background: rgba(255, 95, 87, .13); color: #d9534f; }
.quick-chip.q-ok { background: rgba(52, 199, 89, .15); color: #1ba463; }
.quick-chip.q-x { background: rgba(0, 0, 0, .055); color: var(--ink-3); }
.quick-chip:hover { transform: translateY(-1px); filter: brightness(.97); }
.quick-chip:active { transform: scale(.95); }
@media (max-width: 700px) {
  .book-row { flex-direction: row; flex-wrap: wrap; }
  .br-actions { width: 100%; justify-content: flex-start; }
  .wl-row { flex-wrap: wrap; }
  .wl-side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
}

/* ============================================================
 * 社交:好友中心 / 好友卡片 / PK 邀请
 * ============================================================ */
.social-me-card {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, rgba(0, 122, 255, .1), rgba(0, 122, 255, .03));
  border: 1px solid rgba(0, 122, 255, .16);
  border-radius: 16px; padding: 18px 20px; margin-bottom: 8px;
}
.sm-avatar { font-size: 44px; line-height: 1; }
.sm-info { flex: 1; min-width: 0; }
.sm-name { font-size: 18px; font-weight: 700; color: var(--ink); }
.sm-account { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.sm-bio { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; }
.sm-pk { margin-top: 8px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.social-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}
.social-card {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, .75);
  border: 1px solid rgba(0, 0, 0, .07); border-radius: 14px;
  padding: 12px 14px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.social-card:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .06); }
.sc-avatar {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; background: rgba(0, 122, 255, .08);
}
.sc-main { flex: 1; min-width: 0; }
.sc-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.sc-user { font-size: 12px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.win-chip.static { background: rgba(0, 0, 0, .05); color: var(--ink-3); }
.win-chip.danger { background: rgba(255, 59, 48, .1); color: #ff3b30; }
.win-chip.danger:hover { background: rgba(255, 59, 48, .18); }
.social-empty-tip { font-size: 13.5px; color: var(--ink-3); padding: 10px 2px; }
/* 好友页顶部:今日榜单入口卡 */
.board-entry {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: linear-gradient(135deg, rgba(255, 159, 10, .12), rgba(0, 122, 255, .06));
  border: 1px solid rgba(255, 159, 10, .22); border-radius: 16px;
  padding: 14px 18px; margin: 4px 0 18px;
  cursor: pointer; color: var(--ink);
  transition: transform .14s ease, box-shadow .14s ease;
}
.board-entry:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.board-entry .be-ico { font-size: 26px; flex-shrink: 0; }
.board-entry .be-main { flex: 1; min-width: 0; }
.board-entry .be-main strong { display: block; font-size: 15px; font-weight: 700; }
.board-entry .be-main small { font-size: 12.5px; color: var(--ink-3); }
.board-entry .be-arrow { font-size: 20px; color: var(--ink-3); flex-shrink: 0; }
.pk-playing-bar {
  display: flex; align-items: center; gap: 14px;
  margin-top: 18px; padding: 14px 18px;
  background: linear-gradient(135deg, rgba(255, 159, 10, .12), rgba(255, 69, 58, .08));
  border: 1px solid rgba(255, 159, 10, .25); border-radius: 14px;
  font-weight: 600; color: var(--ink);
}
.pk-playing-bar.hidden { display: none; }
.social-results { margin-top: 4px; }
.social-results .social-card { margin-bottom: 10px; }

/* ============================================================
 * 用户主页窗口
 * ============================================================ */
.profile-body { max-width: 880px; margin: 0 auto; width: 100%; padding: 26px 30px 40px; }
.profile-head { display: flex; align-items: center; gap: 18px; }
.profile-avatar {
  width: 76px; height: 76px; border-radius: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; background: rgba(0, 122, 255, .09);
  border: 1px solid rgba(0, 122, 255, .15);
}
.profile-names { flex: 1; min-width: 0; }
.profile-name { font-size: 22px; font-weight: 700; color: var(--ink); }
.profile-account { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.profile-bio { font-size: 14px; color: var(--ink-2); margin-top: 8px; line-height: 1.6; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 26px; }
.profile-stats .stat-card { text-align: center; }

/* 热力图(GitHub 风格) */
.heatmap-wrap { margin-top: 8px; background: rgba(255,255,255,.6); border: 1px solid rgba(0,0,0,.06); border-radius: 14px; padding: 16px 14px; }
.heat-head {
  display: grid; grid-template-columns: 24px repeat(26, 14px); gap: 3px;
  margin-bottom: 4px; height: 14px;
}
.heat-month { font-size: 9px; color: var(--ink-3); line-height: 14px; }
.heat-month.empty { visibility: hidden; }
.heat-corner { font-size: 0; }
.heat-grid {
  display: grid; grid-template-columns: 24px repeat(26, 14px); gap: 3px;
}
.heat-weekday { font-size: 9px; color: var(--ink-3); line-height: 14px; text-align: right; padding-right: 2px; }
.heat-cell { width: 14px; height: 14px; border-radius: 3px; }
.heat-cell.l0, .heat-legend i.l0 { background: rgba(0, 0, 0, .05); }
.heat-cell.l1, .heat-legend i.l1 { background: rgba(31, 176, 109, .25); }
.heat-cell.l2, .heat-legend i.l2 { background: rgba(31, 176, 109, .5); }
.heat-cell.l3, .heat-legend i.l3 { background: rgba(31, 176, 109, .75); }
.heat-cell.l4, .heat-legend i.l4 { background: #1fb06d; }
.heat-cell.off { visibility: hidden; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: 11px; color: var(--ink-3); }
.heat-legend i { width: 11px; height: 11px; border-radius: 2.5px; }

/* ============================================================
 * PK 对战窗口
 * ============================================================ */
.pk-body { max-width: 920px; margin: 0 auto; width: 100%; padding: 22px 26px 40px; }
.pk-body > div { width: 100%; }
.pk-done-wait { text-align: center; padding: 80px 20px 60px; }

/* 3·2·1 Begin */
.pk-begin {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(245, 245, 247, .96);
  backdrop-filter: blur(8px);
}
.pk-begin-num {
  font-size: 120px; font-weight: 900; color: var(--accent);
  line-height: 1; text-shadow: 0 8px 30px rgba(0,122,255,.25);
  animation: pkNumPop .32s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pkNumPop {
  from { transform: scale(2.1); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.pk-begin-text { margin-top: 14px; font-size: 16px; color: var(--ink-3); letter-spacing: 2px; }

/* 每词 10s 倒计时 */
.pk-count {
  width: 76px; height: 76px; margin: 0 auto 10px;
  border-radius: 50%;
  background: rgba(0,122,255,.1); border: 1.5px solid rgba(0,122,255,.35);
  display: flex; align-items: baseline; justify-content: center; gap: 1px;
  color: var(--accent);
}
.pk-count-num-big { font-size: 30px; font-weight: 800; }
.pk-count-num-big.low { color: #ff3b30; }
.pk-count-unit { font-size: 14px; font-weight: 700; color: var(--accent); }
.pk-count-wrap { display: flex; align-items: center; gap: 10px; justify-content: center; }
.pk-wait { text-align: center; padding: 80px 20px 60px; }
.pk-wait-emoji { font-size: 56px; }
.pk-wait-title { font-size: 21px; font-weight: 700; color: var(--ink); margin-top: 14px; }
.pk-wait-sub { font-size: 14px; color: var(--ink-3); margin: 8px 0 22px; }
.pk-duel {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.07);
  border-radius: 16px; padding: 14px 16px;
}
.pk-player { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pk-player.opp { flex-direction: row-reverse; text-align: right; }
.pk-p-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; background: rgba(0, 122, 255, .08);
}
.pk-p-info { min-width: 0; }
.pk-p-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.pk-p-num { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.pk-p-num b { color: var(--accent); font-size: 14px; }
.pk-progress { width: 100%; height: 8px; border-radius: 6px; background: rgba(0,0,0,.07); overflow: hidden; margin-top: 8px; flex-basis: 100%; }
.pk-player.opp .pk-progress { direction: rtl; }
.pk-progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .4s ease; }
.pk-progress-fill.me { background: #34c759; }
.pk-vs {
  font-size: 15px; font-weight: 800; color: var(--ink-3);
  background: rgba(0,0,0,.05); border-radius: 999px; padding: 6px 12px;
}
.pk-word-area { text-align: center; margin-top: 30px; }
.pk-qnum {
  display: inline-block; font-size: 13px; color: var(--ink-3);
  background: rgba(0,0,0,.05); border-radius: 999px; padding: 5px 14px;
  margin-bottom: 12px;
}
.pk-answer { max-width: 560px; margin: 26px auto 0; }
.pk-answer-row { display: flex; gap: 8px; }
.pk-answer-row input {
  flex: 1; font-size: 15px; padding: 11px 14px; border-radius: 10px;
  background: rgba(0,0,0,.045); border: 1px solid rgba(0,0,0,.08); color: var(--ink);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.pk-answer-row input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,122,255,.14); }
.pk-actions { margin-top: 12px; }
.pk-actions .act-btn { width: auto; padding: 0 18px; }
.pk-feedback {
  margin-top: 14px; padding: 12px 16px; border-radius: 12px;
  font-size: 14.5px; line-height: 1.6;
}
.pk-feedback.pass { background: rgba(31, 176, 109, .12); color: #177a4c; }
.pk-feedback.fail { background: rgba(255, 59, 48, .1); color: #c2311f; }
.pk-feedback.busy { background: rgba(0, 122, 255, .08); color: var(--ink-2); }

/* PK 对局 = 测试模式"刮刮乐"样式(2026-09-07) */
#view-pk .pk-duel { margin-bottom: 0; }
.pk-topline {
  width: 100%; max-width: 600px; margin: 6px auto 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px;
}
.pk-topline .pk-qnum { margin-bottom: 0; }   /* 覆盖原 .pk-qnum 的 margin-bottom */
.pk-count-inline { display: inline-flex; align-items: baseline; gap: 3px; font-variant-numeric: tabular-nums; }
.pk-count-inline .pk-count-num-big { font-size: 26px; }
.pk-count-inline .pk-count-unit { font-size: 13px; }
#view-pk .word-area { margin-top: 14px; }
#view-pk .word-area .word-big { font-size: clamp(44px, 9vw, 66px); margin-top: 10px; }
#view-pk .word-area .word-pron { margin-top: 8px; }
#view-pk .word-area .speak-btn { margin-top: 16px; }
/* PK 刮刮乐与测试页共用通用 .scratch-zone/.scratch-card(含响应式高度),不做特例覆盖 */
#view-pk .answer-check { margin: 18px auto 0; }
#view-pk .ac-row { gap: 8px; }
/* PK「不会」按钮(与检测按钮同行,次级外观) */
.pk-skip-btn {
  flex-shrink: 0;
  padding: 12px 15px;
  border-radius: 9px;
  font-size: 14.5px; font-weight: 700;
  color: var(--ink-2);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--border);
  box-shadow: none;
  white-space: nowrap;
  transition: transform .16s ease, color .16s ease, background .16s ease;
}
.pk-skip-btn:hover { color: var(--red); background: rgba(255, 59, 48, .08); }
.pk-skip-btn:active { transform: scale(.95); }
.pk-skip-btn:disabled { opacity: .45; cursor: default; }
#view-pk .pk-feedback { margin-top: 12px; }
#view-pk .pk-feedback .ai-badge { background: #1FB06D; }
/* PK 刮刮乐 canvas(规则同 #scratch-canvas) */
#pk-scratch-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: var(--radius);
  cursor: grab;
  touch-action: none;
  z-index: 2;
}
#pk-scratch-canvas.scratching { cursor: grabbing; }
#pk-scratch-card.revealed #pk-scratch-canvas { opacity: 0; pointer-events: none; transition: opacity .5s ease; }

/* 结算 */
.pk-result { text-align: center; }
.pk-result-card {
  max-width: 460px; margin: 0 auto;
  background: rgba(255,255,255,.8); border: 1px solid rgba(0,0,0,.07);
  border-radius: 22px; padding: 30px 26px;
  box-shadow: 0 10px 34px rgba(0,0,0,.08);
  animation: pkPop .4s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pkPop {
  from { transform: scale(.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.pk-result-emoji { font-size: 64px; }
.pk-result-title { font-size: 26px; font-weight: 800; color: var(--ink); margin: 8px 0 4px; }
.pk-result-sub { font-size: 14px; color: var(--ink-3); margin-bottom: 20px; }
/* 双方正确率对比条(单元完成页风格) */
.pk-rate { max-width: 400px; margin: 4px auto 6px; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.pk-rate-row { padding: 10px 14px 12px; border-radius: 14px; background: rgba(0,0,0,.035); border: 1px solid rgba(0,0,0,.05); }
.pk-rate-row.winner { background: rgba(31,176,109,.09); border-color: rgba(31,176,109,.35); box-shadow: inset 0 0 0 1.5px rgba(31,176,109,.3); }
.pk-rate-row.winner .pk-rate-name, .pk-rate-row.winner .pk-rate-pct { color: #177a4c; }
.pk-rate-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.pk-rate-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.pk-rate-pct { font-size: 19px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.pk-rate-track { height: 12px; border-radius: 8px; background: rgba(0,0,0,.07); overflow: hidden; }
.pk-rate-fill { height: 100%; width: 0; border-radius: 8px; transition: width .9s cubic-bezier(.2, 1.4, .4, 1); }
.pk-rate-fill.me { background: linear-gradient(90deg, #28C840, #34c759); }
.pk-rate-fill.opp { background: linear-gradient(90deg, #5ac8fa, #0a84ff); }
.pk-rate-time { font-size: 12.5px; color: var(--ink-3); margin: 2px 0 16px; }
.pk-rate-time b { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pk-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* PK 全屏彩带/失败散点 */
.pk-fx { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.pk-fx i {
  position: absolute; width: 8px; height: 8px; border-radius: 2px; opacity: .9;
  animation-name: pkFall; animation-timing-function: ease-in; animation-fill-mode: both;
}
@keyframes pkFall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: .2; }
}
@media (max-width: 640px) {
  .profile-head { flex-wrap: wrap; }
  .profile-actions { width: 100%; justify-content: flex-start; }
  .pk-duel { gap: 8px; }
  .pk-vs { display: none; }
  .heat-head { grid-template-columns: 18px repeat(26, 11px); }
  .heat-grid { grid-template-columns: 18px repeat(26, 11px); }
  .heat-cell { width: 11px; height: 11px; }
}

/* PK 右下角邀请弹窗 */
.pk-pop {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  width: 330px; max-width: calc(100vw - 32px);
}
.pk-pop.hidden { display: none; }
.pk-pop-body {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(0,0,0,.08); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.16);
  padding: 14px 16px;
  animation: pkPopIn .35s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pkPopIn {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.pk-pop-close {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  color: var(--ink-3); background: rgba(0,0,0,.06); font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.pk-pop-ico { font-size: 34px; }
.pk-pop-text { flex: 1; min-width: 0; }
.pk-pop-title { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.pk-pop-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.pk-pop-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pk-pop-actions .win-chip { padding: 7px 12px; font-size: 13px; }
@media (max-width: 480px) {
  .pk-pop { right: 10px; bottom: 10px; }
}

/* ============================================================
   移动端 App 化(2026-09-07):安全区 / 禁捏合缩放 / 键盘不顶走内容
   —— 仅作用触屏窄屏,桌面不受影响
   ============================================================ */
/* iOS 聚焦时禁止自动放大页面:输入框字号强制 ≥16px */
@media (max-width: 768px) {
  input, textarea { font-size: 16px !important; }
  select { font-size: 16px !important; }
}

/* 触屏禁捏合/双击缩放(配合 meta user-scalable=no 双保险) */
@media (hover: none), (pointer: coarse) {
  html, body {
    touch-action: pan-x pan-y;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  .menu-bar, .sidebar, .content, .window, .win-body,
  .view, .modal, .login-wrap, .pk-pop, .toast { touch-action: pan-y; }
}

/* 顶部菜单栏:兼容刘海屏安全区,手机高度略增高防内容溢出 */
@media (max-width: 768px) {
  :root { --menu-h: 40px; }   /* 手机顶栏加高为 40px,内容不再挤压溢出 */
  .menu-bar {
    height: calc(var(--menu-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 10px 0;
  }
  .app-body { top: calc(var(--menu-h) + env(safe-area-inset-top, 0px)); }
  .toast { top: calc(var(--menu-h) + env(safe-area-inset-top, 0px) + 16px); }
  .menu-left { min-width: 0; flex-shrink: 1; }
  .menu-app {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 44vw; flex-shrink: 1; min-width: 0;
  }
  .menu-right { min-width: 0; overflow: hidden; flex-shrink: 0; gap: 6px; }
  .menu-chip, .menu-user { white-space: nowrap; flex-shrink: 1; min-width: 0; }
  .menu-user { max-width: 30vw; overflow: hidden; text-overflow: ellipsis; }
  .menu-chip { overflow: hidden; text-overflow: ellipsis; }
  .menu-clock { flex-shrink: 0; }
}

/* 超窄屏:顶栏只保留 用户+打卡+时钟,今日词数移入概览卡,避免挤出栏外 */
@media (max-width: 400px) {
  #menu-today { display: none; }
  .menu-app { display: none; }          /* 空间不够时隐藏标题,顶栏专注信息 */
  .menu-chip { font-size: 11px; padding: 2px 7px; }
  .menu-user { font-size: 11px; padding: 2px 8px; max-width: 40vw; }
  .menu-clock { font-size: 12px; min-width: 38px; }
}
/* 更窄屏:只保留 用户+时间,打卡数字折叠为图标 */
@media (max-width: 340px) {
  #menu-streak b, #menu-streak { font-size: 0; }
  #menu-streak::before { content: '🔥'; font-size: 12px; }
  .menu-user { max-width: 44vw; }
}

/* ============================================================
   键盘弹出(html.ew-kb) —— 用户拍板(2026-09-08):
   “输入框连同上方内容整体平移上去,输入框贴住键盘上沿,不留空;
   测试页不上下滚动,可左右滑动切换上一个/下一个词。”
   因此键盘态把全屏窗口高度设为键盘上方的可视高度(视觉视口),
   窗口内容纵向排列:上方题干 → 底部输入区(margin-top:auto 推到底),
   使输入框正好贴住键盘,中间不产生空白。
   ============================================================ */
@media (max-width: 900px) {
  /* 根不随键盘滚动 → 无“内容被顶没”;高度由 --ew-vh 接管 */
  html.ew-kb, html.ew-kb body {
    overflow: hidden !important;
    height: 100%;
  }

  /* 全屏窗口 / 居中弹窗收缩到可视高度(键盘以上),贴顶不动
     —— 但 #view-test 例外:其题干区与操作条已分层(dock fixed + --ew-kb),
        窗口保持全高、词/卡完全不参与键盘重排(不闪不动) */
  html.ew-kb .window,
  html.ew-kb #view-login,
  html.ew-kb .modal {
    position: fixed !important;
    top: var(--ew-vtop, 0px) !important;
    left: 0; right: 0;
    bottom: auto !important;
    height: var(--ew-vh, 100vh) !important;
  }

  /* PK / 自定义等旧式题干窗口:窗口锁定在键盘上方可视高度;内容超高时内部可滚动,
     底部输入区 margin-top:auto 吸底贴键盘 */
  html.ew-kb #view-pk .win-body,
  html.ew-kb #view-custom .win-body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }
  html.ew-kb #view-pk .answer-check,
  html.ew-kb #view-custom .answer-check {
    margin-top: auto;
    flex-shrink: 0;
    padding: 10px 12px;
  }
  html.ew-kb #view-pk .word-area { margin-top: 6px; }
  html.ew-kb #view-pk .word-big { font-size: clamp(28px, 8vw, 42px); margin-top: 4px; }
  html.ew-kb #view-pk .word-pron { font-size: 15px; margin-top: 4px; }
  html.ew-kb #view-pk .speak-btn { margin-top: 8px; padding: 8px 18px; font-size: 13px; }

  html.ew-kb .nav-arrow { display: none; }
  html.ew-kb .ac-hint { display: none; }

  /* 登录/找回等居中页:可视高度内可滚,避免内容顶没 */
  html.ew-kb #view-login { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  html.ew-kb .modal-card { max-height: calc(var(--ew-vh, 100vh) - 24px); overflow-y: auto; }
}

/* 手机(≤768px)+键盘态:#view-test 窗口保持全高、题干区可滚(词卡尺寸与常态一致,不重排),
   仅底部操作条 .test-dock 由 fixed bottom:var(--ew-kb) 贴到键盘上沿 */
@media (max-width: 768px) {
  html.ew-kb #view-test {
    position: fixed !important;
    top: 0 !important; left: 0; right: 0; bottom: 0 !important;
    height: auto !important;
  }
  html.ew-kb #view-test .win-body {
    overflow: hidden !important;
    justify-content: flex-start;
    padding: 0 !important;
  }
  html.ew-kb #view-test .test-stage {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* ============================================================
 * 词书分享 / 导入(2026-09-08 v=20260950)
 * ============================================================ */
.share-card { width: 430px; max-width: 92vw; }
.share-url-row { display: flex; gap: 8px; margin-top: 14px; }
.share-url-row input {
  flex: 1; min-width: 0; padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, .13); border-radius: 10px;
  font-size: 13px; color: var(--ink); background: rgba(0, 0, 0, .035);
}
.share-copy {
  flex-shrink: 0; padding: 0 15px; border: none; border-radius: 10px;
  background: #007AFF; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
}
.share-copy:hover { filter: brightness(1.08); }
.share-copy:active { transform: scale(.96); }
.share-tip { font-size: 12px; line-height: 1.65; color: var(--ink-3); margin-top: 10px; }
.import-go { width: 100%; margin-top: 12px; }
#import-confirm:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.import-preview {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(0, 122, 255, .07); border: 1px solid rgba(0, 122, 255, .22);
}
.import-preview .ip-cover {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: linear-gradient(135deg, #007AFF, #30c9a8); color: #fff;
}
.import-preview .ip-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.import-preview .ip-name {
  font-size: 15px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.import-preview .ip-meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.import-preview .ip-dot { opacity: .6; }

/* ============================================================
 * 共享书架 / 公开分享开关(2026-09-08 v=20260951)
 * ============================================================ */
.shelf-entry {
  width: 100%; margin: 4px 0 14px; padding: 11px 14px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px dashed rgba(0, 122, 255, .45); border-radius: 12px;
  background: rgba(0, 122, 255, .05); color: var(--ink-2);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.shelf-entry:hover { background: rgba(0, 122, 255, .12); color: var(--ink); }
.shelf-entry:active { transform: scale(.985); }

.share-pub { margin-top: 16px; }
.share-pub-btn {
  width: 100%; padding: 11px 14px;
  border: none; border-radius: 12px;
  background: linear-gradient(135deg, #007AFF, #30c9a8);
  color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 122, 255, .25);
  transition: filter .15s ease, transform .12s ease;
}
.share-pub-btn.on {
  background: rgba(52, 199, 89, .12); color: #1b8a3a;
  box-shadow: none; border: 1px solid rgba(52, 199, 89, .35);
}
.share-pub-btn:hover { filter: brightness(1.05); }
.share-pub-btn:active { transform: scale(.97); }
.share-pub-state { display: block; margin-top: 7px; font-size: 12px; color: var(--ink-3); line-height: 1.55; }

.shelf-card { width: 460px; max-width: 94vw; }
.shelf-list { max-height: 58vh; overflow-y: auto; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.shelf-empty { padding: 26px 10px; color: var(--ink-3); font-size: 13.5px; }
.shelf-empty .se-emoji { font-size: 40px; display: block; margin-bottom: 8px; }
.shelf-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 14px; background: rgba(0, 0, 0, .035); border: 1px solid rgba(0, 0, 0, .06);
  text-align: left;
}
.shelf-item .sf-cover {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 21px; color: #fff;
  background: linear-gradient(135deg, #af52de, #5856d6);
}
.shelf-item .sf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.shelf-item .sf-name { font-size: 14.5px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-item .sf-meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.shelf-item .sf-count { color: #af52de; font-weight: 700; }
.shelf-item .sf-add {
  flex-shrink: 0; padding: 7px 12px; border: none; border-radius: 10px;
  background: #007AFF; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: filter .15s ease, transform .12s ease;
}
.shelf-item .sf-add:hover { filter: brightness(1.08); }
.shelf-item .sf-add:active { transform: scale(.96); }
.shelf-item .sf-add.own { background: rgba(0, 0, 0, .07); color: var(--ink-3); cursor: default; }
.shelf-item .sf-add.got { background: rgba(52, 199, 89, .14); color: #1b8a3a; cursor: default; }
.shelf-loading { padding: 26px; color: var(--ink-3); font-size: 13px; }
