/* 叙影 · AI 演说视频 */
:root {
  --bg: #14111c;
  --bg2: #1a1626;
  --card: #1e1930;
  --card2: #251f3a;
  --ln: #322a4a;
  --tx: #efeaf8;
  --sub: #9b93b5;
  --dim: #6f6788;
  --ac: #8b5cf6;
  --ac2: #c084fc;
  --ac-soft: rgba(139, 92, 246, .16);
  --ok: #4ade80;
  --bad: #f87171;
  --r: 16px;
}

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

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--tx);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

body { height: 100dvh; }

.page {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background:
    radial-gradient(80% 50% at 50% -10%, rgba(139, 92, 246, .28), transparent 62%),
    radial-gradient(60% 40% at 100% 100%, rgba(192, 132, 252, .12), transparent 60%),
    var(--bg);
}
.page.hidden { display: none; }

/* ---------- 顶栏 ---------- */
.hd {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  position: relative; z-index: 20;
}
.logo { display: flex; align-items: center; gap: 7px; color: var(--ac2); font-size: 14pt; }
.logo span { font-size: 15px; font-weight: 800; color: var(--tx); letter-spacing: 3px; }
.hd-r { margin-left: auto; display: flex; gap: 4px; }
.ico {
  width: 36px; height: 36px; border-radius: 11px; border: 1px solid transparent;
  background: none; color: var(--sub); display: grid; place-items: center; cursor: pointer;
  transition: .16s;
}
.ico:active { background: rgba(255, 255, 255, .07); }
.title-mid {
  flex: 1; min-width: 0; text-align: center; font-size: 13.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 滚动区 ---------- */
.scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 4px 16px 150px;
}

.hero { padding: 6px 2px 18px; }
.hero h1 {
  font-size: 27px; line-height: 1.32; font-weight: 800; margin: 0 0 8px;
  letter-spacing: -.3px;
  background: linear-gradient(120deg, #fff, #d8c8ff 60%, #b794f6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .sub { font-size: 12.5px; color: var(--sub); margin: 0 0 16px; letter-spacing: .4px; }

.input-wrap {
  background: rgba(32, 26, 48, .92);
  border: 1px solid var(--ln); border-radius: 18px; padding: 13px 14px 9px;
  transition: border-color .2s;
}
.input-wrap:focus-within { border-color: rgba(139, 92, 246, .7); box-shadow: 0 0 0 3px rgba(139, 92, 246, .12); }
#topic {
  width: 100%; border: none; background: none; color: var(--tx);
  font-family: inherit; font-size: 14.5px; line-height: 1.6; resize: none; outline: none;
  min-height: 58px; max-height: 150px;
}
#topic::placeholder { color: #5f577a; }
.in-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.mini {
  border: none; background: none; color: var(--ac2); font-size: 11.5px;
  font-family: inherit; padding: 2px 0; cursor: pointer;
}
.cnt { font-size: 10.5px; color: var(--dim); font-variant-numeric: tabular-nums; }

/* ---------- 块 ---------- */
.block {
  background: rgba(30, 25, 48, .72);
  border: 1px solid var(--ln); border-radius: var(--r);
  padding: 13px 13px 12px; margin-bottom: 12px;
}
.bh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 10px; }
.bt { font-size: 12.5px; font-weight: 700; letter-spacing: .3px; }
.bt .dim { font-weight: 500; color: var(--dim); margin-left: 6px; font-size: 11px; }
.ba { display: flex; gap: 10px; flex: 0 0 auto; }
.link {
  border: none; background: none; color: var(--sub); font-size: 11.5px;
  font-family: inherit; padding: 2px 0; cursor: pointer; white-space: nowrap;
}
.link.accent { color: var(--ac2); font-weight: 600; }
.tip-block { background: none; border-color: transparent; padding: 2px 4px; }

.row { display: flex; align-items: center; gap: 10px; }
.row.mt { margin-top: 10px; }
.lbl { flex: 0 0 auto; font-size: 11.5px; color: var(--sub); font-weight: 600; width: 30px; }
.grow { flex: 1; min-width: 0; }
.tiny { font-size: 11px; color: var(--dim); line-height: 1.7; }

/* ---------- 横向条 ---------- */
.style-strip, .pal-strip, .chips {
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 2px 1px 4px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent);
}
.style-strip::-webkit-scrollbar, .pal-strip::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }

