/* ==========================================================================
   Lumina AI · 设计系统
   ========================================================================== */
:root {
    --accent: #6d5efc;
    --accent-2: #b06bff;
    --accent-3: #4ad6f7;
    --bg: #07070d;
    --bg-soft: #0c0c15;
    --panel: rgba(255, 255, 255, .042);
    --panel-strong: rgba(255, 255, 255, .07);
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .16);
    --text: #eceaf7;
    --text-dim: #b3b0c9;
    --muted: #8b88a6;
    --ok: #37d99a;
    --warn: #ffb347;
    --danger: #ff6b81;
    --radius-lg: 22px;
    --radius: 16px;
    --radius-sm: 11px;
    --shadow: 0 24px 60px rgba(0, 0, 0, .55);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, .35);
    --glow: 0 12px 40px rgba(109, 94, 252, .38);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
code, pre { font-family: var(--mono); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .22); background-clip: content-box; }

/* 背景光晕 --------------------------------------------------------------- */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-orbs span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; }
.bg-orbs span:nth-child(1) { width: 620px; height: 620px; top: -240px; left: -140px; background: radial-gradient(circle, rgba(109, 94, 252, .85), transparent 65%); animation: float1 22s ease-in-out infinite; }
.bg-orbs span:nth-child(2) { width: 520px; height: 520px; top: 8%; right: -180px; background: radial-gradient(circle, rgba(176, 107, 255, .7), transparent 65%); animation: float2 26s ease-in-out infinite; }
.bg-orbs span:nth-child(3) { width: 460px; height: 460px; bottom: -220px; left: 32%; background: radial-gradient(circle, rgba(74, 214, 247, .42), transparent 65%); animation: float1 30s ease-in-out infinite reverse; }
@keyframes float1 { 50% { transform: translate3d(60px, 40px, 0) scale(1.08); } }
@keyframes float2 { 50% { transform: translate3d(-70px, 50px, 0) scale(1.05); } }

