/* ========== v14 幻灯成片 - VibeKnow 浅色风格 ========== */
:root {
  --bg: #f5f6f8;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fb;
  --bg-input: #f5f5f5;
  --border: #e8eaed;
  --border-light: #f0f0f0;
  --primary: #2d6a4f;
  --primary-hover: #1b4332;
  --primary-light: #f0f7f4;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent: #2d6a4f;
  --success: #22a06b;
  --danger: #dc4c4c;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
  --shadow-md: 0 2px 12px rgba(0,0,0,.08);
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  padding-bottom: 100px;
  line-height: 1.6;
}
.wrap { max-width: 560px; margin: 0 auto; }

/* ========== 顶部导航 ========== */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-bar .nav-back {
  position: absolute;
  left: 16px;
  font-size: 20px;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
}
.nav-bar .nav-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}
.nav-bar .nav-action {
  position: absolute;
  right: 16px;
  font-size: 14px;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 600;
}

/* ========== 卡片 ========== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 14px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ========== 内容输入卡片 ========== */
.input-source {
  background: #fdf2ec;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.input-source .source-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.input-source .source-text {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.input-source .source-edit {
  font-size: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

/* ========== AI 策划框 ========== */
.plan-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 14px;
  box-shadow: var(--shadow);
}
.plan-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  min-height: 120px;
}

/* ========== 参数标签 ========== */
.param-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 14px;
  padding: 0 2px;
}
.param-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  background: #f0f0f0;
  border-radius: 20px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: .15s;
  border: none;
  font-family: inherit;
}
.param-tag:active { background: #e0e0e0; }
.param-tag .tag-arrow { font-size: 11px; opacity: .6; }

/* ========== 素材提取条 ========== */
.asset-bar {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.asset-bar .asset-info { flex: 1; }
.asset-bar .asset-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.asset-bar .asset-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.asset-bar .asset-link {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

/* ========== 模式选择 ========== */
.mode-section {
  margin: 12px 14px;
}
.mode-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
}
.mode-scroll::-webkit-scrollbar { display: none; }
.mode-card {
  flex: 0 0 auto;
  width: 82px;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: .15s;
}
.mode-card:active { transform: scale(.96); }
.mode-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.mode-card .mode-icon {
  font-size: 22px;
  margin-bottom: 6px;
}
.mode-card .mode-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.mode-card.selected .mode-name { color: var(--primary); }
.mode-card.disabled { opacity: .48; cursor: not-allowed; }

/* ========== 模板选择 ========== */
.template-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 14px;
  box-shadow: var(--shadow);
}
.template-bar .tpl-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.template-bar .tpl-match {
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.template-bar .tpl-match .arrow { font-size: 12px; color: var(--text-muted); }

/* ========== 输入方式切换 ========== */
.input-tabs {
  display: flex;
  background: #f0f0f0;
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 14px;
}
.input-tab {
  flex: 1;
  padding: 9px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: .2s;
  font-weight: 600;
  border: none;
  background: transparent;
  font-family: inherit;
}
.input-tab.active {
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.input-panel { display: none; }
.input-panel.active { display: block; }

/* ========== 文本输入 ========== */
.text-input {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 14px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  min-height: 140px;
}
.text-input:focus {
  outline: none;
  border-color: var(--primary);
}
.text-input::placeholder { color: var(--text-muted); }

/* ========== 文件上传 ========== */
.file-upload {
  border: 2px dashed #ddd;
  border-radius: var(--radius-sm);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: .2s;
  background: #fafafa;
}
.file-upload:active { background: #f0f0f0; }
.file-upload.has-file {
  border-color: var(--primary);
  background: var(--primary-light);
}
.file-upload .upload-icon { font-size: 32px; margin-bottom: 8px; }
.file-upload .upload-text { font-size: 13px; color: var(--text-secondary); }
.file-upload.has-file .upload-text { color: var(--primary); font-weight: 600; }

/* ========== URL输入 ========== */
.url-input {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
}
.url-input:focus { outline: none; border-color: var(--primary); }
.url-input::placeholder { color: var(--text-muted); }

/* ========== 底部生成按钮 ========== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: #fff;
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  z-index: 100;
}
.btn-generate {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: .15s;
  font-family: inherit;
  letter-spacing: 1px;
}
.btn-generate:active { transform: scale(.98); opacity: .9; }
.btn-generate:disabled { opacity: .5; cursor: not-allowed; }

/* ========== 进度/步骤 ========== */
.progress-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin: 12px 14px;
  box-shadow: var(--shadow);
}
.progress-bar-wrap {
  height: 6px;
  background: #e8eaed;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #40916c);
  border-radius: 3px;
  transition: width .6s ease;
}

.status-list { display: flex; flex-direction: column; }
.status-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  position: relative;
}
.status-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 14px;
  top: 40px;
  width: 2px;
  height: calc(100% - 24px);
  background: #e8eaed;
}
.status-item.done:not(:last-child)::after { background: var(--success); }
.status-icon-wrap {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.status-item.done .status-icon-wrap { background: var(--success); color: #fff; }
.status-item.active .status-icon-wrap {
  background: var(--primary);
  color: #fff;
  animation: pulse-green 1.5s infinite;
}
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45,106,79,.3); }
  50% { box-shadow: 0 0 0 8px rgba(45,106,79,0); }
}
.status-text { flex: 1; padding-top: 4px; }
.status-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.status-item:not(.active):not(.done) .status-name { color: var(--text-muted); }
.status-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.progress-msg {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ========== 编辑器 ========== */
.editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px;
}
@media (min-width: 900px) {
  .editor-wrap {
    flex-direction: row;
    max-width: 1400px;
    margin: 0 auto;
  }
  .editor-left { flex: 0 0 180px; }
  .editor-center { flex: 1; }
  .editor-right { flex: 0 0 280px; }
}
.editor-left, .editor-center, .editor-right {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  overflow-y: auto;
}
.page-list { display: flex; flex-direction: column; gap: 8px; }
.page-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  background: #f8f9fb;
  border: 1.5px solid transparent;
  transition: .15s;
}
.page-item:active { background: #f0f0f0; }
.page-item.active {
  border-color: var(--primary);
  background: var(--primary-light);
}
.page-thumb {
  width: 60px;
  height: 34px;
  border-radius: 4px;
  background: #e0e0e0;
  flex-shrink: 0;
}
.page-info { flex: 1; min-width: 0; }
.page-index { font-size: 11px; color: var(--primary); font-weight: 700; }
.page-title-text {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}
.preview-frame {
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16/9;
  background: #111;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  position: relative;
}
.preview-frame.portrait { max-width: 300px; aspect-ratio: 9/16; }
.preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a2744, #0b1124);
  color: #999;
  font-size: 14px;
}
.preview-placeholder .ph-icon { font-size: 48px; margin-bottom: 12px; }
.preview-toolbar { display: flex; gap: 8px; margin-top: 14px; }
.tool-btn {
  padding: 8px 16px;
  background: #f0f0f0;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.tool-btn:active { background: #e0e0e0; }
.prop-section { margin-bottom: 14px; }
.prop-section:last-child { margin-bottom: 0; }
.prop-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}
.prop-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  margin-top: 10px;
}
.prop-label:first-child { margin-top: 0; }
.prop-input, .prop-textarea {
  width: 100%;
  font-size: 13px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
}
.prop-textarea { min-height: 60px; resize: vertical; }
.prop-input:focus, .prop-textarea:focus { outline: none; border-color: var(--primary); }

