/* ============================================================
   米诺神仙 · 黑白极简 · 浅粉打卡圈 · 可爱风
   Mobile-first, 适配 iPhone(15 Pro Max / 刘海 & 灵动岛安全区)
   ============================================================ */

:root {
  --ink: #171717;
  --ink-soft: #555;
  --ink-faint: #8f8f8f;
  --paper: #ffffff;
  --paper-soft: #fafafa;
  --line: #e7e7e7;
  --line-soft: #f1f1f1;
  --pink: #ffc6d6;          /* 浅粉打卡圈 */
  --pink-deep: #ff9dbb;     /* 进度环 / 强调 */
  --pink-tint: #fff4f7;     /* 浅粉底卡 */
  --radius: 22px;
  --shadow: 0 2px 0 rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  background: #fff;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--paper);
}

/* ---------------- 顶栏 ---------------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(14px + var(--safe-top)) 20px 10px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.logo-mark { color: var(--pink-deep); font-size: 15px; }
.brand-sub { font-size: 10.5px; color: var(--ink-faint); letter-spacing: 2.2px; text-transform: uppercase; margin-top: 3px; }

/* ---------------- 内容滚动区 ---------------- */
#content { flex: 1; overflow-y: auto; padding-bottom: calc(96px + var(--safe-bottom)); }

.view { display: none; padding: 18px 20px 30px; animation: viewIn .24s ease both; }
.view.active { display: block; }

@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-title { font-size: 22px; font-weight: 800; margin: 4px 0 2px; letter-spacing: .5px; }
.view-sub { font-size: 12.5px; color: var(--ink-faint); margin: 0 0 14px; }
.sub-title { font-size: 13px; font-weight: 700; color: var(--ink-faint); margin: 22px 0 10px; letter-spacing: 1px; }

/* ---------------- 打卡页 ---------------- */
.date-line { font-size: 13px; color: var(--ink-soft); font-weight: 600; margin: 6px 2px 4px; }
#dateLine .today-big { font-weight: 800; font-size: 14px; color: var(--ink); }

.ring-wrap {
  position: relative;
  width: min(62vw, 268px);
  aspect-ratio: 1;
  margin: 18px auto 14px;
}

.progress-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #f4f4f4; stroke-width: 7; }
.ring-fg {
  fill: none;
  stroke: var(--pink-deep);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset .5s cubic-bezier(.3,.9,.3,1);
}

.check-circle {
  position: absolute;
  inset: 9.5%;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 32% 28%, #ffe2ec, var(--pink) 62%, #ffb9cd);
  box-shadow: 0 10px 30px rgba(255,150,180,.28), inset 0 -6px 16px rgba(255,140,170,.18), inset 0 4px 10px rgba(255,255,255,.65);
  color: #6d1428;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: inherit;
  transition: transform .12s ease;
  -webkit-user-select: none;
  user-select: none;
}
.check-circle:active { transform: scale(.955); }
.check-circle.pop { animation: pop .42s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { 0% { transform: scale(1);} 40% { transform: scale(1.045);} 100% { transform: scale(1);} }

.check-heart { font-size: clamp(18px, 5vw, 24px); line-height: 1; }
.check-num { font-size: clamp(44px, 14vw, 62px); font-weight: 800; line-height: 1; letter-spacing: -1px; }
.check-unit { font-size: 11.5px; font-weight: 700; letter-spacing: 2px; opacity: .75; margin-top: 4px; }
.check-hint { font-size: 10.5px; opacity: .6; font-weight: 500; margin-top: 3px; }

.home-msg { text-align: center; font-size: 14px; color: var(--ink-soft); font-weight: 600; margin: 4px 10px 6px; min-height: 20px; }
.undo-row { text-align: center; min-height: 30px; }
.undo-btn {
  border: 1px dashed var(--line); background: #fff; color: var(--ink-faint);
  border-radius: 999px; font-size: 12px; padding: 6px 14px; font-family: inherit;
}
.undo-btn:active { background: var(--paper-soft); }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}
.card-title { font-weight: 800; font-size: 14.5px; margin-bottom: 8px; }
.card-sub { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; }
.tiny-note { font-size: 11.5px; color: var(--ink-faint); line-height: 1.55; margin-top: 8px; }

