/* ==================== 全局变量与重置 ==================== */
:root {
  --green-light: #a8e6cf;
  --green-soft: #d4f1e0;
  --green-deep: #6abf8a;
  --pink-light: #ffb7c5;
  --pink-soft: #ffd9e0;
  --pink-deep: #ff8fa3;
  --orange-flame: #ff7043;
  --orange-light: #ffab91;
  --cream: #fff9f0;
  --bg-main: #f0faf5;
  --text-dark: #4a4a4a;
  --text-gray: #888;
  --text-light: #bbb;
  --white: #ffffff;
  --red-soft: #ffcdd2;
  --red-task: #ff8a80;
  --blue-info: #64b5f6;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --tab-bar-height: 64px;
  --header-height: 140px;
  --font: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

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

html, body {
  font-family: var(--font);
  color: var(--text-dark);
  background: var(--bg-main);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* 所有备注栏/输入框：placeholder 浅灰色，输入内容深绿色 */
textarea, input.form-input, input.weight-input {
  color: var(--green-deep);
}
textarea::placeholder, input.form-input::placeholder, input.weight-input::placeholder {
  color: var(--text-light);
  opacity: 0.7;
}

body {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: linear-gradient(180deg, var(--green-soft) 0%, var(--bg-main) 30%, var(--bg-main) 100%);
}

.hidden { display: none !important; }

/* ==================== 标题栏 ==================== */
.app-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  border-radius: 0 0 24px 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  z-index: 30;
}

.header-bg {
  position: absolute;
  inset: 0;
  background-image: url('../assets/ace-bg.jpg');
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
}

.header-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.45) 100%);
}

.header-bg::after {
  display: none;
}

.header-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}

.header-date {
  position: absolute;
  top: 12px;
  left: 16px;
  font-size: 12px;
  color: var(--white);
  background: rgba(0,0,0,0.35);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.header-title {
  color: var(--white);
  font-size: 26px;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6), 0 0 20px rgba(255,87,34,0.4);
  letter-spacing: 2px;
  text-align: center;
}

.header-sync {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.5s;
}
.header-sync:active { transform: rotate(360deg); }

/* ==================== 下拉刷新 ==================== */
/* 改用 toast 提示，不再使用 hint 元素 */

/* ==================== 主内容区 ==================== */
.app-main {
  padding: 12px 14px calc(var(--tab-bar-height) + 20px);
  min-height: calc(100vh - var(--header-height));
}

.tab-page { display: none; animation: fadeIn 0.3s; }
.tab-page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== 页面头部 ==================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
}

.date-input {
  border: 2px solid var(--green-light);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--text-dark);
  background: var(--white);
  outline: none;
  font-family: var(--font);
}

/* ==================== 卡片通用 ==================== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==================== 重启计划 ==================== */
.completion-rate {
  text-align: center;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-gray);
}
.completion-rate .rate-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--green-deep);
}
.completion-rate .rate-bar {
  height: 8px;
  background: var(--green-soft);
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}
.completion-rate .rate-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-light), var(--green-deep));
  border-radius: 4px;
  transition: width 0.5s;
}

.task-list { margin-bottom: 12px; }

.task-item {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 三态勾选框 */
.check-tri {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
  transition: all 0.2s;
  background: var(--white);
  color: transparent;
  user-select: none;
}
.check-tri.state-none { border-color: var(--text-light); background: var(--white); }
.check-tri.state-done { border-color: var(--green-deep); background: var(--green-deep); color: var(--white); }
.check-tri.state-undone { border-color: var(--red-task); background: var(--red-task); color: var(--white); }

.task-name {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
}
.task-item.task-done .task-name {
  color: var(--text-gray);
  text-decoration: line-through;
}
.task-item.task-undone {
  background: var(--pink-soft);
  border-color: var(--pink-light);
}

.task-sub-tasks {
  display: flex;
  gap: 8px;
  margin-left: 38px;
  margin-top: 6px;
}
.sub-task {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-gray);
}
.sub-task .check-tri { width: 22px; height: 22px; font-size: 12px; border-radius: 6px; }
.sub-task .check-tri.state-undone { border-color: var(--red-task); background: var(--red-task); color: var(--white); }

