:root {
  --bg: #fbfbfa;
  --panel: #ffffff;
  --panel-soft: #f8f8f6;
  --ink: #161713;
  --muted: #7b7b76;
  --soft: #a6a49e;
  --line: #ebe8e2;
  --line-strong: #dedad2;
  --black: #151515;
  --green: #164a3f;
  --gold: #eac274;
  --gold-soft: #f7dd9c;
  --shadow: 0 16px 40px rgba(18, 18, 15, 0.06);
  --shadow-strong: 0 22px 58px rgba(18, 18, 15, 0.1);
  --radius: 8px;
  --workspace-gutter-left: 72px;
  --workspace-gutter-right: 64px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

.icon-sprite {
  height: 0;
  left: -9999px;
  overflow: hidden;
  position: absolute;
  top: -9999px;
  width: 0;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-width: 1180px;
}

body {
  background: var(--bg);
  color: var(--ink);
  margin: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(22, 74, 63, 0.14);
  outline-offset: 2px;
}

.desktop-app {
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 8%, rgba(235, 210, 169, 0.16), transparent 28rem),
    linear-gradient(180deg, #ffffff 0%, #fbfbfa 44%, #f8f7f4 100%);
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 80px;
  justify-content: space-between;
  padding: 0 44px 0 38px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  color: var(--ink);
  display: flex;
  gap: 0;
  min-width: 520px;
  text-decoration: none;
}

.brand-lockup {
  height: 58px;
  object-fit: contain;
  object-position: left center;
  width: calc(276px - 38px);
}

.brand-copy {
  align-items: center;
  display: flex;
  min-height: 30px;
  padding-left: 56px;
  position: relative;
}

.brand-copy::before {
  background: #d8d4cc;
  border-radius: 999px;
  content: "";
  height: 34px;
  left: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
}

.brand small {
  color: #7d7a73;
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.account {
  align-items: center;
  display: flex;
  gap: 14px;
}

.balance {
  align-items: center;
  color: #3f3d38;
  display: inline-flex;
  font-size: 15px;
  font-weight: 720;
  gap: 5px;
}

.balance i,
.balance::after {
  background: var(--gold);
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 12px;
  width: 12px;
}

.balance i {
  height: 10px;
  width: 10px;
}

.recharge-btn {
  background: #efc86f;
  border: 0;
  border-radius: 7px;
  box-shadow: 0 10px 20px rgba(207, 166, 88, 0.18);
  color: #332315;
  font-size: 15px;
  font-weight: 760;
  height: 44px;
  min-width: 82px;
  transition:
    transform 0.16s ease,
    filter 0.16s ease;
}

.recharge-btn:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
}

.avatar {
  background: transparent;
  border: 0;
  border-radius: 999px;
  height: 44px;
  overflow: hidden;
  padding: 0;
  width: 44px;
}

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

.chevron {
  background: transparent;
  border: 0;
  color: #222;
  font-size: 21px;
  height: 32px;
  width: 28px;
}

.layout {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: calc(100vh - 80px);
  transition: grid-template-columns 0.22s ease;
}

.desktop-app.is-rail-collapsed .layout {
  grid-template-columns: 92px minmax(0, 1fr);
}

.side-rail {
  background: rgba(250, 250, 249, 0.86);
  border-right: 1px solid var(--line);
  padding: 28px 22px 30px;
  position: relative;
}

.collapse-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 10px 24px rgba(18, 18, 15, 0.05);
  color: #55534e;
  align-items: center;
  display: flex;
  height: 38px;
  justify-content: center;
  position: absolute;
  right: 22px;
  top: 28px;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease;
  width: 38px;
}

.collapse-btn svg {
  fill: none;
  height: 19px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 0.16s ease;
  width: 19px;
}

.collapse-btn:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.nav-list {
  display: grid;
  gap: 10px;
  padding-top: 88px;
}

.nav-item,
.fold-menu {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: #57554f;
  display: flex;
  font-size: 16px;
  font-weight: 720;
  gap: 14px;
  min-height: 56px;
  padding: 0 18px;
  position: relative;
  text-align: left;
  transition:
    background 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
  width: 100%;
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(18, 18, 15, 0.05);
  color: #262521;
}

