/* ═══════════════════════════════════════════
   墨韵 · AI 小说创作工坊 — Stylesheet v2
   ═══════════════════════════════════════════ */

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

:root {
  --bg-deep:    #07070a;
  --bg-base:    #0f0f16;
  --bg-surface: #16161f;
  --bg-card:    #1e1e2a;
  --bg-hover:   #262635;
  --bg-active:  #2f2f42;
  --border:     #262638;
  --border-light: #36364a;
  --text-primary:   #f0eee9;
  --text-secondary: #a8a5b0;
  --text-muted:     #6b6878;
  --accent:       #d4b47a;
  --accent-light: #e8d4a8;
  --accent-dim:   #9a8a5e;
  --accent-bg:    rgba(212, 180, 122, 0.08);
  --accent-bg-hover: rgba(212, 180, 122, 0.15);
  --accent-glow: rgba(212, 180, 122, 0.3);
  --red:    #e86060;
  --red-light: #ff7b7b;
  --green:  #58d682;
  --green-light: #7be8a0;
  --blue:   #6a99f5;
  --blue-light: #8fb0ff;
  --purple: #b596ff;
  --purple-light: #cbb5ff;
  --orange: #f5a158;
  --cyan:   #58d6e8;
  --font-serif: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --font-sans:  'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
  --space-xs: 4px; --space-sm: 8px; --space-md: 16px;
  --space-lg: 24px; --space-xl: 40px; --space-2xl: 64px;
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 18px; --radius-xl: 28px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-xl: 0 12px 48px rgba(0,0,0,0.5);
  --shadow-accent: 0 4px 24px rgba(212, 180, 122, 0.15);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --transition-fast: 0.15s var(--ease-out);
  --transition: 0.3s var(--ease-out);
  --transition-slow: 0.5s var(--ease-out);
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(212, 180, 122, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(106, 153, 245, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-light); }

.hidden { display: none !important; }

/* ── Navigation ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(7, 7, 10, 0.92);
  backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.nav-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 var(--space-lg);
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}

.nav-brand { display: flex; align-items: center; gap: var(--space-sm); cursor: pointer; user-select: none; }

.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 900; font-size: 18px; color: var(--bg-deep);
  box-shadow: 0 2px 12px rgba(212, 180, 122, 0.3);
  transition: all var(--transition-fast);
}

.nav-brand:hover .brand-icon {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(212, 180, 122, 0.4);
}

.brand-text { font-family: var(--font-serif); font-weight: 700; font-size: 18px; letter-spacing: 2px; }

.nav-links { display: flex; gap: var(--space-xs); }

.nav-link {
  padding: var(--space-sm) var(--space-md); color: var(--text-secondary);
  font-size: 14px; font-weight: 500; border-radius: var(--radius-md);
  transition: all var(--transition-fast); letter-spacing: 0.5px;
  position: relative;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link.active { color: var(--accent); background: var(--accent-bg); }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.nav-menu-btn {
  display: none; background: none; border: none; color: var(--text-secondary);
  cursor: pointer; padding: var(--space-sm); border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.nav-menu-btn:hover { background: var(--bg-hover); }

.mobile-menu { display: none; flex-direction: column; background: var(--bg-surface); border-top: 1px solid var(--border); }
.mobile-menu.open { display: flex; }
.mobile-menu a { padding: var(--space-md) var(--space-lg); color: var(--text-secondary); font-size: 15px; transition: all var(--transition-fast); }
.mobile-menu a:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-sm);
  padding: 10px 20px; font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  border: none; border-radius: var(--radius-md); cursor: pointer;
  transition: all var(--transition-fast); user-select: none; white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s var(--ease-out), height 0.6s var(--ease-out);
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: var(--bg-deep); 
  box-shadow: 0 2px 12px rgba(212, 180, 122, 0.3), var(--shadow-accent);
}
.btn-primary:hover { 
  box-shadow: 0 6px 28px rgba(212, 180, 122, 0.45), var(--shadow-accent); 
  transform: translateY(-2px); 
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost { 
  background: transparent; 
  color: var(--text-secondary); 
  border: 1px solid var(--border); 
}
.btn-ghost:hover { 
  color: var(--text-primary); 
  border-color: var(--border-light); 
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.btn-danger { 
  background: rgba(232, 96, 96, 0.12); 
  color: var(--red); 
  border: 1px solid rgba(232, 96, 96, 0.25); 
}
.btn-danger:hover { 
  background: rgba(232, 96, 96, 0.2); 
  border-color: var(--red);
  box-shadow: 0 4px 16px rgba(232, 96, 96, 0.2);
}

.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.btn.loading { pointer-events: none; opacity: 0.7; }

/* ── Sections ── */
.section { min-height: 100vh; padding-top: 64px; }
.section-header { text-align: center; padding: var(--space-2xl) var(--space-lg) var(--space-xl); }
.section-header h2 { font-family: var(--font-serif); font-size: 36px; font-weight: 700; margin-bottom: var(--space-sm); }
.section-header p { color: var(--text-secondary); font-size: 16px; }

/* ═══════════ HERO ═══════════ */
.hero-section {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; position: relative; overflow: hidden; padding: 0 var(--space-lg);
}
.hero-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ink-drop { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.15; }
.ink-1 { width: 700px; height: 700px; background: var(--accent); top: -250px; right: -150px; animation: float 20s ease-in-out infinite; }
.ink-2 { width: 500px; height: 500px; background: var(--purple); bottom: -150px; left: -100px; animation: float 25s ease-in-out infinite reverse; }
.ink-3 { width: 400px; height: 400px; background: var(--blue); top: 50%; left: 50%; animation: floatCenter 30s ease-in-out infinite; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}
@keyframes floatCenter {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  33% { transform: translate(calc(-50% + 30px), calc(-50% - 30px)) scale(1.05); }
  66% { transform: translate(calc(-50% - 20px), calc(-50% + 20px)) scale(0.95); }
}

.hero-content { position: relative; z-index: 1; max-width: 800px; }

.hero-badge {
  display: inline-block; padding: 8px 20px; background: var(--accent-bg);
  border: 1px solid rgba(212, 180, 122, 0.25); border-radius: 100px;
  font-size: 13px; color: var(--accent); font-weight: 600; letter-spacing: 2px;
  margin-bottom: var(--space-xl); animation: fadeInUp 0.8s var(--ease-out);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(212, 180, 122, 0.1);
}

.hero-title { font-family: var(--font-serif); font-size: clamp(36px, 6vw, 64px); font-weight: 900; line-height: 1.3; margin-bottom: var(--space-lg); }
.hero-char { display: inline-block; animation: charReveal 0.8s var(--ease-out) backwards; animation-delay: calc(var(--i) * 0.08s); }

@keyframes charReveal {
  from { opacity: 0; transform: translateY(30px) scale(0.9); filter: blur(6px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.hero-subtitle { font-size: 18px; color: var(--text-secondary); line-height: 1.9; margin-bottom: var(--space-xl); animation: fadeInUp 0.8s var(--ease-out) 0.8s backwards; }

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

.hero-actions { display: flex; gap: var(--space-md); justify-content: center; flex-wrap: wrap; margin-bottom: var(--space-2xl); animation: fadeInUp 0.8s var(--ease-out) 1s backwards; }
.hero-stats { display: flex; gap: var(--space-xl); justify-content: center; flex-wrap: wrap; animation: fadeInUp 0.8s var(--ease-out) 1.2s backwards; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-num { font-family: var(--font-serif); font-size: 32px; font-weight: 700; color: var(--accent); text-shadow: 0 2px 12px rgba(212, 180, 122, 0.3); }
.stat-label { font-size: 13px; color: var(--text-muted); letter-spacing: 1px; }
.stat-divider { width: 1px; height: 40px; background: var(--border); align-self: center; }
.scroll-hint { position: absolute; bottom: 40px; display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); color: var(--text-muted); font-size: 12px; letter-spacing: 2px; animation: bounce 2s ease-in-out infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

/* ═══════════ WIZARD ═══════════ */
.create-section { padding: var(--space-2xl) var(--space-lg); }
.wizard-container { max-width: 1000px; margin: 0 auto; }

/* Progress */
.wizard-progress { margin-bottom: var(--space-xl); }
.progress-bar { height: 4px; background: var(--bg-card); border-radius: 2px; overflow: hidden; margin-bottom: var(--space-md); box-shadow: inset 0 1px 3px rgba(0,0,0,0.3); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light)); border-radius: 2px; transition: width 0.6s var(--ease-out); box-shadow: 0 0 12px rgba(212, 180, 122, 0.5); }
.progress-steps { display: flex; justify-content: space-between; }
.step { display: flex; align-items: center; gap: var(--space-sm); opacity: 0.4; transition: all var(--transition); }
.step.active { opacity: 1; } .step.completed { opacity: 0.7; }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-card); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; transition: all var(--transition); box-shadow: var(--shadow-sm); }
.step.active .step-num { background: var(--accent); border-color: var(--accent); color: var(--bg-deep); box-shadow: 0 0 0 3px var(--accent-bg), 0 4px 12px rgba(212, 180, 122, 0.4); transform: scale(1.1); }
.step.completed .step-num { background: var(--green); border-color: var(--green); color: var(--bg-deep); box-shadow: 0 0 0 3px rgba(88, 214, 130, 0.2), 0 4px 12px rgba(88, 214, 130, 0.3); }
.step-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* Wizard Steps */
.wizard-step { display: none; animation: fadeInUp 0.5s var(--ease-out); }
.wizard-step.active { display: block; }
.step-header { text-align: center; margin-bottom: var(--space-xl); }
.step-number { font-family: var(--font-serif); font-size: 13px; color: var(--accent-dim); letter-spacing: 4px; display: block; margin-bottom: var(--space-sm); }
.step-header h2 { font-family: var(--font-serif); font-size: 28px; font-weight: 700; margin-bottom: var(--space-sm); }
.step-header p { color: var(--text-secondary); font-size: 15px; }

/* Option Grid */
.option-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
.option-grid > * { z-index: 1; position: relative; }
.option-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.option-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.option-card {
  position: relative; padding: var(--space-lg); background: var(--bg-surface);
  border: 2px solid var(--border); border-radius: var(--radius-lg);
  cursor: pointer; transition: all var(--transition); text-align: center;
  overflow: hidden;
  z-index: 1;
}
.option-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }

