/* ============================================================
   AI Film Prompt Studio v4 - Styles
   ============================================================ */

:root {
  --bg-primary: #08080f;
  --bg-secondary: #0f0f1a;
  --bg-card: rgba(20, 20, 38, 0.75);
  --bg-card-hover: rgba(30, 30, 55, 0.85);
  --border: rgba(100, 100, 160, 0.12);
  --border-active: rgba(99, 102, 241, 0.5);
  --accent: #6366f1; --accent2: #8b5cf6; --pink: #ec4899; --cyan: #06b6d4;
  --green: #10b981; --orange: #f97316; --red: #ef4444; --yellow: #eab308;
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
  --grad-btn: linear-gradient(135deg, #6366f1, #8b5cf6);
  --grad-btn-h: linear-gradient(135deg, #4f46e5, #7c3aed);
  --text: #f0f0f5; --text2: #9a96b0; --text3: #5a566e;
  --tag-bg: rgba(99, 102, 241, 0.08); --tag-bg-a: rgba(99, 102, 241, 0.3);
  --tag-bdr: rgba(99, 102, 241, 0.2); --tag-bdr-a: rgba(99, 102, 241, 0.7);
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px;
  --transition: 0.2s ease;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif; background: var(--bg-primary); color: var(--text); min-height: 100vh; overflow-x: hidden; }
#particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* Header */
.header { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; padding: 8px 16px; background: rgba(8,8,15,0.92); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.header-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo { display: flex; align-items: center; gap: 6px; }
.logo-icon { font-size: 22px; }
.logo-text { font-size: 16px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.logo-text .accent { font-weight: 300; }
h1.logo { margin: 0; font-size: inherit; }
.version-badge { font-size: 9px; font-weight: 600; padding: 2px 6px; background: rgba(99,102,241,0.15); color: var(--accent); border-radius: 10px; border: 1px solid rgba(99,102,241,0.2); }
.nav-tabs { display: flex; gap: 3px; flex: 1; justify-content: center; }
.nav-tab { display: flex; align-items: center; gap: 4px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px; background: transparent; color: var(--text2); font-size: 12px; font-weight: 500; cursor: pointer; transition: all var(--transition); font-family: inherit; white-space: nowrap; }
.nav-tab:hover { border-color: var(--accent); color: var(--text); }
.nav-tab.active { background: rgba(99,102,241,0.15); border-color: var(--accent); color: #fff; }
.nav-icon { font-size: 13px; }
.header-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Layout */
.container { position: relative; z-index: 5; min-height: calc(100vh - 100px); }
.tab-content { display: none; }
.tab-content.active { display: grid; grid-template-columns: 340px 1fr; gap: 0; }
#tab-novel.active, #tab-templates.active, #tab-chat.active { display: block; }
.panel { padding: 14px; overflow-y: auto; }
.config-panel { background: rgba(8,8,15,0.5); backdrop-filter: blur(8px); border-right: 1px solid var(--border); max-height: calc(100vh - 48px); }
.config-panel::-webkit-scrollbar { width: 3px; }
.config-panel::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
.output-panel { padding: 16px 20px; max-height: calc(100vh - 48px); overflow-y: auto; }
.output-panel::-webkit-scrollbar { width: 3px; }
.output-panel::-webkit-scrollbar-thumb { background: var(--pink); border-radius: 3px; }

/* Search */
.search-bar { padding: 0 0 10px; }
.search-input { width: 100%; padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; color: var(--text); font-size: 12px; font-family: inherit; outline: none; transition: border-color var(--transition); }
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text3); }

/* Sections */
.section { margin-bottom: 2px; border-radius: var(--r-md); overflow: hidden; }
.section-title { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); background: var(--bg-card); transition: background var(--transition); user-select: none; }
.section-title:hover { background: var(--bg-card-hover); }
.title-right { display: flex; align-items: center; gap: 6px; }
.arrow { font-size: 9px; color: var(--text3); transition: transform var(--transition); }
.section-title.collapsed .arrow { transform: rotate(-90deg); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; background: var(--accent); color: #fff; border-radius: 9px; font-size: 10px; font-weight: 700; }
.badge.hidden { display: none; }
.section-dice { background: none; border: none; cursor: pointer; font-size: 14px; opacity: 0.5; transition: opacity var(--transition); padding: 0 2px; }
.section-dice:hover { opacity: 1; }
.section-content { padding: 8px 10px 12px; background: rgba(12,12,22,0.5); max-height: 500px; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease; opacity: 1; }
.section-content.hidden { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }

/* Tags */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-flex; align-items: center; padding: 4px 9px; font-size: 11px; border-radius: 16px; border: 1px solid var(--tag-bdr); background: var(--tag-bg); color: var(--text2); cursor: pointer; transition: all var(--transition); user-select: none; white-space: nowrap; }
.tag:hover { background: rgba(99,102,241,0.18); border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.tag.active { background: var(--tag-bg-a); border-color: var(--tag-bdr-a); color: #fff; box-shadow: 0 0 12px rgba(99,102,241,0.25); }
.tag.active::before { content: '✓ '; font-size: 8px; }
.tag.filtered-out { display: none; }

/* Platform / Ratio */
.platform-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.platform-btn { padding: 7px 4px; text-align: center; font-size: 11px; font-weight: 500; border-radius: var(--r-sm); border: 1px solid var(--tag-bdr); background: var(--tag-bg); color: var(--text2); cursor: pointer; transition: all var(--transition); }
.platform-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.platform-btn.active { border-color: var(--cyan); background: rgba(6,182,212,0.2); color: #fff; }
.ratio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.ratio-btn { padding: 5px 3px; text-align: center; font-size: 11px; border-radius: var(--r-sm); border: 1px solid var(--tag-bdr); background: var(--tag-bg); color: var(--text2); cursor: pointer; transition: all var(--transition); }
.ratio-btn:hover { border-color: var(--pink); color: var(--pink); }
.ratio-btn.active { border-color: var(--pink); background: rgba(236,72,153,0.15); color: #fff; }

/* Action Bar & Buttons */
.action-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 14px; border: none; border-radius: var(--r-md); font-size: 12px; font-weight: 500; cursor: pointer; transition: all var(--transition); font-family: inherit; }
.btn-primary { background: var(--grad-btn); color: #fff; box-shadow: 0 3px 12px rgba(99,102,241,0.25); }
.btn-primary:hover { background: var(--grad-btn-h); transform: translateY(-1px); box-shadow: 0 5px 16px rgba(99,102,241,0.35); }
.btn-lg { padding: 11px 24px; font-size: 14px; font-weight: 700; border-radius: var(--r-lg); }
.btn-secondary { background: rgba(6,182,212,0.12); color: var(--cyan); border: 1px solid rgba(6,182,212,0.25); }
.btn-secondary:hover { background: rgba(6,182,212,0.2); transform: translateY(-1px); }
.btn-accent { background: var(--grad-btn); color: #fff; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text); }
.btn-sm { padding: 4px 9px; font-size: 10px; border-radius: var(--r-sm); }
.btn-ai { background: rgba(6,182,212,0.08); color: var(--cyan); border: 1px solid rgba(6,182,212,0.2); font-size: 11px; padding: 5px 10px; border-radius: 16px; }
.btn-ai:hover { background: rgba(6,182,212,0.18); border-color: var(--cyan); }
.btn-ai-gradient { background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(236,72,153,0.15)); color: #e0e0ff; border: 1px solid rgba(139,92,246,0.35); font-size: 11px; padding: 6px 12px; border-radius: 16px; font-weight: 500; transition: all 0.2s ease; }
.btn-ai-gradient:hover { background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(236,72,153,0.3)); border-color: rgba(139,92,246,0.6); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.2); color: #fff; }
.btn-ai-gradient.loading { opacity: 0.6; pointer-events: none; }
.btn-ai-gradient.loading::after { content: ''; display: inline-block; width: 10px; height: 10px; margin-left: 4px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
.btn-ai.loading { opacity: 0.6; pointer-events: none; }
.btn-ai.loading::after { content: ''; display: inline-block; width: 10px; height: 10px; margin-left: 4px; border: 2px solid rgba(6,182,212,0.3); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.6s linear infinite; }
.btn-primary.loading { pointer-events: none; opacity: 0.75; }
.btn-primary.loading::after { content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 6px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
.btn-copied { background: var(--green) !important; border-color: var(--green) !important; }

/* AI Toolbar */
.ai-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; background: rgba(6,182,212,0.04); border: 1px solid rgba(6,182,212,0.12); border-radius: var(--r-lg); }
.ai-toolbar-label { font-size: 11px; font-weight: 700; color: var(--cyan); padding: 3px 8px; background: rgba(6,182,212,0.12); border-radius: 10px; }
.ai-style-dropdown { position: relative; }
.style-menu { display: none; position: absolute; top: 100%; left: 0; z-index: 60; min-width: 220px; padding: 6px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 8px 24px rgba(0,0,0,0.5); margin-top: 4px; }
.style-menu.show { display: block; }
.style-menu-item { display: block; width: 100%; padding: 8px 12px; background: none; border: none; color: var(--text2); font-size: 12px; text-align: left; cursor: pointer; border-radius: var(--r-sm); font-family: inherit; transition: all var(--transition); }
.style-menu-item:hover { background: rgba(99,102,241,0.12); color: var(--text); }

/* Export Dropdown */
.export-dropdown { position: relative; }
.export-menu { display: none; position: absolute; right: 0; top: 100%; z-index: 60; padding: 4px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.export-menu.show { display: flex; flex-direction: column; gap: 2px; }
.export-menu button { padding: 6px 16px; background: none; border: none; color: var(--text2); font-size: 11px; cursor: pointer; border-radius: 4px; text-align: left; font-family: inherit; }
.export-menu button:hover { background: rgba(99,102,241,0.12); color: var(--text); }

/* Custom Input */
.custom-area { margin-bottom: 14px; }
.label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 5px; color: var(--text2); }
.textarea { width: 100%; min-height: 60px; padding: 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text); font-family: inherit; font-size: 12px; resize: vertical; outline: none; transition: border-color var(--transition); }
.textarea:focus { border-color: var(--accent); }
.textarea::placeholder { color: var(--text3); }

/* Output Cards */
.output-card { margin-bottom: 14px; background: var(--bg-card); border-radius: var(--r-lg); border: 1px solid var(--border); overflow: hidden; transition: border-color 0.3s, box-shadow 0.3s; }
.output-card.glow { border-color: var(--accent); box-shadow: 0 0 20px rgba(99,102,241,0.15), inset 0 0 20px rgba(99,102,241,0.03); }
.output-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 6px; }
.output-header h3 { font-size: 13px; font-weight: 600; }
.output-meta { display: flex; align-items: center; gap: 6px; }
.char-count { font-size: 10px; color: var(--text3); font-family: monospace; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.04); }
.char-count.warn { color: var(--orange); }
.char-count.over { color: var(--red); }
.prompt-output { padding: 14px; min-height: 80px; font-size: 13px; line-height: 1.75; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.prompt-output .placeholder { color: var(--text3); text-align: center; padding: 24px 16px; line-height: 2; }
.prompt-output .hint { font-size: 11px; opacity: 0.5; }
.negative-card { border-color: rgba(239,68,68,0.15); }
.prompt-output.negative { color: #f87171; font-size: 11px; line-height: 1.6; }
.prompt-anatomy { display: none; flex-wrap: wrap; gap: 5px; padding: 8px 14px; border-bottom: 1px solid var(--border); background: rgba(99,102,241,0.03); }
.anatomy-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; font-size: 10px; font-weight: 500; color: var(--text2); background: var(--tag-bg); border: 1px solid var(--tag-bdr); border-radius: 12px; white-space: nowrap; }
.anatomy-platform { color: var(--cyan); border-color: rgba(6,182,212,0.25); background: rgba(6,182,212,0.06); }
.anatomy-custom { color: var(--pink); border-color: rgba(236,72,153,0.25); background: rgba(236,72,153,0.06); }

/* Score */
.score-display { padding: 14px; border-top: 1px solid var(--border); background: rgba(16,185,129,0.03); }
.score-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 10px; }
.score-item { text-align: center; padding: 8px; background: rgba(255,255,255,0.03); border-radius: var(--r-md); }
.score-value { font-size: 24px; font-weight: 700; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.score-label { font-size: 10px; color: var(--text3); margin-top: 2px; }
.score-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.06); overflow: hidden; margin-top: 4px; }
.score-bar-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.score-tips { font-size: 12px; color: var(--text2); padding: 8px; background: rgba(255,255,255,0.02); border-radius: var(--r-sm); }

/* Platform Tips */
.platform-tips-content { padding: 12px 14px; font-size: 12px; color: var(--text2); line-height: 1.7; }
.platform-tips-content h4 { color: var(--cyan); font-size: 13px; margin-bottom: 6px; }
.platform-tips-content ul { padding-left: 18px; }
.platform-tips-content li { margin-bottom: 4px; }

/* Storyboard */
.storyboard-shot { display: flex; gap: 10px; padding: 10px 14px; margin: 6px 14px; background: rgba(12,12,22,0.6); border-radius: var(--r-md); border-left: 3px solid var(--accent); align-items: flex-start; animation: slideIn 0.25s ease backwards; }
.shot-num { width: 24px; height: 24px; border-radius: 50%; background: var(--grad-btn); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0; }
.shot-content { flex: 1; }
.shot-type { font-size: 10px; font-weight: 600; color: var(--cyan); margin-bottom: 3px; }
.shot-desc { font-size: 12px; color: var(--text2); line-height: 1.5; }
.shot-copy { padding: 3px 7px; font-size: 9px; background: transparent; border: 1px solid var(--border); color: var(--text3); border-radius: 4px; cursor: pointer; flex-shrink: 0; font-family: inherit; }
.shot-copy:hover { color: var(--text); border-color: var(--accent); }

/* Novel Tab */
.novel-container { display: grid; grid-template-columns: 1fr 1fr; gap: 0; min-height: calc(100vh - 100px); }
.novel-input-panel { padding: 16px; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.novel-header { margin-bottom: 12px; }
.novel-header h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.novel-options { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; margin-bottom: 12px; }
.novel-options .label { margin-bottom: 0; }
.novel-textarea { flex: 1; min-height: 300px; padding: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text); font-family: 'Noto Sans SC', sans-serif; font-size: 14px; line-height: 1.8; resize: none; outline: none; }
.novel-textarea:focus { border-color: var(--accent); }
.novel-textarea::placeholder { color: var(--text3); }
.novel-actions { display: flex; gap: 8px; margin-top: 12px; }
.novel-output-panel { padding: 16px; overflow-y: auto; max-height: calc(100vh - 100px); }
.novel-output-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.novel-output-header h3 { font-size: 15px; font-weight: 700; }
.novel-output { min-height: 400px; }
.novel-shot { margin-bottom: 12px; background: var(--bg-card); border-radius: var(--r-lg); border: 1px solid var(--border); overflow: hidden; animation: slideIn 0.3s ease backwards; }
.novel-shot:nth-child(n) { animation-delay: calc(var(--i, 0) * 0.06s); }
.novel-shot-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); background: rgba(99,102,241,0.05); }
.novel-shot-num { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.novel-shot-num .num { width: 26px; height: 26px; border-radius: 50%; background: var(--grad-btn); display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; }
.novel-shot-meta { font-size: 10px; color: var(--text3); }
.novel-shot-body { padding: 12px 14px; }
.novel-shot-prompt { font-size: 13px; line-height: 1.7; color: var(--text); padding: 10px; background: rgba(0,0,0,0.2); border-radius: var(--r-sm); margin-bottom: 8px; }
.novel-shot-note { font-size: 11px; color: var(--text3); line-height: 1.4; border-top: 1px solid var(--border); padding-top: 8px; }
.novel-transition { text-align: center; padding: 4px 0; margin: 2px 0; font-size: 10px; font-weight: 600; letter-spacing: 1.5px; color: var(--cyan); text-transform: uppercase; opacity: 0.7; position: relative; }
.novel-transition::before, .novel-transition::after { content: ''; position: absolute; top: 50%; width: 30%; height: 1px; background: var(--border); }
.novel-transition::before { left: 5%; }
.novel-transition::after { right: 5%; }

/* Templates */
.templates-container { padding: 20px; max-width: 1200px; margin: 0 auto; }
.templates-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.templates-header h2 { font-size: 20px; font-weight: 700; }
.templates-search-bar { width: 280px; }
.templates-categories { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.template-cat-btn { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: transparent; color: var(--text2); font-size: 12px; cursor: pointer; transition: all var(--transition); font-family: inherit; }
.template-cat-btn:hover { border-color: var(--accent); color: var(--text); }
.template-cat-btn.active { background: rgba(99,102,241,0.15); border-color: var(--accent); color: #fff; }
.templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.template-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; transition: all var(--transition); cursor: default; }
.template-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(99,102,241,0.1); }
.template-card-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.template-card-title { font-size: 14px; font-weight: 600; }
.template-card-cat { font-size: 10px; color: var(--text3); }
.template-card-preview { font-size: 11px; color: var(--text2); line-height: 1.6; max-height: 60px; overflow: hidden; margin-bottom: 10px; }
.template-card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.template-card-tags span { font-size: 9px; padding: 2px 6px; background: rgba(99,102,241,0.08); color: var(--text3); border-radius: 8px; }
.template-card-actions { display: flex; gap: 6px; }

/* Chat */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 100px); max-width: 800px; margin: 0 auto; }
.chat-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.chat-header h3 { font-size: 15px; font-weight: 700; }
.chat-header-actions { display: flex; gap: 6px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
.chat-msg { max-width: 80%; padding: 12px 16px; border-radius: var(--r-lg); font-size: 13px; line-height: 1.7; animation: fadeIn 0.3s ease; }
.chat-msg.user { align-self: flex-end; background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3); color: var(--text); }
.chat-msg.ai { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); white-space: pre-wrap; }
.chat-msg.ai .chat-msg-copy { margin-top: 8px; display: flex; gap: 6px; }
.chat-msg.system { align-self: center; color: var(--text3); font-size: 11px; text-align: center; max-width: 90%; }
.chat-input-area { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-input { flex: 1; padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); color: var(--text); font-family: inherit; font-size: 13px; resize: none; outline: none; max-height: 120px; }
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text3); }
.chat-send-btn { flex-shrink: 0; height: 42px; padding: 0 20px; }
.chat-typing { align-self: flex-start; color: var(--text3); font-size: 12px; padding: 8px 16px; }
.chat-typing::after { content: '...'; animation: dots 1.5s infinite; }
@keyframes dots { 0% { content: '.'; } 33% { content: '..'; } 66% { content: '...'; } }

