/* ==================== CSS Variables ==================== */
:root {
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-soft: rgba(14, 165, 233, 0.12);
  --primary-1: #0ea5e9;
  --primary-2: #0ea5e9;
  --primary-gradient: #0ea5e9;
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f3f5;
  --bg-input: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --text: #1a1a1a;
  --text-dim: #6b7280;
  --text-muted: #9ca3af;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #38bdf8;
  --sidebar-width: 240px;
  --player-height: 80px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 4px 16px rgba(14, 165, 233, 0.25);
}

/* Light Mode - 使用body类选择器，更可靠 */
.light-mode {
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f3f5;
  --bg-input: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --text: #1a1a1a;
  --text-dim: #6b7280;
  --text-muted: #9ca3af;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  background: #f8f9fa !important;
  color: #1a1a1a !important;
}

.light-mode .sidebar {
  background: rgba(255, 255, 255, 0.95) !important;
  border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.light-mode .player-bar {
  background: rgba(255, 255, 255, 0.98) !important;
  border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.light-mode .card {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.light-mode input,
.light-mode textarea,
.light-mode select {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  color: #1a1a1a !important;
}

.light-mode input::placeholder,
.light-mode textarea::placeholder {
  color: #9ca3af !important;
}

/* 同时保留属性选择器作为备份 */
[data-mode="light"] {
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f3f5;
  --bg-input: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --text: #1a1a1a;
  --text-dim: #6b7280;
  --text-muted: #9ca3af;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

[data-mode="light"] body {
  background: #f8f9fa !important;
  color: #1a1a1a !important;
}

[data-mode="light"] .sidebar {
  background: rgba(255, 255, 255, 0.95) !important;
  border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-mode="light"] .player-bar {
  background: rgba(255, 255, 255, 0.98) !important;
  border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-mode="light"] .card {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-mode="light"] input,
[data-mode="light"] textarea,
[data-mode="light"] select {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  color: #1a1a1a !important;
}

[data-mode="light"] input::placeholder,
[data-mode="light"] textarea::placeholder {
  color: #9ca3af !important;
}

[data-theme="orange"]  { --primary:#f97316; --primary-hover:#ea580c; --primary-soft:rgba(249,115,22,0.12); --primary-1:#f97316; --primary-2:#f97316; --primary-gradient:#f97316; --shadow-glow:0 4px 16px rgba(249,115,22,0.25); }
[data-theme="rose"]    { --primary:#f43f5e; --primary-hover:#e11d48; --primary-soft:rgba(244,63,94,0.12); --primary-1:#f43f5e; --primary-2:#f43f5e; --primary-gradient:#f43f5e; --shadow-glow:0 4px 16px rgba(244,63,94,0.25); }
[data-theme="sky"]     { --primary:#0ea5e9; --primary-hover:#0284c7; --primary-soft:rgba(14,165,233,0.12); --primary-1:#0ea5e9; --primary-2:#0ea5e9; --primary-gradient:#0ea5e9; --shadow-glow:0 4px 16px rgba(14,165,233,0.25); }
[data-theme="emerald"] { --primary:#10b981; --primary-hover:#059669; --primary-soft:rgba(16,185,129,0.12); --primary-1:#10b981; --primary-2:#10b981; --primary-gradient:#10b981; --shadow-glow:0 4px 16px rgba(16,185,129,0.25); }
[data-theme="violet"]  { --primary:#8b5cf6; --primary-hover:#7c3aed; --primary-soft:rgba(139,92,246,0.12); --primary-1:#8b5cf6; --primary-2:#8b5cf6; --primary-gradient:#8b5cf6; --shadow-glow:0 4px 16px rgba(139,92,246,0.25); }

/* ==================== Reset & Base ==================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
  z-index: 0;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); }

/* ==================== Layout ==================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr auto;
  height: 100vh;
  position: relative;
  z-index: 1;
}
.sidebar {
  grid-row: 1 / 3;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.main-content {
  overflow-y: auto;
  padding: 32px 40px 100px;
}

/* ==================== Sidebar ==================== */
.sidebar-header { padding: 0 20px 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 44px; height: 44px;
  background: var(--primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: white;
}
.logo-text h1 { font-size: 16px; font-weight: 700; line-height: 1.2; }
.logo-text span { font-size: 11px; color: var(--text-dim); letter-spacing: 2px; }
.nav-menu { list-style: none; flex: 1; padding: 0 12px; }
.nav-item a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
  margin-bottom: 2px;
}
.nav-item a:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active a { background: var(--primary); color: white; }
.nav-item i { width: 18px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.sidebar-credits {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(14,165,233,0.12), rgba(139,92,246,0.08));
  border: 1px solid rgba(14,165,233,0.15);
}
.sidebar-credits > i { font-size: 20px; color: #f59e0b; }
.credits-info { display: flex; flex-direction: column; }
.credits-label { font-size: 11px; color: var(--text-muted); }
.credits-value { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.2; }
.sidebar-user-row { display: flex; align-items: center; gap: 8px; }
.sidebar-user-row .user-info { flex: 1; min-width: 0; }
.logout-btn {
  width: 36px; height: 36px; flex-shrink: 0;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.15);
  border-radius: 10px; color: #ef4444; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all 0.2s; font-family: inherit;
}
.logout-btn:hover { background: rgba(239,68,68,0.2); transform: translateX(2px); }

/* ==================== Page ==================== */
.page { animation: fadeIn 0.3s ease; }
.page.hidden { display: none; }
@keyframes fadeIn { from{opacity:0; transform:translateY(8px)} to{opacity:1; transform:translateY(0)} }
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 28px;
}
.page-header h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.page-subtitle { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.header-actions { display: flex; gap: 8px; }

/* ==================== Card ==================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-strong); }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.card-header h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header h3 i { color: var(--primary); }
.link { color: var(--primary); text-decoration: none; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* ==================== Stats Grid ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: transform 0.2s, border-color 0.2s;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: white;
}
.stat-info { display: flex; flex-direction: column; }
.stat-number { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-dim); }

/* ==================== Dashboard Grid ==================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}
.quick-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-chip {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.preset-chip:hover { background: var(--primary); border-color: transparent; color: white; transform: translateY(-1px); }
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.recent-item:hover { background: rgba(255,255,255,0.05); }
.recent-cover {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.recent-meta { flex: 1; }
.recent-title { font-weight: 500; font-size: 13px; }
.recent-info { font-size: 11px; color: var(--text-dim); }
.model-list { display: flex; flex-direction: column; gap: 8px; }
.model-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  font-size: 13px;
}
.model-row .badge {
  font-size: 10px; padding: 2px 8px; border-radius: 8px;
  background: rgba(34, 197, 94, 0.15); color: var(--success);
}
.model-row .badge.off { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* ==================== Forms ==================== */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; flex: 1; }
.form-group.compact label { display: flex; justify-content: space-between; }
.form-group label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.form-row { display: flex; gap: 16px; }
input[type="text"], input[type="number"], textarea, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--primary-soft);
}
textarea { resize: vertical; min-height: 60px; line-height: 1.6; }
select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L2 4h8z' fill='%239ca3af'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.range-group { display: flex; align-items: center; gap: 12px; }
.range-group input[type="range"] { flex: 1; }
.range-group span { min-width: 40px; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
input[type="range"] {
  appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px; height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-outline:hover { background: rgba(255,255,255,0.04); }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-icon {
  width: 36px; height: 36px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.btn-icon.active { background: var(--primary); color: white; }
.btn-play {
  background: var(--primary); color: white; width: 44px; height: 44px;
}
.btn-play:hover { background: var(--primary-hover); }
.btn-play-lg { width: 40px; height: 40px; background: white; color: var(--bg); }
.btn-play-lg:hover { transform: scale(1.05); background: white; color: var(--bg); }
.btn-generate {
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-generate:hover { transform: translateY(-2px); background: var(--primary-hover); }
.btn-generate:disabled { opacity: 0.6; cursor: not-allowed; }

/* ==================== Generate Page ==================== */
.generate-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}
.model-selector { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.model-card {
  background: rgba(255,255,255,0.02);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.model-card:hover { border-color: var(--border-strong); }
.model-card.active { border-color: var(--primary); background: var(--primary-soft); }
.model-card-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.model-card-desc { font-size: 11px; color: var(--text-dim); }
.model-card.disabled { opacity: 0.5; cursor: not-allowed; }

.tab-bar { display: flex; gap: 4px; padding: 4px; background: var(--bg-input); border-radius: 10px; margin-bottom: 16px; }
.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.2s;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--primary); color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.tag-select { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.tag:hover { background: rgba(255,255,255,0.08); }
.tag.active { background: var(--primary); border-color: transparent; color: white; }

.generate-action { margin-top: 16px; }

.style-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.style-preset-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-size: 11px;
}
.style-preset-item:hover { background: var(--primary); border-color: transparent; color: white; transform: translateY(-1px); }
.style-preset-icon { font-size: 24px; margin-bottom: 4px; display: block; }

.gen-history { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.gen-history-item {
  padding: 8px 10px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.gen-history-item:hover { background: rgba(255,255,255,0.05); }

/* ==================== Progress ==================== */
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.progress-title { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar { height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.3s;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.progress-hint { font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.progress-time { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ==================== Result Player ==================== */
.result-player { display: flex; flex-direction: column; gap: 16px; }
.result-info h4 { font-size: 16px; margin-bottom: 4px; }
.result-info p { color: var(--text-dim); font-size: 12px; }
.waveform-container {
  height: 80px;
  background: var(--bg-input);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
.waveform-bars {
  display: flex; align-items: center; height: 100%;
  gap: 2px; padding: 0 8px;
}
.waveform-bar {
  flex: 1;
  background: var(--primary);
  border-radius: 2px;
  min-height: 4px;
  opacity: 0.4;
  transition: opacity 0.2s;
}
.waveform-bar.played { opacity: 1; }

.player-controls {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.player-controls.small .btn-icon { width: 32px; height: 32px; }
.time-display { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.volume-control { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.volume-control input[type="range"] {
  width: 96px;
  min-width: 96px;
  cursor: pointer;
  touch-action: manipulation;
}
.result-player .volume-control {
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.08);
}
.result-player .volume-control i {
  color: #1f2937;
  font-size: 15px;
}
.result-player .volume-control input[type="range"] {
  background: transparent !important;
  border: 0 !important;
}
.result-player .volume-control input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: #d7e3ee;
}
.result-player .volume-control input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}
.result-player .volume-control input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #d7e3ee;
}
.result-player .volume-control input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--primary);
}
.result-player .volume-control input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid #ffffff;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}
.result-actions { display: flex; gap: 4px; margin-left: auto; }

/* ==================== Library ==================== */
.library-toolbar {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-box { position: relative; flex: 1; min-width: 240px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.search-box input { padding-left: 36px; }
.filter-group { display: flex; gap: 8px; align-items: center; }
.filter-group select { min-width: 130px; }
.view-toggle.active { background: var(--primary); color: white; }

.library-content.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.library-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.library-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.library-card-cover {
  width: 100%; aspect-ratio: 1;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  color: white;
  margin-bottom: 10px;
  position: relative;
}
.library-card-cover .play-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.library-card:hover .play-overlay { opacity: 1; }
.library-card-title { font-weight: 500; font-size: 13px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-card-meta { font-size: 11px; color: var(--text-dim); }

.library-content.list { display: flex; flex-direction: column; gap: 4px; }
.library-row {
  display: grid;
  grid-template-columns: 40px 1fr 100px 80px 60px auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.library-row:hover { background: var(--bg-card-hover); }
.library-row-cover { width: 40px; height: 40px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; }
.library-row-title { font-weight: 500; font-size: 13px; }
.library-row-sub { font-size: 11px; color: var(--text-dim); }
.library-row-meta { font-size: 12px; color: var(--text-dim); }
.library-row-actions { display: flex; gap: 2px; }

/* ==================== Empty State ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; display: block; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 20px; }
.empty-state.small { padding: 20px; }
.empty-state.small i { font-size: 32px; margin-bottom: 10px; }

/* ==================== Lyrics ==================== */
.lyrics-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}
.toolbar { display: flex; gap: 4px; flex-wrap: wrap; }
#lyricsEditor { min-height: 400px; font-family: "JetBrains Mono", Consolas, monospace; font-size: 14px; line-height: 1.8; }
.lyrics-stats {
  display: flex; gap: 16px;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: 10px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
}
.lyrics-stats b { color: var(--text); margin-left: 4px; }
.ai-tools { display: flex; flex-direction: column; }
.ai-btn-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ai-btn-group .btn { padding: 10px; font-size: 12px; }
.templates { display: flex; flex-direction: column; gap: 8px; }
.template-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  color: var(--text);
  font-family: inherit;
}
.template-item:hover { background: rgba(255,255,255,0.05); border-color: var(--primary); }
.template-icon { font-size: 24px; }
.template-item small { color: var(--text-dim); font-size: 11px; }

/* ==================== Effects ==================== */
.effects-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}
.audio-upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.audio-upload-zone:hover { background: var(--primary-soft); border-color: var(--primary); }
.audio-upload-zone.dragover { background: var(--primary-soft); border-color: var(--primary); }
.audio-upload-zone i { font-size: 48px; color: var(--text-dim); margin-bottom: 12px; display: block; }
.audio-upload-zone p { color: var(--text-dim); margin-bottom: 12px; }
.audio-upload-zone .hint { font-size: 11px; margin-top: 12px; }

.effect-module {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.effect-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.effect-header h4 { font-size: 13px; font-weight: 600; flex: 1; display: flex; align-items: center; gap: 8px; }
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-switch .slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .slider { background: var(--primary); }
.toggle-switch input:checked + .slider::before { transform: translateX(16px); }

.eq-controls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.eq-band { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.eq-band label { font-size: 10px; color: var(--text-dim); text-align: center; }
.eq-slider {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: bt-lr;
  width: 24px; height: 100px;
}
.effect-params { display: flex; flex-direction: column; gap: 10px; }
.export-options { display: flex; gap: 8px; }
.export-options .btn { flex: 1; }
.export-options select { max-width: 140px; }

/* ==================== Settings ==================== */
.settings-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.api-status-list { display: flex; flex-direction: column; gap: 10px; }
.api-status-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
}
.api-status-item .status-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.api-status-item .status-icon.ok { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.api-status-item .status-icon.off { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.api-status-item .status-info { flex: 1; }
.api-status-item .status-name { font-weight: 500; font-size: 13px; }
.api-status-item .status-desc { font-size: 11px; color: var(--text-dim); }
.color-picker { display: flex; gap: 8px; }
.color-swatch {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.color-swatch.active { border-color: white; transform: scale(1.1); }
.mode-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--border);
}
.mode-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 500;
}
.mode-btn:hover {
  color: var(--text);
}
.mode-btn.active {
  background: var(--primary);
  color: white;
}
.data-actions { display: flex; flex-direction: column; gap: 8px; }
.about-info { font-size: 13px; color: var(--text-dim); line-height: 1.8; }
.about-info b { color: var(--text); font-size: 14px; }
.hint { font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }
code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; font-family: Consolas, monospace; font-size: 12px; }

/* ==================== Player Bar ==================== */
.player-bar {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
  height: var(--player-height);
  background: linear-gradient(180deg, rgba(32, 35, 48, 0.98), rgba(24, 27, 38, 0.98));
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.18);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
}
.player-bar.hidden { display: none; }
.player-bar-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player-bar-cover { width: 52px; height: 52px; background: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: white; box-shadow: 0 8px 18px rgba(14, 165, 233, 0.28); }
.player-bar-meta { display: flex; flex-direction: column; min-width: 0; }
.player-bar-title { font-size: 14px; font-weight: 700; color: #f8fafc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.player-bar-sub { font-size: 12px; color: #cbd5e1; margin-top: 3px; }
.player-bar-center { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.player-bar-controls { display: flex; gap: 8px; align-items: center; }
.player-bar .btn-icon {
  width: 44px;
  height: 44px;
  color: #cbd5e1;
  border-radius: 12px;
}
.player-bar .btn-icon:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}
.player-bar .btn-play-lg {
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.35);
}
.player-bar .btn-play-lg:hover {
  background: var(--primary-hover);
  color: #ffffff;
  transform: translateY(-1px) scale(1.03);
}
.player-bar-progress { display: flex; align-items: center; gap: 10px; width: 100%; font-size: 12px; color: #cbd5e1; font-variant-numeric: tabular-nums; }
.progress-track { flex: 1; height: 6px; background: rgba(148, 163, 184, 0.35); border-radius: 999px; cursor: pointer; position: relative; }
.progress-track:hover { background: rgba(148, 163, 184, 0.5); }
.progress-played { height: 100%; background: var(--primary); border-radius: 999px; width: 0%; box-shadow: 0 0 10px rgba(14, 165, 233, 0.55); }
.player-bar-right { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.player-bar .volume-control input[type="range"] {
  background: transparent !important;
  border: 0 !important;
}
.player-bar .volume-control input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
}
.player-bar .volume-control input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 3px solid #1f2937;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.55);
}
.player-bar .volume-control input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
}
.player-bar .volume-control input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--primary);
}
.player-bar .volume-control input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid #1f2937;
  background: var(--primary);
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.55);
}
.light-mode .player-bar,
[data-mode="light"] .player-bar {
  background: linear-gradient(180deg, rgba(32, 35, 48, 0.98), rgba(24, 27, 38, 0.98)) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* ==================== Queue ==================== */
.queue-panel {
  position: fixed;
  right: 20px;
  bottom: calc(var(--player-height) + 20px);
  width: 320px;
  max-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.queue-panel.hidden { display: none; }
.queue-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--border); }
.queue-list { padding: 8px; overflow-y: auto; }
.queue-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.queue-item:hover { background: rgba(255,255,255,0.04); }
.queue-item-meta { flex: 1; font-size: 12px; }

/* ==================== Toast ==================== */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10001;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  min-width: 240px;
  font-size: 13px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
.toast i { font-size: 16px; }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.info i { color: var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ==================== Misc ==================== */
.hidden { display: none !important; }

/* ==================== Responsive ==================== */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .generate-layout, .lyrics-layout, .effects-layout, .settings-layout, .podcast-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar-width: 64px; }
  .logo-text, .nav-item span, .sidebar-footer { display: none; }
  .nav-item a { justify-content: center; padding: 12px; }
  .main-content { padding: 20px; }
}

/* ==================== Podcast Page ==================== */
.podcast-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}
.podcast-text-stats {
  display: flex; gap: 16px;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: 10px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
}
.podcast-text-stats b { color: var(--text); margin-left: 4px; }
.bgm-source-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tab-pill {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.tab-pill:hover { background: rgba(255,255,255,0.08); }
.tab-pill.active { background: var(--primary); border-color: transparent; color: white; }
.tips-list { list-style: none; padding: 0; }
.tips-list li {
  padding: 8px 12px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: flex; gap: 8px;
}
.tips-list li::before { content: '✓'; color: var(--success); font-weight: bold; }

/* ==================== LLM Output ==================== */
.badge-ai {
  font-size: 10px; padding: 2px 8px; border-radius: 8px;
  background: rgba(34, 197, 94, 0.15); color: var(--success);
  margin-left: 8px;
}
.badge-ai.off { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.llm-output {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 80px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  white-space: pre-wrap;
}
.llm-output .typing { display: inline-block; width: 6px; height: 14px; background: var(--primary); animation: blink 0.8s infinite; vertical-align: middle; }
@keyframes blink { 0%,50%{opacity:1} 51%,100%{opacity:0} }

/* ==================== Visualizer Page ==================== */
.viz-controls-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.viz-mode-tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-card); border-radius: 10px; }
.viz-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.2s;
  font-family: inherit;
}
.viz-mode-btn:hover { color: var(--text); }
.viz-mode-btn.active { background: var(--primary); color: white; }
.viz-track-select { display: flex; gap: 8px; align-items: center; }
.viz-track-select select { min-width: 200px; }
.viz-stage {
  background: #050508;
  border: 1px solid var(--border);
  border-radius: 16px;
  position: relative;
  height: calc(100vh - 280px);
  min-height: 500px;
  overflow: hidden;
}
.viz-stage:fullscreen { border-radius: 0; height: 100vh; }
#vizCanvas { width: 100%; height: 100%; display: block; }
.viz-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-dim);
  pointer-events: none;
}
.viz-overlay i { font-size: 60px; opacity: 0.3; margin-bottom: 16px; }
.viz-overlay.hidden { display: none; }
.viz-info {
  position: absolute; top: 20px; left: 20px;
  color: white;
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.viz-track-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.viz-track-time { font-size: 13px; opacity: 0.8; font-variant-numeric: tabular-nums; }
.viz-bottom-controls {
  position: absolute; bottom: 20px; left: 20px; right: 20px;
  display: flex; align-items: center; gap: 14px;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(10px);
  padding: 12px 16px;
  border-radius: 12px;
}
.viz-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}
.viz-progress-played {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  width: 0%;
}
.viz-color-picker { display: flex; gap: 6px; }
.viz-color {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: transform 0.2s;
}
.viz-color:hover { transform: scale(1.1); }

/* ==================== Library Cover Display ==================== */
.library-card-cover.has-cover, .library-row-cover.has-cover, .recent-cover.has-cover,
.player-bar-cover.has-cover {
  background-size: cover;
  background-position: center;
}
.library-card-cover.has-cover i, .library-row-cover.has-cover i,
.recent-cover.has-cover i, .player-bar-cover.has-cover i { display: none; }
.cover-generate-overlay {
  position: absolute;
  top: 4px; right: 4px;
  width: 24px; height: 24px;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: white;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
.library-card:hover .cover-generate-overlay { opacity: 1; }
.cover-generate-overlay:hover { background: var(--primary); }

/* ==================== User Info & Auth ==================== */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid var(--border);
}
.user-info:hover { background: var(--bg-card-hover); }
.user-info i { font-size: 24px; color: var(--primary); }
.user-info span { font-size: 13px; color: var(--text-dim); }
.user-info.logged-in { border-color: var(--primary); }
.user-info.logged-in span { color: var(--text); font-weight: 500; }

/* ==================== Modal ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s;
}
.modal {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-input);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--danger); color: white; }

/* ==================== Confirm Modal ==================== */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; animation: fadeIn 0.15s;
}
.confirm-box {
  background: var(--bg-card); border-radius: 20px;
  padding: 32px 28px 24px; width: 100%; max-width: 360px;
  text-align: center; box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.confirm-icon {
  width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--primary);
  background: var(--primary-soft);
}
.confirm-icon.danger { color: var(--danger); background: rgba(239,68,68,0.1); }
.confirm-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.confirm-message { font-size: 14px; color: var(--text-dim); line-height: 1.6; margin-bottom: 24px; white-space: pre-line; }
.confirm-actions { display: flex; gap: 12px; }
.confirm-btn {
  flex: 1; padding: 12px 20px; border-radius: 12px;
  border: none; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.confirm-cancel { background: var(--bg-input); color: var(--text-dim); border: 1px solid var(--border); }
.confirm-cancel:hover { background: var(--bg-card-hover); }
.confirm-ok { background: var(--primary); color: white; }
.confirm-ok:hover { background: var(--primary-hover); }
.confirm-ok.danger { background: #ef4444; }
.confirm-ok.danger:hover { background: #dc2626; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==================== Auth Forms ==================== */
.auth-header {
  text-align: center;
  margin-bottom: 24px;
}
.auth-logo {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  color: white;
}
.auth-header h2 { margin-bottom: 8px; }
.auth-header p { color: var(--text-dim); font-size: 14px; }
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 13px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-dim);
}
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
.checkbox-label a { color: var(--primary); text-decoration: none; }
.forgot-link { color: var(--primary); text-decoration: none; }
.forgot-link:hover { text-decoration: underline; }
.btn-full { width: 100%; }
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-dim);
}
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ==================== Auth Page (full-screen login/register) ==================== */
.auth-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f4f8;
  z-index: 9999;
  overflow: hidden;
  font-family: inherit;
}

/* Floating orbs */
.auth-floating-orbs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  animation: orbFloat 20s ease-in-out infinite;
}
.orb-1 {
  width: 400px; height: 400px;
  background: #0ea5e9;
  top: -10%; left: -5%;
  animation-delay: 0s;
}
.orb-2 {
  width: 350px; height: 350px;
  background: #8b5cf6;
  bottom: -10%; right: -5%;
  animation-delay: -7s;
}
.orb-3 {
  width: 250px; height: 250px;
  background: #10b981;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(60px, -40px) scale(1.1); }
  50% { transform: translate(-30px, 50px) scale(0.95); }
  75% { transform: translate(40px, 30px) scale(1.05); }
}