.option-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  transition: left 0.5s var(--ease-out);
}

.option-card:hover::before {
  left: 100%;
}

.option-card:hover { border-color: var(--border-light); background: var(--bg-hover); box-shadow: var(--shadow-md); z-index: 20; }
.option-card:has(input:checked) { 
  border-color: var(--accent); 
  background: var(--accent-bg); 
  box-shadow: 0 0 0 1px var(--accent), 0 8px 32px rgba(212, 180, 122, 0.2), var(--shadow-accent);
  z-index: 20;
}
.card-icon { font-size: 36px; margin-bottom: var(--space-md); line-height: 1; transition: transform var(--transition-fast); }
.option-card:hover .card-icon { transform: scale(1.1); }
.option-card:has(input:checked) .card-icon { transform: scale(1.15); }
.card-title { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.card-check { position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; opacity: 0; transition: all var(--transition-fast); color: var(--accent); transform: scale(0); pointer-events: none; }
.option-card:has(input:checked) .card-check { opacity: 1; transform: scale(1); }

/* Featured Cards */
.option-card.featured-card {
  border: 2px solid rgba(212, 180, 122, 0.3);
  background: linear-gradient(135deg, rgba(212, 180, 122, 0.05), rgba(106, 153, 245, 0.05));
  position: relative;
  overflow: hidden;
}

.option-card.featured-card::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, rgba(212, 180, 122, 0.2), rgba(106, 153, 245, 0.2));
  border-radius: var(--radius-lg);
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.option-card.featured-card:hover::after {
  opacity: 1;
}

.option-card.featured-card:has(input:checked)::after {
  opacity: 1;
  background: linear-gradient(135deg, rgba(212, 180, 122, 0.3), rgba(106, 153, 245, 0.3));
}

.card-featured {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #e86060, #f5a158);
  color: white;
  box-shadow: 0 2px 8px rgba(232, 96, 96, 0.3);
  animation: pulse 2s ease-in-out infinite;
  pointer-events: none;
}

.option-card.featured-card .card-icon {
  font-size: 40px;
  margin-bottom: var(--space-md);
}

.option-card.featured-card .card-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.option-card.featured-card .card-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.option-card.featured-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 30px rgba(212, 180, 122, 0.2);
  z-index: 10;
}

.option-card.featured-card:has(input:checked) {
  transform: translateY(-6px);
  box-shadow: 0 0 0 2px var(--accent), 0 12px 40px rgba(0,0,0,0.4), 0 0 30px rgba(212, 180, 122, 0.3);
  z-index: 10;
}

.option-card.wide { text-align: left; display: flex; align-items: center; gap: var(--space-md); }
.option-card.wide .card-icon { margin-bottom: 0; font-size: 28px; flex-shrink: 0; }
.option-card.wide .card-title { font-size: 15px; }
.option-card.wide .card-desc { font-size: 12px; margin-top: 2px; }

.custom-chapter-input { margin-top: var(--space-lg); text-align: center; }
.custom-chapter-input label { display: block; font-size: 14px; color: var(--text-secondary); margin-bottom: var(--space-sm); }
.custom-chapter-input input {
  width: 120px; padding: 10px 16px; font-size: 18px; text-align: center;
  font-family: var(--font-sans); font-weight: 700; color: var(--accent);
  background: var(--bg-surface); border: 2px solid var(--border); border-radius: var(--radius-md);
  outline: none; transition: border-color var(--transition-fast);
}
.custom-chapter-input input:focus { border-color: var(--accent); }

/* Theme Input */
.theme-input-container { margin-top: var(--space-lg); }
.theme-input-container textarea {
  width: 100%; min-height: 140px; padding: var(--space-md) var(--space-lg);
  font-size: 16px; font-family: var(--font-sans); color: var(--text-primary);
  background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius-lg);
  outline: none; transition: all var(--transition-fast); resize: vertical;
  line-height: 1.7;
}
.theme-input-container textarea:focus { 
  border-color: var(--accent); 
  box-shadow: 0 0 0 4px var(--accent-bg), 0 4px 20px rgba(212, 180, 122, 0.15); 
  background: var(--bg-surface);
}
.theme-input-container textarea::placeholder { color: var(--text-muted); }
.theme-input-container textarea::placeholder { color: var(--text-muted); }
.theme-examples { margin-top: var(--space-md); display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-sm); }
.theme-label { font-size: 13px; color: var(--text-muted); }
.theme-example-btn {
  padding: 8px 16px; font-size: 13px; color: var(--text-secondary);
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-full);
  cursor: pointer; transition: all var(--transition-fast);
  font-weight: 500;
}
.theme-example-btn:hover { 
  background: var(--accent-bg); 
  border-color: var(--accent); 
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 180, 122, 0.15);
}

