:root {
  --bg: #f7f3ee;
  --panel: #fffaf4;
  --panel-strong: #ffffff;
  --ink: #1f2328;
  --muted: #6a717c;
  --line: #e5ded3;
  --line-strong: #d8d0c2;
  --accent: #c7354c;
  --accent-dark: #a42b3f;
  --shadow: 0 18px 48px rgba(53, 45, 35, 0.12);
  --danger: #a9232f;
  --danger-bg: #fff1f2;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Helvetica Neue", "Segoe UI", Roboto, Ubuntu, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(199, 53, 76, 0.07), transparent 34%),
    linear-gradient(220deg, rgba(64, 95, 127, 0.08), transparent 34%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

body.auth-gate .workspace,
body.auth-gate .site-footer {
  opacity: 0;
  pointer-events: none;
}

.site-footer {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: 18px clamp(18px, 4vw, 40px) 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.site-footer span {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 250, 244, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.topbar-inner {
  width: min(1260px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 4vw, 40px);
}

.brand,
.account-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  background: transparent;
  overflow: hidden;
}

.brand-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  display: block;
}

.brand-name {
  font-size: 22px;
  letter-spacing: 0;
}

.account-actions {
  gap: 12px;
}

.user-label {
  color: var(--muted);
  font-size: 13px;
}
.user-label:hover {
  color: var(--accent);
}

/* ── Profile page ── */
.profile-stage {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 32px);
}

.register-stage {
  width: min(460px, 100%);
  margin: 0 auto;
  min-height: calc(100vh - 104px);
  padding: clamp(32px, 7vw, 72px) clamp(18px, 4vw, 40px);
  display: grid;
  place-items: center;
}

.register-panel {
  width: 100%;
}

.register-card {
  width: 100%;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.88);
  box-shadow: var(--shadow);
}

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

.register-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(169, 35, 47, 0.18);
  border-radius: 8px;
  color: var(--danger);
  background: var(--danger-bg);
  font-size: 13px;
  line-height: 1.5;
}

.profile-empty-state {
  text-align: center;
  padding: 64px 24px;
}
.profile-empty-state h2 {
  margin: 0 0 12px;
  font-size: 22px;
}
.profile-empty-state p {
  margin: 0 0 20px;
  color: var(--muted);
}

.profile-hero {
  text-align: center;
  margin-bottom: 28px;
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
}
.profile-name {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
}
.profile-meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.profile-balance-hero {
  text-align: center;
  padding: 28px 24px;
  margin-bottom: 24px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(199, 53, 76, 0.04), transparent);
}
.profile-balance-label {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.profile-balance-number {
  margin: 0 0 2px;
  font-size: 48px;
  font-weight: 750;
  line-height: 1;
  color: var(--ink);
}
.profile-balance-unit {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.profile-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}
.recharge-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 650;
  color: #fff;
  cursor: pointer;
  transition: filter 0.2s, opacity 0.2s;
}
.recharge-btn:hover { filter: brightness(0.92); }
.recharge-btn.disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.recharge-alipay { background: #1677FF; }
.recharge-wechat { background: #07C160; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.profile-stat {
  text-align: center;
  padding: 18px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}
.profile-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.profile-stat-label {
  font-size: 12px;
  color: var(--muted);
}

.profile-history-card,
.profile-detail-card {
  padding: 24px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}
.profile-history-card {
  margin-bottom: 24px;
}
.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.profile-section-head h3,
.profile-detail-card h3 {
  margin: 0 0 16px;
  font-size: 16px;
}
.profile-section-head h3 {
  margin-bottom: 0;
}
.profile-section-head span,
.profile-history-empty {
  font-size: 13px;
  color: var(--muted);
}
.profile-history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.profile-history-item {
  display: grid;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}
.profile-history-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
.profile-history-meta p {
  margin: 0 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--ink);
}
.profile-history-meta span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.profile-dl {
  margin: 0;
  display: grid;
  gap: 12px;
}
.profile-dl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.profile-dl-row dt {
  font-size: 14px;
  color: var(--muted);
}
.profile-dl-row dd {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  margin: 0;
}

.workspace {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 40px);
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 32px);
  align-items: stretch;
}

.control-stack {
  display: grid;
  gap: 18px;
  height: 100%;
}

.control-panel,
.result-panel,
.auth-card,
.share-card {
  border: 1px solid var(--line);
  background: rgba(255, 250, 244, 0.94);
  box-shadow: var(--shadow);
}

.control-panel,
.result-panel {
  border-radius: 8px;
}

.control-panel {
  padding: clamp(18px, 3vw, 28px);
  height: 100%;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title-row h1,
.panel-title-row h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.generator-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: #424850;
  font-size: 13px;
  font-weight: 650;
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 232px;
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
}

textarea::placeholder {
  color: #98a1ad;
  font-style: italic;
}

select,
input {
  min-height: 44px;
  padding: 0 12px;
}

.file-input {
  padding: 10px 12px;
}

