/* PocketPath — 视觉系统 */

:root,
[data-theme="light"] {
  --bg-shell: #dce8e4;
  --bg-phone: #f4f7f5;
  --bg-elevated: #ffffff;
  --text: #1a2421;
  --text-secondary: #4a5c56;
  --text-muted: #7a8f88;
  --primary: #2a6b62;
  --primary-dark: #1f524b;
  --primary-soft: rgba(42, 107, 98, 0.12);
  --accent: #c9923a;
  --accent-soft: rgba(201, 146, 58, 0.14);
  --accent-red: #d64545;
  --accent-red-soft: rgba(214, 69, 69, 0.12);
  --green: #2a8f5c;
  --green-soft: rgba(42, 143, 92, 0.14);
  --yellow: #c9923a;
  --yellow-soft: rgba(201, 146, 58, 0.16);
  --gradient-hero: linear-gradient(165deg, #1a4f48 0%, #2d7a6f 55%, #3a9488 100%);
  --gradient-card: linear-gradient(160deg, #ffffff 0%, #f0f7f4 100%);
  --gradient-soft: linear-gradient(160deg, #e8f2ef 0%, #faf8f2 100%);
  --tips-bg: linear-gradient(145deg, #eef6f3 0%, #f8f4ea 100%);
  --shadow-sm: 0 2px 8px rgba(18, 20, 28, 0.06);
  --shadow-md: 0 8px 28px rgba(18, 20, 28, 0.1);
  --shadow-lg: 0 20px 50px rgba(18, 20, 28, 0.14);
  --border: rgba(18, 20, 28, 0.08);
  --input-bg: #f4f5fa;
  --font-brand: "Plus Jakarta Sans", sans-serif;
  --font-display: "Noto Sans SC", "Plus Jakarta Sans", sans-serif;
  --font-ui: "Noto Sans SC", "Plus Jakarta Sans", sans-serif;
  --lh-tight: 1.25;
  --lh-normal: 1.55;
  --lh-relaxed: 1.65;
}

[data-theme="dark"] {
  --bg-shell: #0a1210;
  --bg-phone: #111916;
  --bg-elevated: #1a2420;
  --text: #ecf3f0;
  --text-secondary: #a8bdb6;
  --text-muted: #6d827a;
  --primary: #4da396;
  --primary-dark: #3d8a7f;
  --primary-soft: rgba(77, 163, 150, 0.18);
  --accent: #d4a85c;
  --accent-soft: rgba(212, 168, 92, 0.16);
  --gradient-hero: linear-gradient(165deg, #143832 0%, #1f5c52 100%);
  --gradient-card: linear-gradient(160deg, #1a2420 0%, #1e2e28 100%);
  --gradient-soft: linear-gradient(160deg, #152220 0%, #1f2420 100%);
  --tips-bg: linear-gradient(145deg, #1a2824 0%, #222820 100%);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --input-bg: #222736;
}

:root {
  --radius: 18px;
  --radius-sm: 12px;
  --phone-w: 390px;
  --phone-h: 844px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  font-stretch: normal;
  line-height: var(--lh-normal);
  letter-spacing: 0.01em;
  background: var(--bg-shell);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  color: var(--text);
  transition: background 0.35s, color 0.35s;
}

/* 独立 App 全屏模式（PWA / 添加到主屏幕） */
@media (display-mode: standalone) {
  body { padding: 0; background: var(--bg-phone); }
  .phone-frame {
    max-width: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .phone-notch { display: none; }
  .install-banner { display: none !important; }
}

.app-shell { width: 100%; display: flex; justify-content: center; }

.phone-frame {
  position: relative;
  width: 100%;
  max-width: var(--phone-w);
  min-height: min(var(--phone-h), calc(100dvh - 48px));
  max-height: calc(100dvh - 48px);
  background: var(--bg-phone);
  border-radius: 42px;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border) inset;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.35s;
}

.phone-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 26px;
  background: #0a0c10;
  border-radius: 18px;
  z-index: 100;
  pointer-events: none;
}

.phone-glow {
  position: absolute;
  top: -80px;
  right: -60px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(42, 107, 98, 0.2) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* 金额专用字体 — 避免压扁 */
.num-display,
.num-display-sm {
  font-family: "Noto Sans SC", sans-serif !important;
  font-weight: 700;
  font-stretch: normal;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  letter-spacing: 0.02em;
}
.num-display-sm { font-size: 1.0625rem; }

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  z-index: 1;
}

#screen-login {
  padding: 50px 18px 18px;
  overflow-y: auto;
  scrollbar-width: none;
}
#screen-login::-webkit-scrollbar { display: none; }

/* 主界面：内容滚动 + 底部 Tab 固定 */
.screen-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.main-scroll {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 50px 18px 12px;
  scrollbar-width: none;
  min-height: 0;
}
.main-scroll::-webkit-scrollbar { display: none; }

.screen-active { animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.is-hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* —— 登录 —— */
#screen-login { padding-top: 56px; }

.login-bg-deco {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(42, 107, 98, 0.2), transparent),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(201, 146, 58, 0.12), transparent);
  pointer-events: none;
}

.login-hero { text-align: center; margin-bottom: 24px; position: relative; }

.logo-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 24px;
  background: var(--gradient-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(26, 79, 72, 0.28);
  color: #fff;
}

.logo-svg {
  width: 40px;
  height: 40px;
}

.brand-title {
  font-family: var(--font-brand);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.04em;
  color: var(--primary);
  font-stretch: normal;
}

.brand-sub {
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--font-brand);
}

.version-tag {
  text-align: center;
  margin-top: 20px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  font-family: var(--font-brand);
}
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--input-bg);
  border-radius: 14px;
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 11px;
  border: none;
  border-radius: 11px;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: all 0.25s;
}

.auth-tab-active {
  background: var(--bg-elevated);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: background 0.35s, border-color 0.35s;
}

.card-elevated { box-shadow: var(--shadow-md); }
.card-gradient-soft { background: var(--gradient-soft); border: none; }

.login-card { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.field input,
.select-styled,
.profile-nickname-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.select-styled:focus,
.profile-nickname-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-error {
  font-size: 0.8125rem;
  color: var(--accent-red);
  text-align: center;
  font-weight: 600;
}

.login-card.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%, 75% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
}

/* 按钮 */
.btn {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.9375rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 15px 24px;
  box-shadow: 0 6px 20px rgba(42, 107, 98, 0.28);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  padding: 14px 20px;
  border: 1.5px solid var(--border);
  margin-top: 4px;
}
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 14px; border: 1.5px solid var(--border); flex: 1; }
.btn-danger { background: var(--accent-red-soft); color: var(--accent-red); padding: 14px; margin-top: 8px; }
.btn-block { width: 100%; }

/* —— 主界面头部 —— */
.main-header { margin-bottom: 18px; }

.header-left { display: flex; align-items: center; gap: 12px; }

.header-avatar-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--gradient-soft);
  border: 2px solid var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
  overflow: hidden;
}
.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.header-avatar-btn:hover .header-avatar { transform: scale(1.05); }