.task-note {
  margin-left: 38px;
  margin-top: 8px;
  width: calc(100% - 38px);
  border: 1.5px dashed var(--green-light);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--green-deep);
  font-family: var(--font);
  resize: vertical;
  min-height: 32px;
  background: #e8f7ed;
  outline: none;
}
.task-note::placeholder { color: var(--text-light); opacity: 0.7; }
.task-note:focus { border-color: var(--green-deep); background: var(--white); }

.general-note-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.note-label {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  display: block;
}
.general-note {
  width: 100%;
  border: 1.5px solid var(--pink-light);
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  color: var(--green-deep);
  font-family: var(--font);
  resize: vertical;
  min-height: 50px;
  outline: none;
  background: var(--pink-soft);
}
.general-note::placeholder { color: var(--text-light); -webkit-text-fill-color: var(--text-light); opacity: 0.7; }
.general-note:focus { border-color: var(--pink-deep); background: var(--white); }

/* 粉色备注框输入文字使用黑色，聚焦时背景变白、文字仍黑色 */
.general-note, .period-note, .book-note-textarea {
  color: var(--text-dark) !important;
  -webkit-text-fill-color: var(--text-dark) !important;
  caret-color: var(--text-dark);
}
.general-note:focus, .period-note:focus, .book-note-textarea:focus {
  color: var(--text-dark) !important;
  -webkit-text-fill-color: var(--text-dark) !important;
  caret-color: var(--text-dark);
}
.general-note::placeholder, .period-note::placeholder, .book-note-textarea::placeholder {
  color: var(--text-light) !important;
  -webkit-text-fill-color: var(--text-light) !important;
  opacity: 0.7;
}

/* ==================== 运动 Tab ==================== */
.today-training-list { margin-bottom: 10px; }
.training-item {
  display: grid;
  grid-template-columns: 1fr 64px 20px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--green-soft);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}
.training-item .ti-name { font-weight: 600; }
.training-item .ti-duration { color: var(--green-deep); font-weight: 700; text-align: right; }
.training-item .ti-remove {
  color: var(--red-task);
  cursor: pointer;
  font-size: 18px;
  text-align: center;
  line-height: 1;
}

.training-summary {
  border-top: 2px dashed var(--green-light);
  padding-top: 10px;
  font-size: 13px;
}
.training-summary .sum-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.training-summary .sum-value { font-weight: 700; color: var(--green-deep); }

/* 日历 */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--green-soft);
  border-radius: 50%;
  font-size: 20px;
  color: var(--green-deep);
  cursor: pointer;
}
.cal-title { font-size: 16px; font-weight: 700; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-weekday {
  text-align: center;
  font-size: 11px;
  color: var(--text-gray);
  padding: 4px 0;
  font-weight: 600;
}
.cal-day {
  min-height: 68px;
  border-radius: 10px;
  padding: 5px 3px;
  font-size: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  position: relative;
  background: var(--white);
  border: 1.5px solid transparent;
  overflow: hidden;
}
.cal-day.other-month { color: var(--text-light); opacity: 0.4; }
.cal-day.today { border-color: var(--pink-deep); }
.cal-day.selected { background: var(--green-deep); border-color: var(--green-deep); color: var(--white); }
.cal-day .day-num { font-weight: 600; font-size: 13px; }
.cal-day .day-icon { font-size: 10px; margin-top: 1px; }
.cal-day .day-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-top: 2px;
  padding: 0 1px;
  max-width: 100%;
  overflow: hidden;
}
.cal-day .day-cat {
  font-size: 9px;
  line-height: 1.25;
  color: var(--green-deep);
  font-weight: 700;
  white-space: nowrap;
}
.cal-day .day-duration { font-size: 8px; color: var(--green-deep); }
.cal-day.selected .day-label,
.cal-day.selected .day-cat { color: var(--white); }
.cal-day.selected .day-duration { color: var(--white); }

/* 运动分类 */
.cat-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.cat-tab {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--green-light);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-gray);
  cursor: pointer;
  transition: all 0.2s;
}
.cat-tab.active {
  background: var(--green-light);
  border-color: var(--green-deep);
  color: var(--white);
}