.custom-chapter-input.hidden, .hidden { display: none; }

/* Wizard Nav */
.wizard-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: var(--space-xl); padding-top: var(--space-lg); border-top: 1px solid var(--border);
}
.step-indicator { font-size: 14px; color: var(--text-muted); font-weight: 500; }

/* ═══════════ OUTLINE ═══════════ */
.outline-container { max-width: 1200px; margin: 0 auto; animation: fadeInUp 0.6s var(--ease-out); }
.outline-header { text-align: center; margin-bottom: var(--space-xl); }
.outline-badge { display: inline-block; padding: 6px 16px; background: rgba(78, 203, 113, 0.1); border: 1px solid rgba(78, 203, 113, 0.2); border-radius: 100px; font-size: 13px; color: var(--green); font-weight: 500; margin-bottom: var(--space-md); }
.outline-header h2 { font-family: var(--font-serif); font-size: 32px; font-weight: 700; margin-bottom: var(--space-sm); }

.outline-content { display: grid; grid-template-columns: 320px 1fr; gap: var(--space-lg); margin-bottom: var(--space-xl); }
.outline-section { 
  background: var(--bg-surface); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg); 
  padding: var(--space-lg); 
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.outline-section:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-light);
}

.outline-section h3 { 
  font-size: 16px; 
  font-weight: 700; 
  margin-bottom: var(--space-md); 
  padding-bottom: var(--space-md); 
  border-bottom: 2px solid var(--border);
  color: var(--text-primary);
}
.info-grid { display: flex; flex-direction: column; gap: var(--space-sm); }
.info-item { display: flex; justify-content: space-between; padding: var(--space-sm) 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.info-label { font-size: 13px; color: var(--text-muted); }
.info-value { font-size: 14px; font-weight: 600; color: var(--accent); }

.character-card { 
  padding: var(--space-md) var(--space-lg); 
  background: var(--bg-card); 
  border-radius: var(--radius-md); 
  margin-bottom: var(--space-sm);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.character-card:hover {
  border-color: var(--accent-dim);
  background: var(--bg-hover);
  transform: translateX(4px);
}

.character-card:last-child { margin-bottom: 0; }

.char-name { 
  font-weight: 700; 
  font-size: 16px; 
  color: var(--accent); 
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.char-role { 
  font-size: 12px; 
  color: var(--text-muted); 
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

.char-desc { 
  font-size: 13px; 
  color: var(--text-secondary); 
  line-height: 1.7;
}

.chapter-plan-list { display: flex; flex-direction: column; gap: var(--space-sm); max-height: 600px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.chapter-plan-item { 
  display: flex; 
  align-items: flex-start; 
  gap: var(--space-md); 
  padding: var(--space-md) var(--space-lg); 
  background: var(--bg-card); 
  border-radius: var(--radius-md); 
  transition: all var(--transition-fast);
  border: 1px solid var(--border);
  cursor: pointer;
}

.chapter-plan-item:hover { 
  background: var(--bg-hover);
  border-color: var(--accent-dim);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.chapter-num { 
  flex-shrink: 0; 
  width: 40px; 
  height: 40px; 
  background: var(--accent-bg); 
  border: 1px solid rgba(212, 180, 122, 0.25); 
  border-radius: var(--radius-md); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 14px; 
  font-weight: 700; 
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(212, 180, 122, 0.15);
  transition: all var(--transition-fast);
}

.chapter-plan-item:hover .chapter-num {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(212, 180, 122, 0.25);
}

.chapter-info h4 { 
  font-size: 15px; 
  font-weight: 600; 
  margin-bottom: 4px;
  color: var(--text-primary);
}

.chapter-info p { 
  font-size: 13px; 
  color: var(--text-muted);
  line-height: 1.5;
}

.outline-actions { display: flex; justify-content: center; gap: var(--space-md); padding-top: var(--space-lg); border-top: 1px solid var(--border); }

/* ═══════════ WORKSPACE ═══════════ */
.workspace { max-width: 1400px; margin: 0 auto; animation: fadeInUp 0.6s var(--ease-out); }
.workspace-header { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-lg) 0; border-bottom: 1px solid var(--border); margin-bottom: var(--space-lg); }
.workspace-header h2 { font-family: var(--font-serif); font-size: 22px; font-weight: 700; flex: 1; }
.workspace-meta { display: flex; gap: var(--space-sm); }
.badge { padding: 4px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 100px; font-size: 12px; color: var(--text-secondary); font-weight: 500; }

.workspace-body { display: grid; grid-template-columns: 260px 1fr; gap: var(--space-lg); min-height: 70vh; }

.chapter-sidebar {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-md); height: fit-content; position: sticky; top: 80px;
  max-height: calc(100vh - 100px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sidebar-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 2px; margin-bottom: var(--space-md); padding-bottom: var(--space-sm); border-bottom: 1px solid var(--border); }
.chapter-nav-list { display: flex; flex-direction: column; gap: 2px; }

.chapter-nav-item {
  padding: 10px 12px; font-size: 13px; color: var(--text-secondary); border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--transition-fast); display: flex; align-items: center; gap: var(--space-sm);
  position: relative;
  overflow: hidden;
}

.chapter-nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform var(--transition-fast);
}

.chapter-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.chapter-nav-item:hover::before { transform: scaleY(1); }
.chapter-nav-item.active { 
  background: var(--accent-bg); 
  color: var(--accent); 
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.chapter-nav-item.active::before { transform: scaleY(1); }
.chapter-nav-item .ch-status { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: all var(--transition-fast); box-shadow: var(--shadow-sm); }
.chapter-nav-item.done .ch-status { background: var(--green); box-shadow: 0 0 8px rgba(88, 214, 130, 0.4); }

.chapter-reader { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.reader-toolbar { padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--border); background: var(--bg-card); }
.reader-tabs { display: flex; gap: 2px; }
.reader-tab {
  padding: 10px 18px; font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  color: var(--text-muted); background: none; border: none; border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--transition-fast);
  position: relative;
}

.reader-tab::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: transform var(--transition-fast);
}

.reader-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.reader-tab:hover::after { transform: translateX(-50%) scaleX(0.5); }
.reader-tab.active { color: var(--accent); background: var(--accent-bg); }
.reader-tab.active::after { transform: translateX(-50%) scaleX(1); width: 30px; }
.reader-content { position: relative; }
.reader-panel { display: none; padding: var(--space-lg); min-height: 60vh; }
.reader-panel.active { display: block; }

.chapter-display { font-family: var(--font-serif); line-height: 2; font-size: 16px; }
.chapter-display .ch-title { 
  font-size: 28px; 
  font-weight: 700; 
  margin-bottom: var(--space-xl); 
  padding-bottom: var(--space-lg); 
  border-bottom: 2px solid var(--border); 
  text-align: center;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.chapter-display .ch-body p { 
  text-indent: 2em; 
  margin-bottom: 1em;
  letter-spacing: 0.3px;
}

.chapter-display .ch-body p:first-of-type::first-letter {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--accent);
}

.empty-state { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  min-height: 40vh; 
  text-align: center; 
  color: var(--text-muted);
  padding: var(--space-xl);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
}

.empty-state.large { min-height: 50vh; }

.empty-icon { 
  font-size: 56px; 
  margin-bottom: var(--space-lg); 
  opacity: 0.4;
  animation: float 3s ease-in-out infinite;
}

.empty-state h3 { 
  font-size: 20px; 
  color: var(--text-secondary); 
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

.empty-state p { 
  font-size: 14px; 
  margin-bottom: var(--space-lg);
  line-height: 1.6;
  max-width: 400px;
}

.chapter-actions { display: flex; justify-content: center; padding: var(--space-lg); border-top: 1px solid var(--border); }

.chapter-meta { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); font-family: var(--font-sans); font-size: 13px; color: var(--text-muted); display: flex; justify-content: space-between; }

/* Quality Checklist */
.quality-checklist { font-size: 14px; }
.check-category { margin-bottom: var(--space-lg); }
.check-category h4 { font-size: 15px; font-weight: 700; margin-bottom: var(--space-sm); color: var(--accent); }
.check-category ul { list-style: none; display: flex; flex-direction: column; gap: var(--space-sm); }
.check-category li { padding: var(--space-sm) var(--space-md); background: var(--bg-card); border-radius: var(--radius-sm); display: flex; align-items: center; gap: var(--space-sm); cursor: pointer; transition: background var(--transition-fast); }
.check-category li:hover { background: var(--bg-hover); }
.check-category li.checked { opacity: 0.5; text-decoration: line-through; }
.check-category li::before { content: '☐'; color: var(--text-muted); flex-shrink: 0; font-size: 16px; }
.check-category li.checked::before { content: '☑'; color: var(--green); }

/* Hooks in reader */
.hooks-reference .hook-item { display: flex; gap: var(--space-md); padding: var(--space-md); background: var(--bg-card); border-radius: var(--radius-md); margin-bottom: var(--space-sm); }
.hooks-reference .hook-num { flex-shrink: 0; width: 32px; height: 32px; background: var(--accent-bg); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--accent); }
.hooks-reference .hook-content h4 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.hooks-reference .hook-content p { font-size: 13px; color: var(--text-secondary); }
.hooks-reference .hook-example { margin-top: var(--space-sm); padding: var(--space-sm) var(--space-md); background: rgba(201, 169, 110, 0.05); border-left: 2px solid var(--accent-dim); font-family: var(--font-serif); font-size: 13px; color: var(--text-secondary); font-style: italic; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ═══════════ LIBRARY ═══════════ */
.library-section { padding: var(--space-lg); min-height: calc(100vh - 120px); }
.library-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-xl); }

