/* ═══════════════════════════════════════
   USER.CSS — 用户端专属样式
   放置在 app.css 之后加载
   ═══════════════════════════════════════ */

/* ── Page Header ── */
.page-hd {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(10px, 1.2vw, 16px);
  margin-bottom: clamp(16px, 2vw, 24px);
}

.page-hd p {
  margin: 0;
  font-size: clamp(12px, 1.4vw, 14px);
  color: var(--text-muted);
  font-weight: 600;
}

.page-hd h1 {
  margin: 2px 0 0;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-hd-actions {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  flex-shrink: 0;
}

/* Prompt send control: a quiet in-field action below the expand control. */
html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell textarea,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-shell textarea {
  padding-right: 58px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send {
  position: absolute !important;
  right: 8px !important;
  bottom: 8px !important;
  z-index: 3 !important;
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
  border: 1px solid rgba(214, 91, 17, .2) !important;
  border-radius: 10px !important;
  background: #f97316 !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(194, 65, 12, .22), inset 0 1px 0 rgba(255, 255, 255, .3) !important;
  cursor: pointer !important;
  transform: none !important;
  transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send span,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send span {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send svg,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send svg {
  width: 19px !important;
  height: 19px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send::before,
html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send::after,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send::before,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send::after {
  content: none !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send:hover,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send:hover {
  background: #ea580c !important;
  box-shadow: 0 6px 16px rgba(194, 65, 12, .28), inset 0 1px 0 rgba(255, 255, 255, .3) !important;
  transform: translateY(-1px) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send:focus-visible,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send:focus-visible {
  outline: 3px solid rgba(249, 115, 22, .24) !important;
  outline-offset: 2px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send:disabled,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send:disabled {
  background: #fdba74 !important;
  box-shadow: none !important;
  cursor: wait !important;
  opacity: .82 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send[data-busy] svg,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send[data-busy] svg {
  animation: home-send-pulse .9s ease-in-out infinite alternate !important;
}

@keyframes home-send-pulse {
  to { transform: translateY(-2px); opacity: .7; }
}

@media (max-width: 720px) {
  html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send,
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    border-radius: 11px !important;
  }
}

/* Creation room result rail and project picker. */
body.page-creation .creation-message.is-ai { position: relative; }
body.page-creation .creation-message.is-ai > div { position: relative; }
body.page-creation .creation-result-actions {
  position: absolute;
  top: 54px;
  left: calc(100% + 12px);
  z-index: 2;
  display: grid;
  gap: 7px;
}
body.page-creation [data-creation-record]:not([data-status="succeeded"]):not([data-status="failed"]) .creation-result-actions {
  display: none;
}
body.page-creation [data-creation-record][data-status="failed"] .creation-action-btn:not([data-creation-action="redo"]) {
  display: none;
}
body.page-creation .creation-action-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 9px;
  background: rgba(255, 255, 255, .9);
  color: #475569;
  box-shadow: 0 5px 16px rgba(15, 23, 42, .1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease;
}
body.page-creation .creation-action-btn:hover,
body.page-creation .creation-action-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(249, 115, 22, .3);
  background: #fff7ed;
  color: #ea580c;
  box-shadow: 0 7px 18px rgba(194, 65, 12, .14);
}
body.page-creation .creation-action-btn:focus-visible {
  outline: 3px solid rgba(249, 115, 22, .2);
  outline-offset: 2px;
}
body.page-creation .creation-action-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.creation-project-dialog {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(10px);
}
.creation-project-dialog.hidden { display: none; }
.creation-project-panel {
  width: min(520px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .86);
  border-radius: 10px;
  background: var(--main-surface, #fff);
  color: var(--text, #172033);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}
.creation-project-head { display: flex; justify-content: space-between; gap: 14px; }
.creation-project-head span { color: #f97316; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.creation-project-head h2 { margin: 3px 0 4px; font-size: 20px; }
.creation-project-head p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.creation-project-close { width: 30px; height: 30px; border: 0; background: transparent; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.creation-project-create { display: flex; gap: 8px; margin: 20px 0 12px; }
.creation-project-create input { min-width: 0; flex: 1; height: 38px; padding: 0 11px; border: 1px solid var(--line, #d8dee8); border-radius: 7px; background: var(--main-bg, #fff); color: var(--text, #172033); }
.creation-project-list { display: grid; gap: 8px; }
.creation-project-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--line, #d8dee8); border-radius: 8px; background: var(--main-surface-soft, #f8fafc); }
.creation-project-row > div { min-width: 0; display: grid; gap: 3px; }
.creation-project-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.creation-project-row small, .creation-project-empty { color: var(--text-muted); font-size: 11px; }
.creation-project-empty { display: block; padding: 16px 4px; text-align: center; }
.creation-project-message { margin: 12px 0 0; color: #0f766e; font-size: 12px; }
.creation-project-message.is-error { color: #b42318; }
@media (max-width: 860px) {
  body.page-creation .creation-result-actions {
    position: static;
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin-top: 8px;
  }
  body.page-creation .creation-action-btn { width: 32px; height: 32px; font-size: 18px; }
}
@media (max-width: 520px) {
  .creation-project-dialog { padding: 10px; }
  .creation-project-panel { padding: 17px; max-height: calc(100vh - 20px); }
  .creation-project-create { align-items: stretch; flex-direction: column; }
}

.asset-projects-panel { margin: 16px 0; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--main-surface); }
.asset-projects-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.asset-projects-eyebrow { color: #0f766e; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.asset-projects-head h2 { margin: 3px 0 4px; color: var(--text); font-size: 18px; }
.asset-projects-head p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.asset-projects-create { display: flex; gap: 8px; margin: 14px 0 0; }
.asset-projects-create.hidden { display: none; }
.asset-projects-create input { min-width: 0; flex: 1; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--main-bg); color: var(--text); }
.asset-projects-list { display: grid; gap: 12px; margin-top: 16px; }
.asset-projects-empty, .asset-project-empty { padding: 16px; color: var(--text-muted); font-size: 12px; text-align: center; }
.asset-project-card { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--main-surface-soft); }
.asset-project-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.asset-project-title-wrap { min-width: 0; display: grid; gap: 4px; }
.asset-project-title { width: min(100%, 340px); min-width: 0; border: 0; border-bottom: 1px dashed var(--line); background: transparent; color: var(--text); font-size: 14px; font-weight: 800; }
.asset-project-title-wrap span { color: var(--text-muted); font-size: 11px; }
.asset-project-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.asset-project-items { display: grid; gap: 7px; margin-top: 13px; }
.asset-project-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 7px; border-top: 1px solid var(--line); }
.asset-project-item-thumb { display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: 6px; background: var(--main-bg); color: var(--text-muted); }
.asset-project-item-thumb img, .asset-project-item-thumb video { width: 100%; height: 100%; object-fit: cover; }
.asset-project-item-thumb span { font-size: 18px; }
.asset-project-item input { min-width: 0; width: 100%; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--main-bg); color: var(--text); font-size: 12px; }
@media (max-width: 640px) {
  .asset-projects-panel { padding: 13px; }
  .asset-projects-head, .asset-project-card-head { flex-direction: column; }
  .asset-project-actions { justify-content: flex-start; }
  .asset-project-title { width: 100%; }
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell:has(.home-prompt-send) textarea,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-shell:has(.home-prompt-send) textarea {
  min-height: 88px !important;
  height: 88px !important;
}

/* Main composer expanded prompt editor: viewport-centered floating dialog. */
html[data-theme] body.page-app:not(.page-admin) > .home-prompt-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  width: 100vw !important;
  height: 100dvh !important;
  display: grid !important;
  place-items: center !important;
  padding: clamp(16px, 3vw, 36px) !important;
  background: rgba(20, 27, 38, .30) !important;
  backdrop-filter: blur(18px) saturate(.88) !important;
  -webkit-backdrop-filter: blur(18px) saturate(.88) !important;
}

html[data-theme] body.page-app:not(.page-admin) > .home-prompt-modal.hidden {
  display: none !important;
}

html[data-theme] body.page-app:not(.page-admin) > .home-prompt-modal .home-prompt-modal-panel {
  width: min(calc(100vw - 48px), 980px) !important;
  height: min(72dvh, 720px) !important;
  min-width: 0 !important;
  min-height: 420px !important;
  max-width: 980px !important;
  max-height: calc(100dvh - 48px) !important;
  margin: 0 !important;
  padding: 22px !important;
  gap: 14px !important;
  overflow: hidden !important;
  border: 1px solid rgba(255, 255, 255, .78) !important;
  border-radius: 28px !important;
  background: rgba(255, 255, 255, .92) !important;
  box-shadow: 0 32px 100px rgba(31, 41, 55, .28), inset 0 1px 0 rgba(255, 255, 255, .94) !important;
}

html[data-theme] body.page-app:not(.page-admin) > .home-prompt-modal textarea {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 18px 20px !important;
  overflow-y: auto !important;
  resize: none !important;
  border-color: rgba(65, 76, 91, .14) !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, .84) !important;
  color: #29313d !important;
  font-size: 16px !important;
  line-height: 1.75 !important;
}

html[data-theme] body.page-app:not(.page-admin) > .home-prompt-modal textarea:focus {
  outline: none !important;
  border-color: rgba(255, 122, 24, .58) !important;
  box-shadow: 0 0 0 4px rgba(255, 122, 24, .10) !important;
}

html[data-theme] body.page-app:not(.page-admin) > .home-prompt-modal .home-prompt-modal-head strong {
  color: #29313d !important;
  font-size: 18px !important;
}

html[data-theme] body.page-app:not(.page-admin) > .home-prompt-modal .home-prompt-modal-actions .btn-primary {
  border-color: #171c24 !important;
  background: #171c24 !important;
  color: #fff !important;
}

@media (max-width: 640px) {
  html[data-theme] body.page-app:not(.page-admin) > .home-prompt-modal {
    padding: 12px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) > .home-prompt-modal .home-prompt-modal-panel {
    width: 100% !important;
    height: min(78dvh, 680px) !important;
    min-height: 360px !important;
    max-height: calc(100dvh - 24px) !important;
    padding: 16px !important;
    border-radius: 22px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) > .home-prompt-modal textarea {
    padding: 15px 16px !important;
    font-size: 16px !important;
  }
}

/* Compact workflow cards with content-aware tactile title plates. */
html[data-theme] body.page-app:not(.page-admin) .home-workflow-card {
  min-height: 58px !important;
  padding: 5px !important;
  overflow: hidden;
  border-radius: 17px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-copy {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 48px;
  display: grid;
  align-content: center;
  gap: 2px;
  overflow: hidden;
  padding: 7px 46px 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -1px 0 rgba(15, 23, 42, 0.06),
    0 5px 14px rgba(15, 23, 42, 0.1);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.42;
  background-image: linear-gradient(115deg, transparent 36%, rgba(255,255,255,.42) 50%, transparent 64%);
  background-size: 180% 100%;
  background-position: 100% 0;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-copy::after {
  position: absolute;
  right: 11px;
  top: 50%;
  min-width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 9px;
  transform: translateY(-50%);
  background: rgba(255,255,255,.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card:hover .home-workflow-copy {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.8),
    inset 0 -1px 0 rgba(15,23,42,.06),
    0 8px 18px rgba(15,23,42,.14);
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-copy > strong,
html[data-theme] body.page-app:not(.page-admin) .home-workflow-copy > span {
  position: relative;
  z-index: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-copy > strong {
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-copy > span {
  font-size: 10px;
  line-height: 1.25;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--agent .home-workflow-copy {
  color: #f8fafc;
  background:
    radial-gradient(circle at 88% 15%, rgba(96,165,250,.42), transparent 31%),
    linear-gradient(135deg, rgba(15,23,42,.96), rgba(35,48,72,.9));
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--agent .home-workflow-copy > span {
  color: rgba(226,232,240,.72);
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--agent .home-workflow-copy::after {
  content: "AI";
  color: #dbeafe;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--canvas .home-workflow-copy {
  color: #40285f;
  background:
    radial-gradient(circle at 85% 12%, rgba(249,168,212,.46), transparent 34%),
    linear-gradient(135deg, rgba(255,247,237,.96), rgba(243,232,255,.93));
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--canvas .home-workflow-copy > span {
  color: rgba(88,64,112,.7);
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--canvas .home-workflow-copy::after {
  content: "∞";
  color: #7e22ce;
  font-size: 18px;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--gallery .home-workflow-copy {
  color: #153b62;
  background:
    radial-gradient(circle at 84% 13%, rgba(34,211,238,.4), transparent 32%),
    linear-gradient(135deg, rgba(236,254,255,.96), rgba(224,231,255,.92));
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--gallery .home-workflow-copy > span {
  color: rgba(30,64,99,.68);
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--gallery .home-workflow-copy::after {
  content: "✦";
  color: #0369a1;
  font-size: 15px;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--records .home-workflow-copy {
  color: #25443d;
  background:
    radial-gradient(circle at 85% 12%, rgba(52,211,153,.33), transparent 34%),
    linear-gradient(135deg, rgba(240,253,250,.96), rgba(241,245,249,.94));
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--records .home-workflow-copy > span {
  color: rgba(45,76,69,.68);
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card--records .home-workflow-copy::after {
  content: "↗";
  color: #047857;
  font-size: 15px;
}

@media (max-width: 620px) {
  html[data-theme] body.page-app:not(.page-admin) .home-workflow-card {
    min-height: 54px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-workflow-copy {
    min-height: 44px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

.canvas-project-titlebar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.canvas-project-titlebox {
  display: grid;
  gap: 6px;
  min-width: min(100%, 320px);
}

.canvas-project-titlebox span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.canvas-project-titlebox input {
  width: min(100%, 360px);
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--main-surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-out-expo), box-shadow var(--duration-fast) var(--ease-out-expo);
}

.canvas-project-titlebox input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.canvas-project-save-state {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.canvas-project-save-state.is-pending {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.canvas-project-save-state.is-saving {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
}

.canvas-project-save-state.is-saved {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.canvas-project-save-state.is-error {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.badge-balance {
  display: flex;
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  padding: clamp(6px, 0.8vw, 10px) clamp(10px, 1.2vw, 16px);
  border-radius: var(--radius-full);
  background: var(--main-surface);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.badge-balance:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.badge-balance .num {
  font-size: clamp(15px, 1.8vw, 20px);
  font-weight: 800;
  color: var(--text);
}

.badge-balance .label {
  font-size: clamp(11px, 1.3vw, 13px);
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Grid layouts ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(16px, 2vw, 24px);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(14px, 1.6vw, 20px);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(12px, 1.4vw, 18px);
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: clamp(12px, 1.4vw, 18px);
}

/* ── Card v3 ── */
.card-v3 {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--main-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-out-expo);
}

.card-v3:hover {
  box-shadow: var(--shadow);
}

.card-v3-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 1.2vw, 16px);
  padding: clamp(14px, 1.8vw, 20px) clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}

.card-v3-head > div { min-width: 0; }

.card-v3-head .eyebrow {
  margin: 0;
  font-size: clamp(10px, 1.2vw, 12px);
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.card-v3-head h3 {
  margin: 2px 0 0;
  font-size: clamp(15px, 1.8vw, 19px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-v3-body {
  padding: clamp(14px, 1.8vw, 22px) clamp(16px, 2vw, 24px);
}

/* ── Mode Toggle ── */
.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-toggle label {
  min-height: clamp(44px, 5.5vw, 52px);
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius, 14px);
  background: var(--main-surface);
  color: var(--text-soft);
  font-weight: 750;
  font-size: clamp(13px, 1.5vw, 15px);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  padding: 0 clamp(12px, 1.4vw, 16px);
}

.mode-toggle label:hover {
  border-color: rgba(59,130,246,0.5);
  background: var(--primary-soft);
  color: var(--primary);
}

.mode-toggle input { display: none; }

.mode-toggle label:has(input:checked),
.mode-toggle label.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary-soft), transparent);
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

/* ── Media Card (Gallery) ── */
.media-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--main-surface);
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.media-card:hover {
  border-color: var(--primary-soft);
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-2px);
}

.media-card img,
.media-card video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.media-card-body {
  padding: clamp(8px, 1vw, 12px) clamp(10px, 1.2vw, 14px);
}

.media-card-body .prompt {
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card-body .meta {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.5vw, 8px);
  margin-top: 4px;
  font-size: clamp(10px, 1.2vw, 12px);
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Status Badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: clamp(10px, 1.1vw, 11px);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.status-badge.pending {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.status-badge.running {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.status-badge.succeeded {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.status-badge.failed {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* ── Upload Box ── */
.edit-upload-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.edit-upload-box:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.edit-upload-box input { display: none; }

.edit-upload-box strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}

.edit-upload-box small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.edit-upload-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--main-surface-soft);
  font-size: 20px;
  font-weight: 300;
  color: var(--text-muted);
  flex-shrink: 0;
}

.edit-upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.edit-upload-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* ── Pricing / Shop ── */
.price-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  background: var(--main-surface);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.price-card:hover {
  border-color: var(--primary-soft);
  box-shadow: 0 8px 24px var(--primary-glow);
  transform: translateY(-4px);
}

.price-card .price {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
}

.price-card .price small {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ── History ── */
.history-list {
  display: grid;
  gap: 8px;
}

.record-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--main-surface);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.record-card:hover {
  border-color: var(--primary-soft);
  background: var(--primary-soft);
}

/* ── Utility ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}

.alert.error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert strong { display: block; font-weight: 700; margin-bottom: 4px; }
.alert span { opacity: 0.85; }

.hidden { display: none !important; }

/* ── User Center ── */
.uc-section {
  margin-bottom: clamp(16px, 2vw, 24px);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
}

@media (max-width: 640px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-hd { flex-direction: column; align-items: flex-start; }
}

/* ── Button Variants ── */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-light, #60a5fa), var(--primary, #3b82f6));
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.22);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary, #3b82f6), var(--primary-dark, #2563eb));
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
  transform: translateY(-2px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  border-color: var(--line);
  background: var(--main-surface);
  color: var(--text-soft);
}
.btn-secondary:hover {
  border-color: rgba(59,130,246,0.5);
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-soft);
}
.btn-ghost:hover { background: var(--main-surface-soft); }

.btn-sm {
  min-height: 30px;
  padding: 0 clamp(8px, 1vw, 14px);
  font-size: clamp(11px, 1.3vw, 13px);
}

.btn-lg {
  min-height: 48px;
  padding: 0 28px;
  font-size: 15px;
}

/* ── Edit Upload ── */
.edit-upload-field {
  display: grid;
  gap: 8px;
}

.edit-upload-field.hidden { display: none; }

/* ── Prompt Optimize ── */
.prompt-optimize-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.hint { color: var(--text-muted); font-size: 12px; }
.hint.hidden { display: none; }

/* ── Record Delete Form ── */
.record-delete-form { display: inline; }

/* ── Card v3 subtitle ── */
.card-v3-head .sub {
  margin: 0;
  font-size: clamp(10px, 1.2vw, 12px);
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* ── History Empty ── */
.history-empty-inline {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

/* ── Chat Message Text ── */
.chat-msg-text {
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg-text p { margin: 0 0 8px; }
.chat-msg-text p:last-child { margin-bottom: 0; }

/* ── Dot (typing indicator) ── */
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: dotPulse 1.4s infinite ease-in-out;
}
.dot:nth-child(2) { animation-delay: 0.16s; }
.dot:nth-child(3) { animation-delay: 0.32s; }
@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ── Prompt Optimize Status ── */
.hint.is-error { color: var(--danger, #ef4444); }

.btn-secondary.is-loading { pointer-events: none; opacity: 0.7; }
.field-hint {
  font-size: clamp(11px, 1.3vw, 13px);
  color: var(--text-muted);
  font-weight: 600;
}
.field-hint.hidden { display: none; }
.field-hint.is-error { color: var(--danger, #ef4444); }

/* ── Chat Model Picker (beautified) ── */
.chat-model-picker {
  border: none;
  outline: none;
  background: transparent;
  color: var(--primary, #3b82f6);
  font-size: clamp(11px, 1.3vw, 13px);
  font-weight: 700;
  cursor: pointer;
  padding: 0 16px 0 0;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  background-size: 10px;
}

.chat-model-picker:hover {
  color: var(--primary-dark, #2563eb);
}

.chat-model-picker option {
  color: var(--text, #1e293b);
  background: var(--main-surface, #fff);
  padding: 4px 8px;
}

/* ── Chat Input Textarea scroll fix ── */
.chat-input::-webkit-scrollbar {
  width: 4px;
}
.chat-input::-webkit-scrollbar-thumb {
  background: var(--line-strong, #cbd5e1);
  border-radius: 2px;
}

/* ── Canvas ── */
.canvas-page {
  display: grid;
  gap: 18px;
}

.canvas-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 180px);
}

.canvas-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

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

.canvas-sidebar-tabs button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--main-surface);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  padding: 10px 8px;
  cursor: pointer;
}

.canvas-sidebar-tabs button.is-active {
  border-color: rgba(59,130,246,.35);
  background: var(--primary-soft);
  color: var(--primary);
}

.canvas-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--main-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: none;
}

.canvas-panel.is-active {
  display: block;
}

.canvas-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.canvas-panel-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.canvas-panel-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.canvas-projects,
.canvas-form {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
}

.canvas-preset-list {
  display: grid;
  gap: 10px;
}

.canvas-quick-node-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.canvas-quick-node-card {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--main-surface);
  cursor: pointer;
}

.canvas-quick-node-card strong {
  font-size: 13px;
  color: var(--text);
}

.canvas-quick-node-card small {
  font-size: 11px;
  color: var(--text-muted);
}

.canvas-upload-actions,
.canvas-guide-list {
  display: grid;
  gap: 8px;
}

.canvas-guide-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--main-surface-soft);
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
}

.canvas-preset-card {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(59,130,246,.08), rgba(14,165,233,.04)),
    var(--main-surface);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out-expo),
              border-color var(--duration-fast) var(--ease-out-expo),
              box-shadow var(--duration-fast) var(--ease-out-expo);
}

.canvas-preset-card:hover {
  transform: translateY(-1px);
  border-color: rgba(59,130,246,.35);
  box-shadow: 0 10px 24px rgba(59,130,246,.12);
}

.canvas-preset-card strong {
  font-size: 13px;
  color: var(--text);
}

.canvas-preset-card small {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
}

.canvas-project-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  background: var(--main-surface);
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.canvas-project-card:hover,
.canvas-project-card.active {
  border-color: rgba(59,130,246,0.45);
  background: var(--primary-soft);
}

.canvas-project-card .thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(14,165,233,.06));
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.canvas-project-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.canvas-project-card .meta {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 4px;
}

.canvas-project-card .meta strong {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.canvas-project-card .meta span,
.canvas-empty {
  font-size: 11px;
  color: var(--text-muted);
}

.canvas-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.canvas-workflow-steps {
  display: grid;
  gap: 8px;
}

.canvas-workflow-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--main-surface-soft);
  font-size: 13px;
  font-weight: 600;
}

.canvas-task-list {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
}

.canvas-task-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--main-surface);
}

.canvas-task-card .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.canvas-task-card .top strong {
  font-size: 13px;
}

.canvas-task-card .meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.canvas-task-card .steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.canvas-stage-wrap {
  min-width: 0;
  border: 1px solid rgba(15,23,42,.22);
  border-radius: 16px;
  background: #111827;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

body.canvas-immersive-active {
  overflow: hidden;
}

.canvas-stage-wrap.is-immersive {
  position: fixed;
  inset: 0;
  z-index: 1100;
  border-radius: 0;
  border: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  box-shadow: none;
}

.canvas-stage-wrap.is-immersive .canvas-stage-shell {
  min-height: 0;
  height: 100%;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(15,23,42,.92);
  backdrop-filter: blur(10px);
}

.canvas-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.canvas-node-quickbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 12px;
  background: rgba(2,6,23,.38);
}

.canvas-node-quickbar-label {
  font-size: 11px;
  color: #cbd5e1;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.canvas-toolbar-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}

.canvas-toolbar .btn.is-active {
  border-color: rgba(59,130,246,.45);
  background: var(--primary-soft);
  color: var(--primary);
}

.canvas-fullscreen-btn {
  height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid rgba(20, 184, 166, 0.26);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(15, 118, 110, 0.88));
  color: #ecfeff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 30px rgba(13, 148, 136, 0.18);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out-expo), box-shadow var(--duration-fast) var(--ease-out-expo), border-color var(--duration-fast) var(--ease-out-expo);
}

.canvas-fullscreen-btn:hover {
  transform: translateY(-1px) scale(1.01);
  border-color: rgba(94, 234, 212, 0.52);
  box-shadow: 0 16px 36px rgba(13, 148, 136, 0.26);
}

.canvas-fullscreen-btn.is-active {
  background: linear-gradient(135deg, rgba(8, 47, 73, 0.98), rgba(14, 116, 144, 0.9));
  border-color: rgba(125, 211, 252, 0.56);
}

.canvas-fullscreen-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.canvas-upload-btn {
  position: relative;
  overflow: hidden;
}

.canvas-stage-shell {
  position: relative;
  overflow: hidden;
  min-height: 620px;
  background:
    radial-gradient(circle at top left, rgba(20,184,166,.12), transparent 24%),
    radial-gradient(circle at bottom right, rgba(148,163,184,.08), transparent 22%),
    #0b1120;
}

.canvas-stage {
  --canvas-width: 10000px;
  --canvas-height: 8000px;
  --canvas-x: 0px;
  --canvas-y: 0px;
  --canvas-scale: 1;
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
}

.canvas-stage:active {
  cursor: grabbing;
}

.canvas-grid,
.canvas-group-layer,
.canvas-items,
.canvas-selection {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--canvas-width);
  height: var(--canvas-height);
  transform: translate(var(--canvas-x), var(--canvas-y)) scale(var(--canvas-scale));
  transform-origin: top left;
}

.canvas-grid {
  background-image:
    linear-gradient(rgba(148,163,184,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,.12) 1px, transparent 1px),
    linear-gradient(rgba(148,163,184,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,.04) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 20px 20px, 20px 20px;
}

.canvas-item {
  position: absolute;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(15,23,42,.12);
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.82);
}

.canvas-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.canvas-item-text {
  display: grid;
  place-items: center;
  padding: 10px 14px;
  backdrop-filter: blur(12px);
  font-weight: 700;
  text-align: center;
}

.canvas-selection {
  border: 2px dashed rgba(59,130,246,.9);
  background: rgba(59,130,246,.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4);
  pointer-events: none;
}

.canvas-group-layer,
.canvas-node-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--canvas-width);
  height: var(--canvas-height);
  transform: translate(var(--canvas-x), var(--canvas-y)) scale(var(--canvas-scale));
  transform-origin: top left;
}

.canvas-group-card {
  position: absolute;
  border: 1px dashed rgba(125,211,252,.5);
  border-radius: 20px;
  background: rgba(59,130,246,.06);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}

.canvas-group-card.active {
  border-color: rgba(34,197,94,.72);
  background: rgba(16,185,129,.08);
}

.canvas-group-head {
  position: absolute;
  left: 16px;
  top: -18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,.92);
  color: #e2e8f0;
  border: 1px solid rgba(148,163,184,.18);
  font-size: 11px;
}

.canvas-group-action {
  border: 0;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(59,130,246,.14);
  color: #bfdbfe;
  font-size: 10px;
  cursor: pointer;
}

.canvas-minimap {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 15;
  display: grid;
  gap: 8px;
}

.canvas-minimap-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-minimap-toggle {
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 999px;
  background: rgba(15,23,42,.92);
  color: #e2e8f0;
  font-size: 12px;
  padding: 8px 12px;
  cursor: pointer;
}

.canvas-minimap-help {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(94, 234, 212, 0.38);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.88), rgba(14, 116, 144, 0.88));
  color: #f0fdfa;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(13, 148, 136, 0.18);
  cursor: pointer;
}

.canvas-minimap-panel {
  width: 200px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(15,23,42,.92);
  border: 1px solid rgba(148,163,184,.18);
}

.canvas-minimap-stage {
  position: relative;
  width: 180px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(rgba(148,163,184,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,.08) 1px, transparent 1px),
    #0b1120;
  background-size: 18px 18px;
  cursor: pointer;
}

.canvas-minimap-node {
  position: absolute;
  border-radius: 4px;
  background: rgba(125,211,252,.58);
}

.canvas-minimap-node.active {
  background: rgba(34,197,94,.72);
}

.canvas-minimap-viewport {
  position: absolute;
  border: 1px solid rgba(255,255,255,.82);
  background: rgba(255,255,255,.08);
  border-radius: 4px;
  pointer-events: none;
}

.canvas-zoom-label {
  min-width: 52px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}

@media (max-width: 1180px) {
  .canvas-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .canvas-actions {
    grid-template-columns: 1fr;
  }

  .canvas-stage-shell {
    min-height: 460px;
  }
}

.canvas-edges {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--canvas-width);
  height: var(--canvas-height);
  transform: translate(var(--canvas-x), var(--canvas-y)) scale(var(--canvas-scale));
  transform-origin: top left;
}

.canvas-edge-path {
  cursor: default;
  pointer-events: none;
  filter: drop-shadow(0 0 5px rgba(20,184,166,.22));
}

.canvas-edge-hit {
  cursor: pointer;
  pointer-events: stroke;
}

.canvas-edge-path:hover {
  stroke: #5eead4;
  stroke-width: 4;
}

.canvas-node-card {
  position: absolute;
  width: 240px;
  min-height: 124px;
  padding: 10px 12px 12px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.24);
  background: linear-gradient(180deg, rgba(30,41,59,.98), rgba(15,23,42,.98));
  box-shadow: 0 14px 32px rgba(0,0,0,.28);
  text-align: left;
  display: grid;
  gap: 8px;
  cursor: grab;
  user-select: none;
  color: #e5e7eb;
}

.canvas-node-card.active {
  border-color: rgba(20,184,166,.72);
  box-shadow: 0 0 0 2px rgba(20,184,166,.18), 0 18px 38px rgba(0,0,0,.32);
}

.canvas-node-card.dragging {
  cursor: grabbing;
  box-shadow: 0 0 0 3px rgba(59,130,246,.16), 0 18px 36px rgba(15,23,42,.18);
}

body.canvas-node-dragging,
body.canvas-node-dragging * {
  user-select: none !important;
  -webkit-user-select: none !important;
}

.canvas-node-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(20,184,166,.18);
  color: #5eead4;
  font-size: 11px;
  font-weight: 800;
}

.canvas-node-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.canvas-node-title {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-node-status {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(148,163,184,.12);
  color: #94a3b8;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.canvas-node-status.queued {
  background: rgba(245,158,11,.16);
  color: #fbbf24;
}

.canvas-node-status.running {
  background: rgba(59,130,246,.16);
  color: #93c5fd;
}

.canvas-node-status.done {
  background: rgba(20,184,166,.18);
  color: #5eead4;
}

.canvas-node-status.error {
  background: rgba(239,68,68,.18);
  color: #fca5a5;
}

.canvas-node-body {
  min-height: 34px;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(2,6,23,.48);
  color: #94a3b8;
  font-size: 10px;
  line-height: 1.4;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}

.canvas-node-ports {
  display: grid;
  gap: 7px;
}

.canvas-node-ports-in {
  justify-items: start;
}

.canvas-node-ports-out {
  justify-items: end;
}

.canvas-port {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  font-size: 10px;
  line-height: 1;
  cursor: crosshair;
}

.canvas-node-title-input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  padding: 0;
  outline: none;
}

.canvas-node-delete-btn {
  border: 0;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(239,68,68,.12);
  color: #fca5a5;
  font-size: 10px;
  cursor: pointer;
}

.canvas-node-inline-text,
.canvas-node-provider input,
.canvas-node-provider textarea,
.canvas-node-provider select {
  width: 100%;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 8px;
  background: rgba(2,6,23,.46);
  color: #e5e7eb;
  font-size: 11px;
  line-height: 1.45;
  padding: 8px 10px;
  outline: none;
}

.canvas-node-inline-text {
  min-height: 70px;
  resize: vertical;
}

.canvas-node-inline-text.is-script {
  min-height: 132px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.canvas-script-card,
.canvas-generator-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.16);
  background: linear-gradient(180deg, rgba(15,23,42,.72), rgba(2,6,23,.5));
}

.canvas-script-card-top,
.canvas-generator-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.canvas-script-card-top strong,
.canvas-generator-panel-head strong {
  color: #f8fafc;
  font-size: 11px;
}

.canvas-script-card-top span,
.canvas-generator-panel-head span {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(20,184,166,.12);
  color: #99f6e4;
  font-size: 10px;
}

.canvas-script-card-body {
  color: #cbd5e1;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.canvas-script-board {
  display: grid;
  gap: 8px;
}

.canvas-script-board-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.canvas-script-table,
.canvas-script-card-list {
  display: grid;
  gap: 8px;
}

.canvas-script-row,
.canvas-script-shot-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(148,163,184,.16);
  border-radius: 10px;
  background: rgba(2,6,23,.34);
}

.canvas-script-row {
  grid-template-columns: auto 24px 1fr 1.5fr;
  align-items: center;
}

.canvas-script-row input[type="text"] {
  width: 100%;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 8px;
  background: rgba(15,23,42,.6);
  color: #e5e7eb;
  padding: 8px 10px;
  font-size: 11px;
}

.canvas-script-row-index {
  color: #94a3b8;
  font-size: 11px;
  text-align: center;
}

.canvas-script-shot-card strong {
  color: #f8fafc;
  font-size: 12px;
}

.canvas-script-shot-card p {
  margin: 0;
  color: #cbd5e1;
  font-size: 11px;
  line-height: 1.5;
}

.canvas-generator-panel.is-image {
  border-color: rgba(59,130,246,.2);
}

.canvas-generator-panel.is-video {
  border-color: rgba(16,185,129,.22);
}

.canvas-generator-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.canvas-node-media-row,
.canvas-node-media-preview,
.canvas-node-media-tools,
.canvas-node-provider,
.canvas-node-editor-actions,
.canvas-node-run-row,
.canvas-node-result {
  display: grid;
  gap: 8px;
}

.canvas-node-media-row {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

.canvas-node-upload {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px dashed rgba(148,163,184,.24);
  border-radius: 8px;
  background: rgba(15,23,42,.42);
  color: #cbd5e1;
  font-size: 10px;
  cursor: pointer;
}

.canvas-node-media-item {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(148,163,184,.16);
  border-radius: 10px;
  background: rgba(2,6,23,.4);
}

.canvas-node-media-thumb {
  border-radius: 8px;
  overflow: hidden;
  background: rgba(15,23,42,.8);
  min-height: 84px;
}

.canvas-node-media-thumb img,
.canvas-node-media-thumb video,
.canvas-node-result video,
.canvas-node-result audio,
.canvas-media-lightbox-body img,
.canvas-media-lightbox-body video,
.canvas-media-lightbox-body audio {
  display: block;
  width: 100%;
  max-width: 100%;
}

.canvas-node-media-thumb img,
.canvas-node-result-grid img,
.canvas-media-lightbox-body img,
.canvas-media-lightbox-body video {
  object-fit: contain;
}

.canvas-node-video-placeholder {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: #94a3b8;
  font-size: 11px;
}

.canvas-node-media-tools {
  grid-template-columns: 1fr repeat(3, auto);
  align-items: center;
}

.canvas-node-media-tools button,
.canvas-node-run-btn {
  border: 1px solid rgba(20,184,166,.22);
  border-radius: 8px;
  background: rgba(20,184,166,.12);
  color: #ccfbf1;
  font-size: 10px;
  padding: 6px 8px;
  cursor: pointer;
}

.canvas-node-result-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.canvas-node-result-tools .is-download {
  padding: 8px 14px;
  border-color: rgba(34, 197, 94, 0.36);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.24), rgba(20, 184, 166, 0.22));
  color: #ecfdf5;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 18px rgba(22, 163, 74, 0.16);
}

.canvas-node-preview-frame {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.74), rgba(15, 23, 42, 0.92));
}

.canvas-node-provider span,
.canvas-node-result > span {
  color: #94a3b8;
  font-size: 10px;
}

.canvas-node-result.is-error .canvas-node-preview-frame {
  border-color: rgba(248,113,113,.38);
  background: rgba(127,29,29,.16);
}

.canvas-node-result.is-error .canvas-node-preview-empty strong,
.canvas-node-result.is-error > span {
  color: #fecaca;
}

.canvas-node-result.is-error .canvas-node-preview-empty small {
  color: #fca5a5;
}

.canvas-node-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.canvas-node-result-grid img {
  border-radius: 8px;
  background: rgba(15,23,42,.72);
  aspect-ratio: 1 / 1;
}

.canvas-node-preview-frame.is-video video,
.canvas-node-result-grid img,
.canvas-media-lightbox-body video,
.canvas-media-lightbox-body img {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.canvas-node-result-image {
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
}

.canvas-node-result-image.is-active {
  box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.48);
}

.canvas-node-card.is-script {
  border-color: rgba(244,114,182,.28);
}

.canvas-node-card.is-image-node {
  border-color: rgba(59,130,246,.24);
}

.canvas-node-card.is-video-node {
  border-color: rgba(16,185,129,.26);
}

.canvas-history-check {
  accent-color: #14b8a6;
}

.canvas-media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(2,6,23,.84);
  backdrop-filter: blur(8px);
}

.canvas-media-lightbox-shell {
  width: min(94vw, 1280px);
  max-height: 90vh;
  display: grid;
  gap: 12px;
}

.canvas-media-lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #f8fafc;
}

.canvas-media-lightbox-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.canvas-media-lightbox-close {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(15,23,42,.92);
  color: #fff;
  cursor: pointer;
}

.canvas-media-lightbox-body {
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  border-radius: 18px;
  background: rgba(15,23,42,.96);
  padding: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,.42);
  overscroll-behavior: contain;
}

.canvas-media-lightbox-body video {
  width: auto;
  min-width: min(100%, 960px);
  max-height: calc(88vh - 90px);
  margin: 0 auto;
}

.canvas-help-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.74);
  backdrop-filter: blur(10px);
}

.canvas-help-panel {
  width: min(760px, 92vw);
  max-height: 88vh;
  overflow: auto;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.18), transparent 26%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.99), rgba(2, 6, 23, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.36);
  color: #e2e8f0;
}

.canvas-help-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 14px;
}

.canvas-help-head span {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5eead4;
}

.canvas-help-head h2 {
  margin: 8px 0 0;
  font-size: 28px;
  line-height: 1.1;
  color: #f8fafc;
}

.canvas-help-close {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  color: #f8fafc;
  padding: 8px 14px;
  cursor: pointer;
}

.canvas-help-body {
  display: grid;
  gap: 12px;
  padding: 0 24px 24px;
}

.canvas-help-section {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.canvas-help-section strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  color: #f8fafc;
}

.canvas-help-section p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: #cbd5e1;
}

body.canvas-script-editor-open {
  overflow: hidden;
}

.canvas-script-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2,6,23,.82);
  backdrop-filter: blur(8px);
}

.canvas-script-modal.hidden {
  display: none;
}

.canvas-script-modal-panel {
  width: min(980px, 92vw);
  max-height: 90vh;
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 18px;
  background: rgba(15,23,42,.98);
  border: 1px solid rgba(148,163,184,.16);
  box-shadow: 0 24px 64px rgba(0,0,0,.42);
}

.canvas-script-modal-head,
.canvas-script-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.canvas-script-modal textarea {
  width: 100%;
  min-height: 52vh;
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 14px;
  background: rgba(2,6,23,.6);
  color: #e5e7eb;
  font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 14px 16px;
  resize: vertical;
  outline: none;
}

.canvas-port i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #0f172a;
  border: 2px solid #14b8a6;
  box-shadow: 0 0 0 3px rgba(20,184,166,.12);
}

.canvas-port:hover i {
  background: #5eead4;
}

.canvas-port.active i {
  background: #5eead4;
  border-color: #ccfbf1;
  box-shadow: 0 0 0 5px rgba(20,184,166,.22);
}

.canvas-step-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.canvas-step-preview {
  font-size: 11px;
  color: var(--primary);
  text-decoration: none;
}

.canvas-template-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
}

