/* ==========================================================================
   小树苗 · 追高计划  —— 样式
   风格：奶油暖底 + 嫩绿主色，圆角卡片，童趣但不幼稚
   ========================================================================== */

:root {
  --bg: #FFF8F0;
  --card: #FFFFFF;
  --ink: #3D3A36;
  --ink-2: #7C7570;
  --ink-3: #A9A29B;
  --green: #3FAE6A;
  --green-deep: #2C8C54;
  --green-soft: #E9F7EE;
  --coral: #FF8A65;
  --yellow: #FFC85C;
  --blue: #6FB7E9;
  --line: #F2E8DB;
  --line-2: #F7F0E6;
  --shadow: 0 6px 22px rgba(120, 86, 40, .07);
  --shadow-lg: 0 14px 40px rgba(120, 86, 40, .10);
  --r: 22px;
  --r-sm: 14px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
          "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(620px 420px at 8% -8%, #FFEED8 0%, transparent 62%),
    radial-gradient(520px 380px at 96% -2%, #E4F6EB 0%, transparent 58%),
    radial-gradient(760px 520px at 50% 112%, #FFF3E0 0%, transparent 62%);
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.2px; }
p { margin: 0; }
button { font-family: inherit; }
a { color: var(--green-deep); }

.app { min-height: 100vh; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 248, 240, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(120, 86, 40, .06);
}

.topbar-in {
  max-width: 1040px;
  margin: 0 auto;
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.logo { width: 34px; height: 34px; display: block; }

.brand-t { display: flex; align-items: baseline; gap: 5px; }
.brand-t b { font-size: 16px; font-weight: 800; letter-spacing: .5px; }
.brand-t i { font-style: normal; font-size: 12px; color: var(--ink-3); letter-spacing: 1px; }

.tabs {
  display: flex;
  gap: 2px;
  background: #fff;
  padding: 4px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.tab {
  border: 0;
  background: transparent;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .18s, color .18s, box-shadow .18s;
  white-space: nowrap;
}
.tab:hover { background: var(--line-2); }
.tab.on { background: var(--green); color: #fff; box-shadow: 0 4px 12px rgba(63, 174, 106, .3); }
.tab-e { font-size: 14px; }
.tab.on .tab-e { filter: brightness(0) invert(1); }

/* ---------------- 主体 ---------------- */
.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 16px; }
.card-head h2 + * { flex-shrink: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 16px; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--line-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.ok { background: var(--green-soft); color: var(--green-deep); }
.chip.warn { background: #FFF4E0; color: #C98321; }
.chip.bad { background: #FDECEC; color: #C4554B; }

.link {
  border: 0;
  background: transparent;
  color: var(--green-deep);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 8px;
}
.link:hover { background: var(--green-soft); }

.note-text { font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.note-text b { color: var(--ink); }

/* ---------------- 按钮 ---------------- */
.btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 18px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s, box-shadow .18s, background .18s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #4FBF7B, #2C8C54);
  color: #fff;
  box-shadow: 0 8px 20px rgba(44, 140, 84, .25);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(44, 140, 84, .32); }

.btn-soft {
  background: #fff;
  color: var(--green-deep);
  box-shadow: 0 4px 14px rgba(120, 86, 40, .1);
  font-size: 13.5px;
  padding: 9px 14px;
}
.btn-soft:hover { background: var(--green-soft); }

.btn-ghost {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
  font-size: 13.5px;
  padding: 10px 14px;
}
.btn-ghost:hover { border-color: var(--green); color: var(--green-deep); }
.btn-ghost.danger { color: #C4554B; }
.btn-ghost.danger:hover { border-color: #E8B4AF; color: #C4554B; background: #FDF3F2; }

.btn-block { width: 100%; margin-top: 4px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* ---------------- 首页 Hero ---------------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ECF9F0 0%, #FFF6E6 100%);
  border-radius: 26px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -70px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 92, .28), transparent 68%);
  pointer-events: none;
}

.hero-row { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 28px;
  box-shadow: 0 6px 16px rgba(120, 86, 40, .1);
  flex-shrink: 0;
}

.hero-id { flex: 1; min-width: 0; }
.hero-name { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.hero-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}
.hs {
  background: rgba(255, 255, 255, .72);
  border-radius: 16px;
  padding: 11px 12px;
  text-align: center;
}
.hs-v { font-size: 24px; font-weight: 800; letter-spacing: -.6px; line-height: 1.2; }
.hs-v i { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--ink-3); margin-left: 2px; }
.hs-k { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.hs-d { font-size: 11px; color: var(--ink-3); }

/* ---------------- 百分位刻度 ---------------- */
.gauge { padding-top: 26px; }
.gauge-bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #A5D8F3 0%, #D5EEDD 22%, #A8E2BC 50%, #D5EEDD 78%, #FFDFA6 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05);
}
.gauge-pin {
  position: absolute;
  top: -25px;
  width: 38px;
  height: 38px;
  margin-left: -19px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--green-deep);
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--green-deep);
  box-shadow: 0 4px 12px rgba(44, 140, 84, .22);
  transition: left .5s cubic-bezier(.3, 1.2, .5, 1);
}
.gauge-pin b { font-weight: 800; }
.gauge-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  font-size: 10.5px;
  color: var(--ink-3);
}

/* ---------------- 今日打卡（迷你） ---------------- */
.habit-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1.5px dashed var(--line);
  background: #fff;
  border-radius: 13px;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-2);
  text-align: left;
  transition: all .18s;
  min-width: 0;
}
.mini:hover { border-color: #D9EEDF; background: #FBFEFC; }
.mini.on {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-deep);
  font-weight: 700;
}
.mini-e { font-size: 15px; flex-shrink: 0; }
.mini-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 趋势 ---------------- */
.spark-wrap { margin: 4px 0 2px; }
.spark { width: 100%; height: 90px; display: block; }
.spark-empty { font-size: 13px; color: var(--ink-3); padding: 16px 0; }
.spark-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 2px;
}