.subcat-list { }
.subcat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--white);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}
.subcat-item .sc-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.subcat-item .sc-name { font-weight: 600; }
.subcat-item .sc-arrow { font-size: 12px; color: var(--text-gray); }
.subcat-item .sc-add-btn {
  border: 1.5px solid var(--green-light);
  background: var(--white);
  color: var(--green-deep);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 8px;
  flex-shrink: 0;
}
.subcat-item .sc-add-btn:hover { background: var(--green-light); color: var(--white); }

.detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-left: 16px;
  background: var(--green-soft);
  border-radius: 8px;
  margin-bottom: 4px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s;
}
.detail-item .di-name { font-size: 13px; }
.detail-item .di-duration { font-size: 12px; color: var(--green-deep); font-weight: 600; }
.detail-item .di-actions { display: flex; gap: 6px; }
.detail-item .di-btn { cursor: pointer; font-size: 14px; color: var(--text-gray); }
.detail-delete {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 60px;
  background: var(--red-task);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transform: translateX(100%);
  transition: transform 0.2s;
}
.detail-item.swiped { transform: translateX(-60px); }
.detail-item.swiped .detail-delete { transform: translateX(0); }

.duration-input {
  width: 60px;
  border: 1.5px solid var(--green-light);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 13px;
  text-align: center;
  outline: none;
}

/* 待确认训练输入行 */
.training-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  background: var(--pink-soft);
  border-radius: 8px;
  margin-bottom: 6px;
}
.training-input-row .ti-name { font-weight: 600; flex: 1; }
.training-input-row .duration-input { width: 50px; }
.training-input-row .ti-confirm,
.training-input-row .ti-cancel {
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  color: var(--white);
}
.training-input-row .ti-confirm { background: var(--green-deep); }
.training-input-row .ti-cancel { background: var(--red-task); }

/* 添加子类按钮 */
.add-subcat-btn {
  padding: 8px;
  margin: 4px 0;
  text-align: center;
  border: 1.5px dashed var(--green-light);
  border-radius: 8px;
  color: var(--green-deep);
  font-size: 13px;
  cursor: pointer;
}

/* ==================== 体重 Tab ==================== */
.weight-input-section { text-align: center; }
.weight-input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.weight-input {
  width: 120px;
  border: 2px solid var(--green-light);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  color: var(--text-dark);
  outline: none;
  font-family: var(--font);
}
.weight-input:focus { border-color: var(--green-deep); }
.weight-unit { font-size: 18px; font-weight: 600; color: var(--text-gray); }
.weight-diff { font-size: 13px; font-weight: 600; min-width: 100px; text-align: left; }
.weight-diff.down { color: var(--blue-info); }
.weight-diff.up { color: var(--red-task); }
.weight-diff.flat { color: var(--text-dark); }

.goal-display { font-size: 14px; margin-bottom: 10px; }
.goal-display .goal-main {
  font-size: 18px;
  font-weight: 700;
  color: var(--orange-flame);
  text-align: center;
  margin-bottom: 8px;
}
.goal-milestone {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--pink-soft);
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}
.goal-milestone.done { opacity: 0.5; text-decoration: line-through; }
.goal-milestone .ms-weight { font-weight: 700; color: var(--pink-deep); }
.goal-milestone .ms-date { color: var(--text-gray); margin-left: auto; }

.btn-edit-goal {
  border: 2px solid var(--pink-light);
  border-radius: 20px;
  padding: 6px 20px;
  background: var(--white);
  color: var(--pink-deep);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat-box {
  background: var(--green-soft);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.stat-box .stat-label { font-size: 11px; color: var(--text-gray); }
.stat-box .stat-value { font-size: 18px; font-weight: 700; color: var(--green-deep); }
.stat-box .stat-date { font-size: 10px; color: var(--text-light); }

.chart-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.chart-tab {
  flex: 1;
  padding: 6px;
  border: 1.5px solid var(--green-light);
  border-radius: 16px;
  background: var(--white);
  font-size: 13px;
  color: var(--text-gray);
  cursor: pointer;
}
.chart-tab.active { background: var(--green-light); color: var(--white); border-color: var(--green-deep); }

.chart-wrapper { height: 200px; position: relative; }
.chart-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}
.chart-nav-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--green-soft);
  border-radius: 50%;
  font-size: 18px;
  color: var(--green-deep);
  cursor: pointer;
}
#chart-range-label { font-size: 13px; font-weight: 600; color: var(--text-gray); }