/* 顶栏 ------------------------------------------------------------------ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    backdrop-filter: blur(18px);
    background: linear-gradient(180deg, rgba(7, 7, 13, .92), rgba(7, 7, 13, .68));
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 1580px;
    margin: 0 auto;
    padding: 11px 22px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-logo {
    width: 38px; height: 38px; border-radius: 12px; object-fit: cover;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid; place-items: center;
    /* 字色保持白色（原来就是这样，之前那次改动已回退）；
       只在字下加一层很淡的深色投影，白字在亮紫渐变上也读得清 */
    color: #fff; font-weight: 800; font-size: 18px; line-height: 1;
    letter-spacing: -.02em;
    text-shadow: 0 1px 2px rgba(24, 12, 54, .45);
    box-shadow: var(--glow), inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.brand-text em { font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav-link {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 15px; border-radius: 11px; font-size: 14px; color: var(--text-dim);
    transition: .18s; white-space: nowrap;
}
.nav-link svg { flex: 0 0 auto; opacity: .85; }
.nav-link:hover { color: var(--text); background: var(--panel); }
.nav-link.is-active { color: #fff; background: linear-gradient(135deg, rgba(109, 94, 252, .95), rgba(176, 107, 255, .85)); box-shadow: var(--glow); }
.nav-link.is-active svg { opacity: 1; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.points-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px;
    background: rgba(109, 94, 252, .14); border: 1px solid rgba(109, 94, 252, .32); color: #cfc8ff;
    font-size: 13px; transition: .18s;
}
.points-chip:hover { background: rgba(109, 94, 252, .24); }
.points-chip b { font-weight: 700; color: #fff; }
.user-menu { position: relative; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong); cursor: pointer;
    background: linear-gradient(135deg, rgba(109, 94, 252, .9), rgba(74, 214, 247, .7));
    color: #fff; font-weight: 700; display: grid; place-items: center;
}
.dropdown {
    position: absolute; right: 0; top: calc(100% + 10px);
    /* 宽度按内容自适应：正好包住文字，不留多余空白；长邮箱也不会把菜单顶出屏幕 */
    width: max-content; min-width: 132px; max-width: min(320px, calc(100vw - 32px));
    padding: 8px;
    background: rgba(16, 16, 26, .97); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); backdrop-filter: blur(20px);
    opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .18s;
}
.dropdown.is-open { opacity: 1; visibility: visible; transform: none; }
.dropdown-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; }
.dropdown-head strong { font-size: 14px; }
.dropdown-head span { font-size: 12px; color: var(--muted); word-break: break-all; }
.dropdown a, .dropdown button {
    display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    padding: 9px 11px; border-radius: 10px; border: 0;
    background: transparent; color: var(--text-dim); cursor: pointer; font-size: 13.5px; white-space: nowrap;
}
.dropdown svg { flex: 0 0 auto; opacity: .8; transition: .16s; }
.dropdown a:hover, .dropdown button:hover { background: var(--panel-strong); color: #fff; }
.dropdown a:hover svg, .dropdown button:hover svg { opacity: 1; }
.dropdown [data-logout]:hover { color: #ffb3bf; background: rgba(255, 107, 129, .12); }

.announce {
    max-width: 1580px; margin: 14px auto 0; padding: 10px 16px; display: flex; align-items: center; gap: 10px;
    background: linear-gradient(90deg, rgba(109, 94, 252, .18), rgba(176, 107, 255, .08));
    border: 1px solid rgba(109, 94, 252, .3); border-radius: 14px; color: #ded9ff; font-size: 13.5px;
}
.announce p { margin: 0; flex: 1; }
.announce button { border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }

.container { max-width: 1580px; margin: 0 auto; padding: 22px; }

/* 按钮 ------------------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
    background: var(--panel-strong); color: var(--text); cursor: pointer; font-size: 14px; font-weight: 600;
    transition: .18s; white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: var(--glow); }
.btn-primary:hover { box-shadow: 0 16px 46px rgba(109, 94, 252, .5); }
.btn-ghost { background: var(--panel); border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover { color: #fff; border-color: var(--line-strong); }
.btn-danger { background: rgba(255, 107, 129, .14); border-color: rgba(255, 107, 129, .4); color: #ffb3bf; }
.btn-danger:hover { background: rgba(255, 107, 129, .24); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 26px; font-size: 15.5px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 34px; height: 34px; border-radius: 10px; }

/* 卡片与面板 ------------------------------------------------------------ */
.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 20px; backdrop-filter: blur(16px); box-shadow: var(--shadow-soft);
}
.card + .card { margin-top: 18px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title h2, .card-title h3 { margin: 0; font-size: 16px; }
.card-title .sub { color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.muted { color: var(--muted); }
.dim { color: var(--text-dim); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap-gap { display: flex; flex-wrap: wrap; gap: 10px; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 10px; } .mt-2 { margin-top: 18px; } .mt-3 { margin-top: 28px; }
.hidden { display: none !important; }

/* 表单 ------------------------------------------------------------------ */
.field { margin-bottom: 15px; }
/* 注意 :not(.switch)：开关本身也是 <label>，如果被这条规则命中会变成 display:block，
   里面的 <i> 轨道就退化成行内元素、宽高失效，只剩一个白色圆点 */
.field > label:not(.switch), .label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px; font-weight: 600; letter-spacing: .02em; }
.label .req { color: var(--danger); }
.input, .select, .textarea {
    width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .34); border: 1px solid var(--line); color: var(--text);
    outline: none; transition: .16s; font-size: 14px;
}
.input:focus, .select:focus, .textarea:focus { border-color: rgba(109, 94, 252, .75); box-shadow: 0 0 0 3px rgba(109, 94, 252, .16); }
.input::placeholder, .textarea::placeholder { color: #6b6885; }
.textarea { min-height: 104px; resize: vertical; line-height: 1.6; }
.select { 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='%238b88a6' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

/* 原生控件（下拉展开的选项列表、复选框、单选框、日期选择器…）跟随深色主题渲染。
   不加这些的话，点开 select 弹出的会是系统浅色菜单，跟整体风格完全脱节；
   部分浏览器还会继承到浅色文字，导致选项看不清。 */
html { color-scheme: dark; }
.select, select { color-scheme: dark; }
.select option, select option {
    background-color: #14141f;
    color: var(--text);
    padding: 8px 10px;
}
.select optgroup, select optgroup {
    background-color: #0d0d15;
    color: var(--muted);
    font-style: normal;
}
.select option:checked, select option:checked {
    background-color: var(--accent);
    background-image: linear-gradient(0deg, var(--accent), var(--accent));
    color: #fff;
}
/* 复选框 / 单选框也用主题色，深色底下勾选状态才看得清 */
input[type="checkbox"], input[type="radio"] { color-scheme: dark; accent-color: var(--accent); cursor: pointer; }
table.data input[type="checkbox"] { width: 15px; height: 15px; vertical-align: middle; margin: 0; }

/* ---- 自绘下拉框（原生 select 的展开列表由系统绘制，无法与整站风格统一，这里整体替换） ---- */
.lselect { position: relative; display: block; width: 100%; }
.lselect.is-auto { width: auto; }
.lselect-native { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.lselect-trigger {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 13px; border-radius: var(--radius-sm); background: rgba(0, 0, 0, .34);
    border: 1px solid var(--line); color: var(--text); font-size: 14px; text-align: left;
    cursor: pointer; transition: .16s;
}
.lselect.is-auto .lselect-trigger { min-width: 132px; }
.lselect-trigger:hover { border-color: var(--line-strong); }
.lselect-trigger:disabled { cursor: not-allowed; }
.lselect.is-open .lselect-trigger { border-color: rgba(109, 94, 252, .75); box-shadow: 0 0 0 3px rgba(109, 94, 252, .16); }
.lselect.is-disabled { opacity: .55; pointer-events: none; }
.lselect-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lselect-caret {
    flex: 0 0 auto; width: 0; height: 0; margin-top: 2px;
    border-left: 4.5px solid transparent; border-right: 4.5px solid transparent; border-top: 5.5px solid var(--muted);
    transition: transform .2s;
}
.lselect.is-open .lselect-caret { transform: rotate(180deg); }

.lselect-menu {
    position: fixed; z-index: 420; max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
    padding: 6px; background: rgba(16, 16, 26, .98); border: 1px solid var(--line-strong);
    border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(20px);
    animation: selectPop .16s cubic-bezier(.2, .9, .3, 1.15);
}
.lselect-menu.is-up { animation-name: selectPopUp; }
@keyframes selectPop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
@keyframes selectPopUp { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.loption {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
    padding: 9px 11px; border: 0; border-radius: 10px; background: transparent; color: var(--text-dim);
    font-size: 13.5px; text-align: left; cursor: pointer; transition: .14s;
}
.loption-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loption-check { display: none; flex: 0 0 auto; font-size: 12px; opacity: .95; }
.loption:hover, .loption.is-active { background: var(--panel-strong); color: #fff; }
.loption.is-selected { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.loption.is-selected .loption-check { display: block; }
.loption:disabled { opacity: .38; cursor: not-allowed; background: transparent; }
.input-hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

.segmented { display: flex; padding: 4px; background: rgba(0, 0, 0, .32); border: 1px solid var(--line); border-radius: 14px; gap: 4px; }
.segmented button {
    flex: 1; border: 0; background: transparent; color: var(--text-dim); padding: 10px 12px;
    border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; transition: .18s;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.segmented button:hover { color: #fff; }
.segmented button.is-active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 22px rgba(109, 94, 252, .35); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel);
    color: var(--text-dim); font-size: 12.5px; cursor: pointer; transition: .16s;
}
.chip:hover { border-color: var(--line-strong); color: #fff; }
.chip.is-active { background: rgba(109, 94, 252, .22); border-color: rgba(109, 94, 252, .55); color: #fff; }

/* 画面比例：小方框直观显示比例 */
.ratio-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; }
.ratio-shape { display: inline-block; border: 1.5px solid currentColor; border-radius: 3px; opacity: .65; }
.ratio-shape.is-auto { border-style: dashed; background: linear-gradient(135deg, currentColor 0 40%, transparent 40%); opacity: .5; }
.ratio-chip.is-active .ratio-shape { opacity: 1; }

/* 生成中的任务 */
.queue-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel); }
.queue-item:last-child { margin-bottom: 0; }
.queue-item.is-current { border-color: rgba(109, 94, 252, .55); background: rgba(109, 94, 252, .08); }
.progress-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; margin: 9px 0 6px; }
.progress-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-3)); transition: width .45s ease; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; font-weight: 400; color: var(--text-dim); }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
/* 轨道：flex 里用 flex-basis 锁宽，万一外层不是 flex（例如被当成 block），
   inline-block + min-width 也能撑开，两条路都保证看得见 */
.switch i {
    display: inline-block; flex: 0 0 40px; width: 40px; min-width: 40px; height: 22px; box-sizing: border-box;
    border-radius: 999px; background-color: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .14);
    position: relative; transition: background-color .2s, border-color .2s;
}
.switch i::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .45); transition: left .2s;
}
.switch input:checked + i {
    background-color: var(--accent);
    background-image: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
}
.switch input:checked + i::after { left: 20px; }
.switch > span, .switch > em { min-width: 0; }