.vel-tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
}
.vel-tag.ok { background: var(--green-soft); color: var(--green-deep); }
.vel-tag.warn { background: #FFF3E0; color: #C17F1E; }

/* ---------------- 贴士 ---------------- */
.tip-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: linear-gradient(135deg, #FFFDF8, #FFF7EC);
  border: 1px solid #FAEBD7;
}
.tip-ico {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: #FFF1D6;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.tip-k { font-size: 11.5px; font-weight: 800; color: #C17F1E; letter-spacing: 1px; }
.tip-card p { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.7; }

/* ---------------- 表单 ---------------- */
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field { display: block; margin-bottom: 13px; }
.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 600;
}
.field input, .field select {
  width: 100%;
  border: 1.5px solid var(--line);
  background: #FFFDFA;
  border-radius: 13px;
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s, background .18s;
  -webkit-appearance: none;
  appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A9A29B' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(63, 174, 106, .12);
}
.field input::placeholder { color: #C9C1B8; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-3);
  padding: 6px 8px 10px;
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 11px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #FFFDF9; }
.t-date { white-space: nowrap; font-weight: 600; }
.t-date em { display: block; font-style: normal; font-size: 11px; color: var(--ink-3); font-weight: 500; }
.t-h { font-size: 16px; font-weight: 800; white-space: nowrap; }
.t-h i, .tbl td i { font-style: normal; font-size: 11px; color: var(--ink-3); margin-left: 1px; font-weight: 600; }
.t-note { font-size: 12px; color: var(--ink-3); max-width: 120px; }
.t-act { white-space: nowrap; text-align: right; }
.icon-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 5px;
  border-radius: 8px;
  opacity: .6;
  transition: opacity .15s, background .15s;
}
.icon-btn:hover { opacity: 1; background: var(--line-2); }
.dim { color: #D5CCC2; }
.up { color: var(--green-deep); font-weight: 700; }
.down { color: #C4554B; font-weight: 700; }

.empty {
  padding: 26px 10px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
  background: #FFFDF9;
  border-radius: var(--r-sm);
  border: 1.5px dashed var(--line);
}

/* ---------------- 分段控件 ---------------- */
.seg-row {
  display: inline-flex;
  background: #fff;
  padding: 4px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  gap: 2px;
}
.seg {
  border: 0;
  background: transparent;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 600;
  transition: all .18s;
}
.seg.on { background: var(--green); color: #fff; box-shadow: 0 4px 12px rgba(63, 174, 106, .28); }

/* ---------------- 图表 ---------------- */
.chart-card { padding: 14px 10px 16px; }
.chart { width: 100%; height: auto; display: block; }

.g-line { stroke: var(--line); stroke-width: 1; }
.g-line.vert { stroke-dasharray: 3 7; opacity: .7; }
.g-txt { font-size: 11px; fill: #B4AAA0; font-family: var(--font); }

.band-outer { fill: rgba(111, 183, 233, .07); }
.band-inner { fill: rgba(63, 174, 106, .13); }

.pct-line { fill: none; stroke: #D3E6D9; stroke-width: 1.3; stroke-dasharray: 5 5; }
.pct-line.p50 { stroke: #B3D6C0; stroke-width: 1.6; stroke-dasharray: 6 4; }
.pct-label { font-size: 10px; fill: #A3C4AF; font-weight: 700; font-family: var(--font); }

.child-line { fill: none; stroke: url(#childLine); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.child-dot { fill: #fff; stroke: var(--green-deep); stroke-width: 2.6; }
.child-dot:hover { r: 7; }
.dot-label { font-size: 12px; font-weight: 800; fill: var(--green-deep); font-family: var(--font); }

.now-line { stroke: #FFB27A; stroke-width: 1.5; stroke-dasharray: 4 5; }
.now-txt { font-size: 10px; font-weight: 700; fill: #E39A62; font-family: var(--font); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 10px;
}
.legend span { display: inline-flex; align-items: center; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green-deep); display: inline-block; margin-right: 6px; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--green-deep); }
.lg-band { width: 15px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; }
.lg-band.inner { background: rgba(63, 174, 106, .3); }
.lg-band.outer { background: rgba(111, 183, 233, .22); }

.big-metric { font-size: 40px; font-weight: 800; letter-spacing: -1.5px; color: var(--green-deep); line-height: 1.1; }
.big-metric i { font-style: normal; font-size: 14px; color: var(--ink-3); font-weight: 700; margin-left: 4px; }

.pred-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-2);
  font-size: 13.5px;
  color: var(--ink-2);
}
.pred-row:last-of-type { border-bottom: 0; }
.pred-row b { color: var(--ink); font-size: 15px; font-weight: 800; }

.help-card p { font-size: 13.5px; color: var(--ink-2); line-height: 1.8; margin-bottom: 8px; }
.help-card p:last-child { margin-bottom: 0; }
.help-card h2 { font-size: 15px; margin-bottom: 10px; }

/* ---------------- 打卡页 ---------------- */
.today-card { background: linear-gradient(160deg, #FFFFFF 0%, #FBFEFB 100%); }

.habit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }

.habit {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border: 2px dashed var(--line);
  background: #fff;
  border-radius: 18px;
  padding: 14px 13px;
  cursor: pointer;
  text-align: left;
  transition: all .2s ease;
}
.habit:hover { border-color: #D6EEDD; transform: translateY(-1px); }
.habit.on {
  border-style: solid;
  border-color: var(--green);
  background: linear-gradient(150deg, #F3FCF6, #E7F7EC);
  box-shadow: 0 8px 20px rgba(63, 174, 106, .14);
}
.habit.on .h-n { color: var(--green-deep); }
.h-ring {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: #fff;
  transition: all .2s;
}
.habit.on .h-ring { background: var(--green); border-color: var(--green); }
.h-e { font-size: 21px; line-height: 1.2; }
.h-n { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.h-t { font-size: 11px; color: var(--ink-3); line-height: 1.5; }

.stat-card {
  background: #fff;
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
  text-align: center;
}
.stat-big { font-size: 32px; font-weight: 800; letter-spacing: -1px; color: var(--green-deep); line-height: 1.2; }
.stat-k { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

.wk-tbl { width: 100%; border-collapse: separate; border-spacing: 0 5px; font-size: 12.5px; }
.wk-tbl th {
  font-weight: 700;
  font-size: 11px;
  color: var(--ink-3);
  padding: 0 4px 4px;
  text-align: center;
}
.wk-tbl th em { display: block; font-style: normal; font-size: 10px; color: #C9C1B8; font-weight: 600; }
.wk-tbl th.is-today { color: var(--green-deep); }
.wk-tbl th.is-today em { color: var(--green); }
.wk-tbl td { text-align: center; padding: 0 4px; }
.wk-tbl .wk-h {
  text-align: left;
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  padding-right: 8px;
  font-weight: 600;
}
.wk-tbl .wk-h span { white-space: nowrap; }
.cell {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1.5px dashed var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  color: var(--green-deep);
  transition: all .16s;
  padding: 0;
}
.cell:hover { border-color: #CFE9D8; }
.cell.on { background: var(--green-soft); border-style: solid; border-color: #BFE3CB; }
.cell:disabled { opacity: .3; cursor: default; border-color: var(--line); }
.cell:disabled:hover { border-color: var(--line); }

/* ---------------- 知识页 ---------------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip-btn {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.chip-btn:hover { border-color: #D6EEDD; }
.chip-btn.on { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 4px 12px rgba(63, 174, 106, .25); }

.learn-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.k-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  height: fit-content;
}
.k-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 16px;
  user-select: none;
}
.k-card summary::-webkit-details-marker { display: none; }
.k-ico { font-size: 17px; flex-shrink: 0; }
.k-t { flex: 1; font-size: 14px; font-weight: 700; line-height: 1.45; }
.k-cat { font-size: 10.5px; color: var(--ink-3); background: var(--line-2); padding: 2px 8px; border-radius: 999px; flex-shrink: 0; }
.k-plus {
  font-size: 17px;
  color: var(--ink-3);
  transition: transform .22s;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.k-card[open] .k-plus { transform: rotate(45deg); }
.k-card[open] { box-shadow: var(--shadow-lg); }
.k-body {
  padding: 0 16px 16px 43px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.8;
  animation: fadeIn .25s ease;
}

.disclaimer {
  background: #FFFCF4;
  border: 1px solid #F7E9CE;
}
.disclaimer b { font-size: 13px; color: #B8801F; }
.disclaimer p { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.75; }

/* ---------------- 我的 ---------------- */
.soon-card { background: linear-gradient(135deg, #F7FBFF, #F2F9FF); border: 1px dashed #CFE6F5; }
.soon-card .btn { margin-top: 12px; }
.about p { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }

/* ---------------- 欢迎页 ---------------- */
.welcome { max-width: 540px; margin: 30px auto 0; text-align: center; }
.w-art svg { width: 64px; height: 64px; }
.welcome h1 { font-size: 25px; margin: 6px 0 10px; }
.w-sub { font-size: 14px; color: var(--ink-2); line-height: 1.8; margin-bottom: 22px; }
.welcome .form { text-align: left; }
.w-note { font-size: 12px; color: var(--ink-3); margin-top: 14px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 16px);
  background: rgba(56, 52, 48, .94);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 200;
  max-width: 88vw;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 底部导航（手机） ---------------- */
.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid rgba(120, 86, 40, .07);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.tb {
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink-3);
  min-width: 0;
  flex: 1;
}
.tb-e { font-size: 19px; line-height: 1; filter: grayscale(1) opacity(.62); transition: filter .15s; }
.tb-n { font-size: 10.5px; font-weight: 700; }
.tb.on { color: var(--green-deep); }
.tb.on .tb-e { filter: none; }

/* ---------------- 动画 ---------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.shell > * { animation: fadeUp .32s cubic-bezier(.2, .8, .3, 1) both; }
.shell > *:nth-child(2) { animation-delay: .03s; }
.shell > *:nth-child(3) { animation-delay: .06s; }
.shell > *:nth-child(4) { animation-delay: .09s; }
.shell > *:nth-child(5) { animation-delay: .12s; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------- 云端同步 ---------------- */
.cloud-form { margin-top: 12px; }
.cloud-form .btn-row { margin-top: 4px; }
.cloud-who { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cloud-mail { font-size: 15px; font-weight: 800; word-break: break-all; }
.cloud-err {
  margin-top: 12px;
  font-size: 12.5px;
  color: #C4554B;
  background: #FDF3F2;
  border-radius: 12px;
  padding: 9px 12px;
  line-height: 1.6;
}
.cloud-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--green-deep);
  background: var(--green-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
.cloud-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .grid2 > .card { margin-bottom: 16px; }
  .learn-list { grid-template-columns: 1fr; }
  .habit-grid { grid-template-columns: 1fr 1fr; }
  .brand-t i { display: none; }
}

@media (max-width: 760px) {
  .tabs { display: none; }
  .tabbar { display: flex; }
  .shell { padding: 14px 13px 96px; }
  .topbar-in { height: 58px; padding: 0 14px; }
  .brand-t b { font-size: 15.5px; }
  .card { padding: 16px; border-radius: 20px; }
  .hero { padding: 18px; border-radius: 22px; }
  .hero-name { font-size: 19px; }
  .hs-v { font-size: 21px; }
  .hs { padding: 9px 6px; }
  .hs-k { font-size: 10.5px; }
  .hs-d { font-size: 10px; }
  .form .row2 { grid-template-columns: 1fr; gap: 0; }
  .habit-mini { grid-template-columns: 1fr 1fr; }
  .chart-card { padding: 8px 2px 12px; }
  .seg-row { display: flex; width: 100%; }
  .seg { flex: 1; padding: 8px 6px; font-size: 12.5px; }
  .btn-row .btn { flex: 1 1 46%; }
  .welcome { margin-top: 12px; }
  .welcome h1 { font-size: 22px; }
  .toast { bottom: 96px; }
  .k-body { padding-left: 16px; }
  .t-note { display: none; }
  .tbl th:nth-child(5) { display: none; }
  .wk-tbl .wk-h span { display: none; }
}

@media (max-width: 400px) {
  .habit-grid { grid-template-columns: 1fr; }
  .h-t { display: none; }
  .hero-stats { gap: 6px; }
}

/* ==========================================================================
   深色模式（跟随系统 / 浏览器深色设置）
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110E;
    --card: #1E1A16;
    --ink: #F4EDE4;
    --ink-2: #B6ABA0;
    --ink-3: #877D74;
    --line: #2F2923;
    --line-2: #262019;
    --green: #4CC47C;
    --green-deep: #77D69A;
    --green-soft: #17301F;
    --blue: #7FBEE8;
    --shadow: 0 6px 22px rgba(0, 0, 0, .38);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .46);
  }

  html { color-scheme: dark; }
  body { background: var(--bg); color: var(--ink); }

  body::before {
    background:
      radial-gradient(620px 420px at 8% -8%, rgba(255, 160, 60, .10) 0%, transparent 62%),
      radial-gradient(520px 380px at 96% -2%, rgba(76, 196, 124, .10) 0%, transparent 58%),
      radial-gradient(760px 520px at 50% 112%, rgba(255, 200, 92, .05) 0%, transparent 62%);
  }

  .topbar { background: rgba(20, 17, 14, .86); border-bottom-color: rgba(255, 255, 255, .05); }
  .tabs { background: #201C18; }
  .tab { color: var(--ink-2); }
  .tab:hover { background: #2A2420; }

  .hero { background: linear-gradient(135deg, #18271D 0%, #2B2216 100%); }
  .hero::after { background: radial-gradient(circle, rgba(255, 200, 92, .16), transparent 68%); }
  .hs { background: rgba(255, 255, 255, .055); }
  .avatar { background: #262019; }

  .gauge-bar { box-shadow: inset 0 1px 2px rgba(0, 0, 0, .55); }
  .gauge-pin { background: #221D18; box-shadow: 0 4px 12px rgba(0, 0, 0, .45); }

  .mini, .habit, .cell, .btn-soft, .btn-ghost, .k-card, .stat-card { background: #211D19; }
  .btn-ghost { border-color: var(--line); }
  .btn-soft { color: var(--green-deep); }
  .mini.on, .habit.on { background: linear-gradient(150deg, #17301F, #142E22); }
  .cell.on { background: #17301F; border-color: #2A5C3C; border-style: solid; }
  .h-ring { background: #211D19; border-color: var(--line); }
  .habit.on .h-ring { background: var(--green); border-color: var(--green); }

  .field input, .field select { background: #1A1612; color: var(--ink); border-color: var(--line); }
  .field input::placeholder { color: #6B625A; }
  .field input:focus, .field select:focus { background: #221D18; }

  .tbl tbody tr:hover { background: #241F1A; }
  .tbl th { color: var(--ink-3); }

  .empty { background: #1A1612; }

  .tip-card { background: linear-gradient(135deg, #201A13, #23190F); border-color: #34291A; }
  .tip-ico { background: #33280F; }
  .tip-k { color: #E0B15A; }

  .disclaimer { background: #1F1A12; border-color: #3A2E1C; }
  .disclaimer b { color: #E0B15A; }

  .soon-card { background: linear-gradient(135deg, #17202A, #182430); border-color: #263440; }

  .chip.ok { background: #17301F; color: #77D69A; }
  .chip.warn { background: #33280F; color: #E8BC63; }
  .chip.bad { background: #3A1F1C; color: #EE9E95; }
  .vel-tag.warn { background: #33280F; color: #E8BC63; }
  .vel-tag.ok { background: #17301F; color: #77D69A; }

  .cloud-err { background: #3A1F1C; color: #EE9E95; }
  .cloud-badge { background: #17301F; color: #77D69A; }

  .band-outer { fill: rgba(111, 183, 233, .10); }
  .band-inner { fill: rgba(76, 196, 124, .15); }
  .pct-line { stroke: #3A4A3F; }
  .pct-line.p50 { stroke: #4C6354; }
  .pct-label { fill: #5E7A67; }
  .g-txt { fill: #7A7168; }
  .child-dot { fill: #211D19; }
  .now-line { stroke: #B5763F; }
  .now-txt { fill: #C98A50; }
  .lg-band.inner { background: rgba(76, 196, 124, .3); }
  .lg-band.outer { background: rgba(111, 183, 233, .22); }

  .k-cat { background: #2A2420; color: var(--ink-3); }

  .toast { background: rgba(244, 237, 228, .95); color: #1A1612; }

  .tabbar { background: rgba(30, 26, 22, .95); border-top-color: rgba(255, 255, 255, .06); }

  .w-sub, .w-note, .note-text { color: var(--ink-2); }
}
