/* ============================================================
   展示面制图 · 设计系统（阳光浅色 / 暖橙）
   移动端优先：手机端前台使用底部 Tab 导航，桌面端顶部导航。
   变量名与旧版兼容（--primary/--red 等），内联样式自动适配。
   ============================================================ */

:root {
  /* 品牌：浅紫罗兰主色 + 紫调近白底（编辑杂志 / 高端影棚风） */
  --primary: #6e56cf;
  --primary-dark: #5a43b8;
  --grad-main: linear-gradient(135deg, #8a6ef0 0%, #6e56cf 100%);
  --grad-soft: linear-gradient(135deg, rgba(110, 86, 207, .08), rgba(110, 86, 207, .045));
  --on-grad: #ffffff;

  /* 表面 */
  --bg: #f9f8fd;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-hover: #f6f4fd;
  --border: #e8e5f4;
  --border-strong: #d7d2ec;
  --track: #eeebf9;

  /* 文字 */
  --text: #211d33;
  --text-2: #5c5776;
  --muted: #9c96b5;

  /* 状态 */
  --green: #188f4b;  --green-bg: #e8f7ee;
  --red: #d9482f;    --red-bg: #fdeeea;
  --orange: #c07a12; --orange-bg: #fdf3e2;
  --blue: #2f6bc4;   --blue-bg: #ecf2fc;
  --gray: #837e95;   --gray-bg: #f2f1f7;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(76, 58, 150, .05), 0 12px 32px rgba(76, 58, 150, .07);
  --shadow-lift: 0 24px 56px rgba(76, 58, 150, .13), 0 4px 12px rgba(76, 58, 150, .06);
  --font: "PingFang SC", "MiSans", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --serif: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* 顶部暖阳光晕 */
body::before {
  content: "";
  position: fixed; z-index: -1; pointer-events: none;
  width: 680px; height: 420px; top: -220px; right: -140px;
  background: radial-gradient(ellipse, rgba(150, 128, 245, .11), transparent 68%);
}
body::after {
  content: "";
  position: fixed; z-index: -1; pointer-events: none;
  width: 520px; height: 380px; bottom: -200px; left: -160px;
  background: radial-gradient(ellipse, rgba(140, 120, 230, .06), transparent 68%);
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-dark); }

::selection { background: rgba(110, 86, 207, .14); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d9dce6; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c3c8d8; }

/* ============ 控件 ============ */
button {
  cursor: pointer; border: none; border-radius: 12px;
  padding: 11px 22px; font-size: 14.5px; font-weight: 600; font-family: inherit;
  background: linear-gradient(145deg, #8a6ef0 0%, #6e56cf 100%);
  color: var(--on-grad);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease, background .18s;
  letter-spacing: .02em;
  box-shadow: 0 6px 18px rgba(110, 86, 207, .18);
  position: relative;
  overflow: hidden;
}
button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}
button:active::before {
  width: 300px;
  height: 300px;
}
button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(110, 86, 207, .32);
}
button:active { transform: translateY(0) scale(.98); }
button:disabled { background: #e3e6ee; color: #a8aec0; cursor: not-allowed; transform: none; box-shadow: none; }

button.ghost {
  background: #fff; color: var(--text-2);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
button.ghost:hover { color: var(--primary); border-color: rgba(110, 86, 207, .38); background: var(--card-hover); box-shadow: none; }

button.danger { background: var(--red-bg); color: var(--red); box-shadow: none; border: 1px solid rgba(217, 72, 47, .18); }
button.danger:hover { background: #fbddd6; box-shadow: none; filter: none; }

button.green { background: var(--green-bg); color: var(--green); box-shadow: none; border: 1px solid rgba(24, 143, 75, .18); }
button.green:hover { background: #d9f0e3; box-shadow: none; filter: none; }

input, textarea, select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; outline: none; background: #ffffff; color: var(--text);
  font-family: inherit; transition: border-color .18s, box-shadow .18s;
}
input::placeholder, textarea::placeholder { color: #a9b0c0; }
input:focus, textarea:focus, select:focus {
  border-color: rgba(110, 86, 207, .42);
  box-shadow: 0 0 0 3.5px rgba(110, 86, 207, .09);
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px;
}
input[type="checkbox"] { width: auto; accent-color: var(--primary); }
input[type="file"] { color: var(--text-2); }

textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

/* ============ 通用 ============ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(76, 58, 150, .04), 0 10px 30px rgba(76, 58, 150, .06);
}
.muted { color: var(--muted); font-size: 12.5px; }

.tag {
  display: inline-block; padding: 3px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.orange { background: var(--orange-bg); color: var(--orange); }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.gray { background: var(--gray-bg); color: var(--gray); }

.section-title {
  font-size: 16.5px; font-weight: 700; margin: 26px 0 13px;
  display: flex; align-items: center; gap: 10px; letter-spacing: .01em;
}
.section-title::before {
  content: ""; width: 4px; height: 16px; border-radius: 3px;
  background: var(--grad-main); flex-shrink: 0; opacity: .9;
}
.section-title:first-child { margin-top: 0; }
/* 带步骤徽章的标题：圆徽章代替竖条 */
.section-title.step-title { margin: 0 0 4px; }
.section-title.step-title::before { display: none; }
.step {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad-main); color: #fff;
  font-size: 13px; font-weight: 700; line-height: 24px; text-align: center;
  box-shadow: 0 4px 10px rgba(110, 86, 207, .18);
}
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 14px 34px; }

.err-msg { color: var(--red); font-size: 13px; min-height: 18px; }

.mb { margin-bottom: 14px; }
.mt { margin-top: 14px; }
.flex { display: flex; gap: 10px; align-items: center; }
.right { margin-left: auto; }

.btn-sm { padding: 6px 14px; font-size: 12.5px; border-radius: 9px; font-weight: 500; box-shadow: none; }
.btn-sm.ghost, .btn-sm.danger, .btn-sm.green { border: 1px solid transparent; }
.btn-sm.ghost { border-color: var(--border-strong); }
/* 任务筛选按钮的选中态：JS 会给按钮加 .active，此前没有对应样式，点了看不出变化 */
.btn-sm.ghost.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 6px 16px rgba(110, 86, 207, .24);
}
.btn-sm.ghost.active:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

/* ============ 登录 ============ */
.auth-wrap { max-width: 420px; margin: 7vh auto 40px; padding: 0 16px; }
.auth-wrap .card { padding: 34px 28px; box-shadow: var(--shadow-lift); border: none; }
.auth-wrap .card h2 { margin-bottom: 6px; font-size: 22px; letter-spacing: .02em; }
.auth-wrap form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.auth-wrap form button { width: 100%; padding: 13px; font-size: 15.5px; margin-top: 4px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13.5px; }

.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .logo-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-brand svg { width: 36px; height: 36px; }
.auth-brand .name { font-size: 21px; font-weight: 800; letter-spacing: .05em; }
.auth-brand .slogan {
  color: var(--primary); font-size: 11.5px; margin-top: 7px;
  letter-spacing: .3em; text-indent: .3em; font-weight: 600; opacity: .75;
}

/* ============ 顶栏 ============ */
.topbar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 22px; min-height: 60px; display: flex; align-items: center; gap: 20px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .logo { font-weight: 800; font-size: 16.5px; color: var(--text); display: flex; align-items: center; gap: 9px; letter-spacing: .03em; }
.topbar .logo svg { width: 25px; height: 25px; flex-shrink: 0; }
.topbar .logo .zh { color: var(--text); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  padding: 8px 17px; border-radius: 11px; color: var(--text-2); cursor: pointer;
  font-weight: 600; transition: all .18s; font-size: 14.5px;
}
.topbar nav a.active { background: var(--grad-soft); color: var(--primary); }
.topbar nav a:hover { background: var(--grad-soft); color: var(--primary); }

.credits-pill {
  background: #f3f1fc;
  border: 1px solid #ddd6f5;
  color: #5a43b8;
  padding: 6px 16px; border-radius: 20px; font-weight: 700; font-size: 13px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.topbar .top-link {
  font-size: 13px; font-weight: 500; color: var(--muted);
  padding: 6px 8px; border-radius: 8px; transition: all .15s;
}
.topbar .top-link:hover { color: var(--primary); background: var(--grad-soft); }

/* ============ 底部 Tab（手机端） ============ */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 0 3px; border-radius: 12px;
  color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer;
  transition: color .15s;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.active { color: var(--primary); }
.tabbar a.active svg { transform: scale(1.06); }

/* ============ 布局 ============ */
.container { max-width: 1060px; margin: 0 auto; padding: 26px 16px 56px; }

/* ============ 参考图上传（图生图：自由上传 1~6 张） ============ */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.ref-add {
  min-height: 96px; border: 2px dashed #dcdfe9; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  color: var(--muted); cursor: pointer; font-size: 13px; text-align: center; padding: 12px 8px;
  background: var(--bg-soft); transition: border-color .2s, background .2s, box-shadow .2s;
}
.ref-add:hover {
  border-color: rgba(110, 86, 207, .42);
  background: #f6f4fd;
  box-shadow: 0 8px 24px rgba(110, 86, 207, .1);
}
.ref-tile { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--track); }
.ref-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-main {
  position: absolute; left: 5px; bottom: 5px; background: var(--grad-main); color: #fff;
  font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 9px;
  box-shadow: 0 2px 6px rgba(76, 58, 150, .25);
}
.ref-del {
  position: absolute; right: 5px; top: 5px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(30, 26, 45, .55); color: #fff; font-size: 13px; line-height: 22px; text-align: center;
  cursor: pointer; transition: background .15s;
}
.ref-del:hover { background: rgba(217, 72, 47, .92); }
.ref-del.armed { width: auto; padding: 0 8px; font-size: 11px; background: rgba(217, 72, 47, .95); border-radius: 11px; }

/* ============ 风格/规格选择 ============ */
.style-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  padding: 8px 17px; border-radius: 22px;
  background: var(--gray-bg); color: var(--text-2);
  cursor: pointer; font-size: 13.5px; border: 1px solid transparent;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1); user-select: none; white-space: nowrap;
  position: relative;
}
.chip:hover {
  background: #eae7f7;
  color: var(--text);
  transform: translateY(-1px);
}
.chip.active {
  background: linear-gradient(145deg, #8a6ef0 0%, #6e56cf 100%);
  color: var(--on-grad);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(110, 86, 207, .28);
  transform: scale(1.02);
  border-color: rgba(110, 86, 207, .3);
}

/* 规格分块与生成行动区 */
.spec-block { margin-bottom: 14px; }
.spec-block .muted { margin-bottom: 2px; }
.cta-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 20px; padding-top: 18px;
  border-top: 1px dashed var(--border-strong);
}
.cta-row #genBtn { padding: 13px 40px; font-size: 15.5px; border-radius: 13px; }

