/* PSA 样式 — 移动优先，无外部字体/库
   视觉规范见 design.md：米灰底 + 苔藓/灰绿低饱和绿色层次体系 */
:root {
  --bg: #EFEDE8;          /* 页面底色：米灰（去黄） */
  --card: #FFFFFF;
  --text: #374151;        /* 正文 */
  --muted: #6B7280;       /* 次要文字 */
  --border: #DFDCD2;
  --brand: #637C6E;       /* 主色：苔藓绿 */
  --brand-soft: #E9EFEC;  /* 浅主色 */
  --brand-text: #41564A;  /* 深苔绿：主色上的文字 */
  --danger: #5C6B5E;      /* 深灰绿：删除/浪费/错误 */
  --warn: #8A9A7B;        /* 灰橄榄：提示/到期 */
  --period: #4C6355;      /* 经期：深苔绿（实底） */
  --period-soft: #DEE8E2;
  --period-text: #3E5347;
  --fertile: #5B7F66;     /* 易孕期/排卵日：中绿 */
  --fertile-soft: #C3D7CA;
  --fertile-text: #3F5B49;
  --safe: #9DB3A6;        /* 安全期：浅绿灰 */
  --safe-soft: #EAF1EC;
  --safe-text: #5C7064;
  /* 经期日历专用状态色：深绿经期 / 橘黄易孕 / 浅绿排卵 / 条纹预测 / 底色安全 */
  --cycle-fertile: #D08A24;
  --cycle-fertile-soft: #FCE4BC;
  --cycle-fertile-text: #7A4A0C;
  --cycle-ov: #62926F;
  --cycle-ov-soft: #D8ECD9;
  --cycle-ov-text: #2F5238;
  --cycle-stripe: rgba(76, 99, 85, .34);
  --radius: 10px;
  --shadow: 0 1px 3px rgba(60, 70, 60, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171B19; --card: #212723; --text: #E3E8E4; --muted: #93A097;
    --border: #333C36; --brand: #8FB3A2; --brand-soft: #26332C; --brand-text: #C4DACD;
    --danger: #9DB5A6; --warn: #B3C29E;
    --period: #A9C3B4; --period-soft: #2A3830; --period-text: #CDE0D4;
    --fertile: #7E9A8B; --fertile-soft: #2F4337; --fertile-text: #BED9C8;
    --safe: #6E8578; --safe-soft: #26302A; --safe-text: #A3B8AB;
    --cycle-fertile: #C8913C; --cycle-fertile-soft: #3A2C15; --cycle-fertile-text: #F2C784;
    --cycle-ov: #8DC09B; --cycle-ov-soft: #24362B; --cycle-ov-text: #C6E3CC;
    --cycle-stripe: rgba(205, 224, 212, .30);
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  padding-bottom: 76px; /* 底部导航高度 */
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }

/* 头部 */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--border);
}
.app-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.lang-toggle {
  font-size: 12px; font-weight: 600; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text); cursor: pointer;
  line-height: 1.2; min-height: 24px;
}
.lang-toggle:hover { background: var(--brand-light); border-color: var(--brand); }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.sync-dot.ok { background: var(--brand); }
.sync-dot.err { background: var(--danger); }
.sync-dot.busy { background: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* 主区 */
#main { max-width: 680px; margin: 0 auto; padding: 12px 12px 0; }
.view { display: none; }
.view.active { display: block; }

/* 卡片与通用 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }

.btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 8px; padding: 6px 12px; font-size: 14px;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }

.input, .select, textarea.note {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; background: var(--bg); outline: none;
}
.input:focus, .select:focus, textarea.note:focus { border-color: var(--brand); }
textarea.note { min-height: 90px; resize: vertical; }

.chip {
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font-size: 13px;
}
.chip.active { background: var(--brand-soft); color: var(--brand-text); border-color: var(--brand); font-weight: 600; }

.badge {
  position: absolute; top: 4px; right: 12%;
  min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger);
  color: #fff; font-size: 11px; font-style: normal; line-height: 16px; text-align: center; padding: 0 4px;
}

/* 日期导航 */
.date-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.date-nav .cur { font-weight: 600; }

/* 进度条 */
.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width .2s; }