/* Settings */
.settings-form { display: flex; flex-direction: column; gap: 14px; }
.settings-group { display: flex; flex-direction: column; gap: 6px; }
.settings-group label { font-size: 12px; font-weight: 600; color: var(--text2); }
.settings-group select, .settings-group input { padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text); font-family: inherit; font-size: 12px; outline: none; }
.settings-group select:focus, .settings-group input:focus { border-color: var(--accent); }
.settings-group input::placeholder { color: var(--text3); }
.settings-key-wrap { position: relative; }
.settings-key-wrap input { width: 100%; padding-right: 40px; }
.settings-key-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text3); cursor: pointer; font-size: 14px; }
.settings-actions { display: flex; gap: 8px; }
.settings-free-note { padding: 12px; background: rgba(16,185,129,0.06); border: 1px solid rgba(16,185,129,0.15); border-radius: var(--r-md); }
.settings-free-note h4 { font-size: 12px; color: var(--green); margin-bottom: 6px; }
.settings-free-note p { font-size: 11px; color: var(--text2); line-height: 1.6; }
.settings-status { padding: 8px 12px; border-radius: var(--r-sm); font-size: 11px; text-align: center; }
.settings-status.ok { background: rgba(16,185,129,0.1); color: var(--green); }
.settings-status.err { background: rgba(239,68,68,0.1); color: var(--red); }

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(5px); z-index: 100; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--r-xl); width: 90%; max-width: 560px; max-height: 80vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 15px; }
.modal-header-actions { display: flex; align-items: center; gap: 6px; }
.modal-close { width: 28px; height: 28px; border: none; background: var(--bg-card); color: var(--text2); border-radius: 50%; cursor: pointer; font-size: 13px; }
.modal-close:hover { background: rgba(239,68,68,0.2); color: var(--red); }
.modal-body { padding: 14px 18px; overflow-y: auto; flex: 1; }
.history-item, .favorite-item { padding: 10px; margin-bottom: 6px; background: var(--bg-card); border-radius: var(--r-md); border: 1px solid var(--border); transition: all var(--transition); }
.history-item:hover, .favorite-item:hover { border-color: var(--accent); }
.history-meta { font-size: 10px; color: var(--text3); margin-bottom: 4px; }
.history-text { font-size: 11px; color: var(--text2); line-height: 1.5; max-height: 50px; overflow: hidden; }
.item-actions { display: flex; gap: 5px; margin-top: 6px; }

