:root {
  --bg: #f5f6fa;
  --bg2: #ffffff;
  --card: #ffffff;
  --card-bd: #ebedf5;
  --txt: #1a1d2b;
  --txt-dim: #7a8199;
  --primary: #7c5cff;
  --primary2: #21d4fd;
  --grad: linear-gradient(135deg, #7c5cff 0%, #21d4fd 100%);
  --danger: #ff5c7c;
  --ok: #1cd39b;
  --radius: 16px;
  --maxw: 480px;
  --shadow: 0 4px 20px rgba(124, 92, 255, .10);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--txt);
  max-width: var(--maxw); margin: 0 auto; min-height: 100vh; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ===== 页面容器 ===== */
.page {
  padding: 14px;
  min-height: 100vh;
  /* 关键：内容区底部留出 tabbar 高度 + 安全区，避免被固定底栏遮挡 */
  padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

/* ===== 通用页面头部（统一 UI） ===== */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.page-head .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-head .logo {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 auto;
  background: var(--grad); display: grid; place-items: center;
  color: #fff; font-size: 19px; font-weight: 800; box-shadow: 0 6px 16px rgba(124,92,255,.30);
}
.page-head .logo .logo-img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  border-radius: 12px; display: block;
}
.page-head .tt { display: flex; flex-direction: column; min-width: 0; }
.page-head .tt b { font-size: 17px; font-weight: 800; line-height: 1.2; }
.page-head .tt small { font-size: 11px; color: var(--txt-dim); margin-top: 1px; }
.page-head .acts { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.page-head .acts .ic {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--card);
  border: 1px solid var(--card-bd); color: var(--txt-dim); font-size: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05); transition: transform .12s, color .18s, border-color .18s;
}
.page-head .acts .ic:active { transform: scale(.92); color: var(--primary); border-color: var(--primary); }

/* 首页专用头部（沿用通用结构） */
.home-header { padding: 6px 2px 12px; }

/* ===== AI 创作头部 ===== */
.ai-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.ai-head .info { display: flex; align-items: center; gap: 12px; }
.ai-head .icon {
  width: 52px; height: 52px; border-radius: 16px;
  background: var(--grad); display: grid; place-items: center;
  font-size: 26px; box-shadow: 0 6px 18px rgba(124, 92, 255, .30);
}
.ai-head .title { font-size: 20px; font-weight: 800; }
.ai-head .sub { font-size: 12px; color: var(--txt-dim); margin-top: 2px; }
.ai-head .points {
  display: flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--card-bd); padding: 7px 12px;
  border-radius: 999px; font-size: 13px; font-weight: 700; box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.ai-head .points .bolt { color: #ffbf00; font-size: 14px; }

/* ===== Banner ===== */
.banner {
  position: relative; border-radius: 20px; overflow: hidden;
  margin-bottom: 16px; min-height: 160px; background-size: cover; background-position: center;
  box-shadow: var(--shadow);
}
.banner .mask {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(74,44,180,.82) 0%, rgba(74,44,180,.25) 70%, transparent 100%);
  padding: 22px; display: flex; flex-direction: column; justify-content: center;
}
.banner .tag {
  align-self: flex-start; background: rgba(255,255,255,.20); color: #fff;
  font-size: 11px; padding: 4px 10px; border-radius: 999px; margin-bottom: 8px; backdrop-filter: blur(4px);
}
.banner h3 { color: #fff; font-size: 22px; font-weight: 800; line-height: 1.25; }
.banner p { color: rgba(255,255,255,.85); font-size: 13px; margin-top: 6px; }
.banner .btn-go {
  align-self: flex-start; margin-top: 12px;
  background: #fff; color: var(--primary); border: none; border-radius: 999px;
  padding: 8px 18px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 4px;
}
/* banner 配图：图片直接铺满覆盖原布局，隐藏文字/遮罩/按钮 */
.banner.is-image { background-color: transparent; overflow: hidden; padding: 0; min-height: 0; }
.banner.is-image .mask,
.banner.is-image .tag,
.banner.is-image h3,
.banner.is-image p,
.banner.is-image .btn-go { display: none; }
/* 后台配图：拉满横幅宽度，高度按固定比例（避免原图过高导致间距过大），图片裁剪铺满不变形 */
.banner.is-image { aspect-ratio: 2.4 / 1; }
.banner.is-image .bn-img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: center;
  border-radius: var(--radius);
}
/* 旧背景图兜底（无 img 时）仍铺满 */
.banner.is-image { background-size: cover; background-position: center; }

/* ===== 大入口卡片 ===== */
.quick-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px;
}
/* 超宽视口：容器最大 480，仍按 2 列；极小屏自动降为 1 列，保证不拥挤 */
@media (max-width: 340px) {
  .quick-grid { grid-template-columns: 1fr; }
}
.quick-card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  border: 1px solid var(--card-bd); box-shadow: 0 2px 12px rgba(0,0,0,.04);
  display: flex; flex-direction: column; gap: 10px; cursor: pointer;
  /* 让文字卡片高度与图片卡片对齐，整体更整齐 */
  min-height: 96px; justify-content: space-between;
}
.quick-card .top { display: flex; align-items: center; justify-content: space-between; }
.quick-card .top .emoji { font-size: 28px; }
.quick-card .top .arrow {
  width: 24px; height: 24px; border-radius: 50%; background: rgba(124,92,255,.08);
  color: var(--primary); display: grid; place-items: center; font-size: 12px;
}
.quick-card h4 { font-size: 16px; font-weight: 700; }
.quick-card p { font-size: 12px; color: var(--txt-dim); }