/* 任务槽位 */
.slot-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; margin-bottom: 8px; position: relative; }
.slot-card.done { border-left: 4px solid var(--brand); }
.slot-card.wasted { border-left: 4px solid var(--danger); opacity: .85; }
.slot-head { display: flex; align-items: center; gap: 8px; }
.slot-time { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--muted); white-space: nowrap; }
.slot-tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.slot-actions { display: flex; gap: 6px; margin-left: auto; }
.chk-btn, .waste-btn {
  width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); font-size: 15px; line-height: 1; color: var(--muted);
}
.chk-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.waste-btn.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.slot-body { display: flex; gap: 8px; align-items: center; }
.slot-input { flex: 1; min-width: 0; }

/* M13a：每日「全部」视图 早/中/晚 深绿分割条 */
.slot-band {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--period); color: #fff;
  border-radius: 8px; padding: 6px 12px; margin: 14px 0 8px;
  font-weight: 600; font-size: 13px;
}
.slot-band:first-child { margin-top: 0; }
.slot-band-plan { font-weight: 400; font-size: 12px; opacity: .92; }
.sec-select { width: 84px; flex: none; font-size: 13px; padding: 6px 6px; }
.slot-qty { display: flex; gap: 6px; align-items: center; }
.slot-qty .num { width: 76px; flex: none; }
.slot-qty .unit { width: 88px; flex: none; font-size: 13px; padding: 6px; }

/* 槽位实际时间：点击时间文字展开起止时间编辑 */
.slot-time-edit {
  background: none; border: 0; padding: 0;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  color: var(--muted); white-space: nowrap; cursor: pointer;
  border-bottom: 1px dashed transparent;
}
.slot-time-edit:hover { color: var(--brand); border-bottom-color: var(--brand); }
.slot-time-ic { font-size: 11px; opacity: .7; }
.slot-times {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
}
.slot-times input[type="time"] { width: 112px; flex: none; padding: 5px 6px; font-size: 13px; }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
@media (min-width: 480px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.stat-num { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; gap: 4px; margin-bottom: 10px; }
.chart-wrap { width: 100%; overflow-x: auto; }
.qty-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.qty-table td, .qty-table th { padding: 5px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.qty-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.delta-up { color: var(--danger); }
.delta-down { color: var(--brand); }

/* 提醒 */
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.item-title { font-weight: 600; }
.item-meta { font-size: 12px; color: var(--muted); }
.item-actions { display: flex; gap: 6px; margin-left: auto; flex: none; }
.state-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); flex: none; }
.state-pill.fired { background: var(--brand-soft); color: var(--brand-text); }
.state-pill.done { background: var(--brand-soft); color: var(--brand-text); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.weekdays { display: flex; gap: 4px; flex-wrap: wrap; }
.weekdays .chip { padding: 3px 9px; }
.time-list { display: flex; flex-wrap: wrap; gap: 6px; }
.time-pill { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.time-pill button { border: none; background: none; color: var(--muted); padding: 0; font-size: 14px; }

/* 横幅 / Toast */
.banner-root { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 60; width: min(94vw, 560px); }
.banner {
  background: var(--card); border: 1px solid var(--brand); border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0,0,0,.18); padding: 10px 12px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.banner .b-title { font-weight: 600; }
.banner .b-sub { font-size: 12px; color: var(--muted); }
.toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
  background: rgba(55, 65, 58, .94); color: #fff; padding: 8px 16px; border-radius: 999px;
  font-size: 13px; z-index: 70; max-width: 86vw; text-align: center;
}

/* 底部导航 */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: var(--card); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-btn {
  flex: 1; background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; font-size: 12px; position: relative;
}
.tab-btn.active { color: var(--brand); font-weight: 600; }
.tab-ico { font-size: 20px; line-height: 1; }

/* 说明列表 */
.help li { margin-bottom: 6px; font-size: 14px; }
.help { padding-left: 18px; margin: 0; }

/* ========== 「我的」子导航 ========== */
.mine-sub { display: flex; gap: 6px; margin-bottom: 10px; }

/* ========== 健康：月经日历 ========== */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); padding: 2px 0; }
.cal-cell {
  position: relative; min-height: 48px; text-align: left;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text);
  padding: 3px 5px; font: inherit; cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.cal-cell:hover:not(.empty) { transform: translateY(-1px); box-shadow: var(--shadow); }
