/* 万物新知 V1.0 —— 移动端优先，同一套页面渐进适配平板与电脑。 */

/* ---------- 设计令牌（浅色为默认，深色预留） ---------- */
:root {
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --surface-2: #EFECE5;
  --ink: #1B2A4A;
  --ink-2: #4A5672;
  --ink-3: #8A92A6;
  --line: rgba(27, 42, 74, .08);
  --brand: #FF6B3D;
  --brand-ink: #FFFFFF;
  --vocab: #3D7BF7;
  --reading: #17A673;
  --mistakes: #F2A114;
  --danger: #E5484D;

  --radius-s: 12px;
  --radius: 18px;
  --radius-l: 26px;
  --shadow: 0 1px 2px rgba(27,42,74,.04), 0 6px 20px rgba(27,42,74,.06);
  --tap: 44px;                 /* Apple HIG 最小触控尺寸 */
  --tabbar-h: 58px;
  --nav-h: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-en: "SF Pro Rounded", ui-rounded, -apple-system, "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: light;
}
/* 深色主题扩展位：第一版不启用，后续在 <html data-theme="dark"> 下开放 */
:root[data-theme="dark"] {
  --bg: #0F1525; --surface: #182036; --surface-2: #212A43;
  --ink: #EEF1F8; --ink-2: #B5BDD0; --ink-3: #7C86A0; --line: rgba(255,255,255,.08);
  color-scheme: dark;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  font-family: var(--font); color: var(--ink); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button, a, input, summary { touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.en { font-family: var(--font-en); }
.skip-link {
  position: fixed; z-index: 100; top: 8px; left: 8px; transform: translateY(-160%);
  padding: 10px 14px; border-radius: 10px; background: var(--ink); color: #fff;
}
.skip-link:focus { transform: translateY(0); }

/* ---------- App 外壳 ---------- */
#app { position: relative; min-height: 100%; max-width: 480px; margin: 0 auto; background: var(--bg); }
.view {
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 8px) 18px calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
}
.view.no-tabbar { padding-bottom: calc(var(--safe-bottom) + 28px); }
.view.has-nav { padding-top: calc(var(--safe-top) + var(--nav-h) + 8px); }

/* 页面切换动画（尊重系统“减少动态效果”） */
.view.enter-push { animation: push-in .28s cubic-bezier(.2,.8,.2,1); }
.view.enter-pop  { animation: pop-in .24s cubic-bezier(.2,.8,.2,1); }
.view.enter-tab  { animation: fade-in .18s ease-out; }
@keyframes push-in { from { transform: translateX(28%); opacity: .4; } }
@keyframes pop-in  { from { transform: translateX(-12%); opacity: .5; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .view[class*="enter-"] { animation: none; } }

/* ---------- 底部导航（固定 + iPhone 安全区） ---------- */
.tabbar {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 480px;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
  transition: transform .22s ease;
}
.tabbar.hidden { transform: translateY(110%); }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--tap); color: var(--ink-3); font-size: 11px; font-weight: 500; letter-spacing: .02em;
}
.tab svg { width: 25px; height: 25px; transition: transform .15s; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] svg { color: var(--brand); }
.tab:active svg { transform: scale(.88); }

/* ---------- 顶部导航栏（二级页） ---------- */
.navbar {
  position: fixed; z-index: 15; top: 0; left: 0; right: 0; margin: 0 auto; max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-top)); padding: var(--safe-top) 6px 0;
  display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.navbar h1 { text-align: center; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: var(--tap); height: var(--tap); display: grid; place-items: center; border-radius: 50%; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; }

/* ---------- 通用组件 ---------- */
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -.01em; padding: 10px 2px 4px; }
.page-sub { color: var(--ink-3); font-size: 14px; padding: 0 2px 14px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 12px; }
.section-head h2 { font-size: 19px; font-weight: 700; }
.section-head a, .link { color: var(--ink-3); font-size: 14px; min-height: var(--tap); display: inline-flex; align-items: center; }