.nav-item.is-active::before {
  background: var(--black);
  border-radius: 999px;
  content: "";
  height: 22px;
  left: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
}

.nav-item:active,
.fold-menu:active,
.tag-chip:active,
.record-action:active,
.generate-btn:active {
  transform: scale(0.985);
}

.nav-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #ded9d0;
  border-radius: 7px;
  color: #5f5d57;
  display: flex;
  flex: 0 0 auto;
  height: 28px;
  justify-content: center;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
  width: 28px;
}

.nav-icon svg,
.upload-icon svg,
.upload-remove svg,
.record-action svg,
.viewer-action svg,
.viewer-close svg,
.modal-close svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.nav-icon svg {
  height: 18px;
  width: 18px;
}

.nav-item.is-active .nav-icon,
.nav-item:hover .nav-icon,
.fold-menu:hover .nav-icon {
  background: #fbfaf8;
  border-color: #c8c1b6;
  color: var(--black);
}

.nav-item.is-active .nav-icon {
  border-color: rgba(22, 74, 63, 0.22);
  color: var(--green);
}

.fold-menu {
  bottom: 30px;
  color: #5c5953;
  position: absolute;
  width: calc(100% - 44px);
}

.fold-menu::before {
  background: var(--line);
  content: "";
  height: 1px;
  left: 22px;
  position: absolute;
  right: 22px;
  top: -18px;
}

.desktop-app.is-rail-collapsed .nav-item span:last-child,
.desktop-app.is-rail-collapsed .fold-menu span:last-child {
  display: none;
}

.desktop-app.is-rail-collapsed .nav-item,
.desktop-app.is-rail-collapsed .fold-menu {
  justify-content: center;
  padding-inline: 0;
}

.desktop-app.is-rail-collapsed .collapse-btn {
  right: 26px;
}

.desktop-app.is-rail-collapsed .collapse-btn svg {
  transform: rotate(180deg);
}

.workspace {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  max-height: calc(100vh - 80px);
  overflow: hidden;
}

.stream {
  display: grid;
  gap: 18px;
  overflow: auto;
  padding: 16px var(--workspace-gutter-right) 12px var(--workspace-gutter-left);
  scrollbar-width: thin;
}

.stream-context {
  align-items: end;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
  padding: 14px 16px;
}

.stream-context span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.stream-context strong {
  color: #1d1e1a;
  font-size: 15px;
  font-weight: 780;
}

.stream-context small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  max-width: 52%;
  text-align: right;
}

.gallery-grid {
  display: grid;
  gap: 18px;
}

.template-toolbar {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.template-toolbar-head {
  align-items: center;
  display: flex;
  gap: 12px;
}

.template-search {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  flex: 1;
  gap: 9px;
  height: 42px;
  padding: 0 12px;
}

.template-search-icon {
  color: #7d7a73;
  display: flex;
  flex: 0 0 auto;
}

.template-search-icon svg {
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 17px;
}

.template-search input {
  border: 0;
  color: var(--ink);
  min-width: 0;
  outline: none;
  width: 100%;
}

.template-search input::placeholder {
  color: #b9b5ae;
}

.template-clear {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #4c4943;
  font-size: 13px;
  font-weight: 760;
  height: 42px;
  padding: 0 14px;
}

.template-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-filter-chip {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4f4d48;
  display: inline-flex;
  font-size: 13px;
  font-weight: 720;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
}

.template-filter-chip small {
  color: #96928b;
  font-size: 11px;
  font-weight: 760;
}

.template-filter-chip.is-active {
  background: #edf4f0;
  border-color: rgba(22, 74, 63, 0.22);
  color: var(--green);
}

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

.template-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  min-height: 224px;
  padding: 18px 18px 16px;
}

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

.template-card h3 {
  color: #262621;
  font-size: 16px;
  line-height: 1.3;
  margin: 0;
}

.template-head-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.template-badge {
  background: #edf4f0;
  border: 1px solid rgba(22, 74, 63, 0.16);
  border-radius: 999px;
  color: var(--green);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 760;
  padding: 4px 10px;
}

.template-icon-btn {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #8a867d;
  display: flex;
  height: 30px;
  justify-content: center;
  padding: 0;
  width: 30px;
}

