/*!
 * 优思明 · 每日提醒
 * 视觉：苹果极简白（Apple-minimal white），参考 ixuexi.xyz 的设计语言。
 */

:root {
  --canvas: #ffffff;
  --canvas-alt: #f5f5f7;
  --ink: #1d1d1f;
  --ink-muted: #6e6e73;
  --ink-subtle: #86868b;
  --hairline: #d2d2d7;
  --hairline-soft: #e8e8ed;
  --accent: #0066cc;
  --accent-hover: #0071e3;
  --accent-soft: rgba(0, 102, 204, 0.09);
  --danger: #c7362b;
  --danger-soft: #fdf0ee;
  --warn: #a86a00;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
  --max: 1000px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable", "Segoe UI", Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom);
}

body.is-onboard,
body.sheet-open { overflow: hidden; }

h1, h2, h3, p, ul, ol { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { font-family: inherit; }
svg { display: block; }

::selection { background: rgba(0, 102, 204, 0.16); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
}
.skip-link:focus { left: 16px; color: #fff; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline-soft);
}

.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  min-width: 0;
}
.brand:hover { color: var(--ink); }

.brand-mark { width: 30px; height: 30px; color: var(--ink); flex: 0 0 auto; }
.brand-mark svg { width: 30px; height: 30px; border-radius: 9px; }

.brand-text { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.brand-text strong { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.brand-text span {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--ink-subtle);
  font-weight: 600;
}

.nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.nav a {
  position: relative;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-muted);
  border-radius: 8px;
}
.nav a:hover { color: var(--ink); background: var(--canvas-alt); }
.nav a.is-active { color: var(--ink); }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}

.install-btn {
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.install-btn:hover { background: var(--canvas-alt); border-color: var(--ink-subtle); }

/* ---------------- 主容器 ---------------- */
.main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 64px 24px 96px;
}

.view { padding-bottom: 32px; }

/* ---------------- Hero ---------------- */
.hero { padding: 46px 0 6px; max-width: 840px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  flex: 0 0 auto;
}
.eyebrow .dot.is-due { background: var(--warn); }
.eyebrow .dot.is-late { background: var(--danger); }
.eyebrow .dot.is-rest { background: var(--accent); }