.range { width: 100%; appearance: none; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .14); outline: none; }
.range::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; box-shadow: 0 0 0 4px rgba(109, 94, 252, .18); }
.range-value { font-family: var(--mono); font-size: 12px; color: var(--accent-3); min-width: 42px; text-align: right; }

/* 徽标 ------------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; border: 1px solid var(--line); background: var(--panel); color: var(--text-dim); }
.badge-ok { background: rgba(55, 217, 154, .13); border-color: rgba(55, 217, 154, .34); color: #8ef0c8; }
.badge-warn { background: rgba(255, 179, 71, .13); border-color: rgba(255, 179, 71, .34); color: #ffd79b; }
.badge-danger { background: rgba(255, 107, 129, .13); border-color: rgba(255, 107, 129, .34); color: #ffb3bf; }
.badge-accent { background: rgba(109, 94, 252, .18); border-color: rgba(109, 94, 252, .4); color: #cfc8ff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(55, 217, 154, .18); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 107, 129, .18); }

/* 创作台布局 ------------------------------------------------------------ */
.studio { display: grid; grid-template-columns: 388px minmax(0, 1fr); gap: 20px; align-items: start; }
.studio-panel { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; padding-right: 4px; }

/* 创作台整页不顶出屏幕：页头 / 公告 / 主体 / 页脚 撑满一屏，
   超出的内容在左右两栏内部各自滚动，页面本身不出现滚动条。
   注意 flex 基准必须用 0（写成 auto 会按内容高度算，把页脚挤到屏幕外），
   宽度显式 100%（flex 容器里的 auto 外边距会让它按内容宽度收缩）。 */