/* ========== 结果页 ========== */
.result-wrap { padding: 12px 14px; }
.result-video {
  width: 100%;
  border-radius: 12px;
  background: #000;
  display: block;
}
.result-info {
  display: flex;
  justify-content: space-around;
  margin: 16px 0;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.info-item { text-align: center; }
.info-item .info-value { font-size: 18px; font-weight: 700; color: var(--primary); }
.info-item .info-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.result-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--bg-card);
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  border: none;
  font-family: inherit;
}
.action-btn:active { background: var(--bg-card-hover); }
.action-btn .action-icon { font-size: 22px; }
.action-btn .action-text { font-size: 12px; color: var(--text-secondary); font-weight: 600; }

/* ========== Toast ========== */
.toast-wrap {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: none;
}
.toast-msg {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
  opacity: 0;
  transition: opacity .3s;
  white-space: nowrap;
}
.toast-msg.show { opacity: 1; }
.toast-msg.success { background: rgba(34,160,107,.95); }
.toast-msg.error { background: rgba(220,76,76,.95); }
.toast-msg.info { background: rgba(47,107,255,.95); }

/* ========== Loading ========== */
.loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #e0e0e0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 首页样式 ========== */
.home-hero {
  text-align: center;
  padding: 30px 20px 10px;
}
.home-hero h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.home-hero .hero-sub {
  font-size: 14px;
  color: var(--text-muted);
}
.home-features {
  margin: 12px 14px;
}
.feature-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.feature-row:last-child { border-bottom: none; }
.feature-icon { font-size: 22px; flex-shrink: 0; }
.feature-text .ft-title { font-size: 14px; font-weight: 700; }
.feature-text .ft-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ========== 选项行 ========== */
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.option-row:last-child { border-bottom: none; }
.option-label { font-size: 14px; color: var(--text-primary); }
.option-label .opt-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* 开关 */
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  background: #ddd;
  border-radius: 14px;
  cursor: pointer;
  transition: .2s;
  border: none;
  padding: 0;
}
.switch.on { background: var(--primary); }
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.switch.on::after { left: 23px; }

/* 分段选择 */
.segment {
  display: flex;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 2px;
}
.segment-btn {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: .2s;
  font-weight: 600;
  border: none;
  background: transparent;
  font-family: inherit;
}
.segment-btn.active {
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* 滑块 */
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 50%;
}
.slider-row input[type=range] {
  flex: 1;
  accent-color: var(--primary);
}
.slider-row .slider-val {
  font-size: 13px;
  color: var(--primary);
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}

/* ========== 错误 ========== */
.error-box {
  background: rgba(220,76,76,.08);
  border: 1px solid rgba(220,76,76,.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--danger);
  font-size: 13px;
  margin: 12px 14px;
}

/* ========== 素材池 ========== */
.asset-pool {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.asset-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
}
.asset-item.selected { border-color: var(--primary); }
.asset-item img { width: 100%; height: 100%; object-fit: cover; }
.asset-add {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #ddd;
  color: var(--text-muted);
  font-size: 24px;
  background: #fafafa;
}

/* ========== 网站备案信息 ========== */
.site-footer {
  padding: 8px 20px calc(22px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.8;
}
.site-footer a {
  color: inherit;
  text-decoration: none;
}
.site-footer a:hover { color: var(--primary); }