/* 空状态 */
.empty-tip {
  grid-column: 1 / -1; text-align: center; color: var(--muted);
  padding: 36px 16px; background: var(--bg-soft);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  font-size: 13.5px;
}

/* ============ 任务 / 作品 ============ */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 16px; }
.task-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 2px 10px rgba(76, 58, 150, .06);
  transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .25s cubic-bezier(0.4, 0, 0.2, 1), opacity .4s ease;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.task-card:nth-child(1) { animation-delay: 0.05s; }
.task-card:nth-child(2) { animation-delay: 0.1s; }
.task-card:nth-child(3) { animation-delay: 0.15s; }
.task-card:nth-child(4) { animation-delay: 0.2s; }
.task-card:nth-child(5) { animation-delay: 0.25s; }
.task-card:nth-child(6) { animation-delay: 0.3s; }
.task-card:nth-child(n+7) { animation-delay: 0.35s; }
.task-card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 16px 40px rgba(76, 58, 150, .15), 0 4px 12px rgba(110, 86, 207, .12);
}
.task-card .img-wrap {
  height: 250px; background: var(--track);
  /* 纵向排列：结果图在上、「保留 24 小时」提示条在下。不写 flex-direction 默认是 row，
     会把提示条挤成图片右侧的一条竖窄条（曾如此）。 */
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
}
/* 结果图占满提示条之外的剩余高度；min-height:0 允许它在窄屏里被压缩 */
.task-card img { width: 100%; flex: 1 1 auto; min-height: 0; object-fit: cover; }
/* 结果图下方的保留期限提示条 */
.task-card .img-note {
  flex-shrink: 0; width: 100%; font-size: 11px; color: var(--text-2); text-align: center;
  padding: 6px 8px; background: var(--bg); border-top: 1px solid var(--border);
}
/* 图片加载失败占位（cookie 身份异常时服务端返回 404，浏览器只会显示破图） */
.img-fail { color: var(--red); font-size: 12.5px; padding: 12px; text-align: center; line-height: 1.6; }
.task-card .meta { padding: 12px 14px; }

