/* ========================================
   恒市值法智能理财助手 — 专业金融风
   蓝+金+白，传统金融的信任感与稳重
   ======================================== */

/* --- CSS Variables --- */
:root {
  /* Primary — 藏蓝系 */
  --color-primary: #1e3a5f;
  --color-primary-light: #2c5f8a;
  --color-primary-dark: #0f1f33;

  /* Accent — 暖金 */
  --color-accent: #b8860b;
  --color-accent-light: #d4a017;
  --color-accent-dark: #8b6508;

  /* Functional — 中国习惯：红涨绿跌 */
  --color-rise: #c53030;
  --color-fall: #1a7d3a;
  --color-success: #c53030;
  --color-danger: #1a7d3a;
  --color-warning: #c05600;
  --color-info: #2563eb;

  /* Neutral — 暖灰白底 */
  --color-bg: #f8f7f4;
  --color-surface: #ffffff;
  --color-border: #e2dfd8;
  --color-border-light: #f0ede8;
  --color-text: #1a1a2e;
  --color-text-secondary: #5f6368;
  --color-text-muted: #94989e;

  /* Shadows — 更精致的投影 */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 5rem;

  /* Layout */
  --container-max: 1200px;
  --nav-height: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transition */
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input { font-family: inherit; }

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-light);
  z-index: 1000;
  transition: box-shadow var(--transition-normal);
}

.nav.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-primary);
}

.nav-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-links a:hover {
  color: var(--color-primary);
  background: rgba(26,58,92,0.06);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: var(--space-sm);
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: var(--transition-fast);
}

/* --- Section --- */
.section {
  padding: var(--space-3xl) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-dark);
  background: rgba(184,134,11,0.08);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-md);
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.section-subtitle {
  font-size: 1.0625rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* --- Hero --- */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
  background: linear-gradient(160deg, #e8edf5 0%, #f5f3ee 50%, #f8f7f4 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
}

/* 左侧内容区加淡色卡片底 */
.hero-content {
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-primary);
  background: rgba(30,58,95,0.06);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-lg);
}

.hero-badge-dot {
  width: 8px;
  height: 8px;
  background: var(--color-success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-primary-dark);
  margin-bottom: var(--space-sm);
}

