:root {
  --primary: #ec4899;
  --primary-dark: #be185d;
  --primary-soft: #fce7f3;
  --bg: #fdf2f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #8b7280;
  --border: #f3d7e4;
  --danger: #e11d48;
  --warn: #f59e0b;
  --shadow: 0 1px 3px rgba(190,24,93,.08);
  --radius: 16px;
  --tabbar-h: 60px;
  --header-h: 54px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* 顶部 */
.app-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(135deg, #f472b6, #db2777);
  color: #fff;
  padding-top: env(safe-area-inset-top, 0px);
}
.header-brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 6px; }
.header-logo { font-size: 20px; }

.icon-btn {
  background: none; border: none; color: inherit;
  font-size: 20px; width: 40px; height: 40px;
  border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.app-header .icon-btn:active { background: rgba(255,255,255,.25); }

main {
  padding: 16px 14px;
  padding-bottom: calc(var(--tabbar-h) + 90px + var(--safe-bottom));
  max-width: 560px; margin: 0 auto;
}

/* 日期横幅 */
.date-banner { text-align: center; padding: 4px 0 14px; }
.date-big { font-size: 22px; font-weight: 700; }
.date-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* 首页状态卡 */
.status-card {
  background: var(--card);
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  text-align: center;
  border: 1px solid var(--border);
}
.status-card.hero-ongoing { background: linear-gradient(160deg, #fff1f6, #ffe3ee); }
.status-emoji { font-size: 44px; line-height: 1; }
.status-title { font-size: 21px; font-weight: 800; margin-top: 10px; }
.status-sub { font-size: 14px; color: var(--muted); margin-top: 6px; }
.status-dates { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* 预测区 */
.pred-block { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.pred-main { font-size: 19px; font-weight: 800; color: var(--primary-dark); }
.pred-main .pred-date { font-size: 24px; }
.pred-countdown { font-size: 14px; margin-top: 6px; }
.pred-countdown.soon { color: var(--danger); font-weight: 700; }
.pred-countdown.ok { color: var(--muted); }
.pred-detail { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.7; }
.pred-note { font-size: 12px; color: #c0a0b0; margin-top: 8px; }
.tip-line { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* 首页大按钮 */
.home-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.big-btn {
  border: none; border-radius: 16px;
  padding: 17px 16px; font-size: 18px; font-weight: 700;
  color: #fff; cursor: pointer;
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #f472b6, #db2777);
}
.big-btn:active { transform: scale(.98); }
.big-btn.secondary {
  background: var(--card); color: var(--primary-dark);
  border: 1.5px solid #f9a8d4; box-shadow: none;
}
.big-btn.warn-solid { background: linear-gradient(135deg, #fb7185, #e11d48); }
.home-tip { text-align: center; font-size: 13px; color: var(--muted); margin-top: 12px; line-height: 1.6; }

/* 汇总卡 */
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.summary-cell {
  background: var(--card); border-radius: var(--radius);
  padding: 13px; box-shadow: var(--shadow);
}
.summary-cell .sc-value { font-size: 21px; font-weight: 800; line-height: 1.15; color: var(--primary-dark); }
.summary-cell .sc-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 分区标题 */
.section-title { font-size: 15px; font-weight: 700; color: var(--muted); margin: 6px 0 10px; }

/* 补记按钮 */
.add-btn {
  width: 100%; border: 1.5px dashed #f9a8d4; background: #fff;
  color: var(--primary-dark); font-size: 15px; font-weight: 600;
  padding: 12px; border-radius: 14px; cursor: pointer;
  margin-bottom: 14px;
}
.add-btn:active { background: var(--primary-soft); }

/* 历史列表 */
.entry-list { display: flex; flex-direction: column; gap: 10px; }
.entry {
  background: var(--card); border-radius: var(--radius);
  padding: 13px 14px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; border: 1px solid transparent;
}
.entry:active { background: var(--primary-soft); border-color: #f9a8d4; }
.entry-emoji { font-size: 26px; flex-shrink: 0; }
.entry-body { flex: 1; min-width: 0; }
.entry-main { font-size: 15px; font-weight: 700; }
.entry-main .en-idx { color: var(--muted); font-weight: 600; font-size: 13px; margin-right: 6px; }
.entry-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.entry-badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-dark);
}
.tag.blue { background: #e0f2fe; color: #0369a1; }
.tag.dark { background: #f1f5f9; color: #475569; }
.tag.red { background: #ffe4e6; color: var(--danger); }
.entry-arrow { color: #f9a8d4; font-size: 18px; flex-shrink: 0; }

.empty-tip { text-align: center; color: #cbb3c0; font-size: 14px; padding: 26px 10px; }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--card); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  max-width: 560px; margin: 0 auto;
}
.tab {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--muted); padding: 6px 14px;
}
.tab .ti { font-size: 22px; line-height: 1; }
.tab.active { color: var(--primary-dark); font-weight: 700; }

/* 模态框 */
.modal {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(120,20,60,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: var(--card); width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0;
  max-height: 88vh; overflow-y: auto;
  padding-bottom: var(--safe-bottom);
}
.modal-card-sm { border-radius: 20px; margin: 0 16px 16px; width: calc(100% - 32px); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 6px;
}
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head .modal-close { color: var(--muted); }
.modal-body { padding: 8px 18px 16px; }
.modal-foot { display: flex; gap: 12px; padding: 12px 18px 20px; }
.modal-body.center { text-align: center; }
.modal-body.center p { font-size: 16px; font-weight: 600; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; color: var(--text);
}
.field input:focus { outline: none; border-color: var(--primary); }

.dur-hint { font-size: 13px; color: var(--primary-dark); font-weight: 600; margin: -6px 0 10px; }
.quick-dur { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quick-dur-tip { font-size: 11px; color: var(--muted); }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  padding: 7px 14px; border-radius: 999px; font-size: 14px; cursor: pointer;
}
.chip:active { background: var(--primary-soft); color: var(--primary-dark); }

/* 按钮 */
.btn {
  flex: 1; border: none; border-radius: 14px; padding: 14px;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.btn-primary { background: linear-gradient(135deg, #f472b6, #db2777); color: #fff; }
.btn-primary:active { filter: brightness(.94); }
.btn-ghost { background: #fdf2f8; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { flex: none; padding: 8px 16px; font-size: 14px; border-radius: 10px; }

/* 统计 */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.stat-label { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.stat-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.stat-row:last-child { border-bottom: none; }
.stat-row b { color: var(--primary-dark); }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding: 0 4px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.chart-bar {
  width: 70%; max-width: 30px; border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #f9a8d4, #db2777);
  min-height: 3px; position: relative;
}
.chart-val { font-size: 10px; color: var(--primary-dark); font-weight: 700; margin-bottom: 3px; }
.chart-x { font-size: 9px; color: var(--muted); margin-top: 5px; white-space: nowrap; transform: scale(.92); }
.chart-legend { font-size: 11px; color: var(--muted); margin-top: 8px; text-align: center; }

/* 设置 */
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-of-type { border-bottom: none; }
.settings-hint { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.7; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 90px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(30,10,20,.92); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 999px; z-index: 60;
  white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}

@media (min-width: 560px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 20px; margin: 0 16px; width: calc(100% - 32px); }
}