.novel-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-xl); cursor: pointer; transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1); position: relative;
  overflow: hidden; display: flex; flex-direction: column; gap: var(--space-md);
}

.novel-card::before {
  content: '';
  position: absolute; top: 0; left: 0; width: 4px; height: 0;
  background: linear-gradient(180deg, #d4b47a, #8b6914);
  transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 0 4px 0;
}

.novel-card:hover::before { height: 100%; }

.novel-card:hover { 
  border-color: rgba(212, 180, 122, 0.3); 
  transform: translateY(-8px); 
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(212, 180, 122, 0.08), inset 0 1px 0 rgba(255,255,255,0.03);
}

.novel-card-header { display: flex; align-items: center; gap: var(--space-lg); }
.novel-cover { 
  width: 60px; height: 60px; 
  background: linear-gradient(135deg, #d4b47a 0%, #8b6914 100%); 
  border-radius: var(--radius-md); 
  display: flex; align-items: center; justify-content: center; 
  font-size: 28px; flex-shrink: 0;
  box-shadow: 0 6px 24px rgba(212, 180, 122, 0.3);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.novel-card:hover .novel-cover {
  transform: scale(1.08) rotate(-3deg);
  box-shadow: 0 10px 30px rgba(212, 180, 122, 0.45);
}

.novel-title { 
  font-family: var(--font-serif); font-size: 20px; font-weight: 700; 
  color: var(--text-primary); line-height: 1.3;
  letter-spacing: 0.02em;
}

.novel-meta { display: flex; gap: var(--space-sm); margin-top: 4px; }
.novel-meta .badge { font-size: 11px; padding: 2px 10px; border-radius: 20px; }

.novel-desc { 
  font-size: 14px; color: var(--text-secondary); line-height: 1.7; 
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  padding: var(--space-sm) var(--space-md); background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm); border-left: 3px solid rgba(212, 180, 122, 0.25);
}

.novel-progress-bar {
  position: relative; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 3px; overflow: hidden; margin: 2px 0;
}
.novel-progress-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  border-radius: 3px; transition: width 0.5s ease;
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
  box-shadow: 0 0 8px currentColor;
}
.novel-progress-text {
  display: block; text-align: right; font-size: 12px; color: var(--text-muted);
  margin-top: 4px; font-variant-numeric: tabular-nums;
}

.novel-stats { 
  display: flex; flex-wrap: wrap; gap: var(--space-md); 
  font-size: 12px; color: var(--text-muted); padding-top: var(--space-sm);
  border-top: 1px solid rgba(255,255,255,0.04);
}
.novel-stat { display: flex; align-items: center; gap: 5px; white-space: nowrap; }

.novel-badge-complete {
  position: absolute; top: var(--space-md); right: var(--space-md);
  background: linear-gradient(135deg, #059669, #10b981); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 20px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.05); }
}

.novel-delete {
  position: absolute; top: 12px; right: 12px; width: 28px; height: 28px;
  background: rgba(224, 85, 85, 0.1); border: 1px solid rgba(224, 85, 85, 0.15);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: all var(--transition-fast); color: var(--red); font-size: 14px;
}
.novel-card:hover .novel-delete { opacity: 1; }
.novel-delete:hover { background: rgba(224, 85, 85, 0.25); }

/* ═══════════ TECHNIQUES ═══════════ */
.techniques-section { padding: var(--space-lg); }
.techniques-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }

.technique-card { 
  background: var(--bg-surface); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg); 
  overflow: hidden; 
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.technique-card:hover { 
  border-color: var(--border-light); 
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.technique-card.featured { 
  grid-column: span 2; 
  border-color: var(--accent-dim); 
  background: linear-gradient(135deg, var(--bg-surface), rgba(212, 180, 122, 0.04));
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(212, 180, 122, 0.1);
}
.technique-header { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-lg); border-bottom: 1px solid var(--border); }
.technique-icon { font-size: 24px; }
.technique-header h3 { font-size: 18px; font-weight: 700; }
.technique-body { padding: var(--space-lg); }
.technique-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: var(--space-lg); }

.hook-list { display: flex; flex-direction: column; gap: var(--space-sm); max-height: 500px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.hook-item { display: flex; gap: var(--space-md); padding: var(--space-md); background: var(--bg-card); border-radius: var(--radius-md); transition: background var(--transition-fast); }
.hook-item:hover { background: var(--bg-hover); }
.hook-num { flex-shrink: 0; width: 28px; height: 28px; background: var(--accent-bg); border: 1px solid rgba(201, 169, 110, 0.15); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--accent); }
.hook-content h4 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.hook-content p { font-size: 13px; color: var(--text-secondary); }
.hook-example { margin-top: var(--space-sm); padding: var(--space-sm) var(--space-md); background: rgba(201, 169, 110, 0.04); border-left: 2px solid var(--accent-dim); font-family: var(--font-serif); font-size: 13px; color: var(--text-muted); font-style: italic; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; line-height: 1.7; }

