/* ===== 北抖AI H5 · 设计规范（对齐小程序现版） =====
   文字 #1D1D1F · 次级 #7A7A7A · 弱 #B0B0B8 · 卡片 #F5F5F7 · 主色 #4F46E5 · 辅 #6E5BFF
   成功 #22A06B · 危险 #FF3B30 · 页面底 #F7F7F9 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; } /* 遮罩类元素 display:flex 会顶掉 hidden 属性，必须强制 */
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  background: #E9E9EE; color: #1D1D1F; font-size: 15px; line-height: 1.5;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; background: #F7F7F9; position: relative; display: flex; flex-direction: column; }
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: 0; background: none; cursor: pointer; color: inherit; }
img, video { display: block; max-width: 100%; }
.muted { color: #7A7A7A; }
.small { font-size: 12px; }

/* ===== 顶栏 ===== */
.hdr {
  position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #EFEFF2;
}
.hdr .back { font-size: 22px; line-height: 1; width: 28px; color: #1D1D1F; }
.hdr .t { font-size: 17px; font-weight: 600; }
.hdr .sp { flex: 1; }
.hdr .logo { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; }
.hdr .sub { font-size: 11px; color: #7A7A7A; }

/* ===== 通用卡片 / 区块 ===== */
.page { padding: 14px 16px; }
.card { background: #fff; border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.card.tight { padding: 12px 14px; }
.sec-h { font-size: 13px; font-weight: 600; color: #7A7A7A; margin: 4px 2px 8px; }
.btn {
  display: block; width: 100%; padding: 14px; border-radius: 14px; font-size: 16px; font-weight: 600;
  background: #4F46E5; color: #fff; text-align: center; transition: opacity .15s;
}
.btn:active { opacity: .85; }
.btn[disabled] { opacity: .45; }
.btn.ghost { background: #fff; color: #1D1D1F; border: 1px solid #E4E4EA; }
.btn.black { background: #1D1D1F; }
.btn.mini { display: inline-block; width: auto; padding: 7px 14px; font-size: 13px; border-radius: 10px; }
.link { color: #4F46E5; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: #F3F1FF; color: #4F46E5; }
.tag.ok { background: #EAF7EE; color: #22A06B; }
.tag.warn { background: #FFF3E0; color: #C77700; }
.tag.err { background: #FFECEC; color: #FF3B30; }
.tag.off { background: #F0F0F2; color: #8A8A94; }

/* ===== 开关 ===== */
.switch { width: 46px; height: 27px; border-radius: 14px; background: #E4E4EA; position: relative; transition: background .2s; flex: none; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 23px; height: 23px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: #22A06B; }
.switch.on .knob { left: 21px; }

/* ===== 输入 ===== */
.input, .textarea {
  width: 100%; border: 1px solid #E4E4EA; border-radius: 12px; padding: 12px 14px; font-size: 15px;
  background: #FAFAFC; outline: none; font-family: inherit; color: #1D1D1F;
}
.input:focus, .textarea:focus { border-color: #4F46E5; background: #fff; }
.textarea { min-height: 88px; resize: vertical; }
input[type=file] { display: none; }

/* ===== TabBar ===== */
.tabbar {
  position: sticky; bottom: 0; z-index: 20; display: flex; background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid #EFEFF2; padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar.hidden { display: none; }
.tabbar .ti { flex: 1; text-align: center; font-size: 11px; color: #8A8A94; }
.tabbar .ti svg { width: 24px; height: 24px; display: block; margin: 0 auto 2px; }
.tabbar .ti.on { color: #4F46E5; font-weight: 600; }

/* ===== 广场 ===== */
.plaza-tabs { display: flex; gap: 18px; padding: 12px 16px 4px; font-size: 17px; font-weight: 600; color: #8A8A94; }
.plaza-tabs .on { color: #1D1D1F; position: relative; }
.plaza-tabs .on::after { content: ''; position: absolute; left: 20%; right: 20%; bottom: -4px; height: 3px; border-radius: 2px; background: #4F46E5; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 14px; border-radius: 16px; background: #fff; color: #5A5A66; font-size: 13px; }
.chip.on { background: #1D1D1F; color: #fff; }
.waterfall { display: flex; gap: 10px; padding: 8px 16px 16px; align-items: flex-start; }
.wcol { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.tcard { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.tcard .cover { position: relative; width: 100%; background: #0B0B0F; border-radius: 0; overflow: hidden; }
.tcard .cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
.tcard .cover video { width: 100%; height: 100%; position: absolute; top: 0; left: 0; object-fit: contain; }
.tcard .ratio916 { padding-top: 177.78%; }
.tcard .play-badge {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; padding: 4px 9px; border-radius: 12px; display: flex; align-items: center; gap: 4px;
}
.tcard .star { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; }
.tcard .star img { width: 16px; height: 16px; position: static; }
.tcard .meta { padding: 10px 12px 12px; }
.tcard .name { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.tcard .go { display: block; width: 100%; padding: 8px; border-radius: 10px; background: #4F46E5; color: #fff; font-size: 13px; font-weight: 600; text-align: center; }
.tcard.disabled .go { background: #B0B0B8; }
.aspect-tag { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.45); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 8px; }

/* ===== 上传 ===== */
.up-box { background: #fff; border-radius: 16px; padding: 14px; text-align: center; border: 1.5px dashed #D9D9E0; }
.up-box.filled { border-style: solid; }
.up-box .plus { font-size: 34px; color: #B0B0B8; line-height: 1.2; }
.up-box .tip { font-size: 13px; color: #7A7A7A; margin-top: 4px; }
.up-preview { width: 100%; border-radius: 12px; overflow: hidden; background: #0B0B0F; position: relative; }
.up-preview img, .up-preview video { width: 100%; display: block; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.tpl-chip { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.tpl-chip img { width: 40px; height: 52px; border-radius: 8px; object-fit: cover; background: #F0F0F2; }

/* ===== 进度 ===== */
.progress-wrap { background: #fff; border-radius: 16px; padding: 22px 18px; text-align: center; }
.progress-bar { height: 10px; border-radius: 6px; background: #F0F0F2; overflow: hidden; margin: 18px 0 10px; }
.progress-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #4F46E5, #6E5BFF); transition: width .6s; }
.spin { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid #E4E4EA; border-top-color: #4F46E5; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 结果页 ===== */
.player { position: relative; border-radius: 18px; overflow: hidden; background: #0B0B0F; margin-bottom: 14px; }
.player video { width: 100%; display: block; max-height: 72vh; object-fit: contain; background: #0B0B0F; }
.ai-badge { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 4px 10px; border-radius: 12px; }
.copy-card { background: #fff; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.copy-card .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid #F0F0F2; }
.copy-card .row:last-child { border-bottom: 0; }
.copy-card .lbl { flex: none; width: 40px; font-size: 13px; color: #7A7A7A; padding-top: 2px; }
.copy-card .val { flex: 1; font-size: 14px; word-break: break-all; }
.copy-card .cp { flex: none; font-size: 12px; color: #4F46E5; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; }
.topics .t { background: #F3F1FF; color: #4F46E5; font-size: 12px; padding: 3px 9px; border-radius: 8px; }

/* ===== 我的 ===== */
.me-head { display: flex; align-items: center; gap: 14px; padding: 20px 16px 6px; }
.avatar { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; background: #E4E4EA; }
.quota-hero { margin: 14px 16px; background: linear-gradient(135deg, #4F46E5, #6E5BFF); border-radius: 18px; padding: 18px; color: #fff; }
.quota-hero .num { font-size: 34px; font-weight: 700; }
.asset-grid { display: flex; background: #fff; border-radius: 16px; margin: 0 16px 12px; overflow: hidden; }
.asset-grid .ai { flex: 1; text-align: center; padding: 14px 0; position: relative; }
.asset-grid .ai + .ai { border-left: 1px solid #F0F0F2; }
.asset-grid .n { font-size: 19px; font-weight: 700; }
.asset-grid .l { font-size: 12px; color: #7A7A7A; }
.menu { background: #fff; border-radius: 16px; margin: 0 16px 12px; overflow: hidden; }
.menu-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #F5F5F7; }
.menu-row:last-child { border-bottom: 0; }
.menu-row .m-label { flex: 1; font-size: 15px; }
.menu-row .arrow { color: #C4C4CC; font-size: 18px; }
.menu-row .ext { font-size: 12px; color: #B0B0B8; }

/* ===== 列表（视频/订单/素材等）===== */
.vcard { display: flex; gap: 12px; background: #fff; border-radius: 14px; padding: 10px; margin-bottom: 10px; }
.vcard .th { width: 64px; height: 96px; border-radius: 8px; background: #EDEDEF; object-fit: cover; flex: none; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.empty { text-align: center; color: #B0B0B8; padding: 48px 0 30px; font-size: 13px; }
.ledger-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid #F5F5F7; font-size: 13px; }

/* ===== 兑换 ===== */
.code-input { text-align: center; font-size: 22px; letter-spacing: 3px; font-weight: 600; text-transform: uppercase; }

/* ===== 协议 ===== */
.doc-tabs { display: flex; background: #fff; border-radius: 14px; margin: 14px 16px 6px; overflow: hidden; }
.doc-tabs .dt { flex: 1; text-align: center; padding: 11px; font-size: 14px; color: #7A7A7A; }
.doc-tabs .dt.on { background: #1D1D1F; color: #fff; border-radius: 14px; }
.doc { background: #fff; border-radius: 16px; margin: 8px 16px 16px; padding: 18px 18px 24px; }
.doc .h1 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.doc .upd { font-size: 11px; color: #B0B0B8; margin-bottom: 14px; }
.doc .h2 { font-size: 14px; font-weight: 700; margin: 14px 0 6px; }
.doc .p { font-size: 13px; color: #4A4A52; margin-bottom: 6px; }
.doc .p.warn { color: #C77700; background: #FFF8EC; border-radius: 8px; padding: 8px 10px; }

/* ===== 计划卡 ===== */
.plans { display: flex; flex-wrap: wrap; gap: 10px; }
.plan { width: calc(50% - 5px); background: #fff; border-radius: 14px; padding: 14px; position: relative; border: 1.5px solid transparent; }
.plan.on { border-color: #4F46E5; background: #F9F8FF; }
.plan .cnt { font-size: 20px; font-weight: 700; }
.plan .cnt small { font-size: 12px; font-weight: 400; color: #7A7A7A; }
.plan .price { color: #4F46E5; font-weight: 700; font-size: 16px; margin-top: 2px; }
.plan .tag { position: absolute; top: -8px; right: 8px; }

/* ===== Toast / Modal / Lightbox ===== */
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; font-size: 13px; padding: 10px 18px; border-radius: 10px;
  z-index: 90; max-width: 80vw; text-align: center;
}
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 30px; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 360px; padding: 20px; max-height: 76vh; overflow-y: auto; }
.modal .m-t { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 10px; }
.modal .m-b { font-size: 14px; color: #4A4A52; }
.modal .m-btns { display: flex; gap: 10px; margin-top: 18px; }
.modal .m-btns .btn { padding: 11px; font-size: 15px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 95; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 96vw; max-height: 88vh; border-radius: 10px; }