.template-icon-btn svg {
  fill: none;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 15px;
}

.template-icon-btn.is-active {
  background: #fff7df;
  border-color: #ead08b;
  color: #b58918;
}

.template-icon-btn.is-active svg {
  fill: currentColor;
}

.template-summary {
  color: #3e3d39;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

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

.template-meta span {
  background: #f6f5f1;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #6b6862;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}

.template-prompt {
  background: #faf9f6;
  border: 1px solid #e7e1d7;
  border-radius: 7px;
  color: #4b4944;
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
  padding: 10px 12px;
}

.template-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: auto;
}

.template-use-btn {
  min-width: 108px;
}

.empty-records {
  align-content: center;
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  display: grid;
  gap: 6px;
  min-height: 220px;
  padding: 24px 20px;
  text-align: center;
}

.empty-records strong {
  color: #2a2a26;
  font-size: 16px;
}

.record-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(280px, 390px) minmax(360px, 422px) 180px;
  min-height: 302px;
  padding: 18px 22px 18px 24px;
}

.record-card.is-entering {
  animation: liftIn 0.24s ease both;
}

.record-info {
  align-content: start;
  display: grid;
  gap: 20px;
  padding-top: 8px;
}

.record-label {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 10px;
}

.record-prompt {
  color: #282824;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.78;
  margin: 0;
}

.reference-block {
  margin-top: 4px;
}

.reference-block img {
  border-radius: 6px;
  display: block;
  height: 91px;
  object-fit: cover;
  width: 107px;
}

.result-preview {
  align-self: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  display: block;
  padding: 0;
}

.result-image {
  background: #ece8df;
  border-radius: 6px;
  cursor: zoom-in;
  display: block;
  height: 266px;
  object-fit: cover;
  transition:
    box-shadow 0.16s ease,
    filter 0.16s ease,
    transform 0.16s ease;
  width: 422px;
}

.result-image:hover {
  box-shadow: 0 14px 28px rgba(18, 18, 15, 0.12);
  filter: saturate(1.02);
  transform: translateY(-1px);
}

.pending-preview {
  align-self: center;
  align-items: center;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.64), transparent),
    #f2eee7;
  background-size: 220% 100%, auto;
  border: 1px solid #e6e1d8;
  border-radius: 6px;
  color: #494640;
  display: grid;
  height: 266px;
  justify-items: center;
  padding: 24px;
  width: 422px;
  animation: shimmer 1.5s ease-in-out infinite;
}

.pending-preview span {
  border: 2px solid rgba(22, 74, 63, 0.18);
  border-top-color: var(--green);
  border-radius: 999px;
  display: block;
  height: 32px;
  width: 32px;
  animation: spin 0.9s linear infinite;
}

.pending-preview strong {
  font-size: 18px;
  margin-top: 8px;
}

.pending-preview small {
  color: var(--muted);
}

.record-card.is-pending {
  border-color: #e3ded5;
  box-shadow: 0 18px 42px rgba(18, 18, 15, 0.07);
}

.reference-empty {
  align-items: center;
  background: #f4f1eb;
  border: 1px dashed #d8d2c8;
  border-radius: 6px;
  color: #9a978e;
  display: flex;
  font-size: 13px;
  height: 91px;
  justify-content: center;
  width: 107px;
}

.record-action.subtle {
  color: var(--muted);
}

.record-side {
  align-content: start;
  display: grid;
  gap: 26px;
  padding-top: 12px;
}

.record-time {
  color: #999891;
  font-size: 14px;
}

.record-actions {
  display: grid;
  gap: 14px;
  margin-top: 10px;
}

.record-action {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #2d2d29;
  display: flex;
  font-size: 15px;
  font-weight: 640;
  gap: 10px;
  height: 44px;
  justify-content: center;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.record-action:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 18px rgba(18, 18, 15, 0.05);
}

.record-action svg,
.viewer-action svg {
  color: var(--black);
  flex: 0 0 auto;
  height: 16px;
  width: 16px;
}

.composer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-strong);
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(520px, 1fr) 304px;
  margin: 0 var(--workspace-gutter-right) 14px var(--workspace-gutter-left);
  min-height: 168px;
  padding: 13px 24px 13px 24px;
}

