/* ==========================================================================
 * style.css —— 新拟态（Soft UI）设计系统
 * 设计 token 与小程序 app.wxss 同源，保证两边观感一致。
 * ========================================================================== */
:root {
  --bg: #e6e9f0;          /* 页面底：比卡片深一档 */
  --surf: #f0f0f3;        /* 卡片面 */
  --text: #2a2936;
  --text-2: #3b394a;
  --muted: #6b6a7e;
  --muted-2: #8a8898;
  --brand: #7a6fd0;
  --brand-grad: linear-gradient(135deg, #8b7ed8, #a89de8);
  --dark: rgba(163, 170, 190, .34);
  /* 拟态三要素：近层小模糊出轮廓，远层大模糊出体积，强度靠 alpha 不靠半径 */
  --sh-card: 8px 8px 18px rgba(163, 170, 190, .34), -6px -6px 14px #fff;
  --sh-sm:   4px 4px 10px rgba(163, 170, 190, .30), -3px -3px 8px #fff;
  --sh-lg:   12px 12px 28px rgba(163, 170, 190, .38), -8px -8px 20px #fff;
  --sh-brand: 8px 8px 20px rgba(139, 126, 216, .42), -6px -6px 14px #fff;
  --sh-in:   inset 4px 4px 10px rgba(163, 170, 190, .42), inset -4px -4px 10px #fff;
  --r-lg: 18px; --r-md: 14px; --r-sm: 10px;
}
* { box-sizing: border-box; }
/* ★ 通配的 [hidden] 保底规则：本页多处用 hidden 属性来控制显隐，
   而 display:flex / display:block 之类的声明会盖过浏览器默认的 display:none。
   有这一条，任何元素加 hidden 都能真正藏起来。 */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased; }

/* ===== 吸顶头部：外层毛玻璃条，内层是与下方卡片同款的拟态块 ===== */
header { position: sticky; top: 0; z-index: 20; padding: 14px 0 0;
  background: rgba(230, 233, 240, .78); backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); }
.hwrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.hbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px; border-radius: var(--r-lg);
  background: var(--surf); box-shadow: var(--sh-card); }
.hbar > button { margin-left: auto; }