.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; transition: transform .12s ease;
}
a.card:active, button.card:active, .pressable:active { transform: scale(.98); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border-radius: 999px; font-weight: 600; font-size: 16px;
  background: var(--ink); color: #fff; transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; }
.btn.brand { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; }

.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 16px; border-radius: 999px;
  background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 500; box-shadow: var(--shadow);
  white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 18px 10px; margin: 0 -18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2);
}
.muted { color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 插画占位（主题色渐变 + 图标），正式插画按需懒加载替换 */
.art {
  position: relative; display: grid; place-items: center; overflow: hidden;
  background:
    radial-gradient(120% 90% at 85% 10%, hsl(var(--h) 90% 88%) 0%, transparent 55%),
    linear-gradient(150deg, hsl(var(--h) 80% 94%), hsl(var(--h) 70% 84%));
  color: hsl(var(--h) 55% 38%);
}
.art svg { width: 44%; height: 44%; opacity: .9; }
.art::after {
  content: ""; position: absolute; width: 60%; aspect-ratio: 1; border-radius: 50%;
  right: -18%; bottom: -26%; background: hsl(var(--h) 70% 78% / .55);
}

/* ---------- 首页 ---------- */
.action-grid, .test-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.action-grid .card, .test-grid .card { display: flex; flex-direction: column; gap: 7px; min-height: 128px; text-align: left; }
.action-grid small, .test-grid small { color: var(--ink-3); line-height: 1.35; }
.action-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--vocab); }
.action-icon.warm { background: var(--mistakes); }
.action-icon svg { width: 24px; height: 24px; }
.home-top { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px 0; }
.home-hello { font-size: 14px; color: var(--ink-3); }
.home-name { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.avatar {
  width: var(--tap); height: var(--tap); border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 17px;
}
.today {
  margin-top: 18px; padding: 20px; border-radius: var(--radius-l); color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(140deg, #1B2A4A 0%, #2B3F6B 100%);
}
.today::before {
  content: ""; position: absolute; width: 190px; height: 190px; right: -50px; top: -70px; border-radius: 50%;
  background: radial-gradient(circle, #FF6B3D 0%, #FF6B3D 45%, transparent 46%);
  opacity: .95;
}
.today::after {
  content: ""; position: absolute; width: 70px; height: 70px; right: 96px; top: 58px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.18);
}
.today > * { position: relative; }
.today .label { font-size: 13px; opacity: .7; letter-spacing: .04em; }
.today h2 { font-size: 22px; font-weight: 700; margin: 4px 0 16px; max-width: 70%; }
.today-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.today-stats div { background: rgba(255,255,255,.1); border-radius: 14px; padding: 10px 12px; }
.today-stats b { display: block; font-size: 24px; font-family: var(--font-en); line-height: 1.15; }
.today-stats span { font-size: 12px; opacity: .75; }

.modules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.module {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px 12px 14px;
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-height: 118px;
}
.module .ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.module .ico svg { width: 23px; height: 23px; }
.module b { font-size: 15px; display: block; }
.module span { font-size: 12px; color: var(--ink-3); }

.continue { display: flex; gap: 14px; align-items: center; padding: 12px; }
.continue .art { width: 76px; height: 76px; border-radius: 16px; flex: none; }
.continue h3 { font-size: 16px; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--reading); }

/* ---------- 词汇 ---------- */
.search {
  display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink-3); font-size: 15px;
}
.search svg { width: 20px; height: 20px; }
.review-banner { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.review-banner .ring {
  width: 54px; height: 54px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--vocab) calc(var(--p) * 1%), var(--surface-2) 0);
  font-weight: 700; font-family: var(--font-en);
}
.review-banner .ring span { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 15px; }
.topics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.topic { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.topic .art { aspect-ratio: 4 / 3; }
.topic .meta { padding: 10px 12px 12px; }
.topic b { font-size: 15px; display: block; }
.topic .en { font-size: 12px; color: var(--ink-3); }
.topic .theme { position: absolute; z-index: 1; top: 8px; left: 8px; background: rgba(255,255,255,.75); color: var(--ink-2); }

.word-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.word-row + .word-row { border-top: 1px solid var(--line); }
.word-row .w { font-family: var(--font-en); font-size: 19px; font-weight: 600; }
.word-row .ph { font-size: 13px; color: var(--ink-3); }
.word-row .cn { font-size: 14px; color: var(--ink-2); }
.list { padding: 0; overflow: hidden; }
.hero-art { aspect-ratio: 16 / 9; border-radius: var(--radius-l); margin-top: 4px; }

/* ---------- 课标词库 ---------- */
.notice {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 14px; border-radius: 14px; margin: 4px 0 12px;
  background: color-mix(in srgb, var(--mistakes) 13%, var(--surface)); color: #8A5A00; font-size: 13px; line-height: 1.45;
}
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.lex-entry { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.lex-entry .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--ink); color: #fff; flex: none; }
.lex-entry .ico svg { width: 24px; height: 24px; }
.lex-head { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lex-head div { background: var(--surface); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); }
.lex-head b { display: block; font-size: 22px; line-height: 1.2; }
.lex-head span { font-size: 12px; color: var(--ink-3); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; font: inherit; font-size: 16px; color: var(--ink); outline: none; }
.lex-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; }
.lex-row + .lex-row { border-top: 1px solid var(--line); }
.lex-row:active { background: var(--surface-2); }
.lex-row .w { display: block; font-family: var(--font-en); font-size: 18px; font-weight: 600; line-height: 1.25; }
.lex-row .cn { display: block; font-size: 13px; color: var(--ink-2); }
.lex-row .chev { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.count-note { text-align: center; font-size: 13px; padding: 14px; }

/* ---------- V1 词卡 学习 复习 ---------- */
.word-card { text-align: center; margin-top: 8px; }
.word-card h2 { font-size: 38px; margin-top: 12px; }
.word-image, .word-placeholder { width: 100%; aspect-ratio: 4 / 3; border-radius: 18px; margin-bottom: 16px; object-fit: cover; }
.word-placeholder { display: grid; place-items: center; color: var(--ink-3); background: var(--surface-2); }
.word-meaning { font-size: 21px; font-weight: 600; margin: 12px 0; }
.example { text-align: left; background: var(--surface-2); border-radius: 14px; padding: 14px; margin: 14px 0; }
.example p + p { margin-top: 6px; color: var(--ink-2); }
.feedback-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.study-stack > * + * { margin-top: 10px; }
.study-item { display: flex; align-items: center; gap: 12px; }
.study-item .en { font-size: 20px; }
.study-item p { color: var(--ink-2); font-size: 14px; }
.study-no { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; }
.review-row { display: flex; align-items: center; gap: 8px; padding: 12px 0; }
.review-row + .review-row { border-top: 1px solid var(--line); }
.review-row .chip { padding: 0 12px; }
.quiz, .result-card { margin-top: 12px; text-align: center; }
.quiz h2, .result-card h2 { font-size: 28px; margin: 18px 0 8px; }
.quiz-options, [data-spell] { display: grid; gap: 10px; margin-top: 22px; }
.result-card p { margin: 10px 0 18px; }
.lv-dot {
  width: 30px; height: 30px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: hsl(var(--h) 80% 94%); color: hsl(var(--h) 55% 38%); font-family: var(--font-en);
}
.badge.star2 { background: color-mix(in srgb, var(--brand) 14%, transparent); color: #C2451C; }
.badge.warn { background: color-mix(in srgb, var(--mistakes) 18%, transparent); color: #8A5A00; }
.word-hero { display: flex; gap: 16px; align-items: center; padding: 4px 2px 0; }
.word-art { width: 104px; height: 104px; border-radius: 26px; flex: none; }
.word-head { font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; word-break: break-word; margin-bottom: 8px; }
.ipa-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.ipa {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow); font-size: 14px; color: var(--ink-2); text-align: left;
}
.ipa svg { width: 20px; height: 20px; color: var(--vocab); flex: none; }
.ipa .en { color: var(--ink-3); font-size: 13px; }
.tip { font-size: 12px; margin: 6px 4px 0; }
.mean { font-size: 20px; font-weight: 600; }
.mean .pos { font-family: var(--font-en); font-weight: 500; color: var(--ink-3); margin-right: 6px; font-size: 16px; }
.example { position: relative; margin-top: 14px; padding: 12px 52px 12px 14px; border-radius: 14px; background: var(--surface-2); }
.example .en { font-size: 17px; line-height: 1.5; }
.example .muted { font-size: 14px; margin-top: 2px; }
.example .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--vocab); }
.usage { display: flex; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.usage svg { width: 18px; height: 18px; color: var(--brand); flex: none; margin-top: 2px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.meta-grid span { display: block; font-size: 12px; color: var(--ink-3); }
.meta-grid b { font-size: 14px; font-weight: 600; word-break: break-word; }
.action-spacer { height: 84px; }
.action-bar {
  position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 10px 18px calc(var(--safe-bottom) + 10px);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-top: 1px solid var(--line);
}
.flash { text-align: center; padding: 26px 20px 30px; min-height: 260px; display: flex; flex-direction: column; justify-content: center; }
.flash .answer { margin-top: 18px; }

/* ---------- 阅读 ---------- */
.story { display: flex; gap: 14px; padding: 12px; align-items: stretch; }
.story .art { width: 96px; border-radius: 14px; flex: none; min-height: 112px; }
.story h3 { font-family: var(--font-en); font-size: 17px; font-weight: 700; line-height: 1.3; }
.story .cn { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.story .tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.lv { background: color-mix(in srgb, var(--reading) 14%, transparent); color: var(--reading); }
.article p { font-family: Georgia, "Times New Roman", serif; font-size: 19px; line-height: 1.75; margin-top: 16px; color: var(--ink); }
.article .gl { border-bottom: 2px dashed color-mix(in srgb, var(--reading) 60%, transparent); cursor: pointer; }
.player { position: sticky; bottom: calc(var(--safe-bottom) + 12px); margin-top: 28px; display: flex; align-items: center; gap: 12px; }

/* ---------- 错题本 ---------- */
.capture {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 26px 20px 22px; border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow);
}
.capture .cam {
  width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, #F7B733, var(--mistakes));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--mistakes) 40%, transparent);
}
.capture .cam svg { width: 34px; height: 34px; }
.capture h2 { font-size: 19px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 14px; background: var(--surface-2); }
.segmented button { min-height: 38px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.steps div { font-size: 12px; color: var(--ink-2); }
.steps i {
  display: grid; place-items: center; width: 40px; height: 40px; margin: 0 auto 6px; border-radius: 12px;
  background: color-mix(in srgb, var(--mistakes) 14%, transparent); color: #B87400; font-style: normal; font-weight: 700;
}
.empty { text-align: center; padding: 30px 16px; color: var(--ink-3); font-size: 14px; }
.empty svg { width: 40px; height: 40px; margin-bottom: 6px; opacity: .5; }

/* ---------- 我的 ---------- */
.profile { display: flex; align-items: center; gap: 14px; padding: 18px; }
.profile .avatar { width: 60px; height: 60px; font-size: 24px; background: var(--brand); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding: 14px 6px; }
.stats3 b { display: block; font-size: 22px; font-family: var(--font-en); }
.stats3 span { font-size: 12px; color: var(--ink-3); }
.menu { padding: 0; overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 0 16px; text-align: left; font-size: 16px; }
.menu-item + .menu-item { border-top: 1px solid var(--line); }
.menu-item .mi { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; }
.menu-item .mi svg { width: 18px; height: 18px; }
.menu-item .chev { width: 18px; height: 18px; color: var(--ink-3); }
.menu-item:active { background: var(--surface-2); }

/* ---------- 登录 ---------- */
.login { min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 40px); display: flex; flex-direction: column; justify-content: center; }
.login .logo { width: 84px; height: 84px; border-radius: 24px; margin-bottom: 22px; box-shadow: var(--shadow); }
.login h1 { font-size: 32px; font-weight: 800; letter-spacing: -.01em; }
.login p.slogan { color: var(--ink-2); margin: 6px 0 30px; font-size: 16px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--ink-3); margin: 0 4px 6px; }
.input {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 14px; border: 1.5px solid transparent;
  background: var(--surface); box-shadow: var(--shadow); font: inherit; font-size: 17px; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--ink); }
