:root {
  --bg: #0d1016;
  --bg-elevated: #151923;
  --bg-soft: #1b2130;
  --bg-muted: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f0ea;
  --text-soft: #b5bccd;
  --text-dim: #8c94a8;
  --brand: #ff7a3d;
  --brand-soft: rgba(255, 122, 61, 0.14);
  --mint: #8ef0cb;
  --gold: #f6cf68;
  --danger: #ff6e6e;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 61, 0.12), transparent 34%),
    radial-gradient(circle at top right, rgba(142, 240, 203, 0.08), transparent 30%),
    linear-gradient(180deg, #0a0d12, #0d1016 36%, #090b11);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

body {
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1440px, calc(100vw - 24px));
  min-height: calc(100vh - 24px);
  margin: 12px auto;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr;
  backdrop-filter: blur(22px);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 10px);
  gap: 4px;
}

.brand-mark span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 20px currentColor;
}

.brand-mark span:nth-child(1),
.brand-mark span:nth-child(9) { color: #ff7a3d; background: currentColor; }
.brand-mark span:nth-child(2) { color: #ffd56c; background: currentColor; }
.brand-mark span:nth-child(3) { color: #c3ff73; background: currentColor; }
.brand-mark span:nth-child(4) { color: #67d6ff; background: currentColor; }
.brand-mark span:nth-child(5) { color: #ff84c7; background: currentColor; }
.brand-mark span:nth-child(6) { color: #d07cff; background: currentColor; }
.brand-mark span:nth-child(7) { color: #ff6464; background: currentColor; }
.brand-mark span:nth-child(8) { color: #5cf1b9; background: currentColor; }

.brand-copy {
  flex: 1;
  min-width: 0;
}

.brand-copy h1 {
  margin: 3px 0 0;
  font-family: "Baskerville", "Times New Roman", serif;
  font-size: clamp(28px, 3.4vw, 40px);
  letter-spacing: 0.02em;
}

.brand-kicker,
.brand-badge {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--text-dim);
}

.brand-badge {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 122, 61, 0.3);
  background: rgba(255, 122, 61, 0.08);
  color: #ffc49d;
}

.brand-badge-pp {
  border-color: rgba(142, 240, 203, 0.35);
  background: rgba(142, 240, 203, 0.08);
  color: var(--mint);
  letter-spacing: 0.12em;
}

.mode-nav {
  display: flex;
  gap: 10px;
  padding: 14px 24px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-tab {
  flex: 1;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-muted);
  color: var(--text-soft);
  font-weight: 700;
}

.mode-tab.active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 122, 61, 0.16), rgba(255, 122, 61, 0.06));
  border-color: rgba(255, 122, 61, 0.28);
}

.app-main {
  overflow: hidden;
}

.view-panel {
  display: none;
  height: 100%;
  overflow: hidden;
}

.view-panel.active {
  display: block;
}

.scroll-shell {
  height: 100%;
  overflow: auto;
  padding: 18px 24px 24px;
  scrollbar-gutter: stable;
}

.home-shell {
  display: grid;
  gap: 14px;
  align-content: start;
}

.home-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.72fr);
  gap: 14px;
  align-items: stretch;
}

.home-dashboard:not(:has(.home-side-stack > .card:not(.hidden))) {
  grid-template-columns: 1fr;
}

.home-dashboard > .card,
.home-side-stack > .card,
.home-shell > .card {
  margin-top: 0;
}

.home-side-stack {
  display: grid;
  gap: 14px;
  align-content: start;
}

.home-side-stack:not(:has(.card:not(.hidden))) {
  display: none;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 18px;
  margin-top: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 36px rgba(0, 0, 0, 0.18);
}

.card:first-child {
  margin-top: 0;
}

.hero-card-home,
.hero-card-records {
  background:
    radial-gradient(circle at top right, rgba(255, 122, 61, 0.13), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
}

.hero-card-home {
  position: relative;
  min-height: 326px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 24px;
}

.hero-card-home::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -86px;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    repeating-radial-gradient(circle, rgba(255, 255, 255, 0.09) 0 2px, transparent 2px 16px),
    radial-gradient(circle, rgba(255, 122, 61, 0.18), transparent 62%);
  opacity: 0.7;
  pointer-events: none;
}

.flow-card {
  padding-top: 14px;
  padding-bottom: 14px;
}

.card-pill,
.section-kicker {
  margin: 0 0 6px;
  color: #ffbf9e;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
}

.hero-card-home h2 {
  margin: 0;
  font-family: "Baskerville", "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.02;
  max-width: 12ch;
  position: relative;
  z-index: 1;
}

.hero-card-home .card-pill,
.hero-card-home .hero-copy,
.hero-card-home .hero-actions {
  position: relative;
  z-index: 1;
}

.hero-copy,
.records-copy,
.muted-copy,
.section-meta,
.flow-item p,
.empty-card p,
.image-meta p,
.footer-note,
.save-hint,
.mini-hint {
  color: var(--text-soft);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  align-items: center;
}

.records-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.records-actions .primary-btn,
.records-actions .secondary-btn {
  flex: 1 1 180px;
}

.release-list {
  display: grid;
  gap: 12px;
}

.release-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.release-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.release-head span,
.release-label {
  color: var(--text-dim);
  font-size: 12px;
}

.release-group {
  display: grid;
  gap: 6px;
}

.release-group ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  line-height: 1.55;
  font-size: 13px;
}