/* ===== 拟态标签 ===== */
.badge { padding: 4px 14px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  color: var(--brand); background: var(--surf); box-shadow: var(--sh-sm); }
.badge.mock { color: #6b5816; background: #f6f0d8;
  box-shadow: 4px 4px 10px rgba(200,180,110,.24), -3px -3px 8px #fff; }
.badge.off { color: #a3443e; background: #f8e6e4;
  box-shadow: 4px 4px 10px rgba(190,130,120,.24), -3px -3px 8px #fff; }

/* ===== 按钮 ===== */
button { font: inherit; cursor: pointer; border: none; color: #4a4568; font-weight: 600;
  padding: 9px 20px; border-radius: 999px; background: var(--surf);
  box-shadow: var(--sh-sm); transition: transform .15s ease, box-shadow .2s ease, opacity .15s ease; }
button:hover { color: var(--brand); }
button:active { transform: translateY(1px);
  box-shadow: inset 4px 4px 10px rgba(146,154,178,.40), inset -3px -3px 8px rgba(255,255,255,.6); }
button.primary { color: #fff; background: var(--brand-grad); box-shadow: var(--sh-brand); }
button.primary:hover { color: #fff; filter: brightness(1.04); }
button.primary:active { transform: translateY(1px);
  box-shadow: inset 4px 4px 10px rgba(90,78,150,.40), inset -3px -3px 7px rgba(255,255,255,.3); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.mini { padding: 5px 14px; font-size: 12px; }

main { max-width: 1180px; margin: 0 auto; padding: 20px; }
.panel, section { background: var(--surf); border: none; border-radius: var(--r-lg);
  padding: 18px; margin-bottom: 18px; box-shadow: var(--sh-card); }

.row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.row[hidden] { display: none; }   /* hidden 属性会被上面的 display:flex 顶掉，必须显式压回 */
.row.wide { align-items: flex-start; }
.row > label { width: 68px; color: var(--muted); flex: none; line-height: 36px; }
.row.wide > label { line-height: 1.6; padding-top: 10px; }
.row > textarea { flex: 1 1 280px; min-width: 0; width: auto; }
#brief { min-height: 96px; }
.row > .chips { flex: 1 1 280px; min-width: 0; }
/* 复选框那一行不是普通 label：要顶掉 .row > label 的固定 68px 宽（否则文字被压成竖排） */
.row > .check { flex: none; width: auto; white-space: nowrap; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chip { padding: 8px 20px; border-radius: 999px; cursor: pointer; user-select: none;
  flex: none; white-space: nowrap; line-height: 1.5; color: var(--brand);
  background: var(--surf); box-shadow: var(--sh-sm); font-weight: 600; font-size: 13px;
  transition: transform .15s ease, box-shadow .2s ease; }
.chip:hover { transform: translateY(-1px); }
.chip.active { color: #fff; background: var(--brand-grad); box-shadow: var(--sh-brand); }

/* ===== 内凹控件 ===== */
input, select, textarea { font: inherit; padding: 10px 14px; border: none; border-radius: var(--r-sm);
  color: var(--text-2); background: var(--surf); box-shadow: var(--sh-in); width: auto; }
input:focus, select:focus, textarea:focus { outline: none;
  box-shadow: inset 4px 4px 10px rgba(163,170,190,.42), inset -4px -4px 10px #fff, 0 0 0 3px rgba(139,126,216,.25); }
::placeholder { color: var(--muted-2); }
input[type=number] { width: 92px; }
.row > input, .row > select { flex: none; }
textarea { width: 100%; resize: vertical; line-height: 1.6; }
/* 复选框：不要继承输入框的内凹盒模型，否则会被压扁、文字逐字换行 */
input[type=checkbox] { width: 18px; height: 18px; padding: 0; margin: 0; flex: none;
  border-radius: 5px; box-shadow: none; accent-color: var(--brand); cursor: pointer; }
input[type=checkbox]:focus { box-shadow: none; }
.check { display: flex; align-items: center; gap: 8px; line-height: 36px; color: var(--text-2);
  flex: none; white-space: nowrap; cursor: pointer; }
.check > span { white-space: nowrap; }

/* ===== 图生图：参考图 ===== */
.srcrow { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; min-width: 0; }
.srcprev { width: 88px; height: 118px; border-radius: var(--r-sm); object-fit: cover; flex: none;
  box-shadow: var(--sh-in); background: var(--surf); }
.srcprev.empty { display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 11px; color: var(--muted-2); padding: 6px; }
.srcops { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.srcops .hint { margin: 0; max-width: 420px; }
.tag { display: inline-block; font-size: 11px; color: var(--brand); background: rgba(139,126,216,.14);
  border-radius: 999px; padding: 2px 9px; margin-left: 6px; flex: none; }
.srcthumb { width: 34px; height: 46px; border-radius: 6px; object-fit: cover; flex: none;
  box-shadow: var(--sh-in); }

.actions { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.actions > button { flex: none; white-space: nowrap; }
h2 { font-size: 15px; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; font-weight: 600; flex-wrap: wrap; }
h2 span { font-weight: 400; color: var(--muted); font-size: 13px; }
h2 .hbtn { padding: 4px 14px; font-size: 12px; margin-left: 0; }

/* ===== 凹槽进度条 ===== */
.prow { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.prow[hidden] { display: none; }
.progress { flex: 1 1 auto; min-width: 0; height: 16px; border-radius: 999px; padding: 3px;
  background: var(--surf); box-shadow: inset 4px 4px 10px rgba(163,170,190,.45), inset -4px -4px 10px #fff; }
.progress > div { height: 100%; border-radius: 999px; width: 0; transition: width .3s;
  background: var(--brand-grad); box-shadow: 0 2px 6px rgba(139,126,216,.45); }
.pinfo { flex: none; font-size: 12px; color: var(--brand); font-weight: 600; white-space: nowrap; }
/* 不确定态：AI 写词时没有真实进度，用来回滑动的填充表示"在跑" */
.progress.indet > div { width: 38%; transition: none; animation: pfSlide 1.15s ease-in-out infinite; }
@keyframes pfSlide { 0% { margin-left: 0; } 50% { margin-left: 59%; } 100% { margin-left: 0; } }

.hint { color: var(--muted); font-size: 12px; margin-top: 10px; }
.fatal { color: #6b5816; background: #f6f0d8; border-radius: var(--r-md); padding: 14px 18px;
  margin-bottom: 18px; font-size: 13px; line-height: 1.7;
  box-shadow: 6px 6px 12px rgba(200,180,110,.24), -5px -5px 12px #fff; }
.fatal code { background: rgba(255,255,255,.7); padding: 1px 6px; border-radius: 4px; }
.warn { color: #a3443e; background: #f8e6e4; border-radius: var(--r-md);
  padding: 12px 16px; margin-top: 10px; font-size: 12px; line-height: 1.7;
  box-shadow: 4px 4px 10px rgba(190,130,120,.24), -3px -3px 8px #fff; }

/* ===== 提示词条目 ===== */
.pitem { border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 12px;
  background: var(--surf); box-shadow: var(--sh-sm); }
.phead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.phead b { color: var(--brand); font-size: 12px; }
.phead .t { font-weight: 600; font-size: 13px; color: var(--text); flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phead > button { flex: none; }
.pitem textarea { font-size: 13px; min-height: 72px; display: block; }
.neg { font-size: 11px; color: var(--muted-2); margin-top: 6px; }

/* ===== 画廊 ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.card { border-radius: var(--r-md); overflow: hidden; padding: 6px; background: var(--surf);
  box-shadow: var(--sh-card); transition: box-shadow .2s ease, transform .15s ease; }
.card.keep { box-shadow: 0 0 0 3px rgba(139,126,216,.35), var(--sh-card); }
.card.drop { opacity: .45; }
.thumb { width: 100%; aspect-ratio: 9/16; object-fit: cover; display: block; border-radius: var(--r-sm);
  background: linear-gradient(135deg, #e6e2f2, #ece8f6); }
.ph { width: 100%; aspect-ratio: 9/16; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); color: var(--muted); font-size: 12px; text-align: center; padding: 8px;
  background: linear-gradient(135deg, #e6e2f2, #ece8f6); box-shadow: var(--sh-in); }
.card-body { padding: 10px 6px 6px; }
.card-body .pt { font-size: 12px; color: var(--muted); max-height: 54px; overflow: hidden; }
.card-body .btns { display: flex; gap: 8px; margin-top: 10px; }
.card-body .btns button { flex: 1; padding: 6px 0; font-size: 12px; }
.card-body .btns button.on { color: #fff; background: var(--brand-grad); box-shadow: var(--sh-brand); }
.card-body .btns button.on:hover { color: #fff; }
.card-body .btns button.on.drop-on { background: linear-gradient(135deg, #c98b84, #d9a29b);
  box-shadow: 4px 4px 12px rgba(190,130,120,.36), -3px -3px 8px #fff; }
.card-body .btns button:disabled { opacity: .5; }
.err { color: #a3443e; font-size: 11px; margin-top: 6px; }

/* ===== 历史批次 ===== */
.bitem { display: flex; align-items: center; gap: 12px; padding: 12px 0; font-size: 13px;
  border-bottom: 1px solid rgba(42,41,54,.06); flex-wrap: wrap; }
.bitem:last-child { border-bottom: 0; }
.bitem button.mini { padding: 4px 10px; font-size: 12px; flex: none; }
.bitem button.mini.danger { color: #a3443e; }
.bitem button.mini.danger:hover { background: rgba(163,68,62,.08); }
.bitem input[type=checkbox] { width: 16px; height: 16px; flex: none; margin: 0; padding: 0;
  box-shadow: none; accent-color: var(--brand); cursor: pointer; }
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 0 2px;
  font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager button { padding: 6px 14px; font-size: 12px; }
.pager button:disabled { opacity: .4; cursor: default; }

/* ===== 弹层 ===== */
.mask { position: fixed; inset: 0; z-index: 50; display: flex;
  overflow: auto; padding: 20px; background: rgba(42,41,54,.22); backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px); }
/* 不用 align-items:center 垂直居中：内容高于屏幕时顶部会进入"负溢出区"，
   滚动条永远够不着。margin:auto 在内容矮时居中、高时贴顶并可完整滚动，两种场景都对。 */
.modal { width: 540px; max-width: 94vw; margin: auto; padding: 24px; border-radius: var(--r-lg);
  background: var(--surf); box-shadow: var(--sh-lg); }
.modal h3 { margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.modal .row { align-items: center; }
.modal .row > label { width: 96px; line-height: 36px; flex: none; }
.modal .f { flex: 1 1 220px; min-width: 0; width: auto; }
.modal .actions { justify-content: flex-end; margin-top: 18px; }
.modal hr { border: 0; border-top: 1px solid rgba(42,41,54,.07); margin: 18px 0; }
.modal textarea { margin-top: 8px; font-size: 12px; }
.sec-title { font-size: 13px; font-weight: 600; color: var(--brand); margin: 4px 0 12px; }

/* ===== 轻提示 ===== */
.toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 80;
  display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.toast { max-width: 76vw; padding: 10px 22px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--text-2); background: var(--surf); box-shadow: var(--sh-lg);
  opacity: 0; transform: translateY(12px) scale(.96);
  transition: opacity .22s ease, transform .26s cubic-bezier(.22, 1.2, .36, 1); }
.toast.in { opacity: 1; transform: translateY(0) scale(1); }
.toast.ok { color: var(--brand); }
.toast.ok::before { content: '✓ '; }
.toast.err { color: #a3443e; background: #f8e6e4;
  box-shadow: 6px 6px 16px rgba(190,130,120,.28), -4px -4px 12px #fff; }
.toast.err::before { content: '⚠ '; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border-radius: 999px; background: #d3d7e0; border: 2px solid var(--bg); }

@media (max-width: 640px) {
  main { padding: 14px; }
  .hwrap { padding: 0 14px; }
  .row > label { width: 52px; font-size: 13px; }
  .modal .row > label { width: 80px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .toast-wrap { bottom: 18px; }
}
