
:root {
  color-scheme: light;
  --bg: #fff;
  --panel: rgba(255,255,255,.82);
  --section: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0,0,0,.14);
  --line-soft: rgba(0,0,0,.08);
  --blue: #0071e3;
  --brand-red: #d70f22;
  --brand-red-dark: #bd0d1d;
  --green: #34c759;
  --shadow: 0 22px 58px rgba(0,0,0,.09);
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(245,245,247,.9) 0, rgba(255,255,255,0) 360px),
    var(--bg);
}
@media (min-width: 981px) {
  html, body { height: 100%; overflow: hidden; }
}

button, textarea, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }

main {
  width: 100%;
  margin: 0;
  padding: 20px clamp(20px, 4vw, 52px);
  flex: 1;
  min-height: 0;
}

.app-body {
  display: grid;
  grid-template-columns: 94px minmax(0, 1280px);
  gap: 24px;
  justify-content: start;
  align-items: start;
}
.feature-nav {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 88px;
  height: calc(100vh - 40px);
  min-height: 0;
  padding: 14px 8px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.5)),
    rgba(255,255,255,.34);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.72),
    inset 0 -1px 0 rgba(255,255,255,.28),
    0 22px 52px rgba(0,0,0,.11);
  backdrop-filter: blur(30px) saturate(180%);
}
.nav-logo {
  width: 44px;
  height: 44px;
  justify-self: center;
  margin: 0 0 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: 0 10px 28px rgba(209,13,31,.14);
}
.nav-logo img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: contain;
  object-position: center;
}
.nav-icon {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
}
.nav-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-icon svg path[fill] { stroke: none; }
.feature-nav .feature-item:hover {
  background: rgba(29,29,31,.1);
  color: var(--text);
}
.feature-nav .feature-item.active {
  border-color: rgba(255,255,255,.42);
  background: linear-gradient(180deg, rgba(29,29,31,.1), rgba(29,29,31,.055));
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    0 10px 24px rgba(0,0,0,.07);
}
.account-entry {
  align-self: end;
  width: 100%;
  min-height: 68px;
  margin-top: auto;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 18px;
  background: rgba(255,255,255,.48);
  color: rgba(29,29,31,.78);
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.56);
}
.account-entry:hover {
  background: rgba(29,29,31,.1);
  color: var(--text);
}
.account-avatar {
  width: 29px;
  height: 29px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, #e51a2d, var(--brand-red));
  box-shadow: 0 10px 22px rgba(215,15,34,.2);
  font-size: 12px;
  font-weight: 800;
}
.account-entry.admin .account-avatar {
  background: linear-gradient(180deg, #1d1d1f, #555);
}
.account-entry-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}
.account-entry-tier {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-red);
  background: rgba(215,15,34,.1);
  border-radius: 999px;
  padding: 1px 8px;
  line-height: 1.5;
}
.account-entry.admin .account-entry-tier {
  color: #1d1d1f;
  background: rgba(0,0,0,.08);
}
.account-entry-tier[hidden] { display: none; }
.account-avatar img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.feature-content { min-width: 0; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, .95fr);
  gap: 20px;
  align-items: stretch;
  height: calc(100vh - 40px);
  min-height: 0;
}
.feature-workspace { display: none; }
.feature-workspace.active { display: grid; }
.generator-workspace {
  grid-template-columns: minmax(360px, .82fr) minmax(460px, 1fr);
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(18px);
  min-height: 0;
}
.input-panel,
.result-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-title {
  min-height: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}
.panel-title h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0;
}
.panel-title span { color: var(--muted); font-size: 14px; white-space: nowrap; }
.title-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.title-copy small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}
.result-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.result-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(245,245,247,.76);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.result-tab {
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0 11px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.result-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
}

textarea {
  width: 100%;
  min-height: clamp(180px, 30vh, 255px);
  flex: 1 1 auto;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  padding: 18px;
  color: var(--text);
  outline: none;
  font-size: 16px;
  line-height: 1.6;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
textarea:focus {
  border-color: rgba(0,113,227,.68);
  box-shadow: 0 0 0 4px rgba(0,113,227,.13);
  background: #fff;
}

.extract-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 10px;
}
.extract-mode {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.68);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.48);
}
.extract-mode input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-red);
}
.extract-mode.active {
  border-color: rgba(215,15,34,.28);
  background: rgba(215,15,34,.08);
  color: var(--brand-red);
}

