/* ===== 金淘智能 — 移动端优先设计系统 v4 ===== */
:root {
  --bg: #0b1120;
  --bg2: #111827;
  --bg3: #1a2436;
  --bd: #1e2d45;
  --bdh: #2a3d5a;
  --t1: #f0f8ff;
  --t2: #8899aa;
  --t3: #5a6a7a;
  --amber: #f59e0b;
  --amber2: #fbbf24;
  --indigo: #6366f1;
  --ok: #10b981;
  --warn: #ef4444;
  --info: #3b82f6;
  --r: 12px;
  --r2: 8px;
  --sh: 0 4px 24px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--t1);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: 80px;
  position: relative;
}

/* ===== 顶部条 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11,17,32,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--bd);
  gap: 8px;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-brand { font-size: 15px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-credits {
  background: var(--bg3);
  border: 1px solid var(--bd);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--amber);
  white-space: nowrap;
}
.topbar-credits span { color: var(--t2); margin-right: 4px; font-size: 11px; }

/* ===== 底部导航 ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg2);
  border-top: 1px solid var(--bd);
  display: flex;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  max-width: 480px;
  margin: 0 auto;
}
.bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: none;
  color: var(--t2);
  font-size: 11px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.bottom-nav button .nav-icon { font-size: 20px; line-height: 1; }
.bottom-nav button.active { color: var(--amber); }

/* ===== 视图切换 ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== Hero 横幅（多模型矩阵） ===== */
.hero-banner {
  position: relative;
  margin: 12px 12px 16px;
  height: 200px;
  border-radius: var(--r);
  overflow: hidden;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
  display: flex;
  align-items: center;
  padding: 0 20px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(255,255,255,.15) 0%, transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.1) 0%, transparent 40%);
}
.hero-content { position: relative; z-index: 2; width: 100%; }
.hero-content h1 { font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.hero-content h2 { font-size: 28px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.hero-content > p { font-size: 12px; color: rgba(255,255,255,.85); margin-bottom: 16px; }
.hero-models { display: flex; gap: 8px; flex-wrap: wrap; }
.model-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  flex-direction: column;
}
.model-chip b { font-size: 8px; font-weight: 500; opacity: .8; margin-top: 2px; }

/* ===== 快捷工具 4 格 ===== */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 12px 16px;
}
.quick-card {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg3) 100%);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 80px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.quick-card:active { transform: scale(.97); }
.quick-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, transparent 50%, var(--amber) 100%);
  opacity: .15;
  border-radius: 0 var(--r) 0 100%;
}
.quick-card strong { font-size: 16px; font-weight: 700; color: var(--t1); margin-bottom: 2px; }
.quick-card small { font-size: 11px; color: var(--t2); }

/* ===== Tab 栏 ===== */
.tab-bar {
  display: flex;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--bd);
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab {
  padding: 12px 0;
  background: none;
  border: none;
  color: var(--t2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tab.active { color: var(--amber); }
.tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--amber);
  border-radius: 3px;
}

/* ===== 场景标签 ===== */
.scene-tags {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.scene-tag {
  padding: 6px 14px;
  background: var(--bg3);
  border: 1px solid var(--bd);
  border-radius: 20px;
  font-size: 13px;
  color: var(--t2);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scene-tag.active {
  background: var(--amber);
  color: #0b1120;
  border-color: var(--amber);
  font-weight: 600;
}

/* ===== 示例视频墙 ===== */
.sample-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 12px 20px;
}
.sample-card {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  /* ★ 屏外卡片不渲染，不触发图片下载 */
  content-visibility: auto;
  contain-intrinsic-size: auto 280px;
}
.sample-cover {
  width: 100%;
  aspect-ratio: 9/16;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: var(--bg3);
  overflow: hidden;
}
/* ★ <img> 替代 background-image，浏览器原生懒加载 */
.sample-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sample-img-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--bg3), var(--bg2));
}
.sample-cover-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.7) 100%);
  z-index: 1;
}
.sample-cover-text {
  position: relative;
  z-index: 2;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  width: 100%;
}
.sample-action {
  position: relative;
  z-index: 2;
  background: rgba(255,255,255,.95);
  color: #0b1120;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  margin: 0 auto 12px;
  display: block;
  text-align: center;
  width: fit-content;
}
/* 视频播放区域（懒加载） */
.sample-video-area { display: none; }
.sample-video-area video {
  width: 100%;
  max-height: 400px;
  background: #000;
  display: block;
}

/* ===== 卡片 ===== */
.card {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.card-header h2 { font-size: 16px; }
.back-btn {
  background: var(--bg3);
  border: 1px solid var(--bd);
  color: var(--t1);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--r2);
  cursor: pointer;
}