body.page-create {
    height: 100vh; height: 100dvh; overflow: hidden;
    display: flex; flex-direction: column;
}
.page-create .topbar { flex: 0 0 auto; }
.page-create .announce { flex: 0 0 auto; }
.page-create .site-footer { flex: 0 0 auto; margin-top: 0; padding: 12px 22px; }
.page-create .container {
    flex: 1 1 0;              /* 只吃剩余空间，页脚永远留在屏幕内 */
    width: 100%;             /* 宽度跟普通块级一样撑满（上限仍是 max-width） */
    min-height: 0;
    display: flex; flex-direction: column; overflow: hidden;
}
.page-create .studio {
    flex: 1 1 0; min-height: 0; align-items: stretch;
    grid-template-rows: minmax(0, 1fr);   /* 行高严格等于可用高度，左栏才能内部滚动 */
}
.page-create .studio-panel {
    position: static; top: auto; max-height: none; height: auto; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
}
.page-create .studio > section {
    display: flex; flex-direction: column; gap: 18px; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain; padding-right: 4px;
}
.page-create .stage { flex: 1 1 auto; min-height: 320px; }
.page-create .studio > section > .card { margin-top: 0; flex: 0 0 auto; }
.panel-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; backdrop-filter: blur(16px); box-shadow: var(--shadow-soft); }
.panel-card + .panel-card { margin-top: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h3 { margin: 0; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.panel-head h3 svg { color: var(--accent-3); }

.dropzone {
    border: 1.5px dashed rgba(255, 255, 255, .18); border-radius: var(--radius); padding: 22px;
    text-align: center; cursor: pointer; transition: .2s; background: rgba(0, 0, 0, .22);
}
.dropzone:hover, .dropzone.is-over { border-color: rgba(109, 94, 252, .8); background: rgba(109, 94, 252, .09); }
.dropzone strong { display: block; font-size: 14px; margin-bottom: 4px; }
.dropzone span { font-size: 12px; color: var(--muted); }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 9px; margin-top: 12px; }
.thumb-item { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 1; background: #000; }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-item button {
    position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%; border: 0;
    background: rgba(0, 0, 0, .72); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; display: grid; place-items: center;
}

.stage {
    min-height: 560px; border-radius: var(--radius-lg); border: 1px solid var(--line);
    background: linear-gradient(160deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012));
    backdrop-filter: blur(16px); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column;
}
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.stage-head h2 { margin: 0; font-size: 17px; }
.stage-empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 40px 20px; }
.stage-empty .orb {
    width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 30px;
    background: linear-gradient(135deg, rgba(109, 94, 252, .9), rgba(176, 107, 255, .7));
    display: grid; place-items: center; box-shadow: var(--glow); animation: pulse 3.4s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: translateY(-6px) rotate(2deg); box-shadow: 0 22px 60px rgba(109, 94, 252, .55); } }