.platforms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 20px;
}
.platform {
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  background: rgba(245,245,247,.7);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 10px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-content: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.platform.active {
  background: rgba(245,251,255,.9);
  box-shadow: inset 0 0 0 1px rgba(0,113,227,.32), 0 0 0 3px rgba(0,113,227,.06);
}
.platform-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 5px;
  background: #a1a1a6;
  grid-row: 1 / 3;
}
.platform-dot.douyin { background: #111; }
.platform-dot.xhs { background: #ff2442; }
.platform-dot.bilibili { background: #00aeec; }
.platform strong { font-size: 13px; line-height: 1.2; }
.platform small { margin-top: 3px; color: var(--muted); font-size: 12px; }

.actions { display: grid; grid-template-columns: 1.3fr .9fr; gap: 12px; }
button, .secondary {
  border-radius: 12px;
  min-height: 48px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease;
}
button:active, .secondary:active { transform: scale(.985); }
.feature-nav .feature-item {
  width: 100%;
  min-height: 70px;
  align-self: start;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: rgba(29,29,31,.76);
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  box-shadow: none;
}
.primary {
  color: #fff;
  border-color: var(--brand-red);
  background: linear-gradient(180deg, #e51a2d 0, var(--brand-red) 100%);
  box-shadow: 0 10px 24px rgba(215,15,34,.18);
}
.primary:hover { background: var(--brand-red-dark); border-color: var(--brand-red-dark); }
.primary:disabled { opacity: .55; cursor: wait; }
.secondary {
  color: var(--text);
  background: rgba(255,255,255,.75);
}
.secondary:not(.disabled):hover { background: #fff; border-color: rgba(0,0,0,.2); }
.secondary.disabled { pointer-events: none; color: #a1a1a6; background: rgba(245,245,247,.75); }

.status { display: inline-flex; align-items: center; gap: 8px; }
.status i {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  background: #a1a1a6;
  box-shadow: 0 0 0 3px rgba(161,161,166,.16);
}
.status.ready i { background: var(--green); box-shadow: 0 0 0 3px rgba(52,199,89,.16); }
.status.loading i { background: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.16); }
.status.error i { background: #ff3b30; box-shadow: 0 0 0 3px rgba(255,59,48,.16); }

.result-view { display: none; }
.result-view.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.result-cover-view { flex: 1 1 auto; }

.preview {
  min-height: clamp(190px, 31vh, 300px);
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.9), rgba(245,245,247,.72)),
    var(--section);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.placeholder {
  color: #a1a1a6;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0;
}
#coverImg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}
#coverImg[hidden] { display: none; }
.preview-nav {
  position: absolute;
  top: 50%;
  width: 38px;
  height: 72px;
  min-height: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.54);
  color: var(--blue);
  box-shadow: 0 10px 28px rgba(0,0,0,.12), inset 0 0 0 1px rgba(0,0,0,.08);
  backdrop-filter: blur(16px);
  font-size: 46px;
  font-weight: 300;
  line-height: 1;
  padding: 0 0 6px;
  z-index: 2;
  touch-action: manipulation;
  user-select: none;
}
.preview-nav.prev { left: 4px; }
.preview-nav.next { right: 4px; }
.preview-nav:hover { background: #fff; }
.preview-nav:active { transform: translateY(-50%) scale(.98); }
.preview-nav:disabled {
  opacity: .28;
  cursor: default;
  transform: translateY(-50%);
}
.preview-nav[hidden] { display: none; }

.meta {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 0;
}
.meta div {
  min-height: 36px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0;
}
.meta dt { color: var(--muted); font-size: 15px; }
.meta dd {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}
.result-actions { grid-template-columns: 1fr 1fr; }
.push-actions {
  margin-top: 10px;
  grid-template-columns: 1fr 1fr;
}
.result-cover-view .result-actions .secondary {
  min-height: 42px;
  font-size: 14px;
}

.copy-view {
  flex: 1 1 auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(245,245,247,.72)),
    var(--section);
  padding: 18px;
  overflow: auto;
  position: relative;
}
.copy-nav {
  position: absolute;
  top: 50%;
  width: 36px;
  height: 62px;
  min-height: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.56);
  color: var(--blue);
  box-shadow: 0 10px 28px rgba(0,0,0,.12), inset 0 0 0 1px rgba(0,0,0,.08);
  backdrop-filter: blur(16px);
  font-size: 40px;
  font-weight: 300;
  line-height: 1;
  padding: 0 0 6px;
  z-index: 2;
  touch-action: manipulation;
  user-select: none;
}
.copy-nav.prev { left: 4px; }
.copy-nav.next { right: 4px; }
.copy-nav:hover { background: #fff; }
.copy-nav:active { transform: translateY(-50%) scale(.98); }
.copy-nav:disabled {
  opacity: .28;
  cursor: default;
  transform: translateY(-50%);
}
.copy-nav[hidden] { display: none; }
.content-view {
  flex: 0 0 auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(245,245,247,.72)),
    var(--section);
  padding: 14px;
  overflow: visible;
}
.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.content-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.content-zip {
  width: auto;
  min-height: 38px;
  padding: 0 18px;
  font-size: 13px;
}
.content-preview {
  height: clamp(220px, 34vh, 360px);
  min-height: 0;
  flex: none;
  margin-bottom: 10px;
}
#contentImg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}
#contentImg[hidden] { display: none; }
.content-pager {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 2;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.content-pager[hidden] { display: none; }
.content-actions {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 0;
}
.content-actions[hidden] { display: none; }
.content-actions .secondary { min-height: 42px; font-size: 14px; }
.copy-block {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.copy-row {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.copy-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.copy-mini {
  position: relative;
  z-index: 3;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(215,15,34,.2);
  background: rgba(215,15,34,.06);
  color: var(--brand-red);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 650;
  touch-action: manipulation;
}
.copy-mini:hover {
  border-color: rgba(215,15,34,.38);
  background: rgba(215,15,34,.1);
}
.copy-block p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.copy-body { flex: 1 1 auto; }
.generator-panel,
.generation-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.generator-scroll {
  flex: 1 1 auto;
  gap: 10px;
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.reference-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.reference-actions .secondary,
.reference-upload {
  min-height: 42px;
  justify-content: center;
}
.reference-grid {
  flex: 0 0 clamp(118px, 18vh, 176px);
  min-height: 118px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}
.reference-grid.dragging {
  border-radius: 18px;
  outline: 2px solid rgba(215,15,34,.36);
  outline-offset: 3px;
  background: rgba(215,15,34,.04);
}
.reference-grid.dragging .reference-empty {
  border-color: rgba(215,15,34,.42);
  background: rgba(255,245,247,.82);
  color: var(--brand-red);
}
.reference-empty {
  min-height: 100%;
  grid-column: 1 / -1;
  border: 1px dashed rgba(0,0,0,.14);
  border-radius: 16px;
  background: rgba(245,245,247,.7);
  color: var(--muted);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  font-size: 14px;
  line-height: 1.5;
}
.reference-card {
  position: relative;
  min-height: 154px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(245,245,247,.78);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
  display: grid;
  grid-template-rows: minmax(100px, 1fr) auto;
}
.reference-card img {
  width: 100%;
  height: 118px;
  object-fit: cover;
  display: block;
}
.reference-card footer {
  min-width: 0;
  padding: 8px 9px;
  display: grid;
  gap: 2px;
}
.reference-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.reference-card small {
  color: var(--muted);
  font-size: 11px;
}
.reference-remove {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 28px;
  height: 28px;
  min-height: 0;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,.82);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0,0,0,.14);
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.analyze-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
}
.analyze-actions button {
  width: 100%;
}
.premium-analyze {
  color: var(--brand-red);
  border-color: rgba(215,15,34,.24);
  background: rgba(255,242,244,.82);
}
.premium-analyze:not(.disabled):hover {
  color: #fff;
  border-color: var(--brand-red);
  background: var(--brand-red);
}
.ai-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.mini-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.ai-prompt,
.subject-desc {
  width: 100%;
  min-height: 64px;
  flex: none;
  resize: vertical;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255,255,255,.78);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
}
.subject-desc { min-height: 52px; }
.upload-btn {
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(215,15,34,.2);
  background: rgba(215,15,34,.06);
  color: var(--brand-red);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.upload-btn input { display: none; }
.subject-preview {
  position: relative;
  min-height: 54px;
  border-radius: 12px;
  border: 1px dashed rgba(0,0,0,.13);
  background: rgba(245,245,247,.65);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
}
.subject-preview img {
  width: 100%;
  height: 100%;
  max-height: 140px;
  object-fit: contain;
  display: block;
}
.subject-remove {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 28px;
  height: 28px;
  min-height: 0;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(255,255,255,.85);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0,0,0,.16);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.subject-remove:hover { background: #fff; }
.ai-generate {
  width: 100%;
  min-height: 46px;
  font-size: 15px;
}
/* 封面模板面板 */
.template-block .template-group {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}
.template-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.template-hint { color: var(--muted); font-size: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.1);
  background: rgba(255,255,255,.7);
  color: var(--muted);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.chip:hover { border-color: rgba(215,15,34,.25); }
.chip.active {
  border-color: rgba(215,15,34,.3);
  background: rgba(215,15,34,.09);
  color: var(--brand-red);
}
.count-stepper { display: flex; align-items: center; gap: 8px; }
.count-btn {
  width: 34px;
  height: 34px;
  min-height: 0;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.1);
  background: rgba(255,255,255,.7);
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.count-stepper input {
  width: 54px;
  height: 34px;
  min-height: 0;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.8);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  outline: none;
  -moz-appearance: textfield;
}
.count-stepper input::-webkit-outer-spin-button,
.count-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.count-hint { color: var(--muted); font-size: 12px; margin-left: 2px; }
/* 批量生成结果 */
.generated-results { display: grid; gap: 8px; }
.generated-head { min-height: 24px; }
.generated-head span { color: var(--muted); font-size: 13px; font-weight: 650; }
.generated-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  align-content: start;
}
.generated-grid .placeholder {
  grid-column: 1 / -1;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.9), rgba(245,245,247,.72)),
    var(--section);
  display: grid;
  place-items: center;
  color: var(--muted);
}
.generated-card {
  margin: 0;
  border-radius: 13px;
  overflow: hidden;
  background: rgba(245,245,247,.78);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
  display: grid;
  grid-template-rows: 1fr auto;
}
.generated-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: #fff;
}
.generated-card figcaption {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(0,0,0,.06);
}
.gen-action {
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--brand-red);
  background: rgba(255,255,255,.85);
  text-decoration: none;
}
.gen-action:hover { background: #fff; }

/* 背景移除 */
.background-workspace {
  grid-template-columns: minmax(360px, .9fr) minmax(480px, 1fr);
}
.background-panel,
.background-result-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bg-upload-card {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(160px, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.bg-upload-zone {
  height: 190px;
  min-height: 0;
  box-sizing: border-box;
  border: 1px dashed rgba(215,15,34,.32);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.76), rgba(255,245,247,.74)),
    rgba(255,255,255,.62);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  color: var(--text);
  cursor: pointer;
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.bg-upload-zone:hover {
  border-color: rgba(215,15,34,.48);
  background: rgba(255,245,247,.9);
}
.bg-upload-zone.is-disabled {
  opacity: .58;
  cursor: wait;
  pointer-events: none;
  filter: grayscale(.15);
}
.bg-upload-zone input { display: none; }
.bg-upload-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--brand-red);
  background: rgba(215,15,34,.08);
}
.bg-upload-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bg-upload-zone strong {
  font-size: 18px;
  font-weight: 800;
}
.bg-upload-zone small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.bg-source-preview {
  height: 190px;
  min-height: 0;
  box-sizing: border-box;
  border-radius: 18px;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(245,245,247,.76)),
    var(--section);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  position: relative;
}
.bg-source-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 8px;
  box-sizing: border-box;
  object-fit: contain;
  object-position: center;
  display: block;
}
.bg-source-preview img[hidden] { display: none; }
.bg-count-badge {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 3;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 10px 28px rgba(0,0,0,.08), inset 0 0 0 1px rgba(0,0,0,.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(14px);
}
.bg-source-preview .bg-count-badge {
  left: 12px;
  right: auto;
}
.bg-source-remove {
  position: absolute;
  right: 7px;
  top: 7px;
  z-index: 5;
  width: 28px;
  height: 28px;
  min-height: 0;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,.82);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0,0,0,.14);
  font-size: 18px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.bg-source-remove:hover {
  background: #fff;
  color: var(--brand-red);
}
.bg-source-remove:disabled {
  opacity: .42;
  cursor: wait;
}
.bg-stage-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  transform: translateY(-50%);
  width: 42px;
  height: 64px;
  border: 0;
  border-radius: 16px;
  background: rgba(255,255,255,.76);
  color: var(--brand-red);
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(0,0,0,.12), inset 0 0 0 1px rgba(0,0,0,.06);
  backdrop-filter: blur(14px);
}
.bg-stage-nav:hover {
  background: rgba(255,255,255,.92);
}
.bg-stage-nav:disabled {
  opacity: .36;
  cursor: default;
}
.bg-stage-nav.prev { left: 10px; }
.bg-stage-nav.next { right: 10px; }
.bg-source-preview .bg-stage-nav {
  width: 34px;
  height: 52px;
  font-size: 34px;
}
.bg-setting-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.72);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
  margin-bottom: 12px;
}
.option-row,
.bg-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.option-pill,
.bg-choice {
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.1);
  background: rgba(255,255,255,.74);
  color: var(--muted);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.option-pill:hover,