textarea:focus,
select:focus,
input:focus {
  border-color: rgba(199, 53, 76, 0.72);
  box-shadow: 0 0 0 3px rgba(199, 53, 76, 0.12);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.action-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.action-column {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.action-column .primary-button,
.action-column .edit-primary-button {
  width: 100%;
}

.edit-action-column {
  grid-template-columns: 1fr;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.edit-reference {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 82px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.edit-reference.empty {
  background: rgba(255, 255, 255, 0.62);
}

.edit-reference-preview {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.edit-reference-preview img {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #fff;
}

.edit-reference-preview span {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
}

.edit-reference > .text-button {
  margin-left: auto;
}

.upload-photo-button {
  min-width: 112px;
  min-height: 42px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(199, 53, 76, 0.35);
  background: rgba(199, 53, 76, 0.08);
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
}

.upload-photo-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.upload-photo-button span {
  color: currentColor;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.upload-photo-button:hover {
  border-color: rgba(199, 53, 76, 0.62);
  background: rgba(199, 53, 76, 0.13);
}

.primary-button,
.edit-primary-button,
.secondary-button,
.text-button,
.share-target-button {
  cursor: pointer;
  border: 0;
}

.primary-button,
.edit-primary-button {
  min-height: 50px;
  border-radius: 8px;
  color: #fff;
  font-weight: 750;
}

.primary-button {
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.edit-primary-button {
  background: #8f4a56;
}

.edit-primary-button:hover {
  background: #773c47;
}

.model-status {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  font-weight: 650;
}

.text-button {
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 650;
}

.text-button:hover {
  color: var(--accent);
}

.primary-button:disabled,
.edit-primary-button:disabled,
.secondary-button:disabled,
.text-button:disabled,
.share-target-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.result-panel {
  min-height: calc(100vh - 132px);
  padding: clamp(16px, 2.5vw, 24px);
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(111, 134, 111, 0.08), transparent 44%),
    rgba(255, 255, 255, 0.72);
}

.empty-result,
.loading-result,
.image-result {
  width: min(100%, 640px);
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.portrait-placeholder,
.loading-frame {
  width: min(100%, 520px);
  aspect-ratio: 4 / 5;
  border-radius: 10px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(242, 229, 222, 0.9), rgba(255, 255, 255, 0.95)),
    #f8f1ea;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.loading-frame {
  position: relative;
  overflow: hidden;
}

.loading-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.36) 48%, transparent 68%);
  animation: loading-shimmer 1.6s infinite;
}

@keyframes loading-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.empty-result p,
.loading-result p {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.image-result img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 16px 38px rgba(31, 35, 40, 0.12);
  background: #fff;
  cursor: zoom-in;
}

.result-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.error-banner {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(92vw, 720px);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 8px;
  border: 1px solid rgba(169, 35, 47, 0.18);
  color: var(--danger);
  background: var(--danger-bg);
  box-shadow: 0 16px 34px rgba(169, 35, 47, 0.12);
  z-index: 70;
}

.error-banner-text {
  min-width: 0;
  line-height: 1.45;
}

.error-retry-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(169, 35, 47, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--danger);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.error-retry-button:hover {
  background: rgba(255, 255, 255, 0.86);
}

.auth-overlay,
.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(19, 26, 35, 0.42);
  backdrop-filter: blur(8px);
}

.auth-overlay {
  background:
    linear-gradient(120deg, rgba(199, 53, 76, 0.08), transparent 34%),
    linear-gradient(220deg, rgba(64, 95, 127, 0.08), transparent 34%),
    rgba(247, 243, 238, 0.88);
}

.modal-open {
  overflow: hidden;
}

.image-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 42px);
  background: rgba(17, 20, 24, 0.78);
  backdrop-filter: blur(10px);
}

.image-zoom-overlay img {
  max-width: min(96vw, 1280px);
  max-height: 90vh;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
  background: #fff;
  object-fit: contain;
}

.image-zoom-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.image-zoom-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.auth-card {
  width: min(100%, 420px);
  border-radius: 10px;
  padding: 24px;
}

.auth-card h2 {
  margin: 0 0 18px;
  font-size: 22px;
  line-height: 1.2;
}

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

.auth-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.auth-action-row .primary-button,
.auth-action-row .secondary-button {
  width: 100%;
  min-height: 50px;
  margin: 0;
}

/* captcha */
.captcha-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.captcha-row input {
  flex: 1;
}
.captcha-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  min-height: 44px;
  border-radius: 8px;
  background: rgba(199, 53, 76, 0.08);
  color: var(--accent);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 6px;
  user-select: none;
  cursor: pointer;
  font-style: italic;
  text-decoration: line-through;
  border: 0;
}
.auth-password-hint {
  margin: -6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.share-card {
  width: min(100%, 420px);
  border-radius: 10px;
  padding: 20px;
}

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

.share-head h2 {
  margin: 0;
  font-size: 20px;
}

.share-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.share-target-button {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 650;
  text-align: left;
}

.share-target-button:hover {
  border-color: rgba(199, 53, 76, 0.45);
  box-shadow: 0 0 0 3px rgba(199, 53, 76, 0.1);
}

.share-target-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent);
}

.share-target-icon svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-target-label {
  line-height: 1;
}
.share-target-icon.wechat-icon svg { width: 28px; height: 28px; }
.share-target-icon.moments-icon svg { width: 28px; height: 28px; }
.share-target-icon.xhs-icon svg { width: 28px; height: 28px; }
.share-target-icon.douyin-icon svg { width: 28px; height: 28px; }

.share-hint {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(7, 193, 96, 0.08);
  color: #057a3e;
  font-size: 14px;
  font-weight: 650;
  text-align: center;
  line-height: 1.5;
  display: none;
}
.share-hint.visible {
  display: block;
}

/* ── Alipay recharge button ── */
.alipay-recharge-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 650;
  color: #fff;
  background: #1677FF;
  cursor: pointer;
  transition: background 0.2s;
}
.alipay-recharge-button:hover {
  background: #0958d9;
}
.alipay-logo {
  flex-shrink: 0;
}