/* Batch */
.batch-results { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 400px; overflow-y: auto; }
.batch-item { padding: 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md); font-size: 12px; color: var(--text); line-height: 1.6; position: relative; }
.batch-item .batch-copy { position: absolute; top: 6px; right: 6px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); padding: 8px 20px; background: var(--grad-btn); color: #fff; border-radius: 24px; font-size: 12px; font-weight: 500; z-index: 200; transition: transform 0.3s ease; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.toast.show { transform: translateX(-50%) translateY(0); }

/* Donate */
.donate-tabs { display: flex; gap: 4px; justify-content: center; margin-bottom: 16px; }
.donate-tab { padding: 6px 16px; border-radius: 20px; border: 1px solid var(--border); background: transparent; color: var(--text2); font-size: 12px; cursor: pointer; font-family: inherit; transition: all var(--transition); }
.donate-tab.active { background: rgba(99,102,241,0.15); border-color: var(--accent); color: #fff; }
.donate-qr { width: 200px; height: 200px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card); }

/* Footer */
.footer { position: relative; z-index: 5; padding: 14px 20px; color: var(--text3); font-size: 11px; border-top: 1px solid var(--border); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1200px; margin: 0 auto; flex-wrap: wrap; gap: 8px; }
.footer-actions { display: flex; gap: 6px; align-items: center; }
.donate-btn { background: linear-gradient(135deg, rgba(249,115,22,0.15), rgba(236,72,153,0.15)) !important; border-color: rgba(249,115,22,0.3) !important; color: var(--orange) !important; }
.donate-btn:hover { background: linear-gradient(135deg, rgba(249,115,22,0.25), rgba(236,72,153,0.25)) !important; transform: translateY(-1px); }