.home-side-stack .release-card,
.home-side-stack #homeRecentCard {
  padding: 16px;
}

.home-side-stack .section-head {
  align-items: flex-start;
}

.home-side-stack .release-list {
  gap: 10px;
}

.home-side-stack .release-item,
.home-side-stack .release-group {
  gap: 8px;
}

.home-side-stack .records-actions {
  margin-top: 14px;
  gap: 10px;
}

.home-side-stack .records-actions .primary-btn,
.home-side-stack .records-actions .secondary-btn {
  min-height: 42px;
  flex-basis: 130px;
}

.primary-btn,
.secondary-btn,
.link-btn,
.small-btn,
.chip,
.tool-chip,
.compare-badge {
  border: 0;
  border-radius: 14px;
}

.primary-btn {
  min-height: 48px;
  padding: 0 22px;
  background: linear-gradient(135deg, #ff7a3d, #ffaf6e);
  color: #140d08;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(255, 122, 61, 0.22);
}

.primary-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.primary-btn-wide,
.secondary-btn-wide {
  width: 100%;
}

.secondary-btn {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-weight: 700;
}

.link-btn {
  width: 100%;
  min-height: 44px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 700;
  margin-top: 14px;
}

.section-head,
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-head h3,
.section-head h3,
.empty-card h3 {
  margin: 0;
  font-size: 20px;
}

.flow-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.record-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-card .section-head {
  margin-bottom: 12px;
}

.flow-item,
.record-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.flow-item {
  min-height: 100%;
  align-items: flex-start;
  padding: 12px 14px;
}

.flow-item > div {
  display: grid;
  gap: 4px;
  align-content: start;
}

.flow-item strong {
  font-size: 15px;
  line-height: 1.2;
}

.flow-item p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.flow-num {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: #ffc49d;
  font-weight: 800;
  font-size: 12px;
  margin-top: 1px;
}

.record-item {
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  border: 1px solid transparent;
}

.home-side-stack .record-item {
  grid-template-columns: 50px 1fr;
  align-items: start;
}

.home-side-stack .record-thumb {
  width: 50px;
  height: 50px;
  border-radius: 12px;
}

.home-side-stack .record-open {
  grid-column: 1 / -1;
  width: 100%;
}

.record-item.active {
  border-color: rgba(255, 122, 61, 0.28);
  background: rgba(255, 122, 61, 0.08);
}

.record-thumb {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.record-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-title {
  font-weight: 700;
  font-size: 14px;
}

.record-status {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.record-status.is-draft { background: rgba(140, 148, 168, 0.16); color: #d4d8e5; }
.record-status.is-ready { background: rgba(142, 240, 203, 0.16); color: #9ff6d5; }
.record-status.is-making { background: rgba(255, 122, 61, 0.16); color: #ffc49d; }
.record-status.is-done { background: rgba(246, 207, 104, 0.18); color: #ffe49c; }

.record-meta,
.record-progress {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-soft);
}

.record-progress {
  color: var(--text-dim);
}

.record-open {
  min-height: 40px;
  min-width: 76px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 700;
}

.empty-card {
  text-align: center;
  display: grid;
  place-items: center;
  min-height: 240px;
}

.empty-mark {
  font-size: 40px;
  margin-bottom: 8px;
}

.empty-state {
  width: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-soft);
}

.preview-empty-state {
  align-content: center;
  gap: 12px;
}

.preview-empty-state .empty-mark {
  margin: 0;
  line-height: 1;
}

.preview-empty-state p {
  margin: 0;
}

.studio-layout {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.stepbar {
  display: flex;
  gap: 14px;
  padding: 18px 24px 12px;
  margin: 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)),
    rgba(255, 255, 255, 0.01);
  border-radius: 0 0 24px 24px;
}

.step {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--text-dim);
  padding: 10px 6px 12px;
  border-radius: 18px;
  transition: background 180ms ease, color 180ms ease;
}

.step-num {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  font-weight: 800;
}

.step.active .step-num,
.step.done .step-num {
  border-color: rgba(255, 122, 61, 0.26);
  background: rgba(255, 122, 61, 0.14);
  color: var(--text);
}

.step.active,
.step.done {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
}

.step.done .step-num {
  border-color: rgba(142, 240, 203, 0.28);
  background: rgba(142, 240, 203, 0.14);
}

.step-label {
  font-size: 12px;
  font-weight: 700;
}

.studio-main {
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.studio-step {
  display: none;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.studio-step.active {
  display: block;
}

.preview-stage,
.confirm-preview-frame,
.make-board {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #0f131b;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-stage {
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 14px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.05), transparent 42%),
    linear-gradient(180deg, #171d29, #111722);
  user-select: none;
  -webkit-user-select: none;
}

.preview-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.28));
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.loading-state,
.stage-loading,
.make-loading {
  display: grid;
  place-items: center;
  gap: 12px;
}

.loading-state,
.make-loading {
  position: absolute;
  inset: 0;
  background: rgba(12, 15, 21, 0.82);
  z-index: 3;
  pointer-events: none;
}

.stage-loading {
  height: 100%;
}

.dots {
  display: flex;
  gap: 8px;
}

.dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  animation: bounce 0.82s ease-in-out infinite;
}

.dots span:nth-child(1) { background: #ff7a3d; }
.dots span:nth-child(2) { background: #ffd56c; animation-delay: 0.12s; }
.dots span:nth-child(3) { background: #8ef0cb; animation-delay: 0.24s; }

@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(0.8); opacity: 0.5; }
  50% { transform: translateY(-8px) scale(1); opacity: 1; }
}

.image-meta {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 12px;
}

.image-meta img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 12px;
}

.card-head.split {
  align-items: center;
}

.field {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.field-stack {
  display: grid;
  gap: 10px;
}

/* 高级折叠（默认收起，给 Step1 减负） */
.advanced-fold {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.advanced-fold > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  list-style: none;
  user-select: none;
  padding: 2px 0;
}
.advanced-fold > summary::-webkit-details-marker { display: none; }
.advanced-fold > summary::before {
  content: '▸ ';
  color: var(--text-dim);
}
.advanced-fold[open] > summary::before { content: '▾ '; }
.advanced-fold[open] > summary { margin-bottom: 12px; color: var(--text-soft); }
.advanced-fold .field-stack + .field-stack { margin-top: 14px; }

.field-stack + .field-stack {
  margin-top: 14px;
}

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.field-head small {
  color: var(--text-dim);
  font-size: 12px;
}

.algorithm-note {
  margin-top: 4px;
  padding: 14px 15px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.algorithm-note strong {
  display: block;
  font-size: 14px;
}

.algorithm-note p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.field span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--brand);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.mode-grid-double {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tune-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.art-style-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.art-style-grid .chip:first-child {
  grid-column: 1 / -1;
}

.tune-grid .chip:last-child {
  grid-column: 1 / -1;
}

.chip,
.tool-chip {
  min-height: 42px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-weight: 700;
}

.chip.active,
.tool-chip.active {
  border-color: rgba(255, 170, 122, 0.78);
  background: linear-gradient(135deg, rgba(255, 122, 61, 0.28), rgba(255, 175, 110, 0.16));
  color: #fff5ef;
  box-shadow: 0 0 0 1px rgba(255, 122, 61, 0.18), 0 10px 22px rgba(255, 122, 61, 0.16);
}

.chip-warn {
  color: #ffc49d;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-row:last-child {
  border-bottom: 0;
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.status-pill.loading { background: rgba(246, 207, 104, 0.14); color: #ffd56c; }
.status-pill.warn { background: rgba(255, 122, 61, 0.14); color: #ffbd9c; }
.status-pill.ok { background: rgba(142, 240, 203, 0.14); color: #baf5dd; }
.status-pill.muted { background: rgba(255, 255, 255, 0.06); color: var(--text-soft); }

.confirm-layout {
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
  overflow: hidden;
}

.confirm-preview-shell {
  flex: 0 0 clamp(180px, 36vh, 320px);
  min-height: 0;
}

.s2-stats-bar {
  flex: 0 0 auto;
}

.s2-panel {
  flex: 1 1 0;
  min-height: 220px;
}

.confirm-preview-frame {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 12px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.04), transparent 40%),
    linear-gradient(180deg, #121722, #0d1219);
}

.confirm-preview-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.selection-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.selection-overlay.pp-select-active {
  pointer-events: all;
  cursor: crosshair;
}

.selection-rect {
  position: absolute;
  display: none;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  border: 2px dashed #63b3ff;
  outline: 1px solid rgba(255, 255, 255, 0.25);
  outline-offset: -1px;
}

.selection-rect.visible {
  display: block;
}

.confirm-preview-frame img {
  -webkit-user-drag: none;
  user-select: none;
}

.compare-badge {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 2;
  right: auto;
  bottom: auto;
  max-width: calc(100% - 28px);
  padding: 9px 11px;
  background: rgba(12, 15, 21, 0.88);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.s2-stats-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toolbar-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.small-btn {
  min-width: 42px;
  min-height: 40px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 700;
}

.inline-info {
  margin-left: auto;
  color: var(--text-soft);
  font-size: 13px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.stat-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
  gap: 6px;
}

.stat-grid-compact .stat {
  padding: 8px 8px 7px;
}

.stat-grid-compact .n {
  font-size: 17px;
}

.stat-grid-compact .l {
  font-size: 11px;
  white-space: nowrap;
}

.stat-grid .stat {
  padding: 10px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
  min-width: 0;
  overflow: hidden;
}

.stat-grid .n {
  display: block;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.stat-grid .l {
  display: block;
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-grid .m {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.2;
  color: rgba(214, 221, 235, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-grid-compact .m {
  font-size: 9px;
  white-space: nowrap;
}

.legend-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 10px;
  margin-top: 10px;
}



.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 9px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.legend-swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.legend-text {
  display: grid;
  gap: 2px;
}

.legend-code {
  font-weight: 800;
  font-size: 11px;
}

.legend-count {
  font-size: 10px;
  color: var(--text-soft);
}

.make-top-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 12px;
  flex-wrap: wrap;
}

.tool-chip {
  min-height: 40px;
}

.tool-pin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tool-pin-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  line-height: 1;
}

.tool-pin-label {
  white-space: nowrap;
}

.tool-zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.tool-zoom-group .small-btn {
  min-width: 40px;
  min-height: 36px;
}

.save-hint {
  margin-left: auto;
  font-size: 12px;
}

.make-shell {
  height: calc(100% - 52px);
  padding: 0 24px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}

.make-board {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-rows: 32px minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  isolation: isolate;
  contain: layout paint;
}

.axis-corner,
.axis-top,
.axis-left {
  background: rgba(10, 13, 19, 0.9);
}

.axis-corner {
  grid-column: 1;
  grid-row: 1;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.axis-top {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.axis-left {
  grid-column: 1;
  grid-row: 2;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.axis-track {
  position: relative;
}

.axis-label {
  position: absolute;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.axis-label.active {
  color: var(--mint);
}

.axis-guide {
  position: absolute;
  background: rgba(255, 255, 255, 0.2);
}

.axis-guide.col {
  width: 1px;
  top: 0;
  bottom: 0;
}

.axis-guide.row {
  height: 1px;
  left: 0;
  right: 0;
}

.make-board.strong-guides .axis-corner,
.make-board.strong-guides .axis-top,
.make-board.strong-guides .axis-left {
  border-color: transparent;
}

.make-board.strong-guides .axis-guide {
  background: rgba(255, 255, 255, 0.32);
}

.make-scroll {
  grid-column: 2;
  grid-row: 2;
  overflow: auto;
  background: #0f131b;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  overscroll-behavior: contain;
  cursor: grab;
  touch-action: none;
}

.make-scroll.dragging {
  cursor: grabbing;
  user-select: none;
}

.make-scroll.locked {
  cursor: default;
}

.make-stage {
  position: relative;
  width: max-content;
  height: max-content;
  max-width: none;
  max-height: none;
}

#makeCanvas {
  display: block;
}

.make-sidebar {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 14px;
}

.mark-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact {
  margin-top: 10px;
}

.number-shell {
  margin-top: 12px;
}

.number-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 168px;
  overflow: auto;
}

.number-btn {
  min-width: 40px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  font-weight: 700;
}

.number-btn.done {
  background: rgba(142, 240, 203, 0.18);
  border-color: rgba(142, 240, 203, 0.4);
  color: #baf5dd;
}

.number-btn.done.col {
  background: rgba(120, 180, 255, 0.16);
  border-color: rgba(120, 180, 255, 0.36);
  color: #acd1ff;
}

.mark-bar {
  margin-top: 12px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.mark-tags,
.mark-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mark-tags {
  margin-bottom: 8px;
}

.mark-tag {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.mark-tag.row { background: rgba(142, 240, 203, 0.14); color: #baf5dd; }
.mark-tag.col { background: rgba(120, 180, 255, 0.14); color: #c0dfff; }
.mark-tag.bead { background: rgba(246, 207, 104, 0.16); color: #ffe49c; cursor: default; }

.mark-progress span {
  font-size: 12px;
  color: var(--text-soft);
}

.muted-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.006));
}

.stack-actions {
  display: grid;
  gap: 10px;
}

.stack-actions-inline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-legend {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  margin-top: 14px;
}

.studio-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.02));
}

.footer-actions {
  display: flex;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(12, 15, 21, 0.92);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  z-index: 30;
}

/* ─── step-2 tab panel ─────────────────────────────────────── */
.s2-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.s2-tab-nav {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}

.s2-tab-btn {
  flex: 1;
  padding: 11px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.s2-tab-btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.s2-tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--brand);
}

.s2-tab-btn:disabled {
  color: var(--text-dim);
  cursor: not-allowed;
}

.s2-tab-content {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.s2-pane {
  height: 100%;
  overflow-y: auto;
  padding: 14px;
  box-sizing: border-box;
}

.s2-pane.hidden {
  display: none;
}

/* PP pane: fixed controls on top, scrollable color list below */
#panePostprocess {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.s2-pane #postprocessCard {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.pp-fixed-controls {
  flex: 0 0 auto;
  padding: 8px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid var(--line);
}

.pp-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pp-hist-btns {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.pp-tool-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--bg-muted);
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s;
}

.pp-tool-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.pp-tool-btn:disabled {
  color: var(--text-dim);
  cursor: not-allowed;
}

.pp-toggle-select-btn.active {
  background: rgba(99, 179, 255, 0.14);
  border-color: rgba(99, 179, 255, 0.45);
  color: #63b3ff;
  font-weight: 600;
}

.pp-controls-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.pp-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
}

.pp-slider {
  height: 18px;
}

.pp-slider-label {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  min-width: 108px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.pp-slider-label strong {
  display: inline-block;
  min-width: 18px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pp-slider {
  flex: 1;
  min-width: 0;
}

.pp-row-spacer {
  flex: 1;
}

.pp-run-chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--bg-muted);
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 48px;
  text-align: center;
  transition: background 0.14s, color 0.14s;
}

.pp-run-chip:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

/* 孤点行已重构为标准 slider-row，无需特殊样式 */

/* pp-color-stats: remove max-height — pane handles scrolling now */

@media (min-width: 981px) {
  #step1Panel .scroll-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 360px);
    gap: 14px;
    align-content: start;
  }

  #step1Panel .scroll-shell > .card {
    margin-top: 0;
  }

  #step1Panel .scroll-shell > .card:first-child {
    grid-row: 1 / span 3;
  }

  .confirm-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(380px, 38%, 520px);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 16px;
    padding: 0 24px 24px;
    overflow: visible;
  }

  .confirm-preview-shell {
    grid-column: 1;
    grid-row: 1 / span 2;
    flex: unset;
  }

  .s2-stats-bar {
    grid-column: 2;
    grid-row: 1;
    flex: unset;
  }

  .s2-panel {
    grid-column: 2;
    grid-row: 2;
    flex: unset;
    min-height: 0;
  }
}

@media (max-width: 1100px) {
  .home-dashboard {
    grid-template-columns: 1fr;
  }

  .home-side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .home-side-stack:not(:has(.card:not(.hidden))) {
    display: none;
  }

  .home-side-stack:has(#releaseNoticeCard:not(.hidden)):has(#homeRecentCard.hidden),
  .home-side-stack:has(#releaseNoticeCard.hidden):has(#homeRecentCard:not(.hidden)) {
    grid-template-columns: 1fr;
  }

  .make-shell {
    grid-template-columns: 1fr;
  }

  .make-sidebar {
    max-height: 38vh;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .app-header,
  .mode-nav,
  .stepbar,
  .make-top-tools,
  .studio-footer,
  .scroll-shell,
  .make-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-card-home h2 {
    max-width: none;
  }

  .home-side-stack {
    grid-template-columns: 1fr;
  }

  .hero-card-home {
    min-height: 280px;
  }

  .stepbar {
    margin: 0 16px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .art-style-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-item {
    grid-template-columns: 1fr;
  }

  .record-thumb {
    width: 100%;
    height: 170px;
  }

  .flow-list {
    grid-template-columns: 1fr;
  }

  .record-open,
  .secondary-btn,
  .primary-btn,
  .link-btn {
    width: 100%;
  }

  .records-actions .primary-btn,
  .records-actions .secondary-btn {
    flex-basis: 100%;
  }

  .make-top-tools {
    flex-wrap: wrap;
  }

  .save-hint {
    margin-left: 0;
  }

  .tool-zoom-group {
    order: 3;
  }

  .stack-actions-inline {
    grid-template-columns: 1fr;
  }
}

/* ─── 后处理面板 ─────────────────────────────────────── */

.pp-action-grid {
  margin-top: 4px;
}

.pp-color-stats {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 10px 14px 14px;
}

.pp-color-stats::-webkit-scrollbar {
  width: 4px;
}
.pp-color-stats::-webkit-scrollbar-track {
  background: transparent;
}
.pp-color-stats::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 2px;
}

.pp-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  transition: background 0.15s;
}

.pp-color-row:hover {
  background: rgba(255, 255, 255, 0.07);
}

.pp-color-row.pp-color-rare {
  background: rgba(255, 122, 61, 0.08);
  border: 1px solid rgba(255, 122, 61, 0.2);
}

.pp-color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.pp-color-code {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 32px;
  flex-shrink: 0;
}

.pp-color-count {
  font-size: 12px;
  color: var(--text-soft);
  flex: 1;
}

.pp-color-count em {
  font-style: normal;
  color: var(--text-dim);
  margin-left: 4px;
}

.pp-remove-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  flex-shrink: 0;
}

.pp-remove-btn:hover {
  background: rgba(255, 110, 110, 0.14);
  border-color: rgba(255, 110, 110, 0.4);
  color: var(--danger);
}

.pp-color-rare .pp-remove-btn {
  border-color: rgba(255, 122, 61, 0.4);
  color: var(--brand);
}

.pp-btn-group {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.pp-selection-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: rgba(99, 179, 255, 0.08);
  border: 1px solid rgba(99, 179, 255, 0.25);
  font-size: 12px;
  color: #63b3ff;
  margin-bottom: 6px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.pp-selection-bar .pp-sel-label {
  flex: 1;
}

.pp-toggle-select-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.pp-toggle-select-btn:hover,
.pp-toggle-select-btn.active {
  background: rgba(99, 179, 255, 0.14);
  border-color: rgba(99, 179, 255, 0.45);
  color: #63b3ff;
}

.pp-toggle-select-btn.active {
  font-weight: 600;
}

.pp-color-row {
  cursor: pointer;
}

.pp-color-row.pp-color-selected {
  background: rgba(99, 179, 255, 0.12);
  border: 1px solid rgba(99, 179, 255, 0.35);
  outline: none;
}

.pp-color-row.pp-color-replacing {
  background: rgba(255, 195, 0, 0.1);
  border: 1px solid rgba(255, 195, 0, 0.4);
}

.pp-replace-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  flex-shrink: 0;
}

.pp-replace-btn:hover {
  background: rgba(99, 179, 255, 0.14);
  border-color: rgba(99, 179, 255, 0.45);
  color: #63b3ff;
}

.pp-replace-btn.pp-replace-cancel {
  border-color: rgba(255, 195, 0, 0.45);
  color: #ffc300;
}

.pp-replace-btn.pp-replace-cancel:hover {
  background: rgba(255, 195, 0, 0.14);
}

.pp-target-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(99, 179, 255, 0.4);
  background: rgba(99, 179, 255, 0.08);
  color: #63b3ff;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s;
  flex-shrink: 0;
}

.pp-target-btn:hover {
  background: rgba(99, 179, 255, 0.22);
  border-color: rgba(99, 179, 255, 0.7);
}

/* ── 涂抹排除区域（测试）编辑器 ───────────────────── */
.mask-stage {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  margin-bottom: 10px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mask-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}

.mask-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
  pointer-events: none;
}