/* 图片上传 / 后台配置图片：直接以图片覆盖原布局，无任何框架 */
.quick-card.is-image,
.quick-card.is-upload {
  position: relative; overflow: hidden; padding: 0;
  /* 用等比宽高比让图片随容器宽度自适应，不再写死高度 */
  aspect-ratio: 16 / 10; min-height: 96px;
  background: transparent; border: none; border-radius: var(--radius); box-shadow: 0 2px 12px rgba(0, 0, 0, .04);
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.quick-card.is-upload .qc-body, .quick-card.is-image .qc-body { padding: 16px; }
.quick-card.is-upload .qc-loading { padding: 24px; text-align: center; color: var(--txt-dim); font-size: 13px; }
/* 图片覆盖文字：真实 <img> 等比铺满自适应，不变形、不拉伸 */
.quick-card.has-img .qc-body { display: none; }
.quick-card.has-img .qc-img {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: center; cursor: pointer;
  /* 图片本身保持等比，宽高随卡片自适应 */
  border-radius: 0;
}

/* ===== 小入口 ===== */
.mini-row {
  display: flex; justify-content: space-around; margin-bottom: 16px;
  background: var(--card); border: 1px solid var(--card-bd); border-radius: var(--radius);
  padding: 16px 6px; box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.mini-item { text-align: center; cursor: pointer; min-width: 60px; }
.mini-item .ic {
  width: 44px; height: 44px; border-radius: 14px; margin: 0 auto 8px;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, rgba(124,92,255,.10), rgba(33,212,253,.10));
}
.mini-item span { font-size: 12px; color: var(--txt-dim); }

/* ===== 充值推广条（图片卡片） ===== */
.promo-bar {
  position: relative; overflow: hidden; cursor: pointer;
  border-radius: 16px; margin-bottom: 16px;
  background: var(--card); border: 1px solid var(--card-bd);
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
  /* 等比自适应高度，图片拉满不变形 */
   min-height: 84px;
}
.promo-bar.has-img .promo-img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: center;
  border-radius: 16px;
}
/* 未配置图片时的占位符 */
.promo-bar .promo-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  background: repeating-linear-gradient(45deg, #f1f2f8 0 12px, #e9ebf3 12px 24px);
  color: var(--txt-dim);
}
.promo-bar .promo-ph-ic { font-size: 22px; opacity: .55; }
.promo-bar .promo-ph-tx { font-size: 11px; letter-spacing: .3px; }

/* ===== 场景工具 ===== */
.section-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-hd h3 { font-size: 16px; font-weight: 800; }
.section-hd a { font-size: 12px; color: var(--txt-dim); }
.tools-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.tool-item {
  background: var(--card); border: 1px solid var(--card-bd); border-radius: 14px;
  padding: 14px 4px; text-align: center; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.03);
}
.tool-item .ic { font-size: 26px; margin-bottom: 8px; }
.tool-item span { font-size: 11px; color: var(--txt-dim); display: block; }
/* 场景工具：配置了图片则覆盖原 emoji 文字卡片 */
.tool-item.has-img { position: relative; overflow: hidden; padding: 0; aspect-ratio: 1; border: none; box-shadow: 0 2px 10px rgba(0,0,0,.03); }
.tool-item.has-img .ic,
.tool-item.has-img span { display: none; }
.tool-item.has-img .tool-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center; border-radius: 14px;
}

/* ===== 通用 ===== */
.section-title { font-size: 13px; color: var(--txt-dim); margin: 4px 2px 10px; font-weight: 600; letter-spacing: .3px; }
.section-title-act { display: flex; align-items: center; justify-content: space-between; }
.section-title-act a { font-size: 12px; color: var(--primary); font-weight: 600; letter-spacing: 0; }

/* 全部流水弹窗 */
.log-box { max-width: 420px; }
.log-bd { padding: 6px 16px 16px; max-height: 62vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.log-bd .log-item { padding: 12px 2px; }
.card {
  background: var(--card); border: 1px solid var(--card-bd);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}
.glow-card { position: relative; overflow: hidden; }

/* 输入框 */
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12px; color: var(--txt-dim); margin-bottom: 6px; }
textarea, input[type=text], input[type=password], select {
  width: 100%; background: #f8f9fc; border: 1px solid var(--card-bd);
  color: var(--txt); border-radius: 12px; padding: 12px; font-size: 14px;
  font-family: inherit; outline: none; transition: border-color .2s;
}
textarea { resize: none; min-height: 92px; }
textarea:focus, input:focus, select:focus { border-color: var(--primary); }
select { appearance: none; -webkit-appearance: none; }

/* chips 选择 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: #f4f5f9; border: 1px solid var(--card-bd); color: var(--txt-dim);
  transition: all .18s;
}
.chip.active { color: #fff; border-color: transparent; background: var(--grad); box-shadow: 0 4px 14px rgba(124,92,255,.25); }

/* 页面普通标题（命名显示） */
/* 通用内页标题（卡片式，统一视觉） */
.page-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 19px; font-weight: 800; margin: 2px 2px 16px;
}
.page-title::before {
  content: ''; width: 4px; height: 20px; border-radius: 4px;
  background: var(--grad); flex: 0 0 auto; box-shadow: 0 2px 8px rgba(124,92,255,.35);
}

/* 上传 */
.upload {
  border: 1.5px dashed var(--card-bd); border-radius: 14px; padding: 22px; text-align: center;
  cursor: pointer; transition: border-color .2s; position: relative; background: #f8f9fc;
}
.upload:active { border-color: var(--primary); }
.upload .ic { font-size: 26px; }
.upload .hint { color: var(--txt-dim); font-size: 13px; margin-top: 6px; }
.upload img { border-radius: 10px; margin-top: 10px; max-height: 160px; width: 100%; object-fit: cover; }
.upload .rm { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 8px; padding: 4px 9px; font-size: 12px; }

/* 主按钮 */
.btn {
  width: 100%; border: none; border-radius: 14px; padding: 14px; font-size: 16px; font-weight: 700;
  color: #fff; background: var(--grad); cursor: pointer;
  box-shadow: 0 8px 22px rgba(124, 92, 255, .28); transition: transform .12s, opacity .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: var(--card); border: 1px solid var(--card-bd); box-shadow: none; color: var(--txt); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; width: auto; box-shadow: none; }

/* 生成结果 */
.cr-result-hd {
  display: flex; align-items: center; gap: 8px;
  margin: 20px 2px 12px;
  font-size: 14px; font-weight: 600; color: var(--txt);
}
.cr-result-hd::before {
  content: ''; width: 4px; height: 15px; border-radius: 4px;
  background: var(--grad);
}
.cr-result-hd .cnt { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--txt-dim); }

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.result-item {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--card); border: 1px solid var(--card-bd);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1;
  transition: transform .25s ease, box-shadow .25s ease;
}
.result-item:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(124,92,255,.18); }
.result-item img {
  width: 100%; height: 100%; object-fit: contain;
  background: #f0f1f7;
  animation: imgIn .4s ease both;
}
@keyframes imgIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.result-item .dl {
  position: absolute; right: 8px; bottom: 8px;
  background: var(--grad); color: #fff;
  border: none; border-radius: 999px; padding: 7px 14px; font-size: 12px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(124,92,255,.4);
  opacity: 0; transform: translateY(6px); transition: all .25s ease;
  cursor: pointer;
}
.result-item:hover .dl { opacity: 1; transform: translateY(0); }
.result-item .dl:active { transform: scale(.94); }

/* 瀑布/网格 */
.masonry { columns: 2; column-gap: 10px; }
.masonry .item { break-inside: avoid; margin-bottom: 10px; border-radius: 12px; overflow: hidden; position: relative; border: 1px solid var(--card-bd); background: var(--card); }
.masonry .item img { width: 100%; display: block; }
.masonry .meta { padding: 8px 10px; font-size: 12px; color: var(--txt-dim); }
.masonry .meta .u { color: var(--txt); }

