:root {
  --bg: #fbf7f0;
  --bg-soft: #f3ece0;
  --card: #ffffff;
  --primary: #5a9e6f;
  --primary-dark: #48815a;
  --accent: #ef9a4d;
  --text: #3a3a3a;
  --text-soft: #7a756d;
  --border: #eadfcf;
  --danger: #d9756b;
  --shadow: 0 4px 18px rgba(120, 100, 70, 0.10);
  --radius: 14px;
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.boot-loading { text-align: center; padding: 120px 0; color: var(--text-soft); }

/* ---------- 通用容器 ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 50;
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.topbar-right .chip {
  background: rgba(255,255,255,0.18); padding: 4px 10px; border-radius: 20px; white-space: nowrap;
}
.topbar-right .chip b { font-weight: 700; }

/* ---------- 顶栏孩子信息徽标（主信息 + 副信息两行） ---------- */
.child-badge {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  background: rgba(255,255,255,0.16); border: none; color: #fff;
  padding: 4px 12px; border-radius: 12px; cursor: pointer;
  font-family: inherit; text-align: left; line-height: 1.3;
  transition: background 0.15s ease;
}
.child-badge:hover { background: rgba(255,255,255,0.26); }
.child-badge-main { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; white-space: nowrap; }
.child-badge-sub {
  font-size: 12px; font-weight: 400; color: rgba(255,255,255,0.82);
  white-space: nowrap; margin-top: 1px;
}
.child-badge-sep { margin: 0 6px; opacity: 0.6; }

/* ---------- 开发测试模式标记（DEV_MODE=true 时才出现） ---------- */
/* 黄色小标签，提醒当前额度不受每日限制，仅用于本地调试 */
.dev-tag {
  display: inline-block; vertical-align: middle;
  margin-left: 6px; padding: 1px 6px; border-radius: 8px;
  background: #fbbf24; color: #422006;
  font-size: 11px; font-weight: 700; line-height: 1.5;
  white-space: nowrap;
}
.chip-quota.chip-dev { background: rgba(251,191,36,0.28); }
.npc-quota-chip.chip-dev { background: #fef3c7; border: 1px solid #fbbf24; color: #78350f; }
.dev-tip { color: #92400e; font-size: 12px; margin-top: 6px; }

/* 中等屏（平板 / 窄窗口）：让品牌可压缩并收起日期与密钥，防止顶栏被挤爆 */
@media (max-width: 1000px) {
  .topbar .container { gap: 10px; }
  .brand { flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { gap: 10px; flex: none; }
  .chip-key { display: none; }
}
.btn-logout {
  background: rgba(255,255,255,0.22); color: #fff; border: none; padding: 6px 14px;
  border-radius: 20px; cursor: pointer; font-size: 13px;
}
.btn-logout:hover { background: rgba(255,255,255,0.34); }

/* ---------- 标签页 ---------- */
.tabs {
  background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 60px; z-index: 40; box-shadow: 0 2px 8px rgba(120,100,70,0.05);
}
.tabs .container { display: flex; gap: 4px; overflow-x: auto; }
.tab {
  padding: 14px 18px; cursor: pointer; white-space: nowrap; font-size: 14px;
  color: var(--text-soft); border-bottom: 3px solid transparent; transition: .15s;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- 布局 ---------- */
.layout { display: flex; gap: 20px; padding: 22px 0 60px; align-items: flex-start; }
.sidebar { width: 190px; flex-shrink: 0; }
.sidebar .side-title { font-size: 13px; color: var(--text-soft); margin: 6px 8px 8px; }
.side-item {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text); font-size: 14px;
}
.side-item:hover { background: var(--bg-soft); }
.side-item.active { background: #e7f1ea; color: var(--primary-dark); font-weight: 600; }
.main { flex: 1; min-width: 0; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; }
.card h2 { font-size: 17px; margin-bottom: 6px; color: var(--primary-dark); }
.card .sub { color: var(--text-soft); font-size: 13px; margin-bottom: 14px; }

.placeholder {
  background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 60px 20px; text-align: center; color: var(--text-soft);
}
.placeholder .big { font-size: 20px; color: var(--text); margin-bottom: 8px; }
.placeholder .tag { display: inline-block; margin-top: 12px; background: var(--bg-soft); padding: 4px 14px; border-radius: 20px; font-size: 13px; }

/* ---------- 首页仪表盘 ---------- */
.dash { display: flex; flex-wrap: wrap; gap: 18px; }
.dash .child-info { flex: 1; min-width: 240px; }
.info-row { display: flex; gap: 14px; margin-top: 10px; }
.info-row .item { flex: 1; background: var(--bg-soft); border-radius: 10px; padding: 10px 12px; }
.info-row .item .k { font-size: 12px; color: var(--text-soft); }
.info-row .item .v { font-size: 18px; font-weight: 700; color: var(--primary-dark); }
.hint {
  margin-top: 16px; background: #fff7ec; border: 1px solid #f3e0c4; color: #9a6b2f;
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
}
.quota-box { width: 220px; flex-shrink: 0; }
.quota-box .q { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.quota-box .q:last-child { border-bottom: none; }
.quota-box .q .num { font-weight: 700; color: var(--accent); }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-soft); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; background: #fff; color: var(--text); font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(90,158,111,0.15); }
.form-control.masked { letter-spacing: 2px; color: var(--text-soft); }
.btn {
  padding: 10px 20px; border: none; border-radius: 10px; cursor: pointer; font-size: 14px;
  background: var(--primary); color: #fff; font-weight: 600; transition: .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: var(--bg-soft); color: var(--text); }
.btn.secondary:hover { background: #e6dccb; }
.btn.ghost { background: transparent; color: var(--text-soft); border: 1px solid var(--border); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.msg { font-size: 13px; margin-top: 10px; }
.msg.ok { color: var(--primary-dark); }
.msg.err { color: var(--danger); }
.meta-line { font-size: 12px; color: var(--text-soft); margin-top: 8px; }

/* ---------- 登录 / 改密页 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 380px; max-width: 100%; }
.auth-card .logo { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: 22px; font-weight: 700; color: var(--primary-dark); margin-bottom: 4px; }
.auth-card .logo-sub { text-align: center; color: var(--text-soft); font-size: 13px; margin-bottom: 22px; }
/* 品牌LOGO图（后台 settings.brand_logo 驱动，未配置时前端不输出 img） */
.brand-logo-img { width: auto; object-fit: contain; border-radius: 6px; flex: none; }
.brand .brand-logo-img { display: block; background: rgba(255,255,255,.85); padding: 2px; }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ---------- 协议弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(60,50,40,0.5); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius); width: 620px; max-width: 100%; max-height: 86vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); font-weight: 700; color: var(--primary-dark); }
.modal-body { padding: 18px 22px; overflow-y: auto; font-size: 14px; }
.modal-body h4 { margin: 14px 0 6px; color: var(--text); }
.modal-body ol { padding-left: 20px; }
.modal-body li { margin-bottom: 8px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.agree-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.agreement-body { max-height: 45vh; overflow-y: auto; font-size: 14px; line-height: 1.7; margin-bottom: 14px; }
.agreement-body ol { padding-left: 20px; margin: 8px 0; }
.agreement-body li { margin-bottom: 8px; }
.exit-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-soft); }

.small { font-size: 12px; color: var(--text-soft); }

/* ---------- PDF 阅读器 ---------- */
.reader-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.reader-title { font-weight: 700; font-size: 16px; color: var(--primary-dark); }
.reader-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-info { font-size: 13px; color: var(--text-soft); min-width: 72px; text-align: center; }
.reader-body { display: flex; gap: 14px; align-items: flex-start; }
.doc-list { width: 180px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; }
.doc-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid var(--border);
  background: #fff; font-size: 13px; text-align: left; color: var(--text); font-family: inherit;
}
.doc-item:hover { border-color: var(--primary); }
.doc-item.active { background: #e7f1ea; border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.reader-stage {
  flex: 1; min-width: 0; background: var(--bg-soft); border-radius: 12px;
  padding: 16px; position: relative; overflow: hidden;
}
.reader-empty { color: var(--text-soft); text-align: center; padding: 40px 16px; }
#book { width: 100%; margin: 0 auto; }
.page { background: #fff; overflow: hidden; box-shadow: 0 2px 14px rgba(0,0,0,0.12); }
.page canvas { width: 100%; height: 100%; display: block; }
.fallback-page {
  position: relative;
  width: 100%;
  min-height: 60vh;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  touch-action: none;
}
.fallback-zoom { position: relative; display: inline-block; line-height: 0; }
.fallback-page canvas {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  border-radius: 2px;
  will-change: transform;
}
.btn.disabled { opacity: .5; pointer-events: none; }

/* ---------- 书签 / 页码笔记 ---------- */
/* 笔记按钮上的小圆点标记（当前页已有笔记时） */
#noteBtn.has-note { position: relative; }
#noteBtn.has-note::after {
  content: ''; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: #e11d48; box-shadow: 0 0 0 2px #fff;
}
/* 书签面板（阅读器右侧滑出） */
.bm-panel {
  width: 260px; flex-shrink: 0; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; display: flex; flex-direction: column; max-height: 72vh;
}
.bm-panel-head {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 12px;
  border-bottom: 1px solid var(--border); font-weight: 700; color: var(--primary-dark); font-size: 14px;
}
.bm-panel-actions { display: flex; align-items: center; gap: 6px; }
.bm-close { border: none; background: none; font-size: 16px; cursor: pointer; color: var(--text-soft); padding: 4px 6px; }
.bm-close:hover { color: var(--text); }
.small-btn { padding: 5px 10px; font-size: 12px; min-height: 30px; }
.bm-panel-body { padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.bm-item { display: flex; align-items: flex-start; gap: 4px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.bm-jump { flex: 1; border: none; background: none; text-align: left; cursor: pointer; font-family: inherit; padding: 0; }
.bm-doc { display: block; font-size: 12px; color: var(--text-soft); }
.bm-page { display: block; font-size: 14px; font-weight: 600; color: var(--primary-dark); }
.bm-note { display: block; font-size: 12px; color: var(--text); margin-top: 2px; white-space: normal; }
.bm-del { border: none; background: none; color: var(--text-soft); cursor: pointer; font-size: 14px; padding: 2px 4px; flex-shrink: 0; }
.bm-del:hover { color: #e11d48; }
/* 书签/笔记弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: none;
  align-items: center; justify-content: center; z-index: 10000; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 14px; width: 440px; max-width: 100%;
  display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.modal-title { padding: 16px 18px 0; font-weight: 700; color: var(--primary-dark); font-size: 15px; }
.modal-input {
  margin: 12px 18px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; min-height: 80px; resize: vertical; color: var(--text);
}
.modal-input:focus { outline: none; border-color: var(--primary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; }

/* ---------- 矩形区域高亮 ---------- */
/* 高亮层：叠在 canvas 上，显示已保存的矩形高亮 */
.highlight-layer { pointer-events: none; }
.hl-rect { pointer-events: none; }

/* 标记模式：阅读区进入框选状态（黄色虚线描边 + 十字光标），提示用户当前拖拽=框选而非翻页 */
.reader-stage.hl-mode {
  outline: 2px dashed #eab308;
  outline-offset: -6px;
  cursor: crosshair;
}
.reader-stage.hl-mode .page,
.reader-stage.hl-mode .fallback-page,
.reader-stage.hl-mode canvas {
  cursor: crosshair;
}

/* 拖拽画框时的临时框 */
.hl-drag { border-radius: 3px; }

/* 高亮颜色菜单（悬浮） */
.hl-menu {
  position: fixed;
  z-index: 12000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
}
.hl-color {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid #e5e0d8; background: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.hl-color i {
  width: 20px; height: 20px; border-radius: 50%; display: block;
}
.hl-color.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(90,158,111,0.35); }
.hl-remove {
  border: none; background: none; color: var(--danger); cursor: pointer;
  font-size: 13px; padding: 6px 8px; white-space: nowrap; font-family: inherit;
}
.hl-remove:hover { text-decoration: underline; }
@media (max-width: 720px) {
  .hl-menu { gap: 6px; padding: 8px; }
  .hl-color { width: 38px; height: 38px; }
  .hl-color i { width: 24px; height: 24px; }
  .hl-remove { padding: 10px 10px; font-size: 14px; }
}

/* 高亮文字输入框（选色后弹出，填写/粘贴重点内容） */
.hl-text-input {
  position: fixed;
  z-index: 12001;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.28);
  padding: 14px;
}
.hl-text-input-title {
  font-size: 13px; font-weight: 600; color: var(--primary-dark); margin-bottom: 6px;
}
.hl-text-input-hint {
  font-size: 12px; color: var(--text-soft); margin-bottom: 8px; line-height: 1.5;
}
.hl-text-input-area {
  width: 100%; min-height: 84px; resize: vertical;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; color: var(--text);
  box-sizing: border-box;
}
.hl-text-input-area:focus { outline: none; border-color: var(--primary); }
.hl-text-input-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px;
}
.hl-text-cancel {
  border: 1px solid var(--border); background: #fff; color: var(--text-soft);
  border-radius: 10px; padding: 7px 14px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.hl-text-cancel:hover { background: var(--bg-soft); }
.hl-text-save {
  border: none; background: var(--primary); color: #fff;
  border-radius: 10px; padding: 7px 16px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.hl-text-save:hover { background: var(--primary-dark); }

/* 摘录列表里无文字内容的占位 */
.hl-text-empty { color: var(--text-soft); font-style: italic; }

/* ---------- 我的重点摘录 ---------- */
.hl-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.hl-filter-btn {
  padding: 7px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 13px; color: var(--text); font-family: inherit;
}
.hl-filter-btn.active { background: #e7f1ea; border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.hl-list { display: flex; flex-direction: column; gap: 10px; }
.hl-item {
  display: flex; align-items: flex-start; gap: 6px;
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
  background: #fff; transition: box-shadow .15s;
}
.hl-item:hover { box-shadow: var(--shadow); }
.hl-item-main {
  flex: 1; display: flex; align-items: flex-start; gap: 10px;
  border: none; background: none; text-align: left; cursor: pointer; padding: 0; font-family: inherit;
}
.hl-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; display: block; }
.hl-item-body { flex: 1; min-width: 0; }
.hl-meta { font-size: 12px; color: var(--text-soft); margin-bottom: 3px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.hl-manual-tag {
  display: inline-block; font-size: 11px; line-height: 1;
  padding: 2px 6px; border-radius: 6px;
  background: #fef3c7; color: #b45309; border: 1px solid #fcd34d;
  white-space: nowrap;
}
.hl-text { font-size: 14px; color: var(--text); line-height: 1.6; word-break: break-word; }
.hl-item-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.hl-del {
  border: none; background: none; cursor: pointer; color: var(--text-soft);
  font-size: 16px; padding: 4px 6px; line-height: 1;
}
.hl-del:hover { color: var(--danger); }


/* 全屏阅读模式 */
.reader-body:fullscreen {
  background: #1f2937;
  padding: 24px;
  align-items: center;
  justify-content: center;
  overflow: auto;
}
.reader-body:fullscreen .doc-list {
  background: rgba(255,255,255,0.92);
  padding: 12px;
  border-radius: 12px;
  max-height: 90vh;
  overflow: auto;
}
.reader-body:fullscreen .reader-stage {
  background: transparent;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reader-body:fullscreen #book {
  /* 必须给明确宽度：auto 会让容器塌缩，stretch 模式取不到父宽度导致书不放大 */
  width: calc(100vw - 280px);
  max-width: 1400px;
}
.btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   全屏悬浮工具栏（挂载在 reader-body 内，原生全屏/伪全屏均显示）
   ============================================================ */
.fs-toolbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(31, 41, 55, 0.92);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
}
.fs-toolbar.show { display: flex; }
.fs-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.fs-btn:hover { background: rgba(255,255,255,0.24); }
.fs-btn:active { background: rgba(255,255,255,0.3); }
.fs-btn.fs-exit {
  background: rgba(217,117,107,0.9);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
}
.fs-btn.fs-exit:hover { background: #d9756b; }
.fs-page {
  min-width: 72px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
  white-space: nowrap;
}
.fs-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.2); }
/* 全屏工具栏「标记」按钮激活态 */
.fs-btn.active { background: #eab308; color: #1f2937; }
.fs-btn.active:hover { background: #facc15; }
/* 全屏笔记按钮红点 */
.fs-btn.fs-note-btn { position: relative; }
#fsNote.has-note { position: relative; }
#fsNote.has-note::after {
  content: ''; position: absolute; top: 8px; right: 8px; width: 9px; height: 9px;
  border-radius: 50%; background: #e11d48; box-shadow: 0 0 0 2px rgba(31,41,55,0.9);
}

/* 手机端伪全屏（CSS fixed，不用原生 Fullscreen API，避免系统横屏） */
.reader-body.fs-pseudo {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #1f2937;
  padding: 10px;
  flex-direction: column;
  align-items: stretch;
  overflow: auto;
}
.reader-body.fs-pseudo .doc-list {
  background: rgba(255,255,255,0.92);
  padding: 10px;
  border-radius: 12px;
  max-height: 34vh;
  overflow: auto;
}
.reader-body.fs-pseudo .reader-stage {
  background: transparent;
  overflow: auto;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.reader-body.fs-pseudo .fallback-page canvas {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
/* 伪全屏时隐藏文档列表，让悬浮工具栏独占底部、阅读区最大化 */
.reader-body.fs-pseudo .doc-list { display: none; }

/* PC 端默认隐藏移动端专用元素（手机媒体查询内再显示） */
.info-toggle { display: none; }
.info-dropdown { display: none; }
.side-toggle { display: none; }

/* 移动端：列表与舞台纵向堆叠 */
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
  .sidebar .side-title { display: none; }
  .side-item { width: auto; }
  .reader-body { flex-direction: column; }
  .doc-list { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .doc-item { width: auto; }
}

/* ============================================================
   移动端适配（手机 375px~430px）
   ============================================================ */
@media (max-width: 720px) {
  .container { padding: 0 12px; }

  /* ---------- 顶栏：品牌压缩 + 孩子徽标精简，保证窄屏不溢出 ---------- */
  .topbar .container { height: 52px; gap: 8px; }
  .brand { font-size: 15px; letter-spacing: 0; gap: 5px; flex: 1 1 auto; min-width: 0; overflow: hidden; }
  /* 窄屏保留品牌文字并允许截断，把横向空间让给孩子信息，避免挤压换行 */
  .brand-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 隐藏日期与密钥 chip，保留额度 chip、退出按钮与信息下拉开关 */
  .topbar-right .chip { display: none; }
  .topbar-right .chip-quota { display: inline-block; font-size: 11px; padding: 3px 8px; }
  .topbar-right { gap: 8px; flex: none; }
  /* 孩子徽标：手机端隐藏「生日」，只留「姓名（性别） | 命格」；
     点击徽标可在下方信息面板里查看生日等完整信息 */
  .child-badge { padding: 3px 8px; border-radius: 10px; }
  .child-badge-main { font-size: 14px; }
  .child-badge-sub { font-size: 11px; margin-top: 0; }
  .child-badge-birth, .child-badge-sep { display: none; }
  .btn-logout { padding: 6px 12px; font-size: 12px; }
  .info-toggle {
    display: flex;
    align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,0.22); color: #fff; border: none;
    font-size: 15px; cursor: pointer;
  }
  .info-dropdown {
    display: none;
    background: #fff; color: var(--text);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    padding: 6px 0;
  }
  .info-dropdown.open { display: block; }
  .info-dropdown-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; font-size: 13px;
    border-bottom: 1px solid var(--bg-soft);
  }
  .info-dropdown-row:last-child { border-bottom: none; }
  .info-dropdown-row span { color: var(--text-soft); }
  .info-dropdown-row b { color: var(--text); font-weight: 600; }

  /* ---------- 标签页：横向滑动，不换行，加大点击区 ---------- */
  .tabs { top: 52px; }
  .tabs .container { gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs .container::-webkit-scrollbar { display: none; }
  .tab { padding: 13px 16px; font-size: 13px; flex-shrink: 0; }

  /* ---------- 布局：侧边栏折叠为抽屉 ---------- */
  .layout { padding-top: 14px; gap: 0; }
  .sidebar { width: 100%; display: block; }
  .side-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 12px 14px; background: var(--card);
    border: 1px solid var(--border); border-radius: 12px;
    font-size: 14px; font-weight: 600; color: var(--primary-dark);
    cursor: pointer; font-family: inherit; text-align: left;
    box-shadow: var(--shadow);
  }
  .side-toggle::after { content: '▾'; }
  .sidebar #sideBar {
    display: none;
    margin-top: 8px;
    flex-direction: column; gap: 4px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 12px; padding: 8px; box-shadow: var(--shadow);
  }
  .sidebar #sideBar.open { display: flex; }
  .sidebar .side-item { width: 100%; text-align: left; padding: 13px 14px; font-size: 14px; }
  .main { width: 100%; }

  /* ---------- 卡片与首页 ---------- */
  .card { padding: 16px; }
  .card h2 { font-size: 16px; }
  .dash { flex-direction: column; gap: 12px; }
  .dash .child-info { min-width: 0; }
  .info-row { gap: 8px; }
  .info-row .item { padding: 10px; }
  .info-row .item .v { font-size: 16px; }
  .quota-box { width: 100%; }

  /* ---------- 登录 / 协议 / 改密 ---------- */
  .auth-wrap { padding: 12px; }
  .auth-card { width: 100%; max-width: 380px; }
  .modal-mask { padding: 10px; align-items: flex-start; }
  .modal { width: 100%; max-width: 620px; max-height: 92vh; }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; flex-direction: column; align-items: stretch; }
  .modal-foot .agree-check { font-size: 13px; }
  .modal-foot > div { display: flex; gap: 10px; }
  .modal-foot > div .btn { flex: 1; }

  /* ---------- API 密钥管理：按钮换行、易点按 ---------- */
  .btn-row { gap: 8px; }
  .btn-row .btn { flex: 1 1 auto; min-height: 44px; font-size: 14px; }

  /* ---------- 阅读器 ---------- */
  .reader-bar { gap: 8px; }
  .reader-title { font-size: 15px; }
  .reader-controls { gap: 6px; width: 100%; justify-content: center; }
  .reader-controls .btn { padding: 10px 14px; font-size: 14px; min-height: 44px; }
  .reader-controls #prevBtn,
  .reader-controls #nextBtn { flex: 1; }
  /* 下载与全屏按钮等宽、不拉伸，保持一致大小 */
  .reader-controls #dlBtn,
  .reader-controls #fsBtn { flex: 0 0 auto; text-align: center; }
  .page-info { min-width: 56px; font-size: 13px; }
  .reader-stage { padding: 8px; }
  .reader-body:fullscreen { padding: 8px; flex-direction: column; align-items: center; }
  .reader-body:fullscreen #book { width: 100%; }
  .reader-body:fullscreen .reader-stage {
    width: 100%;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }
  .reader-body:fullscreen .doc-list {
    max-height: 30vh;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  /* 手机端单页浏览：容器可容纳放大内容 */
  .fallback-page { min-height: 65vh; }

  /* ---------- 书签 / 笔记：移动端 ---------- */
  #bmBtn, #noteBtn { flex: 0 0 auto; text-align: center; }
  .bm-panel {
    position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto;
    width: auto; max-height: 55vh; z-index: 2500; border-radius: 14px;
  }
  .bm-panel .bm-panel-body { max-height: calc(55vh - 50px); }
  .modal-box { width: 100%; max-width: 100%; border-radius: 14px; }
  .modal-input { min-height: 100px; font-size: 16px; }
  .modal-actions .btn { min-height: 44px; font-size: 14px; }
  .modal-actions #modalDelete { margin-right: auto; }
  /* 全屏保持竖屏：A4 竖幅文档完整显示在竖屏内，不横向拉伸 */
  .reader-body:fullscreen .fallback-page {
    min-height: 0;
    height: 100%;
    align-items: center;
    justify-content: center;
  }
  .reader-body:fullscreen .fallback-page canvas {
    max-width: 100%;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /* ---------- 全屏悬浮工具栏：移动端 ---------- */
  /* 伪全屏（手机实际走这条）+ 原生全屏（F12 窄屏）都适配 */
  .fs-toolbar {
    left: 8px;
    right: 8px;
    bottom: 10px;
    transform: none;
    border-radius: 16px;
    padding: 8px 6px;
    gap: 4px;
    justify-content: space-between;
  }
  .fs-btn {
    min-width: 44px;
    height: 46px;
    padding: 0 10px;
    font-size: 17px;
    flex-shrink: 0;
  }
  .fs-btn.fs-exit {
    padding: 0 12px;
    font-size: 14px;
  }
  .fs-page { min-width: 56px; font-size: 13px; flex-shrink: 0; }
  .fs-sep { display: none; } /* 手机上省空间，去掉分隔线 */
  /* 手机全屏时阅读区底部留出工具栏空间，避免被遮挡 */
  .reader-body.fs-pseudo { padding-bottom: 72px; }
  .reader-body:fullscreen { padding-bottom: 72px; }
  /* 弹窗移动端全屏自适应、可滚动 */
  .modal-mask { padding: 10px; align-items: flex-start; }
  .modal-box { max-height: 88vh; overflow: auto; }

  /* ---------- 矩形高亮：移动端 ---------- */
  .hl-menu {
    padding: 6px 8px;
    gap: 6px;
    border-radius: 14px;
  }
  .hl-color { width: 40px; height: 40px; }
  .hl-color i { width: 26px; height: 26px; }
  .hl-remove { font-size: 14px; padding: 10px 10px; }

  /* ---------- 我的重点摘录：移动端 ---------- */
  .hl-filter { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .hl-filter::-webkit-scrollbar { display: none; }
  .hl-filter-btn { flex-shrink: 0; padding: 8px 14px; font-size: 14px; }
  .hl-item { padding: 12px 10px; }
  .hl-item-main { gap: 10px; }
  .hl-item-actions { flex-direction: row; align-items: center; gap: 8px; }
  .hl-del { font-size: 20px; padding: 8px; min-width: 36px; text-align: center; }
}

/* ============================================================
   通用弹窗与表单控件（日记弹窗等复用）
   说明：周成长任务模块已下线，此处仅保留弹窗骨架与输入控件样式，
        供「家庭观察日记」的写日记 / 编辑日记弹窗使用。
   ============================================================ */

/* 弹窗（遮罩 + 居中卡片，自适应屏幕） */
.task-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 13000;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.task-modal {
  width: 420px;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.32);
  padding: 20px;
  box-sizing: border-box;
}
.task-modal-title {
  font-size: 17px; font-weight: 700; color: var(--text);
  margin-bottom: 16px;
}
.task-field { margin-bottom: 14px; }
.task-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-soft); margin-bottom: 6px;
}
.task-input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; color: var(--text);
  background: #fff;
}
.task-input:focus { outline: none; border-color: var(--primary); }
.task-textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.task-modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px;
}
.task-btn-cancel {
  border: 1px solid var(--border); background: #fff; color: var(--text-soft);
  border-radius: 10px; padding: 9px 16px; cursor: pointer; font-size: 14px; font-family: inherit;
}
.task-btn-cancel:hover { background: var(--bg-soft); }
.task-btn-save {
  border: none; background: var(--primary); color: #fff;
  border-radius: 10px; padding: 9px 20px; cursor: pointer; font-size: 14px; font-family: inherit;
}
.task-btn-save:hover { background: var(--primary-dark); }

/* ============================================================
   家庭观察日记
   ============================================================ */
.diary-module { padding-top: 4px; }
/* 板块页签（观察日记 / 周复盘报告） */
.diary-tabs {
  display: flex; gap: 8px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); margin-bottom: 18px;
}
.diary-tab {
  border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 600; color: var(--text-soft);
  padding: 12px 4px; margin-bottom: -1px; border-bottom: 2px solid transparent;
}
.diary-tab:hover { color: var(--primary); }
.diary-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

