/* ============================================================
   SuperDesigner Studio v5 —— 专业科技风格的工作台界面
   骨架：左侧导航 rail + 多页面（设计 / 广场 / 用量 / 编辑器）+ 设置浮层
   令牌：tokens.css（颜色 / 字体 / 间距 / 圆角 / 阴影全部来自变量）
   规则：信息密但对齐严格；数字 tabular-nums；表格行高 46；主色只给主操作
   ============================================================ */

* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-13)/1.55 var(--font-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  min-width: 320px;
}
::selection { background: var(--primary-soft-2); color: var(--text); }
svg { display: block; flex: none; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p, ul, ol, pre { margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-xs); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2); border: 3px solid transparent;
  background-clip: content-box; border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }

.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }

/* ============================================================ 应用骨架 */
#app { display: flex; height: 100%; }

#rail {
  width: var(--rail-w); flex: none;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px; overflow: hidden;
}

.rail-brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.brand-mark-wrap {
  width: 32px; height: 32px; flex: none; border-radius: var(--r);
  background: var(--primary); color: #fff;
  display: grid; place-items: center; box-shadow: 0 1px 2px rgba(15, 23, 42, .18);
}
.brand-mark { width: 17px; height: 17px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-name { font: 600 13.5px/1.3 var(--font-head); color: var(--text); letter-spacing: -.005em; white-space: nowrap; }
.brand-sub { font-size: var(--fs-12); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rail-sec { font-size: var(--fs-12); color: var(--faint); padding: 6px 10px 4px; letter-spacing: .04em; }

.rail-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r);
  background: none; color: var(--muted); font-size: var(--fs-13); text-align: left;
  cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.rail-item > svg { width: 16px; height: 16px; opacity: .9; }
.rail-item > span { white-space: nowrap; }
.rail-item:hover { background: var(--surface-3); color: var(--text); }
.rail-item.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.rail-item.on > svg { opacity: 1; }
.rail-item.on::before {
  content: ""; position: absolute; left: -12px; top: 50%;
  width: 3px; height: 16px; margin-top: -8px;
  border-radius: 0 2px 2px 0; background: var(--primary);
}

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 10px; }

.rail-usage {
  display: flex; flex-direction: column; gap: 3px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2);
}
.ru-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--faint); }
.ru-label > svg { width: 12px; height: 12px; }
/* 用量三行分行展示：键值两端对齐，不再挤一行省略号 */
.ru-rows { display: flex; flex-direction: column; gap: 3px; }
.ru-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ru-k { font-size: var(--fs-12); color: var(--muted); flex: none; }
.ru-v {
  font-family: var(--mono); font-size: var(--fs-12); color: var(--text);
  font-variant-numeric: tabular-nums; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#btn-signin-rail { width: 100%; height: 32px; padding: 0 10px; margin: 0; }

.user-box {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
}
.user-avatar {
  position: relative;
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  font: 600 11px/1 var(--font-head); text-transform: uppercase;
}
/* 已登录：头像右下角常驻绿点，配合昵称一眼可辨身份状态 */
.user-box[data-auth="in"] .user-avatar::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok); border: 1.5px solid var(--surface);
}
.user-box #user-name { flex: 1; min-width: 0; font-size: var(--fs-12); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-level {
  font-size: var(--fs-12); font-weight: 600; color: var(--primary);
  background: var(--primary-soft); border-radius: var(--r-xs);
  padding: 1px 5px; white-space: nowrap;
}
.user-box .icon-btn { width: 24px; height: 24px; border-radius: var(--r-xs); }
.user-box .icon-btn > svg { width: 13px; height: 13px; }
.user-box .icon-btn:hover { color: var(--err-ink); background: var(--err-soft); }

/* 未登录：明确显示身份状态，而不是整块消失 */
.auth-guest {
  display: flex; flex-direction: column; gap: 6px;
  padding: 9px 10px; border: 1px dashed var(--line-2); border-radius: var(--r);
  background: var(--surface-2);
}
.ag-row { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--muted); white-space: nowrap; }
.ag-row > svg { width: 13px; height: 13px; flex: none; }
.ag-btn { width: 100%; height: 30px; }
.ag-btn > svg { width: 13px; height: 13px; }
.auth-note { display: inline-flex; align-items: center; gap: 8px; color: var(--warn-ink); }
.auth-note a { color: var(--primary); font-weight: 600; padding: 3px 6px; margin: -3px -6px; border-radius: var(--r-xs); }
.auth-note a:hover { background: var(--primary-soft); }

#page-root { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }

/* ============================================================ 通用页面 */
.page { display: none; flex: 1; min-height: 0; overflow-y: auto; padding: 24px 28px 40px; }
.page.on { display: block; }
#page-editor.page { padding: 0; overflow: hidden; }
#page-editor.page.on { display: flex; flex-direction: column; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); margin-bottom: 18px; }
.page-title { font: 600 19px/1.25 var(--font-head); letter-spacing: -.012em; color: var(--text); }
.page-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 5px; font-size: var(--fs-12); color: var(--muted); }
.page-sub b { font-weight: 600; color: var(--text); }
.page-actions { display: flex; align-items: center; gap: var(--s-2); flex: none; padding-top: 2px; }