/* 空态 */
.empty { text-align: center; color: var(--txt-dim); padding: 50px 20px; font-size: 14px; }
.empty .em { font-size: 38px; opacity: .5; }

/* ===== 短视频去水印 ===== */
.video-page .vw-head { box-shadow: var(--shadow); margin-bottom: 12px; }
.video-page .vw-hero {
  display: flex; align-items: center; gap: 12px;
  background: var(--grad, linear-gradient(135deg, #7c5cff 0%, #21d4fd 100%));
  border-radius: 18px; padding: 18px 16px; margin-bottom: 14px;
  color: #fff; box-shadow: 0 10px 26px rgba(124, 92, 255, .25);
}
.video-page .vw-hero-ic {
  width: 46px; height: 46px; border-radius: 14px; flex: 0 0 auto;
  background: rgba(255, 255, 255, .18); display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.video-page .vw-hero-tx { display: flex; flex-direction: column; }
.video-page .vw-hero-tx b { font-size: 16px; }
.video-page .vw-hero-tx small { opacity: .85; font-size: 12px; margin-top: 2px; }
.video-page .vw-box {
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.vw-input {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg, #f5f6fa); border: 1.5px solid var(--card-bd);
  border-radius: 14px; padding: 8px 16px; transition: border-color .2s;
}
.vw-input:focus-within { border-color: var(--primary); }
.vw-link-ic { font-size: 20px; opacity: .6; }
.vw-input .inp { flex: 1; border: 0; background: transparent; padding: 14px 0; font-size: 15px; outline: none; color: var(--txt); }
.vw-input .inp[readonly] { cursor: pointer; }
.vw-paste {
  flex: 0 0 auto; font-size: 12px; font-weight: 600; color: #fff;
  background: var(--primary); border-radius: 999px; padding: 5px 12px;
  cursor: pointer; user-select: none; transition: transform .12s, opacity .2s;
}
.vw-paste:active { transform: scale(.94); opacity: .85; }
.vw-tip { min-height: 18px; color: var(--danger); font-size: 12px; margin: 8px 2px 12px; }
.vw-btn {
  width: 100%; border: 0; border-radius: 12px; padding: 13px;
  background: var(--grad, linear-gradient(135deg, #7c5cff 0%, #21d4fd 100%));
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 20px rgba(124, 92, 255, .3); transition: transform .15s, opacity .15s;
}
.vw-btn:active { transform: scale(.98); }
.vw-btn:disabled { opacity: .6; cursor: not-allowed; }
.vw-history { display: flex; flex-direction: column; gap: 10px; }
.vw-item {
  display: flex; gap: 12px;
  background: var(--card);
  border: 1px solid var(--card-bd);
  border-radius: 12px;
  padding: 10px;
  transition: transform .15s, box-shadow .15s;
}
.vw-item:active { transform: scale(.99); }
.vw-thumb {
  width: 76px; height: 100px; flex: 0 0 auto;
  border-radius: 8px; overflow: hidden; background: #f0f1f6;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.vw-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vw-thumb-ph { color: var(--txt-dim); font-size: 22px; }
.vw-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vw-title {
  font-size: 14px; font-weight: 600; color: var(--txt);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vw-author { font-size: 12px; color: var(--txt-dim); margin: 4px 0 8px; }
.vw-acts { display: flex; flex-wrap: wrap; gap: 12px; margin-top: auto; }
.vw-act {
  font-size: 12px; color: var(--primary); cursor: pointer;
  padding: 4px 10px; border: 1px solid var(--card-bd); border-radius: 8px;
  background: var(--bg, #f5f6fa); transition: background .15s;
}
.vw-act:active { background: rgba(124, 92, 255, .1); }
.vw-act:hover { text-decoration: none; }
.sec-clear { font-size: 12px; color: var(--txt-dim); cursor: pointer; }
.vw-status { margin-top: 10px; font-size: 13px; font-weight: 600; text-align: center; padding: 8px; border-radius: 10px; }
.vw-status.free { color: #16a34a; background: rgba(22, 163, 74, .1); }
.vw-status.paid { color: var(--primary); background: rgba(124, 92, 255, .08); }

/* ===== 充值页头部 ===== */
.rc-head {
  background: var(--grad); border-radius: 20px; padding: 18px 18px 16px; margin-bottom: 14px;
  box-shadow: 0 10px 26px rgba(124, 92, 255, .28); color: #fff; position: relative; overflow: hidden;
}
.rc-head::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px;
  background: rgba(255,255,255,.14); border-radius: 50%;
}
.rc-head-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.rc-title { font-size: 19px; font-weight: 800; letter-spacing: .5px; }
.rc-bal { text-align: right; }
.rc-bal-n { font-size: 26px; font-weight: 900; line-height: 1; display: block; }
.rc-bal-l { font-size: 12px; opacity: .85; }
.rc-head-sub { position: relative; z-index: 1; font-size: 12px; opacity: .9; margin-top: 10px; }

/* 公告条 */
.announce {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
  background: linear-gradient(90deg, #fff7e6 0%, #fff2d4 100%);
  border: 1px solid #ffe4b0; border-left: 4px solid #ffb020;
  border-radius: 12px; padding: 11px 13px;
}
.announce-ic { font-size: 18px; flex: 0 0 auto; }
.announce-txt { font-size: 13px; color: #7a5400; line-height: 1.45; font-weight: 600; }

/* 充值套餐 */
.pkg { display: flex; flex-wrap: wrap; gap: 8px; }
.pkg .p {
  flex: 1 1 calc(50% - 4px); background: var(--card); border: 1px solid var(--card-bd);
  border-radius: 14px; padding: 14px 10px; text-align: center; cursor: pointer; transition: transform .16s ease, box-shadow .18s, border-color .18s, background .18s; position: relative;
}
.pkg .p:hover { transform: scale(.97); }
.pkg .p:active { transform: scale(.94); }
.pkg .p.active { border-color: transparent; background: rgba(124,92,255,.08); box-shadow: 0 0 0 1.5px var(--primary) inset; }
.pkg .p.active:hover { transform: scale(.97); }
.pkg .p .price { font-size: 22px; font-weight: 800; }
.pkg .p .price small { font-size: 13px; font-weight: 500; color: var(--txt-dim); }
.pkg .p .pts { font-size: 13px; margin-top: 4px; }
.pkg .p .pts b { color: var(--ok); }
.pkg .p .pts .gift { color: var(--danger); font-style: normal; font-weight: 700; }
.pkg .p .tag { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: var(--grad); color: #fff; font-size: 11px; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }

/* 我的 */
.mine-page { padding-top: 0; background: #f5f6fa; }
.mine-hero {
  position: relative; margin: 0 -14px 0; padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 22px;
  color: #18324a; overflow: hidden;
  background: linear-gradient(180deg, #7cc3ff 0%, #b071f6b8 45%, #d4e8f7 82%, #f5f6fa 100%);
  box-shadow: none;
}
.mine-hero::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 85% -10%, rgba(255,255,255,.3), rgba(255,255,255,0) 60%);
}
.mine-hero-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; position: relative; z-index: 1; }
.mine-hero-title > span { font-size: 20px; font-weight: 800; color: #fff; }
.mine-account-btn {
  width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  border: 1px solid rgba(255,255,255,.5); border-radius: 50%; color: #fff;
  background: rgba(255,255,255,.2); cursor: pointer;
}
.mine-account-btn svg { width: 17px; height: 17px; }
.mine-account-btn:active { transform: scale(.94); background: #fff; }
.mine-page .profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; position: relative; z-index: 1; }
.mine-page .avatar {
  position: relative; width: 58px; height: 58px; border-radius: 50%; overflow: visible;
  background: #f7fbff; border: 2px solid rgba(255,255,255,.95); display: grid;
  place-items: center; font-size: 22px; font-weight: 800; color: #285f89; flex: 0 0 auto;
  box-shadow: 0 4px 14px rgba(50,100,140,.14);
}
.mine-page .avatar span { position: relative; z-index: 0; }
.mine-page .avatar img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.mine-page .avatar i {
  position: absolute; right: 0; bottom: 1px; z-index: 2; width: 12px; height: 12px;
  border-radius: 50%; background: #4d8fbe; border: 2px solid #c9e1f5;
}
.mine-page .profile-info { flex: 1; min-width: 0; }
.mine-page .profile-name { font-size: 17px; line-height: 1.3; font-weight: 750; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-page .profile-id { font-size: 11px; color: rgba(255,255,255,.82); margin-top: 4px; }
.mine-page .profile-vip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.mine-page .profile-vip .vip-tag { border: 0; font-family: inherit; cursor: pointer; white-space: nowrap; }
.mine-page .profile-expire { font-size: 10px; color: #58758d; white-space: nowrap; }
@media (max-width: 360px) {
  .mine-page .profile-head { gap: 9px; }
  .mine-page .avatar { width: 52px; height: 52px; }
  .mine-page .profile-vip .vip-tag { padding: 4px 8px; font-size: 11px; }
  .mine-page .profile-expire { font-size: 9px; }
}
.mine-balance {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px; margin-top: 6px; background: #fff; color: var(--txt);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -6px 16px rgba(60,110,150,.06);
}
.mine-balance-label { font-size: 11px; color: var(--txt-dim); }
.mine-balance-value { margin-top: 1px; font-size: 26px; line-height: 1.15; font-weight: 850; font-variant-numeric: tabular-nums; }
.mine-recharge {
  min-width: 78px; height: 36px; padding: 0 15px; border: 0; border-radius: 8px;
  color: #fff; background: #a17af5; font-size: 13px; font-weight: 750; cursor: pointer;
  box-shadow: 0 4px 12px rgba(52,122,172,.22);
}
.mine-recharge:active { transform: scale(.97); background: #286991; }
.mine-page .stats {
  position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
  margin: 0; padding: 0 10px 12px; background: #fff; color: var(--txt); border-radius: 0 0 14px 14px;
  box-shadow: 0 8px 18px rgba(60,110,150,.08);
}
.mine-page .stat { min-width: 0; padding: 10px 6px 6px; text-align: center; border-top: 1px solid var(--card-bd); }
.mine-page .stat + .stat { border-left: 1px solid var(--card-bd); }
.mine-page .stat .n { font-size: 15px; font-weight: 800; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-page .stat .l { font-size: 10px; color: var(--txt-dim); margin-top: 3px; white-space: nowrap; }
.mine-section-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 0 2px 8px; }
.mine-section-head h2 { font-size: 16px; font-weight: 800; }
.mine-section-head span { font-size: 10px; color: var(--txt-dim); }

.menu { background: var(--card); border: 1px solid var(--card-bd); border-radius: var(--radius); overflow: hidden; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--card-bd); font-size: 14px; }
.menu a:last-child { border-bottom: none; }
.menu a .mi { width: 22px; flex: 0 0 auto; text-align: center; color: var(--primary); display: grid; place-items: center; }
.menu a .mi svg { width: 18px; height: 18px; display: block; }

/* ===== 会员标签 ===== */
.vip-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 700; padding: 4px 12px;
  border-radius: 999px; color: #fff;
  background: var(--vip-bg, var(--txt-dim));
}
.vip-tag svg { width: 14px; height: 14px; stroke-width: 2.5; }
/* 未开通会员：灰色可点击标识 */
.vip-tag.vip-none {
  background: var(--txt-dim); cursor: pointer;
  opacity: .85; transition: opacity .15s, transform .12s;
}
.vip-tag.vip-none:active { opacity: .65; transform: scale(.96); }
/* 弹窗内会员列表的边距微调 */
.agree-box .vip-list { padding: 0 4px; margin: 0 -4px; }
.agree-box .vip-item .vip-name svg { color: var(--primary); }

/* 会员徽章（图片版，后台套餐配图时显示） */
.vip-badge-img {
  display: inline-block; padding: 0; border: 0; background: transparent; cursor: pointer;
  line-height: 0; border-radius: 10px; overflow: hidden;
  box-shadow: 0 4px 14px rgba(40,90,140,.18);
}
.vip-badge-img img { display: block; height: 30px; max-width: 120px; width: auto; object-fit: contain; }
.vip-badge-img:active { transform: scale(.97); }

/* 普通会员免费模块权益提示 */
.vip-free-tip {
  margin: 10px 2px 0; font-size: 12px; color: var(--txt-dim);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.vip-free-tag {
  background: rgba(51,202,187,.12); color: var(--ly-primary-d, #22a99c);
  padding: 2px 9px; border-radius: 999px; font-weight: 600; font-size: 11.5px;
}

/* 会员弹窗：当前会员信息条（文字徽章 + 到期时间） */
.vip-modal-box { max-width: 340px; }
.vip-cur {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; margin: 0 12px 10px;
  background: rgba(124,92,255,.06); border: 1px solid var(--card-bd);
  border-radius: 12px;
}
.vip-cur .vip-cur-tag { border: 0; cursor: default; }
.vip-cur .vip-cur-exp { font-size: 12px; color: var(--txt-dim); white-space: nowrap; }
/* 会员套餐列表（上下布局卡片） */
.vip-list { padding: 4px 12px; display: flex; flex-direction: column; gap: 12px; }
.vip-card {
  cursor: pointer; border-radius: 14px; overflow: hidden;
  background: var(--card); border: 1px solid var(--card-bd);
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
  transition: transform .15s, box-shadow .15s;
}
.vip-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(124,92,255,.16); }
.vip-card:active { opacity: .8; }
.vip-card .vip-card-banner { width: 100%; line-height: 0; }
.vip-card .vip-card-banner img { width: 100%; height: auto; display: block; object-fit: cover; }
.vip-card .vip-card-body {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding: 12px 16px 14px;
}
.vip-card .vip-desc {
  font-size: 12.5px; color: var(--txt-dim); line-height: 1.5; margin-bottom: 2px; text-align: center;
}
.vip-card .vip-card-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.vip-card .vip-info-row {
  justify-content: center;
}
.vip-card .vip-price-row {
  justify-content: center;
  padding-top: 4px;
  border-top: 1px solid rgba(0,0,0,.05);
}
.vip-card .vip-info { font-size: 14px; color: var(--txt-dim); font-weight: 500; }
.vip-card .vip-name {
  flex: 1; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 5px;
}
.vip-card .vip-name svg { width: 16px; height: 16px; color: #c08400; }
.vip-item .vip-info {
  font-size: 11px; color: var(--txt-dim); white-space: nowrap;
}
.vip-card .vip-price {
  font-size: 20px; font-weight: 800; color: var(--danger);
  white-space: nowrap; display: flex; align-items: center; gap: 8px;
}
.vip-card .vip-buy-tag {
  font-size: 12px; font-weight: 700; color: #fff; background: var(--primary);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(124,92,255,.3);
}
.menu a .ar { margin-left: auto; color: var(--txt-dim); }

/* 我的页：一行两列网格菜单 */
.menu.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; background: transparent; border: none; overflow: visible; }
.menu.grid a {
  flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  height: 84px; padding: 0 10px; border: 1px solid var(--card-bd); border-bottom: 1px solid var(--card-bd);
  border-radius: 14px; background: var(--card); font-size: 13px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.04); transition: transform .12s, box-shadow .15s;
}
.menu.grid a:active { transform: translateY(1px) scale(.98); box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.menu.grid a .mi { width: auto; margin-bottom: 2px; }
.menu.grid a .mi svg { width: 24px; height: 24px; }
.menu.grid a .mi img { width: 26px; height: 26px; object-fit: cover; border-radius: 7px; display: block; }
.menu.grid a .ar { margin-left: 0; font-size: 11.5px; color: var(--txt-dim); }
/* 后端上传图片的模块：只显示图片，不显示标题和图标，图片拉伸铺满格子 */
.menu.grid a.only-img { gap: 0; padding: 0; border: none; overflow: hidden; border-radius: 14px; }
.menu.grid a.only-img .mi { margin-bottom: 0; width: 100%; height: 100%; }
.menu.grid a.only-img .mi img { width: 100%; height: 100%; object-fit: fill; display: block; border-radius: 14px; }

/* 通用输入框（弹窗内使用） */
.inp {
  width: 100%; box-sizing: border-box; padding: 11px 12px;
  border: 1px solid var(--card-bd); border-radius: 10px;
  background: var(--bg); color: var(--txt); font-size: 14px; outline: none;
  transition: border-color .15s;
}
.inp:focus { border-color: var(--primary); }

/* 修改密码弹窗：图标嵌入输入框内 */
.pwd-modal .agree-bd { padding: 16px 18px 18px; }
.pwd-field {
  position: relative; margin-bottom: 12px;
}
.pwd-field svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; pointer-events: none;
  color: var(--txt-dim); opacity: .6;
}
.pwd-field .inp { padding-left: 38px; margin-bottom: 0; }
.pwd-err {
  font-size: 12px; color: var(--danger); min-height: 16px;
  margin-bottom: 8px; text-align: center;
}
.pwd-modal .btn {
  width: 100%; border-radius: 11px; padding: 13px;
  font-size: 15px; border: none; color: #fff;
  background: linear-gradient(135deg, #7c5cff, #21d4fd);
  box-shadow: 0 4px 14px rgba(124,92,255,.3);
}


/* 邀请区：分销流水子区块 */
.sub-hd { font-size: 12px; color: var(--txt-dim); margin: 12px 2px 6px; font-weight: 600; }
.sub-log { padding: 2px 14px 12px; }
.sub-log .log-item { padding: 9px 0; border-top: 1px dashed var(--card-bd); }
.sub-log .log-item:first-child { border-top: none; }
.sub-log .empty { padding: 8px 0; color: var(--txt-dim); font-size: 13px; }

/* 邀请弹窗行 */
.inv-row { padding: 12px 14px; border: 1px solid var(--card-bd); border-radius: 12px; margin: 8px 2px; background: var(--card); cursor: pointer; transition: background .15s; }
.inv-row:active { background: rgba(124,92,255,.06); }
.inv-k { font-size: 13px; color: var(--txt-dim); margin-bottom: 4px; }
.inv-v { font-size: 13px; word-break: break-all; display: flex; align-items: center; gap: 6px; }
.inv-cp { flex: 0 0 auto; color: var(--primary); font-weight: 600; border: 1px solid var(--primary); border-radius: 6px; padding: 1px 8px; font-size: 12px; }

/* 账号信息弹窗行 */
.acc-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 2px; border-bottom: 1px solid var(--card-bd); font-size: 14px; }
.acc-row:last-child { border-bottom: none; }
.acc-k { color: var(--txt-dim); flex: 0 0 auto; }
.acc-v { font-weight: 600; text-align: right; display: flex; align-items: center; gap: 6px; }

.log-item { display: flex; justify-content: space-between; padding: 11px 4px; border-bottom: 1px solid var(--card-bd); font-size: 13px; }
.log-item:last-child { border-bottom: none; }
.log-item .rmk { color: var(--txt-dim); }
.log-item .amt { font-weight: 700; }
.log-item .amt.plus { color: var(--ok); }
.log-item .amt.minus { color: var(--danger); }

/* 底部 tabbar — 参考现代 App 风格：激活项胶囊背景 + 悬浮中间按钮 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--maxw);
  display: flex; align-items: center; justify-content: space-evenly;
  background: #ffffff; z-index: 40;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -2px 12px rgba(26, 29, 43, .06);
}

/* 普通选项：图标+文字，激活时显示圆角胶囊背景 */
.tab {
  flex: 1; text-align: center; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3px 0; font-size: 10px; color: var(--txt-dim);
  transition: all .25s ease;
  /* 激活胶囊容器（默认隐藏） */
  --pill-h: 38px;
  margin-top: 0;
}
.tab .ti {
  display: block; line-height: 1.15;
  transition: all .22s ease;
  position: relative; z-index: 2;
}
.tab .ti svg {
  width: 22px; height: 22px; display: block;
  stroke: currentColor;
}
.tab span:not(.ti) {
  font-size: 10px; letter-spacing: .2px;
  transition: all .22s ease; position: relative; z-index: 2;
}

/* 激活态：圆角渐变胶囊包裹图标+文字 */
.tab.active {
  color: var(--grad, #7c5cff);
}
/* 激活态图标/文字微调 */
.tab.active .ti svg { width: 20px; height: 20px; }
.tab.active .ti { transform: translateY(-1px); }
.tab.active span:not(.ti) { font-size: 9.5px; font-weight: 600; transform: translateY(-1px); }

/* 点按反馈 */
.tab:not(.tab-mid):active { transform: scale(.93); }

/* 中间「开始创作」按钮：悬浮圆形，浮于导航栏上方 */
.tab.tab-mid {
  position: relative; top: -14px;
  flex: 0 0 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff 0%, #6d48e8 50%, #5b36db 100%);
  color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; gap: 0;
  box-shadow: 0 8px 24px rgba(124, 92, 255, .45), 0 2px 6px rgba(124, 92, 255, .25) inset;
  border: 3.5px solid #fff;
  transition: transform .2s ease, box-shadow .2s ease;
  margin: 0 4px;
}
.tab.tab-mid .ti svg { width: 26px; height: 26px; stroke-width: 2.4; }
.tab.tab-mid .ti { line-height: 1; filter: none !important; opacity: 1 !important; transform: none !important; }
.tab.tab-mid:active { transform: scale(.91); box-shadow: 0 4px 12px rgba(124, 92, 255, .5), 0 1px 3px rgba(124, 92, 255, .2) inset; }
.tab.tab-mid.active { color: #fff; }

/* toast */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.86); color: #fff; padding: 13px 22px; border-radius: 12px;
  font-size: 14px; z-index: 99; display: none; max-width: 76%; text-align: center;
  border: 1px solid rgba(255,255,255,.1);
}
/* 生成中遮罩 */
.loading { text-align: center; padding: 30px 0; color: var(--txt-dim); font-size: 14px; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--card-bd); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 登录 overlay */
.auth-mask { position: fixed; inset: 0; background: rgba(245,246,250,.96); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-box { width: 100%; max-width: 340px; position: relative; }
.auth-close { position: absolute; top: -6px; right: 0; width: 34px; height: 34px; display: grid; place-items: center; font-size: 20px; color: var(--txt-dim); cursor: pointer; border-radius: 50%; }
.auth-close:active { background: rgba(0,0,0,.06); }
.auth-box .brand { display: flex; align-items: center; justify-content: center; gap: 9px; font-weight: 800; font-size: 22px; margin-bottom: 26px; }
.auth-box .brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 18px; }
.auth-box .brand .logo-img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; display: block; }
.auth-box .card { margin-bottom: 0; }
.auth-switch { text-align: center; color: var(--primary); font-size: 13px; margin-top: 16px; cursor: pointer; }
.auth-tip { text-align: center; color: var(--txt-dim); font-size: 12px; margin-top: 10px; }
.auth-tip .agree-link { color: var(--primary); cursor: pointer; }
.mine-foot { margin-top: 18px; }

/* 登录/注册：图标嵌入输入框 */
.auth-field { position: relative; margin-bottom: 12px; }
.auth-field:last-of-type { margin-bottom: 0; }
.auth-field svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; pointer-events: none;
  color: var(--txt-dim); opacity: .55;
}
.auth-field input {
  width: 100%; box-sizing: border-box; padding: 13px 14px 13px 42px;
  border: 1px solid var(--card-bd); border-radius: 12px;
  background: var(--bg); color: var(--txt); font-size: 15px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,92,255,.12);
}
/* 算术验证码行：输入框 + 题目 + 刷新 同一行 */
.auth-cap { display: flex; align-items: center; gap: 8px; }
.auth-cap > svg { position: static; transform: none; flex: 0 0 auto; width: 18px; height: 18px; }
.auth-cap input {
  width: 110px; flex: 0 0 auto; padding: 12px 10px;
  text-align: center; font-variant-numeric: tabular-nums;
}
.auth-cap .cap-q {
  flex: 1 1 auto; font-size: 14px; font-weight: 700; color: var(--primary);
  white-space: nowrap; text-align: left; cursor: pointer; user-select: none;
  font-variant-numeric: tabular-nums; transition: opacity .15s;
}
.auth-cap .cap-q:active { opacity: .6; }
.mine-foot .sep { margin: 0 6px; color: var(--txt-dim); }

/* ===== AI 对话页 ===== */
.chat-page { display: flex; flex-direction: column; height: 100vh; padding: 0; padding-bottom: calc(86px + env(safe-area-inset-bottom,0px)); }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; margin: 6px 0 10px; border-radius: 16px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-bd); box-shadow: 0 4px 16px rgba(0,0,0,.05);
}
.chat-head .tt { font-weight: 700; font-size: 16px; }
.chat-head .back {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: rgba(124,92,255,.08); color: var(--primary);
  font-size: 22px; line-height: 1; transition: transform .12s, background .18s;
}
.chat-head .back:active { transform: scale(.9); background: rgba(124,92,255,.16); }
.chat-head .clr { font-size: 13px; color: var(--primary); cursor: pointer; white-space: nowrap; }
.chat-box { flex: 1 1 auto; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 16px; }
.chat-msg { display: flex; gap: 10px; align-items: flex-start; animation: msgIn .2s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg .avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 auto; }
.chat-msg .bubble { max-width: 76%; padding: 11px 14px; border-radius: 16px; font-size: 14px; line-height: 1.65; word-break: break-word; white-space: pre-wrap; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.chat-msg.user { flex-direction: row-reverse; }
.chat-msg.user .bubble { background: var(--grad); color: #fff; border-top-right-radius: 5px; box-shadow: 0 2px 8px rgba(124,92,255,.18); }
.chat-msg.assistant .bubble { background: var(--card); border: 1px solid var(--card-bd); border-top-left-radius: 5px; }
.chat-msg.loading .bubble { color: var(--txt-dim); font-style: italic; }
.chat-input-bar { padding: 4px 10px calc(4px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--card-bd); background: var(--card); }
.chat-input-card { background: var(--bg); border: 1px solid var(--card-bd); border-radius: 18px; padding: 5px 12px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.chat-input-card textarea { width: 100%; resize: none; border: none; background: transparent; padding: 0 2px; font-size: 15px; line-height: 1.35; max-height: 72px; font-family: inherit; outline: none; color: var(--txt); }
.chat-input-card textarea::placeholder { color: var(--txt-dim); opacity: .7; }
.chat-tools { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.chat-img-btn { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--txt-dim); cursor: pointer; background: #fff; border: 1px solid var(--card-bd); transition: transform .12s, background .18s, border-color .18s, color .18s; }
.chat-img-btn svg { display: block; }
.chat-img-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(124,92,255,.08); }
.chat-img-btn:active { transform: scale(.92); }
.chat-img-btn.has-img { border-color: var(--primary); color: var(--primary); background: rgba(124,92,255,.12); }
.msg-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.msg-imgs img { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; cursor: zoom-in; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.chat-preview { display: none; gap: 8px; padding-bottom: 8px; flex-wrap: wrap; animation: prevIn .18s ease; }
@keyframes prevIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.chat-preview .prev-item { position: relative; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.chat-preview img { width: 100%; height: 100%; object-fit: cover; }
.chat-preview .prev-del { position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; line-height: 16px; text-align: center; background: var(--danger); color: #fff; border-radius: 50%; font-size: 12px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.img-zoom-mask { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; }
.img-zoom-mask img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.chat-send { flex: 0 0 auto; border: none; background: var(--grad); color: #fff; border-radius: 16px; padding: 0 18px; height: 30px; font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .12s, opacity .18s; }
.chat-send:active { transform: scale(.95); }
.chat-send.stopping { background: var(--txt-dim); }
.chat-msg.assistant.streaming .bubble::after { content: '▋'; display: inline-block; margin-left: 2px; animation: blink 1s steps(2) infinite; color: var(--primary); }
.typing-cursor { display: inline-block; margin-left: 1px; color: var(--primary); animation: blink 1s steps(2) infinite; }
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }
.chat-msg .bubble pre.code-block { position: relative; background: var(--bg); border: 1px solid var(--card-bd); border-radius: 10px; padding: 10px 12px; margin: 8px 0; max-width: 100%; overflow-x: auto; white-space: pre; }
.chat-msg .bubble pre.code-block code { font-family: Consolas, Menlo, monospace; font-size: 13px; line-height: 1.5; color: var(--txt); }
.chat-msg .bubble pre.code-block .copy-code { position: absolute; top: 6px; right: 8px; font-size: 11px; color: var(--primary); cursor: pointer; background: var(--card); border: 1px solid var(--card-bd); border-radius: 6px; padding: 1px 7px; }
.chat-msg .bubble pre.code-block .copy-code:active { transform: scale(.95); }
.chat-actions { display: flex; gap: 10px; align-items: center; }
.chat-actions span { font-size: 12px; color: var(--txt-dim); cursor: pointer; padding: 3px 10px; border: 1px solid var(--card-bd); border-radius: 14px; }
.chat-actions span:active { transform: scale(.97); }

/* 顶部栏右侧操作组 */
.chat-head .head-actions { display: flex; align-items: center; gap: 14px; }
.chat-head .clr { font-size: 13px; color: var(--primary); cursor: pointer; white-space: nowrap; }

/* 历史会话侧边抽屉 */
.sess-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 80;
  display: none; opacity: 0; transition: opacity .28s ease;
}
.sess-mask.show { opacity: 1; }
.sess-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 80%; max-width: 340px;
  background: var(--card); z-index: 81; transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,.12);
}
.sess-drawer.open { transform: translateX(0); }
.sess-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--card-bd); font-weight: 700; font-size: 16px;
}
.sess-new {
  background: var(--grad); color: #fff; border: none; border-radius: 10px;
  padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 14px rgba(124,92,255,.25);
}
.sess-new:active { transform: scale(.96); }
.sess-list { flex: 1 1 auto; overflow-y: auto; padding: 8px 10px; }
.sess-item {
  display: flex; align-items: center; gap: 6px; padding: 12px 12px;
  border-radius: 12px; margin-bottom: 6px; cursor: pointer; transition: background .15s;
}
.sess-item:active { background: rgba(124,92,255,.06); }
.sess-item.active { background: rgba(124,92,255,.10); box-shadow: 0 0 0 1px var(--primary) inset; }
.sess-main { flex: 1 1 auto; min-width: 0; }
.sess-title {
  font-size: 14px; font-weight: 600; color: var(--txt); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.sess-meta { font-size: 11px; color: var(--txt-dim); margin-top: 3px; }
.sess-del {
  flex: 0 0 auto; width: 26px; height: 26px; line-height: 24px; text-align: center;
  border-radius: 50%; color: var(--txt-dim); font-size: 18px; cursor: pointer;
  background: rgba(0,0,0,.04); transition: background .15s, color .15s;
}
.sess-del:active { background: var(--danger); color: #fff; }
.sess-empty { padding: 50px 20px; text-align: center; color: var(--txt-dim); font-size: 13px; line-height: 1.8; }

/* ===== 创作页面（GPT Image2 风格） ===== */
.cr-page { padding: 10px 14px calc(76px + env(safe-area-inset-bottom, 0px)); }

/* 顶部品牌栏 */
.cr-hero {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-top: 4px;
}
.cr-brand { display: flex; align-items: center; gap: 10px; }
.cr-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad); display: grid; place-items: center;
  color: #fff; font-size: 17px; font-weight: 900;
  box-shadow: 0 4px 14px rgba(124,92,255,.30);
}
.cr-brand-tx { display: flex; flex-direction: column; }
.cr-brand-tx b { font-size: 15px; font-weight: 800; letter-spacing: .3px; }
.cr-brand-tx span { font-size: 11px; color: var(--txt-dim); margin-top: 1px; }
.cr-user {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  padding: 5px 10px; border-radius: 20px;
  background: rgba(124,92,255,.1); color: var(--primary); font-size: 13px; font-weight: 700;
}
.cr-user-ic { font-size: 15px; }
.cr-user-coin { font-variant-numeric: tabular-nums; }
.cr-user:active { transform: scale(.96); }
.cr-user-coin { font-variant-numeric: tabular-nums; }

/* 大标题 */
.cr-headline { margin: 28px 0 28px; text-align: center; }
.cr-headline h1 {
  font-size: 24px; font-weight: 900; line-height: 1.25;
  letter-spacing: -.3px; color: var(--txt);
}
.cr-hl-dot { color: var(--primary); }
.cr-hl-grad {
  background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.cr-headline p {
  font-size: 13px; color: var(--txt-dim); margin-top: 6px;
  line-height: 1.5;
}

/* 模块选择行 */
.cr-row { margin-bottom: 12px; }

/* 输入卡片 */
.cr-input-card {
  background: var(--card); border: 1px solid var(--card-bd);
  border-radius: var(--radius); padding: 14px; margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.05);
}
.cr-input-card textarea {
  width: 100%; min-height: 120px; max-height: 200px;
  border: none; background: transparent; padding: 0;
  font-size: 14px; line-height: 1.55; color: var(--txt);
  resize: none; outline: none; font-family: inherit;
}
.cr-input-card textarea::placeholder { color: var(--txt-dim); opacity: .6; }

/* 工具栏 */
.cr-toolbar {
  display: flex; gap: 8px; margin-top: 10px; flex-wrap: nowrap;
}
.cr-tool {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 11px; border-radius: 999px; font-size: 12px;
  background: #f4f5f9; border: 1.5px solid transparent;
  color: var(--txt-dim); cursor: pointer; transition: all .18s;
  font-family: inherit; white-space: nowrap; flex-shrink: 0;
}
.cr-tool svg { width: 14px; height: 14px; flex-shrink: 0; }
.cr-tool:active { transform: scale(.96); }
.cr-tool.active {
  background: rgba(124,92,255,.07); border-color: var(--primary);
  color: var(--primary);
}
.cr-tool-val {
  font-size: 10px; font-weight: 700; background: rgba(124,92,255,.10);
  padding: 1px 6px; border-radius: 999px; margin-left: 2px;
}

/* 上传区域 */
.cr-upload { margin-top: 10px; }
.cr-upload-ph {
  border: 1.5px dashed var(--card-bd); border-radius: 14px;
  padding: 22px; text-align: center; cursor: pointer;
  background: #f8f9fc; transition: border-color .2s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.cr-upload-ph:active { border-color: var(--primary); }
.cr-upload-ph svg { width: 28px; height: 28px; stroke: var(--txt-dim); }
.cr-upload-ph span { font-size: 13px; color: var(--txt-dim); }
.cr-upload-preview {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1.5px solid var(--primary); background: #f8f9fc;
}
.cr-upload-preview img {
  width: 100%; max-height: 180px; object-fit: cover;
  display: block; border-radius: 12px;
}
.cr-upload-preview .rm {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.60); color: #fff; border: none;
  border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}

/* 风格/尺寸面板 */
.cr-style-panel, .cr-size-panel {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid #f0f1f5;
}
.cr-style-chips, .cr-size-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
}

/* 私密开关 + 生成按钮 同一行 */
.cr-action-row {
  display: flex; align-items: center; gap: 12px; margin-top: 16px;
}
.cr-action-row .cr-private-row { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; border: none; }

/* 生成按钮（同一行内，宽度自适应、略小） */
.cr-gen-btn {
  flex: 0 0 auto; border: none; border-radius: 14px; padding: 11px 22px;
  font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap;
  background: var(--grad); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 22px rgba(124, 92, 255, .28);
  transition: transform .12s, opacity .2s;
}
.cr-gen-btn svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cr-gen-btn:active { transform: scale(.98); }
.cr-gen-btn:disabled { opacity: .6; cursor: default; }

/* 探索灵感 / 精选作品 — 区块 */
.cr-section { margin-bottom: 24px; }

/* 灵感网格 */
.cr-inspire-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.cr-inspire-item {
  cursor: pointer; border-radius: 14px; overflow: hidden;
  background: var(--card); border: 1px solid var(--card-bd);
  transition: transform .18s, box-shadow .18s;
}
.cr-inspire-item:active { transform: scale(.96); }
.cr-inspire-item:hover { box-shadow: 0 6px 18px rgba(124,92,255,.18); }
.cr-inspire-bg {
  aspect-ratio: 1; display: grid; place-items: center;
  background: #ddd; background-size: cover; background-position: center;
}
.cr-inspire-bg.cr-inspire-img { background-color: #e9ebf3; }
.cr-inspire-ph { color: #b9bdd0; font-size: 26px; }
.cr-inspire-loading, .cr-inspire-empty {
  grid-column: 1 / -1; text-align: center; color: var(--txt-dim);
  font-size: 12px; padding: 18px 0;
}
.cr-inspire-t {
  text-align: center; font-size: 11px; color: var(--txt-dim);
  padding: 6px 2px 8px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}

/* 精选作品网格 */
.cr-featured-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.cr-feat-item {
  aspect-ratio: 4/5; border-radius: 16px; overflow: hidden;
  position: relative; cursor: pointer;
  transition: transform .18s;
}
.cr-feat-item:active { transform: scale(.97); }
.cr-feat-more {
  grid-column: 1 / -1;
  text-align: center; font-size: 13px; color: var(--primary);
  padding: 10px 0; cursor: pointer; font-weight: 600;
  border: 1px solid rgba(124,92,255,.25); border-radius: 12px;
}
.cr-feat-more:active { opacity: .7; }
.cr-feat-ph {
  position: absolute; inset: 0; display: grid; place-items: center;
}
.cr-feat-ph svg { width: 32%; height: 32%; }
.cr-feat-meta {
  position: absolute; right: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,.45); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
}
.cr-feat-like { display: flex; align-items: center; gap: 3px; }

/* 精选作品：真实图片 */
.cr-feat-item { background: #e9ebf3; }
.cr-feat-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center; display: block;
}
.cr-feat-item.cr-feat-err { background: #e9ebf3; }
.cr-feat-loading, .cr-feat-empty {
  grid-column: 1 / -1; text-align: center; color: var(--txt-dim);
  font-size: 13px; padding: 28px 0;
}

/* 私密开关 */
.cr-private-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid #f0f1f5;
}
.cr-private-tx { font-size: 12.5px; color: var(--txt-dim); }
.cr-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: 0 0 auto; cursor: pointer; }
.cr-switch input { opacity: 0; width: 0; height: 0; }
.cr-switch-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: #d7dae6; transition: background .2s;
}
.cr-switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s;
}
.cr-switch input:checked + .cr-switch-track { background: var(--grad); }
.cr-switch input:checked + .cr-switch-track .cr-switch-thumb { transform: translateX(18px); }

/* 协议弹窗 */
.agree-mask { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 24px; }
.agree-box { width: 100%; max-width: 360px; max-height: 76vh; background: var(--card); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.agree-hd { padding: 16px 18px; font-size: 16px; font-weight: 800; border-bottom: 1px solid var(--card-bd); flex: 0 0 auto; }
.agree-bd { padding: 16px 18px; font-size: 13px; line-height: 1.7; color: var(--txt); overflow-y: auto; flex: 1 1 auto; }
.agree-bd img { max-width: 100%; border-radius: 8px; margin: 6px 0; }
.agree-box .btn {
  margin: 4px 18px 18px;
  flex: 0 0 auto;
  width: auto;
  align-self: stretch;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  background: var(--card);
  color: var(--primary);
  border: 1px solid var(--card-bd);
  box-shadow: none;
}
.agree-box .btn:active { transform: scale(.98); background: rgba(124,92,255,.06); }

/* 灵感全部弹窗 */
.insp-mask { padding: 18px; }
.insp-box { max-width: 420px; max-height: 80vh; }
.insp-close { float: right; cursor: pointer; color: var(--txt-dim); font-size: 18px; line-height: 1; }
.insp-bd { padding: 14px; overflow: hidden; }
.insp-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; max-height: 56vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