.prompt-label {
  color: var(--ink);
  display: block;
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 6px;
}

.prompt-row {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(360px, 1fr) 136px;
}

textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  height: 86px;
  line-height: 1.55;
  min-height: 0;
  outline: none;
  padding: 11px 16px;
  resize: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

textarea::placeholder {
  color: #bebbb5;
}

textarea:focus {
  border-color: #d4cec4;
  box-shadow: inset 0 0 0 1px #d4cec4;
}

textarea.is-invalid {
  border-color: #b94b42;
  box-shadow: inset 0 0 0 1px rgba(185, 75, 66, 0.18);
}

.composer.has-error .prompt-label::after {
  color: #b94b42;
  content: "  请输入提示词";
  font-size: 13px;
  font-weight: 700;
}

.upload-tile {
  align-items: center;
  background: var(--panel);
  border: 1px dashed #dcd7cf;
  border-radius: 6px;
  color: #5b5954;
  display: grid;
  justify-items: center;
  height: 86px;
  min-height: 0;
  padding: 6px 12px;
  text-align: center;
  transition:
    background 0.16s ease,
    border-color 0.16s ease;
}

.upload-tile:hover,
.upload-tile.has-file {
  background: #fbfaf8;
  border-color: #cfc8bd;
}

.upload-tile input {
  display: none;
}

.upload-empty,
.upload-preview {
  align-items: center;
  display: grid;
  gap: 3px;
  justify-items: center;
  width: 100%;
}

.upload-preview {
  gap: 4px;
  position: relative;
}

.upload-preview img {
  border-radius: 5px;
  display: block;
  height: 48px;
  object-fit: cover;
  width: 64px;
}

.upload-remove {
  align-items: center;
  background: rgba(20, 20, 18, 0.78);
  border: 0;
  border-radius: 999px;
  color: #fff;
  display: flex;
  height: 22px;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 9px;
  top: -2px;
  width: 22px;
  z-index: 2;
}

.upload-remove svg {
  height: 13px;
  stroke-width: 2.4;
  width: 13px;
}

.upload-icon {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid #ddd8ce;
  border-radius: 7px;
  color: #34332f;
  display: flex;
  height: 28px;
  justify-content: center;
  margin-bottom: 2px;
  width: 28px;
}

.upload-icon svg {
  height: 16px;
  width: 16px;
}

.upload-tile:hover .upload-icon,
.upload-tile.has-file .upload-icon {
  border-color: rgba(22, 74, 63, 0.22);
  color: var(--green);
}

.upload-kicker {
  border: 1px solid #d8d2c8;
  border-radius: 999px;
  color: #77736b;
  display: inline-flex;
  font-size: 11px;
  font-weight: 760;
  height: 22px;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 0 10px;
}

.upload-tile strong {
  font-size: 13px;
  margin-top: 0;
  white-space: nowrap;
}

.upload-tile small {
  color: #8f8c86;
  font-size: 11px;
  white-space: nowrap;
}