/* ==================== 经期 Tab ==================== */
.period-calendar { }
.period-cal-grid .cal-day.period-day { background: var(--pink-soft); border-color: var(--pink-light); }
.period-cal-grid .cal-day.period-day .day-icon { color: var(--pink-deep); }
.period-cal-grid .cal-day.intimacy-day .day-icon::after { content: '❤️'; }

.period-control { text-align: center; margin: 10px 0; }
.period-btn {
  padding: 10px 30px;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  color: var(--white);
  background: var(--pink-deep);
}
.period-btn.active { background: var(--green-deep); }

.period-clear-btn {
  display: block;
  margin: 8px auto 0;
  padding: 6px 16px;
  border: 1.5px dashed var(--red-task);
  border-radius: 16px;
  background: var(--white);
  color: var(--red-task);
  font-size: 12px;
  cursor: pointer;
}

.period-flow-section { margin: 12px 0; }
.flow-label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 8px; }
.flow-options { display: flex; gap: 6px; flex-wrap: wrap; }
.flow-option {
  padding: 6px 14px;
  border: 1.5px solid var(--pink-light);
  border-radius: 16px;
  background: var(--white);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-gray);
}
.flow-option.active { background: var(--pink-light); border-color: var(--pink-deep); color: var(--white); font-weight: 600; }

.period-intimacy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0;
}
.switch-label { font-size: 14px; font-weight: 600; }
.switch { position: relative; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--text-light);
  border-radius: 28px;
  transition: 0.3s;
}
.switch-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: 0.3s;
}
.switch input:checked + .switch-slider { background: var(--pink-deep); }
.switch input:checked + .switch-slider::before { transform: translateX(22px); }

.period-tips { margin-top: 10px; }
.period-tip {
  background: var(--pink-soft);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-dark);
}
.period-tip::before { content: '🌸 '; }

.period-note {
  width: 100%;
  border: 1.5px solid var(--pink-light);
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  font-family: var(--font);
  resize: vertical;
  min-height: 50px;
  outline: none;
  background: var(--pink-soft);
  margin-top: 8px;
}
.period-note:focus { border-color: var(--pink-deep); background: var(--white); }

/* 心情 */
.mood-icons {
  display: flex;
  justify-content: space-around;
  margin: 10px 0;
}
.mood-icon {
  font-size: 32px;
  cursor: pointer;
  padding: 6px;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: all 0.2s;
  text-align: center;
}
.mood-icon .mood-label { font-size: 9px; display: block; color: var(--text-gray); }
.mood-icon.selected { border-color: var(--pink-deep); background: var(--pink-soft); transform: scale(1.1); }

/* ==================== 英语 Tab ==================== */
.word-count { font-size: 12px; color: var(--text-gray); font-weight: 400; }
.words-list { }
.word-item {
  background: var(--green-soft);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}