.canvas-template-actions input {
  min-width: 0;
}

.canvas-template-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.canvas-template-chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--main-surface);
  color: var(--text-soft);
  font-size: 12px;
  cursor: pointer;
}

.canvas-node-whitelist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.canvas-node-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.canvas-node-editor-head strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}

.canvas-node-editor-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.canvas-node-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .canvas-generator-panel-grid {
    grid-template-columns: 1fr;
  }

  .canvas-script-row {
    grid-template-columns: 1fr;
  }

  .canvas-project-titlebar {
    align-items: stretch;
  }

  .canvas-project-titlebox,
  .canvas-project-titlebox input {
    width: 100%;
  }

  .canvas-fullscreen-btn {
    padding: 0 14px;
  }

  .canvas-help-head {
    flex-direction: column;
  }
}

html[data-theme] body.page-creation:not(.page-admin) .creation-transfer-files {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  opacity: .76;
}

.canvas-context-menu {
  position: fixed;
  z-index: 1400;
  width: 260px;
  max-height: min(520px, 80vh);
  overflow: auto;
  background: rgba(15,23,42,.98);
  border: 1px solid rgba(148,163,184,.24);
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(0,0,0,.34);
  padding: 8px;
  display: grid;
  gap: 4px;
}

.canvas-context-meta {
  padding: 4px 10px 2px;
  color: #e2e8f0;
  font-size: 10px;
  font-weight: 800;
}

.canvas-node-search {
  width: 100%;
  margin-bottom: 6px;
  padding: 8px 9px;
  border-radius: 8px;
  border: 1px solid rgba(148,163,184,.28);
  background: rgba(2,6,23,.72);
  color: #e5e7eb;
  font-size: 11px;
  outline: none;
}

.canvas-node-search:focus {
  border-color: rgba(20,184,166,.72);
}

.canvas-context-menu button {
  text-align: left;
  border: none;
  background: transparent;
  color: #e5e7eb;
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 2px;
  font-size: 12px;
  line-height: 1.25;
}

.canvas-context-menu button span {
  color: #94a3b8;
  font-size: 9px;
  font-weight: 800;
}

.canvas-context-section {
  display: grid;
  gap: 4px;
}

.canvas-context-title {
  padding: 6px 10px 2px;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.canvas-context-menu button:hover {
  background: rgba(20,184,166,.14);
  color: #ccfbf1;
}

/* ═══════════════════════════════════════
   User area tech-theme refinements
   ═══════════════════════════════════════ */

.credits-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: clamp(12px, 1.5vw, 18px);
  margin-bottom: clamp(16px, 2vw, 24px);
}

.credits-stat {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 2vw, 22px);
  background:
    radial-gradient(circle at 100% 0%, rgba(0,224,255,.16), transparent 38%),
    linear-gradient(145deg, rgba(255,255,255,.082), rgba(255,255,255,.032)),
    rgba(9, 12, 20, 0.76);
  box-shadow: var(--shadow-card);
}

.credits-stat::after {
  content: "";
  position: absolute;
  inset: auto 16px 14px auto;
  width: 46px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--primary));
}

.credits-stat .label,
.credits-stat .sub {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.credits-stat .value {
  margin: 8px 0 4px;
  color: #fff;
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: 1;
}

.credits-list {
  display: grid;
  gap: 10px;
}

.credits-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255,255,255,.038);
}

.credits-item .icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(0,224,255,.12);
}

.credits-item .prompt {
  color: var(--text);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credits-item .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.credits-item .cost {
  min-width: 70px;
  text-align: right;
  color: var(--primary-light);
  font-size: 18px;
  font-weight: 900;
}

.model-chip {
  display: grid;
  gap: 8px;
}

.model-chip label,
.model-chip .chip {
  border-color: var(--line);
  background: rgba(255,255,255,.045);
}

.compact-param-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  align-items: end;
  margin: 2px 0 6px;
}

.compact-param-field {
  min-width: 0;
  gap: 4px;
  margin-bottom: 0;
}

.compact-param-field > label {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
}

.compact-param-field select,
.compact-param-field input[type="text"],
.compact-param-field input[type="number"] {
  min-height: 34px;
  height: 34px;
  border-radius: 9px;
  padding: 0 28px 0 10px;
  font-size: 12px;
  line-height: 34px;
}

.compact-param-field .model-chip {
  gap: 0;
}

.compact-param-field .model-chip select {
  width: 100%;
}

@media (min-width: 900px) {
  .image-param-row {
    grid-template-columns: minmax(118px, .75fr) minmax(160px, 1.25fr);
  }

  .video-param-row {
    grid-template-columns: minmax(104px, .82fr) minmax(112px, .9fr) minmax(96px, .72fr) minmax(96px, .72fr) minmax(150px, 1.24fr);
  }
}

@media (max-width: 640px) {
  .compact-param-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-param-field-wide {
    grid-column: 1 / -1;
  }
}

.media-card {
  position: relative;
  isolation: isolate;
}

.media-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(circle at 50% 0%, rgba(0,224,255,.22), transparent 54%);
  transition: opacity var(--duration-normal) var(--ease-out-expo);
}

.media-card:hover::after {
  opacity: 1;
}

.canvas-project-card,
.canvas-preset-card,
.canvas-task-card {
  border-color: var(--line);
  background:
    linear-gradient(145deg, rgba(255,255,255,.065), rgba(255,255,255,.026)),
    rgba(7, 10, 17, 0.72);
}

.canvas-project-card:hover,
.canvas-project-card.active,
.canvas-preset-card:hover,
.canvas-task-card:hover {
  border-color: rgba(0,224,255,.32);
  box-shadow: 0 0 34px rgba(0,224,255,.10);
}

.canvas-project-card .thumb {
  background:
    radial-gradient(circle at 40% 30%, rgba(0,224,255,.24), transparent 42%),
    rgba(255,255,255,.045);
}

@media (max-width: 640px) {
  .credits-item {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .credits-item .cost {
    grid-column: 2;
    text-align: left;
  }

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

/* ═══════════════════════════════════════
   USER UI REFINEMENT — compact controls, airy layout
   ═══════════════════════════════════════ */

body:not(.page-admin) {
  --main-bg: #f9fafb;
  --main-surface: #ffffff;
  --main-surface-soft: #f6f7f9;
  --text: #333333;
  --text-soft: #4b5563;
  --text-muted: #7b8494;
  --primary: #4f74a8;
  --primary-dark: #3f628f;
  --primary-light: #6f8fba;
  --primary-soft: rgba(79, 116, 168, 0.08);
  --primary-glow: rgba(79, 116, 168, 0.10);
  --sidebar-bg: #111827;
  --sidebar-surface: #1f2937;
  --sidebar-text: #a7b0bf;
  --sidebar-text-hover: #f3f4f6;
  --sidebar-text-active: #d9e5f6;
  --sidebar-accent: #6f8fba;
  --sidebar-accent-glow: rgba(111, 143, 186, 0.13);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --line: #e5e7eb;
  --line-strong: #dfe3e8;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-elevated: 0 6px 18px rgba(15, 23, 42, 0.07);
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  font-family: Inter, "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  font-weight: 400;
  background: var(--main-bg);
}

body:not(.page-admin) * {
  letter-spacing: 0;
}

body:not(.page-admin) .main-area {
  padding: clamp(24px, 3.4vw, 42px) clamp(24px, 4vw, 48px);
  background: var(--main-bg);
}

body.page-embed .main-area {
  margin-left: 0;
  padding: 0;
  min-height: 100dvh;
}

body.page-embed main {
  margin: 0;
}

body:not(.page-admin) main,
body:not(.page-admin) .form,
body:not(.page-admin) .card-v3-body,
body:not(.page-admin) .record-dialog-body {
  gap: clamp(14px, 1.8vw, 22px);
}

body:not(.page-admin) .grid-2,
body:not(.page-admin) .grid-3,
body:not(.page-admin) .grid-4,
body:not(.page-admin) .grid-auto {
  gap: clamp(22px, 2.8vw, 34px);
}

body:not(.page-admin) .page-hd {
  gap: clamp(18px, 2.3vw, 28px);
  margin-bottom: clamp(24px, 3vw, 38px);
}

body:not(.page-admin) .page-hd p {
  font-size: clamp(10px, 1.1vw, 12px);
  font-weight: 400;
}

body:not(.page-admin) .page-hd h1 {
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 500;
  color: #333;
}

body:not(.page-admin) .page-hd-actions {
  gap: clamp(12px, 1.5vw, 18px);
}

body:not(.page-admin) .sidebar-logo,
body:not(.page-admin) .sidebar-user-avatar {
  background: var(--primary);
  box-shadow: none;
}

body:not(.page-admin) .sidebar-logo {
  width: clamp(30px, 3.2vw, 36px);
  height: clamp(30px, 3.2vw, 36px);
}

body:not(.page-admin) .sidebar-brand-text h1,
body:not(.page-admin) .sidebar-user-info strong {
  font-weight: 500;
}

body:not(.page-admin) .sidebar-brand-text small,
body:not(.page-admin) .sidebar-user-info span,
body:not(.page-admin) .sidebar-balance,
body:not(.page-admin) .sidebar-action-btn,
body:not(.page-admin) .sidebar-nav-item,
body:not(.page-admin) .sidebar-nav-section {
  font-weight: 400;
}

body:not(.page-admin) .sidebar-nav {
  gap: 5px;
  padding: 14px;
}

body:not(.page-admin) .sidebar-nav-item {
  padding: 10px 11px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

body:not(.page-admin) .sidebar-nav-item.active {
  box-shadow: inset 2px 0 0 var(--sidebar-accent);
}

body:not(.page-admin) .sidebar-nav-item.is-agent-hub,
body:not(.page-admin) .sidebar-nav-item.is-agent-hub:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-accent-glow);
  border-color: var(--sidebar-border);
}

body:not(.page-admin) .sidebar-nav-item svg,
body:not(.page-admin) .sidebar-action-btn svg,
body:not(.page-admin) .btn svg,
body:not(.page-admin) .button svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.75;
}

body:not(.page-admin) .sidebar-nav-item .nav-badge {
  min-height: 17px;
  padding: 0 5px;
  font-size: 9px;
  font-weight: 500;
  background: rgba(111, 143, 186, 0.16);
  color: #d9e5f6;
}

body:not(.page-admin) .card-v3,
body:not(.page-admin) .media-card,
body:not(.page-admin) .record-dialog-panel,
body:not(.page-admin) .package-card,
body:not(.page-admin) .credits-item,
body:not(.page-admin) .canvas-project-card,
body:not(.page-admin) .canvas-preset-card,
body:not(.page-admin) .canvas-task-card {
  border: 1px solid var(--line);
  background: var(--main-surface);
  box-shadow: var(--shadow-card);
}

body:not(.page-admin) .card-v3:hover,
body:not(.page-admin) .media-card:hover,
body:not(.page-admin) .package-card:hover,
body:not(.page-admin) .canvas-project-card:hover,
body:not(.page-admin) .canvas-project-card.active,
body:not(.page-admin) .canvas-preset-card:hover,
body:not(.page-admin) .canvas-task-card:hover {
  border-color: #d7dde5;
  box-shadow: var(--shadow-lg);
}

body:not(.page-admin) .media-card::after,
body:not(.page-admin) .media-card:hover::after {
  display: none;
}

body:not(.page-admin) .card-v3-head {
  min-height: 40px;
  padding: clamp(13px, 1.7vw, 18px) clamp(18px, 2.4vw, 28px);
}

body:not(.page-admin) .card-v3-head h3 {
  font-size: clamp(14px, 1.5vw, 17px);
  font-weight: 500;
}

body:not(.page-admin) .card-v3-head .eyebrow,
body:not(.page-admin) .card-v3-head .sub {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
}

body:not(.page-admin) .card-v3-body {
  padding: clamp(20px, 2.8vw, 32px);
}

body:not(.page-admin) .field-v3 {
  gap: 7px;
  margin-bottom: clamp(14px, 1.9vw, 22px);
}

body:not(.page-admin) .field-v3 > label,
body:not(.page-admin) .field-v3 > span,
body:not(.page-admin) .compact-param-field > label {
  font-size: 11px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--text-muted);
}

body:not(.page-admin) input[type="text"],
body:not(.page-admin) input[type="password"],
body:not(.page-admin) input[type="email"],
body:not(.page-admin) input[type="number"],
body:not(.page-admin) input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
body:not(.page-admin) select,
body:not(.page-admin) textarea,
body:not(.page-admin) .canvas-project-titlebox input,
body:not(.page-admin) .canvas-node-provider input,
body:not(.page-admin) .canvas-node-provider select,
body:not(.page-admin) .canvas-node-provider textarea,
body:not(.page-admin) .designer-inspector-field input,
body:not(.page-admin) .designer-inspector-field select,
body:not(.page-admin) .designer-inspector-field textarea {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  box-shadow: none;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
}

body:not(.page-admin) input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
body:not(.page-admin) input[type="text"],
body:not(.page-admin) input[type="password"],
body:not(.page-admin) input[type="email"],
body:not(.page-admin) input[type="number"],
body:not(.page-admin) select {
  height: 36px;
  min-height: 36px;
  padding: 0 11px;
}

body:not(.page-admin) textarea {
  min-height: 108px;
  padding: 10px 12px;
  line-height: 1.65;
}

body:not(.page-admin) input:hover,
body:not(.page-admin) select:hover,
body:not(.page-admin) textarea:hover {
  border-color: #d1d5db;
}

body:not(.page-admin) input:focus,
body:not(.page-admin) select:focus,
body:not(.page-admin) textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

body:not(.page-admin) .btn,
body:not(.page-admin) .button,
body:not(.page-admin) .btn-primary,
body:not(.page-admin) .btn-secondary,
body:not(.page-admin) .btn-ghost {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 400;
}

body:not(.page-admin) .btn-sm,
body:not(.page-admin) .btn.sm,
body:not(.page-admin) .button.small {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

body:not(.page-admin) .btn-lg,
body:not(.page-admin) .btn.lg {
  min-height: 40px;
  padding: 0 18px;
  font-size: 14px;
}

body:not(.page-admin) .btn::after,
body:not(.page-admin) .button::after {
  display: none;
}

body:not(.page-admin) .btn-primary,
body:not(.page-admin) .btn.primary,
body:not(.page-admin) .button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

body:not(.page-admin) .btn-primary:hover,
body:not(.page-admin) .btn.primary:hover,
body:not(.page-admin) .button.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

body:not(.page-admin) .btn-secondary,
body:not(.page-admin) .btn.secondary,
body:not(.page-admin) .button.secondary,
body:not(.page-admin) .btn-ghost,
body:not(.page-admin) .btn.ghost {
  background: #fff;
  color: var(--text-soft);
}

body:not(.page-admin) .btn-secondary:hover,
body:not(.page-admin) .btn.secondary:hover,
body:not(.page-admin) .button.secondary:hover,
body:not(.page-admin) .btn-ghost:hover,
body:not(.page-admin) .btn.ghost:hover {
  border-color: #d1d5db;
  background: var(--main-surface-soft);
  color: var(--text);
  box-shadow: none;
}

body:not(.page-admin) .mode-toggle,
body:not(.page-admin) .video-reference-modes,
body:not(.page-admin) .chip-group,
body:not(.page-admin) .compact-param-row,
body:not(.page-admin) .generate-actions {
  gap: clamp(10px, 1.3vw, 16px);
}

body:not(.page-admin) .mode-toggle label,
body:not(.page-admin) .video-reference-modes label,
body:not(.page-admin) .chip-group label,
body:not(.page-admin) .pay-type-item {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 400;
  box-shadow: none;
}

body:not(.page-admin) .mode-toggle label:has(input:checked),
body:not(.page-admin) .video-reference-modes label:has(input:checked),
body:not(.page-admin) .chip-group label:has(input:checked),
body:not(.page-admin) .pay-type-item:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: none;
}

body:not(.page-admin) .edit-upload-box {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  background: #fff;
}

body:not(.page-admin) .edit-upload-box:hover {
  border-color: #d1d5db;
  background: var(--main-surface-soft);
  box-shadow: none;
}

body:not(.page-admin) .edit-upload-icon,
body:not(.page-admin) .video-reference-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: none;
  font-size: 14px;
}

body:not(.page-admin) .edit-upload-box strong,
body:not(.page-admin) .media-card-body .prompt,
body:not(.page-admin) .media-card .prompt {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
}

body:not(.page-admin) .edit-upload-box small,
body:not(.page-admin) .field-hint,
body:not(.page-admin) .hint,
body:not(.page-admin) .media-card-body .meta,
body:not(.page-admin) .media-card .meta {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-muted);
}

body:not(.page-admin) .edit-upload-preview {
  gap: 10px;
}

body:not(.page-admin) .edit-preview-item {
  border: 1px solid var(--line);
  border-radius: 9px;
}

body:not(.page-admin) .compact-param-field select,
body:not(.page-admin) .compact-param-field input[type="text"],
body:not(.page-admin) .compact-param-field input[type="number"] {
  height: 32px;
  min-height: 32px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}

body:not(.page-admin) .cost-hint,
body:not(.page-admin) .generation-notice,
body:not(.page-admin) .alert,
body:not(.page-admin) .badge-balance,
body:not(.page-admin) .canvas-project-save-state {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-xs);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 400;
}

body:not(.page-admin) .badge-balance {
  padding: 7px 12px;
}

body:not(.page-admin) .badge-balance .num {
  font-size: 16px;
  font-weight: 500;
}

body:not(.page-admin) .badge-balance .label {
  font-size: 11px;
  font-weight: 400;
}

body:not(.page-admin) .record-dialog-panel {
  border-radius: 12px;
}

body:not(.page-admin) .record-dialog-head,
body:not(.page-admin) .record-dialog-foot {
  padding: 14px 18px;
  border-color: var(--line);
}

body:not(.page-admin) .record-dialog-body {
  padding: 20px;
}

body:not(.page-admin) .record-dialog-head h2 {
  font-size: 17px;
  font-weight: 500;
}

body:not(.page-admin) .record-dialog-close,
body:not(.page-admin) .record-action-trigger {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  box-shadow: none;
}

body:not(.page-admin) .media-card {
  border-radius: 10px;
}

body:not(.page-admin) .media-card-body {
  padding: 12px;
}

body:not(.page-admin) .status-badge,
body:not(.page-admin) .nav-badge {
  font-weight: 400;
}

body:not(.page-admin) .jpt-toast,
body:not(.page-admin) .jpt-layer-panel {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

/* ═══════════════════════════════════════
   THEME MODES + COMPACT MEDIA LISTS
   ═══════════════════════════════════════ */

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="chinese"] {
  color-scheme: light;
}

html[data-theme="light"] body:not(.page-admin) {
  --main-bg: #f9fafb;
  --main-surface: #ffffff;
  --main-surface-soft: #f4f6f8;
  --text: #333333;
  --text-soft: #4b5563;
  --text-muted: #7b8494;
  --primary: #4f74a8;
  --primary-dark: #3f628f;
  --primary-light: #6f8fba;
  --primary-soft: rgba(79, 116, 168, 0.08);
  --primary-glow: rgba(79, 116, 168, 0.10);
  --panel-bg: #ffffff;
  --panel-muted: #f3f4f6;
  --panel-inset: #f7f8fa;
  --notice-bg: #eef3f8;
  --notice-border: #d8e1ec;
  --line: #e5e7eb;
  --line-strong: #dfe3e8;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 22px rgba(15, 23, 42, 0.07);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04);
  background: var(--main-bg);
}

html[data-theme="dark"] body:not(.page-admin) {
  --main-bg: #0b111d;
  --main-surface: #111827;
  --main-surface-soft: #172033;
  --text: #e5e7eb;
  --text-soft: #c3cad6;
  --text-muted: #8792a3;
  --primary: #83a7d8;
  --primary-dark: #a8c2e8;
  --primary-light: #bfd4f0;
  --primary-soft: rgba(131, 167, 216, 0.13);
  --primary-glow: rgba(131, 167, 216, 0.18);
  --panel-bg: #111827;
  --panel-muted: #172033;
  --panel-inset: #0d1422;
  --notice-bg: #172236;
  --notice-border: #2c3a52;
  --sidebar-bg: #080d16;
  --sidebar-surface: #101827;
  --sidebar-text: #9da8ba;
  --sidebar-text-hover: #eef2f7;
  --sidebar-text-active: #d7e7ff;
  --sidebar-accent: #9ab8e2;
  --sidebar-accent-glow: rgba(154, 184, 226, 0.14);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --line: #273244;
  --line-strong: #344155;
  --success-soft: rgba(16, 185, 129, 0.14);
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger-soft: rgba(239, 68, 68, 0.15);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.20);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.32);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03), 0 12px 28px rgba(0, 0, 0, 0.22);
  background:
    radial-gradient(circle at 18% 6%, rgba(131, 167, 216, 0.10), transparent 28%),
    radial-gradient(circle at 90% 20%, rgba(65, 88, 128, 0.12), transparent 26%),
    var(--main-bg);
}

html[data-theme="chinese"] body:not(.page-admin) {
  --main-bg: #f7f1e6;
  --main-surface: #fffaf0;
  --main-surface-soft: #f3eadb;
  --text: #2f3433;
  --text-soft: #5a5148;
  --text-muted: #8a7b68;
  --primary: #b84a3a;
  --primary-dark: #8f3429;
  --primary-light: #cf7d69;
  --primary-soft: rgba(184, 74, 58, 0.10);
  --primary-glow: rgba(184, 74, 58, 0.14);
  --panel-bg: #fffaf0;
  --panel-muted: #f3eadb;
  --panel-inset: #f8efe0;
  --notice-bg: #f5e4d8;
  --notice-border: #e2c4a9;
  --sidebar-bg: #211d19;
  --sidebar-surface: #302820;
  --sidebar-text: #c8bbaa;
  --sidebar-text-hover: #fffaf0;
  --sidebar-text-active: #fff2df;
  --sidebar-accent: #d7aa62;
  --sidebar-accent-glow: rgba(215, 170, 98, 0.14);
  --sidebar-border: rgba(255, 250, 240, 0.10);
  --line: #e2d6c4;
  --line-strong: #cdbca5;
  --shadow-xs: 0 1px 2px rgba(61, 43, 31, 0.04);
  --shadow-sm: 0 2px 7px rgba(61, 43, 31, 0.07);
  --shadow: 0 8px 22px rgba(61, 43, 31, 0.08);
  --shadow-lg: 0 16px 38px rgba(61, 43, 31, 0.11);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.72), 0 10px 24px rgba(61, 43, 31, 0.07);
  background: var(--main-bg);
}

html[data-theme] body:not(.page-admin)::before,
html[data-theme] body:not(.page-admin)::after {
  display: none;
}

html[data-theme] body:not(.page-admin) .main-area {
  background: var(--main-bg);
}

html[data-theme] body:not(.page-admin) .sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow-sm);
}

html[data-theme] body:not(.page-admin) .sidebar-header,
html[data-theme] body:not(.page-admin) .sidebar-footer {
  background: transparent;
}

html[data-theme] body:not(.page-admin) .sidebar-logo,
html[data-theme] body:not(.page-admin) .sidebar-user-avatar {
  background: var(--primary);
  color: #fff;
}

html[data-theme="dark"] body:not(.page-admin) .sidebar-logo,
html[data-theme="dark"] body:not(.page-admin) .sidebar-user-avatar {
  color: #0b111d;
}

html[data-theme] body:not(.page-admin) .sidebar-action-btn.theme-toggle {
  border: 1px solid var(--sidebar-border);
  background: rgba(255, 255, 255, 0.04);
  font-family: inherit;
  cursor: pointer;
}

html[data-theme] body:not(.page-admin) .theme-picker {
  position: relative;
  flex: 1;
  min-width: 0;
}

