/* ═══════════ 云剪 · 样式 ═══════════
   一套代码两套布局：手机 = 底部标签栏；电脑(≥900px) = 左侧导航栏
   品牌蓝 #2563EB，白卡 + 浅灰底，大字号（老板年龄层看得清）
*/

:root {
  --brand: #2563EB;
  --brand-dark: #1D4ED8;
  --brand-soft: #EFF4FF;
  --bg: #F6F8FB;
  --card: #FFFFFF;
  --text: #0F172A;
  --text-2: #475569;
  --muted: #94A3B8;
  --line: #E7ECF3;
  --ok: #10B981;
  --warn: #F59E0B;
  --danger: #EF4444;
  --r: 16px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.10);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden 属性必须高于任何 display 声明，否则 .modal{display:grid} 会把 hidden 顶掉 */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Source Han Sans SC", system-ui, sans-serif;
  font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

input, button, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { text-decoration: none; color: inherit; }

/* ═══════════ 布局骨架 ═══════════ */
.app { min-height: 100%; display: flex; }

.sidebar { display: none; }
.tabbar  { display: flex; }

.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 18px;
  background: rgba(246,248,251,.86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }

.scroll { flex: 1; padding: 4px 18px 96px; }

.view { display: none; max-width: 860px; margin: 0 auto; }
.view.on { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ═══════════ 手机底部栏 ═══════════ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px; color: var(--muted); font-size: 11px; font-weight: 500;
  transition: color .15s;
}
.tabbar a i {
  font-style: normal; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: transparent; color: var(--muted); transition: all .15s;
}
.tabbar a.on { color: var(--brand); }
.tabbar a.on i { background: var(--brand-soft); color: var(--brand); }

/* ═══════════ 电脑侧栏 ═══════════ */
@media (min-width: 900px) {
  .tabbar { display: none; }
  .main { padding-bottom: 0; }

  .sidebar {
    display: flex; flex-direction: column; gap: 8px;
    width: 236px; flex-shrink: 0;
    background: #fff; border-right: 1px solid var(--line);
    padding: 22px 14px 18px;
    position: sticky; top: 0; height: 100vh;
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
  .brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), #4F83FF);
    color: #fff; display: grid; place-items: center;
    font-size: 19px; font-weight: 800; letter-spacing: -.02em;
    box-shadow: 0 6px 16px -6px rgba(37,99,235,.55);
  }
  .brand-text { display: flex; flex-direction: column; line-height: 1.25; }
  .brand-text strong { font-size: 16px; letter-spacing: -.01em; }
  .brand-text span { font-size: 11px; color: var(--muted); }

  .sidenav { display: flex; flex-direction: column; gap: 2px; }
  .sidenav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    font-size: 14.5px; font-weight: 500; color: var(--text-2);
    transition: all .14s;
  }
  .sidenav a i {
    font-style: normal; width: 24px; height: 24px; border-radius: 7px;
    display: grid; place-items: center; font-size: 12px; font-weight: 700;
    background: #F1F5F9; color: var(--muted); transition: all .14s;
  }
  .sidenav a:hover { background: #F8FAFC; color: var(--text); }
  .sidenav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
  .sidenav a.on i { background: var(--brand); color: #fff; }

  .sidefoot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); }
  .shop-chip {
    font-size: 12.5px; color: var(--text-2); background: #F8FAFC;
    border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  .topbar { padding: 0 34px; }
  .scroll { padding: 8px 34px 56px; }
  .view { max-width: 880px; }
}

/* ═══════════ 标题区 ═══════════ */
.hero { padding: 10px 0 20px; }
.hero h1 {
  margin: 0 0 8px; font-size: 24px; line-height: 1.3;
  font-weight: 800; letter-spacing: -.025em;
}
.hero p { margin: 0; font-size: 14px; color: var(--text-2); line-height: 1.65; }
@media (min-width: 900px) {
  .hero { padding: 16px 0 26px; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 14.5px; }
}