.transform-table { display: flex; flex-direction: column; gap: 2px; }
.transform-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--space-md); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm); font-size: 14px; align-items: center; }
.transform-row.header { font-weight: 700; font-size: 12px; color: var(--text-muted); letter-spacing: 1px; }
.transform-row:not(.header) { background: var(--bg-card); }
.bad { color: var(--red); } .good { color: var(--green); } .arrow { color: var(--text-muted); text-align: center; }

.checklist-categories { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.check-category h4 { font-size: 14px; font-weight: 700; margin-bottom: var(--space-sm); color: var(--accent); }
.check-category ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.check-category li { font-size: 13px; color: var(--text-secondary); padding: 4px 0; display: flex; align-items: flex-start; gap: var(--space-sm); }
.check-category li::before { content: '☐'; color: var(--text-muted); flex-shrink: 0; }

.quality-score { margin-top: var(--space-lg); padding-top: var(--space-lg); border-top: 1px solid var(--border); }
.quality-score h4 { font-size: 14px; font-weight: 700; margin-bottom: var(--space-md); }
.score-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-sm); }
.score-item { padding: var(--space-sm) var(--space-md); background: var(--bg-card); border-radius: var(--radius-sm); font-size: 13px; text-align: center; color: var(--text-secondary); }
.score-note { margin-top: var(--space-sm); font-size: 13px; color: var(--text-muted); }

.rules-list { display: flex; flex-direction: column; gap: var(--space-lg); }
.rule { display: flex; gap: var(--space-lg); align-items: flex-start; }
.rule-num { flex-shrink: 0; width: 48px; height: 48px; background: linear-gradient(135deg, var(--accent), var(--accent-dim)); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 900; color: var(--bg-deep); font-family: var(--font-serif); }
.rule-content h4 { font-size: 18px; font-weight: 700; margin-bottom: var(--space-xs); }
.rule-content p { font-size: 15px; color: var(--text-secondary); line-height: 1.7; }

/* Suspense levels */
.suspense-levels { display: flex; flex-direction: column; gap: var(--space-sm); }
.level { display: flex; align-items: center; gap: var(--space-md); }
.level-bar { height: 8px; border-radius: 4px; background: var(--accent); flex-shrink: 0; transition: width 1s var(--ease-out); }
.level-info { display: flex; flex-direction: column; gap: 2px; }
.level-name { font-weight: 700; font-size: 14px; }
.level-reaction { font-size: 12px; color: var(--text-muted); font-style: italic; }
.level-use { font-size: 11px; color: var(--accent-dim); }

/* Structure diagram */
.structure-diagram { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0; padding: var(--space-md) 0; }
.structure-step { display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); }
.step-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--accent-dim); border: 3px solid var(--bg-surface); box-shadow: 0 0 0 2px var(--accent-dim); }
.step-dot.trigger { background: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
.step-dot.rising { background: var(--purple); box-shadow: 0 0 0 2px var(--purple); }
.step-dot.climax { background: var(--red); box-shadow: 0 0 0 2px var(--red), 0 0 12px rgba(224,85,85,0.4); }
.step-dot.falling { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.step-dot.resolution { background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.step-label { font-size: 12px; text-align: center; color: var(--text-secondary); font-weight: 600; min-width: 80px; }
.step-label small { font-weight: 400; color: var(--text-muted); display: block; margin-top: 2px; }
.structure-line { width: 40px; height: 2px; background: var(--border-light); flex-shrink: 0; margin-bottom: 28px; }

/* ═══════════ ABOUT ═══════════ */
.about-section { padding: var(--space-2xl) var(--space-lg); }
.about-content { max-width: 1000px; margin: 0 auto; }
.about-header { text-align: center; margin-bottom: var(--space-xl); }
.about-header h2 { font-family: var(--font-serif); font-size: 36px; font-weight: 700; margin-bottom: var(--space-sm); }
.about-tagline { color: var(--text-secondary); font-size: 16px; }
.about-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); margin-bottom: var(--space-xl); }
.about-card { 
  background: var(--bg-surface); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg); 
  padding: var(--space-lg);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.about-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-light);
}

.about-icon { 
  font-size: 32px; 
  margin-bottom: var(--space-md);
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

.about-card h3 { 
  font-size: 18px; 
  font-weight: 700; 
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}
.about-card p, .about-card li { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }
.about-card ul { list-style: none; display: flex; flex-direction: column; gap: var(--space-sm); }
.about-card li { padding-left: var(--space-md); position: relative; }
.about-card li::before { content: '→'; position: absolute; left: 0; color: var(--accent-dim); }
.file-tree { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); background: var(--bg-card); padding: var(--space-md); border-radius: var(--radius-md); }
.tree-item { padding: 2px 0; } .tree-item.indent { padding-left: 20px; } .tree-item.indent2 { padding-left: 40px; }
.about-footer { text-align: center; padding-top: var(--space-lg); border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14px; }

/* ═══════════ FOOTER ═══════════ */
.footer { 
  border-top: 1px solid var(--border); 
  padding: var(--space-lg) var(--space-lg) var(--space-2xl);
  background: linear-gradient(180deg, var(--bg-deep), var(--bg-base));
}

.footer-inner { 
  max-width: 1400px; 
  margin: 0 auto; 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
}

.footer-brand { 
  display: flex; 
  align-items: center; 
  gap: var(--space-sm); 
  font-size: 14px; 
  color: var(--text-muted);
  font-weight: 500;
}

.footer-brand .brand-icon {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.footer-links { 
  display: flex; 
  gap: var(--space-lg); 
  font-size: 13px; 
}

.footer-links a { 
  color: var(--text-muted); 
  transition: all var(--transition-fast);
  position: relative;
}

.footer-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--transition-fast);
}

.footer-links a:hover { 
  color: var(--accent); 
}

.footer-links a:hover::after {
  width: 100%;
}

.footer-divider { color: var(--border); opacity: 0.5; }

/* ═══════════ TOAST ═══════════ */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 14px 24px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); font-size: 14px; color: var(--text-primary);
  box-shadow: var(--shadow-xl); animation: toastIn 0.4s var(--ease-out);
  display: flex; align-items: center; gap: var(--space-sm);
  backdrop-filter: blur(8px);
  border-left: 3px solid var(--accent);
}
.toast.success { 
  border-color: var(--green); 
  box-shadow: 0 8px 32px rgba(88, 214, 130, 0.15), var(--shadow-xl);
}
.toast.error { 
  border-color: var(--red);
  box-shadow: 0 8px 32px rgba(232, 96, 96, 0.15), var(--shadow-xl);
}
.toast.leaving { animation: toastOut 0.3s var(--ease-out) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

/* ═══════════ MODAL ═══════════ */
.modal-overlay { 
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,0.7); 
  backdrop-filter: blur(8px); 
  z-index: 300; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  animation: fadeIn 0.3s var(--ease-out); 
}

