/* Final theme layer inspired by the Automation Workflow Dashboard UI Kit. */

body {
  background: #fff;
}

.workspace {
  padding: 16px 18px 18px;
  background: #fff;
}

.app-shell {
  background: #fff;
}

.sidebar {
  border-right: 0;
}

.topbar {
  min-height: 66px;
}

.topbar h2 {
  font-size: 25px;
}

.wechat-contact-button,
.referral-entry-button,
.topbar-credit-button,
.status-cluster {
  height: 36px;
  border-color: transparent;
  border-radius: 8px;
  background: #f5f8f7;
  box-shadow: none;
  font-size: 12px;
}

.status-cluster {
  background: #f8faf9;
}

.panel-grid,
.panel-grid.chat-only {
  gap: 0;
}

.creator-surface,
.result-rail {
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.panel {
  padding: 20px;
}

.composer .icon-button.primary,
.creation-form > .action-button[type="submit"] {
  color: #fff;
  border-color: #171a19;
  background: #171a19;
  box-shadow: none;
}

.composer .icon-button.primary:hover,
.creation-form > .action-button[type="submit"]:hover {
  color: #fff;
  border-color: #159c8c;
  background: #159c8c;
  box-shadow: none;
}

.field-block textarea,
.control-grid select,
.control-grid input,
.reference-block {
  border-color: #dce5e2;
  border-radius: 8px;
  background: #f9fbfa;
}

.field-block textarea:focus,
.control-grid select:focus,
.control-grid input:focus {
  border-color: #83cfc4;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(49, 200, 181, 0.1);
}

.rail-header {
  padding: 14px 16px;
  border: 0;
  border-bottom-color: transparent;
  background: transparent;
}

.result-list {
  gap: 9px;
  padding: 12px;
  background: #fff;
}

.result-card,
.chat-history-card {
  padding: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.result-card:hover,
.chat-history-card:hover {
  border-color: transparent;
  background: #fafcfc;
  box-shadow: none;
}

.result-rail {
  background: #fff;
}

.account-card.signed-in .profile-entry {
  border-color: transparent;
  background: transparent;
}

.profile-entry small {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.profile-entry small #credit-balance {
  display: inline;
}

/* Keep task-log results comparable across image ratios and prompt lengths. */
.task-log-grid {
  align-items: stretch;
}

.task-log-card {
  display: grid;
  grid-template-rows: 24px 190px 68px 36px;
  gap: 10px;
  height: 378px;
  min-height: 378px;
  overflow: hidden;
}

.task-log-card .result-preview {
  display: grid;
  place-items: center;
  min-height: 0;
  height: auto;
  overflow: hidden;
  border-radius: 8px;
  background: #f5f7f6;
}

.task-log-card .result-preview img,
.task-log-card .result-preview video {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.task-log-card .result-detail {
  min-height: 0;
  overflow: hidden;
  align-content: center;
}

.task-log-card .result-actions {
  min-height: 0;
  align-items: center;
}

/* Image and video: result-first workspace with controls on the right. */
.panel-grid.result-first {
  grid-template-columns: minmax(0, 1fr) 390px;
  grid-template-areas: "results controls";
  gap: 18px;
}

.panel-grid.result-first .creator-surface {
  grid-area: controls;
  min-width: 0;
  overflow: hidden;
}

.panel-grid.result-first .result-rail {
  grid-area: results;
  min-width: 0;
  overflow: hidden;
}

.panel-grid.result-first .panel {
  padding: 16px;
}

.panel-grid.result-first .creation-form {
  width: 100%;
  max-width: none;
  margin: 0;
  gap: 14px;
}

.panel-grid.result-first .field-block textarea {
  min-height: 180px;
}

.panel-grid.result-first .control-grid {
  gap: 10px;
}

.panel-grid.result-first .reference-block {
  padding: 12px;
}

.panel-grid.result-first .cost-preview,
.panel-grid.result-first .creation-form > .action-button[type="submit"] {
  width: 100%;
  min-width: 0;
}

.panel-grid.result-first .result-list {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  place-items: stretch;
  align-content: stretch;
  padding: 24px;
}

.panel-grid.result-first .result-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 920px);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
}

.panel-grid.result-first .result-meta,
.panel-grid.result-first .result-detail,
.panel-grid.result-first .result-actions {
  width: min(100%, 920px);
}

.panel-grid.result-first .result-preview {
  place-items: center;
  width: 100%;
  min-height: 0;
  height: 100%;
  padding: 16px;
  overflow: hidden;
  border-radius: 8px;
  background: #f7f9f8;
}

.current-result-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 0 0;
}

.current-result-actions .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  color: #49635e;
  border: 0;
  border-radius: 7px;
  background: #edf5f3;
  font-size: 12px;
  font-weight: 800;
}

.current-result-actions .secondary-button:hover {
  color: #117e70;
  background: #e0f3ef;
}

.current-result-actions svg {
  width: 15px;
  height: 15px;
}

.panel-grid.result-first .result-preview img,
.panel-grid.result-first .result-preview video {
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.panel-grid.result-first #clear-results:disabled {
  opacity: 0.35;
  cursor: default;
}

.panel-grid.result-first .empty-state {
  width: min(100%, 720px);
  min-height: 420px;
  border: 0;
  background: transparent;
}

@media (max-width: 1120px) {
  .panel-grid.result-first {
    grid-template-columns: 1fr;
    grid-template-areas:
      "controls"
      "results";
    gap: 12px;
    overflow: visible;
  }

  .panel-grid.result-first .creator-surface,
  .panel-grid.result-first .result-rail {
    height: auto;
    max-height: none;
  }

  .panel-grid.result-first .result-preview img,
  .panel-grid.result-first .result-preview video {
    max-height: 70vh;
  }
}

.task-log-summary-card.active {
  color: #fff;
  border-color: #171a19;
  background: #171a19;
  box-shadow: none;
}

@media (max-width: 720px) {
  body,
  .workspace,
  .app-shell {
    background: #fff;
  }

  .workspace {
    padding: calc(62px + env(safe-area-inset-top)) 10px calc(76px + env(safe-area-inset-bottom));
  }

  .topbar,
  body:has(#chat-panel.active) .topbar {
    min-height: 54px;
  }

  .topbar h2 {
    font-size: 21px;
  }

  .panel {
    padding: 14px;
  }

  .creator-surface,
  .result-rail {
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(31, 47, 43, 0.06);
  }

  .result-list {
    padding: 10px;
  }
}

/* Luming creator workspace redesign. */
:root {
  color-scheme: dark;
  --product-accent: #35c7b0;
  --product-accent-soft: rgba(53, 199, 176, 0.13);
  --product-ink: #eef4f1;
  --product-muted: #8f9a96;
  --product-canvas: #111513;
  --product-radius: 8px;
  --bg: #0d100f;
  --ink: #eef4f1;
  --muted: #8f9a96;
  --line: #29312e;
  --surface: #151917;
  --surface-soft: #1b211e;
  --accent: #35c7b0;
  --accent-strong: #62dbc7;
  --blue: #35c7b0;
  --red: #eb7a7a;
  --shadow: 0 20px 54px rgba(4, 8, 6, 0.3);
  font-family: "Segoe UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
}

body {
  color: var(--ink);
  overflow: hidden;
}

button,
input,
textarea,
select {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-color: rgba(53, 199, 176, 0.45);
}

.app-shell {
  grid-template-columns: 196px minmax(0, 1fr);
  min-height: 100dvh;
  background: var(--bg);
}

.sidebar {
  gap: 18px;
  padding: 16px 12px;
  border-right: 1px solid #232a27;
  background: #101412;
}

.brand {
  gap: 10px;
  min-height: 54px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid #252c29;
}

.brand-mark {
  width: 38px;
  height: 38px;
}

.brand h1 {
  color: #f1f6f4;
  font-size: 16px;
}

.brand span {
  color: #75807c;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
}

.module-nav {
  gap: 5px;
}

.nav-item {
  min-height: 42px;
  gap: 10px;
  padding: 0 11px;
  color: #8e9995;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.nav-item:hover {
  color: #e9efec;
  border-color: #29322e;
  background: #181d1b;
}

.nav-item.active {
  color: #0f1714;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: none;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
}

.account-card,
.account-card.signed-in {
  border-color: #29312e;
  background: #151a18;
}

.account-card.signed-in .profile-entry,
.profile-entry {
  color: #e8efec;
  border-color: #29312e;
  background: #181d1b;
}

.profile-entry small,
.account-head,
.account-head strong {
  color: #8e9995;
}

.avatar {
  color: #0d1411;
  background: var(--accent);
}

.guest-actions button {
  color: #cbd4d0;
  border-color: #303936;
  background: #1a201d;
}

.guest-actions button:first-child,
.account-card:not(.signed-in) .guest-actions button:first-child {
  color: #0d1411;
  border-color: var(--accent);
  background: var(--accent);
}

.workspace {
  height: 100dvh;
  padding: 0 22px 22px;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  min-height: 64px;
  height: 64px;
  padding: 0 2px;
}

.topbar h2 {
  color: #edf3f0;
  font-size: 21px;
  font-weight: 750;
}

.topbar-actions {
  gap: 6px;
}

.wechat-contact-button,
.referral-entry-button,
.topbar-credit-button,
.status-cluster {
  height: 34px;
  color: #b8c2be;
  border: 1px solid #29312e;
  border-radius: 8px;
  background: #151a18;
  box-shadow: none;
}

.wechat-contact-button:hover,
.wechat-contact-button[aria-expanded="true"],
.referral-entry-button:hover,
.topbar-credit-button:hover {
  color: #eaf2ef;
  border-color: #3a4842;
  background: #1c2320;
}

.status-cluster {
  color: #85918c;
}

.status-dot.ready {
  background: var(--accent);
}

.panel-grid,
.panel-grid.chat-only {
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1px;
  border: 1px solid #252d2a;
  border-radius: 8px;
  background: #252d2a;
}

.panel-grid.home-only,
.panel-grid.workflow-only,
.panel-grid.task-log-only {
  grid-template-columns: minmax(0, 1fr);
}

.panel-grid.home-only .result-rail,
.panel-grid.workflow-only .result-rail,
.panel-grid.task-log-only .result-rail {
  display: none;
}

.creator-surface,
.result-rail {
  border: 0;
  border-radius: 0;
  background: #121614;
  box-shadow: none;
}

.creator-surface {
  position: relative;
}

.panel {
  padding: 18px;
  scrollbar-color: #39433f transparent;
}

.panel-grid.home-only .creator-surface,
.panel-grid.workflow-only .creator-surface {
  background: #101412;
}

.panel-grid.generation-mode,
.panel-grid.result-first {
  grid-template-columns: minmax(350px, 410px) minmax(0, 1fr);
  grid-template-areas: "controls results";
  gap: 1px;
}

.panel-grid.generation-mode .creator-surface,
.panel-grid.result-first .creator-surface {
  grid-area: controls;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
}

.panel-grid.generation-mode .result-rail,
.panel-grid.result-first .result-rail {
  grid-area: results;
  min-width: 0;
}

.panel-grid.generation-mode .panel.active,
.panel-grid.result-first .panel.active {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  padding: 14px 16px 18px;
}

.generation-tabs {
  display: none;
  flex: 0 0 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  margin: 12px 12px 0;
  padding: 3px;
  border: 1px solid #29312e;
  border-radius: 8px;
  background: #0e1210;
}

.panel-grid.generation-mode .generation-tabs {
  display: grid;
}

.generation-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  color: #84908b;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.generation-tabs button:hover {
  color: #dfe7e3;
  background: #1b211e;
}

.generation-tabs button.active {
  color: #0f1714;
  background: var(--accent);
}

.generation-tabs svg {
  width: 15px;
  height: 15px;
}

.home-panel {
  padding: 0;
}

.home-stage {
  display: grid;
  grid-template-rows: minmax(250px, 0.9fr) minmax(270px, 1.1fr);
  gap: 12px;
  width: min(100%, 1240px);
  height: 100%;
  margin: 0 auto;
  padding: 18px;
}

.home-assistant-feature {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid #2a3430;
  border-radius: 8px;
  background:
    linear-gradient(112deg, rgba(53, 199, 176, 0.16), transparent 43%),
    #171c1a;
}

.home-assistant-feature::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.24;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 100% 32px;
  pointer-events: none;
}

.home-assistant-copy {
  align-self: center;
  padding: 30px clamp(24px, 4vw, 56px);
}

.home-kicker {
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

@font-face {
  font-family: "MaoKenWangFengYaSong";
  src: url("/fonts/MaoKenWangFengYaSong.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

.home-kinetic-title {
  position: relative;
  width: min(100%, 560px);
  height: clamp(104px, 11vw, 138px);
  margin: -4px 0 0;
  overflow: visible;
  cursor: default;
}

.home-kinetic-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.home-kinetic-fallback {
  max-width: 520px;
  margin: 0;
  color: #f0f5f3;
  font-size: clamp(28px, 3vw, 46px);
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: 0;
  transition: opacity 120ms ease;
}

.home-kinetic-fallback span {
  display: inline-block;
  margin-left: 22%;
}

.home-kinetic-title.is-ready .home-kinetic-fallback {
  opacity: 0;
}

.home-assistant-copy p {
  max-width: 540px;
  margin: 14px 0 22px;
  color: #a6b0ac;
  font-size: 14px;
  line-height: 1.7;
}

.home-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  color: #0c1411;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.home-primary-action:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.home-primary-action svg {
  width: 17px;
  height: 17px;
}

.home-brand-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: hidden;
}

.home-brand-visual::before {
  content: "";
  position: absolute;
  width: 58%;
  aspect-ratio: 1;
  border: 1px solid rgba(53, 199, 176, 0.24);
  border-radius: 50%;
}

.home-brand-visual img {
  position: relative;
  width: min(76%, 300px);
  max-height: 82%;
  object-fit: contain;
  filter: saturate(0.86) contrast(1.04);
}

.home-launch-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-height: 0;
}

.home-launch-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 18px 20px;
  color: #e8efec;
  text-align: left;
  border: 1px solid #29322e;
  border-radius: 8px;
  background: #151a18;
  overflow: hidden;
}

.home-launch-card::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 3px;
  background: transparent;
}

.home-launch-card:hover {
  color: #f0f5f3;
  border-color: #3d4a45;
  background: #1a211e;
  transform: translateY(-1px);
}

.home-launch-card:hover::after {
  background: var(--accent);
}

.home-launch-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--accent);
  border: 1px solid rgba(53, 199, 176, 0.26);
  border-radius: 8px;
  background: rgba(53, 199, 176, 0.08);
}

.home-launch-icon svg {
  width: 20px;
  height: 20px;
}

.home-launch-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.home-launch-copy strong {
  font-size: 15px;
}

.home-launch-copy small {
  color: #87928d;
  font-size: 12px;
  line-height: 1.45;
}

.home-launch-arrow {
  width: 18px;
  height: 18px;
  color: #66716d;
}

.workflow-page {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 22px 10px;
}

.workflow-page-head {
  display: block;
  margin-bottom: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid #29312e;
}

.workflow-page-head h3 {
  margin: 0;
  color: #eef4f1;
  font-size: 26px;
  line-height: 1.25;
}

.workflow-page-head p {
  max-width: 640px;
  margin: 8px 0 0;
  color: #8d9893;
  font-size: 13px;
  line-height: 1.65;
}

.workflow-list {
  display: grid;
}

.workflow-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 14px 6px;
  color: #dce5e1;
  text-align: left;
  text-decoration: none;
  border: 0;
  border-bottom: 1px solid #29312e;
  border-radius: 0;
  background: transparent;
}

.workflow-row:hover {
  color: #f1f6f4;
  border-color: #3a4842;
  background: #151a18;
  transform: none;
}

.workflow-row-primary {
  border-top: 1px solid #29312e;
}

.workflow-row-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--accent);
  border: 1px solid rgba(53, 199, 176, 0.25);
  border-radius: 8px;
  background: rgba(53, 199, 176, 0.08);
}

.workflow-row-copy {
  display: grid;
  gap: 4px;
}

.workflow-row-copy strong {
  font-size: 14px;
}

.workflow-row-copy small,
.workflow-row-meta {
  color: #84908b;
  font-size: 12px;
}

.workflow-row-meta {
  padding: 5px 8px;
  border: 1px solid #303936;
  border-radius: 6px;
  white-space: nowrap;
}

.workflow-row > svg {
  width: 18px;
  height: 18px;
  color: #66716d;
}

.my-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.my-quick-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  color: #b8c2be;
  border: 1px solid #29312e;
  border-radius: 8px;
  background: #171c1a;
  font-size: 12px;
  font-weight: 750;
}

.my-quick-actions button:hover {
  color: #edf3f0;
  border-color: #3c4944;
  background: #1c2320;
}

.my-quick-actions svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.chat-history-bar select,
.field-block textarea,
.control-grid select,
.control-grid input,
.reference-block,
.advanced-settings,
.creation-model-options,
.composer,
.tool-switch,
.cost-preview {
  color: #dfe7e3;
  border-color: #2c3531;
  background: #181d1b;
}

.field-block label,
.control-grid label > span,
.reference-block > span,
.panel-grid.result-first .field-block label,
.panel-grid.result-first .control-grid label > span,
.panel-grid.result-first .reference-block > span,
.creation-model-label {
  color: #aab4b0;
}

.field-block textarea,
.control-grid select,
.control-grid input,
.panel-grid.result-first .field-block textarea,
.panel-grid.result-first .control-grid select,
.panel-grid.result-first .control-grid input,
.panel-grid.result-first .reference-block {
  color: #e7eeeb;
  border-color: #303936;
  background: #171c1a;
}

.field-block textarea::placeholder,
.control-grid input::placeholder,
.composer textarea::placeholder {
  color: #65706b;
}

.field-block textarea:focus,
.control-grid select:focus,
.control-grid input:focus,
.panel-grid.result-first .field-block textarea:focus,
.panel-grid.result-first .control-grid select:focus,
.panel-grid.result-first .control-grid input:focus,
.composer:focus-within {
  color: #eef4f1;
  border-color: var(--accent);
  background: #1a211e;
  box-shadow: 0 0 0 3px rgba(53, 199, 176, 0.12);
}

.creation-model-options {
  border-color: #29312e;
  background: #0f1311;
}

.creation-model-options button {
  color: #7f8b86;
}

.creation-model-options button:hover {
  color: #dfe7e3;
  background: #1c2320;
}

.creation-model-options button.active {
  color: #0d1512;
  background: var(--accent);
  box-shadow: none;
}

.tool-switch {
  padding: 3px;
}

.tool-switch button {
  color: #82908a;
  border: 0;
  background: transparent;
}

.tool-switch button.active {
  color: #0c1411;
  background: var(--accent);
}

.advanced-settings > summary {
  color: #aab4b0;
}

.generation-action-bar {
  background: #121614;
}