html[data-theme] body:not(.page-admin) .theme-picker .theme-toggle {
  width: 100%;
}

html[data-theme] body:not(.page-admin) .theme-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: none;
  padding: 6px;
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  background: var(--sidebar-surface);
  box-shadow: var(--shadow-lg);
}

html[data-theme] body:not(.page-admin) .theme-picker.is-open .theme-menu {
  display: grid;
  gap: 4px;
}

html[data-theme] body:not(.page-admin) .theme-menu button {
  width: 100%;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

html[data-theme] body:not(.page-admin) .theme-menu button:hover,
html[data-theme] body:not(.page-admin) .theme-menu button.is-active {
  border-color: var(--sidebar-border);
  background: var(--sidebar-accent-glow);
  color: var(--sidebar-text-hover);
}

html[data-theme] body:not(.page-admin) .theme-icon-dark,
html[data-theme] body:not(.page-admin) .theme-icon-chinese,
html[data-theme="dark"] body:not(.page-admin) .theme-icon-light,
html[data-theme="chinese"] body:not(.page-admin) .theme-icon-light {
  display: none;
}

html[data-theme="dark"] body:not(.page-admin) .theme-icon-dark {
  display: block;
}

html[data-theme="chinese"] body:not(.page-admin) .theme-icon-chinese {
  display: block;
}

html[data-theme] body:not(.page-admin) .page-hd,
html[data-theme] body:not(.page-admin) .card-v3,
html[data-theme] body:not(.page-admin) .media-card,
html[data-theme] body:not(.page-admin) .record-dialog-panel,
html[data-theme] body:not(.page-admin) .redeem-panel,
html[data-theme] body:not(.page-admin) .jpt-layer-panel,
html[data-theme] body:not(.page-admin) .jpt-toast,
html[data-theme] body:not(.page-admin) .canvas-panel,
html[data-theme] body:not(.page-admin) .chat-main,
html[data-theme] body:not(.page-admin) .package-card,
html[data-theme] body:not(.page-admin) .credits-item,
html[data-theme] body:not(.page-admin) .stat-card,
html[data-theme] body:not(.page-admin) .empty-state,
html[data-theme] body:not(.page-admin) .table-wrap {
  border: 1px solid var(--line);
  background: var(--main-surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

html[data-theme="dark"] body:not(.page-admin) .page-hd,
html[data-theme="dark"] body:not(.page-admin) .card-v3,
html[data-theme="dark"] body:not(.page-admin) .media-card,
html[data-theme="dark"] body:not(.page-admin) .record-dialog-panel,
html[data-theme="dark"] body:not(.page-admin) .redeem-panel,
html[data-theme="dark"] body:not(.page-admin) .jpt-layer-panel,
html[data-theme="dark"] body:not(.page-admin) .jpt-toast,
html[data-theme="dark"] body:not(.page-admin) .canvas-panel,
html[data-theme="dark"] body:not(.page-admin) .chat-main,
html[data-theme="dark"] body:not(.page-admin) .package-card,
html[data-theme="dark"] body:not(.page-admin) .credits-item,
html[data-theme="dark"] body:not(.page-admin) .stat-card,
html[data-theme="dark"] body:not(.page-admin) .empty-state,
html[data-theme="dark"] body:not(.page-admin) .table-wrap {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.018)), var(--main-surface);
}

html[data-theme] body:not(.page-admin) .card-v3-head,
html[data-theme] body:not(.page-admin) .record-dialog-head,
html[data-theme] body:not(.page-admin) .record-dialog-foot,
html[data-theme] body:not(.page-admin) .redeem-head {
  border-color: var(--line);
  background: var(--panel-muted);
}

html[data-theme] body:not(.page-admin) .record-dialog-body,
html[data-theme] body:not(.page-admin) .redeem-form,
html[data-theme] body:not(.page-admin) .jpt-layer-head,
html[data-theme] body:not(.page-admin) .jpt-layer-actions {
  background: var(--panel-bg);
}

html[data-theme] body:not(.page-admin) .record-full-prompt,
html[data-theme] body:not(.page-admin) .record-detail-grid > div,
html[data-theme] body:not(.page-admin) .record-error,
html[data-theme] body:not(.page-admin) .record-dialog-image,
html[data-theme] body:not(.page-admin) .error-dialog-body,
html[data-theme] body:not(.page-admin) .jpt-layer-panel p,
html[data-theme] body:not(.page-admin) .redeem-form .field,
html[data-theme] body:not(.page-admin) .content-slot,
html[data-theme] body:not(.page-admin) .history-empty-inline {
  border: 1px solid var(--line);
  background: var(--panel-inset);
  color: var(--text-soft);
}

html[data-theme] body:not(.page-admin) .alert,
html[data-theme] body:not(.page-admin) .generation-notice,
html[data-theme] body:not(.page-admin) .cost-hint,
html[data-theme] body:not(.page-admin) .field-hint:not(.hidden),
html[data-theme] body:not(.page-admin) .hint:not(.hidden),
html[data-theme] body:not(.page-admin) .canvas-project-save-state,
html[data-theme] body:not(.page-admin) .jpt-toast {
  border: 1px solid var(--notice-border);
  background: var(--notice-bg);
  color: var(--text-soft);
}

html[data-theme] body:not(.page-admin) .record-action-dropdown,
html[data-theme] body:not(.page-admin) .record-action-dropdown button,
html[data-theme] body:not(.page-admin) .record-action-dropdown a {
  border-color: var(--line);
  background: var(--panel-bg);
  color: var(--text-soft);
}

html[data-theme] body:not(.page-admin) .record-action-dropdown button:hover,
html[data-theme] body:not(.page-admin) .record-action-dropdown a:hover {
  background: var(--panel-muted);
  color: var(--text);
}

html[data-theme] body:not(.page-admin) .media-card-body,
html[data-theme] body:not(.page-admin) #audioHistoryList .media-card > div:first-child,
html[data-theme] body.page-app:not(.page-admin) #historyList .media-card > div:first-child,
html[data-theme] body:not(.page-admin) #videoHistoryList .media-card > div:first-child {
  background: var(--panel-inset) !important;
}

html[data-theme] body:not(.page-admin) .media-card > img,
html[data-theme] body:not(.page-admin) .media-card > video {
  background-color: var(--panel-muted);
}

html[data-theme] body:not(.page-admin) .record-detail-grid {
  gap: 10px;
}

html[data-theme] body:not(.page-admin) .record-detail-grid > div strong,
html[data-theme] body:not(.page-admin) .record-full-prompt p {
  color: var(--text);
}

html[data-theme] body:not(.page-admin) .record-full-prompt > span,
html[data-theme] body:not(.page-admin) .record-detail-grid > div span {
  color: var(--text-muted);
}

html[data-theme] body:not(.page-admin) .page-hd h1,
html[data-theme] body:not(.page-admin) .card-v3-head h3,
html[data-theme] body:not(.page-admin) .media-card .prompt,
html[data-theme] body:not(.page-admin) .media-card-body .prompt,
html[data-theme] body:not(.page-admin) .record-dialog-head h2,
html[data-theme] body:not(.page-admin) .edit-upload-box strong {
  color: var(--text);
}

html[data-theme] body:not(.page-admin) .page-hd p,
html[data-theme] body:not(.page-admin) .card-v3-head .sub,
html[data-theme] body:not(.page-admin) .card-v3-head .eyebrow,
html[data-theme] body:not(.page-admin) .media-card .meta,
html[data-theme] body:not(.page-admin) .media-card-body .meta,
html[data-theme] body:not(.page-admin) .field-hint,
html[data-theme] body:not(.page-admin) .hint {
  color: var(--text-muted);
}

html[data-theme] body:not(.page-admin) input[type="text"],
html[data-theme] body:not(.page-admin) input[type="password"],
html[data-theme] body:not(.page-admin) input[type="email"],
html[data-theme] body:not(.page-admin) input[type="number"],
html[data-theme] body:not(.page-admin) input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
html[data-theme] body:not(.page-admin) select,
html[data-theme] body:not(.page-admin) textarea,
html[data-theme] body:not(.page-admin) .edit-upload-box,
html[data-theme] body:not(.page-admin) .video-reference-modes,
html[data-theme] body:not(.page-admin) .mode-toggle label,
html[data-theme] body:not(.page-admin) .video-reference-modes label,
html[data-theme] body:not(.page-admin) .chip-group label,
html[data-theme] body:not(.page-admin) .cost-hint,
html[data-theme] body:not(.page-admin) .generation-notice,
html[data-theme] body:not(.page-admin) .alert,
html[data-theme] body:not(.page-admin) .badge-balance,
html[data-theme] body:not(.page-admin) .record-dialog-close,
html[data-theme] body:not(.page-admin) .record-action-trigger {
  border: 1px solid var(--line);
  background: var(--panel-bg);
  color: var(--text);
  box-shadow: none;
}

html[data-theme] body:not(.page-admin) .edit-upload-box,
html[data-theme] body:not(.page-admin) .video-reference-modes,
html[data-theme] body:not(.page-admin) .mode-toggle label,
html[data-theme] body:not(.page-admin) .video-reference-modes label,
html[data-theme] body:not(.page-admin) .chip-group label {
  background: var(--panel-inset);
}

html[data-theme] body:not(.page-admin) textarea,
html[data-theme] body:not(.page-admin) input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
html[data-theme] body:not(.page-admin) select {
  background: var(--panel-bg);
}

html[data-theme] body:not(.page-admin) input:focus,
html[data-theme] body:not(.page-admin) select:focus,
html[data-theme] body:not(.page-admin) textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

html[data-theme] body:not(.page-admin) .mode-toggle label:has(input:checked),
html[data-theme] body:not(.page-admin) .video-reference-modes label:has(input:checked),
html[data-theme] body:not(.page-admin) .chip-group label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

html[data-theme] body:not(.page-admin) .btn-primary,
html[data-theme] body:not(.page-admin) .btn.primary,
html[data-theme] body:not(.page-admin) .button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

html[data-theme="dark"] body:not(.page-admin) .btn-primary,
html[data-theme="dark"] body:not(.page-admin) .btn.primary,
html[data-theme="dark"] body:not(.page-admin) .button.primary {
  color: #0b111d;
}

html[data-theme] body:not(.page-admin) .btn-secondary,
html[data-theme] body:not(.page-admin) .btn.secondary,
html[data-theme] body:not(.page-admin) .button.secondary,
html[data-theme] body:not(.page-admin) .btn-ghost,
html[data-theme] body:not(.page-admin) .btn.ghost {
  border-color: var(--line);
  background: var(--main-surface);
  color: var(--text-soft);
}

html[data-theme] body:not(.page-admin) .btn-secondary:hover,
html[data-theme] body:not(.page-admin) .btn.secondary:hover,
html[data-theme] body:not(.page-admin) .button.secondary:hover,
html[data-theme] body:not(.page-admin) .btn-ghost:hover,
html[data-theme] body:not(.page-admin) .btn.ghost:hover,
html[data-theme] body:not(.page-admin) .edit-upload-box:hover {
  border-color: var(--line-strong);
  background: var(--main-surface-soft);
  color: var(--text);
}

html[data-theme] body.page-app:not(.page-admin) #historyList.grid-auto,
html[data-theme] body:not(.page-admin) #videoHistoryList.grid-auto,
html[data-theme] body:not(.page-admin) #audioHistoryList.grid-auto {
  grid-template-columns: 1fr;
  gap: 12px;
}

html[data-theme] body.page-app:not(.page-admin) .grid-2:has(#historyList),
html[data-theme] body.page-video:not(.page-admin) .grid-2:has(#videoHistoryList),
html[data-theme] body.page-audio:not(.page-admin) .grid-2:has(#audioHistoryList) {
  grid-template-columns: minmax(0, 1fr) clamp(260px, 28vw, 340px);
  align-items: start;
}

html[data-theme] body.page-app:not(.page-admin) .grid-2:has(#historyList) > section:last-child,
html[data-theme] body.page-video:not(.page-admin) .grid-2:has(#videoHistoryList) > section:last-child,
html[data-theme] body.page-audio:not(.page-admin) .grid-2:has(#audioHistoryList) > section:last-child {
  width: 100%;
}

html[data-theme] body.page-app:not(.page-admin) #historyList .media-card,
html[data-theme] body:not(.page-admin) #videoHistoryList .media-card,
html[data-theme] body:not(.page-admin) #audioHistoryList .media-card {
  width: 100%;
  display: grid;
  grid-template-columns: clamp(112px, 38%, 160px) minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
}

html[data-theme] body.page-app:not(.page-admin) #historyList .media-card > img,
html[data-theme] body.page-app:not(.page-admin) #historyList .media-card > video,
html[data-theme] body.page-app:not(.page-admin) #historyList .media-card > div:first-child,
html[data-theme] body:not(.page-admin) #videoHistoryList .media-card > video,
html[data-theme] body:not(.page-admin) #audioHistoryList .media-card > div:first-child,
html[data-theme] body:not(.page-admin) #videoHistoryList .media-card > div:first-child {
  width: 100%;
  height: 100%;
  min-height: 112px;
  max-height: 160px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-right: 1px solid var(--line);
  background: var(--main-surface-soft) !important;
}

html[data-theme] body:not(.page-admin) #audioHistoryList .media-card > div:first-child {
  padding: 12px !important;
  align-content: center;
}

html[data-theme] body:not(.page-admin) #audioHistoryList .media-card audio {
  width: 100%;
  min-width: 0;
}

html[data-theme] body.page-app:not(.page-admin) #historyList .media-card-body,
html[data-theme] body:not(.page-admin) #videoHistoryList .media-card-body,
html[data-theme] body:not(.page-admin) #audioHistoryList .media-card-body {
  min-width: 0;
  padding: 10px 12px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

html[data-theme] body.page-app:not(.page-admin) #historyList .media-card .prompt,
html[data-theme] body:not(.page-admin) #videoHistoryList .media-card .prompt,
html[data-theme] body:not(.page-admin) #audioHistoryList .media-card .prompt {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

html[data-theme] body.page-app:not(.page-admin) #historyList .media-card .meta,
html[data-theme] body:not(.page-admin) #videoHistoryList .media-card .meta,
html[data-theme] body:not(.page-admin) #audioHistoryList .media-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 560px) {
  html[data-theme] body.page-app:not(.page-admin) #historyList .media-card,
  html[data-theme] body:not(.page-admin) #videoHistoryList .media-card,
  html[data-theme] body:not(.page-admin) #audioHistoryList .media-card {
    grid-template-columns: 104px minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  html[data-theme] body.page-app:not(.page-admin) .grid-2:has(#historyList),
  html[data-theme] body.page-video:not(.page-admin) .grid-2:has(#videoHistoryList),
  html[data-theme] body.page-audio:not(.page-admin) .grid-2:has(#audioHistoryList) {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════
   NEW CHINESE VISUAL DETAILS
   ═══════════════════════════════════════ */

html[data-theme="chinese"] body:not(.page-admin) {
  --cn-red: #b84a3a;
  --cn-red-soft: rgba(184, 74, 58, 0.10);
  --cn-gold: #a77832;
  --cn-ink: #2f3433;
  --cn-paper-line: rgba(93, 76, 58, 0.08);
  --cn-corner: rgba(184, 74, 58, 0.42);
}

html[data-theme="chinese"] body:not(.page-admin) .main-area {
  background:
    linear-gradient(90deg, var(--cn-paper-line) 1px, transparent 1px),
    linear-gradient(var(--cn-paper-line) 1px, transparent 1px),
    var(--main-bg);
  background-size: 28px 28px;
}

html[data-theme="chinese"] body:not(.page-admin) .page-hd,
html[data-theme="chinese"] body:not(.page-admin) .card-v3,
html[data-theme="chinese"] body:not(.page-admin) .media-card,
html[data-theme="chinese"] body:not(.page-admin) .record-dialog-panel,
html[data-theme="chinese"] body:not(.page-admin) .redeem-panel {
  position: relative;
  border-color: color-mix(in srgb, var(--line) 74%, var(--cn-gold));
}

html[data-theme="chinese"] body:not(.page-admin) .page-hd::before,
html[data-theme="chinese"] body:not(.page-admin) .card-v3::before,
html[data-theme="chinese"] body:not(.page-admin) .record-dialog-panel::before,
html[data-theme="chinese"] body:not(.page-admin) .redeem-panel::before {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0.72;
  background:
    linear-gradient(var(--cn-corner), var(--cn-corner)) top right / 16px 1px no-repeat,
    linear-gradient(var(--cn-corner), var(--cn-corner)) top right / 1px 16px no-repeat,
    linear-gradient(var(--cn-corner), var(--cn-corner)) bottom left / 12px 1px no-repeat,
    linear-gradient(var(--cn-corner), var(--cn-corner)) bottom left / 1px 12px no-repeat;
}

html[data-theme="chinese"] body:not(.page-admin) .page-hd::after {
  content: "创";
  position: absolute;
  right: clamp(24px, 3vw, 36px);
  bottom: clamp(18px, 2.4vw, 28px);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cn-red);
  border-radius: 6px;
  color: var(--cn-red);
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 17px;
  line-height: 1;
  opacity: 0.42;
  transform: rotate(-5deg);
  pointer-events: none;
}

html[data-theme="chinese"] body:not(.page-admin) .card-v3-head {
  background:
    linear-gradient(90deg, var(--cn-red-soft), transparent 42%),
    var(--main-surface);
}

html[data-theme="chinese"] body:not(.page-admin) .card-v3-head h3,
html[data-theme="chinese"] body:not(.page-admin) .page-hd h1,
html[data-theme="chinese"] body:not(.page-admin) .record-dialog-head h2 {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "PingFang SC", serif;
  color: var(--cn-ink);
}

html[data-theme="chinese"] body:not(.page-admin) .card-v3-head h3::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1em;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--cn-red);
  vertical-align: -0.12em;
}

html[data-theme="chinese"] body:not(.page-admin) .card-v3-head .sub,
html[data-theme="chinese"] body:not(.page-admin) .card-v3-head .eyebrow,
html[data-theme="chinese"] body:not(.page-admin) .page-hd p {
  color: color-mix(in srgb, var(--text-muted) 72%, var(--cn-red));
}

html[data-theme="chinese"] body:not(.page-admin) .btn-primary,
html[data-theme="chinese"] body:not(.page-admin) .btn.primary,
html[data-theme="chinese"] body:not(.page-admin) .button.primary {
  border-color: var(--cn-red);
  background: var(--cn-red);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), var(--shadow-sm);
}

html[data-theme="chinese"] body:not(.page-admin) .btn-primary:hover,
html[data-theme="chinese"] body:not(.page-admin) .btn.primary:hover,
html[data-theme="chinese"] body:not(.page-admin) .button.primary:hover {
  border-color: color-mix(in srgb, var(--cn-red) 82%, #000);
  background: color-mix(in srgb, var(--cn-red) 88%, #000);
}

html[data-theme="chinese"] body:not(.page-admin) .btn-primary,
html[data-theme="chinese"] body:not(.page-admin) .btn.primary,
html[data-theme="chinese"] body:not(.page-admin) .button.primary {
  color: #fff8f0;
}

html[data-theme="chinese"] body:not(.page-admin) input:focus,
html[data-theme="chinese"] body:not(.page-admin) select:focus,
html[data-theme="chinese"] body:not(.page-admin) textarea:focus,
html[data-theme="chinese"] body:not(.page-admin) .mode-toggle label:has(input:checked),
html[data-theme="chinese"] body:not(.page-admin) .video-reference-modes label:has(input:checked),
html[data-theme="chinese"] body:not(.page-admin) .chip-group label:has(input:checked) {
  border-color: var(--cn-red);
  box-shadow: 0 0 0 3px var(--cn-red-soft);
}

html[data-theme="chinese"] body:not(.page-admin) .mode-toggle label:has(input:checked),
html[data-theme="chinese"] body:not(.page-admin) .video-reference-modes label:has(input:checked),
html[data-theme="chinese"] body:not(.page-admin) .chip-group label:has(input:checked) {
  background: var(--cn-red-soft);
  color: color-mix(in srgb, var(--cn-red) 84%, var(--text));
}

html[data-theme="chinese"] body:not(.page-admin) .sidebar-nav-item.active {
  color: var(--sidebar-text-hover);
  box-shadow: inset 2px 0 0 var(--cn-red);
}

html[data-theme="chinese"] body:not(.page-admin) .sidebar-nav-item.active::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--cn-red);
  transform: rotate(45deg);
  box-shadow: 0 0 0 3px var(--cn-red-soft);
}

html[data-theme="chinese"] body:not(.page-admin) .badge-balance .num,
html[data-theme="chinese"] body:not(.page-admin) .cost-hint strong,
html[data-theme="chinese"] body:not(.page-admin) .sidebar-balance strong {
  color: var(--cn-red);
}

html[data-theme="chinese"] body:not(.page-admin) .edit-upload-icon,
html[data-theme="chinese"] body:not(.page-admin) .video-reference-icon,
html[data-theme="chinese"] body:not(.page-admin) .status-badge.succeeded {
  background: var(--cn-red-soft);
  color: var(--cn-red);
}

html[data-theme="chinese"] body:not(.page-admin) .media-card {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    var(--shadow-card);
}

html[data-theme="chinese"] body:not(.page-admin) .media-card:hover {
  border-color: color-mix(in srgb, var(--line) 52%, var(--cn-red));
}

body:not(.page-admin) .edit-preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body:not(.page-admin) .edit-preview-item.is-audio {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 8px;
  text-align: center;
}

body:not(.page-admin) .edit-preview-media-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 22px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
}

body:not(.page-admin) .edit-preview-item.is-audio small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 10px;
}

/* Sidebar collapse and canvas workspace expansion */
body:not(.page-admin).sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

body:not(.page-admin).sidebar-collapsed .main-area,
body.page-designer-canvas.sidebar-collapsed .main-area {
  margin-left: 0;
}

body:not(.page-admin).sidebar-collapsed .sidebar-toggle {
  display: grid;
}

body.page-canvas .main-area {
  padding: 12px 14px;
}

body.page-canvas .canvas-page {
  gap: 10px;
}

body.page-canvas .page-hd {
  margin-bottom: 8px;
}

body.page-canvas .canvas-layout {
  gap: 10px;
  min-height: calc(100vh - 132px);
}

body.page-canvas .canvas-stage-wrap {
  border-width: 1px;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

body.page-canvas .canvas-toolbar {
  padding: 9px 10px;
}

body.page-canvas .canvas-stage-shell {
  min-height: calc(100vh - 190px);
}

body.page-canvas.sidebar-collapsed .canvas-layout {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

body.page-designer-canvas .designer-topbar {
  height: 54px;
  padding: 0 12px;
}

body.page-designer-canvas .main-area {
  margin-left: var(--sidebar-width);
  padding: 0;
  overflow: hidden;
  background: #05070c;
}

body.page-designer-canvas::before,
body.page-designer-canvas::after {
  display: none;
}

body.page-designer-canvas.sidebar-collapsed .main-area {
  margin-left: 0;
}

body.page-designer-canvas .designer-workbench {
  height: calc(100vh - 54px);
  height: calc(100dvh - 54px);
}

body.page-designer-canvas .designer-stage-wrap {
  border: 0;
}

body.page-app #historyList .media-card-compact,
body.page-video #videoHistoryList .media-card-compact,
body.page-audio #audioHistoryList .media-card-compact {
  display: grid;
  grid-template-columns: clamp(112px, 38%, 160px) minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: stretch;
  min-height: 112px;
  overflow: hidden;
  border-radius: 12px;
}

body.page-app #historyList .media-card-compact > .media-card-thumb,
body.page-video #videoHistoryList .media-card-compact > .media-card-thumb,
body.page-audio #audioHistoryList .media-card-compact > .media-card-thumb {
  min-width: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--main-surface-soft);
  align-self: start;
  cursor: zoom-in;
}

body.page-app #historyList .media-card-compact > .media-card-thumb > img,
body.page-app #historyList .media-card-compact > .media-card-thumb > video,
body.page-video #videoHistoryList .media-card-compact > .media-card-thumb > video,
body.page-audio #audioHistoryList .media-card-compact > .media-card-thumb > audio {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body.page-video #videoHistoryList .media-card-video-thumb {
  pointer-events: none;
}

body.page-audio #audioHistoryList .media-card-compact > .media-card-thumb {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 10px;
}

body.page-app #historyList .media-card-compact .media-card-body,
body.page-video #videoHistoryList .media-card-compact .media-card-body,
body.page-audio #audioHistoryList .media-card-compact .media-card-body {
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  min-width: 0;
}

body.page-app #historyList .media-card-compact .media-card-body .prompt,
body.page-video #videoHistoryList .media-card-compact .media-card-body .prompt,
body.page-audio #audioHistoryList .media-card-compact .media-card-body .prompt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  white-space: normal;
  line-height: 1.45;
  min-height: 3.8em;
}

/* Generation records use the same natural-height masonry cards as the home gallery. */
body.page-records .records-waterfall {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 4px;
  grid-auto-flow: row;
  gap: 12px;
  align-items: start;
}

body.page-records .records-waterfall .media-card {
  width: 100%;
  display: block;
  vertical-align: top;
  align-self: start;
  margin: 0;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(65, 45, 52, 0.08);
}

body.page-records .records-waterfall .media-card:hover {
  z-index: 1;
  border-color: rgba(255, 146, 82, 0.42);
  box-shadow: 0 16px 34px rgba(65, 45, 52, 0.15);
}

body.page-records .records-waterfall .media-card > .media-card-thumb {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: linear-gradient(145deg, rgba(255, 244, 237, 0.92), rgba(241, 245, 249, 0.9));
}

body.page-records .records-waterfall .media-card > .media-card-thumb > img,
body.page-records .records-waterfall .media-card > .media-card-thumb > video {
  width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
  display: block;
}

body.page-records .records-waterfall .media-card > .media-card-thumb:has(.status-badge) {
  min-height: 180px;
  display: grid;
  place-items: center;
}

body.page-records .records-waterfall .media-card .media-card-body {
  display: grid;
  gap: 6px;
  padding: 9px 10px 10px;
}

body.page-records .records-waterfall .media-card .prompt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  white-space: normal;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.page-records .records-waterfall .media-card .meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.35;
}

body.page-records .records-waterfall .media-card-thumb-audio {
  min-height: 150px;
  display: grid;
  place-items: center;
  padding: 18px;
}

body.page-records .records-waterfall .media-card-thumb-audio audio {
  width: 100%;
}

@media (min-width: 1700px) {
  body.page-records .records-waterfall { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  body.page-records .records-waterfall { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

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

@media (max-width: 520px) {
  body.page-records .records-waterfall { grid-template-columns: minmax(0, 1fr); }
}

body.page-app #historyList .media-card > img,
body.page-app #historyList .media-card > video,
body.page-video #videoHistoryList .media-card > video,
body.page-audio #audioHistoryList .media-card > div:first-child {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

body.page-audio #audioHistoryList .media-card > div:first-child {
  display: grid;
  align-items: center;
  justify-items: center;
  padding: 12px;
}

.media-card-summary {
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.media-card-summary time {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
}

.creation-asset-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-reference-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.compact-reference-upload .edit-upload-box {
  width: 78px;
  height: 78px;
  padding: 8px;
  flex: 0 0 78px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 4px;
  border-radius: 10px;
}

.compact-reference-upload .edit-upload-icon {
  width: 28px;
  height: 28px;
  font-size: 20px;
}

.compact-reference-upload .edit-upload-box strong {
  font-size: 12px;
  line-height: 1;
}

.compact-reference-upload .edit-upload-box small {
  display: none;
}

.compact-reference-upload .edit-upload-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 2px 0;
}

.compact-reference-upload .edit-preview-item,
.compact-reference-upload .edit-upload-preview img {
  width: 64px;
  height: 64px;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  object-fit: cover;
  flex: 0 0 64px;
}

.prompt-optimize-inline {
  margin: 0;
  align-self: center;
  flex: 0 0 auto;
}

.prompt-optimize-inline .btn {
  min-height: 42px;
  padding-inline: 18px;
}

.compact-param-row {
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 10px;
}

.compact-param-field-wide {
  min-width: 180px;
}

/* ── Home dashboard layout ── */
body.page-app {
  background: #0b1220;
}

body.page-app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--home-bg-image) center var(--home-ve-bg-y) / cover no-repeat;
  filter: blur(var(--home-bg-blur));
}

body.page-app::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.12), transparent 34%),
    linear-gradient(180deg, rgba(7,14,28,.10), rgba(255,255,255,var(--home-ve-bg-fade)) 78%, rgba(255,255,255,.42));
  pointer-events: none;
}

body.page-app .main-area {
  background:
    linear-gradient(180deg, rgba(7,14,28,.08), rgba(255,255,255,var(--home-ve-bg-fade)) 78%, rgba(255,255,255,.36)),
    var(--home-bg-image) center var(--home-ve-bg-y) / cover fixed no-repeat !important;
}

.home-dashboard {
  display: grid;
  width: min(100%, 1180px);
  margin: 0 auto;
  gap: clamp(14px, 1.6vw, 22px);
  padding-top: clamp(10px, 2vh, 24px);
}

.home-dashboard > .page-hd {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 22px;
  background: rgba(255,255,255,.34);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px rgba(15,23,42,.08);
}

.home-dashboard > .page-hd h1 {
  font-size: clamp(22px, 3.2vw, 44px);
  font-weight: 500;
  color: rgba(255,255,255,.92);
  text-shadow: 0 2px 18px rgba(15,23,42,.28);
}

.home-dashboard > .page-hd p {
  color: rgba(255,255,255,.76);
}

.home-dashboard .page-hd-actions .btn,
.home-dashboard .badge-balance {
  min-height: 36px;
  border-color: rgba(255,255,255,.42);
  background: rgba(255,255,255,.58);
  backdrop-filter: blur(12px);
}

.home-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: min(100%, 780px);
  margin: 0 auto;
  gap: 12px;
}

.home-hero-grid:has(> :only-child) {
  grid-template-columns: 1fr;
}

.home-feature-card {
  position: relative;
  min-height: 92px;
  display: grid;
  align-content: end;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 20px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  background: rgba(255,255,255,.34);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 40px rgba(15,23,42,.08);
  transition: transform var(--duration-normal) var(--ease-out-expo),
              border-color var(--duration-normal) var(--ease-out-expo),
              box-shadow var(--duration-normal) var(--ease-out-expo);
}

.home-feature-card::before {
  display: none;
}

.home-feature-card:hover {
  transform: translateY(-3px);
  border-color: rgba(59, 130, 246, 0.32);
  box-shadow: var(--shadow-lg);
}

.home-feature-agent {
  background: rgba(255,255,255,.36);
}

.home-feature-canvas {
  background: rgba(255,255,255,.36);
}

.home-feature-kicker,
.home-section-title span {
  position: relative;
  z-index: 1;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.home-feature-card strong {
  position: relative;
  z-index: 1;
  font-size: clamp(16px, 1.8vw, 22px);
  line-height: 1.05;
  font-weight: 700;
  color: var(--text);
}

.home-feature-card small {
  position: relative;
  z-index: 1;
  max-width: 520px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.home-console {
  overflow: visible;
  width: min(100%, 760px);
  margin: 0 auto;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 26px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(26px);
  box-shadow: 0 24px 70px rgba(15,23,42,.14);
}

.home-project-thread {
  width: min(100%, 820px);
  margin: 0 auto;
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 22px;
  background: rgba(255,255,255,.46);
  backdrop-filter: blur(22px);
  box-shadow: 0 18px 54px rgba(15,23,42,.10);
}

.sidebar-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-history-head a {
  color: inherit;
  opacity: .72;
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
}

.sidebar-history-list {
  display: grid;
  gap: 8px;
  margin: 4px 10px 10px;
}

.sidebar-history-empty {
  padding: 8px 10px;
  color: var(--sidebar-text);
  font-size: 12px;
  opacity: .72;
}

.sidebar-history-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  cursor: pointer;
}

.sidebar-history-item:hover,
.sidebar-history-item.active {
  background: var(--sidebar-accent-glow);
  border-color: var(--sidebar-border);
  color: var(--sidebar-text-hover);
}

.sidebar-history-thumb {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: var(--sidebar-surface);
  color: var(--sidebar-text-hover);
  font-size: 13px;
  font-weight: 900;
}

.sidebar-history-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.sidebar-history-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sidebar-history-copy strong,
.sidebar-history-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-history-copy strong {
  font-size: 13px;
  color: inherit;
}

.sidebar-history-copy small {
  font-size: 11px;
  color: var(--sidebar-text);
}

.home-project-thread {
  overflow: hidden;
}

.home-project-body {
  display: grid;
  gap: 10px;
  padding: 14px 18px;
}

.home-project-message {
  max-width: 960px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--main-surface-soft);
}

