/* =====================================================
   TwinTree · 专业设计系统
   深空绿 + 翠绿强调 + 金色奖励
   ===================================================== */
:root {
  --bg: #070b09;
  --bg-soft: #0d1410;
  --card: #121a16;
  --card-hover: #172019;
  --elevated: #1a2420;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.1);

  --primary: #2dd4a0;
  --primary-hover: #25b88a;
  --primary-muted: rgba(45,212,160,0.12);
  --primary-glow: rgba(45,212,160,0.22);

  --gold: #e8b84a;
  --gold-muted: rgba(232,184,74,0.15);
  --danger: #f87171;
  --warning: #fbbf24;

  --text: #eef5f1;
  --text-secondary: #8fa89a;
  --text-muted: #5a7266;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 12px 40px rgba(0,0,0,0.45);
  --font: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}
input::placeholder { color: var(--text-muted); }

/* Layout */
.app-shell {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.page { flex: 1; padding: 0 20px 100px; }

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7,11,9,0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.topbar-back {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}
.topbar-back:hover { color: var(--text); }

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  background: rgba(13,20,16,0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 18px;
  z-index: 50;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  transition: color 0.2s;
}
.nav-item.active { color: var(--primary); }
.nav-item svg { width: 22px; height: 22px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: 14px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 22px;
  border-radius: 12px;
  transition: all 0.18s;
  width: 100%;
}
.btn-primary {
  background: linear-gradient(135deg, #1a9b74, var(--primary));
  color: #04120c;
  box-shadow: 0 4px 20px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--primary-glow);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-secondary {
  background: var(--elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid transparent;
}
.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  width: auto;
  border-radius: 20px;
}

/* Form */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 6px; }

/* Auth pages */
.auth-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 24px;
  max-width: 400px;
  margin: 0 auto;
}
.auth-logo {
  text-align: center;
  margin-bottom: 36px;
}
.auth-logo .icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #1a9b74, var(--primary));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 32px var(--primary-glow);
}
.auth-logo h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.auth-logo p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 6px;
}
.auth-tabs {
  display: flex;
  background: var(--card);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 9px;
  color: var(--text-muted);
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--elevated);
  color: var(--text);
}
.auth-switch {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Tree Visual */
.tree-hero {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px 24px;
  text-align: center;
  overflow: hidden;
  margin-bottom: 16px;
}
.tree-level {
  position: absolute;
  top: 14px;
  right: 14px;
  background: linear-gradient(135deg, #1a9b74, var(--primary));
  color: #04120c;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 20px;
}
.tree-canvas {
  width: 140px;
  height: 160px;
  margin: 0 auto 16px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.tree-glow {
  position: absolute;
  bottom: 16px;
  width: 110px;
  height: 110px;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
  border-radius: 50%;
}
.tree-trunk {
  width: 12px;
  height: 44px;
  background: linear-gradient(#6b4a36, #3d2a1e);
  border-radius: 3px;
  z-index: 1;
}
.tree-leaves {
  position: absolute;
  bottom: 36px;
  width: 100px;
  height: 100px;
}
.leaf {
  position: absolute;
  border-radius: 50% 0 50% 50%;
  background: linear-gradient(135deg, #34d399, #059669);
  opacity: 0.92;
}
.leaf-a { width: 64px; height: 64px; top: 8px; left: 18px; transform: rotate(-18deg); }
.leaf-b { width: 54px; height: 54px; top: 4px; left: 46px; transform: rotate(28deg); background: linear-gradient(135deg, #2dd4a0, #047857); }
.leaf-c { width: 50px; height: 50px; top: 38px; left: 4px; transform: rotate(-48deg); }
.leaf-d { width: 46px; height: 46px; top: 42px; left: 52px; transform: rotate(55deg); background: linear-gradient(135deg, #10b981, #065f46); }

.tree-name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.tree-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.progress-box { margin-top: 18px; }
.progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.progress-row strong { color: var(--primary); font-weight: 600; }
.progress-track {
  height: 7px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1a9b74, var(--primary));
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
  width: 0%;
}

/* Partner */
.partner-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.partner-item {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.partner-item.me { border-color: rgba(45,212,160,0.25); }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.avatar-me {
  background: linear-gradient(135deg, #1a9b74, var(--primary));
  color: #04120c;
}
.avatar-friend {
  background: var(--elevated);
  color: var(--text-secondary);
  border: 1px dashed var(--border-strong);
}
.avatar-friend.joined {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
}
.partner-meta { flex: 1; min-width: 0; }
.partner-meta .name { font-size: 14px; font-weight: 600; }
.partner-meta .status { font-size: 12px; color: var(--text-muted); }
.partner-meta .status.ok { color: var(--primary); }

/* Balance strip */
.balance-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(45,212,160,0.1), rgba(232,184,74,0.06));
  border: 1px solid rgba(45,212,160,0.2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.balance-strip .label { font-size: 12px; color: var(--text-secondary); }
.balance-strip .value { font-size: 22px; font-weight: 700; color: var(--primary); letter-spacing: -0.02em; }
.balance-actions { display: flex; gap: 8px; }
.balance-actions .btn-sm {
  background: var(--primary-muted);
  color: var(--primary);
  border: none;
}

/* My page list */
.list-group { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.15s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--card-hover); }
.list-item .icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.list-item .text { flex: 1; font-size: 15px; font-weight: 500; }
.list-item .arrow { color: var(--text-muted); font-size: 18px; }

/* Transaction */
.tx-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.tx-item:last-child { border-bottom: none; }
.tx-left .title { font-size: 14px; font-weight: 500; }
.tx-left .time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tx-amount { font-size: 15px; font-weight: 650; }
.tx-amount.plus { color: var(--primary); }
.tx-amount.minus { color: var(--text-secondary); }

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
  z-index: 200;
  max-width: 90%;
  text-align: center;
  box-shadow: var(--shadow);
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Modal */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
  padding: 24px;
}
.modal-mask.show { opacity: 1; visibility: visible; }
.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.25s;
}
.modal-mask.show .modal-box { transform: scale(1); }
.modal-icon { font-size: 44px; margin-bottom: 12px; }
.modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.modal-box p { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.modal-amount { font-size: 32px; font-weight: 800; color: var(--gold); margin-bottom: 22px; }

/* Utility */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 20px 0 10px;
}
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-gold { color: var(--gold); }
.fw-600 { font-weight: 600; }

/* Empty / loading */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive small */
@media (max-width: 380px) {
  .partner-row { flex-direction: column; }
}
