/* ═══════════════════════════════════════════════════
   网文工坊 · Main Stylesheet
   Design: Dark luxury SaaS with sidebar layout
   ═══════════════════════════════════════════════════ */

:root {
  /* Core palette */
  --bg-deepest: #030308;
  --bg-base:    #080810;
  --bg-raised:  #0e0e1a;
  --bg-elevated:#14141f;
  --bg-surface: #1a1a28;

  /* Accent */
  --purple-400:#a78bfa;
  --purple-500:#8b5cf6;
  --purple-600:#7c3aed;
  --purple-glow:rgba(139,92,246,0.18);

  /* Semantic */
  --green:     #34d399;
  --green-bg:  rgba(52,211,153,0.10);
  --green-border: rgba(52,211,153,0.18);
  --yellow:    #fbbf24;
  --yellow-bg: rgba(251,191,36,0.10);
  --red:       #f87171;
  --red-bg:    rgba(248,113,113,0.10);
  --blue:      #60a5fa;
  --blue-bg:   rgba(96,165,250,0.10);
  --pink:      #f472b6;

  /* Borders */
  --border:    #1e1e32;
  --border-light: #282840;

  /* Text */
  --text:      #ecedf5;
  --text-secondary: #a8a8c0;
  --muted:     #656580;

  /* Spacing */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow:    0 4px 20px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.55);

  /* Transitions */
  --ease:      .2s cubic-bezier(.4,0,.2,1);
  --ease-out:  .25s cubic-bezier(0,0,.2,1);

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 52px;
}

/* ═══ Reset ═══ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--bg-deepest);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}
/* Subtle noise/grain texture overlay */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Ambient gradient blobs */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 15% 10%, rgba(139,92,246,0.04), transparent),
    radial-gradient(ellipse 50% 35% at 80% 70%, rgba(244,114,182,0.03), transparent),
    radial-gradient(ellipse 40% 30% at 50% 40%, rgba(96,165,250,0.02), transparent);
}

/* ═══ Top Bar ═══ */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 20px;
  background: rgba(8,8,16,.82);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-brand { display: flex; align-items: center; gap: 11px; }
.brand-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, var(--purple-500), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  box-shadow: 0 2px 12px rgba(139,92,246,.30);
}
.brand-title {
  font-size: 16px; font-weight: 700; letter-spacing: -.3px;
  background: linear-gradient(135deg, var(--text), var(--purple-400));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-sub {
  font-size: 10px; color: var(--muted); display: block; margin-top: -2px;
  letter-spacing: .2px;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ═══ App Layout ═══ */
.app-layout {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
  position: relative; z-index: 1;
}

/* ═══ Sidebar ═══ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
}
.sidebar-project { padding: 0 4px; }
.project-select {
  width: 100%; padding: 9px 32px 9px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px; font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23656580' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: var(--ease);
}
.project-select:hover { border-color: var(--purple-500); }
.project-select:focus { outline: none; border-color: var(--purple-500); box-shadow: 0 0 0 3px var(--purple-glow); }

/* Sidebar Stats */
.sidebar-stats { padding: 8px 4px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-stat {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  transition: var(--ease);
}
.sidebar-stat:hover { background: var(--bg-elevated); }
.sidebar-stat-icon { font-size: 15px; opacity: .7; width: 22px; text-align: center; }
.sidebar-stat-num { font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.sidebar-stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }

/* Sidebar Navigation */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px;
  border: none; border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px; font-family: inherit; font-weight: 500;
  cursor: pointer;
  transition: var(--ease);
  text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--bg-surface); color: var(--text); }
.nav-item.active {
  background: var(--bg-surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--purple-500);
}
.nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge {
  background: var(--purple-500); color: #fff;
  font-size: 10px; font-weight: 600; padding: 1px 7px;
  border-radius: 10px; min-width: 20px; text-align: center;
  display: none;
}
.nav-badge:not(:empty) { display: inline-block; }
.nav-divider-above { margin-top: 12px; position: relative; }
.nav-divider-above::before {
  content: ''; position: absolute; top: -7px; left: 12px; right: 12px;
  height: 1px; background: var(--border);
}

/* ═══ Main Content ═══ */
.main-content {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  min-width: 0;
}

/* ═══ Stats Row ═══ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  transition: var(--ease);
  cursor: default;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
}
.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-card:hover::before { background: linear-gradient(90deg, transparent, var(--purple-glow), transparent); }
.stat-card-icon { font-size: 26px; flex-shrink: 0; opacity: .8; }
.stat-card-body { flex: 1; min-width: 0; }
.stat-num {
  font-size: 26px; font-weight: 800; letter-spacing: -.5px;
  line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text);
}
.stat-label {
  font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; margin-top: 2px;
}
.stat-accent { border-left: 2px solid var(--purple-500); }
.stat-accent .stat-num {
  background: linear-gradient(135deg, var(--purple-400), var(--pink));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: 1px solid transparent;
  transition: var(--ease);
  white-space: nowrap; line-height: 1.4;
}
.btn:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }
.btn:active:not(:disabled) { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--purple-500), var(--purple-600));
  color: #fff;
  box-shadow: 0 2px 10px var(--purple-glow);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 18px var(--purple-glow);
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--bg-surface); color: var(--text-secondary);
  border-color: var(--border-light);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-elevated); color: var(--text);
  border-color: var(--muted);
}

.btn-ghost {
  background: transparent; color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-surface); color: var(--text);
}

.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn-xs { padding: 3px 7px; font-size: 10px; border-radius: 5px; }

.btn-success { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.btn-success:hover:not(:disabled) { background: rgba(52,211,153,.15); }
.btn-warning { background: var(--yellow-bg); color: var(--yellow); border-color: rgba(251,191,36,.15); }
.btn-warning:hover:not(:disabled) { background: rgba(251,191,36,.15); }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: rgba(248,113,113,.15); }
.btn-danger:hover:not(:disabled) { background: rgba(248,113,113,.15); }
.btn-copy { background: var(--blue-bg); color: var(--blue); border-color: rgba(96,165,250,.15); }
.btn-copy:hover:not(:disabled) { background: rgba(96,165,250,.15); }

.btn-icon { padding: 6px 8px; min-width: 32px; justify-content: center; }

/* ═══ Panel / Card ═══ */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 10px;
  transition: border-color var(--ease);
}
.panel:hover { border-color: var(--border-light); }
.panel-header {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.panel-header .badge { margin-left: auto; }

/* ═══ Chapter List ═══ */
.chapter-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: calc(100vh - 280px); overflow-y: auto;
}
.chapter-row {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  transition: var(--ease);
}
.chapter-row:hover {
  border-color: var(--border-light);
  background: var(--bg-elevated);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}