.subsep { width: 1px; height: 11px; background: var(--line-2); flex: none; }

.sec-title {
  font: 600 var(--fs-12)/1.4 var(--font-body);
  letter-spacing: .05em; color: var(--faint);
  margin: 26px 0 10px;
}
.list-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin: 6px 0 12px; }
.list-head .sec-title { margin: 0; }
.list-meta { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-12); color: var(--muted); flex-wrap: wrap; }
.hs { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* ============================================================ 按钮与控件 */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 44px; padding: 0 18px; flex: none;
  border: 0; border-radius: var(--r); background: var(--primary); color: var(--on-primary);
  font: 600 var(--fs-13)/1 var(--font-head); white-space: nowrap; cursor: pointer;
  transition: background .15s var(--ease), transform .08s var(--ease);
}
.btn-primary > svg { width: 15px; height: 15px; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-press); transform: translateY(1px); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-sm { height: 30px; padding: 0 11px; font-size: var(--fs-12); border-radius: var(--r-sm); }
.btn-sm > svg { width: 13px; height: 13px; }
.btn-block { width: 100%; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 11px; flex: none;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--muted);
  font-size: var(--fs-12); white-space: nowrap; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn-ghost > svg { width: 14px; height: 14px; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; }

/* 工具按钮（editor 头部、预览栏）—— 保留旧类名，行为不变 */
.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 10px; flex: none;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--muted);
  font-size: var(--fs-12); white-space: nowrap; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.tool-btn > svg { width: 14px; height: 14px; }
.tool-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.tool-btn:disabled { opacity: .42; cursor: not-allowed; }
.tool-accent { color: var(--primary); border-color: var(--primary-soft-2); background: transparent; }
.tool-accent:hover:not(:disabled) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: none;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: none; color: var(--muted); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn > svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* 分段控件 */
.seg {
  position: relative; display: inline-flex; align-items: center; gap: 2px; flex: none;
  padding: 3px; border-radius: var(--r); background: var(--surface-3);
}
.seg button {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 9px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--muted); font-size: var(--fs-12);
  white-space: nowrap; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.seg button > svg { width: 13px; height: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .10);
}
.seg button.on > svg { color: var(--primary); }
.seg-value { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.vdiv { width: 1px; height: 16px; background: var(--line); flex: none; }

select {
  height: 32px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font-size: var(--fs-12); cursor: pointer;
}
select:focus { outline: 0; border-color: var(--primary); box-shadow: var(--ring); }

/* 输入框 */
.pf-input {
  width: 100%; height: 34px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font-size: var(--fs-13);
  outline: 0; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.pf-input::placeholder { color: var(--faint); }
.pf-input:focus { border-color: var(--primary); box-shadow: var(--ring); }
textarea.pf-input { height: auto; min-height: 66px; padding: 8px 11px; line-height: 1.55; resize: vertical; }
select.pf-input { height: 34px; padding: 0 8px; font-size: var(--fs-13); }

/* 手机号绑定行：输入 + 发送验证码 / 验证码 + 绑定按钮 */
.pf-phone-row { display: flex; gap: 8px; }
.pf-phone-row .pf-input { flex: 1; min-width: 0; }
.pf-phone-row .tool-btn { flex: none; white-space: nowrap; }
.pf-phone-state { margin-top: 6px; font-size: var(--fs-12); color: var(--muted); line-height: 1.5; }
.pf-phone-state.is-ok { color: var(--ok-ink); }
.pf-phone-state.is-err { color: var(--err-ink); }

/* 状态点 / 状态标签 */
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); display: inline-block; flex: none; }
.dot-ready { background: var(--ok); }
.dot-generating { background: var(--warn); animation: pulse 1.2s var(--ease) infinite; }
.dot-failed { background: var(--err); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .24; } }

.st { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-12); color: var(--muted); white-space: nowrap; }
.st > i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); flex: none; }
.st-ready { color: var(--ok-ink); }
.st-ready > i { background: var(--ok); }
.st-generating { color: var(--warn-ink); }
.st-generating > i { background: var(--warn); animation: pulse 1.2s var(--ease) infinite; }
.st-failed { color: var(--err-ink); }
.st-failed > i { background: var(--err); }

/* ============================================================ 页面：设计列表 */
.compose {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 22px;
}
.compose-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.compose-title { display: inline-flex; align-items: center; gap: 7px; font: 600 var(--fs-13)/1 var(--font-head); color: var(--text); }
.compose-title > svg { width: 15px; height: 15px; color: var(--primary); }
.compose-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.compose-row { display: flex; align-items: stretch; gap: 8px; }
.cmd-input {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px;
  height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.cmd-input > svg { width: 16px; height: 16px; color: var(--faint); }
.cmd-input:focus-within { border-color: var(--primary); background: var(--surface); box-shadow: var(--ring); }
.cmd-input input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none;
  font-size: var(--fs-13); color: var(--text);
}
.cmd-input input::placeholder { color: var(--faint); }

.compose-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.cf-label { font-size: var(--fs-12); color: var(--faint); flex: none; }
.example-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  display: inline-flex; align-items: center; height: 26px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--muted); font-size: var(--fs-12);
  cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.chip-btn:hover { background: var(--primary-soft); border-color: var(--primary-soft-2); color: var(--primary); }