.generation-action-bar::before {
  background: linear-gradient(to top, #121614, rgba(18, 22, 20, 0));
}

.panel-grid.result-first .cost-preview,
.generation-action-bar .cost-preview {
  color: #9fe6da;
  border-color: rgba(53, 199, 176, 0.18);
  background: rgba(53, 199, 176, 0.1);
}

.panel-grid.result-first .creation-form > .action-button[type="submit"],
.creation-form > .action-button[type="submit"],
.composer .icon-button.primary {
  color: #0c1411;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: none;
}

.panel-grid.result-first .creation-form > .action-button[type="submit"]:hover,
.creation-form > .action-button[type="submit"]:hover,
.composer .icon-button.primary:hover {
  color: #0c1411;
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.result-rail,
.result-list {
  background: #0f1311;
}

.rail-header {
  min-height: 50px;
  padding: 12px 14px;
  border-bottom: 1px solid #252d2a;
  background: #121614;
}

.rail-header h3,
.panel-grid.result-first .rail-header h3 {
  color: #dfe7e3;
  font-size: 15px;
}

.icon-button,
.secondary-button {
  color: #aab4b0;
  border-color: #303936;
  background: #1a201d;
}

.icon-button:hover,
.secondary-button:hover {
  color: #edf3f0;
  border-color: #43504b;
  background: #202824;
}

.result-card,
.chat-history-card {
  color: #dce5e1;
  border-color: #29312e;
  background: #151a18;
}

.result-card:hover,
.chat-history-card:hover {
  background: #1a211e;
}

.panel-grid.result-first .result-preview,
.panel-grid.result-first .empty-state,
.empty-state {
  color: #87928d;
  border-color: #29312e;
  background: #121614;
}

.panel-grid.result-first .result-preview {
  min-height: 420px;
  background:
    linear-gradient(45deg, rgba(238, 244, 241, 0.025) 25%, transparent 25%, transparent 75%, rgba(238, 244, 241, 0.025) 75%),
    linear-gradient(45deg, rgba(238, 244, 241, 0.025) 25%, transparent 25%, transparent 75%, rgba(238, 244, 241, 0.025) 75%),
    #111513;
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
}

.result-tool-dock {
  border-top: 1px solid #252d2a;
  background: #121614;
}

.result-tool-dock > strong {
  color: #aab4b0;
}

.result-tool-button,
.current-result-actions .secondary-button,
.retry-task-log-result {
  color: #9fe6da;
  border-color: rgba(53, 199, 176, 0.24);
  background: rgba(53, 199, 176, 0.1);
}

.result-tool-button:hover,
.current-result-actions .secondary-button:hover,
.retry-task-log-result:hover {
  color: #0c1411;
  border-color: var(--accent);
  background: var(--accent);
}

.chat-window {
  background: #101412;
}

.message.assistant .bubble,
.message.user .bubble {
  color: #dfe7e3;
  border-color: #29312e;
  background: #181d1b;
}

.message.user .bubble {
  color: #0d1512;
  border-color: var(--accent);
  background: var(--accent);
}

.composer {
  box-shadow: none;
}

.composer textarea {
  color: #edf3f0;
}

.task-log-head,
.task-log-summary-card,
.task-log-card {
  color: #aab4b0;
  border-color: #29312e;
  background: #151a18;
}

.task-log-summary-card:hover,
.task-log-summary-card.active {
  color: #0d1512;
  border-color: var(--accent);
  background: var(--accent);
}

.task-log-card .result-preview,
.task-log-card .task-log-preview {
  background: #101412;
}

.modal-backdrop {
  background: rgba(5, 8, 7, 0.76);
}

.modal-card,
.wechat-contact-popover,
.profile-modal-card,
.ledger-modal-card,
.recharge-modal-card,
.referral-modal-card {
  color: #dfe7e3;
  border: 1px solid #303936;
  border-radius: 8px;
  background: #171c1a;
  box-shadow: 0 24px 70px rgba(3, 7, 5, 0.5);
}

.modal-card input,
.modal-card textarea,
.modal-card select,
.auth-form input,
.profile-form input {
  color: #e5ece9;
  border-color: #303936;
  background: #101412;
}

.modal-card input::placeholder,
.modal-card textarea::placeholder {
  color: #68736e;
}

.profile-tabs,
.recharge-step-section,
.recharge-status-message,
.auth-help-box,
.ecommerce-step-pane,
.ecommerce-option-section,
.ecommerce-plan-summary,
.ecommerce-plan-card,
.ecommerce-confirm-grid div {
  color: #cbd4d0;
  border-color: #303936;
  background: #111513;
}

.profile-tabs button,
.recharge-step-head p,
.profile-subsection-head p,
.profile-record-note,
.ecommerce-head p,
.ecommerce-section-head p,
.ecommerce-message {
  color: #89948f;
}

.profile-tabs button.active,
.ecommerce-option-card.active {
  color: #0d1512;
  background: var(--accent);
  box-shadow: none;
}

.ecommerce-modal-card {
  width: min(980px, calc(100vw - 32px));
  min-height: min(720px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
}

.ecommerce-head {
  border-bottom-color: #303936;
}

.ecommerce-head h3,
.ecommerce-section-head h4,
.ecommerce-option-section h5,
.ecommerce-plan-card header b {
  color: #edf3f0;
}

#ecommerce-cost-badge {
  color: #9fe6da;
  border-color: rgba(53, 199, 176, 0.24);
  background: rgba(53, 199, 176, 0.1);
}

.ecommerce-steps {
  border-color: #303936;
  background: #101412;
}

.ecommerce-steps div {
  color: #75817c;
}

.ecommerce-steps .active,
.ecommerce-steps .done {
  color: #bfeee6;
}

.ecommerce-steps .active b,
.ecommerce-steps .done b {
  color: #0d1512;
  border-color: var(--accent);
  background: var(--accent);
}

.ecommerce-option-card,
.ecommerce-upload-box,
.ecommerce-result-card {
  color: #b9c3bf;
  border-color: #303936;
  background: #171c1a;
}

.ecommerce-form-grid input,
.ecommerce-form-grid select,
.ecommerce-form-grid textarea,
.ecommerce-plan-summary input,
.ecommerce-plan-summary textarea,
.ecommerce-plan-card input,
.ecommerce-plan-card textarea {
  color: #e5ece9;
  border-color: #303936;
  background: #0f1311;
}

.ecommerce-actions {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  border-top-color: #303936;
  background: #171c1a;
}

.ecommerce-actions p {
  margin: 0;
  color: #89948f;
  font-size: 12px;
  line-height: 1.5;
}

.ecommerce-actions .action-button {
  color: #0c1411;
  border-color: var(--accent);
  background: var(--accent);
}

@media (prefers-reduced-motion: no-preference) {
  .home-assistant-feature,
  .home-launch-card,
  .workflow-row {
    animation: luming-enter 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .home-launch-card:nth-child(2),
  .workflow-row:nth-child(2) {
    animation-delay: 50ms;
  }

  .home-launch-card:nth-child(3),
  .workflow-row:nth-child(3) {
    animation-delay: 90ms;
  }

  .home-launch-card:nth-child(4) {
    animation-delay: 130ms;
  }
}

@keyframes luming-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Match chat history cards to the rounded generation cards. */
.panel-grid.chat-only .chat-history-list {
  gap: 10px;
}

.panel-grid.chat-only .chat-history-section {
  gap: 10px;
}

.panel-grid.chat-only .chat-history-card,
.panel-grid.chat-only .chat-history-card.archived {
  padding: 12px 14px;
  border: 1px solid #2d3733;
  border-radius: 20px;
  background: #1d211f;
  box-shadow: none;
  opacity: 1;
}

.panel-grid.chat-only .chat-history-card:hover {
  border-color: #3d4b45;
  background: #242b27;
}

.panel-grid.chat-only .chat-history-card.active {
  border-color: #5b7568;
  background: #26302b;
}

/* Outer history surface uses the same rounded shell as generation panels. */
.panel-grid.chat-only .result-rail {
  border: 1px solid #2d3733 !important;
  border-radius: 24px !important;
  overflow: hidden;
}

@media (max-width: 820px) {
  .topbar {
    background: #0d100f !important;
    background-color: #0d100f !important;
  }
}

body:has(#chat-panel.active) .topbar {
  border: 0 !important;
  border-bottom: 0 !important;
}

/* Keep all main result/conversation canvases transparent above the shared dot texture. */
html body .workspace,
html body .panel-grid.generation-mode,
html body .panel-grid.result-first,
html body .panel-grid.chat-only,
html body .panel-grid.generation-mode .result-rail,
html body .panel-grid.result-first .result-rail,
html body .panel-grid.generation-mode .result-list,
html body .panel-grid.result-first .result-list,
html body .panel-grid.chat-only .creator-surface,
html body:has(#chat-panel.active) #chat-panel.panel.active {
  background-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body .workspace {
  background-image: radial-gradient(circle, rgba(187, 255, 235, 0.2) 0 1px, transparent 1.35px) !important;
  background-size: 22px 22px !important;
  animation: site-dot-drift 32s linear infinite;
}

/* Final override: keep generation result canvases transparent over the site texture. */
.panel-grid.generation-mode .result-rail,
.panel-grid.result-first .result-rail,
.panel-grid.generation-mode .result-list,
.panel-grid.result-first .result-list {
  background: transparent !important;
  background-color: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.panel-grid.generation-mode .result-rail .rail-header,
.panel-grid.result-first .result-rail .rail-header,
.panel-grid.generation-mode .result-tool-dock,
.panel-grid.result-first .result-tool-dock {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

.panel-grid.generation-mode .empty-state,
.panel-grid.result-first .empty-state {
  background: transparent !important;
  background-color: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Let the conversation canvas reveal the shared site texture as well. */
html body .panel-grid.chat-only .creator-surface,
html body:has(#chat-panel.active) #chat-panel.panel.active {
  background: transparent !important;
  background-color: transparent !important;
}

/* Recharge modal: override legacy light surfaces so every section stays dark. */
.recharge-modal-card .recharge-step-section,
.recharge-modal-card .recharge-step-section.card-redeem-card,
.recharge-modal-card .recharge-pricing-card {
  color: #cbd4d0;
  border-color: #303936;
  background: #111513 !important;
}

.recharge-modal-card .recharge-pricing-card .pricing-table {
  border-color: #303936;
  background: #171c1a !important;
}

.recharge-modal-card .recharge-pricing-card .pricing-row {
  border-top-color: rgba(250, 251, 255, 0.08);
}

.recharge-modal-card .recharge-pricing-card .pricing-row-head {
  background: #202623 !important;
}

.recharge-modal-card .recharge-pricing-card .pricing-row span {
  color: #93a09a;
}

.recharge-modal-card .recharge-pricing-card .pricing-row strong {
  color: #42cbbb;
}

/* Profile tabs use a restrained dark selected state instead of the legacy white tile. */
.profile-modal-card .profile-tabs {
  border: 1px solid #29312e;
  background: #0f1311 !important;
}

.profile-modal-card .profile-tabs button {
  color: #77827d;
  background: transparent !important;
  box-shadow: none !important;
}

.profile-modal-card .profile-tabs button:hover {
  color: #cbd4d0;
  background: #171c1a !important;
}

.profile-modal-card .profile-tabs button.active {
  color: #42cbbb !important;
  background: #202623 !important;
  box-shadow: inset 0 0 0 1px #303936 !important;
}

/* Shared site-wide dot texture for every workspace view. */
.sidebar,
body:not(:has(#home-panel.active)) .workspace {
  background-image: radial-gradient(circle, rgba(187, 255, 235, 0.2) 0 1px, transparent 1.35px) !important;
  background-size: 22px 22px !important;
  background-position: 0 0 !important;
}

.sidebar {
  background-color: #101412 !important;
  background-blend-mode: screen;
}

body:not(:has(#home-panel.active)) .workspace {
  background-color: #0d100f !important;
  background-blend-mode: screen;
  animation: site-dot-drift 32s linear infinite;
}

@keyframes site-dot-drift {
  from { background-position: 0 0; }
  to { background-position: 44px 44px; }
}

/* Keep the music model card on the same mobile axis and rhythm as video. */
@media (max-width: 720px) {
  #music-panel.active {
    padding: 12px 12px 88px !important;
  }

  #music-panel.active .creation-model-switch {
    width: auto !important;
    height: 70px !important;
    min-height: 70px !important;
    margin: 10px 10px 0 !important;
    padding-block: 6px !important;
    box-sizing: border-box;
    position: static;
  }
}

/* Responsive mobile baseline: let each surface follow the viewport instead
   of inheriting desktop-centered widths and fixed gutters. */
@media (max-width: 720px) {
  html,
  body,
  .app-shell,
  .workspace,
  .panel-grid,
  .creator-surface,
  .result-rail,
  .panel-grid.generation-mode .panel.active,
  .panel-grid.result-first .panel.active {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .workspace {
    padding-inline: 0;
  }

  .panel-grid.generation-mode .panel.active,
  .panel-grid.result-first .panel.active {
    padding-inline: clamp(8px, 2.6vw, 14px);
  }

  .panel-grid.generation-mode .creation-form,
  .panel-grid.result-first .creation-form,
  #music-panel.active .creation-form {
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
    margin-inline: 0 !important;
    align-self: stretch;
  }

  .panel-grid.generation-mode .creation-model-switch,
  .panel-grid.result-first .creation-model-switch {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: 0;
    box-sizing: border-box;
  }

  .panel-grid.generation-mode .music-editor-stack,
  .panel-grid.result-first .music-editor-stack,
  #music-panel.active .music-editor-stack {
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    margin-inline: 0 !important;
    box-sizing: border-box;
  }

  .panel-grid.generation-mode .generation-action-bar,
  .panel-grid.result-first .generation-action-bar,
  #music-panel.active .generation-action-bar {
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    margin-inline: 0 !important;
    box-sizing: border-box;
  }

  .panel-grid.generation-mode .control-grid,
  .panel-grid.result-first .control-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  }

  .panel-grid.generation-mode input,
  .panel-grid.generation-mode select,
  .panel-grid.generation-mode textarea,
  .panel-grid.result-first input,
  .panel-grid.result-first select,
  .panel-grid.result-first textarea {
    max-width: 100%;
    box-sizing: border-box;
  }

  .generation-tabs {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .generation-tabs::-webkit-scrollbar {
    display: none;
  }

  /* Reserve the fixed mobile navigation area without fixing the action bar. */
  .panel-grid.generation-mode .generation-action-bar,
  .panel-grid.result-first .generation-action-bar {
    margin-bottom: calc(62px + env(safe-area-inset-bottom) + 16px) !important;
  }
}

/* Final generation header color lock. */
body:has(.panel-grid.generation-mode) .topbar,
body:has(.panel-grid.result-first) .topbar {
  background: #0d100f !important;
  background-color: #0d100f !important;
}

/* Match the mobile generation header to the application canvas. */
body:has(.panel-grid.generation-mode) .topbar,
body:has(.panel-grid.result-first) .topbar {
  background: #0d100f !important;
  background-color: #0d100f !important;
}

/* Compact the empty result area on phones so filters stay close to the editor. */
@media (max-width: 720px) {
  .panel-grid.generation-mode .empty-state,
  .panel-grid.result-first .empty-state {
    min-height: 120px !important;
  }
}

/* Keep the model switcher attached beneath the fixed generation tabs while scrolling. */
@media (max-width: 720px) {
  .panel-grid.generation-mode .creation-model-switch.mobile-stuck,
  .panel-grid.result-first .creation-model-switch.mobile-stuck {
    position: fixed !important;
    top: calc(106px + env(safe-area-inset-top)) !important;
    right: 10px !important;
    left: 10px !important;
    z-index: 28 !important;
    margin: 0 !important;
    padding-block: 6px;
    background: #111513 !important;
  }
}

/* Final mobile override: generation actions stay in normal document flow. */
@media (max-width: 720px) {
  .panel-grid.generation-mode .generation-action-bar,
  .panel-grid.result-first .generation-action-bar {
    position: static !important;
    inset: auto !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    z-index: auto !important;
  }
}

/* Keep the assistant composer visible above the fixed mobile navigation. */
@media (max-width: 820px) {
  #chat-panel .composer {
    position: fixed !important;
    right: 10px !important;
    bottom: calc(62px + env(safe-area-inset-bottom)) !important;
    left: 10px !important;
    z-index: 32 !important;
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* Final cascade: all generation submit buttons use the image-generation UI. */
.panel-grid.generation-mode .generation-action-bar,
.panel-grid.result-first .generation-action-bar {
  display: block !important;
  width: auto !important;
  margin: 6px 12px 12px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.panel-grid.generation-mode .generation-action-bar > .cost-preview,
.panel-grid.result-first .generation-action-bar > .cost-preview { display: none !important; }
.panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"],
.panel-grid.result-first .generation-action-bar > .action-button[type="submit"] {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100% !important;
  min-width: 0 !important;
  height: 46px !important;
  min-height: 46px !important;
  border-radius: 8px !important;
}
.panel-grid.generation-mode .generation-action-bar .action-cost,
.panel-grid.result-first .generation-action-bar .action-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: currentColor;
  font-size: 12px;
  font-weight: 750;
}
.panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"]:disabled .action-cost,
.panel-grid.result-first .generation-action-bar > .action-button[type="submit"]:disabled .action-cost { display: none !important; }

/* Unified generation action contract: image generation is the visual baseline. */
.panel-grid.generation-mode .generation-action-bar,
.panel-grid.result-first .generation-action-bar {
  display: block;
  width: auto;
  margin: 6px 12px 12px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.panel-grid.generation-mode .generation-action-bar > .cost-preview,
.panel-grid.result-first .generation-action-bar > .cost-preview {
  display: none;
}

.panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"],
.panel-grid.result-first .generation-action-bar > .action-button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  height: 46px;
  min-height: 46px;
  border-radius: 8px;
}

.panel-grid.generation-mode .generation-action-bar .action-cost,
.panel-grid.result-first .generation-action-bar .action-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: currentColor;
  font-size: 12px;
  font-weight: 750;
}

.panel-grid.generation-mode .generation-action-bar .action-cost svg,
.panel-grid.result-first .generation-action-bar .action-cost svg {
  width: 14px;
  height: 14px;
}

.panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"]:disabled .action-cost,
.panel-grid.result-first .generation-action-bar > .action-button[type="submit"]:disabled .action-cost {
  display: none;
}

/* On mobile, model selection and generation actions belong to the scroll flow. */
@media (max-width: 720px) {
  body:has(.panel-grid.generation-mode) .creation-model-switch,
  body:has(.panel-grid.result-first) .creation-model-switch,
  .panel-grid.generation-mode .generation-action-bar,
  .panel-grid.result-first .generation-action-bar {
    position: static !important;
    inset: auto !important;
    z-index: auto !important;
    width: auto;
    margin-top: 10px;
    margin-bottom: 10px;
  }
}

/* Keep the image ratio control beneath the mobile bottom navigation. */
@media (max-width: 820px) {
  .panel-grid.generation-mode .image-parameter-control,
  .panel-grid.result-first .image-parameter-control {
    z-index: 20 !important;
  }

  .panel-grid.generation-mode .image-parameter-control.open,
  .panel-grid.result-first .image-parameter-control.open {
    z-index: 40 !important;
  }
}

/* Keep the fixed mobile bottom navigation fully opaque. */
@media (max-width: 820px) {
  .app-shell > .sidebar {
    background: #0d100f !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .app-shell > .sidebar .module-nav {
    background: #0d100f !important;
  }

  /* The bottom nav is the top layer at the viewport edge. */
  .panel-grid.generation-mode .generation-action-bar,
  .panel-grid.result-first .generation-action-bar {
    z-index: 20 !important;
  }
}

/* Opaque mobile generation header surfaces; prevent content bleeding through. */
@media (max-width: 720px) {
  body:has(.panel-grid.generation-mode) .topbar {
    background: #0d100f !important;
    backdrop-filter: none;
  }

  body:has(.panel-grid.generation-mode) .generation-tabs {
    background: #0d100f !important;
    backdrop-filter: none;
  }
}

/* Keep the generation header (topbar + mode tabs) pinned while mobile content scrolls. */
@media (max-width: 720px) {
  body:has(.panel-grid.generation-mode) .topbar {
    position: fixed !important;
    top: 0;
    right: 0;
    left: 0;
  }

  body:has(.panel-grid.generation-mode) .generation-tabs {
    position: fixed !important;
    top: calc(54px + env(safe-area-inset-top));
    right: 0;
    left: 0;
    z-index: 29;
    width: 100%;
    margin: 0;
    border-radius: 0;
  }

  body:has(.panel-grid.generation-mode) .panel-grid {
    padding-top: 54px;
  }
}

/* Mobile generation header: keep the title and all account actions visible. */
@media (max-width: 720px) {
  body:has(.panel-grid.generation-mode) .topbar {
    display: flex;
    align-items: center;
    min-height: calc(54px + env(safe-area-inset-top));
    height: calc(54px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0 14px;
  }

  body:has(.panel-grid.generation-mode) .topbar > div:first-child {
    display: block;
    min-width: 0;
  }

  body:has(.panel-grid.generation-mode) .topbar h2 {
    max-width: 86px;
    overflow: hidden;
    color: #edf3f0;
    font-size: 16px;
    opacity: 1;
    pointer-events: auto;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:has(.panel-grid.generation-mode) .topbar .eyebrow {
    display: none;
  }

  body:has(.panel-grid.generation-mode) .topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
  }

  body:has(.panel-grid.generation-mode) .wechat-contact,
  body:has(.panel-grid.generation-mode) .referral-entry-button,
  body:has(.panel-grid.generation-mode) .status-cluster {
    display: block;
  }

  body:has(.panel-grid.generation-mode) .wechat-contact-button,
  body:has(.panel-grid.generation-mode) .referral-entry-button,
  body:has(.panel-grid.generation-mode) .topbar-credit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    width: auto;
    height: 32px;
    padding: 0 6px;
    font-size: 10px;
    white-space: nowrap;
  }

  body:has(.panel-grid.generation-mode) .wechat-contact-button svg,
  body:has(.panel-grid.generation-mode) .referral-entry-button svg,
  body:has(.panel-grid.generation-mode) .topbar-credit-button svg {
    width: 14px;
    height: 14px;
  }
}

/* Keep the mobile generation action clear of the fixed bottom navigation. */
@media (max-width: 820px) {
  .panel-grid.generation-mode .generation-action-bar,
  .panel-grid.result-first .generation-action-bar {
    position: static !important;
    inset: auto !important;
    z-index: auto !important;
    width: auto;
    margin: 6px 12px 12px !important;
  }
}

/* Final mobile navigation lock: keep the five-item nav fixed to the viewport bottom. */
@media (max-width: 820px) {
  .app-shell > .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 35;
    display: block;
    width: 100%;
    height: calc(62px + env(safe-area-inset-bottom));
    padding: 0 0 env(safe-area-inset-bottom);
    margin: 0;
  }

  .app-shell > .sidebar .module-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: 62px;
  }

  .panel-grid.generation-mode .generation-action-bar,
  .panel-grid.result-first .generation-action-bar {
    bottom: auto;
    margin-bottom: calc(62px + env(safe-area-inset-bottom));
  }
}

/* Mobile focus: keep the primary creation flow short and reserve the infinite canvas for desktop. */
@media (max-width: 720px) {
  .nav-item[data-panel="workflow"],
  .home-launch-workflow {
    display: none !important;
  }

  .module-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .topbar .wechat-contact,
  .topbar .referral-entry-button {
    display: none !important;
  }

  .topbar-actions {
    gap: 6px !important;
  }

  .topbar h2 {
    max-width: calc(100vw - 168px) !important;
  }

  .generation-tabs button {
    min-width: 84px;
    padding-inline: 12px;
  }

  .panel-grid.generation-mode .advanced-settings,
  .panel-grid.result-first .advanced-settings {
    margin-top: 8px;
  }
}

/* TTS controls use a deliberate three-row layout. */
#music-panel [data-music-section="tts"] {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) !important;
  gap: 14px 12px;
  align-items: end;
}
#music-panel [data-music-section="tts"] > label {
  min-width: 0;
  width: 100%;
}
#music-panel [data-music-section="tts"] > label:nth-child(1) { grid-column: 1; grid-row: 1; }
#music-panel [data-music-section="tts"] > label:nth-child(2) { grid-column: 2; grid-row: 1; }
#music-panel [data-music-section="tts"] > label:nth-child(3) { grid-column: 1; grid-row: 2; }
#music-panel [data-music-section="tts"] > label:nth-child(4) { grid-column: 2; grid-row: 2; }
#music-panel [data-music-section="tts"] > label:nth-child(5) { grid-column: 1 / -1; grid-row: 3; }
#music-panel [data-music-section="tts"] .range-field {
  grid-template-columns: minmax(0, 1fr) 58px;
}
#music-panel [data-music-section="tts"] .inline-field-action {
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
}
#music-panel [data-music-section="tts"] select,
#music-panel [data-music-section="tts"] .inline-field-action,
#music-panel [data-music-section="tts"] .range-field {
  width: 100%;
  min-width: 0;
}

/* Generation history collapse: keep a narrow restore rail instead of only toggling a class. */
@media (min-width: 821px) {
  .panel-grid.generation-mode.generation-history-collapsed,
  .panel-grid.result-first.generation-history-collapsed {
    grid-template-columns: 48px minmax(0, 1fr) !important;
    grid-template-areas: "results controls" !important;
    gap: 1px !important;
  }

  .panel-grid.generation-mode.generation-history-collapsed .result-rail,
  .panel-grid.result-first.generation-history-collapsed .result-rail {
    grid-area: results !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    position: relative;
    overflow: hidden !important;
  }

  .panel-grid.generation-mode.generation-history-collapsed .creator-surface,
  .panel-grid.result-first.generation-history-collapsed .creator-surface {
    grid-area: controls !important;
    width: auto !important;
    min-width: 0 !important;
  }

  .panel-grid.generation-mode.generation-history-collapsed .result-rail > :not(.chat-history-collapse),
  .panel-grid.result-first.generation-history-collapsed .result-rail > :not(.chat-history-collapse) {
    display: none !important;
  }

  .panel-grid.generation-mode.generation-history-collapsed .chat-history-collapse,
  .panel-grid.result-first.generation-history-collapsed .chat-history-collapse {
    display: grid !important;
    position: absolute;
    top: 12px;
    right: auto;
    left: 11px;
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 820px) {
  .panel-grid.generation-mode.generation-history-collapsed,
  .panel-grid.result-first.generation-history-collapsed {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) 46px !important;
    grid-template-areas: "controls" "results" !important;
  }

  .panel-grid.generation-mode.generation-history-collapsed .result-rail,
  .panel-grid.result-first.generation-history-collapsed .result-rail {
    grid-area: results !important;
    width: 100% !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 !important;
    position: relative;
    overflow: hidden !important;
  }

  .panel-grid.generation-mode.generation-history-collapsed .result-rail > :not(.chat-history-collapse),
  .panel-grid.result-first.generation-history-collapsed .result-rail > :not(.chat-history-collapse) {
    display: none !important;
  }

  .panel-grid.generation-mode.generation-history-collapsed .chat-history-collapse,
  .panel-grid.result-first.generation-history-collapsed .chat-history-collapse {
    display: grid !important;
    position: absolute;
    top: 10px;
    right: 12px;
    left: auto;
    width: 26px;
    height: 26px;
  }
}

.panel-grid.chat-only {
  grid-template-columns: minmax(0, 1fr) 278px !important;
  grid-template-areas: "conversation history" !important;
}
.panel-grid.chat-only .result-rail {
  order: 0;
  grid-area: history;
}
.panel-grid.chat-only .creator-surface {
  order: 0;
  grid-area: conversation;
}
@media (max-width: 820px) {
  .panel-grid.chat-only {
    grid-template-columns: 1fr !important;
    grid-template-areas: "conversation" !important;
  }
}

.panel-grid.chat-only {
  grid-template-columns: minmax(0, 1fr) 278px !important;
  grid-template-areas: "conversation history" !important;
}
.panel-grid.chat-only .result-rail {
  order: 0;
  grid-area: history;
}
.panel-grid.chat-only .creator-surface {
  order: 0;
  grid-area: conversation;
}
@media (max-width: 820px) {
  .panel-grid.chat-only {
    grid-template-columns: 1fr !important;
    grid-template-areas: "conversation" !important;
  }
}

/* Place chat history on the right side of the conversation. */
.panel-grid.chat-only {
  grid-template-columns: minmax(0, 1fr) 278px !important;
  grid-template-areas: "conversation history" !important;
}

.panel-grid.chat-only .result-rail {
  order: 0;
  grid-area: history;
}

.panel-grid.chat-only .creator-surface {
  order: 0;
  grid-area: conversation;
}

@media (max-width: 820px) {
  .panel-grid.chat-only {
    grid-template-columns: 1fr !important;
    grid-template-areas: "conversation" !important;
  }
}

body:has(#chat-panel.active) .topbar {
  border: 0 !important;
  border-bottom: 0 !important;
}

body:has(#chat-panel.active) .topbar {
  border: 0 !important;
  border-bottom: 0 !important;
}