.diary-view { min-height: 120px; }
.diary-list-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.diary-add-btn { white-space: nowrap; flex-shrink: 0; }

.diary-list { display: flex; flex-direction: column; gap: 12px; }
.diary-item {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  background: #fff;
}
.diary-item-main {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 0; cursor: pointer; font-family: inherit;
}
.diary-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.diary-date { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.diary-ai-tag {
  font-size: 12px; padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.diary-ai-tag.pending { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.diary-ai-tag:not(.pending) { background: #ede9fe; color: #6d28d9; border: 1px solid #c4b5fd; }
.diary-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.diary-summary {
  font-size: 14px; color: var(--text); line-height: 1.6; word-break: break-word;
  white-space: pre-wrap;
}
.diary-expand-hint { font-size: 12px; color: var(--primary); margin-top: 4px; }

/* 展开的详情区 */
.diary-detail { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 12px; }
.diary-detail-label { font-size: 12px; color: var(--text-soft); margin-bottom: 4px; }
.diary-detail-content {
  font-size: 14px; color: var(--text); line-height: 1.7; word-break: break-word;
  white-space: pre-wrap; margin-bottom: 12px;
}
/* 「AI解读」按钮 */
.diary-ai-btn {
  border: 1px solid var(--primary); background: #eef6f0; color: var(--primary-dark);
  cursor: pointer; font-size: 13px; padding: 6px 14px; border-radius: 8px;
  font-family: inherit; font-weight: 600;
}
.diary-ai-btn:hover { background: var(--primary); color: #fff; }

/* AI 解读区：浅绿色背景 + 「AI专属顾问解读」标注，与日记原文明确分离 */
.diary-ai-box {
  margin-top: 12px; border: 1px solid #cfe3d6; border-radius: 10px;
  padding: 12px; background: #eef8f1;
}
.diary-ai-box.hidden { display: none; }
.diary-ai-title { font-size: 13px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
.diary-ai-text {
  font-size: 14px; color: var(--text); line-height: 1.75;
  white-space: pre-wrap; word-break: break-word;
}
.diary-ai-empty { font-size: 13px; color: var(--text-soft); }
.diary-ai-loading { font-size: 13px; color: var(--primary-dark); }
.diary-ai-fail { font-size: 13px; color: #b45309; }

.diary-item-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.diary-edit, .diary-del {
  border: none; cursor: pointer; font-size: 13px; padding: 6px 14px; font-family: inherit;
  border-radius: 8px; background: #f1f5f9; color: var(--text-soft);
}
.diary-edit:hover { color: var(--primary); background: #e7f1ea; }
.diary-del { color: #b91c1c; }
.diary-del:hover { color: #fff; background: var(--danger); }

/* 日记弹窗（内容框更高） */
.diary-modal { width: 480px; }
.diary-content { min-height: 140px; }

/* 周复盘报告（数据源：仅本周的家庭观察日记） */
.report-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.report-title { font-size: 17px; font-weight: 700; color: var(--text); }
.report-range { font-size: 13px; color: var(--text-soft); margin-top: 4px; }
.report-meta { font-size: 12px; color: var(--text-soft); margin-bottom: 10px; }
.report-text {
  font-size: 15px; color: var(--text); line-height: 1.8;
  white-space: pre-wrap; word-break: break-word;
}
.report-hint { font-size: 14px; color: var(--text-soft); margin-bottom: 12px; }
.report-diary-list { display: flex; flex-direction: column; gap: 8px; }
.report-diary-row {
  display: flex; gap: 10px; align-items: baseline;
  border-left: 3px solid #cfe3d6; padding: 6px 10px;
  background: var(--bg-soft); border-radius: 0 8px 8px 0;
}
.report-diary-date { font-size: 12px; color: var(--text-soft); flex-shrink: 0; }
.report-diary-title { font-size: 14px; color: var(--text); word-break: break-word; }
.report-fail { margin-top: 12px; font-size: 13px; color: #b45309; }

/* ============================================================
   AI 私人咨询室
   ============================================================ */
.consult-wrap {
  display: flex; gap: 14px; align-items: stretch;
  height: calc(100vh - 190px); min-height: 480px;
}
/* 左侧会话列表 */
.consult-sidebar {
  width: 240px; flex-shrink: 0; border: 1px solid var(--border); border-radius: 12px;
  background: #fff; display: flex; flex-direction: column; overflow: hidden;
}
.consult-side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px; border-bottom: 1px solid var(--border);
}
.consult-side-title { font-size: 14px; font-weight: 600; color: var(--text); }
.consult-new-btn {
  border: none; background: var(--primary); color: #fff; cursor: pointer;
  border-radius: 8px; padding: 6px 10px; font-size: 12px; font-family: inherit; white-space: nowrap;
}
.consult-new-btn:hover { background: var(--primary-dark); }
.consult-session-list { flex: 1; overflow-y: auto; padding: 8px; }
.consult-session-item {
  display: flex; align-items: center; gap: 4px; border-radius: 8px; margin-bottom: 4px;
  transition: background .15s;
}
.consult-session-item.active { background: #e7f1ea; }
.consult-session-main {
  flex: 1; text-align: left; border: none; background: none; cursor: pointer;
  padding: 8px 6px; font-family: inherit; min-width: 0;
}
.consult-session-item.active .consult-session-title { color: var(--primary-dark); }
.consult-session-title {
  font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.consult-session-time { font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.consult-session-del {
  border: none; background: none; cursor: pointer; color: var(--text-soft);
  font-size: 14px; padding: 4px 8px; flex-shrink: 0;
}
.consult-session-del:hover { color: var(--danger); }

/* 右侧聊天区 */
.consult-main {
  flex: 1; border: 1px solid var(--border); border-radius: 12px; background: #fff;
  display: flex; flex-direction: column; overflow: hidden;
}
.consult-chat-head {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--text);
}
.consult-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.msg-row { display: flex; align-items: flex-end; gap: 6px; max-width: 78%; }
.msg-row.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.assistant { align-self: flex-start; }
.msg-bubble {
  padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.6;
  word-break: break-word; white-space: pre-wrap;
}
.msg-row.user .msg-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg-row.assistant .msg-bubble { background: var(--bg-soft); color: var(--text); border-bottom-left-radius: 4px; }
.msg-fav {
  border: none; background: none; cursor: pointer; font-size: 16px; padding: 2px 4px;
  opacity: .55; transition: opacity .15s; flex-shrink: 0;
}
.msg-fav:hover { opacity: 1; }

/* 输入栏 */
.consult-input-bar {
  display: flex; gap: 10px; align-items: flex-end; padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.consult-input {
  flex: 1; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
  font-size: 14px; font-family: inherit; color: var(--text); resize: none;
  max-height: 120px; line-height: 1.5;
}
.consult-input:focus { outline: none; border-color: var(--primary); }
.consult-send-btn {
  border: none; background: var(--primary); color: #fff; cursor: pointer;
  border-radius: 12px; padding: 10px 20px; font-size: 14px; font-family: inherit; flex-shrink: 0;
}
.consult-send-btn:hover { background: var(--primary-dark); }
/* 发送中禁用态（按钮 + 输入框一起置灰，防止重复发送） */
.consult-send-btn:disabled {
  background: var(--text-soft, #b0b7c3); opacity: .75; cursor: not-allowed; pointer-events: none;
}
.consult-input:disabled {
  background: #f1f3f5; color: var(--text-soft, #98a0ac); cursor: not-allowed;
}

/* AI 正在思考中… 加载气泡 */
.msg-row.thinking .msg-bubble { display: inline-flex; align-items: center; gap: 8px; }
.thinking-text { color: var(--text-soft, #6b7280); }
.dot-loader { display: inline-flex; gap: 4px; align-items: center; }
.dot-loader i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-soft, #6b7280);
  display: inline-block; animation: dotBlink 1.2s infinite ease-in-out;
}
.dot-loader i:nth-child(2) { animation-delay: .2s; }
.dot-loader i:nth-child(3) { animation-delay: .4s; }
@keyframes dotBlink {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .dot-loader i { animation: none; opacity: .5; }
}
/* 错误提示气泡（保留在聊天记录中） */
.msg-row.error .msg-bubble.error-bubble {
  background: #fdecea; color: #b71c1c; border: 1px solid #f5c6c2;
}

/* 收藏回答子页面 */
.saved-list { display: flex; flex-direction: column; gap: 12px; }
.saved-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: #fff; }
.saved-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.saved-source { font-size: 12px; color: var(--primary-dark); background: #e7f1ea; border: 1px solid #cfe3d6; padding: 2px 10px; border-radius: 20px; }
.saved-time { font-size: 12px; color: var(--text-soft); }
.saved-q, .saved-a { font-size: 14px; line-height: 1.6; margin-top: 6px; display: flex; gap: 8px; }
.saved-q-label, .saved-a-label {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 6px; text-align: center;
  font-size: 12px; line-height: 20px; color: #fff; margin-top: 2px;
}
.saved-q-label { background: var(--primary); }
.saved-a-label { background: #8b5cf6; }
.saved-q { color: var(--text); word-break: break-word; }
.saved-a { color: var(--text); word-break: break-word; white-space: pre-wrap; }
.saved-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.saved-jump, .saved-del {
  border: none; cursor: pointer; font-size: 13px; padding: 6px 14px; font-family: inherit;
  border-radius: 8px; background: #f1f5f9; color: var(--text-soft);
}
.saved-jump:hover { color: var(--primary); background: #e7f1ea; }
.saved-del { color: #b91c1c; }
.saved-del:hover { color: #fff; background: var(--danger); }

/* 聊天历史子页面 */
.chat-history-list { display: flex; flex-direction: column; gap: 10px; }
.chat-history-item { border: 1px solid var(--border); border-radius: 12px; background: #fff; overflow: hidden; }
.chat-history-main {
  display: block; width: 100%; text-align: left; border: none; background: none;
  cursor: pointer; padding: 14px; font-family: inherit;
}
.chat-history-main:hover { background: var(--bg-soft); }
.chat-history-title { font-size: 14px; font-weight: 600; color: var(--text); }
.chat-history-time { font-size: 12px; color: var(--text-soft); margin-top: 4px; }

/* ============================================================
   AI 模拟实训
   ============================================================ */
.npc-page { display: flex; flex-direction: column; gap: 16px; }
.npc-stage-card { padding-bottom: 18px; }
.npc-stage-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 4px;
}
.npc-quota-chip {
  font-size: 12px; color: var(--primary-dark); background: #eaf3ec;
  border: 1px solid #cfe3d6; padding: 4px 12px; border-radius: 20px; white-space: nowrap;
}
.npc-quota-chip b { font-size: 14px; }
.npc-stage { margin-top: 14px; }

/* 开场：醒目的开始按钮 */
.npc-intro { text-align: center; padding: 26px 16px 10px; }
.npc-intro-icon { font-size: 46px; line-height: 1; margin-bottom: 10px; }
.npc-intro-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.npc-intro-desc { font-size: 14px; color: var(--text-soft); line-height: 1.9; margin-bottom: 20px; }
.npc-intro-desc b { color: var(--primary-dark); }

/* ---------- 训练方向选择（七个方向按钮） ----------
   界面上只出现「Emoji + 方向名」这两个词，绝不展示括号或细化标签（拖延/粗心…），
   细化标签只活在后端提示词里。 */
.npc-dir-section { margin-top: 22px; }
.npc-dir-title {
  font-size: 13.5px; font-weight: 700; color: var(--text);
  margin-bottom: 12px; letter-spacing: .3px;
}
.npc-dir-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.npc-dir-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; min-height: 50px; padding: 12px 10px;
  border: 1px solid #cfe3d6; border-radius: 14px; cursor: pointer;
  background: #f6fbf7; color: var(--primary-dark);
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.npc-dir-btn:hover:not(:disabled) {
  background: #eaf6ee; border-color: var(--primary);
  transform: translateY(-2px); box-shadow: 0 6px 14px rgba(90, 158, 111, .18);
}
.npc-dir-btn:active:not(:disabled) { transform: translateY(0); }
.npc-dir-btn:disabled {
  background: #f1f3f5; border-color: var(--border); color: var(--text-soft);
  cursor: not-allowed; transform: none; box-shadow: none;
}

/* 方向标签：聊天头部 / 历史卡片 / 详情头部 共用 */
.npc-chat-scene-wrap { display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.npc-dir-chip {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 600; color: var(--primary-dark);
  background: #eaf4ee; border: 1px solid #cfe6d8;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.npc-dir-chip.small { font-size: 11px; font-weight: 500; padding: 2px 8px; }
.npc-hist-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.npc-hist-meta .npc-hist-time { margin-top: 0; }

.npc-intro-hint { font-size: 12px; color: var(--text-soft); margin-top: 12px; }

/* 开场页的两个小徽标：剩余回复次数 + 今日剩余模拟机会 */
.npc-intro-badges {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px;
}
.npc-intro-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; color: var(--primary-dark);
  background: #eaf4ee; border: 1px solid #cfe6d8;
  padding: 5px 12px; border-radius: 999px;
}
.npc-intro-badge.soft { font-weight: 500; color: var(--text-soft); background: var(--bg-soft); border-color: var(--border); }

/* 聊天面板 */
.npc-chat-panel {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: #fff; display: flex; flex-direction: column;
}
.npc-chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-soft);
  font-size: 13px; flex-wrap: wrap;
}
.npc-chat-scene { font-weight: 600; color: var(--text); }
.npc-round-chip { font-size: 12px; color: var(--text-soft); white-space: nowrap; }
.npc-round-chip b { color: var(--primary-dark); font-size: 13px; }
.npc-round-chip.done { color: var(--primary-dark); font-weight: 600; }

.npc-messages {
  height: 400px; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 14px; background: #fcfaf6;
  -webkit-overflow-scrolling: touch;
}
.npc-row { display: flex; gap: 8px; align-items: flex-start; max-width: 86%; }
.npc-row.child { align-self: flex-start; }
.npc-row.parent { align-self: flex-end; flex-direction: row-reverse; }
.npc-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-soft); display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.npc-row.parent .npc-avatar { background: #e7f1ea; }
.npc-col { min-width: 0; display: flex; flex-direction: column; }
.npc-who { font-size: 11px; color: var(--text-soft); margin-bottom: 4px; }
.npc-row.parent .npc-who { text-align: right; }
.npc-bubble {
  padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.7;
  word-break: break-word; white-space: pre-wrap; overflow-wrap: anywhere;
}
.npc-row.child .npc-bubble { background: #fff; color: var(--text); border: 1px solid var(--border); border-top-left-radius: 4px; }
.npc-row.parent .npc-bubble { background: var(--primary); color: #fff; border-top-right-radius: 4px; }
.npc-row.error .npc-bubble.npc-error-bubble { background: #fdecea; color: #b71c1c; border: 1px solid #f5c6c2; }

.npc-input-bar {
  display: flex; gap: 10px; align-items: flex-end; padding: 10px 12px;
  border-top: 1px solid var(--border); background: #fff;
}
.npc-input {
  flex: 1; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
  font-size: 14px; font-family: inherit; color: var(--text); resize: none;
  max-height: 120px; line-height: 1.5; min-width: 0;
}
.npc-input:focus { outline: none; border-color: var(--primary); }
.npc-input:disabled { background: #f1f3f5; color: var(--text-soft); cursor: not-allowed; }
.npc-send-btn {
  border: none; background: var(--primary); color: #fff; cursor: pointer;
  border-radius: 12px; padding: 10px 20px; font-size: 14px; font-family: inherit; flex-shrink: 0;
}
.npc-send-btn:hover { background: var(--primary-dark); }
.npc-send-btn:disabled { background: #b0b7c3; opacity: .75; cursor: not-allowed; pointer-events: none; }

/* 撤回按钮：只出现在「刚发出、AI 还没回」的家长气泡下方 */
.npc-recall-btn {
  align-self: flex-end; margin-top: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text-soft);
  font-size: 12px; font-family: inherit; line-height: 1;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.npc-recall-btn:hover { color: var(--accent); border-color: #f0cfae; background: #fff8f0; }
.npc-recall-btn:active { transform: translateY(1px); }

/* ---------- 语音输入按钮（麦克风） ---------- */
/* 移动端刚需：点击区域 ≥44×44，图标够大，录制中有明显的红色脉冲反馈 */
.npc-mic-btn, .consult-mic-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text-soft);
  transition: background .15s, color .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.npc-mic-btn:hover, .consult-mic-btn:hover { color: var(--primary-dark); border-color: #cfe0d5; background: #eef5f0; }
.npc-mic-btn.recording, .consult-mic-btn.recording {
  background: #fdecea; color: #c0392b; border-color: #f2b8b2;
  animation: micPulse 1.1s ease-in-out infinite;
}
.npc-mic-btn.voice-unsupported, .consult-mic-btn.voice-unsupported { opacity: .45; cursor: not-allowed; }
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 117, 107, .5); }
  50%      { box-shadow: 0 0 0 7px rgba(217, 117, 107, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .npc-mic-btn.recording, .consult-mic-btn.recording { animation: none; }
}

/* 轻量浮动提示（撤回成功等一次性反馈） */
.wb-tip {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 10px);
  max-width: 82vw; padding: 10px 18px; border-radius: 22px;
  background: rgba(58, 58, 58, .92); color: #fff; font-size: 13.5px; line-height: 1.4;
  opacity: 0; pointer-events: none; z-index: 9999;
  transition: opacity .22s, transform .22s;
}
.wb-tip.show { opacity: 1; transform: translate(-50%, 0); }

/* 点评区 */
.npc-review-box {
  margin-top: 14px; border: 1px solid var(--border); border-radius: 12px;
  background: #fffaf2; padding: 16px;
}
.npc-review-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.npc-review-body { font-size: 14px; line-height: 1.8; color: var(--text); }
.npc-score-line { margin-bottom: 10px; font-size: 14px; color: var(--text-soft); }
.npc-score { font-size: 26px; font-weight: 800; color: var(--accent); margin: 0 2px; }
.npc-score-max { font-size: 13px; }
.npc-review-text { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.npc-review-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.npc-save-btn {
  border: none; cursor: pointer; font-family: inherit; background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 700; padding: 12px 24px; border-radius: 12px;
}
.npc-save-btn:hover { filter: brightness(.94); }
.npc-save-btn:disabled { background: #ccc; cursor: not-allowed; }
.npc-saved-tip { font-size: 14px; color: var(--primary-dark); font-weight: 600; align-self: center; }
.npc-again-btn {
  border: 1px solid var(--primary); background: #fff; color: var(--primary-dark);
  cursor: pointer; font-family: inherit; font-size: 14px; padding: 11px 20px; border-radius: 12px;
}
.npc-error-box {
  background: #fdecea; color: #b71c1c; border: 1px solid #f5c6c2;
  border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px;
}

/* 历史记录卡片 */
.npc-history { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.npc-hist-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  background: #fff; cursor: pointer; transition: background .15s, box-shadow .15s;
}
.npc-hist-card:hover { background: var(--bg-soft); box-shadow: var(--shadow); }
.npc-hist-main { min-width: 0; flex: 1; }
.npc-hist-title { font-size: 14px; font-weight: 600; color: var(--text); word-break: break-word; }
.npc-hist-time { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.npc-hist-score { font-size: 20px; font-weight: 800; color: var(--accent); flex-shrink: 0; }
.npc-hist-score span { font-size: 12px; color: var(--text-soft); font-weight: 500; }

/* 回看详情 */
.npc-detail-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.npc-back-btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  cursor: pointer; font-family: inherit; font-size: 13px; padding: 7px 14px; border-radius: 10px;
}
.npc-detail-title { font-size: 15px; font-weight: 700; color: var(--text); flex: 1; min-width: 0; }

.npc-model-tip { color: var(--primary-dark); }

/* 移动端：弹窗自适应、按钮可点按 */
@media (max-width: 720px) {
  .task-modal { width: 100%; max-height: calc(100vh - 24px); padding: 16px; border-radius: 14px; }
  .diary-modal { width: 100%; }
  .task-input { font-size: 16px; padding: 12px 14px; }
  .task-btn-cancel, .task-btn-save { padding: 12px 20px; font-size: 16px; }

  /* 日记移动端 */
  .diary-tabs { gap: 4px; }
  .diary-tab { font-size: 14px; padding: 12px 4px; min-height: 44px; }
  .diary-item { padding: 12px; }
  .diary-content { min-height: 120px; font-size: 16px; }
  .diary-ai-btn, .diary-edit, .diary-del {
    font-size: 14px; padding: 10px 14px; min-height: 44px;
  }
  .diary-item-actions { justify-content: stretch; }
  .diary-ai-btn, .diary-edit, .diary-del { flex: 1; }

  /* 周复盘报告移动端 */
  .report-head { flex-direction: column; align-items: stretch; }
  .report-head .btn { width: 100%; }

  /* 咨询室移动端：侧栏抽屉化，聊天区占满 */
  .consult-wrap { height: calc(100vh - 170px); min-height: 0; flex-direction: column; }
  .consult-sidebar {
    width: 100%; flex-shrink: 1; max-height: 180px; border-radius: 12px;
  }
  .consult-session-list { max-height: 120px; }
  .consult-main { flex: 1; border-radius: 12px; }
  .consult-messages { padding: 12px; }
  .msg-row { max-width: 88%; }
  .consult-input { font-size: 16px; }
  .consult-send-btn { padding: 12px 18px; font-size: 15px; min-height: 44px; }
  .consult-new-btn { font-size: 13px; padding: 8px 12px; }
  .saved-jump, .saved-del { font-size: 14px; padding: 10px 14px; min-height: 44px; flex: 1; }
  .saved-actions { justify-content: stretch; }

  /* AI 模拟实训移动端：气泡不溢出、输入框不被键盘挡住 */
  .npc-page { gap: 12px; }
  .npc-stage-head { gap: 6px; }
  .npc-intro { padding: 18px 8px 6px; }
  .npc-intro-icon { font-size: 40px; }
  .npc-intro-title { font-size: 16px; }
  .npc-intro-desc { font-size: 13.5px; line-height: 1.85; }
  /* 七个方向按钮：移动端固定两列，minmax(0,1fr) 保证再窄也不溢出 */
  .npc-dir-section { margin-top: 18px; }
  .npc-dir-title { font-size: 13px; margin-bottom: 10px; }
  .npc-dir-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .npc-dir-btn { min-height: 46px; font-size: 13.5px; padding: 10px 6px; border-radius: 12px; }
  .npc-chat-scene-wrap { gap: 6px; }
  .npc-dir-chip { font-size: 11.5px; padding: 3px 8px; }
  /* 消息区用视口高度，保证输入框落在首屏、聚焦时键盘不会顶掉 */
  .npc-messages { height: 46vh; min-height: 220px; padding: 12px; }
  .npc-row { max-width: 92%; }
  .npc-bubble { font-size: 14.5px; padding: 9px 12px; }
  /* 16px 可避免 iOS 聚焦时自动放大页面 */
  .npc-input { font-size: 16px; padding: 11px 12px; max-height: 96px; }
  .npc-send-btn { font-size: 15px; padding: 12px 16px; min-height: 44px; }
  /* 移动端麦克风按钮再放大一点，手指好点 */
  .npc-mic-btn, .consult-mic-btn { width: 46px; height: 46px; border-radius: 13px; }
  .npc-intro-badges { gap: 6px; }
  .npc-intro-badge { font-size: 12.5px; padding: 5px 10px; }
  .npc-recall-btn { font-size: 12.5px; padding: 7px 13px; min-height: 32px; }
  .wb-tip { bottom: 96px; font-size: 13px; }
  .npc-review-box { padding: 13px; }
  .npc-review-text { font-size: 14px; }
  .npc-save-btn { width: 100%; font-size: 16px; padding: 13px 20px; min-height: 48px; }
  .npc-again-btn { width: 100%; min-height: 44px; }
  .npc-review-actions { flex-direction: column; }
  .npc-hist-card { padding: 11px 12px; }
  .npc-hist-title { font-size: 13.5px; }
}

/* 登录页：登录 / 注册 切换标签（平台化升级新增） */
.auth-tab {
  border: 1px solid #e0e6ee;
  background: #f4f7fb;
  color: #5b6675;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 0;
  border-radius: 10px;
  cursor: pointer;
  transition: .15s;
}
.auth-tab.active {
  background: var(--brand, #2f7d5b);
  border-color: var(--brand, #2f7d5b);
  color: #fff;
  box-shadow: 0 4px 12px rgba(47,125,91,.22);
}
.btn-wechat {
  background: #1aad19;
  color: #fff;
}

/* ============================================================
   我的账号：会员中心 / 微信绑定 / 支付（V3.0）
   ============================================================ */

/* 顶栏会员徽标 */
.chip-vip {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; border: none; font-weight: 700;
}

/* 账号信息表 */
.acct-grid { margin-top: 12px; border: 1px solid #e7ecf3; border-radius: 10px; overflow: hidden; }
.acct-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; font-size: 14px; border-bottom: 1px solid #eef2f7;
}
.acct-row:last-child { border-bottom: none; }
.acct-row span { color: #6b7280; }
.acct-row b { color: #111827; font-weight: 600; }

/* 会员套餐卡片 */
.vip-plans {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-top: 14px;
}
.vip-plan {
  position: relative; border: 1px solid #e7ecf3; border-radius: 12px;
  padding: 16px 14px; text-align: center; background: #fff;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.vip-plan:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(17,24,39,.10); border-color: #f59e0b; }
.vip-plan.hot { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.18); }
.vip-plan.disabled { opacity: .62; }
.vip-plan-tag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: #f59e0b; color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 10px; white-space: nowrap;
}
.vip-plan-label { font-size: 14px; color: #6b7280; }
.vip-plan-price { font-size: 24px; font-weight: 800; color: #111827; margin: 6px 0 2px; }
.vip-plan-desc { font-size: 12px; color: #9aa3ad; min-height: 18px; }
.vip-buy { margin-top: 10px; width: 100%; }
.vip-buy:disabled { background: #d1d5db; cursor: not-allowed; }

/* 支付区 */
.pay-card {
  margin-top: 14px; padding: 16px; border: 1px solid #e7ecf3; border-radius: 12px;
  background: #fafbfc; display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
}
.pay-qr img { display: block; }
.pay-fallback { font-size: 13px; color: #6b7280; word-break: break-all; max-width: 220px; }
.pay-meta { font-size: 14px; color: #374151; line-height: 1.9; }
.pay-meta b { color: #d97706; font-size: 16px; }
.pay-status { margin-top: 4px; font-weight: 600; color: #6b7280; }

/* 首次登录引导绑定微信 */
.wx-bind-bar{background:linear-gradient(90deg,#1aad19,#22c55e);color:#fff}
.wx-bind-inner{
  display:flex;align-items:center;gap:10px;padding:9px 16px;font-size:13px;flex-wrap:wrap;
}
.wx-bind-ico{font-size:16px}
.wx-bind-text{flex:1 1 220px;min-width:0}
.wx-bind-btn{
  background:#fff;color:#15803d;border:none;padding:5px 14px;border-radius:16px;
  font-size:13px;font-weight:700;cursor:pointer;
}
.wx-bind-btn:hover{background:#f0fdf4}
.wx-bind-close{
  background:transparent;border:none;color:rgba(255,255,255,.85);
  font-size:14px;cursor:pointer;padding:2px 4px;line-height:1;
}
.wx-bind-close:hover{color:#fff}

/* 会员门禁拦截页 */
.vip-gate-card{text-align:center;padding:36px 24px}
.vip-gate-ico{font-size:44px;margin-bottom:6px}
.vip-gate-card h2{margin:6px 0 8px}
.vip-gate-card .btn-row{justify-content:center;margin-top:16px}

/* 平台统一 AI 接口提示（家长端 API 密钥页） */
.ai-shared-box{
  display:flex;gap:12px;align-items:flex-start;
  margin:12px 0 16px;padding:14px 16px;
  border:1px solid #bbf7d0;background:#f0fdf4;border-radius:10px;font-size:14px;color:#14532d;
}
.ai-shared-box.warn{border-color:#fde68a;background:#fffbeb;color:#78350f}
.ai-shared-ic{font-size:22px;line-height:1.2}
.ai-shared-meta{margin-top:4px;font-size:12px;opacity:.8}