/* 设计卡片 */
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }
.dcard {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; cursor: pointer;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.dcard:hover { border-color: var(--line-2); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.dcard-thumb {
  position: relative; aspect-ratio: 16 / 10; flex: none; overflow: hidden;
  background: var(--surface-3); border-bottom: 1px solid var(--line);
}
.dcard-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top center; display: block;
  transition: transform .4s var(--ease);
}
.dcard:hover .dcard-thumb img { transform: scale(1.03); }
.dcard-thumb.shimmer {
  background: linear-gradient(100deg, var(--surface-3) 30%, var(--surface-4) 50%, var(--surface-3) 70%);
  background-size: 220% 100%; animation: shimmer 1.8s linear infinite;
}
@keyframes shimmer { to { background-position: -120% 0; } }

/* 无缩略图时的主题骨架（用设计自身配色画一个微型页面） */
.dcard-fake {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: 12px 13px; background: var(--tf-bg, var(--surface-3));
}
.dcard-fake .f-top { display: flex; align-items: center; gap: 5px; }
.dcard-fake .f-brand { width: 22px; height: 6px; border-radius: 3px; background: var(--tf-brand); opacity: .9; }
.dcard-fake .f-line { height: 5px; border-radius: 3px; background: var(--tf-fg); opacity: .16; }
.dcard-fake .f-line.lg { height: 10px; opacity: .3; }
.dcard-fake .f-row { flex: 1; min-height: 14px; display: flex; gap: 5px; margin: 8px 0; }
.dcard-fake .f-cell { flex: 1; border-radius: 4px; background: var(--tf-line); opacity: .6; }
.dcard-fake .f-cta { width: 26%; height: 12px; border-radius: 3px; background: var(--tf-brand); opacity: .85; }

.dcard-mode {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 6px; border-radius: var(--r-xs);
  background: rgba(255, 255, 255, .94); border: 1px solid var(--line);
  color: var(--muted); font-size: var(--fs-12); line-height: 1;
}
.dcard-mode > svg { width: 11px; height: 11px; }
html[data-app-theme="dark"] .dcard-mode { background: rgba(17, 26, 43, .92); }

.dcard-del {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: var(--r-xs);
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  cursor: pointer; opacity: 0; transition: opacity .15s var(--ease), color .15s, border-color .15s, background .15s;
}
.dcard:hover .dcard-del, .dcard:focus-within .dcard-del { opacity: 1; }
.dcard-del > svg { width: 12px; height: 12px; }
.dcard-del:hover { color: var(--err-ink); border-color: var(--err); background: var(--err-soft); }

.dcard-body { display: flex; flex-direction: column; gap: 4px; padding: 11px 13px 12px; min-width: 0; }
.dcard-title {
  font: 600 var(--fs-13)/1.45 var(--font-head); color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word; min-height: 38px;
}
.dcard-brief {
  font-size: var(--fs-12); line-height: 1.55; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 37px;
}
.dcard-brief.no-brief { color: var(--faint); }
.dcard-foot {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  margin-top: 6px; padding-top: 9px; border-top: 1px solid var(--line);
  font-size: var(--fs-12); color: var(--faint);
}
.dcard-theme {
  font-family: var(--mono); font-size: var(--fs-12); color: var(--muted);
  background: var(--surface-3); border-radius: var(--r-xs); padding: 1px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46%;
}
.dcard-time { margin-left: auto; white-space: nowrap; }

/* 站点分组 */
.site-group {
  grid-column: 1 / -1;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); padding: 0 14px 14px;
}
.site-group-head { display: flex; align-items: center; gap: 8px; padding: 12px 0 11px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.site-ic { width: 14px; height: 14px; color: var(--primary); }
.site-name { font: 600 var(--fs-13)/1.4 var(--font-head); color: var(--text); }
.site-count { font-size: var(--fs-12); color: var(--faint); }
.site-export-btn { margin-left: auto; }
.site-group-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.dcard-site { background: var(--surface); }

/* 空状态 */
.empty-block {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 5px; padding: 48px 16px 32px; color: var(--muted);
}
.empty-ic-box { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; margin-bottom: 4px; }
.empty-ic { width: 20px; height: 20px; color: var(--faint); }
.empty-title { font: 600 var(--fs-15)/1.4 var(--font-head); color: var(--text); }
.empty-sub { font-size: var(--fs-12); color: var(--muted); max-width: 34em; line-height: 1.65; }

/* ============================================================ 页面：编辑器 */
.editor-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  height: var(--head-h); padding: 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
#btn-back { border-color: var(--line); }
.eh-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.eh-row1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
#ed-title { font: 600 13.5px/1.35 var(--font-head); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eh-row2 { display: flex; align-items: center; gap: 7px; min-width: 0; }
#ed-slug { font-size: var(--fs-12); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.eh-sep { color: var(--faint); font-size: var(--fs-12); flex: none; }
.eh-chip {
  font-size: var(--fs-12); color: var(--muted); background: var(--surface-3);
  border-radius: var(--r-xs); padding: 1px 6px; white-space: nowrap;
}
.eh-chip.mono { font-family: var(--mono); }
.eh-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.editor-body { flex: 1; display: flex; min-height: 0; }
#center { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }

#preview-bar {
  display: flex; align-items: center; gap: 8px; flex: none;
  min-width: 0; overflow: hidden;
  padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
}
#preview-bar .icon-btn { width: 28px; height: 28px; }
#preview-bar .tool-btn { height: 28px; }
#preview-url {
  flex: 1 1 auto; min-width: 0; margin-left: 8px; max-width: none;
  font-family: var(--mono); font-size: var(--fs-12); color: var(--faint);
  text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