/* Container: left brand + right form */
.auth-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 60px;
  max-width: 900px;
  width: 100%;
  padding: 20px;
  z-index: 1;
}

/* Left brand panel */
.auth-brand {
  flex: 1;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeSlideIn 0.6s ease;
}
.auth-brand-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: white;
  box-shadow: 0 8px 32px rgba(14,165,233,0.25);
  margin-bottom: 8px;
}
.auth-brand h1 {
  font-size: 36px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.5px;
}
.auth-brand > p {
  font-size: 16px;
  color: #64748b;
  margin-top: -8px;
}
.auth-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}
.auth-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #475569;
  font-size: 14px;
}
.auth-feature i {
  width: 36px; height: 36px;
  background: rgba(14,165,233,0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0ea5e9;
  font-size: 14px;
  flex-shrink: 0;
}

/* Right card */
.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  flex-shrink: 0;
  animation: fadeSlideIn 0.6s ease 0.15s both;
}
.auth-card .auth-form {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 24px;
  padding: 40px 36px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.08);
}
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}
.auth-header p {
  font-size: 14px;
  color: #94a3b8;
}

/* Input groups with icon inside */
.auth-input-group {
  position: relative;
  margin-bottom: 16px;
}
.auth-input-group i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 14px;
  transition: color 0.2s;
  pointer-events: none;
}
.auth-input-group input {
  width: 100%;
  padding: 14px 14px 14px 42px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #1e293b;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
  box-sizing: border-box;
}
.auth-input-group input::placeholder { color: #94a3b8; }
.auth-input-group input:focus {
  outline: none;
  border-color: #0ea5e9;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}
.auth-input-group input:focus + i,
.auth-input-group:focus-within i { color: #0ea5e9; }

/* Options row */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
}
.auth-agree {
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.6;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #64748b;
}
.checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #0ea5e9;
}
.checkbox-label a { color: #0ea5e9; text-decoration: none; }
.forgot-link { color: #0ea5e9; text-decoration: none; font-size: 13px; }
.forgot-link:hover { text-decoration: underline; }

/* Submit button */
.auth-submit-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.auth-submit-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.auth-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(14,165,233,0.3);
}
.auth-submit-btn:hover::before { opacity: 1; }
.auth-submit-btn:active { transform: translateY(0); }

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}
.auth-divider span {
  color: #94a3b8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Footer link */
.auth-footer {
  text-align: center;
  font-size: 14px;
  color: #64748b;
}
.auth-footer a {
  color: #0ea5e9;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}
.auth-footer a:hover { color: #0284c7; }

/* Entry animation */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hide brand on small screens */
@media (max-width: 768px) {
  .auth-brand { display: none; }
  .auth-container { justify-content: center; }
}

/* ==================== Recharge Page ==================== */
.recharge-container { display: flex; flex-direction: column; gap: 20px; }
.balance-display {
  font-size: 14px;
  color: var(--text-dim);
}
.balance-display strong {
  color: var(--primary);
  font-size: 18px;
}
.recharge-plans {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.plan-card {
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.plan-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.plan-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.plan-card.popular { border-color: var(--warning); }
.plan-card.popular::before {
  content: '热门';
  position: absolute;
  top: -1px;
  right: -1px;
  background: var(--warning);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 0 10px 0 10px;
}
.plan-credits { font-size: 28px; font-weight: 700; color: var(--primary); }
.plan-label { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.plan-price { font-size: 16px; font-weight: 600; }
.original-price {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-left: 4px;
}
.plan-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 4px;
  font-size: 11px;
}
.custom-recharge { max-width: 400px; }
.input-with-btn {
  position: relative;
}
.input-with-btn input {
  width: 100%;
  padding-right: 40px;
}
.input-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-weight: 600;
}
.form-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.form-hint strong { color: var(--primary); }
.payment-methods {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.payment-method {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.payment-method:hover { border-color: var(--primary); }
.payment-method.selected { border-color: var(--primary); background: var(--primary-soft); }
.payment-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.payment-icon.wechat { background: #07c160; color: white; }
.payment-icon.alipay { background: #1677ff; color: white; }
.payment-info { flex: 1; }
.payment-name { font-weight: 600; font-size: 15px; }
.payment-desc { font-size: 12px; color: var(--text-dim); }
.payment-check { font-size: 20px; color: var(--primary); opacity: 0; transition: opacity 0.2s; }
.payment-method.selected .payment-check { opacity: 1; }
.recharge-submit {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
}
.recharge-summary {
  margin-bottom: 16px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}
.summary-row:last-child { border-bottom: none; }
.btn-large {
  padding: 14px 24px;
  font-size: 16px;
  width: 100%;
}
.btn-large:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== Payment Modal ==================== */
.payment-modal { max-width: 380px; text-align: center; }
.payment-header { margin-bottom: 24px; }
.payment-header h2 { margin-bottom: 8px; }
.payment-amount {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
}
.qrcode-container { margin: 20px 0; }
.qrcode {
  background: white;
  padding: 16px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 12px;
}
.qrcode canvas { display: block; }
.qrcode-tip { font-size: 14px; color: var(--text-dim); }
.payment-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  color: var(--text-dim);
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.payment-actions { display: flex; flex-direction: column; gap: 10px; }

/* ==================== Terms Modal ==================== */
.terms-modal { max-width: 600px; }
.terms-content h2 {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.terms-body {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 10px;
}
.terms-body h3 {
  font-size: 15px;
  margin: 20px 0 10px;
  color: var(--primary);
}
.terms-body p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.terms-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