/* 结果图下载按钮（生成图保留 24 小时，引导及时保存） */
.dl-btn {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong);
  box-shadow: 0 2px 8px rgba(76, 58, 150, .18);
  transition: all .15s;
}
.dl-btn:hover { background: var(--primary); color: #fff; transform: scale(1.08); }
.dl-btn svg { width: 15px; height: 15px; }

/* 生成按钮（桌面端尺寸；手机端在媒体查询里全宽） */
#genBtn { padding: 12px 36px; font-size: 15px; }

.spinner {
  width: 32px; height: 32px; border: 3px solid #e4ddf8;
  border-top-color: var(--primary);
  border-radius: 50%; animation: spin .9s linear infinite;
}
/* 进行中任务的脉动动画 */
.task-card.processing .img-wrap {
  position: relative;
}
.task-card.processing .img-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--primary);
  border-radius: inherit;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ============ 表格 ============ */
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
th {
  background: var(--bg-soft); color: var(--muted); font-weight: 600;
  font-size: 12px; letter-spacing: .05em; white-space: nowrap;
}
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--card-hover); }
td b { color: var(--primary); font-variant-numeric: tabular-nums; }

/* 表格行内编辑（模型定价等） */
td input:not([type="checkbox"]):not([type="file"]):not(.m-name) { width: 92px; padding: 7px 10px; font-size: 13px; }
td input.m-name { width: 170px; }
td input[type="checkbox"] { width: auto; accent-color: var(--primary); transform: scale(1.15); cursor: pointer; }
td .btn-sm { margin-right: 4px; }

