/* =========================================================
   AI 视觉实验室 — UI 2026.10
   ========================================================= */
:root {
    --bg: #07080f;
    --bg-2: #0a0c17;
    --surface: rgba(255, 255, 255, .04);
    --surface-2: rgba(255, 255, 255, .075);
    --surface-3: rgba(255, 255, 255, .11);
    --border: rgba(255, 255, 255, .075);
    --border-strong: rgba(255, 255, 255, .14);
    --text: #eef1fb;
    --muted: #939cb8;
    --muted-2: #646c86;
    --accent: #7c5cff;
    --accent-2: #22d3ee;
    --accent-soft: rgba(124, 92, 255, .14);
    --grad: linear-gradient(135deg, #7c5cff 0%, #4d7cff 46%, #22d3ee 100%);
    --grad-soft: linear-gradient(135deg, rgba(124, 92, 255, .2), rgba(34, 211, 238, .12));
    --danger: #ff5f7a;
    --ok: #34d399;
    --radius: 20px;
    --radius-sm: 13px;
    --shadow: 0 28px 64px rgba(0, 0, 0, .5);
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body::before,
body::after {
    content: '';
    position: fixed;
    pointer-events: none;
    z-index: 0;
    filter: blur(90px);
}
body::before {
    top: -220px; left: 50%; width: 900px; height: 520px;
    transform: translateX(-50%);
    background: radial-gradient(circle at 50% 50%, rgba(124, 92, 255, .3), transparent 68%);
}
body::after {
    bottom: -260px; right: -160px; width: 720px; height: 520px;
    background: radial-gradient(circle at 50% 50%, rgba(34, 211, 238, .14), transparent 70%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; }

::selection { background: rgba(124, 92, 255, .35); color: #fff; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .2); }

.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.app { position: relative; z-index: 1; }

/* ============ 顶部导航 ============ */
.nav {
    position: sticky; top: 0; z-index: 60;
    display: flex; align-items: center; gap: 26px;
    height: 62px; padding: 0 26px;
    background: rgba(7, 8, 15, .72);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; }
.brand-mark {
    display: grid; place-items: center;
    width: 28px; height: 28px; border-radius: 9px;
    background: var(--grad); color: #fff; font-size: 14px;
    box-shadow: 0 6px 18px rgba(124, 92, 255, .45);
}
.brand-text { background: linear-gradient(120deg, #fff, #c9d2f0); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.nav-links { display: flex; align-items: center; gap: 3px; }
.nav-links a {
    position: relative;
    display: flex; align-items: center; gap: 7px;
    padding: 7px 13px; border-radius: 10px;
    font-size: 13.5px; color: var(--muted);
    transition: color .18s ease, background .18s ease;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
.nav-links a .nv-ico { width: 15px; height: 15px; opacity: .9; }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.quota-pill {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 11px; border-radius: 10px;
    font-size: 12.5px; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}
.quota-pill b {
    font-size: 14px;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 18px; border-radius: 11px;
    border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text);
    font-size: 13.5px; font-weight: 500; cursor: pointer;
    transition: background .18s ease, transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: var(--grad); border-color: transparent; color: #fff; font-weight: 600;
    box-shadow: 0 10px 26px rgba(85, 92, 255, .34);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 14px 34px rgba(85, 92, 255, .46); }
.btn-primary:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 13px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }

.avatar {
    display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: 11px;
    background: var(--grad-soft); border: 1px solid rgba(124, 92, 255, .4);
    color: #cfd6ff; font-size: 13px; font-weight: 700; cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}
.avatar:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(124, 92, 255, .3); }
.user-menu { position: relative; }
.user-drop {
    position: absolute; right: 0; top: calc(100% + 10px);
    min-width: 190px; padding: 6px; display: none;
    background: #10121d; border: 1px solid var(--border-strong);
    border-radius: 13px; box-shadow: var(--shadow); z-index: 70;
}
.user-drop.open { display: block; animation: drop-in .16s ease; }
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.user-drop a, .user-drop button {
    display: block; width: 100%; padding: 9px 11px; border-radius: 9px;
    font-size: 13px; color: var(--muted); text-align: left;
    background: none; border: none; cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.user-drop a:hover, .user-drop button:hover { background: var(--surface); color: var(--text); }
.user-drop .u-head { padding: 8px 11px 12px; border-bottom: 1px solid var(--border); margin-bottom: 5px; }
.user-drop .u-head b { display: block; font-size: 14px; }
.user-drop .u-head span { font-size: 12px; color: var(--muted-2); }

/* ============ 布局 ============ */
/* 底部留白 44：再多就会让 1440×900 撑出一条 30 多 px 的竖向滚动条 */
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 26px 44px; }

.hero { padding: 16px 0 14px; text-align: center; }
.hero-tag {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 12px 5px 9px; margin-bottom: 12px;
    border-radius: 999px; font-size: 12px; color: #b9c2e0;
    background: var(--surface); border: 1px solid var(--border-strong);
}
.ht-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.hero h1 {
    margin: 0; font-size: clamp(25px, 3vw, 33px);
    font-weight: 760; letter-spacing: -1px; line-height: 1.24;
}
.hero h1 .g {
    background: linear-gradient(100deg, #fff 6%, #c8c2ff 42%, #8fd8ff 88%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { margin: 8px auto 0; max-width: 600px; font-size: 14px; color: var(--muted); }

.notice {
    display: none; margin: 0 0 18px;
    padding: 11px 15px; border-radius: 12px;
    font-size: 13px; color: #cfd6f5;
    background: rgba(34, 211, 238, .07);
    border: 1px solid rgba(34, 211, 238, .22);
}
.notice.show { display: block; }

/* ============ 工作台 ============ */
.studio {
    display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
    gap: 20px; align-items: start;
}

.panel {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .018));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    /* 不能用 overflow:hidden，否则内部 sticky 生成条失效 */
    overflow: visible;
}
.panel::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: linear-gradient(160deg, rgba(255, 255, 255, .1), transparent 38%);
    mask-image: linear-gradient(180deg, #000, transparent 30%);
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 30%);
    opacity: .5;
}

.panel-head {
    display: flex; align-items: center; gap: 9px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px; font-weight: 600; letter-spacing: .1px;
}
.panel-head .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 10px rgba(124, 92, 255, .8);
}
.ph-title { color: var(--text); }
.ph-hint { margin-left: auto; font-size: 11.5px; font-weight: 400; color: var(--muted-2); }

.gen-running {
    display: inline-flex; align-items: center; gap: 5px;
    margin-left: 4px; padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 500; color: #cbbdff;
    background: rgba(124, 92, 255, .16); border: 1px solid rgba(124, 92, 255, .32);
}

.panel-body { padding: 18px; position: relative; }

/* 参数区块 */
.blk { margin-bottom: 15px; }
.blk:last-of-type { margin-bottom: 12px; }
.blk-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.blk-head::before {
    content: ''; flex: none; width: 3px; height: 13px; border-radius: 2px;
    background: var(--grad); opacity: .95;
    box-shadow: 0 0 10px rgba(124, 92, 255, .5);
}
.blk-title { font-size: 13px; font-weight: 600; color: #dbe1f7; letter-spacing: .1px; }
.blk-aside { margin-left: auto; font-size: 11.5px; color: var(--muted-2); }

/* 生成方式 */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 11px 6px; border-radius: 12px;
    background: rgba(0, 0, 0, .22);
    border: 1px solid var(--border);
    color: var(--muted); font-size: 12.5px; cursor: pointer;
    transition: all .18s ease;
}
.seg button svg { width: 19px; height: 19px; opacity: .8; transition: opacity .18s ease; }
.seg button:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.seg button.active {
    color: #fff;
    background: linear-gradient(160deg, rgba(124, 92, 255, .26), rgba(77, 124, 255, .12));
    border-color: rgba(124, 92, 255, .55);
    box-shadow: 0 8px 22px rgba(124, 92, 255, .2), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.seg button.active svg { opacity: 1; }

/* 提示词输入 */
.prompt-box {
    border-radius: 14px;
    background: rgba(0, 0, 0, .28);
    border: 1px solid var(--border-strong);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.prompt-box:focus-within {
    border-color: rgba(124, 92, 255, .7);
    box-shadow: 0 0 0 4px rgba(124, 92, 255, .12);
}
.prompt-box textarea {
    display: block; width: 100%; min-height: 90px; max-height: 240px;
    padding: 13px 14px 4px;
    background: transparent; border: none; outline: none; resize: vertical;
    color: var(--text); font-family: inherit; font-size: 13.5px; line-height: 1.72;
}
.prompt-box textarea::placeholder { color: var(--muted-2); }
.prompt-foot { display: flex; align-items: center; gap: 8px; padding: 4px 10px 9px; }
.prompt-foot .count { font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.prompt-foot .spacer { flex: 1; }

.btn-optimize {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 11px; border-radius: 9px;
    font-size: 12px; font-weight: 500; color: #cdc2ff;
    background: rgba(124, 92, 255, .14);
    border: 1px solid rgba(124, 92, 255, .34);
    cursor: pointer; transition: all .18s ease;
}
.btn-optimize .ico { font-size: 11px; opacity: .9; }
.btn-optimize:hover {
    background: rgba(124, 92, 255, .26);
    border-color: rgba(124, 92, 255, .62);
    color: #fff;
    box-shadow: 0 6px 16px rgba(124, 92, 255, .25);
}
.btn-optimize:disabled { cursor: wait; opacity: .75; }
.btn-optimize.need { opacity: .55; color: var(--muted); background: rgba(255, 255, 255, .04); border-color: var(--border); }
.btn-optimize.need .ico { opacity: .45; }
.btn-optimize.need:hover { opacity: .85; background: rgba(255, 95, 122, .12); border-color: rgba(255, 95, 122, .4); color: #ffc4ce; }
.btn-optimize.loading .ico { animation: opt-spin 1.1s linear infinite; display: inline-block; }
@keyframes opt-spin { to { transform: rotate(360deg); } }

.need-flash { animation: need-flash .8s ease; }
@keyframes need-flash {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 95, 122, 0); border-color: var(--border-strong); }
    35% { box-shadow: 0 0 0 3px rgba(255, 95, 122, .28); border-color: rgba(255, 95, 122, .65); }
}

.prompt-undo {
    padding: 5px 10px; border-radius: 8px;
    font-size: 11.5px; color: var(--muted);
    background: transparent; border: 1px solid var(--border);
    cursor: pointer; transition: all .18s ease;
}
.prompt-undo:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }

/* 参考图 */
.refs { display: flex; flex-wrap: wrap; gap: 10px; }
.ref-item {
    position: relative; width: 84px; height: 84px; border-radius: 13px; overflow: hidden;
    border: 1px solid var(--border-strong); background: rgba(0, 0, 0, .34);
}
.ref-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-item .rm {
    position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%;
    background: rgba(0, 0, 0, .68); border: none; color: #fff; cursor: pointer; font-size: 12px;
    display: grid; place-items: center; line-height: 1; transition: background .15s ease;
}
.ref-item .rm:hover { background: var(--danger); }
.ri-idx {
    position: absolute; left: 5px; bottom: 5px;
    min-width: 17px; height: 17px; padding: 0 4px; border-radius: 6px;
    display: grid; place-items: center;
    font-size: 10.5px; font-weight: 700; color: #fff;
    background: rgba(0, 0, 0, .68); border: 1px solid rgba(255, 255, 255, .2);
}
.ref-add {
    display: grid; place-items: center;
    width: 84px; height: 84px; border-radius: 13px;
    font-size: 22px; color: var(--muted-2);
    background: rgba(255, 255, 255, .02);
    border: 1.5px dashed rgba(255, 255, 255, .16);
    cursor: pointer; transition: all .18s ease;
}
.ref-add:hover { color: #cbbdff; border-color: rgba(124, 92, 255, .55); background: rgba(124, 92, 255, .08); }
.ref-add.txt { font-size: 12.5px; }

/* 模型卡片 */
.model-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.mc {
    position: relative; display: flex; flex-direction: column; gap: 2px;
    min-height: 76px;
    padding: 8px 10px; text-align: left;
    border-radius: 11px; cursor: pointer;
    background: rgba(0, 0, 0, .22);
    border: 1px solid var(--border);
    color: var(--text);
    transition: all .18s ease;
}
.mc:hover { border-color: var(--border-strong); background: var(--surface); transform: translateY(-1px); }
.mc-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.mc-name { font-size: 12.2px; font-weight: 600; letter-spacing: -.1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-badge {
    flex: none; padding: 1px 4px; border-radius: 4px;
    font-size: 9px; font-weight: 700; letter-spacing: .2px;
    color: #cbbdff; background: rgba(124, 92, 255, .2);
    border: 1px solid rgba(124, 92, 255, .34);
}
.mc-desc {
    font-size: 10.5px; color: var(--muted-2); line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 15px;
}
.mc-foot { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.mc-cost { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mc-tick {
    margin-left: auto; display: grid; place-items: center;
    width: 14px; height: 14px; border-radius: 50%;
    font-size: 8.5px; color: #fff;
    background: var(--grad); opacity: 0; transform: scale(.5);
    transition: all .18s cubic-bezier(.3, 1.4, .5, 1);
}
.mc.active {
    background: linear-gradient(160deg, rgba(124, 92, 255, .24), rgba(77, 124, 255, .08));
    border-color: rgba(124, 92, 255, .6);
    box-shadow: 0 8px 22px rgba(124, 92, 255, .18), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.mc.active .mc-name { color: #fff; }
.mc.active .mc-desc { color: #a99cf0; }
.mc.active .mc-tick { opacity: 1; transform: scale(1); }

/* 比例选择 */
.ratio-pills {
    display: flex; flex-wrap: wrap; gap: 6px;
    max-height: 118px; overflow-y: auto;
    padding: 2px 2px 2px 0;
    scrollbar-width: thin;
}
.rp {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 10px 6px 8px; border-radius: 10px;
    background: rgba(0, 0, 0, .22);
    border: 1px solid var(--border);
    color: var(--muted); font-size: 11.5px; cursor: pointer;
    transition: all .16s ease;
    flex: none;
}
.rp:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.rp-shape {
    flex: none; display: block; border-radius: 3px;
    background: rgba(255, 255, 255, .32);
    border: 1px solid rgba(255, 255, 255, .46);
    transition: all .16s ease;
}
.rp-label { font-variant-numeric: tabular-nums; letter-spacing: -.1px; }
.rp-sub { font-size: 10px; color: var(--muted-2); }
.rp.active {
    color: #fff;
    background: linear-gradient(160deg, rgba(124, 92, 255, .28), rgba(77, 124, 255, .1));
    border-color: rgba(124, 92, 255, .6);
    box-shadow: 0 6px 18px rgba(124, 92, 255, .2);
}
.rp.active .rp-shape { background: #fff; border-color: #fff; }
.rp-auto .rp-shape { background: transparent; border: 1px dashed rgba(255, 255, 255, .5); }
.rp-auto.active .rp-shape { background: transparent; border-color: rgba(255, 255, 255, .85); }
.rp.active .rp-sub { color: #c3b6ff; }

/* 表单元素 */
.grid2 { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 12px; margin-top: 12px; }
.field { margin-bottom: 0; }
.field > label, .lbl {
    display: block; margin-bottom: 7px;
    font-size: 11.5px; color: var(--muted); letter-spacing: .2px;
}
.sel {
    width: 100%; padding: 10px 34px 10px 12px; border-radius: 11px;
    background-color: rgba(0, 0, 0, .28); color: var(--text);
    border: 1px solid var(--border-strong); font-size: 13px; outline: none; cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23939cb8' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.sel:hover { border-color: rgba(255, 255, 255, .24); }
.sel:focus { border-color: rgba(124, 92, 255, .7); box-shadow: 0 0 0 3px rgba(124, 92, 255, .14); }
.sel option { background: #12141f; color: #eaeefb; }

/* 模型与画面比例改用下拉：卡片、胶囊保留在 DOM 里（渲染逻辑不动），只是不再展示 */
.model-grid, .ratio-pills { display: none; }

/* =========================================================
   自定义下拉（外观与交互参考 uView 的 u-select）
   原生 select 藏在 .msel 里当唯一状态源，用户看到的是 .cs
   ========================================================= */
.msel { position: relative; display: block; }
.msel > .sel {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; pointer-events: none;   /* 纯状态源，视觉交给 .cs */
}

.cs { position: relative; }

.cs-trigger {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; min-height: 40px;
    background: rgba(0, 0, 0, .28); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 11px;
    font-size: 13px; text-align: left; cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.cs-trigger:hover { border-color: rgba(255, 255, 255, .24); background: rgba(255, 255, 255, .035); }
.cs.is-open > .cs-trigger {
    border-color: rgba(124, 92, 255, .7);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, .14);
}
.cs-val {
    flex: 1; min-width: 0;
    display: flex; align-items: baseline; gap: 8px;
    overflow: hidden; white-space: nowrap;
}
.cs-t-main {
    flex: none; max-width: 100%; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis;
}
.cs-t-sub {
    min-width: 0; font-size: 12px; color: var(--muted);
    overflow: hidden; text-overflow: ellipsis;
}
.cs-caret {
    flex: none; width: 12px; height: 12px; color: var(--muted);
    transition: transform .2s ease;
}
.cs.is-open .cs-caret { transform: rotate(180deg); color: var(--accent); }

.cs-panel {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 70;
    display: none; padding: 6px;
    max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
    background: rgba(16, 18, 28, .985);
    border: 1px solid var(--border-strong); border-radius: 14px;
    box-shadow: 0 22px 50px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .04);
    backdrop-filter: blur(16px);
}
.cs.is-open > .cs-panel { display: block; animation: csIn .16s ease; }
.cs-panel.up { top: auto; bottom: calc(100% + 6px); }
@keyframes csIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

.cs-panel::-webkit-scrollbar { width: 8px; }
.cs-panel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 8px; }
.cs-panel::-webkit-scrollbar-track { background: transparent; }

.cs-opt {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: 9px;
    background: transparent; color: var(--text); font-family: inherit;
    text-align: left; cursor: pointer;
    transition: background .14s ease;
}
.cs-opt:hover { background: rgba(255, 255, 255, .06); }
.cs-opt.active { background: var(--accent-soft); }
.cs-opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cs-opt-t {
    font-size: 13px; font-weight: 600; line-height: 1.45;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-opt.active .cs-opt-t { color: #fff; }
.cs-opt-d {
    font-size: 11.5px; color: var(--muted); line-height: 1.45;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-opt-x { flex: none; font-size: 11.5px; color: var(--muted-2); letter-spacing: .2px; }
.cs-check { flex: none; width: 14px; height: 14px; color: var(--accent); opacity: 0; }
.cs-opt.active .cs-check { opacity: 1; }

/* 比例下拉里的形状预览 */
.cs-shape {
    flex: none; border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 3px; background: rgba(255, 255, 255, .06);
}
.cs-opt.active .cs-shape { border-color: rgba(124, 92, 255, .9); background: rgba(124, 92, 255, .3); }

/* 透明背景勾选卡片 */
.bgchk {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    margin: 12px 0 0; padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
    cursor: pointer; -webkit-user-select: none; user-select: none;
    transition: border-color .18s ease, background .18s ease;
}
.bgchk:hover { border-color: rgba(124, 92, 255, .5); background: rgba(124, 92, 255, .07); }
.bgchk input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.bgchk-box {
    position: relative; flex: 0 0 18px; width: 18px; height: 18px;
    border-radius: 6px; border: 1.5px solid var(--border-strong);
    background: rgba(0, 0, 0, .28);
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.bgchk-box::after {
    content: ''; position: absolute; left: 5.5px; top: 1px;
    width: 4px; height: 8.5px; border-radius: 1px;
    border-right: 2px solid #fff; border-bottom: 2px solid #fff;
    transform: rotate(42deg) scale(.3); opacity: 0;
    transition: transform .2s cubic-bezier(.3, 1.4, .5, 1), opacity .12s ease;
}
.bgchk-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bgchk-text b { font-size: 13px; font-weight: 600; letter-spacing: .1px; color: var(--text); transition: color .18s ease; }
.bgchk-text i { font-style: normal; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bgchk-tag {
    margin-left: auto; flex: none;
    font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .6px; color: var(--muted);
    padding: 4px 7px; border-radius: 6px; border: 1px solid var(--border);
    background-color: rgba(255, 255, 255, .03);
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, .16) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .16) 75%),
        linear-gradient(45deg, rgba(255, 255, 255, .16) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .16) 75%);
    background-size: 6px 6px, 6px 6px;
    background-position: 0 0, 3px 3px;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}
.bgchk input:checked ~ .bgchk-box {
    border-color: transparent;
    background: linear-gradient(135deg, #8f6bff, #6a45f0);
    box-shadow: 0 2px 10px rgba(124, 92, 255, .45);
}
.bgchk input:checked ~ .bgchk-box::after { opacity: 1; transform: rotate(42deg) scale(1); }
.bgchk input:checked ~ .bgchk-text b { color: #cbbdff; }
.bgchk input:focus-visible ~ .bgchk-box { box-shadow: 0 0 0 3px rgba(124, 92, 255, .32); }
.bgchk:has(input:checked) { border-color: rgba(124, 92, 255, .55); background: rgba(124, 92, 255, .12); }
.bgchk:has(input:checked) .bgchk-tag { color: #cbbdff; border-color: rgba(124, 92, 255, .5); background-color: rgba(124, 92, 255, .12); }
.bgchk:has(input:checked) .bgchk-text i { color: #a99cf0; }

/* 生成条 */
.gen-bar {
    position: sticky; bottom: 0; z-index: 20;
    display: flex; flex-direction: column; gap: 7px;
    margin: 4px -19px -19px; padding: 12px 18px 12px;
    border-radius: 0 0 var(--radius) var(--radius);
    background: linear-gradient(180deg, rgba(10, 12, 23, .6), rgba(10, 12, 23, .97) 42%);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.gen-row { display: flex; align-items: center; gap: 12px; }
.btn-gen {
    flex: 1; height: 47px; border-radius: 13px;
    font-size: 15px; font-weight: 700; letter-spacing: .3px;
    position: relative; overflow: hidden;
}
.btn-gen .ico { font-size: 14px; }
.btn-gen::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, .3) 42%, transparent 62%);
    transform: translateX(-120%);
    animation: sheen 3.6s ease-in-out infinite;
}
@keyframes sheen { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.btn-gen.running::after { animation-duration: 1.6s; }
.cost { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }
.cost b {
    font-size: 14px; font-weight: 700; color: #cbbdff; font-variant-numeric: tabular-nums;
}
.gen-note { font-size: 10.5px; color: var(--muted-2); text-align: center; }

.hint { margin-top: 10px; font-size: 11.5px; color: var(--muted-2); line-height: 1.65; }

@media (min-width: 1081px) {
    .panel-result { position: sticky; top: 78px; }
}

/* 画布 */
.canvas {
    position: relative;
    display: grid; place-items: center;
    min-height: 470px; max-height: 64vh;
    border-radius: 16px; overflow: hidden;
    background-color: #0b0d16;
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, .024) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .024) 75%),
        linear-gradient(45deg, rgba(255, 255, 255, .024) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .024) 75%);
    background-size: 22px 22px;
    background-position: 0 0, 11px 11px;
    border: 1px solid var(--border);
}
.canvas > img.result {
    display: block; width: auto; height: auto;
    max-width: 100%; max-height: 64vh; object-fit: contain;
    animation: fade-up .36s ease;
}
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.canvas-empty {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 40px 20px; text-align: center; color: var(--muted-2);
}
.canvas-empty .ico {
    display: grid; place-items: center;
    width: 56px; height: 56px; border-radius: 18px;
    font-size: 22px; color: #a99cf0;
    background: radial-gradient(circle at 50% 40%, rgba(124, 92, 255, .22), rgba(124, 92, 255, .04));
    border: 1px solid rgba(124, 92, 255, .24);
    box-shadow: 0 12px 30px rgba(124, 92, 255, .14);
}
.canvas-empty p { margin: 0; font-size: 13px; }

/* 空态灵感胶囊 */
.eg-row {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
    max-width: 420px; margin-top: 6px;
}
.eg-label {
    flex: 0 0 100%; text-align: center;
    font-size: 11px; color: var(--muted-2); letter-spacing: .3px; margin-bottom: 1px;
}
.eg {
    padding: 7px 13px; border-radius: 999px;
    font-size: 12px; color: #b9c2e0; font-family: inherit;
    background: var(--surface); border: 1px solid var(--border-strong);
    cursor: pointer; transition: all .18s ease;
}
.eg:hover {
    color: #fff; transform: translateY(-1px);
    border-color: rgba(124, 92, 255, .6);
    background: rgba(124, 92, 255, .14);
    box-shadow: 0 8px 20px rgba(124, 92, 255, .18);
}

.gen-state {
    /* 画布是 grid + place-items:center，不给宽度会被内容压成一条细线（进度条会只剩几十像素） */
    width: 100%; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 46px 20px 24px; text-align: center;
}
.gen-ring {
    width: 42px; height: 42px; border-radius: 50%;
    border: 3px solid rgba(124, 92, 255, .2);
    border-top-color: var(--accent);
    border-right-color: var(--accent-2);
    animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gen-state .t { font-size: 14px; font-weight: 600; color: #dfe4f8; }
.gen-state .s { font-size: 12px; color: var(--muted-2); }
.skeleton {
    width: min(340px, 78%); height: 5px; margin: 0 auto 40px;
    border-radius: 999px; overflow: hidden;
    background: rgba(255, 255, 255, .07);
}
.skeleton::after {
    content: ''; display: block; width: 40%; height: 100%;
    background: var(--grad); border-radius: inherit;
    animation: sk 1.4s ease-in-out infinite;
}
@keyframes sk { 0% { transform: translateX(-100%); } 100% { transform: translateX(320%); } }

.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* 最近生成 */
.recent { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.recent-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; font-size: 12.5px; color: var(--muted);
}
.recent-head a { font-size: 12px; color: #a99cf0; }
.recent-head a:hover { color: #cbbdff; }
.recent-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.recent-item {
    position: relative; border-radius: 12px; overflow: hidden; cursor: pointer;
    background: rgba(0, 0, 0, .3); border: 1px solid var(--border);
    transition: border-color .18s ease, transform .18s ease;
}
.recent-item:hover { border-color: rgba(124, 92, 255, .45); transform: translateY(-2px); }
.recent-item .ri-thumb { position: relative; aspect-ratio: 1 / 1; overflow: hidden; }
.recent-item .ri-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recent-item .ri-thumb .ph {
    display: grid; place-items: center; width: 100%; height: 100%;
    font-size: 20px; color: var(--muted-2);
    background: rgba(255, 255, 255, .03);
}
.recent-item .ri-thumb .ph.bad { color: var(--danger); background: rgba(255, 95, 122, .08); }
.recent-item .ri-thumb .ph.run { color: #cbbdff; background: rgba(124, 92, 255, .1); }
.recent-item .ri-info { padding: 7px 8px 8px; }
.recent-item .ri-prompt {
    font-size: 11px; color: var(--muted); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.recent-item .ri-err {
    margin-top: 3px; font-size: 10.5px; color: #ffb3bf; line-height: 1.45;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-item .ri-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.recent-item .ri-tag {
    padding: 1px 5px; border-radius: 4px; font-size: 9.5px;
    color: var(--muted-2); background: rgba(255, 255, 255, .05);
    border: 1px solid var(--border);
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-item .ri-tag.ok { color: #7ee2b8; background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .28); }
.recent-item .ri-tag.bad { color: #ffb3bf; background: rgba(255, 95, 122, .12); border-color: rgba(255, 95, 122, .28); }
.recent-item .ri-tag.run { color: #cbbdff; background: rgba(124, 92, 255, .14); border-color: rgba(124, 92, 255, .3); }

/* ============ 其它页面 ============ */
.sec { animation: fade-up .3s ease; }
.sec-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 34px 0 20px; }
.sec-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.sec-head p { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.sec-head .spacer { flex: 1; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, .25); border: 1px solid var(--border); }
.tabs .tab, .tab {
    padding: 6px 13px; border-radius: 9px; border: none; background: transparent;
    color: var(--muted); font-size: 12.5px; cursor: pointer; transition: all .16s ease;
}
.tabs .tab:hover, .tab:hover { color: var(--text); }
.tabs .tab.active, .tab.active { color: #fff; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong); }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 14px; }
.card {
    position: relative; border-radius: 16px; overflow: hidden; cursor: pointer;
    background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015));
    border: 1px solid var(--border);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
    animation: fade-up .3s ease;
}
.card:hover { transform: translateY(-3px); border-color: rgba(124, 92, 255, .45); box-shadow: 0 18px 40px rgba(0, 0, 0, .4); }
.card .thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: rgba(0, 0, 0, .3); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.card:hover .thumb img { transform: scale(1.045); }
.card .thumb .ph {
    display: grid; place-items: center; width: 100%; height: 100%;
    font-size: 22px; color: var(--muted-2); background: rgba(255, 255, 255, .03);
}
.card .tag {
    position: absolute; left: 9px; top: 9px;
    padding: 3px 8px; border-radius: 7px;
    font-size: 10.5px; color: #e5e9f8;
    background: rgba(6, 8, 15, .72); border: 1px solid rgba(255, 255, 255, .14);
    backdrop-filter: blur(6px); max-width: calc(100% - 18px);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .use {
    position: absolute; right: 9px; bottom: 9px;
    padding: 4px 9px; border-radius: 8px;
    font-size: 11px; color: #fff;
    background: rgba(124, 92, 255, .82);
    opacity: 0; transform: translateY(4px);
    transition: all .18s ease;
}
.card:hover .use { opacity: 1; transform: none; }
.card .meta { padding: 10px 12px 12px; }
.card .meta .t { font-size: 13px; font-weight: 600; line-height: 1.45; }
.card .meta .d {
    margin-top: 3px; font-size: 11.5px; color: var(--muted-2); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.load-more { display: flex; justify-content: center; padding: 26px 0 8px; }

/* =========================================================
   示例：文章列表
   ========================================================= */
.ex-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.ex-item {
    display: grid; grid-template-columns: 148px minmax(0, 1fr);
    border-radius: 16px; overflow: hidden; cursor: pointer; text-align: left;
    background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015));
    border: 1px solid var(--border);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
    animation: fade-up .3s ease;
    content-visibility: auto; contain-intrinsic-size: auto 120px;
}
.ex-item:hover { transform: translateY(-2px); border-color: rgba(124, 92, 255, .45); box-shadow: 0 16px 36px rgba(0, 0, 0, .38); }
.ex-item:active { transform: translateY(0); }
.ex-cover { position: relative; overflow: hidden; background: rgba(0, 0, 0, .3); }
.ex-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.ex-item:hover .ex-cover img { transform: scale(1.045); }
.ex-cover .ph {
    display: grid; place-items: center; width: 100%; height: 100%;
    font-size: 22px; color: var(--muted-2); background: rgba(255, 255, 255, .03);
}
.ex-cat {
    position: absolute; left: 8px; top: 8px; max-width: calc(100% - 16px);
    padding: 2px 7px; border-radius: 6px; font-size: 10px; color: #e5e9f8;
    background: rgba(6, 8, 15, .72); border: 1px solid rgba(255, 255, 255, .14);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ex-body { min-width: 0; padding: 12px 14px 11px; display: flex; flex-direction: column; }
.ex-t {
    margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.45; letter-spacing: -.2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ex-s {
    margin: 6px 0 0; font-size: 12px; line-height: 1.65; color: var(--muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ex-meta { margin-top: auto; padding-top: 9px; display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--muted-2); }
.ex-go { margin-left: auto; color: #cbbdff; white-space: nowrap; flex: none; }
/* 制作方式角标：与左上角的分类标签对角摆放，封面窄时也不会挤在一起 */
.ex-kind {
    position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 6px;
    font-size: 10px; font-weight: 600; letter-spacing: .2px; color: #d9d2ff;
    background: rgba(6, 8, 15, .76); border: 1px solid rgba(124, 92, 255, .42);
}
.ex-kind-image { color: #c3e6ff; border-color: rgba(64, 170, 255, .44); }
.ex-kind-ref { color: #ffe1bb; border-color: rgba(255, 176, 80, .44); }

/* =========================================================
   示例：文章页
   ========================================================= */
.art-wrap { max-width: 1120px; margin: 0 auto; }
.art-top { display: flex; align-items: center; gap: 12px; padding: 22px 0 14px; }
.art-back {
    display: inline-flex; align-items: center; gap: 4px; flex: none;
    padding: 6px 12px 6px 8px; border-radius: 999px;
    font-size: 12.5px; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border);
    transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.art-back:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.art-back svg { width: 14px; height: 14px; }
.art-crumb { min-width: 0; font-size: 12px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.art-head { padding-top: 6px; }
.art-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.art-tags span {
    padding: 3px 9px; border-radius: 7px;
    font-size: 11px; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border);
}
.art-tags span.acc { color: #cbbdff; background: rgba(124, 92, 255, .14); border-color: rgba(124, 92, 255, .3); }
.art-tags span.kind { color: #cfe6ff; background: rgba(64, 170, 255, .14); border-color: rgba(64, 170, 255, .32); }
.art-head h1 { margin: 0; font-size: 30px; line-height: 1.32; letter-spacing: -.8px; font-weight: 700; }
.art-lead { margin: 12px 0 0; max-width: 720px; font-size: 15px; line-height: 1.8; color: var(--muted); }
.art-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; font-size: 12px; color: var(--muted-2); }
.art-meta i { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }

/* ---------------------------------------------------------
   制作流程：参考图 → 提示词 → 结果图
   --------------------------------------------------------- */
.flow {
    margin-top: 24px; padding: 18px 20px 4px; border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012));
    border: 1px solid var(--border);
}
.flow-loading { padding: 30px 0; text-align: center; font-size: 13px; color: var(--muted-2); }
.flow-head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding-bottom: 15px; border-bottom: 1px dashed rgba(255, 255, 255, .09);
}
.flow-kind {
    padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
    color: #d9d2ff; background: rgba(124, 92, 255, .16); border: 1px solid rgba(124, 92, 255, .34);
}
.flow-chain { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted-2); }
.flow-chain span {
    padding: 2px 8px; border-radius: 6px; font-size: 11.5px; color: var(--muted);
    background: rgba(255, 255, 255, .05); border: 1px solid var(--border);
}
.flow-chain i { font-style: normal; opacity: .6; }

.flow-steps { list-style: none; margin: 0; padding: 16px 0 0; }
.flow-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; }
.flow-rail { position: relative; display: flex; flex-direction: column; align-items: center; }
.flow-dot {
    display: grid; place-items: center; flex: none;
    width: 24px; height: 24px; border-radius: 50%;
    font-size: 12px; font-weight: 700; font-style: normal; color: #e8e2ff;
    background: rgba(124, 92, 255, .18); border: 1px solid rgba(124, 92, 255, .5);
}
.flow-line {
    flex: 1 1 auto; width: 1px; margin: 5px 0 -4px;
    background: linear-gradient(180deg, rgba(124, 92, 255, .48), rgba(124, 92, 255, .1));
}
.flow-body { min-width: 0; padding-bottom: 20px; }
.flow-label {
    display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px;
    font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: .2px;
}
.flow-label em { font-style: normal; font-size: 11px; font-weight: 400; color: var(--muted-2); }

/* 参考图：1 张单独放大，2 张并排，3~6 张走三列网格（最多 6 张） */
.flow-refs { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 10px; max-width: 580px; }
.flow-refs.n1 { --cols: 1; max-width: 300px; }
.flow-refs.n2 { --cols: 2; max-width: 480px; }
/* 单张底图按原比例完整显示，多张参考图统一 4:3 裁切，网格才齐 */
.flow-refs.n1 .flow-ref img { aspect-ratio: auto; }
.flow-ref {
    position: relative; padding: 0; overflow: hidden; cursor: zoom-in;
    border-radius: 12px; border: 1px solid var(--border); background: rgba(0, 0, 0, .3);
}
.flow-ref img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .32s ease; }
.flow-ref:hover img { transform: scale(1.03); }
.flow-ref-no {
    position: absolute; left: 7px; top: 7px; display: grid; place-items: center;
    width: 18px; height: 18px; border-radius: 50%; font-size: 10.5px; color: #e8ecf8;
    background: rgba(6, 8, 15, .78); border: 1px solid rgba(255, 255, 255, .18);
}

/* 提示词：等宽字体，保留换行 */
.flow-prompt { position: relative; padding: 14px 15px; border-radius: 14px; background: rgba(0, 0, 0, .34); border: 1px solid var(--border); }
.flow-prompt pre {
    margin: 0; padding-right: 50px; white-space: pre-wrap; word-break: break-word;
    font-family: inherit;
    font-size: 14px; line-height: 1.9; letter-spacing: .1px; color: #cfd6e8;
}
.flow-copy {
    position: absolute; right: 10px; top: 10px; padding: 3px 9px; border-radius: 7px;
    font-size: 11px; color: #cbbdff; background: rgba(124, 92, 255, .14);
    border: 1px solid rgba(124, 92, 255, .32); cursor: pointer;
}
.flow-copy:hover { background: rgba(124, 92, 255, .26); }

/* 结果图：按图片本身比例显示，不裁切也不留黑边 */
.flow-out { display: flex; flex-direction: column; align-items: center; margin: 0; text-align: center; }
.flow-shot {
    display: block; padding: 0; overflow: hidden; cursor: zoom-in;
    border-radius: 16px; border: 1px solid var(--border); background: rgba(0, 0, 0, .3);
}
.flow-shot img {
    display: block; width: auto; height: auto; margin: 0 auto;
    max-width: 100%; max-height: min(52vh, 560px);
}
.flow-out figcaption { margin-top: 8px; font-size: 11.5px; color: var(--muted-2); }
.flow-out figcaption:empty { display: none; }
.flow-empty {
    padding: 22px; text-align: center; font-size: 12px; color: var(--muted-2);
    border: 1px dashed var(--border-strong); border-radius: 12px;
}

.art-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; margin-top: 30px; align-items: start; }

.art-h2 {
    display: flex; align-items: center; gap: 9px; margin: 0 0 16px;
    font-size: 17px; font-weight: 700; letter-spacing: -.3px; color: var(--text);
}
.art-h2::before { content: ''; flex: none; width: 4px; height: 16px; border-radius: 2px; background: var(--grad); }
.art-tip { margin: 0; font-size: 11.5px; line-height: 1.72; color: var(--muted-2); }
.art-tip:empty { display: none; }

.art-prose { font-size: 15.5px; line-height: 1.95; color: #d5daea; }
.art-prose p { margin: 0 0 18px; }
.art-prose h2 {
    display: flex; align-items: center; gap: 9px;
    margin: 34px 0 14px; font-size: 19px; font-weight: 700; letter-spacing: -.3px; color: var(--text);
}
.art-prose h2::before { content: ''; flex: none; width: 4px; height: 16px; border-radius: 2px; background: var(--grad); }
.art-prose h2:first-child { margin-top: 0; }
.art-prose h3 { margin: 24px 0 10px; font-size: 16px; font-weight: 600; color: var(--text); }
.art-prose ul, .art-prose ol { margin: 0 0 18px; padding-left: 20px; }
.art-prose li { margin-bottom: 9px; }
.art-prose li::marker { color: rgba(124, 92, 255, .8); }
.art-prose strong { color: #fff; font-weight: 600; }
.art-prose code {
    padding: 1px 5px; border-radius: 5px; font-size: .88em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: rgba(124, 92, 255, .16); color: #cbbdff;
}
.art-prose blockquote {
    margin: 0 0 18px; padding: 12px 16px; border-radius: 0 12px 12px 0;
    border-left: 2px solid rgba(124, 92, 255, .7);
    background: rgba(124, 92, 255, .09);
    font-size: 14px; line-height: 1.85; color: #cdd4e8;
}
.art-prose blockquote + blockquote { margin-top: -12px; }
.art-loading { color: var(--muted-2); font-size: 13px; }

.art-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 12px; }
.art-panel {
    padding: 15px 16px; border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015));
    border: 1px solid var(--border);
}
.ap-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; font-size: 12px; color: var(--muted); }
.ap-copy {
    padding: 3px 9px; border-radius: 7px; cursor: pointer;
    font-size: 11px; color: var(--muted);
    background: transparent; border: 1px solid var(--border-strong);
    transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.ap-copy:hover { color: var(--text); background: rgba(124, 92, 255, .14); border-color: rgba(124, 92, 255, .5); }
.ap-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 12px; margin: 0; }
.ap-list dt { font-size: 12px; color: var(--muted-2); }
.ap-list dd { margin: 0; font-size: 12.5px; color: var(--text); text-align: right; overflow-wrap: anywhere; }
.ap-prompt {
    max-height: 210px; overflow-y: auto; padding: 11px 12px; border-radius: 11px;
    font-size: 12px; line-height: 1.8; color: #cfd6ea;
    background: rgba(0, 0, 0, .32); border: 1px solid var(--border);
    white-space: pre-wrap; word-break: break-word;
}
.art-use { margin-top: 2px; }

.art-rel { margin-top: 46px; }
.rel-h { font-size: 17px; font-weight: 700; margin-bottom: 14px; letter-spacing: -.3px; }
.rel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rel-item {
    display: flex; flex-direction: column; border-radius: 14px; overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015));
    border: 1px solid var(--border);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.rel-item:hover { transform: translateY(-2px); border-color: rgba(124, 92, 255, .45); box-shadow: 0 14px 30px rgba(0, 0, 0, .35); }
.rel-img { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: rgba(0, 0, 0, .3); }
.rel-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rel-img .ph { display: grid; place-items: center; width: 100%; height: 100%; font-size: 20px; color: var(--muted-2); background: rgba(255, 255, 255, .03); }
.rel-t {
    padding: 10px 12px 0; font-size: 13px; font-weight: 600; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rel-d {
    padding: 5px 12px 12px; font-size: 11.5px; line-height: 1.6; color: var(--muted-2);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 卡密充值 */
.redeem-card {
    max-width: 520px; margin: 0 auto; padding: 34px 30px 30px;
    text-align: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015));
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.rc-ico {
    display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 16px;
    border-radius: 17px; color: #cbbdff;
    background: radial-gradient(circle at 50% 40%, rgba(124, 92, 255, .26), rgba(124, 92, 255, .05));
    border: 1px solid rgba(124, 92, 255, .28);
}
.rc-ico svg { width: 24px; height: 24px; }
.redeem-card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.redeem-card p { margin: 0 0 22px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.redeem-row { display: flex; gap: 10px; }
.inp {
    flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px;
    background: rgba(0, 0, 0, .3); border: 1px solid var(--border-strong);
    color: var(--text); font-size: 14px; outline: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .6px;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.inp::placeholder { color: var(--muted-2); letter-spacing: .5px; }
.inp:focus { border-color: rgba(124, 92, 255, .7); box-shadow: 0 0 0 3px rgba(124, 92, 255, .14); }
.rc-note { margin-top: 16px; font-size: 11.5px; color: var(--muted-2); }

/* ---------- API 接入 ---------- */
.api-card {
    max-width: 820px; margin: 0 auto 22px; padding: 22px 22px 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .015));
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.api-card-head { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 16px; }
.api-dot {
    width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; flex: none;
    background: var(--grad); box-shadow: 0 0 12px rgba(124, 92, 255, .8);
}
.api-card-t { flex: 1; min-width: 0; }
.api-card-t h3 { margin: 0 0 3px; font-size: 15.5px; font-weight: 700; }
.api-card-t p { margin: 0; font-size: 12px; color: var(--muted-2); line-height: 1.6; }
.api-quota {
    flex: none; font-size: 11.5px; color: var(--muted); padding: 4px 10px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
}
.api-keyrow { display: flex; align-items: center; gap: 8px; }
.api-keyrow code {
    flex: 1; min-width: 0; padding: 11px 13px; border-radius: 12px;
    background: rgba(0, 0, 0, .34); border: 1px solid var(--border-strong);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px; letter-spacing: .3px; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.abtn {
    flex: none; padding: 9px 13px; border-radius: 11px; cursor: pointer;
    font-size: 12.5px; font-family: inherit;
    color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong);
    transition: background .16s ease, border-color .16s ease;
}
.abtn:hover { background: var(--surface-3); border-color: rgba(255, 255, 255, .24); }
.abtn-warn { color: #ffc7d1; border-color: rgba(255, 95, 122, .32); background: rgba(255, 95, 122, .1); }
.abtn-warn:hover { background: rgba(255, 95, 122, .18); border-color: rgba(255, 95, 122, .5); }
.abtn.is-arm { color: #fff; background: rgba(255, 95, 122, .88); border-color: rgba(255, 95, 122, .95); }
.api-tip { margin-top: 11px; font-size: 11.5px; color: var(--muted-2); line-height: 1.7; }

.api-doc {
    max-width: 820px; margin: 0 auto; padding: 22px;
    background: rgba(255, 255, 255, .022); border: 1px solid var(--border);
    border-radius: var(--radius);
}
.ad-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.ad-title h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.ad-base { font-size: 11.5px; color: var(--muted-2); }
.ad-base code, .ad-sec p code, .ad-params code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px; padding: 1px 6px; border-radius: 6px;
    color: #cbbdff; background: rgba(124, 92, 255, .13);
}
.ad-sec { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--border); }
.ad-sec h4 { margin: 0 0 9px; font-size: 13.5px; font-weight: 650; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.ad-sec h4 em {
    font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--accent-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    padding: 1px 7px; border-radius: 6px; background: rgba(34, 211, 238, .1);
}
.ad-sec p { margin: 0 0 10px; font-size: 13px; color: var(--muted); line-height: 1.85; }
.ad-pre {
    margin: 0; padding: 13px 15px; border-radius: 12px; overflow-x: auto;
    background: rgba(0, 0, 0, .4); border: 1px solid var(--border);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px; line-height: 1.75; color: #cfd6ee; white-space: pre;
}
.ad-pre code { font-family: inherit; font-size: inherit; background: none; padding: 0; color: inherit; }
.ad-key, .ad-host { color: var(--accent-2); }
.ad-code { max-height: 420px; overflow-y: auto; }
.ad-params { display: flex; flex-direction: column; gap: 1px; margin-bottom: 12px; }
.ad-row {
    display: grid; grid-template-columns: 116px 62px 1fr; gap: 10px; align-items: baseline;
    padding: 8px 10px; border-radius: 9px; background: rgba(255, 255, 255, .022);
}
.ad-row code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px; color: #cbbdff;
}
.ad-row p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.ad-row p code { font-size: 11px; }
.ad-type { font-size: 11px; color: var(--muted-2); font-family: ui-monospace, Menlo, monospace; }
.ad-tabs { margin-bottom: 11px; }

.foot {
    display: flex; flex-direction: column; gap: 4px; align-items: center;
    padding: 40px 0 10px; font-size: 11.5px; color: var(--muted-2); text-align: center;
}

/* ============ 遮罩 / 弹窗 ============ */
.mask {
    position: fixed; inset: 0; z-index: 200;
    display: none; align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(3, 4, 9, .74);
    backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
    overflow-y: auto;
}
.mask.open { display: flex; animation: mask-in .2s ease; }
@keyframes mask-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
    position: relative; width: 100%; max-width: 430px;
    padding: 26px; border-radius: var(--radius);
    background: linear-gradient(180deg, #14161f, #0d0f18);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    animation: modal-in .24s cubic-bezier(.2, .9, .3, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.modal .sub { margin: 0 0 18px; font-size: 12.5px; color: var(--muted); }
.modal-close {
    position: absolute; right: 14px; top: 14px;
    display: grid; place-items: center;
    width: 30px; height: 30px; border-radius: 9px;
    background: transparent; border: 1px solid transparent;
    color: var(--muted); cursor: pointer; transition: all .16s ease;
}
.modal-close svg { width: 15px; height: 15px; }
.modal-close:hover { background: var(--surface); border-color: var(--border); color: var(--text); }

/* 扣次数确认 */
.gen-confirm { max-width: 452px; }
.gc-rows {
    display: flex; flex-direction: column; gap: 1px;
    border-radius: 13px; overflow: hidden;
    background: var(--border); border: 1px solid var(--border);
}
.gc-row {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 13px; font-size: 12.5px;
    background: #10121b;
}
.gc-row span { color: var(--muted-2); flex: none; min-width: 52px; }
.gc-row b { flex: 1; min-width: 0; font-weight: 500; color: var(--text); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-prompt {
    margin-top: 12px; padding: 11px 13px; border-radius: 12px;
    font-size: 12px; line-height: 1.7; color: var(--muted);
    background: rgba(0, 0, 0, .3); border: 1px solid var(--border);
    max-height: 116px; overflow-y: auto;
}
.gc-sum {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 14px; padding: 12px 14px; border-radius: 13px;
    background: linear-gradient(120deg, rgba(124, 92, 255, .16), rgba(34, 211, 238, .07));
    border: 1px solid rgba(124, 92, 255, .28);
}
.gc-cost { font-size: 13px; color: #dfe4f8; }
.gc-cost b { font-size: 17px; color: #d9cdff; font-variant-numeric: tabular-nums; }
.gc-balance { font-size: 12px; color: var(--muted); text-align: right; }
.gc-note { margin-top: 10px; font-size: 11.5px; color: var(--muted-2); line-height: 1.6; }
.gc-remember {
    display: flex; align-items: center; gap: 8px;
    margin-top: 14px; font-size: 12px; color: var(--muted); cursor: pointer;
}
.gc-remember input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.gc-actions { display: flex; gap: 10px; margin-top: 18px; }
.gc-actions .btn { flex: 1; height: 44px; }

/* 登录注册 */
.auth-box {
    position: relative; display: grid; grid-template-columns: 320px 1fr;
    width: 100%; max-width: 800px; overflow: hidden;
    border-radius: 22px;
    background: #0d0f18;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    animation: modal-in .26s cubic-bezier(.2, .9, .3, 1);
}
.auth-side {
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 30px 26px;
    background:
        radial-gradient(circle at 20% 0%, rgba(124, 92, 255, .32), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(34, 211, 238, .18), transparent 55%),
        #0b0d16;
    border-right: 1px solid var(--border);
}
.auth-brand { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: #dfe4f8; }
.auth-brand-ico {
    display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px;
    background: var(--grad); color: #fff; font-size: 12px;
}
.auth-side h2 {
    margin: 22px 0 12px; font-size: 26px; font-weight: 750; line-height: 1.34; letter-spacing: -.6px;
    background: linear-gradient(120deg, #fff, #c3b9ff 70%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-side p { margin: 0; font-size: 12.5px; color: #9aa3c0; line-height: 1.7; }
.auth-perks { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.auth-perks li { display: flex; gap: 10px; align-items: flex-start; }
.pk-ico {
    flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px;
    color: #cbbdff; background: rgba(124, 92, 255, .16); border: 1px solid rgba(124, 92, 255, .26);
}
.pk-ico svg { width: 15px; height: 15px; }
.auth-perks b { display: block; font-size: 12.5px; font-weight: 600; color: #e2e7f8; }
.auth-perks span { font-size: 11px; color: #7f88a6; line-height: 1.55; }
.auth-side-foot { margin-top: 26px; font-size: 10.5px; color: #5d6580; }

.auth-main { position: relative; padding: 34px 34px 28px; }
.auth-tabs {
    position: relative; display: flex; gap: 4px; margin-bottom: 20px;
    padding: 4px; width: fit-content;
    border-radius: 11px; background: rgba(0, 0, 0, .3); border: 1px solid var(--border);
}
.auth-tabs button {
    position: relative; z-index: 1; padding: 6px 18px; border-radius: 8px;
    background: transparent; border: none; color: var(--muted);
    font-size: 13px; font-weight: 500; cursor: pointer; transition: color .18s ease;
}
.auth-tabs button.active { color: #fff; }
.auth-ink {
    position: absolute; top: 4px; left: 4px; height: calc(100% - 8px);
    border-radius: 8px; background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--border-strong);
    transition: transform .22s cubic-bezier(.3, 1, .4, 1), width .22s ease;
    z-index: 0;
}
.auth-main h3 { margin: 0 0 5px; font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.auth-sub { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); }
.af { margin-bottom: 13px; }
.af-lbl { display: block; margin-bottom: 6px; font-size: 11.5px; color: var(--muted-2); }
.af-inp {
    display: flex; align-items: center; gap: 9px;
    padding: 0 13px; height: 44px; border-radius: 12px;
    background: rgba(0, 0, 0, .3); border: 1px solid var(--border-strong);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.af-inp:focus-within { border-color: rgba(124, 92, 255, .7); box-shadow: 0 0 0 3px rgba(124, 92, 255, .13); }
.af-ico { flex: none; width: 16px; height: 16px; color: var(--muted-2); }
.af-inp input {
    flex: 1; min-width: 0; height: 100%; background: transparent; border: none; outline: none;
    color: var(--text); font-size: 13.5px; font-family: inherit;
}
.af-inp input::placeholder { color: var(--muted-2); }
.af-eye {
    flex: none; display: grid; place-items: center; width: 26px; height: 26px;
    background: transparent; border: none; color: var(--muted-2); cursor: pointer;
    transition: color .16s ease;
}
.af-eye svg { width: 15px; height: 15px; }
.af-eye:hover, .af-eye.on { color: var(--text); }
.af-tip { margin-top: 5px; font-size: 11px; color: var(--muted-2); min-height: 15px; }
.af-tip.bad { color: #ffb3bf; }
.af-tip.ok { color: #7ee2b8; }
/* 注册风控提示：一行小字，不抢按钮视觉 */
.auth-note {
    margin: 2px 0 10px; padding-left: 10px; position: relative;
    font-size: 12px; line-height: 1.7; color: var(--muted-2);
}
.auth-note::before {
    content: ''; position: absolute; left: 0; top: 6px; bottom: 5px; width: 2px;
    border-radius: 2px; background: rgba(124, 92, 255, .55);
}
.auth-submit { height: 46px; margin-top: 6px; border-radius: 12px; font-size: 14.5px; }
.auth-arrow { width: 16px; height: 16px; transition: transform .18s ease; }
.auth-submit:hover .auth-arrow { transform: translateX(3px); }
.auth-foot { margin-top: 16px; text-align: center; font-size: 12px; color: var(--muted-2); }
.auth-foot a, .auth-foot button {
    color: #a99cf0; background: none; border: none; cursor: pointer; font-size: 12px; padding: 0;
}
.auth-foot a:hover, .auth-foot button:hover { color: #cbbdff; }

/* 模板详情 */
.tmpl-modal {
    position: relative; display: grid; grid-template-columns: 1.15fr 1fr;
    width: 100%; max-width: 840px; overflow: hidden;
    border-radius: 22px; background: #0d0f18;
    border: 1px solid var(--border-strong); box-shadow: var(--shadow);
    animation: modal-in .26s cubic-bezier(.2, .9, .3, 1);
}
.tmpl-preview { background: #08090f; display: grid; place-items: center; min-height: 340px; }
.tmpl-preview img { width: 100%; height: 100%; max-height: 78vh; object-fit: contain; display: block; }
.tmpl-info { position: relative; padding: 28px 26px 24px; display: flex; flex-direction: column; }
.tmpl-info h3 { margin: 0 0 12px; font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.tmpl-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tmpl-tags span {
    padding: 3px 9px; border-radius: 7px;
    font-size: 11px; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border);
}
.tmpl-tags span.acc { color: #cbbdff; background: rgba(124, 92, 255, .14); border-color: rgba(124, 92, 255, .3); }
.tmpl-lbl { font-size: 11.5px; color: var(--muted-2); margin-bottom: 7px; }
.tmpl-prompt {
    flex: 1; min-height: 120px; max-height: 260px; overflow-y: auto;
    padding: 12px 13px; border-radius: 12px;
    font-size: 12.5px; line-height: 1.75; color: #cfd6ea;
    background: rgba(0, 0, 0, .3); border: 1px solid var(--border);
    white-space: pre-wrap; word-break: break-word;
}
.tmpl-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* 灯箱 */
.lightbox {
    position: fixed; inset: 0; z-index: 300;
    display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    padding: 30px;
    background: rgba(3, 4, 9, .93);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.lightbox.open { display: flex; animation: mask-in .2s ease; }
.lightbox img {
    max-width: min(1100px, 94vw); max-height: 78vh;
    border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
    object-fit: contain;
}

/* Toast */
.toast {
    position: fixed; left: 50%; bottom: 34px; z-index: 400;
    transform: translate(-50%, 20px);
    max-width: min(520px, 92vw);
    padding: 11px 18px; border-radius: 12px;
    font-size: 13px; color: var(--text); text-align: center;
    background: rgba(20, 22, 33, .96);
    border: 1px solid var(--border-strong);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
    opacity: 0; pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(52, 211, 153, .4); }
.toast.err { border-color: rgba(255, 95, 122, .45); }

/* ============ 响应式 ============ */
@media (max-width: 1200px) {
    .model-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
    .studio { grid-template-columns: minmax(0, 1fr); }
    .canvas { max-height: 58vh; min-height: 360px; }
    .canvas > img.result { max-height: 58vh; }
}

@media (max-width: 860px) {
    /* 顶部栏去掉 backdrop-filter：它会为子元素生成 containing block，
       导致 .nav-links 的 position:fixed 相对 nav 而不是视口定位 */
    .nav {
        height: 56px; padding: 0 14px; gap: 14px;
        background: rgba(7, 8, 15, .94);
        backdrop-filter: none; -webkit-backdrop-filter: none;
    }
    .brand-text { font-size: 14px; }
    /* 底部留出 tabbar 高度 + iOS 安全区 */
    .wrap { padding: 0 14px calc(86px + env(safe-area-inset-bottom)); }

    /* ---------- 底部 tabbar（复用顶部那组导航） ---------- */
    .nav-links {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        height: calc(58px + env(safe-area-inset-bottom));
        padding: 0 0 env(safe-area-inset-bottom);
        align-items: stretch; justify-content: space-around; gap: 0;
        background: rgba(9, 11, 20, .96);
        border-top: 1px solid var(--border-strong);
        box-shadow: 0 -10px 28px rgba(0, 0, 0, .5);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }
    .nav-links a {
        flex: 1; flex-direction: column; justify-content: center; gap: 3px;
        padding: 0; border-radius: 0;
        font-size: 10.5px; color: var(--muted-2);
        -webkit-tap-highlight-color: transparent;
    }
    .nav-links a:hover { color: var(--muted-2); background: transparent; }
    .nav-links a.active { color: #fff; background: transparent; box-shadow: none; }
    .nav-links a.active::before {
        content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
        width: 22px; height: 2.5px; border-radius: 0 0 3px 3px;
        background: var(--grad);
        box-shadow: 0 0 12px rgba(124, 92, 255, .7);
    }
    .nav-links a .txt { display: block; letter-spacing: .2px; }
    .nav-links a .nv-ico { width: 20px; height: 20px; }
    .nav-links a.active .nv-ico { opacity: 1; filter: drop-shadow(0 0 10px rgba(124, 92, 255, .75)); }
    /* 手机底栏只留 4 项：API 入口收进右上角头像菜单 */
    .nav-links a[data-sec="api"] { display: none; }

    .hero { padding: 10px 0 10px; }
    .hero-tag { margin-bottom: 8px; font-size: 10.5px; padding: 4px 10px 4px 8px; }
    .hero h1 { font-size: 23px; }
    .hero p { font-size: 12.5px; margin-top: 6px; }
    .studio { gap: 14px; }
    .panel-body { padding: 14px; }
    .panel-head { padding: 12px 14px; }
    .blk { margin-bottom: 12px; }
    .ph-hint { display: none; }

    /* ---------- 模型 / 尺寸比例：卡片、胶囊换成下拉 ---------- */
    .model-grid, .ratio-pills { display: none; }
    /* 手机端用系统原生下拉（iOS / Android 的滚轮选择器最贴手），自绘面板只在桌面用 */
    .msel > .sel {
        position: static; width: 100%; height: auto;
        opacity: 1; pointer-events: auto;
        font-size: 13.5px; padding: 11px 38px 11px 12px;
    }
    .msel > .cs { display: none; }
    .blk-aside:not(#ratioTag) { display: none; }
    .prompt-box textarea { min-height: 104px; resize: none; font-size: 16px; }

    /* iOS Safari：聚焦字号 <16px 的输入框会自动把整页放大，且失焦后不还原。
       移动端把这些可输入控件统一提到 16px，从根上避免"点一下就放大"。 */
    .af-inp input,
    .inp { font-size: 16px; }
    .grid2 { grid-auto-flow: row; grid-auto-columns: auto; }
    .gen-bar {
        margin: 4px -16px -16px; padding: 11px 15px 13px;
        bottom: calc(58px + env(safe-area-inset-bottom));   /* 停在 tabbar 上方 */
    }
    .btn-gen { height: 46px; font-size: 14.5px; }
    .gen-note { display: none; }
    .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
    .recent-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .card .meta { padding: 8px 10px 10px; }
    .auth-box { grid-template-columns: 1fr; max-width: 420px; }
    .auth-side { display: none; }
    .auth-main { padding: 26px 22px 22px; }
    .tmpl-modal { grid-template-columns: 1fr; max-height: 86vh; overflow-y: auto; }
    .tmpl-preview { min-height: 200px; max-height: 42vh; }
    .tmpl-info { padding: 20px 18px; }
    .redeem-card { padding: 26px 20px 24px; }
    .redeem-row { flex-direction: column; }

    /* API 页：密钥行换行、参数表改两行 */
    .api-card { padding: 18px 15px 15px; margin-bottom: 16px; }
    .api-keyrow { flex-wrap: wrap; }
    .api-keyrow code { flex: 1 1 100%; font-size: 12px; }
    .abtn { flex: 1; padding: 9px 8px; text-align: center; }
    .api-doc { padding: 16px 14px; }
    .ad-row { grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 9px; }
    .ad-row p { grid-column: 1 / -1; }
    .ad-pre { font-size: 11.5px; padding: 11px 12px; }
    .ad-code { max-height: 340px; }
    .api-quota { display: none; }
    .modal { padding: 22px 18px; }
    .seg button { flex-direction: row; gap: 6px; padding: 10px 4px; font-size: 12px; }
    .seg button svg { width: 16px; height: 16px; }
    .foot { font-size: 10.5px; padding: 26px 0 6px; }

    /* 分类标签多时横滑，别换行挤压列表 */
    .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .tabs::-webkit-scrollbar { display: none; }
    .tabs .tab { flex: none; }

    /* ---------- 示例列表（手机单列横卡） ---------- */
    .ex-list { grid-template-columns: minmax(0, 1fr); gap: 11px; }
    .ex-item { grid-template-columns: 116px minmax(0, 1fr); }
    /* 封面只有 116~128px 宽，标签字号和留白都收一点，别把图压住 */
    .ex-cat { left: 7px; top: 7px; max-width: calc(100% - 14px); padding: 1px 5px; font-size: 9.5px; }
    .ex-kind { right: 7px; bottom: 7px; padding: 1px 5px; font-size: 9.5px; }
    .ex-body { padding: 11px 12px 10px; }
    .ex-t { font-size: 14px; }
    .ex-s { font-size: 11.5px; margin-top: 5px; }
    .ex-meta { padding-top: 7px; gap: 8px; }

    /* ---------- 示例文章页 ---------- */
    .art-top { padding: 14px 0 10px; gap: 9px; }
    .art-head h1 { font-size: 22px; letter-spacing: -.4px; }
    .art-lead { font-size: 14px; line-height: 1.78; margin-top: 9px; }
    .art-meta { margin-top: 11px; font-size: 11.5px; gap: 8px; }
    .flow { margin-top: 18px; padding: 14px 14px 2px; border-radius: 15px; }
    .flow-head { padding-bottom: 12px; gap: 8px; }
    .flow-chain { gap: 5px; }
    .flow-chain span { padding: 2px 6px; font-size: 11px; }
    .flow-steps { padding-top: 14px; }
    .flow-step { grid-template-columns: 26px minmax(0, 1fr); gap: 10px; }
    .flow-dot { width: 22px; height: 22px; font-size: 11px; }
    .flow-body { padding-bottom: 17px; }
    .flow-label { font-size: 12.5px; margin-bottom: 8px; }
    .flow-refs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .flow-refs.n1 { grid-template-columns: minmax(0, 1fr); }
    .flow-ref-no { width: 17px; height: 17px; font-size: 10px; left: 6px; top: 6px; }
    .flow-prompt { padding: 12px 13px; }
    .flow-prompt pre { font-size: 14px; padding-right: 44px; line-height: 1.8; }
    .flow-shot img { width: 100%; max-height: none; }
    .art-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 22px; }
    .art-side { position: static; }
    .art-h2 { font-size: 16px; margin-bottom: 13px; }
    .art-prose { font-size: 16px; line-height: 1.9; }
    .art-prose h2 { font-size: 17.5px; margin: 28px 0 12px; }
    .art-prose h2::before { height: 15px; }
    .art-prose blockquote { font-size: 14px; padding: 11px 14px; }
    .art-rel { margin-top: 30px; }
    .rel-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .rel-item { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; }
    .rel-img { aspect-ratio: 1 / 1; height: 100%; }
    .rel-t { padding: 0 12px; grid-column: 2; }
    .rel-d { display: none; }
}

/* 平板竖屏：单列横卡会被拉得过宽，改两列 */
@media (min-width: 641px) and (max-width: 860px) {
    .ex-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ex-item { grid-template-columns: 128px minmax(0, 1fr); }
}

/* 仅 iOS：原生下拉（模型 / 分辨率）同样会被自动放大，这里一并提到 16px；
   其他平台保持 13.5px 的紧凑排版，不影响标签显示宽度 */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 860px) {
        .msel > .sel { font-size: 16px; }
    }
}

/* 360 以下卡片文字区放不下「作者 + 阅读 + 阅读全文」，先省作者 */
@media (max-width: 359px) {
    .ex-meta > span:first-child { display: none; }
}

@media (max-width: 420px) {
    .ex-meta { white-space: nowrap; gap: 7px; font-size: 10.5px; }
    .ex-t { font-size: 13.5px; }
    .ex-s { font-size: 11px; }
    .nav-links { gap: 1px; }
    .brand-text { display: none; }
    .recent-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gc-row { padding: 8px 11px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* 平板与桌面：hero 收成左对齐单行，把首屏让给参数面板 */
@media (min-width: 861px) {
    .hero {
        display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
        padding: 9px 2px 9px; text-align: left;
    }
    .hero-tag { display: none; }
    .hero h1 { font-size: 25px; letter-spacing: -.6px; }
    .hero p { margin: 0; font-size: 13px; }
    .hero p::before { content: '·'; margin-right: 12px; opacity: .45; }
}

/* 单列平板（861~1080）表单比一屏高，生成条吸底会压住「输出分辨率」，
   这里让它回到文档流；同时把垂直间距压到桌面档，1024×768 的首屏才不会把
   「立即生成」切掉一半 */
@media (min-width: 861px) and (max-width: 1080px) {
    .gen-bar { position: static; margin: 4px -18px -13px; padding: 8px 16px; gap: 8px; }
    .btn-gen { height: 42px; }

    .panel-head { padding: 12px 16px; }
    .panel-body { padding: 12px 16px; }
    .panel-body .blk { margin-bottom: 9px; }
    .panel-body .blk-head { margin-bottom: 6px; }
    .prompt-box textarea { min-height: 72px; padding: 9px 12px 2px; }
    .prompt-foot { padding: 2px 8px 6px; }
    .seg button { padding: 9px 6px; }
}

/* 桌面端再收紧参数面板，目标是 1440×900 一屏内放下「参数面板 + 生成条」 */
@media (min-width: 1081px) {
    .panel-body { padding: 16px; }
    .blk { margin-bottom: 11px; }
    .blk:last-of-type { margin-bottom: 8px; }
    .blk-head { margin-bottom: 8px; }

    .seg button { padding: 9px 6px; }
    .prompt-box textarea { min-height: 74px; padding: 10px 13px 2px; }
    .prompt-foot { padding: 2px 9px 6px; }

    .mc { min-height: 70px; padding: 7px 9px; }
    .mc-desc { min-height: 14px; }

    .rp { padding: 5px 9px 5px 7px; }
    .ratio-pills { max-height: 150px; }   /* VIP 像素档位很多，多露几行少滚动 */

    .gen-bar { margin: 4px -17px -17px; padding: 9px 16px; gap: 6px; }
    .btn-gen { height: 44px; }

    /* 左右面板等高：结果区随参数面板拉伸，避免右侧留一大块空白 */
    .studio { align-items: stretch; }
    .panel-result { position: static; display: flex; flex-direction: column; }
    .panel-result .panel-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
    .panel-result .canvas {
        flex: 1 1 auto; min-height: 240px;
        max-height: calc(100vh - 240px);   /* 参数特别多时（VIP / 参考图）画布不要顶出屏幕 */
    }
    .panel-result .canvas > img.result { width: 100%; height: 100%; object-fit: contain; }
}

/* ============================================================
   可用性增强（对照 Bootstrap 3 的成熟做法补齐）
   进度条 / 焦点可见 / 跳过导航 / 弹窗锁滚动 / 大图翻页
   ============================================================ */

/* 弹窗打开时锁住背景滚动（Bootstrap 的 .modal-open） */
body.body-lock { overflow: hidden; }

/* 键盘焦点必须看得见：鼠标点击时不出现，Tab 切换时才出现 */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid rgba(124, 92, 255, .9);
    outline-offset: 2px;
}
.prompt-box textarea:focus-visible { outline: none; }   /* 外层 :focus-within 已经有高亮 */

/* 跳过导航（Bootstrap 的 .sr-only-focusable 思路） */
.skip-link {
    position: fixed; left: 12px; top: 12px; z-index: 90;
    transform: translateY(-180%);
    padding: 9px 16px; border-radius: 10px;
    background: var(--grad); color: #fff;
    font-size: 13px; font-weight: 600; text-decoration: none;
    box-shadow: 0 10px 26px rgba(85, 92, 255, .42);
    transition: transform .18s ease;
}
.skip-link:focus { transform: none; }

/* 确定进度条（Bootstrap .progress / .progress-bar 的做法，配色跟着本站令牌） */
.gen-state .pg {
    width: min(320px, 82%); height: 6px; border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, .25);
    overflow: hidden;
}
.gen-state .pg-bar {
    display: block; height: 100%; border-radius: inherit;
    background: var(--grad);
    transition: width .55s cubic-bezier(.4, 0, .2, 1);
    position: relative;
}
.gen-state .pg-bar::after {
    content: ''; position: absolute; inset: 0;
    background-image: linear-gradient(45deg,
        rgba(255, 255, 255, .22) 25%, transparent 25%, transparent 50%,
        rgba(255, 255, 255, .22) 50%, rgba(255, 255, 255, .22) 75%, transparent 75%);
    background-size: 14px 14px;
    animation: pg-stripe .8s linear infinite;
}
@keyframes pg-stripe { to { background-position: 14px 0; } }

/* 出图淡入，避免大图"啪"地跳出来 */
.canvas > img.result { animation: img-in .42s ease both; }
@keyframes img-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 大图翻页 */
.lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    display: grid; place-items: center;
    width: 44px; height: 44px; padding: 0 0 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .16);
    color: #e8ecff; font-size: 26px; line-height: 1; cursor: pointer;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.lb-nav:hover {
    background: rgba(124, 92, 255, .3);
    border-color: rgba(124, 92, 255, .6);
    transform: translateY(-50%) scale(1.06);
}
.lb-nav[hidden] { display: none; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-count {
    position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
    font-size: 12px; letter-spacing: .6px; color: var(--muted);
}

/* 生成条里的快捷键提示 */
.kbd {
    display: inline-block; margin: 0 2px 0 8px; padding: 1px 6px;
    border-radius: 5px; font-size: 10.5px; font-family: inherit;
    color: #cfd6ff; background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .13);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .3);
}

@media (max-width: 640px) {
    .lb-nav { width: 36px; height: 36px; font-size: 20px; }
    .lb-prev { left: 6px; }
    .lb-next { right: 6px; }
    .lb-count { top: 12px; }
    .kbd { display: none; }
}

/* ============================================================
   作品列表性能：长列表滚动与「加载更多」不再卡顿
   ============================================================ */

/* 屏幕外的卡片跳过布局与绘制；auto 会记住上次的真实高度，滚动条不会跳 */
.card {
    content-visibility: auto;
    contain-intrinsic-size: auto 288px;
}

/* 追加批次不播放逐张入场动画：一次 20 张时 20 个动画会一起抢渲染 */
.grid-cards.no-anim .card { animation: none; }

/* 卡片左上角的标签原来是毛玻璃，每张都要单独模糊一遍；
   标签压在照片上，改成同色不透明底几乎看不出差别，但省掉大量栅格化 */
.card .tag {
    background: rgba(6, 8, 15, .84);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
