/* =====================================================================
 *  生图工作台 · 浅色设计系统 v3
 *  类名与旧版一致，纯样式重构
 * ===================================================================== */

:root {
  color-scheme: light;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f2f3f6;

  --line: #e8eaef;
  --line-strong: #d8dbe3;

  --text: #14161c;
  --text-2: #565d6c;
  --text-3: #8b93a3;

  --accent: #5b5bd6;
  --accent-2: #7c6cff;
  --accent-soft: #eeeefe;
  --accent-line: #c9c9f7;

  --ok: #0f9d76;
  --ok-soft: #e7f7f2;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warn-soft: #fff6e6;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 6px 18px rgba(16, 24, 40, .07);
  --shadow-lg: 0 18px 44px rgba(16, 24, 40, .12);

  --top-h: 62px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

.hidden { display: none !important; }
.muted { color: var(--text-3); }
.req { color: var(--danger); }

/* ===================== 顶栏 ===================== */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--top-h);
  padding: 0 24px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 19px;
  border-radius: 11px;
  background: linear-gradient(140deg, #efeefe, #e4f4ff);
  border: 1px solid #e3e5f5;
}
.brand-title { font-size: 15px; font-weight: 650; letter-spacing: -.1px; }
.brand-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

.top-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.balance {
  font-variant-numeric: tabular-nums;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  white-space: nowrap;
  flex: 0 0 auto;
  box-shadow: var(--shadow-sm);
}

.who {
  font-size: 12.5px;
  color: var(--accent);
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 视图切换 */
.view-switch {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin: 0 auto;
}
.view-switch button {
  padding: 7px 15px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: all .16s;
}
.view-switch button:hover { color: var(--text); }
.view-switch button.on {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ===================== 主布局 ===================== */
.layout {
  display: grid;
  grid-template-columns: 356px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 24px 64px;
  max-width: 1720px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .panel { position: static; max-height: none; }
}

/* ===================== 左栏参数面板 ===================== */
.panel {
  position: sticky;
  top: calc(var(--top-h) + 20px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--top-h) - 44px);
  overflow-y: auto;
}
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: #d9dce3; border-radius: 6px; }

.field { margin-bottom: 16px; }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2);
  margin-bottom: 8px;
}
.row-between { display: flex; align-items: center; justify-content: space-between; }

/* 表单控件 */
textarea, input[type="text"], input[type="number"],
input[type="password"], select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea::placeholder, input::placeholder { color: #a9b0be; }
textarea { resize: vertical; line-height: 1.6; min-height: 100px; }
textarea:focus, input:focus, select:focus {
  background: var(--surface);
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, .1);
}
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='M3 4.5L6 7.5L9 4.5' stroke='%238b93a3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
select option, select optgroup { background: #fff; color: var(--text); }

.hint { font-size: 11.5px; color: var(--text-3); margin-top: 7px; line-height: 1.55; }

/* 分段选择器 */
.seg { display: flex; gap: 5px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 auto;
  min-width: 46px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-2);
  transition: all .14s;
  white-space: nowrap;
}
.seg button:hover { background: var(--surface-3); color: var(--text); }
.seg button.on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
}