/* Chat dark surface: remove the muted green-gray structural rules. */
body:has(#chat-panel.active) .topbar,
body:has(#chat-panel.active) .sidebar,
body:has(#chat-panel.active) .creator-surface,
body:has(#chat-panel.active) .result-rail,
body:has(#chat-panel.active) #chat-panel,
body:has(#chat-panel.active) .chat-history-card,
body:has(#chat-panel.active) .chat-history-card.active,
body:has(#chat-panel.active) .chat-history-card:hover {
  border-color: transparent !important;
}

/* Keep chat history and its controls together as a left navigation rail. */
.panel-grid.chat-only {
  grid-template-columns: 300px minmax(0, 1fr);
}

.panel-grid.chat-only .result-rail {
  order: -1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid #2d3733 !important;
  border-radius: 24px;
  background: #171717;
  box-shadow: none;
  overflow: hidden;
}

.panel-grid.chat-only .creator-surface {
  min-width: 0;
}

.panel-grid.chat-only .chat-history-bar {
  position: relative;
  inset: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 14px 12px 12px;
  border: 0;
  border-bottom: 1px solid #2a2a2a;
  border-radius: 0;
  background: #171717;
  box-shadow: none;
}

.panel-grid.chat-only .chat-history-bar-head,
.panel-grid.chat-only .chat-history-actions-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-grid.chat-only .chat-history-bar-head {
  justify-content: space-between;
}

.panel-grid.chat-only .chat-history-bar-head strong {
  color: #f2f2f2;
  font-size: 14px;
}

.panel-grid.chat-only .chat-history-bar-head .icon-button {
  width: 34px;
  height: 34px;
}

.panel-grid.chat-only .chat-history-bar label {
  display: none;
}

.panel-grid.chat-only .chat-history-bar label > span {
  display: block;
  color: #8e8e8e;
  font-size: 11px;
}

.panel-grid.chat-only .chat-history-bar select,
.panel-grid.chat-only .chat-search-input {
  width: 100%;
  height: 36px;
  color: #ececec;
  border: 1px solid #343434;
  border-radius: 8px;
  background: #212121;
}

.panel-grid.chat-only .chat-history-bar select {
  padding: 0 26px 0 10px;
}

.panel-grid.chat-only .chat-search-input {
  padding: 0 10px;
}

.panel-grid.chat-only .chat-history-actions-bar {
  justify-content: flex-end;
}

.panel-grid.chat-only .chat-history-actions-bar .chat-credit-button,
.panel-grid.chat-only .chat-history-actions-bar .icon-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  color: #c9c9c9;
  border: 0;
  border-radius: 7px;
  background: transparent;
}

.panel-grid.chat-only .chat-history-actions-bar .chat-credit-button span {
  display: none;
}

.panel-grid.chat-only .chat-history-actions-bar button:hover:not(:disabled) {
  color: #fff;
  background: #303030;
}

.panel-grid.chat-only .result-rail .rail-header {
  display: none;
}

.panel-grid.chat-only .result-rail .result-list {
  flex: 1;
  overflow: auto;
  padding: 12px;
  background: #171717;
}

.panel-grid.chat-only .chat-history-card {
  border-color: #2b2b2b;
  background: #1f1f1f;
}

.panel-grid.chat-only .chat-history-card.active {
  border-color: #4a4a4a;
  background: #2a2a2a;
}

.panel-grid.chat-only .chat-history-main strong {
  color: #f1f1f1;
}

.panel-grid.chat-only .chat-history-main span,
.panel-grid.chat-only .chat-history-card time,
.panel-grid.chat-only .chat-history-section-label {
  color: #919191;
}

@media (max-width: 820px) {
  .panel-grid.chat-only {
    grid-template-columns: 1fr;
  }

  .panel-grid.chat-only .result-rail {
    display: none;
  }
}

/* Screenshot-aligned generation tabs and model dropdown. */
.panel-grid.generation-mode .generation-tabs {
  min-height: 58px;
  padding: 0 12px;
  gap: 0;
}

.panel-grid.generation-mode .generation-tabs button {
  flex: 0 0 auto;
  min-height: 57px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.panel-grid.generation-mode .generation-tabs button.active {
  font-weight: 700;
}

.panel-grid.generation-mode .generation-tabs button::after {
  right: 12px;
  bottom: 7px;
  left: 12px;
}

.creation-model-dropdown {
  position: relative;
  z-index: 24;
  display: block;
  min-width: 0;
}

.creation-model-dropdown.open {
  z-index: 40;
}

.creation-model-trigger {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 5px 10px 5px 5px;
  color: #eef4f1;
  border: 1px solid #2a312e;
  border-radius: 8px;
  background: #171a19;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition: border-color 180ms ease, background-color 180ms ease;
}

.creation-model-trigger:hover,
.creation-model-dropdown.open .creation-model-trigger {
  border-color: #343c38;
  background: #1b1e1d;
}

.creation-model-trigger:active {
  transform: none;
}

.creation-model-trigger-copy,
.creation-model-option-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.creation-model-trigger-name-row,
.creation-model-option-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.creation-model-trigger-name,
.creation-model-option-name-row strong {
  min-width: 0;
  overflow: hidden;
  color: #eef4f1;
  font-size: 14px;
  font-weight: 720;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creation-model-trigger-description,
.creation-model-option-description {
  overflow: hidden;
  color: #7f8985;
  font-size: 11px;
  font-weight: 540;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creation-model-trigger-badge,
.creation-model-option-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  color: #a9eee2;
  border: 1px solid rgba(98, 219, 199, 0.18);
  border-radius: 4px;
  background: rgba(53, 199, 176, 0.12);
  font-size: 9px;
  font-weight: 760;
  line-height: 1;
}

.creation-model-trigger-badge[hidden],
.creation-model-option-badge[hidden],
.creation-model-options[hidden] {
  display: none !important;
}

.creation-model-trigger-chevron {
  width: 16px;
  height: 16px;
  color: #d2dad6;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.creation-model-dropdown.open .creation-model-trigger-chevron {
  transform: rotate(180deg);
}

.creation-model-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background:
    radial-gradient(circle at 74% 18%, rgba(255, 255, 255, 0.32), transparent 28%),
    linear-gradient(145deg, #27332f, #111513);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.creation-model-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 42%, rgba(53, 199, 176, 0.12));
  pointer-events: none;
}

.creation-model-thumb[data-tone="lime"] {
  background:
    radial-gradient(circle at 72% 18%, rgba(217, 239, 157, 0.3), transparent 28%),
    linear-gradient(145deg, #304036, #111513);
}

.creation-model-thumb[data-tone="blue"] {
  background:
    radial-gradient(circle at 72% 18%, rgba(112, 170, 232, 0.32), transparent 28%),
    linear-gradient(145deg, #27384a, #111513);
}

.creation-model-thumb[data-tone="cyan"] {
  background:
    radial-gradient(circle at 72% 18%, rgba(93, 217, 222, 0.3), transparent 28%),
    linear-gradient(145deg, #224143, #111513);
}

.creation-model-thumb[data-tone="rose"] {
  background:
    radial-gradient(circle at 72% 18%, rgba(213, 125, 154, 0.28), transparent 28%),
    linear-gradient(145deg, #412c35, #111513);
}

.creation-model-thumb img {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  object-fit: contain;
  opacity: 0.86;
  filter: saturate(0.8) brightness(1.08);
}

.panel-grid.generation-mode .creation-model-menu,
.panel-grid.result-first .creation-model-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 60;
  display: block;
  max-height: min(410px, calc(100dvh - 190px));
  min-height: 0;
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid #303633;
  border-radius: 8px;
  background: rgba(29, 32, 30, 0.985);
  box-shadow: 0 18px 44px rgba(4, 8, 6, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  scrollbar-color: #3a403d transparent;
  scrollbar-width: thin;
}

.creation-model-menu::-webkit-scrollbar {
  width: 5px;
}

.creation-model-menu::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background: #3a403d;
}

.panel-grid.generation-mode .creation-model-menu .creation-model-option,
.panel-grid.result-first .creation-model-menu .creation-model-option {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 5px;
  color: #dfe7e3;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  transition: background-color 160ms ease, transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-grid.generation-mode .creation-model-menu .creation-model-option:hover,
.panel-grid.result-first .creation-model-menu .creation-model-option:hover {
  background: #242826;
}

.panel-grid.generation-mode .creation-model-menu .creation-model-option.active,
.panel-grid.result-first .creation-model-menu .creation-model-option.active {
  color: #eef4f1;
  background: #2a2e2c;
  box-shadow: none;
}

.panel-grid.generation-mode .creation-model-menu .creation-model-option:active,
.panel-grid.result-first .creation-model-menu .creation-model-option:active {
  transform: scale(0.99);
}

.creation-model-option-check {
  width: 17px;
  height: 17px;
  color: #eef4f1;
  opacity: 0;
}

.creation-model-option.active .creation-model-option-check {
  opacity: 1;
}

@media (max-width: 720px) {
  .panel-grid.generation-mode .generation-tabs {
    min-height: 52px;
    padding-inline: 8px;
  }

  .panel-grid.generation-mode .generation-tabs button {
    min-height: 51px;
    padding-inline: 10px;
    font-size: 13px;
  }

  .panel-grid.generation-mode .creation-model-menu,
  .panel-grid.result-first .creation-model-menu {
    position: fixed;
    top: calc(112px + env(safe-area-inset-top));
    right: 10px;
    left: 10px;
    max-height: min(430px, calc(100dvh - 220px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .creation-model-trigger,
  .creation-model-trigger-chevron,
  .creation-model-option {
    transition: none !important;
    transform: none !important;
  }
}

/* Qianwen-aligned neutral surface and hairline hierarchy. */
.panel-grid.generation-mode,
.panel-grid.result-first {
  --qwen-surface: #222222;
  --qwen-soft-surface: rgba(250, 251, 255, 0.03);
  --qwen-hairline: rgba(250, 251, 255, 0.03);
  --qwen-control-line: rgba(250, 251, 255, 0.06);
}

.panel-grid.generation-mode .creator-surface,
.panel-grid.result-first .creator-surface {
  border: 0;
  background: rgba(34, 34, 34, 0.4);
  box-shadow: none;
}

.panel-grid.generation-mode .generation-tabs {
  border-bottom: 0;
}

.creation-model-trigger {
  border: 0;
  outline: 1px solid var(--qwen-hairline);
  outline-offset: -1px;
  background: transparent;
  box-shadow: none;
}

.creation-model-trigger:hover,
.creation-model-dropdown.open .creation-model-trigger {
  border-color: transparent;
  background: var(--qwen-soft-surface);
}

.creation-model-trigger:focus-visible,
.creation-model-option:focus-visible {
  outline: 1px solid rgba(250, 251, 255, 0.1);
  outline-offset: -1px;
}

.panel-grid.generation-mode .creation-model-menu,
.panel-grid.result-first .creation-model-menu {
  border: 0;
  outline: 1px solid var(--qwen-hairline);
  outline-offset: -1px;
  background: var(--qwen-surface);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.panel-grid.generation-mode .creation-model-menu .creation-model-option:hover,
.panel-grid.result-first .creation-model-menu .creation-model-option:hover {
  background: rgba(250, 251, 255, 0.04);
}

.panel-grid.generation-mode .creation-model-menu .creation-model-option.active,
.panel-grid.result-first .creation-model-menu .creation-model-option.active {
  background: rgba(250, 251, 255, 0.06);
  box-shadow: none;
}

.panel-grid.generation-mode .image-editor-stack,
.panel-grid.result-first .image-editor-stack {
  width: auto;
  margin-inline: 12px;
  border: 0;
  background: var(--qwen-surface);
  box-shadow: none;
}

.image-editor-stack .image-reference-block {
  position: relative;
  border-bottom: 0;
  background: transparent;
}

.image-editor-stack .image-reference-block::after {
  content: "";
  position: absolute;
  right: 15px;
  bottom: 0;
  left: 15px;
  height: 1px;
  background: var(--qwen-hairline);
  pointer-events: none;
}

/* Match the video reference composer baseline, including its 8px preview slot. */
.panel-grid.generation-mode .image-editor-stack .image-reference-block,
.panel-grid.result-first .image-editor-stack .image-reference-block {
  min-height: 136px;
}

.image-editor-stack .image-prompt-block {
  background: transparent;
}

.image-editor-stack .reference-actions .icon-button,
.image-editor-stack .reference-actions label.icon-button {
  border: 0;
  outline: 1px solid var(--qwen-control-line);
  outline-offset: -1px;
  background: var(--qwen-soft-surface);
}

.panel-grid.generation-mode .image-control-grid select,
.panel-grid.result-first .image-control-grid select,
.panel-grid.generation-mode .generation-action-bar .cost-preview,
.panel-grid.result-first .generation-action-bar .cost-preview {
  border: 0;
  outline: 1px solid var(--qwen-control-line);
  outline-offset: -1px;
  background: rgba(0, 0, 0, 0.08);
  box-shadow: none;
}

@media (max-width: 720px) {
  .panel-grid.generation-mode .image-editor-stack,
  .panel-grid.result-first .image-editor-stack {
    margin-inline: 10px;
  }
}

/* Qianwen-style image parameter summary and anchored control panel. */
.panel-grid.generation-mode .image-parameter-control,
.panel-grid.result-first .image-parameter-control {
  position: relative;
  z-index: 45;
  width: auto;
  margin-inline: 12px;
}

.image-parameter-native {
  display: none !important;
}

.image-parameter-summary-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.image-parameter-trigger {
  display: inline-flex;
  width: auto;
  min-width: 116px;
  height: 36px;
  padding: 0 11px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: rgba(250, 251, 255, 0.9);
  border: 0;
  border-radius: 8px;
  outline: 1px solid rgba(250, 251, 255, 0.08);
  outline-offset: -1px;
  background: rgba(250, 251, 255, 0.05);
  box-shadow: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  transition: background-color 150ms ease, transform 150ms ease, outline-color 150ms ease;
}

.image-parameter-trigger:hover,
.image-parameter-control.open .image-parameter-trigger {
  background: rgba(250, 251, 255, 0.08);
  outline-color: rgba(250, 251, 255, 0.12);
}

.image-parameter-trigger:active {
  transform: scale(0.98);
}

.image-parameter-trigger:focus-visible,
.image-parameter-option:focus-visible {
  outline: 1px solid rgba(250, 251, 255, 0.36);
  outline-offset: 1px;
}

.image-parameter-trigger svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  stroke-width: 1.7;
}

.panel-grid.generation-mode .image-parameter-summary-row .cost-preview,
.panel-grid.result-first .image-parameter-summary-row .cost-preview {
  display: inline-flex;
  width: auto;
  min-width: 0;
  height: 28px;
  padding: 0;
  align-items: center;
  gap: 4px;
  color: rgba(250, 251, 255, 0.42);
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  white-space: nowrap;
}

.image-parameter-summary-row .cost-preview strong {
  color: rgba(250, 251, 255, 0.72);
  font-size: 12px;
  font-weight: 600;
}

.image-parameter-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 80;
  display: flex;
  width: min(342px, 100%);
  max-height: min(680px, calc(100dvh - 120px));
  padding: 15px;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  color: rgb(250, 251, 255);
  border: 1px solid rgba(250, 251, 255, 0.06);
  border-radius: 8px;
  outline: 0;
  background: rgba(34, 34, 34, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px rgba(6, 10, 38, 0.08);
}

.image-parameter-popover[hidden] {
  display: none !important;
}

.image-parameter-section {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.image-parameter-section[hidden] {
  display: none !important;
}

.image-parameter-label {
  display: block;
  min-height: 24px;
  color: rgba(250, 251, 255, 0.5);
  font-size: 12px;
  font-weight: 500;
  line-height: 24px;
}

.image-segmented-control,
.image-aspect-control {
  display: grid;
  min-width: 0;
  padding: 2px;
  gap: 4px;
  border-radius: 8px;
  background: rgba(250, 251, 255, 0.03);
}

.image-segmented-control {
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  height: 42px;
}

.image-aspect-control {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: 52px;
}

.image-parameter-option {
  display: flex;
  min-width: 0;
  min-height: 0;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(250, 251, 255, 0.86);
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  transition: background-color 150ms ease, transform 150ms ease;
}

.image-parameter-option:hover {
  background: rgba(250, 251, 255, 0.04);
}

.image-parameter-option.active,
.image-parameter-option[aria-checked="true"] {
  color: rgb(250, 251, 255);
  background: rgba(250, 251, 255, 0.06);
}

.image-parameter-option:active {
  transform: scale(0.97);
}

.image-aspect-control .image-parameter-option {
  height: 52px;
  padding: 6px 2px;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  line-height: 16px;
}

.image-aspect-icon {
  display: block;
  width: var(--aspect-icon-width);
  height: var(--aspect-icon-height);
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 2px;
  opacity: 0.92;
}

.panel-grid.generation-mode .image-generation-action-bar,
.panel-grid.result-first .image-generation-action-bar {
  display: block;
  width: auto;
  margin: 6px 12px 12px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.image-generation-action-bar::before {
  display: none !important;
}

.panel-grid.generation-mode .image-generation-action-bar > .action-button[type="submit"],
.panel-grid.result-first .image-generation-action-bar > .action-button[type="submit"] {
  width: 100%;
  min-width: 0;
  height: 40px;
  border-radius: 8px;
}

.image-generation-action-bar > .action-button[type="submit"]:disabled {
  color: rgba(250, 251, 255, 0.32);
  border-color: transparent;
  background: rgba(250, 251, 255, 0.06);
  box-shadow: none;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: no-preference) {
  .image-parameter-popover:not([hidden]) {
    animation: image-parameter-popover-in 150ms cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom left;
  }

  @keyframes image-parameter-popover-in {
    from {
      opacity: 0;
      transform: translateY(5px) scale(0.99);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
}

@media (max-width: 720px) {
  .panel-grid.generation-mode .image-parameter-control,
  .panel-grid.result-first .image-parameter-control {
    margin-inline: 10px;
  }

  .image-parameter-popover {
    position: fixed;
    right: 10px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
    max-height: calc(100dvh - 150px);
    overflow-y: auto;
  }

  .panel-grid.generation-mode .image-generation-action-bar,
  .panel-grid.result-first .image-generation-action-bar {
    margin-inline: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-parameter-trigger,
  .image-parameter-option,
  .image-parameter-popover {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .image-parameter-popover {
    background: rgb(34, 34, 34);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* Qianwen-style reference uploader and real generation-history picker. */
.panel-grid.generation-mode .image-editor-stack .image-reference-block,
.panel-grid.result-first .image-editor-stack .image-reference-block {
  display: block;
  min-height: 128px;
  padding: 16px 16px 12px;
}

.image-reference-uploader {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  width: 100%;
  height: 100px;
  color: rgba(250, 251, 255, 0.5);
  border: 0;
  border-radius: 8px;
  background: rgba(250, 251, 255, 0.03);
  cursor: pointer;
  transition: color 180ms ease, background-color 180ms ease, outline-color 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.image-reference-uploader[hidden] {
  display: none !important;
}

.image-reference-uploader > svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}

.image-reference-uploader > span {
  color: rgba(250, 251, 255, 0.5);
  font-size: 13px;
  line-height: 1;
}

.image-reference-uploader > span small {
  color: rgba(250, 251, 255, 0.36);
  font: inherit;
}

.image-reference-uploader > span button {
  padding: 0;
  color: #f3f5f4;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.image-reference-uploader > span [data-open-reference-upload] {
  color: rgba(250, 251, 255, 0.5);
  font-weight: 400;
}

.image-reference-uploader:hover,
.image-reference-uploader:focus-within {
  color: rgba(250, 251, 255, 0.68);
  outline: 1px solid rgba(250, 251, 255, 0.06);
  outline-offset: -1px;
  background: rgba(250, 251, 255, 0.05);
}

.image-reference-uploader:active {
  transform: scale(0.995);
}

.image-reference-uploader.drag-active {
  color: #b9f0e6;
  outline: 1px solid rgba(98, 219, 199, 0.35);
  outline-offset: -1px;
  background: rgba(53, 199, 176, 0.1);
}

.image-reference-preview {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.image-reference-preview[hidden] {
  display: none !important;
}

.image-reference-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 24px;
  margin-bottom: 8px;
}

.image-reference-preview-head > span {
  color: #eef2f0;
  font-size: 12px;
  font-weight: 650;
}

.image-reference-preview-head > span small {
  margin-left: 5px;
  color: rgba(250, 251, 255, 0.38);
  font: inherit;
  font-weight: 500;
}

.image-reference-preview-head .link-button {
  min-height: 24px;
  padding: 0 4px;
  color: rgba(250, 251, 255, 0.46);
  font-size: 11px;
}

.image-reference-thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 68px);
  gap: 8px;
  min-height: 68px;
}

.image-reference-thumbnail {
  position: relative;
  width: 68px;
  height: 68px;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(250, 251, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(250, 251, 255, 0.05);
}

.image-reference-thumbnail > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-reference-thumbnail > span {
  position: absolute;
  bottom: 4px;
  left: 4px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  color: #f4f6f5;
  border-radius: 4px;
  background: rgba(12, 14, 13, 0.72);
  font-size: 10px;
}

.image-reference-thumbnail .attachment-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  color: #f4f6f5;
  border: 0;
  background: rgba(12, 14, 13, 0.72);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.image-reference-thumbnail:hover .attachment-remove,
.image-reference-thumbnail .attachment-remove:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.image-reference-add {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  color: rgba(250, 251, 255, 0.42);
  border-radius: 8px;
  background: rgba(250, 251, 255, 0.025);
  box-shadow: inset 0 0 0 1px rgba(250, 251, 255, 0.05);
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}

.image-reference-add:hover {
  color: rgba(250, 251, 255, 0.7);
  background: rgba(250, 251, 255, 0.05);
}

.image-reference-add > svg {
  width: 22px;
  height: 22px;
}

.reference-assets-modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(700px, calc(100vw - 32px));
  height: min(550px, calc(100dvh - 32px));
  padding: 24px;
  color: #f2f4f3;
  border: 0;
  background: #1c1c1c;
}

.reference-assets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reference-assets-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 16px;
}

.reference-assets-head h3 svg {
  width: 18px;
  height: 18px;
}

.reference-assets-head .modal-close {
  position: static;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
}

.reference-assets-content {
  min-height: 0;
  padding: 20px 0;
  overflow: auto;
}

.reference-assets-empty {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  height: 100%;
  color: rgba(250, 251, 255, 0.38);
  font-size: 13px;
}

.reference-assets-empty svg {
  width: 44px;
  height: 44px;
  stroke-width: 1.2;
}

.reference-assets-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.reference-asset-item {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: rgba(250, 251, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(250, 251, 255, 0.05);
}

.reference-asset-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-asset-check {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #0d1512;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 160ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reference-asset-check svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}

.reference-asset-item.selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.reference-asset-item.selected .reference-asset-check {
  opacity: 1;
  transform: scale(1);
}

.reference-assets-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.reference-assets-actions > button {
  width: 120px;
  min-height: 36px;
}

.reference-assets-actions .secondary-button {
  color: #f0f3f1;
  border: 0;
  background: rgba(250, 251, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(250, 251, 255, 0.04);
}

.reference-assets-actions .action-button {
  color: #171918;
  border: 0;
  background: #f2f4f3;
}

.reference-assets-actions .action-button:disabled {
  color: rgba(250, 251, 255, 0.28);
  background: rgba(250, 251, 255, 0.06);
}

@media (max-width: 720px) {
  .reference-assets-modal-card {
    width: calc(100vw - 20px);
    height: min(620px, calc(100dvh - 20px));
    padding: 18px;
  }

  .reference-assets-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .reference-assets-actions > button {
    flex: 1 1 0;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-reference-uploader,
  .image-reference-thumbnail .attachment-remove,
  .image-reference-add,
  .reference-asset-check {
    transition: none !important;
    transform: none !important;
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 10px;
  }

  .brand {
    justify-content: center;
    padding-inline: 0;
  }

  .brand > div:last-child,
  .nav-item span,
  .profile-entry span:last-child {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .account-card,
  .account-card.signed-in {
    padding: 5px;
    border-color: transparent;
    background: transparent;
  }

  .guest-actions {
    grid-template-columns: 1fr;
  }

  .guest-actions button {
    min-width: 0;
    padding: 0;
    font-size: 10px;
  }

  .panel-grid.generation-mode,
  .panel-grid.result-first {
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    grid-template-areas: "controls results";
    gap: 1px;
    overflow: hidden;
  }

  .home-assistant-copy h3 {
    font-size: 34px;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    min-height: 100dvh;
    padding-bottom: calc(62px + env(safe-area-inset-bottom));
    background: var(--bg);
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 35;
    display: block;
    width: 100%;
    height: calc(62px + env(safe-area-inset-bottom));
    padding: 0 0 env(safe-area-inset-bottom);
    border-top: 1px solid #29312e;
    border-right: 0;
    background: rgba(16, 20, 18, 0.97);
    box-shadow: 0 -12px 30px rgba(3, 7, 5, 0.35);
  }

  .brand,
  .account-panel {
    display: none;
  }

  .module-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    height: 62px;
  }

  .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 62px;
    padding: 4px 0;
    color: #7f8a86;
    border: 0;
    border-radius: 0;
    font-size: 10px;
  }

  .nav-item span {
    display: block;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-item.active {
    color: var(--accent);
    background: transparent;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .workspace {
    height: auto;
    min-height: 100dvh;
    padding: calc(54px + env(safe-area-inset-top)) 0 0;
    overflow: visible;
    background: var(--bg);
  }

  .topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 30;
    min-height: calc(54px + env(safe-area-inset-top));
    height: calc(54px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0 14px;
    border-bottom: 1px solid #29312e;
    background: rgba(13, 16, 15, 0.96);
    backdrop-filter: blur(14px);
  }

  .topbar h2 {
    max-width: calc(100vw - 150px);
    color: #edf3f0;
    font-size: 17px;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .wechat-contact,
  .referral-entry-button,
  .status-cluster {
    display: none;
  }

  .topbar-credit-button {
    min-width: 68px;
    height: 32px;
    padding: 0 9px;
    font-size: 11px;
  }

  .panel-grid,
  .panel-grid.chat-only,
  .panel-grid.generation-mode,
  .panel-grid.result-first {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "controls" "results";
    gap: 1px;
    min-height: calc(100dvh - 54px - 62px);
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .creator-surface,
  .result-rail,
  .panel-grid.generation-mode .creator-surface,
  .panel-grid.result-first .creator-surface {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    border-radius: 0;
    overflow: visible;
  }

  .panel-grid.chat-only .creator-surface {
    height: calc(100dvh - 54px - 62px);
  }

  .panel-grid.chat-only .result-rail {
    display: none;
  }

  .panel,
  .panel-grid.generation-mode .panel.active,
  .panel-grid.result-first .panel.active {
    height: auto;
    min-height: 0;
    padding: 14px;
    overflow: visible;
  }

  .home-panel {
    padding: 0;
  }

  .home-stage {
    grid-template-rows: auto auto;
    height: auto;
    padding: 12px;
  }

  .home-assistant-feature {
    grid-template-columns: minmax(0, 1fr) 126px;
    min-height: 270px;
  }

  .home-assistant-copy {
    padding: 24px 0 24px 22px;
  }

  .home-kinetic-title {
    width: min(100%, 430px);
    height: 108px;
  }

  .home-kinetic-fallback {
    font-size: clamp(25px, 7vw, 34px);
  }

  .home-assistant-copy p {
    font-size: 12px;
  }

  .home-brand-visual img {
    width: 100%;
  }

  .home-launch-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, auto);
  }

  .home-launch-card {
    min-height: 88px;
    padding: 14px;
  }

  .workflow-page {
    padding: 12px 0;
  }

  .workflow-row {
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    padding-inline: 4px;
  }

  .workflow-row-meta {
    display: none;
  }

  .my-quick-actions {
    grid-template-columns: 1fr;
  }

  .generation-tabs {
    position: sticky;
    top: calc(54px + env(safe-area-inset-top));
    z-index: 20;
    margin: 0;
    padding: 6px 10px;
    border-width: 0 0 1px;
    border-radius: 0;
    background: rgba(15, 19, 17, 0.97);
  }

  .generation-tabs button {
    min-height: 36px;
  }

  .panel-grid.result-first .result-preview,
  .panel-grid.result-first .empty-state {
    min-height: 300px;
  }

  .generation-action-bar {
    right: 8px;
    left: 8px;
    bottom: calc(62px + env(safe-area-inset-bottom));
    border: 1px solid #303936;
    border-radius: 8px;
    background: rgba(18, 22, 20, 0.98);
    box-shadow: 0 -10px 28px rgba(3, 7, 5, 0.35);
  }

  .ecommerce-modal-card {
    width: 100%;
    min-height: calc(100dvh - 20px);
    max-height: calc(100dvh - 20px);
  }

  .ecommerce-actions {
    grid-template-columns: 1fr 1fr;
    margin-inline: -18px;
    padding: 12px 18px 0;
    background: #171c1a;
  }

  .ecommerce-actions p {
    grid-column: 1 / -1;
  }
}

/* Qianwen-inspired home composition, rebuilt for Luming controls and branding. */
.panel-grid.home-only,
.panel-grid.home-only .creator-surface {
  border-color: transparent;
  background: #0d100f;
}

.home-stage {
  /* Keep the launch cards anchored to the lower edge, like Qianwen's home view. */
  grid-template-rows: minmax(0, 1fr) 320px;
  gap: 16px;
  width: min(100%, 1200px);
  padding: 8px 18px 24px;
}

.home-slogan-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
}

.home-slogan-copy {
  display: grid;
  place-items: center;
  width: min(100%, 1060px);
}

.home-slogan-stage .home-kinetic-title {
  width: 100%;
  height: clamp(190px, 23vh, 280px);
  margin: 0;
}

.home-slogan-stage .home-kinetic-fallback {
  margin: 0 auto;
  color: rgba(238, 244, 241, 0.72);
  font-family: "MaoKenWangFengYaSong", "Microsoft YaHei", sans-serif;
  font-size: clamp(42px, 5.4vw, 72px);
  font-weight: 560;
  text-align: center;
}

.home-slogan-stage .home-kinetic-fallback span {
  margin-left: 28%;
}

.home-launch-grid {
  grid-template-columns: minmax(280px, 1.38fr) repeat(2, minmax(210px, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 14px;
  height: 320px;
}

.home-glow-card {
  --pointer-x: 50%;
  --pointer-y: 50%;
  --cursor-angle: 0deg;
  --edge-proximity: 0;
  --edge-sensitivity: 30;
  --glow-intensity: 1;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.065);
  box-shadow: none;
  transform: translateZ(0);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.home-glow-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 1.5px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--cursor-angle),
    #ffffff 0%,
    #f4bc72 4%,
    #38bdf8 8%,
    transparent 12%,
    transparent 88%,
    #38bdf8 92%,
    #f4bc72 96%,
    #ffffff 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: calc(var(--glow-intensity) * (var(--edge-proximity) - var(--edge-sensitivity)) / (100 - var(--edge-sensitivity)));
  pointer-events: none;
  transition: opacity 250ms ease-out;
}

.home-glow-card::after {
  display: none;
}

.home-glow-card:not(:hover):not(.sweep-active)::before {
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.home-glow-card > * {
  position: relative;
  z-index: 1;
}

.home-glow-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.15);
  transform: translateZ(0);
}

.home-glow-card:active {
  transform: scale(0.985);
}

.home-assistant-feature {
  grid-column: 1;
  grid-row: 1 / 3;
  display: block;
  min-height: 0;
  padding: 0;
  color: #eef4f1;
  text-align: left;
  cursor: pointer;
}

.home-assistant-feature .home-assistant-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  height: 100%;
  padding: 26px;
}

.home-assistant-copy .home-kicker {
  margin-bottom: 12px;
  color: #eef4f1;
  font-size: 21px;
  font-weight: 760;
}

.home-assistant-copy > strong {
  max-width: 290px;
  color: #d6dfdb;
  font-size: 14px;
  font-weight: 560;
}

.home-assistant-copy > small {
  max-width: 300px;
  margin-top: 8px;
  color: #8f9a96;
  font-size: 12px;
  line-height: 1.6;
}

.home-assistant-feature .home-primary-action {
  margin-top: auto;
  color: #eef4f1;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  transition: background-color 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.home-assistant-feature:hover .home-primary-action {
  border-color: rgba(98, 219, 199, 0.34);
  background: rgba(53, 199, 176, 0.18);
  transform: translateY(-1px);
}

.home-assistant-feature .home-brand-visual {
  position: absolute;
  right: -18px;
  bottom: -24px;
  z-index: 0;
  display: block;
  width: min(72%, 330px);
  height: min(82%, 270px);
  opacity: 0.48;
  pointer-events: none;
}

.home-assistant-feature .home-brand-visual::before {
  display: none;
}

.home-assistant-feature .home-brand-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: right bottom;
  filter: saturate(0.72) brightness(0.72);
  transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1), filter 260ms ease, opacity 260ms ease;
}

.home-assistant-feature:hover .home-brand-visual img {
  opacity: 0.9;
  filter: saturate(0.92) brightness(0.9);
  transform: translate3d(-5px, -4px, 0) scale(1.035);
}

.home-launch-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  min-height: 0;
  padding: 20px 22px;
}

.home-launch-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 10px;
  color: #dce7e3;
  border: 0;
  background: transparent;
  transition: color 200ms ease, transform 340ms cubic-bezier(0.16, 1, 0.3, 1);
}

.home-glow-card:hover .home-launch-icon {
  color: inherit;
  transform: none;
}

.home-launch-copy {
  gap: 4px;
}

.home-launch-copy strong {
  color: #f0f5f3;
  font-size: 18px;
  line-height: 1.25;
}

.home-launch-copy small {
  color: #99a39f;
  font-size: 12px;
}

.home-launch-arrow {
  position: absolute;
  top: 20px;
  right: 20px;
  color: rgba(238, 244, 241, 0.36);
  transition: color 200ms ease, transform 340ms cubic-bezier(0.16, 1, 0.3, 1);
}

.home-glow-card:hover .home-launch-arrow {
  color: inherit;
  transform: none;
}

body:has(#home-panel.active) .topbar > div:first-child {
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 1121px) {
  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .sidebar {
    gap: 20px;
    padding: 16px 10px;
  }

  .brand {
    justify-content: center;
    padding: 4px 0 12px;
  }

  .brand > div:last-child,
  .profile-entry span:last-child,
  .account-card:not(.signed-in) .account-head {
    display: none;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .module-nav {
    gap: 9px;
  }

  .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    min-height: 58px;
    padding: 6px 2px;
    color: rgba(238, 244, 241, 0.48);
    border: 0;
    background: transparent;
    font-size: 10px;
    font-weight: 560;
  }

  .nav-item:hover {
    color: rgba(238, 244, 241, 0.78);
    border: 0;
    background: transparent;
    transform: none;
  }

  .nav-item.active {
    color: #eef4f1;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), color 180ms ease;
  }

  .nav-item:hover svg {
    transform: translateY(-1px) scale(1.06);
  }

  .account-card,
  .account-card.signed-in {
    padding: 4px;
    border-color: transparent;
    background: transparent;
  }

  .profile-entry,
  .account-card.signed-in .profile-entry {
    display: grid;
    grid-template-columns: 42px;
    justify-content: center;
    padding: 4px;
    border-color: transparent;
    background: transparent;
  }

  .guest-actions {
    display: grid;
    gap: 6px;
  }

  .guest-actions button {
    min-width: 0;
    padding: 0 4px;
    font-size: 10px;
  }

  .workspace {
    padding: 10px 20px 20px;
  }
}

@media (max-width: 820px) {
  .home-stage {
    grid-template-rows: 210px auto;
    gap: 12px;
    padding: 4px 10px 18px;
  }

  .home-slogan-stage {
    min-height: 210px;
  }

  .home-slogan-stage .home-kinetic-title {
    width: 100%;
    height: 150px;
    margin: 0;
  }

  .home-launch-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    gap: 10px;
  }

  .home-assistant-feature {
    grid-column: auto;
    grid-row: auto;
    min-height: 230px;
  }

  .home-assistant-feature .home-assistant-copy {
    padding: 22px;
  }

  .home-launch-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 12px;
    min-height: 88px;
    padding: 14px;
  }

  .home-launch-icon {
    width: 42px;
    height: 42px;
    margin: 0;
    border: 1px solid rgba(53, 199, 176, 0.22);
    background: rgba(53, 199, 176, 0.07);
  }

  .home-launch-arrow {
    position: static;
  }

  body:has(#home-panel.active) .topbar > div:first-child {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-glow-card,
  .home-glow-card *,
  .nav-item svg {
    transform: none !important;
  }

  .home-glow-card::before,
  .home-glow-card::after {
    display: none;
  }
}

@media (max-width: 520px) {
  .home-assistant-feature {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-brand-visual {
    position: absolute;
    right: -24px;
    bottom: -18px;
    width: 154px;
    height: 154px;
    opacity: 0.28;
  }

  .home-assistant-copy {
    position: relative;
    z-index: 1;
    padding: 24px 20px;
  }

  .home-assistant-copy p {
    max-width: 290px;
  }

  .home-kinetic-title {
    width: calc(100% + 12px);
    height: 98px;
    margin-left: -6px;
  }

  .home-launch-card {
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    gap: 11px;
  }

  .home-launch-icon {
    width: 42px;
    height: 42px;
  }

  .generation-tabs button {
    gap: 4px;
    padding-inline: 4px;
    font-size: 11px;
  }

  .my-quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .my-quick-actions button {
    gap: 4px;
    padding-inline: 5px;
    font-size: 10px;
  }
}

/* Account and recharge flow: reduce scrolling and make the next action obvious. */
.profile-modal-card,
.recharge-modal-card {
  width: min(680px, calc(100vw - 28px));
}

.profile-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: var(--product-radius);
  background: #f3f6f5;
}

.profile-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  color: #66716e;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.profile-tabs button.active {
  color: var(--product-ink);
  background: #fff;
  box-shadow: 0 3px 12px rgba(30, 47, 43, 0.08);
}

.profile-tabs svg,
.balance-account button svg {
  width: 16px;
  height: 16px;
}

#profile-avatar {
  padding: 0;
  border: 0;
  background: #fff;
  box-shadow: none;
}

#profile-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-pane {
  display: grid;
  gap: 14px;
}

.profile-pane[hidden] {
  display: none;
}

.profile-pane .balance-account {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.profile-pane .balance-account button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-inline: 13px;
}

.profile-pane .balance-account strong {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.profile-pane .balance-account strong > span {
  display: inline;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.profile-subsection {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.profile-subsection-head h4,
.profile-subsection-head p {
  margin: 0;
}

.profile-subsection-head h4 {
  font-size: 14px;
}

.profile-subsection-head p,
.profile-record-note {
  margin-top: 3px;
  color: var(--product-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.recharge-modal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding-right: 42px;
}

.recharge-modal-head h3,
.recharge-modal-head p {
  margin: 0;
}

.recharge-modal-head p {
  margin-top: 4px;
  color: var(--product-muted);
  font-size: 12px;
  font-weight: 700;
}

.recharge-modal-head > strong {
  color: #245d55;
  font-size: 14px;
  white-space: nowrap;
}

.recharge-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recharge-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #89928f;
  font-size: 12px;
}

.recharge-steps li > span,
.recharge-step-head > span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid #d9e1df;
  border-radius: 50%;
  background: #fff;
  font-size: 11px;
  font-weight: 900;
}

.recharge-steps li.active,
.recharge-steps li.completed {
  color: #245d55;
}

.recharge-steps li.active > span,
.recharge-steps li.completed > span,
.recharge-step-head > span {
  color: #fff;
  border-color: var(--product-accent);
  background: var(--product-accent);
}

.recharge-step-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e2e8e6;
  border-radius: var(--product-radius);
  background: #fafbfb;
}

.recharge-step-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.recharge-step-head h4,
.recharge-step-head p {
  margin: 0;
}

.recharge-step-head h4 {
  font-size: 14px;
}

.recharge-step-head p {
  margin-top: 3px;
  color: var(--product-muted);
  font-size: 12px;
  font-weight: 700;
}

.recharge-step-section.card-redeem-card {
  background: #fafbfb;
}

.recharge-step-section .card-redeem-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.recharge-step-section .secondary-button,
.recharge-step-section .action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding-inline: 13px;
}

.recharge-status-message {
  padding: 9px 10px;
  border-radius: 6px;
  background: #f3f6f5;
  color: #596562;
  font-size: 12px;
  font-weight: 800;
}

.recharge-status-message.success {
  color: #176b5f;
  background: #e7f4f1;
}

.recharge-status-message.error {
  color: #9a4f08;
  background: #fff7ed;
}

.recharge-pricing-card {
  padding: 0;
  overflow: hidden;
}

.recharge-pricing-card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 800;
}

.recharge-pricing-card > summary::-webkit-details-marker {
  display: none;
}

.recharge-pricing-card > summary svg {
  width: 16px;
  height: 16px;
  transition: transform 160ms ease;
}

.recharge-pricing-card[open] > summary svg {
  transform: rotate(180deg);
}

.recharge-pricing-card .pricing-table {
  margin: 0 10px 10px;
}

.task-log-cost {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  color: #245d55;
  background: var(--product-accent-soft);
}

.task-log-cost svg {
  color: var(--product-accent);
}

.task-log-card.status-failed {
  grid-template-rows: auto 190px auto auto auto;
  height: auto;
  min-height: 378px;
}

.task-log-card.status-failed .task-log-preview {
  color: #8a4b16;
  background: #fff8ef;
}

.task-failure-detail {
  display: grid;
  gap: 7px;
  padding: 10px 11px;
  border-radius: 7px;
  background: #fff8ef;
}

.task-failure-detail strong {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: #8a4b16;
  font-size: 12px;
  line-height: 1.45;
}

.task-failure-detail strong svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

.task-failure-detail > span {
  color: #69736f;
  font-size: 11px;
  font-weight: 800;
}

.task-failure-detail > span.refunded {
  color: #176b5f;
}

.task-failure-detail > span.checking {
  color: #9a4f08;
}

.retry-task-log-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 11px;
  color: #245d55;
  border-color: #c9e3de;
  background: var(--product-accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.retry-task-log-result svg {
  width: 15px;
  height: 15px;
}

.task-retry-confirm {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid #d8e5e2;
  border-radius: 7px;
  background: #f7faf9;
}

.task-retry-confirm strong,
.task-retry-confirm span {
  display: block;
}

.task-retry-confirm strong {
  color: #26312e;
  font-size: 12px;
}

.task-retry-confirm span {
  margin-top: 3px;
  color: #69736f;
  font-size: 11px;
  font-weight: 700;
}

.task-retry-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.task-retry-confirm-actions button {
  flex: 1 1 0;
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .modal-backdrop {
    padding: 10px;
  }

  .profile-modal-card,
  .recharge-modal-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 18px 14px;
  }

  .usage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-pane .balance-account {
    grid-template-columns: minmax(0, 1fr) repeat(2, auto);
  }

  .profile-pane .balance-account button span {
    display: none;
  }

  .recharge-steps li {
    display: grid;
    justify-items: center;
    gap: 5px;
    text-align: center;
  }

  .recharge-steps li strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .recharge-step-section .card-redeem-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .recharge-step-section .card-redeem-row .action-button {
    grid-column: 1 / -1;
  }

  .task-retry-confirm-actions button {
    min-height: 36px;
  }
}

/* Taste-skill audit pass: result-first, restrained, consistent. */
:root {
  --product-accent: #138f80;
  --product-accent-soft: #e7f4f1;
  --product-ink: #171b1a;
  --product-muted: #6c7774;
  --product-canvas: #f4f6f5;
  --product-radius: 8px;
}

.eyebrow {
  display: none;
}

.topbar {
  min-height: 62px;
}

.topbar h2 {
  color: var(--product-ink);
  font-size: 26px;
  line-height: 1.15;
}

.nav-item,
.wechat-contact-button,
.referral-entry-button,
.topbar-credit-button,
.status-cluster,
.icon-button,
.action-button,
.secondary-button,
.field-block textarea,
.control-grid select,
.control-grid input,
.reference-block,
.cost-preview {
  border-radius: var(--product-radius);
}

.nav-item.active {
  box-shadow: none;
}

button:active,
.icon-button:active,
.action-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.task-log-toolbar { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.task-log-toolbar .task-log-sort { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; }
.task-log-toolbar select { min-height: 32px; padding: 4px 28px 4px 10px; }
.task-log-page-status { color: var(--muted-text, #69736f); font-size: 12px; }
.task-log-model { display: flex; align-items: center; gap: 6px; color: var(--muted-text, #69736f); font-size: 12px; }
.task-log-model svg { width: 14px; height: 14px; }
.task-log-details { margin-top: 10px; font-size: 12px; }
.task-log-details summary { cursor: pointer; color: var(--muted-text, #69736f); }
.task-log-prompt { margin: 8px 0; white-space: pre-wrap; word-break: break-word; }
.task-log-more-menu { position: relative; }
.task-log-more-popover { display: none !important; }
.task-log-menu-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.task-log-menu-item:hover { background: rgba(20, 40, 34, .07); }

/* Legacy inline actions stay hidden; deletion is handled by the compact icon. */
.task-log-card > .result-actions > .retry-task-log-result,
.task-log-card > .result-actions > .delete-task-log-result { display: none; }

/* Keep task cards compact after details/actions became collapsible. */
.task-log-card,
.task-log-card.status-failed {
  grid-template-rows: auto auto minmax(110px, 1fr) auto auto;
  height: 378px;
  min-height: 378px;
}
.task-log-card .task-log-details { min-height: 0; overflow: auto; }
.task-log-card .result-actions { min-height: 36px; }

/* The task-log page sits directly on the global canvas. */
.panel-grid.task-log-only {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.panel-grid.task-log-only .creator-surface,
.panel-grid.task-log-only #tasklog-panel,
.panel-grid.task-log-only .task-log-page {
  background: transparent;
  box-shadow: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(19, 143, 128, 0.2);
  outline-offset: 2px;
}

.panel-grid.result-first {
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 24px;
}

.panel-grid.result-first .rail-header {
  min-height: 54px;
  padding: 8px 0 10px;
}

.panel-grid.result-first .rail-header h3 {
  color: var(--product-ink);
  font-size: 17px;
}

.panel-grid.result-first .result-rail {
  position: relative;
}

.panel-grid.result-first .rail-header {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: block;
  min-height: 0;
  padding: 0;
}

.panel-grid.result-first .rail-header > div {
  display: none;
}

.panel-grid.result-first .rail-header #clear-results {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 14px rgba(30, 47, 43, 0.08);
}

.panel-grid.result-first .result-list {
  height: auto;
  padding: 0 0 8px;
}

.result-tool-dock {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 10px 4px 0;
  background: #fff;
}

.result-tool-dock[hidden] {
  display: none;
}

.result-tool-dock > strong {
  flex: 0 0 auto;
  color: #3d4845;
  font-size: 13px;
}

.result-tool-list {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
}

.result-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  color: #245d55;
  border: 1px solid #c9e3de;
  border-radius: var(--product-radius);
  background: var(--product-accent-soft);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.result-tool-button:hover {
  color: #fff;
  border-color: var(--product-accent);
  background: var(--product-accent);
}

.result-tool-button:disabled {
  color: #7c8885;
  border-color: #dfe6e4;
  background: #f4f6f5;
  cursor: not-allowed;
  opacity: 0.72;
}

.result-tool-button:disabled:hover {
  color: #7c8885;
  border-color: #dfe6e4;
  background: #f4f6f5;
}

.result-tool-button svg {
  width: 16px;
  height: 16px;
}

.result-tool-button small {
  color: #7c8885;
  font-size: 10px;
  font-weight: 700;
}

.task-log-head {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
}

.panel-grid.task-log-only .creator-surface,
.panel-grid.task-log-only #tasklog-panel,
.panel-grid.task-log-only .task-log-page {
  width: 100%;
  max-width: none;
}

.panel-grid.task-log-only .task-log-page {
  margin-inline: 0;
}

.panel-grid.task-log-only .task-log-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  width: 100%;
}

.panel-grid.task-log-only .task-log-card {
  width: 100%;
}

.panel-grid.result-first .result-card {
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
}

.panel-grid.result-first .result-meta,
.panel-grid.result-first .result-detail {
  display: none;
}

.panel-grid.result-first .result-preview {
  min-height: 460px;
  padding: 24px;
  border-radius: var(--product-radius);
  background:
    linear-gradient(45deg, rgba(23, 27, 26, 0.025) 25%, transparent 25%, transparent 75%, rgba(23, 27, 26, 0.025) 75%),
    linear-gradient(45deg, rgba(23, 27, 26, 0.025) 25%, transparent 25%, transparent 75%, rgba(23, 27, 26, 0.025) 75%),
    var(--product-canvas);
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
}

.panel-grid.result-first .result-preview img,
.panel-grid.result-first .result-preview video {
  border-radius: 6px;
  box-shadow: 0 12px 34px rgba(30, 47, 43, 0.1);
}

.panel-grid.result-first .empty-state {
  min-height: 460px;
  color: var(--product-muted);
  border-radius: var(--product-radius);
  background: var(--product-canvas);
}

.panel-grid.result-first .empty-state svg {
  color: var(--product-accent);
}

.current-result-actions {
  justify-content: flex-start;
  padding-top: 12px;
}

.current-result-actions .secondary-button {
  min-height: 38px;
  padding: 0 14px;
  color: #245d55;
  background: var(--product-accent-soft);
}

.current-result-actions .secondary-button:hover {
  color: #fff;
  background: var(--product-accent);
}

.panel-grid.result-first .creator-surface {
  padding-left: 4px;
}

.panel-grid.result-first .panel {
  padding: 8px 0 20px;
}

.panel-grid.result-first .creation-form {
  gap: 12px;
}

.panel-grid.result-first .field-block label,
.panel-grid.result-first .control-grid label > span,
.panel-grid.result-first .reference-block > span {
  color: #3d4845;
  font-weight: 800;
}

.panel-grid.result-first .field-block textarea,
.panel-grid.result-first .control-grid select,
.panel-grid.result-first .control-grid input,
.panel-grid.result-first .reference-block {
  border-color: #dbe2e0;
  background: #fafbfb;
}

.panel-grid.result-first .field-block textarea:focus,
.panel-grid.result-first .control-grid select:focus,
.panel-grid.result-first .control-grid input:focus {
  border-color: var(--product-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(19, 143, 128, 0.1);
}

.panel-grid.result-first .cost-preview {
  color: #245d55;
  border-color: transparent;
  background: var(--product-accent-soft);
}

.panel-grid.result-first .creation-form > .action-button[type="submit"] {
  min-height: 48px;
  color: #fff;
  border-color: var(--product-ink);
  background: var(--product-ink);
}

.panel-grid.result-first .creation-form > .action-button[type="submit"]:hover {
  border-color: var(--product-accent);
  background: var(--product-accent);
}

@media (max-width: 1120px) {
  .panel-grid.result-first {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "controls"
      "results";
    gap: 16px;
    width: 100%;
    overflow: visible;
  }

  .panel-grid.result-first .creator-surface,
  .panel-grid.result-first .result-rail {
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: none;
  }

  .panel-grid.result-first .result-preview,
  .panel-grid.result-first .empty-state {
    min-height: 360px;
  }
}

@media (max-width: 720px) {
  .topbar h2 {
    font-size: 21px;
  }

  .panel-grid.result-first .creator-surface,
  .panel-grid.result-first .panel {
    height: auto;
    min-height: 0;
  }

  .panel-grid.result-first .panel {
    overflow: visible;
  }

  .panel-grid.result-first .rail-header {
    padding-inline: 4px;
  }

  .panel-grid.result-first .result-preview {
    min-height: 300px;
    padding: 12px;
  }

  .panel-grid.result-first .empty-state {
    min-height: 300px;
  }

  .current-result-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .current-result-actions .secondary-button {
    width: 100%;
    padding-inline: 8px;
  }
}

/* Desktop polish: keep wide screens focused and proportionate. */
@media (min-width: 1121px) {
  .workspace {
    padding: 18px 32px 24px;
  }

  .workspace > .topbar,
  .workspace > .panel-grid {
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }

  .panel-grid.result-first {
    grid-template-columns: minmax(0, 1fr) clamp(360px, 30vw, 520px);
    gap: 28px;
  }

  .panel-grid.result-first .creator-surface,
  .panel-grid.result-first .result-rail {
    height: 100%;
    max-height: none;
    align-self: stretch;
  }

  .panel-grid.result-first .result-list {
    padding: 0;
  }

  .panel-grid.result-first .empty-state {
    width: 100%;
    max-width: none;
  }

  .panel-grid.result-first .creator-surface {
    padding-left: 0;
  }

  .panel-grid.result-first #image-panel,
  .panel-grid.result-first #video-panel {
    width: 100%;
    padding: 8px 0 20px;
  }

  .panel-grid.result-first #image-panel .creation-form,
  .panel-grid.result-first #video-panel .creation-form {
    width: 100%;
    max-width: none;
    margin: 0;
  }
}

/* Generation forms: keep the primary action visible and advanced controls optional. */
.advanced-settings {
  border: 1px solid #dbe2e0;
  border-radius: var(--product-radius);
  background: #fafbfb;
}

.advanced-settings > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 12px;
  color: #3d4845;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.advanced-settings > summary::-webkit-details-marker {
  display: none;
}

.advanced-settings > summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.advanced-settings > summary svg {
  width: 16px;
  height: 16px;
}

.advanced-settings > summary > svg {
  color: #7c8885;
  transition: transform 160ms ease;
}

.advanced-settings[open] > summary > svg {
  transform: rotate(180deg);
}

.advanced-settings-body {
  display: grid;
  gap: 10px;
  padding: 0 10px 10px;
}

.generation-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: minmax(130px, auto) minmax(160px, 1fr);
  gap: 10px;
  padding: 10px 0 0;
  background: #fff;
}

.generation-action-bar::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 14px;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.generation-action-bar .cost-preview,
.generation-action-bar > .action-button[type="submit"] {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin: 0;
}

.generation-action-bar > .action-button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.creation-model-switch {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.creation-model-label {
  color: #66716e;
  font-size: 12px;
  font-weight: 800;
}

.creation-model-options {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid #e1e7e5;
  border-radius: 8px;
  background: #f6f8f7;
  scrollbar-width: none;
}

.creation-model-options::-webkit-scrollbar {
  display: none;
}

.creation-model-options button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  color: #69736f;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.creation-model-options button:hover {
  color: #26312e;
  background: #edf2f0;
}

.creation-model-options button.active {
  color: #173f39;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(28, 47, 42, 0.12);
}

.creation-model-hint {
  grid-column: 2;
  color: #7a8581;
  font-size: 11px;
  font-weight: 700;
}

.image-control-grid > label[hidden],
.image-reference-block[hidden],
.video-reference-block[hidden],
.creation-form label[hidden],
.creation-form details[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .creation-model-switch {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 12px;
  }

  .creation-model-options {
    width: 100%;
  }

  .creation-model-options button {
    flex: 1 0 auto;
    min-height: 36px;
  }

  .creation-model-hint {
    grid-column: 1;
  }

  .generation-action-bar {
    position: static;
    right: 10px;
    left: 10px;
    grid-template-columns: minmax(112px, 0.8fr) minmax(150px, 1.2fr);
    bottom: calc(62px + env(safe-area-inset-bottom));
    padding: 10px;
    border-top: 1px solid #e8edeb;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -10px 24px rgba(30, 47, 43, 0.08);
  }

  #image-panel.active,
  #video-panel.active,
  #music-panel.active {
    padding-bottom: 88px;
  }

  .generation-action-bar .cost-preview {
    padding-inline: 8px;
  }

  .generation-action-bar .cost-preview span:first-child {
    display: none;
  }

}

/* Final cascade lock for the Luming dark workspace. */
:root {
  color-scheme: dark;
  --product-accent: #35c7b0;
  --product-accent-soft: rgba(53, 199, 176, 0.13);
  --product-ink: #eef4f1;
  --product-muted: #8f9a96;
  --product-canvas: #111513;
  --bg: #0d100f;
  --ink: #eef4f1;
  --muted: #8f9a96;
  --line: #29312e;
  --surface: #151917;
  --surface-soft: #1b211e;
  --accent: #35c7b0;
  --accent-strong: #62dbc7;
}

html,
body,
.app-shell,
.workspace {
  background: #0d100f;
}

.sidebar,
.topbar,
.creator-surface,
.result-rail,
.result-list,
.rail-header,
.generation-action-bar {
  color: #eef4f1;
  background: #121614;
}

.sidebar {
  border-right-color: #232a27;
}

.nav-item:hover {
  color: #e9efec;
  border-color: #29322e;
  background: #181d1b;
}

.nav-item.active {
  color: #0f1714;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: none;
}

.topbar {
  min-height: 64px;
}

.topbar h2,
.rail-header h3,
.panel-grid.result-first .rail-header h3 {
  color: #edf3f0;
}

.panel-grid,
.panel-grid.chat-only {
  gap: 1px;
  border-color: #252d2a;
  background: #252d2a;
}

.panel-grid.home-only,
.panel-grid.workflow-only,
.panel-grid.task-log-only {
  grid-template-columns: minmax(0, 1fr);
}

.panel-grid.home-only .result-rail,
.panel-grid.workflow-only .result-rail,
.panel-grid.task-log-only .result-rail {
  display: none;
}

.panel-grid.generation-mode,
.panel-grid.result-first {
  grid-template-columns: minmax(350px, 410px) minmax(0, 1fr);
  grid-template-areas: "controls results";
  gap: 1px;
}

.panel-grid.generation-mode .creator-surface,
.panel-grid.result-first .creator-surface {
  grid-area: controls;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.panel-grid.generation-mode .result-rail,
.panel-grid.result-first .result-rail {
  grid-area: results;
}

.panel-grid.generation-mode .panel.active,
.panel-grid.result-first .panel.active {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  padding: 14px 16px 18px;
}

.panel-grid.generation-mode .generation-tabs {
  display: grid;
}

.field-block textarea,
.control-grid select,
.control-grid input,
.reference-block,
.advanced-settings,
.creation-model-options,
.composer,
.tool-switch,
.cost-preview,
.panel-grid.result-first .field-block textarea,
.panel-grid.result-first .control-grid select,
.panel-grid.result-first .control-grid input,
.panel-grid.result-first .reference-block {
  color: #e7eeeb;
  border-color: #303936;
  background: #171c1a;
}

.field-block label,
.control-grid label > span,
.reference-block > span,
.panel-grid.result-first .field-block label,
.panel-grid.result-first .control-grid label > span,
.panel-grid.result-first .reference-block > span,
.creation-model-label,
.advanced-settings > summary {
  color: #aab4b0;
}

.creation-model-options {
  background: #0f1311;
}

.creation-model-options button.active,
.tool-switch button.active {
  color: #0d1512;
  background: var(--accent);
  box-shadow: none;
}

.panel-grid.result-first .cost-preview,
.generation-action-bar .cost-preview {
  color: #9fe6da;
  border-color: rgba(53, 199, 176, 0.18);
  background: rgba(53, 199, 176, 0.1);
}

.generation-action-bar::before {
  background: linear-gradient(to top, #121614, rgba(18, 22, 20, 0));
}

.panel-grid.result-first .creation-form > .action-button[type="submit"],
.creation-form > .action-button[type="submit"],
.composer .icon-button.primary {
  color: #0c1411;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: none;
}

.panel-grid.result-first .result-preview,
.panel-grid.result-first .empty-state,
.empty-state {
  color: #87928d;
  border-color: #29312e;
  background-color: #111513;
}

.result-tool-dock,
.task-log-head,
.task-log-summary-card,
.task-log-card {
  color: #aab4b0;
  border-color: #29312e;
  background: #151a18;
}

.modal-card,
.wechat-contact-popover,
.profile-modal-card,
.ledger-modal-card,
.recharge-modal-card,
.referral-modal-card,
.ecommerce-actions {
  color: #dfe7e3;
  border-color: #303936;
  background: #171c1a;
}

.profile-tabs,
.recharge-step-section,
.recharge-status-message,
.auth-help-box,
.ecommerce-step-pane,
.ecommerce-option-section,
.ecommerce-plan-summary,
.ecommerce-plan-card,
.ecommerce-confirm-grid div {
  color: #cbd4d0;
  border-color: #303936;
  background: #111513;
}

.ecommerce-option-card.active strong,
.ecommerce-option-card.active span {
  color: #0d1512;
}

.modal-card input,
.modal-card textarea,
.modal-card select,
.ecommerce-form-grid input,
.ecommerce-form-grid select,
.ecommerce-form-grid textarea,
.ecommerce-plan-summary input,
.ecommerce-plan-summary textarea,
.ecommerce-plan-card input,
.ecommerce-plan-card textarea {
  color: #e5ece9;
  border-color: #303936;
  background: #0f1311;
}

@media (max-width: 820px) {
  html,
  body,
  .app-shell,
  .workspace {
    background: #0d100f;
  }

  .workspace {
    padding: calc(54px + env(safe-area-inset-top)) 0 0;
  }

  .topbar {
    min-height: calc(54px + env(safe-area-inset-top));
    background: rgba(13, 16, 15, 0.96);
  }

  .sidebar {
    background: rgba(16, 20, 18, 0.97);
  }

  .nav-item.active {
    color: var(--accent);
    border-color: transparent;
    background: transparent;
  }

  .panel-grid,
  .panel-grid.chat-only,
  .panel-grid.generation-mode,
  .panel-grid.result-first {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "controls" "results";
    gap: 1px;
    border: 0;
    overflow: visible;
  }

  .creator-surface,
  .result-rail,
  .panel-grid.generation-mode .creator-surface,
  .panel-grid.result-first .creator-surface {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .panel-grid.chat-only .creator-surface {
    height: calc(100dvh - 54px - 62px);
  }

  .panel-grid.chat-only .result-rail {
    display: none;
  }

  .panel-grid.generation-mode .panel.active,
  .panel-grid.result-first .panel.active {
    height: auto;
    padding: 14px;
    overflow: visible;
  }

  .generation-action-bar {
    background: rgba(18, 22, 20, 0.98);
  }
}

/* Keep the compact Qianwen-like rail above the legacy desktop cascade. */
@media (min-width: 1121px) {
  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .sidebar {
    gap: 20px;
    padding: 16px 10px;
  }

  .nav-item,
  .nav-item:hover,
  .nav-item.active {
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .nav-item {
    color: rgba(238, 244, 241, 0.48);
  }

  .nav-item:hover {
    color: rgba(238, 244, 241, 0.78);
  }

  .nav-item.active {
    color: #eef4f1;
  }
}

/* Qianwen-inspired generation workspace, rebuilt around Luming's real controls. */
body:has(.panel-grid.generation-mode) .workspace {
  padding: 0 16px 16px 0;
}

body:has(.panel-grid.generation-mode) .topbar {
  min-height: 52px;
  height: 52px;
}

body:has(.panel-grid.generation-mode) .topbar h2 {
  opacity: 0;
  pointer-events: none;
}

.panel-grid.generation-mode,
.panel-grid.result-first {
  grid-template-columns: 380px minmax(0, 1fr);
  grid-template-areas: "controls results";
  gap: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.panel-grid.generation-mode .creator-surface,
.panel-grid.result-first .creator-surface {
  min-height: 0;
  overflow: hidden;
  border: 1px solid #262d2a;
  border-radius: 8px;
  background: rgba(27, 31, 29, 0.82);
}

.panel-grid.generation-mode .result-rail,
.panel-grid.result-first .result-rail {
  min-height: 0;
  border: 0;
  background: transparent;
}

.panel-grid.generation-mode .generation-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-height: 48px;
  margin: 0;
  padding: 4px 10px 0;
  border: 0;
  border-bottom: 1px solid #262d2a;
  border-radius: 0;
  background: transparent;
}

.panel-grid.generation-mode .generation-tabs button {
  position: relative;
  flex: 0 1 auto;
  min-height: 43px;
  padding: 0 10px;
  color: rgba(238, 244, 241, 0.5);
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 680;
  transition: color 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-grid.generation-mode .generation-tabs button::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-strong);
  opacity: 0;
  transform: scaleX(0.35);
  transition: opacity 180ms ease, transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-grid.generation-mode .generation-tabs button:hover {
  color: rgba(238, 244, 241, 0.8);
  background: transparent;
}

.panel-grid.generation-mode .generation-tabs button.active {
  color: #eef4f1;
  background: transparent;
}

.panel-grid.generation-mode .generation-tabs button.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.panel-grid.generation-mode .generation-tabs button:active {
  transform: translateY(1px) scale(0.98);
}

.panel-grid.generation-mode .panel.active,
.panel-grid.result-first .panel.active {
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}

.panel-grid.generation-mode .creation-form,
.panel-grid.result-first .creation-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
}

.panel-grid.generation-mode .creation-model-switch,
.panel-grid.result-first .creation-model-switch {
  display: block;
  margin: 0;
}

.panel-grid.generation-mode .creation-model-label,
.panel-grid.result-first .creation-model-label,
.panel-grid.generation-mode .creation-model-hint,
.panel-grid.result-first .creation-model-hint {
  display: none;
}

.panel-grid.generation-mode .creation-model-options,
.panel-grid.result-first .creation-model-options {
  display: flex;
  gap: 4px;
  min-height: 48px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid #2b3430;
  border-radius: 8px;
  background: #171c1a;
}

.panel-grid.generation-mode .creation-model-options button,
.panel-grid.result-first .creation-model-options button {
  min-height: 36px;
  padding: 0 13px;
  color: #899590;
  border-radius: 6px;
  background: transparent;
  transition: color 180ms ease, background-color 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-grid.generation-mode .creation-model-options button:hover,
.panel-grid.result-first .creation-model-options button:hover {
  color: #dfe7e3;
  background: #202622;
}

.panel-grid.generation-mode .creation-model-options button.active,
.panel-grid.result-first .creation-model-options button.active {
  color: #b9f0e6;
  background: rgba(53, 199, 176, 0.14);
  box-shadow: inset 0 0 0 1px rgba(98, 219, 199, 0.18);
}

.panel-grid.generation-mode .creation-model-options button:active,
.panel-grid.result-first .creation-model-options button:active {
  transform: scale(0.97);
}

.image-editor-stack {
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid #2b3430;
  border-radius: 8px;
  background: #171c1a;
}

.image-editor-stack .image-reference-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title actions"
    "help actions"
    "preview preview";
  align-content: center;
  gap: 5px 12px;
  min-height: 112px;
  margin: 0;
  padding: 15px;
  border: 0;
  border-bottom: 1px solid #2b3430;
  border-radius: 0;
  background: #202422;
}

.image-editor-stack .image-reference-block > span {
  grid-area: title;
  align-self: end;
  color: #edf3f0;
  font-size: 13px;
  font-weight: 720;
}

.image-editor-stack .reference-help {
  grid-area: help;
  align-self: start;
  color: #7f8a86;
  font-size: 11px;
  line-height: 1.5;
}

.image-editor-stack .reference-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 7px;
}

.image-editor-stack .reference-actions .icon-button,
.image-editor-stack .reference-actions label.icon-button {
  width: 42px;
  height: 42px;
  color: #a7b2ae;
  border-color: #39423e;
  background: #292e2b;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.image-editor-stack .reference-actions .icon-button:hover,
.image-editor-stack .reference-actions label.icon-button:hover {
  color: #c9f4ec;
  border-color: rgba(98, 219, 199, 0.42);
  background: rgba(53, 199, 176, 0.12);
  transform: translateY(-1px);
}

.image-editor-stack .image-reference-preview {
  grid-area: preview;
  margin-top: 7px;
}

.image-editor-stack .image-prompt-block {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 15px 12px;
}

.image-editor-stack .image-prompt-block label {
  color: #adb7b3;
  font-size: 12px;
  font-weight: 680;
}

.image-editor-stack .image-prompt-block textarea,
.panel-grid.result-first .image-editor-stack .image-prompt-block textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: 10px 0 0;
  resize: none;
  color: #edf3f0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  line-height: 1.65;
}

.image-editor-stack .image-prompt-block textarea:focus,
.panel-grid.result-first .image-editor-stack .image-prompt-block textarea:focus {
  border: 0;
  outline: none;
  outline-offset: 0;
  background: transparent;
  box-shadow: none;
}

.image-editor-stack .image-prompt-block textarea::placeholder {
  color: #68736e;
}

.panel-grid.generation-mode .image-control-grid,
.panel-grid.result-first .image-control-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.panel-grid.generation-mode .image-control-grid label,
.panel-grid.result-first .image-control-grid label {
  gap: 5px;
}

.panel-grid.generation-mode .image-control-grid label > span,
.panel-grid.result-first .image-control-grid label > span {
  color: #8f9a96;
  font-size: 11px;
  font-weight: 650;
}

.panel-grid.generation-mode .image-control-grid select,
.panel-grid.result-first .image-control-grid select {
  min-height: 40px;
  color: #dfe7e3;
  border-color: #2f3834;
  background: #171c1a;
}

.panel-grid.generation-mode .generation-action-bar,
.panel-grid.result-first .generation-action-bar {
  position: relative;
  bottom: auto;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 8px;
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.panel-grid.generation-mode .generation-action-bar::before,
.panel-grid.result-first .generation-action-bar::before {
  display: none;
}

.panel-grid.generation-mode .generation-action-bar .cost-preview,
.panel-grid.result-first .generation-action-bar .cost-preview {
  min-height: 46px;
  padding: 0 10px;
  color: #a6b1ad;
  border-color: #2f3834;
  background: #171c1a;
  font-size: 11px;
}

.panel-grid.generation-mode .generation-action-bar .cost-preview strong,
.panel-grid.result-first .generation-action-bar .cost-preview strong {
  color: #bff2e8;
}

.panel-grid.generation-mode .generation-action-bar .cost-preview span:first-child,
.panel-grid.result-first .generation-action-bar .cost-preview span:first-child {
  display: none;
}

.panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"],
.panel-grid.result-first .generation-action-bar > .action-button[type="submit"] {
  position: relative;
  isolation: isolate;
  min-height: 46px;
  overflow: hidden;
  color: #0c1411;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"]::before,
.panel-grid.result-first .generation-action-bar > .action-button[type="submit"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.32) 48%, transparent 76%);
  transform: translateX(-125%);
  transition: transform 480ms cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"]:hover,
.panel-grid.result-first .generation-action-bar > .action-button[type="submit"]:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"]:hover::before,
.panel-grid.result-first .generation-action-bar > .action-button[type="submit"]:hover::before {
  transform: translateX(125%);
}

.panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"]:active,
.panel-grid.result-first .generation-action-bar > .action-button[type="submit"]:active {
  transform: scale(0.985);
}

.panel-grid.generation-mode .rail-header,
.panel-grid.result-first .rail-header {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 4px 8px;
  border: 0;
  background: transparent;
}

.panel-grid.generation-mode .rail-header > div,
.panel-grid.result-first .rail-header > div {
  display: block;
}

.panel-grid.generation-mode .rail-header h3,
.panel-grid.result-first .rail-header h3 {
  color: #cfd8d4;
  font-size: 14px;
  font-weight: 680;
}

.panel-grid.generation-mode .rail-header #clear-results,
.panel-grid.result-first .rail-header #clear-results {
  width: 36px;
  height: 36px;
  color: #8d9893;
  border-color: #29312e;
  background: #171c1a;
  box-shadow: none;
}

.panel-grid.generation-mode .rail-header #clear-results:hover,
.panel-grid.result-first .rail-header #clear-results:hover {
  color: #dfe7e3;
  border-color: #3b4641;
  background: #202622;
}

.panel-grid.generation-mode .result-list,
.panel-grid.result-first .result-list {
  min-height: 0;
  padding: 0;
  background: transparent;
}

.panel-grid.generation-mode .empty-state,
.panel-grid.result-first .empty-state {
  min-height: 100%;
  color: #737e79;
  border: 0;
  background: transparent;
}

.panel-grid.generation-mode .empty-state svg,
.panel-grid.result-first .empty-state svg {
  color: #77817d;
}

.panel-grid.generation-mode .empty-state strong,
.panel-grid.result-first .empty-state strong {
  color: #a8b2ae;
  font-size: 14px;
}

.panel-grid.generation-mode .empty-state span,
.panel-grid.result-first .empty-state span {
  max-width: 280px;
  color: #66716c;
  font-size: 12px;
  line-height: 1.65;
  text-align: center;
}

.panel-grid.generation-mode .result-tool-dock,
.panel-grid.result-first .result-tool-dock {
  min-height: 50px;
  padding: 8px 4px 0;
  border-top-color: #232a27;
  background: transparent;
}

@media (max-width: 960px) {
  body:has(.panel-grid.generation-mode) .workspace {
    height: auto;
    min-height: 100dvh;
    padding: 0 12px 18px;
    overflow: visible;
  }

  .panel-grid.generation-mode,
  .panel-grid.result-first {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "controls"
      "results";
    gap: 12px;
    overflow: visible;
  }

  .panel-grid.generation-mode .creator-surface,
  .panel-grid.result-first .creator-surface,
  .panel-grid.generation-mode .result-rail,
  .panel-grid.result-first .result-rail {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .panel-grid.generation-mode .panel.active,
  .panel-grid.result-first .panel.active {
    overflow: visible;
  }

  .panel-grid.generation-mode .creation-form,
  .panel-grid.result-first .creation-form {
    height: auto;
  }

  .image-editor-stack {
    min-height: 480px;
  }

  .panel-grid.generation-mode .empty-state,
  .panel-grid.result-first .empty-state {
    min-height: 360px;
  }
}

@media (max-width: 720px) {
  body:has(.panel-grid.generation-mode) .workspace {
    padding: calc(54px + env(safe-area-inset-top)) 0 88px;
  }

  body:has(.panel-grid.generation-mode) .topbar {
    min-height: calc(54px + env(safe-area-inset-top));
    height: calc(54px + env(safe-area-inset-top));
  }

  .panel-grid.generation-mode .creator-surface,
  .panel-grid.result-first .creator-surface {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .panel-grid.generation-mode .generation-tabs {
    position: sticky;
    top: calc(54px + env(safe-area-inset-top));
    z-index: 20;
    overflow-x: auto;
    background: rgba(17, 21, 19, 0.97);
  }

  .panel-grid.generation-mode .generation-tabs button {
    flex: 1 0 auto;
  }

  .image-editor-stack {
    min-height: 430px;
  }

  .image-editor-stack .image-reference-block {
    min-height: 104px;
  }

  .panel-grid.generation-mode .generation-action-bar,
  .panel-grid.result-first .generation-action-bar {
    position: static;
    right: 10px;
    bottom: calc(62px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 30;
    padding: 8px;
    border: 1px solid #303936;
    border-radius: 8px;
    background: rgba(18, 22, 20, 0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel-grid.generation-mode .generation-tabs button,
  .panel-grid.generation-mode .generation-tabs button::after,
  .panel-grid.generation-mode .creation-model-options button,
  .image-editor-stack .reference-actions .icon-button,
  .image-editor-stack .reference-actions label.icon-button,
  .panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"],
  .panel-grid.generation-mode .generation-action-bar > .action-button[type="submit"]::before {
    transition: none !important;
    transform: none !important;
  }
}

/* Final cascade lock for the screenshot-style model selector. */
.panel-grid.generation-mode .generation-tabs {
  min-height: 58px;
  padding: 0 12px;
  gap: 0;
}

.panel-grid.generation-mode .generation-tabs button {
  flex: 0 0 auto;
  min-height: 57px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.panel-grid.generation-mode .generation-tabs button.active {
  font-weight: 700;
}

.panel-grid.generation-mode .generation-tabs button::after {
  right: 12px;
  bottom: 7px;
  left: 12px;
}

.panel-grid.generation-mode .creation-model-menu,
.panel-grid.result-first .creation-model-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 60;
  display: block;
  max-height: min(410px, calc(100dvh - 190px));
  min-height: 0;
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  border-color: #303633;
  background: rgba(29, 32, 30, 0.985);
}

.panel-grid.generation-mode .creation-model-switch,
.panel-grid.result-first .creation-model-switch {
  width: auto;
  margin-inline: 12px;
}

.panel-grid.generation-mode .image-control-grid,
.panel-grid.generation-mode .generation-action-bar {
  width: auto;
  margin-inline: 12px;
}

.creation-model-options[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .panel-grid.generation-mode .generation-tabs {
    min-height: 52px;
    padding-inline: 8px;
  }

  .panel-grid.generation-mode .generation-tabs button {
    flex: 1 0 auto;
    min-height: 51px;
    padding-inline: 10px;
    font-size: 13px;
  }

  .panel-grid.generation-mode .creation-model-switch,
  .panel-grid.result-first .creation-model-switch,
  .panel-grid.generation-mode .image-control-grid {
    margin-inline: 10px;
  }

  .panel-grid.generation-mode .generation-action-bar {
    margin-inline: 0;
  }

  .panel-grid.generation-mode .creation-model-menu,
  .panel-grid.result-first .creation-model-menu {
    position: fixed;
    top: calc(112px + env(safe-area-inset-top));
    right: 10px;
    left: 10px;
    max-height: min(430px, calc(100dvh - 220px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .creation-model-trigger,
  .creation-model-trigger-chevron,
  .creation-model-option {
    transition: none !important;
    transform: none !important;
  }
}

/* Final cascade lock for Qianwen-style neutral cards and inset hairlines. */
/* Reference uploader layout must remain above the legacy workflow cascade. */
.panel-grid.generation-mode .image-editor-stack .image-reference-block,
.panel-grid.result-first .image-editor-stack .image-reference-block {
  display: block;
  min-height: 128px;
  padding: 16px 16px 12px;
}

.image-editor-stack .image-reference-preview {
  grid-area: auto;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.reference-assets-modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(700px, calc(100vw - 32px));
  height: min(550px, calc(100dvh - 32px));
  padding: 24px;
  color: #f2f4f3;
  border: 0;
  background: #1c1c1c;
}

@media (max-width: 720px) {
  .reference-assets-modal-card {
    width: calc(100vw - 20px);
    height: min(620px, calc(100dvh - 20px));
    padding: 18px;
  }
}
.panel-grid.generation-mode,
.panel-grid.result-first {
  --qwen-surface: #222222;
  --qwen-soft-surface: rgba(250, 251, 255, 0.03);
  --qwen-hairline: rgba(250, 251, 255, 0.03);
  --qwen-control-line: rgba(250, 251, 255, 0.06);
}

.panel-grid.generation-mode .creator-surface,
.panel-grid.result-first .creator-surface {
  border: 0;
  background: rgba(34, 34, 34, 0.4);
  box-shadow: none;
}

.panel-grid.generation-mode .generation-tabs {
  border-bottom: 0;
}

.creation-model-trigger {
  border: 0;
  outline: 1px solid var(--qwen-hairline);
  outline-offset: -1px;
  background: transparent;
  box-shadow: none;
}

.creation-model-trigger:hover,
.creation-model-dropdown.open .creation-model-trigger {
  border-color: transparent;
  background: var(--qwen-soft-surface);
}

.creation-model-trigger:focus-visible,
.creation-model-option:focus-visible {
  outline: 1px solid rgba(250, 251, 255, 0.06);
  outline-offset: -1px;
}

.panel-grid.generation-mode .creation-model-menu,
.panel-grid.result-first .creation-model-menu {
  border: 0;
  outline: 1px solid var(--qwen-hairline);
  outline-offset: -1px;
  background: var(--qwen-surface);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.panel-grid.generation-mode .creation-model-menu .creation-model-option:hover,
.panel-grid.result-first .creation-model-menu .creation-model-option:hover {
  background: rgba(250, 251, 255, 0.04);
}

.panel-grid.generation-mode .creation-model-menu .creation-model-option.active,
.panel-grid.result-first .creation-model-menu .creation-model-option.active {
  background: rgba(250, 251, 255, 0.06);
  box-shadow: none;
}

.panel-grid.generation-mode .image-editor-stack,
.panel-grid.result-first .image-editor-stack {
  width: auto;
  margin-inline: 12px;
  border: 0;
  background: var(--qwen-surface);
  box-shadow: none;
}

.panel-grid.generation-mode .image-editor-stack .image-reference-block,
.panel-grid.result-first .image-editor-stack .image-reference-block {
  position: relative;
  border-bottom: 0;
  background: transparent;
}

.image-editor-stack .image-reference-block::after {
  content: "";
  position: absolute;
  right: 15px;
  bottom: 0;
  left: 15px;
  height: 1px;
  background: var(--qwen-hairline);
  pointer-events: none;
}

.image-editor-stack .image-prompt-block {
  background: transparent;
}

.image-editor-stack .reference-actions .icon-button,
.image-editor-stack .reference-actions label.icon-button {
  border: 0;
  outline: 1px solid var(--qwen-control-line);
  outline-offset: -1px;
  background: var(--qwen-soft-surface);
}

.panel-grid.generation-mode .image-control-grid select,
.panel-grid.result-first .image-control-grid select,
.panel-grid.generation-mode .generation-action-bar .cost-preview,
.panel-grid.result-first .generation-action-bar .cost-preview {
  border: 0;
  outline: 1px solid var(--qwen-control-line);
  outline-offset: -1px;
  background: rgba(0, 0, 0, 0.08);
  box-shadow: none;
}

@media (max-width: 720px) {
  .panel-grid.generation-mode .image-editor-stack,
  .panel-grid.result-first .image-editor-stack {
    margin-inline: 10px;
  }
}

/* Final lock for the Qianwen desktop navigation axis and card geometry. */
@media (min-width: 721px) {
  .app-shell {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 8px;
    border-right: 0;
  }

  .module-nav {
    margin-block: auto;
  }

  .account-panel {
    margin-top: 0;
  }

  .brand-mark,
  .brand-mark img {
    width: 40px;
    height: 40px;
  }

  .brand {
    border-bottom: 0;
  }

  .panel-grid.generation-mode .creator-surface,
  .panel-grid.result-first .creator-surface {
    border-radius: var(--radius-outer);
  }
}

/* Product-wide corner hierarchy: outer 24, inner 20, controls 12, actions 8. */
:root {
  --radius-outer: 24px;
  --radius-inner: 20px;
  --radius-control: 12px;
  --radius-small: 8px;
}

@media (min-width: 721px) {
  /* Outermost page and dialog surfaces. */
  .panel-grid.home-only,
  .panel-grid.chat-only,
  .panel-grid.workflow-only,
  .panel-grid.task-log-only,
  .panel-grid.generation-mode .creator-surface,
  .panel-grid.result-first .creator-surface,
  .modal-card,
  .reference-assets-modal-card {
    border-radius: var(--radius-outer);
  }

  /* Cards nested directly inside the primary page surface. */
  .home-assistant-feature,
  .home-launch-card,
  .chat-history-card,
  .task-log-card,
  .video-reference-block,
  .image-editor-stack,
  .image-parameter-popover,
  .creation-model-menu,
  .panel-grid.generation-mode .creation-model-menu,
  .panel-grid.result-first .creation-model-menu {
    border-radius: var(--radius-inner);
  }

  /* Field groups, segmented controls, and compact selectors. */
  .field-block textarea,
  .control-grid select,
  .control-grid input,
  .reference-block:not(.video-reference-block),
  .image-segmented-control,
  .image-aspect-control,
  .image-parameter-trigger,
  .creation-model-trigger,
  .tool-switch,
  .task-log-summary-card {
    border-radius: var(--radius-control);
  }

  /* Leaf actions retain a tighter radius so the hierarchy stays visible. */
  .action-button,
  .secondary-button,
  .icon-button,
  .image-parameter-option,
  .creation-model-option,
  .panel-grid.generation-mode .creation-model-menu .creation-model-option,
  .panel-grid.result-first .creation-model-menu .creation-model-option,
  .nav-item {
    border-radius: var(--radius-small);
  }
}

/* Keep the navigation, generation header, and result canvas on one surface. */
.sidebar,
body:has(.panel-grid.generation-mode) .topbar,
.panel-grid.generation-mode .result-rail,
.panel-grid.result-first .result-rail {
  background: #0d100f;
}

/* Qianwen-style media history inside the generation result rail. */
.result-filter-tabs[hidden] {
  display: none !important;
}

.result-filter-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-filter-tabs button {
  min-width: 46px;
  height: 36px;
  padding: 0 12px;
  color: rgba(238, 244, 241, 0.52);
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 650;
}

.result-filter-tabs button:hover {
  color: rgba(238, 244, 241, 0.82);
  background: rgba(255, 255, 255, 0.035);
}

.result-filter-tabs button.active {
  color: #eef4f1;
  background: #242725;
}

.result-rail[data-layout="history"] {
  min-width: 0;
  overflow: hidden;
  padding: 0 18px 0 28px;
}

.panel-grid.generation-mode .result-rail[data-layout="history"] .rail-header,
.panel-grid.result-first .result-rail[data-layout="history"] .rail-header {
  position: static;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 58px;
  padding: 4px 0 10px;
}

.panel-grid.generation-mode .result-rail[data-layout="history"] .rail-header > div,
.panel-grid.result-first .result-rail[data-layout="history"] .rail-header > div {
  display: block;
}

.result-rail[data-layout="history"] .rail-header .eyebrow,
.result-rail[data-layout="history"] .rail-header h3,
.result-rail[data-layout="history"] #clear-results,
.result-rail[data-layout="history"] .result-tool-dock {
  display: none;
}

.panel-grid.generation-mode .result-rail[data-layout="history"] .result-list,
.panel-grid.result-first .result-rail[data-layout="history"] .result-list {
  height: calc(100% - 58px);
  min-height: 0;
  padding: 0 12px 36px 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.result-rail[data-layout="history"] .result-list::-webkit-scrollbar {
  width: 6px;
}

.result-rail[data-layout="history"] .result-list::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(238, 244, 241, 0.13);
}

.result-history-list {
  display: grid;
}

.result-history-item {
  min-width: 0;
  padding: 10px 0 22px;
  border-bottom: 1px solid rgba(238, 244, 241, 0.055);
}

.result-history-item:last-child {
  border-bottom: 0;
}

.result-history-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 30px;
}

.result-history-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: #edf3f0;
}

.result-history-title > svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
}

.result-history-title > strong {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 720;
}

.result-history-title > span {
  min-width: 0;
  overflow: hidden;
  color: rgba(238, 244, 241, 0.92);
  font-size: 14px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-history-title > small,
.result-history-title > em {
  flex: 0 0 auto;
  color: rgba(238, 244, 241, 0.34);
  font-size: 12px;
  font-style: normal;
  font-weight: 520;
  white-space: nowrap;
}

.result-history-item.status-failed .result-history-title > em {
  color: #d8948f;
}

.result-history-item.status-queued .result-history-title > em,
.result-history-item.status-submitting .result-history-title > em,
.result-history-item.status-processing .result-history-title > em {
  color: #c4a96d;
}

.result-history-head > time {
  color: rgba(238, 244, 241, 0.3);
  font-size: 12px;
  white-space: nowrap;
}

.result-history-preview {
  display: flex;
  align-items: flex-start;
  min-height: 0;
  margin-top: 14px;
}

.result-history-preview img,
.result-history-preview video {
  display: block;
  width: auto;
  max-width: min(280px, 100%);
  height: auto;
  max-height: 440px;
  border-radius: 12px;
  background: #181c1a;
  object-fit: contain;
}

.result-history-preview img {
  cursor: zoom-in;
}

.result-history-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  width: min(280px, 100%);
  min-height: 168px;
  padding: 18px;
  color: rgba(238, 244, 241, 0.46);
  border: 1px solid rgba(238, 244, 241, 0.08);
  border-radius: 12px;
  background: #151917;
  font-size: 12px;
  text-align: center;
}

.result-history-placeholder svg {
  width: 22px;
  height: 22px;
}

.result-history-placeholder.is-processing svg {
  animation: result-history-spin 900ms linear infinite;
}

.result-history-placeholder.is-failed {
  color: #c9948f;
}

.result-history-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
}

.result-history-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  color: rgba(238, 244, 241, 0.82);
  border: 1px solid rgba(238, 244, 241, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 12px;
  font-weight: 600;
}

.result-history-actions button:hover:not(:disabled) {
  color: #eef4f1;
  border-color: rgba(238, 244, 241, 0.22);
  background: rgba(255, 255, 255, 0.065);
}

.result-history-actions button:active:not(:disabled) {
  transform: translateY(1px);
}

.result-history-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.result-history-actions svg {
  width: 16px;
  height: 16px;
}

.result-history-empty {
  min-height: calc(100% - 20px) !important;
}

@keyframes result-history-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .result-history-placeholder.is-processing svg {
    animation: none;
  }
}

@media (max-width: 960px) {
  .result-rail[data-layout="history"] {
    padding: 0 16px;
  }

  .panel-grid.generation-mode .result-rail[data-layout="history"] .result-list,
  .panel-grid.result-first .result-rail[data-layout="history"] .result-list {
    height: auto;
    max-height: none;
    padding-right: 0;
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .result-history-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .result-history-title {
    flex-wrap: wrap;
  }

  .result-history-title > span {
    flex: 1 1 180px;
  }

  .result-history-title > small {
    flex-basis: 100%;
    padding-left: 28px;
  }

  .result-history-head > time {
    padding-left: 28px;
  }
}

/* Video generation keeps the image workflow's compact editor rhythm while retaining every existing field. */
#video-panel .creation-form {
  position: relative;
  gap: 10px;
}

#video-panel .video-editor-stack {
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr);
  min-height: 0;
  overflow: visible;
  width: auto;
  margin-inline: 12px;
  border: 0;
  border-radius: var(--radius-inner, 20px);
  background: var(--qwen-surface, #222222);
  box-shadow: none;
}

#video-panel .video-reference-composer {
  position: relative;
  display: block;
  min-height: 128px;
  padding: 16px 16px 12px;
  border-bottom: 0;
  background: transparent;
}

#video-panel .video-reference-composer::after {
  content: "";
  position: absolute;
  right: 15px;
  bottom: 0;
  left: 15px;
  height: 1px;
  background: var(--qwen-hairline, rgba(250, 251, 255, 0.03));
  pointer-events: none;
}

#video-panel .video-reference-launch {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  width: 100%;
  height: 100px;
  min-height: 100px;
  padding: 0;
  color: rgba(250, 251, 255, 0.5);
  border: 0;
  border-radius: 8px;
  background: rgba(250, 251, 255, 0.03);
  transition: color 180ms ease, outline-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

#video-panel .video-reference-launch svg {
  width: 24px;
  height: 24px;
  color: currentColor;
  stroke-width: 1.5;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

#video-panel .video-reference-launch span {
  color: rgba(250, 251, 255, 0.5);
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
}

#video-panel .video-reference-launch small {
  color: rgba(250, 251, 255, 0.36);
  font: inherit;
  font-size: 11px;
}

#video-panel .video-reference-launch:hover,
#video-panel .video-reference-composer.reference-open .video-reference-launch {
  color: rgba(250, 251, 255, 0.68);
  outline: 1px solid rgba(250, 251, 255, 0.06);
  outline-offset: -1px;
  background: rgba(250, 251, 255, 0.05);
}

#video-panel .video-reference-launch:active {
  transform: scale(0.985);
}

#video-panel .video-reference-composer.reference-open .video-reference-launch svg {
  transform: rotate(45deg);
}

#video-panel .video-reference-menu,
#video-panel .video-mode-menu,
#video-panel .video-parameter-popover {
  position: absolute;
  z-index: 30;
  border: 1px solid #39443f;
  border-radius: var(--radius-inner, 20px);
  background: rgba(29, 34, 32, 0.985);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

#video-panel .video-reference-menu[hidden],
#video-panel .video-mode-menu[hidden],
#video-panel .video-parameter-popover[hidden] {
  display: none !important;
}

#video-panel .video-reference-menu {
  top: calc(100% - 4px);
  right: 12px;
  left: 12px;
  padding: 12px;
}

#video-panel .video-reference-menu-head {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
}

#video-panel .video-reference-menu-head strong {
  color: #e6efeb;
  font-size: 13px;
}

#video-panel .video-reference-menu-head span {
  color: #7f8a86;
  font-size: 11px;
}

#video-panel .video-reference-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#video-panel .video-reference-choice {
  display: grid !important;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 56px;
  padding: 9px;
  color: #aab5b0;
  border: 1px solid #35403b;
  border-radius: var(--radius-control, 12px);
  background: #252b28;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

#video-panel .video-reference-choice:hover {
  color: #e4eee9;
  border-color: rgba(98, 219, 199, 0.44);
  background: rgba(53, 199, 176, 0.1);
  transform: translateY(-1px);
}

#video-panel .video-reference-choice > svg {
  width: 21px;
  height: 21px;
  color: #7de0cc;
}

#video-panel .video-reference-choice > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

#video-panel .video-reference-choice b {
  color: inherit;
  font-size: 12px;
}

#video-panel .video-reference-choice small {
  overflow: hidden;
  color: #71807a;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#video-panel .video-reference-previews {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

#video-panel .video-reference-previews .attachment-preview {
  padding: 0;
  border: 0;
  background: transparent;
}

#video-panel .video-prompt-block {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 15px 12px;
  background: transparent;
}

#video-panel .video-prompt-block label {
  color: #adb7b3;
  font-size: 12px;
  font-weight: 680;
}

#video-panel .video-prompt-block textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: 10px 0 0;
  resize: none;
  color: #edf3f0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  line-height: 1.65;
}