/* ── Pay modal ── */
.pay-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(19, 26, 35, 0.42);
  backdrop-filter: blur(8px);
}
.pay-card {
  width: min(100%, 420px);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 244, 0.98);
  box-shadow: var(--shadow);
  padding: 24px;
}
.pay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.pay-head h2 {
  margin: 0;
  font-size: 20px;
}
.pay-desc {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.pay-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.pay-plan-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pay-plan-card:hover { border-color: #1677FF; }
.pay-plan-card.selected {
  border-color: #1677FF;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.15);
}
.pay-plan-price {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}
.pay-plan-credits {
  font-size: 13px;
  color: #1677FF;
  font-weight: 600;
}
.pay-timeout-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.pay-error {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(169, 35, 47, 0.18);
}
.pay-submit {
  width: 100%;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    padding-top: 10px;
    align-items: start;
  }

  .control-stack {
    height: auto;
  }

  .control-panel {
    height: auto;
  }

  .result-panel {
    min-height: 620px;
  }
}

@media (max-width: 680px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-name {
    font-size: 17px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .action-split,
  .edit-action-column {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 164px;
  }

  .edit-reference {
    align-items: flex-start;
    flex-direction: column;
  }

  .edit-reference .text-button {
    align-self: flex-end;
  }

  .result-panel {
    min-height: 540px;
  }

  .share-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Warm card-based image composer ── */
body.chat-home {
  --chat-bg: #f8f3eb;
  --chat-ink: #332d25;
  --chat-muted: #776f63;
  --chat-line: #e6d8be;
  --chat-line-strong: #dcc7a2;
  --chat-panel: #fffdf7;
  --chat-card: #fffefa;
  --chat-action: #9d6a32;
  --chat-action-hover: #7f5528;
  --chat-edit: #8f7b49;
  --chat-edit-hover: #705f38;
  --chat-soft: #fbf5ea;
  --chat-surface-blue: #eee8dd;
  --chat-surface-clay: #eee0c8;
  --chat-shadow: 0 18px 48px rgba(91, 66, 30, 0.10);
  font-weight: 400;
  font-family: "Avenir Next", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(248, 243, 235, 0.98)),
    linear-gradient(135deg, rgba(255, 232, 180, 0.18), rgba(255, 232, 180, 0) 42%),
    linear-gradient(315deg, rgba(232, 192, 139, 0.16), rgba(232, 192, 139, 0) 45%),
    var(--chat-bg);
  color: var(--chat-ink);
}

body.chat-home :where(
  .brand,
  .brand-name,
  .account-actions .text-button,
  .user-label,
  .chat-prompt-title,
  .chat-prompt-title span,
  .prompt-preset-card,
  .edit-reference-preview span,
  button,
  .secondary-button,
  .guest-limit-card h2,
  .guest-limit-offer strong,
  .guest-limit-offer-badge,
  .guest-limit-primary,
  .guest-limit-login-hint .text-button
) {
  font-weight: 400;
}

.chat-home .app-shell {
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
  overflow-x: hidden;
}

.chat-home .topbar {
  position: relative;
  background: rgba(255, 253, 247, 0.78);
  border-bottom: 0;
  backdrop-filter: blur(18px);
}

.chat-home .topbar-inner {
  width: min(1180px, 100%);
  padding: 18px clamp(18px, 4vw, 34px);
}

.chat-home .brand-mark,
.chat-home .brand-logo {
  width: 38px;
  height: 38px;
}

.chat-home .brand-name {
  font-size: 23px;
  font-weight: 400;
  letter-spacing: -0.08em;
}

.chat-home .account-actions {
  gap: 10px;
}

.chat-home .account-actions .text-button {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid rgba(212, 189, 141, 0.72);
  background: rgba(255, 253, 247, 0.82);
  color: var(--chat-ink);
  font-size: 12px;
  font-weight: 400;
}

.chat-home .account-actions #login-button {
  border-color: var(--chat-action);
  background: var(--chat-action);
  color: #fff;
}

.chat-home .account-actions #login-button:hover {
  background: var(--chat-action-hover);
}

.chat-home .account-actions .text-button:hover,
.chat-home .user-label:hover {
  border-color: var(--chat-line-strong);
  color: var(--chat-ink);
}

.chat-home .user-label {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid rgba(212, 189, 141, 0.72);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.82);
  color: var(--chat-ink);
  font-size: 14px;
  font-weight: 400;
}

.chat-home .chat-workspace {
  width: 100%;
  min-width: 0;
  min-height: calc(100vh - 142px);
  margin: 0;
  padding: clamp(24px, 8vh, 76px) clamp(16px, 4vw, 40px) 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
}

.chat-home .chat-stage {
  width: min(100%, 880px);
  min-width: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.chat-home .chat-prompt-title {
  margin: 0 0 8px;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.18;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--chat-ink);
  text-wrap: balance;
}

.chat-home .chat-prompt-title span {
  font-weight: 400;
  letter-spacing: 0;
}

.chat-home .chat-control-stack {
  width: min(100%, 860px);
  min-width: 0;
  display: grid;
  gap: 12px;
  height: auto;
}

.chat-home .chat-composer-panel {
  width: 100%;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 1px solid rgba(212, 189, 141, 0.82);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.98), rgba(255, 250, 242, 0.94)),
    var(--chat-panel);
  box-shadow: var(--chat-shadow);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.chat-home .chat-composer-panel.has-preset {
  border-color: rgba(189, 154, 93, 0.92);
}

.chat-home .chat-composer-panel.is-editing-reference {
  border-color: rgba(143, 123, 73, 0.86);
  box-shadow: 0 20px 52px rgba(91, 66, 30, 0.14), 0 0 0 4px rgba(143, 123, 73, 0.08);
}

.chat-home .chat-composer-form {
  display: grid;
  gap: 0;
}

.chat-home .generation-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 4px;
  border-radius: 14px;
  background: rgba(212, 189, 141, 0.16);
}

.chat-home .generation-mode-button {
  min-width: 0;
  min-height: 46px;
  display: grid;
  align-content: center;
  gap: 3px;
  margin: 0;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--chat-muted);
  text-align: center;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.chat-home .generation-mode-button:hover {
  background: rgba(255, 253, 247, 0.56);
  color: var(--chat-ink);
}