.home-project-message p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.home-project-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-project-steps span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--main-surface);
  font-size: 12px;
  font-weight: 800;
}

.home-project-steps i {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: var(--text-muted);
}

.home-project-steps span.is-done i {
  background: #22c55e;
}

.home-project-preview {
  max-width: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--main-surface);
}

.home-project-preview img,
.home-project-preview video {
  width: 100%;
  display: block;
  max-height: 360px;
  object-fit: contain;
}

.home-project-preview audio {
  width: 100%;
  display: block;
  padding: 12px;
}

.home-console-head {
  align-items: center;
  flex-wrap: wrap;
}

.home-mode-tabs,
.home-showcase-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.home-mode-tabs button,
.home-showcase-tabs button,
.home-showcase-tabs a,
.home-resource-links a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--main-surface);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.home-mode-tabs button:hover,
.home-showcase-tabs button:hover,
.home-showcase-tabs a:hover,
.home-resource-links a:hover {
  border-color: rgba(59, 130, 246, 0.36);
  color: var(--primary);
}

.home-mode-tabs button.active,
.home-showcase-tabs button.active,
.home-showcase-tabs a.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.18);
}

.home-console-body {
  padding: 0;
}

.home-mode-panel {
  display: none;
  padding: 12px 18px;
}

.home-mode-panel.is-active {
  display: block;
}

.home-embed-frame {
  width: 100%;
  min-height: min(980px, calc(100vh - 150px));
  display: block;
  border: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--main-bg);
}

.home-chat-frame {
  min-height: min(860px, calc(100vh - 150px));
}

.home-video-frame {
  min-height: min(1120px, calc(100vh - 120px));
}

.home-console #generateForm,
.home-create-form {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.home-console .prompt-field-compact textarea,
.home-prompt-field textarea {
  min-height: 72px;
  max-height: 288px;
  border-color: transparent;
  border-radius: 18px;
  background: rgba(255,255,255,.62);
  font-size: 14px;
  resize: none;
  overflow-y: auto;
}

.home-prompt-shell {
  position: relative;
}

.home-prompt-shell textarea {
  width: 100%;
  padding-left: 48px;
  padding-right: 48px;
}

.home-prompt-expand {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 9px;
  background: rgba(255,255,255,.72);
  color: rgba(17,24,39,.56);
  cursor: pointer;
}

.home-prompt-expand:hover {
  color: var(--primary);
  border-color: rgba(59,130,246,.28);
  background: #fff;
}

.home-prompt-resize-handle {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 9px;
  background: rgba(255,255,255,.72);
  color: rgba(17,24,39,.56);
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
}

.home-prompt-resize-handle:hover,
.home-prompt-shell.is-resizing-prompt .home-prompt-resize-handle {
  color: var(--primary);
  border-color: rgba(59,130,246,.28);
  background: #fff;
}

.home-prompt-resize-handle span,
.home-prompt-resize-handle span::before,
.home-prompt-resize-handle span::after {
  display: block;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.home-prompt-resize-handle span::before {
  transform: translateY(-5px);
}

.home-prompt-resize-handle span::after {
  transform: translateY(3px);
}

.home-prompt-expand svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-console #generateButton,
.home-console #homeGenerateButton {
  width: auto;
  min-width: 76px;
  max-width: none;
  min-height: 40px;
  justify-self: center;
  padding: 0 18px;
  border-radius: 999px;
  overflow: visible;
  position: relative;
  text-indent: 0;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.home-console #homeGenerateButton::after {
  content: none;
}

.home-create-alert {
  margin: clamp(14px, 1.8vw, 22px) clamp(16px, 2vw, 24px) 0;
}

.home-create-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.home-create-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

@media (max-width: 720px) {
  .home-create-actions {
    width: 100%;
  }
}

.home-file-tool {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--main-surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.home-file-tool input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.home-file-tool span {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  line-height: 1;
}

.home-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-reference-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-file-chip {
  max-width: min(100%, 260px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--main-surface-soft);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.home-file-chip.is-reference {
  cursor: pointer;
}

.home-reference-chip {
  max-width: min(100%, 280px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--main-surface-soft);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.home-file-chip img,
.home-reference-chip img,
.home-reference-chip video,
.home-reference-audio {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.home-reference-audio {
  display: inline-grid;
  place-items: center;
  background: var(--main-surface);
  color: var(--primary);
  font-size: 12px;
}

.home-reference-chip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-reference-chip button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--main-surface);
  color: var(--text-muted);
  cursor: pointer;
}

.home-reference-bank {
  display: grid;
  gap: 8px;
}

.home-reference-bank > span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 900;
}

.home-reference-bank > div {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.home-reference-bank button {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--main-surface-soft);
  cursor: pointer;
}

.home-reference-bank button:hover {
  border-color: var(--primary);
}

.home-reference-bank img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.home-model-fields {
  margin-top: 8px;
}

.video-param-row > .home-model-fields-inline,
.video-param-row > .home-model-fields-inline > .compact-param-row {
  display: contents;
}

.home-toggle-field {
  align-content: center;
}

.home-toggle-field span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.home-file-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-file-chip button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--main-surface);
  color: var(--text-muted);
  cursor: pointer;
  line-height: 18px;
}

.home-chat-result {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.home-chat-bubble {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--main-surface);
  color: var(--text);
}

.home-chat-bubble strong {
  font-size: 12px;
  color: var(--text-muted);
}

.home-chat-bubble p {
  margin: 0;
  line-height: 1.7;
  font-size: 14px;
}

.home-chat-bubble-user {
  background: var(--primary-soft);
  border-color: rgba(59, 130, 246, 0.22);
}

.home-photo-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.home-photo-presets button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--main-surface);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.home-photo-presets button.is-active,
.home-photo-presets button:hover {
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--primary);
  background: var(--primary-soft);
}

.home-reference-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.home-reference-modes label {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--main-surface);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.home-reference-modes input {
  accent-color: var(--primary);
}

.home-audio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, .8fr) minmax(180px, .8fr);
  gap: 8px;
  margin-bottom: 8px;
}

.home-audio-demo {
  grid-column: 1 / -1;
}

.home-cost-hint {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  margin-top: 0;
  padding: 0 12px;
  white-space: nowrap;
}

.home-prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15,23,42,.36);
  backdrop-filter: blur(14px);
}

.home-prompt-modal.hidden {
  display: none;
}

.home-prompt-modal-panel {
  width: min(60vw, 960px);
  height: min(60vh, 720px);
  min-width: min(92vw, 520px);
  min-height: min(72vh, 420px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.52);
  border-radius: 18px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 30px 90px rgba(15,23,42,.22);
}

.home-prompt-modal-head,
.home-prompt-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.home-prompt-modal-head strong {
  color: var(--text);
  font-size: 14px;
}

.home-prompt-modal-head button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 10px;
  background: rgba(15,23,42,.06);
  color: var(--text-soft);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.home-prompt-modal textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  resize: none;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}

.home-prompt-modal-actions {
  justify-content: flex-end;
}

.home-workflow-strip {
  display: grid;
  gap: 12px;
  width: min(100%, 760px);
  margin: 0 auto;
}

.home-section-title {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 12px;
}

.home-section-title strong {
  color: var(--text);
  font-size: clamp(16px, 1.8vw, 20px);
  font-weight: 700;
}

.home-workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.5vw, 18px);
}

.home-workflow-card {
  min-height: 112px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--main-surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: transform var(--duration-fast) var(--ease-out-expo),
              border-color var(--duration-fast) var(--ease-out-expo),
              box-shadow var(--duration-fast) var(--ease-out-expo);
}

.home-workflow-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.34);
  box-shadow: var(--shadow);
}

.home-workflow-card strong {
  font-size: 15px;
  font-weight: 800;
}

.home-workflow-card span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.home-showcase-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  width: min(100%, 1120px);
  margin: 0 auto;
  gap: clamp(16px, 2vw, 24px);
  align-items: start;
}

.home-showcase-main,
.home-resource-panel {
  border-color: rgba(255,255,255,.38);
  background: rgba(255,255,255,.76);
  backdrop-filter: blur(22px);
}

.home-showcase-main .media-card {
  transform: scale(.96);
  transform-origin: top center;
}

.home-showcase-tabs {
  margin-bottom: 16px;
}

.home-showcase-panel {
  display: none;
}

.home-showcase-panel.is-active {
  display: grid;
}

.home-showcase-main.is-searching .home-showcase-panel {
  display: grid;
  margin-top: 14px;
}

.home-chat-records {
  gap: 10px;
}

.home-chat-record {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--main-surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.home-chat-record:hover {
  border-color: rgba(59, 130, 246, 0.34);
  box-shadow: var(--shadow);
}

.home-chat-record strong {
  font-size: 14px;
  font-weight: 800;
}

.home-chat-record span {
  color: var(--text-muted);
  font-size: 12px;
}

.home-resource-panel {
  position: sticky;
  top: 24px;
}

.home-resource-search {
  display: grid;
  gap: 8px;
}

.home-resource-search span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.home-resource-search input {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--main-surface-soft);
  color: var(--text);
  outline: none;
}

.home-resource-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.home-resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

html[data-theme="dark"] body:not(.page-admin) .home-feature-card {
  background: rgba(17, 24, 39, 0.62);
}

html[data-theme="dark"] body:not(.page-admin) .home-feature-agent {
  background: rgba(17, 24, 39, 0.62);
}

html[data-theme="dark"] body:not(.page-admin) .home-feature-card::before {
  border-color: rgba(96, 165, 250, 0.20);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.10) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1px);
}

@media (max-width: 1180px) {
  .home-workflow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .home-resource-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .home-hero-grid,
  .home-workflow-grid {
    grid-template-columns: 1fr;
  }

  .home-feature-card {
    min-height: 86px;
  }

  .home-dashboard {
    padding-top: 8px;
  }

  .home-dashboard > .page-hd {
    border-radius: 18px;
  }

  .home-console,
  .home-project-thread {
    border-radius: 20px;
  }

  .home-prompt-field textarea {
    min-height: 118px;
  }

  .home-console-head {
    align-items: flex-start;
  }

  .home-mode-tabs {
    width: 100%;
  }

  .home-mode-tabs button {
    flex: 1 1 calc(50% - 8px);
  }

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

  .home-create-toolbar {
    gap: 8px;
  }

  .home-file-tool,
  .home-create-toolbar .btn {
    flex: 1 1 auto;
  }
}

.record-dialog-panel {
  max-width: min(1175px, calc(100vw - 24px));
  width: min(1175px, calc(100vw - 24px));
}

.record-dialog-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-preview-zoom-btn {
  min-width: 44px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 750;
  line-height: 1;
}

.record-preview-fullscreen-btn {
  font-size: 18px;
}

.record-dialog-image {
  position: relative;
  height: min(65.625vh, 715px);
  min-height: min(65.625vh, 715px);
  display: grid;
  place-items: center;
  background: #070b12;
  padding: 0;
  overflow: hidden;
}

.record-dialog-body {
  padding: 8px 10px 10px;
}

.record-dialog-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: zoom-in;
  touch-action: none;
}

.record-dialog-viewport.is-draggable {
  cursor: grab;
}

.record-dialog-viewport.is-dragging {
  cursor: grabbing;
}

.record-dialog-image img,
.record-dialog-image video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
}

.record-dialog-image img.dialog-media-preview {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.record-dialog-image video.dialog-media-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center center;
  background: #070b12;
}

.record-dialog-image.is-media-loading::after {
  content: "视频加载中...";
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  padding: 9px 14px;
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.78);
  color: #fff;
  font-size: 13px;
  pointer-events: none;
}

.record-dialog-image video.dialog-media-preview.is-portrait {
  width: auto;
  height: auto;
  object-fit: contain !important;
}

.record-dialog-image video.dialog-media-preview.is-landscape {
  width: auto;
  height: auto;
  object-fit: contain !important;
}

.record-dialog-image img.dialog-media-preview.is-zoomable {
  transform: translate(var(--dialog-preview-offset-x, 0px), var(--dialog-preview-offset-y, 0px)) scale(var(--dialog-preview-scale, 1));
  transform-origin: center center;
  transition: transform 120ms ease-out;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  max-width: min(100%, 1600px);
  max-height: 100%;
}

.record-dialog.is-preview-fullscreen {
  padding: 0;
}

.record-dialog.is-preview-fullscreen .record-dialog-panel,
.record-dialog-panel:fullscreen {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: 0;
  overflow: hidden;
  background: var(--main-surface);
}

.record-dialog.is-preview-fullscreen .record-dialog-body,
.record-dialog-panel:fullscreen .record-dialog-body {
  min-height: 0;
  padding: 8px 10px 10px;
  overflow: hidden;
}

.record-dialog.is-preview-fullscreen .record-dialog-image,
.record-dialog-panel:fullscreen .record-dialog-image {
  height: 100%;
  min-height: 0;
  margin-bottom: 0;
}

.record-dialog.is-preview-fullscreen .record-dialog-image video.dialog-media-preview,
.record-dialog-panel:fullscreen .record-dialog-image video.dialog-media-preview {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.record-dialog.is-preview-fullscreen .record-detail-panel,
.record-dialog-panel:fullscreen .record-detail-panel {
  display: none;
}

.record-detail-panel {
  margin-top: 12px;
}

.record-preview-actions {
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.record-preview-actions form {
  display: none;
}

@media (max-width: 1024px) {
  .sidebar-collapse-btn {
    display: none;
  }

  body:not(.page-admin).sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }

  body.page-canvas .main-area {
    padding-top: 64px;
  }

  body.page-canvas.sidebar-collapsed .canvas-layout {
    grid-template-columns: 1fr;
  }
}

/* Final home art direction: compact glass UI over the scenic background. */
html[data-theme] body.page-app:not(.page-admin) {
  background: #eef3f7;
}

html[data-theme] body.page-app:not(.page-admin)::before {
  background: var(--home-bg-image) center var(--home-ve-bg-y) / cover no-repeat;
  filter: blur(var(--home-bg-blur));
}

html[data-theme] body.page-app:not(.page-admin)::after {
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.14), transparent 30%),
    linear-gradient(180deg, rgba(7,14,28,.08), rgba(255,255,255,var(--home-ve-bg-fade)) 78%, rgba(255,255,255,.40));
}