#video-panel .video-prompt-block textarea:focus {
  border: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
}

#video-panel .video-prompt-block textarea::placeholder {
  color: #68736e;
}

#video-panel .video-control-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-inline: 12px;
}

#video-panel .video-control-bar .video-cost-inline {
  display: none;
}

#video-panel .video-mode-picker {
  position: relative;
  flex: 0 0 auto;
}

#video-panel .video-mode-trigger,
#video-panel .video-parameter-trigger {
  display: inline-flex;
  min-width: 116px;
  height: 36px;
  min-height: 36px;
  padding: 0 11px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: rgba(250, 251, 255, 0.9);
  border: 0;
  border-radius: var(--radius-control, 12px);
  outline: 1px solid rgba(250, 251, 255, 0.08);
  outline-offset: -1px;
  background: rgba(250, 251, 255, 0.05);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  transition: background-color 150ms ease, transform 150ms ease, outline-color 150ms ease;
}

#video-panel .video-mode-trigger svg,
#video-panel .video-parameter-trigger svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  stroke-width: 1.7;
  transition: transform 200ms ease;
}

#video-panel .video-mode-picker.open .video-mode-trigger svg {
  transform: rotate(180deg);
}

#video-panel .video-mode-trigger:hover,
#video-panel .video-parameter-trigger:hover,
#video-panel .video-parameter-trigger.active {
  outline-color: rgba(250, 251, 255, 0.12);
  background: rgba(250, 251, 255, 0.08);
}