.page { padding: 16px; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--t2); margin-bottom: 6px; font-weight: 500; }
.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg3);
  border: 1px solid var(--bd);
  border-radius: var(--r2);
  color: var(--t1);
  font-size: 15px;
  outline: none;
  transition: border .15s;
  -webkit-appearance: none;
  font-family: inherit;
}
.form-input:focus { border-color: var(--amber); }
.form-input::placeholder { color: var(--t3); }
textarea.form-input { min-height: 80px; resize: vertical; }
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238899aa'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--r2);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-decoration: none;
  font-family: inherit;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--amber); color: #0b1120; }
.btn-primary:active { background: var(--amber2); }
.btn-ghost { background: var(--bg3); color: var(--t1); border: 1px solid var(--bd); }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 32px; }
.btn-block { width: 100%; }

/* ===== 登录页 ===== */
.login-page { padding: 32px 20px; text-align: center; }
.login-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--bd);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 12px;
}
.login-page h2 { font-size: 18px; margin-bottom: 4px; }
.login-page .subtitle { font-size: 13px; color: var(--t3); margin-bottom: 24px; }
.login-page .form-group { text-align: left; }
.toggle-link {
  margin-top: 16px;
  font-size: 13px;
  color: var(--indigo);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

/* ===== 我的（个人中心） ===== */
.profile-page { padding: 24px 16px; text-align: center; }
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 12px;
  border: 3px solid rgba(99,102,241,.3);
  box-shadow: 0 4px 20px rgba(99,102,241,.3);
}
.profile-page h2 { font-size: 16px; margin-bottom: 4px; font-weight: 600; }
.profile-id { font-size: 12px; color: var(--t3); margin-bottom: 20px; }
.profile-id span { color: var(--t2); font-family: monospace; }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 16px;
  text-align: center;
}
.stat-card strong { display: block; font-size: 24px; color: var(--t1); font-weight: 700; }
.stat-card span { font-size: 12px; color: var(--t3); }

.menu-card {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  margin-bottom: 12px;
  overflow: hidden;
}
.menu-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bd);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--bg3); }
.menu-icon { font-size: 18px; margin-right: 12px; width: 24px; text-align: center; }
.menu-label { flex: 1; font-size: 14px; }
.menu-arrow { color: var(--t3); font-size: 18px; }
.menu-switch {
  width: 44px;
  height: 24px;
  background: var(--amber);
  border-radius: 12px;
  position: relative;
}
.switch-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: all .2s;
}
.switch-dot.active { right: 2px; }
.switch-dot:not(.active) { right: 22px; }

/* ===== 作品列表 ===== */
.work-list { display: flex; flex-direction: column; gap: 12px; }
.work-item {
  background: var(--bg2);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  overflow: hidden;
}
.work-item video { width: 100%; max-height: 360px; background: #000; display: block; }
.work-placeholder {
  aspect-ratio: 9/16;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  color: var(--t3);
  font-size: 14px;
}
.work-info { padding: 12px; }
.work-info strong { font-size: 15px; display: inline; margin-right: 8px; }
.work-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg3);
  color: var(--t2);
  vertical-align: middle;
}
.work-prompt {
  margin-top: 8px;
  padding: 10px;
  background: var(--bg3);
  border-radius: var(--r2);
}
.work-prompt .label { font-size: 11px; color: var(--t3); text-transform: uppercase; letter-spacing: .5px; }
.work-prompt p { font-size: 13px; color: var(--t2); margin-top: 4px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.work-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.work-tags .tag {
  font-size: 11px;
  padding: 3px 8px;
  background: rgba(245,158,11,.12);
  color: var(--amber);
  border-radius: 10px;
  white-space: nowrap;
}
.work-materials { margin-top: 8px; }
.work-materials .label { font-size: 11px; color: var(--t3); display: block; margin-bottom: 4px; }
.material-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.material-thumbs img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--bd);
  cursor: pointer;
}
.work-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--bd);
}
.work-footer .meta { font-size: 12px; color: var(--t3); }
.work-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--bg2);
  border: 1px solid var(--amber);
  border-radius: var(--r2);
  padding: 10px 18px;
  font-size: 13px;
  color: var(--t1);
  box-shadow: var(--sh);
  animation: toastIn .3s ease;
  max-width: 90vw;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } }
.toast.error { border-color: var(--warn); }

/* ===== 素材预览 ===== */
.material-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.material-preview img, .material-preview video { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--bd); }
.upload-zone {
  border: 2px dashed var(--bd);
  border-radius: var(--r);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border .15s;
}
.upload-zone:active { border-color: var(--amber); }
.upload-zone strong { display: block; font-size: 14px; margin-bottom: 4px; }
.upload-zone span { font-size: 12px; color: var(--t3); }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--t3); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.hidden { display: none !important; }

/* 管理端编辑弹窗 */
.fixed { position: fixed; inset: 0; z-index: 100; }


/* ===== 示例视频预览弹窗 ===== */
.sample-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: rgba(245,158,11,.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #0b1120;
  z-index: 3;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.sample-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}
.sample-preview-box {
  width: 100%;
  max-width: 420px;
  text-align: center;
  color: #fff;
}