.chapter-num {
  font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, var(--purple-400), var(--pink));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 34px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.chapter-info { flex: 1; min-width: 0; }
.chapter-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.chapter-preview {
  font-size: 11px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chapter-actions { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }

/* ═══ Badges ═══ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 600; letter-spacing: .1px;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-dim { background: rgba(101,101,128,.10); color: var(--muted); }

/* ═══ Forms ═══ */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 10.5px; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .4px;
}
.form-input, .form-select {
  width: 100%; padding: 10px 13px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px; font-family: inherit;
  transition: var(--ease);
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px var(--purple-glow);
}
.form-input::placeholder { color: var(--muted); }
.form-select {
  cursor: pointer; appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23656580' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.form-textarea {
  width: 100%; min-height: 200px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text); padding: 12px 14px;
  font-family: 'Cascadia Code', 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12.5px; line-height: 1.7;
  resize: vertical;
  transition: var(--ease);
}
.form-textarea:focus { outline: none; border-color: var(--purple-500); box-shadow: 0 0 0 3px var(--purple-glow); }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-input { flex: 1; min-width: 140px; }

/* ═══ Diff View ═══ */
.diff-view {
  font-size: 14px; line-height: 2.2; white-space: pre-wrap;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.diff-view .diff-del {
  background: rgba(248,113,113,.18); color: var(--red);
  text-decoration: line-through; padding: 1px 3px; border-radius: 3px;
}
.diff-view .diff-ins {
  background: rgba(52,211,153,.12); color: var(--green);
  padding: 1px 3px; border-radius: 3px;
}
.diff-legend {
  display: flex; gap: 20px; margin-bottom: 14px;
  font-size: 11px; color: var(--muted);
}
.diff-legend span { display: inline-flex; align-items: center; gap: 5px; }
.diff-legend .swatch { width: 12px; height: 12px; border-radius: 3px; }

/* ═══ Modal ═══ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(2,2,6,.88); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  justify-content: center; align-items: center;
  padding: 24px;
}
.modal-overlay.show { display: flex; animation: fadeIn .2s ease; }
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 860px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s cubic-bezier(.16,1,.3,1);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 14px; font-weight: 600; }
.modal-actions { display: flex; gap: 6px; }
.modal-body {
  padding: 20px 24px; overflow-y: auto; flex: 1;
  font-size: 14px; line-height: 2;
}
.modal-body.plain {
  white-space: pre-wrap;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ═══ Toast ═══ */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .35s cubic-bezier(.16,1,.3,1);
  max-width: 400px;
  border: 1px solid;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.toast-ok  { background: rgba(6,78,59,.9); color: var(--green); border-color: rgba(52,211,153,.25); }
.toast-err { background: rgba(78,6,6,.9); color: var(--red); border-color: rgba(248,113,113,.25); }
.toast-info{ background: rgba(30,27,75,.9); color: var(--purple-400); border-color: rgba(139,92,246,.25); }

/* ═══ Empty State ═══ */
.empty-state { text-align: center; padding: 64px 24px; }
.empty-icon { font-size: 52px; margin-bottom: 16px; opacity: .4; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: var(--muted); max-width: 440px; margin: 0 auto; line-height: 1.7; }

/* ═══ Score Ring ═══ */
.score-ring { font-size: 36px; font-weight: 800; letter-spacing: -1px; }
.score-high { color: var(--green); }
.score-mid { color: var(--yellow); }
.score-low { color: var(--red); }

/* ═══ Trending ═══ */
.trend-h {
  font-size: 13px; font-weight: 700; margin: 20px 0 10px;
  color: var(--purple-400); display: flex; align-items: center; gap: 7px;
}
.trend-h .platform-icon { font-size: 18px; }
.rank-num {
  font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, var(--purple-400), var(--pink));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 32px; text-align: center;
}