/* 新增模型行高亮 */
tr.m-new td { background: rgba(110, 86, 207, .05); }

/* 线性 SVG 图标（替代 emoji） */
.ico { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.sidebar a .ico { width: 17px; height: 17px; opacity: .9; }
.f-icon .ico { width: 26px; height: 26px; color: var(--primary); }

/* ============ 管理后台 ============ */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 212px; flex-shrink: 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
}
.sidebar .logo {
  font-weight: 800; padding: 6px 12px 18px; font-size: 16px;
  display: flex; align-items: center; gap: 9px; letter-spacing: .03em; color: var(--text);
}
.sidebar .logo svg { width: 25px; height: 25px; flex-shrink: 0; }
.sidebar .logo .zh { color: var(--text); }
.sidebar a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 11px; color: var(--text-2);
  margin-bottom: 2px; cursor: pointer; font-size: 14px; font-weight: 500;
  position: relative; transition: all .16s;
}
.sidebar a:hover { background: var(--grad-soft); color: var(--primary); }
.sidebar a.active {
  background: var(--grad-soft);
  color: var(--primary); font-weight: 700;
}
.sidebar a.active::before {
  content: ""; position: absolute; left: 0; top: 24%; bottom: 24%;
  width: 3.5px; border-radius: 2px; background: var(--grad-main);
}

.admin-main { flex: 1; padding: 26px 28px 60px; max-width: 1200px; min-width: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 13px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(76, 58, 150, .05);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .label { color: var(--muted); font-size: 12px; letter-spacing: .03em; }
.stat-card .value { font-size: 26px; font-weight: 800; margin-top: 7px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

.form-row { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.form-row label { width: 130px; color: var(--muted); flex-shrink: 0; font-size: 13px; }
.form-row input:not([type="checkbox"]) { width: auto; min-width: 110px; flex: 0 1 auto; }
.form-row select { width: auto; min-width: 110px; }

.ai-box {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  white-space: pre-wrap; line-height: 1.75; font-size: 13.5px; color: var(--text-2);
}

/* ---- 设置页：分组卡片 ---- */
.set-card { padding: 20px 22px 22px; }
.set-card + .set-card, .set-card + .set-actions { margin-top: 16px; }
.set-card-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px dashed var(--border);
}
.set-card-head b { font-size: 15px; letter-spacing: .02em; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 26px; }
.set-field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; letter-spacing: .02em; }
.set-field input, .set-field select { width: 100%; }
.set-field.full { grid-column: 1 / -1; }
.set-hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.55; }