.chat-home .generation-mode-button.is-active {
  background: #fff;
  color: var(--chat-ink);
  box-shadow: 0 2px 8px rgba(91, 66, 30, 0.10);
}

.chat-home .generation-mode-button.is-locked,
.chat-home .generation-mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

.chat-home .generation-mode-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
}

.chat-home .generation-mode-meta {
  display: block;
  color: inherit;
  font-size: 12px;
  line-height: 1.2;
  opacity: 0.78;
}

.chat-home .chat-input-shell {
  position: relative;
  min-height: 148px;
  display: grid;
  grid-template-rows: minmax(76px, 1fr) auto;
  align-items: stretch;
  gap: 10px;
  padding: 18px 20px 18px;
  background: transparent;
  transition: background 0.18s ease;
}

.chat-home .chat-input-shell.has-preset {
  background: linear-gradient(180deg, rgba(255, 254, 250, 0.56), rgba(254, 248, 238, 0.62));
}

.chat-home .chat-input-shell.has-reference {
  min-height: 184px;
  grid-template-rows: 64px minmax(44px, 1fr) auto;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.68), rgba(248, 243, 230, 0.78));
}

.chat-home .chat-composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-home .chat-tool-left,
.chat-home .chat-tool-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.chat-home .upload-photo-button,
.chat-home .voice-input-button {
  min-width: 34px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(212, 189, 141, 0.82);
  background: rgba(251, 245, 234, 0.86);
  color: var(--chat-muted);
  touch-action: manipulation;
}

.chat-home .upload-photo-button:hover,
.chat-home .voice-input-button:hover {
  background: #f7ead2;
  border-color: #d7bb8a;
  color: var(--chat-ink);
}

.chat-home .upload-photo-button svg,
.chat-home .voice-input-button svg {
  width: 18px;
  height: 18px;
}

.chat-home .voice-input-button {
  display: inline-grid;
  place-items: center;
  background: transparent;
}

.chat-home .voice-input-button.is-listening {
  border-color: var(--chat-action);
  background: rgba(157, 106, 50, 0.12);
  color: var(--chat-action);
}

.chat-home .voice-input-button.is-unsupported {
  opacity: 0.56;
}

.chat-home .voice-input-button.is-native-voice-fallback {
  opacity: 1;
}

.chat-home .chat-prompt-field {
  min-width: 0;
  min-height: 76px;
  display: block;
}

.chat-home textarea {
  height: 76px;
  min-height: 76px;
  max-height: 160px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--chat-ink);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 400;
  resize: none;
}

.chat-home .prompt-preset-row {
  display: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0 6px;
}

.chat-home .prompt-preset-card {
  position: relative;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 15px;
  border: 1px solid rgba(212, 189, 141, 0.68);
  border-radius: 13px;
  background: rgba(255, 253, 247, 0.68);
  color: var(--chat-muted);
  box-shadow: 0 8px 22px rgba(91, 66, 30, 0.05);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.chat-home .prompt-preset-card:hover,
.chat-home .prompt-preset-card.is-active {
  border-color: rgba(157, 106, 50, 0.68);
  background: rgba(255, 248, 236, 0.98);
  color: var(--chat-ink);
}

.chat-home .prompt-preset-card.is-active {
  box-shadow: 0 10px 24px rgba(91, 66, 30, 0.08), inset 0 0 0 1px rgba(157, 106, 50, 0.16);
}

.chat-home .prompt-preset-card.is-active .prompt-preset-icon {
  color: var(--chat-action);
}

.chat-home .prompt-preset-card:hover {
  transform: translateY(-1px);
}

.chat-home .prompt-preset-check {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--chat-action);
  box-shadow: 0 0 0 3px rgba(157, 106, 50, 0.12);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.chat-home .prompt-preset-card.is-active .prompt-preset-check {
  opacity: 1;
  transform: scale(1);
}

.chat-home .prompt-preset-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: inherit;
}

.chat-home .prompt-preset-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.chat-home textarea::placeholder {
  color: #9d9486;
  font-size: 17px;
  font-style: normal;
  font-weight: 400;
}

.chat-home textarea:focus,
.chat-home select:focus,
.chat-home input:focus {
  border-color: transparent;
  box-shadow: none;
}

.chat-home .primary-button.send-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #7b5022;
  color: #fff;
  box-shadow: none;
  transition: transform 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.chat-home .primary-button.send-button svg {
  width: 17px;
  height: 17px;
}

.send-button-label {
  display: none;
}

.chat-home .primary-button.send-button:hover {
  background: #5e3c18;
  transform: translateY(-1px);
}

.chat-home .primary-button.send-button.edit-mode {
  background: var(--chat-edit);
  box-shadow: 0 0 0 4px rgba(143, 123, 73, 0.12);
}

.chat-home .primary-button.send-button.edit-mode:hover {
  background: var(--chat-edit-hover);
}

.chat-home .primary-button.send-button.is-loading svg {
  opacity: 1;
}

.chat-home .primary-button.send-button.stop-mode {
  background: #d84a3a;
}

.chat-home .primary-button.send-button.stop-mode:hover {
  background: #c53d31;
  transform: translateY(-1px);
}

.chat-home .chat-status-strip {
  display: none;
}

.chat-home .edit-reference {
  position: relative;
  width: 64px;
  height: 64px;
  min-height: 0;
  margin: 0;
  padding: 0;
  align-self: start;
  justify-self: start;
  border: 0;
  border-radius: 16px;
  background: transparent;
}

.chat-home .edit-reference.empty {
  display: none;
}

.chat-home .edit-reference-preview {
  width: 64px;
  height: 64px;
  display: block;
}

.chat-home .edit-reference-preview img {
  width: 64px;
  height: 64px;
  display: block;
  border-radius: 14px;
  border: 1px solid rgba(212, 189, 141, 0.88);
  object-fit: cover;
  background: var(--chat-card);
  box-shadow: 0 8px 22px rgba(91, 66, 30, 0.12);
}

