/* ===== 每日学习 · UI 设计令牌（莫兰迪淡蓝系） ===== */
:root {
  /* 莫兰迪淡蓝主色 */
  --blue-50:#F5FAFC; --blue-100:#E6F3FA; --blue-200:#C8E4F2;
  --blue-300:#A8D4EC; --blue-400:#8EC4DE; --blue-500:#74B4D6;
  --blue-600:#5A9FC8; --blue-700:#4A8AB4;
  /* 低饱和粉 */
  --pink-50:#FFF5F9; --pink-100:#FDE8F0; --pink-200:#FAD0E2;
  /* 低饱和黄 */
  --yellow-50:#FFFBF0; --yellow-100:#FDF6E3;
  /* 强调紫 */
  --purple-accent:#7C6BFF; --purple-soft:#EDE9FF;
  /* 中性色 */
  --surface:#F5F7FA; --ink:#1F2937; --muted:#6B7280;
  --tertiary:#9CA3AF; --rule:#E8EAED;
  /* 圆角 */
  --r-sm:.75rem; --r-md:1rem; --r-lg:1.25rem; --r-xl:1.5rem;
  /* 阴影 */
  --shadow-card:0 1px 2px rgba(0,0,0,.03),0 2px 8px rgba(0,0,0,.02);
  --shadow-pop:0 4px 20px rgba(0,0,0,.06);
  /* 渐变 */
  --grad-active:linear-gradient(90deg,var(--blue-100),var(--pink-100));
  --grad-card-head:linear-gradient(135deg,var(--blue-100),var(--yellow-100));
  --grad-page:linear-gradient(180deg,var(--blue-50),var(--surface));
  --grad-warm:linear-gradient(135deg,var(--pink-50),var(--yellow-50));
  /* 动效 */
  --ease-ios:cubic-bezier(.32,.72,0,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--grad-page) fixed;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 84px;
}

/* ===== 页面切换 ===== */
.page { display: none; padding: 16px; max-width: 560px; margin: 0 auto; }
.page.active { display: block; }

.page-header { padding: 24px 4px 16px; }
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header .sub { color: var(--muted); margin-top: 4px; font-size: 13px; }

/* ===== 区块标题（带蓝色小条） ===== */
.section-title {
  font-size: 14px; font-weight: 600; margin: 8px 4px 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ""; width: 3px; height: 16px;
  border-radius: 2px; background: var(--blue-400);
}

/* ===== 卡片 ===== */
.card {
  background: #fff; border-radius: var(--r-lg);
  padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-card); border: 1px solid var(--rule);
}
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

/* ===== 进度条 ===== */
.progress {
  height: 8px; border-radius: 4px;
  background: var(--blue-100); overflow: hidden; margin-bottom: 8px;
}
.progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--blue-400), var(--blue-500));
  border-radius: 4px; transition: width .3s var(--ease-ios);
}
#progress-text { font-size: 13px; color: var(--muted); }

/* ===== 单词卡（暖色渐变） ===== */
.word-card {
  background: var(--grad-warm);
  border: 1px solid var(--rule);
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; cursor: pointer; user-select: none;
}
.word { font-size: 32px; font-weight: 700; }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.meaning { font-size: 20px; font-weight: 600; line-height: 1.6; }
.example { color: var(--muted); font-size: 13px; margin-top: 10px; }
.hidden { display: none; }
.hint.center { text-align: center; margin-top: 10px; }