.bg-choice:hover {
  border-color: rgba(215,15,34,.26);
}
.option-pill.active,
.bg-choice.active {
  border-color: rgba(215,15,34,.34);
  background: rgba(215,15,34,.09);
  color: var(--brand-red);
}
.option-pill:disabled,
.bg-choice:disabled {
  opacity: .58;
  cursor: wait;
}
.bg-choice {
  gap: 8px;
}
.swatch {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.16);
}
.checker {
  background-image:
    linear-gradient(45deg, #d7d7dc 25%, transparent 25%),
    linear-gradient(-45deg, #d7d7dc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d7d7dc 75%),
    linear-gradient(-45deg, transparent 75%, #d7d7dc 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  background-color: #fff;
}
.swatch-white { background: #fff; }
.swatch-black { background: #111; }
.swatch-green { background: #00b140; }
.bg-remove-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.bg-remove-btn {
  width: 100%;
  min-height: 54px;
}
.bg-result-stage {
  flex: 0 0 auto;
  min-height: 300px;
  height: clamp(300px, 42vh, 520px);
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(245,245,247,.72)),
    var(--section);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.bg-result-stage.transparent {
  background-image:
    linear-gradient(45deg, rgba(0,0,0,.055) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,0,0,.055) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,.055) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,.055) 75%),
    linear-gradient(135deg, rgba(255,255,255,.9), rgba(245,245,247,.74));
  background-size: 22px 22px, 22px 22px, 22px 22px, 22px 22px, auto;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0, 0 0;
}
.bg-result-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 8px;
  box-sizing: border-box;
  object-fit: contain;
  object-position: center;
  display: block;
}
.bg-result-stage img[hidden] { display: none; }
.bg-meta {
  flex: 0 0 auto;
}
.background-result-panel .result-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.bg-send-btn {
  width: 100%;
  margin-top: 12px;
}
.image-context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 148px;
  padding: 7px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 18px 42px rgba(0,0,0,.16);
  backdrop-filter: blur(22px) saturate(170%);
}
.image-context-menu[hidden] { display: none; }
.image-context-menu button {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  justify-content: flex-start;
  padding: 0 12px;
  font-size: 14px;
}
.image-context-menu button:hover {
  background: rgba(215,15,34,.09);
  color: var(--brand-red);
}
/* 封面模板库（左侧参考面板，可折叠） */
/* 封面模板面板（参考区下方，约页面 1/3 高，比参考区小） */
.template-panel {
  margin-top: 8px;
  flex: 0 0 auto;
  height: clamp(330px, 44vh, 420px);
  min-height: 330px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
  overflow: hidden;
}
.template-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.template-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}
.tmode {
  min-height: 34px;
  border-radius: 13px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(245,245,247,.72);
  color: var(--muted);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}