.chat-home .edit-reference-preview span {
  display: none;
}

.chat-home .edit-reference > .text-button {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(212, 189, 141, 0.88);
  border-radius: 50%;
  background: rgba(255, 253, 247, 0.98);
  color: var(--chat-ink);
  box-shadow: 0 6px 18px rgba(91, 66, 30, 0.14);
}

.chat-home .edit-reference > .text-button:hover {
  background: #f7ead2;
  color: var(--chat-ink);
}

.chat-home .edit-reference > .text-button svg {
  width: 13px;
  height: 13px;
}

.chat-home .chat-result-panel {
  width: min(100%, 790px);
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chat-home .empty-result {
  display: none;
}

.chat-home .loading-result,
.chat-home .image-result {
  width: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  text-align: center;
  animation: chat-result-enter 0.42s ease both;
}

.chat-home .loading-frame {
  width: min(100%, 570px);
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(212, 189, 141, 0.82);
  border-radius: 24px;
  background: rgba(255, 253, 247, 0.78);
  box-shadow: var(--chat-shadow);
}

.chat-home .loading-frame::after {
  content: none;
}

.chat-home .loading-frame span {
  border-radius: 18px;
  background:
    linear-gradient(110deg, rgba(230, 216, 190, 0.86), rgba(255, 254, 250, 0.98), rgba(238, 224, 200, 0.82));
  background-size: 220% 100%;
  animation: chat-placeholder-fade 1.4s ease-in-out infinite;
}

.chat-home .loading-frame span:first-child {
  grid-row: span 2;
}

.chat-home .loading-frame span:nth-child(2) {
  animation-delay: 0.12s;
}

.chat-home .loading-frame span:nth-child(3) {
  animation-delay: 0.24s;
}

.chat-home .loading-result p {
  margin: 14px 0 0;
  color: var(--chat-muted);
  font-size: 14px;
}

.chat-home .image-result {
  padding: 16px;
  border: 1px solid rgba(212, 189, 141, 0.82);
  border-radius: 26px;
  background: rgba(255, 253, 247, 0.82);
  box-shadow: var(--chat-shadow);
}

.chat-home .result-image-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  max-width: 100%;
}

.chat-home .result-image-wrap.is-placeholder {
  width: min(100%, 680px);
}

.chat-home .result-image-wrap.is-placeholder::before {
  content: "";
  width: min(100%, 680px);
  aspect-ratio: 4 / 5;
  border-radius: 22px;
  border: 1px solid rgba(212, 189, 141, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 248, 237, 0.96), rgba(246, 239, 226, 0.92)),
    var(--chat-card);
  box-shadow: 0 12px 34px rgba(91, 66, 30, 0.14);
}

.chat-home .result-image-wrap.is-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.46) 48%, transparent 68%);
  animation: loading-shimmer 1.6s infinite;
}

.chat-home .image-result img {
  max-width: min(100%, 680px);
  max-height: 60vh;
  border-radius: 22px;
  border: 1px solid rgba(212, 189, 141, 0.82);
  box-shadow: 0 12px 34px rgba(91, 66, 30, 0.14);
  background: var(--chat-card);
  cursor: zoom-in;
  opacity: 0;
  filter: blur(8px) saturate(0.92);
  transform: translateY(4px) scale(0.992);
  transition: opacity 0.7s ease, filter 0.9s ease, transform 0.7s ease;
}

.chat-home .image-result img.is-visible {
  opacity: 1;
  filter: blur(0) saturate(1);
  transform: translateY(0) scale(1);
}

.result-quality-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(42, 37, 28, 0.78);
  color: #fffaf1;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.result-quality-badge.is-hd {
  background: rgba(83, 122, 83, 0.86);
}

.hd-progress-card {
  width: min(100%, 680px);
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(212, 189, 141, 0.78);
  border-radius: 18px;
  background: rgba(255, 252, 245, 0.9);
  text-align: left;
}

.hd-progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hd-progress-title,
.hd-progress-message {
  margin: 0;
}

.hd-progress-title {
  color: var(--chat-ink);
  font-size: 14px;
  font-weight: 700;
}

.hd-progress-message {
  margin-top: 4px;
  color: var(--chat-muted);
  font-size: 13px;
  line-height: 1.45;
}

.hd-progress-percent {
  flex: 0 0 auto;
  color: var(--chat-muted);
  font-size: 13px;
  font-weight: 700;
}

.hd-progress-track {
  width: 100%;
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(212, 189, 141, 0.28);
}

.hd-progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c7aa7e, #7f9c73);
  transition: width 0.45s ease;
}

.hd-progress-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.hd-primary-action {
  min-height: 38px;
  min-width: 128px;
  border-radius: 999px;
}

.guest-limit-status {
  width: min(100%, 680px);
  margin: 10px 0 0;
  color: var(--chat-muted);
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
}

.guest-limit-status.is-warning {
  color: #9a5b17;
}

.guest-soft-signup {
  position: relative;
  width: min(100%, 680px);
  margin-top: 10px;
  padding: 12px 42px 12px 14px;
  border: 1px solid rgba(127, 156, 115, 0.38);
  border-radius: 14px;
  background: rgba(248, 255, 246, 0.9);
  color: var(--chat-ink);
  text-align: left;
}

.guest-soft-signup strong,
.guest-soft-signup span {
  display: block;
}

.guest-soft-signup strong {
  font-size: 14px;
  font-weight: 700;
}

.guest-soft-signup span {
  margin-top: 3px;
  color: var(--chat-muted);
  font-size: 13px;
  line-height: 1.45;
}

.guest-soft-signup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.guest-soft-signup-actions .secondary-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff;
}