/* ===== 按钮 ===== */
.btn {
  width: 100%; padding: 12px 20px; border: none;
  border-radius: var(--r-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform .15s var(--ease-ios);
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--blue-400); color: #fff; }
.btn:disabled { background: var(--rule); color: var(--tertiary); }

/* ===== 列表项 ===== */
.list-item { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.list-item .icon {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  background: var(--blue-50); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.list-item p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.list-item .chev { margin-left: auto; color: var(--tertiary); font-size: 22px; }

/* ===== 打卡 ===== */
.checkin-card { text-align: center; padding: 32px 16px; }
.streak { font-size: 40px; font-weight: 700; margin: 12px 0 20px; color: var(--blue-600); }

/* ===== 底部导航 ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: rgba(255,255,255,.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--rule);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; padding: 6px 0; border: none; background: none;
  font-size: 18px; color: var(--tertiary); border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: all .2s var(--ease-ios);
}
.tab span { font-size: 10px; }
.tab.active { background: var(--grad-active); color: var(--blue-600); font-weight: 600; }

/* ===== 阅读模块 ===== */
.badge {
  display: inline-block; font-size: 12px; color: var(--blue-700);
  background: var(--blue-100); border-radius: 6px;
  padding: 3px 8px; margin-bottom: 10px; font-weight: 600;
}
.today-card { cursor: pointer; }
.article-title { font-size: 17px; font-weight: 700; line-height: 1.4; }
.article-title.small { font-size: 15px; }
.article-meta { color: var(--muted); font-size: 12px; margin: 6px 0; }
.article-summary { font-size: 14px; line-height: 1.6; color: #374151; margin: 8px 0; }
.article-item { cursor: pointer; }

/* 版块筛选 */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 4px; }
.chip {
  flex: none; border: 1px solid var(--rule); background: #fff;
  border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted);
  transition: all .2s var(--ease-ios);
}
.chip.active { background: var(--grad-active); border-color: transparent; color: var(--blue-600); font-weight: 600; }

/* ===== 浮层 ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.25);
  z-index: 40; display: none; align-items: flex-end; justify-content: center;
}
.overlay:not(.hidden) { display: flex; }
.overlay-panel {
  background: #fff; width: 100%; max-width: 560px; max-height: 82vh;
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 20px 20px 36px;
  overflow-y: auto; position: relative;
  box-shadow: var(--shadow-pop);
}
.overlay-close {
  position: absolute; top: 12px; right: 12px; border: none;
  background: var(--surface); border-radius: 50%; width: 32px; height: 32px;
  font-size: 14px; color: var(--muted);
}
.reader-title { font-size: 20px; line-height: 1.45; margin: 8px 0 14px; }
.reader-summary { font-size: 16px; line-height: 1.9; }
.reader-link { display: block; text-decoration: none; text-align: center; margin-top: 20px; }

/* 可点查的单词 */
.w { cursor: pointer; border-radius: 3px; }
.w:active { background: var(--blue-100); }

/* ===== 词典弹窗（顶部） ===== */
.dict-popup {
  position: fixed; left: 12px; right: 12px;
  top: calc(12px + env(safe-area-inset-top));
  max-width: 536px; margin: 0 auto; z-index: 50;
}
.dict-body {
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--shadow-pop); font-size: 14px;
}
.dict-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.dict-head b { font-size: 18px; }
.phonetic { color: var(--muted); font-size: 13px; }
.dict-close {
  margin-left: auto; border: none; background: none;
  font-size: 14px; color: var(--tertiary);
}
.dict-trans { line-height: 1.7; color: #374151; margin-bottom: 12px; }
.dict-actions { display: flex; gap: 8px; }
.dict-actions .btn { flex: 1; }
.dict-sentence-btn { background: var(--blue-100); color: var(--blue-700); font-size: 14px; padding: 10px; }
.dict-vocab-btn { background: var(--pink-100); color: #C05080; font-size: 14px; padding: 10px; }
.dict-vocab-btn:disabled { background: var(--surface); color: var(--tertiary); }
.vocab-note { color: var(--blue-600); font-size: 13px; font-weight: 600; margin: -4px 0 12px; }

/* ===== 生词本 ===== */
.vocab-item {
  position: relative; padding: 12px;
  background: #fff; border: 1px solid var(--rule);
  border-radius: var(--r-md); margin-bottom: 10px;
}
.vocab-word { display: flex; align-items: baseline; gap: 8px; }
.vocab-word b { font-size: 16px; }
.vocab-reviews { margin-left: auto; font-size: 11px; color: var(--tertiary); padding-right: 24px; }
.vocab-trans { font-size: 13px; color: #374151; margin-top: 4px; line-height: 1.5; }
.vocab-src {
  font-size: 11px; color: var(--tertiary); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vocab-del {
  position: absolute; top: 10px; right: 10px;
  border: none; background: none; color: var(--tertiary); font-size: 13px; padding: 4px;
}

/* ===== 雅思词库 ===== */
.ielts-search {
  width: 100%; padding: 12px 16px; margin-bottom: 12px;
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: #fff; font-size: 14px; outline: none;
  transition: border-color .2s;
}
.ielts-search:focus { border-color: var(--blue-400); }
.ielts-star {
  position: absolute; top: 10px; right: 10px;
  border: 1px solid var(--rule); background: #fff; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; color: var(--blue-600);
}
.ielts-star:disabled { border: none; color: var(--tertiary); }

/* ===== 书架 ===== */
.book-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-top: 16px;
}
.book-tile { position: relative; text-align: center; cursor: pointer; }
.book-cover {
  width: 100%; aspect-ratio: 3/4; object-fit: cover;
  border-radius: var(--r-sm); box-shadow: var(--shadow-card);
  border: 1px solid var(--rule);
}
.book-cover-text {
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-card-head); color: var(--blue-700);
  font-size: 36px; font-weight: 700;
}
.book-name {
  font-size: 12px; font-weight: 600; margin-top: 6px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.book-author { font-size: 11px; color: var(--tertiary); }
.book-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 11px;
}

/* ===== 全屏阅读器 ===== */
.book-panel {
  width: 100%; max-width: 100%;
  height: 100vh; max-height: 100vh;
  height: 100dvh; max-height: 100dvh; /* 适配手机浏览器动态工具栏 */
  border-radius: 0; padding: 0;
  display: flex; flex-direction: column;
}
.reader-topbar {
  display: flex; align-items: center; gap: 6px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid var(--rule);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  flex: none;
}
.topbar-btn {
  border: none; background: var(--surface); border-radius: var(--r-sm);
  padding: 6px 10px; font-size: 14px; color: #374151; flex: none;
}
.topbar-title { flex: 1; min-width: 0; padding: 0 4px; font-weight: 600; font-size: 15px; }
.topbar-title #book-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.book-chapter-info { font-size: 11px; color: var(--tertiary); font-weight: 400; margin-top: 2px; }
.book-content {
  flex: 1; overflow-y: auto; padding: 20px 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px; line-height: 2.0; color: #1f2937;
  background: #fff;
}
.book-content h3 { font-size: 1.2em; margin: 18px 0 12px; }
.parablock { position: relative; margin-bottom: 14px; padding-right: 24px; }
.parablock p { margin: 0; }
.p-trans {
  position: absolute; top: 2px; right: 0;
  border: 1px solid var(--rule); background: #fff; border-radius: 6px;
  font-size: 10px; color: var(--tertiary); padding: 2px 5px;
  opacity: .75; font-family: -apple-system, "PingFang SC", sans-serif;
}
.trans-zh {
  background: var(--blue-50); border-left: 3px solid var(--blue-400);
  padding: 10px 12px; margin: 8px 0 2px; border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: .88em; line-height: 1.9; color: #374151;
  font-family: -apple-system, "PingFang SC", sans-serif;
}
.book-nav {
  display: flex; gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule); background: #fff; flex: none; margin: 0;
}
.book-nav .btn { flex: 1; background: var(--blue-100); color: var(--blue-700); }
.book-nav .btn:disabled { opacity: .4; }

/* 章节目录 */
.toc-panel { max-height: 72vh; }
.toc-item {
  display: block; width: 100%; text-align: left;
  padding: 13px 4px; border: none; background: none;
  border-bottom: 1px solid var(--surface); font-size: 14px; color: #374151;
  border-radius: var(--r-sm);
}
.toc-item.active {
  background: var(--grad-active);
  color: var(--blue-600); font-weight: 600;
}

/* ===== 首页模式切换 ===== */
.mode-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.mode-tab {
  flex: 1; padding: 9px; border-radius: var(--r-sm);
  border: 1px solid var(--rule); background: #fff;
  font-size: 13px; color: var(--muted);
  transition: all .2s var(--ease-ios);
}
.mode-tab.active {
  background: var(--grad-active); border-color: transparent;
  color: var(--blue-600); font-weight: 600;
}

/* ===== 目录/书签面板 ===== */
.toc-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.toc-tab {
  flex: 1; padding: 8px; border-radius: var(--r-sm);
  border: 1px solid var(--rule); background: #fff;
  font-size: 13px; color: var(--muted);
}
.toc-tab.active {
  background: var(--grad-active); border-color: transparent;
  color: var(--blue-600); font-weight: 600;
}
.toc-meta { float: right; color: var(--tertiary); font-size: 12px; }
.topbar-btn.active { background: var(--yellow-100); }

/* ===== 摘抄 ===== */
#excerpt-fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 100px; z-index: 60; border: none; border-radius: 999px;
  background: var(--purple-accent); color: #fff;
  padding: 11px 20px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-pop);
}
.excerpt-panel { text-align: center; }
#excerpt-img {
  width: 100%; border-radius: var(--r-md);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-card); margin-bottom: 10px;
}
.excerpt-panel .btn { display: block; text-decoration: none; }

/* ===== 关于/版本 ===== */
.about-version { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
#btn-update { background: var(--surface); color: var(--muted); }