/* 按钮 */
.btn {
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn.primary {
  background: linear-gradient(135deg, #5b5bd6, #7b6bf0);
  border: none;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(91, 91, 214, .28);
}
.btn.primary:hover { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(91, 91, 214, .34); }
.btn.primary:disabled { opacity: .6; cursor: progress; box-shadow: none; }
.btn.big {
  width: 100%;
  padding: 13px;
  font-size: 14.5px;
  margin-top: 6px;
  position: sticky;
  bottom: -18px;
  z-index: 6;
}
.btn.ghost {
  padding: 7px 13px;
  font-size: 12.5px;
  background: var(--surface);
  color: var(--text-2);
}
.btn.ghost:hover { color: var(--text); }

.mini {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
}
.mini:hover { color: var(--accent); }

/* 提示词模板 chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chips button {
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: all .14s;
}
.chips button:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* 参考图上传 */
.drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  background: var(--surface-2);
}
.drop:hover, .drop.over {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.drop-icon { font-size: 19px; color: var(--text-3); margin-bottom: 5px; }
.drop-inner { font-size: 12.5px; line-height: 1.7; color: var(--text-2); }
.drop-inner .muted { font-size: 11.5px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-3);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: rgba(20, 22, 28, .62);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 10px;
  line-height: 19px;
  text-align: center;
  padding: 0;
}
.thumb .idx {
  position: absolute;
  left: 4px;
  bottom: 3px;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(20, 22, 28, .55);
  color: #fff;
}

.mask-btn {
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  font-size: 12.5px;
  transition: all .15s;
}
.mask-btn:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* 高级选项 */
.adv {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--surface-2);
}
.adv summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-2);
  list-style: none;
  user-select: none;
}
.adv summary::-webkit-details-marker { display: none; }
.adv summary::after { content: " ▾"; color: var(--text-3); }
.adv[open] summary { margin-bottom: 14px; color: var(--accent); }
.adv input[type="file"] { font-size: 12px; color: var(--text-2); }

/* 警告条 */
.warn {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border: 1px solid #f5e0b8;
  color: #8a5b00;
  font-size: 12.5px;
  line-height: 1.55;
}

/* ===================== 右侧作品区 ===================== */
.results { min-width: 0; }

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 2px 2px 16px;
}
.results-head h2 { font-size: 16px; font-weight: 650; margin: 0; letter-spacing: -.1px; }
.results-head .muted { font-size: 12.5px; }

.list {
  display: block;
  columns: 3;
  column-gap: 16px;
}
@media (max-width: 1560px) { .list { columns: 2; } }
@media (max-width: 860px) { .list { columns: 1; } }

