/* 无痕打卡 Wuhen Streak · 样式：单栏移动优先，深色模式翻转中性色，主题橙（火焰） */
:root {
  --bg: #ffffff; --surface: #f7f9fb; --surface-2: #eef2f6;
  --text: #1a2332; --muted: #5b6b82; --border: #e3e8ef;
  --accent: #e8590c; --accent-soft: rgba(232, 89, 12, .12);
  --danger: #d64545; --radius: 12px;
  --shadow: 0 4px 18px rgba(20, 30, 50, .08);
}
[data-dark="true"] {
  --bg: #141a24; --surface: #1c2430; --surface-2: #232e3d;
  --text: #e8edf4; --muted: #93a1b5; --border: #2a3442;
  --shadow: 0 4px 18px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  display: flex; flex-direction: column;
}
button, input { font: inherit; color: inherit; }
button {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.danger { color: var(--danger); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* 页眉 */
.app-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.app-logo { width: 36px; height: 36px; border-radius: 9px; }
.header-text h1 { font-size: 18px; margin: 0; }
.header-text p { margin: 0; font-size: 12px; color: var(--muted); }
.header-actions { margin-left: auto; }
.header-actions button { font-size: 17px; padding: 6px 9px; }

/* 页面 */
.page { flex: 1; overflow-y: auto; padding: 14px; width: 100%; max-width: 560px; margin: 0 auto; }
.today-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px;
}
.today-date { font-size: 13px; color: var(--muted); }
.today-progress { font-size: 19px; font-weight: 700; margin-top: 2px; }

/* 习惯卡片 */
.habit-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px; cursor: pointer;
}
.habit-icon { font-size: 30px; flex: none; width: 44px; text-align: center; }
.habit-main { flex: 1; min-width: 0; }
.habit-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.habit-sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.streak-fire { color: var(--accent); font-weight: 700; }
.week-dots { display: flex; gap: 4px; margin-top: 6px; }
.wdot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--border); }
.wdot.on { background: var(--accent); border-color: var(--accent); }
.wdot.today { box-shadow: 0 0 0 2px var(--accent-soft); }
.check-btn {
  flex: none; min-width: 76px; padding: 12px 10px; border-radius: 10px;
  font-weight: 700; background: var(--accent); border-color: var(--accent); color: #fff;
}
.check-btn.done { background: var(--surface-2); border-color: var(--border); color: var(--muted); }

#empty-state { text-align: center; padding: 28px 10px; color: var(--muted); }
#empty-state h2 { color: var(--text); }
.add-btn {
  width: 100%; padding: 14px; border-radius: var(--radius); font-size: 16px; font-weight: 700;
  background: var(--accent-soft); border: 1.5px dashed var(--accent); color: var(--accent);
}
#archived-wrap h3 { color: var(--muted); font-size: 14px; margin: 18px 0 8px; }
.archived-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted);
}
.archived-row .grow { flex: 1; }

/* 广告位预留（未开启：隐藏） */
#ad-slot { display: none; margin-top: 14px; border-top: 1px dashed var(--border); padding: 10px; text-align: center; color: var(--muted); font-size: 12px; }
#ad-slot.on { display: block; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 80; padding: 14px; }
.modal[hidden] { display: none; }
.modal.high { z-index: 100; }
.modal.higher { z-index: 110; }
.card {
  background: var(--bg); border-radius: 16px; padding: 20px; width: 400px; max-width: calc(100vw - 28px);
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 14px; font-size: 18px; }
.card h3 { margin: 16px 0 6px; font-size: 15px; }
.note { font-size: 13px; color: var(--muted); line-height: 1.65; margin: 0 0 8px; }
.dlg-btns { display: flex; gap: 10px; margin-top: 14px; }
.dlg-btns button { flex: 1; padding: 11px 0; border-radius: 10px; font-size: 15px; }
.dlg-btns.col { flex-direction: column; }
.dlg-btns.col button { flex: none; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
#habit-name {
  width: 100%; padding: 11px; font-size: 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { font-size: 21px; padding: 7px 0; border-radius: 10px; }
.emoji-grid button.sel { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.seg-row { display: flex; gap: 8px; }
.seg-row button { flex: 1; padding: 10px 0; border-radius: 10px; font-size: 15px; }
.seg-row button.sel { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.perweek-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 15px; }
.perweek-row b { font-size: 18px; min-width: 22px; text-align: center; }
.perweek-row button { width: 38px; height: 38px; border-radius: 50%; font-size: 17px; }

/* 详情 */
.detail-head { display: flex; align-items: center; gap: 12px; }
#detail-icon { font-size: 36px; }
.detail-names { flex: 1; min-width: 0; }
.detail-names h2 { margin: 0; }
.detail-names p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
#detail-close { flex: none; }
.stat-row { display: flex; gap: 8px; margin: 14px 0; }
.stat { flex: 1; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 4px; }
.stat b { display: block; font-size: 21px; color: var(--accent); }
.stat span { font-size: 12px; color: var(--muted); }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-nav button { width: 36px; height: 32px; font-size: 18px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-week span { text-align: center; font-size: 12px; color: var(--muted); padding: 2px 0; }
.cal-grid button {
  aspect-ratio: 1; border-radius: 50%; border: 1px solid transparent; background: none;
  font-size: 14px; padding: 0; position: relative;
}
.cal-grid button.dim { color: var(--muted); opacity: .45; }
.cal-grid button.on { background: var(--accent); color: #fff; font-weight: 700; }
.cal-grid button.today { border-color: var(--accent); }
.cal-grid button:disabled { opacity: .3; cursor: default; }

/* 设置 */
.setting-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; padding: 8px 0; }
.lang-btns button.active { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }

/* 语言/欢迎 */
.lang-card { text-align: center; }
.lang-card h2 { line-height: 1.6; }
.lang-pick-row { display: flex; gap: 12px; }
.lang-pick-row button { flex: 1; padding: 14px 0; font-size: 17px; border-radius: 12px; border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 700; }
.welcome-card { text-align: left; }
.welcome-card h2 { text-align: center; }
.welcome-points p { font-size: 14px; line-height: 1.7; margin: 0 0 10px; }
.welcome-hide { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 4px 0 6px; cursor: pointer; }
.welcome-hide input { width: 16px; height: 16px; accent-color: var(--accent); }

#toast {
  position: fixed; bottom: 64px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 20px;
  font-size: 13px; z-index: 120;
}
#toast[hidden] { display: none; }