.style-card {
  flex: 0 0 auto; width: 132px; border-radius: 12px; overflow: hidden;
  border: 2px solid transparent; background: #0e0b16; cursor: pointer;
  position: relative; transition: .18s;
}
.style-card canvas { display: block; width: 100%; height: auto; }
.style-card .nm {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 9.5px; color: #fff; padding: 12px 6px 4px; text-align: center;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .75));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.style-card.on { border-color: var(--ac); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }

.pal-chip {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 13px;
  border: 2px solid transparent; cursor: pointer; position: relative;
  display: grid; place-items: center; transition: .16s; overflow: hidden;
}
.pal-chip .dots { display: flex; gap: 2px; }
.pal-chip .dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.pal-chip.on { border-color: var(--ac); transform: scale(1.04); }

.chip {
  flex: 0 0 auto; border: 1px solid var(--ln); background: rgba(40, 33, 62, .8);
  color: var(--sub); border-radius: 999px; padding: 6px 12px;
  font-size: 11.5px; font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: .15s;
}
.chip.on { background: var(--ac-soft); border-color: rgba(139, 92, 246, .6); color: var(--ac2); font-weight: 700; }

/* ---------- 底部 CTA ---------- */
.foot {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 26px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(20, 17, 28, .92) 40%);
}
.cta {
  width: 100%; border: none; border-radius: 16px; padding: 15px 0;
  font-size: 15px; font-weight: 800; color: #fff; font-family: inherit;
  background: linear-gradient(120deg, #7c3aed, #a855f7 55%, #c084fc);
  box-shadow: 0 10px 28px rgba(124, 58, 237, .38);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .14s;
}
.cta:active { transform: scale(.985); }
.cta-i { font-size: 15px; }

/* ---------- 作品页 ---------- */
.stage-wrap {
  flex: 0 0 auto; margin: 6px 14px 0;
  position: relative; border-radius: 14px; overflow: hidden;
  background: #000; aspect-ratio: 16 / 9;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
}
#stage { width: 100%; height: 100%; display: block; }
.stage-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 11.5px; color: rgba(255, 255, 255, .7);
  background: rgba(0, 0, 0, .4); padding: 6px 12px; border-radius: 999px;
  pointer-events: none; transition: opacity .3s;
}

.bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 11px 16px 6px;
}
.pb {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
  border: none; background: var(--ac); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.pb.ghost { background: rgba(255, 255, 255, .07); color: var(--sub); }
.seekwrap { flex: 1; min-width: 0; }
input[type=range] { -webkit-appearance: none; width: 100%; height: 20px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; background: rgba(255, 255, 255, .16); border-radius: 2px; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--ac2); margin-top: -5px; border: none;
}
.seekinfo { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); margin-top: -2px; font-variant-numeric: tabular-nums; }

.strip {
  flex: 0 0 auto; display: flex; gap: 7px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 6px 16px 8px;
}
.strip::-webkit-scrollbar { display: none; }
.thumb {
  flex: 0 0 auto; width: 96px; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; position: relative; cursor: pointer; background: #000;
}
.thumb canvas { display: block; width: 100%; height: auto; }
.thumb .no {
  position: absolute; left: 4px; top: 3px; font-size: 8.5px; color: rgba(255, 255, 255, .85);
  background: rgba(0, 0, 0, .45); border-radius: 5px; padding: 1px 4px;
}
.thumb.on { border-color: var(--ac); }

.tools {
  flex: 0 0 auto; display: flex; gap: 6px; padding: 4px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .06);
  background: rgba(20, 17, 28, .9);
}
.tool {
  flex: 1; border: none; background: none; color: var(--sub);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px 4px; font-family: inherit; cursor: pointer; border-radius: 11px;
}
.tool span { font-size: 16px; line-height: 1; }
.tool i { font-style: normal; font-size: 10px; }
.tool.pri { color: var(--ac2); }
.tool:active { background: rgba(255, 255, 255, .06); }

