:root{
  --bg:#ffffff;
  --bg-soft:#f7f7f8;
  --card:#ffffff;
  --card-2:#fafafa;
  --fg:#161618;
  --muted:#66666f;
  --muted-2:#93939c;
  --border:rgba(18,18,24,.10);
  --border-strong:rgba(18,18,24,.17);
  --primary:#a96f16;
  --primary-bright:#f1c77c;
  --primary-soft:rgba(214,151,58,.13);
  --primary-line:rgba(169,111,22,.35);
  --primary-fg:#ffffff;
  --danger:#b23b3b;
  --danger-soft:rgba(178,59,59,.08);
  --success:#2e9e63;
  --radius:14px;
  --radius-sm:10px;
  --shadow-panel:0 26px 60px -48px rgba(18,18,24,.28);
  --shadow-lift:0 20px 40px -26px rgba(18,18,24,.20);
  --ring:0 0 0 2px rgba(169,111,22,.35), 0 0 0 4px rgba(169,111,22,.12);
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  --mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;
  color-scheme:light;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:#ffffff;
  color:var(--fg);
  font-family:var(--font);
  font-size:14px;
  line-height:1.7;
  -webkit-font-smoothing:antialiased;
}
body.modal-open{overflow:hidden}
img{display:block;max-width:100%}
a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
h1,h2,h3,p,ol,dl,dd{margin:0}
ol{padding:0;list-style:none}
::selection{background:rgba(214,151,58,.22);color:#161618}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#dedee2;border-radius:10px;border:3px solid #fff}
::-webkit-scrollbar-track{background:transparent}
:focus-visible{outline:none;box-shadow:var(--ring)}

/* ---------- 顶栏 ---------- */
.topbar{
  position:sticky;top:0;z-index:40;
  background:rgba(255,255,255,.82);
  backdrop-filter:blur(18px) saturate(140%);
  border-bottom:1px solid var(--border);
}
.topbar-inner{
  max-width:1440px;margin:0 auto;height:64px;padding:0 28px;
  display:flex;align-items:center;justify-content:space-between;gap:18px;
}
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.brand-mark{
  width:38px;height:38px;border-radius:11px;flex-shrink:0;
  display:grid;place-items:center;color:#f1c77c;
  background:linear-gradient(145deg,#232329,#121215);
  border:1px solid rgba(18,18,24,.18);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.10),0 8px 20px -14px rgba(18,18,24,.45);
}
.brand-mark svg{width:21px;height:21px}
.brand-copy{display:flex;flex-direction:column;line-height:1.25;min-width:0}
.brand-copy strong{font-size:17px;letter-spacing:.14em;font-weight:700}
.brand-copy small{font-size:10px;color:var(--muted-2);letter-spacing:.22em}
.topbar-right{display:flex;align-items:center;gap:10px;flex-shrink:0}
.status-pill{
  display:inline-flex;align-items:center;gap:7px;height:32px;padding:0 12px;
  border-radius:999px;border:1px solid var(--border);background:#fff;
  font-size:12px;color:var(--muted);
}
.dot{width:6px;height:6px;border-radius:50%;background:var(--muted-2);flex-shrink:0}
.status-pill.ok .dot{background:var(--success);box-shadow:0 0 0 4px rgba(46,158,99,.12);animation:pulse 2.4s ease-in-out infinite}
.status-pill.bad .dot{background:var(--danger);box-shadow:0 0 0 4px rgba(178,59,59,.10)}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.45}}
.model-badge{
  height:32px;display:inline-flex;align-items:center;padding:0 11px;border-radius:8px;
  font-family:var(--mono);font-size:11.5px;color:#4b4b53;
  background:#f6f6f7;border:1px solid var(--border);
}
.user-box{
  display:flex;align-items:center;gap:8px;height:32px;padding:0 5px 0 4px;
  border:1px solid var(--border);border-radius:999px;background:#fff;
}
.user-box[hidden]{display:none}
.user-avatar{
  width:24px;height:24px;border-radius:50%;display:grid;place-items:center;
  background:var(--primary-soft);color:var(--primary);border:1px solid var(--primary-line);
  font-size:11px;font-weight:700;flex-shrink:0;
}
.user-name{font-size:12px;color:#3f3f46;max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.logout-btn{font-size:11px;color:var(--muted-2);padding:3px 7px;border-radius:6px;transition:.16s}
.logout-btn:hover{color:var(--danger);background:var(--danger-soft)}
.primary-nav{flex:1;display:flex;justify-content:center;gap:2px;min-width:0}
.primary-nav a{font-size:13px;color:var(--muted);padding:8px 14px;border-radius:8px;transition:.16s;white-space:nowrap}
.primary-nav a:hover{color:var(--fg);background:#f4f4f5}
.primary-nav a.is-active{color:var(--fg);background:#f1f1f3;font-weight:600}
.help-btn{
  width:32px;height:32px;border-radius:9px;display:grid;place-items:center;color:var(--muted);
  border:1px solid var(--border);background:#fff;transition:.16s;
}
.help-btn:hover{color:var(--fg);background:#f5f5f6;border-color:var(--border-strong)}
.help-btn svg{width:16px;height:16px}

/* 二级菜单栏 */
.subnav{
  position:sticky;top:64px;z-index:35;
  background:rgba(255,255,255,.9);backdrop-filter:blur(16px) saturate(140%);
  border-bottom:1px solid var(--border);
}
.subnav-inner{
  max-width:1440px;margin:0 auto;padding:0 28px;height:50px;
  display:flex;align-items:center;justify-content:space-between;gap:18px;
}
.mode-tabs{display:flex;gap:3px;padding:3px;border-radius:10px;background:#f4f4f5;border:1px solid var(--border)}
.mode-tab{height:32px;padding:0 18px;border-radius:8px;font-size:12.5px;color:var(--muted);transition:.16s;white-space:nowrap}
.mode-tab:hover{color:var(--fg)}
.mode-tab.is-active{
  background:#fff;color:var(--fg);
  box-shadow:0 1px 2px rgba(18,18,24,.08),inset 0 0 0 1px rgba(18,18,24,.06);
}
.subnav-meta{display:flex;align-items:center;gap:16px;font-size:11.5px;color:var(--muted-2);min-width:0}
.mode-hint{letter-spacing:.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.subnav-count{
  padding:3px 9px;border-radius:999px;border:1px solid var(--border);
  background:#fff;font-variant-numeric:tabular-nums;white-space:nowrap;
}

/* ---------- 布局 ---------- */
.shell{
  max-width:1440px;margin:0 auto;padding:26px 28px 60px;
  display:grid;grid-template-columns:376px minmax(0,1fr);gap:26px;align-items:start;
}
#create,#works{scroll-margin-top:132px}

/* ---------- 创作面板 ---------- */
.panel{
  background:#ffffff;
  border:1px solid var(--border);border-radius:18px;padding:24px;
  box-shadow:var(--shadow-panel);
}
.panel::before{
  content:"";display:block;height:1px;margin:-24px -24px 22px;border-radius:18px 18px 0 0;
  background:linear-gradient(90deg,transparent,rgba(18,18,24,.08),transparent);
}
.panel-heading{margin-bottom:22px}
.eyebrow{
  font-size:10.5px;letter-spacing:.24em;color:var(--primary);
  display:inline-flex;align-items:center;gap:8px;
}
.eyebrow::before{content:"";width:16px;height:1px;background:var(--primary-line)}
.panel-heading h1{font-size:25px;line-height:1.35;letter-spacing:-.02em;font-weight:700;margin:10px 0 8px}
.panel-heading .sub{font-size:12.5px;color:var(--muted);line-height:1.75}

.field{margin-bottom:18px}
.field-label{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  font-size:11.5px;color:var(--muted);letter-spacing:.06em;margin-bottom:8px;
}
.counter{font-family:var(--mono);font-size:10.5px;color:var(--muted-2)}

.textarea-wrap{
  background:#fbfbfc;border:1px solid var(--border);border-radius:12px;
  transition:border-color .18s,box-shadow .18s,background .18s;
}
.textarea-wrap:focus-within{border-color:rgba(169,111,22,.35);background:#fff;box-shadow:0 0 0 3px rgba(169,111,22,.08)}
textarea{
  width:100%;display:block;resize:vertical;min-height:126px;max-height:280px;
  padding:13px 14px 6px;border:0;background:transparent;color:var(--fg);
  font:inherit;font-size:13.5px;line-height:1.8;
}
textarea::placeholder{color:#a4a4ad}
textarea:focus{outline:none}
.textarea-foot{display:flex;justify-content:space-between;padding:4px 8px 9px}
.ghost-btn{
  font-size:11.5px;color:var(--muted-2);padding:4px 7px;border-radius:6px;transition:.16s;
}
.ghost-btn:hover{color:var(--fg);background:#f1f1f3}
.ghost-btn.accent{color:var(--primary)}
.ghost-btn.accent:hover{background:var(--primary-soft)}

/* 参考图上传 */
.dropzone{
  border:1px dashed rgba(18,18,24,.16);border-radius:12px;background:#fbfbfc;
  padding:14px;cursor:pointer;transition:.18s;
}
.dropzone:hover{border-color:rgba(169,111,22,.35);background:#fff}
.dropzone.is-drag{border-color:var(--primary);background:var(--primary-soft);box-shadow:0 0 0 3px rgba(169,111,22,.08)}
.drop-empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:5px;padding:10px 0}
.drop-empty[hidden]{display:none}
.drop-icon{width:26px;height:26px;color:var(--primary);opacity:.85;margin-bottom:4px}
.drop-empty strong{font-size:12.5px;font-weight:600;color:#3c3c43}
.drop-empty span{font-size:10.5px;color:var(--muted-2)}
.upload-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}
.upload-grid[hidden]{display:none}
.upload-item{position:relative;aspect-ratio:1/1;border-radius:10px;overflow:hidden;border:1px solid var(--border);background:#f4f4f5}
.upload-item img{width:100%;height:100%;object-fit:cover}
.upload-remove{
  position:absolute;top:4px;right:4px;width:18px;height:18px;border-radius:6px;
  display:grid;place-items:center;font-size:12px;line-height:1;
  background:rgba(255,255,255,.92);border:1px solid rgba(18,18,24,.12);color:#3c3c43;
  box-shadow:0 1px 2px rgba(18,18,24,.12);
}
.upload-remove:hover{background:#fff;color:var(--danger)}
.upload-add{
  aspect-ratio:1/1;border-radius:10px;border:1px dashed rgba(18,18,24,.2);background:#fff;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;
  color:var(--muted-2);font-size:10px;transition:.16s;
}
.upload-add:hover{border-color:var(--primary-line);color:var(--primary);background:var(--primary-soft)}
.add-plus{font-size:16px;line-height:1;font-weight:300}
.btn-sm{height:30px;padding:0 11px;font-size:11.5px;border-radius:8px}

.chips{display:flex;flex-wrap:wrap;gap:7px}
.chip{
  padding:6px 11px;border-radius:999px;border:1px solid var(--border);
  background:#fff;color:var(--muted);font-size:12px;
  transition:.16s ease;white-space:nowrap;
}
.chip:hover{color:var(--fg);border-color:var(--border-strong);background:#f7f7f8}
.chip[aria-pressed="true"]{
  color:#8a5a12;border-color:var(--primary-line);background:var(--primary-soft);
  box-shadow:inset 0 0 0 1px rgba(169,111,22,.10);
}

.segmented{
  display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:2px;
  padding:3px;border-radius:10px;background:#f4f4f5;border:1px solid var(--border);
}
.segmented button{
  display:flex;align-items:center;justify-content:center;gap:6px;
  height:36px;border-radius:8px;color:var(--muted);font-size:12px;
  transition:.16s ease;white-space:nowrap;
}
.segmented button:hover{color:var(--fg)}
.segmented button[aria-pressed="true"]{
  background:#fff;color:var(--fg);font-weight:600;
  box-shadow:0 1px 2px rgba(18,18,24,.10),inset 0 0 0 1px rgba(18,18,24,.05);
}

.ratio-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.ratio-option{
  height:58px;border-radius:10px;border:1px solid var(--border);background:#fff;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  color:var(--muted);font-size:10.5px;letter-spacing:.04em;transition:.16s;
}
.ratio-option:hover{color:var(--fg);border-color:var(--border-strong);background:#fafafa}
.ratio-option[aria-pressed="true"]{
  color:#8a5a12;border-color:var(--primary-line);background:var(--primary-soft);
  box-shadow:inset 0 0 0 1px rgba(169,111,22,.08);
}
.ratio-shape{display:block;border:1.5px solid currentColor;border-radius:2.5px}
.ratio-shape.r11{width:13px;height:13px}
.ratio-shape.r43{width:16px;height:12px}
.ratio-shape.r34{width:12px;height:16px}
.ratio-shape.r32{width:18px;height:12px}
.ratio-shape.r23{width:12px;height:18px}
.ratio-shape.r169{width:19px;height:11px}
.ratio-shape.r916{width:11px;height:19px}
.ratio-key{font-size:10px;line-height:1;letter-spacing:.02em}

.stepper{
  display:inline-flex;align-items:center;gap:4px;padding:3px;border-radius:10px;
  background:#f6f6f7;border:1px solid var(--border);
}
.stepper button{
  width:32px;height:32px;border-radius:8px;color:var(--muted);font-size:16px;line-height:1;
  display:grid;place-items:center;transition:.16s;
}
.stepper button:hover{background:#fff;color:var(--fg);box-shadow:0 1px 2px rgba(18,18,24,.08)}
.stepper span{min-width:30px;text-align:center;font-size:13px;font-variant-numeric:tabular-nums}
.count-static{
  display:inline-flex;align-items:center;height:38px;padding:0 12px;border-radius:9px;
  border:1px solid var(--border);background:#f6f6f7;font-size:13px;color:var(--fg);
  font-variant-numeric:tabular-nums;
}
.count-static[hidden]{display:none}
.field-row{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;margin-bottom:20px}
.estimate{text-align:right}
.estimate .field-label{justify-content:flex-end;margin-bottom:6px}
.estimate strong{font-size:12.5px;font-weight:600;color:#3f3f46}

/* ---------- 按钮体系 ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  height:40px;padding:0 16px;border-radius:10px;border:1px solid transparent;
  font-size:13px;font-weight:600;letter-spacing:.01em;
  transition:background .18s,border-color .18s,color .18s,transform .18s,box-shadow .18s;
  white-space:nowrap;
}
.btn:active{transform:translateY(1px)}
.btn-primary{
  background:linear-gradient(180deg,#2c2c33,#161619);
  color:#fff;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 12px 24px -16px rgba(18,18,24,.55);
}
.btn-primary:hover{background:linear-gradient(180deg,#35353d,#1d1d21)}
.btn-secondary{background:#f4f4f5;border-color:var(--border);color:var(--fg)}
.btn-secondary:hover{background:#ececef}
.btn-ghost{background:transparent;color:var(--muted)}
.btn-ghost:hover{background:rgba(18,18,24,.04);color:var(--fg)}
.btn-danger{background:#fdeeee;border-color:rgba(178,59,59,.25);color:#a83a3a}
.btn-danger:hover{background:#fbe2e2}
.btn-ghost.danger{color:var(--danger)}
.btn-ghost.danger:hover{background:var(--danger-soft)}
.btn-block{width:100%;height:48px;font-size:14px;border-radius:12px}
.btn:disabled{opacity:.45;cursor:not-allowed;transform:none;filter:none;box-shadow:none}
.spinner{
  display:none;width:15px;height:15px;border-radius:50%;
  border:2px solid rgba(255,255,255,.3);border-top-color:#fff;
  animation:spin .8s linear infinite;
}
.btn.is-loading .spinner{display:inline-block}
@keyframes spin{to{transform:rotate(360deg)}}
.micro{font-size:10.5px;color:var(--muted-2);text-align:center;margin-top:12px;letter-spacing:.02em}

/* ---------- 作品区 ---------- */
.workspace{min-width:0}
.workspace-head{
  display:flex;align-items:flex-end;justify-content:space-between;gap:16px;
  padding:2px 2px 16px;border-bottom:1px solid var(--border);margin-bottom:20px;
}
.workspace-head h2{font-size:18px;font-weight:650;letter-spacing:-.01em}
.workspace-head p{font-size:11.5px;color:var(--muted-2);margin-top:4px}
.workspace-meta{display:flex;align-items:center;gap:8px}
.count-chip{
  height:28px;padding:0 11px;border-radius:999px;border:1px solid var(--border);
  display:inline-flex;align-items:center;gap:5px;font-size:11.5px;color:var(--muted);
  font-variant-numeric:tabular-nums;background:#fff;
}
.running-chip{
  height:28px;padding:0 10px;border-radius:999px;border:1px solid var(--border);
  display:inline-flex;align-items:center;gap:7px;font-size:11.5px;color:var(--muted);
  background:#fff;font-variant-numeric:tabular-nums;
}
.running-chip[hidden]{display:none}
.running-dot{width:6px;height:6px;border-radius:50%;background:var(--primary);animation:pulse 1.6s ease-in-out infinite}

.gallery{columns:3;column-gap:16px}
.work-card{
  break-inside:avoid;-webkit-column-break-inside:avoid;margin:0 0 16px;
  background:#fff;
  border:1px solid var(--border);border-radius:14px;overflow:hidden;
  transition:transform .22s ease,border-color .22s,box-shadow .22s;
}
.work-card:hover{transform:translateY(-3px);border-color:var(--border-strong);box-shadow:var(--shadow-lift)}
.work-card.is-new{animation:cardIn .45s ease both}
@keyframes cardIn{from{opacity:0;transform:translateY(10px) scale(.985)}to{opacity:1;transform:none}}
.work-media{
  position:relative;display:block;width:100%;aspect-ratio:1/1;overflow:hidden;
  background:#f3f3f5;cursor:zoom-in;
}
.work-media img{width:100%;height:100%;object-fit:cover;transition:transform .6s cubic-bezier(.2,.7,.2,1)}
.work-media:hover img{transform:scale(1.035)}
.media-open{position:absolute;inset:0;z-index:1;background:none;border:0;cursor:zoom-in}
.work-media::after{
  content:"";position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(180deg,transparent 62%,rgba(18,18,24,.16));
  opacity:0;transition:opacity .22s;
}
.work-media:hover::after,.work-card:focus-within .work-media::after{opacity:1}
.work-time{
  position:absolute;top:10px;left:10px;z-index:2;
  padding:3px 8px;border-radius:999px;font-size:10px;color:#3c3c43;
  background:rgba(255,255,255,.86);border:1px solid rgba(18,18,24,.08);
  backdrop-filter:blur(8px);
}
.work-actions{
  position:absolute;right:10px;bottom:10px;z-index:3;display:flex;gap:6px;
  opacity:0;transform:translateY(4px);transition:.2s ease;
}
.work-media:hover .work-actions,.work-card:focus-within .work-actions{opacity:1;transform:none}
.icon-action{
  width:30px;height:30px;border-radius:8px;display:grid;place-items:center;
  background:rgba(255,255,255,.92);border:1px solid rgba(18,18,24,.10);
  color:#2f2f36;box-shadow:0 2px 6px rgba(18,18,24,.10);backdrop-filter:blur(10px);transition:.16s;
}
.icon-action:hover{background:#fff;border-color:var(--primary-line);color:var(--primary)}
.icon-action svg{width:15px;height:15px}
.work-body{padding:13px 14px 14px}
.work-prompt{
  font-size:12.5px;line-height:1.7;color:#3f3f46;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  min-height:42px;
}
.work-meta{display:flex;align-items:center;gap:6px;margin-top:10px;flex-wrap:wrap}
.badge{
  font-size:10px;padding:2px 7px;border-radius:5px;color:var(--muted);
  background:#f6f6f7;border:1px solid var(--border);
}
.badge.gold{color:#8a5a12;border-color:rgba(169,111,22,.22);background:rgba(214,151,58,.12)}

/* 骨架 / 显影中 */
.ghost-card{background:#fff;border:1px solid var(--border);border-radius:14px;overflow:hidden;break-inside:avoid;margin-bottom:16px}
.ghost-media{
  position:relative;aspect-ratio:1/1;overflow:hidden;
  background:
    radial-gradient(120% 90% at 30% 20%,rgba(214,151,58,.10),transparent 60%),
    linear-gradient(180deg,#fbfbfc,#f2f2f4);
}
.ghost-media::before{
  content:"";position:absolute;inset:0;
  background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,.65) 48%,transparent 66%);
  transform:translateX(-100%);animation:shimmer 2.2s infinite;
}
@keyframes shimmer{to{transform:translateX(100%)}}
.ghost-state{
  position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;
  color:var(--muted);font-size:12px;letter-spacing:.08em;text-align:center;padding:16px;
}
.ghost-ring{
  width:34px;height:34px;border-radius:50%;
  border:1.5px solid rgba(169,111,22,.18);border-top-color:var(--primary);
  animation:spin 1.1s linear infinite;
}
.ghost-state strong{font-weight:500;color:#4b4b53;font-size:12px}
.ghost-state small{font-family:var(--mono);font-size:10.5px;color:var(--muted-2)}
.ghost-body{padding:13px 14px 14px;display:grid;gap:8px}
.ghost-line{height:9px;border-radius:5px;background:#ededf0;position:relative;overflow:hidden}
.ghost-line::after{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent,rgba(255,255,255,.75),transparent);animation:shimmer 2s infinite}
.ghost-line.short{width:55%}

/* 空状态 */
.empty{
  border:1px dashed rgba(18,18,24,.14);border-radius:18px;
  padding:58px 28px;display:flex;flex-direction:column;align-items:center;text-align:center;
  background:radial-gradient(80% 120% at 50% 0%,rgba(214,151,58,.06),transparent 65%);
}
.empty[hidden]{display:none}
.empty-art{position:relative;width:92px;height:92px;margin-bottom:22px}
.empty-art .ring{position:absolute;inset:0;border-radius:50%;border:1px solid rgba(169,111,22,.16)}
.empty-art .r2{inset:14px;border-color:rgba(169,111,22,.24)}
.empty-art .r3{inset:28px;border-color:rgba(169,111,22,.4)}
.empty-art .core{
  position:absolute;inset:50%;width:9px;height:9px;margin:-4.5px;border-radius:50%;
  background:var(--primary);box-shadow:0 0 16px rgba(169,111,22,.45);
}
.empty h3{font-size:16px;font-weight:600}
.empty p{font-size:12.5px;color:var(--muted);margin-top:8px;max-width:380px}
.idea-list{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:22px}
.idea{
  font-size:12px;color:var(--muted);padding:7px 12px;border-radius:999px;
  border:1px solid var(--border);background:#fff;transition:.16s;
}
.idea:hover{color:var(--fg);border-color:var(--border-strong);background:#f7f7f8}

/* ---------- 弹窗 ---------- */
.modal{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:24px}
.modal[hidden]{display:none}
.modal-backdrop{position:absolute;inset:0;background:rgba(18,18,24,.42);backdrop-filter:blur(8px)}
.modal-panel{
  position:relative;background:#fff;border:1px solid rgba(18,18,24,.12);
  border-radius:20px;box-shadow:0 50px 120px -50px rgba(18,18,24,.55);
  animation:pop .24s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes pop{from{opacity:0;transform:translateY(10px) scale(.985)}to{opacity:1;transform:none}}
.modal-close{
  position:absolute;top:14px;right:14px;z-index:5;width:34px;height:34px;border-radius:9px;
  display:grid;place-items:center;font-size:20px;color:var(--muted);
  background:rgba(255,255,255,.85);border:1px solid var(--border);transition:.16s;
}
.modal-close:hover{color:var(--fg);background:#f5f5f6}
.icon-btn{background:none;border:0}

.viewer-panel{
  width:min(1120px,calc(100vw - 48px));max-height:calc(100vh - 48px);
  display:grid;grid-template-columns:minmax(0,1.65fr) minmax(280px,.85fr);overflow:hidden;
}
.viewer-media{
  position:relative;display:grid;place-items:center;min-height:320px;padding:22px;
  background:radial-gradient(70% 70% at 50% 45%,#ffffff,#f2f2f4 75%);
}
.viewer-media img{max-width:100%;max-height:calc(100vh - 140px);object-fit:contain;border-radius:8px;box-shadow:0 24px 60px -34px rgba(18,18,24,.45)}
.nav-btn{
  position:absolute;top:50%;transform:translateY(-50%);width:38px;height:38px;border-radius:50%;
  background:rgba(255,255,255,.9);border:1px solid rgba(18,18,24,.10);color:#2f2f36;
  font-size:20px;line-height:1;display:grid;place-items:center;box-shadow:0 4px 12px rgba(18,18,24,.10);transition:.16s;
}
.nav-btn:hover{background:#fff;border-color:var(--primary-line);color:var(--primary)}
.nav-btn.prev{left:14px}
.nav-btn.next{right:14px}
.nav-btn[hidden]{display:none}
.viewer-info{padding:28px 24px 24px;border-left:1px solid var(--border);overflow:auto;background:#fff}
.viewer-info h3{font-size:15px;font-weight:650;margin:12px 0 10px}
.viewer-prompt{font-size:12.5px;line-height:1.9;color:#4b4b53;white-space:pre-wrap;word-break:break-word}
.specs{display:grid;grid-template-columns:1fr 1fr;gap:12px 14px;margin:22px 0 24px;padding:16px;border:1px solid var(--border);border-radius:12px;background:#fafafa}
.specs dt{font-size:10px;color:var(--muted-2);letter-spacing:.08em;margin-bottom:3px}
.specs dd{font-size:12px;color:#3c3c43;font-variant-numeric:tabular-nums}
.viewer-actions{display:grid;gap:9px}

.help-panel{width:min(560px,calc(100vw - 48px));padding:34px 32px 30px}
.help-panel h3{font-size:19px;font-weight:650;margin:12px 0 20px}
.help-steps{display:grid;gap:16px;counter-reset:step}
.help-steps li{display:grid;grid-template-columns:20px 1fr;gap:10px;counter-increment:step}
.help-steps li::before{
  content:counter(step);width:20px;height:20px;border-radius:50%;display:grid;place-items:center;
  font-size:10.5px;color:var(--primary);border:1px solid var(--primary-line);background:var(--primary-soft);
}
.help-steps strong{display:block;font-size:13px;font-weight:600;margin-bottom:3px}
.help-steps span{display:block;font-size:12px;color:var(--muted);line-height:1.8}
.help-note{font-size:10.5px;color:var(--muted-2);margin-top:24px;padding-top:16px;border-top:1px solid var(--border);line-height:1.9}

.confirm-panel{width:min(420px,calc(100vw - 48px));padding:28px}
.confirm-panel h3{font-size:17px;font-weight:650}
.confirm-panel p{font-size:12.5px;color:var(--muted);margin:10px 0 24px;line-height:1.8}
.confirm-actions{display:flex;justify-content:flex-end;gap:10px}

/* ---------- Toast ---------- */
.toasts{position:fixed;right:22px;bottom:22px;z-index:200;display:flex;flex-direction:column;gap:10px;max-width:min(360px,calc(100vw - 44px))}
.toast{
  display:flex;align-items:flex-start;gap:10px;padding:12px 14px;border-radius:12px;
  background:rgba(255,255,255,.97);border:1px solid var(--border-strong);
  box-shadow:0 24px 50px -26px rgba(18,18,24,.28);backdrop-filter:blur(12px);
  animation:toastIn .28s cubic-bezier(.2,.8,.2,1) both;font-size:12.5px;color:#2c2c33;
}
.toast.out{animation:toastOut .22s ease forwards}
.toast .bar{width:3px;align-self:stretch;border-radius:3px;background:var(--primary);flex-shrink:0}
.toast.error .bar{background:var(--danger)}
.toast .msg{flex:1;line-height:1.65}
.toast .close{color:var(--muted-2);font-size:16px;line-height:1;padding:2px 4px;border-radius:5px}
.toast .close:hover{color:var(--fg);background:#f1f1f3}
@keyframes toastIn{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}
@keyframes toastOut{to{opacity:0;transform:translateY(6px)}}

/* ---------- 页脚 ---------- */
.site-foot{
  max-width:1440px;margin:0 auto;padding:18px 28px 30px;
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  font-size:10.5px;color:var(--muted-2);border-top:1px solid var(--border);
}
.foot-right{display:flex;align-items:center;gap:16px}
.site-foot a:hover{color:var(--muted);text-decoration:underline}

/* ---------- 启动与登录 ---------- */
.boot-screen{
  position:fixed;inset:0;z-index:400;background:#fff;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;
}
.boot-screen[hidden]{display:none}
.boot-mark{
  width:44px;height:44px;border-radius:13px;display:grid;place-items:center;
  background:linear-gradient(145deg,#232329,#121215);color:#f1c77c;
  font-weight:700;font-size:19px;border:1px solid rgba(18,18,24,.18);
}
.boot-spinner{width:20px;height:20px;border-radius:50%;border:2px solid #ececef;border-top-color:var(--primary);animation:spin .8s linear infinite}
.boot-text{font-size:11.5px;color:var(--muted-2);letter-spacing:.1em}

.auth-gate{
  position:fixed;inset:0;z-index:300;background:#fff;
  display:grid;grid-template-columns:1.02fr .98fr;overflow:auto;
}
.auth-gate[hidden]{display:none}
.auth-visual{
  position:relative;padding:56px;display:flex;flex-direction:column;justify-content:space-between;gap:40px;
  background:
    radial-gradient(110% 80% at 18% 8%,#fff6e4,transparent 58%),
    linear-gradient(180deg,#fffdf8,#f7f7f8);
  border-right:1px solid var(--border);overflow:hidden;
}
.auth-brand,.auth-panel-brand{display:flex;align-items:center;gap:12px}
.auth-brand .brand-mark,.auth-panel-brand .brand-mark{font-size:16px;font-weight:700}
.auth-copy{position:relative;z-index:1;max-width:470px}
.auth-copy h2{font-size:clamp(30px,3.4vw,46px);line-height:1.28;letter-spacing:-.03em;margin:16px 0;font-weight:700}
.auth-copy p{font-size:14px;color:#4b4b53;line-height:1.9;max-width:410px}
.auth-points{display:grid;gap:11px;margin-top:26px;font-size:13px;color:#55555e}
.auth-points li{display:flex;align-items:center;gap:10px}
.auth-points li::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--primary);box-shadow:0 0 0 4px var(--primary-soft)}
.auth-art{position:absolute;right:-130px;bottom:-150px;width:470px;height:470px;pointer-events:none}
.auth-art .ring{position:absolute;inset:0;border-radius:50%;border:1px solid rgba(169,111,22,.12)}
.auth-art .r2{inset:72px;border-color:rgba(169,111,22,.18)}
.auth-art .r3{inset:144px;border-color:rgba(169,111,22,.28)}
.auth-art .core{
  position:absolute;left:50%;top:50%;width:12px;height:12px;margin:-6px;border-radius:50%;
  background:var(--primary);box-shadow:0 0 26px rgba(169,111,22,.5);
}
.auth-panel{display:flex;align-items:center;justify-content:center;padding:48px 32px;background:#fff}
.auth-panel-inner{width:min(380px,100%)}
.auth-panel-brand{display:none;margin-bottom:28px}
.auth-panel h3{font-size:26px;letter-spacing:-.02em;margin:12px 0 6px}
.auth-sub{font-size:12.5px;color:var(--muted);margin-bottom:22px}
.auth-tabs{
  display:grid;grid-template-columns:1fr 1fr;gap:3px;padding:3px;border-radius:10px;
  background:#f4f4f5;border:1px solid var(--border);margin-bottom:20px;
}
.auth-tabs button{height:36px;border-radius:8px;font-size:13px;color:var(--muted);transition:.16s}
.auth-tabs button.is-active{
  background:#fff;color:var(--fg);font-weight:600;
  box-shadow:0 1px 2px rgba(18,18,24,.08),inset 0 0 0 1px rgba(18,18,24,.05);
}
.auth-field{display:block;margin-bottom:14px}
.auth-field>span{display:block;font-size:11.5px;color:var(--muted);letter-spacing:.06em;margin-bottom:7px}
.auth-field input{
  width:100%;height:46px;padding:0 14px;border-radius:10px;border:1px solid var(--border);
  background:#fbfbfc;color:var(--fg);font:inherit;font-size:13.5px;transition:.16s;outline:none;
}
.auth-field input::placeholder{color:#a4a4ad}
.auth-field input:focus{border-color:rgba(169,111,22,.4);background:#fff;box-shadow:0 0 0 3px rgba(169,111,22,.1)}
.auth-field[hidden]{display:none}
.auth-error{
  background:var(--danger-soft);border:1px solid rgba(178,59,59,.2);color:#9c3030;
  font-size:12px;border-radius:8px;padding:8px 11px;margin:0 0 12px;line-height:1.6;
}
.auth-error[hidden]{display:none}
.auth-note{font-size:10.5px;color:var(--muted-2);margin-top:16px;line-height:1.8}

/* ---------- 响应式 ---------- */
@media (max-width:1180px){
  .shell{grid-template-columns:332px minmax(0,1fr);gap:20px}
  .gallery{columns:2}
}
@media (max-width:980px){
  .shell{grid-template-columns:1fr;padding-top:20px}
  .viewer-panel{grid-template-columns:1fr;max-height:calc(100vh - 32px);overflow:auto}
  .viewer-media{min-height:0}
  .viewer-media img{max-height:46vh}
  .viewer-info{border-left:0;border-top:1px solid var(--border)}
}
@media (max-width:900px){
  .primary-nav{display:none}
  .auth-gate{grid-template-columns:1fr}
  .auth-visual{display:none}
  .auth-panel{padding:40px 24px}
  .auth-panel-brand{display:flex}
  .user-name{display:none}
}
@media (max-width:640px){
  .topbar-inner{height:58px;padding:0 16px;gap:10px}
  .brand-copy small{display:none}
  .status-pill{display:none}
  .model-badge{font-size:10.5px;padding:0 8px;height:28px}
  .brand-mark{width:34px;height:34px}
  .user-box{height:30px;padding:0 4px}
  .logout-btn{font-size:10.5px;padding:3px 5px}
  .auth-panel{padding:28px 18px}
  .auth-panel h3{font-size:23px}
  .subnav{top:58px}
  .subnav-inner{height:46px;padding:0 16px;gap:10px}
  .mode-tab{height:30px;padding:0 13px;font-size:12px}
  .mode-hint{display:none}
  #create,#works{scroll-margin-top:112px}
  .shell{padding:16px 16px 40px;gap:16px}
  .panel{padding:18px;border-radius:16px}
  .panel-heading h1{font-size:22px}
  .segmented button{height:34px;font-size:11.5px}
  .ratio-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}
  .ratio-option{height:54px}
  .upload-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
  .gallery{columns:2;column-gap:10px}
  .work-card{margin-bottom:10px}
  .work-body{padding:10px 11px 12px}
  .work-prompt{font-size:11.5px;min-height:38px}
  .badge{font-size:9.5px}
  .workspace-head h2{font-size:16px}
  .workspace-head{align-items:center}
  .modal{padding:12px}
  .viewer-panel{width:calc(100vw - 24px);max-height:calc(100vh - 24px)}
  .viewer-media{padding:12px}
  .viewer-media img{max-height:42vh}
  .viewer-info{padding:20px 18px 18px}
  .help-panel{padding:28px 20px 22px}
  .site-foot{padding:16px;flex-direction:column;align-items:flex-start;gap:8px}
  .foot-right{flex-wrap:wrap;gap:10px}
  .toasts{right:12px;bottom:12px}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms !important;animation-iteration-count:1 !important;transition-duration:.001ms !important}
}