.greeting { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

.page-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: 0;
  margin-top: 2px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.section-title-inline { font-family: var(--font-display); font-weight: 700; font-size: 0.9375rem; }
.section-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* 语音特色卡片 */
.feature-card {
  position: relative;
  padding: 28px 20px 32px;
  text-align: center;
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.feature-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 22px;
  padding: 2px;
  background: linear-gradient(145deg, var(--primary), rgba(42, 107, 98, 0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.65;
  pointer-events: none;
}

.feature-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.voice-tip {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: var(--lh-tight);
  margin-bottom: 8px;
}

.mic-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--green);
  background: var(--green-soft);
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.transcript-box {
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  text-align: left;
  border: 1px solid var(--border);
}
.transcript-label { font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.transcript-text { font-size: 1rem; font-weight: 600; margin-top: 4px; }

.wave-container {
  margin: 12px 0;
  padding: 14px;
  background: var(--accent-red-soft);
  border-radius: var(--radius-sm);
}
.wave-bars { display: flex; align-items: center; justify-content: center; gap: 4px; height: 44px; }
.wave-bar {
  width: 5px;
  min-height: 8px;
  background: var(--accent-red);
  border-radius: 3px;
  animation: wavePulse 0.5s ease-in-out infinite alternate;
}
@keyframes wavePulse {
  0% { height: 10px; opacity: 0.5; }
  100% { height: 40px; opacity: 1; }
}
.recording-label { margin-top: 8px; font-size: 0.8125rem; font-weight: 700; color: var(--accent-red); }

.record-btn {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px auto 0;
  color: #fff;
  box-shadow: 0 10px 28px rgba(42, 107, 98, 0.38);
}
.record-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(42, 107, 98, 0.35);
  animation: ringPulse 2s ease-in-out infinite;
}
@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}
.record-btn.recording .record-ring { border-color: var(--accent); animation: ringRecord 0.8s ease-in-out infinite; }
@keyframes ringRecord {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
.record-hint { margin-top: 14px; font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

.voice-status {
  margin-top: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}
.voice-status-error { background: var(--accent-red-soft); color: var(--accent-red); }

/* 看板 */
.hero-balance {
  border-radius: 22px;
  overflow: hidden;
  background: var(--gradient-hero);
  box-shadow: 0 14px 40px rgba(26, 79, 72, 0.28);
  position: relative;
}
.hero-balance::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 60%;
  height: 120%;
  background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 65%);
  pointer-events: none;
}
.hero-balance-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 28px 20px 26px;
  color: #fff;
}
.hero-balance .balance-label { font-size: 0.8125rem; opacity: 0.92; font-weight: 600; }
.hero-balance .balance-amount {
  font-size: 2.5rem;
  margin: 10px 0 8px;
  color: #fff;
}
.hero-balance .balance-sub { font-size: 0.8125rem; opacity: 0.88; line-height: 1.5; }

.insight-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.insight-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.insight-pill.accent {
  background: var(--accent-soft);
  border-color: rgba(201, 146, 58, 0.25);
}
/* 通用线性图标 */
.ui-icon {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}
.ui-icon-sm { width: 16px; height: 16px; }
.ui-icon-lg { width: 28px; height: 28px; }