/* Onboarding */
.onboarding-overlay { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; }
.onboarding-card { background: var(--bg-secondary); border-radius: 20px; padding: 48px 40px; max-width: 460px; width: 90%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.onboarding-card h2 { margin: 0 0 12px; font-size: 22px; color: #fff; }
.onboarding-card p { color: #aaa; line-height: 1.6; margin: 0 0 24px; }
.onboarding-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; }
.onboarding-dots .dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.2); }
.onboarding-dots .dot.active { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.select { padding: 5px 10px; background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm); font-family: inherit; font-size: 11px; outline: none; cursor: pointer; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes glowPulse { 0%, 100% { box-shadow: 0 0 20px rgba(99,102,241,0.1); } 50% { box-shadow: 0 0 30px rgba(99,102,241,0.25); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes tagPop { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
.prompt-output.generated { animation: fadeIn 0.3s ease; }
.output-card.glow { animation: glowPulse 2s ease infinite; }
.tag.just-activated { animation: tagPop 0.2s ease; }

/* Focus */
.btn:focus-visible, .nav-tab:focus-visible, .tag:focus-visible, .select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 4px 8px; background: rgba(0,0,0,0.85); color: #fff; font-size: 10px; white-space: nowrap; border-radius: 4px; z-index: 50; pointer-events: none; }

/* Responsive */
@media (max-width: 900px) {
  .tab-content.active { grid-template-columns: 1fr; }
  .config-panel { max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
  .output-panel { max-height: none; }
  .nav-tabs { order: 10; width: 100%; justify-content: flex-start; overflow-x: auto; }
  .nav-label { display: none; }
  .header-actions { margin-left: auto; }
  .novel-container { grid-template-columns: 1fr; }
  .novel-input-panel { border-right: none; border-bottom: 1px solid var(--border); }
  .novel-output-panel { max-height: none; }
  .templates-grid { grid-template-columns: 1fr; }
  .score-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 500px) {
  .action-bar { flex-direction: column; }
  .btn-lg { width: 100%; }
  .platform-grid { grid-template-columns: 1fr; }
  .header-actions .btn-sm:not(.lang-toggle) { display: none; }
  .ai-toolbar { gap: 4px; }
  .chat-msg { max-width: 95%; }
}
@media (max-width: 768px) {
  .action-bar { position: sticky; bottom: 0; z-index: 100; background: var(--bg-primary); padding: 12px 0; border-top: 1px solid rgba(255,255,255,0.1); }
}