.guest-soft-signup-actions .text-button {
  color: var(--chat-muted);
  font-size: 13px;
}

.guest-soft-signup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--chat-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.guest-soft-signup-close:hover {
  background: rgba(127, 156, 115, 0.12);
  color: var(--chat-ink);
}

.chat-home .result-actions {
  margin-top: 14px;
}

.chat-home .result-actions .secondary-button {
  min-height: 42px;
  min-width: 78px;
  border-radius: 999px;
  background: var(--chat-card);
}

.chat-home .site-footer {
  border-top: 0;
  padding-bottom: 18px;
}

/* ── Guest limit prompt ── */
.guest-limit-card {
  position: relative;
  width: min(100%, 400px);
  padding: 36px 28px 28px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  text-align: center;
}

.guest-limit-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #999;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.guest-limit-close:hover {
  background: #f4f4f4;
  color: #333;
}

.guest-limit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.guest-limit-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  color: #0d0d0d;
}

.guest-limit-card > p {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.6;
  color: #6b6b6b;
}

.guest-limit-offer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.guest-limit-offer-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #16a34a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.guest-limit-offer strong {
  font-size: 18px;
  font-weight: 700;
  color: #16a34a;
}

.guest-limit-offer-detail {
  font-size: 14px;
  color: #4b5563;
}

.guest-limit-primary {
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  background: #0d0d0d;
  color: #fff;
  border: none;
  cursor: pointer;
}

.guest-limit-primary:hover {
  background: #2b2b2b;
}

.guest-limit-secondary {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  background: #fff;
  color: #0d0d0d;
  border: 1px solid #d4d4d8;
  cursor: pointer;
}

.guest-limit-secondary:hover {
  background: #f4f4f5;
}

.guest-limit-login-hint {
  margin: 14px 0 0;
  font-size: 14px;
  color: #6b6b6b;
}

.guest-limit-login-hint .text-button {
  color: #0d0d0d;
  font-weight: 600;
  text-decoration: underline;
}

body.chat-home :where(
  .brand,
  .brand-name,
  .account-actions .text-button,
  .user-label,
  .chat-prompt-title,
  .chat-prompt-title span,
  .prompt-preset-card,
  .edit-reference-preview span,
  .result-actions .secondary-button,
  .guest-limit-card h2,
  .guest-limit-offer strong,
  .guest-limit-offer-badge,
  .guest-soft-signup strong,
  .guest-limit-primary,
  .guest-limit-login-hint .text-button
) {
  font-weight: 400;
}

/* ── WeChat in-app H5 mode ── */
body.wechat-mode.chat-home {
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(248, 243, 235, 0.98)),
    var(--chat-bg);
}

.wechat-mode.chat-home .topbar {
  display: block;
  position: relative;
  background: rgba(255, 253, 247, 0.88);
  border-bottom: 0;
  backdrop-filter: blur(14px);
}

.wechat-mode.chat-home .app-shell {
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
}

.wechat-mode .topbar-inner {
  width: min(430px, 100%);
  min-height: 48px;
  padding: 8px 16px 4px;
  gap: 8px;
}

.wechat-mode .brand {
  gap: 7px;
}

.wechat-mode .brand-mark,
.wechat-mode .brand-logo {
  width: 28px;
  height: 28px;
}

.wechat-mode .brand-name {
  display: inline;
  color: var(--chat-ink);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0;
}

.wechat-mode .account-actions {
  display: inline-flex;
  margin-left: auto;
  gap: 6px;
}

.wechat-mode .account-actions .text-button,
.wechat-mode .user-label {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
}

.wechat-mode #register-button,
.wechat-mode #logout-button {
  display: none !important;
}

.wechat-mode #login-button {
  border-color: rgba(212, 189, 141, 0.72);
  background: rgba(255, 253, 247, 0.82);
  color: var(--chat-ink);
}

.wechat-mode .chat-workspace {
  width: 100%;
  max-width: 100vw;
  min-height: calc(100svh - 96px);
  padding: clamp(56px, 10svh, 80px) 14px 18px;
  place-items: start center;
  overflow-x: hidden;
}

.wechat-mode .chat-stage {
  width: min(430px, calc(100vw - 44px));
  max-width: 100%;
  gap: 9px;
  align-content: start;
}

.wechat-mode .chat-prompt-title {
  order: 1;
  display: none;
  margin: 0;
  font-size: 27px;
  line-height: 1.12;
  letter-spacing: 0;
}

.wechat-value-prop {
  order: 1;
  max-width: 370px;
  margin: 0 auto 12px;
  color: var(--chat-muted);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.wechat-mode .chat-control-stack {
  order: 3;
  width: 100%;
  max-width: 100%;
  gap: 9px;
}

.wechat-mode .chat-composer-panel {
  border-radius: 16px;
}

.wechat-mode .generation-mode-toggle {
  gap: 0;
  padding: 4px;
}

.wechat-mode .generation-mode-button {
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 10px;
}

.wechat-mode .generation-mode-title {
  font-size: 13px;
}

.wechat-mode .generation-mode-meta {
  font-size: 11px;
}

.wechat-mode .chat-input-shell {
  min-height: 116px;
  grid-template-rows: minmax(52px, 1fr) auto;
  gap: 8px;
  padding: 12px;
}

.wechat-mode .chat-tool-left,
.wechat-mode .upload-photo-button,
.wechat-mode .voice-input-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  visibility: visible;
  position: static;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  overflow: visible;
}

.wechat-mode .upload-photo-button svg,
.wechat-mode .voice-input-button svg {
  width: 20px;
  height: 20px;
}

.wechat-mode .chat-composer-toolbar {
  justify-content: space-between;
}

.wechat-mode .chat-tool-right {
  width: auto;
  margin-left: auto;
  gap: 8px;
}