.hero-title {
  margin: 16px 0 0;
  font-size: clamp(40px, 6.6vw, 66px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: var(--ink);
}
.hero-title .check {
  display: inline-block;
  color: var(--accent);
  font-size: 0.78em;
  transform: translateY(-0.04em);
  margin-left: 0.06em;
}

.hero-sub {
  margin: 18px 0 0;
  max-width: 620px;
  font-size: clamp(15.5px, 1.8vw, 18px);
  line-height: 1.6;
  color: var(--ink-muted);
}
.hero-sub strong { color: var(--ink); font-weight: 600; }
.hero-sub .warn { color: var(--danger); font-weight: 600; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-note {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--ink-subtle);
  line-height: 1.6;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 980px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.12s var(--ease);
}
.btn:active { transform: scale(0.985); }
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #000; color: #fff; border-color: #000; }

.btn-ghost { background: transparent; color: var(--accent); border-color: var(--hairline); }
.btn-ghost:hover { background: var(--canvas-alt); color: var(--accent-hover); border-color: var(--ink-subtle); }

.btn-danger { color: var(--danger); border-color: var(--hairline); }
.btn-danger:hover { background: var(--danger-soft); border-color: #f0c9c4; color: var(--danger); }

.btn-lg { height: 52px; padding: 0 30px; font-size: 15.5px; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 13px; }
.btn-block { width: 100%; }

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------------- 提示条 ---------------- */
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  background: var(--canvas-alt);
}
.notice strong { display: block; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.notice p { margin: 4px 0 0; font-size: 12px; line-height: 1.55; color: var(--ink-muted); max-width: 600px; }

/* ---------------- 卡片面板 ---------------- */
.panel {
  margin-top: 16px;
  padding: 24px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-lg);
  background: #fff;
}
.panel-tight { padding: 20px 22px; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.panel-head h2 {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.35;
}
.panel-meta {
  flex: 0 0 auto;
  padding-top: 2px;
  font-size: 12px;
  color: var(--ink-subtle);
  white-space: nowrap;
}

.section-block { margin-top: 44px; }
.section-kicker {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.section-title {
  margin: 12px 0 0;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.section-lede {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-muted);
  max-width: 640px;
}

.page-head { padding: 44px 0 8px; max-width: 760px; }
.page-title {
  margin: 14px 0 0;
  font-size: clamp(38px, 5.6vw, 56px);
  line-height: 1.03;
  letter-spacing: -0.038em;
  font-weight: 800;
}
.page-lede {
  margin: 16px 0 0;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink-muted);
  max-width: 640px;
}

/* ---------------- 周期条 ---------------- */
.cycle-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  align-items: start;
}
.cycle-block { min-width: 0; }
.cycle-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.cycle-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.pday {
  position: relative;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-subtle);
  background: var(--canvas-alt);
}
.pday.is-upcoming { background: #fff; border-color: var(--hairline-soft); color: var(--ink-muted); }
.pday.is-taken { background: var(--ink); color: #fff; font-weight: 600; }
.pday.is-missed { background: var(--danger-soft); border-color: #f3d2cd; color: var(--danger); font-weight: 600; }
.pday.is-break { background: transparent; border: 1px dashed var(--hairline); color: var(--ink-subtle); }
.pday.is-today { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.pday.is-today.is-taken { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--ink-muted);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--canvas-alt);
  border: 1px solid var(--hairline-soft);
  display: inline-block;
}
.legend i.taken { background: var(--ink); border-color: var(--ink); }
.legend i.missed { background: var(--danger-soft); border-color: #f0c9c4; }
.legend i.today { background: #fff; border: 2px solid var(--ink); }
.legend i.break { background: transparent; border: 1px dashed var(--hairline); }

/* ---------------- 数字卡片 ---------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 108px;
  padding: 18px 18px 16px;
  border-radius: var(--radius);
  background: var(--canvas-alt);
}
.stat-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}
.stat-value {
  margin-top: 14px;
  font-size: clamp(24px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-value small {
  margin-left: 3px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-subtle);
}
.stat-sub {
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-subtle);
}
.stat-sub strong { color: var(--ink-muted); font-weight: 500; }

/* ---------------- 空档期 ---------------- */
.break-track {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}
.bday {
  padding: 10px 4px 9px;
  border: 1px dashed var(--hairline);
  border-radius: 10px;
  text-align: center;
  font-size: 10.5px;
  color: var(--ink-subtle);
}
.bday strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.bday.is-done { background: var(--canvas-alt); border-style: solid; border-color: var(--hairline-soft); }
.bday.is-done strong { color: var(--ink-subtle); }
.bday.is-now { background: var(--ink); border-color: var(--ink); color: rgba(255, 255, 255, 0.72); }
.bday.is-now strong { color: #fff; }
.bday.is-rest { background: var(--accent-soft); border: 1px dashed rgba(0, 102, 204, 0.35); }
.bday.is-rest strong { color: var(--accent); }

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline-soft);
}
.facts span { display: block; font-size: 11.5px; color: var(--ink-subtle); }
.facts strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.facts em { font-style: normal; color: var(--ink-subtle); font-weight: 500; font-size: 12px; }

/* ---------------- 时间线 / 步骤 ---------------- */
.timeline { margin-top: 2px; }
.tl-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--hairline-soft);
}
.tl-item:first-child { border-top: 0; padding-top: 2px; }
.tl-dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--hairline);
}
.tl-item.is-done .tl-dot { background: var(--ink); }
.tl-item.is-now .tl-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-title { font-size: 14.5px; font-weight: 500; line-height: 1.45; }
.tl-sub { margin-top: 3px; font-size: 11.5px; line-height: 1.5; color: var(--ink-subtle); }
.tl-date {
  padding-top: 1px;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 4px 0 10px;
}
.step {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--canvas-alt);
}
.step-n { font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; color: var(--ink-subtle); }
.step h3 { margin: 10px 0 0; font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.step p { margin: 6px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--ink-muted); }