.set-panel {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px 16px; margin-top: 14px;
  background: var(--bg-soft); transition: opacity .2s;
}
.set-panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.set-panel-head b { font-size: 13.5px; }
.set-panel.off { opacity: .48; }
.on-tag[hidden], .set-panel-note[hidden] { display: none !important; }
.set-panel-note {
  font-size: 13px; color: var(--text-2); margin-top: 12px;
  padding: 10px 14px; background: var(--gray-bg); border-radius: 10px;
}
.set-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* 拨动开关（appearance:none 的 checkbox） */
input[type="checkbox"].switch {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  width: 46px; height: 26px; padding: 0; margin: 3px 0 0;
  border-radius: 13px; border: 1px solid var(--border-strong);
  background: var(--track); position: relative; cursor: pointer; flex-shrink: 0;
  transition: background .18s, border-color .18s; display: inline-block; vertical-align: middle;
}
input[type="checkbox"].switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(76, 58, 150, .28);
  transition: left .18s;
}
input[type="checkbox"].switch:checked { background: var(--grad-main); border-color: transparent; }
input[type="checkbox"].switch:checked::after { left: 22px; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(40, 30, 70, .45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  position: relative; /* 供 .auth-close 绝对定位（弹窗右上角关闭按钮） */
  background: #fff; border-radius: 20px; padding: 26px; width: 460px;
  max-width: 100vw; max-height: 88vh; overflow: auto;
  box-shadow: var(--shadow-lift);
}
.modal h3 { margin-bottom: 16px; font-size: 17.5px; }

/* ============ Toast ============ */
.toast {
  position: fixed; top: 74px; left: 50%; transform: translateX(-50%);
  background: #2a2440; color: #fff;
  padding: 12px 28px; border-radius: 14px; z-index: 99;
  font-size: 13.5px; box-shadow: 0 12px 34px rgba(40, 30, 70, .35), 0 4px 12px rgba(40, 30, 70, .2);
  max-width: 88vw; text-align: center;
  animation: toast-slide-in .35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(8px);
}
.toast::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}
.toast.err { background: #b3341f; }
.toast.err::before {
  content: "✕";
}
@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translate(-50%, -20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

/* ============ 页脚 ============ */
.site-footer {
  text-align: center; padding: 30px 16px 36px; color: var(--muted); font-size: 12px;
  letter-spacing: .04em;
}

/* ============================================================
   移动端适配（手机用户为主）
   ============================================================ */
@media (max-width: 768px) {
  body { font-size: 15px; }

  /* 前台：隐藏顶部导航，启用底部 Tab */
  .topbar nav { display: none; }
  .topbar { padding: 0 14px; gap: 10px; min-height: 54px; }
  .tabbar { display: flex; }

  .container { padding: 16px 13px 40px; }
  #mainView .container { padding-bottom: 40px; }
  /* 底部 Tab 是 fixed 的，页脚补足它的高度，避免最后一行被盖住（原本写成全局，桌面端白留了 100px） */
  #mainView .site-footer { padding-bottom: calc(30px + 70px); }

  .card { padding: 17px; border-radius: 15px; }
  .section-title { font-size: 15.5px; margin: 22px 0 12px; }

  .style-chips { gap: 8px; }
  .chip { padding: 8px 15px; font-size: 13.5px; }

  .task-grid { grid-template-columns: repeat(2, 1fr); gap: 11px; }
  .task-card .img-wrap { height: 190px; }
  .task-card .meta { padding: 10px 11px; }

  /* 生成行动区：手机端纵向排布，按钮全宽好按 */
  .cta-row { flex-direction: column; align-items: stretch; gap: 10px; text-align: center; }
  .cta-row > .muted { order: 2; }
  .cta-row #genBtn { width: 100%; padding: 15px; font-size: 16px; border-radius: 13px; margin: 0; order: 1; }
  #polishBtn { flex-shrink: 0; }

  /* 表格可横向滑动（容器在 HTML 中包一层 .table-host） */
  table { min-width: 560px; }
  .table-host { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }

  .auth-wrap { margin-top: 5vh; }
  .auth-wrap .card { padding: 28px 20px; }

  /* 下单/改密/对话框：手机端做成从底部升起的抽屉 */
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%; max-width: 100vw; max-height: 86vh;
    border-radius: 20px 20px 0 0;
    animation: sheet-up .26s ease;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
  /* 登录弹窗和灯箱不是抽屉：抵消上面 .modal-mask 的沉底与零内边距，
     否则登录卡片会贴着屏幕底边、灯箱（内联 flex-direction:column）会被挤到屏幕右侧 */
  .modal-mask.auth-modal { align-items: center; padding: 16px; }
  #lightbox { align-items: center; padding: 16px; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }

  .toast { top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); width: max-content; }
}

/* ============ 管理后台移动端 ============ */
@media (max-width: 860px) {
  .admin-layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 8px 10px; border-right: none; border-bottom: 1px solid var(--border);
    flex-wrap: nowrap; gap: 2px;
  }
  .sidebar .logo { padding: 4px 8px; flex-shrink: 0; }
  .sidebar .logo .zh { display: none; }
  .sidebar a { margin-bottom: 0; padding: 8px 12px; white-space: nowrap; flex-shrink: 0; }
  .sidebar a.active::before { display: none; }
  .admin-main { padding: 16px 12px 50px; overflow-x: auto; }
  .admin-main > * { min-width: 0; }
  .admin-main table { min-width: 640px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row label { width: 100%; }
  .form-row input:not([type="checkbox"]), .form-row select { flex: 1 1 130px; }
  .set-grid { grid-template-columns: 1fr; gap: 12px; }
  .set-field.full { grid-column: auto; }
}

/* ============================================================
   落地页（营销首页）
   ============================================================ */
.brand-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; display: block; }
.brand-logo.lg { width: 38px; height: 38px; border-radius: 10px; }

