/* 草稿 C（浅色版）：暖灰底 + 白卡 + 顶部两段切换（生活+学习 / 游戏）+ 柔紫点缀 + 浅色底栏 */
:root {
  --bg: #F7F7F5;
  --card: #FFFFFF;
  --game: #F1F0EC;
  --dot: #6B5FA6;
  --ink: #1F1F1E;
  --muted: #8E8D89;
  --faint: #B9B8B3;
  --line: #E8E7E3;
  --line-game: #E2E1DB;
  --accent: #6B5FA6;
  --accent-soft: #EEEBF6;
  --tabbar-h: 60px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, input { font: inherit; color: inherit; }
.wrap { max-width: 480px; margin: 0 auto; padding: 20px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }

/* 顶部 */
.top { padding: 8px 4px 16px; }
.date-row { display: flex; align-items: center; gap: 4px; margin-left: -10px; }
.date { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; margin: 0; flex: 1; line-height: 1.2; }
.nav {
  width: 44px; height: 44px; border: 0; background: none; font-size: 26px; line-height: 1;
  color: var(--muted); cursor: pointer; border-radius: 10px;
}
.nav:active { background: rgba(0,0,0,.04); }
.date-row .nav:last-child { margin-right: -10px; }
.sub { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.focus { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.focus b { color: var(--ink); font-weight: 500; }
.count { flex: none; font-variant-numeric: tabular-nums; }
.bar { height: 3px; background: var(--line); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .3s ease; }
.today-link { margin-top: 10px; border: 0; background: none; padding: 0; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; }

/* 顶部两段切换 */
.seg { display: flex; gap: 4px; padding: 4px; margin: 0 0 14px; background: #ECEBE7; border-radius: 14px; }
.seg-btn {
  flex: 1; height: 40px; border: 0; border-radius: 10px; background: none; cursor: pointer;
  font-size: 15px; font-weight: 500; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg-btn[aria-selected="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg-n { font-size: 12px; font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; }
.seg-btn[aria-selected="true"] .seg-n { color: var(--accent); }
.card[hidden] { display: none; }

/* 卡片 */
.card { background: var(--card); border-radius: 16px; padding: 4px 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card-game { background: var(--game); box-shadow: none; }
.zone + .zone { border-top: 1px solid var(--line); }
.zone-head { display: flex; align-items: center; gap: 8px; padding: 14px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.zone-head .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dot); }
.zone-head .owner { font-weight: 400; color: var(--faint); }
.zone-head .add { margin-left: auto; width: 44px; height: 32px; border: 0; background: none; color: var(--accent); font-size: 22px; line-height: 1; cursor: pointer; margin-right: -12px; }

ul.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; align-items: center; min-height: 56px; border-top: 1px solid var(--line); }
.card-game .task { border-top-color: var(--line-game); }
.zone-head + ul .task:first-child { border-top: 0; }
.tick {
  flex: none; width: 44px; height: 44px; margin-left: -10px; border: 0; background: none; padding: 0;
  display: grid; place-items: center; cursor: pointer;
}
.tick span { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--faint); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.tick span svg { width: 13px; height: 13px; opacity: 0; }
.task.done .tick span { background: var(--accent); border-color: var(--accent); opacity: .55; }
.task.done .tick span svg { opacity: 1; }
.task.doing .tick span { border-color: var(--accent); border-width: 2px; }
.task.placeholder .tick { cursor: default; }
.task.placeholder .tick span { border-style: dashed; }
.body { flex: 1; min-width: 0; padding: 8px 0 8px 2px; cursor: pointer; }
.title { font-size: 16px; line-height: 1.35; word-break: break-word; }
.meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.task.done .title { color: var(--faint); text-decoration: line-through; }
.task.done .meta { color: var(--faint); }
.task.placeholder .title { color: var(--muted); }
.card-game .task.placeholder { margin: 8px 0 12px; padding: 0 12px; min-height: 64px; border: 1.5px dashed #D5D1E6; border-radius: 12px; background: rgba(255,255,255,.55); }
.card-game .zone-head + ul .task.placeholder:first-child { border-top: 1.5px dashed #D5D1E6; }
.card-game .task.placeholder .tick { margin-left: -6px; }
.card-game .task.placeholder .tick span { border-color: #C9C3E0; }

/* 行内编辑 / 新增 */
.edit { padding: 10px 0 12px; border-top: 1px solid var(--line); }
.card-game .edit { border-top-color: var(--line-game); }
.zone-head + ul .edit:first-child { border-top: 0; }
.edit input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; outline: none; font-size: 16px; }
.edit input:focus { border-color: var(--accent); }
.edit input + input { margin-top: 8px; font-size: 14px; }
.edit .row { display: flex; gap: 8px; margin-top: 10px; }
.edit .row button { height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; }
.edit .row .primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.edit .row .danger { margin-left: auto; color: var(--muted); }
.empty { padding: 14px 0 16px; color: var(--faint); font-size: 14px; }

.msg { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0; }

/* token 入口 */
.gate { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.gate[hidden] { display: none; }
.gate-card { width: 100%; max-width: 360px; background: var(--card); border-radius: 16px; padding: 24px; }
.gate-card h2 { margin: 0 0 4px; font-size: 22px; }
.gate-card p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.gate-card input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 16px; outline: none; }
.gate-card button { margin-top: 12px; width: 100%; height: 44px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }

/* 浅色底栏：今日 | 日历 | 回顾 | 我的 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom);
  background: rgba(255,255,255,.88); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tb {
  flex: 1; max-width: 120px; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; color: var(--faint);
}
.tb svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tb.on { color: var(--accent); font-weight: 600; }
.msg { position: relative; z-index: 11; }

@media (display-mode: standalone) { .wrap { padding-top: 12px; } }

/* ---------- 底栏视图 ---------- */
.view[hidden] { display: none; }
.hint { text-align: center; color: var(--faint); font-size: 12px; margin: 4px 0 0; }
.sub .today-link { margin-top: 0; }

/* 日历 */
.cal-card { padding: 10px 8px 12px; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12px; color: var(--faint); padding: 2px 0 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  aspect-ratio: 1 / 1.12; min-height: 46px; border: 0; border-radius: 10px; background: none; cursor: pointer; padding: 6px 2px 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2px;
}
.cal-cell.blank { cursor: default; }
.cal-cell:active:not(.blank) { background: rgba(0,0,0,.04); }
.cal-n { font-size: 15px; font-weight: 500; line-height: 1; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.cal-cell.empty .cal-n { color: var(--faint); }
.cal-cell.future .cal-n { color: var(--muted); }
.cal-cell.today .cal-n { background: var(--accent); color: #fff; font-weight: 700; }
.cal-cell.sel:not(.today) { background: var(--accent-soft); }
.cal-cell.clear:not(.today) .cal-n { color: var(--accent); font-weight: 700; }
.cal-cell.wkend:not(.today) .cal-n { opacity: .8; }
.cal-cell.sel { box-shadow: inset 0 0 0 1.5px var(--accent); }
/* 小圆环：conic-gradient 画完成比例；全清 = 实心 + ✓；无任务 = 不画 */
.ring { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--accent) var(--p, 0deg), #E4E0F0 0);
  -webkit-mask: radial-gradient(circle, transparent 5.5px, #000 6px); mask: radial-gradient(circle, transparent 5.5px, #000 6px); }
.ring.full { background: var(--accent); -webkit-mask: none; mask: none; }
.ring.full svg { width: 11px; height: 11px; }
.ring.none { background: none; -webkit-mask: none; mask: none; }
.cal-cell.future .ring:not(.none):not(.full) { opacity: .7; }

/* 点日期的底部预览卡 */
.cal-preview { padding: 14px 16px 14px; }
.pv-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pv-h b { font-size: 16px; font-weight: 600; }
.pv-h span { font-size: 14px; color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }
ul.pv-list { list-style: none; margin: 10px 0 0; padding: 0; }
.pv-list li { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; font-size: 14px; }
.pv-list li i { font-style: normal; width: 16px; flex: none; text-align: center; color: var(--faint); }
.pv-list li.on i { color: var(--accent); }
.pv-list li.on span { color: var(--faint); text-decoration: line-through; }
.pv-list li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-more, .pv-empty { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.pv-go { margin-top: 12px; width: 100%; height: 42px; border: 0; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 15px; cursor: pointer; }
.pv-go:active { filter: brightness(.96); }
.cal-bar { display: block; width: 70%; max-width: 34px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.cal-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.cal-c { font-size: 10px; line-height: 1; color: var(--faint); font-variant-numeric: tabular-nums; min-height: 10px; }

/* 回顾 */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border-radius: 14px; padding: 14px 10px 12px; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.stat b { display: block; font-size: 24px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat b small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat span { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
/* 回顾：主卡 + 对比 + 最长连续 */
.rev-say { margin: -4px 4px 12px; font-size: 14px; color: var(--ink); }
.hero { display: flex; align-items: center; gap: 12px; padding: 16px 18px; }
.hero-l { flex: 1; min-width: 0; }
.hero-l b { display: block; font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-l > span { display: block; font-size: 13px; color: var(--muted); margin-top: 6px; }
.hero-l .cmp { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 600; padding: 3px 8px; border-radius: 8px; }
.cmp.up { color: #2F8A57; background: #E6F4EC; }
.cmp.down, .cmp.flat { color: var(--muted); background: var(--bg); }
.hero-r { flex: none; text-align: center; padding-left: 14px; border-left: 1px solid var(--line); }
.hero-r b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-r small { font-size: 13px; color: var(--muted); }
.hero-r span { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
/* 柱状条 */
.rev-chart { padding: 14px 12px 10px; }
.bars { display: flex; align-items: stretch; gap: 6px; height: 120px; }
.bars.wide { gap: 2px; }
.bc { flex: 1; min-width: 0; border: 0; background: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bt { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bt i { display: block; width: 100%; max-width: 22px; border-radius: 5px 5px 2px 2px; }
.bars.wide .bt i { border-radius: 2px; }
.bt i.clear { background: var(--accent); }
.bt i.part { background: #D9D4EE; }
.bt i.dot { width: 5px; height: 5px; border-radius: 50%; background: #CFCEC9; margin-bottom: 1px; }
.bl { height: 14px; font-size: 11px; line-height: 14px; color: var(--faint); font-variant-numeric: tabular-nums; }
.bc:active .bt i { filter: brightness(.92); }
.legend { display: flex; gap: 14px; justify-content: center; margin-top: 10px; font-size: 11px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.lg { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.lg.clear { background: var(--accent); } .lg.part { background: #D9D4EE; } .lg.dot { background: #CFCEC9; border-radius: 50%; width: 6px; height: 6px; }
.rev-empty { text-align: center; padding: 22px 18px 18px; }
.re-emo { font-size: 32px; }
.rev-empty p { margin: 6px 0 12px; font-size: 15px; font-weight: 600; }
.re-prog { height: 6px; border-radius: 6px; background: var(--accent-soft); overflow: hidden; max-width: 200px; margin: 0 auto; }
.re-prog i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.rev-empty > span { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
.more-btn { display: block; margin: -2px auto 8px; border: 0; background: none; color: var(--accent); font-size: 14px; padding: 8px 12px; cursor: pointer; }
.more-btn[hidden] { display: none; }

ul.days { list-style: none; margin: 0; padding: 0; }
.day { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.day:first-child { border-top: 0; }
.day-main { flex: 1; min-width: 0; }
.day-h { font-size: 15px; font-weight: 500; }
.day-f { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day.clear .day-f { color: var(--accent); }
.day.empty-day .day-h, .day.empty-day .day-f { color: var(--faint); }
.day-r { flex: none; width: 54px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.day-r .cal-bar { width: 100%; max-width: none; }
.day-c { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 我的 */
.me-card { padding: 14px 16px 16px; }
.me-h { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .04em; margin-bottom: 10px; }
.me-who { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.me-name { font-size: 18px; font-weight: 600; }
.me-note { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.me-row { display: flex; align-items: center; gap: 10px; }
.me-row code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 13px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); padding: 9px 10px; border-radius: 8px; }
.pill { flex: none; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; color: var(--accent); }
.me-tips { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--ink); }
.me-tips li + li { margin-top: 6px; }
.logout { margin-top: 14px; width: 100%; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: #B4463C; font-weight: 600; cursor: pointer; }

/* 我的：身份卡 3 个数字 + iOS 分组列表 */
.me-nums { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; }
.me-nums b { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.me-nums small { font-size: 12px; font-weight: 500; color: var(--muted); }
.me-nums span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.me-nums > div + div { border-left: 1px solid var(--line); }
.grp-h { margin: 18px 16px 6px; font-size: 13px; color: var(--muted); }
.grp { background: var(--card); border-radius: 14px; overflow: hidden; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.grp .row { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 14px; border: 0; background: none; text-align: left; cursor: pointer; font-size: 15px; position: relative; }
.grp .row.static { cursor: default; }
.grp .row:disabled { cursor: default; color: inherit; opacity: 1; }
.grp .row + .row::before, .grp .row-tips + .row::before { content: ""; position: absolute; top: 0; left: 50px; right: 0; height: 1px; background: var(--line); }
.grp .row:active:not(.static):not(:disabled) { background: rgba(0,0,0,.035); }
.grp .ic { width: 24px; text-align: center; font-size: 17px; flex: none; }
.grp .rt { flex: 1; min-width: 0; }
.grp .rv { flex: none; color: var(--muted); font-size: 14px; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp .rv.mono { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
.grp .chev { flex: none; color: var(--faint); font-size: 20px; line-height: 1; margin-right: -2px; }
.grp .chev[hidden] { display: none; }
.grp .row.danger { justify-content: center; color: #B4463C; font-weight: 600; }
.row-tips { padding: 4px 16px 14px 50px; }
.row-tips[hidden] { display: none; }
.ver { text-align: center; font-size: 12px; color: var(--faint); margin: 8px 0 0; }