.mask-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.mask-fill-label {
  font-size: 12px;
  color: var(--text-soft);
  margin-left: 4px;
}

/* 涂抹排除：步骤指引 */
.exclude-steps {
  list-style: none;
  margin: 0 0 10px;
  padding: 10px 12px;
  background: rgba(255, 122, 61, 0.06);
  border: 1px solid rgba(255, 122, 61, 0.18);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-soft);
  display: grid;
  gap: 4px;
}
.exclude-steps li strong {
  color: var(--brand);
  margin-right: 6px;
}

/* 涂抹排除：操作行 */
.mask-ai-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 10px;
}

/* 画笔（加）/ 橡皮擦（减）—— 视觉区分，避免雷同 */
.pp-tool-btn.mask-tool-add {
  border-color: rgba(255, 122, 61, 0.45);
  color: #ffb38c;
}
.pp-tool-btn.mask-tool-add.active {
  background: rgba(255, 122, 61, 0.22);
  border-color: var(--brand);
  color: var(--brand);
}
.pp-tool-btn.mask-tool-sub {
  border-color: rgba(180, 180, 180, 0.35);
  color: var(--text-dim);
}
.pp-tool-btn.mask-tool-sub.active {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--text);
}
.mask-ai-btn {
  flex: 1;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #1a0e07;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.mask-ai-btn:hover:not(:disabled) {
  background: #ff8a52;
}
.mask-ai-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: rgba(255, 122, 61, 0.2);
  color: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 122, 61, 0.3);
}