#video-panel .video-mode-trigger:active,
#video-panel .video-parameter-trigger:active {
  transform: scale(0.98);
}

#video-panel .video-parameter-trigger {
  color: rgba(250, 251, 255, 0.9);
}

#video-panel .video-mode-menu {
  bottom: calc(100% + 8px);
  left: 0;
  width: 220px;
  padding: 6px;
}

#video-panel .video-mode-menu button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 52px;
  padding: 9px 10px;
  color: #a8b4af;
  text-align: left;
  border: 0;
  border-radius: 10px;
  background: transparent;
  transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

#video-panel .video-mode-menu button:hover,
#video-panel .video-mode-menu button.active {
  color: #edf5f1;
  background: #2a312d;
}

#video-panel .video-mode-menu button:active {
  transform: scale(0.985);
}

#video-panel .video-mode-menu b {
  font-size: 12px;
}

#video-panel .video-mode-menu small {
  color: #77837e;
  font-size: 10px;
}

#video-panel .video-cost-inline {
  min-height: 42px;
  margin-left: auto;
  padding: 0 10px;
  color: #9ba8a2;
  border: 1px solid #2f3834;
  border-radius: var(--radius-control, 12px);
  background: #171c1a;
  font-size: 11px;
}

#video-panel .video-cost-inline strong {
  color: #bff2e8;
}

#video-panel .video-parameter-popover {
  right: 12px;
  bottom: 74px;
  width: min(calc(100% - 24px), 440px);
  padding: 14px;
}

#video-panel .video-parameter-section {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

#video-panel .video-parameter-section > span,
#video-panel .video-parameter-grid label > span {
  color: #8f9a96;
  font-size: 11px;
  font-weight: 680;
}

#video-panel .video-parameter-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#video-panel .video-parameter-grid label {
  gap: 5px;
}

#video-panel .video-parameter-grid select,
#video-panel .video-parameter-grid input {
  min-height: 38px;
  color: #dfe7e3;
  border-color: #2f3834;
  background: #171c1a;
}

#video-panel .video-advanced-settings {
  margin-top: 12px;
  border-top: 1px solid #2b3430;
}

#video-panel .video-advanced-settings summary {
  padding-top: 12px;
  color: #9eaaa5;
  font-size: 12px;
}

#video-panel .video-advanced-settings .advanced-settings-body {
  padding-top: 10px;
}

#video-panel .video-generation-action-bar {
  grid-template-columns: minmax(0, 1fr);
}

#video-panel .video-generation-action-bar > .cost-preview {
  display: none;
}

#video-panel .video-generation-action-bar > .action-button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

#video-panel .video-generation-action-bar .action-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: currentColor;
  font-size: 12px;
  font-weight: 750;
}

#video-panel .video-generation-action-bar .action-cost svg {
  width: 14px;
  height: 14px;
}

#video-panel .video-generation-action-bar > .action-button[type="submit"]:disabled .action-cost {
  color: #68736e;
}

/* Keep video submission controls on the same visual contract as image generation. */
#video-panel .video-generation-action-bar {
  display: block;
  width: auto;
  margin: 6px 12px 12px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#video-panel .video-generation-action-bar > .action-button[type="submit"] {
  min-width: 0;
  height: 46px;
  min-height: 46px;
  border-radius: 8px;
}

#video-panel .video-generation-action-bar > .action-button[type="submit"]:disabled {
  color: rgba(250, 251, 255, 0.32);
  border-color: transparent;
  background: rgba(250, 251, 255, 0.06);
  box-shadow: none;
  cursor: not-allowed;
}

#video-panel .video-generation-action-bar > .action-button[type="submit"]:disabled .action-cost {
  display: none;
}

#image-panel .image-generation-action-bar .action-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: currentColor;
  font-size: 12px;
  font-weight: 750;
}

#image-panel .image-generation-action-bar .action-cost svg {
  width: 14px;
  height: 14px;
}

#image-panel .image-generation-action-bar > .action-button[type="submit"]:disabled .action-cost {
  display: none;
}

#image-panel .image-parameter-summary-row > .cost-preview {
  display: none;
}

#image-panel .image-generation-action-bar > .action-button[type="submit"]:disabled {
  color: rgba(250, 251, 255, 0.32);
  border-color: transparent;
  background: rgba(250, 251, 255, 0.06);
  box-shadow: none;
  cursor: not-allowed;
}

#video-panel .video-generation-action-bar > .action-button[type="submit"]:disabled {
  color: rgba(250, 251, 255, 0.32);
  border-color: transparent;
  background: rgba(250, 251, 255, 0.06);
  box-shadow: none;
}

@media (max-width: 720px) {
  #video-panel .video-editor-stack {
    grid-template-rows: auto minmax(260px, 1fr);
    border-radius: var(--radius-inner, 20px);
  }

  #video-panel .video-reference-menu-grid,
  #video-panel .video-parameter-grid {
    grid-template-columns: 1fr;
  }

  #video-panel .video-control-bar {
    flex-wrap: wrap;
  }

  #video-panel .video-cost-inline {
    flex-basis: 100%;
    justify-content: center;
    margin-left: 0;
  }

  #video-panel .video-parameter-popover {
    right: 10px;
    bottom: 74px;
    left: 10px;
    width: auto;
  }
}

/* Mobile generation actions stay inside the creator card instead of floating over the viewport. */
@media (max-width: 720px) {
  .panel-grid.generation-mode .panel.active,
  .panel-grid.result-first .panel.active {
    display: flex;
    flex-direction: column;
  }

  .panel-grid.generation-mode .panel.active .creation-form,
  .panel-grid.result-first .panel.active .creation-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: calc(100dvh - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  .panel-grid.generation-mode .generation-action-bar,
  .panel-grid.result-first .generation-action-bar {
    position: static;
    right: auto;
    bottom: 0;
    left: auto;
    z-index: 30;
    width: auto;
    margin: 8px 0 0;
    padding: 8px;
    border: 1px solid #303936;
    border-radius: 8px;
    background: rgba(18, 22, 20, 0.98);
    box-shadow: 0 -10px 28px rgba(3, 7, 5, 0.35);
  }

  .panel-grid.generation-mode .generation-action-bar > .action-button,
  .panel-grid.result-first .generation-action-bar > .action-button {
    width: 100%;
  }
}

/* Keep the mobile model card below the sticky media tabs while the editor scrolls. */
@media (max-width: 720px) {
  .panel-grid.generation-mode .creation-model-switch,
  .panel-grid.result-first .creation-model-switch {
    position: sticky;
    top: calc(106px + env(safe-area-inset-top));
    z-index: 22;
    padding-block: 6px;
    background: #111513;
  }

  .panel-grid.generation-mode .creation-model-switch.mobile-stuck + .image-editor-stack,
  .panel-grid.generation-mode .creation-model-switch.mobile-stuck + .video-editor-stack,
  .panel-grid.generation-mode .creation-model-switch.mobile-stuck + .music-editor-stack,
  .panel-grid.result-first .creation-model-switch.mobile-stuck + .image-editor-stack,
  .panel-grid.result-first .creation-model-switch.mobile-stuck + .video-editor-stack,
  .panel-grid.result-first .creation-model-switch.mobile-stuck + .music-editor-stack {
    margin-top: 70px;
  }
}

/* Mobile music controls should use the full creator width. The base form has
   a desktop-centered margin that otherwise squeezes the editor into a narrow
   column while the model card remains viewport-fixed. */
@media (max-width: 720px) {
  #music-panel.active .creation-form {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    align-self: stretch !important;
    box-sizing: border-box;
  }

  #music-panel.active .music-editor-stack {
    width: calc(100% - 20px) !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-inline: 10px !important;
    box-sizing: border-box;
  }

  #music-panel.active .generation-action-bar {
    width: calc(100% - 20px) !important;
    min-width: 0 !important;
    margin-inline: 10px !important;
    box-sizing: border-box;
  }
}