.legal { font-size: 12px; color: var(--ink-3); text-align: center; margin-top: 16px; }

/* ---------- 底部弹层 / 提示 ---------- */
.sheet-mask { position: fixed; inset: 0; z-index: 40; background: rgba(15,21,37,.35); animation: fade-in .2s; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto;
  background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 22px calc(var(--safe-bottom) + 22px);
  animation: sheet-up .26s cubic-bezier(.2,.8,.2,1);
}
.sheet .grip { width: 40px; height: 5px; border-radius: 9px; background: var(--surface-2); margin: 0 auto 16px; }
@keyframes sheet-up { from { transform: translateY(100%); } }
.toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  transition: opacity .2s, transform .2s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 骨架屏：按需加载时的占位 */
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 平板：侧栏导航 + 可用的宽屏内容 ---------- */
@media (min-width: 768px) {
  body { background: #E9E5DC; }
  #app {
    width: 100%; max-width: 1180px; min-height: 100dvh;
    box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(27,42,74,.10);
  }
  .view {
    width: 100%; max-width: none; padding: 32px 32px 48px 120px;
  }
  .view.no-tabbar { padding: 32px 32px 48px 120px; }
  .view.has-nav { padding-top: 88px; }
  .tabbar {
    top: 0; bottom: 0; left: max(0px, calc((100vw - 1180px) / 2)); right: auto;
    width: 88px; max-width: none; height: 100dvh; padding: 24px 8px;
    grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(64px, 82px));
    align-content: center; border-top: 0; border-right: 1px solid var(--line);
  }
  .tabbar.hidden { transform: translateX(-110%); }
  .tab { gap: 5px; border-radius: 16px; font-size: 12px; }
  .tab:hover { color: var(--ink); background: var(--surface-2); }
  .tab[aria-current="page"] { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
  .navbar {
    left: max(88px, calc((100vw - 1180px) / 2 + 88px));
    right: max(0px, calc((100vw - 1180px) / 2)); max-width: none;
    height: 64px; padding: 8px 20px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  }
  .page-title { font-size: 36px; padding-top: 0; }
  .page-sub { font-size: 15px; }
  .card { padding: 20px; }
  .action-grid, .test-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .study-stack > * + * { margin-top: 0; }
  .word-card, .quiz, .result-card { width: min(100%, 680px); margin-left: auto; margin-right: auto; }

  .view[data-route="home"] {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
    grid-template-rows: auto auto 1fr; gap: 22px 28px; align-content: start;
  }
  .view[data-route="home"] .home-top { grid-column: 1 / -1; }
  .view[data-route="home"] .today { grid-column: 1; grid-row: 2 / span 2; align-self: start; margin-top: 0; }
  .view[data-route="home"] .section { margin-top: 0; }

  .view[data-route="vocabulary"] .list {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden;
  }
  .view[data-route="vocabulary"] .lex-row { border-top: 1px solid var(--line); }
  .view[data-route="vocabulary"] .lex-row:nth-child(odd) { border-right: 1px solid var(--line); }
  .view[data-route="vocabulary"] .lex-row:nth-child(-n+2) { border-top: 0; }

  .view[data-route="review"]:not(.has-nav) {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .8fr);
    gap: 0 28px; align-content: start;
  }
  .view[data-route="review"]:not(.has-nav) > .page-title,
  .view[data-route="review"]:not(.has-nav) > .page-sub { grid-column: 1 / -1; }
  .view[data-route="review"]:not(.has-nav) > .section { margin-top: 0; }
}