/* 导航 */
.land-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; height: 64px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.land-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: .03em; }
.land-nav-actions { display: flex; align-items: center; gap: 8px; }
.land-link { color: var(--text-2); font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: 10px; cursor: pointer; transition: all .15s; }
.land-link:hover { color: var(--primary); background: var(--grad-soft); }
.land-cta-sm { padding: 9px 20px; font-size: 13.5px; border-radius: 11px; }

/* Hero */
.hero {
  max-width: 1080px; margin: 0 auto; padding: 64px 24px 40px;
  display: grid; grid-template-columns: 1.08fr .92fr; gap: 52px; align-items: center;
}
.hero-badge {
  display: inline-block; font-family: var(--serif); font-style: italic;
  font-size: 13px; letter-spacing: .14em;
  color: var(--muted); margin-bottom: 20px;
}
.hero h1 { font-size: 50px; line-height: 1.22; font-weight: 700; letter-spacing: -.025em; margin-bottom: 18px; }
/* 关键词：浅灰"标注笔"底纹（编辑风高亮） */
.hero h1 .grad {
  background: none; color: var(--text);
  box-shadow: inset 0 -0.32em 0 rgba(110, 86, 207, .14);
}
.hero-sub { color: var(--text-2); font-size: 15.5px; line-height: 1.85; margin-bottom: 28px; max-width: 440px; }
.hero-actions { display: flex; align-items: center; gap: 16px; margin-bottom: 40px; flex-wrap: wrap; }
.hero-cta { padding: 15px 36px; font-size: 16.5px; border-radius: 14px; }
.hero-note { color: var(--muted); font-size: 13px; }
.hero-stats { display: flex; gap: 38px; }
.hero-stats b { display: block; font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: 0; }
.hero-stats span { color: var(--muted); font-size: 12.5px; }
.hero-visual { position: relative; display: flex; justify-content: center; }
/* 照片卡：细边框 + 底部署名式小字（编辑风，无装饰色块） */
.hero-photo-card {
  position: relative; z-index: 1;
  width: min(340px, 100%); border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(76, 58, 150, .14), 0 4px 14px rgba(76, 58, 150, .07);
}
.hero-photo-card img { display: block; width: 100%; }

/* Section 通用 */
.section-heading { font-size: 30px; font-weight: 800; text-align: center; letter-spacing: -.01em; margin: 0 0 8px; }
.section-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 34px; }

/* 作品展示 */
.showcase { max-width: 1080px; margin: 0 auto; padding: 56px 24px 20px; }
.showcase-cat { font-size: 19px; font-weight: 800; margin: 30px 0 14px; }
.showcase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.showcase-item {
  margin: 0; background: #fff; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(76, 58, 150, .08);
  transition: transform .25s ease, box-shadow .25s ease;
}
.showcase-item:hover { transform: translateY(-4px); box-shadow: 0 22px 46px rgba(76, 58, 150, .16); }
.showcase-item img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.showcase-item figcaption { padding: 13px 16px; font-size: 14px; font-weight: 600; }
.showcase-item:last-child img { filter: saturate(.9); }