#preview-wrap {
  position: relative; flex: 1; min-height: 0; overflow: auto;
  display: flex; justify-content: center; padding: 18px;
  background-color: var(--canvas);
  background-image: radial-gradient(circle at 1px 1px, var(--canvas-dot) 1px, transparent 0);
  background-size: 18px 18px;
}
#preview {
  flex: none; width: 100%; height: 100%;
  border: 0; border-radius: var(--r-sm); background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .10), 0 12px 32px rgba(15, 23, 42, .16);
  transition: width .25s var(--ease);
}
html[data-app-theme="dark"] #preview { box-shadow: 0 0 0 1px rgba(255, 255, 255, .10), 0 12px 32px rgba(0, 0, 0, .55); }

#preview-loading {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30; height: 2px;
  background: var(--surface-3); overflow: hidden;
}
#preview-loading i {
  display: block; width: 36%; height: 100%; border-radius: 2px;
  background: var(--primary); animation: indet 1.3s cubic-bezier(.45, .05, .55, .95) infinite;
}
@keyframes indet { 0% { transform: translateX(-110%); } 100% { transform: translateX(380%); } }

/* 浮动卡片 */
.floating-card {
  position: absolute; z-index: 20;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
}
#gen-progress { top: 50%; left: 50%; transform: translate(-50%, -50%); width: 320px; padding: 15px 17px 14px; animation: fadeIn .18s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } }

.gp-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font: 600 var(--fs-13)/1.4 var(--font-head); }
.dots { display: inline-flex; align-items: center; gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); animation: dotWave 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dotWave { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-3px); opacity: 1; } }
.gp-stage { margin-left: auto; font: 400 var(--fs-12)/1.4 var(--mono); color: var(--faint); }

#gp-steps { list-style: none; display: flex; flex-direction: column; gap: 9px; }
#gp-steps li { display: flex; align-items: center; gap: 9px; font-size: var(--fs-12); color: var(--faint); }
#gp-steps li .st-ic {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--line-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
#gp-steps li.active { color: var(--text); }
#gp-steps li.active .st-ic { border-color: var(--primary-soft-2); border-top-color: var(--primary); animation: rot .9s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
#gp-steps li.done { color: var(--muted); }
#gp-steps li.done .st-ic { border-color: var(--ok); background: var(--ok-soft); }
#gp-steps li.done .st-ic::after {
  content: ""; width: 6px; height: 3px;
  border-left: 1.6px solid var(--ok); border-bottom: 1.6px solid var(--ok);
  transform: rotate(-45deg) translate(0, -1px);
}
#gp-steps li.error { color: var(--err-ink); }
#gp-steps li.error .st-ic { border-color: var(--err); background: var(--err-soft); }
.gp-error { margin-top: 10px; font-size: var(--fs-12); line-height: 1.5; color: var(--err-ink); }

#pick-card {
  bottom: 16px; left: 50%; transform: translateX(-50%);
  width: min(580px, calc(100% - 32px)); padding: 13px 15px;
  animation: cardUp .22s var(--ease);
}
@keyframes cardUp { from { opacity: 0; transform: translate(-50%, 8px); } }
.pc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.pc-ic { width: 15px; height: 15px; color: var(--primary); }
#pick-selector {
  flex: 1; min-width: 0; padding: 4px 8px; border-radius: var(--r-xs);
  background: var(--primary-soft); color: var(--primary);
  font-family: var(--mono); font-size: var(--fs-12);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#pick-close { width: 24px; height: 24px; }
#pick-card textarea {
  width: 100%; height: 56px; resize: none; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  font: 400 var(--fs-13)/1.5 var(--font-body); outline: 0;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
#pick-card textarea:focus { border-color: var(--primary); background: var(--surface); box-shadow: var(--ring); }
.pc-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 9px; }

/* 右栏 */
#right {
  width: var(--panel-w); flex: none; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line); background: var(--surface);
}
.tabs { display: flex; gap: 4px; flex: none; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; border: 0; border-radius: var(--r-sm); background: none;
  color: var(--muted); font-size: 12.5px; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.tab > svg { width: 14px; height: 14px; opacity: .9; }
.tab:hover { background: var(--surface-3); color: var(--text); }
.tab.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tab-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.tab-pane { display: none; padding: 12px; }
.tab-pane.on { display: block; }

#log {
  min-height: 180px; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--muted);
  font: 400 var(--fs-12)/1.72 var(--mono);
  white-space: pre-wrap; word-break: break-word;
}
#log:empty::before {
  content: "还没有活动。生成、定向修改、风格切换与评审的进度都会实时记录在这里。";
  color: var(--faint); font-family: var(--font-body); font-size: var(--fs-12); line-height: 1.7;
  white-space: normal;
}
.lg-stage { color: var(--primary); font-weight: 600; }
.lg-usage { color: var(--accent-ink); }
.lg-err { color: var(--err-ink); }
.lg-ok { color: var(--ok-ink); }