.tmode:hover {
  border-color: rgba(215,15,34,.22);
}
.tmode.active {
  border-color: rgba(215,15,34,.32);
  background: rgba(215,15,34,.09);
  color: var(--brand-red);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.template-filter {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  flex: 0 0 32px;
  min-height: 32px;
  position: relative;
  z-index: 2;
  background: rgba(255,255,255,.72);
}
.template-filter::-webkit-scrollbar { display: none; }
.tfilter {
  flex: 0 0 auto;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.1);
  background: rgba(255,255,255,.7);
  color: var(--muted);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.tfilter:hover { border-color: rgba(215,15,34,.25); }
.tfilter.active {
  border-color: rgba(215,15,34,.3);
  background: rgba(215,15,34,.09);
  color: var(--brand-red);
}
.template-ratio {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 32px;
  overflow-x: auto;
  scrollbar-width: none;
  animation: pwdReveal .18s ease;
  position: relative;
  z-index: 2;
  background: rgba(255,255,255,.72);
}
.template-ratio::-webkit-scrollbar { display: none; }
.template-ratio[hidden] { display: none; }
.template-ratio-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.tratio {
  flex: 0 0 auto;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.1);
  background: rgba(255,255,255,.7);
  color: var(--muted);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.tratio:hover { border-color: rgba(215,15,34,.25); }
.tratio.active {
  border-color: rgba(215,15,34,.3);
  background: rgba(215,15,34,.09);
  color: var(--brand-red);
}
.template-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  align-content: start;
  gap: 10px;
  padding: 4px 2px 2px 0;
  position: relative;
  z-index: 1;
}
.template-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  padding: 14px 4px;
  text-align: center;
}
.template-thumb {
  position: relative;
  height: 150px;
  min-height: 150px;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.08);
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(245,245,247,.76)),
    #fff;
}
.template-pick {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  background: transparent;
}
.template-pick img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.template-thumb:hover { border-color: rgba(215,15,34,.4); }
.template-star {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.42);
  color: rgba(255,255,255,.85);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.template-star:hover { background: rgba(0,0,0,.6); }