.word-item .word-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.word-item .word-text { font-size: 18px; font-weight: 700; color: var(--text-dark); }
.word-item .word-phonetic { font-size: 12px; color: var(--text-gray); }
.word-item .word-meaning { font-size: 13px; color: var(--text-dark); margin-top: 4px; }
.word-item .word-actions { display: flex; gap: 6px; align-items: center; }
.word-btn {
  border: none;
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--white);
}
.word-btn.play { background: var(--blue-info); }
.word-btn.read { background: var(--orange-flame); }
.word-status {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.status-btn {
  flex: 1;
  border: 1.5px solid var(--green-light);
  border-radius: 16px;
  padding: 4px;
  font-size: 12px;
  background: var(--white);
  color: var(--text-gray);
  cursor: pointer;
}
.status-btn.active.mastered { background: var(--green-deep); color: var(--white); border-color: var(--green-deep); }
.status-btn.active.review { background: var(--orange-flame); color: var(--white); border-color: var(--orange-flame); }
.status-btn.active.new { background: var(--red-task); color: var(--white); border-color: var(--red-task); }

.btn-test {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 12px;
  background: var(--green-deep);
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.btn-test:disabled { opacity: 0.4; cursor: not-allowed; }

.sentences-list .sentence-item {
  background: var(--pink-soft);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}
.sentence-item .sen-en { font-size: 14px; font-weight: 600; }
.sentence-item .sen-zh { font-size: 13px; color: var(--text-gray); margin-top: 2px; }
.sentence-item .sen-play {
  border: none;
  background: var(--pink-deep);
  color: var(--white);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
  margin-top: 4px;
}

.article-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-dark);
  max-height: 300px;
  overflow-y: auto;
  background: var(--cream);
  border-radius: 10px;
  padding: 12px;
}
.article-word {
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.2s;
}
.article-word:hover { background: var(--green-soft); }
.article-word.has-note {
  background: var(--pink-soft);
  border-bottom: 2px solid var(--pink-deep);
  font-weight: 600;
}
.word-note-tooltip {
  display: inline-block;
  background: var(--pink-deep);
  color: var(--white);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin-left: 4px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-read-article {
  border: 1.5px solid var(--orange-flame);
  background: var(--white);
  color: var(--orange-flame);
  border-radius: 16px;
  padding: 4px 16px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 8px;
}

/* ==================== 书库 Tab ==================== */
.btn-add-book {
  border: 2px solid var(--green-deep);
  background: var(--white);
  color: var(--green-deep);
  border-radius: 20px;
  padding: 4px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.library-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.filter-btn {
  padding: 6px 16px;
  border: 1.5px solid var(--green-light);
  border-radius: 20px;
  background: var(--white);
  font-size: 13px;
  color: var(--text-gray);
  cursor: pointer;
}
.filter-btn.active { background: var(--green-light); color: var(--white); border-color: var(--green-deep); }

.books-grid { }
.book-item {
  display: flex;
  gap: 12px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.book-cover {
  width: 60px;
  height: 80px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--white);
  font-weight: 700;
}
.book-info { flex: 1; }
.book-title { font-size: 16px; font-weight: 700; }
.book-author { font-size: 12px; color: var(--text-gray); margin-top: 2px; }
.book-rating { font-size: 12px; color: var(--orange-flame); margin-top: 2px; }
.book-status-btn {
  border: 1.5px solid var(--green-light);
  background: var(--white);
  border-radius: 16px;
  padding: 2px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-gray);
  margin-top: 6px;
}
.book-status-btn.read { background: var(--green-deep); color: var(--white); border-color: var(--green-deep); }

.book-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.book-note-btn {
  border: 1.5px solid var(--pink-light);
  background: var(--white);
  border-radius: 16px;
  padding: 2px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--pink-deep);
}
.book-note-btn:hover { background: var(--pink-soft); }

.book-note-panel {
  margin-top: 8px;
  background: var(--cream);
  border-radius: 10px;
  padding: 10px;
}
.note-view {
  display: block;
  position: relative;
}
.note-view .note-edit-btn {
  float: right;
  margin-left: 8px;
  margin-bottom: 6px;
  width: auto;
  height: auto;
  line-height: 1.2;
  padding: 4px 12px;
  flex: none;
  align-self: flex-start;
}
.note-view .note-text {
  font-size: 13px;
  color: var(--text-dark);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 8px;
}
/* 自定义滚动条 */
.note-text::-webkit-scrollbar { width: 6px; }
.note-text::-webkit-scrollbar-track { background: var(--green-soft); border-radius: 3px; }
.note-text::-webkit-scrollbar-thumb { background: var(--green-deep); border-radius: 3px; }
.note-text::-webkit-scrollbar-thumb:hover { background: var(--orange-flame); }
.note-edit-btn {
  border: 1.5px solid var(--green-light);
  background: var(--white);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--green-deep);
  display: inline-block;
  vertical-align: top;
}
.note-edit {
  margin-top: 4px;
  clear: both;
}

.book-note-section { margin-top: 8px; }
.book-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-gray);
}
.book-note-content {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-dark);
  background: var(--cream);
  border-radius: 8px;
  padding: 8px;
  white-space: pre-wrap;
  display: none;
}
.book-note-content.show { display: block; }
.book-note-textarea {
  width: 100%;
  border: 1.5px solid var(--green-light);
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  font-family: var(--font);
  resize: vertical;
  min-height: 80px;
  outline: none;
}