.modal-box { 
  background: var(--bg-card); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg); 
  padding: var(--space-xl); 
  max-width: 420px; 
  width: 90%; 
  animation: modalIn 0.4s var(--ease-out);
  box-shadow: var(--shadow-xl);
}
.modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: var(--space-sm); }
.modal-box p { font-size: 14px; color: var(--text-secondary); margin-bottom: var(--space-lg); }
.modal-actions { display: flex; gap: var(--space-sm); justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ═══════════ LOADING SPINNER ═══════════ */
.spinner { 
  display: inline-block; 
  width: 18px; 
  height: 18px; 
  border: 2px solid var(--bg-deep); 
  border-top-color: var(--accent); 
  border-radius: 50%; 
  animation: spin 0.7s linear infinite; 
  margin-right: 6px; 
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(212, 180, 122, 0.3);
}

.spinner.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Pulse animation for loading states */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Shimmer effect for loading states */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  background: linear-gradient(90deg, 
    var(--bg-card) 0%, 
    var(--bg-hover) 50%, 
    var(--bg-card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.loading-text {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--accent);
  font-weight: 500;
}

.loading-text::after {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}

/* ═══════════ SCROLLBAR ═══════════ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { 
  background: linear-gradient(180deg, var(--accent-dim), var(--border)); 
  border-radius: 4px;
  border: 2px solid var(--bg-deep);
}
::-webkit-scrollbar-thumb:hover { 
  background: linear-gradient(180deg, var(--accent), var(--border-light));
}
::-webkit-scrollbar-corner { background: transparent; }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 1024px) {
  .techniques-grid { grid-template-columns: 1fr; }
  .technique-card.featured { grid-column: span 1; }
  .checklist-categories { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-menu-btn { display: block; }
  .option-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .option-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .option-grid.cols-2 { grid-template-columns: 1fr; }
  .hero-stats { gap: var(--space-md); }
  .stat-divider { display: none; }
  .outline-content { grid-template-columns: 1fr; }
  .workspace-body { grid-template-columns: 1fr; }
  .chapter-sidebar { position: static; max-height: 250px; overflow-y: auto; }
  .about-grid { grid-template-columns: 1fr; }
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  .structure-diagram { flex-direction: column; align-items: stretch; }
  .structure-line { width: 2px; height: 20px; margin: 0 auto; }
  .transform-row { grid-template-columns: 1fr; text-align: center; gap: 4px; }
  .transform-row.header { display: none; }
  .reader-tabs { overflow-x: auto; }
  .wizard-nav { flex-direction: column; gap: var(--space-md); }
  .wizard-nav .btn { width: 100%; justify-content: center; }
  .step-header h2 { font-size: 20px; }
  .hero-title { font-size: 28px; }
}

@media (max-width: 480px) {
  .option-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 24px; }
  .hero-subtitle { font-size: 15px; }
  .step-header h2 { font-size: 20px; }
  .step-label { display: none; }
  .footer-inner { flex-direction: column; gap: var(--space-md); }
  .wizard-nav { gap: var(--space-sm); }
  .wizard-nav .btn { padding: 10px 16px; font-size: 14px; }
  .workspace-header { flex-wrap: wrap; }
  .workspace-header h2 { font-size: 18px; order: -1; width: 100%; }
  .techniques-grid { grid-template-columns: 1fr; }
  .section-header h2 { font-size: 28px; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: 100%; }
}

/* ═══════════ SHAKE ANIMATION ═══════════ */
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ═══════════ NAV LINK BUTTON ═══════════ */
.chapter-actions {
  display: flex; flex-wrap: wrap; gap: 12px;
}

.auto-generate-toggle {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.toggle-switch {
  position: relative; display: inline-block; width: 48px; height: 26px;
}

.toggle-switch input {
  opacity: 0; width: 0; height: 0;
}

.toggle-switch .slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-light); transition: 0.3s; border-radius: 26px;
}

.toggle-switch .slider:before {
  position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px;
  background-color: var(--bg-surface); transition: 0.3s; border-radius: 50%;
}

.toggle-switch input:checked + .slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(22px);
}

.toggle-label {
  font-size: 14px; color: var(--text-secondary);
}

.delay-select {
  padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-surface); color: var(--text-primary);
  font-size: 13px; cursor: pointer;
}

.delay-select:hover {
  border-color: var(--border-light);
}

.nav-link-btn {
  background: none; border: 1px solid var(--border); color: var(--text-secondary);
  cursor: pointer; padding: 8px; border-radius: var(--radius-sm);
  transition: all var(--transition-fast); display: flex; align-items: center; justify-content: center;
}
.nav-link-btn:hover { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-bg); }

.outline-display {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.outline-display-sections {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-lg);
  height: calc(100% - 40px);
  overflow-y: auto;
}

.outline-display-section {
  padding: var(--space-md);
}

.outline-display-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: var(--space-sm);
}

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

.outline-character {
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.outline-character h4 {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 15px;
}

.outline-character .role-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--bg-card);
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.outline-chapters-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  overflow-y: auto;
}

.outline-chapter-item {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.outline-chapter-item:hover {
  border-color: var(--accent-dim);
}

.outline-chapter-item.written {
  border-color: rgba(76, 175, 80, 0.3);
  background: rgba(76, 175, 80, 0.03);
}

.chapter-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.chapter-num-dot {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 700;
  border: 1px solid rgba(212, 180, 122, 0.3);
}

.status-badge {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.pending {
  background: var(--bg-surface);
  color: var(--text-muted);
}

.status-badge.written {
  background: rgba(76, 175, 80, 0.1);
  color: rgb(76, 175, 80);
}

.chapter-info h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.chapter-info p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ═══════════ SETTINGS MODAL ═══════════ */
.settings-modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  max-width: 580px; width: 95%; max-height: 90vh; display: flex; flex-direction: column;
  animation: modalIn 0.4s var(--ease-out);
  box-shadow: var(--shadow-xl);
}
.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-lg); border-bottom: 1px solid var(--border);
}
.settings-header h2 { font-size: 20px; font-weight: 700; }
.modal-close-btn {
  background: none; border: none; color: var(--text-muted); font-size: 20px;
  cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.modal-close-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

.settings-body {
  padding: var(--space-lg); overflow-y: auto; flex: 1;
}

.settings-notice {
  display: flex; gap: var(--space-sm); padding: var(--space-md);
  background: rgba(91, 141, 239, 0.08); border: 1px solid rgba(91, 141, 239, 0.15);
  border-radius: var(--radius-md); margin-bottom: var(--space-lg); font-size: 13px; color: var(--text-secondary);
}
.settings-notice span { font-size: 16px; flex-shrink: 0; }

.form-group { margin-bottom: var(--space-lg); }
.form-group label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: var(--space-sm); letter-spacing: 0.5px;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"] {
  width: 100%; padding: 12px 16px; font-size: 14px; font-family: var(--font-mono);
  color: var(--text-primary); background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); outline: none; transition: all var(--transition-fast);
}
.form-group input:focus { 
  border-color: var(--accent); 
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-bg), 0 2px 12px rgba(212, 180, 122, 0.1);
}
.form-group input::placeholder { color: var(--text-muted); font-family: var(--font-sans); }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.input-with-btn { position: relative; display: flex; gap: 0; }
.input-with-btn input { flex: 1; border-radius: var(--radius-md) 0 0 var(--radius-md); }
.btn-icon {
  padding: 0 12px; background: var(--bg-card); border: 1px solid var(--border);
  border-left: none; border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-muted); cursor: pointer; transition: all var(--transition-fast);
  display: flex; align-items: center;
}
.btn-icon:hover { color: var(--text-primary); background: var(--bg-hover); }