.avatar-default {
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-default::before {
  content: "";
  width: 55%;
  height: 55%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232a6b62' stroke-width='1.75'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M5 20c0-3.3 3.1-6 7-6s7 2.7 7 6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.avatar-color-a { background: #dce8e4 !important; }
.avatar-color-b { background: #e8eef6 !important; }
.avatar-color-c { background: #f0ebe3 !important; }
.avatar-color-d { background: #e6f0ec !important; }
.avatar-color-e { background: #ede8f2 !important; }
.avatar-color-f { background: #f2ece6 !important; }
.avatar-option {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
.avatar-option:hover { transform: scale(1.06); }
.avatar-option.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.insight-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.insight-pill.accent .insight-icon-wrap {
  background: rgba(201, 146, 58, 0.2);
  color: var(--accent);
}

.goal-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.insight-label { font-size: 0.6875rem; color: var(--text-muted); font-weight: 600; }
.insight-value { font-size: 1.125rem; font-weight: 700; color: var(--text); margin-top: 2px; }

.chart-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.chart-tab {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}
.chart-tab-active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 120px;
  padding-top: 8px;
}
.trend-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.trend-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--primary) 0%, rgba(42, 107, 98, 0.45) 100%);
  min-height: 4px;
  transition: height 0.4s ease;
}
.trend-label { font-size: 0.625rem; color: var(--text-muted); font-weight: 600; }

.category-list { list-style: none; }
.category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.category-item:last-child { border-bottom: none; }
.category-rank {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.category-name { flex: 1; font-weight: 600; font-size: 0.875rem; }
.category-bar-wrap {
  flex: 1.2;
  height: 6px;
  background: var(--input-bg);
  border-radius: 3px;
  overflow: hidden;
}
.category-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
}
.category-amt { font-weight: 700; font-size: 0.8125rem; color: var(--accent-red); min-width: 52px; text-align: right; }

.goal-card {
  background: var(--gradient-soft);
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: var(--radius);
}
.goal-header { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.goal-name { font-weight: 700; font-size: 1.0625rem; }
.goal-pct-line { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 4px; }
.goal-bar { margin-bottom: 8px; }

.tips-card {
  background: var(--tips-bg);
  border: 1px solid var(--border);
}
.section-title.light { color: var(--text); }
.tips-list { list-style: none; }
.tips-list li {
  padding: 12px 0 12px 16px;
  border-bottom: 1px dashed var(--border);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
  position: relative;
}
.tips-list li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 800;
}
.tips-list li:last-child { border-bottom: none; }

.embed-tip {
  font-size: 0.8125rem;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  line-height: 1.55;
}
.embed-tip-line + .embed-tip-line {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(45, 90, 74, 0.12);
}
[data-theme="dark"] .embed-tip-line + .embed-tip-line {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.savings-card { padding: 18px 20px; }
.savings-header { display: flex; justify-content: space-between; margin-bottom: 12px; }
.savings-pct { font-family: var(--font-display); font-weight: 800; color: var(--primary); }
.savings-bar { height: 8px; background: var(--input-bg); border-radius: 4px; overflow: hidden; }
.savings-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #3d9488); border-radius: 4px; transition: width 0.5s; }
.savings-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; }

.rhythm-card { padding: 18px 20px; }
.rhythm-indicator { display: flex; gap: 14px; margin-bottom: 14px; }
.traffic-light {
  width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; flex-shrink: 0;
  background: var(--green); box-shadow: 0 0 0 4px var(--green-soft);
}
.traffic-light[data-state="yellow"] { background: var(--yellow); box-shadow: 0 0 0 4px var(--yellow-soft); }
.rhythm-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.rhythm-desc { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }
.rhythm-bar { height: 8px; background: var(--input-bg); border-radius: 4px; overflow: hidden; }
.rhythm-fill { height: 100%; background: linear-gradient(90deg, var(--green), #34d399); transition: width 0.5s, background 0.4s; }
.rhythm-fill.fast { background: linear-gradient(90deg, var(--yellow), #fbbf24); }
.rhythm-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; text-align: right; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-chip .stat-value { display: block; }
.stat-chip .stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: 4px;
  display: block;
}

/* 账单 */
.ledger-hero { text-align: center; padding: 24px 20px; }
.ledger-summary-label { font-size: 0.8125rem; color: var(--text-secondary); font-weight: 600; }
.ledger-summary-amount {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--accent-red);
  margin: 8px 0;
}
.ledger-summary-sub { font-size: 0.75rem; color: var(--text-muted); }

.recent-list { list-style: none; }
.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.recent-item-body { flex: 1; min-width: 0; }
.recent-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.btn-record-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}
.btn-record-delete:hover {
  background: rgba(196, 74, 62, 0.1);
  color: var(--accent-red);
}
.recent-item:last-child { border-bottom: none; }
.recent-cat { font-weight: 700; font-size: 0.9375rem; }
.recent-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.recent-note { font-size: 0.6875rem; color: var(--text-muted); margin-top: 2px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-amount { font-family: var(--font-display); font-weight: 800; color: var(--accent-red); }
.recent-empty { text-align: center; color: var(--text-muted); font-size: 0.875rem; padding: 12px 0; }

/* 个人主页 */
.profile-hero {
  text-align: center;
  padding: 28px 20px 24px;
  border: none;
  background: var(--gradient-hero);
  border-radius: 22px;
  color: #fff;
  box-shadow: 0 12px 32px rgba(26, 79, 72, 0.22);
}

.profile-avatar-wrap {
  position: relative;
  width: 120px;
  margin: 0 auto 12px;
  display: block;
  cursor: pointer;
}

.avatar-upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 32px;
  padding: 10px;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.avatar-upload-zone:active { background: rgba(255, 255, 255, 0.12); }

.avatar-upload-overlay {
  position: absolute;
  bottom: 36px;
  right: 4px;
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  box-shadow: var(--shadow-sm);
}

.avatar-upload-hint {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  margin-top: 10px;
  opacity: 0.92;
}
.btn-sm { padding: 10px 16px; font-size: 0.8125rem; }

.profile-avatar-large {
  width: 100px;
  height: 100px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.2);
  border: 3px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.75rem;
  overflow: hidden;
  object-fit: cover;
}

.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }

.avatar-edit-btn {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.profile-nickname-input {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: var(--lh-tight);
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  max-width: 200px;
  margin: 0 auto;
  display: block;
}
.profile-hero .profile-nickname-input::placeholder { color: rgba(255,255,255,0.6); }

.profile-email { font-size: 0.8125rem; opacity: 0.85; margin-top: 8px; }

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 600;
}
.setting-row:last-child { border-bottom: none; }

.segmented { display: flex; gap: 6px; }
.segmented-sm .segmented-item span { padding: 8px 10px; font-size: 0.75rem; }
.segmented-item { flex: 1; cursor: pointer; }
.segmented-item input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-item span {
  display: block;
  text-align: center;
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--input-bg);
  border: 2px solid transparent;
  transition: all 0.2s;
}
.segmented-item input:checked + span {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.settings-form-inner { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.settings-saved-tip { text-align: center; font-size: 0.875rem; color: var(--green); font-weight: 700; }

.select-styled { width: auto; min-width: 120px; padding: 10px 12px; font-size: 0.875rem; cursor: pointer; }

/* Tab 栏 — 固定在手机框底部，不随内容滚动 */
.tab-bar {
  flex-shrink: 0;
  display: flex;
  padding: 8px 14px calc(12px + env(safe-area-inset-bottom, 8px));
  gap: 6px;
  background: var(--bg-elevated);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 60;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: background 0.2s;
}
.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  transition: color 0.2s;
}
.tab-active .tab-icon { color: var(--primary); }
.tab .ui-icon { width: 22px; height: 22px; }
.tab-label { font-size: 0.625rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.01em; line-height: 1.2; }
.tab-active { background: var(--primary-soft); }
.tab-active .tab-label { color: var(--primary); }

/* 弹窗 */
.toast-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
}
.toast-overlay:not(.is-hidden) { animation: fadeIn 0.25s ease; }

.toast-card {
  background: var(--bg-elevated);
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: popIn 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.9) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.toast-success-ring {
  width: 56px; height: 56px; margin: 0 auto 14px;
  background: var(--green-soft); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--green);
}
.toast-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-red);
  background: var(--accent-red-soft);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.toast-title { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 800; margin-bottom: 14px; }
.toast-detail {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--input-bg); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 10px; border: 1px solid var(--border);
}
.toast-category { font-weight: 700; color: var(--text-secondary); }
.toast-amount { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--accent-red); }
.toast-time { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 18px; }