/* ---------- 电脑：充分利用宽度，不改变业务层 ---------- */
@media (min-width: 1200px) {
  .view { padding-left: 128px; padding-right: 40px; }
  .view.no-tabbar { padding-left: 128px; padding-right: 40px; }
  .page-title { font-size: 40px; }
  .study-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .view[data-route="vocabulary"] .list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .view[data-route="vocabulary"] .lex-row:nth-child(odd) { border-right: 0; }
  .view[data-route="vocabulary"] .lex-row:not(:nth-child(3n)) { border-right: 1px solid var(--line); }
  .view[data-route="vocabulary"] .lex-row:nth-child(-n+3) { border-top: 0; }
  .action-grid, .test-grid { gap: 16px; }
}

@media (hover: hover) and (pointer: fine) {
  a.card:hover, button.card:hover, .lex-row:hover, .study-item:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(27,42,74,.10); }
  .btn:hover:not(:disabled), .chip:hover { filter: brightness(.97); }
}

/* ---------- 第二阶段：高质量单词卡 ---------- */
.img-wrap { position: relative; overflow: hidden; background: #FAF7F1; }
.img-wrap img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.img-wrap img.ok { opacity: 1; }
.img-wrap.broken::after { content: "插画加载失败"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }
.wcard { background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: 14px 14px 12px; text-align: center; }
.wcard-img { width: min(46vw, 184px); aspect-ratio: 1; border-radius: 26px; margin: 0 auto 4px; }
.wcard-img.art svg { width: 40%; height: 40%; }
.wcard-head { font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; word-break: break-word; }
.wcard-tags { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.voices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.voice { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 12px; border-radius: 16px; background: var(--surface-2); }
.voice .vi { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--vocab); flex: none; transition: transform .15s; }
.voice .vi svg { width: 20px; height: 20px; }
.voice.playing .vi { transform: scale(1.12); background: var(--vocab); color: #fff; }
.voice .vl { display: block; font-size: 15px; font-weight: 600; }
.voice .vl .en { font-weight: 500; color: var(--ink-2); }
.voice .vs { display: block; font-size: 11px; color: #8A5A00; }
.voice .vs.ok { color: var(--reading); }
.wsec { margin-top: 14px; }
.wsec-h { font-size: 15px; font-weight: 700; color: var(--ink-2); margin: 0 4px 8px; }
.colloc { display: flex; align-items: center; gap: 8px; padding: 10px 6px 10px 16px; }
.colloc + .colloc { border-top: 1px solid var(--line); }
.colloc .en { font-size: 16px; font-weight: 600; }
.colloc .muted { font-size: 13px; }
.colloc .icon-btn, .example .icon-btn { color: var(--vocab); }
.example + .example { margin-top: 10px; }
.example.theme { background: color-mix(in srgb, var(--reading) 9%, var(--surface)); }
.ex-tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--ink-3); margin-bottom: 2px; }
.example.theme .ex-tag { color: var(--reading); }
.meta-box summary { cursor: pointer; font-weight: 600; font-size: 15px; min-height: 28px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.meta-box summary::-webkit-details-marker { display: none; }
.meta-box summary .muted { font-size: 12px; font-weight: 400; }
.meta-box[open] summary { margin-bottom: 14px; }
.lex-thumb { width: 40px; height: 40px; border-radius: 12px; flex: none; object-fit: cover; background: #FAF7F1; }
.flash-img { width: 150px; height: 150px; border-radius: 26px; margin: 10px auto 0; }
.sample-entry { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; }
.sample-entry .thumbs { display: flex; flex: none; }
.sample-entry .thumbs img { width: 38px; height: 38px; border-radius: 12px; border: 2px solid var(--surface); margin-left: -10px; background: #FAF7F1; }
.sample-entry .thumbs img:first-child { margin-left: 0; }

.wsec + .wsec, .wcard + .wsec { margin-top: 12px; }
.notice.slim { padding: 7px 12px; margin: 0 0 10px; font-size: 12px; align-items: center; }