/* ═══════════ 卡片 ═══════════ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
@media (min-width: 900px) { .card { padding: 24px; border-radius: 18px; } }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 26px 0 12px;
}
.section-head.tight { margin: 0 0 14px; }
.section-head h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.section-head .count {
  display: inline-block; min-width: 20px; padding: 1px 7px; margin-left: 4px;
  background: var(--brand-soft); color: var(--brand);
  border-radius: 20px; font-size: 12px; font-weight: 700;
}

/* ═══════════ 表单 ═══════════ */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 7px;
}
.field .req { color: var(--danger); font-weight: 500; font-size: 11.5px; margin-left: 3px; }
.field input {
  width: 100%; height: 46px; padding: 0 14px;
  background: #F8FAFC; border: 1.5px solid transparent;
  border-radius: var(--r-sm); font-size: 15.5px;
  transition: all .15s; outline: none;
}
.field input::placeholder { color: #B6C2D2; }
.field input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
.field .hint { margin: 7px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .field-row { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  padding: 8px 15px; border-radius: 20px;
  background: #F1F5F9; color: var(--text-2);
  font-size: 14px; font-weight: 500; transition: all .14s;
  border: 1.5px solid transparent;
}
.chips button:hover { background: #E8EEF7; }
.chips button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ═══════════ 按钮 ═══════════ */
.btn-primary {
  height: 50px; padding: 0 26px;
  background: var(--brand); color: #fff;
  border-radius: 12px; font-size: 16px; font-weight: 700;
  letter-spacing: .01em;
  box-shadow: 0 8px 20px -8px rgba(37,99,235,.55);
  transition: all .16s;
}
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: #C7D5EE; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; margin-top: 22px; }

.btn-ghost {
  padding: 7px 13px; border-radius: 9px;
  background: #F1F5F9; color: var(--text-2);
  font-size: 13px; font-weight: 600; transition: all .14s;
}
.btn-ghost:hover { background: #E8EEF7; color: var(--text); }

.btn-mini {
  padding: 6px 12px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12.5px; font-weight: 700;
}
.btn-mini:hover { background: #E3ECFF; }

.link { color: var(--brand); font-size: 13px; font-weight: 600; padding: 0 4px; }

/* ═══════════ 提示条 ═══════════ */
.notice {
  background: #FFFBF0; border: 1px solid #FDE9BE;
  border-radius: var(--r-sm); padding: 14px 16px;
  font-size: 13.5px; line-height: 1.7; color: #78500A;
  margin-bottom: 16px;
}
.notice strong { color: #92400E; }
.notice b { color: #92400E; font-weight: 700; }

/* ═══════════ 上传区 ═══════════ */
.uploader {
  border: 2px dashed #CBD8E8; border-radius: var(--r);
  background: #FAFCFF; padding: 34px 20px; text-align: center;
  cursor: pointer; transition: all .18s;
}
.uploader:hover, .uploader.hot {
  border-color: var(--brand); background: var(--brand-soft);
}
.uploader.hot { transform: scale(1.008); }
.up-icon {
  width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 14px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 26px; font-weight: 300;
  box-shadow: 0 8px 20px -8px rgba(37,99,235,.6);
}
.up-title { font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.up-sub { font-size: 12.5px; color: var(--muted); }

.up-queue { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.up-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 13px; font-size: 13px;
}
.up-item .bar { flex: 1; height: 4px; background: #EDF2F9; border-radius: 3px; overflow: hidden; }
.up-item .bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; border-radius: 3px; }
.up-item.ok .bar i { background: var(--ok); }
.up-item.err .bar i { background: var(--danger); }

/* ═══════════ 素材网格 ═══════════ */
.mat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
@media (min-width: 640px) { .mat-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 900px) { .mat-grid { grid-template-columns: repeat(4, 1fr); } }

.mat {
  position: relative; border-radius: 12px; overflow: hidden;
  background: #0F172A; aspect-ratio: 9/16;
  box-shadow: 0 2px 10px -4px rgba(15,23,42,.25);
}
.mat video, .mat img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mat .tags {
  position: absolute; left: 6px; right: 6px; bottom: 6px;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.mat .tags span {
  background: rgba(15,23,42,.72); color: #fff;
  font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 5px;
  backdrop-filter: blur(4px);
}
.mat .del {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(15,23,42,.65); color: #fff;
  display: grid; place-items: center; font-size: 14px; line-height: 1;
  backdrop-filter: blur(4px);
}
.mat .dur {
  position: absolute; top: 6px; left: 6px;
  background: rgba(15,23,42,.72); color: #fff;
  font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 5px;
}
.mat .by {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(16,185,129,.9); color: #fff;
  font-size: 9.5px; font-weight: 700; padding: 2px 5px; border-radius: 4px;
}

/* ═══════════ 分段控件 ═══════════ */
.seg {
  display: flex; gap: 4px; padding: 4px;
  background: #EDF2F9; border-radius: 12px; margin-bottom: 10px;
}
.seg button {
  flex: 1; padding: 10px 6px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--text-2);
  transition: all .16s;
}
.seg button.on {
  background: #fff; color: var(--brand);
  box-shadow: 0 1px 4px rgba(15,23,42,.10);
}
.type-desc { margin: 0 0 16px; font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ═══════════ 骨架列表 ═══════════ */
.skel-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.skel {
  display: flex; align-items: flex-start; gap: 12px;
  background: #fff; border: 1.5px solid var(--line);
  border-radius: var(--r-sm); padding: 14px 16px;
  transition: all .15s; text-align: left; width: 100%;
}
.skel:hover { border-color: #C7D5EE; }
.skel.on { border-color: var(--brand); background: var(--brand-soft); }
.skel .dot {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; margin-top: 2px;
  border: 2px solid #CBD5E1; transition: all .15s;
}
.skel.on .dot { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px #fff; }
.skel .s-body { flex: 1; min-width: 0; }
.skel .s-name { display: block; font-size: 14.5px; font-weight: 700; margin-bottom: 3px; }
.skel .s-desc { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.skel .s-dur {
  flex-shrink: 0; font-size: 11.5px; font-weight: 700; color: var(--brand);
  background: #fff; border-radius: 20px; padding: 2px 9px;
}

/* ═══════════ 稿件行 ═══════════ */
.script-lines { display: flex; flex-direction: column; gap: 1px; margin-bottom: 16px; }
.sline {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 11px 0; border-bottom: 1px dashed #EDF2F9;
}
.sline:last-child { border-bottom: none; }
.sline .n {
  width: 20px; height: 20px; flex-shrink: 0; border-radius: 6px;
  background: #F1F5F9; color: var(--muted);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; margin-top: 1px;
}
.sline .s-txt { flex: 1; font-size: 14.5px; line-height: 1.65; }
.sline .s-meta {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
}
.sline .s-meta em {
  font-style: normal; font-size: 11px; color: var(--muted); font-weight: 600;
}
.sline .s-meta i {
  font-style: normal; font-size: 10.5px; color: var(--brand);
  background: var(--brand-soft); padding: 1px 6px; border-radius: 4px; white-space: nowrap;
}
.sline.fixed .s-txt { font-weight: 600; }

.badge {
  font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  background: var(--brand-soft); color: var(--brand);
}
.badge.ok { background: #ECFDF5; color: #047857; }
.badge.warn { background: #FFFBEB; color: #B45309; }
.badge.err { background: #FEF2F2; color: #B91C1C; }

/* ═══════════ 生成行 ═══════════ */
.gen-row {
  display: flex; align-items: center; gap: 14px; margin-top: 20px;
  padding-top: 18px; border-top: 1px solid var(--line);
}
.count-picker { display: flex; align-items: center; gap: 10px; }
.count-picker label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.stepper {
  display: flex; align-items: center; gap: 2px;
  background: #F1F5F9; border-radius: 10px; padding: 3px;
}
.stepper button {
  width: 30px; height: 30px; border-radius: 8px;
  background: #fff; color: var(--text-2); font-size: 17px; font-weight: 600;
  display: grid; place-items: center; line-height: 1;
  box-shadow: 0 1px 2px rgba(15,23,42,.06);
}
.stepper button:hover { color: var(--brand); }
.stepper span { min-width: 26px; text-align: center; font-size: 15px; font-weight: 700; }
.gen-row .btn-primary { margin-left: auto; flex: 1; max-width: 240px; }
@media (max-width: 480px) {
  .gen-row { flex-wrap: wrap; }
  .gen-row .btn-primary { width: 100%; max-width: none; }
}

/* ═══════════ 任务项 ═══════════ */
.task-items { display: flex; flex-direction: column; gap: 8px; }
.titem {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; background: #F8FAFC; border-radius: var(--r-sm);
  font-size: 13px;
}
.titem .t-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titem .t-st { font-size: 11.5px; font-weight: 700; flex-shrink: 0; }
.titem .t-st.pending { color: var(--muted); }
.titem .t-st.rendering { color: var(--brand); }
.titem .t-st.done { color: var(--ok); }
.titem .t-st.preview { color: var(--warn); }
.titem .t-st.failed { color: var(--danger); }

/* ═══════════ 成品列表 ═══════════ */
.video-list { display: flex; flex-direction: column; gap: 12px; }
.vcard {
  display: flex; gap: 14px; align-items: flex-start;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px;
  box-shadow: var(--shadow);
}
.vcard .thumb {
  width: 88px; height: 156px; flex-shrink: 0;
  border-radius: 10px; background: #0F172A; overflow: hidden;
}
.vcard .thumb video { width: 100%; height: 100%; object-fit: cover; }
.vcard .v-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vcard .v-title { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; line-height: 1.4; }
.vcard .v-meta { font-size: 12px; color: var(--muted); margin-bottom: auto; }
.vcard .v-acts { display: flex; gap: 8px; margin-top: 10px; }

/* ═══════════ 空态 ═══════════ */
.empty {
  text-align: center; padding: 44px 20px;
  color: var(--muted); font-size: 13.5px; line-height: 1.7;
}

/* ═══════════ 弹层 ═══════════ */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-bg { position: absolute; inset: 0; background: rgba(15,23,42,.62); backdrop-filter: blur(6px); }
.modal-body {
  position: relative; background: #fff; border-radius: 18px;
  padding: 22px; max-width: 460px; width: 100%;
  max-height: 86vh; overflow: auto;
  box-shadow: 0 24px 60px -20px rgba(15,23,42,.4);
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.modal-x {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  background: #F1F5F9; color: var(--text-2);
  font-size: 19px; line-height: 1; display: grid; place-items: center;
}
.modal-body video { width: 100%; border-radius: 12px; background: #0F172A; }
.modal-body h3 { margin: 0 0 12px; font-size: 17px; }

/* ═══════════ Toast ═══════════ */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  z-index: 200; background: rgba(15,23,42,.92); color: #fff;
  padding: 11px 20px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  max-width: 84vw; text-align: center;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── 成品卡片：BGM 署名（CC BY 必须署名，直接给一句可复制的） ── */
.v-credit {
  font-size: 11.5px; line-height: 1.6; color: var(--muted);
  background: #F8FAFC; border: 1px dashed var(--line);
  border-radius: 8px; padding: 6px 8px; margin-top: 6px;
}
.v-credit b { font-weight: 600; color: #334155; }
.v-credit .link { margin-left: 4px; }

/* ── 我的声音 ── */
.voice-rec { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; }
.voice-hint { font-size: 12px; color: var(--muted); flex: 1; min-width: 160px; }
.voice-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px; background: #F8FAFC;
  border: 1px solid var(--line); border-radius: 10px;
}
.voice-bar audio { flex: 1; min-width: 180px; height: 34px; }