.qa-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.qa-hint { font-size: var(--fs-12); color: var(--faint); }
.gates-empty, .review-empty { font-size: var(--fs-12); color: var(--faint); padding: 2px; line-height: 1.6; }
#gates-box { margin-bottom: 12px; }
.gates-title { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: var(--fs-12); font-weight: 600; color: var(--muted); }
.gates-free { padding: 0 5px; border-radius: var(--r-xs); background: var(--accent-soft); color: var(--accent-ink); font-family: var(--mono); font-size: var(--fs-12); font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border: 1px solid transparent; border-radius: var(--r-pill);
  font-family: var(--mono); font-size: var(--fs-12);
}
.chip-ic { width: 11px; height: 11px; }
.chip-ok { color: var(--ok-ink); background: var(--ok-soft); border-color: rgba(18, 161, 80, .22); }
.chip-bad { color: var(--err-ink); background: var(--err-soft); border-color: rgba(224, 58, 82, .25); }
.gate-error { display: flex; align-items: center; gap: 7px; font-size: var(--fs-12); color: var(--warn-ink); }
.gate-ic { width: 13px; height: 13px; }

.review-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 10px; flex-wrap: wrap; }
.verdict { padding: 2px 8px; border-radius: var(--r-xs); font-size: var(--fs-12); font-weight: 700; letter-spacing: .08em; }
.verdict.pass { color: var(--ok-ink); background: var(--ok-soft); }
.verdict.fail { color: var(--err-ink); background: var(--err-soft); }
.review-total { font-family: var(--mono); font-weight: 700; font-size: 20px; line-height: 1; }
.review-total i { font-style: normal; font-weight: 400; font-size: var(--fs-12); color: var(--faint); }
.review-iter { margin-left: auto; font-size: var(--fs-12); color: var(--faint); }
.scores { display: flex; flex-direction: column; gap: 8px; }
.score-row { display: flex; align-items: center; gap: 9px; }
.score-name { width: 84px; flex: none; font-size: var(--fs-12); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.score-fill { display: block; height: 100%; border-radius: 3px; background: var(--muted); }
.score-fill.s5 { background: var(--ok); }
.score-fill.s4 { background: #7FBF3F; }
.score-fill.s3 { background: var(--warn); }
.score-fill.s1, .score-fill.s2 { background: var(--err); }
.score-num { width: 14px; flex: none; text-align: right; font-family: var(--mono); font-size: var(--fs-12); font-weight: 600; color: var(--text); }

.snaps-hint { margin-bottom: 9px; font-size: var(--fs-12); color: var(--faint); line-height: 1.6; }
#snapshot-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }
#snapshot-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: var(--fs-12); color: var(--muted);
  cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
#snapshot-list li:hover { background: var(--primary-soft); color: var(--primary); }
.snap-ic { width: 12px; height: 12px; opacity: .8; }

#review-issues { margin-top: 14px; }
.ri-item {
  display: flex; gap: 9px; margin-bottom: 6px; padding: 9px 10px;
  border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--r-sm);
  background: var(--surface-2);
}
.ri-high { border-left-color: var(--err); }
.ri-mid { border-left-color: var(--warn); }
.ri-low { border-left-color: var(--line-2); }
.ri-sev { flex: none; height: 18px; padding: 1px 5px; border-radius: var(--r-xs); font-size: var(--fs-12); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.ri-high .ri-sev { color: var(--err-ink); background: var(--err-soft); }
.ri-mid .ri-sev { color: var(--warn-ink); background: var(--warn-soft); }
.ri-low .ri-sev { color: var(--muted); background: var(--surface-3); }
.ri-body { min-width: 0; }
.ri-problem { font-size: 12.5px; line-height: 1.5; color: var(--text); }
.ri-fix { margin-top: 3px; font-size: var(--fs-12); line-height: 1.5; color: var(--muted); }
.ri-selector { margin-top: 3px; font-family: var(--mono); font-size: var(--fs-12); color: var(--primary); word-break: break-all; }

/* ============================================================ 页面：设计广场 */
.g-author { display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-size: var(--fs-12); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.g-tag { padding: 1px 6px; border-radius: var(--r-xs); font-size: var(--fs-12); color: var(--ok-ink); background: var(--ok-soft); white-space: nowrap; }
.g-tag-pro { color: var(--warn-ink); background: var(--warn-soft); }
.g-target { margin-left: auto; font-size: var(--fs-12); color: var(--faint); white-space: nowrap; }
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 64px; margin-bottom: 16px; padding: 12px 16px;
  border: 1px dashed var(--line-2); border-radius: var(--r);
  background: var(--surface-2); color: var(--faint); font-size: var(--fs-12);
}

/* ============================================================ 页面：用量 */
.usage-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ucard { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.ucard-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--muted); }
.ucard-label > svg { width: 13px; height: 13px; color: var(--primary); }
.ucard-val { margin-top: 8px; font-family: var(--mono); font-weight: 600; font-size: var(--fs-30); line-height: 1.1; letter-spacing: -.02em; color: var(--accent); }
.ucard-val i { margin-left: 4px; font-family: var(--font-body); font-style: normal; font-weight: 400; font-size: var(--fs-12); color: var(--faint); }

.table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow);
}
.data-table { width: 100%; min-width: 520px; border-collapse: separate; border-spacing: 0; }
.data-table th {
  padding: 9px 14px; text-align: left; white-space: nowrap;
  font-size: var(--fs-12); font-weight: 600; letter-spacing: .04em; color: var(--faint);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.data-table td {
  height: var(--row-h); padding: 0 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--text); white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table td.num, .data-table th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: var(--fs-12); color: var(--muted); }