/* ==================== 阅读页 ==================== */
.reading-page {
  position: fixed;
  inset: 0;
  background: var(--cream);
  z-index: 100;
  overflow-y: auto;
}
.reading-header {
  position: sticky;
  top: 0;
  background: var(--green-deep);
  color: var(--white);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
}
.reading-back {
  background: none;
  border: none;
  color: var(--white);
  font-size: 16px;
  cursor: pointer;
}
.reading-title { font-weight: 600; }
.reading-content {
  padding: 20px;
  font-size: 16px;
  line-height: 2;
  color: var(--text-dark);
  white-space: pre-wrap;
}

/* ==================== 弹窗 ==================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--green-soft);
}
.modal-header h3 { font-size: 17px; }
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-gray);
  cursor: pointer;
}
.modal-body { padding: 16px; }

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--green-soft);
  font-size: 15px;
}
.stat-row .stat-big { font-size: 24px; font-weight: 800; color: var(--green-deep); }
.stat-percent {
  text-align: center;
  margin-top: 12px;
}
.stat-percent .pct-value { font-size: 36px; font-weight: 800; color: var(--orange-flame); }
.stat-percent .pct-label { font-size: 13px; color: var(--text-gray); }

.form-group { margin-bottom: 12px; }
.form-label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 4px; }
.form-input {
  width: 100%;
  border: 1.5px solid var(--green-light);
  border-radius: 8px;
  padding: 8px;
  font-size: 14px;
  outline: none;
  font-family: var(--font);
}
.form-input:focus { border-color: var(--green-deep); }
.btn-save {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 12px;
  background: var(--green-deep);
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

/* ===== 云端同步按钮 / 弹窗 ===== */
.header-cloud-btn {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.45);
  color: var(--green-deep);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.header-cloud-btn.configured {
  background: var(--pink-soft);
  color: var(--pink-deep);
}
.cloud-modal-content { max-width: 420px; }
.cloud-tip {
  font-size: 12px;
  color: var(--text-gray);
  background: var(--green-soft);
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
  line-height: 1.5;
}
.cloud-tip code, .cloud-help code {
  background: rgba(0,0,0,0.06);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 11px;
}
.cloud-tip b { color: var(--green-deep); }
.form-row { margin-bottom: 10px; }
.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-dark);
}
.form-row .form-input { color: var(--text-dark); }
.cloud-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 6px;
}
.btn-cloud {
  padding: 9px 6px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--white);
}
.btn-cloud-test { background: var(--blue-info); }
.btn-cloud-pull { background: var(--green-deep); }
.btn-cloud-push { background: var(--pink-deep); }
.btn-cloud-save { background: var(--orange-flame); }
.cloud-status {
  font-size: 13px;
  font-weight: 600;
  min-height: 18px;
  margin-top: 6px;
}
.cloud-status-ok { color: var(--green-deep); }
.cloud-status-error { color: var(--red-task); }
.cloud-status-loading { color: var(--text-gray); }
.cloud-help {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-gray);
}
.cloud-help summary { cursor: pointer; font-weight: 600; color: var(--text-dark); }
.cloud-help ol { margin: 8px 0 0 18px; line-height: 1.7; }

.milestone-edit-item {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  align-items: center;
}
.milestone-edit-item input { flex: 1; }
.milestone-edit-item .del-ms {
  color: var(--red-task);
  cursor: pointer;
  font-size: 20px;
}