/* ---------- 弹层 ---------- */
#sheet { position: fixed; inset: 0; z-index: 120; display: flex; align-items: flex-end; }
#sheet.hidden { display: none; }
.sheet-bd { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.sheet-cd {
  position: relative; width: 100%; max-height: 88dvh; overflow-y: auto;
  background: #1a1626; border-top: 1px solid var(--ln);
  border-radius: 20px 20px 0 0;
  padding: 16px 14px calc(20px + env(safe-area-inset-bottom));
  animation: up .22s ease;
  -webkit-overflow-scrolling: touch;
}
@keyframes up { from { transform: translateY(18px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.sh-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sh-t { font-size: 14.5px; font-weight: 800; }
.sh-x { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--ln); background: var(--card); color: var(--sub); font-size: 15px; cursor: pointer; }

.fld { margin-bottom: 12px; }
.fld > label { display: block; font-size: 11px; color: var(--sub); font-weight: 700; margin-bottom: 6px; letter-spacing: .4px; }
input[type=text], input[type=password], textarea.sel {
  width: 100%; border: 1px solid var(--ln); border-radius: 11px; background: #120f1c;
  color: var(--tx); font-family: inherit; font-size: 13.5px; padding: 10px 12px;
  outline: none; resize: vertical; line-height: 1.55;
}
input:focus, textarea.sel:focus { border-color: rgba(139, 92, 246, .6); }
textarea.sel::placeholder, input::placeholder { color: #5a5273; }

.btn {
  border: 1px solid var(--ln); background: var(--card2); color: var(--tx);
  border-radius: 11px; padding: 10px 14px; font-size: 12.5px; font-family: inherit;
  font-weight: 700; cursor: pointer; white-space: nowrap; transition: .14s;
}
.btn:active { transform: scale(.98); }
.btn.pri { background: linear-gradient(120deg, #7c3aed, #a855f7); border: none; color: #fff; }
.btn.ghost { background: transparent; color: var(--sub); }
.btn.sm { padding: 7px 11px; font-size: 11.5px; }
.btn.block { display: block; width: 100%; text-align: center; }
.btn.danger { color: var(--bad); border-color: rgba(248, 113, 113, .3); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.opt {
  border: 1px solid var(--ln); background: var(--card2); border-radius: 10px;
  padding: 10px 4px; font-size: 11.5px; color: var(--sub); text-align: center;
  font-family: inherit; cursor: pointer; transition: .15s;
}
.opt.on { border-color: rgba(139, 92, 246, .7); background: var(--ac-soft); color: var(--ac2); font-weight: 700; }

.hr { height: 1px; background: var(--ln); margin: 14px 0; }

/* 风格选择网格 */
.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sg-item { border-radius: 9px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: #000; position: relative; }
.sg-item canvas { display: block; width: 100%; height: auto; }
.sg-item .nm { position: absolute; left: 0; right: 0; bottom: 0; font-size: 8.5px; color: #fff; text-align: center; padding: 8px 3px 3px; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .8)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-item.on { border-color: var(--ac); }

/* 页编辑 */
.slide-edit { border: 1px solid var(--ln); border-radius: 12px; padding: 11px; margin-bottom: 9px; background: rgba(255, 255, 255, .02); }
.se-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.se-k { font-size: 10px; color: var(--ac2); font-weight: 700; letter-spacing: .5px; }
.se-i { font-size: 10px; color: var(--dim); }

/* 忙碌 */
#busy { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(10, 8, 16, .62); backdrop-filter: blur(3px); }
#busy.hidden { display: none; }
.busy-card {
  background: #1e1930; border: 1px solid var(--ln); border-radius: 18px;
  padding: 24px 26px; text-align: center; min-width: 210px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}
.spin { width: 26px; height: 26px; margin: 0 auto 14px; border: 2.5px solid #33294e; border-top-color: var(--ac2); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.bt { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.bs { font-size: 11px; color: var(--dim); min-height: 15px; }
.bbar { height: 3px; background: #33294e; border-radius: 2px; margin: 14px 0 12px; overflow: hidden; }
.bbar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #7c3aed, #c084fc); border-radius: 2px; transition: width .3s; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(8px);
  background: rgba(38, 30, 58, .98); border: 1px solid var(--ln); color: var(--tx);
  font-size: 12px; padding: 9px 16px; border-radius: 12px; max-width: 80%;
  opacity: 0; transition: .24s; pointer-events: none; z-index: 300; text-align: center; line-height: 1.5;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 启动 */
#boot {
  position: fixed; inset: 0; z-index: 400;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg); transition: opacity .35s;
}
#boot.gone { opacity: 0; pointer-events: none; }
.bl-mark { color: var(--ac2); margin-bottom: 14px; animation: br 1.9s ease-in-out infinite; }
@keyframes br { 0%, 100% { opacity: .5; transform: scale(.96); } 50% { opacity: 1; transform: scale(1); } }
.bl-t { font-size: 18px; font-weight: 800; letter-spacing: 7px; margin-bottom: 6px; }
.bl-s { font-size: 11px; color: var(--dim); }
.bl-bar { width: 96px; height: 2px; background: #33294e; border-radius: 2px; margin-top: 18px; overflow: hidden; }
.bl-bar i { display: block; width: 40%; height: 100%; background: var(--ac2); border-radius: 2px; animation: sl 1.1s ease-in-out infinite; }
@keyframes sl { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

.hidden { display: none !important; }