.data-table a { color: var(--primary); cursor: pointer; }
.data-table a:hover { text-decoration: underline; }
.data-table .empty-row td { height: 78px; text-align: center; color: var(--faint); font-size: var(--fs-12); }

/* ============================================================ 设置 / 发布浮层 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(15, 23, 42, .42); backdrop-filter: blur(2px);
  animation: fadeIn .16s var(--ease);
}
html[data-app-theme="dark"] .modal-overlay { background: rgba(3, 7, 18, .64); }

.modal {
  width: 812px; height: 600px; max-width: 100%; max-height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow-lg);
  animation: modalIn .18s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(6px) scale(.99); } }
.modal:focus { outline: none; }
.modal:focus-visible { outline: none; }

.modal-head {
  display: flex; align-items: center; gap: 9px; flex: none;
  height: 52px; padding: 0 16px;
  border-bottom: 1px solid var(--line);
  font: 600 13.5px/1.4 var(--font-head);
}
.mh-ic { width: 15px; height: 15px; color: var(--primary); }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { flex: 1; display: flex; min-height: 0; }

.snav-col {
  width: 180px; flex: none; display: flex; flex-direction: column; gap: 2px;
  padding: 10px; border-right: 1px solid var(--line); background: var(--surface-2);
}
.snav {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border: 0; border-radius: var(--r-sm); background: none;
  color: var(--muted); font-size: 12.5px; text-align: left; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.snav > svg { width: 14px; height: 14px; flex: none; opacity: .9; }
.snav:hover { background: var(--surface-3); color: var(--text); }
.snav.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.spane-wrap { flex: 1; min-width: 0; position: relative; }
.spane { display: none; position: absolute; inset: 0; overflow-y: auto; padding: 20px 22px; }
.spane.on { display: block; }

.pref-group { margin-bottom: 18px; }
.pref-label { margin-bottom: 7px; font: 600 12.5px/1.4 var(--font-head); color: var(--text); }
.pref-desc { margin-top: 7px; font-size: var(--fs-12); line-height: 1.65; color: var(--muted); }
.pref-desc code { padding: 0 4px; border-radius: var(--r-xs); background: var(--surface-3); font-family: var(--mono); font-size: var(--fs-12); color: var(--text); }

.theme-notice {
  margin-bottom: 14px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); font-size: var(--fs-12); line-height: 1.6; color: var(--muted);
}
.theme-notice.warn { color: var(--warn-ink); background: var(--warn-soft); border-color: rgba(209, 138, 0, .25); }
.theme-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.theme-card {
  position: relative; padding: 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.theme-card:hover { border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.theme-card.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.theme-card.disabled { opacity: .5; pointer-events: none; }
.tc-name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--text); }
.tc-desc { margin: 4px 0 9px; min-height: 32px; font-size: var(--fs-12); line-height: 1.5; color: var(--muted); }
.tc-swatches { display: flex; gap: 4px; }
.tc-sw { flex: 1; height: 22px; border-radius: var(--r-xs); border: 1px solid rgba(15, 23, 42, .08); }
.tc-check { position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; display: none; align-items: center; justify-content: center; border-radius: 50%; background: var(--primary); color: #fff; }
.tc-check svg { width: 10px; height: 10px; }
.theme-card.on .tc-check { display: inline-flex; }

.apptheme-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 360px; }
.apptheme-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  color: var(--muted); font-size: var(--fs-12); font-weight: 600;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.apptheme-card:hover { border-color: var(--line-2); }
.apptheme-card.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); color: var(--text); }
.at-preview { display: flex; width: 100%; height: 48px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-xs); }
.at-preview .at-rail { width: 26%; flex: none; border-right: 1px solid rgba(15, 23, 42, .10); }
.at-preview .at-main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 0 8px; }
.at-preview .at-line { height: 3px; border-radius: 2px; background: rgba(15, 23, 42, .18); width: 78%; }
.at-preview .at-line.short { width: 52%; }
.at-preview .at-accent { width: 34%; height: 7px; border-radius: 2px; background: #2457F5; margin-top: 2px; }
.at-light { background: #FFFFFF; }
.at-light .at-rail { background: #F1F4FA; }
.at-dark { background: #111A2B; border-color: #22304A; }
.at-dark .at-rail { background: #0B1220; border-right-color: #22304A; }
.at-dark .at-line { background: rgba(255, 255, 255, .22); }
.at-dark .at-accent { background: #3B67F0; }
.at-name { font-size: var(--fs-12); }

.keys-table { width: 100%; border-collapse: collapse; }
.keys-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); vertical-align: middle; }
.keys-table td:first-child { width: 200px; color: var(--text); }
kbd {
  display: inline-block; padding: 1px 6px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: var(--r-xs);
  background: var(--surface-2); color: var(--text);
  font-family: var(--mono); font-size: var(--fs-12); font-weight: 600; line-height: 1.5;
}

.bk-hint { margin-bottom: 14px; font-size: var(--fs-12); line-height: 1.6; color: var(--muted); }
.bk-color-row { display: flex; align-items: center; gap: 10px; }
.bk-picker { width: 44px; height: 34px; padding: 2px; cursor: pointer; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.bk-picker::-webkit-color-swatch-wrapper { padding: 0; }
.bk-picker::-webkit-color-swatch { border: 0; border-radius: calc(var(--r-sm) - 2px); }
.bk-hex { flex: 1; max-width: 130px; font-family: var(--mono); font-size: var(--fs-12); text-transform: uppercase; }
.bk-preview { margin: 18px 0; }
.bk-preview-card { min-height: 168px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r); transition: background .2s var(--ease), color .2s var(--ease); }
.bk-preview-nav { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.bk-logo-text { margin-right: auto; font-weight: 700; font-size: var(--fs-13); }
.bk-nav-link { font-size: var(--fs-12); }
.bk-nav-btn { padding: 4px 12px; border-radius: var(--r-sm); font-size: var(--fs-12); font-weight: 600; }
.bk-preview-hero { padding: 34px 18px 28px; text-align: center; }
.bk-preview-title { font: 600 var(--fs-22)/1.35 var(--font-head); }
.bk-preview-sub { margin-top: 6px; font-size: 12.5px; }

.apikey-row { display: flex; align-items: center; gap: 8px; }
.apikey-row .pf-input { flex: 1; min-width: 0; font-family: var(--mono); font-size: var(--fs-12); }
.apikey-row .tool-btn { height: 34px; width: 34px; padding: 0; }
.mcp-config {
  padding: 12px 14px; overflow-x: auto;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--muted);
  font: 400 var(--fs-12)/1.85 var(--mono);
}
.mcp-line { white-space: pre; }
.mcp-line:first-child { margin-bottom: 5px; color: var(--faint); font-style: italic; }
.mcp-config span { color: var(--primary); }
.pf-points { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--fs-12); color: var(--muted); }
.pf-points b { color: var(--text); }

/* 发布设置 */
.vis-modal { width: 460px; height: auto; }
.vis-body { padding: 4px 22px 20px; }
.vis-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.vis-item:last-of-type { border-bottom: 0; }
.vis-title { font: 600 var(--fs-13)/1.4 var(--font-head); color: var(--text); }
.vis-desc { margin-top: 3px; font-size: var(--fs-12); color: var(--muted); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { position: absolute; width: 0; height: 0; opacity: 0; }
.switch i { position: absolute; inset: 0; cursor: pointer; border: 1px solid var(--line-2); border-radius: var(--r-pill); background: var(--surface-4); transition: background .18s var(--ease), border-color .18s var(--ease); }
.switch i::before { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .25); transition: transform .18s var(--ease); }
.switch input:checked + i { background: var(--primary); border-color: var(--primary); }
.switch input:checked + i::before { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: var(--ring); }