html[data-theme] body.page-app:not(.page-admin) .main-area {
  background:
    linear-gradient(180deg, rgba(7,14,28,.08), rgba(255,255,255,var(--home-ve-bg-fade)) 78%, rgba(255,255,255,.36)),
    var(--home-bg-image) center var(--home-ve-bg-y) / cover fixed no-repeat !important;
  padding-top: 28px;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard {
  width: min(100%, 1080px);
  gap: 16px;
  padding-top: 0;
}

html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .main-area {
  margin-left: 0;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd,
html[data-theme] body.page-app:not(.page-admin) .home-feature-card,
html[data-theme] body.page-app:not(.page-admin) .home-project-thread,
html[data-theme] body.page-app:not(.page-admin) .home-console,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main,
html[data-theme] body.page-app:not(.page-admin) .home-resource-panel,
html[data-theme] body.page-app:not(.page-admin) .home-workflow-card {
  border-color: rgba(255,255,255,.42) !important;
  background: rgba(255,255,255,.58) !important;
  color: #111827;
  box-shadow: 0 22px 70px rgba(15,23,42,.12);
  backdrop-filter: blur(24px) saturate(1.1);
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd {
  width: min(100%, 980px);
  min-height: 84px;
  margin-top: 0;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd h1 {
  color: rgba(255,255,255,.94);
  font-size: clamp(28px, 4vw, 50px);
  font-weight: 500;
  letter-spacing: 0;
  text-shadow: 0 2px 22px rgba(15,23,42,.28);
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd p,
html[data-theme] body.page-app:not(.page-admin) .card-v3-head .sub,
html[data-theme] body.page-app:not(.page-admin) .home-feature-kicker,
html[data-theme] body.page-app:not(.page-admin) .home-section-title span {
  color: rgba(17,24,39,.58);
}

html[data-theme] body.page-app:not(.page-admin) .home-hero-grid {
  width: min(100%, 700px);
  margin-top: 28px;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card {
  min-height: 84px;
  border-radius: 20px;
  padding: 14px 18px;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card strong {
  color: #111827;
  font-size: 18px;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card small {
  color: rgba(17,24,39,.66);
}

html[data-theme] body.page-app:not(.page-admin) .home-project-thread {
  width: min(100%, 760px);
  border-radius: 22px;
}

html[data-theme] body.page-app:not(.page-admin) .home-project-message,
html[data-theme] body.page-app:not(.page-admin) .home-project-steps span,
html[data-theme] body.page-app:not(.page-admin) .home-chat-bubble,
html[data-theme] body.page-app:not(.page-admin) .home-file-tool,
html[data-theme] body.page-app:not(.page-admin) .home-file-chip,
html[data-theme] body.page-app:not(.page-admin) .home-reference-chip,
html[data-theme] body.page-app:not(.page-admin) .home-reference-bank button,
html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs button,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-tabs button,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-tabs a,
html[data-theme] body.page-app:not(.page-admin) .home-resource-links a {
  border-color: rgba(15,23,42,.08);
  background: rgba(255,255,255,.64);
  color: #1f2937;
}

html[data-theme] body.page-app:not(.page-admin) .home-console {
  width: min(100%, 720px);
  border-radius: 28px;
  margin-top: 8px;
}

html[data-theme] body.page-app:not(.page-admin) .home-console-head {
  min-height: 58px;
  padding: 12px 18px;
  border-bottom-color: rgba(15,23,42,.07);
}

html[data-theme] body.page-app:not(.page-admin) .home-console-head h3 {
  color: #111827;
  font-size: 16px;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-form {
  padding: 16px 18px 18px;
  gap: 10px;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-field textarea {
  min-height: 72px;
  max-height: 288px;
  border: 0;
  border-radius: 20px;
  background: rgba(255,255,255,.72);
  color: #111827;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.06);
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-field textarea::placeholder {
  color: rgba(17,24,39,.42);
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton {
  width: auto;
  min-width: 76px;
  max-width: none;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(17,24,39,.92);
  box-shadow: 0 8px 22px rgba(15,23,42,.16);
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs button.active {
  color: #fff;
  background: rgba(17,24,39,.88) !important;
  box-shadow: 0 8px 22px rgba(15,23,42,.16);
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-strip {
  width: min(100%, 720px);
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card {
  min-height: 70px;
  border-radius: 18px;
  padding: 14px 16px;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid {
  width: min(100%, 1000px);
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .media-card {
  box-shadow: none;
}

@media (max-width: 720px) {
  html[data-theme] body.page-app:not(.page-admin) .main-area {
    padding-top: 72px;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-dashboard {
    width: min(100%, calc(100vw - 24px));
  }
}

/* Home compact viewport: match the smaller, centered UI scale from the reference. */
html[data-theme] body.page-app:not(.page-admin)::before {
  background: var(--home-bg-image) center var(--home-ve-bg-y) / cover no-repeat;
  filter: blur(var(--home-bg-blur));
}

html[data-theme] body.page-app:not(.page-admin)::after {
  background:
    linear-gradient(180deg, rgba(7,14,28,.08), rgba(255,255,255,var(--home-ve-bg-fade)) 78%, rgba(255,255,255,.40)),
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.14), transparent 34%);
}

html[data-theme] body.page-app:not(.page-admin) .main-area {
  padding: clamp(18px, 2.4vh, 30px) clamp(22px, 3vw, 46px) 56px;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard {
  width: min(100%, 1040px);
  gap: clamp(10px, 1.2vw, 15px);
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd {
  width: min(100%, 920px);
  min-height: 64px;
  padding: 8px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.28) !important;
  box-shadow: 0 14px 44px rgba(15,23,42,.08);
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd h1 {
  font-size: clamp(24px, 3.2vw, 42px);
  line-height: 1.08;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard .page-hd-actions .btn,
html[data-theme] body.page-app:not(.page-admin) .home-dashboard .badge-balance {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12px;
}

html[data-theme] body.page-app:not(.page-admin) .home-hero-grid {
  width: min(100%, 560px);
  gap: 8px;
  margin-top: 18px;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card {
  min-height: 66px;
  padding: 11px 14px;
  border-radius: 17px;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card strong {
  font-size: 15px;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card small,
html[data-theme] body.page-app:not(.page-admin) .home-feature-kicker {
  font-size: 10px;
  line-height: 1.35;
}

html[data-theme] body.page-app:not(.page-admin) .home-project-thread:not(.is-active):not(.has-preview) {
  display: none;
}

html[data-theme] body.page-app:not(.page-admin) .home-console {
  width: min(100%, 640px);
  margin-top: 4px;
  border-radius: 24px;
  box-shadow: 0 22px 66px rgba(15,23,42,.13);
}

html[data-theme] body.page-app:not(.page-admin) .home-console-head {
  min-height: 50px;
  padding: 10px 16px;
}

html[data-theme] body.page-app:not(.page-admin) .home-console-head h3 {
  font-size: 14px;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-tabs {
  gap: 6px;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs button,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-tabs button,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-tabs a,
html[data-theme] body.page-app:not(.page-admin) .home-resource-links a {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-form {
  padding: 14px 16px 16px;
  gap: 8px;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-field label {
  display: none;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-field textarea {
  min-height: 66px;
  max-height: 264px;
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 13px;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-panel {
  padding: 8px 16px;
}

html[data-theme] body.page-app:not(.page-admin) .compact-param-row {
  gap: 8px;
}

html[data-theme] body.page-app:not(.page-admin) .compact-param-field label,
html[data-theme] body.page-app:not(.page-admin) .field-v3 label {
  font-size: 11px;
}

html[data-theme] body.page-app:not(.page-admin) .field-v3 input,
html[data-theme] body.page-app:not(.page-admin) .field-v3 select,
html[data-theme] body.page-app:not(.page-admin) .field-v3 textarea {
  min-height: 34px;
  font-size: 12px;
}

html[data-theme] body.page-app:not(.page-admin) .home-file-tool,
html[data-theme] body.page-app:not(.page-admin) .home-photo-presets button,
html[data-theme] body.page-app:not(.page-admin) .home-reference-modes label {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton {
  width: auto;
  min-width: 72px;
  max-width: none;
  min-height: 36px;
  padding: 0 16px;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-strip {
  width: min(100%, 640px);
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-grid {
  gap: 9px;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card {
  min-height: 58px;
  padding: 11px 13px;
  border-radius: 16px;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card strong {
  font-size: 13px;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card span {
  font-size: 10px;
  line-height: 1.4;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid {
  width: min(100%, 1080px);
  grid-template-columns: minmax(0, 1fr) minmax(230px, 280px);
  gap: 16px;
  margin-top: 12px;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-head,
html[data-theme] body.page-app:not(.page-admin) .home-resource-panel .card-v3-head {
  min-height: 58px;
  padding: 13px 18px;
  border-bottom-color: rgba(15, 23, 42, .06);
  background: rgba(255, 255, 255, .42);
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-body,
html[data-theme] body.page-app:not(.page-admin) .home-resource-panel .card-v3-body {
  padding: 16px 18px 18px;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: 18px 16px;
  align-items: start;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .media-card {
  transform: none;
  border-radius: 16px;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .media-card-body {
  padding: 10px 11px;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList.grid-auto,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)) !important;
  gap: 20px 16px !important;
  overflow: visible;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact {
  display: grid !important;
  grid-template-columns: 1fr !important;
  grid-template-rows: auto auto !important;
  min-height: 0 !important;
  width: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact > .media-card-thumb,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact > .media-card-thumb,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card > div:first-child,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card > div:first-child {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 16 / 9 !important;
  border: 1px solid rgba(15, 23, 42, .08) !important;
  border-radius: 16px !important;
  overflow: hidden;
  background: var(--main-surface-soft) !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .09);
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact > .media-card-thumb > img,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact > .media-card-thumb > video,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact > .media-card-thumb > img,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact > .media-card-thumb > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact .media-card-body,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact .media-card-body {
  display: grid !important;
  gap: 6px !important;
  padding: 10px 3px 0 !important;
  align-content: start !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact .prompt,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact .prompt {
  min-height: 0 !important;
  margin: 0;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.35;
  -webkit-line-clamp: 2 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact .meta,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact .meta {
  gap: 6px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main,
html[data-theme] body.page-app:not(.page-admin) .home-resource-panel {
  border-color: rgba(255, 255, 255, .48);
  border-radius: 22px;
  background: rgba(255, 255, 255, .72) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-resource-panel {
  align-self: start;
}

html[data-theme] body.page-app:not(.page-admin) .home-resource-panel .card-v3-body {
  display: grid;
  gap: 14px;
}

@keyframes homeFloatingPillShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

html[data-theme] body.page-app:not(.page-admin) .home-resource-links {
  gap: 8px;
}

html[data-theme] body.page-app:not(.page-admin) .home-resource-links a {
  min-height: 32px;
  border-radius: 999px;
}

html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .main-area {
  padding-left: clamp(30px, 3.2vw, 58px);
  padding-right: clamp(30px, 3.2vw, 58px);
}

html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-dashboard {
  width: min(100%, calc(100vw - 96px)) !important;
}

html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
  width: min(100%, calc(100vw - 120px)) !important;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 330px) !important;
  gap: 18px !important;
}

html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-main #historyList.grid-auto,
html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-main .home-showcase-panel.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact time,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact time {
  display: none;
}

@media (max-width: 1180px) {
  html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid {
    grid-template-columns: 1fr;
    width: min(100%, 820px);
  }
}

@media (max-width: 720px) {
  html[data-theme] body.page-app:not(.page-admin) .main-area {
    padding: 72px 12px 36px;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-dashboard {
    width: 100%;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd {
    min-height: 58px;
    padding: 8px 10px;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd h1 {
    font-size: 25px;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-hero-grid,
  html[data-theme] body.page-app:not(.page-admin) .home-workflow-grid {
    grid-template-columns: 1fr;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console,
  html[data-theme] body.page-app:not(.page-admin) .home-workflow-strip,
  html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid {
    width: 100%;
  }
}

/* Visual layout editor for /user/index?layout_editor=1 */
:root {
  --home-ve-page-width: 1030px;
  --home-ve-top-width: 970px;
  --home-ve-console-width: 900px;
  --home-ve-feature-width: 900px;
  --home-ve-showcase-width: 980px;
  --home-ve-gap: 10px;
  --home-ve-radius: 34px;
  --home-ve-glass: 0.83;
  --home-ve-blur: 13px;
  --home-ve-scale: 1.03;
  --home-ve-main-pad-y: 2px;
  --home-ve-hero-offset: 0px;
  --home-ve-prompt-height: 62px;
  --home-ve-card-shadow: 0.28;
  --home-ve-gallery-min: 140px;
  --home-ve-resource-width: 220px;
  --home-ve-feature-height: 64px;
  --home-ve-top-pad-x: 36px;
  --home-ve-top-pad-y: 4px;
  --home-ve-card-pad: 13px;
  --home-ve-console-head-pad: 32px;
  --home-ve-editor-x: 8px;
  --home-ve-editor-y: 23px;
  --home-ve-editor-width: 300px;
  --home-ve-accent: #000000;
  --home-ve-active-text: #d95000;
}

body.page-app.home-layout-editing:not(.page-admin)::before {
  background: var(--home-bg-image) center var(--home-ve-bg-y) / cover no-repeat !important;
  filter: blur(var(--home-bg-blur));
}

body.page-app.home-layout-editing:not(.page-admin) .main-area {
  padding-top: var(--home-ve-main-pad-y) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-dashboard {
  width: min(100%, var(--home-ve-page-width)) !important;
  gap: var(--home-ve-gap) !important;
  transform: scale(var(--home-ve-scale));
  transform-origin: top center;
}

body.page-app.home-layout-editing:not(.page-admin) .home-dashboard > .page-hd {
  width: min(100%, var(--home-ve-top-width)) !important;
  padding: var(--home-ve-top-pad-y) var(--home-ve-top-pad-x) !important;
  border-radius: calc(var(--home-ve-radius) - 6px) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-hero-grid {
  width: min(100%, var(--home-ve-feature-width)) !important;
  gap: calc(var(--home-ve-gap) * .6) !important;
  margin-top: var(--home-ve-hero-offset) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-console,
body.page-app.home-layout-editing:not(.page-admin) .home-workflow-strip {
  width: min(100%, var(--home-ve-console-width)) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-showcase-grid {
  width: min(100%, var(--home-ve-showcase-width)) !important;
  grid-template-columns: minmax(0, 1fr) minmax(220px, var(--home-ve-resource-width)) !important;
  gap: var(--home-ve-gap) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-feature-card,
body.page-app.home-layout-editing:not(.page-admin) .home-console,
body.page-app.home-layout-editing:not(.page-admin) .home-workflow-card,
body.page-app.home-layout-editing:not(.page-admin) .home-showcase-main,
body.page-app.home-layout-editing:not(.page-admin) .home-resource-panel,
body.page-app.home-layout-editing:not(.page-admin) .home-dashboard > .page-hd {
  background: rgba(255,255,255,var(--home-ve-glass)) !important;
  box-shadow: 0 22px 70px rgba(15,23,42,var(--home-ve-card-shadow)) !important;
  backdrop-filter: blur(var(--home-ve-blur)) saturate(1.1) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-feature-card {
  min-height: var(--home-ve-feature-height) !important;
  padding: var(--home-ve-card-pad) !important;
  border-radius: calc(var(--home-ve-radius) - 7px) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-console {
  border-radius: var(--home-ve-radius) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-console-head,
body.page-app.home-layout-editing:not(.page-admin) .home-showcase-main .card-v3-head,
body.page-app.home-layout-editing:not(.page-admin) .home-resource-panel .card-v3-head {
  padding-left: var(--home-ve-console-head-pad) !important;
  padding-right: var(--home-ve-console-head-pad) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-prompt-field textarea {
  min-height: var(--home-ve-prompt-height) !important;
  border-radius: calc(var(--home-ve-radius) - 6px) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-workflow-grid {
  gap: calc(var(--home-ve-gap) * .65) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-workflow-card {
  border-radius: calc(var(--home-ve-radius) - 8px) !important;
}

body.page-app.home-layout-editing:not(.page-admin) .home-showcase-main .grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--home-ve-gallery-min)), 1fr)) !important;
}

body.page-app.home-layout-editing.home-layout-hide-hero:not(.page-admin) .home-hero-grid,
body.page-app.home-layout-editing.home-layout-hide-project:not(.page-admin) .home-project-thread,
body.page-app.home-layout-editing.home-layout-hide-workflow:not(.page-admin) .home-workflow-strip,
body.page-app.home-layout-editing.home-layout-hide-showcase:not(.page-admin) .home-showcase-grid {
  display: none !important;
}

body.page-app.home-layout-editing.home-layout-focus-console:not(.page-admin) .home-dashboard > .page-hd,
body.page-app.home-layout-editing.home-layout-focus-console:not(.page-admin) .home-hero-grid,
body.page-app.home-layout-editing.home-layout-focus-console:not(.page-admin) .home-workflow-strip,
body.page-app.home-layout-editing.home-layout-focus-console:not(.page-admin) .home-showcase-grid {
  opacity: .32;
  filter: saturate(.72);
}

body.page-app.home-layout-editing:not(.page-admin) .home-mode-tabs button.active,
body.page-app.home-layout-editing:not(.page-admin) .home-showcase-tabs button.active,
body.page-app.home-layout-editing:not(.page-admin) .home-console #homeGenerateButton {
  background: var(--home-ve-accent) !important;
  color: var(--home-ve-active-text) !important;
}

body.page-app:not(.page-admin) .home-builder-style-solid {
  background: #fff !important;
  backdrop-filter: none !important;
}

body.page-app:not(.page-admin) .home-builder-style-outline {
  background: transparent !important;
  border-style: dashed !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body.page-app:not(.page-admin) .home-builder-style-flat {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body.page-app:not(.page-admin) .home-builder-style-spotlight {
  transform: translateY(-2px);
  border-color: rgba(17,24,39,.18) !important;
  box-shadow: 0 28px 86px rgba(15,23,42,.18) !important;
}

body.page-app.home-layout-editing .home-layout-selected {
  position: relative;
  outline: 2px solid var(--home-ve-accent) !important;
  outline-offset: 4px;
}

body.page-app.home-layout-editing .home-layout-selected::after {
  content: attr(data-layout-name);
  position: absolute;
  top: -13px;
  left: 14px;
  z-index: 10;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--home-ve-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}

.home-layout-editor-panel {
  position: fixed;
  right: var(--home-ve-editor-x);
  bottom: var(--home-ve-editor-y);
  z-index: 1000;
  width: min(var(--home-ve-editor-width), calc(100vw - 36px));
  max-height: min(720px, calc(100dvh - 36px));
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 18px;
  background: rgba(255,255,255,.90);
  box-shadow: 0 24px 70px rgba(15,23,42,.20);
  backdrop-filter: blur(24px);
}

.home-layout-editor-tabs,
.home-layout-editor-presets,
.home-layout-editor-switches,
.home-layout-editor-field-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-layout-editor-tabs {
  margin: 0 0 10px;
}

.home-layout-editor-tabs button,
.home-layout-editor-presets button,
.home-layout-editor-switches label,
.home-layout-editor-field-grid button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.home-layout-editor-tabs button.is-active,
.home-layout-editor-presets button:hover,
.home-layout-editor-switches label:has(input:checked),
.home-layout-editor-field-grid button:hover {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.home-layout-editor-section {
  display: none;
}

.home-layout-editor-section.is-active {
  display: block;
}

.home-layout-editor-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.home-layout-editor-panel h2 {
  margin: 0;
  color: #111827;
  font-size: 16px;
  letter-spacing: 0;
}

.home-layout-editor-panel small,
.home-layout-editor-note {
  color: #64748b;
  font-size: 12px;
  line-height: 1.55;
}

.home-layout-editor-control {
  display: grid;
  gap: 7px;
  padding: 10px 0;
  border-top: 1px solid rgba(15,23,42,.08);
}

.home-layout-selected-controls {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 12px;
  background: rgba(248,250,252,.72);
}

.home-layout-selected-controls .home-layout-editor-note {
  margin: 0 0 4px;
}

.home-layout-selected-controls input:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.home-layout-editor-control label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.home-layout-editor-control output {
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.home-layout-editor-control input {
  width: 100%;
  accent-color: #111827;
}

.home-layout-editor-import {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid rgba(15,23,42,.08);
}

.home-layout-editor-import textarea {
  width: 100%;
  min-height: 118px;
  padding: 10px;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 12px;
  background: rgba(255,255,255,.78);
  color: #111827;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

.home-layout-editor-text-field {
  display: grid;
  gap: 6px;
  padding: 9px 0;
  border-top: 1px solid rgba(15,23,42,.08);
}

.home-layout-editor-text-field label {
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.home-layout-editor-text-field input,
.home-layout-editor-text-field textarea,
.home-layout-editor-spec-field input,
.home-layout-editor-spec-field textarea,
.home-layout-editor-spec-field select {
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 10px;
  background: rgba(255,255,255,.78);
  color: #111827;
  font-size: 12px;
  outline: none;
}

.home-layout-editor-text-field textarea {
  min-height: 62px;
  resize: vertical;
}

.home-layout-button-editor {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid rgba(15,23,42,.08);
}

.home-layout-button-row {
  display: grid;
  grid-template-columns: 62px 62px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.home-layout-button-row label {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.home-layout-button-row input[type="number"],
.home-layout-button-row input[type="text"] {
  width: 100%;
  min-height: 32px;
  padding: 7px 8px;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 10px;
  background: rgba(255,255,255,.78);
  color: #111827;
  font-size: 12px;
  outline: none;
}

.home-layout-button-row span {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
}

.home-layout-editor-spec-field {
  display: grid;
  gap: 6px;
  padding: 9px 0;
  border-top: 1px solid rgba(15,23,42,.08);
}

.home-layout-editor-spec-field label {
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.home-layout-editor-spec-field textarea {
  min-height: 82px;
  resize: vertical;
}

.home-layout-editor-color-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  align-items: center;
}

.home-layout-editor-color-row input[type="color"] {
  width: 46px;
  min-height: 34px;
  padding: 2px;
}

.home-layout-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(15,23,42,.08);
}

.home-layout-editor-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.home-layout-editor-actions button.is-primary {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.home-layout-editor-panel.is-collapsed .home-layout-editor-control,
.home-layout-editor-panel.is-collapsed .home-layout-editor-note,
.home-layout-editor-panel.is-collapsed .home-layout-editor-tabs,
.home-layout-editor-panel.is-collapsed .home-layout-editor-section {
  display: none;
}

@media (max-width: 1180px) {
  body.page-app.home-layout-editing:not(.page-admin) .home-showcase-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Solidified home layout: apply builder variables on normal /user/index too. */
html[data-theme] body.page-app:not(.page-admin)::before {
  background: var(--home-bg-image) center var(--home-ve-bg-y) / cover no-repeat !important;
  filter: blur(var(--home-bg-blur));
}

html[data-theme] body.page-app:not(.page-admin) .main-area {
  background:
    linear-gradient(180deg, rgba(7,14,28,.08), rgba(255,255,255,var(--home-ve-bg-fade)) 78%, rgba(255,255,255,.36)),
    var(--home-bg-image) center var(--home-ve-bg-y) / cover fixed no-repeat !important;
  padding-top: var(--home-ve-main-pad-y) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard {
  width: min(100%, var(--home-ve-page-width)) !important;
  gap: var(--home-ve-gap) !important;
  transform: scale(var(--home-ve-scale));
  transform-origin: top center;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd {
  width: min(100%, var(--home-ve-top-width)) !important;
  padding: var(--home-ve-top-pad-y) var(--home-ve-top-pad-x) !important;
  border-radius: calc(var(--home-ve-radius) - 6px) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-hero-grid {
  width: min(100%, var(--home-ve-feature-width)) !important;
  gap: calc(var(--home-ve-gap) * .6) !important;
  margin-top: var(--home-ve-hero-offset) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console,
html[data-theme] body.page-app:not(.page-admin) .home-workflow-strip {
  width: min(100%, var(--home-ve-console-width)) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid {
  width: min(100%, var(--home-ve-showcase-width)) !important;
  grid-template-columns: minmax(0, 1fr) minmax(220px, var(--home-ve-resource-width)) !important;
  gap: var(--home-ve-gap) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card,
html[data-theme] body.page-app:not(.page-admin) .home-console,
html[data-theme] body.page-app:not(.page-admin) .home-workflow-card,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main,
html[data-theme] body.page-app:not(.page-admin) .home-resource-panel,
html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd {
  background: rgba(255,255,255,var(--home-ve-glass)) !important;
  box-shadow: 0 22px 70px rgba(15,23,42,var(--home-ve-card-shadow)) !important;
  backdrop-filter: blur(var(--home-ve-blur)) saturate(1.1) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card {
  min-height: var(--home-ve-feature-height) !important;
  padding: var(--home-ve-card-pad) !important;
  border-radius: calc(var(--home-ve-radius) - 7px) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console {
  border-radius: var(--home-ve-radius) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console-head,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-head,
html[data-theme] body.page-app:not(.page-admin) .home-resource-panel .card-v3-head {
  padding-left: var(--home-ve-console-head-pad) !important;
  padding-right: var(--home-ve-console-head-pad) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-field textarea {
  min-height: var(--home-ve-prompt-height) !important;
  border-radius: calc(var(--home-ve-radius) - 6px) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-grid {
  gap: calc(var(--home-ve-gap) * .65) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-card {
  border-radius: calc(var(--home-ve-radius) - 8px) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--home-ve-gallery-min)), 1fr)) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs button.active,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-tabs button.active,
html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton {
  background: var(--home-ve-accent) !important;
  color: var(--home-ve-active-text) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console-head {
  min-height: 44px !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-form {
  padding: 10px 16px 12px !important;
  gap: 4px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-field textarea {
  min-height: 62px !important;
  max-height: 248px !important;
  padding: 11px 14px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell textarea {
  padding-right: 48px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar {
  gap: 8px !important;
  margin-top: 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-panel {
  padding: 2px 16px 4px !important;
}

html[data-theme] body.page-app:not(.page-admin) .compact-param-row {
  gap: 5px !important;
  margin: 0 0 3px !important;
}

html[data-theme] body.page-app:not(.page-admin) .compact-param-field label,
html[data-theme] body.page-app:not(.page-admin) .field-v3 label {
  margin-bottom: 3px !important;
}

@media (max-width: 1180px) {
  html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Final home showcase polish: wider collapsed layout, cleaner gallery cards. */
html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid {
  width: min(100%, 1080px) !important;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 280px) !important;
  gap: 16px !important;
  margin-top: 12px;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main,
html[data-theme] body.page-app:not(.page-admin) .home-resource-panel {
  border-color: rgba(255, 255, 255, .48) !important;
  border-radius: 22px !important;
  background: rgba(255, 255, 255, .72) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-head,
html[data-theme] body.page-app:not(.page-admin) .home-resource-panel .card-v3-head {
  min-height: 58px !important;
  padding: 13px 18px !important;
  border-bottom-color: rgba(15, 23, 42, .06) !important;
  background: rgba(255, 255, 255, .42) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-body,
html[data-theme] body.page-app:not(.page-admin) .home-resource-panel .card-v3-body {
  padding: 16px 18px 18px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList.grid-auto,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)) !important;
  gap: 20px 16px !important;
  align-items: start;
  overflow: visible;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact > .media-card-thumb,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact > .media-card-thumb {
  border-radius: 16px !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .09) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact .media-card-body,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact .media-card-body {
  padding: 10px 3px 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList .media-card-compact .prompt,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel .media-card-compact .prompt {
  font-size: 13.5px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-resource-panel .card-v3-body {
  display: grid;
  gap: 14px;
}

html[data-theme] body.page-app:not(.page-admin) .home-resource-links {
  gap: 8px;
}

html[data-theme] body.page-app:not(.page-admin) .home-resource-links a {
  min-height: 32px !important;
  border-radius: 999px !important;
}

html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .main-area {
  padding-left: clamp(30px, 3.2vw, 58px) !important;
  padding-right: clamp(30px, 3.2vw, 58px) !important;
}

html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-dashboard {
  width: min(100%, calc(100vw - 96px)) !important;
}

html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
  width: min(100%, calc(100vw - 120px)) !important;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 330px) !important;
  gap: 18px !important;
}

html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-main #historyList.grid-auto,
html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-main .home-showcase-panel.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)) !important;
}

@media (max-width: 1180px) {
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
    width: 100% !important;
    grid-template-columns: 1fr !important;
  }
}

/* Resource search is now embedded in the showcase header. */
html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid,
html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
  width: min(100%, calc(100vw - 112px)) !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 260px;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-search-inline {
  width: min(360px, 42vw);
  min-width: 220px;
  display: block;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-title {
  display: grid;
  grid-template-columns: auto minmax(220px, 360px);
  align-items: center;
  column-gap: 18px;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-title .sub {
  grid-column: 1;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-title .home-showcase-search-inline {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.home-slogan {
  display: none;
}

.home-slogan p {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0;
  text-align: center;
}

@media (max-width: 720px) {
  html[data-theme] body.page-app:not(.page-admin) .home-console > .home-slogan {
    position: absolute;
    top: -152px;
    right: auto;
    left: 50%;
    z-index: 6;
    width: max(0px, calc(100vw - 24px));
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 8px 6px !important;
    overflow: visible;
    transform: translateX(-50%);
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console > .home-slogan p {
    position: relative;
    z-index: 1;
    min-width: 0;
    max-width: 100%;
    color: #f8fafc;
    font-family: "STXingkai", "Xingkai SC", "华文行楷", "KaiTi", "楷体", cursive;
    font-size: clamp(22px, 6.8vw, 33.8px);
    font-weight: 900;
    line-height: 1.3;
    letter-spacing: 0;
    text-align: center;
    width: 100%;
    white-space: nowrap !important;
    text-wrap: nowrap;
    overflow-wrap: normal;
    text-shadow: 0 3px 16px rgba(0, 0, 0, .92), 0 1px 2px rgba(0, 0, 0, .95);
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console > .home-slogan strong {
    color: #3b82f6;
    font: inherit;
    text-shadow: 0 0 18px rgba(59, 130, 246, .58), 0 3px 14px rgba(0, 0, 0, .9);
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console > .home-slogan span {
    color: #f8fafc;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] body.page-app:not(.page-admin) .home-model-label-window.is-scrolling > span {
    animation: none !important;
  }
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-search-inline input {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 14px;
  background: rgba(255, 255, 255, .76);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .32);
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-search-inline input:focus {
  border-color: rgba(17, 24, 39, .20);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 0 0 4px rgba(17, 24, 39, .06);
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-search-inline input::placeholder {
  color: rgba(31, 41, 55, .44);
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList.grid-auto,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel.grid-auto,
html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-main #historyList.grid-auto,
html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-main .home-showcase-panel.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)) !important;
}

@media (max-width: 720px) {
  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row {
    position: absolute;
    top: 8px;
    right: 48px;
    left: 8px;
    z-index: 3;
    min-width: 0;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row::-webkit-scrollbar {
    display: none;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row > .home-file-tool {
    position: relative !important;
    inset: auto !important;
    z-index: auto !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-height: 30px !important;
    height: 30px !important;
    padding: 0 9px 0 6px !important;
    border-color: rgba(15, 23, 42, .08) !important;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, .9) !important;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .08) !important;
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row > .home-file-tool[hidden] {
    display: inline-flex !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row > .home-file-tool > span {
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-file-preview,
  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-reference-preview {
    min-width: 0 !important;
    display: contents !important;
    margin: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-file-chip,
  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-reference-chip {
    position: relative;
    width: 34px;
    min-width: 34px;
    max-width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: block;
    padding: 0;
    overflow: visible;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 8px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 3px 9px rgba(15, 23, 42, .1);
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-file-chip > span,
  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-reference-chip > strong {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-file-chip img,
  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-reference-chip img,
  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-reference-chip video,
  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-reference-audio {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 7px;
    object-fit: cover;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-file-chip button,
  html[data-theme] body.page-app:not(.page-admin) .home-prompt-media-row .home-reference-chip button {
    position: absolute;
    top: -4px;
    right: -4px;
    z-index: 2;
    width: 15px;
    height: 15px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .9);
    background: #111827;
    color: #fff;
    font-size: 11px;
    line-height: 13px;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-field textarea {
    padding-top: 54px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-capability-trigger {
    width: auto !important;
    min-width: 48px !important;
    padding: 0 10px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-capability-trigger > strong {
    max-width: none !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 11px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid,
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
    width: 100% !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-head {
    align-items: stretch;
    flex-direction: column;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-head-actions {
    width: 100%;
    min-width: 0;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-search-inline {
    width: 100%;
    min-width: 0;
  }
}

body.page-app:not(.page-admin) .home-resource-panel {
  display: none !important;
}

body.page-app:not(.page-admin) .home-showcase-grid,
body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
  width: min(100%, calc(100vw - 112px)) !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0 !important;
}

body.page-app:not(.page-admin) .home-showcase-head-actions {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1 1 auto;
}

body.page-app:not(.page-admin) .home-showcase-search-inline {
  display: block !important;
}

/* Home top bar: restrained dark glass with independent breathing nav pills. */
html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd {
  width: min(100%, calc(100vw - 112px)) !important;
  min-height: 64px !important;
  position: relative;
  isolation: isolate;
  z-index: 20;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center !important;
  gap: 16px !important;
  padding: 10px 12px 10px 14px !important;
  border: 1px solid rgba(255, 255, 255, .12) !important;
  border-radius: 19px !important;
  background: rgba(5, 9, 18, .74) !important;
  box-shadow:
    0 14px 38px rgba(0, 0, 0, .26),
    inset 0 1px 0 rgba(255, 255, 255, .1) !important;
  backdrop-filter: blur(18px) saturate(112%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(112%) !important;
  overflow: visible;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd::before {
  content: none;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd::after {
  content: none;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd > * {
  position: relative;
  z-index: 1;
}

@keyframes homeNavGlassBreath {
  0%, 100% {
    border-color: rgba(var(--home-nav-accent), .18);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .08);
  }
  50% {
    border-color: rgba(var(--home-nav-accent), .34);
    box-shadow: 0 5px 18px rgba(var(--home-nav-accent), .13), inset 0 1px 0 rgba(255, 255, 255, .12);
  }
}

html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-dashboard > .page-hd {
  width: min(100%, calc(100vw - 96px)) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-top-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #f8fbff;
  text-decoration: none;
  white-space: nowrap;
}

html[data-theme] body.page-app:not(.page-admin) .home-top-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 11px;
  background: rgba(255, 255, 255, .07);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

html[data-theme] body.page-app:not(.page-admin) .home-top-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(248, 251, 255, .94);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .02em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .34);
}

html[data-theme] body.page-app:not(.page-admin) .home-top-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}

html[data-theme] body.page-app:not(.page-admin) .home-top-nav a {
  --home-nav-accent: 56, 189, 248;
  min-height: 34px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid rgba(var(--home-nav-accent), .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
  color: rgba(226, 232, 240, .82);
  text-decoration: none;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .08);
  animation: homeNavGlassBreath 4.8s ease-in-out infinite;
  transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

html[data-theme] body.page-app:not(.page-admin) .home-top-nav a:nth-child(2n) { animation-delay: -1.6s; }
html[data-theme] body.page-app:not(.page-admin) .home-top-nav a:nth-child(3n) { animation-delay: -3.2s; }

html[data-theme] body.page-app:not(.page-admin) .home-top-nav a[data-nav-tone="violet"] { --home-nav-accent: 167, 139, 250; }
html[data-theme] body.page-app:not(.page-admin) .home-top-nav a[data-nav-tone="blue"] { --home-nav-accent: 96, 165, 250; }
html[data-theme] body.page-app:not(.page-admin) .home-top-nav a[data-nav-tone="indigo"] { --home-nav-accent: 129, 140, 248; }
html[data-theme] body.page-app:not(.page-admin) .home-top-nav a[data-nav-tone="pink"] { --home-nav-accent: 244, 114, 182; }
html[data-theme] body.page-app:not(.page-admin) .home-top-nav a[data-nav-tone="orange"] { --home-nav-accent: 251, 146, 60; }
html[data-theme] body.page-app:not(.page-admin) .home-top-nav a[data-nav-tone="amber"] { --home-nav-accent: 251, 191, 36; }

html[data-theme] body.page-app:not(.page-admin) .home-top-nav a::after {
  content: none;
}

html[data-theme] body.page-app:not(.page-admin) .home-top-nav a:hover,
html[data-theme] body.page-app:not(.page-admin) .home-top-nav a.is-active {
  border-color: rgba(var(--home-nav-accent), .48);
  background: rgba(255, 255, 255, .11);
  color: #fff;
  box-shadow: 0 0 20px rgba(var(--home-nav-accent), .19), inset 0 1px 0 rgba(255, 255, 255, .1);
  animation: none;
  transform: translateY(-1px);
}

html[data-theme] body.page-app:not(.page-admin) .home-top-nav a:hover::after,
html[data-theme] body.page-app:not(.page-admin) .home-top-nav a.is-active::after {
  content: none;
}

html[data-theme] body.page-app:not(.page-admin) .home-top-nav a.home-tutorial-nav {
  gap: 5px;
}
html[data-theme] body.page-app:not(.page-admin) .home-top-nav a.home-tutorial-nav:hover {
  border-color: rgba(251, 146, 60, .56);
  background: rgba(255, 255, 255, .11);
  color: #fff7ed;
}
html[data-theme="dark"] body.page-app:not(.page-admin) .home-top-nav a.home-tutorial-nav {
  color: #fed7aa;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .page-hd-actions {
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .btn,
html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .badge-balance {
  min-height: 36px !important;
  padding: 0 13px !important;
  border-radius: 999px !important;
  border-color: rgba(148, 163, 184, .32) !important;
  background: rgba(15, 23, 42, .58) !important;
  color: #f8fafc !important;
  box-shadow: 0 8px 22px rgba(2, 8, 23, .2), inset 0 1px 0 rgba(255, 255, 255, .08) !important;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .btn:hover,
html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .badge-balance:hover {
  border-color: rgba(103, 232, 249, .5) !important;
  background: rgba(8, 47, 73, .66) !important;
  box-shadow: 0 0 22px rgba(34, 211, 238, .18), inset 0 1px 0 rgba(255, 255, 255, .12) !important;
  transform: translateY(-1px);
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .badge-balance {
  border-color: rgba(148, 163, 184, .32) !important;
  background: rgba(15, 23, 42, .58) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-refresh-action:hover > span:first-child {
  display: inline-block;
  transform: rotate(180deg);
  transition: transform .45s ease;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .badge-balance .num {
  font-size: 15px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .badge-balance .label {
  font-size: 12px !important;
}

@media (max-width: 980px) {
  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd {
    width: 100% !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-top-name {
    max-width: 120px;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-top-nav {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-top-nav::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 720px) {
  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd {
    min-height: 0 !important;
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 8px !important;
    padding: 9px !important;
    border-radius: 16px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-top-name {
    display: none;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-top-nav a {
    padding: 0 10px;
    font-size: 11px;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-top-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    justify-content: flex-start;
    padding-top: 7px;
    border-top: 1px solid rgba(148, 163, 184, .16);
  }

  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .page-hd-actions {
    justify-self: end;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .btn span:last-child,
  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .badge-balance .label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] body.page-app:not(.page-admin) .home-top-nav a {
    animation: none;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-top-nav a,
  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .btn,
  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd .badge-balance {
    transition: none !important;
  }
}

/* Must stay last: user-requested compact floating creation panel controls. */
html[data-theme] body.page-app:not(.page-admin) .home-console {
  position: relative !important;
  margin-top: 74px !important;
  padding-top: 0 !important;
  padding-bottom: 12px !important;
  overflow: visible !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console-head {
  position: absolute !important;
  z-index: 7 !important;
  left: 0 !important;
  right: 0 !important;
  top: -64px !important;
  min-height: 48px !important;
  padding: 0 2px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  border-bottom: 0 !important;
  background: transparent !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console-head > div {
  min-height: 46px !important;
  display: inline-grid !important;
  align-content: center !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  animation: none !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs {
  position: static !important;
  z-index: 6 !important;
  top: auto !important;
  right: auto !important;
  width: auto !important;
  max-width: calc(100% - 36px) !important;
  padding: 3px !important;
  border: 1px solid rgba(255, 255, 255, .68) !important;
  border-radius: 999px !important;
  background: linear-gradient(120deg, rgba(255,255,255,.72), rgba(236,253,245,.76), rgba(255,247,237,.74), rgba(255,255,255,.72)) !important;
  background-size: 260% 260% !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .12) !important;
  backdrop-filter: blur(18px) saturate(1.25) !important;
  animation: homeFloatingPillShift 9s ease infinite !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs button,
html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar .btn,
html[data-theme] body.page-app:not(.page-admin) .home-file-tool,
html[data-theme] body.page-app:not(.page-admin) .home-cost-hint,
html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton {
  min-height: 34px !important;
  border: 1px solid rgba(255, 255, 255, .62) !important;
  border-radius: 999px !important;
  background: linear-gradient(120deg, rgba(255,255,255,.78), rgba(240,253,250,.74), rgba(255,247,237,.78), rgba(255,255,255,.76)) !important;
  background-size: 240% 240% !important;
  color: #172033 !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .11) !important;
  backdrop-filter: blur(16px) saturate(1.18) !important;
  animation: homeFloatingPillShift 8s ease infinite !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs button {
  flex: 0 0 auto !important;
  padding: 0 15px !important;
  box-shadow: none !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs button.active {
  border-color: rgba(255, 122, 24, .72) !important;
  background: linear-gradient(120deg, #ff7a18, #ff9f1c, #ff6a00, #ff8a1f) !important;
  background-size: 240% 240% !important;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(255, 122, 24, .26) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton {
  border-color: rgba(17, 24, 39, .82) !important;
  background: linear-gradient(120deg, #050505, #151515, #1d1d1d, #050505) !important;
  background-size: 240% 240% !important;
  color: #fff !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console-body {
  position: relative !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-form {
  position: relative !important;
  padding: 18px 18px 0 !important;
  gap: 8px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar {
  position: static !important;
  z-index: auto !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  display: flex !important;
  gap: 8px !important;
  transform: none !important;
  pointer-events: auto !important;
  margin-top: -2px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar .home-create-actions {
  padding-right: 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar > * {
  pointer-events: auto !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-actions {
  margin-left: auto !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-field {
  margin: 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-field textarea {
  height: 86px !important;
  min-height: 86px !important;
  max-height: 128px !important;
  padding: 14px 48px 12px 16px !important;
  border-radius: 24px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell textarea {
  padding-right: 48px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-panel {
  padding: 4px 18px 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .compact-param-row {
  gap: 8px !important;
  margin: 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-file-preview:empty,
html[data-theme] body.page-app:not(.page-admin) .home-reference-preview:empty {
  display: none !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-file-preview,
html[data-theme] body.page-app:not(.page-admin) .home-reference-preview {
  margin: 6px 0 0 !important;
  min-height: 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .compact-param-field select,
html[data-theme] body.page-app:not(.page-admin) .compact-param-field input[type="text"],
html[data-theme] body.page-app:not(.page-admin) .compact-param-field input[type="number"],
html[data-theme] body.page-app:not(.page-admin) .field-v3 select,
html[data-theme] body.page-app:not(.page-admin) .field-v3 input[type="text"],
html[data-theme] body.page-app:not(.page-admin) .field-v3 input[type="number"] {
  min-height: 34px !important;
  height: 34px !important;
}

@media (max-width: 720px) {
  html[data-theme] body.page-app:not(.page-admin) .home-console {
    margin-top: 104px !important;
    padding-top: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console-head {
    top: -96px !important;
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs {
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    overflow-x: auto !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-form {
    padding-top: 16px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar {
    align-items: flex-start !important;
    overflow-x: auto !important;
    transform: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-actions {
    width: auto !important;
    flex: 0 0 auto !important;
  }
}

html[data-theme] body.home-prompt-modal-open {
  overflow: hidden !important;
}

/* Model/capability controls are rendered in toolbar popovers; remove their old rows. */
html[data-theme] body:not(.page-admin) [data-home-model-source],
html[data-theme] body:not(.page-admin) .home-mode-panel.is-capability-relocated {
  display: none !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console.has-open-tool-popover,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer.has-open-tool-popover {
  z-index: 3600 !important;
  overflow: visible !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console.has-open-tool-popover .home-console-body,
html[data-theme] body.page-app:not(.page-admin) .home-console.has-open-tool-popover .home-create-form,
html[data-theme] body.page-app:not(.page-admin) .home-console.has-open-tool-popover .home-create-toolbar,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer.has-open-tool-popover .home-create-form,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer.has-open-tool-popover .home-create-toolbar {
  overflow: visible !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console .home-mode-panel.is-capability-relocated,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-panel.is-capability-relocated {
  min-height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-modal {
  z-index: 2147483000 !important;
  background: rgba(10, 14, 24, .42) !important;
  backdrop-filter: blur(22px) saturate(.9) !important;
  -webkit-backdrop-filter: blur(22px) saturate(.9) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-modal-panel {
  position: relative !important;
  z-index: 2147483001 !important;
  width: min(72vw, 1080px) !important;
  height: min(68vh, 760px) !important;
  background: rgba(255, 255, 255, .94) !important;
  box-shadow: 0 36px 110px rgba(0, 0, 0, .32) !important;
}

html[data-theme] body.page-app:not(.page-admin):not(.home-layout-editing) .home-project-thread {
  display: none !important;
}

.home-history-dialog-body {
  display: grid;
  gap: 16px;
}

.home-history-dialog-preview {
  display: grid;
  place-items: center;
  max-height: 58vh;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(15, 23, 42, .06);
}

.home-history-dialog-preview img,
.home-history-dialog-preview video {
  display: block;
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
}

.home-history-dialog-preview audio {
  width: min(100%, 560px);
  margin: 24px;
}

/* Resource/developer pages share the creation workbench backdrop and one glass shell. */
html[data-theme] body.page-shop:not(.page-admin)::before,
html[data-theme] body.page-records:not(.page-admin)::before,
html[data-theme] body.page-gallery:not(.page-admin)::before,
html[data-theme] body.page-invite:not(.page-admin)::before,
html[data-theme] body.page-credits:not(.page-admin)::before,
html[data-theme] body.page-earnings:not(.page-admin)::before,
html[data-theme] body.page-api-tokens:not(.page-admin)::before {
  background: var(--home-bg-image) center var(--home-ve-bg-y) / cover no-repeat !important;
  filter: blur(var(--home-bg-blur));
}

html[data-theme] body.page-shop:not(.page-admin) .main-area,
html[data-theme] body.page-records:not(.page-admin) .main-area,
html[data-theme] body.page-gallery:not(.page-admin) .main-area,
html[data-theme] body.page-invite:not(.page-admin) .main-area,
html[data-theme] body.page-credits:not(.page-admin) .main-area,
html[data-theme] body.page-earnings:not(.page-admin) .main-area,
html[data-theme] body.page-api-tokens:not(.page-admin) .main-area {
  background:
    linear-gradient(180deg, rgba(7,14,28,.08), rgba(255,255,255,var(--home-ve-bg-fade)) 78%, rgba(255,255,255,.36)),
    var(--home-bg-image) center var(--home-ve-bg-y) / cover fixed no-repeat !important;
  padding: clamp(22px, 3vw, 38px) clamp(18px, 3vw, 42px) !important;
}

html[data-theme] body.page-shop:not(.page-admin) .main-area > main,
html[data-theme] body.page-records:not(.page-admin) .main-area > main,
html[data-theme] body.page-gallery:not(.page-admin) .main-area > main,
html[data-theme] body.page-invite:not(.page-admin) .main-area > main,
html[data-theme] body.page-credits:not(.page-admin) .main-area > main,
html[data-theme] body.page-earnings:not(.page-admin) .main-area > main,
html[data-theme] body.page-api-tokens:not(.page-admin) .main-area > main {
  width: min(100%, 1120px) !important;
  max-width: 1120px !important;
  min-height: calc(100vh - clamp(44px, 6vw, 76px)) !important;
  margin: 0 auto !important;
  padding: clamp(18px, 2.3vw, 28px) !important;
  border: 1px solid rgba(255, 255, 255, .48) !important;
  border-radius: 24px !important;
  background: rgba(255, 255, 255, .70) !important;
  box-shadow: 0 28px 86px rgba(15, 23, 42, .18) !important;
  backdrop-filter: blur(var(--home-ve-blur, 18px)) saturate(1.08) !important;
  -webkit-backdrop-filter: blur(var(--home-ve-blur, 18px)) saturate(1.08) !important;
}

html[data-theme="dark"] body.page-shop:not(.page-admin) .main-area > main,
html[data-theme="dark"] body.page-records:not(.page-admin) .main-area > main,
html[data-theme="dark"] body.page-gallery:not(.page-admin) .main-area > main,
html[data-theme="dark"] body.page-invite:not(.page-admin) .main-area > main,
html[data-theme="dark"] body.page-credits:not(.page-admin) .main-area > main,
html[data-theme="dark"] body.page-api-tokens:not(.page-admin) .main-area > main {
  border-color: rgba(255, 255, 255, .14) !important;
  background: rgba(15, 23, 42, .70) !important;
  box-shadow: 0 28px 86px rgba(0, 0, 0, .34) !important;
}

html[data-theme] body.page-shop:not(.page-admin) .page-hd,
html[data-theme] body.page-records:not(.page-admin) .page-hd,
html[data-theme] body.page-gallery:not(.page-admin) .page-hd,
html[data-theme] body.page-invite:not(.page-admin) .page-hd,
html[data-theme] body.page-credits:not(.page-admin) .page-hd,
html[data-theme] body.page-earnings:not(.page-admin) .page-hd,
html[data-theme] body.page-api-tokens:not(.page-admin) .page-hd,
html[data-theme] body.page-shop:not(.page-admin) .card-v3,
html[data-theme] body.page-records:not(.page-admin) .card-v3,
html[data-theme] body.page-gallery:not(.page-admin) .card-v3,
html[data-theme] body.page-credits:not(.page-admin) .card-v3,
html[data-theme] body.page-api-tokens:not(.page-admin) .card-v3,
html[data-theme] body.page-shop:not(.page-admin) .pricing-card,
html[data-theme] body.page-shop:not(.page-admin) .balance-banner,
html[data-theme] body.page-shop:not(.page-admin) .order-item,
html[data-theme] body.page-invite:not(.page-admin) .invite-stat,
html[data-theme] body.page-invite:not(.page-admin) .invite-section,
html[data-theme] body.page-credits:not(.page-admin) .credits-stat,
html[data-theme] body.page-earnings:not(.page-admin) .earn-metric,
html[data-theme] body.page-earnings:not(.page-admin) .earn-section,
html[data-theme] body.page-earnings:not(.page-admin) .earn-form,
html[data-theme] body.page-credits:not(.page-admin) .credits-item,
html[data-theme] body.page-gallery:not(.page-admin) .media-card,
html[data-theme] body.page-records:not(.page-admin) .media-card {
  background: rgba(255, 255, 255, .72) !important;
  border-color: rgba(255, 255, 255, .46) !important;
  box-shadow: 0 14px 38px rgba(15, 23, 42, .08) !important;
  backdrop-filter: blur(14px) saturate(1.05) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.05) !important;
}

html[data-theme="dark"] body.page-shop:not(.page-admin) .page-hd,
html[data-theme="dark"] body.page-records:not(.page-admin) .page-hd,
html[data-theme="dark"] body.page-gallery:not(.page-admin) .page-hd,
html[data-theme="dark"] body.page-invite:not(.page-admin) .page-hd,
html[data-theme="dark"] body.page-credits:not(.page-admin) .page-hd,
html[data-theme="dark"] body.page-earnings:not(.page-admin) .page-hd,
html[data-theme="dark"] body.page-api-tokens:not(.page-admin) .page-hd,
html[data-theme="dark"] body.page-shop:not(.page-admin) .card-v3,
html[data-theme="dark"] body.page-records:not(.page-admin) .card-v3,
html[data-theme="dark"] body.page-gallery:not(.page-admin) .card-v3,
html[data-theme="dark"] body.page-credits:not(.page-admin) .card-v3,
html[data-theme="dark"] body.page-api-tokens:not(.page-admin) .card-v3,
html[data-theme="dark"] body.page-shop:not(.page-admin) .pricing-card,
html[data-theme="dark"] body.page-shop:not(.page-admin) .balance-banner,
html[data-theme="dark"] body.page-shop:not(.page-admin) .order-item,
html[data-theme="dark"] body.page-invite:not(.page-admin) .invite-stat,
html[data-theme="dark"] body.page-invite:not(.page-admin) .invite-section,
html[data-theme="dark"] body.page-credits:not(.page-admin) .credits-stat,
html[data-theme="dark"] body.page-earnings:not(.page-admin) .earn-metric,
html[data-theme="dark"] body.page-earnings:not(.page-admin) .earn-section,
html[data-theme="dark"] body.page-earnings:not(.page-admin) .earn-form,
html[data-theme="dark"] body.page-credits:not(.page-admin) .credits-item,
html[data-theme="dark"] body.page-gallery:not(.page-admin) .media-card,
html[data-theme="dark"] body.page-records:not(.page-admin) .media-card {
  background: rgba(15, 23, 42, .62) !important;
  border-color: rgba(255, 255, 255, .12) !important;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .20) !important;
}

@media (max-width: 720px) {
  html[data-theme] body.page-shop:not(.page-admin) .main-area,
  html[data-theme] body.page-records:not(.page-admin) .main-area,
  html[data-theme] body.page-gallery:not(.page-admin) .main-area,
  html[data-theme] body.page-invite:not(.page-admin) .main-area,
  html[data-theme] body.page-credits:not(.page-admin) .main-area,
  html[data-theme] body.page-earnings:not(.page-admin) .main-area,
  html[data-theme] body.page-api-tokens:not(.page-admin) .main-area {
    padding: 14px 12px !important;
  }

  html[data-theme] body.page-shop:not(.page-admin) .main-area > main,
  html[data-theme] body.page-records:not(.page-admin) .main-area > main,
  html[data-theme] body.page-gallery:not(.page-admin) .main-area > main,
  html[data-theme] body.page-invite:not(.page-admin) .main-area > main,
  html[data-theme] body.page-credits:not(.page-admin) .main-area > main,
  html[data-theme] body.page-earnings:not(.page-admin) .main-area > main,
  html[data-theme] body.page-api-tokens:not(.page-admin) .main-area > main {
    min-height: calc(100vh - 28px) !important;
    padding: 14px !important;
    border-radius: 18px !important;
  }
}

@keyframes sidebarOrangeBreath {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(255, 142, 38, .92),
      0 0 12px rgba(255, 118, 20, .58),
      0 0 34px rgba(255, 96, 12, .30),
      16px 28px 76px rgba(7, 12, 22, .36),
      inset -2px 0 0 rgba(8, 13, 23, .96),
      inset 0 1px 0 rgba(255, 229, 188, .22);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 196, 94, 1),
      0 0 22px rgba(255, 122, 20, .88),
      0 0 54px rgba(255, 84, 10, .46),
      18px 30px 84px rgba(7, 12, 22, .38),
      inset -2px 0 0 rgba(8, 13, 23, .96),
      inset 0 1px 0 rgba(255, 229, 188, .26);
  }
}

/* User sidebar: elevated pull-out drawer with rounded vertical edges. */
html[data-theme] body:not(.page-admin),
html[data-theme] body:not(.page-admin) .app-layout {
  background:
    linear-gradient(180deg, rgba(7,13,24,.82), rgba(10,16,28,.76)),
    var(--home-bg-image, #08111f) center / cover fixed no-repeat !important;
}

html[data-theme] body:not(.page-admin) .sidebar {
  --user-drawer-width: calc(var(--sidebar-width) - clamp(14px, 1.7vw, 22px));
  top: 12px !important;
  left: 0 !important;
  bottom: 12px !important;
  width: var(--user-drawer-width) !important;
  background:
    linear-gradient(180deg, rgba(7, 13, 24, .78), rgba(11, 17, 29, .66)),
    var(--home-bg-image, linear-gradient(145deg, #eef4fb, #f7fbff)) center var(--home-ve-bg-y, 2%) / cover fixed no-repeat !important;
  border: 0 !important;
  border-radius: 0 24px 24px 0 !important;
  box-shadow:
    0 0 0 1px rgba(255, 142, 38, .92),
    0 0 12px rgba(255, 118, 20, .58),
    0 0 34px rgba(255, 96, 12, .30),
    16px 28px 76px rgba(7, 12, 22, .36),
    inset -2px 0 0 rgba(8, 13, 23, .96),
    inset 0 1px 0 rgba(255, 229, 188, .22) !important;
  animation: sidebarOrangeBreath 2.8s ease-in-out infinite !important;
  backdrop-filter: blur(30px) saturate(.9) !important;
  -webkit-backdrop-filter: blur(30px) saturate(.9) !important;
  overflow: visible !important;
  will-change: transform, box-shadow !important;
  transform: translateZ(0) !important;
  transition:
    transform 420ms cubic-bezier(.22, 1, .36, 1),
    box-shadow 420ms ease,
    background 420ms ease,
    backdrop-filter 420ms ease,
    -webkit-backdrop-filter 420ms ease !important;
}

html[data-theme] body:not(.page-admin) .sidebar::before {
  content: none !important;
}

html[data-theme] body:not(.page-admin) .sidebar::after {
  content: none !important;
}

html[data-theme] body:not(.page-admin) .sidebar > * {
  position: relative !important;
  z-index: 2 !important;
}

html[data-theme] body:not(.page-admin) .sidebar-header,
html[data-theme] body:not(.page-admin) .sidebar-footer {
  background: rgba(8, 13, 23, .10) !important;
  border-color: transparent !important;
}

html[data-theme] body:not(.page-admin) .sidebar-nav-item,
html[data-theme] body:not(.page-admin) .sidebar-history-item,
html[data-theme] body:not(.page-admin) .sidebar-user,
html[data-theme] body:not(.page-admin) .sidebar-balance,
html[data-theme] body:not(.page-admin) .sidebar-action-btn {
  border: 1px solid transparent !important;
  background: rgba(238, 248, 255, .15) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .18),
    0 10px 28px rgba(0, 0, 0, .12) !important;
  backdrop-filter: blur(12px) saturate(.92) !important;
  -webkit-backdrop-filter: blur(12px) saturate(.92) !important;
}

html[data-theme] body:not(.page-admin) .sidebar-brand {
  min-height: 54px !important;
  padding: 6px 8px !important;
  border: 1px solid rgba(255, 210, 160, .30) !important;
  border-radius: 16px !important;
  background: rgba(244, 250, 255, .20) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .24),
    0 12px 34px rgba(0, 0, 0, .14) !important;
  backdrop-filter: blur(14px) saturate(.96) !important;
  -webkit-backdrop-filter: blur(14px) saturate(.96) !important;
}

html[data-theme] body:not(.page-admin) .sidebar-brand-text.is-platform-only h1 {
  height: clamp(34px, 4vw, 42px) !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 1px !important;
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
  font-size: clamp(11px, 1.15vw, 13px) !important;
  line-height: 1.15 !important;
  font-weight: 760 !important;
  letter-spacing: 0 !important;
}

html[data-theme] body:not(.page-admin) .sidebar-brand-text.is-platform-only h1 span {
  display: block !important;
  white-space: nowrap !important;
}

html[data-theme] body:not(.page-admin) .sidebar-collapse-btn {
  border-color: rgba(255, 210, 160, .34) !important;
  background: rgba(244, 250, 255, .18) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .20), 0 10px 24px rgba(0, 0, 0, .12) !important;
  backdrop-filter: blur(14px) saturate(.96) !important;
  -webkit-backdrop-filter: blur(14px) saturate(.96) !important;
}

html[data-theme] body:not(.page-admin) .sidebar-nav-item::before {
  content: none !important;
}

html[data-theme] body:not(.page-admin) .sidebar-nav-item:hover,
html[data-theme] body:not(.page-admin) .sidebar-nav-item.active,
html[data-theme] body:not(.page-admin) .sidebar-history-item:hover,
html[data-theme] body:not(.page-admin) .sidebar-history-item.active,
html[data-theme] body:not(.page-admin) .sidebar-user:hover,
html[data-theme] body:not(.page-admin) .sidebar-action-btn:hover {
  background: rgba(255, 255, 255, .26) !important;
  border-color: rgba(255, 210, 160, .32) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .20),
    0 14px 34px rgba(0, 0, 0, .16) !important;
}

html[data-theme] body:not(.page-admin) .sidebar-nav-item.active {
  color: var(--sidebar-text-hover) !important;
  background: rgba(255, 255, 255, .30) !important;
  border-color: rgba(255, 205, 145, .42) !important;
  box-shadow:
    inset 3px 0 0 rgba(255, 151, 56, .78),
    inset 0 1px 0 rgba(255, 255, 255, .20),
    0 14px 36px rgba(0, 0, 0, .18) !important;
}

html[data-theme] body:not(.page-admin) .sidebar-history-list {
  box-sizing: border-box !important;
  height: clamp(180px, 28vh, 300px);
  min-height: 120px;
  max-height: min(42vh, 460px);
  margin: 8px 10px 18px !important;
  padding: 8px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  resize: vertical !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  border-radius: 12px !important;
  background: rgba(8,13,23,.22) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 10px 28px rgba(0,0,0,.12) !important;
  opacity: 1 !important;
  transition: max-height 220ms ease, opacity 160ms ease, margin 220ms ease !important;
}

html[data-theme] body:not(.page-admin) .sidebar-history-list.is-collapsed {
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

html[data-theme] body:not(.page-admin) .sidebar-history-head-actions {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
}

html[data-theme] body:not(.page-admin) .sidebar-history-toggle {
  width: 24px !important;
  height: 24px !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  border-radius: 6px !important;
  background: rgba(255,255,255,.12) !important;
  color: inherit !important;
  cursor: pointer !important;
}

html[data-theme] body:not(.page-admin) .sidebar-history-toggle svg {
  width: 14px !important;
  height: 14px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
  transition: transform 180ms ease !important;
}

html[data-theme] body:not(.page-admin) .sidebar-history-toggle.is-collapsed svg {
  transform: rotate(-90deg) !important;
}

html[data-theme] body:not(.page-admin) .sidebar-actions {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 6px !important;
  align-items: stretch !important;
}

html[data-theme] body:not(.page-admin) .sidebar-actions .sidebar-action-btn {
  grid-column: span 2 !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 38px !important;
  padding-inline: 7px !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  font-size: 11px !important;
}

html[data-theme] body:not(.page-admin) .sidebar-actions .sidebar-action-btn > span:not(.action-icon) {
  min-width: max-content !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}

html[data-theme] body:not(.page-admin) .sidebar-actions .theme-picker {
  grid-column: span 2 !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-theme] body:not(.page-admin) .sidebar-actions .theme-picker .theme-toggle {
  width: 100% !important;
  min-height: 38px !important;
  margin: 0 !important;
}

html[data-theme] body:not(.page-admin) .sidebar-actions > .sidebar-action-btn:nth-last-child(2),
html[data-theme] body:not(.page-admin) .sidebar-actions > .sidebar-action-btn:last-child {
  grid-column: span 3 !important;
}

html[data-theme] body:not(.page-admin) .sidebar-actions .sidebar-balance {
  display: inline-flex !important;
  justify-content: center !important;
  gap: 5px !important;
  min-height: 32px !important;
  margin: 0 !important;
  color: var(--sidebar-text) !important;
  text-decoration: none !important;
  padding: 0 8px !important;
  border-radius: var(--radius-sm) !important;
  background: rgba(238,248,255,.15) !important;
}

html[data-theme] body:not(.page-admin) .sidebar-actions .sidebar-balance strong {
  color: var(--sidebar-accent) !important;
  font-size: inherit !important;
}

html[data-theme] body:not(.page-admin) .main-area {
  margin-left: calc(var(--sidebar-width) - clamp(14px, 1.7vw, 22px) - 10px) !important;
}

html[data-theme] body:not(.page-admin).sidebar-collapsed .sidebar {
  transform: translate3d(calc(-1 * (var(--sidebar-width) + 72px)), 0, 0) !important;
}

html[data-theme] body:not(.page-admin).sidebar-open .sidebar,
html[data-theme] body:not(.page-admin):not(.sidebar-collapsed) .sidebar {
  transform: translate3d(0, 0, 0) !important;
}

html[data-theme] body:not(.page-admin).sidebar-collapsed .main-area,
html[data-theme] body.page-designer-canvas.sidebar-collapsed .main-area {
  margin-left: 0 !important;
}

@media (max-width: 1024px) {
  html[data-theme] body:not(.page-admin) .sidebar {
    top: 8px !important;
    left: 0 !important;
    bottom: 8px !important;
    width: min(320px, calc(100vw - 8px)) !important;
    border-radius: 0 20px 20px 0 !important;
  }

  html[data-theme] body:not(.page-admin) .main-area {
    margin-left: 0 !important;
  }

  html[data-theme] body:not(.page-admin).sidebar-open .sidebar {
    transform: translate3d(0, 0, 0) !important;
  }
}

/* Creation room bottom composer: keep controls tight to the input. */
html[data-theme] body.page-creation:not(.page-admin) .creation-composer.home-console {
  bottom: clamp(42px, 5.8vh, 72px) !important;
  padding: 0 !important;
  width: min(84vw, 980px) !important;
  max-width: calc(100vw - 310px) !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-form {
  padding: 14px 18px 16px !important;
  gap: 5px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-toolbar {
  order: 1;
  align-items: center !important;
  gap: 6px !important;
  margin: 0 0 4px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-field {
  order: 3;
  margin: 0 !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-file-preview {
  order: 4;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-reference-preview {
  order: 5;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-panel {
  order: 2;
  padding: 0 0 5px !important;
  max-height: 112px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateMessage {
  order: 6;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-field label {
  display: none !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-field textarea {
  height: 58px !important;
  min-height: 58px !important;
  max-height: 108px !important;
  padding: 13px 46px 11px 16px !important;
  border-radius: 16px !important;
  line-height: 1.35 !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-expand {
  top: 10px !important;
  right: 10px !important;
  width: 26px !important;
  height: 26px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-tabs {
  order: -1;
  margin-right: 2px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-file-tool,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-toolbar .btn,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-tabs button,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-cost-hint,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton {
  min-height: 32px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-actions {
  margin-left: auto !important;
  gap: 6px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-file-preview,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-reference-preview {
  margin-top: 2px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-row {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)) !important;
  gap: 6px !important;
  margin: 0 !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field > label,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-model-fields .field-v3 label {
  display: block !important;
  margin-bottom: 3px !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
  color: var(--text-muted) !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field select,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field input[type="text"],
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field input[type="number"] {
  height: 32px !important;
  min-height: 32px !important;
  border-radius: 9px !important;
  font-size: 12px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-thread {
  padding-bottom: 178px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-modal {
  inset: var(--prompt-modal-top, 0) auto auto var(--prompt-modal-left, 0) !important;
  width: var(--prompt-modal-width, 100vw) !important;
  height: var(--prompt-modal-height, 100vh) !important;
  z-index: 9000 !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  background: rgba(15, 23, 42, .28) !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-modal.hidden {
  display: none !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-modal-panel {
  width: min(78%, 920px) !important;
  height: min(68%, 680px) !important;
  min-width: min(92%, 520px) !important;
  min-height: min(78%, 390px) !important;
  margin: 0 !important;
}

@media (max-width: 720px) {
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer.home-console {
    bottom: 26px !important;
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-form {
    padding: 10px 12px 12px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-toolbar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-actions {
    width: auto !important;
    flex: 0 0 auto !important;
  }
}

/* Creation room containment: every surface stays inside the rounded room frame. */
html[data-theme] body.page-creation:not(.page-admin) .main-area {
  overflow: hidden !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-workspace {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: 236px minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  height: calc(100vh - clamp(36px, 5vw, 68px)) !important;
  max-height: calc(100vh - clamp(36px, 5vw, 68px)) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar {
  position: relative !important;
  top: auto !important;
  height: auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-main {
  min-height: 0 !important;
  height: 100% !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  overflow: hidden !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-topbar {
  flex: 0 0 auto !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-thread {
  min-height: 0 !important;
  overflow-y: auto !important;
  padding-bottom: 18px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer.home-console {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 3 !important;
  width: min(calc(100% - 32px), 980px) !important;
  max-width: calc(100% - 32px) !important;
  margin: 0 auto 16px !important;
  transform: none !important;
  align-self: end !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-result-media {
  max-width: 100% !important;
  min-width: 0 !important;
}

@media (max-width: 860px) {
  html[data-theme] body.page-creation:not(.page-admin) .creation-workspace {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar {
    max-height: 190px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer.home-console {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    margin-bottom: 10px !important;
  }
}

/* Creation room final sizing: compact composer and in-frame prompt modal. */
html[data-theme] body.page-creation:not(.page-admin) .creation-main {
  position: relative !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-main > .home-prompt-modal {
  position: absolute !important;
  inset: 0 !important;
  z-index: 40 !important;
  width: auto !important;
  height: auto !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  background: rgba(15, 23, 42, .28) !important;
  backdrop-filter: blur(12px) saturate(.9) !important;
  -webkit-backdrop-filter: blur(12px) saturate(.9) !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-main > .home-prompt-modal.hidden {
  display: none !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-main > .home-prompt-modal .home-prompt-modal-panel {
  width: min(72%, 720px) !important;
  height: min(62%, 560px) !important;
  min-width: min(86%, 460px) !important;
  min-height: min(72%, 340px) !important;
  margin: 0 !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer.home-console {
  width: min(66.666%, 720px) !important;
  max-width: min(66.666%, 720px) !important;
  margin: 0 auto 8px !important;
  border-radius: 14px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-form {
  padding: 8px 12px 8px !important;
  gap: 3px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-toolbar {
  gap: 5px !important;
  margin-bottom: 3px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-panel {
  max-height: 82px !important;
  padding-bottom: 3px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-field textarea {
  height: 46px !important;
  min-height: 46px !important;
  max-height: 86px !important;
  padding: 10px 40px 9px 13px !important;
  border-radius: 14px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-expand {
  top: 8px !important;
  right: 8px !important;
  width: 24px !important;
  height: 24px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-file-tool,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-toolbar .btn,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-tabs button,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-cost-hint,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton {
  min-height: 28px !important;
  padding-top: 3px !important;
  padding-bottom: 3px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field select,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field input[type="text"],
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field input[type="number"] {
  height: 28px !important;
  min-height: 28px !important;
}

@media (max-width: 860px) {
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer.home-console {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
  }
}

/* Final compact prompt panel tuning */
html[data-theme] body.page-app:not(.page-admin) .home-console {
  padding-bottom: 8px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-form {
  padding: 10px 14px 8px !important;
  gap: 6px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-field textarea {
  min-height: 72px !important;
  height: auto !important;
  max-height: 216px !important;
  padding: 12px 46px 10px 14px !important;
  border-radius: 21px !important;
  overflow-y: hidden;
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-expand {
  top: 8px !important;
  right: 8px !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar {
  gap: 7px !important;
  margin-top: 2px !important;
  align-items: center !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-mode-panel {
  padding: 2px 14px 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-file-preview,
html[data-theme] body.page-app:not(.page-admin) .home-reference-preview {
  margin-top: 2px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-field textarea {
  height: auto !important;
  max-height: 126px !important;
  overflow-y: hidden;
}

html[data-theme] body.page-app:not(.page-admin) .home-console > .home-prompt-modal,
html[data-theme] body.page-creation:not(.page-admin) .creation-main > .home-prompt-modal {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 9000 !important;
  display: grid !important;
  place-items: center !important;
  padding: 18px !important;
  background: rgba(15, 23, 42, .24) !important;
  backdrop-filter: blur(16px) saturate(.95) !important;
  -webkit-backdrop-filter: blur(16px) saturate(.95) !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console > .home-prompt-modal.hidden,
html[data-theme] body.page-creation:not(.page-admin) .creation-main > .home-prompt-modal.hidden {
  display: none !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console > .home-prompt-modal .home-prompt-modal-panel,
html[data-theme] body.page-creation:not(.page-admin) .creation-main > .home-prompt-modal .home-prompt-modal-panel {
  width: min(86%, 1180px) !important;
  height: min(86%, 920px) !important;
  min-width: min(92%, 520px) !important;
  min-height: min(86%, 620px) !important;
  margin: 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-console > .home-prompt-modal textarea,
html[data-theme] body.page-creation:not(.page-admin) .creation-main > .home-prompt-modal textarea {
  min-height: 420px !important;
}

/* Creation room composer: inline parameter labels to reduce vertical height. */
html[data-theme] body.page-creation:not(.page-admin) .creation-composer.home-console {
  width: min(73.333%, 792px) !important;
  max-width: min(73.333%, 792px) !important;
  margin-bottom: 4px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-form {
  padding: 6px 10px 6px !important;
  gap: 2px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-panel {
  max-height: 70px !important;
  padding-bottom: 2px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-row {
  gap: 5px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field {
  position: relative !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field:not(.home-toggle-field) > label,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-model-fields .field-v3:not(.home-toggle-field) > label {
  position: absolute !important;
  left: 10px !important;
  top: 50% !important;
  z-index: 2 !important;
  max-width: 54px !important;
  margin: 0 !important;
  overflow: hidden !important;
  color: var(--text-muted) !important;
  font-size: 11px !important;
  line-height: 1 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  pointer-events: none !important;
  transform: translateY(-50%) !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field select,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field input[type="text"],
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field input[type="number"] {
  height: 30px !important;
  min-height: 30px !important;
  padding-left: 70px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-toggle-field {
  min-height: 30px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-field textarea {
  height: 42px !important;
  min-height: 42px !important;
  max-height: 76px !important;
  padding-top: 9px !important;
  padding-bottom: 8px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-toolbar {
  margin-bottom: 2px !important;
}

@media (max-width: 860px) {
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer.home-console {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
  }
}

html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell textarea,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-shell textarea {
  max-height: min(52vh, 520px) !important;
  resize: none !important;
  overflow-y: auto !important;
  padding-left: 48px !important;
}

/* Wide-screen responsiveness: let dense user pages breathe on 2K/4K monitors. */
@media (min-width: 1440px) {
  html[data-theme] body:not(.page-admin):not(.page-designer-canvas) .main-area {
    padding-left: clamp(34px, 3.8vw, 72px) !important;
    padding-right: clamp(34px, 3.8vw, 72px) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-dashboard {
    width: min(100%, calc(100vw - var(--sidebar-width) - 112px), 1480px) !important;
  }

  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-dashboard {
    width: min(100%, calc(100vw - 128px), 1600px) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd,
  html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid,
  body.page-app:not(.page-admin) .home-showcase-grid,
  body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
    width: min(100%, calc(100vw - var(--sidebar-width) - 128px), 1480px) !important;
  }

  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-dashboard > .page-hd,
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid,
  body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
    width: min(100%, calc(100vw - 144px), 1600px) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-hero-grid,
  html[data-theme] body.page-app:not(.page-admin) .home-workflow-strip {
    width: min(100%, clamp(900px, 62vw, 1180px)) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console {
    width: min(100%, clamp(860px, 58vw, 1120px)) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList.grid-auto,
  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel.grid-auto,
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-main #historyList.grid-auto,
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-main .home-showcase-panel.grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)) !important;
  }

  html[data-theme] body.page-shop:not(.page-admin) .main-area > main,
  html[data-theme] body.page-records:not(.page-admin) .main-area > main,
  html[data-theme] body.page-gallery:not(.page-admin) .main-area > main,
  html[data-theme] body.page-invite:not(.page-admin) .main-area > main,
  html[data-theme] body.page-credits:not(.page-admin) .main-area > main,
  html[data-theme] body.page-earnings:not(.page-admin) .main-area > main,
  html[data-theme] body.page-api-tokens:not(.page-admin) .main-area > main {
    width: min(100%, 1440px) !important;
    max-width: 1440px !important;
  }
}

@media (min-width: 1800px) {
  html[data-theme] body.page-app:not(.page-admin) .home-dashboard {
    width: min(100%, calc(100vw - var(--sidebar-width) - 144px), 1680px) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd,
  html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid,
  body.page-app:not(.page-admin) .home-showcase-grid,
  body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
    width: min(100%, calc(100vw - var(--sidebar-width) - 160px), 1680px) !important;
  }

  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-dashboard,
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-dashboard > .page-hd,
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid,
  body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
    width: min(100%, calc(100vw - 176px), 1760px) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main #historyList.grid-auto,
  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .home-showcase-panel.grid-auto,
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-main #historyList.grid-auto,
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-main .home-showcase-panel.grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)) !important;
  }

  html[data-theme] body.page-shop:not(.page-admin) .main-area > main,
  html[data-theme] body.page-records:not(.page-admin) .main-area > main,
  html[data-theme] body.page-gallery:not(.page-admin) .main-area > main,
  html[data-theme] body.page-invite:not(.page-admin) .main-area > main,
  html[data-theme] body.page-credits:not(.page-admin) .main-area > main,
  html[data-theme] body.page-earnings:not(.page-admin) .main-area > main,
  html[data-theme] body.page-api-tokens:not(.page-admin) .main-area > main {
    width: min(100%, 1600px) !important;
    max-width: 1600px !important;
  }
}

/* Home creation console: wider, lower horizontal workstation. */
@media (min-width: 900px) {
  html[data-theme] body.page-app:not(.page-admin) .home-console {
    width: min(66vw, 1320px) !important;
    max-width: calc(100vw - var(--sidebar-width) - 72px) !important;
    padding-bottom: 0 !important;
    border-radius: 24px !important;
    overflow: visible !important;
  }

  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-console {
    max-width: calc(100vw - 72px) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-form {
    padding: 8px 12px 6px !important;
    gap: 3px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console-body {
    padding: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-field textarea {
    min-height: 54px !important;
    height: 54px !important;
    max-height: 148px !important;
    padding-top: 9px !important;
    padding-bottom: 7px !important;
    border-radius: 16px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar {
    min-height: 30px !important;
    margin-top: 0 !important;
    gap: 5px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-mode-panel {
    padding: 0 12px 3px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-mode-panel[data-home-panel="video"].is-active {
    display: grid !important;
    grid-template-columns: minmax(220px, .75fr) minmax(0, 2.25fr) !important;
    align-items: end !important;
    gap: 8px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-mode-panel[data-home-panel="video"] .home-submode-toggle {
    grid-column: 1 !important;
    margin: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-mode-panel[data-home-panel="video"] .video-param-row {
    grid-column: 2 !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(110px, 1.35fr) !important;
    margin: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-mode-panel[data-home-panel="video"] .home-reference-modes,
  html[data-theme] body.page-app:not(.page-admin) .home-mode-panel[data-home-panel="video"] .home-model-fields {
    grid-column: 1 / -1 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-mode-panel[data-home-panel="video"] .home-reference-modes:empty,
  html[data-theme] body.page-app:not(.page-admin) .home-mode-panel[data-home-panel="video"] .home-model-fields:empty {
    display: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .compact-param-field select,
  html[data-theme] body.page-app:not(.page-admin) .compact-param-field input[type="text"],
  html[data-theme] body.page-app:not(.page-admin) .compact-param-field input[type="number"] {
    min-height: 30px !important;
    height: 30px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .compact-param-field,
  html[data-theme] body.page-app:not(.page-admin) .home-mode-panel .field-v3 {
    margin-bottom: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar .btn,
  html[data-theme] body.page-app:not(.page-admin) .home-file-tool,
  html[data-theme] body.page-app:not(.page-admin) .home-cost-hint,
  html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton {
    min-height: 30px !important;
  }
}

/* Home feature covers: scenic artwork with compact editorial typography. */
html[data-theme] body.page-app:not(.page-admin) .home-feature-card {
  min-height: 58px !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  grid-template-areas:
    "kicker kicker"
    "title description" !important;
  align-content: center !important;
  align-items: baseline !important;
  column-gap: 14px !important;
  row-gap: 2px !important;
  padding: 9px 56px 9px 15px !important;
  border: 1px solid rgba(255, 255, 255, .38) !important;
  border-radius: 17px !important;
  color: #fff !important;
  background-color: #172033 !important;
  background-image:
    linear-gradient(90deg, rgba(7, 18, 35, .88) 0%, rgba(12, 24, 42, .66) 48%, rgba(12, 24, 42, .18) 100%),
    var(--home-bg-image) !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  box-shadow: 0 12px 30px rgba(9, 18, 33, .18) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-agent {
  background-position: center 34% !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-canvas {
  background-image:
    linear-gradient(90deg, rgba(38, 16, 38, .86) 0%, rgba(51, 24, 47, .62) 48%, rgba(51, 24, 47, .16) 100%),
    var(--home-bg-image) !important;
  background-position: center 62% !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card::before {
  display: block !important;
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.12), transparent 42%, rgba(0,0,0,.12));
  content: "";
  pointer-events: none;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card::after {
  position: absolute;
  top: 50%;
  right: 14px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.44);
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  color: #fff;
  content: "\2197";
  font-size: 15px;
  line-height: 1;
  transform: translateY(-50%);
  transition: background-color 180ms ease, transform 180ms ease;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card:hover::after {
  background: rgba(255,255,255,.28);
  transform: translate(2px, calc(-50% - 2px));
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card .home-feature-kicker {
  grid-area: kicker;
  color: rgba(255,255,255,.68) !important;
  font-size: 9px !important;
  line-height: 1.1 !important;
  letter-spacing: 0 !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card strong {
  grid-area: title;
  color: #fff !important;
  font-size: 17px !important;
  line-height: 1.15 !important;
  text-shadow: 0 2px 12px rgba(0,0,0,.28);
  white-space: nowrap;
}

html[data-theme] body.page-app:not(.page-admin) .home-feature-card small {
  grid-area: description;
  min-width: 0;
  overflow: hidden;
  color: rgba(255,255,255,.76) !important;
  font-size: 11px !important;
  line-height: 1.25 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  html[data-theme] body.page-app:not(.page-admin) .home-feature-card {
    min-height: 68px !important;
    grid-template-columns: 1fr !important;
    grid-template-areas: "kicker" "title" "description" !important;
    row-gap: 2px !important;
  }
}

/* Home featured gallery: native-ratio media in a compact masonry layout. */
html[data-theme] body.page-app:not(.page-admin) .home-showcase-panel:not(.is-active) {
  display: none !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-showcase-panel.is-active:not(.home-public-gallery-panel) {
  display: grid !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-audio-record-cover {
  position: relative;
  display: flex !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  min-height: 150px;
  padding: 18px !important;
  overflow: hidden;
  background: #101923 !important;
  color: #f8fafc;
}

html[data-theme] body.page-app:not(.page-admin) .home-audio-record-cover audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.home-audio-record-visual {
  display: flex;
  align-items: center;
  gap: 18px;
}

.home-audio-note {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(94, 234, 212, 0.42);
  border-radius: 50%;
  background: #142c32;
  color: #5eead4;
  font-size: 25px;
  line-height: 1;
}

.home-audio-wave {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.home-audio-wave i {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: #5eead4;
}

.home-audio-wave i:nth-child(2),
.home-audio-wave i:nth-child(6) { height: 30px; background: #60a5fa; }
.home-audio-wave i:nth-child(3),
.home-audio-wave i:nth-child(5) { height: 42px; background: #f472b6; }
.home-audio-wave i:nth-child(4) { height: 24px; }

.home-audio-record-format {
  display: grid;
  gap: 3px;
  text-align: right;
}

.home-audio-record-format strong {
  color: #f8fafc;
  font-size: 13px;
}

.home-audio-record-format small {
  color: #94a3b8;
  font-size: 10px;
}

html[data-theme] body.page-app:not(.page-admin) .home-audio-record-cover.is-pending {
  align-items: center !important;
  justify-content: center !important;
  gap: 12px;
}

html[data-theme] body.page-app:not(.page-admin) .home-chat-record {
  text-decoration: none !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-panel.is-active,
html[data-theme] body.page-app:not(.page-admin) .home-showcase-main.is-searching .home-public-gallery-panel {
  display: block !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-marketplace-type-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 8px;
}

html[data-theme] body.page-app:not(.page-admin) .home-marketplace-type-nav button {
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 138, 36, .28);
  border-radius: 999px;
  background: rgba(255, 255, 255, .68);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

html[data-theme] body.page-app:not(.page-admin) .home-marketplace-type-nav button.active {
  border-color: #ff8a24;
  background: #ff8a24;
  color: #17120d;
  box-shadow: 0 5px 16px rgba(255, 122, 24, .22);
}

html[data-theme] body.page-app:not(.page-admin) .home-marketplace-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}

html[data-theme] body.page-app:not(.page-admin) .home-marketplace-card-actions > strong {
  color: #ff8a24;
  font-size: 12px;
  font-weight: 850;
}

html[data-theme] body.page-app:not(.page-admin) .home-workflow-thumbnail {
  min-height: 150px;
  background: linear-gradient(145deg, rgba(255, 138, 36, .18), rgba(54, 103, 255, .16));
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-masonry {
  width: 100%;
  column-count: 3;
  column-gap: 8px;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-masonry.is-workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  align-items: start;
  gap: 8px;
  column-count: initial !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-masonry.is-workflow-grid .home-public-gallery-card {
  display: block;
  margin: 0;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-masonry.is-workflow-grid .home-public-gallery-media {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-masonry.is-workflow-grid .home-public-gallery-media img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-card {
  width: 100%;
  display: inline-block;
  break-inside: avoid;
  margin: 0 0 8px;
  overflow: hidden;
  vertical-align: top;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(65, 45, 52, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-card:hover {
  z-index: 1;
  border-color: rgba(255, 146, 82, 0.42);
  box-shadow: 0 16px 34px rgba(65, 45, 52, 0.15);
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-card {
  cursor: zoom-in;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-media {
    position: relative;
    width: 100%;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 244, 237, 0.92), rgba(241, 245, 249, 0.9));
}

.home-gallery-play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 50%;
    color: #fff;
    background: rgba(15, 23, 42, .72);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .26);
    font-size: 20px;
    line-height: 1;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-media img,
html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-media video {
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  display: block;
  object-fit: contain !important;
  background: transparent;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-body {
  display: grid;
  gap: 9px;
  padding: 12px 13px 13px;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-prompt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-meta span:nth-child(2) {
  min-width: 0;
  flex: 1 1 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-likes {
  margin-left: auto;
  color: #d97442;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-state {
  column-span: all;
  width: 100%;
  min-height: 150px;
  display: grid;
  place-items: center;
  padding: 28px;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-state.is-error {
  color: #b45309;
  background: rgba(255, 247, 237, 0.76);
}

@media (min-width: 1700px) {
  html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-masonry {
    column-count: 4;
  }
}

@media (max-width: 980px) {
  html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-masonry {
    column-count: 2;
  }
}

@media (max-width: 620px) {
  html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-masonry {
    column-count: 1;
  }
}

/* Gallery discovery tags and share-time tag selection. */
.gallery-tag-nav,
.home-gallery-tag-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow-x: auto;
  padding: 2px 0 8px;
  margin: 0 0 16px;
  scrollbar-width: thin;
}

.gallery-tag-chip,
.home-gallery-tag-nav button,
.gallery-share-tag {
  min-height: 32px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.gallery-tag-chip:hover,
.home-gallery-tag-nav button:hover,
.gallery-share-tag:hover {
  border-color: rgba(244, 122, 62, 0.48);
  color: #b45309;
  transform: translateY(-1px);
}

.gallery-tag-chip.active,
.home-gallery-tag-nav button.active,
.gallery-share-tag.is-selected {
  border-color: transparent;
  background: #ff7a1a;
  color: #fff;
  box-shadow: 0 7px 18px rgba(234, 88, 12, 0.2);
}

.gallery-card-tags,
.home-public-gallery-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.gallery-card-tags {
  margin-top: 8px;
}

.gallery-card-tags a,
.home-public-gallery-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 122, 26, 0.1);
  color: #b45309;
  font-size: 10px;
  font-weight: 750;
  text-decoration: none;
}

/* Public gallery lightbox: available to signed-in users and guests. */
.gallery-preview-dialog {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 7, 18, 0.86);
  backdrop-filter: blur(12px);
}

.gallery-preview-dialog.hidden {
  display: none;
}

.gallery-preview-panel {
  width: min(1180px, calc(100vw - 32px));
  height: min(900px, calc(100dvh - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: #080c14;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.gallery-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  color: #fff;
  background: rgba(18, 24, 36, 0.96);
}

.gallery-preview-head h2,
.gallery-preview-head p {
  margin: 0;
}

.gallery-preview-head h2 {
  font-size: 16px;
}

.gallery-preview-head p {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.gallery-preview-close {
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
}

.gallery-preview-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 12px;
}

.gallery-preview-stage img,
.gallery-preview-stage video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-public-card {
  cursor: zoom-in !important;
}

.gallery-video-thumbnail {
  width: 100%;
  min-height: 180px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  background: linear-gradient(145deg, rgba(15, 23, 42, .96), rgba(30, 41, 59, .92));
  color: #fff;
}

.gallery-video-thumbnail span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding-left: 3px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  background: rgba(255,255,255,.13);
  font-size: 18px;
}

.gallery-video-thumbnail small {
  color: rgba(255,255,255,.72);
  font-size: 11px;
}

@media (max-width: 620px) {
  .gallery-preview-dialog { padding: 8px; }
  .gallery-preview-panel {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    border-radius: 14px;
  }
}

.gallery-share-picker {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 30;
  width: min(460px, 100%);
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid #dbe3ea;
  border-radius: 0 12px 12px 0;
  background: #f8fafc;
  color: #172033;
  box-shadow: -24px 0 64px rgba(15, 23, 42, 0.24);
}

.gallery-share-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.gallery-share-picker-head > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.gallery-share-picker-head strong {
  color: #172033;
  font-size: 20px;
  line-height: 1.25;
}

.gallery-share-picker-head p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.gallery-share-eyebrow {
  color: #0f766e !important;
  font-size: 11px !important;
  font-weight: 850;
}

.gallery-share-close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #dbe3ea;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.gallery-share-picker-body {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px;
}

.gallery-share-tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gallery-share-tag {
  min-height: 36px;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid #d7e0e8;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  box-shadow: none;
  font-size: 12px;
  font-weight: 750;
}

.gallery-share-tag > span {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  color: transparent;
  font-size: 10px;
  line-height: 1;
}

.gallery-share-tag:hover {
  border-color: #5eead4;
  background: #f0fdfa;
  color: #115e59;
  transform: none;
}

.gallery-share-tag.is-selected,
.gallery-share-tag[aria-pressed="true"] {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.18);
}

.gallery-share-tag.is-selected > span,
.gallery-share-tag[aria-pressed="true"] > span {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

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

.gallery-share-tags-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.gallery-share-tags-head strong {
  color: #172033;
  font-size: 13px;
}

.gallery-share-tags-head span {
  color: #94a3b8;
  font-size: 11px;
}

.gallery-share-tags-head output {
  min-width: 66px;
  padding: 5px 8px;
  border-radius: 5px;
  background: #e9eef3;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.gallery-share-tags-head output.has-selection {
  background: #ccfbf1;
  color: #115e59;
}

.gallery-share-picker-message {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.gallery-share-picker-message.is-error {
  background: #fff1f2;
  color: #be123c;
}

.gallery-share-required-fields { display:grid; gap:18px; }
.gallery-share-required-fields label { display:grid; gap:7px; color:#334155; font-size:12px; font-weight:800; }
.gallery-share-required-fields label > span { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.gallery-share-required-fields label em { color:#94a3b8; font-size:10px; font-style:normal; font-weight:700; }
.gallery-share-required-fields input { width:100%; min-height:42px; padding:9px 11px; border:1px solid #cbd5e1; border-radius:6px; background:#fff; color:#172033; font:inherit; }
.gallery-share-required-fields input:focus { border-color:#0f766e !important; box-shadow:0 0 0 3px rgba(20,184,166,.14) !important; outline:0; }
.gallery-share-required-fields input[type="file"] { padding:6px; color:#64748b; font-size:11px; }
.gallery-share-required-fields input[type="file"]::file-selector-button { min-height:30px; margin-right:9px; padding:0 10px; border:0; border-radius:5px; background:#e9eef3; color:#334155; font-weight:750; cursor:pointer; }
.gallery-share-required-fields small { color:#94a3b8; font-size:10px; font-weight:650; line-height:1.45; }

.gallery-share-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.gallery-share-picker-actions .btn {
  min-height: 40px;
  padding-inline: 18px;
  border-radius: 6px;
}

html[data-theme] body:not(.page-admin) .gallery-share-picker-actions .btn-primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

html[data-theme] body:not(.page-admin) .gallery-share-picker-actions .btn-primary:hover {
  border-color: #115e59;
  background: #115e59;
}

.record-dialog-panel { position: relative; }

html[data-theme="dark"] body:not(.page-admin) .gallery-share-picker {
  border-left-color: #334155;
  background: #111827;
  color: #f8fafc;
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] body:not(.page-admin) .gallery-share-picker-head,
html[data-theme="dark"] body:not(.page-admin) .gallery-share-picker-actions {
  border-color: #334155;
  background: #18212f;
}

html[data-theme="dark"] body:not(.page-admin) .gallery-share-picker-head strong,
html[data-theme="dark"] body:not(.page-admin) .gallery-share-tags-head strong,
html[data-theme="dark"] body:not(.page-admin) .gallery-share-required-fields label {
  color: #f8fafc;
}

html[data-theme="dark"] body:not(.page-admin) .gallery-share-picker-head p,
html[data-theme="dark"] body:not(.page-admin) .gallery-share-tags-head span,
html[data-theme="dark"] body:not(.page-admin) .gallery-share-required-fields small {
  color: #94a3b8;
}

html[data-theme="dark"] body:not(.page-admin) .gallery-share-close,
html[data-theme="dark"] body:not(.page-admin) .gallery-share-required-fields input,
html[data-theme="dark"] body:not(.page-admin) .gallery-share-tag {
  border-color: #3b4758;
  background: #202b3a;
  color: #dbe5ef;
}

html[data-theme="dark"] body:not(.page-admin) .gallery-share-tag:hover {
  border-color: #2dd4bf;
  background: #153d3b;
  color: #ccfbf1;
}

html[data-theme="dark"] body:not(.page-admin) .gallery-share-tag.is-selected,
html[data-theme="dark"] body:not(.page-admin) .gallery-share-tag[aria-pressed="true"] {
  border-color: #2dd4bf;
  background: #0f766e;
  color: #fff;
}
.home-article-modal { position:fixed; inset:0; z-index:2147482000; display:grid; place-items:center; padding:18px; background:rgba(2,6,12,.72); backdrop-filter:blur(12px); }
.home-article-panel { position:relative; width:min(680px,100%); max-height:calc(100dvh - 36px); overflow:auto; display:grid; gap:12px; padding:22px; border:1px solid var(--line); border-radius:8px; background:var(--main-surface); color:var(--text); box-shadow:var(--shadow-elevated); }
.home-article-panel > [data-article-close] { position:absolute; top:12px; right:12px; }
.home-article-panel h2 { margin:0 72px 4px 0; font-size:20px; }
.home-article-panel label { display:grid; gap:6px; color:var(--text-muted); font-size:12px; font-weight:750; }
.home-article-panel input,.home-article-panel textarea,.home-article-panel select { width:100%; padding:9px 11px; border:1px solid var(--line); border-radius:6px; background:var(--main-surface-soft); color:var(--text); font:inherit; }
.home-article-content { white-space:normal; line-height:1.75; overflow-wrap:anywhere; }
.home-article-content p { margin:0 0 1em; }
.home-article-content img { display:block; max-width:100%; height:auto; margin:16px auto; border-radius:12px; }
.home-article-content figure { margin:18px 0; }
.home-article-content figcaption { color:var(--text-muted); text-align:center; font-size:12px; }
.home-article-content blockquote { margin:16px 0; padding:10px 14px; border-left:3px solid #ff7a1a; background:rgba(255,122,26,.08); color:var(--text-soft); }
.article-close-button { position:absolute; top:14px; right:14px; width:32px; height:32px; border:1px solid rgba(148,163,184,.3); border-radius:50%; background:rgba(255,255,255,.72); color:var(--text); font-size:22px; line-height:1; cursor:pointer; }
.home-article-composer { width:min(980px,100%); }
.article-composer-head { display:flex; justify-content:space-between; gap:16px; padding-right:42px; }
.article-composer-head span { color:#f97316; font-size:10px; font-weight:900; letter-spacing:0; }
.article-composer-head h2 { margin:4px 0 2px; }
.article-composer-head p { margin:0; color:var(--text-muted); font-size:12px; }
.article-composer-grid { display:grid; grid-template-columns:minmax(0,1fr) 280px; gap:18px; }
.article-field { display:grid; gap:7px; color:var(--text-muted); font-size:12px; font-weight:800; }
.article-field input { min-height:42px; }
.article-editor-toolbar { display:flex; flex-wrap:wrap; gap:5px; padding:7px; border:1px solid var(--line); border-bottom:0; border-radius:8px 8px 0 0; background:var(--main-surface-soft); }
.article-editor-toolbar button { min-height:30px; padding:0 9px; border:1px solid var(--line); border-radius:5px; background:var(--main-surface); color:var(--text-soft); font-size:12px; font-weight:800; cursor:pointer; }
.article-rich-editor { min-height:330px; padding:14px; border:1px solid var(--line); border-radius:0 0 8px 8px; background:var(--main-surface); color:var(--text); font-size:15px; line-height:1.8; outline:none; }
.article-rich-editor:empty::before { content:attr(data-placeholder); color:var(--text-muted); pointer-events:none; }
.article-rich-editor:focus { border-color:#ff7a1a; box-shadow:0 0 0 3px rgba(255,122,26,.12); }
.article-cover-field { display:grid; gap:8px; padding:12px; border:1px dashed var(--line); border-radius:8px; color:var(--text-muted); font-size:12px; font-weight:800; cursor:pointer; }
.article-cover-field input[type=file] { font-size:12px; }
.article-cover-placeholder { padding:30px 10px; border-radius:6px; background:var(--main-surface-soft); text-align:center; font-weight:600; }
.article-cover-field img { width:100%; aspect-ratio:16/10; object-fit:cover; border-radius:6px; }
.article-tags-field { margin:14px 0; padding:12px; border:1px solid var(--line); border-radius:8px; }
.article-tags-field legend { padding:0 4px; color:var(--text); font-size:12px; font-weight:850; }
.article-tags-field legend small { color:var(--text-muted); font-weight:600; }
.article-tag-options { display:flex; flex-wrap:wrap; gap:6px; }
.article-tag-options label { position:relative; cursor:pointer; }
.article-tag-options input { position:absolute; opacity:0; }
.article-tag-options span { display:block; padding:6px 9px; border:1px solid var(--line); border-radius:999px; color:var(--text-soft); font-size:11px; }
.article-tag-options input:checked + span { border-color:#ff7a1a; background:#ff7a1a; color:#fff; }
.article-paywall { display:grid; gap:10px; padding:12px; border:1px solid rgba(249,115,22,.25); border-radius:8px; background:rgba(255,247,237,.6); }
.article-paywall label:not(.article-paywall-switch) { display:grid; gap:5px; color:var(--text-muted); font-size:12px; font-weight:750; }
.article-paywall input[type=number] { min-height:34px; }
.article-paywall-switch { display:flex; align-items:center; gap:8px; color:var(--text); font-size:13px; font-weight:850; }
.article-paywall output { color:#f97316; }
.article-composer-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:4px; }
.article-composer-footer p { margin:0; color:#dc2626; font-size:12px; }
.article-reader { width:min(760px,100%); }
.article-reader-cover { width:100%; max-height:260px; object-fit:cover; border-radius:8px; }
.article-reader-head { display:grid; gap:6px; }
.article-reader-head h2 { margin:0; }
.article-reader-tags { display:flex; flex-wrap:wrap; gap:5px; }
.article-reader-tags span { color:#ea580c; font-size:11px; font-weight:800; }
.article-reader-access { margin:0; color:var(--text-muted); font-size:12px; }
.article-reader-unlock { display:flex; align-items:center; gap:10px; margin-top:18px; padding:12px; border:1px solid rgba(249,115,22,.26); border-radius:8px; background:rgba(255,247,237,.7); }
.article-reader-unlock strong { color:#ea580c; }
.article-reader-unlock span { flex:1; color:var(--text-muted); font-size:12px; }
.article-preview-lock { margin-top:18px; padding:12px; border:1px dashed rgba(249,115,22,.4); border-radius:8px; color:#c2410c; text-align:center; font-weight:800; }
.home-workflow-card--article .home-workflow-copy { color:#6b3418; background:linear-gradient(135deg,rgba(255,247,237,.98),rgba(255,232,204,.94)); }
.home-workflow-card--article .home-workflow-copy > span { color:rgba(124,58,20,.72); }
.home-workflow-card--article .home-workflow-copy::after { content:"✎"; color:#ea580c; font-size:16px; }
@media (max-width:720px) { .article-composer-grid { grid-template-columns:1fr; } .article-composer-footer { align-items:stretch; flex-direction:column; } .article-reader-unlock { align-items:flex-start; flex-wrap:wrap; } }
body.has-article-modal { overflow:hidden; }

.designer-gallery-tags-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 14, 0.72);
  backdrop-filter: blur(10px);
}

.designer-gallery-tags-panel {
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  padding: 22px;
  overflow-y: auto;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.3);
}

.designer-gallery-tags-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.designer-gallery-tags-head > div {
  display: grid;
  gap: 5px;
}

.designer-gallery-tags-head strong {
  color: #172033;
  font-size: 18px;
}

.designer-gallery-tags-head span {
  color: #64748b;
  font-size: 12px;
}

.designer-gallery-tags-head > button {
  width: 34px;
  height: 34px;
  border: 1px solid #dbe3ea;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 22px;
  cursor: pointer;
}

.designer-gallery-share-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(150px, .65fr);
  gap: 12px;
  margin-bottom: 18px;
}

.designer-gallery-share-fields label {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.designer-gallery-share-fields label > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.designer-gallery-share-fields em,
.designer-gallery-share-fields small {
  color: #94a3b8;
  font-size: 10px;
  font-style: normal;
  font-weight: 650;
}

.designer-gallery-share-fields input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #172033;
  font: inherit;
}

.designer-gallery-share-fields input:focus {
  border-color: #0f766e;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .14);
}

.designer-gallery-tags-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

.designer-gallery-tags-actions button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-weight: 750;
  cursor: pointer;
}

.designer-gallery-tags-actions button.is-primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

html[data-theme="dark"] .designer-gallery-tags-panel {
  border-color: #334155;
  background: #111827;
}

html[data-theme="dark"] .designer-gallery-tags-head strong,
html[data-theme="dark"] .designer-gallery-tags-head > button,
html[data-theme="dark"] .designer-gallery-tags-actions button,
html[data-theme="dark"] .designer-gallery-share-fields label {
  color: #f8fafc;
}

html[data-theme="dark"] .designer-gallery-tags-head > button,
html[data-theme="dark"] .designer-gallery-tags-actions button,
html[data-theme="dark"] .designer-gallery-share-fields input {
  border-color: #3b4758;
  background: #202b3a;
}

html[data-theme="dark"] .designer-gallery-tags-actions button.is-primary {
  border-color: #2dd4bf;
  background: #0f766e;
}

@media (max-width: 640px) {
  .gallery-share-picker {
    width: 100%;
    border-left: 0;
    border-radius: 12px;
  }

  .gallery-share-picker-head {
    padding: 18px 16px 15px;
  }

  .gallery-share-picker-head strong {
    font-size: 18px;
  }

  .gallery-share-picker-body {
    padding: 18px 16px;
  }

  .gallery-share-picker-actions {
    padding: 12px 16px;
  }

  .gallery-share-picker-actions .btn {
    flex: 1 1 0;
  }

  .designer-gallery-tags-panel {
    padding: 16px;
    border-radius: 8px;
  }

  .designer-gallery-share-fields {
    grid-template-columns: 1fr;
  }
}
/* Account center */
.uc-page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 10px 0 48px;
  color: var(--text);
}
.uc-profile-hero,
.uc-panel {
  background: var(--main-surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(35, 28, 20, .05);
}
.uc-profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 28px;
  margin-bottom: 16px;
}
.uc-profile-main { display: flex; align-items: center; gap: 18px; min-width: 0; }
.uc-profile-main .uc-avatar { width: 72px; height: 72px; font-size: 34px; }
.uc-profile-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 13px; }
.uc-profile-meta span + span::before { margin-right: 13px; color: var(--line-strong, #cbd5e1); content: "·"; }
.uc-kicker, .uc-eyebrow {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}
.uc-header-info h1 { margin: 5px 0 7px; font-size: 26px; line-height: 1.15; color: var(--text); }
.uc-header-info p { margin: 0; color: var(--text-muted); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.uc-dot { margin: 0 5px; color: var(--line-strong, #cbd5e1); }
.uc-role-badge { display: inline-flex; margin-left: 9px; padding: 4px 8px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-size: 11px; vertical-align: middle; }
.uc-profile-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.uc-action { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--main-surface); text-decoration: none; font-size: 13px; font-weight: 700; white-space: nowrap; }
.uc-action:hover { border-color: var(--primary); color: var(--primary); }
.uc-action-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.uc-action-primary:hover { color: #fff; opacity: .9; }
.uc-action-icon { display: inline-grid; place-items: center; width: 17px; height: 17px; font-size: 15px; line-height: 1; }
.uc-mobile-quick-grid { display: none; }
.uc-mobile-logout { display: none; }
.uc-overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.uc-panel { padding: 22px 24px; }
.uc-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.uc-panel-head h2 { margin: 5px 0 0; color: var(--text); font-size: 18px; line-height: 1.25; }
.uc-panel-subtitle { margin: 8px 0 0; color: var(--text-muted); font-size: 13px; }
.uc-security-warning { margin: 10px 0 0; color: #b45309; font-size: 12px; line-height: 1.5; }
.uc-text-link { color: var(--primary); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.uc-balance-list, .uc-identity-list { display: grid; gap: 0; }
.uc-balance-row, .uc-identity-list > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; border-top: 1px solid var(--line); font-size: 13px; }
.uc-balance-row span, .uc-identity-list span { color: var(--text-muted); }
.uc-balance-row strong, .uc-identity-list strong { color: var(--text); font-size: 15px; }
.uc-balance-row small { color: var(--text-muted); font-size: 11px; font-weight: 600; }
.uc-balance-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 8px; border-radius: 7px; font-style: normal; font-weight: 800; }
.uc-balance-icon.credits { background: #fef3c7; color: #b45309; }
.uc-balance-icon.earnings { background: #dcfce7; color: #15803d; }
.uc-balance-icon.invite { background: #dbeafe; color: #2563eb; }
.uc-status { display: inline-flex; align-items: center; gap: 6px; color: #15803d; font-size: 12px; font-weight: 700; }
.uc-status i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.uc-uid-value { display: inline-flex; align-items: center; gap: 8px; max-width: 70%; overflow-wrap: anywhere; }
.uc-copy-btn { border: 0; padding: 0; color: var(--primary); background: transparent; cursor: pointer; font-size: 11px; font-weight: 700; }
.uc-security-card .card-head { padding: 0; margin: 0 0 22px; border: 0; }
.uc-security-card .card-head h2 { margin: 5px 0 0; color: var(--text); font-size: 20px; line-height: 1.25; }
.uc-security-card .uc-section h3 { margin: 0 0 7px; color: var(--text); font-size: 16px; line-height: 1.3; }
.uc-security-card .uc-section { padding-top: 2px; }
.uc-page .field-hint { display: block; margin: 7px 0; padding: 0; border: 0; background: transparent; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.uc-page .uc-step { padding: 14px 0; border-top: 1px solid var(--line); }
.uc-page .uc-step .field-hint:first-child { margin-top: 0; }
.uc-page .field { display: grid; gap: 7px; margin: 14px 0; }
.uc-page .field > span { color: var(--text); font-size: 13px; font-weight: 700; }
.uc-page .field input { width: 100%; min-height: 42px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; color: var(--text); background: var(--main-surface); }
.uc-page .field input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.uc-page .button.primary, .uc-page .btn-primary { min-height: 40px; border-radius: 9px; }
.uc-page .muted { color: var(--text-muted); font-size: 13px; }
html[data-theme] body:not(.page-admin) .uc-page .field-hint:not(.hidden) { margin: 7px 0; padding: 0; border: 0 !important; background: transparent !important; color: var(--text-muted); }
.uc-inline-status { min-height: 20px; margin-top: 10px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.uc-inline-status.success { color: #15803d; }
.uc-inline-status.error { color: #b91c1c; }
.uc-social-list { display: grid; gap: 10px; margin-top: 16px; }
.uc-social-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.uc-social-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.uc-social-name { color: var(--text); font-size: 15px; font-weight: 700; }
.uc-social-state, .uc-social-nickname { color: var(--text-muted); font-size: 12px; }
.uc-social-state.is-bound { color: #15803d; }

@media (max-width: 760px) {
  .uc-page { padding: 0 0 32px; }
  .uc-profile-hero { align-items: flex-start; flex-direction: column; padding: 20px; }
  .uc-profile-actions { width: 100%; justify-content: flex-start; }
  .uc-action { flex: 1 1 auto; justify-content: center; }
  .uc-overview-grid { grid-template-columns: 1fr; }
  .uc-panel { padding: 18px; }
  .uc-profile-main .uc-avatar { width: 60px; height: 60px; font-size: 28px; }
  .uc-header-info h1 { font-size: 22px; }
  .uc-uid-value { max-width: 62%; }
}

@media (max-width: 520px) {
  html[data-theme] body.page-ucenter .main-area {
    padding: 56px 10px calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 14px) !important;
    background: var(--main-bg, #f6f7f9) !important;
  }
  .uc-page { width: 100%; padding: 0; }
  .uc-profile-hero,
  .uc-panel { border-radius: 10px; }
  .uc-profile-hero { gap: 13px; margin-bottom: 10px; padding: 15px 14px; box-shadow: none; }
  .uc-profile-main { width: 100%; gap: 12px; align-items: flex-start; }
  .uc-profile-main .uc-avatar { width: 52px; height: 52px; flex: 0 0 52px; font-size: 23px; border-radius: 10px; }
  .uc-header-info { min-width: 0; }
  .uc-kicker { font-size: 10px; }
  .uc-header-info h1 { margin: 3px 0 5px; font-size: 19px; overflow-wrap: anywhere; }
  .uc-header-info p { font-size: 10px; line-height: 1.45; }
  .uc-profile-meta { gap: 3px 8px; }
  .uc-profile-meta span + span::before { margin-right: 8px; }
  .uc-role-badge { margin-left: 5px; }
  .uc-profile-actions { display: none; }
  .uc-mobile-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    gap: 6px;
    margin: 0 0 10px;
    padding: 12px 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--main-surface);
  }
  .uc-mobile-quick-grid a { display: grid; justify-items: center; gap: 4px; min-width: 0; padding: 4px 1px; color: var(--text); text-align: center; text-decoration: none; }
  .uc-mobile-quick-grid a:active { opacity: .72; }
  .uc-mobile-quick-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 9px; }
  .uc-mobile-quick-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .uc-mobile-quick-icon.is-shop { background: #fff1e6; color: #c2410c; }
  .uc-mobile-quick-icon.is-records { background: #e0f2fe; color: #0369a1; }
  .uc-mobile-quick-icon.is-earnings { background: #dcfce7; color: #15803d; }
  .uc-mobile-quick-icon.is-invite { background: #ede9fe; color: #6d28d9; }
  .uc-mobile-quick-icon.is-security { background: #f1f5f9; color: #334155; }
  .uc-mobile-quick-grid strong { max-width: 100%; font-size: 11px; line-height: 1.25; overflow-wrap: anywhere; }
  .uc-mobile-quick-grid small { display: none; }
  .uc-overview-grid { gap: 10px; margin-bottom: 10px; }
  .uc-panel { padding: 15px 14px; }
  .uc-panel-head { gap: 9px; margin-bottom: 12px; }
  .uc-panel-head h2 { font-size: 16px; }
  .uc-eyebrow { font-size: 10px; }
  .uc-balance-list { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
  .uc-balance-row { display: grid; justify-items: center; align-content: center; gap: 5px; min-width: 0; min-height: 76px; padding: 8px 3px; border: 0; background: var(--main-surface); text-align: center; }
  .uc-balance-row > span { display: grid; justify-items: center; gap: 3px; min-width: 0; font-size: 10px; }
  .uc-balance-icon { width: 25px; height: 25px; margin: 0; }
  .uc-balance-row strong { max-width: 100%; font-size: 14px; line-height: 1.2; overflow-wrap: anywhere; }
  .uc-balance-row,
  .uc-identity-list > div { min-height: 48px; font-size: 12px; }
  .uc-balance-row { min-height: 76px; }
  .uc-balance-row strong,
  .uc-identity-list strong { max-width: 62%; font-size: 13px; text-align: right; overflow-wrap: anywhere; }
  .uc-balance-row strong { max-width: 100%; text-align: center; }
  .uc-uid-value { max-width: 68%; justify-content: flex-end; }
  .uc-copy-btn { min-height: 30px; padding: 0 4px; }
  .uc-text-link { min-height: 32px; display: inline-flex; align-items: center; }
  .uc-status { white-space: nowrap; }
  .uc-security-card .card-head { margin-bottom: 16px; }
  .uc-security-card .card-head h2 { font-size: 18px; }
  .uc-security-card .uc-section { padding: 14px 0 0; }
  .uc-security-card .uc-section + .uc-section { margin-top: 12px; border-top: 1px solid var(--line); }
  .uc-page .field { margin: 11px 0; }
  .uc-page .field input { min-height: 46px; font-size: 16px; }
  .uc-page .button.primary,
  .uc-page .btn-primary { width: 100%; min-height: 46px; }
  .uc-social-list { gap: 8px; margin-top: 12px; }
  .uc-social-row { align-items: stretch; flex-direction: column; gap: 9px; padding: 11px; }
  .uc-social-info { flex-wrap: wrap; gap: 5px 8px; }
  .uc-social-name { flex: 1 1 100%; font-size: 14px; }
  .uc-social-row > button { width: 100%; min-height: 42px; }
  .uc-mobile-logout {
    display: flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: var(--main-surface);
    color: #b91c1c;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
  }
  .uc-mobile-logout svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
}

@media (max-width: 360px) {
  .uc-mobile-quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/* Mobile primary navigation */
.mobile-bottom-nav {
  display: none;
}

.mobile-sidebar-primary {
  display: none;
}

@media (max-width: 720px) {
  :root {
    --mobile-bottom-nav-height: 64px;
    --mobile-app-height: calc(100dvh - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom));
  }

  @supports not (height: 100dvh) {
    :root { --mobile-app-height: calc(100vh - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom)); }
  }

  body:not(.page-admin) .sidebar-collapse-btn {
    display: grid !important;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
  }

  html[data-theme] body:not(.page-admin) .sidebar {
    top: 15vh !important;
    top: 15dvh !important;
    bottom: auto !important;
    width: 49vw !important;
    height: 70vh !important;
    height: 70dvh !important;
    max-height: 70vh !important;
    max-height: 70dvh !important;
    border-radius: 0 16px 16px 0 !important;
  }

  html[data-theme] body:not(.page-admin) .sidebar-header {
    padding: 10px 8px;
    gap: 6px;
  }

  html[data-theme] body:not(.page-admin) .sidebar-brand-text {
    display: none;
  }

  html[data-theme] body:not(.page-admin) .sidebar-logo {
    width: 36px;
    height: 36px;
  }

  html[data-theme] body:not(.page-admin) .sidebar-nav {
    padding: 6px;
  }

  html[data-theme] body:not(.page-admin) .sidebar-nav-item {
    gap: 7px;
    padding: 9px 8px;
    font-size: 12px;
  }

  html[data-theme] body:not(.page-admin) .sidebar-nav-item > svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
  }

  html[data-theme] body:not(.page-admin) .sidebar-nav-section {
    padding: 10px 8px 4px;
  }

  .mobile-sidebar-primary {
    display: block;
  }

  .mobile-sidebar-duplicate {
    display: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-dashboard > .page-hd {
    display: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-hero-grid,
  html[data-theme] body.page-app:not(.page-admin) .home-workflow-strip {
    display: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-masonry {
    column-count: 2 !important;
    column-gap: 8px;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-masonry.is-workflow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-card {
    margin-bottom: 8px;
    border-radius: 10px;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-body {
    gap: 5px;
    padding: 8px;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-prompt {
    font-size: 11px;
    line-height: 1.4;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-public-gallery-meta {
    gap: 3px 5px;
    font-size: 9px;
  }

  body:not(.page-admin):not(.page-auth):not(.page-embed) .mobile-bottom-nav {
    position: fixed;
    z-index: 210;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
    padding: 4px 4px env(safe-area-inset-bottom);
    border-top: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
    background: color-mix(in srgb, var(--main-surface) 94%, transparent);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    contain: layout paint;
    view-transition-name: mobile-primary-nav;
  }

  ::view-transition-group(mobile-primary-nav) { animation-duration: 120ms; }

  body.sidebar-open .mobile-bottom-nav {
    pointer-events: none;
    opacity: 0;
  }

  .mobile-bottom-nav-item {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 56px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    padding: 4px 1px 3px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: color .16s ease, background-color .16s ease;
  }

  .mobile-bottom-nav-item::before {
    position: absolute;
    top: -4px;
    width: 24px;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: transparent;
    content: "";
  }

  .mobile-bottom-nav-item svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-bottom-nav-item span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bottom-nav-item:nth-child(2) span,
  .mobile-bottom-nav-item:nth-child(3) span,
  .mobile-bottom-nav-item:nth-child(4) span {
    font-size: 9px;
  }

  .mobile-bottom-nav-item.active {
    color: var(--primary);
  }

  .mobile-bottom-nav-item.active::before {
    background: var(--primary);
  }

  .mobile-bottom-nav-item:active {
    background: var(--main-surface-soft);
  }

  body.is-page-leaving .mobile-bottom-nav-item:not(.active) { pointer-events: none; }

  html[data-theme] body:not(.page-admin):not(.page-auth):not(.page-embed) .main-area {
    padding-bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 16px) !important;
  }

  html[data-theme] body.page-chat:not(.page-admin) .main-area {
    padding-bottom: 0 !important;
  }

  body.page-chat .chat-layout {
    height: calc(100vh - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom)) !important;
    height: calc(100dvh - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom)) !important;
  }

  body.page-designer-canvas .designer-workbench {
    height: calc(100vh - 110px - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom));
    height: calc(100dvh - 110px - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom));
  }

  body.page-designer-canvas .designer-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    min-height: 104px;
    height: auto;
    padding: 7px 8px;
  }

  body.page-designer-canvas .designer-project-title,
  body.page-designer-canvas .designer-top-actions { width: 100%; min-width: 0; }
  body.page-designer-canvas .designer-project-title { gap: 7px; }
  body.page-designer-canvas .designer-project-title > span,
  body.page-designer-canvas .designer-workspace-switcher { display: none; }
  body.page-designer-canvas .designer-project-title input { width: 100%; font-size: 14px; }

  body.page-designer-canvas .designer-top-actions {
    flex: 0 0 auto;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  body.page-designer-canvas .designer-top-actions::-webkit-scrollbar { display: none; }
  body.page-designer-canvas .designer-top-btn,
  body.page-designer-canvas .designer-credit-pill { flex: 0 0 auto; min-height: 36px; }

  body.page-designer-canvas .designer-workbench {
    height: calc(100vh - 104px - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom)) !important;
    height: calc(100dvh - 104px - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom)) !important;
    min-height: 0;
  }

  body.page-designer-canvas .designer-rail { top: 8px; bottom: 8px; max-height: calc(100% - 16px); overflow-y: auto; }
  body.page-designer-canvas .designer-flyout,
  body.page-designer-canvas .designer-shortcut-panel,
  body.page-designer-canvas .designer-side-panel,
  body.page-designer-canvas .designer-inspector-panel,
  body.page-designer-canvas .designer-agent-panel {
    width: calc(100vw - 74px);
    max-width: calc(100vw - 74px);
    max-height: calc(100% - 16px);
  }

  /* Mobile-only compact creation controls. */
  html[data-theme] body.page-app:not(.page-admin) .home-console {
    margin-top: 180px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console-head {
    top: -60px !important;
    gap: 5px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs {
    width: max-content !important;
    max-width: 100% !important;
    min-height: 24px !important;
    align-self: flex-end !important;
    justify-content: flex-end !important;
    gap: 3px !important;
    margin-left: auto !important;
    padding: 1px !important;
    overflow: visible !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-mode-tabs button {
    min-height: 22px !important;
    height: 22px !important;
    padding: 0 7px !important;
    font-size: 9px !important;
    line-height: 1 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) #homeGuestDraftClear {
    display: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    display: inline-grid !important;
    place-items: center !important;
    border: 1px solid rgba(255, 255, 255, .72) !important;
    border-radius: 50% !important;
    background: #ff7a18 !important;
    color: transparent !important;
    font-size: 0 !important;
    box-shadow: 0 8px 20px rgba(255, 122, 24, .34) !important;
    animation: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton::before {
    content: "↑";
    color: #fff;
    font-size: 17.5px;
    font-weight: 500;
    line-height: 1;
    transform: translateY(-1px);
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton::after {
    content: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton:disabled {
    background: #f5a261 !important;
    opacity: .72;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid,
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
    width: 100% !important;
    max-width: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-body {
    padding: 12px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-marketplace-type-nav {
    flex-wrap: nowrap !important;
    gap: 4px !important;
    margin: 10px 0 8px !important;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-marketplace-type-nav::-webkit-scrollbar {
    display: none;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-marketplace-type-nav button {
    flex: 0 0 auto !important;
    min-height: 27px !important;
    padding: 5px 8px !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
  }
}

/* Mobile home: remove the composer card shell and let showcase reach both edges. */
@media (max-width: 720px) {
  html[data-theme] body.page-app:not(.page-admin) .home-console {
    width: 100% !important;
    max-width: 100% !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console-body,
  html[data-theme] body.page-app:not(.page-admin) .home-create-form {
    background: transparent !important;
    box-shadow: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-form {
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-field {
    width: 110% !important;
    max-width: none !important;
    margin-right: -5% !important;
    margin-left: -5% !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar {
    width: 100% !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    margin-top: 2px !important;
    padding: 2px 0 5px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar::-webkit-scrollbar {
    display: none;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar > * {
    flex: 0 0 auto !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-file-tool,
  html[data-theme] body.page-app:not(.page-admin) .home-create-toolbar .btn,
  html[data-theme] body.page-app:not(.page-admin) .home-compact-tool-button,
  html[data-theme] body.page-app:not(.page-admin) .home-cost-hint {
    min-height: 32px !important;
    height: 32px !important;
    padding: 0 10px !important;
    border-radius: 10px !important;
    font-size: 11px !important;
    line-height: 1 !important;
    box-shadow: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-file-tool {
    gap: 5px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-file-tool > span {
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-model-tool .home-compact-tool-button {
    max-width: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-model-label-window {
    width: 4em !important;
    max-width: 4em !important;
    display: block !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-model-label-window > span {
    display: inline-block;
    min-width: max-content;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-model-label-window.is-scrolling > span {
    animation: home-model-label-scroll 5s ease-in-out infinite alternate;
  }

  @keyframes home-model-label-scroll {
    0%, 24% { transform: translateX(0); }
    76%, 100% { transform: translateX(calc(4em - 100%)); }
  }

  html[data-theme] body.page-app:not(.page-admin) .home-capability-trigger {
    width: auto !important;
    min-width: 48px !important;
    padding: 0 10px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-create-actions {
    width: auto !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-cost-hint {
    display: inline-flex !important;
    align-items: center !important;
    background: rgba(255, 255, 255, .76) !important;
    font-size: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-cost-hint [data-home-cost-label] {
    display: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-cost-hint strong,
  html[data-theme] body.page-app:not(.page-admin) .home-cost-hint::after {
    font-size: 11px !important;
    line-height: 1 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-cost-hint::after {
    content: attr(data-balance-label) "/次" !important;
    margin-left: 3px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell > .home-file-tool {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    z-index: 3 !important;
    width: auto !important;
    min-height: 30px !important;
    height: 30px !important;
    padding: 0 10px 0 6px !important;
    border-color: rgba(15, 23, 42, .08) !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, .88) !important;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .08) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    display: inline-flex !important;
    align-items: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell > .home-file-tool > span {
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-field textarea {
    padding-top: 44px !important;
    padding-right: 72px !important;
    padding-bottom: 7px !important;
    padding-left: 14px !important;
    border-radius: 18px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell:has(.home-prompt-send) textarea {
    height: 76px !important;
    min-height: 76px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell > #homePolishBtn.home-prompt-polish {
    position: absolute !important;
    right: 38px !important;
    bottom: 6px !important;
    z-index: 3 !important;
    width: 25.2px !important;
    min-width: 25.2px !important;
    max-width: 25.2px !important;
    height: 25.2px !important;
    min-height: 25.2px !important;
    padding: 0 !important;
    display: grid !important;
    place-items: center !important;
    border: 1px solid rgba(249, 115, 22, .18) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, .9) !important;
    color: #ea580c !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .1) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell > #homePolishBtn.home-prompt-polish svg {
    width: 12.6px !important;
    height: 12.6px !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.9 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-resize-handle > span {
    transform: scale(.7) !important;
    transform-origin: center !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-resize-handle {
    left: 8px !important;
    bottom: 6px !important;
    width: 19.6px !important;
    height: 19.6px !important;
    border-radius: 6.3px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send {
    right: 7px !important;
    bottom: 6px !important;
    width: 25.2px !important;
    min-width: 25.2px !important;
    max-width: 25.2px !important;
    height: 25.2px !important;
    min-height: 25.2px !important;
    border-radius: 8px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-console #homeGenerateButton.home-prompt-send svg {
    width: 13.3px !important;
    height: 13.3px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-prompt-shell > #homePolishBtn.home-prompt-polish span {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-grid,
  html[data-theme] body.page-app.sidebar-collapsed:not(.page-admin) .home-showcase-grid {
    position: relative !important;
    left: 50% !important;
    width: 100vw !important;
    max-width: none !important;
    margin-right: -50vw !important;
    margin-left: -50vw !important;
    box-sizing: border-box !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main {
    width: 100% !important;
    max-width: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-head,
  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-body {
    padding-right: max(12px, env(safe-area-inset-right)) !important;
    padding-left: max(12px, env(safe-area-inset-left)) !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-head {
    align-items: flex-start !important;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-head > .home-showcase-title {
    position: relative !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 10px !important;
    padding: 6px 12px 6px 15px !important;
    overflow: hidden !important;
    border: 1px solid rgba(255, 255, 255, .72) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, .88) !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .14) !important;
    backdrop-filter: blur(14px) saturate(1.08) !important;
    -webkit-backdrop-filter: blur(14px) saturate(1.08) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-title .home-showcase-search-inline {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: min(230px, 100%) !important;
    min-width: 0 !important;
    justify-self: end !important;
    margin: 0 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-title > h3 {
    grid-column: 1 !important;
    grid-row: 1 !important;
    white-space: nowrap !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-title > .sub {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    margin-top: 2px !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-title .home-showcase-search-inline input {
    width: 100% !important;
    height: 30px !important;
    padding: 0 11px !important;
    border-radius: 9px !important;
    background: rgba(248, 250, 252, .94) !important;
    font-size: 11px !important;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .04) !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-head > div:first-child::before {
    content: "" !important;
    position: absolute !important;
    top: 8px !important;
    bottom: 8px !important;
    left: 7px !important;
    width: 3px !important;
    border-radius: 999px !important;
    background: #f97316 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-head h3 {
    margin: 0 0 2px !important;
    color: #111827 !important;
    font-size: 16px !important;
    font-weight: 900 !important;
    line-height: 1.2 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-main .card-v3-head .sub {
    margin: 0 !important;
    color: #64748b !important;
    font-size: 10px !important;
    line-height: 1.35 !important;
  }

  html[data-theme] body.page-app:not(.page-admin) .home-showcase-head-actions {
    display: none !important;
  }

}

/* Creation room: portrait phone layout and touch ergonomics. */
@media (max-width: 720px) {
  html[data-theme] body.page-creation:not(.page-admin) {
    --creation-mobile-gutter: max(8px, env(safe-area-inset-left), env(safe-area-inset-right));
  }

  html[data-theme] body.page-creation:not(.page-admin) .main-area {
    height: var(--mobile-app-height) !important;
    min-height: var(--mobile-app-height) !important;
    max-height: var(--mobile-app-height) !important;
    padding: 0 !important;
    overflow: hidden !important;
    contain: layout paint;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-workspace {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    min-height: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 76px minmax(0, 1fr) !important;
    border: 0 !important;
    border-radius: 0 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar {
    height: 76px !important;
    max-height: 76px !important;
    padding: 6px var(--creation-mobile-gutter) 7px !important;
    overflow: hidden !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(15, 23, 42, .08) !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar-head {
    height: 27px !important;
    padding: 0 2px 4px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar-head strong {
    font-size: 13px !important;
    line-height: 1 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar-head a {
    width: 26px !important;
    height: 26px !important;
    border-radius: 8px !important;
    font-size: 18px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-group {
    display: flex !important;
    gap: 6px !important;
    padding-bottom: 2px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-group::-webkit-scrollbar {
    display: none;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-group > span {
    display: none !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-item {
    flex: 0 0 142px !important;
    min-height: 36px !important;
    height: 36px !important;
    gap: 6px !important;
    padding: 3px 6px 3px 4px !important;
    scroll-snap-align: start;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-thumb {
    width: 28px !important;
    height: 28px !important;
    flex-basis: 28px !important;
    border-radius: 7px !important;
    font-size: 10px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-title-line {
    gap: 4px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-item .creation-type-badge {
    min-width: 26px !important;
    height: 16px !important;
    padding: 0 4px !important;
    font-size: 8px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-item strong {
    font-size: 10px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-item small {
    display: none !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-main {
    min-height: 0 !important;
    height: 100% !important;
    grid-template-rows: 46px minmax(0, 1fr) auto !important;
    overflow: hidden !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-topbar {
    min-width: 0 !important;
    min-height: 40px !important;
    height: 40px !important;
    gap: 6px !important;
    margin: 5px var(--creation-mobile-gutter) 1px !important;
    padding: 5px 7px 5px 9px !important;
    border-radius: 10px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-topbar > div:first-child,
  html[data-theme] body.page-creation:not(.page-admin) .creation-room-heading {
    min-width: 0 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-room-heading {
    gap: 5px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-room-heading .creation-type-badge {
    min-width: 30px !important;
    height: 18px !important;
    padding: 0 4px !important;
    font-size: 9px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-topbar h1 {
    max-width: 36vw !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-topbar p {
    display: none !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-top-actions {
    flex: 0 0 auto !important;
    gap: 4px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-top-actions .btn {
    min-height: 28px !important;
    height: 28px !important;
    padding: 0 7px !important;
    border-radius: 8px !important;
    font-size: 10px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-thread {
    min-height: 0 !important;
    padding: 8px var(--creation-mobile-gutter) 10px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-message {
    margin-bottom: 8px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-message > div {
    max-width: 92% !important;
    padding: 9px 10px !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-message.is-user > div {
    max-width: 84% !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-result-media {
    width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: 1fr !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-result-media img,
  html[data-theme] body.page-creation:not(.page-admin) .creation-result-media video {
    max-height: 30dvh !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-result-media audio {
    width: calc(100% - 16px) !important;
    margin: 8px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-welcome {
    width: min(100%, 340px) !important;
    margin-top: clamp(12px, 4vh, 32px) !important;
    padding: 14px 12px !important;
    border-radius: 10px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-welcome span {
    margin-bottom: 7px !important;
    padding: 3px 7px !important;
    font-size: 9px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-welcome h2 {
    margin-bottom: 5px !important;
    font-size: 16px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-welcome p {
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.45 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer.home-console {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: calc(100% - 2 * var(--creation-mobile-gutter)) !important;
    max-width: none !important;
    max-height: min(44dvh, 330px) !important;
    margin: 0 var(--creation-mobile-gutter) max(6px, env(safe-area-inset-bottom)) !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border-radius: 12px !important;
    transform: none !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-form {
    padding: 7px 8px 8px !important;
    gap: 5px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-toolbar {
    width: 100% !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: auto auto auto minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 5px !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-tabs {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    order: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    display: grid !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(76px, 1fr) !important;
    gap: 4px !important;
    margin: 0 !important;
    padding: 2px !important;
    overflow-x: auto !important;
    scrollbar-width: none;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-tabs::-webkit-scrollbar {
    display: none;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-file-tool,
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homePromptPresetBtn,
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homePolishBtn {
    grid-row: 2 !important;
    order: 0 !important;
    margin: 0 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-actions {
    grid-column: 4 !important;
    grid-row: 2 !important;
    width: auto !important;
    min-width: 0 !important;
    justify-self: end !important;
    margin: 0 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-tabs button,
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-toolbar .btn,
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-file-tool {
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 8px !important;
    border-radius: 9px !important;
    font-size: 10px !important;
    white-space: nowrap !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-file-tool > span {
    width: 20px !important;
    height: 20px !important;
    flex-basis: 20px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-file-tool strong {
    font-size: 10px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-cost-hint {
    min-height: 28px !important;
    max-width: 100% !important;
    padding: 3px 6px !important;
    overflow: hidden !important;
    font-size: 9px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-panel {
    max-height: 96px !important;
    padding: 0 0 1px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 5px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field,
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-model-fields .field-v3 {
    width: 100% !important;
    min-width: 0 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field:not(.home-toggle-field) > label,
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-model-fields .field-v3:not(.home-toggle-field) > label {
    left: 9px !important;
    max-width: 42px !important;
    font-size: 10px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field select,
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field input[type="text"],
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .compact-param-field input[type="number"] {
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 24px 0 54px !important;
    border-radius: 9px !important;
    font-size: 11px !important;
    text-overflow: ellipsis !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-field {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-shell:has(.home-prompt-send) textarea {
    width: 100% !important;
    min-height: 62px !important;
    height: 62px !important;
    max-height: 112px !important;
    padding: 10px 48px 10px 12px !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    overflow-y: auto !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-expand {
    top: 7px !important;
    right: 7px !important;
    width: 24px !important;
    height: 24px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer #homeGenerateButton.home-prompt-send {
    right: 7px !important;
    bottom: 7px !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 10px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-file-preview:empty,
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-reference-preview:empty {
    display: none !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-main > .home-prompt-modal {
    position: fixed !important;
    inset: 0 0 calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    height: auto !important;
    padding: max(12px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 12px max(10px, env(safe-area-inset-left)) !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-main > .home-prompt-modal .home-prompt-modal-panel {
    width: 100% !important;
    height: min(76dvh, 620px) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: 100% !important;
    border-radius: 14px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-main > .home-prompt-modal textarea {
    min-height: 0 !important;
    height: 100% !important;
    font-size: 16px !important;
  }
}

@media (max-width: 380px) {
  html[data-theme] body.page-creation:not(.page-admin) .creation-workspace {
    grid-template-rows: 70px minmax(0, 1fr) !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar {
    height: 70px !important;
    max-height: 70px !important;
    padding-top: 4px !important;
    padding-bottom: 5px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar-head {
    height: 25px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-item {
    flex-basis: 132px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-topbar h1 {
    max-width: 30vw !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-file-tool strong {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
  }

}

/* Creation room mobile refinement: one primary scroll surface and on-demand parameters. */
html[data-theme] body.page-creation:not(.page-admin) .home-mobile-options {
  display: none;
}

@media (max-width: 720px) {
  html[data-theme] body.page-creation:not(.page-admin) {
    --creation-mobile-gutter: max(10px, env(safe-area-inset-left), env(safe-area-inset-right));
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-workspace {
    grid-template-rows: 52px minmax(0, 1fr) !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 8px !important;
    height: 52px !important;
    max-height: 52px !important;
    padding: 7px var(--creation-mobile-gutter) !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar-head {
    height: 38px !important;
    gap: 5px !important;
    padding: 0 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar-head strong {
    max-width: 48px !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar-head a {
    width: 38px !important;
    height: 38px !important;
    border-radius: 9px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-group {
    min-width: 0 !important;
    height: 38px !important;
    gap: 6px !important;
    padding: 0 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-history-item {
    flex-basis: 126px !important;
    height: 38px !important;
    min-height: 38px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-main {
    grid-template-rows: 48px minmax(0, 1fr) auto !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-topbar {
    height: 44px !important;
    min-height: 44px !important;
    margin: 4px var(--creation-mobile-gutter) 0 !important;
    padding: 5px 6px 5px 10px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-topbar h1 {
    max-width: 34vw !important;
    font-size: 13px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-top-actions .btn {
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 9px !important;
    font-size: 11px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-thread {
    padding: 10px var(--creation-mobile-gutter) 12px !important;
    scroll-padding-bottom: 12px;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-message > div {
    max-width: 94% !important;
    padding: 10px 11px !important;
    border-radius: 9px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-message.is-user > div {
    max-width: 88% !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer.home-console {
    width: calc(100% - 2 * var(--creation-mobile-gutter)) !important;
    max-height: none !important;
    margin: 0 var(--creation-mobile-gutter) 8px !important;
    overflow: visible !important;
    border-radius: 13px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer.mobile-options-open {
    max-height: min(52dvh, 420px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-form {
    padding: 7px 8px 8px !important;
    gap: 6px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-toolbar {
    grid-template-columns: auto auto auto auto minmax(0, 1fr) !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mobile-options {
    display: inline-flex !important;
    grid-column: 4 !important;
    grid-row: 2 !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-actions {
    grid-column: 5 !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-cost-hint > span {
    display: none !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-panel.is-active {
    display: none !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer.mobile-options-open .home-mode-panel.is-active {
    display: block !important;
    max-height: 152px !important;
    padding: 2px 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-prompt-shell:has(.home-prompt-send) textarea {
    height: 64px !important;
    min-height: 64px !important;
  }
}

@media (max-width: 380px) {
  html[data-theme] body.page-creation:not(.page-admin) .creation-workspace {
    grid-template-rows: 50px minmax(0, 1fr) !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar {
    height: 50px !important;
    max-height: 50px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-sidebar-head strong {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
  }

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-create-toolbar {
  grid-template-columns: 36px auto auto auto minmax(0, 1fr) !important;
}
}

/* Creation room modes: keep the toolbar compact and reveal choices on demand. */
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker {
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
  min-width: 92px;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker-trigger {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 9px;
  background: rgba(255, 255, 255, .82);
  color: var(--text, #1e293b);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker-trigger::-webkit-details-marker {
  display: none;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker-trigger:hover,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker[open] .home-mode-picker-trigger {
  border-color: rgba(249, 115, 22, .3);
  background: #fff7ed;
  color: #c2410c;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker-chevron {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .16s ease;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker[open] .home-mode-picker-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker-menu {
  position: absolute;
  top: auto;
  bottom: calc(100% + 7px);
  left: 0;
  display: grid;
  gap: 4px;
  min-width: 124px;
  padding: 6px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 10px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 32px rgba(15, 23, 42, .16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker-menu button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text, #1e293b);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker-menu button:hover,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker-menu button.active {
  background: #fff1e6;
  color: #c2410c;
}

@media (max-width: 720px) {
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker {
    min-width: 86px;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-mode-picker-trigger {
    min-height: 30px;
    padding: 0 8px;
    font-size: 11px;
  }
}

/* Creation room parameters: use a bounded popover above the composer. */
@media (max-width: 720px) {
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer.mobile-options-open {
    overflow: visible !important;
  }

  html[data-theme] body.page-creation:not(.page-admin) .creation-composer.mobile-options-open .home-mode-panel.is-active {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(100% + 8px) !important;
    z-index: 3600 !important;
    width: auto !important;
    max-height: min(52dvh, 360px) !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 12px !important;
    border: 1px solid rgba(15, 23, 42, .1) !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, .96) !important;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .18) !important;
    backdrop-filter: blur(16px) saturate(1.05) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.05) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

html[data-theme] body.page-creation:not(.page-admin) .creation-composer.mobile-options-open .home-mode-panel.is-active .compact-param-row {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 8px !important;
    margin: 0 !important;
  }
}

/* Expanded composer reference rail: keep image mentions available while editing long prompts. */
html[data-theme] body:not(.page-admin) .home-prompt-modal-panel {
  grid-template-rows: auto auto minmax(0, 1fr) auto !important;
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-references {
  min-width: 0;
  display: grid;
  gap: 10px;
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-tabs {
  display: flex;
  align-items: center;
  min-height: 36px;
  border-bottom: 1px solid rgba(15, 23, 42, .1);
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-tabs button {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text, #1f2937);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-tabs button.is-active {
  border-bottom-color: #f97316;
  color: #c2410c;
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-rail {
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-reference,
html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-add {
  position: relative;
  width: 88px;
  height: 88px;
  flex: 0 0 88px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  background: rgba(248, 250, 252, .86);
  color: var(--text-soft, #64748b);
  cursor: pointer;
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-reference:hover,
html[data-theme] body:not(.page-admin) .home-prompt-modal-reference:focus-visible,
html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-add:hover,
html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-add:focus-visible {
  border-color: rgba(249, 115, 22, .58);
  outline: none;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, .12);
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-reference img,
html[data-theme] body:not(.page-admin) .home-prompt-modal-reference video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-reference > span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 4px 5px;
  overflow: hidden;
  background: rgba(17, 24, 39, .72);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-add {
  display: grid;
  place-items: center;
  border-style: dashed;
}

html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-add > span {
  font-size: 36px;
  font-weight: 300;
  line-height: 1;
}

html[data-theme] body:not(.page-admin) .home-prompt-modal textarea {
  min-height: 0 !important;
}

@media (max-width: 720px) {
  html[data-theme] body:not(.page-admin) .home-prompt-modal-panel {
    padding: 12px !important;
    gap: 8px !important;
  }

  html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-tabs {
    min-height: 30px;
  }

  html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-tabs button {
    padding: 0 10px;
    font-size: 12px;
  }

  html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-rail {
    gap: 8px;
  }

  html[data-theme] body:not(.page-admin) .home-prompt-modal-reference,
  html[data-theme] body:not(.page-admin) .home-prompt-modal-reference-add {
    width: 68px;
    height: 68px;
    flex-basis: 68px;
  }
}

/* Keep creation-room capability choices compact, centered on the trigger, and inside the room. */
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-tool {
  position: relative !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-popover {
  position: absolute !important;
  top: auto !important;
  right: auto !important;
  bottom: calc(100% + 6px) !important;
  left: 50% !important;
  width: min(360px, calc(100vw - 32px)) !important;
  max-width: calc(100vw - 32px) !important;
  max-height: min(48vh, 360px) !important;
  padding: 7px !important;
  transform: translateX(-50%) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-popover .home-tool-popover-head {
  gap: 8px !important;
  padding: 1px 2px 6px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-popover .home-tool-popover-head strong {
  font-size: 11px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-popover .home-tool-popover-head small {
  font-size: 9px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-group > .compact-param-row,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-group .compact-param-row,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-group .home-audio-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 5px !important;
  margin: 0 !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-group .compact-param-field select,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-group .compact-param-field input[type="text"],
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-group .compact-param-field input[type="number"] {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 22px 0 46px !important;
  border-radius: 7px !important;
  font-size: 11px !important;
}

html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-group .compact-param-field:not(.home-toggle-field) > label,
html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-group .home-model-fields .field-v3:not(.home-toggle-field) > label {
  left: 8px !important;
  max-width: 34px !important;
  font-size: 10px !important;
}

@media (max-width: 720px) {
  html[data-theme] body.page-creation:not(.page-admin) .creation-composer .home-capability-popover {
    width: min(360px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 32px) !important;
    max-height: min(52dvh, 360px) !important;
  }
}