/* 兼容：旧主按钮 class 仍保留，万一别处引用 */
.pp-tool-btn.pp-tool-primary {
  border-color: rgba(255, 122, 61, 0.5);
  background: rgba(255, 122, 61, 0.14);
  color: #ffb38c;
  font-weight: 600;
}
.pp-tool-btn.pp-tool-primary:hover:not(:disabled) {
  background: rgba(255, 122, 61, 0.24);
  border-color: var(--brand);
}
.pp-tool-btn.pp-tool-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 滑块下方说明文字 */
.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: -2px;
}

/* ── 主体抠图（前处理）UI ────────────────────────── */

/* 卡片标题中的 toggle-pill 开关 */
.toggle-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-pill input {
  width: 0;
  height: 0;
  opacity: 0;
  position: absolute;
}

.toggle-pill span {
  display: inline-block;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  position: relative;
  transition: background 0.18s, border-color 0.18s;
}

.toggle-pill span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle-pill input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
}

.toggle-pill input:checked + span::after {
  transform: translateX(18px);
}

/* 进度状态行 */
.bgr-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(246, 207, 104, 0.08);
  border: 1px solid rgba(246, 207, 104, 0.2);
  font-size: 12px;
  color: #ffd56c;
  margin-top: 8px;
}

.bgr-status.bgr-ok {
  background: rgba(142, 240, 203, 0.08);
  border-color: rgba(142, 240, 203, 0.2);
  color: #8ef0cb;
}

.bgr-status.bgr-err {
  background: rgba(255, 110, 110, 0.08);
  border-color: rgba(255, 110, 110, 0.2);
  color: #ff9494;
}

.bgr-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: bgrPulse 1.2s ease-in-out infinite;
}

.bgr-status.bgr-ok .bgr-dot,
.bgr-status.bgr-err .bgr-dot {
  animation: none;
}

@keyframes bgrPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* 背景颜色选择行 */
.bgr-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-soft);
}

.bgr-swatches {
  display: flex;
  gap: 6px;
}

.bgr-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, transform 0.1s;
}

.bgr-swatch:hover {
  transform: scale(1.15);
  border-color: rgba(255,255,255,0.5);
}

.bgr-swatch.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(255, 122, 61, 0.4);
}