.composer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.tag-chip {
  align-items: center;
  background: #fafaf9;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #42413d;
  display: inline-flex;
  font-size: 14px;
  font-weight: 680;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  position: relative;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.tag-chip::before {
  border: 1.6px solid currentColor;
  border-radius: 4px;
  content: "";
  height: 14px;
  width: 14px;
}

.tag-chip::after {
  color: #fff;
  content: "✓";
  font-size: 12px;
  font-weight: 850;
  left: 16px;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.7);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.tag-chip.is-active,
.tag-chip:hover {
  background: #f4f3ef;
  border-color: var(--line);
}

.tag-chip.is-active {
  background: #edf4f0;
  border-color: rgba(22, 74, 63, 0.24);
  color: var(--green);
}

.tag-chip.is-active::before {
  background: var(--green);
  border-color: var(--green);
}

.tag-chip.is-active::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.assist-btn,
.viewer-action {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #373530;
  font-weight: 720;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.assist-btn {
  font-size: 13px;
  height: 30px;
  padding: 0 12px;
  white-space: nowrap;
}

.ai-polish-btn {
  background: #f7f5f0;
  border-color: #ded8cd;
  color: #24231f;
  margin-left: 16px;
  min-width: 112px;
}

.ai-polish-btn::before {
  color: var(--green);
  content: "AI";
  font-size: 11px;
  font-weight: 850;
  margin-right: 6px;
}

.assist-btn:hover,
.viewer-action:hover:not(:disabled) {
  background: #f4f3ef;
  border-color: var(--line-strong);
}

.assist-btn:active,
.viewer-action:active {
  transform: scale(0.985);
}

.assist-btn.ghost,
.viewer-action.ghost {
  color: var(--muted);
}

.viewer-side span {
  color: #9a978e;
  font-size: 12px;
  font-weight: 760;
}

.composer-right {
  align-content: start;
  display: grid;
  gap: 10px;
  padding-top: 48px;
}

.generate-btn {
  background: var(--black);
  border: 0;
  border-radius: 5px;
  box-shadow: 0 14px 26px rgba(21, 21, 21, 0.18);
  color: #fff;
  font-size: 15px;
  font-weight: 780;
  height: 42px;
  justify-self: stretch;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.generate-btn:hover:not(:disabled) {
  background: #050505;
  box-shadow: 0 18px 34px rgba(21, 21, 21, 0.2);
  transform: translateY(-1px);
}

.generate-btn.is-loading span::after {
  animation: ellipsis 1s infinite;
  content: "";
}

.composer-right p {
  color: #4e4c47;
  font-size: 13px;
  margin: -3px 0 0;
  text-align: center;
}

.composer > select {
  display: none;
}

.toast {
  background: rgba(20, 20, 18, 0.92);
  border-radius: var(--radius);
  bottom: 22px;
  color: #fff;
  left: 50%;
  max-width: 460px;
  padding: 10px 14px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 60;
}

.toast.is-visible {
  animation: toastIn 0.2s ease both;
}

.modal {
  align-items: center;
  background: rgba(20, 20, 18, 0.38);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 50;
}

.image-viewer {
  align-items: center;
  background: rgba(14, 14, 12, 0.78);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 42px;
  position: fixed;
  z-index: 70;
}

.viewer-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  display: grid;
  gap: 18px;
  max-width: min(92vw, 1180px);
  padding: 18px;
  width: 100%;
}

.viewer-toolbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.viewer-toolbar small {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.viewer-toolbar h2 {
  font-size: 18px;
  margin: 2px 0 0;
}

.viewer-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.viewer-action {
  align-items: center;
  display: inline-flex;
  font-size: 14px;
  gap: 7px;
  height: 38px;
  justify-content: center;
  min-width: 78px;
  padding: 0 14px;
}

.viewer-body {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(520px, 1fr) 260px;
}

.viewer-body > img {
  background: #f5f2ec;
  border-radius: 8px;
  display: block;
  height: min(72vh, 680px);
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

.viewer-side {
  align-content: start;
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.viewer-side p {
  color: #2d2c28;
  font-size: 14px;
  line-height: 1.66;
  margin: 0 0 8px;
}

.viewer-close {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #111;
  display: flex;
  height: 38px;
  justify-content: center;
  position: static;
  width: 42px;
}

.viewer-close svg,
.modal-close svg {
  height: 17px;
  stroke-width: 2.3;
  width: 17px;
}

.modal-close {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #111;
  display: flex;
  height: 36px;
  justify-content: center;
  padding: 0;
  width: 40px;
}

.viewer-close:hover,
.modal-close:hover,
.upload-remove:hover {
  color: var(--green);
}

.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-strong);
  max-width: 520px;
  padding: 20px;
  width: min(100%, 520px);
}

.auth-card {
  display: grid;
  gap: 14px;
}

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

.auth-field span {
  color: var(--muted);
  font-size: 12px;
}

.auth-field input {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  height: 42px;
  padding: 0 12px;
}

.auth-submit {
  width: 100%;
}

.generation-confirm-modal {
  background: rgba(22, 23, 19, 0.34);
  backdrop-filter: blur(8px);
  z-index: 65;
}

.generation-confirm-card {
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfaf8 100%);
  border-color: rgba(222, 218, 210, 0.9);
  box-shadow: 0 28px 74px rgba(18, 18, 15, 0.16);
  display: grid;
  gap: 16px;
  max-width: 620px;
  padding: 22px;
  width: min(100%, 620px);
}

.generation-confirm-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.generation-confirm-head h2 {
  font-size: 21px;
}

.confirm-summary {
  background: #f7f6f2;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 72px;
  overflow: hidden;
}

.confirm-summary > div {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  position: relative;
}

.confirm-summary > div + div {
  border-left: 1px solid var(--line);
}

.confirm-summary span,
.confirm-section-title small,
.confirm-reference-empty small,
.confirm-reference-preview small {
  color: var(--muted);
  font-size: 12px;
}

.confirm-summary strong {
  color: #1f201c;
  font-size: 15px;
  font-weight: 780;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confirm-summary b {
  font: inherit;
}

.confirm-prompt-block,
.confirm-reference-block {
  display: grid;
  gap: 9px;
}

.confirm-section-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.confirm-section-title span {
  color: #4b4943;
  font-size: 13px;
  font-weight: 760;
}

.confirm-prompt-block p {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #24241f;
  font-size: 14px;
  line-height: 1.72;
  margin: 0;
  max-height: 148px;
  overflow: auto;
  padding: 14px 15px;
}

.confirm-reference-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 104px;
  padding: 10px;
}

.confirm-reference-empty,
.confirm-reference-preview {
  align-items: center;
  display: flex;
  gap: 13px;
  min-height: 82px;
}

.confirm-reference-empty {
  color: #3e3d38;
}

.confirm-reference-empty span {
  align-items: center;
  background: #f5f4ef;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  height: 58px;
  justify-content: center;
  width: 58px;
}

.confirm-reference-empty svg {
  color: var(--green);
  fill: none;
  height: 24px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 24px;
}

.confirm-reference-empty strong,
.confirm-reference-preview strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.confirm-reference-preview img {
  background: #f5f2ec;
  border: 1px solid var(--line);
  border-radius: 7px;
  height: 82px;
  object-fit: cover;
  width: 112px;
}

.confirm-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 2px;
}

.confirm-secondary,
.confirm-primary {
  border-radius: 7px;
  font-weight: 780;
  height: 42px;
  min-width: 108px;
  padding: 0 18px;
}

.confirm-secondary {
  background: #ffffff;
  border: 1px solid var(--line-strong);
  color: #363631;
}

.confirm-secondary:hover {
  border-color: #cfc9bd;
  color: #151515;
}

.confirm-primary {
  background: var(--black);
  border: 1px solid var(--black);
  color: #fff;
  min-width: 126px;
}

.confirm-primary:hover {
  background: var(--green);
  border-color: var(--green);
}

.modal-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.modal-head small,
.modal-card p,
.mock-pay small {
  color: var(--muted);
}

.modal-head h2 {
  font-size: 22px;
  margin: 4px 0 0;
}

.modal-head button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 34px;
  width: 34px;
}

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