.card {
  break-inside: avoid;
  margin: 0 0 16px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.badge {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--text-2);
}
.badge.ok { border-color: #bfe8da; color: var(--ok); background: var(--ok-soft); }
.badge.err { border-color: #f6c9ca; color: var(--danger); background: var(--danger-soft); }
.badge.run { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.card-time { margin-left: auto; font-size: 11px; color: var(--text-3); }

.card-prompt {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.65;
  margin: 0 4px 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-prompt.open { -webkit-line-clamp: unset; cursor: text; }

.progress { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 8px 0 6px; }
.progress > i {
  display: block;
  height: 100%;
  width: 30%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: indet 1.15s ease-in-out infinite;
}
@keyframes indet {
  0% { margin-left: -30%; }
  100% { margin-left: 100%; }
}

.grid { display: block; margin: 0; }
.shot {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-3);
  aspect-ratio: auto;
}
.shot img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  cursor: zoom-in;
  border-radius: var(--radius);
}
.shot .acts {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding: 10px;
  background: linear-gradient(transparent, rgba(16, 24, 40, .5));
  opacity: 0;
  transition: opacity .18s;
}
.shot:hover .acts { opacity: 1; }
.shot .acts a, .shot .acts button {
  font-size: 11.5px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .92);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.shot .acts a:hover, .shot .acts button:hover { background: #fff; }

.card-foot { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.card-foot .btn {
  padding: 7px 12px;
  font-size: 12px;
  box-shadow: none;
}

.err-msg {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #f6c9ca;
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  line-height: 1.55;
  word-break: break-word;
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 88px 24px;
  color: var(--text-2);
  line-height: 1.9;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty-emoji { font-size: 44px; margin-bottom: 12px; opacity: .95; }
.empty-title {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -.2px;
  margin: 0 0 10px;
  color: var(--text);
}

/* 大图查看 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(16, 24, 40, .82);
  display: grid;
  place-items: center;
  padding: 28px;
  cursor: zoom-out;
  backdrop-filter: blur(4px);
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}

/* ===================== 登录 / 注册 ===================== */
.auth {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(900px 460px at 18% 0%, rgba(124, 108, 255, .13), transparent 62%),
    radial-gradient(760px 420px at 88% 100%, rgba(18, 190, 178, .1), transparent 62%),
    var(--bg);
}
.auth-box {
  width: min(388px, 92vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-title { font-size: 17px; font-weight: 650; }
.auth-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.auth-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: 999px;
  margin-bottom: 20px;
}
.auth-tabs button {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}
.auth-tabs button.on {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.auth-box input {
  width: 100%;
  padding: 11px 13px;
  margin-bottom: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
}
.auth-box input:focus {
  background: var(--surface);
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, .1);
}
.auth-box .btn { width: 100%; margin-top: 6px; padding: 12px; }
.auth-box .btn:disabled { opacity: .6; cursor: progress; }
.auth-err { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 18px; line-height: 1.5; }
.auth-note {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.65;
}

/* ===================== toast ===================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 16px);
  background: #1d2027;
  color: #fff;
  padding: 11px 19px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all .22s;
  z-index: 300;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===================== 涂抹改图弹层 ===================== */
.mask-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(20, 24, 34, .45);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: auto;
}
.mask-box {
  width: min(1360px, 98vw);
  max-height: 94vh;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mask-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.mask-head .mini {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  background: var(--surface-2);
}
.mask-head .mini:hover { background: var(--surface-3); }
.mask-box .canvas-layout { margin: 0; padding: 16px; overflow: auto; }

/* ===================== 画布（已锁，样式保留） ===================== */
.canvas-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  padding: 16px;
  max-width: 1640px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 1100px) { .canvas-layout { grid-template-columns: 1fr; } }

.canvas-stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.canvas-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.tool-group { display: flex; align-items: center; gap: 6px; }
.tool {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  font-size: 12.5px;
  transition: all .14s;
  white-space: nowrap;
}
.tool:hover { background: var(--surface-3); color: var(--text); }
.tool.on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
}
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }
.mini-label { font-size: 12px; color: var(--text-3); }
.brush-val { font-size: 12px; color: var(--text-2); min-width: 26px; text-align: right; }
input[type=range] { width: 110px; accent-color: var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }

.canvas-wrap {
  position: relative;
  min-height: 420px;
  height: calc(100vh - 250px);
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, rgba(0,0,0,.022) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.022) 75%) 0 0/24px 24px,
    linear-gradient(45deg, rgba(0,0,0,.022) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.022) 75%) 12px 12px/24px 24px,
    var(--surface-3);
  border: 1px solid var(--line);
  overflow: auto;
  padding: 16px;
}
.canvas-wrap.over { border-color: var(--accent-line); box-shadow: inset 0 0 0 2px var(--accent-soft); }

.canvas-empty { text-align: center; color: var(--text-2); line-height: 1.9; padding: 20px; }
.canvas-empty b { color: var(--text); font-weight: 650; }

.canvas-stack { position: relative; display: inline-block; max-width: 100%; max-height: 100%; }
.canvas-stack canvas {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 300px);
  width: auto;
  height: auto;
  border-radius: 10px;
}
.canvas-stack #cvView { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.canvas-stack.actual { max-width: none; max-height: none; }
.canvas-stack.actual canvas { max-width: none; max-height: none; }

.canvas-side {
  position: sticky;
  top: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}
.canvas-side .seg { flex-wrap: wrap; }
.canvas-side .seg button { flex: 1 1 44px; min-width: 44px; }

.cv-note {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-2);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.cv-results { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.cv-results .results-head { margin: 0 0 10px; }
.cv-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cv-item {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--surface-3);
  transition: border-color .15s;
}
.cv-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cv-item:hover { border-color: var(--accent-line); }
.cv-hint { grid-column: 1 / -1; font-size: 12px; color: var(--text-3); line-height: 1.75; padding: 6px 0; }

/* 选图弹窗 */
.picker {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(20, 24, 34, .45);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.picker-box {
  width: min(780px, 94vw);
  max-height: 82vh;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.picker-head .mini { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; background: var(--surface-2); }
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
}
.picker-item {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--surface-3);
}
.picker-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker-item:hover { border-color: var(--accent-line); }