.hero-title span {
  background: linear-gradient(135deg, var(--color-accent-dark), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-slogan {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  letter-spacing: 0.04em;
  padding-left: var(--space-md);
  border-left: 3px solid var(--color-accent);
}

.hero-desc {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-xl);
  max-width: 480px;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  background: rgba(26,58,92,0.04);
}

.btn-accent {
  background: var(--color-accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--color-accent-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Hero Stats */
.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

/* 第1/3/5张卡片微暖底色，形成交错节奏 */
.hero-stats .stat-card:nth-child(odd) {
  background: linear-gradient(135deg, #fdfaf3 0%, #fff 100%);
}

.hero-stats .stat-card:nth-child(even) {
  background: linear-gradient(135deg, #f7f9fc 0%, #fff 100%);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card.primary {
  border-color: rgba(184,134,11,0.25);
  background: linear-gradient(135deg, #fef9ed 0%, #fff 100%);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.stat-value.green { color: var(--color-success); }
.stat-value.red { color: var(--color-danger); }
.stat-value.gold { color: var(--color-accent-dark); }
.stat-value.blue { color: var(--color-primary); }
.stat-value.accent { color: var(--color-accent-dark); }

/* 紧凑型数值，用于较长的文字 */
.stat-compact {
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.stat-sep {
  font-weight: 300;
  color: var(--color-text-muted);
  margin: 0 6px;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* --- Methodology --- */
#methodology {
  background: var(--color-surface);
}

.method-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}

.method-card {
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.method-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.method-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.method-icon.blue {
  background: rgba(30,58,95,0.08);
  color: var(--color-primary);
}

.method-icon.gold {
  background: rgba(184,134,11,0.1);
  color: var(--color-accent-dark);
}

.method-icon.green {
  background: rgba(26,125,58,0.08);
  color: var(--color-success);
}

.method-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.method-card p {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

/* --- Data Selection --- */
#data-selection {
  background: var(--color-bg);
}

.fund-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.fund-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.fund-table th {
  background: #f8f9fb;
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.fund-table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text);
}

.fund-table tbody tr:hover {
  background: #f8f9fb;
}

.fund-table tbody tr:last-child td {
  border-bottom: none;
}

.asset-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.asset-tag.a-stock { background: rgba(59,130,246,0.1); color: #2563eb; }
.asset-tag.us-stock { background: rgba(6,182,212,0.1); color: #0891b2; }
.asset-tag.gold { background: rgba(201,168,76,0.15); color: #a88a2e; }
.asset-tag.cash { background: rgba(148,163,184,0.12); color: #64748b; }
.asset-tag.bond { background: rgba(46,125,50,0.08); color: #2e7d32; }

.data-source-card {
  margin-top: var(--space-xl);
  padding: var(--space-lg) var(--space-xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
}

.data-source-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.data-source-card p {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

/* --- Interactive Backtest --- */
#backtest {
  background: var(--color-surface);
}

.backtest-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: var(--space-xl);
}

/* Slider Panel */
.slider-panel {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.slider-panel-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-panel-title .sum-indicator {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 2px 12px;
  border-radius: var(--radius-full);
}

.slider-panel-title .sum-indicator.ok {
  background: rgba(46,125,50,0.1);
  color: var(--color-success);
}

.slider-panel-title .sum-indicator.warn {
  background: rgba(245,124,0,0.1);
  color: var(--color-warning);
}

.slider-group {
  margin-bottom: var(--space-lg);
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-xs);
}

.slider-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.slider-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-primary);
  font-family: var(--font-mono);
}

.slider-value input {
  width: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-primary);
  font-family: var(--font-mono);
  background: var(--color-surface);
}

.slider-value input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,58,92,0.1);
}

/* Custom range input */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--color-primary-light) 0%, var(--color-border) 100%);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
}

.slider-group.hs300 input[type="range"] { background: linear-gradient(to right, #3b82f6, #93c5fd); }
.slider-group.zz500 input[type="range"] { background: linear-gradient(to right, #60a5fa, #bfdbfe); }
.slider-group.sp500 input[type="range"] { background: linear-gradient(to right, #06b6d4, #67e8f9); }
.slider-group.nasdaq input[type="range"] { background: linear-gradient(to right, #22d3ee, #a5f3fc); }
.slider-group.gold input[type="range"] { background: linear-gradient(to right, #c9a84c, #e0c87a); }
.slider-group.cash input[type="range"] { background: linear-gradient(to right, #94a3b8, #cbd5e1); }

.slider-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.btn-sm:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-sm.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.match-indicator {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  display: inline-block;
}

.match-indicator.exact { background: rgba(26,125,58,0.08); color: var(--color-success); }
.match-indicator.approx { background: rgba(192,86,0,0.08); color: var(--color-warning); }
.match-indicator.coarse { background: rgba(197,48,48,0.06); color: var(--color-danger); }

/* Results Panel */
.results-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.metric-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  transition: all var(--transition-fast);
}

.metric-card.highlight {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, #fff 0%, rgba(184,134,11,0.03) 100%);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.metric-value.positive { color: var(--color-success); }
.metric-value.negative { color: var(--color-danger); }
.metric-value.neutral { color: var(--color-primary); }

.metric-diff {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: var(--space-xs);
}

.metric-diff.better { color: var(--color-success); }
.metric-diff.worse { color: var(--color-danger); }

/* Charts area */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

/* 上下堆叠布局：宽扁图表 */
.charts-stacked {
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

.chart-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

.chart-container {
  width: 100%;
  height: 300px;
}

.chart-wide {
  height: 200px;
}

/* Comparison mode */
.comparison-bar {
  display: none;
  background: rgba(184,134,11,0.06);
  border: 1px solid rgba(184,134,11,0.15);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
  font-size: 0.875rem;
  color: var(--color-accent-dark);
}

.comparison-bar.active {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- Comparison Section --- */
#comparison {
  background: var(--color-bg);
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.compare-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  transition: transform var(--transition-fast);
}

.compare-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.compare-card.featured {
  border: 2px solid var(--color-accent);
  box-shadow: 0 0 0 4px rgba(184,134,11,0.08);
}

.compare-card-header {
  margin-bottom: var(--space-lg);
}

.compare-card-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 12px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-sm);
}

.compare-card-badge.balanced { background: rgba(26,58,92,0.1); color: var(--color-primary); }
.compare-card-badge.aggressive { background: rgba(2,119,189,0.1); color: var(--color-info); }
.compare-card-badge.final { background: rgba(184,134,11,0.12); color: var(--color-accent-dark); }

.compare-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.compare-card .compare-annual {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  margin: var(--space-md) 0;
  padding: var(--space-sm) 0;
  background: rgba(26,58,92,0.03);
  border-radius: var(--radius-sm);
}

.compare-card .compare-metrics {
  display: grid;
  gap: var(--space-sm);
}

.compare-metric-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--color-border-light);
  gap: var(--space-sm);
}

.compare-metric-row:last-child { border-bottom: none; }

.compare-metric-row .label { color: var(--color-text-muted); flex-shrink: 0; }
.compare-metric-row .value { font-weight: 600; font-family: var(--font-mono); flex-shrink: 0; }

/* Allocation bars */
.alloc-bars {
  margin-top: var(--space-md);
}

.alloc-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.alloc-bar-label {
  width: 74px;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.alloc-bar-pct {
  font-size: 0.6875rem;
  width: 34px;
  text-align: right;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.alloc-bar-track {
  flex: 1;
  height: 8px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
}

.alloc-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.alloc-bar-fill.hs300 { background: #3b82f6; }
.alloc-bar-fill.zz500 { background: #60a5fa; }
.alloc-bar-fill.sp500 { background: #06b6d4; }
.alloc-bar-fill.nasdaq { background: #22d3ee; }
.alloc-bar-fill.gold { background: #b8860b; }
.alloc-bar-fill.cash { background: #94a3b8; }

/* Comparison sub-sections */
.compare-sub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.compare-sub-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.compare-sub-card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

.compare-sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.compare-mini {
  text-align: center;
  padding: var(--space-md);
  background: var(--color-bg);
  border-radius: var(--radius-md);
}

.compare-mini .val {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.compare-mini .lbl {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.insight-box {
  background: rgba(184,134,11,0.04);
  border-left: 3px solid var(--color-accent);
  padding: var(--space-md) var(--space-lg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.insight-box strong {
  color: var(--color-text);
}

/* Radar chart container */
.radar-chart-container {
  width: 100%;
  height: 350px;
}

/* 雷达+四柱状图并排布局 */
.compare-charts-row {
  display: flex;
  gap: var(--space-lg);
  align-items: stretch;
}

.mini-bars-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--space-sm);
}

.mini-bar-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: 6px 8px 2px 8px;
  display: flex;
  flex-direction: column;
}

.mini-bar-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.mini-legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.mini-bar-chart {
  flex: 1;
  min-height: 100px;
}

/* --- Final Solution --- */
#final-solution {
  background: var(--color-surface);
}

.final-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: stretch;
}

.pie-chart-container {
  width: 100%;
  height: 340px;
}

/* 饼图下方配置明细表 */
.alloc-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border-light);
}

.alloc-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  padding: 2px 0;
}

.alloc-summary-item .alloc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 6px;
}

.alloc-summary-item .alloc-name {
  color: var(--color-text-secondary);
  flex: 1;
}

.alloc-summary-item .alloc-pct {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-text);
}

.final-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

/* 让 final-grid 子元素等高 */
.final-grid > .chart-card,
.final-grid > .final-info {
  height: 100%;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.guide-step {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
}

.guide-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.guide-step-content h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.guide-step-content p {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.premium-note {
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  background: rgba(245,124,0,0.06);
  border: 1px solid rgba(245,124,0,0.15);
  border-radius: var(--radius-md);
}

.premium-note h4 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-warning);
  margin-bottom: var(--space-sm);
}

.premium-note p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.download-area {
  margin-top: var(--space-2xl);
  text-align: center;
  padding: var(--space-2xl);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  border-radius: var(--radius-lg);
  color: #fff;
}

.download-area h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.download-area p {
  font-size: 1rem;
  opacity: 0.85;
  margin-bottom: var(--space-lg);
}

/* --- Footer --- */
.footer {
  background: var(--color-primary-dark);
  color: rgba(255,255,255,0.7);
  padding: var(--space-2xl) 0;
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.8;
}

.footer strong {
  color: #fff;
}

.footer .disclaimer {
  max-width: 700px;
  margin: var(--space-md) auto 0;
  font-size: 0.75rem;
  opacity: 0.5;
}

/* --- Theme Switcher (floating) --- */
.theme-switcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.theme-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}
.theme-toggle-btn:hover { transform: scale(1.1); box-shadow: var(--shadow-md); }
.theme-options {
  display: none;
  flex-direction: column;
  gap: 6px;
  animation: themeSlideIn 0.2s ease-out;
}
.theme-options.open { display: flex; }
@keyframes themeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.theme-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.theme-btn.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(30,58,95,0.1);
}

@media (max-width: 640px) {
  .theme-switcher {
    bottom: 12px;
    right: 12px;
    gap: 6px;
  }
  .theme-toggle-btn {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }
  .theme-btn {
    width: 34px;
    height: 34px;
    font-size: 0.8rem;
  }
}

/* --- Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .hero-title {
    font-size: 1.875rem;
  }

  .backtest-layout {
    grid-template-columns: 1fr;
  }

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .final-grid {
    grid-template-columns: 1fr;
  }

  .compare-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .compare-sub {
    grid-template-columns: 1fr;
  }

  .method-cards {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

/* ===== 移动端 (< 640px) 大幅优化 ===== */
@media (max-width: 640px) {
  :root {
    --space-3xl: 2.5rem;
    --space-2xl: 1.8rem;
    --space-xl: 1.2rem;
    --space-lg: 1rem;
    --nav-height: 56px;
  }

  .container {
    padding: 0 var(--space-md);
  }

  /* --- 导航 --- */
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--color-surface);
    flex-direction: column;
    padding: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }
  .nav-logo { font-size: 0.95rem; }
  .nav-logo-icon { width: 28px; height: 28px; font-size: 0.85rem; }

  /* --- Hero 紧凑化 --- */
  #hero {
    min-height: auto;
    padding: calc(var(--nav-height) + var(--space-xl)) 0 var(--space-2xl);
  }
  .hero-content {
    padding: var(--space-lg);
    background: rgba(255,255,255,0.4);
  }
  .hero-title {
    font-size: 1.5rem;
    line-height: 1.3;
  }
  .hero-slogan {
    font-size: 0.85rem;
    margin-bottom: var(--space-sm);
  }
  .hero-desc {
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: var(--space-lg);
  }
  .hero-badge {
    font-size: 0.72rem;
    padding: 4px 12px;
    margin-bottom: var(--space-md);
  }
  .hero-actions {
    flex-direction: column;
    gap: var(--space-sm);
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
  }
  .hero-stats {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }
  .stat-card {
    padding: var(--space-md);
  }
  .stat-label { font-size: 0.7rem; }
  .stat-value { font-size: 1.2rem; }
  .stat-sub { font-size: 0.68rem; }

  /* --- 方法论紧凑化 --- */
  .method-card {
    padding: var(--space-lg);
  }
  .method-icon {
    width: 48px; height: 48px;
    font-size: 1.3rem;
    margin-bottom: var(--space-md);
  }
  .method-card h3 { font-size: 1rem; }
  .method-card p { font-size: 0.85rem; }

  /* --- 回测区：折叠滑块面板 --- */
  .backtest-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
  }
  .slider-panel {
    position: relative;
    padding: var(--space-md);
    border-radius: var(--radius-md);
  }
  .slider-panel-title {
    font-size: 0.9rem;
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
  }
  .slider-panel-title::after {
    content: ' ▼';
    font-size: 0.7rem;
    transition: transform 0.2s;
    display: inline-block;
  }
  .slider-panel.expanded .slider-panel-title::after {
    transform: rotate(180deg);
  }
  .slider-body {
    display: none;
    padding-top: var(--space-md);
  }
  .slider-panel.expanded .slider-body {
    display: block;
  }
  .slider-group {
    margin-bottom: var(--space-sm);
  }
  .slider-name { font-size: 0.8rem; }
  .slider-value input {
    width: 40px;
    font-size: 0.8rem;
    padding: 1px 4px;
  }
  input[type="range"] { height: 5px; }
  input[type="range"]::-webkit-slider-thumb {
    width: 18px; height: 18px;
  }
  .slider-actions {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }
  .btn-sm {
    font-size: 0.72rem;
    padding: 0.4rem 0.7rem;
  }
  .match-indicator {
    font-size: 0.68rem;
  }

  /* 指标卡片：2列 + 紧凑 */
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
  .metric-card {
    padding: var(--space-sm) var(--space-md);
  }
  .metric-label { font-size: 0.65rem; }
  .metric-value { font-size: 1.15rem; }
  .metric-diff { font-size: 0.65rem; }

  /* 图表区 */
  .charts-row {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  .chart-card {
    padding: var(--space-sm);
  }
  .chart-container {
    height: 220px;
  }
  .chart-title { font-size: 0.75rem; margin-bottom: var(--space-sm); }

  .comparison-bar {
    font-size: 0.75rem;
    padding: var(--space-sm);
  }

  /* --- 方案对比：横向滑动 --- */
  .compare-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: var(--space-md);
    padding-bottom: var(--space-sm);
    margin-left: calc(-1 * var(--space-md));
    margin-right: calc(-1 * var(--space-md));
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }
  .compare-grid::-webkit-scrollbar { display: none; }
  .compare-card {
    flex: 0 0 82vw;
    scroll-snap-align: center;
    padding: var(--space-lg);
  }
  .compare-card .compare-annual { font-size: 1.5rem; }
  .compare-card h3 { font-size: 1.1rem; }

  /* 黄金/纳指对比 */
  .compare-sub {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  .compare-sub-card {
    padding: var(--space-md);
  }
  .compare-sub-card h3 { font-size: 0.95rem; }
  .compare-mini .val { font-size: 1.1rem; }
  .insight-box {
    font-size: 0.82rem;
    padding: var(--space-sm);
  }

  /* 雷达图和柱状图容器缩小 */
  .radar-chart-container {
    height: 260px;
  }

  /* 雷达+柱状图并排 → 上下堆叠 */
  .compare-charts-row {
    flex-direction: column;
  }
  .mini-bars-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* --- 最终方案 --- */
  .pie-chart-container {
    height: 280px;
  }
  .guide-step {
    padding: var(--space-sm);
    gap: var(--space-sm);
  }
  .guide-step-num {
    width: 28px; height: 28px;
    font-size: 0.8rem;
  }
  .guide-step-content h4 { font-size: 0.85rem; }
  .guide-step-content p { font-size: 0.75rem; }
  .premium-note {
    padding: var(--space-sm);
  }
  .premium-note h4 { font-size: 0.85rem; }
  .premium-note p { font-size: 0.78rem; }
  .download-area {
    padding: var(--space-xl);
  }
  .download-area h3 { font-size: 1.2rem; }
  .download-area p { font-size: 0.85rem; }

  /* 全局 */
  .section-title { font-size: 1.3rem; }
  .section-subtitle { font-size: 0.9rem; }
  .section-tag { font-size: 0.7rem; padding: 3px 12px; }
  .section-header { margin-bottom: var(--space-xl); }

  /* 表格横滑 */
  .fund-table-wrap {
    margin-left: calc(-1 * var(--space-md));
    margin-right: calc(-1 * var(--space-md));
    border-radius: 0;
    border-left: none;
    border-right: none;
    overflow-x: auto;
  }
  .fund-table { min-width: 600px; }
  .fund-table thead { position: sticky; top: 0; z-index: 1; }
  .fund-table th {
    padding: var(--space-sm);
    font-size: 0.72rem;
    background: var(--color-bg);
  }
  .fund-table td {
    padding: var(--space-sm);
    font-size: 0.72rem;
  }

  /* 数据源卡片 */
  .data-source-card {
    padding: var(--space-sm);
    gap: var(--space-sm);
  }
  .data-source-card p { font-size: 0.8rem; }

  /* Footer */
  .footer {
    padding: var(--space-xl) 0;
    font-size: 0.72rem;
  }
  .footer .disclaimer { font-size: 0.68rem; }

  /* 主题切换器 */
  .theme-switcher {
    bottom: 10px; right: 10px;
    flex-direction: row;
    gap: 6px;
  }
  .theme-btn {
    width: 36px; height: 36px;
    font-size: 0.85rem;
  }
}

/* ========================================
   滚动回测样式
   ======================================== */

/* 汇总表 */
.rolling-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.6;
}

.rolling-summary-table thead th {
  background: var(--color-primary);
  color: #fff;
  padding: 0.75rem 0.625rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.rolling-summary-table tbody td {
  padding: 0.625rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border-light);
  white-space: nowrap;
}

.rolling-summary-table tbody tr {
  transition: background 0.2s;
}

.rolling-summary-table tbody tr:hover {
  background: rgba(184, 134, 11, 0.06);
}

.rolling-summary-table .cell-start {
  font-weight: 600;
  color: var(--color-primary);
  text-align: left;
}

.rolling-summary-table .cell-positive {
  color: var(--color-success);
  font-weight: 600;
}

.rolling-summary-table .cell-negative {
  color: var(--color-danger);
  font-weight: 600;
}

.rolling-summary-table .cell-estimated {
  color: var(--color-warning);
  font-size: 0.75rem;
}

.rolling-summary-table .cell-all-real {
  color: var(--color-success);
  font-size: 0.75rem;
}

.rolling-summary-table .btn-detail {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.rolling-summary-table .btn-detail:hover {
  background: var(--color-accent);
}

/* 排名高亮 */
.rolling-summary-table .rank-1 { background: rgba(184, 134, 11, 0.12); }
.rolling-summary-table .rank-2 { background: rgba(184, 134, 11, 0.06); }
.rolling-summary-table .rank-3 { background: rgba(184, 134, 11, 0.03); }

/* 弹窗 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--color-surface);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.log-modal-content {
  width: 1100px;
  max-width: 95vw;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--color-primary);
}

.modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  justify-content: flex-end;
}

/* 日志汇总信息 */
.log-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--color-bg);
  border-radius: 8px;
}

.log-summary-item {
  text-align: center;
}

.log-summary-item .label {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
}

.log-summary-item .value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
}

.log-summary-item .value.accent {
  color: var(--color-accent);
}

.log-summary-item .value.green {
  color: var(--color-success);
}

.log-summary-item .value.red {
  color: var(--color-danger);
}

/* 操作日志表格 */
.log-table-wrap {
  overflow-x: auto;
  max-height: 50vh;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  line-height: 1.5;
}

.log-table thead th {
  background: var(--color-primary);
  color: #fff;
  padding: 0.5rem 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}

.log-table tbody td {
  padding: 0.4rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border-light);
  white-space: nowrap;
}

.log-table tbody tr:hover {
  background: rgba(184, 134, 11, 0.05);
}

.log-table .phase-build {
  background: rgba(37, 99, 235, 0.06);
}

.log-table .phase-rebalance {
  background: transparent;
}

.log-table .action-buy {
  color: var(--color-success);
  font-weight: 600;
}

.log-table .action-sell {
  color: var(--color-danger);
  font-weight: 600;
}

.log-table .estimated-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
}

/* 有操作的行高亮 */
.log-table .has-action {
  background: rgba(184, 134, 11, 0.04);
}

/* 月分隔线 */
.log-table .month-separator td {
  pointer-events: none;
}

/* 响应式 */
@media (max-width: 768px) {
  .rolling-summary-table {
    font-size: 0.72rem;
  }
  .rolling-summary-table thead th,
  .rolling-summary-table tbody td {
    padding: 0.4rem 0.3rem;
  }
  .log-modal-content {
    width: 100vw;
    max-width: 100vw;
  }
  .log-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== 抖音授权弹窗 ===== */
.auth-modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: authFadeIn 0.25s ease-out;
}
@keyframes authFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.auth-shake {
  animation: authShake 0.4s ease-in-out;
}

.auth-modal {
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #fff8f9 100%);
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(254, 44, 85, 0.25), 0 5px 20px rgba(0, 0, 0, 0.15);
  width: 420px;
  max-width: 100%;
  padding: 2rem 1.75rem 1.5rem;
  animation: authSlideUp 0.3s ease-out;
}
@keyframes authSlideUp {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.auth-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  font-size: 1.1rem;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.auth-close:hover {
  background: rgba(254, 44, 85, 0.1);
  color: #FE2C55;
}

/* 抖音名片卡片（图片） */
.auth-douyin-card {
  margin: 0 auto 1rem;
  width: 260px;
  max-width: 90%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.auth-card-img {
  display: block;
  width: 100%;
  height: auto;
}

/* 引导文案 */
.auth-prompt {
  text-align: center;
  margin-bottom: 1rem;
}
.auth-prompt-icon {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}
.auth-prompt h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #1a1a2e;
  font-weight: 700;
}
.auth-prompt p {
  margin: 0;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.5;
}
.auth-prompt strong {
  color: #FE2C55;
  font-weight: 700;
}

/* 表单 */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.auth-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e8e8ed;
  border-radius: 10px;
  font-size: 0.95rem;
  transition: all 0.2s;
  box-sizing: border-box;
  background: #fafafa;
}
.auth-input:focus {
  outline: none;
  border-color: #FE2C55;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.1);
}
.auth-input::placeholder {
  color: #999;
}
.auth-error {
  background: #fff0f3;
  color: #c53030;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  border-left: 3px solid #FE2C55;
  text-align: left;
}
.auth-submit {
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #25F4EE 0%, #FE2C55 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(254, 44, 85, 0.3);
  margin-top: 0.25rem;
}
.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(254, 44, 85, 0.4);
}
.auth-submit:active {
  transform: translateY(0);
}
.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* 已解锁状态 */
.auth-unlocked-badge {
  text-align: center;
  font-size: 0.85rem;
  color: #2d8a6e;
  font-weight: 600;
  padding: 0.4rem 0;
}
.auth-download {
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #FE2C55 0%, #c53030 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(254, 44, 85, 0.3);
}
.auth-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(254, 44, 85, 0.45);
}
.auth-download:active {
  transform: translateY(0);
}

/* 重置按钮 */
.auth-reset {
  padding: 0.4rem 0.5rem;
  background: none;
  color: #999;
  border: none;
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.2s;
  margin-top: 0.3rem;
}
.auth-reset:hover {
  color: #c53030;
}

.auth-hint {
  text-align: center;
  font-size: 0.75rem;
  color: #999;
  padding-top: 0.75rem;
  border-top: 1px dashed #e8e8ed;
}

@media (max-width: 480px) {
  .auth-modal {
    padding: 1.5rem 1.25rem 1.25rem;
  }
  .auth-douyin-card {
    width: 220px;
  }
  .auth-prompt h3 {
    font-size: 1rem;
  }
  .auth-prompt p {
    font-size: 0.8rem;
  }
}