.confirm-card { text-align: left; }
.confirm-transcript {
  font-size: 0.875rem; color: var(--text-secondary);
  background: var(--input-bg); padding: 10px 12px;
  border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--border);
}
.confirm-field { margin-bottom: 12px; }
.confirm-field select { width: 100%; padding: 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font-ui); background: var(--input-bg); color: var(--text); }
.confirm-actions { display: flex; gap: 10px; margin-top: 8px; }
.confirm-actions .btn-primary { flex: 1.2; }

.install-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100% - 32px));
  padding: 14px 44px 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
}
.install-banner p { flex: 1; font-size: 0.8125rem; font-weight: 600; line-height: 1.4; }
.install-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* 口袋小窝 — 宠物养成 */
.pet-teaser-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 12px 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(126, 207, 196, 0.45);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(126, 207, 196, 0.18), rgba(255, 214, 165, 0.22));
  cursor: pointer;
  font-family: var(--font-ui);
  text-align: left;
  transition: transform 0.2s, box-shadow 0.2s;
}
.pet-teaser-card:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(42, 107, 98, 0.12); }
.pet-teaser-emoji { font-size: 1.25rem; }
.pet-teaser-text { flex: 1; font-size: 0.8125rem; font-weight: 700; color: var(--primary); }
.pet-teaser-arrow { color: var(--text-muted); font-size: 1.125rem; font-weight: 700; }