/* ===================== 创作画布（已锁） ===================== */
.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  padding: 16px 20px 20px;
  height: calc(100vh - var(--top-h) - 12px);
}
@media (max-width: 1100px) { .board-layout { grid-template-columns: 1fr; height: auto; } }

.board {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle, #d9dce3 1px, transparent 1px) 0 0 / 22px 22px,
    var(--surface);
  overflow: hidden;
  cursor: grab;
  min-height: 460px;
}
.board.panning { cursor: grabbing; }
.board-canvas { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }

.node {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  user-select: none;
  z-index: 2;
  overflow: visible;
}
.node.sel {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-md);
}
.node-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 13px 13px 0 0;
  cursor: grab;
  font-size: 11.5px;
  color: var(--text-2);
}
.node-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.node-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-acts { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.node:hover .node-acts, .node.sel .node-acts { opacity: 1; }
.node-acts button {
  width: 21px;
  height: 21px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}
.node-acts button:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.node-body { overflow: hidden; background: var(--surface-3); }
.node-body img { display: block; width: 100%; height: auto; pointer-events: none; }
.node-prompt {
  padding: 7px 10px;
  font-size: 11px;
  color: var(--text-3);
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0 0 13px 13px;
}

.port {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent-line);
  z-index: 4;
}
.port.in { left: -7px; top: 50%; margin-top: -6px; }
.port.out { right: -7px; top: 50%; margin-top: -6px; background: var(--accent); border-color: var(--accent); cursor: crosshair; }
.port.out:hover { box-shadow: 0 0 0 5px var(--accent-soft); }
.board.connecting .node { cursor: crosshair; }

.board-links { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.board-links path { fill: none; stroke: var(--accent-line); stroke-width: 2; stroke-dasharray: 7 6; }
.board-links path.temp { stroke: var(--ok); stroke-dasharray: 5 5; }
.board-links circle { fill: var(--accent); }

.board-hud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  font-size: 12px;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.board-tools {
  position: absolute;
  right: 12px;
  top: 12px;
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}
.board-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-2);
  line-height: 1.9;
  pointer-events: none;
}
.board-empty b { color: var(--text); font-size: 15px; font-weight: 650; }

.board-side {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.board-side .seg { flex-wrap: wrap; }
.board-side .seg button { flex: 1 1 44px; min-width: 44px; }
.board-sel { margin-bottom: 12px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); }
.board-sel img { width: 100%; display: block; }

.marquee {
  position: absolute;
  border: 1px solid var(--accent);
  background: rgba(91, 91, 214, .1);
  border-radius: 4px;
  pointer-events: none;
  z-index: 6;
}

/* ===== 对齐微调 ===== */
.results-head {
  margin: 8px 2px 16px;
  padding-top: 2px;
}
.panel > .field:last-of-type { margin-bottom: 6px; }
.panel { scroll-padding-bottom: 80px; }

/* 左栏分组之间加发丝线，读起来更清楚 */
.field + .field,
.field + .adv,
.adv + .field { position: relative; }
.field + .field::before,
.field + .adv::before,
.adv + .field::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -9px;
  height: 1px;
  background: var(--line);
}

/* 卡片内的图片不要圆角过大，和卡片贴合 */
.card .shot, .card .shot img { border-radius: 12px; }

/* ===== 修正：分组线生效 + 生成按钮不压内容 ===== */
.panel .field { position: relative; }
.panel .adv { position: relative; }

.btn.big {
  position: sticky;
  bottom: 0;
  margin-top: 16px;
  box-shadow:
    0 -14px 20px rgba(255, 255, 255, .96),
    0 6px 16px rgba(91, 91, 214, .26);
}
.panel > .btn.big { margin-left: 0; margin-right: 0; }

/* 左栏内容留白 */
.panel { padding: 18px 18px 14px; }
.panel .field { margin-bottom: 18px; }
.panel .field > label { margin-bottom: 9px; }

/* ==================================================================
 *  工作台结构 v4 —— 顶部大输入 + 全宽瀑布流
 * ================================================================== */