.cal-cell:active:not(.empty) { transform: translateY(0); }
.cal-cell.empty { border: none; background: transparent; min-height: 0; box-shadow: none; cursor: default; }
.cal-num { font-size: 13px; }
/* 五种状态：白卡/底色 → 橘黄易孕 → 浅绿排卵 → 斜纹预测 → 深绿经期 */
.cal-cell.period { background: var(--period); border-color: var(--period); color: #fff; font-weight: 600; }
.cal-cell.predperiod {
  background-color: var(--card);
  background-image: repeating-linear-gradient(45deg, var(--cycle-stripe) 0, var(--cycle-stripe) 3px, transparent 3px, transparent 7px);
  border: 1px dashed var(--period); color: var(--period-text);
}
.cal-cell.fertile { background: var(--cycle-fertile-soft); border-color: var(--cycle-fertile); color: var(--cycle-fertile-text); font-weight: 600; }
.cal-cell.safe { background: var(--bg); border-color: var(--border); color: var(--text); }
.cal-cell.ov-day { background: var(--cycle-ov-soft); border-color: var(--cycle-ov); color: var(--cycle-ov-text); font-weight: 600; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--text); }
/* 区间点选模式 */
.cal-cell.pick-start { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.cal-cell.pick-between { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); }
.pick-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--brand-soft); color: var(--brand-text);
  border: 1px solid var(--brand); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px; font-size: 13px;
}
.pick-bar .grow { flex: 1; }
.cal-picktag {
  position: absolute; right: 3px; bottom: 2px;
  font-size: 10px; line-height: 14px; padding: 0 4px; border-radius: 6px;
  background: rgba(255,255,255,.85); color: var(--brand-text); font-weight: 700;
}
.cal-pain, .cal-ov {
  position: absolute; right: 3px; bottom: 2px;
  font-size: 10px; font-style: normal;
  background: #fff; border-radius: 6px; padding: 0 4px; line-height: 14px;
  font-weight: 700;
}
.cal-pain { color: var(--period); }
.cal-pain.mild { opacity: .6; }
.cal-ov { color: var(--cycle-ov-text); }
.cal-cell.period .cal-pain { background: rgba(255,255,255,.28); color: #fff; }
.cal-cell.ov-day .cal-ov { background: #fff; color: var(--cycle-ov-text); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.legend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--border); background: var(--card); }
.lg.period { background: var(--period); border-color: var(--period); }
.lg.predperiod {
  background-color: var(--card);
  background-image: repeating-linear-gradient(45deg, var(--cycle-stripe) 0, var(--cycle-stripe) 2px, transparent 2px, transparent 5px);
  border: 1px dashed var(--period);
}
.lg.fertile { background: var(--cycle-fertile-soft); border-color: var(--cycle-fertile); }
.lg.ov { background: var(--cycle-ov-soft); border-color: var(--cycle-ov); }
.lg.safe { background: var(--bg); border-color: var(--border); }
@media (prefers-color-scheme: dark) {
  /* 深色模式下经期实底为浅苔绿，白字对比不足，改用深色文字 */
  .cal-cell.period { color: #10140F; }
  .cal-cell.period .cal-pain { background: rgba(0, 0, 0, .18); color: #10140F; }
}

/* 健康：症状打卡 */
.symptom-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.symptom-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 4px;
}
.symptom-label { font-size: 12px; color: var(--muted); text-align: center; }
.stepper { display: flex; align-items: center; gap: 10px; }
.step-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--card);
  font-size: 17px; line-height: 1; color: var(--text); padding: 0;
}
.step-btn:active { background: var(--brand-soft); }
.step-num { min-width: 18px; text-align: center; font-weight: 600; }
.state-pill.period-pill { background: var(--period); color: #fff; }
.state-pill.predpill {
  background-color: var(--card);
  background-image: repeating-linear-gradient(45deg, var(--cycle-stripe) 0, var(--cycle-stripe) 2px, transparent 2px, transparent 4px);
  border: 1px dashed var(--period); color: var(--period-text);
}
.state-pill.fertile-pill { background: var(--cycle-fertile-soft); color: var(--cycle-fertile-text); }
.state-pill.ov-pill { background: var(--cycle-ov-soft); color: var(--cycle-ov-text); }
.state-pill.safe-pill { background: var(--bg); color: var(--muted); }
.pain-none.active { background: var(--brand-soft); color: var(--brand-text); border-color: var(--brand); }
.pain-mild.active { background: var(--brand-soft); color: var(--brand-text); border-color: var(--brand); }
.pain-severe.active { background: var(--period-soft); color: var(--period-text); border-color: var(--period); }

/* ========== 复习：翻转卡 ========== */
.flip { perspective: 1200px; height: 168px; cursor: pointer; }
.flip-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .45s; transform-style: preserve-3d;
}
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 12px; text-align: center;
}
.flip-back { transform: rotateY(180deg); background: var(--brand-soft); border-color: var(--brand); }
.flip-word { font-size: 24px; font-weight: 700; word-break: break-word; }
.flip-word.small-word { font-size: 17px; color: var(--brand-text); }
.flip-meaning { font-size: 16px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.flip-actions { display: flex; gap: 8px; margin-top: 8px; }
.review-done { text-align: center; padding: 26px 12px; }
.review-done b { display: block; margin: 6px 0 2px; font-size: 16px; }
.upcoming-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.upcoming-cell { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 4px; }
.upcoming-cell .stat-num { font-size: 18px; }
.due-text { color: var(--warn); font-weight: 600; }

/* ========== 养生版块 ========== */
.task-sub { flex-wrap: wrap; }
.w-statline { margin-top: 8px; }
.w-miss-text { color: var(--danger); }

.w-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--border);
}
.card .w-row:first-of-type { border-top: none; }
.w-info { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.w-ico { font-style: normal; }
.w-title { font-weight: 600; }
.w-dose { color: var(--muted); font-size: 12px; }

/* 完成 / 未做 双态按钮 */
.w-pair { display: inline-flex; gap: 6px; flex: none; }
.w-btn {
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 4px 14px; font-size: 13px; transition: all .15s;
}
.w-btn.w-done.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.w-btn.w-miss.on { background: var(--danger); border-color: var(--danger); color: #fff; }

/* 刮痧 */
.w-badge-mer {
  font-size: 12px; font-weight: 600; color: var(--fertile-text);
  background: var(--fertile-soft); border-radius: 999px; padding: 2px 10px; margin-left: 4px;
}
.w-offday { padding: 6px 0 2px; }

/* 地中海饮食 */
.w-meal { margin-bottom: 8px; }
.w-meal:last-child { margin-bottom: 0; }
.w-meal label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }

/* 补充剂 */
.w-supp { gap: 8px; }
.w-supp-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.w-twice { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.w-am-pm { font-size: 12px; color: var(--muted); width: 16px; }
.w-custom-tag {
  font-size: 10px; color: var(--brand-text); background: var(--brand-soft);
  border-radius: 6px; padding: 0 6px; margin-left: 2px;
}
.w-del {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-size: 12px; line-height: 1;
}
.w-del:hover { color: var(--danger); border-color: var(--danger); }

/* 「未做/未吃」备注原因输入框（标记未做的行下方出现，用于复盘） */
.miss-note-row { padding: 2px 0 8px; }
.miss-note { width: 100%; font-size: 12px; padding: 5px 10px; background: var(--brand-soft); }
.miss-note::placeholder { color: var(--muted); }

/* Reading & Topic Discussion */
.rc-textarea {
  width: 100%; min-height: 120px; resize: vertical;
  font-size: 13px; line-height: 1.6; padding: 10px;
}
.rc-questions { margin-top: 10px; }
.rc-question {
  padding: 8px 10px; margin-bottom: 6px;
  background: var(--brand-soft); border-radius: 8px;
  font-size: 13px; line-height: 1.5;
}
.rc-qnum { font-weight: 700; color: var(--brand); margin-right: 2px; }
.rc-q-speak { padding: 2px 6px; font-size: 12px; margin-left: 4px; }

/* 复习：音标与归档 */
.phonetic { color: var(--muted); font-size: 13px; font-weight: 400; }
.flip-face .phonetic { font-size: 15px; margin-top: -4px; }
.arch-month { font-weight: 700; font-size: 13px; margin-top: 10px; color: var(--brand-text); }
.arch-week {
  cursor: pointer; padding: 7px 10px; margin-top: 6px;
  background: var(--brand-soft); border-radius: 8px;
  font-weight: 600; font-size: 13px; color: var(--brand-text);
}
.arch-body { padding: 2px 0 2px 14px; }
.arch-day { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.arch-word { font-size: 13px; padding: 2px 0; }
.w-addbox { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.w-add-twice { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 3px; white-space: nowrap; }
#w-restore { margin-top: 8px; }

/* 版块页：时间/数量空格、消费 */
.w-note { flex: none; width: 130px; padding: 4px 10px; font-size: 13px; }
.exp-amt { font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }
.exp-sum { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.upcoming-cell { text-align: center; background: var(--bg); border-radius: 10px; padding: 10px 4px; }

/* 统计页：目标任务 */
.tgt-seg { flex-wrap: wrap; margin-top: 2px; }
.tgt-row { gap: 10px; }
.tgt-check {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--border); background: transparent; color: #fff;
  font-size: 14px; line-height: 1; transition: all .15s;
}
.tgt-check.on { background: var(--brand); border-color: var(--brand); }
.tgt-text { flex: 1 1 auto; min-width: 0; cursor: text; }
.tgt-text.done { text-decoration: line-through; color: var(--muted); }
.tgt-edit { flex: 1 1 auto; min-width: 0; padding: 4px 10px; font-size: 14px; }

@media (max-width: 420px) {
  .w-row { flex-wrap: wrap; }
  .w-addbox .input { flex: 1 1 100% !important; }
  .w-note { width: 100%; }
  .exp-sum { grid-template-columns: repeat(2, 1fr); }
}

/* ========== 英语口语练习 Oral ========== */
#board-oral { display: flex; flex-direction: column; height: calc(100vh - 110px); gap: 8px; }
.oral-header .seg { margin-bottom: 0; }
.oral-messages {
  flex: 1 1 auto; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg); border-radius: 12px;
}
.oral-empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.oral-bubble { max-width: 82%; display: flex; flex-direction: column; }
.oral-bubble.me { align-self: flex-end; align-items: flex-end; }
.oral-bubble.ai { align-self: flex-start; align-items: flex-start; }
.oral-bubble-content {
  padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55;
  word-break: break-word; white-space: pre-wrap;
}
.oral-bubble.me .oral-bubble-content { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.oral-bubble.ai .oral-bubble-content { background: #fff; color: var(--text); border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.oral-bubble-actions { display: flex; gap: 4px; margin-top: 4px; }
.oral-spkbtn, .oral-errbtn {
  background: none; border: none; cursor: pointer; font-size: 14px;
  padding: 2px 6px; border-radius: 6px; opacity: 0.6;
}
.oral-spkbtn:hover, .oral-errbtn:hover { opacity: 1; background: var(--brand-soft); }
.oral-errbtn.on { opacity: 1; color: #d97706; }
.oral-input-bar { display: flex; gap: 8px; align-items: center; }
.oral-mic {
  font-size: 18px; padding: 8px 10px; min-width: 44px;
  background: var(--brand-soft); color: var(--brand-text); border: none;
}
.oral-mic.on { background: #ef4444; color: #fff; animation: oral-pulse 1.2s infinite; }
@keyframes oral-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.oral-loading { display: flex; justify-content: flex-start; padding: 0 12px; }
.oral-typing { display: flex; gap: 4px; padding: 10px 14px; background: #fff; border-radius: 14px; border: 1px solid var(--border); }
.oral-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: oral-bounce 1.2s infinite ease-in-out;
}
.oral-typing span:nth-child(2) { animation-delay: 0.15s; }
.oral-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes oral-bounce { 0%,80%,100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }
.oral-toolbar { font-size: 12px; }
.oral-toolbar .seg { margin-bottom: 0; }
.w-oral-btn {
  font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: var(--brand); color: #fff; border: none; cursor: pointer;
  margin-left: 6px;
}
.oral-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 999;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.oral-error-panel { max-width: 460px; width: 100%; max-height: 80vh; overflow-y: auto; }
.oral-err-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.oral-err-item:last-child { border-bottom: none; }

/* M12b IELTS 面板 & 每日表达 & 评分反馈 */
.oral-ielts .seg { margin-bottom: 8px; flex-wrap: wrap; }
.oral-ielts { flex-shrink: 0; max-height: 38vh; overflow-y: auto; }
.oral-cue { background: var(--brand-soft); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.oral-cue ul, .oral-cue ol { margin: 6px 0 0; padding-left: 18px; }
.oral-cue li { margin-bottom: 2px; }
.oral-cue-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.oral-daily-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.oral-daily-expr { font-weight: 700; font-size: 15px; color: var(--brand-text); }
.oral-daily-actions { margin-top: 6px; display: flex; gap: 6px; }
.oral-fb { margin-top: 6px; background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; max-width: 100%; }
.oral-scores { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.oral-scores b { color: var(--brand-text); }
.oral-fb-text { margin-bottom: 4px; }
.oral-corr { margin-top: 4px; }
.oral-corr-wrong { text-decoration: line-through; color: var(--danger); }
.oral-corr-right { color: var(--brand-text); font-weight: 600; }
.oral-err-wrong { text-decoration: line-through; color: var(--danger); }
.oral-err-right { color: var(--brand-text); font-weight: 600; }

/* M12f 问答式布局 + 红笔批改 */
.oral-qa { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 10px; }
.oral-q { display: flex; align-items: flex-start; gap: 6px; }
.oral-q-text { flex: 1; min-width: 0; font-weight: 600; white-space: pre-wrap; }
.oral-a { margin-top: 8px; background: var(--brand-soft); border-radius: 8px; padding: 8px 10px; }
.oral-a-label { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.oral-a-text { white-space: pre-wrap; }
.oral-a-actions { margin-top: 6px; display: flex; gap: 6px; }
.oral-reveal { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; }
.oral-annotated { line-height: 2; }
.rp-wrong { color: #B5483F; text-decoration: line-through; font-weight: 600; }
.rp-fix { color: var(--brand); font-weight: 600; font-size: 13px; }

/* M12f.1 批改抽屉（桌面右侧滑出 / 窄屏底部上滑）+ 题库面板折叠 */
.oral-dmask { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 900; }
.oral-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 901;
  width: min(520px, 94vw);
  background: var(--card); box-shadow: -6px 0 24px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  animation: oralDrawerIn .22s ease;
}
@keyframes oralDrawerIn { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
.oral-dhead { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.oral-dbody { flex: 1; overflow-y: auto; padding: 14px; }
.drawer-a { background: var(--brand-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.drawer-a-text { font-size: 16px; line-height: 1.7; white-space: pre-wrap; }
.oral-dload { color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; }
.oral-local-tip { font-size: 12px; color: var(--warn); background: var(--brand-soft); border-radius: 6px; padding: 6px 8px; margin-bottom: 8px; }
.oral-fold {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: none; background: none; padding: 2px 0 8px;
  font-weight: 600; font-size: 14px; color: var(--text); text-align: left;
}
.oral-fold-arrow { color: var(--brand); }
@media (max-width: 640px) {
  .oral-drawer {
    top: auto; left: 0; width: 100%; max-height: 80vh;
    border-radius: 16px 16px 0 0;
    animation: oralSheetIn .22s ease;
  }
  @keyframes oralSheetIn { from { transform: translateY(48px); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (prefers-color-scheme: dark) {
  .rp-wrong { color: #E08A80; }
}

/* M13b 改版 一问一答：顶部问题清单（逐题打勾） */
#board-oral.qa-mode { padding-bottom: 96px; }
.oral-qconsole .qa-title { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.qa-row { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border-radius: 8px; margin-bottom: 6px; background: var(--bg); }
.qa-row.done { opacity: .62; }
.qa-row.now { background: var(--brand-soft); border: 1px solid var(--brand); }
.qa-row.todo { opacity: .45; }
.qa-idx { font-weight: 700; color: var(--brand); min-width: 20px; }
.qa-qtext { flex: 1; min-width: 0; line-height: 1.6; }
.qa-row.done .qa-qtext { text-decoration: line-through; text-decoration-color: var(--brand); text-decoration-thickness: 1.5px; }
.qa-mark { font-weight: 700; font-size: 16px; min-width: 22px; text-align: center; }
.qa-row.done .qa-mark { color: var(--brand); }
.qa-row.now .qa-mark { animation: oralPulse 1.4s ease-in-out infinite; }
.qa-prog { margin-top: 8px; }
.qa-done-tip { margin-top: 8px; color: var(--brand); font-weight: 600; font-size: 14px; }

/* 左下固定 dock：🎤 / 存 竖排（fixed，不占页面流） */
.oral-qa-dock {
  position: fixed; left: 12px; bottom: 12px; z-index: 850;
  display: flex; align-items: flex-end; gap: 10px;
  background: none; border: none; padding: 0; box-shadow: none;
}
.qa-dock-btns { display: flex; flex-direction: column; gap: 10px; }
.qa-fab {
  width: 56px; height: 56px; border-radius: 50%;
  border: none; cursor: pointer;
  font-size: 22px; line-height: 1;
  background: var(--brand); color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  display: flex; align-items: center; justify-content: center;
}
.qa-fab.qa-save {
  background: var(--card); color: var(--brand);
  border: 2px solid var(--brand); font-size: 17px; font-weight: 700;
}
.qa-fab.listening { background: #B5483F; animation: oralPulse 1.1s ease-in-out infinite; }

/* 右侧悬浮作答窗（挂在 dock 锚点内，贴右边弹出，覆盖不占位） */
.qa-float {
  position: absolute; left: calc(100% + 10px); bottom: 0;
  width: min(380px, calc(100vw - 100px));
  max-height: min(70vh, 560px);
  display: flex; flex-direction: column;
  background: var(--card);
  border: 2px dashed var(--brand); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
  z-index: 851; overflow: hidden;
  animation: qaFloatIn .18s ease;
}
@keyframes qaFloatIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.qa-float-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.qa-saved-tag { color: var(--brand); font-size: 12px; font-weight: 700; }
.qa-float-x { margin-left: auto; border: none; background: none; font-size: 14px; cursor: pointer; color: var(--muted); }
.qa-say { margin: 10px 10px 0; font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; overflow-y: auto; }
.qa-float.committed .qa-say { background: var(--bg); border-radius: 8px; padding: 8px; width: calc(100% - 20px); margin: 10px; }
.qa-float-note { margin: 8px 10px 10px; font-size: 14px; line-height: 1.9; overflow-y: auto; }

/* 窄屏：dock 贴底通栏，悬浮窗变为底部上弹面板（在按钮上方） */
@media (max-width: 640px) {
  .oral-qa-dock { left: 0; right: 0; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 60%, rgba(239,237,232,0)); }
  .qa-float {
    position: fixed; left: 10px; right: 10px; bottom: 96px;
    width: auto; max-height: 52vh;
  }
}
@keyframes oralPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,124,110,.45); }
  50% { box-shadow: 0 0 0 8px rgba(99,124,110,0); }
}

/* 记事本正文右键快捷菜单 */
.nb-ctx {
  position: fixed; z-index: 9999; display: none;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
  padding: 6px; max-width: min(340px, 94vw);
  -webkit-user-select: none; user-select: none;
}
.nb-ctx-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.nb-ctx-row + .nb-ctx-row { border-top: 1px solid var(--border); margin-top: 5px; padding-top: 6px; }
.nb-ctx button {
  min-width: 34px; height: 32px; padding: 0 8px;
  border: none; border-radius: 6px; background: var(--bg);
  color: var(--text); font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.nb-ctx button:hover { background: var(--brand-soft); }
.nb-ctx button:active { background: var(--brand); color: #fff; }
.nb-ctx-fs { font-size: 12px; color: var(--muted); min-width: 42px; text-align: center; }
.nb-ctx-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }
@media (max-width: 640px) {
  .nb-ctx { max-width: 96vw; }
  .nb-ctx button { height: 36px; min-width: 38px; font-size: 15px; }
}