.wechat-mode .primary-button.send-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.wechat-mode .primary-button.send-button.stop-mode {
  width: auto;
  min-width: 76px;
  padding: 0 12px;
  border-radius: 999px;
  gap: 6px;
}

.wechat-mode .primary-button.send-button svg {
  width: 20px;
  height: 20px;
}

.wechat-mode .send-button-label {
  display: none;
}

.wechat-mode .primary-button.send-button.stop-mode .send-button-label {
  display: inline;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.wechat-mode textarea {
  min-height: 52px;
  height: 52px;
  font-size: 16px;
}

.wechat-mode textarea::placeholder {
  font-size: 16px;
}

.wechat-mode .prompt-preset-row {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  padding: 0;
}

.wechat-mode .prompt-preset-card {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  padding: 0 8px;
  gap: 5px;
  border-radius: 11px;
  font-size: 12px;
  overflow: hidden;
}

.wechat-mode .prompt-preset-card span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wechat-mode .prompt-preset-icon,
.wechat-mode .prompt-preset-icon svg {
  width: 14px;
  height: 14px;
}

.wechat-mode .prompt-preset-check {
  display: none;
}

.wechat-example-prompts {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
}

.wechat-example-prompt {
  min-width: 0;
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid rgba(212, 189, 141, 0.58);
  border-radius: 11px;
  background: rgba(255, 253, 247, 0.64);
  color: var(--chat-muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.wechat-gallery {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}

.gallery-track {
  display: flex;
  transition: transform 0.35s ease;
  will-change: transform;
}

.gallery-item {
  flex: 0 0 50%;
  min-width: 0;
  padding: 4px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: rgba(212, 189, 141, 0.16);
}

.gallery-prompt {
  display: block;
  margin-top: 4px;
  color: var(--chat-muted);
  font-size: 11px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.gallery-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.15);
  transition: background 0.2s;
}

.gallery-dot.active {
  background: #7b5022;
}

@media (min-width: 640px) {
  .gallery-track {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    transform: none !important;
    will-change: auto;
  }

  .gallery-item {
    flex: initial;
  }

  .gallery-item img {
    aspect-ratio: 4 / 3;
  }

  .gallery-dots {
    display: none;
  }
}

.wechat-mode .chat-result-panel {
  order: 2;
  width: 100%;
  margin: 0 0 6px;
}

.wechat-mode .loading-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
}

.wechat-mode .loading-result p {
  font-size: 13px;
  line-height: 1.5;
}

.wechat-mode .image-result {
  padding: 10px;
  border-radius: 18px;
}

.wechat-mode .result-image-wrap.is-placeholder {
  width: 100%;
}

.wechat-mode .result-image-wrap.is-placeholder::before {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 28svh;
  border-radius: 16px;
}

.wechat-mode .result-image-wrap.is-placeholder::after {
  border-radius: 16px;
}

.wechat-mode .image-result img {
  width: 100%;
  max-height: 58vh;
  border-radius: 16px;
  object-fit: contain;
}

.wechat-mode .result-quality-badge {
  top: 8px;
  left: 8px;
  min-height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

.wechat-mode .hd-progress-card {
  width: 100%;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 14px;
}

.wechat-mode .hd-progress-head {
  gap: 8px;
}

.wechat-mode .hd-progress-title {
  font-size: 13px;
}

.wechat-mode .hd-progress-message,
.wechat-mode .hd-progress-percent {
  font-size: 12px;
}

.wechat-mode .hd-progress-message {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.wechat-mode .hd-progress-actions {
  justify-content: stretch;
}

.wechat-mode .hd-progress-card[data-status="queued"] .hd-progress-actions,
.wechat-mode .hd-progress-card[data-status="running"] .hd-progress-actions,
.wechat-mode .hd-progress-card[data-status="cancelled"] .hd-progress-actions {
  display: none;
}

.wechat-mode .hd-primary-action {
  width: 100%;
  min-height: 38px;
  border-radius: 12px;
  font-size: 13px;
}

.wechat-mode .guest-limit-status,
.wechat-mode .guest-soft-signup {
  width: 100%;
  margin-top: 8px;
}

.wechat-mode .guest-soft-signup {
  padding: 10px 38px 10px 12px;
  border-radius: 13px;
}

.wechat-mode .guest-soft-signup span,
.wechat-mode .guest-soft-signup-actions .text-button {
  font-size: 12px;
}

.wechat-mode .guest-soft-signup-actions {
  gap: 6px;
}

.wechat-mode .guest-soft-signup-actions .secondary-button {
  min-height: 34px;
  font-size: 12px;
}

.wechat-save-hint {
  margin: 10px 0 0;
  color: var(--chat-muted);
  font-size: 13px;
  line-height: 1.4;
}

.wechat-mode .result-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wechat-mode #rerun-button,
.wechat-mode #share-button {
  display: none !important;
}

.wechat-mode #edit-generated-button {
  grid-column: 1 / -1;
}

.wechat-mode .result-actions .secondary-button {
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 13px;
}

.wechat-mode #download-link {
  display: none;
}

.wechat-mini-program-entry {
  width: 100%;
}

.wechat-mini-program-button {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(7, 193, 96, 0.28);
  border-radius: 12px;
  background: rgba(7, 193, 96, 0.08);
  color: #137a43;
  font-size: 13px;
}

.wechat-mode .site-footer {
  padding: 10px 14px 18px;
}