.form-row { display: flex; gap: var(--space-md); }
.flex-1 { flex: 1; }

input[type="range"] {
  -webkit-appearance: none; width: 100%; height: 4px; background: var(--bg-card);
  border-radius: 2px; outline: none; margin-top: 8px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--bg-surface);
}
.range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.range-labels #tempValue { color: var(--accent); font-weight: 700; }

.preset-btns { display: flex; flex-wrap: wrap; gap: var(--space-sm); }

.settings-status {
  min-height: 24px; font-size: 13px; padding: var(--space-sm) 0;
}
.settings-status.success { color: var(--green); }
.settings-status.error { color: var(--red); }
.settings-status.loading { color: var(--accent); }

.settings-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--border);
  background: var(--bg-card); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.settings-footer > div { display: flex; gap: var(--space-sm); }

/* ═══════════ STREAMING CURSOR ═══════════ */
.streaming-cursor {
  display: inline-block; width: 2px; height: 1.2em; background: var(--accent);
  animation: blink 0.8s step-end infinite; vertical-align: text-bottom; margin-left: 2px;
}
.streaming-paragraph-active::after {
  content: ''; display: inline-block; width: 2px; height: 1.1em; background: var(--accent);
  animation: blink 0.8s step-end infinite; vertical-align: text-bottom; margin-left: 2px;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Generating overlay */
.generating-overlay {
  position: absolute; inset: 0; background: rgba(7, 7, 10, 0.75);
  backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center;
  z-index: 10; border-radius: var(--radius-lg);
}

.generating-box {
  background: var(--bg-card); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-2xl); 
  text-align: center; 
  animation: modalIn 0.4s var(--ease-out);
  box-shadow: var(--shadow-xl);
  min-width: 280px;
}

.generating-box .spinner { 
  width: 32px; 
  height: 32px; 
  border-width: 3px; 
  margin-bottom: var(--space-lg);
  box-shadow: 0 0 16px rgba(212, 180, 122, 0.4);
}

.generating-box p { 
  font-size: 15px; 
  color: var(--text-secondary); 
  margin-top: var(--space-md);
  font-weight: 500;
}

.generating-box .gen-progress {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* ═══════════ LIBRARY ACTIONS ═══════════ */
.library-actions {
  display: flex; gap: var(--space-sm); margin-top: var(--space-md);
  justify-content: center;
}

.library-section .section-header {
  position: relative; padding-bottom: var(--space-xl);
  background: linear-gradient(180deg, rgba(212, 180, 122, 0.04) 0%, transparent 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.library-section .section-header h2 {
  font-size: 32px;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 20px rgba(212, 180, 122, 0.15);
}

.library-section .section-header p {
  font-size: 14px; color: var(--text-muted); margin-top: var(--space-xs);
}

.library-summary {
  max-width: 1200px; margin: 0 auto var(--space-xl);
  display: flex; align-items: center; justify-content: center; gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  background: linear-gradient(135deg, rgba(212, 180, 122, 0.06), rgba(139, 105, 20, 0.04));
  border: 1px solid rgba(212, 180, 122, 0.12);
  border-radius: var(--radius-lg);
}

.lib-stat-item {
  display: flex; align-items: baseline; gap: var(--space-xs); text-align: center;
}
.lib-stat-num { 
  font-size: 24px; font-weight: 800; color: #d4b47a; 
  font-variant-numeric: tabular-nums; line-height: 1;
  text-shadow: 0 2px 10px rgba(212, 180, 122, 0.2);
}
.lib-stat-label { 
  font-size: 12px; color: var(--text-muted); 
  letter-spacing: 0.05em; white-space: nowrap;
}
.lib-stat-highlight .lib-stat-num { color: #4ade80; }
.lib-stat-divider {
  width: 1px; height: 28px; background: rgba(255,255,255,0.08);
}

/* ═══════════ AI REVIEW SECTION ═══════════ */
.ai-review-section {
  margin-top: var(--space-xl); padding: var(--space-lg);
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.ai-review-section h4 { font-size: 16px; font-weight: 600; margin-bottom: var(--space-sm); }
.ai-review-section p { font-size: 14px; color: var(--text-secondary); margin-bottom: var(--space-md); }

.review-result {
  margin-top: var(--space-lg); padding: var(--space-lg);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.review-result.hidden { display: none; }
.review-score {
  display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-md);
  padding-bottom: var(--space-md); border-bottom: 1px solid var(--border);
}
.review-score-value {
  font-size: 48px; font-weight: 700; color: var(--accent);
}
.review-score-label { font-size: 14px; color: var(--text-secondary); }
.review-section { margin-bottom: var(--space-md); }
.review-section h5 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-sm); }
.review-section p { font-size: 14px; line-height: 1.7; }
.review-suggestions { list-style: none; padding: 0; }
.review-suggestions li {
  padding: var(--space-sm) var(--space-md); margin-bottom: var(--space-xs);
  background: var(--bg-surface); border-radius: var(--radius-sm);
  font-size: 14px; border-left: 3px solid var(--accent);
}
.review-loading {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-lg); color: var(--text-secondary);
}
.review-loading .spinner { width: 20px; height: 20px; }

/* ═══════════ CHAPTER ACTIONS ═══════════ */
.chapter-actions {
  display: flex; gap: var(--space-sm); flex-wrap: wrap;
}
.generating-box .gen-progress { font-size: 12px; color: var(--text-muted); margin-top: var(--space-xs); }

/* ═══════════ REWRITE DIALOG ═══════════ */
.rewrite-dialog {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.rewrite-dialog.hidden { display: none; }
.rewrite-dialog-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 90%; max-width: 560px;
  max-height: 80vh; overflow: hidden; display: flex; flex-direction: column;
  animation: modalIn 0.3s var(--ease-out);
}
.rewrite-dialog-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--border);
}
.rewrite-dialog-header h3 { font-size: 18px; font-weight: 600; margin: 0; }
.btn-close {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: var(--text-muted); padding: 4px;
}
.btn-close:hover { color: var(--text-primary); }
.rewrite-dialog-body { padding: var(--space-lg); overflow-y: auto; flex: 1; }
.rewrite-type-selector { display: flex; flex-direction: column; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.rewrite-type-option {
  display: flex; align-items: flex-start; gap: var(--space-md); padding: var(--space-md);
  background: var(--bg-surface); border: 2px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--transition-fast);
}
.rewrite-type-option:hover { border-color: var(--accent); }
.rewrite-type-option input { margin-top: 4px; }
.rewrite-type-option input:checked + .option-content { color: var(--accent); }
.option-content { flex: 1; }
.option-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.option-desc { font-size: 13px; color: var(--text-secondary); }

.rewrite-option-panel { margin-top: var(--space-md); }
.rewrite-option-panel label { display: block; font-size: 14px; font-weight: 600; margin-bottom: var(--space-sm); }
.rewrite-option-panel textarea {
  width: 100%; padding: var(--space-md); font-size: 14px; font-family: var(--font-sans);
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  outline: none; resize: vertical;
}
.rewrite-option-panel textarea:focus { border-color: var(--accent); }
.suggestion-examples { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-sm); align-items: center; }
.example-label { font-size: 12px; color: var(--text-muted); }
.example-btn {
  padding: 4px 10px; font-size: 12px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-full); cursor: pointer;
}
.example-btn:hover { border-color: var(--accent); color: var(--accent); }