.template-thumb.faved .template-star {
  background: #ffb300;
  color: #fff;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-list b {
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(215,15,34,.08);
  color: var(--brand-red);
  font-size: 13px;
  font-weight: 650;
}
.tag-list em {
  color: var(--muted);
  font-style: normal;
  font-size: 14px;
}

.batch-head {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.batch-head h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}
.batch-head .secondary {
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
  border-radius: 11px;
}
.batch-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: clamp(72px, 13vh, 150px);
  overflow: auto;
  padding-right: 2px;
}
.batch-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(255,255,255,.7);
}
.batch-item[data-index] { cursor: pointer; }
.batch-item[data-index]:hover { background: #fff; box-shadow: inset 0 0 0 1px rgba(0,113,227,.16); }
.batch-thumb {
  width: 58px;
  height: 52px;
  border-radius: 10px;
  background: var(--section);
  object-fit: cover;
  border: 1px solid var(--line-soft);
}
.batch-info { min-width: 0; display: grid; gap: 4px; }
.batch-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
  font-size: 14px;
}
.batch-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}
.batch-state {
  min-width: 58px;
  text-align: right;
  color: var(--green);
  font-size: 13px;
  font-weight: 650;
}
.batch-state.fail { color: #ff3b30; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(245,245,247,.38);
  backdrop-filter: blur(18px);
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  position: relative;
  width: min(460px, calc(100vw - 28px));
  max-height: min(90vh, 780px);
  overflow: auto;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.68)),
    rgba(255,255,255,.66);
  box-shadow: 0 28px 78px rgba(0,0,0,.18);
  backdrop-filter: blur(32px) saturate(180%);
  padding: 24px;
}
.admin-card { width: min(720px, calc(100vw - 28px)); }
.modal-close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 34px;
  height: 34px;
  min-height: 0;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.62);
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  padding: 0 0 3px;
}
.modal-title {
  padding-right: 42px;
  margin-bottom: 16px;
}
.modal-title h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}
.modal-title p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(245,245,247,.76);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
  margin-bottom: 16px;
}
.auth-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}
.auth-tabs button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 5px 14px rgba(0,0,0,.08);
}
.register-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.register-mode button {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(245,245,247,.75);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.register-mode button.active {
  border-color: rgba(215,15,34,.22);
  background: rgba(215,15,34,.08);
  color: var(--brand-red);
}
.form-line {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 7px;
}
.link-button {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--brand-red);
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}
.link-button:hover { color: var(--brand-red-dark); }
.form-line-links { display: flex; align-items: center; gap: 14px; }
.form-hint { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.back-login {
  justify-self: start;
  margin-bottom: -2px;
}
.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
  align-items: end;
}
.code-row .secondary {
  min-height: 46px;
  font-size: 14px;
}
.auth-form,
.admin-form {
  display: none;
  gap: 12px;
}
.auth-form.active,
.admin-form {
  display: grid;
}
.auth-form label,
.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.auth-form input,
.admin-form input,
.admin-form select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.75);
  color: var(--text);
  padding: 0 13px;
  outline: none;
  font-size: 15px;
}
.auth-form > div:not(.register-mode):not(.code-row) input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.75);
  color: var(--text);
  padding: 0 13px;
  outline: none;
  font-size: 15px;
}
.auth-form input:focus,
.admin-form input:focus,
.admin-form select:focus {
  border-color: rgba(0,113,227,.62);
  box-shadow: 0 0 0 4px rgba(0,113,227,.12);
  background: #fff;
}
.account-actions {
  display: grid;
  gap: 10px;
}
.account-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.account-header .modal-title {
  margin-bottom: 0;
}
.profile-avatar {
  width: 62px;
  height: 62px;
  aspect-ratio: 1 / 1;
  flex: 0 0 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(180deg, #e51a2d, var(--brand-red));
  color: #fff;
  box-shadow: 0 14px 30px rgba(215,15,34,.18);
}
.profile-avatar input { display: none; }
.profile-avatar span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 850;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.profile-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.profile-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.profile-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.75);
  color: var(--text);
  padding: 0 13px;
  outline: none;
  font-size: 15px;
  transition: border-color .16s ease;
}
.profile-form input:focus { border-color: rgba(215,15,34,.45); }
.profile-form .secondary {
  min-height: 44px;
  font-size: 14px;
}
.membership-box {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.58);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.membership-box small {
  color: var(--muted);
  font-size: 12px;
}
.plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.plan-card {
  min-height: 78px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.68);
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 10px;
  color: var(--text);
}
.plan-card strong {
  color: var(--brand-red);
  font-size: 20px;
  line-height: 1;
}
.plan-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.plan-card.active {
  border-color: rgba(215,15,34,.26);
  background: rgba(215,15,34,.08);
}
.pay-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pay-actions .secondary {
  min-height: 42px;
  font-size: 14px;
}
.account-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.55);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.account-field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  flex: 0 0 auto;
}
.account-field-value {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.password-section { margin-bottom: 14px; }
.secondary.block { width: 100%; }
.password-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.55);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
  animation: pwdReveal .2s ease;
}
.password-form[hidden] { display: none; }
.password-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.password-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.85);
  color: var(--text);
  padding: 0 13px;
  outline: none;
  font-size: 15px;
  transition: border-color .16s ease;
}
.password-form input:focus { border-color: rgba(215,15,34,.45); }
.password-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 2px;
}
.password-actions .secondary,
.password-actions .ghost {
  min-height: 42px;
  font-size: 14px;
}
.ghost {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.ghost:hover { background: rgba(0,0,0,.04); }
.plan-card { cursor: pointer; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.plan-card:hover { border-color: rgba(215,15,34,.22); transform: translateY(-1px); }
@keyframes pwdReveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.admin-form {
  grid-template-columns: 1fr 1fr;
}
.admin-form > label,
.admin-form > button,
.admin-section {
  grid-column: 1 / -1;
}
.admin-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.58);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.admin-section .copy-row {
  grid-column: 1 / -1;
}
.admin-section small {
  color: var(--muted);
  font-size: 12px;
}
.admin-provider { position: relative; }
.admin-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.section-title {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text) !important;
  font-size: 15px !important;
  font-weight: 750 !important;
}
.config-action {
  flex: 0 0 auto;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  border: 1px solid rgba(215,15,34,.22);
  background: rgba(215,15,34,.07);
  color: var(--brand-red);
  font-size: 12px;
  font-weight: 750;
  box-shadow: none;
}
.config-action:hover {
  background: rgba(215,15,34,.12);
  border-color: rgba(215,15,34,.36);
}
.config-action.is-on {
  background: rgba(40,170,90,.12);
  border-color: rgba(40,170,90,.24);
  color: #1c8a48;
}
.config-action:disabled {
  opacity: .62;
  cursor: wait;
}
.section-badge {
  display: none;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-red);
  background: rgba(215,15,34,.1);
  border-radius: 999px;
  padding: 2px 9px;
}
.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 10px;
  background: rgba(0,0,0,.05);
  color: var(--muted) !important;
  font-weight: 650;
}
.status-pill.ok {
  background: rgba(40,170,90,.14);
  color: #1c8a48 !important;
}
.admin-section.is-active {
  background: rgba(215,15,34,.045);
  box-shadow: inset 0 0 0 1px rgba(215,15,34,.28), 0 10px 24px rgba(215,15,34,.07);
}
.admin-section.is-active .section-badge { display: inline-block; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(29,29,31,.88);
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: 0 18px 46px rgba(0,0,0,.18);
  font-size: 14px;
  z-index: 20;
}

