/* =========================================================
   Creator Cockpit - design tokens
   反 AI Slop 原则：单一强调色（emerald）、零渐变、
   sharp corners for numerals、rounded 16px for cards
   ========================================================= */
:root {
  /* light tokens (default = dark via data-theme) */
  --bg:           #fafaf7;
  --bg-elev-1:    #ffffff;
  --bg-elev-2:    #f4f4ee;
  --line:         #e6e4dc;
  --line-soft:    #efece4;
  --text:         #14130f;
  --text-2:       #5a5852;
  --text-3:       #8a8882;
  --accent:       #008a5e;       /* emerald */
  --accent-soft:  #c8efd8;
  --warn:         #d57a1a;
  --pos:          #008a5e;
  --neg:          #c23a3a;
  --shadow:       0 1px 0 rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.05);
}

[data-theme="dark"] {
  --bg:           #0a0a0a;
  --bg-elev-1:    #131311;
  --bg-elev-2:    #1a1a17;
  --line:         #232321;
  --line-soft:    #1d1d1b;
  --text:         #f4f3ee;
  --text-2:       #a8a69d;
  --text-3:       #6a6862;
  --accent:       #34d399;
  --accent-soft:  #14322a;
  --warn:         #f59e0b;
  --pos:          #34d399;
  --neg:          #f87171;
  --shadow:       0 1px 0 rgba(255,255,255,.03), 0 4px 24px rgba(0,0,0,.5);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background .35s ease, color .35s ease;
}

body {
  max-width: 440px;
  margin: 0 auto;
  position: relative;
  min-height: 100dvh;
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

ul, ol { list-style: none; }

/* ===== status bar (iOS-like, decorative) ===== */
.status-bar {
  height: 44px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
}
.status-icons { display: flex; gap: 6px; align-items: center; color: var(--text); }

/* ===== topbar ===== */
.topbar {
  padding: 8px 18px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
}
.brand-dot::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1.6px solid #0a0a0a;
  border-radius: 2px;
}
[data-theme="light"] .brand-dot::after { border-color: #fff; }
.brand-name {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.01em;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: .03em;
  margin-top: 1px;
}
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  color: var(--text-2);
  transition: transform .15s, background .2s;
}
.icon-btn:active { transform: scale(.94); }

/* ===== account tabs (segmented) ===== */
.account-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 18px;
  margin-bottom: 16px;
}
.tab {
  position: relative;
  padding: 12px 14px;
  text-align: left;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: all .25s cubic-bezier(.16,1,.3,1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tab.is-active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.tab-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--text-3);
  font-weight: 500;
}
.tab.is-active .tab-num { color: var(--text-3); opacity: .7; }
.tab-name {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.tab-meta {
  font-size: 10.5px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -.01em;
}
.tab.is-active .tab-meta { color: var(--text-3); opacity: .7; }

/* ===== cockpit (big number hero) ===== */
.cockpit {
  margin: 0 18px 16px;
  padding: 22px 20px 20px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}
.cockpit::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent);
  opacity: .9;
}
.cockpit-label {
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.cockpit-big {
  font-family: 'JetBrains Mono', monospace;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cockpit-big .unit {
  font-size: 18px;
  color: var(--text-2);
  margin-left: 4px;
}
.cockpit-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  margin-top: 6px;
  color: var(--pos);
  font-weight: 500;
}
.cockpit-delta.neg { color: var(--neg); }
.cockpit-sub {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 4px;
  letter-spacing: -.005em;
}
.cockpit-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 18px 0;
}
.cockpit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--text-3);
  text-transform: uppercase;
}
.kpi-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kpi-val .small {
  font-size: 11px;
  color: var(--text-3);
  margin-left: 1px;
}

/* ===== generic panel ===== */
.panel {
  margin: 0 18px 14px;
  padding: 18px 18px 16px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.panel-title {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.005em;
}
.panel-sub {
  font-size: 11px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: .04em;
}
.badge {
  display: inline-block;
  padding: 2px 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  border-radius: 4px;
}

/* ===== segmented switch ===== */
.seg {
  display: flex;
  background: var(--bg-elev-2);
  border-radius: 8px;
  padding: 2px;
  gap: 1px;
}
.seg-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-3);
  border-radius: 6px;
  letter-spacing: .02em;
  transition: all .2s;
}
.seg-btn.is-on {
  background: var(--bg-elev-1);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* ===== sparkline chart ===== */
.chart-wrap { padding: 4px 0 0; }
.spark { width: 100%; height: 140px; display: block; }
.spark-area { fill: var(--accent); opacity: .08; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; }
.spark-dot { fill: var(--accent); }
.spark-label { font-family: 'JetBrains Mono', monospace; font-size: 9px; fill: var(--text-3); }
.chart-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: .02em;
}

/* ===== top5 list ===== */
.top5 { display: flex; flex-direction: column; gap: 1px; }
.top5 li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
  transition: background .2s;
}
.top5 li:first-child { border-top: 0; padding-top: 4px; }
.top5 .rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .02em;
}
.top5 li:nth-child(1) .rank { color: var(--accent); }
.top5 .info { min-width: 0; }
.top5 .title {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top5 .meta {
  font-size: 10.5px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
  letter-spacing: .01em;
}
.top5 .likes {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ===== funnel ===== */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row {
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-2);
}
.funnel-name { letter-spacing: .02em; }
.funnel-bar {
  height: 8px;
  background: var(--bg-elev-2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.funnel-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1.2s cubic-bezier(.16,1,.3,1);
}
.funnel-val {
  text-align: right;
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ===== advice ===== */
.advice-list { display: flex; flex-direction: column; gap: 1px; }
.advice-list li {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
  letter-spacing: -.003em;
}
.advice-list li:first-child { border-top: 0; padding-top: 4px; }
.advice-list .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
  letter-spacing: .04em;
}
.advice-list .text strong { color: var(--text); font-weight: 600; }

/* ===== footer ===== */
.foot {
  padding: 8px 24px 100px;
  text-align: center;
}
.foot-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: .04em;
}
.foot-dim { color: var(--text-3); opacity: .6; margin-top: 2px; }

/* ===== dock (bottom nav) ===== */
.dock {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10,10,10,.82);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-top: 1px solid var(--line);
  z-index: 10;
}
[data-theme="light"] .dock {
  background: rgba(255,255,255,.78);
}
.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 6px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .02em;
  border-radius: 10px;
  transition: color .25s, background .2s, transform .15s;
}
.dock-item.is-on {
  color: var(--accent);
}
.dock-item:active { transform: scale(.92); }

/* ===== enter animations ===== */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rise { animation: riseIn .6s cubic-bezier(.16,1,.3,1) both; }
.rise-d1 { animation-delay: .05s; }
.rise-d2 { animation-delay: .10s; }
.rise-d3 { animation-delay: .15s; }
.rise-d4 { animation-delay: .20s; }
.rise-d5 { animation-delay: .25s; }

@media (prefers-reduced-motion: reduce) {
  .rise, .rise-d1, .rise-d2, .rise-d3, .rise-d4, .rise-d5 { animation: none; }
  .funnel-fill { transition: none; }
  body { transition: none; }
}