.paragraph-selector {
  max-height: 200px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.paragraph-item {
  padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: flex-start; gap: var(--space-sm);
}
.paragraph-item:last-child { border-bottom: none; }
.paragraph-item:hover { background: var(--bg-surface); }
.paragraph-item.selected { background: var(--accent-bg); }
.paragraph-item input { margin-top: 4px; }
.paragraph-preview { font-size: 13px; color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rewrite-dialog-footer {
  display: flex; justify-content: flex-end; gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--border);
}

/* ═══════════ EDIT MODE ═══════════ */
.edit-mode-panel { margin-top: var(--space-lg); }
.edit-mode-panel.hidden { display: none; }
.edit-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-sm) var(--space-md); background: var(--bg-surface);
  border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.edit-mode-label { font-size: 14px; font-weight: 600; color: var(--accent); }
.edit-actions, .edit-save-actions { display: flex; gap: var(--space-sm); }
.edit-textarea {
  width: 100%; min-height: 400px; padding: var(--space-md);
  font-size: 15px; font-family: var(--font-sans); line-height: 1.8;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 0 0 var(--radius-md) var(--radius-md);
  outline: none; resize: vertical;
}
.edit-textarea:focus { border-color: var(--accent); }

/* ═══════════ EXPORT DIALOG ═══════════ */
.export-dialog {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.export-dialog.hidden { display: none; }
.export-dialog-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 90%; max-width: 480px;
  max-height: 70vh; overflow: hidden; display: flex; flex-direction: column;
  animation: modalIn 0.3s var(--ease-out);
}
.export-dialog-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--border);
}
.export-dialog-header h3 { font-size: 18px; font-weight: 600; margin: 0; }
.export-dialog-body { padding: var(--space-lg); overflow-y: auto; flex: 1; }
.export-type-selector { display: flex; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.export-type-option {
  display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md);
  background: var(--bg-surface); border: 2px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--transition-fast);
}
.export-type-option:hover { border-color: var(--accent); }
.export-type-option input { margin-top: 4px; }
.export-type-option input:checked + .option-content .option-title { color: var(--accent); }
.option-content { flex: 1; }
.option-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.option-desc { font-size: 13px; color: var(--text-secondary); }

.export-options { margin-top: var(--space-lg); }
.export-option-panel { padding: var(--space-md); background: var(--bg-surface); border-radius: var(--radius-md); }
.export-option-panel.hidden { display: none; }
.export-option-panel label { display: block; font-size: 14px; font-weight: 600; margin-bottom: var(--space-sm); }

.novel-select-list { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.novel-select-item {
  display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md);
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: all var(--transition-fast);
}
.novel-select-item:last-child { border-bottom: none; }
.novel-select-item:hover { background: var(--bg-hover); }
.novel-select-item.selected { background: var(--accent-bg); border-color: var(--accent); }
.novel-select-item input { margin-right: var(--space-sm); }
.novel-info { flex: 1; }
.novel-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.novel-meta { font-size: 12px; color: var(--text-secondary); }

.export-format-options { display: flex; gap: var(--space-md); margin-top: var(--space-md); }
.export-format-option {
  flex: 1; padding: var(--space-md); background: var(--bg-surface);
  border: 2px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--transition-fast);
}
.export-format-option:hover { border-color: var(--accent); }
.export-format-option.selected { border-color: var(--accent); background: var(--accent-bg); }
.format-icon { font-size: 24px; margin-bottom: var(--space-xs); }
.format-title { font-weight: 600; font-size: 14px; }
.format-desc { font-size: 12px; color: var(--text-secondary); }

.export-dialog-footer {
  display: flex; justify-content: flex-end; gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--border);
}

.export-option-group { margin-bottom: var(--space-lg); }
.export-option-group:last-child { margin-bottom: 0; }
.export-option-group > label { 
  display: block; font-size: 14px; font-weight: 600; margin-bottom: var(--space-sm); 
  color: var(--text-primary);
}
.export-range-options { display: flex; flex-direction: column; gap: var(--space-sm); }
.export-radio-option {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer;
  transition: all var(--transition-fast);
}
.export-radio-option:hover { border-color: var(--accent); background: var(--bg-hover); }
.export-radio-option input:checked + span { color: var(--accent); font-weight: 600; }

.novel-select-info { flex: 1; }
.novel-select-title { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.novel-select-meta { font-size: 12px; color: var(--text-secondary); }
.novel-select-check { 
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-weight: bold; font-size: 16px;
}

.format-content { text-align: center; }
.format-info { margin-top: var(--space-xs); }

/* ── v6 Beat Sheet 章节标识 ── */
.beat-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
  letter-spacing: 0.3px;
}
.beat-badge.beat-climax {
  background: linear-gradient(135deg, #ff5722, #ff9800);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 87, 34, 0.35);
}
.beat-badge.beat-high {
  background: linear-gradient(135deg, #5b8def, #7c5bf2);
  color: #fff;
  box-shadow: 0 2px 6px rgba(91, 141, 239, 0.3);
}
.beat-badge.beat-medium {
  background: rgba(120, 130, 150, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(120, 130, 150, 0.3);
}
.chapter-plan-item.chapter-beat-climax {
  border-left: 3px solid #ff5722;
  background: linear-gradient(90deg, rgba(255, 87, 34, 0.06), transparent 60%);
}
.chapter-plan-item.chapter-beat-high {
  border-left: 3px solid #5b8def;
  background: linear-gradient(90deg, rgba(91, 141, 239, 0.05), transparent 60%);
}
.chapter-plan-item.chapter-beat-medium {
  border-left: 3px solid rgba(120, 130, 150, 0.4);
}

/* ── v6 长任务进度蒙层 ── */
.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 35, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.progress-card {
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1f2937);
  width: min(440px, 92vw);
  padding: 28px 28px 24px;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  text-align: center;
  position: relative;
}

.progress-spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border: 4px solid rgba(91, 141, 239, 0.18);
  border-top-color: #5b8def;
  border-right-color: #7c5bf2;
  border-radius: 50%;
  animation: progressSpin 0.9s linear infinite;
}
@keyframes progressSpin { to { transform: rotate(360deg); } }

.progress-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #5b8def, #7c5bf2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.progress-stage {
  font-size: 14px;
  color: var(--text-secondary, #6b7280);
  margin-bottom: 14px;
  min-height: 20px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(120, 130, 150, 0.15);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #5b8def, #7c5bf2, #ff5722);
  background-size: 200% 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
  animation: progressShimmer 2.5s linear infinite;
}
@keyframes progressShimmer { from { background-position: 0 0; } to { background-position: 200% 0; } }

.progress-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-secondary, #6b7280);
  margin-bottom: 16px;
}
.progress-elapsed {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
}
.progress-tip {
  transition: opacity 0.25s ease;
  min-height: 18px;
  font-style: italic;
}

.progress-cancel-btn {
  background: transparent;
  border: 1px solid rgba(120, 130, 150, 0.4);
  color: var(--text-secondary, #6b7280);
  padding: 7px 22px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.progress-cancel-btn:hover {
  background: rgba(255, 87, 34, 0.08);
  border-color: #ff5722;
  color: #ff5722;
}