.pet-habitat {
  padding: 0;
  overflow: hidden;
  border: none;
  background: linear-gradient(180deg, #dff5f1 0%, #f8faf9 52%, #fff 100%);
  box-shadow: 0 14px 36px rgba(42, 107, 98, 0.14);
}
.pet-bg-meadow.pet-habitat { background: linear-gradient(180deg, #dff5f1 0%, #f8faf9 52%, #fff 100%); }
.pet-bg-sunset.pet-habitat { background: linear-gradient(180deg, #ffe8d6 0%, #fff5eb 50%, #fff 100%); }
.pet-bg-sunset .pet-scene { background: linear-gradient(180deg, rgba(255, 184, 138, 0.55) 0%, rgba(255, 232, 214, 0.35) 45%, transparent 100%); }
.pet-bg-sakura.pet-habitat { background: linear-gradient(180deg, #ffe4ec 0%, #fff5f8 50%, #fff 100%); }
.pet-bg-sakura .pet-scene { background: linear-gradient(180deg, rgba(255, 196, 214, 0.5) 0%, rgba(255, 228, 236, 0.3) 40%, transparent 100%); }
.pet-bg-starry.pet-habitat { background: linear-gradient(180deg, #1a2840 0%, #243652 50%, #1e2423 100%); color: #fff; }
.pet-bg-starry .pet-scene { background: linear-gradient(180deg, #0f1a30 0%, rgba(26, 40, 64, 0.6) 55%, transparent 100%); }
.pet-bg-starry .pet-cloud { background: rgba(255, 255, 255, 0.12); }
.pet-bg-starry .pet-mood-line, .pet-bg-starry .pet-stats-hint, .pet-bg-starry .pet-treats-line { color: rgba(255, 255, 255, 0.72); }
[data-theme="dark"] .pet-habitat {
  background: linear-gradient(180deg, #1a3532 0%, #1e2423 55%, var(--bg-elevated) 100%);
}

.pet-furniture-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.pet-actor-group {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: 150px;
  height: 150px;
  z-index: 3;
  animation: petFloat 3.2s ease-in-out infinite;
  pointer-events: none;
}
.pet-actor-group.pet-bounce { animation: petBounceGroup 0.55s ease; }
.pet-actor-group.pet-feed { animation: petFeedGroup 0.65s ease; }
.pet-actor-group.pet-wiggle { animation: petWiggleGroup 0.5s ease; }
.pet-actor-group.pet-mood-sad { animation-duration: 4.5s; }
.pet-wings-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.pet-wings-layer .item-svg { width: 100%; height: 100%; }
.pet-character {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  width: 130px;
  height: 130px;
  margin: 0 auto;
  z-index: 1;
  pointer-events: none;
}
.pet-character .pet-svg { pointer-events: none; }
.pet-accessory-layer {
  position: absolute;
  left: 50%;
  top: 8%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  z-index: 5;
  touch-action: none;
  pointer-events: none;
}
.pet-accessory-layer:not(:empty) {
  cursor: grab;
  pointer-events: auto;
}
.pet-accessory-layer.pet-dragging { cursor: grabbing; }
.pet-accessory-layer .item-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12));
  pointer-events: auto;
  cursor: inherit;
}

.pet-furn-item {
  position: absolute;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.14));
  pointer-events: none;
}
.pet-furn-item .item-svg { width: 100%; height: 100%; display: block; }
.pet-furn-cushion { left: 4%; bottom: 28px; width: 56px; height: 56px; }
.pet-furn-plant { right: 6%; bottom: 32px; width: 52px; height: 52px; }
.pet-furn-lamp { top: 8px; right: 12px; width: 48px; height: 48px; }
.pet-furn-rug { left: 50%; bottom: 14px; transform: translateX(-50%); width: 100px; height: 40px; }
.pet-furn-teddy { left: 10%; bottom: 30px; width: 44px; height: 44px; }
.pet-furn-frame { top: 16px; left: 12px; width: 44px; height: 44px; }
.pet-furn-clock { top: 12px; left: 50%; transform: translateX(-50%); width: 46px; height: 46px; }
.pet-furn-bookshelf { right: 4%; bottom: 24px; width: 50px; height: 58px; }

.pet-bg-beach.pet-habitat { background: linear-gradient(180deg, #caf0f8 0%, #fff9e6 55%, #fff 100%); }
.pet-bg-beach .pet-scene { background: linear-gradient(180deg, #48cae4 0%, #90e0ef 35%, transparent 100%); }
.pet-bg-beach .pet-ground { background: linear-gradient(180deg, #fde68a, #fbbf24); }
.pet-bg-snow.pet-habitat { background: linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 55%, #fff 100%); }
.pet-bg-snow .pet-scene { background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 45%, transparent 100%); }
.pet-bg-snow .pet-ground { background: linear-gradient(180deg, #f8fafc, #e2e8f0); }
.pet-bg-forest.pet-habitat { background: linear-gradient(180deg, #1b4332 0%, #2d6a4f 45%, #1e2423 100%); color: #fff; }
.pet-bg-forest .pet-scene { background: linear-gradient(180deg, #081c15 0%, rgba(45, 106, 79, 0.5) 50%, transparent 100%); }
.pet-bg-forest .pet-ground { background: linear-gradient(180deg, #40916c, #2d6a4f); }
.pet-bg-forest .pet-mood-line, .pet-bg-forest .pet-stats-hint, .pet-bg-forest .pet-treats-line { color: rgba(255,255,255,0.75); }
.pet-bg-rainbow.pet-habitat { background: linear-gradient(135deg, #fff0f6, #e7f5ff, #fff9db); }
.pet-bg-rainbow .pet-scene {
  background: linear-gradient(180deg,
    rgba(255,107,107,0.25) 0%, rgba(255,212,59,0.2) 25%,
    rgba(105,219,124,0.2) 50%, rgba(77,171,247,0.2) 75%, transparent 100%);
}

.shop-item-art, .shop-bg-preview {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}
.shop-item-art .item-svg { width: 52px; height: 52px; display: block; }
.shop-bg-preview { border-radius: 12px; border: 1px solid var(--border); }
.shop-bg-preview-meadow { background: linear-gradient(180deg, #dff5f1, #9aded4); }
.shop-bg-preview-sunset { background: linear-gradient(180deg, #ffb88a, #ffe8d6); }
.shop-bg-preview-sakura { background: linear-gradient(180deg, #ffc4d6, #ffe4ec); }
.shop-bg-preview-starry { background: linear-gradient(180deg, #0f1a30, #1a2840); }
.shop-bg-preview-beach { background: linear-gradient(180deg, #48cae4, #fde68a); }
.shop-bg-preview-snow { background: linear-gradient(180deg, #bae6fd, #f8fafc); }
.shop-bg-preview-forest { background: linear-gradient(180deg, #081c15, #40916c); }
.shop-bg-preview-rainbow {
  background: linear-gradient(135deg, #ff6b6b, #ffd43b, #69db7c, #4dabf7, #da77f2);
}

.pet-level-block { padding: 12px 18px 0; }
.pet-level-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pet-level-badge { font-family: var(--font-display); font-weight: 800; font-size: 0.875rem; color: var(--primary); }
.pet-xp-text { font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); }
.pet-xp-track { height: 8px; background: rgba(42, 107, 98, 0.12); border-radius: 999px; overflow: hidden; }
.pet-xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffd6a5, #ffb347); border-radius: 999px; transition: width 0.45s ease; }
.pet-stats-hint { text-align: center; font-size: 0.6875rem; color: var(--text-muted); padding: 8px 18px 0; line-height: 1.5; }
.pet-character.pet-bonus-glow .pet-svg {
  filter: drop-shadow(0 0 12px rgba(255, 214, 165, 0.65)) drop-shadow(0 10px 16px rgba(42, 107, 98, 0.22));
}

.shop-tabs { display: flex; gap: 6px; margin: 12px 0 10px; }
.shop-tab {
  flex: 1; padding: 8px 6px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--input-bg); font-family: var(--font-ui); font-size: 0.75rem; font-weight: 700;
  color: var(--text-muted); cursor: pointer;
}
.shop-tab-active { background: var(--primary-soft); border-color: rgba(42, 107, 98, 0.35); color: var(--primary); }
.shop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.shop-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border-radius: 14px; border: 1px solid var(--border); background: var(--input-bg); text-align: center;
}
.shop-item.is-equipped { border-color: rgba(255, 179, 71, 0.65); box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.2); }
.shop-item.is-owned { background: rgba(126, 207, 196, 0.08); }
.shop-item-icon { font-size: 1.625rem; line-height: 1; }
.shop-item-name { font-size: 0.6875rem; font-weight: 700; color: var(--text-secondary); line-height: 1.35; }
.shop-locked, .shop-free { font-size: 0.625rem; color: var(--text-muted); font-weight: 600; }
.btn-sm { padding: 6px 10px; font-size: 0.6875rem; min-height: auto; }
.achievement-chip.claimed { opacity: 0.88; }
.achievement-claim-btn { margin-top: 4px; width: 100%; }
.achievement-claimed-tag { font-size: 0.625rem; font-weight: 700; color: var(--primary); margin-top: 4px; }
#achievement-later-btn { margin-top: 8px; }

.pet-scene {
  position: relative;
  height: 200px;
  overflow: hidden;
}
.pet-sky-deco { position: absolute; inset: 0; pointer-events: none; }
.pet-cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  filter: blur(0.3px);
}
.pet-cloud-a { width: 54px; height: 18px; top: 22px; left: 16%; animation: cloudDrift 8s ease-in-out infinite; }
.pet-cloud-b { width: 42px; height: 14px; top: 38px; right: 14%; animation: cloudDrift 10s ease-in-out infinite reverse; }
.pet-star { position: absolute; color: #ffd6a5; font-size: 0.75rem; opacity: 0.85; animation: starTwinkle 2.4s ease-in-out infinite; }
.pet-star-a { top: 18px; right: 22%; }
.pet-star-b { top: 32px; left: 20%; animation-delay: 0.8s; }
@keyframes cloudDrift {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(8px); }
}
@keyframes starTwinkle {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

.pet-svg { width: 100%; height: 100%; filter: drop-shadow(0 10px 16px rgba(42, 107, 98, 0.22)); }
@keyframes petFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}
@keyframes petBounceGroup {
  0%, 100% { transform: translateX(-50%) scale(1); }
  40% { transform: translateX(-50%) scale(1.08) translateY(-10px); }
}
@keyframes petFeedGroup {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  25% { transform: translateX(-50%) rotate(-4deg) translateY(-4px); }
  75% { transform: translateX(-50%) rotate(4deg) translateY(-4px); }
}
@keyframes petWiggleGroup {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  25% { transform: translateX(-50%) rotate(-6deg); }
  75% { transform: translateX(-50%) rotate(6deg); }
}
.pet-character.pet-bounce { animation: petBounce 0.55s ease; }
.pet-character.pet-feed { animation: petFeedAnim 0.65s ease; }
.pet-character.pet-wiggle { animation: petWiggle 0.5s ease; }
@keyframes petBounce {
  0%, 100% { transform: translateX(-50%) scale(1); }
  40% { transform: translateX(-50%) scale(1.08) translateY(-10px); }
}
@keyframes petFeedAnim {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  25% { transform: translateX(-50%) rotate(-4deg) translateY(-4px); }
  75% { transform: translateX(-50%) rotate(4deg) translateY(-4px); }
}
@keyframes petWiggle {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  25% { transform: translateX(-50%) rotate(-6deg); }
  75% { transform: translateX(-50%) rotate(6deg); }
}

.pet-mood-hungry .pet-mouth { stroke-width: 2.6; opacity: 0.9; }
.pet-mood-sad .pet-eye { transform-origin: center; opacity: 0.85; }
.pet-mood-happy .pet-blush { opacity: 0.75; }

.pet-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  background: linear-gradient(180deg, rgba(126, 207, 196, 0.25), rgba(90, 170, 155, 0.35));
  border-radius: 50% 50% 0 0 / 24px 24px 0 0;
  z-index: 0;
  pointer-events: none;
}
.pet-wings-layer.is-draggable {
  pointer-events: auto;
  cursor: grab;
  z-index: 2;
}
.pet-wings-layer.is-draggable .item-svg { pointer-events: auto; cursor: inherit; }
.pet-wings-layer.is-draggable.pet-dragging { cursor: grabbing; }

.pet-meta-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 16px 0;
}
.pet-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(126, 207, 196, 0.35);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}
[data-theme="dark"] .pet-meta-chip { background: rgba(255, 255, 255, 0.06); }
.pet-level-chip { background: linear-gradient(135deg, #ffd6a5, #ffe8c8); color: #7a4e12; border-color: transparent; }

.pet-bars { padding: 14px 18px 0; display: flex; flex-direction: column; gap: 10px; }
.pet-bar-row { display: flex; align-items: center; gap: 10px; }
.pet-bar-label { width: 42px; font-size: 0.6875rem; font-weight: 700; color: var(--text-secondary); flex-shrink: 0; }
.pet-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(42, 107, 98, 0.1);
  border-radius: 999px;
  overflow: hidden;
}
.pet-bar-fill { height: 100%; border-radius: 999px; transition: width 0.45s ease; }
.pet-bar-happy { background: linear-gradient(90deg, #ff9eb5, #ffb8c9); }
.pet-bar-full { background: linear-gradient(90deg, #7ecfc4, #5eb8aa); }

.pet-mood-line {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 12px 18px 0;
  line-height: 1.55;
}

.pet-actions {
  display: flex;
  gap: 10px;
  padding: 16px 18px 0;
}
.pet-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 10px;
}
.pet-treats-line {
  text-align: center;
  font-size: 0.6875rem;
  color: var(--text-muted);
  padding: 10px 18px 18px;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.achievement-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 14px;
  background: var(--input-bg);
  border: 1px dashed var(--border);
  opacity: 0.72;
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
}
.achievement-chip.unlocked {
  opacity: 1;
  border-style: solid;
  border-color: rgba(126, 207, 196, 0.55);
  background: linear-gradient(145deg, rgba(126, 207, 196, 0.14), rgba(255, 214, 165, 0.12));
  box-shadow: 0 4px 12px rgba(42, 107, 98, 0.08);
}
.achievement-chip-icon { font-size: 1.375rem; line-height: 1; }
.achievement-chip-name { font-size: 0.6875rem; font-weight: 700; text-align: center; line-height: 1.35; color: var(--text-secondary); }

.achievement-unlock-card { padding-top: 24px; }
.achievement-unlock-badge {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 214, 165, 0.5), rgba(126, 207, 196, 0.35));
  box-shadow: 0 8px 24px rgba(42, 107, 98, 0.18);
  animation: petBounce 0.7s ease;
}
.achievement-unlock-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 18px;
  line-height: 1.5;
}

.tab-bar { padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 8px)); gap: 4px; }
.tab { padding: 8px 2px; }
.tab-label { font-size: 0.5625rem; }

@media (max-width: 420px) {
  body { padding: 0; }
  .phone-frame { max-width: 100%; min-height: 100dvh; max-height: 100dvh; border-radius: 0; box-shadow: none; }
  .phone-notch { display: none; }
  .main-scroll { padding-top: 44px; }
  #screen-login { padding-top: 44px; }
}

/* —— 登录身份 / 家庭关联 / 预算申请 / 家长端 —— */
.auth-role-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0 4px;
}
.auth-role-label { font-size: 0.8125rem; font-weight: 700; color: var(--text-secondary); }
.auth-role-seg { flex: 1; max-width: 220px; }

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 10px;
}
.link-code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.link-code {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 12px 10px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px dashed rgba(42, 107, 98, 0.35);
}
.linked-parents-line {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.budget-request-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.budget-request-list:empty { display: none; }
.budget-req-card {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--input-bg);
}
.budget-req-card.is-pending { border-color: rgba(255, 179, 71, 0.45); }
.budget-req-card.is-approved { border-color: rgba(42, 107, 98, 0.35); background: rgba(126, 207, 196, 0.08); }
.budget-req-card.is-rejected { opacity: 0.82; }
.budget-req-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.budget-req-title { font-weight: 800; font-size: 0.875rem; color: var(--text-primary); }
.budget-req-amount { font-family: var(--font-display); font-weight: 800; color: var(--primary); white-space: nowrap; }
.budget-req-meta { font-size: 0.6875rem; color: var(--text-muted); margin-bottom: 6px; }
.budget-req-body { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.55; }
.budget-req-body p { margin: 4px 0; }
.budget-req-body strong { color: var(--text-primary); font-weight: 700; }
.budget-req-status {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  margin-top: 8px;
}
.budget-req-status.pending { background: rgba(255, 179, 71, 0.2); color: #b45309; }
.budget-req-status.approved { background: rgba(42, 107, 98, 0.15); color: var(--primary); }
.budget-req-status.rejected { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.budget-req-actions { display: flex; gap: 8px; margin-top: 10px; }
.budget-req-actions .btn { flex: 1; }

.budget-request-form-card { max-height: 88vh; overflow-y: auto; text-align: left; }
.budget-form-sub { font-size: 0.75rem; color: var(--text-muted); margin: -4px 0 12px; }
.budget-request-warn {
  font-size: 0.8125rem;
  color: #b45309;
  background: rgba(255, 179, 71, 0.15);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  line-height: 1.5;
}
.budget-request-form textarea {
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  resize: vertical;
}
.range-styled { width: 100%; accent-color: var(--primary); margin-top: 4px; }

.parent-header-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffd6a5, #ffb347);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.parent-empty { text-align: center; padding: 28px 18px; }
.parent-empty-icon { font-size: 2rem; margin-bottom: 8px; }
.parent-child-card { margin-bottom: 12px; }
.parent-child-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.parent-child-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
}
.parent-child-name { font-weight: 800; font-size: 0.9375rem; }
.parent-child-email { font-size: 0.6875rem; color: var(--text-muted); }
.parent-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.parent-stat {
  padding: 10px;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
}
.parent-stat-label { font-size: 0.6875rem; color: var(--text-muted); }
.parent-stat-value { font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--primary); margin-top: 2px; }
.parent-pending-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #b45309;
  background: rgba(255, 179, 71, 0.18);
  padding: 4px 8px;
  border-radius: 999px;
  margin-top: 8px;
}
.parent-privacy-note {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 10px;
}
.parent-insight-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.parent-insight-pill {
  flex: 1;
  min-width: calc(50% - 4px);
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
}
.parent-insight-pill .pill-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  font-weight: 600;
}
.parent-insight-pill .pill-value {
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 2px;
}
.parent-insight-pill.health-good .pill-value { color: var(--primary); }
.parent-insight-pill.health-ok .pill-value { color: #b45309; }
.parent-insight-pill.health-tight .pill-value { color: #c2410c; }
.parent-insight-pill.health-over .pill-value { color: #b91c1c; }
.parent-trend-block { margin-top: 12px; }
.parent-trend-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.parent-trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 48px;
  padding: 0 2px;
}
.parent-trend-bar {
  flex: 1;
  min-width: 0;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, rgba(126, 207, 196, 0.85), rgba(42, 107, 98, 0.55));
  transition: height 0.3s ease;
}
.parent-trend-cats {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.5;
}
.linked-children-list { list-style: none; padding: 0; margin: 0; }
.linked-child-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}
.linked-child-item:last-child { border-bottom: none; }
.link-form { margin-top: 4px; }

.app-status-toast {
  position: absolute;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%) translateY(12px);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(26, 61, 56, 0.92);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-align: center;
}
.app-status-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.app-status-toast.is-error { background: rgba(185, 28, 28, 0.92); }

.field-optional { font-weight: 500; color: var(--text-muted); font-size: 0.8125em; }
.mood-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.mood-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.mood-chip.selected {
  border-color: rgba(42, 107, 98, 0.45);
  background: var(--primary-soft);
  color: var(--primary);
}
.mood-chip-emoji { font-size: 0.875rem; line-height: 1; }
.recent-mood { font-size: 0.6875rem; color: var(--text-muted); margin-top: 2px; }

.emotion-bill-body { margin-top: 8px; }
.emotion-bill-highlight {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.55;
  margin: 0 0 8px;
}
.emotion-bill-detail { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.5; margin: 0; }
.emotion-bill-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.emotion-bill-row { display: flex; align-items: center; gap: 8px; font-size: 0.6875rem; }
.emotion-bill-row-label { width: 56px; flex-shrink: 0; color: var(--text-muted); font-weight: 600; }
.emotion-bill-row-track { flex: 1; height: 6px; background: rgba(42, 107, 98, 0.12); border-radius: 999px; overflow: hidden; }
.emotion-bill-row-fill { height: 100%; background: linear-gradient(90deg, #7ecfc4, #2a6b62); border-radius: 999px; }
.emotion-bill-row-pct { width: 32px; text-align: right; font-weight: 700; color: var(--primary); }