/* 拍照提醒卡 */
.photo-card { border-color: #ffd7e2; background: var(--pink-tint); }
.photo-head { font-weight: 800; font-size: 14.5px; color: #a53055; }
.photo-text { font-size: 12.5px; color: #8a4057; line-height: 1.6; margin: 6px 0 12px; }
.photo-card.calm { border-color: var(--line); background: #fff; }
.photo-card.calm .photo-head { color: var(--ink); }
.photo-card.calm .photo-text { color: var(--ink-faint); }

/* ---------------- 按钮 ---------------- */
.btn {
  border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  font-size: 13.5px; font-weight: 700; font-family: inherit;
  padding: 11px 18px; flex: 1; cursor: pointer;
  transition: transform .1s ease, background .15s;
}
.btn:active { transform: scale(.96); }
.btn.pink { background: var(--pink); border-color: #ffb3c9; color: #7c1630; }
.btn.pink:active { background: #ffb6cc; }
.btn.ghost { background: transparent; }
.btn.danger-ghost { background: transparent; border-color: #f3d6d6; color: #b3474f; }
.btn-row { display: flex; gap: 10px; margin: 8px 0; }
.btn-row .btn { flex: 1 1 0; min-width: 0; white-space: nowrap; }

/* 完整计划入口卡 */
.cta-card {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--pink-tint); border-color: #ffd7e2; cursor: pointer;
  padding: 15px 18px;
}
.cta-card:active { transform: scale(.985); background: #ffe9f0; }
.cta-arrow { font-size: 26px; color: var(--pink-deep); font-weight: 400; line-height: 1; padding-left: 10px; }

/* 完整计划文档视图 */
.doc-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 2px 0 10px;
}
.doc-back {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 999px; font-size: 13px; font-weight: 700; font-family: inherit;
  padding: 8px 16px; cursor: pointer; flex-shrink: 0;
}
.doc-back:active { background: var(--paper-soft); }
.doc-tag { font-size: 10.5px; color: var(--ink-faint); letter-spacing: 1px; text-align: right; }

.plan-doc { font-size: 13.5px; color: var(--ink); line-height: 1.85; }
.plan-doc h1 {
  font-size: 21px; font-weight: 800; margin: 4px 0 12px; letter-spacing: .3px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.plan-doc h2 {
  font-size: 16px; font-weight: 800; margin: 22px 0 8px; padding-top: 6px;
  border-top: 1px dashed var(--line-soft);
}
.plan-doc h3 { font-size: 14.5px; font-weight: 800; margin: 16px 0 6px; }
.plan-doc p { margin: 8px 0; }
.plan-doc ul, .plan-doc ol { margin: 8px 0; padding-left: 22px; }
.plan-doc li { margin: 4px 0; }
.plan-doc li::marker { color: var(--pink-deep); }
.plan-doc strong { color: var(--ink); font-weight: 800; }
.plan-doc em { color: var(--ink-soft); }
.plan-doc blockquote {
  margin: 10px 0; padding: 10px 14px;
  background: var(--paper-soft); border-left: 3px solid var(--pink);
  border-radius: 0 12px 12px 0; color: var(--ink-soft); font-size: 13px;
}
.plan-doc code {
  background: var(--paper-soft); border: 1px solid var(--line-soft);
  border-radius: 6px; padding: 1px 6px; font-size: 12px; font-family: ui-monospace, Menlo, monospace;
}
.plan-doc pre {
  background: #1a1a1a; color: #fff; border-radius: 14px; padding: 12px 14px;
  font-size: 12px; overflow-x: auto; white-space: pre; line-height: 1.7;
}
.plan-doc pre code { background: none; border: none; color: inherit; padding: 0; }
.plan-doc table {
  width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.plan-doc th {
  background: #171717; color: #fff; font-weight: 700; text-align: left;
  padding: 8px 10px; white-space: nowrap;
}
.plan-doc td { padding: 8px 10px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.plan-doc tr:nth-child(even) td { background: var(--paper-soft); }
.plan-doc hr { border: none; border-top: 1px dashed var(--line); margin: 16px 0; }
.plan-doc a { color: #b32a56; word-break: break-all; }
.plan-doc .warn-box {
  background: #fff4f0; border: 1px solid #f6d9c8; color: #8a4a21;
  border-radius: 14px; padding: 10px 14px; font-size: 12.5px; margin: 10px 0;
}
.doc-loading { text-align: center; color: var(--ink-faint); padding: 30px 0; font-size: 13px; }

/* ---------------- 统计行 ---------------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.stat {
  background: var(--paper-soft);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  padding: 12px 6px;
  text-align: center;
}
.stat b { display: block; font-size: 19px; font-weight: 800; }
.stat span { display: block; font-size: 10.5px; color: var(--ink-faint); margin-top: 3px; letter-spacing: .5px; }

/* ---------------- 记录列表 ---------------- */
.log-list { display: flex; flex-direction: column; gap: 10px; }
.log-day {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #fff;
}
.log-day-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--paper-soft);
  font-size: 13px; font-weight: 700;
  border-bottom: 1px solid var(--line-soft);
}
.log-day-head .n { color: var(--ink-faint); font-weight: 600; font-size: 11.5px; }
.log-chip-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
.log-chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  font-size: 12.5px; padding: 7px 12px; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px;
}
.log-chip .x { color: var(--ink-faint); font-weight: 700; padding: 0 2px; }
.log-chip .x:active { color: #c33; }
.log-chip.photo { background: var(--pink-tint); border-color: #ffd7e2; color: #a53055; }
.log-empty { text-align: center; color: var(--ink-faint); font-size: 13.5px; padding: 40px 0; line-height: 2; }

/* ---------------- 周报 ---------------- */
.week-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 10px 0; background: #fff; box-shadow: var(--shadow); }
.week-card.current { border-color: #ffd9e4; }
.week-top { display: flex; justify-content: space-between; align-items: baseline; }
.week-range { font-weight: 800; font-size: 14px; }
.week-verdict { font-size: 11px; font-weight: 800; letter-spacing: 1px; padding: 5px 12px; border-radius: 999px; }
.week-verdict.good { background: var(--pink-tint); color: #c0305c; }
.week-verdict.warn { background: #fff3e8; color: #b36a14; }
.week-verdict.meh { background: var(--paper-soft); color: var(--ink-faint); }
.week-body { margin-top: 12px; }
.bar { height: 12px; border-radius: 999px; background: #f4f4f4; overflow: hidden; margin: 8px 0 4px; }
.bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffd0de, var(--pink-deep)); transition: width .6s ease; }
.week-nums { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.week-quote { font-size: 13px; line-height: 1.7; color: var(--ink-soft); margin-top: 10px; }
.week-quote b { color: var(--ink); }
.mini-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--ink-faint); }

/* ---------------- 计划页 ---------------- */
.seg { display: flex; gap: 8px; }
.seg-btn {
  flex: 1; border: 1.5px solid var(--line); background: #fff; border-radius: 14px;
  padding: 11px 8px; font-size: 13.5px; font-weight: 700; font-family: inherit; color: var(--ink-soft);
}
.seg-btn.on { border-color: var(--pink-deep); background: var(--pink-tint); color: #b0234d; }
.row-toggle {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 2px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.row-toggle input { width: 20px; height: 20px; accent-color: var(--pink-deep); }
.plan-list { margin: 0; padding: 0 0 0 20px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.85; }
.plan-list li::marker { color: var(--pink-deep); }
.plan-pill {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 1px;
  border-radius: 999px; padding: 4px 10px; margin-bottom: 8px;
}
.plan-pill.adapt { background: var(--paper-soft); color: var(--ink-soft); }
.plan-pill.step { background: var(--pink-tint); color: #c0305c; }
.plan-pill.long { background: #171717; color: #fff; }
.big-day { font-size: 30px; font-weight: 800; margin: 4px 0 2px; }
.big-day small { font-size: 13px; color: var(--ink-faint); font-weight: 600; }
.disclaimer { background: var(--paper-soft); border-color: var(--line-soft); }
.disclaimer b { display: block; margin-bottom: 4px; }
input[type="date"] {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff; width: 100%;
}

/* ---------------- 底部导航 ---------------- */
#tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  max-width: 520px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + var(--safe-bottom));
}
.tab {
  border: none; background: none; color: var(--ink-faint);
  font-family: inherit; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 4px 0; font-size: 10.5px; font-weight: 700; cursor: pointer;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--ink); }
.tab.active svg { color: #e75b8b; }

/* ---------------- 弹层 ---------------- */
#modalLayer {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(23,23,23,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
  animation: fadeIn .18s ease both;
}
#modalLayer[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 26px; padding: 26px 22px; width: 100%;
  max-width: 400px; max-height: 82vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  animation: modalIn .28s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 20px; font-weight: 800; margin: 0 0 6px; text-align: center; }
.modal-emoji { text-align: center; font-size: 46px; margin-bottom: 8px; }
.modal-text { font-size: 14px; color: var(--ink-soft); line-height: 1.8; margin: 8px 0 16px; }
.modal-text b { color: var(--ink); }
.modal .btn-row { margin-top: 6px; }

/* ---------------- Toast ---------------- */
#toast {
  position: fixed; left: 50%; bottom: calc(110px + var(--safe-bottom)); transform: translateX(-50%);
  z-index: 60; background: #171717; color: #fff; border-radius: 999px;
  padding: 11px 20px; font-size: 13.5px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: toastIn .25s ease both;
}
#toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------------- 撒花特效 ---------------- */
#fxLayer { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.fx { position: absolute; font-size: 15px; animation: floatUp 1s ease-out forwards; }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(0,0) scale(.5) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), -130px) scale(1.15) rotate(var(--rot)); }
}
.fx.petals { position: absolute; border-radius: 50% 0 50% 0; background: var(--pink); animation: petalFall 1.6s ease-in forwards; }
@keyframes petalFall {
  0% { opacity: 0; transform: translate(0,-10px) rotate(0); }
  20% { opacity: .9; }
  100% { opacity: 0; transform: translate(var(--dx), 300px) rotate(var(--rot)); }
}

/* 桌面宽屏下加一点边框，保持居中观感 */
@media (min-width: 521px) {
  #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); box-shadow: 0 0 40px rgba(0,0,0,.06); }
}