.studio {
  max-width: 1460px;
  margin: 0 auto;
  padding: 32px 28px 90px;
}
@media (max-width: 720px) { .studio { padding: 20px 14px 60px; } }

/* ---- hero ---- */
.hero { max-width: 940px; margin: 0 auto 44px; }

.hero-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.7px;
  text-align: center;
  margin: 6px 0 22px;
  color: var(--text);
}
@media (max-width: 720px) { .hero-title { font-size: 22px; margin-bottom: 16px; } }

.composer {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 14px 14px 10px;
  box-shadow: var(--shadow-md);
  transition: border-color .16s, box-shadow .16s;
}
.composer:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 4px rgba(91, 91, 214, .07), var(--shadow-md);
}
.composer.over {
  border-color: var(--accent);
  background: #fbfbff;
}

.composer textarea {
  width: 100%;
  border: none;
  background: transparent;
  padding: 6px 8px 12px;
  font-size: 15px;
  line-height: 1.65;
  resize: none;
  min-height: 62px;
  outline: none;
  box-shadow: none;
}
.composer textarea:focus { box-shadow: none; border: none; background: transparent; }

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 10px 4px 2px;
}
.composer-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.pill-btn {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  font-size: 12.5px;
  transition: all .14s;
  white-space: nowrap;
}
.pill-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.pill-btn.quiet { background: transparent; border-color: transparent; color: var(--text-3); }
.pill-btn.quiet:hover { background: var(--surface-3); color: var(--text-2); }
.count-chip { font-size: 12px; color: var(--text-3); padding: 0 4px; }

.btn.go {
  padding: 11px 30px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: .5px;
}

.composer .thumbs { padding: 10px 4px 0; margin-top: 0; }
.composer .chips { padding: 8px 4px 2px; margin-top: 0; }