@media (max-width: 980px) {
  html, body { min-height: 100%; overflow: auto; }
  body {
    background:
      radial-gradient(circle at 18% 0, rgba(215,15,34,.08), transparent 34%),
      linear-gradient(180deg, rgba(245,245,247,.94) 0, rgba(255,255,255,0) 360px),
      var(--bg);
  }
  main {
    padding: 12px 12px calc(88px + env(safe-area-inset-bottom));
  }
  .app-body {
    display: block;
  }
  .feature-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    top: auto;
    z-index: 30;
    width: auto;
    height: 64px;
    min-height: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 24px;
    overflow: hidden;
  }
  .nav-logo {
    width: 48px;
    height: 48px;
    margin: 0;
    flex: 0 0 auto;
  }
  .nav-logo img {
    width: 42px;
    height: 42px;
  }
  .feature-nav .feature-item {
    width: auto;
    min-width: 0;
    min-height: 48px;
    flex: 1 1 auto;
    flex-direction: row;
    gap: 8px;
    border-radius: 18px;
    padding: 0 14px;
    font-size: 14px;
  }
  .account-entry {
    width: auto;
    min-width: 58px;
    min-height: 48px;
    margin-top: 0;
    flex: 0 0 58px;
    border-radius: 18px;
    padding: 0 8px;
    gap: 3px;
    font-size: 11px;
  }
  .account-avatar {
    width: 25px;
    height: 25px;
    font-size: 11px;
  }
  .nav-icon,
  .nav-icon svg {
    width: 22px;
    height: 22px;
  }
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    gap: 12px;
  }
  .input-panel,
  .result-panel {
    height: auto;
    overflow: visible;
  }
  .panel {
    padding: 16px;
    border-radius: 22px;
    box-shadow: 0 18px 48px rgba(0,0,0,.08);
  }
  .panel-title {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
  }
  .panel-title h2 {
    font-size: 19px;
  }
  .title-copy {
    display: grid;
    gap: 4px;
  }
  .title-copy small {
    font-size: 13px;
  }
  textarea {
    min-height: min(32dvh, 260px);
    max-height: 42dvh;
    padding: 14px;
    font-size: 15px;
    line-height: 1.55;
  }
  .platforms {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin: 12px 0 14px;
  }
  .platform {
    min-height: 48px;
    padding: 8px;
    grid-template-columns: 8px minmax(0, 1fr);
    column-gap: 7px;
  }
  .platform-dot {
    width: 8px;
    height: 8px;
  }
  .platform strong {
    font-size: 12px;
  }
  .platform small {
    font-size: 11px;
  }
  .actions {
    grid-template-columns: 1fr .72fr;
    gap: 10px;
  }
  button,
  .secondary {
    min-height: 46px;
    font-size: 15px;
  }
  .result-panel {
    margin-top: 12px;
  }
  .result-heading {
    flex-wrap: wrap;
    gap: 8px;
  }
  .result-tabs {
    gap: 4px;
  }
  .result-tab {
    min-height: 30px;
    padding: 0 10px;
    font-size: 13px;
  }
  .status {
    margin-left: auto;
    font-size: 13px;
  }
  .preview {
    height: min(46dvh, 430px);
    min-height: 260px;
    flex: none;
    border-radius: 18px;
  }
  .preview-nav {
    width: 34px;
    height: 58px;
    font-size: 38px;
    border-radius: 13px;
  }
  .preview-nav.prev { left: 4px; }
  .preview-nav.next { right: 4px; }
  .meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 12px 0;
  }
  .meta div {
    min-height: 30px;
    grid-template-columns: auto minmax(0, 1fr);
  }
  .meta dt,
  .meta dd {
    font-size: 14px;
  }
  .result-actions {
    grid-template-columns: 1fr 1fr;
  }
  .generator-workspace {
    grid-template-columns: 1fr;
  }
  .background-workspace {
    grid-template-columns: 1fr;
  }
  .generator-panel,
  .generation-panel,
  .background-panel,
  .background-result-panel {
    height: auto;
    overflow: visible;
  }
  .bg-upload-card {
    grid-template-columns: 1fr;
  }
  .bg-upload-zone,
  .bg-source-preview {
    height: 170px;
    min-height: 0;
  }
  .bg-source-preview img {
    padding: 8px;
  }
  .bg-remove-actions,
  .background-result-panel .result-actions {
    grid-template-columns: 1fr;
  }
  .bg-result-stage {
    min-height: 300px;
    height: min(48dvh, 500px);
    flex: none;
  }
  .option-row,
  .bg-choice-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .option-row::-webkit-scrollbar,
  .bg-choice-row::-webkit-scrollbar {
    display: none;
  }
  .reference-grid {
    max-height: none;
    flex-basis: auto;
    min-height: 170px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .template-panel {
    height: auto;
    min-height: 360px;
    overflow: visible;
  }
  .reference-card img {
    height: 118px;
  }
  .copy-view {
    max-height: 58dvh;
    border-radius: 18px;
    padding: 12px;
  }
  .content-view {
    overflow: visible;
  }
  .content-preview {
    height: min(38dvh, 330px);
    min-height: 220px;
  }
  .content-actions {
    margin-bottom: 0;
  }
  .copy-nav {
    width: 34px;
    height: 56px;
    font-size: 36px;
    border-radius: 13px;
  }
  .copy-nav.prev { left: 4px; }
  .copy-nav.next { right: 4px; }
  .copy-block {
    padding: 12px;
  }
  .generated-grid .placeholder {
    min-height: 200px;
  }
  .batch-head {
    margin-top: 12px;
    padding-top: 12px;
  }
  .batch-list {
    max-height: none;
    padding-bottom: 4px;
  }
  .batch-item {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    min-height: 64px;
  }
  .batch-thumb {
    width: 50px;
    height: 46px;
  }
  .toast {
    bottom: calc(86px + env(safe-area-inset-bottom));
  }
  .modal-card {
    max-height: min(86vh, 720px);
    padding: 20px;
  }
  .admin-section {
    grid-template-columns: 1fr;
  }
  .profile-form {
    grid-template-columns: 1fr;
  }
  .plans {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  main {
    padding-inline: 10px;
  }
  .panel {
    padding: 14px;
  }
  .panel-title {
    flex-wrap: wrap;
  }
  .panel-title > span,
  .status {
    margin-left: 0;
  }
  .platform {
    padding: 7px;
  }
  .actions {
    grid-template-columns: 1fr;
  }
  .preview {
    min-height: 240px;
    height: min(48dvh, 390px);
  }
  .bg-result-stage {
    min-height: 280px;
    height: min(46dvh, 420px);
  }
  .bg-upload-zone,
  .bg-source-preview {
    height: 150px;
    min-height: 0;
  }
  .option-pill,
  .bg-choice {
    min-height: 36px;
    padding-inline: 12px;
    font-size: 13px;
  }
  .batch-head {
    align-items: stretch;
    flex-direction: column;
  }
  .batch-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .batch-thumb {
    width: 48px;
    height: 44px;
  }
  .batch-state {
    grid-column: 2;
    text-align: left;
  }
  .feature-nav {
    gap: 6px;
  }
  .feature-nav .feature-item {
    padding: 0 8px;
    font-size: 12px;
  }
  .account-entry {
    flex-basis: 52px;
  }
  .code-row,
  .pay-actions {
    grid-template-columns: 1fr;
  }
}
