/* styles.css — 移动优先，柔和孕期配色（紫/粉调，呼应运动漫画） */

:root {
  color-scheme: light only;
  --bg: #faf7fc;
  --card: #ffffff;
  --ink: #3a3147;
  --ink-soft: #6f6580;
  --accent: #9b8ec4;       /* 主紫 */
  --accent-deep: #7a6bb0;
  --pink: #f4c6d8;
  --tri1: #a8d5b5;         /* 早期 绿 */
  --tri2: #8fb8e8;         /* 中期 蓝 */
  --tri3: #c9a0d8;         /* 晚期 紫 */
  --shadow: 0 4px 18px rgba(123, 107, 176, 0.10);
  --radius: 18px;
}

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

/* 关键修复：HTML 的 hidden 属性必须能盖过 display:flex/block，
 * 否则 .img-viewer / .modal-mask 即使 hidden 也一直显示，全屏挡住点击。 */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---- 顶栏 ---- */
.appbar {
  text-align: center;
  padding: 22px 16px 14px;
}
.logo { font-size: 24px; font-weight: 800; color: var(--accent-deep); }
.logo-sub { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

/* ---- 容器 ---- */
.wrap { max-width: 520px; margin: 0 auto; padding: 0 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

/* ---- 输入区 ---- */
.input-label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.date-input {
  width: 100%;
  font-size: 17px;
  padding: 13px 14px;
  border: 1.5px solid #e6ddf0;
  border-radius: 12px;
  background: #fcfaff;
  color: var(--ink);
  margin-bottom: 12px;
}
.date-input:focus { outline: none; border-color: var(--accent); }

.primary-btn {
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border: none;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: transform .1s, box-shadow .2s;
}
.primary-btn:active { transform: scale(0.98); }

.input-error {
  margin-top: 10px;
  color: #c0567a;
  font-size: 14px;
  background: #fdeef3;
  padding: 10px 12px;
  border-radius: 10px;
}

/* ---- 结果大卡 ---- */
.result-card { text-align: center; }
.stage-pill {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.stage-pill.tri-1, .progress-fill.tri-1 { background: var(--tri1); }
.stage-pill.tri-2, .progress-fill.tri-2 { background: var(--tri2); }
.stage-pill.tri-3, .progress-fill.tri-3 { background: var(--tri3); }

.week-big { font-size: 38px; font-weight: 900; color: var(--accent-deep); letter-spacing: -0.5px; }

.progress-track {
  height: 8px;
  background: #efe9f6;
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0;
}
.progress-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }

.result-meta { display: flex; gap: 12px; }
.meta-item {
  flex: 1;
  background: #f7f3fc;
  border-radius: 12px;
  padding: 12px 8px;
}
.meta-label { display: block; font-size: 12px; color: var(--ink-soft); }
.meta-val { display: block; font-size: 15px; font-weight: 700; margin-top: 3px; }

/* ---- 本周卡 ---- */
.section-title { font-size: 17px; font-weight: 800; margin-bottom: 14px; }

.weekly-block { margin-bottom: 14px; }
.weekly-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.weekly-icon { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
.weekly-k { font-size: 13px; font-weight: 700; color: var(--accent-deep); }
.weekly-row p, .todo-block { font-size: 14.5px; }

.todo-block { margin-bottom: 14px; }
.todo-list { list-style: none; margin-top: 8px; }
.todo-list li {
  position: relative;
  padding: 7px 0 7px 26px;
  font-size: 14.5px;
  border-bottom: 1px solid #f3eef8;
}
.todo-list li:last-child { border-bottom: none; }
.todo-list li::before {
  content: '○';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-size: 15px;
}

.checkup-block {
  background: #fff5f8;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.checkup-tag { font-size: 13px; font-weight: 700; color: #c0567a; }
.checkup-block p { font-size: 14px; margin-top: 4px; }

.tip-line { font-size: 14px; color: var(--ink-soft); background: #f7f3fc; padding: 10px 12px; border-radius: 10px; }

/* ---- 运动漫画 ---- */
.overview-img {
  width: 100%;
  border-radius: 12px;
  cursor: pointer;
  display: block;
}
.overview-note { font-size: 13.5px; color: var(--ink-soft); margin: 10px 0 16px; text-align: center; }

.exercise-list { display: flex; flex-direction: column; gap: 12px; }
.exercise-item {
  display: flex;
  gap: 12px;
  background: #f9f6fd;
  border-radius: 12px;
  padding: 10px;
  align-items: center;
}
.exercise-thumb {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  cursor: pointer;
  background: #efe9f6;
}
.exercise-title { font-size: 15px; font-weight: 700; }
.exercise-stage {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-deep);
  background: #ece6f6;
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 4px;
}
.exercise-note { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }

/* ---- 小免责 ---- */
.mini-disclaimer {
  font-size: 11.5px;
  color: #a79bb8;
  margin-top: 14px;
  line-height: 1.5;
  padding-top: 12px;
  border-top: 1px dashed #ece6f3;
}

/* ---- 页脚 ---- */
.footer { max-width: 520px; margin: 8px auto 0; padding: 18px 22px 30px; text-align: center; }
.footer-disclaimer, .footer p { font-size: 12px; color: var(--ink-soft); line-height: 1.6; }
.footer-credit { margin-top: 8px; color: #b3a8c4; font-size: 11.5px; }

/* ---- 首次声明弹窗 ---- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(58, 49, 71, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 100;
}
.modal-card {
  background: #fff;
  border-radius: 20px;
  padding: 26px 22px;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-card h2 { font-size: 19px; margin-bottom: 14px; color: var(--accent-deep); }
.modal-card #welcome-body p { font-size: 14px; color: var(--ink-soft); margin-bottom: 12px; line-height: 1.65; }
.modal-card .primary-btn { margin-top: 6px; }

/* ---- 图片放大 ---- */
.img-viewer {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
}
.img-viewer img { max-width: 100%; max-height: 90vh; border-radius: 8px; }
.img-viewer-close {
  position: absolute; top: 20px; right: 20px;
  background: rgba(255,255,255,0.2); color: #fff;
  border: none; width: 40px; height: 40px; border-radius: 50%;
  font-size: 18px; cursor: pointer;
}

/* ---- 桌面端轻微放大留白 ---- */
@media (min-width: 560px) {
  .week-big { font-size: 44px; }
}

/* ---- 关键：声明已自带暗色适配，阻止 Chrome「自动暗色模式」强行染黑 ----
 * Chrome 的 Auto Dark Mode 只会对"没有暗色适配"的页面强制染色。
 * 这里在暗色环境下也显式钉死浅色配色，等于告诉浏览器"我已处理暗色，别动我"。 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #faf7fc;
    --card: #ffffff;
    --ink: #3a3147;
    --ink-soft: #6f6580;
    --accent: #9b8ec4;
    --accent-deep: #7a6bb0;
  }
  html, body { background: #faf7fc !important; color: #3a3147 !important; }
  .card, .modal-card { background: #ffffff !important; }
  .week-big, .logo, .modal-card h2 { color: #7a6bb0 !important; }
  .primary-btn { color: #ffffff !important; }
}