/* ═══ Idea Cards ═══ */
.idea-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  cursor: pointer; font-size: 12px; margin-bottom: 4px;
  transition: var(--ease); color: var(--text-secondary);
}
.idea-card:hover {
  border-color: var(--purple-500);
  background: var(--bg-elevated); color: var(--text);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

/* ═══ Mode Tabs ═══ */
.mode-tab {
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border-light);
  background: var(--bg-surface); color: var(--text-secondary);
  font-family: inherit; transition: var(--ease);
}
.mode-tab:hover { border-color: var(--muted); color: var(--text); }
.mode-tab.active {
  background: linear-gradient(135deg, var(--purple-500), var(--purple-600));
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 10px var(--purple-glow);
}

/* ═══ Utilities ═══ */
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.text-dim { color: var(--muted); font-size: 11px; }

/* ═══ Loading ═══ */
#loading-overlay {
  display: none; position: fixed; inset: 0; z-index: 9998;
  background: rgba(3,3,8,.7); backdrop-filter: blur(4px);
  flex-direction: column; align-items: center; justify-content: center;
}
#loading-overlay.show { display: flex; }
.spinner {
  width: 32px; height: 32px;
  border: 2.5px solid var(--border-light);
  border-top-color: var(--purple-500);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ═══ Animations ═══ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(.95); }
  to   { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseGlow {
  0%, 100% { opacity: 1; box-shadow: 0 4px 16px rgba(124,58,237,0.35); }
  50%      { opacity: 0.85; box-shadow: 0 4px 24px rgba(124,58,237,0.55); }
}
@keyframes brandPulse {
  0%, 100% { box-shadow: 0 2px 12px rgba(139,92,246,.30); }
  50%      { box-shadow: 0 2px 20px rgba(139,92,246,.50); }
}

/* ═══ Custom Scrollbar ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-light); border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ═══ Selection ═══ */
::selection {
  background: rgba(139,92,246,.28);
  color: var(--text);
}

/* ═══ Brand Icon Animation ═══ */
.brand-icon { animation: brandPulse 4s ease-in-out infinite; }

/* ═══ Chapter Row Status Borders ═══ */
.chapter-row:has(.badge-green) { border-left: 2px solid var(--green); }
.chapter-row:has(.badge-yellow) { border-left: 2px solid var(--yellow); }
.chapter-row:has(.badge-dim) { border-left: 2px solid transparent; }

/* ═══ Empty State Enhancement ═══ */
.empty-icon {
  filter: grayscale(.3);
  transition: filter var(--ease);
}
.empty-state:hover .empty-icon {
  filter: grayscale(0);
}

/* ═══ Tab Content Transition ═══ */
#tab-content > * {
  animation: fadeIn .25s ease;
}

/* ═══════════════════════════════════════════
   Generation Progress Panel
   ═══════════════════════════════════════════ */
.gen-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  animation: slideUp .3s cubic-bezier(.16,1,.3,1);
  transition: box-shadow .4s ease;
}
.gen-panel.gp-complete {
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(34,197,94,.15);
}

.gp-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.gp-header-icon { font-size: 18px; }
.gp-header-text { font-weight: 600; font-size: 14px; flex: 1; }
.gp-header-count { font-size: 13px; color: var(--purple-400); font-weight: 700;
  font-variant-numeric: tabular-nums; }