/* 内容管理 pane：举报列表 */
.adm-reports { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.adm-report {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2);
}
.adm-report .ar-head { display: flex; align-items: center; gap: 8px; font-size: var(--fs-12); color: var(--muted); }
.adm-report .ar-head b { color: var(--text); font-weight: 600; }
.adm-report .ar-reason { font-size: var(--fs-12); color: var(--text); line-height: 1.5; word-break: break-word; }
.adm-report .ar-actions { display: flex; gap: 8px; margin-top: 4px; }
.adm-empty { font-size: var(--fs-12); color: var(--faint); text-align: center; padding: 16px 0; }

/* 广场加载更多 */
.gallery-more-wrap { display: flex; justify-content: center; padding: 10px 0 4px; }
#gallery-more { min-width: 180px; }

/* 广场作品详情：左实时预览 + 右信息栏（作者 / 关键词 / 详情 / 用量） */
.gd-modal { width: min(1040px, calc(100vw - 48px)); height: min(680px, calc(100vh - 64px)); }
.gd-body { flex: 1; display: flex; min-height: 0; }
.gd-preview { flex: 1 1 62%; min-width: 0; position: relative; border-right: 1px solid var(--line); background: var(--surface-3); }
.gd-preview iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.gd-frame-note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: var(--fs-12); color: var(--faint); pointer-events: none;
}
.gd-preview iframe:not([src]) ~ .gd-frame-note { display: block; }
.gd-preview iframe[src] ~ .gd-frame-note { display: none; }
.gd-side {
  flex: 1 1 38%; min-width: 300px; max-width: 400px;
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 18px; overflow-y: auto;
}
.gd-author { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.gd-avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  font: 600 14px/1 var(--font-head); text-transform: uppercase;
}
.gd-author-name { font: 600 var(--fs-13)/1.3 var(--font-head); color: var(--text); }
.gd-author-sub { font-size: var(--fs-12); color: var(--faint); }
.gd-author-meta { flex: 1; min-width: 0; }
.gd-author-meta .gd-author-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-tags { display: flex; gap: 5px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.gd-tags .g-tag { white-space: nowrap; }
.gd-sec { display: flex; flex-direction: column; gap: 7px; }
.gd-sec-title { font: 600 var(--fs-12)/1 var(--font-head); color: var(--faint); letter-spacing: .02em; }
.gd-brief {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2);
  font-size: var(--fs-13)/1.7; line-height: 1.7; color: var(--text);
  word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.gd-kv { display: grid; grid-template-columns: 52px 1fr; gap: 6px 10px; align-items: baseline; }
.gd-k { font-size: var(--fs-12); color: var(--faint); }
.gd-v { font-size: var(--fs-12); color: var(--text); font-variant-numeric: tabular-nums; min-width: 0; word-break: break-all; }
.gd-usage {
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2);
}
.gd-usage-note { font-size: var(--fs-12); color: var(--faint); }
.gd-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.gd-actions .btn-block { width: 100%; }
@media (max-width: 860px) {
  .gd-body { flex-direction: column; }
  .gd-preview { flex: none; height: 46%; border-right: 0; border-bottom: 1px solid var(--line); }
  .gd-side { flex: 1; max-width: none; min-width: 0; }
}

