/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    pointer-events: auto;
}

.app {
    pointer-events: auto;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

/* ==================== 顶部导航 ==================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-right {
    display: flex;
    gap: 12px;
}

/* ==================== 按钮样式 ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-optimise {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
}

.btn-optimise:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-import {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-import:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-experience {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-experience:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-generate {
    background: linear-gradient(135deg, var(--accent), #6366f1);
    color: white;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    margin-top: 16px;
}

.btn-generate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ==================== 主内容区 ==================== */
.main {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
    padding: 24px;
    flex: 1;
}

.panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-wrap: nowrap;
    gap: 16px;
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
    flex-shrink: 0;
}

.panel-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

.panel-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.input-panel,
.result-panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--bg);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.import-hint {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent);
    line-height: 1.6;
}

/* ==================== 品牌模板列表 ==================== */
.brand-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.brand-card {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.brand-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.brand-card-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.brand-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.brand-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.brand-card-info {
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.brand-card-info div {
    margin-bottom: 4px;
}

.brand-card-info label {
    font-weight: 500;
    color: var(--text-secondary);
}

/* ==================== 爆款开头模型选择器 ==================== */
.hook-models {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.hook-model {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface);
}

.hook-model:hover {
    border-color: var(--accent);
    background: var(--bg);
}

.hook-model.active {
    border-color: var(--accent);
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    transform: scale(1.02);
}

/* 选中时颜色加深 */
.hook-model[data-model="auto"].active {
    background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
}

.hook-model[data-model="question"].active {
    background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
}

.hook-model[data-model="data"].active {
    background: linear-gradient(135deg, #86efac 0%, #4ade80 100%);
}

.hook-model[data-model="benefit"].active {
    background: linear-gradient(135deg, #f9a8d4 0%, #f472b6 100%);
}

.hook-model[data-model="suspense"].active {
    background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 100%);
}

.hook-model[data-model="contrast"].active {
    background: linear-gradient(135deg, #fdba74 0%, #fb923c 100%);
}

.hook-model[data-model="scene"].active {
    background: linear-gradient(135deg, #d8b4fe 0%, #c084fc 100%);
}

.hook-model[data-model="warning"].active {
    background: linear-gradient(135deg, #fca5a5 0%, #f87171 100%);
}

.hook-model.boss-ip.active {
    background: linear-gradient(135deg, #86efac 0%, #4ade80 100%);
}

.hook-model.explorer.active {
    background: linear-gradient(135deg, #f9a8d4 0%, #f472b6 100%);
}

.hook-model.celebrity.active {
    background: linear-gradient(135deg, #fde68a 0%, #fbbf24 100%);
}

.hook-model.influencer.active {
    background: linear-gradient(135deg, #fca5a5 0%, #f87171 100%);
}

.hook-model.custom-style.active {
    background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 100%);
}

.hook-model input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.hook-model-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.hook-model-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.hook-model-desc {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.hint {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: normal;
}

/* ==================== 版本切换 ==================== */
.version-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.version-tab {
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.version-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.version-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ==================== AI修改弹窗 ==================== */
.edit-hint {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-md);
    border-left: 3px solid #f59e0b;
    line-height: 1.6;
    margin-bottom: 16px;
}

.edit-quick-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.edit-quick-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.edit-quick-btn {
    padding: 6px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.edit-quick-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}

.btn-edit {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-edit:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706, #b45309);
}

/* ==================== 自定义模型样式 ==================== */
.icon-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.icon-option {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-option:hover {
    border-color: var(--accent);
}

.icon-option.selected {
    border-color: var(--accent);
    background: var(--accent);
}

.custom-models-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.custom-model-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.custom-model-item-info {
    flex: 1;
}

.custom-model-name {
    font-weight: 500;
    color: var(--text-primary);
}

.custom-model-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.custom-model-actions {
    display: flex;
    gap: 8px;
}

.btn-sm-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* ==================== 结果展示 ==================== */
.result-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 黄金开头 */
.golden-hook {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-left: 4px solid var(--warning);
    padding: 16px;
    border-radius: var(--radius-md);
}

.golden-hook-label {
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.golden-hook-content {
    font-size: 16px;
    font-weight: 500;
    color: var(--primary);
    line-height: 1.7;
}

/* 分镜头 */
.scenes-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scene-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: all 0.2s;
}

.scene-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.scene-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.scene-number {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.scene-duration {
    font-size: 12px;
    color: var(--text-muted);
}

.scene-content {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 12px;
}

.scene-instructions {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.scene-instructions-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scene-instructions-content {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.instruction-tag {
    background: var(--bg);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.instruction-tag:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* 详细指令样式 */
.scene-instructions-content.detailed {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.scene-instructions-content.detailed .instruction-tag {
    padding: 2px 6px;
    font-size: 11px;
    gap: 2px;
}

/* 不同指令类型的颜色 */
.instruction-tag[title*="景别"],
.instruction-tag[title*="拍摄"] {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    border-color: #7dd3fc;
    color: #0369a1;
}

.instruction-tag[title*="动作"],
.instruction-tag[title*="表演"] {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #fbbf24;
    color: #92400e;
}

.instruction-tag[title*="字幕"],
.instruction-tag[title*="文字"] {
    background: linear-gradient(135deg, #fce7f3, #fbcfe8);
    border-color: #f9a8d4;
    color: #9d174d;
}

.instruction-tag[title*="转场"],
.instruction-tag[title*="过渡"] {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    border-color: #a5b4fc;
    color: #3730a3;
}

.instruction-tag[title*="速度"],
.instruction-tag[title*="播放"] {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-color: #86efac;
    color: #166534;
}

.instruction-tag[title*="BGM"],
.instruction-tag[title*="背景音乐"],
.instruction-tag[title*="音乐"] {
    background: linear-gradient(135deg, #fef9c3, #fef08a);
    border-color: #fde047;
    color: #854d0e;
}

.instruction-tag[title*="音效"],
.instruction-tag[title*="声音"] {
    background: linear-gradient(135deg, #fed7aa, #fdba74);
    border-color: #fb923c;
    color: #9a3412;
}

.instruction-tag[title*="光线"],
.instruction-tag[title*="灯光"] {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border-color: #fed7aa;
    color: #9a3412;
}

.instruction-tag[title*="调色"],
.instruction-tag[title*="色彩"] {
    background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
    border-color: #d8b4fe;
    color: #6b21a8;
}

/* 价值强化 */
.value-strength {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-left: 4px solid var(--accent);
    padding: 16px;
    border-radius: var(--radius-md);
}

.value-strength-label {
    font-size: 12px;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 8px;
}

.value-strength-content {
    font-size: 14px;
    color: var(--primary);
    line-height: 1.7;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* ==================== 弹窗 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-large {
    max-width: 700px;
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==================== 历史记录 ==================== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-item-title {
    font-weight: 500;
    color: var(--text-primary);
}

.history-item-date {
    font-size: 12px;
    color: var(--text-muted);
}

.history-item-preview {
    font-size: 13px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-model-tag {
    display: inline-block;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 6px;
}

/* ==================== 加载提示 ==================== */
.loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    padding: 30px 40px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 92, 246, 0.3);
    min-width: 280px;
}

.loading.active {
    display: flex;
}

/* 隐藏粒子容器（不再需要全屏效果） */
.loading-particles {
    display: none;
}

/* 隐藏所有粒子 */
/* Particles hidden for simpler loading display */
.loading .particle {
    display: none;
}

.loading-particles,
.loading-particles * {
    display: none;
    visibility: hidden;
}

/* 单个粒子 */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.8), rgba(59, 130, 246, 0.4));
    border-radius: 50%;
    animation: float-particle 8s infinite ease-in-out;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5), 0 0 20px rgba(59, 130, 246, 0.3);
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 7s; }
.particle:nth-child(2) { left: 20%; animation-delay: 1s; animation-duration: 9s; }
.particle:nth-child(3) { left: 30%; animation-delay: 2s; animation-duration: 6s; }
.particle:nth-child(4) { left: 40%; animation-delay: 0.5s; animation-duration: 8s; }
.particle:nth-child(5) { left: 50%; animation-delay: 1.5s; animation-duration: 7.5s; }
.particle:nth-child(6) { left: 60%; animation-delay: 2.5s; animation-duration: 8.5s; }
.particle:nth-child(7) { left: 70%; animation-delay: 0.8s; animation-duration: 6.5s; }
.particle:nth-child(8) { left: 80%; animation-delay: 1.8s; animation-duration: 7.8s; }
.particle:nth-child(9) { left: 90%; animation-delay: 2.2s; animation-duration: 8.2s; }
.particle:nth-child(10) { left: 15%; animation-delay: 0.3s; animation-duration: 9.5s; }
.particle:nth-child(11) { left: 25%; animation-delay: 1.3s; animation-duration: 6.8s; }
.particle:nth-child(12) { left: 35%; animation-delay: 2.8s; animation-duration: 8.8s; }
.particle:nth-child(13) { left: 45%; animation-delay: 0.6s; animation-duration: 7.2s; }
.particle:nth-child(14) { left: 55%; animation-delay: 1.6s; animation-duration: 8.6s; }
.particle:nth-child(15) { left: 65%; animation-delay: 2.1s; animation-duration: 6.3s; }
.particle:nth-child(16) { left: 75%; animation-delay: 0.9s; animation-duration: 9.2s; }
.particle:nth-child(17) { left: 85%; animation-delay: 1.9s; animation-duration: 7.7s; }
.particle:nth-child(18) { left: 95%; animation-delay: 2.4s; animation-duration: 8.1s; }
.particle:nth-child(19) { left: 5%; animation-delay: 0.4s; animation-duration: 7.4s; }
.particle:nth-child(20) { left: 95%; animation-delay: 1.4s; animation-duration: 8.9s; }

@keyframes float-particle {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* Loading animations enabled */
.loading-spinner,
.loading-core,
.loading-scanline {
    animation: unset;
    transform: unset;
    opacity: unset;
    display: unset;
}

/* 科技感核心动画 */
.loading-spinner {
    width: 100px;
    height: 100px;
    position: relative;
    z-index: 1;
}

.loading-spinner::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top: 3px solid rgba(139, 92, 246, 0.8);
    border-right: 3px solid rgba(59, 130, 246, 0.6);
    border-radius: 50%;
    animation: tech-spin 1s linear infinite;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.5), inset 0 0 30px rgba(139, 92, 246, 0.2);
}

.loading-spinner::after {
    content: '';
    position: absolute;
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border: 2px solid transparent;
    border-bottom: 2px solid rgba(168, 85, 247, 0.8);
    border-left: 2px solid rgba(99, 102, 241, 0.6);
    border-radius: 50%;
    animation: tech-spin-reverse 0.8s linear infinite;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

/* 中心发光点 */
.loading-core {
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(139, 92, 246, 1) 0%, rgba(59, 130, 246, 0.6) 50%, transparent 100%);
    border-radius: 50%;
    animation: core-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.8), 0 0 60px rgba(59, 130, 246, 0.5);
}

@keyframes tech-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes tech-spin-reverse {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

@keyframes core-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
        box-shadow: 0 0 40px rgba(139, 92, 246, 0.8), 0 0 60px rgba(59, 130, 246, 0.5);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
        box-shadow: 0 0 60px rgba(139, 92, 246, 1), 0 0 80px rgba(59, 130, 246, 0.8);
    }
}

/* 扫描线效果 */
.loading-scanline {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.8), transparent);
    animation: scanline 2s linear infinite;
    opacity: 0.6;
}

@keyframes scanline {
    0% {
        transform: translateY(-50%);
        opacity: 0;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(50%);
        opacity: 0;
    }
}

.loading p {
    color: white;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    padding: 0 30px;
    animation: fade-in 0.3s ease-out;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.8), 0 0 40px rgba(59, 130, 246, 0.5);
    letter-spacing: 1px;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading p {
    color: white;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    padding: 0 30px;
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 页脚 ==================== */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.footer p {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ==================== 响应式设计 ==================== */

/* 平板端 (768px - 1024px) */
@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
    }

    .input-panel {
        max-height: none;
    }
}

/* 移动端通用 (<768px) */
@media (max-width: 768px) {
    /* 头部优化 */
    .header {
        padding: 12px 16px;
        position: relative;
    }

    .logo {
        font-size: 18px;
    }

    .logo::before {
        font-size: 20px;
    }

    .header-right {
        gap: 8px;
    }

    /* 按钮触摸优化 */
    .btn {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
        min-width: 44px;
    }

    .btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 36px;
    }

    .btn-generate {
        padding: 14px 20px;
        font-size: 16px;
        margin-top: 20px;
    }

    /* 主内容区 */
    .main {
        padding: 16px;
        gap: 16px;
    }

    .panel-header {
        padding: 14px 16px;
        flex-wrap: nowrap;
        gap: 12px;
    }

    .panel-header h2 {
        font-size: 15px;
        min-width: 0; /* 允许文本在极小屏幕上换行 */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .panel-body {
        padding: 16px;
    }

    .panel-actions {
        width: 100%;
        gap: 8px;
    }

    .panel-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .panel-header-actions {
        flex-direction: row;
        gap: 6px;
        flex-shrink: 0;
    }

    .panel-header-actions .btn {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* 表单优化 */
    .form-group {
        margin-bottom: 20px;
    }

    .form-group label {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .form-group input,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 16px;
        border-radius: var(--radius-md);
    }

    /* 防止iOS缩放 */
    .form-group input {
        font-size: 16px;
    }

    .form-group textarea {
        min-height: 100px;
    }

    /* 开头模型选择器优化 */
    .hook-models {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .hook-model {
        padding: 10px 6px;
    }

    .hook-model-icon {
        font-size: 20px;
    }

    .hook-model-name {
        font-size: 11px;
    }

    .hook-model-desc {
        font-size: 11px;
    }

    /* 结果展示优化 */
    .golden-hook,
    .value-strength {
        padding: 14px;
        border-radius: var(--radius-md);
    }

    .golden-hook-content {
        font-size: 15px;
    }

    .value-strength-content {
        font-size: 14px;
    }

    /* 分镜头优化 */
    .scene-item {
        padding: 14px;
    }

    .scene-content {
        font-size: 15px;
    }

    .scene-instructions {
        padding: 10px;
    }

    .scene-instructions-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .instruction-tag {
        font-size: 13px;
        padding: 6px 10px;
        width: 100%;
    }

    /* 弹窗优化 */
    .modal {
        padding: 16px;
    }

    .modal-content {
        max-height: calc(100vh - 32px);
        border-radius: var(--radius-lg);
    }

    .modal-large {
        max-width: 100%;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-header h3 {
        font-size: 15px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 0;
    }

    /* 模型卡片触摸优化 */
    .hook-model {
        min-height: 70px;
        position: relative;
    }

    .hook-model:active {
        transform: scale(0.98);
    }

    /* 详细剪辑指令优化 */
    .scene-instructions-content.detailed {
        gap: 3px;
    }

    .scene-instructions-content.detailed .instruction-tag {
        font-size: 10px;
        padding: 2px 5px;
    }

    /* 历史记录优化 */
    .history-item {
        padding: 14px;
    }

    .history-item-title {
        font-size: 14px;
        flex: 1;
        word-break: break-word;
    }

    .history-item-preview {
        font-size: 13px;
    }

    /* 加载提示优化 */
    .loading-spinner {
        width: 56px;
        height: 56px;
    }

    .loading p {
        font-size: 15px;
        padding: 0 20px;
        text-align: center;
    }

    /* 页脚优化 */
    .footer {
        padding: 16px;
    }

    .footer p {
        font-size: 12px;
    }
}

/* 小屏手机 (<480px) */
@media (max-width: 480px) {
    /* 头部优化 */
    .header {
        padding: 10px 12px;
    }

    .logo {
        font-size: 16px;
    }

    /* 按钮触摸反馈 */
    .header-right {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .header-right .btn {
        flex: 1;
        min-width: 0;
        padding: 10px 12px;
        font-size: 13px;
    }

    .header-right .btn:active {
        transform: scale(0.95);
    }
        width: 100%;
    }

    .header-right .btn {
        width: 100%;
        justify-content: center;
    }

    .main {
        padding: 12px;
        gap: 12px;
    }

    .panel-body {
        padding: 14px;
    }

    .btn-generate {
        padding: 14px 18px;
        font-size: 15px;
    }

    /* 开头模型选择器两列布局 */
    .hook-models {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .hook-model {
        padding: 8px 4px;
    }

    .hook-model-icon {
        font-size: 18px;
        margin-bottom: 4px;
    }

    .hook-model-name {
        font-size: 10px;
    }

    .hook-model-desc {
        display: none;
    }

    /* 分镜头指令标签布局 */
    .scene-instructions-content {
        gap: 4px;
    }

    .instruction-tag {
        font-size: 10px;
        padding: 2px 5px;
    }

    /* 空状态优化 */
    .empty-state {
        padding: 40px 16px;
    }

    .empty-icon {
        font-size: 40px;
    }
}

/* 超小屏 (<360px) */
@media (max-width: 360px) {
    .logo {
        font-size: 15px;
    }

    .main {
        padding: 10px;
    }

    .panel-header h2 {
        font-size: 14px;
    }

    .btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .scene-instructions-content {
        grid-template-columns: 1fr;
    }
}

/* 横屏模式优化 */
@media (max-height: 600px) and (orientation: landscape) {
    .header {
        padding: 8px 16px;
    }

    .logo {
        font-size: 16px;
    }

    .main {
        padding: 12px;
        gap: 12px;
    }

    .panel-header {
        padding: 10px 14px;
    }

    .panel-body {
        padding: 12px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group textarea {
        min-height: 60px;
    }

    .empty-state {
        padding: 30px 20px;
    }

    .empty-icon {
        font-size: 36px;
    }
}

/* iOS安全区域适配 */
@supports (padding: env(safe-area-inset-bottom)) {
    .modal-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .btn-generate {
        margin-bottom: env(safe-area-inset-bottom);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn:active:not(:disabled) {
        transform: scale(0.97);
        opacity: 0.9;
    }

    .btn-generate:active:not(:disabled) {
        transform: scale(0.98) translateY(-1px);
    }

    .history-item:active {
        background: var(--bg);
    }

    .scene-item:active {
        border-color: var(--accent);
        background: var(--bg);
    }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .golden-hook,
    .value-strength {
        border-left-width: 2px;
    }
}

/* ==================== 模型编辑按钮样式 ==================== */
.hook-model-edit {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.hook-model:hover .hook-model-edit {
    opacity: 1;
}

.hook-model-edit:hover {
    background: var(--accent);
    transform: scale(1.1);
}

/* 自定义模型的操作按钮 */
.custom-model-item .hook-model-delete {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2;
}

.custom-model-item:hover .hook-model-delete {
    opacity: 1;
}

.custom-model-item .hook-model-delete:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.15);
}

.custom-model-item .hook-model-edit {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2;
}

.custom-model-item .hook-model-edit:hover {
    background: var(--accent);
    transform: scale(1.15);
}

/* ==================== 模型分区样式 ==================== */
.model-section {
    margin-bottom: 20px;
}

/* 自定义模型灰色背景 */
.hook-model[data-custom="true"] {
    background: #f3f4f6;
}

.hook-model[data-custom="true"]:hover {
    background: #e5e7eb;
}

/* 基础模型默认颜色 */
.hook-model[data-model="auto"] {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.hook-model[data-model="question"] {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.hook-model[data-model="data"] {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
}

.hook-model[data-model="benefit"] {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
}

.hook-model[data-model="suspense"] {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.hook-model[data-model="contrast"] {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
}

.hook-model[data-model="scene"] {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
}

.hook-model[data-model="warning"] {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.model-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 14px;
}

.btn-delete-models {
    padding: 4px 12px;
    font-size: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    color: #ef4444;
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
}

.btn-delete-models:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05);
}

/* 管理模型弹窗操作按钮 */
.manage-models-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.manage-models-actions .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
}

/* 管理自定义模型列表 */
.delete-models-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.delete-model-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.delete-model-item:hover {
    background: var(--surface);
    border-color: var(--accent);
}

.delete-model-item-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.delete-model-item-icon {
    font-size: 20px;
}

.delete-model-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.delete-model-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.delete-model-item-actions {
    display: flex;
    gap: 8px;
}

.delete-model-item-btn {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.delete-model-item-btn.edit {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.delete-model-item-btn.edit:hover {
    background: rgba(59, 130, 246, 0.2);
}

.delete-model-item-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.delete-model-item-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
}
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 名人模型样式 */
.hook-model.celebrity {
    border: 2px solid transparent;
    background: linear-gradient(135deg, #fff5f5 0%, #fef3c7 100%);
}

.hook-model.celebrity:hover {
    border-color: #f59e0b;
    transform: translateY(-2px);
}

.hook-model.celebrity.active {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

/* 网红模型样式 */
.hook-model.influencer {
    border: 2px solid transparent;
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
}

.hook-model.influencer:hover {
    border-color: #ef4444;
    transform: translateY(-2px);
}

.hook-model.influencer.active {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fed7aa 0%, #fca5a5 100%);
}

/* 老板IP样式 */
.hook-model.boss-ip {
    border: 2px solid transparent;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
}

.hook-model.boss-ip:hover {
    border-color: #22c55e;
    transform: translateY(-2px);
}

.hook-model.boss-ip.active {
    border-color: #22c55e;
    background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
}

/* 探店达人样式 */
.hook-model.explorer {
    border: 2px solid transparent;
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
}

.hook-model.explorer:hover {
    border-color: #ec4899;
    transform: translateY(-2px);
}

.hook-model.explorer.active {
    border-color: #ec4899;
    background: linear-gradient(135deg, #fbcfe8 0%, #f9a8d4 100%);
}

/* 自定义风格样式 */
.hook-model.custom-style {
    border: 2px solid transparent;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.hook-model.custom-style:hover {
    border-color: #6366f1;
    transform: translateY(-2px);
}

.hook-model.custom-style.active {
    border-color: #6366f1;
    background: linear-gradient(135deg, #c7d2fe 0%, #a5b4fc 100%);
}

/* 优化按钮样式 */
.btn-optimize {
    background: linear-gradient(135deg, #a855f7 0%, #8b5cf6 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-optimize:hover {
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.btn-optimize:active {
    transform: translateY(0);
}

.btn-optimize:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* ==================== 生成报告样式 ==================== */
.generation-report {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-top: 20px;
    box-shadow: var(--shadow-sm);
}

.generation-report-label {
    font-size: 18px;
    font-weight: 700;
    color: #0369a1;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.generation-report-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-item {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    border-left: 3px solid #0ea5e9;
}

.report-label {
    font-weight: 600;
    color: #0369a1;
    min-width: 80px;
    flex-shrink: 0;
}

.report-value {
    color: var(--text-primary);
    flex: 1;
}

.report-value.highlight {
    color: #0284c7;
    font-weight: 600;
}

.element-tag {
    display: inline-block;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-right: 6px;
    margin-bottom: 4px;
    cursor: help;
}

/* 元素选择理由样式 */
.report-item.element-reasons {
    flex-direction: column;
    align-items: flex-start;
}

.report-item.element-reasons .report-label {
    min-width: auto;
}

.report-item.element-reasons .report-value {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.element-reason-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: var(--radius-md);
    border-left: 3px solid #f59e0b;
}

.reason-element {
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    display: inline-block;
    background: rgba(255, 255, 255, 0.6);
    padding: 3px 10px;
    border-radius: 12px;
    align-self: flex-start;
}

.reason-text {
    font-size: 13px;
    color: #78350f;
    line-height: 1.5;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .generation-report {
        padding: 16px;
        margin-top: 16px;
    }

    .generation-report-label {
        font-size: 16px;
    }

    .report-item {
        flex-direction: column;
        gap: 6px;
        padding: 10px;
    }

    .report-label {
        min-width: auto;
        font-size: 14px;
    }

    .report-value {
        font-size: 14px;
    }

    .element-tag {
        font-size: 12px;
        padding: 3px 10px;
    }
}
