/* 手绘一键生图 · 奶油暖底 + 墨黑字，贴合手绘调性 */
:root {
  /* 深空科技主题：深蓝黑底 + 青紫霓虹 */
  --bg: #070B18;
  --bg-soft: #0C1224;
  --card: #121A31;
  --ink: #EAF0FF;
  --ink-soft: #8E9BC0;
  --line: #1F2C4D;
  --accent: #3B82F6;
  --accent-soft: #22D3EE;
  --accent-bg: rgba(59, 130, 246, .14);
  --accent-2: #A855F7;
  --ok: #34D399;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 50px rgba(0, 0, 0, .55);
  --glow: 0 0 24px rgba(59, 130, 246, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* hidden 属性必须能压过组件自身的 display，否则弹窗/抽屉关不掉 */
[hidden] { display: none !important; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
}

/* 科技感底纹：径向光晕 + 网格 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(59, 130, 246, .28), transparent 60%),
    radial-gradient(760px 460px at 88% 4%, rgba(168, 85, 247, .22), transparent 62%),
    radial-gradient(700px 420px at 50% 100%, rgba(34, 211, 238, .14), transparent 60%);
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 180, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 180, 255, .05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

/* 霓虹渐变主按钮 */
.btn-primary, .pick-btn, .fab-login {
  background: linear-gradient(135deg, #3B82F6 0%, #22D3EE 50%, #A855F7 100%);
  background-size: 200% 200%;
}
.btn-primary:hover:not(:disabled), .pick-btn:hover, .fab-login:hover {
  background-position: 100% 0;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 20px;
}
.brand h1 { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand .sub { font-size: 12px; color: var(--ink-soft); }
.topbar-status {
  font-size: 12px; color: var(--ink-soft);
  background: var(--bg); padding: 6px 12px; border-radius: 20px;
  border: 1px solid var(--line);
}

/* ---------- 主布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(380px, 460px) 1fr;
  gap: 20px;
  padding: 20px 24px 40px;
  align-items: start;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .preview { position: static !important; }
}

/* ---------- 面板 ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.step { margin-bottom: 22px; }
.step-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.idx {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.step-head h2 { font-size: 15px; font-weight: 700; }
.link-btn {
  margin-left: auto; background: none; border: none;
  color: var(--accent); font-size: 12px; cursor: pointer;
  text-decoration: underline; font-family: inherit;
}

textarea, input[type="text"], input[type="search"], select, input[type="tel"] {
  width: 100%; padding: 10px 12px;
  border: 1px solid rgba(148, 180, 255, .15); border-radius: 10px;
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: rgba(7, 11, 24, .6); resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
textarea::placeholder, input::placeholder { color: #55648C; }
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .14);
}
select option { background: #121A31; color: var(--ink); }
input[type="tel"] { resize: none; }
.hint { font-size: 11px; color: var(--ink-soft); text-align: right; margin-top: 4px; }

/* ---------- 画幅 ---------- */
.ratio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ratio {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px; cursor: pointer;
  background: var(--bg-soft); border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 11px; font-family: inherit; color: var(--ink-soft);
  transition: all .15s;
}
.ratio:hover { border-color: var(--accent-soft); }
.ratio.active { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.r-box { border: 1.5px solid currentColor; border-radius: 3px; opacity: .75; }
.r11 { width: 22px; height: 22px; }
.r34 { width: 19px; height: 25px; }
.r43 { width: 26px; height: 20px; }
.r169 { width: 30px; height: 17px; }
.r916 { width: 15px; height: 27px; }
.r32 { width: 27px; height: 18px; }

/* ---------- 已选卡 ---------- */
.picked {
  border: 1.5px dashed var(--line); border-radius: 12px;
  padding: 8px; min-height: 68px;
  display: flex; flex-direction: column; gap: 6px;
}
.picked-empty { color: var(--ink-soft); font-size: 12px; padding: 8px 4px; }
.picked img { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.picked-info { flex: 1; min-width: 0; }
.picked-info .nm { font-size: 13px; font-weight: 600; }
.picked-info .no { font-size: 11px; color: var(--accent); font-family: ui-monospace, monospace; }
.picked-info .au { font-size: 11px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 单个已选项：图 + 信息 + 取消 */
.picked-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 9px;
  background: rgba(59, 130, 246, .07);
  border: 1px solid rgba(148, 180, 255, .12);
}
.picked-remove {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%; border: 1px solid var(--line);
  background: rgba(10, 16, 32, .6); color: var(--ink-soft);
  cursor: pointer; font-size: 12px; line-height: 1;
  display: grid; place-items: center; transition: all .15s;
}
.picked-remove:hover {
  background: rgba(248, 113, 113, .18);
  border-color: rgba(248, 113, 113, .5);
  color: #FCA5A5;
}

/* ---------- 按钮 ---------- */
.actions { display: flex; flex-direction: column; gap: 10px; }
.btn-primary {
  padding: 13px; border: none; border-radius: 11px;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background .15s, transform .08s;
}
.btn-primary:hover:not(:disabled) { background-position: 100% 0; }
.btn-primary:active:not(:disabled) { transform: scale(.99); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  padding: 11px 18px; border: 1.5px solid var(--line); border-radius: 11px;
  background: var(--bg-soft); color: var(--ink); font-size: 14px;
  font-family: inherit; cursor: pointer; transition: all .15s;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--accent-soft); color: var(--accent); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-row label { font-size: 12px; color: var(--ink-soft); display: block; }
.mode-row select { margin-top: 4px; }

/* ---------- 规划结果 ---------- */
.plan-result { border-top: 1px dashed var(--line); padding-top: 18px; }
.plan-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.plan-card {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--bg-soft);
}
.plan-card img { width: 100%; height: 74px; object-fit: cover; display: block; background: #fff; }
.plan-card .meta { padding: 6px 8px; }
.plan-card .no { font-size: 10px; color: var(--accent); font-family: ui-monospace, monospace; }
.plan-card .nm { font-size: 11px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reasons { font-size: 11px; color: var(--ink-soft); background: var(--bg); padding: 9px 11px; border-radius: 8px; margin-bottom: 12px; line-height: 1.7; }
.plan-fields { display: flex; flex-direction: column; gap: 10px; }
.field-row label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.plan-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 14px; }

/* ---------- 结果区 ---------- */
.preview {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; position: sticky; top: 82px;
  max-height: calc(100vh - 104px); overflow-y: auto;
}
.empty-state { text-align: center; padding: 70px 20px; color: var(--ink-soft); }
.empty-icon { font-size: 42px; color: var(--accent-soft); margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

.gen-loading { text-align: center; padding: 60px 20px; }
.spinner {
  width: 36px; height: 36px; border: 3px solid rgba(59,130,246,.2);
  border-top-color: var(--accent-soft); border-radius: 50%;
  box-shadow: 0 0 18px rgba(34, 211, 238, .35);
  animation: spin .8s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gen-loading p { font-size: 13px; color: var(--ink-soft); }

.result-img { width: 100%; border-radius: 12px; display: block; background: var(--bg); }
.result-bar { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.result-bar .btn-ghost, .result-bar .btn-primary { flex: 1; min-width: 110px; }
.result-info {
  margin-top: 10px; font-size: 11px; color: var(--ink-soft);
  background: var(--bg); padding: 8px 10px; border-radius: 8px;
}
.err-box { background: rgba(248, 113, 113, .12); color: #FCA5A5; border: 1px solid rgba(248, 113, 113, .3); padding: 14px; border-radius: 10px; font-size: 13px; }

/* ---------- 抽屉 ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(3, 6, 15, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 90; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 94vw);
  background: var(--bg-soft); z-index: 100;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-head { display: flex; align-items: center; padding: 14px 18px 0; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  padding: 9px 15px; border: none; background: none; cursor: pointer;
  font-size: 14px; font-family: inherit; color: var(--ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.close-btn { background: none; border: none; font-size: 19px; cursor: pointer; color: var(--ink-soft); padding: 6px 10px; }
.drawer-tools { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.chip {
  padding: 4px 11px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card);
  font-size: 11.5px; font-family: inherit; color: var(--ink-soft);
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.drawer-foot {
  padding: 11px 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--ink-soft);
}

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 11px; }
.lib-item {
  border: 1.5px solid var(--line); border-radius: 11px; overflow: hidden;
  cursor: pointer; background: var(--card); transition: all .15s;
}
.lib-item:hover { border-color: var(--accent-soft); transform: translateY(-2px); }
.lib-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.lib-item img {
  width: 100%; height: 104px; object-fit: cover; display: block; background: #fff;
}
.lib-item .meta { padding: 7px 8px; }
.lib-item .no { font-size: 10px; color: var(--accent); font-family: ui-monospace, monospace; }
.lib-item .nm {
  font-size: 11.5px; line-height: 1.35; margin-top: 1px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lib-item .tr {
  font-size: 10.5px; color: var(--ink-soft); margin-top: 4px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lib-empty { text-align: center; padding: 50px 20px; color: var(--ink-soft); font-size: 13px; }

.fav-btn {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(148,180,255,.2); cursor: pointer; font-size: 15px;
  background: rgba(10, 16, 32, .78); color: var(--ink-soft); backdrop-filter: blur(6px);
  display: grid; place-items: center; line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.fav-btn.on { color: #FBBF24; }
.lib-item { position: relative; }

.color-item .swatch {
  width: 100%; height: 104px; display: grid; place-items: center;
  border-bottom: 1px solid var(--line);
}

/* ---------- 玻璃质感 ---------- */
/* 注意：backdrop-filter 会创建包含块，使内部 position:fixed 的子元素
   相对本元素定位而非视口。.panel 内含移动端吸底栏，故不能用 backdrop-filter。 */
.preview, .work-card, .community-card, .guide .card, .modal, .drawer {
  background: rgba(18, 26, 49, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: rgba(148, 180, 255, .13);
}
/* .panel 用半透明纯色背景，保持层次感但不影响吸底栏定位 */
.panel {
  background: rgba(18, 26, 49, .88);
  border-color: rgba(148, 180, 255, .13);
}

.topbar, .nav-tabs {
  background: rgba(7, 11, 24, .8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* 品牌 logo 发光 */
.logo {
  background: linear-gradient(135deg, #3B82F6, #22D3EE 55%, #A855F7);
  box-shadow: 0 0 22px rgba(59, 130, 246, .5);
}

/* 步骤序号发光圆 */
.idx {
  background: var(--accent-bg); color: var(--accent-soft);
  border: 1px solid rgba(34, 211, 238, .35);
}

/* 选中态 */
.ratio.active {
  border-color: var(--accent-soft); background: var(--accent-bg); color: var(--accent-soft);
  box-shadow: 0 0 16px rgba(34, 211, 238, .25) inset;
}
.lib-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg), 0 0 20px rgba(59,130,246,.3); }
.lib-item:hover { border-color: var(--accent-soft); box-shadow: 0 0 18px rgba(59, 130, 246, .28); }

/* 导航选中 */
.nav-tab.active { color: var(--accent-soft); border-bottom-color: var(--accent-soft); }
.pick-btn, .fab-login { box-shadow: 0 4px 22px rgba(59, 130, 246, .4); }
.tier-badge { background: linear-gradient(135deg, #3B82F6, #A855F7); }

/* 图片占位与边框 */
.lib-item img, .plan-card img, .work-card img { background: #0A1020; }
.lib-item .color-item .swatch { background: #0A1020; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3B82F6, #A855F7);
  border-radius: 6px; border: 2px solid var(--bg-soft);
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #22D3EE, #3B82F6); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 20px;
  border-radius: 10px; font-size: 13px; z-index: 200;
  box-shadow: var(--shadow-lg); max-width: 80vw;
}
.toast.err { background: #7F1D1D; }

/* ---------- 顶栏右侧 ---------- */
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* 左上角会员中心入口 */
.vip-entry {
  margin-left: 6px; padding: 7px 16px; border-radius: 20px; cursor: pointer;
  background: var(--accent-bg); color: var(--accent);
  border: 1.5px solid var(--accent-soft);
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  white-space: nowrap; transition: all .15s;
}
.vip-entry:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 右上角画风选择按钮 */
.pick-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 8px 18px; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: #fff; border: 2px solid var(--accent);
  box-shadow: 0 3px 10px rgba(156, 91, 51, .3);
  font-family: inherit; transition: all .15s;
}
.pick-btn:hover { background-position: 100% 0; transform: translateY(-1px); }
.pick-label { font-size: 14px; font-weight: 700; letter-spacing: .5px; }
.pick-counts {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; opacity: .92; white-space: nowrap;
}
.pick-counts b { font-weight: 700; font-size: 12px; }
.pick-counts i { width: 1px; height: 9px; background: currentColor; opacity: .45; }

/* 左下角常驻登录入口 */
.fab-login {
  position: fixed; left: 20px; bottom: 20px; z-index: 120;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 24px; cursor: pointer;
  background: var(--accent); color: #fff; border: none;
  font-size: 14px; font-family: inherit;
  box-shadow: 0 4px 16px rgba(80, 50, 30, .3);
}
.fab-login:hover { background-position: 100% 0; }
.fab-login .who { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fab-login .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #34D399; box-shadow: 0 0 8px rgba(52,211,153,.9);
}
.fab-credit {
  position: fixed; left: 20px; bottom: 66px; z-index: 120;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 20px; cursor: pointer;
  background: var(--card); color: var(--accent);
  border: 1px solid var(--accent-soft); font-size: 13px; font-weight: 600;
  font-family: inherit; box-shadow: var(--shadow);
}
.credit-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: 20px; cursor: pointer;
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid var(--accent-soft); font-size: 13px; font-weight: 600;
  font-family: inherit;
}
.credit-chip .c-ico { font-size: 10px; }
.user-btn {
  padding: 7px 16px; border-radius: 20px; cursor: pointer;
  background: var(--accent); color: #fff; border: none;
  font-size: 13px; font-family: inherit;
}
.user-btn:hover { background-position: 100% 0; }

/* ---------- 导航 ---------- */
.nav-tabs {
  display: flex; gap: 4px; padding: 0 24px;
  background: var(--bg-soft); border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.nav-tab {
  padding: 11px 16px; border: none; background: none; cursor: pointer;
  font-size: 14px; font-family: inherit; color: var(--ink-soft);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- 视图 ---------- */
.view { padding: 20px 24px 40px; }
.view-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.view-head h2 { font-size: 18px; font-weight: 700; }
.view-sub { font-size: 12px; color: var(--ink-soft); }

.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.work-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.work-card img { width: 100%; display: block; background: var(--bg); cursor: pointer; }
.work-card .meta { padding: 9px 11px; }
.work-card .no { font-size: 10.5px; color: var(--accent); font-family: ui-monospace, monospace; }
.work-card .th { font-size: 12.5px; margin: 2px 0 6px; line-height: 1.4; }
.work-card .row { display: flex; gap: 6px; }
.work-card .mini {
  flex: 1; padding: 5px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg-soft); font-size: 11px; cursor: pointer;
  font-family: inherit; color: var(--ink-soft);
}
.work-card .mini:hover { border-color: var(--accent-soft); color: var(--accent); }

.guide { max-width: 780px; }
.guide h3 { font-size: 15px; margin: 20px 0 8px; color: var(--accent); }
.guide h3:first-child { margin-top: 0; }
.guide p, .guide li { font-size: 13.5px; color: var(--ink); line-height: 1.85; }
.guide ol, .guide ul { padding-left: 20px; }
.guide .card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.community-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.community-card .ch { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.community-card .cd { font-size: 12px; color: var(--ink-soft); margin-bottom: 10px; }
.qr-placeholder {
  height: 168px; background: var(--bg); border: 1px dashed var(--line);
  border-radius: 10px; display: grid; place-items: center;
  font-size: 12px; color: var(--ink-soft); text-align: center; padding: 12px;
}
/* 后台配置的社群二维码 */
.qr-img {
  width: 168px; height: 168px; object-fit: contain;
  background: #fff; border-radius: 10px; border: 1px solid var(--line);
  display: block;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(3, 6, 15, .7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; z-index: 300; padding: 20px;
}
.modal {
  background: var(--bg-soft); border-radius: 16px; padding: 26px;
  width: min(400px, 100%); max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); position: relative;
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; font-size: 17px; cursor: pointer; color: var(--ink-soft);
}
.modal-title { font-size: 19px; margin-bottom: 5px; }
.modal-desc { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 16px; line-height: 1.6; }
.modal-note { font-size: 11.5px; color: var(--ink-soft); margin-top: 12px; line-height: 1.6; }

.field { margin-bottom: 12px; }
.field input { margin-bottom: 4px; }
.field-err { font-size: 11.5px; color: #F87171; min-height: 15px; }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.btn-code {
  padding: 0 14px; border: 1.5px solid var(--accent-soft); border-radius: 10px;
  background: var(--accent-bg); color: var(--accent); cursor: pointer;
  font-size: 13px; font-family: inherit; white-space: nowrap;
}
.btn-code:disabled { opacity: .55; cursor: not-allowed; }
.btn-oauth {
  width: 100%; padding: 11px; border-radius: 11px; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--line);
  font-size: 14px; font-family: inherit; color: var(--ink);
}
.btn-oauth:hover { border-color: var(--accent-soft); }

.btn-wechat {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .45); color: #6EE7B7; font-weight: 600;
  padding: 12px;
}
.btn-wechat:hover { background: rgba(52, 211, 153, .2); border-color: #34D399; }
.wx-ico {
  width: 19px; height: 19px; border-radius: 50%;
  background: #10B981; flex-shrink: 0;
  position: relative;
}
.wx-ico::before, .wx-ico::after {
  content: ''; position: absolute; background: #fff; border-radius: 50%;
}
.wx-ico::before { width: 4px; height: 4px; top: 5px; left: 5px; }
.wx-ico::after { width: 4px; height: 4px; top: 5px; right: 4px; }

.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 14px;
}
.auth-tab {
  padding: 8px; border: none; border-radius: 8px; cursor: pointer;
  background: transparent; font-size: 14px; font-family: inherit;
  color: var(--ink-soft); transition: all .15s;
}
.auth-tab.active { background: var(--card); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }
.divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 12px; font-size: 11.5px; color: var(--ink-soft);
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

/* ---------- 会员中心 ---------- */
.vip-card {
  background: linear-gradient(135deg, #3B82F6 0%, #6366F1 45%, #A855F7 100%);
  color: #fff; border-radius: 14px; padding: 18px; margin-bottom: 14px;
}
.vip-card .vt { font-size: 16px; font-weight: 700; }
.vip-card .vc { font-size: 26px; font-weight: 700; margin: 6px 0 2px; }
.vip-card .vs { font-size: 12px; opacity: .92; }
.vip-price { text-align: center; padding: 8px 0 16px; }
.vip-price .p { font-size: 40px; font-weight: 700; color: var(--accent); }
.vip-price .p span { font-size: 17px; }
.vip-price .u { font-size: 13px; color: var(--ink-soft); }
.vip-feats { list-style: none; margin: 0 0 18px; }
.vip-feats li {
  font-size: 13.5px; padding: 7px 0; display: flex; gap: 8px;
  border-bottom: 1px dashed var(--line);
}
.vip-feats li:last-child { border-bottom: none; }
.vip-feats .yes { color: var(--ok); font-weight: 700; }
.vip-feats .no { color: var(--ink-soft); }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-box {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px; text-align: center;
}
.stat-box .sv { font-size: 21px; font-weight: 700; color: var(--accent); }
.stat-box .sl { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.btn-danger-ghost {
  width: 100%; padding: 10px; margin-top: 10px; border: 1px solid var(--line);
  border-radius: 11px; background: none; cursor: pointer;
  font-size: 13px; font-family: inherit; color: var(--ink-soft);
}

/* ---------- 会员档位 ---------- */
.vip-h { font-size: 19px; margin-bottom: 14px; }
.vip-sub { font-size: 14px; margin: 20px 0 10px; color: var(--ink); }

.tier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tier-card {
  position: relative; border: 1.5px solid var(--line);
  border-radius: 12px; padding: 14px 10px 12px; text-align: center;
  background: var(--card);
}
.tier-card.hl { border-color: var(--accent); background: var(--accent-bg); box-shadow: var(--glow); }
.tier-card.current { box-shadow: 0 0 0 2px var(--accent-bg); }
.tier-badge {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: 10px;
  padding: 2px 9px; border-radius: 10px; white-space: nowrap;
}
.tier-name { font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.tier-price { font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.tier-price span { font-size: 14px; }
.tier-unit { font-size: 11px; color: var(--ink-soft); margin-bottom: 7px; }
.tier-daily {
  font-size: 11px; color: var(--ink-soft); background: var(--bg);
  border-radius: 6px; padding: 5px 4px; margin-bottom: 9px;
}
.tier-btn {
  width: 100%; padding: 7px; border: none; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 13px; font-family: inherit;
}
.tier-btn:hover:not(:disabled) { background-position: 100% 0; }
.tier-btn.disabled { background: var(--accent-bg); color: var(--accent); cursor: default; }
.tier-btn.ghost { background: var(--bg); color: var(--ink-soft); cursor: default; }

.vip-table {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--card);
}
.vip-row {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr;
  border-bottom: 1px solid var(--line); font-size: 12px;
}
.vip-row:last-child { border-bottom: none; }
.vip-row.head { background: var(--bg); font-weight: 600; }
.vr-label { padding: 8px 10px; color: var(--ink-soft); }
.vr-cell { padding: 8px 6px; text-align: center; border-left: 1px solid var(--line); }
.vr-cell.yes { color: var(--ok); font-weight: 600; }
.vr-cell.no { color: #475569; }
.vr-cell.hl { background: rgba(59, 130, 246, .1); }
.vip-row.head .vr-cell { color: var(--ink); font-weight: 600; }

@media (max-width: 520px) {
  .tier-grid { grid-template-columns: 1fr; }
  .vip-row { grid-template-columns: 1.3fr 1fr 1fr 1fr; font-size: 11px; }
  .vr-cell, .vr-label { padding: 7px 4px; }
  .pick-counts { font-size: 10px; }
  .vip-entry { padding: 6px 12px; font-size: 12.5px; }
}

/* ============================================================
   移动端适配（H5）
   设计要点：
   1. 单列纵向流：输入在上，结果在下
   2. 主操作吸底，大拇指够得着
   3. 画风库全屏弹出（手机上 760px 抽屉太窄，选图费劲）
   4. 触摸目标 ≥ 44px
   5. 输入框字号 ≥16px（否则 iOS Safari 会自动放大页面）
   ============================================================ */

/* ---------- 平板：两列改一列，预览不再吸顶 ---------- */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 16px 16px 120px;
    gap: 16px;
  }
  .preview {
    position: static !important;
    max-height: none;
  }
  .panel { padding: 16px; }

  /* 顶部品牌区压缩，副标题在手机上是负担 */
  .brand .sub { display: none; }
  .topbar { padding: 10px 14px; }
  .brand h1 { font-size: 16px; }
  .nav-tabs { padding: 0 14px; }

  /* 画风库：手机上全屏，格子更密 */
  .drawer {
    width: 100%;
    top: auto;
    height: 92vh;
    border-radius: 18px 18px 0 0;
    animation: slideUp .24s ease;
  }
  .drawer::before {
    content: ''; position: absolute; top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 2px;
    background: var(--line); z-index: 2;
  }
  .drawer-head { padding-top: 18px; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .lib-item .li-name { font-size: 11.5px; }
}

/* ---------- 手机 ---------- */
@media (max-width: 640px) {
  /* 输入框 16px 起，防 iOS 自动缩放 */
  textarea, input[type="text"], input[type="search"], select, input[type="tel"] {
    font-size: 16px;
    padding: 11px 12px;
  }

  .layout { padding: 12px 12px 96px; }
  .panel { padding: 14px; border-radius: 12px; }
  .step { margin-bottom: 18px; }

  /* 顶栏 */
  .topbar { padding: 9px 12px; gap: 8px; }
  .brand h1 { font-size: 15px; }
  .logo { width: 30px; height: 30px; font-size: 14px; border-radius: 9px; }
  .vip-entry { padding: 7px 11px; font-size: 12px; }

  /* 画风选择按钮：手机上只留"画风"，数字挤掉 */
  .pick-btn { padding: 7px 12px; }
  .pick-counts { display: none; }

  /* 导航：横向可滑动 */
  .nav-tab { padding: 11px 13px; font-size: 13.5px; white-space: nowrap; }

  /* 比例选择：3 列 */
  .ratio-grid { grid-template-columns: repeat(3, 1fr); }

  /* 触摸目标放大到 44px */
  .nav-tab, .tab, .close-btn, .mini-btn, .link-btn, .chip {
    min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .close-btn { width: 44px; height: 44px; }

  /* 画风库：两列大格子，选图更准 */
  .lib-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .lib-item .li-name { font-size: 12px; }
  .lib-item .li-meta { font-size: 10.5px; }

  /* 抽屉顶到全屏高度 */
  .drawer { height: 94vh; }
  .drawer-tools { padding: 10px 12px; }

  /* 规划卡片单列 */
  .plan-cards { grid-template-columns: 1fr; }
  .plan-actions { grid-template-columns: 1fr 1.4fr; gap: 8px; }

  /* 主操作吸底 —— 手机上单手可达 */
  .actions,
  .plan-actions {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    margin: 0;
    /* env() 在无刘海设备上可能返回异常值，用 max() 兜底保证不超出视口 */
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
    background: rgba(7, 11, 24, .92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(148, 180, 255, .14);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, .45);
  }
  .actions { grid-template-columns: 1fr; gap: 8px; }
  .actions .btn-primary { width: 100%; }
  /* 模式下拉留在面板内，两列并排 */
  .mode-row { display: flex; gap: 10px; margin-bottom: 14px; }
  .mode-row label { flex: 1; }
  .mode-row select { font-size: 14px; padding: 8px 10px; }

  .btn-primary, .btn-ghost { padding: 12px; font-size: 15px; }

  /* 规划完成后：切换吸底栏内容，避免两个栏重叠 */
  /* 隐藏「一键规划」栏，显示「确认出图」栏 */
  body.has-plan .actions { display: none; }
  body.has-plan .plan-actions { display: grid; }
  /* 未规划时 plan-actions 不占位（它 hidden，由 .plan-result 控制） */
  .plan-actions { display: none; }
  .plan-result:not([hidden]) .plan-actions { display: grid; }

  /* 底部留出吸底栏的高度，避免遮挡内容 */
  .layout { padding-bottom: 92px; }
  body.has-plan .layout { padding-bottom: 92px; }

  /* 左下角登录按钮改到吸底栏上方，避免和吸底栏打架 */
  .fab-login, .fab-credit {
    bottom: max(70px, calc(70px + env(safe-area-inset-bottom)));
    left: 12px;
    padding: 8px 13px;
    font-size: 12.5px;
  }

  /* 结果区 */
  .preview { padding: 14px; border-radius: 12px; }
  .result-bar .btn-ghost, .result-bar .btn-primary { padding: 11px 8px; font-size: 13.5px; }

  /* 视图页（我的创作/收藏/教程/社群） */
  .view { padding: 14px 12px 96px; }
  .work-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }

  /* 弹窗适配小屏 */
  .modal { padding: 18px 16px; max-height: 90vh; overflow-y: auto; }
  .modal-title { font-size: 16px; }
  .fg-row { grid-template-columns: 1fr; }
  .fg2 { grid-template-columns: 1fr; }

  /* 会员中心 */
  .tier-grid { grid-template-columns: 1fr; }
  .vip-row { grid-template-columns: 1.2fr 1fr 1fr 1fr; font-size: 10.5px; }
  .vip-entry { padding: 7px 11px; font-size: 12px; }

  /* Toast 避开吸底栏 */
  .toast { bottom: max(86px, calc(86px + env(safe-area-inset-bottom))); }
}

/* ---------- 超窄屏 ---------- */
@media (max-width: 360px) {
  .lib-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .ratio-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .brand h1 { font-size: 14px; }
  .vip-entry { padding: 6px 9px; font-size: 11.5px; }
}

/* ---------- 移动端抽屉弹出动画 ---------- */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ---------- 减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   移动端 · 生成中浮层
   手机上预览区在页面下方，出图等待时用户看不到反馈，
   用全屏浮层明确告知，避免以为没反应而重复点击。
   ============================================================ */
.gen-mask {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: rgba(3, 6, 15, .82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.gen-mask-box { text-align: center; color: var(--ink); padding: 20px; }
.gen-mask-box p { font-size: 15px; margin: 14px 0 6px; font-weight: 600; }
.gen-mask-box small { font-size: 12px; color: var(--ink-soft); }
.spinner.big {
  width: 46px; height: 46px; margin: 0 auto;
  border-width: 4px;
}

/* 桌面端不显示这个浮层（预览区本来就可见） */
@media (min-width: 641px) {
  .gen-mask { display: none !important; }
}