/* Keep the image and video reference separators on the same baseline. */
.panel-grid.generation-mode .image-editor-stack .image-reference-block,
.panel-grid.result-first .image-editor-stack .image-reference-block {
  min-height: 136px;
}

/* Home backdrop: the supplied city artwork sits behind a soft, pointer-following mask. */
.panel-grid.home-only,
.panel-grid.home-only .creator-surface {
  background: transparent;
}

.home-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  --home-pointer-x: 50%;
  --home-pointer-y: 42%;
  --home-bg-x: 50%;
  --home-bg-y: 50%;
  --spotlight-mask:
    radial-gradient(300px 246px at 54% 44%, transparent 25%, #000 100%),
    radial-gradient(249px 300px at 52% 46%, transparent 25%, #000 100%),
    radial-gradient(276px 222px at 56% 47%, transparent 25%, #000 100%),
    radial-gradient(228px 288px at 50% 49%, transparent 25%, #000 100%);
}

.home-panel::before,
.home-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.home-panel::before {
  display: none;
  z-index: -1;
  position: fixed;
  inset: 0;
  background-image: url("/assets/home-cyber-city.webp");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: brightness(0.82) saturate(1.16) contrast(1.04) blur(0);
  opacity: 1;
  transform: scale(1.06);
  animation: home-backdrop-drift 18s ease-in-out infinite alternate;
}

.home-background-layer {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image: url("/assets/home-cyber-city.webp");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: brightness(0.82) saturate(1.16) contrast(1.04) blur(0);
  opacity: 1;
  transform: scale(1.06);
  animation: home-backdrop-drift 18s ease-in-out infinite alternate;
}

.home-panel::after {
  z-index: -1;
  background: linear-gradient(180deg, transparent 0%, rgba(8, 10, 16, 0.68) 100%);
}

.home-stage {
  position: relative;
  z-index: 1;
}

.sidebar,
.topbar {
  position: relative;
  z-index: 2;
}

/* Qianwen-style spotlight: a dark blurred veil with several feathered holes. */
.home-spotlight-layer {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background: rgba(14, 14, 18, 0.93);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  -webkit-mask-image: var(--spotlight-mask);
  mask-image: var(--spotlight-mask);
  mask-composite: intersect;
}

/* Low-contrast dot texture inspired by the reference site. It stays behind all
   controls while drifting slowly with the hero background. */
.home-dot-layer {
  position: fixed;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  opacity: 0.38;
  background-image: radial-gradient(circle, rgba(187, 255, 235, 0.34) 0 1px, transparent 1.4px);
  background-size: 22px 22px;
  background-position: 0 0;
  -webkit-mask-image: radial-gradient(ellipse 82% 72% at 50% 38%, #000 0%, rgba(0, 0, 0, 0.76) 48%, transparent 100%);
  mask-image: radial-gradient(ellipse 82% 72% at 50% 38%, #000 0%, rgba(0, 0, 0, 0.76) 48%, transparent 100%);
  animation: home-dot-drift 28s linear infinite;
}

.home-spotlight { display: none; }

.home-assistant-feature,
.home-launch-card {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
}

.home-assistant-feature {
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.1);
}

.home-launch-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.15);
}

@keyframes home-backdrop-drift {
  from { transform: scale(1.03) translate3d(-0.45%, -0.25%, 0); }
  to { transform: scale(1.07) translate3d(0.45%, 0.35%, 0); }
}

@keyframes home-mask-sweep {
  from { background-position: 0% 50%, 0 0; }
  to { background-position: 100% 50%, 0 0; }
}

@keyframes home-dot-drift {
  from { background-position: 0 0; }
  to { background-position: 44px 44px; }
}

body:has(#home-panel.active) .workspace {
  background: transparent;
}

body:has(#home-panel.active) .topbar {
  background: rgba(4, 11, 20, 0.42);
  backdrop-filter: blur(12px);
}

body:has(#home-panel.active) .sidebar {
  background: rgba(4, 11, 20, 0.48);
  backdrop-filter: blur(12px);
}

@media (max-width: 820px) {
  .home-panel::before {
    opacity: 0.72;
    animation-duration: 24s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-panel::before,
  .home-panel::after,
  .home-dot-layer {
    animation: none;
    transition: none;
  }
}

/* Keep the generation controls on the right side of the desktop workspace. */
@media (min-width: 821px) {
  .panel-grid.generation-mode,
  .panel-grid.result-first {
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-areas: "results controls";
  }

  .panel-grid.generation-mode .creator-surface,
  .panel-grid.result-first .creator-surface {
    grid-area: controls;
  }

  .panel-grid.generation-mode .result-rail,
  .panel-grid.result-first .result-rail {
    grid-area: results;
  }
}

/* Promote the home background and mask to the viewport so the sweep covers every edge. */
body:has(#home-panel.active) {
  position: relative;
  isolation: isolate;
  background: #141414;
}

body:has(#home-panel.active)::before,
body:has(#home-panel.active)::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body:has(#home-panel.active)::before {
  z-index: 0;
  background: url("/assets/home-cyber-city.webp") center / cover no-repeat;
  filter: brightness(0.76) saturate(1.08) contrast(1.04);
  animation: home-backdrop-drift 18s ease-in-out infinite alternate;
}

body:has(#home-panel.active)::after {
  z-index: 1;
  background:
    linear-gradient(
      112deg,
      rgba(0, 0, 0, 0.92) 0%,
      rgba(0, 0, 0, 0.92) 34%,
      rgba(0, 0, 0, 0.28) 47%,
      rgba(0, 0, 0, 0) 54%,
      rgba(0, 0, 0, 0.28) 61%,
      rgba(0, 0, 0, 0.92) 74%,
      rgba(0, 0, 0, 0.92) 100%
    ),
    linear-gradient(180deg, transparent 0%, #141414 92%);
  background-size: 240% 100%, 100% 100%;
  background-position: 0% 50%, 0 0;
  animation: home-mask-sweep 16s ease-in-out infinite alternate;
}

body:has(#home-panel.active) .app-shell {
  position: relative;
  z-index: 2;
  background: transparent;
}

body:has(#home-panel.active) .home-panel::before,
body:has(#home-panel.active) .home-panel::after {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  body:has(#home-panel.active)::before,
  body:has(#home-panel.active)::after {
    animation: none;
  }
}

/* Let the page surface continue through the sidebar and top header. */
.sidebar,
.topbar {
  background: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ChatGPT-inspired assistant workspace: focused conversation, compact history, and one unified composer. */
body:has(#chat-panel.active) .workspace {
  padding: 0;
  background: #0d100f;
}

body:has(#chat-panel.active) .topbar {
  min-height: 60px;
  border-bottom: 1px solid #252c29 !important;
  background: #0d100f !important;
}

body:has(#chat-panel.active) .topbar h2 {
  color: #edf3f0;
  font-size: 16px;
  font-weight: 700;
}

body:has(#chat-panel.active) .topbar h2 {
  display: none;
}

.panel-grid.chat-only {
  grid-template-columns: 278px minmax(0, 1fr);
  grid-template-areas: "history conversation";
  gap: 0;
  border: 0;
  border-radius: 0;
  background: #0d100f;
}

.panel-grid.chat-only .creator-surface {
  grid-area: conversation;
  display: flex;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: #0d100f;
}

.panel-grid.chat-only .result-rail {
  grid-area: history;
  display: flex;
  border: 0;
  border-right: 1px solid #252c29;
  border-radius: 0;
  background: #111512;
}

.panel-grid.chat-only .rail-header {
  min-height: 64px;
  padding: 10px;
  border: 0;
  background: #111512;
}

.panel-grid.chat-only .rail-header > div {
  display: none;
}

.panel-grid.chat-only #clear-results {
  display: inline-flex;
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  height: 42px;
  padding: 0 11px;
  color: #e7eeeb;
  border: 1px solid #303936;
  border-radius: 9px;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.panel-grid.chat-only #clear-results::after {
  content: "新建对话";
}

.panel-grid.chat-only #clear-results:hover {
  border-color: #52615a;
  background: #1b211e;
}

.panel-grid.chat-only .result-list {
  gap: 2px;
  padding: 4px 8px 14px;
  background: #111512;
}

.panel-grid.chat-only .chat-history-list {
  gap: 2px;
}

.panel-grid.chat-only .chat-history-card {
  position: relative;
  display: block;
  padding: 10px 38px 10px 10px;
  color: #bac5c0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.panel-grid.chat-only .chat-history-card:hover,
.panel-grid.chat-only .chat-history-card.active {
  background: #1c231f;
}

.panel-grid.chat-only .chat-history-main {
  display: block;
}

.panel-grid.chat-only .chat-history-main strong {
  display: block;
  color: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
}

.panel-grid.chat-only .chat-history-main span,
.panel-grid.chat-only .chat-history-card time {
  display: none;
}

.panel-grid.chat-only .chat-history-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
  transition: opacity 140ms ease;
}

.panel-grid.chat-only .chat-history-card:hover .chat-history-actions,
.panel-grid.chat-only .chat-history-card:focus-within .chat-history-actions {
  opacity: 1;
}

.panel-grid.chat-only .chat-history-actions div {
  gap: 2px;
}

.panel-grid.chat-only .chat-history-actions .icon-button {
  width: 27px;
  height: 27px;
  color: #aeb9b4;
  border: 0;
  border-radius: 7px;
  background: #28302c;
}

#chat-panel.panel.active {
  width: 100%;
  padding: 0 clamp(24px, 5vw, 112px) 22px;
  overflow: hidden;
}

#chat-panel .chat-window {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 48px 0 22px;
  background: transparent;
}

#chat-panel .message {
  position: relative;
  max-width: 860px;
  margin: 0 auto 30px;
  padding-left: 42px;
}

#chat-panel .message small {
  display: none;
}

#chat-panel .message.assistant::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 0;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #18231e url("/luminglogo.png") center / 18px 18px no-repeat;
}

#chat-panel .message.assistant .bubble {
  padding: 0 34px 5px 0;
  color: #e6eeea;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#chat-panel .message.user {
  max-width: min(76%, 680px);
  margin-right: 0;
  margin-left: auto;
  padding-left: 0;
}

#chat-panel .message.user .bubble {
  padding: 12px 16px;
  color: #f1f6f3;
  border: 1px solid #343d38;
  border-radius: 20px 20px 5px 20px;
  background: #222a26;
}

#chat-panel .message-text {
  font-size: 15px;
  line-height: 1.76;
}

#chat-panel .message-copy-button {
  top: auto;
  right: auto;
  bottom: -25px;
  left: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  color: #8f9a95;
  border: 0;
  border-radius: 5px;
  background: transparent;
  opacity: 0;
  transition: color 140ms ease, opacity 140ms ease;
}

#chat-panel .message.assistant:hover .message-copy-button,
#chat-panel .message.assistant:focus-within .message-copy-button {
  opacity: 1;
}

#chat-panel .message.user .message-copy-button {
  display: none;
}

#chat-panel .composer {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px 36px;
  grid-template-areas:
    "attachment input meta send"
    "preview preview preview preview";
  align-items: center;
  column-gap: 4px;
  row-gap: 0;
  width: min(100%, 768px);
  min-height: 52px;
  margin: 0 auto;
  padding: 4px 8px;
  color: #0d0d0d;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  transition: box-shadow 180ms ease, background-color 180ms ease;
  overflow: visible;
}

#chat-panel .composer:focus-within {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

#chat-panel .composer textarea {
  grid-area: input;
  box-sizing: border-box;
  height: 40px;
  min-height: 42px;
  max-height: 270px;
  padding: 8px 0;
  color: #0d0d0d;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  line-height: 26px;
  resize: none;
  overflow: hidden;
}

#chat-panel .composer textarea::placeholder {
  color: rgba(13, 13, 13, 0.55);
}

#chat-panel .composer textarea:focus {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  outline-offset: 0;
}

#chat-panel .composer textarea:focus-visible {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  outline-offset: 0;
}

#chat-panel .composer-actions {
  display: contents;
}

#chat-panel .composer-expand-button {
  display: none;
}

#chat-panel .composer-meta-actions {
  display: flex;
  grid-area: meta;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  gap: 4px;
}

#chat-panel .composer-thinking-button {
  display: none;
}

#chat-panel .composer-voice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #0d0d0d;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

#chat-panel .composer-voice-button:hover {
  background: rgba(0, 0, 0, 0.06);
}

#chat-panel .attachment-actions {
  grid-area: attachment;
}

#chat-panel .composer .icon-button.primary {
  grid-area: send;
  width: 36px;
  height: 36px;
  color: #ffffff;
  border: 0;
  border-radius: 50%;
  background: #000000;
}

#chat-panel .composer .icon-button.primary:hover:not(:disabled) {
  color: #ffffff;
  background: #2f2f2f;
}

#chat-panel .composer .icon-button.primary:disabled {
  color: rgba(13, 13, 13, 0.35);
  background: rgba(13, 13, 13, 0.08);
  opacity: 1;
}

#chat-panel .composer-send-icon {
  display: inline-block;
}

#chat-panel .composer-voice-stop,
#chat-panel .composer-voice-loader {
  display: none;
}

/* The trailing control is always the send action; only its enabled state changes. */
#chat-panel .composer:not(.has-message) .composer-send-arrow {
  display: inline-block;
}

#chat-panel .composer:not(.has-message) .icon-button.primary {
  color: #ffffff;
  background: #000000;
}

#chat-panel .composer .attachment-menu-button {
  width: 36px;
  height: 36px;
  color: #0d0d0d;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

#chat-panel .attachment-paperclip-icon {
  display: none;
}

#chat-panel .composer .attachment-plus-icon {
  display: inline-block;
}

#chat-panel .composer .attachment-menu-button:hover,
#chat-panel .composer .attachment-menu-button.active {
  color: #0d0d0d;
  border: 0;
  background: rgba(0, 0, 0, 0.06);
}

#chat-panel .composer .attachment-preview {
  grid-area: preview;
  align-self: stretch;
  width: 100%;
  margin-top: 5px;
  padding-top: 7px;
  border-top: 1px solid #313a35;
}

#chat-panel .composer .attachment-menu {
  right: auto;
  left: 0;
  width: 156px;
  color: #e7eeeb;
  border-color: #3a443f;
  border-radius: 10px;
  background: #202723;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
}

#chat-panel .composer .attachment-menu button {
  color: #e7eeeb;
}

#chat-panel .composer .attachment-menu button:hover {
  background: #2b342f;
}

#chat-panel.chat-empty-state {
  align-items: center;
  justify-content: center;
  padding-bottom: clamp(120px, 19vh, 210px);
}

#chat-panel.chat-empty-state .chat-window {
  flex: 0 0 auto;
  min-height: 0;
  padding: 0;
  overflow: visible;
}

#chat-panel .chat-welcome {
  text-align: center;
}

#chat-panel .chat-welcome h3 {
  margin: 0;
  color: #f0f5f2;
  font-size: 30px;
  font-weight: 650;
  line-height: 1.25;
}

#chat-panel.chat-empty-state .composer {
  margin-top: 22px;
}

/* GPT-style expanded editor state after the user starts typing. */
#chat-panel .composer.has-input {
  position: relative;
  grid-template-areas:
    "input input input input"
    "attachment meta meta send"
    "preview preview preview preview";
  /* Keep the auto-growing composer aligned with ChatGPT's 768px surface. */
  width: min(100%, 768px);
  padding: 8px 9px 7px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

#chat-panel .composer.has-input:focus-within {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

#chat-panel .composer.has-input textarea {
  height: auto;
  min-height: 42px;
  max-height: 206px;
  grid-area: input;
  padding: 7px 52px 3px 8px;
  color: #0d0d0d;
  overflow-y: auto;
  scrollbar-color: rgba(13, 13, 13, 0.28) transparent;
  scrollbar-gutter: stable;
}

#chat-panel .composer.has-input .composer-expand-button {
  display: inline-flex;
  position: absolute;
  top: 8px;
  right: 17px;
  width: 36px;
  height: 36px;
  color: #0d0d0d;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

#chat-panel .composer.has-input .composer-expand-button:hover {
  color: #0d0d0d;
  background: rgba(0, 0, 0, 0.06);
}

#chat-panel .composer.has-input .composer-meta-actions {
  display: flex;
  grid-area: meta;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

#chat-panel .composer.has-input .composer-thinking-button,
#chat-panel .composer.has-input .composer-voice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  color: #0d0d0d;
  border: 0;
  border-radius: 18px;
  background: transparent;
  font-size: 13px;
  font-weight: 650;
}

#chat-panel .composer.has-input .composer-thinking-button {
  gap: 4px;
  padding: 0 7px;
}

#chat-panel .composer.has-input .composer-thinking-button[aria-pressed="true"] {
  color: #3a6fd8;
  background: #eef4ff;
}

#chat-panel .composer.has-input .composer-voice-button {
  width: 36px;
  height: 36px;
  padding: 0;
}

#chat-panel .composer.has-input .composer-thinking-button:hover,
#chat-panel .composer.has-input .composer-voice-button:hover {
  color: #0d0d0d;
  background: rgba(0, 0, 0, 0.06);
}

#chat-panel .composer.has-input .attachment-menu-button {
  color: #0d0d0d;
}

#chat-panel .composer.has-input .attachment-plus-icon {
  display: inline-block;
}

#chat-panel .composer.has-input .attachment-paperclip-icon {
  display: none;
}

#chat-panel .composer.has-input .attachment-menu-button:hover,
#chat-panel .composer.has-input .attachment-menu-button.active {
  color: #0d0d0d;
  background: rgba(0, 0, 0, 0.06);
}

#chat-panel .composer.has-input .icon-button.primary {
  grid-area: send;
  align-self: end;
  width: 36px;
  height: 36px;
  color: #ffffff;
  background: #000000;
}

#chat-panel .composer.has-input .icon-button.primary:hover:not(:disabled) {
  color: #ffffff;
  background: #2f2f2f;
}

#chat-panel .composer.has-input .icon-button.primary:disabled {
  color: rgba(13, 13, 13, 0.35);
  background: rgba(13, 13, 13, 0.08);
}

#chat-panel .composer.has-input .attachment-preview {
  border-top-color: #e5e7e9;
}

#chat-panel .composer.has-input .attachment-menu {
  color: #202124;
  border-color: #d8dadd;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(18, 22, 29, 0.16);
}

#chat-panel .composer.has-input .attachment-menu button {
  color: #202124;
}

#chat-panel .composer.has-input .attachment-menu button:hover {
  background: #f0f1f2;
}

/* Match the GPT composer geometry while keeping the existing chat form behavior. */
#chat-panel .composer:not(.has-input) textarea {
  padding-left: 3px;
}

#chat-panel .composer:not(.has-input) .composer-meta-actions {
  transform: translateX(-4px);
}

/* GPT keeps the compact composer free of secondary mode controls. The thinking
   state remains available to the existing logic and can be restored without
   changing message submission behavior. */
#chat-panel .composer .composer-thinking-button {
  display: none !important;
}

#chat-panel .composer.composer-expanded {
  position: absolute;
  z-index: 40;
  top: 8px;
  bottom: auto;
  left: 50%;
  width: min(calc(100vw - 32px), 768px);
  height: min(calc(100vh - 160px), 740px);
  max-height: none;
  margin: 0;
  transform: translateX(-50%);
  grid-template-rows: minmax(0, 1fr) auto auto;
  align-items: end;
  padding: 8px 9px 7px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

#chat-panel .composer.composer-expanded textarea {
  height: 100% !important;
  min-height: 0;
  max-height: none;
  padding: 7px 52px 3px 8px;
  overflow-y: auto;
}

#chat-panel .composer.composer-expanded .composer-expand-button {
  display: inline-flex;
  position: absolute;
  top: 8px;
  right: 17px;
  width: 36px;
  height: 36px;
  color: #0d0d0d;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

#chat-panel .composer.composer-expanded .composer-expand-button:hover {
  background: rgba(0, 0, 0, 0.06);
}

@media (max-width: 820px) {
  #chat-panel .composer.composer-expanded {
    position: fixed;
    top: 12px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
    height: auto;
    transform: none;
  }
}

@media (max-width: 820px) {
  body:has(#chat-panel.active) .workspace {
    padding: 0;
  }

  .panel-grid.chat-only {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "conversation";
  }

  .panel-grid.chat-only .result-rail {
    display: none;
  }

  #chat-panel.panel.active {
    padding: 0 12px calc(86px + env(safe-area-inset-bottom));
    overflow: visible;
  }

  #chat-panel .chat-window {
    width: 100%;
    padding: 28px 0 18px;
  }

  #chat-panel .message {
    margin-bottom: 26px;
    padding-left: 35px;
  }

  #chat-panel .message.user {
    max-width: 86%;
    padding-left: 0;
  }

  #chat-panel .composer {
    position: fixed;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 32;
    width: auto;
    margin: 0;
  }

  /* Prevent the auto-growing state from retaining the desktop width on phones. */
  #chat-panel .composer.has-input {
    width: auto;
  }

  #chat-panel.chat-empty-state {
    align-items: center;
    justify-content: center;
    padding-bottom: 28vh;
  }

  #chat-panel .chat-welcome h3 {
    font-size: 26px;
  }
}

/* ChatGPT dark composer palette, scoped to the assistant workspace only. */
body:has(#chat-panel.active) .workspace,
body:has(#chat-panel.active) .topbar,
.panel-grid.chat-only,
.panel-grid.chat-only .creator-surface,
body:has(#chat-panel.active) #chat-panel.panel.active {
  background: #101412 !important;
}

/* Chat conversation canvas uses the workspace base tone. */
body:has(#chat-panel.active) .panel-grid.chat-only .creator-surface,
body:has(#chat-panel.active) #chat-panel.panel.active {
  background: #0d100f !important;
}

body:has(#chat-panel.active) .topbar,
.panel-grid.chat-only .result-rail {
  border-color: #2a2a2a !important;
}

.panel-grid.chat-only .result-rail,
.panel-grid.chat-only .rail-header,
.panel-grid.chat-only .result-list,
#chat-panel .chat-history-bar {
  background: #171717;
}

#chat-panel .chat-history-bar {
  border-color: #2a2a2a;
}

#chat-panel .chat-history-bar select {
  color: #ececec;
  border-color: #343434;
  background: #212121;
}

#chat-panel .chat-window {
  background: transparent;
}

#chat-panel .chat-welcome h3 {
  color: #f4f4f4;
}

#chat-panel .composer,
#chat-panel .composer.has-input,
#chat-panel .composer.composer-expanded {
  color: #ececec;
  border-color: #2b2b2b;
  background: #212121;
  box-shadow: none;
}

#chat-panel .composer:focus-within,
#chat-panel .composer.has-input:focus-within {
  border-color: #343434;
  background: #212121;
  box-shadow: none;
}

#chat-panel .composer textarea,
#chat-panel .composer.has-input textarea,
#chat-panel .composer.composer-expanded textarea {
  color: #ececec;
}

#chat-panel .composer textarea::placeholder {
  color: #b4b4b4;
}

#chat-panel .composer .attachment-menu-button,
#chat-panel .composer-voice-button,
#chat-panel .composer.has-input .attachment-menu-button,
#chat-panel .composer.has-input .composer-voice-button,
#chat-panel .composer-expand-button,
#chat-panel .composer.has-input .composer-expand-button,
#chat-panel .composer.composer-expanded .composer-expand-button {
  color: #ececec;
}

#chat-panel .composer .attachment-menu-button:hover,
#chat-panel .composer .attachment-menu-button.active,
#chat-panel .composer-voice-button:hover,
#chat-panel .composer.has-input .attachment-menu-button:hover,
#chat-panel .composer.has-input .attachment-menu-button.active,
#chat-panel .composer.has-input .composer-voice-button:hover,
#chat-panel .composer.has-input .composer-expand-button:hover,
#chat-panel .composer.composer-expanded .composer-expand-button:hover {
  color: #ffffff;
  background: #303030;
}

#chat-panel .composer:not(.has-message) .icon-button.primary {
  color: #858585;
  background: #303030;
}

#chat-panel .composer:not(.has-message) .icon-button.primary:hover {
  color: #858585;
  background: #303030;
}

#chat-panel .composer.has-message .icon-button.primary,
#chat-panel .composer.has-input .icon-button.primary {
  color: #ffffff;
  background: #3b82f6;
}

#chat-panel .composer.has-message .icon-button.primary:hover:not(:disabled),
#chat-panel .composer.has-input .icon-button.primary:hover:not(:disabled) {
  color: #ffffff;
  background: #4a8af8;
}

#chat-panel .composer .attachment-preview,
#chat-panel .composer.has-input .attachment-preview {
  border-top-color: #3a3a3a;
}

#chat-panel .composer .attachment-menu,
#chat-panel .composer.has-input .attachment-menu {
  color: #ececec;
  border-color: #3a3a3a;
  background: #2a2a2a;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}

#chat-panel .composer .attachment-menu button,
#chat-panel .composer.has-input .attachment-menu button {
  color: #ececec;
}

#chat-panel .composer .attachment-menu button:hover,
#chat-panel .composer.has-input .attachment-menu button:hover {
  background: #383838;
}

/* Voice controls use the same compact composer language while exposing clear capture states. */
#chat-panel .composer-voice-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

#chat-panel .composer[data-voice-state="recording"][data-voice-mode="dictation"] .composer-voice-mic,
#chat-panel .composer[data-voice-state="processing"][data-voice-mode="dictation"] .composer-voice-mic {
  display: none;
}

#chat-panel .composer[data-voice-state="recording"][data-voice-mode="dictation"] .composer-voice-stop {
  display: inline-block;
}

#chat-panel .composer[data-voice-state="processing"][data-voice-mode="dictation"] .composer-voice-loader {
  display: inline-block;
  animation: luming-voice-spin 900ms linear infinite;
}

#chat-panel .composer[data-voice-state="recording"][data-voice-mode="dictation"] .composer-voice-button {
  color: #ffffff;
  background: #dc3d4b;
}

#chat-panel .composer[data-voice-state="recording"][data-voice-mode="dictation"] .composer-voice-button:hover {
  color: #ffffff;
  background: #ee4a58;
}

@keyframes luming-voice-spin {
  to { transform: rotate(360deg); }
}

/* Chat management, streaming, and PDF selection states. */
#chat-panel.panel.active {
  position: relative;
}

#chat-panel .chat-history-bar {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: clamp(24px, 5vw, 112px);
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(142px, 0.9fr) auto repeat(4, 32px);
  align-items: center;
  width: min(calc(100% - 48px), 686px);
  min-height: 34px;
  margin: 0;
  padding: 3px;
  border: 1px solid #2b2b2b;
  border-radius: 10px;
  background: #171717;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

#chat-panel .chat-history-bar label {
  min-width: 0;
}

#chat-panel .chat-history-bar label > span {
  display: none;
}

#chat-panel .chat-history-bar select,
#chat-panel .chat-search-input {
  box-sizing: border-box;
  width: 100%;
  height: 32px;
  min-width: 0;
  color: #ececec;
  border: 0;
  border-radius: 7px;
  background: #212121;
  font-size: 12px;
}

#chat-panel .chat-history-bar select {
  padding: 0 26px 0 9px;
}

#chat-panel .chat-search-input {
  padding: 0 9px;
  outline: none;
}

#chat-panel .chat-search-input::placeholder {
  color: #9a9a9a;
}

#chat-panel .chat-search-input:focus {
  box-shadow: 0 0 0 1px #4b4b4b;
}

#chat-panel .chat-history-bar .chat-credit-button,
#chat-panel .chat-history-bar .icon-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  color: #c9c9c9;
  border: 0;
  border-radius: 7px;
  background: transparent;
}

#chat-panel .chat-history-bar .chat-credit-button {
  gap: 0;
}

#chat-panel .chat-history-bar .chat-credit-button span {
  display: none;
}

#chat-panel .chat-history-bar .chat-credit-button:hover,
#chat-panel .chat-history-bar .icon-button:hover:not(:disabled) {
  color: #ffffff;
  background: #303030;
}

#chat-panel .chat-history-bar .icon-button:disabled,
#chat-panel .chat-history-bar .chat-credit-button:disabled {
  color: #606060;
  background: transparent;
}

#chat-panel .message-delete-button {
  position: absolute;
  right: 0;
  bottom: -25px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: #8f9a95;
  border: 0;
  border-radius: 5px;
  background: transparent;
  opacity: 0;
  transition: color 140ms ease, opacity 140ms ease, background-color 140ms ease;
}

#chat-panel .message.assistant .message-delete-button {
  right: auto;
  left: 28px;
}

#chat-panel .message .bubble:hover .message-delete-button,
#chat-panel .message:focus-within .message-delete-button {
  opacity: 1;
}

#chat-panel .message-delete-button:hover {
  color: #ffffff;
  background: #303030;
}