.test-question {
  background: var(--green-soft);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.test-q-text { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.test-options { display: flex; flex-direction: column; gap: 6px; }
.test-option {
  padding: 10px;
  border: 1.5px solid var(--green-light);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  font-size: 14px;
}
.test-option.correct { background: var(--green-deep); color: var(--white); border-color: var(--green-deep); }
.test-option.wrong { background: var(--red-task); color: var(--white); border-color: var(--red-task); }
.test-progress { font-size: 13px; color: var(--text-gray); margin-bottom: 10px; }

/* ==================== 目标达成大字 ==================== */
.goal-celebration {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.goal-celebration-inner {
  text-align: center;
  animation: bounceIn 0.6s;
}
@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}
.goal-fire { font-size: 80px; animation: fireDance 1s infinite alternate; }
@keyframes fireDance { from { transform: rotate(-5deg) scale(1); } to { transform: rotate(5deg) scale(1.1); } }
.goal-text {
  font-size: 28px;
  font-weight: 800;
  color: var(--white);
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  margin: 20px;
  line-height: 1.5;
}
.goal-text span { color: var(--orange-light); font-size: 36px; }
.goal-close-btn {
  padding: 10px 30px;
  border: none;
  border-radius: 24px;
  background: var(--orange-flame);
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  bottom: calc(var(--tab-bar-height) + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 250;
  animation: toastIn 0.3s;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ==================== 语音输入 FAB ==================== */
.voice-fab {
  position: fixed;
  bottom: calc(var(--tab-bar-height) + 20px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 20px;
  border: none;
  background: linear-gradient(135deg, var(--pink-deep), var(--orange-flame));
  padding: 6px;
  box-shadow: 0 6px 16px rgba(255,143,163,0.5);
  cursor: grab;
  z-index: 40;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: fabFloat 3s ease-in-out infinite;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.voice-fab:active { cursor: grabbing; transform: scale(0.95); }
.voice-fab.dragging { transition: none; animation: none; }
.voice-fab-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  pointer-events: none;
}
@keyframes fabFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.voice-modal-content { text-align: center; }
.voice-status {
  font-size: 14px;
  color: var(--text-gray);
  margin: 12px 0;
  padding: 8px;
  border-radius: 8px;
  background: var(--green-soft);
}
.voice-status.recording {
  color: var(--white);
  background: var(--red-task);
  font-weight: 700;
  animation: voicePulse 1s infinite;
}
@keyframes voicePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.02); }
}
.voice-result {
  background: var(--cream);
  border: 2px dashed var(--green-light);
  border-radius: 10px;
  padding: 14px;
  min-height: 100px;
  font-size: 15px;
  color: var(--text-dark);
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.voice-result:empty::before {
  content: attr(placeholder);
  color: var(--text-light);
}
.voice-result::-webkit-scrollbar { width: 6px; }
.voice-result::-webkit-scrollbar-track { background: var(--green-soft); border-radius: 3px; }
.voice-result::-webkit-scrollbar-thumb { background: var(--green-deep); border-radius: 3px; }
.voice-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.btn-voice {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: white;
  background: var(--green-deep);
  transition: transform 0.2s;
}
.btn-voice:active { transform: scale(0.95); }
.btn-voice-start { background: linear-gradient(135deg, var(--pink-deep), var(--orange-flame)); }
.btn-voice-stop { background: var(--red-task); }
.btn-voice-copy { background: var(--green-deep); }
.voice-hint {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 8px;
}
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--tab-bar-height);
  background: linear-gradient(180deg, var(--white) 0%, var(--green-soft) 100%);
  display: flex;
  box-shadow: 0 -4px 20px rgba(168,230,207,0.4);
  z-index: 50;
  border-radius: 24px 24px 0 0;
  border-top: 2px solid var(--green-light);
}
.tab-item {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text-gray);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 6px 0;
  position: relative;
}
.tab-item.active { color: var(--green-deep); }
.tab-icon {
  font-size: 24px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: block;
  line-height: 1;
}
.tab-label { font-size: 10px; font-weight: 600; transition: all 0.3s; }
.tab-item.active .tab-icon {
  transform: translateY(-6px) scale(1.4);
  filter: drop-shadow(0 4px 6px rgba(106,191,138,0.4));
  animation: tabBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tab-item.active .tab-label {
  font-weight: 800;
  transform: translateY(-2px);
}
.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 24px;
  height: 3px;
  background: var(--pink-deep);
  border-radius: 2px;
}
@keyframes tabBounce {
  0% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-10px) scale(1.5); }
  60% { transform: translateY(-4px) scale(1.35); }
  100% { transform: translateY(-6px) scale(1.4); }
}

/* 空提示 */
.empty-hint { color: var(--text-light); font-size: 13px; text-align: center; padding: 12px; }

/* 体重日历 */
.weight-cal-toggle {
  width: 100%;
  border: none;
  background: none;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  text-align: left;
  padding: 4px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.weight-cal-content { margin-top: 10px; }
.weight-cal-grid .cal-day .day-weight {
  font-size: 9px;
  color: var(--pink-deep);
  font-weight: 600;
  margin-top: 1px;
}

/* 搜索结果 */
.search-result {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--green-soft);
}
.search-result .sr-add {
  background: var(--green-deep);
  color: var(--white);
  border: none;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  align-self: center;
}