/* ---------------- 规则手风琴 ---------------- */
.rules { margin-top: 2px; }
details.rule { border-top: 1px solid var(--hairline-soft); padding: 14px 0; }
details.rule:first-child { border-top: 0; padding-top: 2px; }
details.rule summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
details.rule summary::-webkit-details-marker { display: none; }
details.rule summary::after {
  content: "+";
  font-size: 19px;
  font-weight: 300;
  line-height: 1;
  color: var(--ink-subtle);
  flex: 0 0 auto;
}
details.rule[open] summary::after { content: "−"; }
details.rule p {
  margin: 10px 0 0;
  max-width: 740px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-muted);
}

/* ---------------- 漏服卡片 ---------------- */
.missed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}
.missed-item { padding: 16px; border-radius: var(--radius); background: var(--canvas-alt); }
.missed-item strong { display: block; font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.missed-item p { margin: 8px 0 0; font-size: 11.5px; line-height: 1.65; color: var(--ink-muted); }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.fineprint { margin-top: 14px; font-size: 11px; line-height: 1.65; color: var(--ink-subtle); }

/* ---------------- 周期大图 ---------------- */
.cycle-map {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cmap {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 62px;
  padding: 9px 9px 8px;
  border-radius: 10px;
  background: var(--canvas-alt);
  border: 1px solid transparent;
}
.cmap-day { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cmap-date { font-size: 10px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.cmap.is-upcoming { background: #fff; border-color: var(--hairline-soft); }
.cmap.is-taken { background: var(--ink); color: #fff; }
.cmap.is-taken .cmap-date { color: rgba(255, 255, 255, 0.62); }
.cmap.is-missed { background: var(--danger-soft); color: var(--danger); }
.cmap.is-missed .cmap-date { color: var(--danger); opacity: 0.75; }
.cmap.is-break { background: transparent; border: 1px dashed var(--hairline); }
.cmap.is-today { box-shadow: inset 0 0 0 2px var(--ink); }
.cmap.is-today.is-taken { box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------------- 日历 ---------------- */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.cal-title { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.cal-nav button:hover:not(:disabled) { background: var(--canvas-alt); }
.cal-nav button:disabled { opacity: 0.35; cursor: default; }
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.cal-week span {
  padding: 2px 0 6px;
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-subtle);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: default;
  font-variant-numeric: tabular-nums;
}
.cal-cell .mark { width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.cal-cell.is-outside { visibility: hidden; }
.cal-cell.is-pill { background: var(--canvas-alt); }
.cal-cell.is-taken { background: var(--ink); color: #fff; }
.cal-cell.is-taken .mark { background: rgba(255, 255, 255, 0.72); }
.cal-cell.is-missed { background: var(--danger-soft); color: var(--danger); }
.cal-cell.is-missed .mark { background: var(--danger); }
.cal-cell.is-break { border: 1px dashed var(--hairline-soft); color: var(--ink-subtle); }
.cal-cell.is-break .mark { background: var(--hairline); }
.cal-cell.is-future { color: var(--ink-muted); }
.cal-cell.is-future.is-pill { background: #fafafb; }
.cal-cell.is-today { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal-cell.has-log { cursor: pointer; }
.cal-cell.has-log:hover { border-color: var(--ink-subtle); }

/* ---------------- 列表 / 最近记录 ---------------- */
.rec-list { margin-top: 2px; }
.rec-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--hairline-soft);
}
.rec-row:first-child { border-top: 0; padding-top: 2px; }
.rec-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hairline); flex: 0 0 auto; }
.rec-dot.taken { background: var(--ink); }
.rec-dot.missed { background: var(--danger); }
.rec-dot.break { background: var(--hairline); }
.rec-title { font-size: 14px; font-weight: 500; }
.rec-sub { margin-top: 2px; font-size: 11.5px; color: var(--ink-subtle); }
.rec-state { font-size: 12px; color: var(--ink-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rec-state.taken { color: var(--ink); }
.rec-state.missed { color: var(--danger); }

/* ---------------- 设置 ---------------- */
.settings-group { margin-top: 34px; }
.settings-group:first-of-type { margin-top: 6px; }
.group-title {
  margin: 0 0 10px;
  padding-left: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.list {
  border: 1px solid var(--hairline-soft);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  padding: 14px 20px;
  border-top: 1px solid var(--hairline-soft);
}
.row:first-child { border-top: 0; }
.row-body { min-width: 0; }
.row-label { font-size: 14px; font-weight: 500; letter-spacing: -0.005em; }
.row-hint { margin-top: 3px; font-size: 11.5px; line-height: 1.5; color: var(--ink-subtle); }
.row-ctl { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.row-btn {
  border: 0;
  background: transparent;
  padding: 6px 2px;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.row-btn:hover { color: var(--accent-hover); text-decoration: underline; }
.row-btn.is-danger { color: var(--danger); }
.settings-note { margin: 10px 4px 0; font-size: 11.5px; line-height: 1.65; color: var(--ink-subtle); }

input[type="time"],
input[type="date"],
select.sel {
  appearance: none;
  -webkit-appearance: none;
  height: 38px;
  min-width: 96px;
  max-width: 200px;
  padding: 0 11px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}
input[type="time"] { text-align: center; font-variant-numeric: tabular-nums; }
input[type="date"] { min-width: 142px; }
select.sel {
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
input:focus-visible,
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--hairline);
  transition: background 0.2s var(--ease);
}
.switch .thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.22s var(--ease);
}
.switch input:checked ~ .track { background: var(--ink); }
.switch input:checked ~ .thumb { transform: translateX(20px); }
.switch input:focus-visible ~ .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.version-line {
  margin: 36px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--hairline-soft);
  font-size: 11px;
  color: var(--ink-subtle);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 130;
  max-width: min(92vw, 540px);
  padding: 12px 20px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hairline-soft);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 0;
  color: var(--ink-subtle);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 10px;
}
.tabbar a:hover { color: var(--ink-muted); }
.tabbar a.is-active { color: var(--ink); }
.tabbar svg { width: 22px; height: 22px; }

/* ---------------- 弹层 ---------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.sheet-backdrop.show { opacity: 1; }

.sheet {
  position: fixed;
  outline: none;
  left: 50%;
  bottom: 0;
  z-index: 141;
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 24px calc(26px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: #fff;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.12);
  transform: translate(-50%, 110%);
  transition: transform 0.34s var(--ease), opacity 0.2s ease;
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-grab {
  width: 36px;
  height: 4px;
  margin: 0 auto 20px;
  border-radius: 999px;
  background: var(--hairline);
}
.sheet h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; }
.sheet-sub { margin-top: 8px; font-size: 13px; line-height: 1.6; color: var(--ink-muted); }
.sheet .field { margin-top: 22px; }
.sheet .field > span {
  display: block;
  margin-bottom: 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.sheet .field input,
.sheet .field select { width: 100%; max-width: none; min-width: 0; }
.sheet-hint { margin-top: 12px; font-size: 11.5px; line-height: 1.6; color: var(--ink-subtle); }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.sheet-actions .btn { width: 100%; }
.sheet-actions-row { display: flex; gap: 10px; margin-top: 24px; }
.sheet-actions-row .btn { flex: 1; }
.sheet-note { margin-top: 16px; font-size: 11px; line-height: 1.65; color: var(--ink-subtle); }
.sheet-list { margin-top: 18px; }
.sheet-list .row { padding-left: 0; padding-right: 0; }
.sheet-list .row:first-child { border-top: 0; }

/* ---------------- 首次引导 ---------------- */
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 110;
  overflow-y: auto;
  padding: 40px 20px 56px;
  background: var(--canvas);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.onboard-card { width: min(520px, 100%); margin: auto; padding: 8px 0 20px; }
.onboard-logo { width: 54px; height: 54px; margin-bottom: 26px; color: var(--ink); }
.onboard-logo svg { width: 100%; height: 100%; border-radius: 15px; }
.onboard-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.onboard-title {
  margin: 14px 0 0;
  font-size: clamp(30px, 5.4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.038em;
  font-weight: 800;
}
.onboard-lede { margin: 16px 0 0; font-size: 15px; line-height: 1.7; color: var(--ink-muted); }
.onboard form { margin-top: 28px; }
.field { margin-top: 20px; }
.field > span {
  display: block;
  margin-bottom: 9px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--canvas-alt);
}
.seg button {
  height: 38px;
  padding: 0 4px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg button.is-on {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.ob-detail { display: flex; align-items: center; gap: 10px; margin-top: 13px; font-size: 13px; color: var(--ink-muted); }
.ob-detail select { width: auto; min-width: 88px; }
.ob-hint { margin: 10px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--ink-subtle); }
.ob-time { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-muted); }
.ob-time input { width: auto; min-width: 120px; }
.ob-submit { width: 100%; margin-top: 28px; }
.ob-fine { margin: 16px 0 0; font-size: 11px; line-height: 1.7; color: var(--ink-subtle); }
.ob-points { display: grid; gap: 10px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--hairline-soft); }
.ob-point { display: flex; gap: 10px; font-size: 12.5px; line-height: 1.6; color: var(--ink-muted); }
.ob-point b { font-weight: 600; color: var(--ink); white-space: nowrap; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cycle-wrap { grid-template-columns: 1fr; gap: 20px; }
  .cycle-days { grid-template-columns: repeat(7, 1fr); }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .topbar-inner { height: 56px; padding: 0 18px; gap: 12px; }
  .brand-text span { display: none; }
  .nav { display: none; }
  .install-btn { margin-left: auto; }
  .main { padding: 56px 18px 100px; }
  .hero { padding-top: 30px; }
  .hero-title { font-size: clamp(34px, 9.2vw, 54px); }
  .hero-sub { font-size: 15px; }
  .hero-actions { gap: 8px; }
  .hero-actions .btn { height: 48px; }
  .panel { padding: 20px 18px; border-radius: 16px; }
  .panel-head h2 { font-size: 17px; }
  .section-block { margin-top: 34px; }
  .page-head { padding-top: 34px; }
  .notice { align-items: flex-start; flex-direction: column; gap: 14px; padding: 16px 18px; }
  .notice .btn { width: 100%; }
  .pday { height: 32px; font-size: 11px; border-radius: 7px; }
  .stat { min-height: 100px; padding: 15px 15px 14px; }
  .stat-value { font-size: 24px; }
  .cmap { min-height: 54px; padding: 7px 7px 6px; }
  .cmap-day { font-size: 13px; }
  .cmap-date { font-size: 9px; }
  .facts { grid-template-columns: 1fr; gap: 12px; }
  .steps { grid-template-columns: 1fr; }
  .missed-grid { grid-template-columns: 1fr; }
  .tabbar { display: grid; }
  .cal-cell { font-size: 11.5px; border-radius: 8px; }
  .cal-week span { font-size: 9.5px; }
  .row { padding: 13px 16px; }
  .row-label { font-size: 13.5px; }
  .version-line { flex-direction: column; gap: 6px; }
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .stat-value { font-size: 22px; }
  .pday { height: 29px; font-size: 10.5px; }
  .seg button { font-size: 11.5px; }
}

@media (min-width: 721px) {
  .tabbar { display: none; }
  .cal-cell { aspect-ratio: auto; height: 78px; }
  .cal-grid { gap: 6px; }
  .cal-week { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- 补充：运行时片段 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--canvas-alt);
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0;
}

.warn-text { color: var(--danger); }

.sheet-rule {
  padding: 14px 0;
  border-top: 1px solid var(--hairline-soft);
}
.sheet-rule:first-child {
  padding-top: 2px;
  border-top: 0;
}
.sheet-rule strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sheet-rule p {
  margin-top: 6px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-muted);
}

.cal-cell:focus-visible,
.pday:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