#chat-panel .message-delete-button svg {
  width: 14px;
  height: 14px;
}

#chat-panel .message-retry-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  margin-top: 12px;
  padding: 0 10px;
  color: #d6d6d6;
  border: 1px solid #393939;
  border-radius: 7px;
  background: #242424;
  font-size: 12px;
  font-weight: 700;
}

#chat-panel .message-retry-button:hover {
  color: #ffffff;
  border-color: #515151;
  background: #303030;
}

#chat-panel .message-retry-button svg {
  width: 14px;
  height: 14px;
}

#chat-panel .message.streaming .message-text::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 15px;
  margin-left: 4px;
  border-radius: 1px;
  background: currentColor;
  vertical-align: -2px;
  animation: luming-chat-caret 880ms steps(1, end) infinite;
}

#chat-panel .composer .icon-button.primary.is-stop,
#chat-panel .composer.has-input .icon-button.primary.is-stop {
  color: #ffffff;
  background: #dc3d4b;
}

#chat-panel .composer .icon-button.primary.is-stop:hover:not(:disabled),
#chat-panel .composer.has-input .icon-button.primary.is-stop:hover:not(:disabled) {
  background: #ee4a58;
}

#chat-panel .chat-cost-preview {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  color: #cfcfcf;
  border-radius: 6px;
  background: #303030;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

#chat-panel .pdf-page-selector {
  display: grid;
  gap: 8px;
  width: 100%;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #3a3a3a;
}

#chat-panel .pdf-page-selector > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #d7d7d7;
  font-size: 12px;
  font-weight: 700;
}

#chat-panel .pdf-page-selector small {
  color: #9b9b9b;
  font-size: 11px;
  font-weight: 500;
}

#chat-panel .pdf-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 7px;
}

#chat-panel .pdf-page-toggle {
  position: relative;
  aspect-ratio: 0.72;
  overflow: hidden;
  padding: 0;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  background: #171717;
}

#chat-panel .pdf-page-toggle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  transition: opacity 140ms ease, transform 140ms ease;
}

#chat-panel .pdf-page-toggle span {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  color: #c7c7c7;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  font-size: 10px;
  font-weight: 800;
}

#chat-panel .pdf-page-toggle.active {
  border-color: #79aaf8;
  box-shadow: inset 0 0 0 1px #79aaf8;
}

#chat-panel .pdf-page-toggle.active img {
  opacity: 0.9;
}

#chat-panel .pdf-page-toggle.active span {
  color: #ffffff;
  background: #3b82f6;
}

#chat-panel .pdf-page-toggle:hover img {
  opacity: 1;
  transform: scale(1.03);
}

/* Match chat history cards to the rounded generation cards. */
.panel-grid.chat-only .chat-history-list { gap: 10px; }
.panel-grid.chat-only .chat-history-section { gap: 10px; }
.panel-grid.chat-only .chat-history-card,
.panel-grid.chat-only .chat-history-card.archived {
  padding: 12px 14px;
  border: 1px solid #2d3733;
  border-radius: 20px;
  background: #1d211f;
  box-shadow: none;
  opacity: 1;
}
.panel-grid.chat-only .chat-history-card:hover {
  border-color: #3d4b45;
  background: #242b27;
}
.panel-grid.chat-only .chat-history-card.active {
  border-color: #5b7568;
  background: #26302b;
}

@keyframes luming-chat-caret {
  50% { opacity: 0; }
}

@media (max-width: 820px) {
  #chat-panel .chat-history-bar {
    position: relative;
    top: auto;
    right: auto;
    display: flex;
    align-self: stretch;
    width: auto;
    min-height: 42px;
    margin: 0 -2px 4px;
    padding: 4px;
    overflow-x: auto;
  }

  #chat-panel .chat-history-bar label {
    flex: 1 0 144px;
  }

  #chat-panel .chat-search-input {
    flex: 0 0 132px;
  }

  #chat-panel .chat-history-bar .chat-credit-button,
  #chat-panel .chat-history-bar .icon-button {
    flex: 0 0 32px;
  }

  #chat-panel .message-delete-button {
    opacity: 1;
  }

  #chat-panel .pdf-page-grid {
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  #chat-panel .message.streaming .message-text::after {
    animation: none;
  }
}

/* Global mobile header surface: every page uses the same opaque top bar. */
@media (max-width: 820px) {
  .topbar,
  body:has(#chat-panel.active) .topbar {
    position: fixed !important;
    inset: 0 0 auto !important;
    z-index: 40 !important;
    min-height: calc(54px + env(safe-area-inset-top)) !important;
    height: calc(54px + env(safe-area-inset-top)) !important;
    background: #0d100f !important;
    background-color: #0d100f !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .topbar-actions {
    display: flex !important;
    align-items: center;
    gap: 4px !important;
    margin-left: auto !important;
  }

  .topbar-actions .wechat-contact {
    display: block !important;
    width: 28px !important;
  }

  .topbar-actions .wechat-contact-button,
  .topbar-actions .referral-entry-button,
  .topbar-actions .topbar-credit-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    flex: 0 0 28px;
    height: 32px;
    padding: 0 !important;
    font-size: 10px;
  }

  .topbar-actions .topbar-credit-button {
    width: 51px;
    min-width: 51px;
    flex-basis: 51px;
  }

  .topbar-actions .wechat-contact-button span,
  .topbar-actions .referral-entry-button span {
    display: none !important;
  }

  .topbar-actions .mobile-profile-entry {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    flex: 0 0 34px;
    height: 34px;
    padding: 0 !important;
    border: 0;
    border-radius: 999px;
    background: transparent;
  }

  .topbar-actions .mobile-profile-entry[hidden] {
    display: none !important;
  }

  .topbar-actions .mobile-login-entry {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 52px;
    min-width: 52px;
    flex: 0 0 52px;
    height: 32px;
    padding: 0 8px !important;
    color: #eef5f0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 9px;
    background: #202723;
    font-size: 12px;
    font-weight: 700;
  }

  .topbar-actions .mobile-login-entry[hidden] {
    display: none !important;
  }

  .topbar-actions .mobile-login-entry svg {
    width: 15px;
    height: 15px;
  }

  .topbar-actions .mobile-profile-entry .avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  }

  .topbar-actions .mobile-profile-entry .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
  }
}

/* The profile shortcut is intentionally mobile-only; desktop keeps account access in the sidebar. */
@media (min-width: 821px) {
  .topbar-actions .mobile-profile-entry,
  .topbar-actions .mobile-login-entry {
    display: none !important;
  }
}

/* The home header uses the action buttons without a duplicate page title. */
@media (max-width: 820px) {
  body:has(#home-panel.active) .topbar h2 {
    display: none !important;
  }
}

.panel-grid.chat-only .result-rail {
  border: 1px solid #2d3733 !important;
  border-radius: 24px !important;
  overflow: hidden;
}

body:has(#chat-panel.active) .topbar {
  border: 0 !important;
  border-bottom: 0 !important;
}

/* Final transparent canvases: preserve the shared dot texture behind result areas. */
html body .workspace,
html body .panel-grid.generation-mode,
html body .panel-grid.result-first,
html body .panel-grid.chat-only,
html body .panel-grid.generation-mode .result-rail,
html body .panel-grid.result-first .result-rail,
html body .panel-grid.generation-mode .result-list,
html body .panel-grid.result-first .result-list,
html body .panel-grid.chat-only .creator-surface,
html body:has(#chat-panel.active) #chat-panel.panel.active {
  background: transparent !important;
  box-shadow: none !important;
}

html body .workspace {
  background-image: radial-gradient(circle, rgba(187, 255, 235, 0.42) 0 1px, transparent 1.35px) !important;
  background-size: 22px 22px !important;
  background-position: 0 0 !important;
  background-color: transparent !important;
  animation: site-dot-drift 32s linear infinite;
}

html body .app-shell {
  background: transparent !important;
  background-color: transparent !important;
}

/* Keep the navigation surface on the same dark dotted tone as the content canvas. */
html body .app-shell > .sidebar {
  background-color: #0d100f !important;
  background-image: radial-gradient(circle, rgba(187, 255, 235, 0.42) 0 1px, transparent 1.35px) !important;
  background-size: 22px 22px !important;
  background-position: 0 0 !important;
  background-blend-mode: normal !important;
}

/* Use the supplied artwork as the single site-wide background surface. */
html,
html body {
  background: #0d100f url("/assets/site-background.webp") center / cover fixed no-repeat !important;
  background-attachment: scroll !important;
}

html body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 8, 10, 0.42), rgba(5, 8, 10, 0.68));
}

/* Last-resort task-log geometry guard: keep later theme rules from restoring card layout. */
html body .panel-grid.task-log-only .task-log-card.task-log-row {
  display: grid !important;
  grid-template-columns: var(--task-log-columns) !important;
  grid-template-rows: none !important;
  min-height: 54px !important;
  height: 54px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-top: 1px solid #252e2b !important;
  border-radius: 0 !important;
  background: #151b18 !important;
  box-shadow: none !important;
}

html body .panel-grid.task-log-only .task-log-card.task-log-row > .result-preview,
html body .panel-grid.task-log-only .task-log-card.task-log-row > .result-meta,
html body .panel-grid.task-log-only .task-log-card.task-log-row > .task-log-details {
  display: none !important;
}

/* Final cascade override for the simplified five-column task log. */
html body .panel-grid.task-log-only .task-log-table {
  --task-log-columns: minmax(88px, .8fr) minmax(118px, 1.05fr) minmax(190px, 1.8fr) minmax(76px, .72fr) minmax(128px, 1.2fr) !important;
  min-width: 660px !important;
}

html body .panel-grid.task-log-only .task-log-table-head,
html body .panel-grid.task-log-only .task-log-card.task-log-row {
  grid-template-columns: var(--task-log-columns) !important;
}

@media (max-width: 720px) {
  html body .panel-grid.generation-mode .panel.active .creation-form,
  html body .panel-grid.result-first .panel.active .creation-form {
    min-height: 0 !important;
    height: auto !important;
    flex: 0 0 auto !important;
  }
  html body .panel-grid.generation-mode .image-editor-stack,
  html body .panel-grid.result-first .image-editor-stack,
  html body .panel-grid.generation-mode .video-editor-stack,
  html body .panel-grid.result-first .video-editor-stack,
  html body .panel-grid.generation-mode .music-editor-stack,
  html body .panel-grid.result-first .music-editor-stack { min-height: 0 !important; }
  html body #image-panel.active,
  html body #video-panel.active,
  html body #music-panel.active { padding-bottom: 16px !important; }
  html body .panel-grid.generation-mode .generation-action-bar,
  html body .panel-grid.result-first .generation-action-bar { margin-bottom: 0 !important; }
  html body .panel-grid.generation-mode,
  html body .panel-grid.result-first { row-gap: 8px !important; }
}

@media (max-width: 720px) {
  html body .panel-grid.generation-mode .panel.active .creation-form,
  html body .panel-grid.result-first .panel.active .creation-form {
    min-height: 0 !important;
    height: auto !important;
    flex: 0 0 auto !important;
  }
  html body .panel-grid.generation-mode .image-editor-stack,
  html body .panel-grid.result-first .image-editor-stack,
  html body .panel-grid.generation-mode .video-editor-stack,
  html body .panel-grid.result-first .video-editor-stack,
  html body .panel-grid.generation-mode .music-editor-stack,
  html body .panel-grid.result-first .music-editor-stack { min-height: 0 !important; }
  html body #image-panel.active,
  html body #video-panel.active,
  html body #music-panel.active { padding-bottom: 16px !important; }
  html body .panel-grid.generation-mode .generation-action-bar,
  html body .panel-grid.result-first .generation-action-bar { margin-bottom: 0 !important; }
  html body .panel-grid.generation-mode,
  html body .panel-grid.result-first { row-gap: 8px !important; }
}

/* Mobile result rail spacing: avoid a viewport-sized placeholder between
   the editor and the result area. */
@media (max-width: 720px) {
  html body .panel-grid.generation-mode .panel.active .creation-form,
  html body .panel-grid.result-first .panel.active .creation-form {
    min-height: 0 !important;
    height: auto !important;
    flex: 0 0 auto !important;
  }

  html body .panel-grid.generation-mode .image-editor-stack,
  html body .panel-grid.result-first .image-editor-stack,
  html body .panel-grid.generation-mode .video-editor-stack,
  html body .panel-grid.result-first .video-editor-stack,
  html body .panel-grid.generation-mode .music-editor-stack,
  html body .panel-grid.result-first .music-editor-stack {
    min-height: 0 !important;
  }

  html body #image-panel.active,
  html body #video-panel.active,
  html body #music-panel.active {
    padding-bottom: 16px !important;
  }

  html body .panel-grid.generation-mode .generation-action-bar,
  html body .panel-grid.result-first .generation-action-bar {
    margin-bottom: 0 !important;
  }

  html body .panel-grid.generation-mode,
  html body .panel-grid.result-first {
    row-gap: 8px !important;
  }
}

/* Absolute last mobile spacing lock: keep results directly after the
   editor controls instead of a viewport-height placeholder. */
@media (max-width: 720px) {
  html body .panel-grid.generation-mode .panel.active .creation-form,
  html body .panel-grid.result-first .panel.active .creation-form {
    min-height: 0 !important;
    height: auto !important;
    flex: 0 0 auto !important;
  }

  html body .panel-grid.generation-mode .image-editor-stack,
  html body .panel-grid.result-first .image-editor-stack,
  html body .panel-grid.generation-mode .video-editor-stack,
  html body .panel-grid.result-first .video-editor-stack,
  html body .panel-grid.generation-mode .music-editor-stack,
  html body .panel-grid.result-first .music-editor-stack {
    min-height: 0 !important;
  }

  html body #image-panel.active,
  html body #video-panel.active,
  html body #music-panel.active {
    padding-bottom: 16px !important;
  }

  html body .panel-grid.generation-mode .generation-action-bar,
  html body .panel-grid.result-first .generation-action-bar {
    margin-bottom: 0 !important;
  }

  html body .panel-grid.generation-mode,
  html body .panel-grid.result-first {
    row-gap: 8px !important;
  }
}