/* ---- 参数条 ---- */
.params {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.param-col { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.param-label { font-size: 11.5px; color: var(--text-3); font-weight: 550; letter-spacing: .2px; }

.model-col { flex: 0 0 auto; }
.model-col select { min-width: 250px; }

.params .seg { gap: 5px; }
.params .seg button { padding: 7px 11px; font-size: 12px; min-width: 42px; }

.more { position: relative; }
.more > summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  user-select: none;
  white-space: nowrap;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary:hover { border-color: var(--line-strong); color: var(--text); }
.more[open] > summary {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.more-body {
  position: absolute;
  z-index: 25;
  top: calc(100% + 8px);
  left: 0;
  width: 360px;
  padding: 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}
.param-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.model-hint { text-align: center; margin-top: 14px; font-size: 12px; }

/* ---- 画廊（全宽） ---- */
.gallery-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.gallery-head h2 { font-size: 18px; font-weight: 680; margin: 0; letter-spacing: -.2px; }
.gallery-meta { font-size: 12.5px; color: var(--text-3); }

.list { columns: 4; column-gap: 16px; }
@media (max-width: 1400px) { .list { columns: 3; } }
@media (max-width: 1000px) { .list { columns: 2; } }
@media (max-width: 640px) { .list { columns: 1; } }

/* 旧 .panel / .layout 不再使用，留空以防误用 */
.panel, .layout { }

/* ===== 参数条一行对齐 ===== */
.params {
  flex-wrap: nowrap;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.params::-webkit-scrollbar { height: 5px; }
.params::-webkit-scrollbar-thumb { background: #dcdfe6; border-radius: 5px; }

.params .seg { flex-wrap: nowrap; }
#ratios { max-width: none; }
.model-col select { min-width: 210px; }
.more { margin-left: auto; }
.more-body { left: auto; right: 0; }

@media (max-width: 900px) {
  .params { flex-wrap: wrap; }
  .more { margin-left: 0; }
  .more-body { left: 0; right: auto; }
}

/* 比例区允许折行，避免超出被裁 */
#ratios {
  flex-wrap: wrap;
  max-width: 400px;
  row-gap: 5px;
}
.params .seg button { padding: 6px 10px; font-size: 11.5px; min-width: 40px; }
.param-col { flex: 0 0 auto; }

/* 去掉参数条多余的横向滚动条（宽屏能放下） */
.params { overflow-x: visible; }
@media (max-width: 900px) {
  .params { overflow-x: auto; flex-wrap: wrap; }
}
.params::-webkit-scrollbar { height: 0; }

/* ===================== @ 提及参考图 ===================== */
.mention-menu {
  position: fixed;
  z-index: 280;
  min-width: 220px;
  max-height: 268px;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.mention-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text);
}
.mention-item:hover, .mention-item.on {
  background: var(--accent-soft);
  color: var(--accent);
}
.mention-thumb {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.mention-label { font-weight: 600; }
.mention-sub { margin-left: auto; font-size: 11px; color: var(--text-3); }
.mention-empty {
  padding: 12px 10px;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.6;
}

/* ===== 邮箱验证码 ===== */
.code-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.code-row input {
  flex: 1;
  margin-bottom: 0;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}
.code-btn {
  flex: 0 0 auto;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  cursor: pointer;
  transition: all .14s;
}
.code-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.code-btn:disabled { opacity: .6; cursor: not-allowed; }

/* 验证码行：输入框占满剩余宽度，按钮固定 */
.code-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
.code-row input {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin-bottom: 0 !important;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}
.code-row .code-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 108px;
  padding: 0 14px;
  margin: 0;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
}

/* ===================== 余额板块 ===================== */
.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 16px 22px;
  margin: 0 0 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.acc-main {
  display: flex;
  gap: 38px;
  flex-wrap: wrap;
  align-items: center;
}
.acc-item { display: flex; flex-direction: column; gap: 3px; }
.acc-label { font-size: 11.5px; color: var(--text-3); letter-spacing: .2px; }
.acc-value {
  font-size: 17px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.acc-value.accent { color: var(--accent); }
.acc-actions { display: flex; gap: 8px; align-items: center; }
.btn.acc-topup {
  padding: 9px 22px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(91, 91, 214, .22);
}
@media (max-width: 720px) {
  .acc-main { gap: 22px; }
  .acc-value { font-size: 15px; }
}

/* ===================== 合规相关 ===================== */
.agree-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 14px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
}
.agree-row input[type="checkbox"] {
  margin: 2px 0 0;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
}
.agree-row a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.agree-row b { color: var(--text); font-weight: 650; }

/* 作品上的 AI 生成标识 */
.badge.ai {
  border-color: #cfe3ff;
  color: #2f6fd0;
  background: #eef5ff;
}

/* 页脚 */
.site-foot {
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-3);
}
.site-foot a { color: var(--text-2); }
.site-foot a:hover { color: var(--accent); }
.site-foot .dot { color: var(--line-strong); }
.site-foot .foot-line { width: 100%; text-align: center; margin-top: 8px; font-size: 12px; }

/* ===================== 充值弹层 ===================== */
.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 230;
  background: rgba(20, 24, 34, .45);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.pay-box {
  width: min(560px, 94vw);
  max-height: 88vh;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pay-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.pay-head .mini {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  background: var(--surface-2);
}
.pay-body { padding: 20px 22px 24px; overflow-y: auto; }

.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 520px) { .plans { grid-template-columns: 1fr; } }

.plan {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.plan:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.plan-cny { font-size: 21px; font-weight: 700; color: var(--text); }
.plan-usd { font-size: 13px; color: var(--accent); font-weight: 600; }
.plan-desc { font-size: 11.5px; color: var(--text-3); }

.pay-tip {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--text-2);
}
.pay-tip b { color: var(--text); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .5px; }

.pay-orders { margin-top: 22px; }
.pay-orders-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.order-list { display: flex; flex-direction: column; gap: 6px; }
.order-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-2);
}
.ob {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--text-3);
}
.ob.ok { color: var(--ok); background: var(--ok-soft); border-color: #bfe8da; }
.ob.run { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }

/* ===================== 收款码 ===================== */
.qr-wrap { display: flex; gap: 18px; align-items: flex-start; }
@media (max-width: 520px) { .qr-wrap { flex-direction: column; align-items: center; } }
.qr-img {
  width: 168px;
  height: 168px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  flex: 0 0 auto;
}
.qr-side { flex: 1; min-width: 0; font-size: 13px; line-height: 1.7; }
.qr-side b { color: var(--text); font-size: 15px; }
.qr-done { margin-top: 12px; width: 100%; border-radius: 10px; padding: 10px; }
.ob.wait { color: #8a5b00; background: var(--warn-soft); border-color: #f5e0b8; }

/* 收款码显示更大，便于手机扫屏幕 */
.qr-img {
  width: 208px;
  height: 208px;
  padding: 8px;
  background: #fff;
  cursor: zoom-in;
}
@media (max-width: 520px) {
  .qr-img { width: 178px; height: 178px; }
}

/* ===================== 加载状态 ===================== */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn.loading { cursor: progress; }

.elapsed-line {
  font-size: 11.5px;
  color: var(--text-3);
  margin: 6px 4px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.elapsed-line b { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ===================== 充值页（独立页面） ===================== */
.rc-page { background: var(--bg); min-height: 100vh; }

.rc-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 26px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.rc-back {
  font-size: 13px;
  color: var(--text-2);
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: all .15s;
}
.rc-back:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.rc-brand { display: flex; align-items: center; gap: 9px; }
.rc-brand .logo {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center; font-size: 17px;
  background: linear-gradient(140deg, #eef0ff, #fff);
  border: 1px solid var(--line);
}
.rc-brand-name { font-size: 14px; font-weight: 680; }
.rc-brand-sub { font-size: 10.5px; color: var(--text-3); }

.rc-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rc-user-bal {
  font-size: 12.5px; color: var(--text-2);
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
}
.rc-user-bal b { color: var(--accent); font-size: 14px; font-variant-numeric: tabular-nums; }
.rc-user-name {
  font-size: 12.5px; color: var(--text-3);
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
}

.rc-main { max-width: 1180px; margin: 0 auto; padding: 34px 26px 90px; }

.rc-head { margin-bottom: 26px; }
.rc-head h1 { font-size: 27px; font-weight: 760; letter-spacing: -.6px; margin: 0 0 6px; }
.rc-head p { font-size: 13.5px; color: var(--text-3); margin: 0; }

.rc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}
@media (max-width: 900px) {
  .rc-grid { grid-template-columns: 1fr; }
}

.rc-panel, .rc-side-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
}
.rc-side-block { margin-bottom: 18px; }
.rc-side-block:last-child { margin-bottom: 0; }
.rc-side-block h2 { font-size: 14.5px; margin: 0 0 14px; }

/* 三个数字 */
.rc-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f7f8ff, #fafbff);
  border: 1px solid var(--line);
  margin-bottom: 24px;
}
.rc-sum-item { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.rc-sum-item span { font-size: 11.5px; color: var(--text-3); }
.rc-sum-item b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rc-sum-item b.accent { color: var(--accent); }
.rc-sum-arrow { color: var(--line-strong); font-size: 15px; }

.rc-h2 {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
  margin: 0 0 12px;
  letter-spacing: .2px;
}

/* 套餐 */
.rc-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 26px; }
@media (max-width: 620px) { .rc-plans { grid-template-columns: 1fr; } }

.rc-plan {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px; border-radius: 16px; text-align: center;
  border: 1px solid var(--line); background: var(--surface-2);
  cursor: pointer; transition: all .15s;
}
.rc-plan:hover { border-color: var(--accent-line); background: var(--accent-soft); transform: translateY(-2px); }
.rc-plan.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(91,91,214,.1); }
.rc-plan-cny { font-size: 22px; font-weight: 720; color: var(--text); }
.rc-plan-usd { font-size: 13px; color: var(--accent); font-weight: 600; }
.rc-plan-desc { font-size: 11.5px; color: var(--text-3); }

/* 支付区 */
.rc-pay {
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  padding: 22px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
}
.rc-pay:has(.rc-qr) { border-style: solid; background: var(--surface); display: block; }

.rc-empty { font-size: 13px; color: var(--text-3); }
.rc-empty.small { font-size: 12.5px; padding: 14px 0; text-align: center; }
.rc-loading { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.spinner.dark { border-color: rgba(91,91,214,.25); border-top-color: var(--accent); }
.rc-error { font-size: 13px; color: var(--danger); text-align: center; line-height: 1.7; }

.rc-qr { display: flex; gap: 20px; align-items: flex-start; }
@media (max-width: 560px) { .rc-qr { flex-direction: column; align-items: center; } }
.rc-qr-img {
  width: 190px; height: 190px; object-fit: contain;
  border-radius: 14px; border: 1px solid var(--line);
  background: #fff; padding: 6px; cursor: zoom-in; flex: 0 0 auto;
}
.rc-qr-side { flex: 1; min-width: 0; font-size: 13px; }
.rc-qr-amount { font-size: 15px; margin-bottom: 8px; }
.rc-qr-amount b { color: var(--text); font-size: 18px; }
.rc-qr-order { color: var(--text-2); margin-bottom: 8px; }
.rc-qr-order .mono { color: var(--text); letter-spacing: .4px; }
.rc-qr-tip { color: var(--text-2); line-height: 1.7; margin-bottom: 14px; }
.rc-qr-tip b { color: var(--text); }
.rc-done { width: 100%; border-radius: 11px; padding: 11px; }
.rc-qr-note { font-size: 11.5px; color: var(--text-3); margin-top: 9px; line-height: 1.6; }

.rc-done-box { text-align: center; padding: 10px 0; line-height: 1.9; font-size: 13px; color: var(--text-2); }
.rc-done-title { font-size: 16px; font-weight: 680; color: var(--ok); margin-bottom: 8px; }

/* 记录 */
.rc-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rc-side-head h2 { margin: 0; }
.rc-mini {
  font-size: 11.5px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-2); cursor: pointer;
}
.rc-mini:hover { color: var(--accent); border-color: var(--accent-line); }

.rc-orders { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; }
.rc-order {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; background: var(--surface-2);
}
.rc-order-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; }
.rc-order-top .mono { color: var(--text-2); }
.rc-order-bottom {
  display: flex; align-items: center; gap: 10px;
  margin-top: 7px; font-size: 12px; color: var(--text-2);
}
.rc-order-bottom .muted { margin-left: auto; }

