/* ================================================================
   plan.css —— 问卷弹层 与 学习计划页
   ----------------------------------------------------------------
   两个界面共用一套"弹层"外壳（.overlay + .sheet）：
     · 问卷：顶部进度条 + 中间题目 + 底部固定"继续"按钮
     · 计划页：顶部标题 + 中间可滚动的计划内容
   想改什么：
     · 弹层多宽     → 改 .sheet 的 max-width
     · 弹层多高     → 改 .sheet 的 max-height
     · 阶段时间轴的配色 → 改 .phase-seg 的 background
   ================================================================ */

/* ================= 弹层外壳 ================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(60, 45, 20, .34);
  backdrop-filter: blur(3px);
  animation: fadeIn .18s ease;
}
.overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: 100%;
  max-width: 780px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 24px;
  border: 2px solid var(--line);
  box-shadow: 0 8px 0 var(--line), 0 24px 60px rgba(60, 45, 20, .28);
  overflow: hidden;
  animation: popIn .22s cubic-bezier(.34, 1.3, .64, 1);
}
.sheet.is-wide { max-width: 940px; }
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- 顶部：进度条 ---------- */
.sheet-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 2px solid var(--line);
}
.sheet-top[hidden], .sheet-foot[hidden] { display: none; }

/* 计划页模式：中间区去掉内边距、禁止自身滚动，
   改由计划页内部自己的 .plan-body 滚动，这样头尾按钮能固定住 */
.sheet.mode-plan .sheet-body {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sheet-top .bar { flex: 1; }
.sheet-step {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
}

/* ---------- 中间：可滚动内容区 ---------- */
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 32px 8px;
}

/* ---------- 底部：按钮区 ---------- */
.sheet-foot {
  flex: 0 0 auto;
  padding: 16px 32px 22px;
  border-top: 2px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sheet-foot .grow { flex: 1; }

/* ================= 问卷题目 ================= */
.q-title {
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 8px;
}
.q-sub {
  font-size: var(--fs-m);
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 26px;
}

/* 日期输入那一屏 */
.date-wrap { display: flex; flex-direction: column; gap: 14px; }
.date-quick { display: flex; flex-wrap: wrap; gap: 10px; }

/* ================= 计划页 ================= */
.plan-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 2px solid var(--line);
}
.plan-head-title { font-size: var(--fs-l); font-weight: 800; color: var(--ink); }

.plan-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- 顶部概览条 ---- */
.hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 22px;
  border-radius: var(--r-l);
  background: linear-gradient(135deg, #FFF6E6, var(--brand-soft));
  border: 2px solid #F3DCB2;
}
.hero-item { flex: 1; min-width: 0; }
.hero-k { font-size: var(--fs-xs); font-weight: 700; color: var(--brand-edge); margin-bottom: 2px; }
.hero-v { font-size: var(--fs-xl); font-weight: 800; color: var(--brand-deep); line-height: 1.2; font-variant-numeric: tabular-nums; }
.hero-sep { width: 2px; align-self: stretch; background: #F0D9AE; border-radius: 2px; }

/* ---- 阶段时间轴 ---- */
.phase-track {
  display: flex;
  gap: 3px;
  height: 46px;
  border-radius: var(--r-s);
  overflow: hidden;
}
.phase-seg {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
}
.phase-seg small { font-weight: 500; opacity: .85; font-size: 11px; }
.phase-seg.is-now { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .85); }
.phase-legend { display: flex; gap: 16px; margin-top: 10px; font-size: var(--fs-xs); color: var(--ink-2); font-weight: 700; }
.phase-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* ---- 四（五）项小分目标 ---- */
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.score-cell {
  text-align: center;
  padding: 12px 6px;
  border-radius: var(--r-m);
  background: var(--card-2);
  border: 2px solid var(--line);
}
.score-cell.is-weak { background: var(--brand-soft); border-color: #F3DCB2; }
.score-name { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); }
.score-val  { font-size: var(--fs-l); font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.score-cell.is-weak .score-name { color: var(--brand-edge); }
.score-cell.is-weak .score-val  { color: var(--brand-deep); }

/* ---- 时间分配堆叠条 ---- */
.stack {
  display: flex;
  height: 22px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--line);
}
.stack > i { display: block; transition: width .3s ease; }
.stack-legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  margin-top: 12px;
}
.stack-legend > span { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); }
.stack-legend i { width: 10px; height: 10px; border-radius: 3px; }

/* ---- 每日任务行 ---- */
.task-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 2px dashed var(--line);
}
.task-row:last-child { border-bottom: none; }
.task-info { flex: 1; min-width: 0; }
.task-name { font-size: var(--fs-m); font-weight: 800; color: var(--ink); }
.task-amount { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); }

/* ---- 合计行 ---- */
.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--r-m);
  background: var(--card-2);
  border: 2px solid var(--line);
  margin-top: 8px;
}
.total-row.is-over { background: var(--danger-soft); border-color: #F6C9C9; }
.total-num { font-size: var(--fs-m); font-weight: 800; font-variant-numeric: tabular-nums; }
.total-num.is-over { color: var(--danger); }

/* ---- 计划页底部操作 ---- */
.plan-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 20px;
  border-top: 2px solid var(--line);
  background: var(--card);
}
.plan-foot .grow { flex: 1; }

/* ---- 小提示条 ---- */
.tip {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-m);
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: var(--fs-s);
  font-weight: 600;
  line-height: 1.6;
}

/* ================= 窄屏 ================= */
@media (max-width: 720px) {
  .overlay { padding: 0; }
  .sheet { max-width: none; max-height: 100vh; height: 100vh; border-radius: 0; border: none; }
  .sheet-body { padding: 20px 18px 8px; }
  .sheet-foot { padding: 12px 18px 18px; }
  .q-title { font-size: var(--fs-xl); }
  .options.is-grid { grid-template-columns: 1fr; }
  .hero { flex-wrap: wrap; gap: 12px; padding: 16px; }
  .hero-item { flex: 0 0 40%; }
  .hero-v { font-size: var(--fs-l); }
  .hero-sep { display: none; }
  .plan-body { padding: 16px; }
  .plan-head, .plan-foot { padding-left: 16px; padding-right: 16px; }
}
