/* ─────────────────────────────────────────────────────────
   成长记录页
   与孩子端同一套深色夜空，但更「像一本账」：少装饰、多留白、数字对齐
   ───────────────────────────────────────────────────────── */

:root {
  --bg-top: #171136;
  --bg-bot: #08061a;
  --text:   #f3ecff;
  --dim:    #a094c9;
  --card:   rgba(255, 255, 255, .055);
  --border: rgba(255, 255, 255, .1);
  --gold:   #ffc23c;
  --in:     #5ee08a;
  --out:    #ff9d76;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(120% 70% at 50% 0%, var(--bg-top) 0%, var(--bg-bot) 65%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}

button { font-family: inherit; color: inherit; border: none; background: none; cursor: pointer; }

/* ── 顶栏 ────────────────────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px 10px;
  background: rgba(10, 8, 24, .78);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.back {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
}

.back:active { background: rgba(255, 255, 255, .08); }

.bar-title {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
}

.bar-side { width: 34px; }

/* ── 标签 ────────────────────────────────────────────── */

.tabs {
  position: sticky;
  top: 57px;
  z-index: 9;
  display: flex;
  gap: 6px;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 14px;
  background: rgba(10, 8, 24, .78);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.tab {
  flex: 1;
  padding: 8px 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dim);
  border: 1px solid transparent;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}

.tab.active {
  color: var(--text);
  background: rgba(255, 255, 255, .08);
  border-color: var(--border);
}

/* ── 概览 ────────────────────────────────────────────── */

.summary {
  max-width: 520px;
  margin: 6px auto 0;
  padding: 0 16px;
  font-size: 12.5px;
  color: var(--dim);
}

.summary b {
  color: var(--gold);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

/* ── 列表 ────────────────────────────────────────────── */

.list {
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 14px calc(28px + var(--safe-b));
}

.day {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--dim);
}

.row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 7px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--border);
}

.row-icon {
  flex: none;
  width: 26px;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}

.row-main { flex: 1; min-width: 0; }

.row-title {
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.35;
  color: #f0e9ff;
}

.row-meta {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-side {
  flex: none;
  text-align: right;
  padding-left: 6px;
}

.row-value {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.row-value.in  { color: var(--in); }
.row-value.out { color: var(--out); }
.row-value.plain { color: var(--text); }

.row-sub {
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--dim);
  white-space: nowrap;
}

/* 属性变化：一条一行，用箭头表示前后 */
.changes {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.change {
  font-size: 11.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.change .cl { color: #cfc4ee; margin-right: 5px; }
.change .cf { color: var(--dim); }
.change .ar { margin: 0 4px; opacity: .6; }
.change .ct { color: var(--gold); font-weight: 700; }

/* ── 加载更多 / 空状态 ───────────────────────────────── */

.more {
  display: block;
  width: calc(100% - 28px);
  max-width: 492px;
  margin: 6px auto calc(24px + var(--safe-b));
  padding: 12px 0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dim);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
}

.more:active { background: rgba(255, 255, 255, .1); }

/* display:block 会盖掉 hidden 属性的默认隐藏，必须显式补一条 */
.more[hidden] { display: none; }

.empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.7;
}

.empty-icon {
  display: block;
  font-size: 30px;
  margin-bottom: 10px;
  opacity: .55;
}

/* ── Toast ───────────────────────────────────────────── */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(30px + var(--safe-b));
  transform: translate(-50%, 14px);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(40, 30, 70, .95);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 40;
  max-width: calc(100vw - 48px);
  text-align: center;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }

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