/* 说明 */
.rc-help { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.95; color: var(--text-2); }
.rc-help li { margin-bottom: 5px; }
.rc-help b { color: var(--text); }
.rc-links { margin: 14px 0 0; font-size: 12px; color: var(--text-3); display: flex; gap: 8px; }
.rc-links a { color: var(--text-2); }
.rc-links a:hover { color: var(--accent); }

.rc-skeleton { height: 84px; border-radius: 16px; background: var(--surface-2); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* 右上角余额：可点击进充值 */
#quota {
  cursor: pointer;
  transition: all .15s;
}
#quota::after {
  content: "›";
  margin-left: 5px;
  opacity: .55;
  font-size: 14px;
}
#quota:hover {
  color: var(--accent) !important;
  border-color: var(--accent-line) !important;
  background: var(--accent-soft) !important;
}

/* 自定义金额 */
.rc-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  margin-bottom: 26px;
}
.rc-custom-label { font-size: 12.5px; color: var(--text-2); flex: 0 0 auto; }
.rc-custom-field {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.rc-custom-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,91,214,.1);
}
.rc-custom-yen { font-size: 13px; color: var(--text-3); }
.rc-custom-field input {
  width: 92px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.rc-custom-field input::-webkit-outer-spin-button,
.rc-custom-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rc-custom-hint { font-size: 12px; color: var(--text-3); flex: 1 1 auto; min-width: 100px; }
.rc-custom-hint.on { color: var(--accent); font-weight: 600; }
.rc-custom-go {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.rc-custom-go:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