.recharge-grid button {
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 760;
  height: 42px;
}

.recharge-grid button.is-active,
.recharge-grid button:hover {
  background: #fff4d8;
  border-color: #e5c16f;
}

.mock-pay {
  align-items: center;
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 12px;
  padding: 12px;
}

.mock-pay span {
  background:
    linear-gradient(90deg, #111 7px, transparent 7px) 0 0 / 16px 16px,
    linear-gradient(#111 7px, transparent 7px) 0 0 / 16px 16px,
    #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  display: block;
  height: 64px;
  width: 64px;
}

.mock-pay strong {
  display: block;
  font-size: 22px;
}

.mock-pay small {
  display: block;
  margin-top: 4px;
}

.paid-btn {
  background: var(--black);
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-weight: 780;
  height: 44px;
  margin-top: 14px;
  width: 100%;
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes ellipsis {
  0% {
    content: "";
  }
  33% {
    content: ".";
  }
  66% {
    content: "..";
  }
  100% {
    content: "...";
  }
}

@keyframes shimmer {
  from {
    background-position: 160% 0, 0 0;
  }
  to {
    background-position: -60% 0, 0 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1280px) {
  :root {
    --workspace-gutter-left: 44px;
    --workspace-gutter-right: 44px;
  }

  html,
  body {
    min-width: 1100px;
  }

  .record-card {
    grid-template-columns: minmax(250px, 360px) 390px 165px;
  }

  .result-image {
    height: 246px;
    width: 390px;
  }

  .pending-preview {
    height: 246px;
    width: 390px;
  }

  .stream {
    padding-inline: var(--workspace-gutter-left);
  }
}

@media (max-width: 760px) {
  :root {
    --workspace-gutter-left: 16px;
    --workspace-gutter-right: 16px;
  }

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

  .desktop-app {
    min-height: 100svh;
  }

  .topbar {
    align-items: center;
    gap: 10px;
    height: auto;
    min-height: 68px;
    padding: 10px 14px;
  }

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

  .brand-lockup {
    height: 46px;
    width: 150px;
  }

  .brand-copy {
    display: none;
  }

  .account {
    gap: 8px;
  }

  .balance {
    font-size: 13px;
    min-width: 56px;
    padding-inline: 8px;
  }

  .recharge-btn {
    height: 36px;
    min-width: 58px;
    padding-inline: 12px;
  }

  .avatar,
  .chevron {
    display: none;
  }

  .layout {
    display: block;
    min-height: calc(100svh - 68px);
  }

  .side-rail {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    padding: 10px 14px;
    position: sticky;
    top: 68px;
    z-index: 18;
  }

  .collapse-btn,
  .fold-menu {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    border: 1px solid transparent;
    flex: 0 0 auto;
    font-size: 14px;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    width: auto;
  }

  .nav-item.is-active {
    border-color: var(--line);
  }

  .nav-item.is-active::before {
    display: none;
  }

  .nav-icon {
    height: 24px;
    width: 24px;
  }

  .nav-icon svg {
    height: 15px;
    width: 15px;
  }

  .workspace {
    display: block;
    max-height: none;
    overflow: visible;
  }

  .stream {
    display: grid;
    gap: 14px;
    overflow: visible;
    padding: 14px 14px 18px;
  }

  .stream-context {
    align-items: start;
    gap: 12px;
    padding: 12px 13px;
  }

  .stream-context small {
    max-width: 62%;
  }

  .gallery-grid {
    gap: 14px;
  }

  .gallery-grid:has(.template-card) {
    grid-template-columns: 1fr;
  }

  .template-toolbar-head,
  .template-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .template-clear,
  .template-use-btn {
    width: 100%;
  }

  .record-card {
    gap: 14px;
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 16px;
  }

  .record-info {
    gap: 14px;
    padding-top: 0;
  }

  .record-prompt {
    font-size: 14px;
    line-height: 1.72;
  }

  .result-preview {
    width: 100%;
  }

  .result-image,
  .pending-preview {
    aspect-ratio: 16 / 9;
    height: auto;
    width: 100%;
  }

  .record-side {
    display: grid;
    gap: 12px;
    padding-top: 0;
  }

  .record-actions {
    gap: 10px;
    grid-template-columns: 1fr;
    margin-top: 0;
  }

  .record-action {
    height: 42px;
  }

  .composer {
    bottom: 0;
    border-radius: 8px 8px 0 0;
    gap: 12px;
    grid-template-columns: 1fr;
    margin: 0;
    min-height: 0;
    padding: 14px;
    position: sticky;
    z-index: 16;
  }

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

  textarea {
    height: 92px;
  }

  .upload-tile {
    height: 76px;
  }

  .composer-tags {
    gap: 8px;
    margin-top: 8px;
  }

  .tag-chip {
    font-size: 13px;
    height: 30px;
    padding-inline: 10px;
  }

  .ai-polish-btn {
    margin-left: 0;
  }

  .composer-right {
    gap: 8px;
    padding-top: 0;
  }

  .generate-btn {
    height: 44px;
  }

  .modal {
    padding: 16px;
  }

  .modal-card,
  .generation-confirm-card,
  .viewer-panel {
    max-height: calc(100svh - 32px);
    width: min(100%, 560px);
  }

  .confirm-summary {
    grid-template-columns: 1fr;
  }

  .viewer-panel {
    min-height: 0;
  }

  .viewer-body {
    grid-template-columns: 1fr;
  }

  .viewer-image-wrap img {
    max-height: 54svh;
  }
}