@media (max-width: 360px) {
  .wechat-mode .chat-workspace {
    padding-left: 10px;
    padding-right: 10px;
  }

  .wechat-mode .prompt-preset-row,
  .wechat-mode .result-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@keyframes chat-placeholder-fade {
  0% {
    background-position: 100% 0;
    opacity: 0.86;
  }
  50% {
    background-position: 0 0;
    opacity: 1;
  }
  100% {
    background-position: -100% 0;
    opacity: 0.86;
  }
}

@keyframes chat-result-enter {
  from {
    opacity: 0.28;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chat-image-reveal {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

@media (max-width: 760px) {
  .chat-home .topbar-inner {
    width: 100%;
    max-width: 100vw;
    padding: 14px 16px;
    align-items: center;
    flex-direction: row;
  }

  .chat-home .brand {
    gap: 8px;
    min-width: 0;
  }

  .chat-home .brand-mark,
  .chat-home .brand-logo {
    width: 32px;
    height: 32px;
  }

  .chat-home .brand-name {
    font-size: 18px;
  }

  .chat-home .account-actions .text-button,
  .chat-home .user-label {
    min-height: 34px;
    padding: 0 9px;
    font-size: 12px;
  }

  .chat-home .account-actions {
    gap: 6px;
    margin-left: auto;
    flex: 0 0 auto;
  }

  .chat-home .account-actions #logout-button {
    display: none !important;
  }

  .chat-home .chat-workspace {
    min-height: calc(100vh - 150px);
    padding: clamp(24px, 7vh, 62px) 20px 34px;
  }

  .chat-home .chat-prompt-title {
    margin-bottom: 8px;
    font-size: 20px;
    letter-spacing: 0;
  }

  .chat-home .chat-composer-panel {
    border-radius: 22px;
  }

  .chat-home .chat-stage,
  .chat-home .chat-control-stack,
  .chat-home .chat-composer-panel {
    width: 100%;
    max-width: 100%;
  }

  .chat-home .chat-input-shell {
    min-height: 132px;
    grid-template-rows: minmax(70px, 1fr) auto;
    gap: 8px;
    padding: 16px;
  }

  .chat-home .chat-input-shell.has-reference {
    min-height: 178px;
    grid-template-rows: 60px minmax(42px, 1fr) auto;
  }

  .chat-home .edit-reference,
  .chat-home .edit-reference-preview,
  .chat-home .edit-reference-preview img {
    width: 60px;
    height: 60px;
  }

  .chat-home .edit-reference > .text-button {
    width: 24px;
    min-width: 24px;
    height: 24px;
    min-height: 24px;
  }

  .chat-home .prompt-preset-row {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: visible;
    padding: 0 2px;
  }

  .chat-home .prompt-preset-card {
    min-height: 38px;
    flex: 0 0 auto;
    gap: 7px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 13px;
  }

  .chat-home .prompt-preset-icon,
  .chat-home .prompt-preset-icon svg {
    width: 16px;
    height: 16px;
  }

  .chat-home .primary-button.send-button {
    grid-column: auto;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .chat-home .primary-button.send-button.stop-mode {
    width: auto;
    min-width: 82px;
    padding: 0 13px;
    border-radius: 999px;
    gap: 7px;
  }

  .chat-home .primary-button.send-button.stop-mode .send-button-label {
    display: inline;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
  }

  .chat-home .upload-photo-button,
  .chat-home .voice-input-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .chat-home .chat-tool-left,
  .chat-home .chat-tool-right {
    gap: 8px;
  }

  .chat-home textarea {
    height: 70px;
    min-height: 70px;
    font-size: 16px;
  }

  .chat-home textarea::placeholder {
    font-size: 16px;
  }

  .chat-home .loading-frame {
    border-radius: 20px;
  }
}

@media (max-width: 760px) {
  .profile-history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.wechat-mode.chat-home .topbar-inner {
    min-height: 48px;
    padding: 8px 16px 4px;
    gap: 8px;
  }

  body.wechat-mode.chat-home .brand {
    gap: 7px;
  }

  body.wechat-mode.chat-home .brand-mark,
  body.wechat-mode.chat-home .brand-logo {
    width: 28px;
    height: 28px;
  }

  body.wechat-mode.chat-home .brand-name {
    display: inline;
    font-size: 17px;
    letter-spacing: 0;
  }

  body.wechat-mode.chat-home .chat-workspace {
    width: 100%;
    max-width: 100vw;
    min-height: calc(100svh - 96px);
    padding: clamp(56px, 10svh, 80px) 14px 18px;
    overflow-x: hidden;
  }

  body.wechat-mode.chat-home .chat-stage {
    width: min(430px, calc(100vw - 44px));
    max-width: 100%;
    justify-self: start;
  }

  body.wechat-mode.chat-home .chat-control-stack,
  body.wechat-mode.chat-home .chat-composer-panel,
  body.wechat-mode.chat-home .wechat-gallery {
    width: 100%;
    max-width: 100%;
  }

  body.wechat-mode.chat-home .chat-input-shell {
    min-height: 116px;
    grid-template-rows: minmax(52px, 1fr) auto;
    gap: 8px;
    padding: 12px;
  }

  body.wechat-mode.chat-home .chat-tool-left,
  body.wechat-mode.chat-home .upload-photo-button,
  body.wechat-mode.chat-home .voice-input-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  body.wechat-mode.chat-home .upload-photo-button svg,
  body.wechat-mode.chat-home .voice-input-button svg {
    width: 20px;
    height: 20px;
  }

  body.wechat-mode.chat-home .primary-button.send-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    align-items: center;
    justify-content: center;
  }

  body.wechat-mode.chat-home .primary-button.send-button.stop-mode {
    width: auto;
    min-width: 76px;
    padding: 0 12px;
    border-radius: 999px;
    gap: 6px;
  }

  body.wechat-mode.chat-home .primary-button.send-button.stop-mode .send-button-label {
    display: inline;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
  }

  body.wechat-mode.chat-home .prompt-preset-row {
    display: none;
  }

  body.wechat-mode.chat-home .prompt-preset-card {
    width: 100%;
    min-height: 40px;
    padding: 0 8px;
    font-size: 12px;
  }
}