/* Final mobile override: keep model selection in document flow and make the top and bottom bars opaque. */
@media (max-width: 720px) {
  html body .panel-grid.generation-mode .creation-model-switch,
  html body .panel-grid.result-first .creation-model-switch,
  html body .panel-grid.generation-mode .creation-model-switch.mobile-stuck,
  html body .panel-grid.result-first .creation-model-switch.mobile-stuck {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    z-index: auto !important;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    padding-block: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html body .panel-grid.generation-mode .creation-model-switch.mobile-stuck + .image-editor-stack,
  html body .panel-grid.generation-mode .creation-model-switch.mobile-stuck + .video-editor-stack,
  html body .panel-grid.generation-mode .creation-model-switch.mobile-stuck + .music-editor-stack,
  html body .panel-grid.result-first .creation-model-switch.mobile-stuck + .image-editor-stack,
  html body .panel-grid.result-first .creation-model-switch.mobile-stuck + .video-editor-stack,
  html body .panel-grid.result-first .creation-model-switch.mobile-stuck + .music-editor-stack {
    margin-top: 0 !important;
  }

  html body .app-shell > .sidebar,
  html body .app-shell > .sidebar .module-nav,
  html body .topbar,
  html body:has(#chat-panel.active) .topbar {
    background: #0d100f !important;
    background-color: #0d100f !important;
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* Mobile scroll behavior: the model card belongs to the page flow, not the viewport. */
@media (max-width: 720px) {
  html body .panel-grid.generation-mode .creation-model-switch,
  html body .panel-grid.result-first .creation-model-switch,
  html body .panel-grid.generation-mode .creation-model-switch.mobile-stuck,
  html body .panel-grid.result-first .creation-model-switch.mobile-stuck {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    z-index: auto !important;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    padding-block: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html body .panel-grid.generation-mode .creation-model-switch.mobile-stuck + .image-editor-stack,
  html body .panel-grid.generation-mode .creation-model-switch.mobile-stuck + .video-editor-stack,
  html body .panel-grid.generation-mode .creation-model-switch.mobile-stuck + .music-editor-stack,
  html body .panel-grid.result-first .creation-model-switch.mobile-stuck + .image-editor-stack,
  html body .panel-grid.result-first .creation-model-switch.mobile-stuck + .video-editor-stack,
  html body .panel-grid.result-first .creation-model-switch.mobile-stuck + .music-editor-stack {
    margin-top: 0 !important;
  }

  /* Match the fixed bottom navigation with a solid, opaque top surface. */
  html body .app-shell > .sidebar,
  html body .app-shell > .sidebar .module-nav,
  html body .topbar,
  html body:has(#chat-panel.active) .topbar {
    background: #0d100f !important;
    background-color: #0d100f !important;
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* Final mobile pass: remove desktop-only canvas and secondary actions from the phone shell. */
@media (max-width: 720px) {
  html body .app-shell > .sidebar .module-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  html body .app-shell > .sidebar .nav-item[data-panel="workflow"],
  html body .home-launch-workflow {
    display: none !important;
  }

  html body .topbar-actions .wechat-contact,
  html body .topbar-actions .referral-entry-button,
  html body .topbar-actions .wechat-contact-button,
  html body .topbar-actions .referral-entry-button {
    display: none !important;
  }

  html body .topbar-actions {
    gap: 6px !important;
  }

  /* Results should follow the editor instead of reserving a desktop-sized
     bottom-navigation gutter. The nav remains fixed independently. */
  html body #image-panel.active,
  html body #video-panel.active,
  html body #music-panel.active {
    padding-bottom: 16px !important;
  }

  html body .panel-grid.generation-mode .generation-action-bar,
  html body .panel-grid.result-first .generation-action-bar {
    margin-bottom: 16px !important;
  }

  html body .panel-grid.generation-mode .result-rail,
  html body .panel-grid.result-first .result-rail {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  /* Do not stretch the mobile editor to a viewport-sized flex column.
     Its reserved height created a large empty band before the results rail. */
  html body .panel-grid.generation-mode .panel.active .creation-form,
  html body .panel-grid.result-first .panel.active .creation-form {
    min-height: 0 !important;
    height: auto !important;
    flex: 0 0 auto !important;
  }

  html body .panel-grid.generation-mode .image-editor-stack,
  html body .panel-grid.result-first .image-editor-stack {
    min-height: 0 !important;
  }
}

/* Last mobile pass: remove desktop-only canvas and secondary actions from the phone shell. */
@media (max-width: 720px) {
  html body .app-shell > .sidebar .module-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  html body .app-shell > .sidebar .nav-item[data-panel="workflow"],
  html body .home-launch-workflow {
    display: none !important;
  }

  html body .topbar-actions .wechat-contact,
  html body .topbar-actions .referral-entry-button,
  html body .topbar-actions .wechat-contact-button,
  html body .topbar-actions .referral-entry-button {
    display: none !important;
  }

  html body .topbar-actions {
    gap: 6px !important;
  }
}

/* Align the desktop result with the generation card and remove the card chrome. */
@media (min-width: 821px) {
  html body .result-rail[data-layout="history"] .rail-header {
    height: 16px !important;
    min-height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
}

html body .result-rail[data-layout="history"] .result-history-item {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html body .result-rail[data-layout="history"] .result-history-preview {
  background: transparent !important;
}

/* Keep the focused generation result fully visible and centered. */
html body .result-rail[data-layout="history"] .result-history-preview {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}

html body .result-rail[data-layout="history"] .result-history-preview img,
html body .result-rail[data-layout="history"] .result-history-preview video {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* Show one focused, full-size result instead of a multi-card gallery. */
html body .result-rail[data-layout="history"] .result-history-list {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  gap: 0 !important;
  min-height: 100%;
}

html body .result-rail[data-layout="history"] .result-history-item {
  display: flex !important;
  flex-direction: column;
  align-self: stretch;
  min-height: 100%;
  height: 100%;
  padding: 0 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

html body .result-rail[data-layout="history"] .result-history-preview {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  margin: 0;
  aspect-ratio: auto;
  overflow: hidden;
  border-radius: 12px;
  background: #111513;
}

html body .result-rail[data-layout="history"] .result-history-preview img,
html body .result-rail[data-layout="history"] .result-history-preview video {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 12px;
  object-fit: contain;
}

html body .result-rail[data-layout="history"] .result-history-placeholder {
  width: 100%;
  height: 100%;
  min-height: 240px;
  border: 0;
  border-radius: 12px;
  background: #111513;
}

html body .result-rail[data-layout="history"] .result-history-actions {
  position: absolute;
}

@media (max-width: 960px) {
  html body .result-rail[data-layout="history"] .result-history-item {
    height: auto;
    min-height: 0;
  }

  html body .result-rail[data-layout="history"] .result-history-preview {
    flex: 0 0 auto;
    min-height: min(68dvh, 620px);
  }
}

/* Midjourney keeps its dense parameter set scoped to the selected model. */
.midjourney-parameter-panel {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.midjourney-parameter-panel[hidden],
[data-mj-action-field][hidden] { display: none !important; }

.midjourney-parameter-panel select,
.midjourney-parameter-panel input,
.midjourney-action-modal select,
.midjourney-action-modal input,
.midjourney-action-modal textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: #171b1a;
  color: #f4f7f5;
  padding: 8px 10px;
}

.midjourney-parameter-grid,
.midjourney-action-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.midjourney-primary-grid {
  grid-template-columns: minmax(0, 1fr);
}

.midjourney-parameter-grid label,
.midjourney-negative-prompt,
.midjourney-action-modal form > label,
.midjourney-action-fields label,
.midjourney-mask-upload {
  display: grid;
  gap: 6px;
  color: #9ca8a3;
  font-size: 12px;
}

.midjourney-advanced-settings {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.midjourney-advanced-settings summary {
  display: flex;
  min-height: 38px;
  padding: 0 2px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #cbd3cf;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.midjourney-advanced-settings summary::-webkit-details-marker {
  display: none;
}

.midjourney-advanced-settings summary svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #7f8a85;
  transition: transform 150ms ease;
}

.midjourney-advanced-settings[open] summary svg {
  transform: rotate(180deg);
}

.midjourney-advanced-settings summary:focus-visible {
  outline: 1px solid rgba(250, 251, 255, 0.36);
  outline-offset: 2px;
}

.midjourney-advanced-body {
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.midjourney-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.midjourney-toggle-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd3cf;
  font-size: 12px;
}

.midjourney-toggle-row input { width: 16px; min-height: 16px; }
.midjourney-action-modal { width: min(560px, calc(100vw - 32px)); }
.midjourney-action-modal form { display: grid; gap: 14px; }
.midjourney-mask-upload small { color: #7f8a85; }

.result-history-text {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 120px;
  padding: 16px;
  background: #151a18;
  color: #d9dfdc;
  overflow: auto;
}

.result-history-text svg { width: 18px; height: 18px; flex: 0 0 auto; }
.result-history-text p { margin: 0; white-space: pre-wrap; line-height: 1.65; }

@media (max-width: 640px) {
  .midjourney-parameter-grid,
  .midjourney-action-fields { grid-template-columns: 1fr; }
}

html body .panel-grid.task-log-only .task-log-status {
  display: inline-flex !important;
  align-items: center !important;
  min-width: 0;
}

html body .panel-grid.task-log-only .task-log-status-button,
html body .panel-grid.task-log-only .task-log-status-result {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 30px;
  padding: 0;
  color: #75c69e;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

html body .panel-grid.task-log-only .task-log-status-button {
  cursor: pointer;
}

html body .panel-grid.task-log-only .task-log-status-button:hover {
  color: #b4ebcb;
}

html body .panel-grid.task-log-only .task-log-status-result.failed {
  color: #de7d77;
}

html body .panel-grid.task-log-only .task-log-status-result:not(.failed) {
  color: #caa866;
}

html body .panel-grid.task-log-only .task-log-status-button svg,
html body .panel-grid.task-log-only .task-log-status-result svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.25;
}

html body .lightbox-media {
  display: grid;
  place-items: center;
  min-width: min(52vw, 760px);
  min-height: min(52vh, 620px);
}

html body .lightbox-media video,
html body .lightbox-media audio {
  display: block;
  max-width: min(1040px, calc(96vw - 300px));
  max-height: 84vh;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .38);
}

html body .lightbox-media audio {
  width: min(700px, 58vw);
}

@media (max-width: 820px) {
  html body .lightbox-media {
    min-width: 0;
    min-height: 34vh;
    width: 100%;
  }

  html body .lightbox-media video,
  html body .lightbox-media audio {
    max-width: 100%;
  }

  html body .lightbox-media audio {
    width: 100%;
  }
}

/* Keep the simplified task log grid as the final cascade rule. */
html body .panel-grid.task-log-only .task-log-table {
  --task-log-columns: minmax(88px, .8fr) minmax(118px, 1.05fr) minmax(170px, 1.7fr) minmax(76px, .72fr) minmax(92px, .9fr) minmax(112px, 1fr) !important;
  min-width: 780px !important;
}

html body .panel-grid.task-log-only .task-log-table-head,
html body .panel-grid.task-log-only .task-log-card.task-log-row {
  grid-template-columns: var(--task-log-columns) !important;
}

/* Final task-log layout contract: six visible columns, with no legacy filters. */
html body .panel-grid.task-log-only .task-log-filters {
  display: none !important;
}

html body .panel-grid.task-log-only .task-log-table {
  --task-log-columns: minmax(88px, .8fr) minmax(118px, 1.05fr) minmax(170px, 1.7fr) minmax(76px, .72fr) minmax(92px, .9fr) minmax(112px, 1fr) !important;
  min-width: 780px !important;
}

html body .panel-grid.task-log-only .task-log-table-head,
html body .panel-grid.task-log-only .task-log-card.task-log-row {
  grid-template-columns: var(--task-log-columns) !important;
}

/* Task log categories and the simplified six-column desktop table. */
html body .panel-grid.task-log-only .task-log-categories {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
  border-bottom: 1px solid #29322f;
}

html body .panel-grid.task-log-only .task-log-category {
  position: relative;
  min-width: 72px;
  min-height: 38px;
  padding: 0 14px;
  color: #7f8b86;
  border: 0;
  border-radius: 6px 6px 0 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

html body .panel-grid.task-log-only .task-log-category:hover {
  color: #dce5e1;
  background: #151b18;
}

html body .panel-grid.task-log-only .task-log-category.active {
  color: #e7f1ec;
  background: #151b18;
}

html body .panel-grid.task-log-only .task-log-category.active::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: #8fbba6;
  content: "";
}

html body .panel-grid.task-log-only .task-log-table {
  --task-log-columns: minmax(88px, .8fr) minmax(118px, 1.05fr) minmax(170px, 1.7fr) minmax(76px, .72fr) minmax(92px, .9fr) minmax(112px, 1fr);
  min-width: 780px;
}

html body .panel-grid.task-log-only .task-log-table-head,
html body .panel-grid.task-log-only .task-log-row,
html body .panel-grid.task-log-only .task-log-card.task-log-row {
  grid-template-columns: var(--task-log-columns) !important;
}

html body .panel-grid.task-log-only .task-log-type-mark.type-voice {
  background: #83a7b7;
}

/* Final mobile pass: remove desktop-only canvas and secondary actions from the phone shell. */
@media (max-width: 720px) {
  html body .app-shell > .sidebar .module-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  html body .app-shell > .sidebar .nav-item[data-panel="workflow"],
  html body .home-launch-workflow {
    display: none !important;
  }

  html body .topbar-actions .wechat-contact,
  html body .topbar-actions .referral-entry-button,
  html body .topbar-actions .wechat-contact-button,
  html body .topbar-actions .referral-entry-button {
    display: none !important;
  }

  html body .topbar-actions {
    gap: 6px !important;
  }
}

@media (max-width: 820px) {
  html body .panel-grid.task-log-only .task-log-categories {
    overflow-x: auto;
    margin-right: -16px;
    margin-left: -16px;
    padding: 0 16px;
  }

  html body .panel-grid.task-log-only .task-log-category {
    flex: 0 0 auto;
  }
}

html body .panel-grid.task-log-only .task-log-card.task-log-row > .task-log-cell {
  min-width: 0 !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

/* Final task-log table overrides: the log page no longer uses legacy result-card chrome. */
html body .panel-grid.task-log-only {
  min-width: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body .panel-grid.task-log-only .creator-surface,
html body .panel-grid.task-log-only #tasklog-panel,
html body .panel-grid.task-log-only .task-log-page,
html body .panel-grid.task-log-only .task-log-list {
  min-width: 0 !important;
  width: 100% !important;
  max-width: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body .panel-grid.task-log-only .task-log-page {
  display: block !important;
  margin: 0 !important;
  padding: 28px 30px 22px !important;
}

html body .panel-grid.task-log-only .task-log-titlebar {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 24px !important;
  margin: 0 0 22px !important;
}

html body .panel-grid.task-log-only .task-log-titlebar h3 {
  margin: 0 0 7px !important;
  color: #f1f5f3 !important;
  font-size: 22px !important;
  line-height: 1.2 !important;
}

html body .panel-grid.task-log-only .task-log-titlebar p {
  max-width: 760px !important;
  margin: 0 !important;
  color: #8c9994 !important;
  font-size: 12px !important;
  line-height: 1.6 !important;
}

html body .panel-grid.task-log-only .task-log-title-actions,
html body .panel-grid.task-log-only .task-log-pagination,
html body .panel-grid.task-log-only .task-log-row-actions {
  display: flex !important;
  align-items: center !important;
}

html body .panel-grid.task-log-only .task-log-title-actions {
  flex: 0 0 auto !important;
  gap: 8px !important;
}

html body .panel-grid.task-log-only .task-log-title-actions .icon-button,
html body .panel-grid.task-log-only .task-log-pagination .icon-button {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  color: #aab5b0 !important;
  border: 1px solid #2b3531 !important;
  border-radius: 7px !important;
  background: #151b18 !important;
  box-shadow: none !important;
}

html body .panel-grid.task-log-only .task-log-table-shell {
  min-width: 0 !important;
  overflow-x: auto !important;
}

html body .panel-grid.task-log-only .task-log-filters {
  display: grid !important;
  grid-template-columns: minmax(240px, 1fr) repeat(4, minmax(130px, 156px)) !important;
  align-items: end !important;
  gap: 10px !important;
  margin: 0 0 14px !important;
}

html body .panel-grid.task-log-only .task-log-filters input,
html body .panel-grid.task-log-only .task-log-filters select {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 36px !important;
  padding: 0 11px !important;
  color: #dbe5e1 !important;
  border: 1px solid #2b3531 !important;
  border-radius: 7px !important;
  outline: 0 !important;
  background: #151b18 !important;
  font: inherit !important;
  font-size: 12px !important;
}

html body .panel-grid.task-log-only .task-log-table {
  --task-log-columns: minmax(140px, 1.2fr) minmax(142px, 1.08fr) minmax(70px, .62fr) minmax(126px, 1.08fr) minmax(64px, .58fr) minmax(144px, 1.28fr) minmax(68px, .62fr) minmax(88px, .78fr) minmax(100px, .9fr) !important;
  min-width: 1080px !important;
  overflow: hidden !important;
  border-top: 1px solid #29322f !important;
  border-bottom: 1px solid #29322f !important;
}

html body .panel-grid.task-log-only .task-log-table-head,
html body .panel-grid.task-log-only .task-log-row {
  display: grid !important;
  grid-template-columns: var(--task-log-columns) !important;
  align-items: center !important;
}

html body .panel-grid.task-log-only .task-log-table-head {
  min-height: 38px !important;
  padding: 0 14px !important;
  color: #7f8b86 !important;
  background: #111714 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

html body .panel-grid.task-log-only .task-log-row,
html body .panel-grid.task-log-only .task-log-card.task-log-row {
  display: grid !important;
  grid-template-rows: none !important;
  min-height: 54px !important;
  height: 54px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  color: #dce5e1 !important;
  border: 0 !important;
  border-top: 1px solid #252e2b !important;
  border-radius: 0 !important;
  background: #151b18 !important;
  box-shadow: none !important;
  font-size: 12px !important;
}

html body .panel-grid.task-log-only .task-log-card .result-preview,
html body .panel-grid.task-log-only .task-log-card .task-log-preview,
html body .panel-grid.task-log-only .task-log-card .result-meta,
html body .panel-grid.task-log-only .task-log-card .task-log-details {
  display: none !important;
}

html body .panel-grid.task-log-only .task-log-cell {
  min-width: 0 !important;
  overflow: hidden !important;
  padding-right: 14px !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

html body .panel-grid.task-log-only .task-log-key,
html body .panel-grid.task-log-only .task-log-model,
html body .panel-grid.task-log-only .task-log-type,
html body .panel-grid.task-log-only .task-log-status {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
}

html body .panel-grid.task-log-only .task-log-key svg,
html body .panel-grid.task-log-only .task-log-model svg {
  flex: 0 0 auto !important;
  width: 14px !important;
  height: 14px !important;
  color: #71817a !important;
}

html body .panel-grid.task-log-only .task-log-key > span,
html body .panel-grid.task-log-only .task-log-model > span,
html body .panel-grid.task-log-only .task-log-status > span:last-child {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

html body .panel-grid.task-log-only .task-log-time,
html body .panel-grid.task-log-only .task-log-duration {
  color: #aab6b1 !important;
}

html body .panel-grid.task-log-only .task-log-task-id {
  display: block !important;
  overflow: hidden !important;
  color: #a9c7bc !important;
  font-family: Consolas, "SFMono-Regular", monospace !important;
  font-size: 11px !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .panel-grid.task-log-only .task-log-type-mark,
html body .panel-grid.task-log-only .task-log-status-dot {
  flex: 0 0 auto !important;
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  background: #7d8b85 !important;
}

html body .panel-grid.task-log-only .task-log-type-mark.type-image { background: #7cae9b !important; }
html body .panel-grid.task-log-only .task-log-type-mark.type-video { background: #a08fc0 !important; }
html body .panel-grid.task-log-only .task-log-type-mark.type-music { background: #c39e75 !important; }
html body .panel-grid.task-log-only .status-completed .task-log-status-dot { background: #70c09c !important; }
html body .panel-grid.task-log-only .status-processing .task-log-status-dot,
html body .panel-grid.task-log-only .status-submitting .task-log-status-dot,
html body .panel-grid.task-log-only .status-queued .task-log-status-dot { background: #d2ad67 !important; }
html body .panel-grid.task-log-only .status-failed .task-log-status-dot { background: #d77f72 !important; }

html body .panel-grid.task-log-only .task-log-row-actions {
  justify-content: flex-start !important;
  gap: 4px !important;
  padding-right: 0 !important;
}

html body .panel-grid.task-log-only .task-log-action {
  display: inline-grid !important;
  place-items: center !important;
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  color: #8c9b94 !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  text-decoration: none !important;
  cursor: pointer !important;
}

html body .panel-grid.task-log-only .task-log-action:hover {
  color: #e5efeb !important;
  background: #25312b !important;
}

html body .panel-grid.task-log-only .task-log-table-empty {
  display: grid !important;
  place-items: center !important;
  gap: 9px !important;
  min-height: 210px !important;
  color: #74817b !important;
  background: #151b18 !important;
  font-size: 12px !important;
}

html body .panel-grid.task-log-only .task-log-pagination {
  justify-content: flex-end !important;
  gap: 12px !important;
  min-height: 52px !important;
  color: #7f8b86 !important;
  font-size: 11px !important;
}

@media (max-width: 820px) {
  html body .panel-grid.task-log-only .task-log-page {
    padding: 20px 16px 16px !important;
  }

  html body .panel-grid.task-log-only .task-log-titlebar {
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 14px !important;
    margin-bottom: 18px !important;
  }

  html body .panel-grid.task-log-only .task-log-title-actions {
    justify-content: flex-end !important;
  }

  html body .panel-grid.task-log-only .task-log-filters {
    grid-template-columns: 1fr 1fr !important;
  }

  html body .panel-grid.task-log-only .task-log-search-field {
    grid-column: 1 / -1 !important;
  }

  html body .panel-grid.task-log-only .task-log-table-shell {
    margin-inline: -16px !important;
    padding-inline: 16px !important;
  }
}

/* The homepage artwork needs one consistent dark veil across the full viewport. */
html body:has(#home-panel.active)::before {
  background: rgba(5, 8, 10, 0.58);
}

html body:has(#home-panel.active) .app-shell > .sidebar,
html body:has(#home-panel.active) .workspace,
html body:has(#home-panel.active) .panel-grid,
html body:has(#home-panel.active) .creator-surface,
html body:has(#home-panel.active) .topbar {
  background-color: transparent !important;
  background-image: none !important;
}

/* Extend the homepage veil over the shell so the artwork reads as one full-screen surface. */
html body:has(#home-panel.active) .app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(5, 8, 10, 0.22);
}

html body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.52;
  background-image: radial-gradient(circle, rgba(187, 255, 235, 0.42) 0 1px, transparent 1.35px);
  background-size: 22px 22px;
  background-position: 0 0;
  animation: site-dot-drift 32s linear infinite;
}

html body .app-shell {
  position: relative;
  z-index: 1;
}

html body .home-background-layer {
  display: none !important;
  background-image: none !important;
  animation: none !important;
}

/* Keep one viewport background surface. The old home pseudo-layer duplicated the
   same artwork and forced an extra composited fixed layer on mobile. */
html body:has(#home-panel.active)::before {
  background: transparent !important;
  background-image: none !important;
  animation: none !important;
}

@media (min-width: 821px) {
  html body {
    background-attachment: fixed !important;
  }
}

/* Keep the three account actions aligned with the homepage header on every desktop page. */
@media (min-width: 821px) {
  html body .topbar {
    position: relative;
    min-height: 64px !important;
    height: 64px !important;
    padding: 0 2px !important;
  }

  html body .topbar-actions {
    position: fixed !important;
    top: 30px;
    right: 30px;
    display: inline-flex !important;
    align-items: center;
    gap: 6px !important;
    margin: 0 !important;
    height: 34px;
  }

  /* Keep the desktop account actions on the same header baseline as home. */
  html body .topbar-actions,
  html body .topbar-actions .wechat-contact-button,
  html body .topbar-actions .referral-entry-button,
  html body .topbar-actions .topbar-credit-button {
    transform: none !important;
  }

  /* Align the assistant collapse control with the first history label. */
  html body .panel-grid.chat-only .chat-history-collapse {
    top: 40px !important;
  }

  html body .panel-grid.chat-only.chat-history-collapsed .chat-history-collapse {
    top: 40px !important;
  }

  html body .topbar-actions .wechat-contact-button,
  html body .topbar-actions .referral-entry-button,
  html body .topbar-actions .topbar-credit-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 0;
    box-sizing: border-box;
    flex: 0 0 auto;
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  html body .topbar-actions .wechat-contact-button {
    width: 102px;
  }

  html body .topbar-actions .referral-entry-button {
    width: 102px;
  }

html body .topbar-actions .topbar-credit-button {
    width: 76px;
  }

  /* Keep the account actions above every desktop page surface and veil. */
  html body .topbar {
    z-index: 50;
  }

  html body .topbar-actions {
    z-index: 60;
  }

  html body .topbar-actions .wechat-contact {
    position: relative;
    z-index: 61;
  }

  html body .topbar-actions .wechat-contact-popover {
    z-index: 62;
  }

  html body:has(.panel-grid.generation-mode) .topbar > div:first-child,
  html body:has(.panel-grid.result-first) .topbar > div:first-child {
    padding-right: 300px;
  }

  html body:has(.panel-grid.generation-mode) .generation-tabs,
  html body:has(.panel-grid.result-first) .generation-tabs {
    padding-right: 300px;
  }

html body:has(.panel-grid.generation-mode) .creator-surface,
html body:has(.panel-grid.result-first) .creator-surface {
  padding-top: 18px;
}

/* The generation pages do not need the assistant history collapse control. */
html body:has(.panel-grid.generation-mode) .chat-history-collapse,
html body:has(.panel-grid.result-first) .chat-history-collapse {
  display: none !important;
}
}

/* Generation results use a recent-gallery layout on desktop. */
@media (min-width: 1121px) {
  html body .panel-grid.generation-mode .result-rail[data-layout="history"],
  html body .panel-grid.result-first .result-rail[data-layout="history"] {
    padding: 0 22px 18px;
  }

  html body .panel-grid.generation-mode .result-rail[data-layout="history"] .result-list,
  html body .panel-grid.result-first .result-rail[data-layout="history"] .result-list {
    height: calc(100% - 58px);
    padding: 0 0 26px;
  }

  html body .result-rail[data-layout="history"] .result-history-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
  }

  html body .result-rail[data-layout="history"] .result-history-item {
    position: relative;
    display: block;
    align-self: start;
    min-width: 0;
    padding: 0;
    border: 1px solid rgba(238, 244, 241, 0.08);
    border-radius: 8px;
    background: rgba(20, 25, 23, 0.7);
    overflow: hidden;
  }

  html body .result-rail[data-layout="history"] .result-history-head {
    display: none;
  }

  html body .result-rail[data-layout="history"] .result-history-title {
    gap: 6px;
  }

  html body .result-rail[data-layout="history"] .result-history-title > svg {
    width: 15px;
    height: 15px;
  }

  html body .result-rail[data-layout="history"] .result-history-title > strong,
  html body .result-rail[data-layout="history"] .result-history-title > small,
  html body .result-rail[data-layout="history"] .result-history-title > em,
  html body .result-rail[data-layout="history"] .result-history-head > time {
    display: none;
  }

  html body .result-rail[data-layout="history"] .result-history-title > span {
    font-size: 11px;
  }

  html body .result-rail[data-layout="history"] .result-history-preview {
    aspect-ratio: 1 / 1;
    margin: 0;
    overflow: hidden;
    background: #111513;
  }

  html body .result-rail[data-layout="history"] .result-history-preview img,
  html body .result-rail[data-layout="history"] .result-history-preview video {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    object-fit: cover;
  }

  html body .result-rail[data-layout="history"] .result-history-placeholder {
    width: 100%;
    min-height: 0;
    height: 100%;
    padding: 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  html body .result-rail[data-layout="history"] .result-history-actions {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 2;
    justify-content: flex-end;
    gap: 4px;
    margin: 0;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(8, 12, 11, 0.78);
    backdrop-filter: blur(8px);
  }

  html body .result-rail[data-layout="history"] .result-history-actions button {
    width: 28px;
    min-height: 28px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
  }

  html body .result-rail[data-layout="history"] .result-history-actions button span {
    display: none;
  }

  html body .result-rail[data-layout="history"] .result-history-actions svg {
    width: 14px;
    height: 14px;
  }
}

/* Dense task-log table: keep the log readable without the legacy result-card chrome. */
html body .panel-grid.task-log-only {
  min-width: 0;
  overflow: hidden;
}

html body .panel-grid.task-log-only #tasklog-panel,
html body .panel-grid.task-log-only .task-log-page,
html body .panel-grid.task-log-only .task-log-list {
  min-width: 0;
  width: 100%;
  max-width: none;
}

html body .panel-grid.task-log-only .task-log-page {
  display: block;
  margin: 0;
  padding: 28px 30px 22px;
}

html body .panel-grid.task-log-only .task-log-list {
  display: block;
}

html body .panel-grid.task-log-only .task-log-titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 22px;
}

html body .panel-grid.task-log-only .task-log-titlebar h3 {
  margin: 0 0 7px;
  color: #f1f5f3;
  font-size: 22px;
  line-height: 1.2;
}

html body .panel-grid.task-log-only .task-log-titlebar p {
  max-width: 760px;
  margin: 0;
  color: #8c9994;
  font-size: 12px;
  line-height: 1.6;
}

html body .panel-grid.task-log-only .task-log-title-actions,
html body .panel-grid.task-log-only .task-log-pagination,
html body .panel-grid.task-log-only .task-log-row-actions {
  display: flex;
  align-items: center;
}

html body .panel-grid.task-log-only .task-log-title-actions {
  flex: 0 0 auto;
  gap: 8px;
}

html body .panel-grid.task-log-only .task-log-title-actions .icon-button,
html body .panel-grid.task-log-only .task-log-pagination .icon-button {
  width: 32px;
  height: 32px;
  color: #aab5b0;
  border: 1px solid #2b3531;
  border-radius: 7px;
  background: #151b18;
  box-shadow: none;
}

html body .panel-grid.task-log-only .task-log-title-actions .icon-button:hover,
html body .panel-grid.task-log-only .task-log-pagination .icon-button:hover:not(:disabled) {
  color: #eaf2ef;
  border-color: #3b4a44;
  background: #1c2521;
}

html body .panel-grid.task-log-only .task-log-title-actions .icon-button.is-refreshing svg {
  animation: result-history-spin 900ms linear infinite;
}

html body .panel-grid.task-log-only .task-log-table-shell {
  min-width: 0;
}

html body .panel-grid.task-log-only .task-log-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(4, minmax(130px, 156px));
  align-items: end;
  gap: 10px;
  margin: 0 0 14px;
}

html body .panel-grid.task-log-only .task-log-filters label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

html body .panel-grid.task-log-only .task-log-filters label > span {
  color: #7f8b86;
  font-size: 11px;
  font-weight: 700;
}

html body .panel-grid.task-log-only .task-log-search-field {
  position: relative;
}

html body .panel-grid.task-log-only .task-log-search-field > svg {
  position: absolute;
  left: 11px;
  bottom: 10px;
  width: 15px;
  height: 15px;
  color: #6f7b76;
  pointer-events: none;
}

html body .panel-grid.task-log-only .task-log-filters input,
html body .panel-grid.task-log-only .task-log-filters select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 0 11px;
  color: #dbe5e1;
  border: 1px solid #2b3531;
  border-radius: 7px;
  outline: 0;
  background: #151b18;
  font: inherit;
  font-size: 12px;
}

html body .panel-grid.task-log-only .task-log-search-field input {
  padding-left: 34px;
}

html body .panel-grid.task-log-only .task-log-filters input::placeholder {
  color: #68746f;
}

html body .panel-grid.task-log-only .task-log-filters input:focus,
html body .panel-grid.task-log-only .task-log-filters select:focus {
  border-color: #4a665d;
  box-shadow: 0 0 0 2px rgba(92, 137, 119, .16);
}

html body .panel-grid.task-log-only .task-log-table {
  --task-log-columns: minmax(140px, 1.2fr) minmax(142px, 1.08fr) minmax(70px, .62fr) minmax(126px, 1.08fr) minmax(64px, .58fr) minmax(144px, 1.28fr) minmax(68px, .62fr) minmax(88px, .78fr) minmax(100px, .9fr);
  min-width: 1080px;
  overflow: hidden;
  border-top: 1px solid #29322f;
  border-bottom: 1px solid #29322f;
}

html body .panel-grid.task-log-only .task-log-table-head,
html body .panel-grid.task-log-only .task-log-row {
  display: grid;
  grid-template-columns: var(--task-log-columns);
  align-items: center;
}

html body .panel-grid.task-log-only .task-log-table-head {
  min-height: 38px;
  padding: 0 14px;
  color: #7f8b86;
  background: #111714;
  font-size: 11px;
  font-weight: 700;
}

html body .panel-grid.task-log-only .task-log-row {
  min-height: 54px;
  padding: 0 14px;
  color: #dce5e1;
  border-top: 1px solid #252e2b;
  background: #151b18;
  font-size: 12px;
  transition: background-color 140ms ease;
}

html body .panel-grid.task-log-only .task-log-row:hover {
  background: #1a231f;
}

html body .panel-grid.task-log-only .task-log-cell {
  min-width: 0;
  overflow: hidden;
  padding-right: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

html body .panel-grid.task-log-only .task-log-key,
html body .panel-grid.task-log-only .task-log-model,
html body .panel-grid.task-log-only .task-log-type,
html body .panel-grid.task-log-only .task-log-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

html body .panel-grid.task-log-only .task-log-key svg,
html body .panel-grid.task-log-only .task-log-model svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: #71817a;
}

html body .panel-grid.task-log-only .task-log-key > span,
html body .panel-grid.task-log-only .task-log-model > span,
html body .panel-grid.task-log-only .task-log-status > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

html body .panel-grid.task-log-only .task-log-time,
html body .panel-grid.task-log-only .task-log-duration {
  color: #aab6b1;
}

html body .panel-grid.task-log-only .task-log-task-id {
  display: block;
  overflow: hidden;
  color: #a9c7bc;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body .panel-grid.task-log-only .task-log-price {
  color: #c8d5cf;
  font-variant-numeric: tabular-nums;
}

html body .panel-grid.task-log-only .task-log-type-mark,
html body .panel-grid.task-log-only .task-log-status-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7d8b85;
}

html body .panel-grid.task-log-only .task-log-type-mark.type-image { background: #7cae9b; }
html body .panel-grid.task-log-only .task-log-type-mark.type-video { background: #a08fc0; }
html body .panel-grid.task-log-only .task-log-type-mark.type-music { background: #c39e75; }
html body .panel-grid.task-log-only .task-log-source {
  flex: 0 0 auto;
  padding: 1px 5px;
  color: #9ed7c0;
  font-size: 10px;
  line-height: 16px;
  border: 1px solid rgba(112, 192, 156, .28);
  border-radius: 4px;
  background: rgba(112, 192, 156, .08);
}
html body .panel-grid.task-log-only .task-log-status-dot { background: #7d8b85; }
html body .panel-grid.task-log-only .status-completed .task-log-status-dot { background: #70c09c; }
html body .panel-grid.task-log-only .status-processing .task-log-status-dot,
html body .panel-grid.task-log-only .status-submitting .task-log-status-dot,
html body .panel-grid.task-log-only .status-queued .task-log-status-dot { background: #d2ad67; }
html body .panel-grid.task-log-only .status-failed .task-log-status-dot { background: #d77f72; }

html body .panel-grid.task-log-only .task-log-row-actions {
  justify-content: flex-start;
  gap: 4px;
  padding-right: 0;
}

html body .panel-grid.task-log-only .task-log-action {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: #8c9b94;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}

html body .panel-grid.task-log-only .task-log-action:hover {
  color: #e5efeb;
  background: #25312b;
}

html body .panel-grid.task-log-only .task-log-action svg {
  width: 15px;
  height: 15px;
}

html body .panel-grid.task-log-only .task-log-table-empty {
  display: grid;
  place-items: center;
  gap: 9px;
  min-height: 210px;
  color: #74817b;
  background: #151b18;
  font-size: 12px;
}

html body .panel-grid.task-log-only .task-log-table-empty svg {
  width: 23px;
  height: 23px;
  color: #596760;
}

html body .panel-grid.task-log-only .task-log-pagination {
  justify-content: flex-end;
  gap: 12px;
  min-height: 52px;
  color: #7f8b86;
  font-size: 11px;
}

html body .panel-grid.task-log-only .task-log-pagination .task-log-page-status {
  margin-right: 4px;
  color: #aab6b1;
}

html body .panel-grid.task-log-only .task-log-pagination .icon-button:disabled {
  color: #4d5953;
  cursor: not-allowed;
  opacity: 1;
}

@media (max-width: 820px) {
  html body .panel-grid.task-log-only .task-log-page {
    padding: 20px 16px 16px;
  }

  html body .panel-grid.task-log-only .task-log-titlebar {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
  }

  html body .panel-grid.task-log-only .task-log-title-actions {
    justify-content: flex-end;
  }

  html body .panel-grid.task-log-only .task-log-filters {
    grid-template-columns: 1fr 1fr;
  }

  html body .panel-grid.task-log-only .task-log-search-field {
    grid-column: 1 / -1;
  }

  html body .panel-grid.task-log-only .task-log-table-shell {
    overflow-x: auto;
    margin-inline: -16px;
    padding-inline: 16px;
  }
}

@media (min-width: 821px) and (max-width: 1120px) {
  html body .result-rail[data-layout="history"] .result-history-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-content: start;
  }

  html body .result-rail[data-layout="history"] .result-history-item {
    position: relative;
    display: block;
    align-self: start;
    padding: 0;
    border: 1px solid rgba(238, 244, 241, 0.08);
    border-radius: 8px;
    background: rgba(20, 25, 23, 0.7);
    overflow: hidden;
  }

  html body .result-rail[data-layout="history"] .result-history-preview {
    aspect-ratio: 1 / 1;
    margin: 0;
    overflow: hidden;
  }

  html body .result-rail[data-layout="history"] .result-history-preview img,
  html body .result-rail[data-layout="history"] .result-history-preview video {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
  }

  html body .result-rail[data-layout="history"] .result-history-head {
    display: none;
  }

  html body .result-rail[data-layout="history"] .result-history-actions {
    position: absolute;
    right: 5px;
    bottom: 5px;
    z-index: 2;
    gap: 3px;
    margin: 0;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 7px;
    background: rgba(8, 12, 11, 0.78);
  }

  html body .result-rail[data-layout="history"] .result-history-actions button {
    width: 26px;
    min-height: 26px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  html body .result-rail[data-layout="history"] .result-history-actions button span {
    display: none;
  }
}

@media (max-width: 820px) {
  html body .result-rail[data-layout="history"] .result-history-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-content: start;
  }

  html body .result-rail[data-layout="history"] .result-history-item {
    position: relative;
    display: block;
    align-self: start;
    padding: 0;
    border: 1px solid rgba(238, 244, 241, 0.08);
    border-radius: 8px;
    overflow: hidden;
  }

  html body .result-rail[data-layout="history"] .result-history-preview {
    aspect-ratio: 1 / 1;
    margin: 0;
    overflow: hidden;
  }

  html body .result-rail[data-layout="history"] .result-history-preview img,
  html body .result-rail[data-layout="history"] .result-history-preview video {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
  }

  html body .result-rail[data-layout="history"] .result-history-head {
    display: none;
  }

  html body .result-rail[data-layout="history"] .result-history-actions {
    position: absolute;
    right: 5px;
    bottom: 5px;
    z-index: 2;
    gap: 3px;
    margin: 0;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 7px;
    background: rgba(8, 12, 11, 0.78);
  }

  html body .result-rail[data-layout="history"] .result-history-actions button {
    width: 26px;
    min-height: 26px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  html body .result-rail[data-layout="history"] .result-history-actions button span {
    display: none;
  }
}

/* The assistant uses the same full-viewport artwork and veil as the homepage. */
html body:has(#chat-panel.active) .app-shell > .sidebar,
html body:has(#chat-panel.active) .workspace,
html body:has(#chat-panel.active) .topbar,
html body:has(#chat-panel.active) .panel-grid.chat-only,
html body:has(#chat-panel.active) .panel-grid.chat-only .creator-surface,
html body:has(#chat-panel.active) .panel-grid.chat-only .result-rail,
html body:has(#chat-panel.active) .panel-grid.chat-only .rail-header,
html body:has(#chat-panel.active) .panel-grid.chat-only .result-list,
html body:has(#chat-panel.active) #chat-panel.panel.active {
  background-color: transparent !important;
  background-image: none !important;
}

html body:has(#chat-panel.active) .app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(5, 8, 10, 0.8);
}

/* Keep the assistant content and controls above its background-only veil. */
html body:has(#chat-panel.active) .workspace {
  position: relative;
  z-index: 2;
}

/* Apply the same background treatment to generation, workflow, and creation pages. */
html body:not(:has(#home-panel.active)):not(:has(#chat-panel.active)) .app-shell > .sidebar,
html body:not(:has(#home-panel.active)):not(:has(#chat-panel.active)) .workspace,
html body:not(:has(#home-panel.active)):not(:has(#chat-panel.active)) .topbar,
html body:not(:has(#home-panel.active)):not(:has(#chat-panel.active)) .panel-grid,
html body:not(:has(#home-panel.active)):not(:has(#chat-panel.active)) .creator-surface,
html body:not(:has(#home-panel.active)):not(:has(#chat-panel.active)) .result-rail {
  background-color: transparent !important;
  background-image: none !important;
}

html body:not(:has(#home-panel.active)):not(:has(#chat-panel.active)) .app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(5, 8, 10, 0.8);
}

html body:not(:has(#home-panel.active)):not(:has(#chat-panel.active)) .workspace {
  position: relative;
  z-index: 2;
}

/* Match the homepage's full-viewport darkness on the assistant page. */
html body:has(#chat-panel.active)::before {
  background: rgba(5, 8, 10, 0.58);
}

html body:has(#chat-panel.active) .chat-history-card:hover,
html body:has(#chat-panel.active) .chat-history-card.active {
  background: rgba(28, 35, 31, 0.78) !important;
}

/* Give the transparent desktop history card a small top inset. */
@media (min-width: 821px) {
  html body:has(#chat-panel.active) .panel-grid.chat-only .result-rail {
    margin-top: 14px !important;
    height: calc(100% - 14px) !important;
    align-self: start;
  }
}

/* Keep the desktop AI generation controls on an opaque card. */
@media (min-width: 821px) {
  html body .panel-grid.generation-mode .creator-surface,
  html body .panel-grid.result-first .creator-surface,
  html body .panel-grid.generation-mode .creator-surface > .panel.active,
  html body .panel-grid.result-first .creator-surface > .panel.active {
    background: #0D100F !important;
    background-color: #0D100F !important;
    background-image: none !important;
  }

  html body .panel-grid.generation-mode .creator-surface,
  html body .panel-grid.result-first .creator-surface {
    border: 0 !important;
    border-radius: 24px !important;
    overflow: hidden;
  }

  /* Match the shared non-home page selector so the outer edge is opaque too. */
  html body:not(:has(#home-panel.active)):not(:has(#chat-panel.active)) .panel-grid.generation-mode .creator-surface,
  html body:not(:has(#home-panel.active)):not(:has(#chat-panel.active)) .panel-grid.result-first .creator-surface {
    background: #0D100F !important;
    background-color: #0D100F !important;
    background-image: none !important;
  }

  /* Lower the full AI generation control card while keeping its bottom edge stable. */
  html body .panel-grid.generation-mode .creator-surface,
  html body .panel-grid.result-first .creator-surface {
    margin-top: 16px !important;
    height: calc(100% - 16px) !important;
    align-self: start;
  }

}

/* Final mobile pass: remove desktop-only canvas and secondary actions from the phone shell. */
@media (max-width: 720px) {
  html body .app-shell > .sidebar .module-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  html body .app-shell > .sidebar .nav-item[data-panel="workflow"],
  html body .home-launch-workflow {
    display: none !important;
  }

  html body .topbar-actions .wechat-contact,
  html body .topbar-actions .referral-entry-button,
  html body .topbar-actions .wechat-contact-button,
  html body .topbar-actions .referral-entry-button {
    display: none !important;
  }

  html body .topbar-actions {
    gap: 6px !important;
  }
}

/* Keep task-log rows in the compact table layout after all page theme rules. */
html body .panel-grid.task-log-only .task-log-card.task-log-row {
  display: grid !important;
  grid-template-columns: var(--task-log-columns) !important;
  grid-template-rows: none !important;
  min-height: 54px !important;
  height: 54px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-top: 1px solid #252e2b !important;
  border-radius: 0 !important;
  background: #151b18 !important;
  box-shadow: none !important;
}

html body .panel-grid.task-log-only .task-log-card.task-log-row > .result-preview,
html body .panel-grid.task-log-only .task-log-card.task-log-row > .result-meta,
html body .panel-grid.task-log-only .task-log-card.task-log-row > .task-log-details {
  display: none !important;
}

/* Final cascade override for the simplified five-column task log. */
html body .panel-grid.task-log-only .task-log-table {
  --task-log-columns: minmax(88px, .8fr) minmax(118px, 1.05fr) minmax(190px, 1.8fr) minmax(76px, .72fr) minmax(128px, 1.2fr) !important;
  min-width: 660px !important;
}

html body .panel-grid.task-log-only .task-log-table-head,
html body .panel-grid.task-log-only .task-log-card.task-log-row {
  grid-template-columns: var(--task-log-columns) !important;
}