/* ============================================================ Toast */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 9px; max-width: 380px;
  padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow-lg);
  font-size: 12.5px; color: var(--text);
  animation: toastIn .2s var(--ease);
}
.toast > svg { width: 15px; height: 15px; flex: none; }
.toast-ok > svg { color: var(--ok); }
.toast-err > svg { color: var(--err); }
.toast-info > svg { color: var(--primary); }
.toast.out { animation: toastOut .22s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ============================================================ 分享页（服务端渲染） */
.share-wrap { height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.share-header { display: flex; align-items: center; gap: 12px; flex: none; padding: 9px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.share-mark {
  width: 30px; height: 30px; flex: none; border-radius: var(--r);
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.share-mark > svg { width: 17px; height: 17px; }
.share-meta-col { min-width: 0; }
.share-title { font: 600 13.5px/1.35 var(--font-head); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-meta { font-size: var(--fs-12); color: var(--faint); }
.share-frame { flex: 1; min-height: 0; display: flex; justify-content: center; overflow: auto; }
.share-frame iframe { width: 100%; max-width: 1200px; height: 100%; border: 0; background: #fff; }
.share-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.share-dl { display: inline-flex; }

/* ============================================================ 自适应 */
@media (max-width: 1360px) {
  :root { --rail-w: 200px; --panel-w: 344px; }
  .brand-sub { display: none; }
}
@media (max-width: 1180px) {
  :root { --rail-w: 64px; }
  #rail { padding: 10px 8px; }
  .rail-brand { justify-content: center; padding: 2px 0 12px; border-bottom: 0; margin-bottom: 4px; }
  .brand-text, .rail-sec, .rail-usage, .rail-item > span, #btn-signin-rail > span { display: none; }
  .rail-item { justify-content: center; padding: 9px 0; }
  .rail-item.on::before { left: -8px; }
  #btn-signin-rail { padding: 0; }
  .user-box { justify-content: center; padding: 7px 0; }
  .user-box #user-name, .user-level { display: none; }
  .auth-guest { padding: 8px 0; align-items: center; border-style: solid; }
  .ag-row { display: none; }
  .ag-btn { width: 34px; height: 34px; padding: 0; }
  .ag-btn > span { display: none; }
  .usage-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .editor-body { flex-direction: column; }
  #right { width: 100%; max-height: 44vh; border-left: 0; border-top: 1px solid var(--line); }
  #center { min-height: 320px; }
}
@media (max-width: 900px) {
  .page { padding: 18px 16px 32px; }
  .editor-head { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .eh-title { flex: 1 1 100%; min-width: 0; }
  .eh-row1 { flex-wrap: nowrap; min-width: 0; overflow: hidden; }
  #ed-title { flex: 1 1 0; min-width: 0; max-width: none; }
  #ed-status { flex: none; }
  .eh-row2 { flex-wrap: nowrap; }
  #ed-slug { flex: 1 1 auto; min-width: 0; }
  .eh-actions { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .modal { width: 100%; height: min(600px, calc(100vh - 32px)); }
  .snav-col { width: 148px; }
}
@media (max-width: 720px) {
  .compose-row { flex-wrap: wrap; }
  .cmd-input { flex: 1 1 100%; }
  .compose-row .btn-primary { flex: 1 1 auto; }
  .compose-controls { margin-left: 0; }
  #preview-url { display: none; }
  #btn-pick > span { display: none; }
  #btn-pick { padding: 0 8px; }
  .spane { padding: 16px; }
  .snav-col { width: 56px; padding: 8px 6px; }
  .snav > span, .snav { font-size: 0; }
  .snav > svg { width: 16px; height: 16px; }
  .snav { justify-content: center; padding: 10px 0; }
  .usage-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theme-cards { grid-template-columns: 1fr; }
  .page-actions .btn-primary > span { display: none; }
}
@media (max-width: 520px) {
  .usage-cards { grid-template-columns: 1fr; }
  .design-grid { grid-template-columns: 1fr; }
  .modal-overlay { padding: 12px; }
  .modal-head { height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