.stage-empty h3 { font-size: 17px; }
.stage-empty p { color: var(--muted); max-width: 380px; margin: 0 auto; font-size: 13.5px; }

.progress-wrap { flex: 1; display: grid; place-items: center; text-align: center; }
.progress-ring { width: 148px; height: 148px; position: relative; margin: 0 auto 20px; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.progress-ring .track { stroke: rgba(255, 255, 255, .09); }
.progress-ring .bar { stroke: url(#ringGradient); transition: stroke-dashoffset .5s ease; }
.progress-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 700; font-family: var(--mono); }
.progress-stage { color: var(--text-dim); font-size: 14px; }
.progress-tip { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.result-item {
    position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
    /* 不再强制 1:1：按图片自身比例完整显示，1920×1080 的图就是 16:9 呈现，不会被裁成方形 */
    background: #05050a; cursor: zoom-in; animation: rise .45s ease both;
    transform: translateZ(0);
    clip-path: inset(0 round var(--radius));
    isolation: isolate;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.result-item img { width: 100%; height: auto; display: block; transition: transform .35s ease; }
.result-item:hover img { transform: scale(1.04); }
.result-item .overlay {
    position: absolute; inset: auto 0 0 0; padding: 30px 12px 11px; display: flex; gap: 8px; align-items: center;
    background: linear-gradient(transparent, rgba(0, 0, 0, .82)); opacity: 0; transition: .24s;
}
.result-item:hover .overlay { opacity: 1; }
.result-item .overlay .btn { padding: 6px 11px; font-size: 12.5px; }
.result-item .fav {
    position: absolute; top: 9px; right: 9px; width: 32px; height: 32px; border-radius: 50%; border: 0;
    background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; display: grid; place-items: center; opacity: 0; transition: .2s;
}
.result-item:hover .fav, .result-item .fav.is-on { opacity: 1; }
.result-item .fav.is-on { color: #ffb347; }
.result-meta { position: absolute; top: 9px; left: 9px; display: flex; gap: 6px; opacity: 0; transition: .2s; }
.result-item:hover .result-meta { opacity: 1; }

/* 渲染前后对比 ---------------------------------------------------------
   直接放在「渲染完成」面板里，不再套一层卡片：只有一行小标题 + 取景框。 */
.compare-block { width: 100%; margin-bottom: 18px; }
.compare-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.compare-head h4 { margin: 0; font-size: 14.5px; }

/* 两张图放进同一个盒子，都用绝对定位 + object-fit 填满：
   · 不管原图和出图尺寸是否一致，都在同一个取景框里裁切，能像素级完全重叠；
   · 图被盒子裁掉多余的边，永远不会顶出父级；
   · 图片不吃指针事件（pointer-events:none），避免拖动滑块时拖出图片 / 选中图片。 */
.compare {
    position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line);
    aspect-ratio: 1 / 1;                 /* 由 JS 按出图尺寸覆盖 */
    max-width: 100%;                     /* 高度上限也由 JS 按可视区域算出来，保证不顶出元素 */
    margin-inline: auto;
    background: #0d0b1f;
    cursor: ew-resize;
    user-select: none; -webkit-user-select: none;
    touch-action: none;                  /* 触屏上拖滑块不要带着页面滚 */
}
.compare img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    display: block; max-width: none; object-fit: cover;
    pointer-events: none; -webkit-user-drag: none; user-select: none;
}
.compare .after { position: absolute; inset: 0; overflow: hidden; clip-path: inset(0 50% 0 0); }
.compare .handle { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; left: 50%; cursor: ew-resize; }
.compare .handle::after { content: "⇔"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-size: 15px; transition: transform .15s; }
.compare.is-dragging .handle::after { transform: translate(-50%, -50%) scale(1.08); }
.compare:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 最近生成：压缩高度，把纵向空间让给渲染结果 */
.recent-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.recent-card { flex: 0 0 104px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.recent-card img { width: 104px; height: 60px; object-fit: cover; }
.recent-card .meta { padding: 6px 8px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 瀑布流 ---------------------------------------------------------------- */
.masonry { columns: 4 240px; column-gap: 14px; }
.masonry-item {
    break-inside: avoid; margin-bottom: 14px; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--panel); position: relative; cursor: zoom-in;
    /* 图片 hover 放大时必须被卡片裁掉，不能顶出卡片：
       overflow + 独立合成层(translateZ) + clip-path 三重保证，
       否则在 CSS 多列布局里，被 transform 的子元素会绕过圆角裁剪跑到卡片外面 */
    overflow: hidden;
    transform: translateZ(0);
    clip-path: inset(0 round var(--radius));
    isolation: isolate;
    /* 与创作台「渲染完成」里的结果卡片同一套入场浮动效果（rise 关键帧）；
       入场结束后 transform 回到上面的 translateZ(0)，不影响圆角裁剪 */
    animation: rise .45s ease both;
}
.masonry-item img { width: 100%; display: block; transition: transform .35s ease; }
.masonry-item:hover img { transform: scale(1.04); }
/* info 覆盖在图片底部：不再占据版面高度，图片不会被顶上去 */
.masonry-item .info {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    padding: 24px 12px 9px; display: flex; justify-content: space-between; gap: 8px;
    font-size: 12px; color: #e8e4f7;
    background: linear-gradient(transparent, rgba(0, 0, 0, .82));
    pointer-events: none;
}
.masonry-item .info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.masonry-item .fav {
    position: absolute; top: 9px; right: 9px; z-index: 3; width: 30px; height: 30px;
    border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
    background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(6px); transition: .2s;
}
.masonry-item .fav.is-on { color: #ffb347; }
/* 悬浮操作条压在 info 上方，底部留白正好让 info 露出来 */
.masonry-item .overlay {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
    padding: 14px 10px 40px; display: flex; gap: 6px; justify-content: center;
    background: linear-gradient(transparent, rgba(0, 0, 0, .72));
    opacity: 0; transition: opacity .24s;
}
.masonry-item:hover .overlay { opacity: 1; }

/* 工具条 / 筛选 -------------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 130px; }
.search-input { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-input .input { padding-left: 36px; }
.search-input svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* 表格 ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); clip-path: inset(0 round var(--radius)); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { background: rgba(255, 255, 255, .035); color: var(--text-dim); font-weight: 600; font-size: 12.5px; }
table.data tbody tr:hover { background: rgba(255, 255, 255, .03); }
table.data td.wrap { white-space: normal; min-width: 220px; }
table.data .actions { display: flex; gap: 6px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 18px; }
.pagination button {
    min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--panel); color: var(--text-dim); cursor: pointer;
}
.pagination button.is-active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* 提示条 / 空状态 ------------------------------------------------------ */
.alert { border-radius: 14px; padding: 13px 16px; font-size: 13.5px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text-dim); }
.alert-ok { background: rgba(55, 217, 154, .1); border-color: rgba(55, 217, 154, .3); color: #a9f0d3; }
.alert-danger { background: rgba(255, 107, 129, .1); border-color: rgba(255, 107, 129, .32); color: #ffc0ca; }
.alert-warn { background: rgba(255, 179, 71, .1); border-color: rgba(255, 179, 71, .3); color: #ffdca8; }
.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty svg { opacity: .5; margin-bottom: 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat {
    padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel);
    display: flex; flex-direction: column; gap: 4px;
}
.stat b { font-size: 24px; font-weight: 700; font-family: var(--mono); letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--muted); }

/* 弹窗 ------------------------------------------------------------------ */
.modal-root:empty { display: none; }
.modal-mask {
    position: fixed; inset: 0; z-index: 200; background: rgba(4, 4, 9, .72); backdrop-filter: blur(6px);
    display: grid; place-items: center; padding: 24px; animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
    width: 100%; max-width: 560px; max-height: 86vh; padding: 22px;
    background: rgba(16, 16, 26, .98); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
    /* 滚动条默认贴着 padding 盒边缘，两端会戳出圆角。
       这里改成：外层弹窗不滚动（overflow:hidden）＋ 内层 .modal-body 滚动，
       内层被弹窗 22px 内边距整体缩进，滚动条永远落在圆角以内；
       附带好处是标题栏与底部按钮栏固定不动。 */
    display: flex; flex-direction: column; overflow: hidden;
}
.modal.modal-lg { max-width: 860px; }
.modal.modal-xl { max-width: 1100px; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex: 0 0 auto; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { border: 0; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1; }
.modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex: 0 0 auto; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }

.toast-stack { position: fixed; right: 20px; bottom: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
    padding: 12px 16px; border-radius: 13px; background: rgba(18, 18, 28, .97); border: 1px solid var(--line-strong);
    box-shadow: var(--shadow); font-size: 13.5px; min-width: 220px; max-width: 360px; animation: slideIn .24s ease;
    display: flex; align-items: flex-start; gap: 9px;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } }
.toast.is-ok { border-color: rgba(55, 217, 154, .45); }
.toast.is-error { border-color: rgba(255, 107, 129, .45); }
.toast.is-warn { border-color: rgba(255, 179, 71, .45); }

.lightbox {
    position: fixed; inset: 0; z-index: 250; background: rgba(3, 3, 8, .94); backdrop-filter: blur(10px);
    display: grid; place-items: center; padding: 46px 24px 74px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 78vh; border-radius: 14px; box-shadow: var(--shadow); }
.lightbox-close { position: absolute; top: 18px; right: 24px; border: 0; background: transparent; color: #fff; font-size: 34px; cursor: pointer; line-height: 1; }
.lightbox-bar { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 99px; background: rgba(18, 18, 28, .9); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-dim); }

/* 加载骨架 -------------------------------------------------------------- */
.skeleton { background: linear-gradient(90deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .12), rgba(255, 255, 255, .05)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 认证页 ---------------------------------------------------------------- */
.auth-wrap { min-height: calc(100vh - 190px); display: grid; place-items: center; padding: 30px 0; }
.auth-card { width: 100%; max-width: 430px; padding: 30px; }
.auth-card h1 { font-size: 23px; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-foot a { color: #b9aeff; }

/* 账户页 ---------------------------------------------------------------- */
.points-hero {
    padding: 26px; border-radius: var(--radius-lg); border: 1px solid rgba(109, 94, 252, .3);
    background: linear-gradient(135deg, rgba(109, 94, 252, .24), rgba(176, 107, 255, .1) 55%, rgba(74, 214, 247, .08));
    display: flex; flex-wrap: wrap; align-items: center; gap: 20px;
}
.points-hero .big { font-size: 42px; font-weight: 800; font-family: var(--mono); letter-spacing: -.03em; line-height: 1; }
.package-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.package {
    position: relative; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line);
    background: var(--panel); cursor: pointer; transition: .2s;
}
.package:hover { border-color: rgba(109, 94, 252, .55); transform: translateY(-3px); }
.package .price { font-size: 26px; font-weight: 800; font-family: var(--mono); }
.package .price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.package .pts { color: var(--accent-3); font-weight: 700; }
.package .tag { position: absolute; top: -10px; right: 14px; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

/* 页脚 ------------------------------------------------------------------ */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px; }
.footer-inner { max-width: 1580px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; font-size: 12.5px; color: var(--muted); }

/* 响应式 ---------------------------------------------------------------- */
@media (max-width: 1180px) {
    .studio { grid-template-columns: 1fr; }
    .studio-panel { position: static; max-height: none; }
    /* 窄屏恢复成整页滚动：两栏上下堆叠时，固定一屏高反而不好用 */
    body.page-create { height: auto; min-height: 100vh; overflow: visible; display: block; }
    .page-create .container { display: block; overflow: visible; }
    .page-create .studio { display: block; }
    .page-create .studio-panel { overflow: visible; }
    .page-create .studio > section { display: block; overflow: visible; padding-right: 0; }
    .page-create .stage { min-height: 460px; }
    .masonry { columns: 3 200px; }
}
@media (max-width: 860px) {
    .container { padding: 16px; }
    .topbar-inner { padding: 10px 14px; gap: 12px; flex-wrap: wrap; }
    .brand-text em { display: none; }
    .nav { order: 3; width: 100%; overflow-x: auto; }
    .masonry { columns: 2 150px; }
    .stage { padding: 16px; min-height: 420px; }
}
@media (max-width: 560px) {
    body { font-size: 14px; }
    .masonry { columns: 1; }
    .result-grid { grid-template-columns: 1fr; }
}
