:root {
  --bg: #F0F7FF;
  --card: #FFFFFF;
  --primary: #FF8A3D;
  --primary-dark: #F0731C;
  --accent: #4D9FFF;
  --green: #3EC97E;
  --text: #2D3A4A;
  --muted: #8CA0B3;
  --radius: 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }

/* ---------- 顶部 ---------- */
.topbar-inner {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 6px;
}
.logo { font-size: 20px; font-weight: 800; color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-badge { font-size: 14px; color: var(--muted); }
.tabs { display: flex; gap: 6px; padding: 8px 18px 12px; }
.tab {
  flex: 1; border: none; background: #E3EEFF; color: var(--accent);
  padding: 10px 0; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.tab.active { background: var(--accent); color: #fff; }

/* ---------- 布局 ---------- */
.view { max-width: 520px; margin: 0 auto; padding: 14px 18px 90px; }
.date-banner {
  text-align: center; font-size: 18px; font-weight: 700; color: var(--accent);
  margin-bottom: 12px;
}

/* ---------- 卡片 ---------- */
.card, .progress-card, .method-card, .stat-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(77, 159, 255, .08);
}
.progress-card { padding: 14px 16px; margin-bottom: 14px; }
.progress-text { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.progress-bar { height: 14px; background: #EAF2FF; border-radius: 999px; overflow: hidden; }
#progressFill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #8BE9B8);
  transition: width .4s ease;
}

/* ---------- 任务列表 ---------- */
.task-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.task-item {
  background: var(--card); border-radius: var(--radius);
  padding: 12px 14px; display: flex; align-items: flex-start; gap: 12px;
  box-shadow: 0 2px 8px rgba(77, 159, 255, .08);
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.check-btn {
  width: 34px; height: 34px; min-width: 34px; border-radius: 50%;
  border: 3px solid #D5E4F7; background: #fff; font-size: 17px; cursor: pointer;
  color: transparent; transition: all .15s;
}
.check-btn:hover { border-color: var(--green); }
.task-item.done .check-btn { background: var(--green); border-color: var(--green); color: #fff; }
.task-body { flex: 1; }
.task-title { font-size: 16px; font-weight: 600; word-break: break-all; }
.task-item.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 8px; }
.task-tip { font-size: 13px; color: var(--accent); margin-top: 5px; background: #F0F7FF; border-radius: 8px; padding: 5px 9px; }
.task-streak { color: var(--primary-dark); font-weight: 700; }
.del-btn {
  border: none; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px;
}
.del-btn:hover { color: #F05A5A; }

/* ---------- 表单 ---------- */
.task-form, .auth-card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: 0 2px 10px rgba(77, 159, 255, .08);
}
.task-form input, .task-form select, .auth-card input {
  width: 100%; padding: 12px 14px; border: 2px solid #E3EEFF; border-radius: 12px;
  font-size: 15px; margin-bottom: 10px; outline: none; background: #FBFDFF;
}
.task-form input:focus, .task-form select:focus, .auth-card input:focus { border-color: var(--accent); }
.form-row { display: flex; gap: 10px; }
.form-row input, .form-row select { flex: 1; min-width: 0; }
#taskEmoji { flex: 0 0 64px; text-align: center; }

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: 12px; padding: 12px 20px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-ghost { background: none; color: var(--muted); padding: 8px 10px; }

/* ---------- 登录 ---------- */
.auth-view { display: flex; justify-content: center; padding-top: 8vh; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { text-align: center; color: var(--primary); margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 18px; }
.seg { display: flex; background: #EAF2FF; border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.seg-btn {
  flex: 1; border: none; background: none; padding: 9px 0; border-radius: 9px;
  font-size: 14.5px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg-btn.active { background: #fff; color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.msg { text-align: center; font-size: 14px; margin-top: 10px; min-height: 20px; color: #F05A5A; }

/* ---------- 方法 ---------- */
.view-desc { color: var(--muted); font-size: 14.5px; margin-bottom: 14px; line-height: 1.6; }
.method-card { padding: 16px; margin-bottom: 14px; }
.method-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.method-emoji { font-size: 28px; }
.method-name { font-size: 17px; font-weight: 800; }
.method-badge {
  margin-left: auto; font-size: 12px; background: #E7F8EF; color: var(--green);
  padding: 3px 10px; border-radius: 999px; font-weight: 700;
}
.method-desc { font-size: 14px; line-height: 1.7; color: var(--text); margin-bottom: 8px; }
.method-tips { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 12px; }
.method-tips li { margin-left: 18px; }

/* ---------- AI 排计划卡片 ---------- */
.ai-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(77, 159, 255, .08); margin-bottom: 16px; overflow: hidden;
}
.ai-card-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; cursor: pointer; user-select: none;
}
.ai-card-title { font-weight: 700; font-size: 15px; }
.ai-caret { color: var(--muted); transition: transform .2s; }
.ai-card-body { padding: 0 16px 16px; }
.ai-card-body.hidden + * { margin-top: 0; }
#aiText {
  width: 100%; border: 2px solid #E3EEFF; border-radius: 12px; padding: 12px 14px;
  font-size: 15px; font-family: inherit; resize: none; outline: none; background: #FBFDFF;
  margin-bottom: 12px;
}
#aiText:focus { border-color: var(--accent); }
.ai-actions { display: flex; gap: 10px; }
.ai-actions .btn { flex: 1; }
.btn-mic { background: #EAF2FF; color: var(--accent); }
.btn-mic.listening { background: #FFE8D6; color: var(--primary-dark); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }
.ai-hint { font-size: 13.5px; color: var(--muted); margin-top: 10px; min-height: 18px; text-align: center; }
.ai-plan-title { font-size: 15px; margin-bottom: 10px; color: var(--text); }
#aiPlanBox .btn-block { margin-top: 4px; }

/* ---------- 成就 ---------- */
.stats-cards { display: flex; gap: 12px; margin-bottom: 16px; }
.stat-card { flex: 1; padding: 18px 0; text-align: center; }
.stat-num { font-size: 32px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
#statsView h3 { margin-bottom: 10px; font-size: 15px; }
.heat-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.heat-cell { aspect-ratio: 1; border-radius: 6px; background: #EAF2FF; }
.heat-cell.on { background: var(--green); }
.heat-cell.today { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.stats-note { font-size: 13px; color: var(--muted); margin-top: 12px; text-align: center; }

/* ---------- 提醒弹窗 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(20, 40, 70, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-card {
  background: #fff; border-radius: 22px; padding: 24px 20px; width: 100%; max-width: 360px;
  text-align: center; animation: pop .25s ease;
}
.modal-emoji { font-size: 44px; }
.modal-card h3 { margin: 8px 0 14px; }
#reminderList { text-align: left; margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.reminder-item {
  background: #FFF4EA; border-radius: 12px; padding: 10px 14px; font-size: 15px; font-weight: 600;
}
.reminder-item .r-time { color: var(--primary-dark); font-weight: 800; margin-right: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: #2D3A4A; color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 14px; z-index: 200; animation: pop .2s ease;
}
.empty { text-align: center; color: var(--muted); font-size: 14.5px; padding: 26px 0; }