/* 卖点 */
.features { max-width: 1080px; margin: 0 auto; padding: 44px 24px 16px; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 22px 18px; box-shadow: 0 6px 20px rgba(76, 58, 150, .06); }
.f-icon { font-size: 26px; margin-bottom: 12px; }
.feature-card b { font-size: 15px; display: block; margin-bottom: 6px; }
.feature-card p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0; }

/* 步骤 */
.steps-sec { max-width: 1080px; margin: 0 auto; padding: 44px 24px 16px; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 24px 22px; }
.step-num {
  display: inline-block; font-size: 13px; font-weight: 800; color: #fff;
  background: var(--grad-main); border-radius: 10px; padding: 3px 11px; margin-bottom: 14px;
}
.step-card b { display: block; font-size: 15.5px; margin-bottom: 6px; }
.step-card p { color: var(--muted); font-size: 13px; margin: 0; }

/* 价格 */
.pricing { max-width: 900px; margin: 0 auto; padding: 44px 24px 16px; }
.land-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.land-plan-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 26px 20px; text-align: center; box-shadow: 0 8px 24px rgba(76, 58, 150, .07); }
.land-plan-card b { font-size: 15px; }
.lp-price { font-family: var(--serif); font-size: 34px; font-weight: 600; color: var(--text); margin: 10px 0 6px; letter-spacing: 0; }

/* 底部 CTA */
.final-cta {
  width: min(1032px, calc(100% - 48px)); margin: 40px auto 0; padding: 56px 24px;
  text-align: center; background: var(--grad-soft); border-radius: 16px;
}
.final-cta h2 { font-size: 25px; font-weight: 800; margin: 0 0 24px; }
.final-cta button { padding: 15px 42px; font-size: 16px; border-radius: 14px; }

/* 页脚 */
.land-footer { text-align: center; padding: 52px 24px 44px; color: var(--muted); font-size: 13px; }
.footer-logo { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; margin-bottom: 12px; }
.land-footer p { margin: 4px 0; }

/* 登录弹窗 */
.auth-card { position: relative; width: 400px; max-width: 92vw; padding: 36px 30px; border: none; box-shadow: var(--shadow-lift); }
.auth-close {
  position: absolute; top: 12px; right: 18px;
  font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; transition: color .15s;
}
.auth-close:hover { color: var(--text); }
.auth-card .logo-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-card .slogan { font-family: var(--serif); font-style: italic; letter-spacing: .12em; }
.auth-card .auth-brand { text-align: center; margin-bottom: 18px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.auth-card form button { width: 100%; padding: 13px; font-size: 15.5px; margin-top: 4px; }
.auth-card .auth-switch { text-align: center; margin-top: 18px; font-size: 13.5px; }

/* 落地页移动端 */
@media (max-width: 768px) {
  .land-nav { padding: 0 14px; height: 58px; }
  .land-link { padding: 8px 10px; font-size: 13.5px; }
  .land-cta-sm { padding: 8px 15px; }
  .brand-name { font-size: 15.5px; }

  .hero { grid-template-columns: 1fr; gap: 28px; padding: 34px 18px 20px; }
  .hero h1 { font-size: 33px; }
  .hero-sub { font-size: 14.5px; margin-bottom: 22px; }
  .hero-actions { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 30px; }
  .hero-cta { width: 100%; padding: 15px; }
  .hero-note { text-align: center; }
  .hero-stats { gap: 26px; justify-content: center; }
  .hero-visual { margin-top: 6px; }
  .hero-photo-card { width: min(272px, 76%); }

  .section-heading { font-size: 22px; }
  .showcase { padding: 40px 18px 12px; }
  .showcase-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .showcase-item:last-child { grid-column: 1 / -1; }
  .showcase-item:last-child img { aspect-ratio: 16 / 9; }
  .feature-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .feature-card { padding: 18px 15px; }
  .steps-grid { grid-template-columns: 1fr; gap: 12px; }
  .land-plans { grid-template-columns: 1fr; gap: 12px; }
  .final-cta { width: calc(100% - 32px); padding: 40px 20px; border-radius: 22px; }
  .final-cta h2 { font-size: 20px; }
  .auth-card { padding: 28px 20px; }
}