.gp-bar-track {
  height: 6px; background: var(--bg-surface);
  border-radius: 3px; overflow: hidden;
  margin-bottom: 12px;
}
.gp-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--purple-500), var(--purple-400), #d89cff);
  background-size: 200% 100%;
  animation: gpShimmer 1.8s ease-in-out infinite;
  transition: width .4s cubic-bezier(.16,1,.3,1);
}
@keyframes gpShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.gp-rows { display: flex; flex-direction: column; gap: 4px; }
.gp-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px;
  font-size: 12px; color: var(--muted);
  transition: all .25s var(--ease);
}
.gp-row.gp-running {
  color: var(--purple-400);
  background: rgba(168,85,247,0.08);
}
.gp-row.gp-done {
  color: var(--green);
  background: rgba(34,197,94,.06);
}
.gp-icon { width: 18px; text-align: center; flex-shrink: 0; }
.gp-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-status { font-size: 11px; opacity: .7; }

/* ═══ Chapter NEW Badge ═══ */
.chapter-new-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  background: linear-gradient(135deg, var(--purple-500), #d89cff);
  color: #fff;
  margin-left: 6px;
  vertical-align: middle;
  animation: newPulse 1.2s ease-in-out infinite;
}
@keyframes newPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .75; transform: scale(1.08); }
}

/* ═══ Chapter Row Slide-In ═══ */
.chapter-row-new {
  animation: slideIn .35s cubic-bezier(.16,1,.3,1);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══ Responsive: Mobile Sidebar Toggle ═══ */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .sidebar.open {
    display: flex; position: fixed; z-index: 200;
    top: var(--topbar-height); left: 0; bottom: 0;
    box-shadow: var(--shadow-lg);
  }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .main-content { padding: 14px; }
}

/* ─── Style DNA ─── */
.dna-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.dna-item:last-child { border-bottom: none; }
.dna-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--purple-400);
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.dna-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.dna-more {
  color: var(--purple-400);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}
.dna-more:hover { color: var(--purple-300); }
.dna-full {
  display: none;
  margin-top: 6px;
  padding: 8px;
  background: var(--bg-muted);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
}
.dna-item.expanded .dna-full { display: block; }
.dna-item.expanded .dna-text .dna-more { display: none; }

/* ═══ User Info Button ═══ */
.user-info-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: var(--ease);
}
.user-info-btn:hover {
  border-color: var(--purple-500);
  background: var(--bg-elevated);
}
.user-avatar {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--purple-400);
}
.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.user-points-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(139,92,246,0.1));
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--purple-400);
}

/* ═══ User Menu Dropdown ═══ */
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 20px;
  width: 240px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--ease);
  z-index: 200;
}
.user-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.user-menu-avatar {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--purple-500), var(--pink));
  border-radius: 12px;
  color: #fff;
}
.user-menu-info { flex: 1; }
.user-menu-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.user-menu-points {
  font-size: 12px;
  color: var(--purple-400);
  margin-top: 2px;
}
.user-menu-divider {
  height: 1px;
  background: var(--border);
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: var(--ease);
  text-align: left;
}
.user-menu-item:hover {
  background: var(--bg-surface);
  color: var(--text);
}

/* ═══ Pricing Modal ═══ */
.modal-lg { max-width: 900px; }
.price-packages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.price-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  position: relative;
  transition: var(--ease);
}
.price-card:hover {
  border-color: var(--purple-500);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(139,92,246,0.15);
}
.price-card-popular {
  border-color: var(--purple-500);
  background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(139,92,246,0.02));
}
.price-card-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}
.price-card-badge.popular {
  background: linear-gradient(135deg, var(--purple-500), var(--purple-600));
  border-color: var(--purple-500);
  color: #fff;
}
.price-card-price {
  margin-top: 20px;
  margin-bottom: 8px;
}
.price-symbol {
  font-size: 20px;
  font-weight: 700;
  color: var(--purple-400);
}
.price-num {
  font-size: 42px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -2px;
}
.price-card-points {
  font-size: 14px;
  font-weight: 600;
  color: var(--purple-400);
  margin-bottom: 8px;
}
.price-card-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}
.price-card-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feature-item {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: left;
}

.contact-box {
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(139,92,246,0.05));
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.contact-box-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.contact-box-wechat {
  font-size: 18px;
  font-weight: 700;
  color: var(--purple-400);
  margin-bottom: 8px;
}
.contact-box-hint {
  font-size: 12px;
  color: var(--muted);
}
.price-hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 768px) {
  .price-packages {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .price-packages {
    grid-template-columns: 1fr;
  }
}


