:root {
  --ink: #171715;
  --muted: #807c75;
  --line: #e8e4dc;
  --line-strong: #d8d2c8;
  --paper: #fffdf9;
  --sidebar: #f8f6f1;
  --soft: #f3f0ea;
  --white: #ffffff;
  --accent: #f05a32;
  --accent-soft: #fff0e9;
  --green: #247a54;
  --green-soft: #eaf6ef;
  --shadow: 0 16px 50px rgba(36, 30, 22, 0.09);
  --font: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background: #ffffff;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  height: 100dvh;
  background: var(--paper);
}

.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 24px 16px 16px;
  background: #f8f8f6;
  border-right: 1px solid var(--line);
  transition: transform 220ms ease;
  z-index: 20;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 23px;
}

.brand-mark,
.welcome-mark {
  position: relative;
  display: grid;
  width: 33px;
  height: 33px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-mark span,
.welcome-mark span {
  font-family: Georgia, serif;
  font-size: 24px;
  font-style: italic;
  font-weight: 700;
  transform: translate(-2px, -1px);
}

.brand-mark i,
.welcome-mark i {
  position: absolute;
  right: 6px;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  letter-spacing: -0.4px;
  line-height: 1;
}

.brand-copy small {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.new-chat-button {
  display: flex;
  height: 44px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.new-chat-button:hover {
  border-color: #c9c1b5;
  background: #fff;
  transform: translateY(-1px);
}

.new-chat-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.new-chat-button span {
  font-size: 13px;
  font-weight: 700;
}

.new-chat-button kbd {
  margin-left: auto;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #99938a;
  background: #fff;
  font-family: inherit;
  font-size: 9px;
}

.sidebar-scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding-top: 26px;
  scrollbar-width: none;
}

.sidebar-scroll::-webkit-scrollbar {
  display: none;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 9px 9px;
  color: #aaa49a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.retention-note {
  color: #b3a89d;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.history-list {
  display: grid;
  gap: 3px;
}

.history-row {
  position: relative;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 10px 31px 10px 9px;
  border: 0;
  border-radius: 9px;
  color: #6e6962;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.history-item:hover,
.history-item.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
}

.history-item.active {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.035);
}

.history-item svg {
  width: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
  opacity: 0.65;
}

.history-item span {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-delete {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #746c63;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  place-items: center;
  cursor: pointer;
  opacity: 0.88;
  transform: translateY(-50%);
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.history-row:hover .history-delete,
.history-delete:focus-visible {
  opacity: 1;
}

.history-delete:hover {
  background: #ece7df;
  color: #9c3328;
}

.sidebar-bottom {
  display: grid;
  gap: 10px;
  padding-top: 14px;
}

.focus-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(240, 90, 50, 0.14);
  border-radius: 12px;
  background: var(--accent-soft);
}

.focus-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(240, 90, 50, 0.1);
}

.focus-card strong,
.focus-card small {
  display: block;
}

.focus-card strong {
  font-size: 11px;
}

.focus-card small {
  margin-top: 3px;
  color: #9c735f;
  font-size: 9px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 4px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.account-avatar {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #262320;
  font-family: Georgia, serif;
  font-size: 16px;
  font-style: italic;
}

.account-copy {
  min-width: 0;
  flex: 1;
}

.account-copy strong,
.account-copy small {
  display: block;
}

.account-copy strong {
  font-size: 11px;
}

.account-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.account-more {
  color: #99938a;
  letter-spacing: 0.1em;
}

.workspace {
  position: relative;
  display: flex;
  min-width: 0;
  height: 100dvh;
  flex-direction: column;
  background: #ffffff;
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  height: 64px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(232, 228, 220, 0.7);
  backdrop-filter: blur(16px);
}

.conversation-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 12px;
}

.conversation-heading span,
.conversation-heading i {
  color: #aaa39a;
  font-style: normal;
}

.conversation-heading strong {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.local-badge {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #7f7a72;
  background: #fff;
  font-size: 9px;
}

.auth-button {
  min-width: 58px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #5f5a53;
  background: #fff;
  cursor: pointer;
  font-size: 9px;
  font-weight: 650;
}

.auth-button:hover {
  border-color: #cbc3b8;
  color: var(--ink);
}

.auth-button.signed-in {
  border-color: #dfd9cf;
  background: #f8f6f1;
}

.auth-popover {
  position: absolute;
  z-index: 30;
  top: 54px;
  right: 24px;
  display: grid;
  width: 224px;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(39, 31, 23, 0.13);
}

.auth-popover[hidden] {
  display: none;
}

.auth-popover-head strong,
.auth-popover-head small {
  display: block;
}

.auth-popover-head strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-popover-head small {
  margin-top: 3px;
  color: #9c958c;
  font-size: 8px;
}

.auth-balance {
  display: flex;
  gap: 8px;
}

.auth-balance span {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  color: #8e877e;
  background: #f6f4ef;
  font-size: 8px;
}

.auth-balance b {
  display: block;
  margin-top: 4px;
  color: #2d2924;
  font-size: 14px;
}

.auth-admin-link,
.auth-logout {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #625c54;
  background: #fff;
  cursor: pointer;
  font-size: 9px;
  text-align: center;
  text-decoration: none;
}

.auth-logout {
  color: #a2402b;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  background: var(--soft);
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.mobile-menu {
  display: none;
}

.chat-area {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.chat-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-color: #d8d2c8 transparent;
  scrollbar-width: thin;
}

.welcome {
  width: min(690px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(72px, 12vh, 126px) 0 24px;
  text-align: center;
  animation: rise-in 560ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.welcome-mark {
  width: 42px;
  height: 42px;
  margin: 0 auto 21px;
  border-radius: 13px;
}

.welcome-mark {
  display: none;
}

.welcome-mark span {
  font-size: 29px;
}

.welcome-mark i {
  right: 8px;
  top: 8px;
  width: 6px;
  height: 6px;
}

.welcome-kicker {
  margin: 0 0 11px;
  color: #a4a09a;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.welcome h1 {
  margin: 0;
  font-size: clamp(28px, 3.6vw, 38px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.18;
}

.welcome-lead {
  max-width: 560px;
  margin: 15px auto 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 34px auto 0;
  text-align: left;
}

.mode-switch {
  display: inline-flex;
  margin-top: 30px;
  padding: 4px;
  border: 1px solid #eceae5;
  border-radius: 999px;
  background: #f5f4f1;
}

.mode-button {
  min-width: 108px;
  padding: 9px 25px;
  border: 0;
  border-radius: 999px;
  color: #8b867e;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.mode-button:hover {
  color: #38342f;
}

.mode-button.active {
  color: #171715;
  background: #fff;
  box-shadow: 0 2px 8px rgba(30, 26, 21, 0.09);
}

.prompt-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 47px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
  font-size: 11px;
  font-weight: 600;
}

.prompt-card:hover {
  border-color: #d1c9bd;
  box-shadow: 0 8px 22px rgba(44, 36, 26, 0.05);
  transform: translateY(-2px);
}

.prompt-arrow {
  color: #b4ada3;
  font-size: 14px;
}

.messages {
  display: none;
  width: min(780px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 38px;
}

.messages.has-messages {
  display: block;
}

.message {
  animation: rise-in 260ms ease both;
}

.message + .message {
  margin-top: 28px;
}

.user-message {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 7px;
  color: #9c968d;
  font-size: 9px;
}

.user-bubble {
  max-width: min(76%, 630px);
  padding: 13px 16px;
  border: 1px solid #e5e0d8;
  border-radius: 17px 17px 5px 17px;
  background: #f4f1eb;
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  margin-bottom: 8px;
}

.message-attachment {
  position: relative;
  width: 94px;
  height: 76px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.message-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-attachment span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 5px;
  border-radius: 5px;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  font-size: 8px;
}

.assistant-message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.assistant-avatar {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--ink);
  font-family: Georgia, serif;
  font-size: 20px;
  font-style: italic;
  transform: translateY(1px);
}

.assistant-avatar::after {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.assistant-content {
  min-width: 0;
  padding-top: 4px;
}

.assistant-text {
  color: #393631;
  font-size: 13px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}

.assistant-text strong {
  font-weight: 700;
}

.typing-card {
  --typing-progress: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 9px 16px;
  overflow: hidden;
  border: 1px solid #e6ded3;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(46, 38, 28, 0.06);
  color: #77716a;
  font-size: 12px;
  line-height: 1.4;
  isolation: isolate;
  animation: typingCardBreathe 2.4s ease-in-out infinite;
}

.typing-card::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 24%,
    rgba(255, 239, 232, 0.7) 46%,
    rgba(255, 255, 255, 0.92) 54%,
    transparent 76%
  );
  background-size: 240% 100%;
  content: "";
  animation: typingCardSweep 2.1s linear infinite;
}

.typing-card::after {
  position: absolute;
  right: 18px;
  bottom: 0;
  left: 18px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ef6a45, #f2ad93);
  content: "";
  opacity: 0.62;
  transform: scaleX(var(--typing-progress));
  transform-origin: left center;
  transition: transform 360ms ease-out;
}

.typing-dots {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e9a48f;
  animation: blink 1s infinite ease-in-out;
}

.typing-dots i:nth-child(2) {
  animation-delay: 130ms;
}

.typing-dots i:nth-child(3) {
  animation-delay: 260ms;
}

.typing-label {
  min-width: 0;
}

.typing-separator {
  flex: 0 0 auto;
  color: #b5aea6;
}

.typing-percent {
  flex: 0 0 auto;
  min-width: 32px;
  color: #4c4742;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.result-card {
  overflow: hidden;
  margin-top: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

.result-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.quality-badge {
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 8px;
  font-weight: 700;
}

.result-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(280px, 1.22fr);
  gap: 18px;
  padding: 17px;
}

.poster-stage {
  display: grid;
  min-height: 294px;
  place-items: center;
  padding: 15px;
  border-radius: 13px;
  background:
    linear-gradient(45deg, #efede8 25%, transparent 25%),
    linear-gradient(-45deg, #efede8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #efede8 75%),
    linear-gradient(-45deg, transparent 75%, #efede8 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.demo-poster {
  position: relative;
  width: min(100%, 218px);
  aspect-ratio: 0.707;
  overflow: hidden;
  color: var(--poster-ink, #201c18);
  background: var(--poster-bg, #f7e8cf);
  box-shadow: 0 13px 30px rgba(43, 33, 22, 0.17);
}

.demo-poster::before {
  position: absolute;
  inset: 8px;
  border: 1px solid color-mix(in srgb, var(--poster-accent, #f05a32) 40%, transparent);
  content: "";
  pointer-events: none;
}

.poster-topline {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 0;
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.poster-eyebrow {
  color: var(--poster-accent, #f05a32);
}

.poster-title {
  position: relative;
  z-index: 2;
  margin: 42px 17px 0;
  font-family: "Microsoft YaHei UI", sans-serif;
  font-size: clamp(25px, 4.2vw, 34px);
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 1.03;
  text-align: center;
}

.poster-subtitle {
  position: relative;
  z-index: 2;
  margin: 11px 22px 0;
  color: color-mix(in srgb, var(--poster-ink, #201c18) 65%, transparent);
  font-size: 8px;
  font-weight: 600;
  line-height: 1.55;
  text-align: center;
}

.poster-art {
  position: absolute;
  right: 20px;
  bottom: 67px;
  left: 20px;
  height: 84px;
}

.poster-art .orb {
  position: absolute;
  right: 18px;
  bottom: 0;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--poster-accent, #f05a32);
  opacity: 0.96;
}

.poster-art .orb-secondary {
  position: absolute;
  right: 2px;
  bottom: 6px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #f6c453;
  mix-blend-mode: multiply;
  opacity: 0.58;
}

.poster-art .ribbon {
  position: absolute;
  left: 0;
  bottom: 20px;
  width: 104px;
  height: 41px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--poster-accent, #f05a32) 15%, #fff);
  transform: rotate(-12deg);
}

.poster-offer {
  position: absolute;
  z-index: 3;
  left: 18px;
  bottom: 17px;
  color: var(--poster-accent, #f05a32);
  font-size: 20px;
  font-weight: 950;
  letter-spacing: -0.06em;
}

.poster-offer small {
  display: block;
  margin-bottom: 2px;
  color: color-mix(in srgb, var(--poster-ink, #201c18) 58%, transparent);
  font-size: 5px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.poster-footer {
  position: absolute;
  right: 18px;
  bottom: 18px;
  color: color-mix(in srgb, var(--poster-ink, #201c18) 60%, transparent);
  font-size: 5px;
  line-height: 1.55;
  text-align: right;
}

.result-details {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.result-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.result-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}

.meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 13px;
}

.meta-pill {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #746e66;
  background: #fcfbf8;
  font-size: 8px;
}

.output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 17px;
}

.output-button {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease;
}

.output-button:hover {
  border-color: #cdc5ba;
  background: #fcfbf8;
}

.output-icon {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 6px;
  color: #6f675f;
  background: #f1eee8;
  font-size: 7px;
  font-weight: 800;
}

.output-copy strong,
.output-copy small {
  display: block;
}

.output-copy strong {
  font-size: 9px;
}

.output-copy small {
  margin-top: 2px;
  color: #9b948b;
  font-size: 7px;
}

.layer-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-top: 1px solid var(--line);
  color: #625d56;
  background: #fcfbf8;
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.layer-toggle span:last-child {
  color: #aaa39a;
  font-weight: 400;
}

.layer-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.chevron {
  display: inline-block;
  margin-left: 7px;
  transition: transform 160ms ease;
}

.layer-panel {
  display: none;
  padding: 10px 16px 15px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.layer-panel.open {
  display: block;
  animation: rise-in 180ms ease both;
}

.layer-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed #ede9e2;
  font-size: 9px;
}

.layer-row:last-child {
  border-bottom: 0;
}

.layer-eye {
  color: #8f887f;
  text-align: center;
}

.layer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-type {
  padding: 2px 5px;
  border-radius: 4px;
  color: #7e776f;
  background: #f2efe9;
  font-size: 7px;
}

.layer-type.vector {
  color: var(--green);
  background: var(--green-soft);
}

.layer-type.text {
  color: #b14a2c;
  background: #fff0e9;
}

.composer-shell {
  position: relative;
  z-index: 8;
  width: min(780px, calc(100% - 48px));
  margin: 0 auto;
  padding: 12px 0 17px;
  background: linear-gradient(to bottom, transparent, var(--paper) 18%);
}

.composer {
  position: relative;
  padding: 17px 16px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(46, 38, 28, 0.08), 0 2px 8px rgba(46, 38, 28, 0.03);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.result-card {
  width: min(100%, 224px);
  margin-top: 14px;
  box-shadow: none;
}

.result-head,
.result-body,
.result-details,
.meta-pills,
.output-grid {
  display: none !important;
}

.result-media {
  display: grid;
  place-items: center;
  padding: 9px;
  background: #f5f5f3;
}

.result-media .demo-poster {
  width: 146px;
}

.generated-preview {
  display: block;
  width: 146px;
  max-height: 220px;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 8px 20px rgba(43, 33, 22, 0.12);
}

.result-preview-button {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.preview-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 7px;
  border-radius: 5px;
  color: #fff;
  background: rgba(20, 19, 17, 0.7);
  font-size: 7px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.result-preview-button:hover .preview-hint {
  opacity: 1;
}

.result-simple-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-top: 1px solid var(--line);
}

.viewer-overlay {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 20, 18, 0.58);
  backdrop-filter: blur(8px);
}

.viewer-overlay.visible {
  display: flex;
  animation: rise-in 180ms ease both;
}

.viewer-dialog {
  display: flex;
  width: min(1100px, 94vw);
  max-height: 90vh;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.viewer-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.viewer-kicker {
  display: block;
  margin-bottom: 3px;
  color: #aaa39a;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.viewer-header h2 {
  margin: 0;
  font-size: 14px;
}

.viewer-close {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #f2f0eb;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.viewer-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(270px, 0.65fr);
  min-height: 0;
  flex: 1;
}

.viewer-media {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 28px;
  background:
    linear-gradient(45deg, #efede8 25%, transparent 25%),
    linear-gradient(-45deg, #efede8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #efede8 75%),
    linear-gradient(-45deg, transparent 75%, #efede8 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.viewer-media img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 140px);
  object-fit: contain;
  box-shadow: 0 18px 45px rgba(34, 27, 20, 0.2);
}

.viewer-media .demo-poster {
  width: min(100%, 350px);
}

.viewer-panel {
  min-width: 0;
  overflow-y: auto;
  padding: 22px 20px;
  border-left: 1px solid var(--line);
}

.viewer-meta {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 10px;
}

.viewer-actions {
  display: grid;
  gap: 7px;
}

.viewer-actions button[hidden],
.viewer-layers-head[hidden],
.viewer-layers[hidden] {
  display: none !important;
}

.viewer-actions button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
}

.viewer-actions button:hover {
  border-color: #c9c1b6;
  background: #fcfbf8;
}

.viewer-actions button span {
  font-size: 10px;
  font-weight: 700;
}

.viewer-actions button small {
  color: #9d968d;
  font-size: 8px;
}

.viewer-actions .action-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  height: 3px;
  overflow: hidden;
  background: transparent;
  opacity: 0;
  pointer-events: none;
}

.viewer-actions .action-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 220ms ease;
}

.viewer-actions .action-progress i::after {
  display: block;
  width: 70%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: translateX(-100%);
  animation: exportShine 1.3s linear infinite;
  content: "";
}

.viewer-actions button.export-running {
  flex-wrap: wrap;
  row-gap: 5px;
}

.viewer-actions button.export-running small {
  display: flex;
  flex: 0 0 100%;
  align-items: center;
  gap: 6px;
  max-width: none;
  color: #a34428;
  font-size: 9px;
  line-height: 1.45;
  white-space: normal;
}

.viewer-actions button.export-running small::before {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border: 2px solid rgba(240, 90, 50, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: exportSpin 0.8s linear infinite;
  content: "";
}

.export-cost-note {
  margin: 9px 0 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: #f7f3ec;
  color: #766d63;
  font-size: 9px;
  line-height: 1.6;
}

.text-audit-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 11px;
  border: 1px solid #d9cbbd;
  border-radius: 8px;
  background: #fffaf3;
  color: #4a4037;
  cursor: pointer;
  text-align: left;
}

.text-audit-trigger:hover {
  border-color: var(--accent);
  background: #fff6ed;
}

.text-audit-trigger:disabled {
  cursor: wait;
  opacity: 0.7;
}

.text-audit-trigger span {
  font-size: 10px;
  font-weight: 800;
}

.text-audit-trigger small {
  color: #9b7964;
  font-size: 8px;
}

.text-audit-panel {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.text-audit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid #eee8df;
}

.text-audit-head strong {
  color: #51483f;
  font-size: 9px;
  line-height: 1.45;
}

.text-audit-head button {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 0;
  border-radius: 50%;
  background: #f3eee8;
  color: #7b7168;
  cursor: pointer;
}

.text-audit-list {
  display: grid;
  gap: 7px;
  max-height: 285px;
  overflow-y: auto;
  padding-top: 8px;
}

.text-audit-empty {
  margin: 0;
  color: #8b8178;
  font-size: 9px;
  line-height: 1.6;
}

.text-audit-item {
  padding: 8px;
  border: 1px solid #eee7de;
  border-radius: 7px;
  background: #fcfbf8;
}

.text-audit-item.needs-review {
  border-color: #f1b49f;
  background: #fff8f4;
}

.text-audit-item.applied {
  border-color: #a9d2b7;
  background: #f4fbf6;
}

.text-audit-item.is-running {
  border-color: #e49b7f;
  background:
    linear-gradient(90deg, #fff8f3, #fffdfb, #fff8f3);
  background-size: 220% 100%;
  animation: textAuditWorking 1.4s linear infinite;
}

.text-audit-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: #5e554d;
  font-size: 9px;
}

.text-audit-copy strong {
  font-size: 10px;
}

.text-audit-copy span {
  color: #a0735e;
  font-size: 8px;
  white-space: nowrap;
}

.text-audit-field {
  display: grid;
  gap: 4px;
}

.text-audit-field > span {
  color: #8c7f74;
  font-size: 8px;
  font-weight: 700;
}

.text-audit-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 8px;
  border: 1px solid #ddd3c8;
  border-radius: 6px;
  color: #332e29;
  font-size: 10px;
}

.text-audit-apply {
  width: 100%;
  margin-top: 6px;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.text-audit-apply:disabled {
  cursor: wait;
  opacity: 0.65;
}

@keyframes textAuditWorking {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.upscale-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #766d63;
  font-size: 9px;
  font-weight: 700;
}

.upscale-choice select {
  min-width: 145px;
  padding: 5px 7px;
  border: 1px solid #d8d0c5;
  border-radius: 6px;
  background: #fcfbf8;
  color: #4f4942;
  font: inherit;
  font-weight: 600;
}

.assistant-billing {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f4efe7;
  color: #7a6f63;
  font-size: 9px;
}

.viewer-actions button.export-running .action-progress,
.viewer-actions button.export-done .action-progress,
.viewer-actions button.export-error .action-progress {
  opacity: 1;
}

.viewer-actions button.export-running {
  border-color: rgba(240, 90, 50, 0.42);
  background: #fffaf7;
}

.viewer-actions button.export-done .action-progress i {
  background: #3f9461;
}

.viewer-actions button.export-error .action-progress i {
  background: #c84a30;
}

.cdr-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #756d64;
  font-size: 9px;
}

.cdr-version-row select {
  min-width: 120px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.cdr-picker-overlay {
  position: fixed;
  z-index: 10020;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(31, 26, 21, 0.42);
  backdrop-filter: blur(6px);
}

.cdr-picker-overlay.visible {
  display: flex;
}

.cdr-picker {
  width: min(620px, 100%);
  max-height: min(720px, 88vh);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(62, 51, 39, 0.13);
  border-radius: 18px;
  background: #fffdf9;
  box-shadow: 0 30px 90px rgba(30, 24, 18, 0.28);
}

.cdr-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.cdr-picker-header h3 {
  margin: 5px 0 0;
  font-size: 20px;
}

.cdr-picker-note {
  margin: 14px 0 18px;
  color: #817970;
  font-size: 12px;
}

.cdr-picker-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.cdr-picker-options button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.cdr-picker-options button:hover {
  border-color: rgba(240, 90, 50, 0.5);
  background: #fff8f4;
}

.cdr-picker-options strong {
  font-size: 13px;
}

.cdr-picker-options small {
  color: #958d84;
  font-size: 10px;
}

@media (max-width: 560px) {
  .cdr-picker-options {
    grid-template-columns: 1fr;
  }
}

.viewer-layers-head {
  display: flex;
  justify-content: space-between;
  margin-top: 21px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: #655f58;
  font-size: 9px;
  font-weight: 700;
}

.viewer-layers {
  padding-top: 2px;
}

.viewer-layers .layer-row {
  padding: 8px 0;
}

.image-context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 132px;
  padding: 6px;
  border: 1px solid rgba(32, 28, 24, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 36px rgba(35, 28, 20, 0.18);
  backdrop-filter: blur(12px);
}

.image-context-menu[hidden] {
  display: none;
}

.image-context-menu button {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.image-context-menu button:hover {
  background: #f3efe8;
}

body.viewer-open {
  overflow: hidden;
}

.result-simple-copy {
  min-width: 0;
  flex: 1;
}

.result-simple-copy strong {
  display: block;
  overflow: hidden;
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-simple-copy small {
  display: block;
  margin-top: 3px;
  color: #9a948c;
  font-size: 8px;
}

.result-action {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  font-size: 8px;
  font-weight: 650;
}

.result-action:hover {
  border-color: #c8c0b5;
}

.download-popover {
  position: relative;
}

.download-menu {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: calc(100% + 7px);
  display: none;
  width: 150px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(34, 29, 23, 0.14);
}

.download-menu.open {
  display: grid;
}

.download-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid #f0ede7;
  background: #fff;
  cursor: pointer;
  font-size: 9px;
  text-align: left;
}

.download-menu button:last-child {
  border-bottom: 0;
}

.download-menu button:hover {
  background: #f8f7f4;
}

.download-menu em {
  color: #aca59c;
  font-size: 7px;
  font-style: normal;
}

.export-progress {
  position: relative;
  padding: 11px 13px;
  border-top: 1px solid var(--line);
  background: #fbfaf7;
  overflow: hidden;
}

.export-progress[hidden] {
  display: none;
}

.export-progress-track {
  position: relative;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: #e9e5de;
}

.export-progress-track i {
  position: relative;
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 260ms ease;
}

.export-progress-track i::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.7) 45%,
    transparent 90%
  );
  transform: translateX(-100%);
  animation: exportShine 1.45s linear infinite;
  content: "";
}

.export-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  color: #8a8379;
  font-size: 9px;
  line-height: 1.45;
}

.export-live {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.export-stage {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  animation: exportTextPulse 2.3s ease-in-out infinite;
}

.export-spinner {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border: 2px solid rgba(240, 90, 50, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: exportSpin 0.8s linear infinite;
}

.export-progress.is-active {
  background: linear-gradient(100deg, #fbfaf7 10%, #fff5ed 50%, #fbfaf7 90%);
  background-size: 220% 100%;
  animation: exportPanelFlow 3.2s linear infinite;
}

.export-progress.error {
  color: #a8402a;
  background: #fff3ee;
}

.export-progress.error .export-progress-track i {
  background: #c84a30;
}

.export-progress.error .export-spinner {
  border-color: #c84a30;
  animation: none;
}

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

@keyframes exportShine {
  to { transform: translateX(100%); }
}

@keyframes exportTextPulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

@keyframes exportPanelFlow {
  to { background-position: -220% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .export-progress,
  .export-progress-track i::after,
  .export-stage,
  .export-spinner {
    animation: none;
  }
}

.composer:focus-within {
  border-color: #bfb6aa;
  box-shadow: 0 22px 55px rgba(46, 38, 28, 0.11), 0 0 0 3px rgba(240, 90, 50, 0.06);
}

.composer textarea {
  display: block;
  width: 100%;
  max-height: 180px;
  min-height: 29px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  line-height: 1.7;
}

.composer textarea::placeholder {
  color: #a8a199;
}

.composer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
}

.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  gap: 9px;
}

.composer-left {
  flex-wrap: wrap;
}

.add-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf9f6;
  cursor: pointer;
}

.add-button:hover {
  border-color: #c9c1b6;
}

.add-button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.image-model-picker {
  display: inline-flex;
  height: 28px;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  border: 1px solid #d8c7b6;
  border-radius: 8px;
  background: #fffaf3;
  color: #7d6c5e;
  cursor: pointer;
}

.image-model-picker:hover,
.image-model-picker:focus-within {
  border-color: #c3aa95;
  background: #fff;
}

.image-model-picker span {
  font-size: 8px;
  white-space: nowrap;
}

.image-model-picker select {
  width: 190px;
  max-width: 28vw;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
}

.image-model-hint {
  max-width: 230px;
  color: #9c8a7a;
  font-size: 8px;
  line-height: 1.35;
}

.fidelity-picker {
  display: inline-flex;
  height: 28px;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf9f6;
  color: #817970;
  cursor: pointer;
}

.fidelity-picker:hover,
.fidelity-picker:focus-within {
  border-color: #c9c1b6;
  background: #fff;
}

.fidelity-picker span {
  font-size: 8px;
  white-space: nowrap;
}

.fidelity-picker select {
  max-width: 74px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 9px;
  font-weight: 650;
  cursor: pointer;
}

.locked-text-picker {
  display: inline-flex;
  height: 28px;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf9f6;
  color: #817970;
}

.locked-text-picker:hover,
.locked-text-picker:focus-within {
  border-color: #c9c1b6;
  background: #fff;
}

.locked-text-picker span {
  font-size: 8px;
  white-space: nowrap;
}

.locked-text-picker input {
  width: min(190px, 23vw);
  min-width: 110px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 9px;
}

.locked-text-picker input::placeholder {
  color: #aaa39b;
}

.input-hint,
.shortcut-hint {
  color: #aaa39b;
  font-size: 8px;
}

.send-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  transition: opacity 160ms ease, transform 160ms ease;
}

.send-button:hover {
  transform: translateY(-1px);
}

.send-button:disabled {
  cursor: default;
  opacity: 0.34;
  transform: none;
}

.send-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.composer-note {
  margin: 8px 0 0;
  color: #b2aba2;
  font-size: 8px;
  text-align: center;
}

.attachment-tray {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding: 0 2px 9px;
}

.attachment-tray.has-files {
  display: flex;
}

.attachment-chip {
  position: relative;
  width: 66px;
  height: 56px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 5px 15px rgba(40, 32, 24, 0.06);
}

.attachment-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-chip span {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  font-size: 7px;
}

.attachment-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(20, 20, 20, 0.7);
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
}

.drop-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(255, 253, 249, 0.82);
  backdrop-filter: blur(12px);
}

.drop-overlay.visible {
  display: grid;
}

.drop-card {
  display: grid;
  width: min(420px, calc(100% - 44px));
  min-height: 180px;
  place-content: center;
  border: 1.5px dashed #c9beb0;
  border-radius: 24px;
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow);
}

.drop-card strong {
  font-size: 20px;
}

.drop-card span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  bottom: 26px;
  max-width: min(420px, calc(100% - 36px));
  padding: 10px 14px;
  border: 1px solid #37322c;
  border-radius: 10px;
  color: #fff;
  background: #211e1b;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sidebar-scrim {
  display: none;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink {
  0%,
  70%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes typingCardSweep {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -80% 0;
  }
}

@keyframes typingCardBreathe {
  0%,
  100% {
    border-color: #e6ded3;
    box-shadow: 0 8px 24px rgba(46, 38, 28, 0.06);
  }
  50% {
    border-color: #ead4c9;
    box-shadow: 0 10px 30px rgba(216, 119, 85, 0.1);
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 270px;
    transform: translateX(-104%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 15;
    inset: 0;
    display: none;
    background: rgba(25, 22, 19, 0.28);
  }

  .sidebar-scrim.visible {
    display: block;
  }

  .mobile-menu {
    display: grid;
  }

  .topbar {
    padding: 0 14px;
  }

  .conversation-heading {
    margin-right: auto;
    margin-left: 10px;
  }

  .local-badge {
    display: none;
  }

  .typing-card {
    max-width: 100%;
    gap: 8px;
    padding: 9px 13px;
    font-size: 11px;
  }

  .typing-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 680px) {
  .welcome,
  .messages,
  .composer-shell {
    width: calc(100% - 26px);
  }

  .welcome {
    padding-top: 48px;
  }

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

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

  .poster-stage {
    min-height: 255px;
  }

  .demo-poster {
    width: 175px;
  }

  .user-bubble {
    max-width: 88%;
  }

  .composer-shell {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .composer-note,
  .shortcut-hint {
    display: none;
  }

  .viewer-overlay {
    padding: 0;
  }

  .viewer-dialog {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }

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

  .viewer-media {
    min-height: 48vh;
    padding: 18px;
  }

  .viewer-media img {
    max-height: 56vh;
  }

  .viewer-panel {
    overflow: visible;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .viewer-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.purchase-overlay{position:fixed;inset:0;z-index:200;display:grid;place-items:center;padding:20px;background:rgba(25,20,16,.62);backdrop-filter:blur(7px)}
.purchase-overlay[hidden]{display:none}
.purchase-dialog{width:min(390px,100%);padding:28px;border-radius:22px;background:#fffdf9;text-align:center;box-shadow:0 30px 90px rgba(0,0,0,.28)}
.purchase-icon{width:52px;height:52px;margin:0 auto 14px;display:grid;place-items:center;border-radius:16px;background:#211c18;color:#fff;font:700 28px Georgia,serif}
.purchase-dialog h3{margin:0;font-size:22px}.purchase-dialog p{margin:8px 0 22px;color:#81786f}
.purchase-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.purchase-actions button,.purchase-actions a{display:grid;place-items:center;min-height:44px;border-radius:12px;cursor:pointer;text-decoration:none}
.purchase-actions button{border:1px solid #e4dbd1;background:#fff;color:#201c18}
.purchase-actions a{border:1px solid #211c18;background:#211c18;color:#fff}

.download-notice-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(25, 20, 16, 0.66);
  backdrop-filter: blur(8px);
}

.download-notice-overlay[hidden] {
  display: none;
}

.download-notice-dialog {
  width: min(500px, 100%);
  padding: 26px;
  border-radius: 20px;
  background: #fffdf9;
  box-shadow: 0 30px 100px rgba(22, 17, 13, 0.32);
}

.download-notice-kicker {
  color: #b64d2d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.download-notice-dialog h3 {
  margin: 7px 0 8px;
  font-size: 22px;
}

.download-notice-dialog > p {
  margin: 0;
  color: #72695f;
  font-size: 13px;
  line-height: 1.65;
}

.download-notice-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 14px;
}

.download-notice-facts > div {
  padding: 14px 15px;
  border: 1px solid #e7ddd2;
  border-radius: 12px;
  background: #f9f5ef;
}

.download-notice-facts small {
  display: block;
  margin-bottom: 5px;
  color: #91877c;
  font-size: 10px;
}

.download-notice-facts strong {
  color: #251f1a;
  font-size: 15px;
  line-height: 1.4;
}

.download-notice-reason {
  padding: 12px 14px;
  border-radius: 11px;
  background: #fff3e9;
  color: #83523d !important;
  font-size: 12px !important;
}

.download-notice-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 10px;
  margin-top: 20px;
}

.download-notice-actions button {
  min-height: 45px;
  border-radius: 11px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

#downloadNoticeCancel {
  border: 1px solid #ddd2c7;
  background: #fff;
  color: #4d463f;
}

#downloadNoticeConfirm {
  border: 1px solid #211c18;
  background: #211c18;
  color: #fff;
}

@media (max-width: 520px) {
  .download-notice-facts,
  .download-notice-actions {
    grid-template-columns: 1fr;
  }
}

.purpose-overlay {
  position: fixed;
  z-index: 240;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(25, 20, 16, 0.66);
  backdrop-filter: blur(9px);
}

.purpose-overlay[hidden] {
  display: none;
}

.purpose-dialog {
  display: flex;
  width: min(1040px, 100%);
  max-height: calc(100dvh - 36px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 34px 110px rgba(24, 18, 13, 0.35);
}

.purpose-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--line);
}

.purpose-header h2 {
  margin: 5px 0 5px;
  font-size: clamp(22px, 2.4vw, 30px);
  letter-spacing: -0.03em;
}

.purpose-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.purpose-layout {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.9fr);
  min-height: 0;
  overflow: hidden;
}

.purpose-visual {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  overflow: auto;
  background:
    linear-gradient(45deg, #f4f1eb 25%, transparent 25%),
    linear-gradient(-45deg, #f4f1eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f4f1eb 75%),
    linear-gradient(-45deg, transparent 75%, #f4f1eb 75%);
  background-color: #fbfaf7;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  background-size: 18px 18px;
}

.purpose-canvas {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(35, 29, 24, 0.14);
  border-radius: 14px;
  background: #ece9e3;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.purpose-canvas.is-idle {
  cursor: default;
}

.purpose-canvas img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.purpose-box-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.purpose-draw-box,
.purpose-saved-box {
  position: absolute;
  border: 2px solid #ff5a32;
  background: rgba(255, 90, 50, 0.13);
  border-radius: 4px;
}

.purpose-saved-box {
  pointer-events: auto;
  cursor: pointer;
}

.purpose-saved-box span {
  position: absolute;
  left: -2px;
  top: -24px;
  max-width: 150px;
  overflow: hidden;
  padding: 3px 7px;
  border-radius: 5px 5px 5px 0;
  background: #26211d;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purpose-canvas-tip {
  margin: 0;
  color: #6f6860;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.purpose-settings {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 15px;
  padding: 20px 22px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: #fffefb;
}

.purpose-ai-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid #eadfd1;
  border-radius: 12px;
  background: #fff8ef;
}

.purpose-ai-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d0b184;
  box-shadow: 0 0 0 4px rgba(208, 177, 132, 0.14);
}

.purpose-ai-banner.is-ready .purpose-ai-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(36, 122, 84, 0.12);
}

.purpose-ai-banner.is-low .purpose-ai-dot {
  background: #d58b25;
  box-shadow: 0 0 0 4px rgba(213, 139, 37, 0.12);
}

.purpose-ai-banner strong {
  display: block;
  font-size: 12px;
  line-height: 1.5;
}

.purpose-ai-banner p {
  margin: 3px 0 0;
  color: #786f66;
  font-size: 11px;
  line-height: 1.55;
}

.purpose-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.purpose-options button {
  min-height: 72px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.purpose-options button:hover {
  border-color: #c9b7a5;
  transform: translateY(-1px);
}

.purpose-options button.is-active {
  border-color: #251f1b;
  background: #251f1b;
  color: #fff;
}

.purpose-options button strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.purpose-options button span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.purpose-options button.is-active span {
  color: rgba(255, 255, 255, 0.68);
}

.purpose-display-fields {
  display: grid;
  gap: 14px;
  padding-top: 2px;
}

.purpose-display-fields[hidden] {
  display: none;
}

.purpose-ratio-note {
  padding: 12px 13px;
  border: 1px solid #e8ddcf;
  border-radius: 11px;
  background: #fbf6ef;
}

.purpose-ratio-note strong {
  display: block;
  color: #4d4034;
  font-size: 11px;
}

.purpose-ratio-note p {
  margin: 4px 0 0;
  color: #7b6f63;
  font-size: 10px;
  line-height: 1.6;
}

.purpose-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.purpose-field-head strong {
  font-size: 12px;
}

.purpose-field-head span {
  color: var(--muted);
  font-size: 10px;
}

.purpose-field-head button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #8b6c4f;
  font-size: 10px;
  cursor: pointer;
}

.purpose-size-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.purpose-size-grid label {
  color: #6e665e;
  font-size: 10px;
}

.purpose-size-input {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.purpose-size-input:focus-within {
  border-color: #9f8c78;
}

.purpose-size-input.is-error {
  border-color: #d94a35;
  background: #fff7f4;
  box-shadow: 0 0 0 3px rgba(217, 74, 53, 0.1);
}

.purpose-size-input input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.purpose-size-input b {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.purpose-form-error {
  margin: -4px 0 0;
  padding: 8px 10px;
  border: 1px solid #f0c4b9;
  border-radius: 8px;
  background: #fff6f3;
  color: #b5412d;
  font-size: 10px;
  line-height: 1.5;
}

.purpose-form-error[hidden] {
  display: none;
}

.purpose-selection-tools {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8f4;
}

.purpose-box-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.purpose-box-toolbar label {
  display: grid;
  gap: 5px;
  color: #6e665e;
  font-size: 10px;
}

.purpose-box-toolbar select {
  min-width: 124px;
  height: 34px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
}

.purpose-box-toolbar > span {
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
}

.purpose-box-list {
  display: grid;
  max-height: 100px;
  gap: 6px;
  overflow-y: auto;
}

.purpose-box-list p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.purpose-box-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  background: #fff;
  font-size: 10px;
}

.purpose-box-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purpose-box-mode {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #faf8f4;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.purpose-box-row button {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: #f2eee8;
  color: #7a7066;
  cursor: pointer;
}

.purpose-actions {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr auto;
  gap: 9px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  background: #fffefb;
  box-shadow: 0 -12px 28px rgba(36, 28, 21, 0.04);
}

.purpose-actions button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 12px;
  cursor: pointer;
}

.purpose-skip {
  border: 1px solid var(--line);
  background: #fff;
  color: #625b54;
}

.purpose-confirm {
  min-width: 130px;
  border: 1px solid #251f1b;
  background: #251f1b;
  color: #fff;
}

.purpose-confirm:disabled {
  border-color: #d7d1ca;
  background: #d7d1ca;
  cursor: not-allowed;
}

.purpose-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px dashed #cdbba9;
  border-radius: 9px;
  background: #fff8ef;
  color: #76563b;
  font-size: 10px;
  cursor: pointer;
}

.purpose-trigger b {
  max-width: 150px;
  overflow: hidden;
  color: #2b241e;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-library-entry {
  display: flex;
  width: min(650px, 100%);
  margin: 22px auto 18px;
  padding: 15px 18px;
  align-items: center;
  gap: 14px;
  border: 1px solid #ead8c9;
  border-radius: 16px;
  color: #2a211b;
  background:
    radial-gradient(circle at 92% 20%, rgba(240, 90, 50, 0.14), transparent 28%),
    linear-gradient(135deg, #fffaf4, #fffdfb 62%, #fff4ec);
  box-shadow: 0 12px 32px rgba(76, 52, 32, 0.08);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.font-library-entry:hover {
  transform: translateY(-2px);
  border-color: #ddbda7;
  box-shadow: 0 16px 38px rgba(76, 52, 32, 0.12);
}

.font-library-badge {
  padding: 6px 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.font-library-entry-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.font-library-entry-copy strong {
  font-family: "DFYaSongW9-GB", "Microsoft YaHei UI", sans-serif;
  font-size: 19px;
  letter-spacing: 0.02em;
}

.font-library-entry-copy small {
  color: #776b61;
  font-size: 12px;
  line-height: 1.55;
}

.font-library-enter {
  margin-left: auto;
  flex: 0 0 auto;
  color: #aa4525;
  font-size: 12px;
  font-weight: 700;
}

.font-library-enter b {
  font-size: 17px;
}

@media (max-width: 860px) {
  .purpose-overlay {
    padding: 0;
  }

  .purpose-dialog {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .purpose-layout {
    grid-template-columns: 1fr;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .purpose-visual {
    min-height: 300px;
    overflow: visible;
  }

  .purpose-settings {
    overflow: visible;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 520px) {
  .font-library-entry {
    margin: 18px auto 14px;
    padding: 13px 14px;
    align-items: flex-start;
    gap: 10px;
  }

  .font-library-entry-copy small {
    font-size: 11px;
  }

  .font-library-enter {
    font-size: 0;
  }

  .font-library-enter b {
    font-size: 20px;
  }

  .purpose-header {
    padding: 18px;
  }

  .purpose-header p {
    display: none;
  }

  .purpose-visual {
    padding: 12px;
  }

  .purpose-settings {
    padding: 16px 14px 22px;
  }

  .purpose-options {
    grid-template-columns: 1fr;
  }

  .purpose-options button {
    min-height: 58px;
  }

  .purpose-size-grid {
    grid-template-columns: 1fr 1fr;
  }

  .purpose-size-grid label:last-child {
    grid-column: 1 / -1;
  }
}

/* Layered export review canvas */
body.layer-review-open {
  overflow: hidden;
}

.layer-review-overlay {
  position: fixed;
  z-index: 620;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 17, 15, 0.76);
  backdrop-filter: blur(10px);
}

.layer-review-overlay.visible {
  display: flex;
  animation: rise-in 180ms ease both;
}

.layer-review-dialog {
  display: flex;
  width: min(1540px, 96vw);
  height: min(920px, 94dvh);
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: #fffdf9;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.38);
}

.layer-review-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 13px 18px 13px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.98);
}

.layer-review-header h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.layer-review-body {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 340px;
}

.layer-review-stage-column {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: #1d1c19;
}

.layer-review-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: #262521;
  color: #f8f3eb;
}

.layer-review-toolbar-group {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.layer-review-toolbar button {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: #d8d3cb;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.layer-review-toolbar button:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.layer-review-toolbar button.is-active {
  border-color: #f1704c;
  background: #f05a32;
  color: #fff;
}

.layer-review-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.layer-review-zoom-group #layerReviewZoomOut,
.layer-review-zoom-group #layerReviewZoomIn {
  width: 32px;
  padding-right: 0;
  padding-left: 0;
  font-size: 16px;
}

.layer-review-zoom-group span {
  min-width: 42px;
  color: #fff;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.layer-review-compare-control {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  color: #c9c3bb;
  font-size: 9px;
  font-weight: 700;
}

.layer-review-compare-control input {
  width: 74px;
  accent-color: #f05a32;
  cursor: ew-resize;
}

.layer-review-viewport {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  background-color: #191816;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.025) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.025) 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
  cursor: default;
}

.layer-review-viewport.is-dragging {
  cursor: grabbing;
}

.layer-review-paper {
  --paper-ratio: 0.75;
  position: relative;
  width: min(72%, 720px);
  max-width: calc(100% - 56px);
  max-height: calc(100% - 56px);
  aspect-ratio: var(--paper-ratio);
  flex: none;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  transform-origin: center center;
  will-change: transform;
}

.layer-review-paper img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.layer-review-original,
.layer-review-background,
.layer-review-items,
.layer-review-repair-layer,
.layer-review-outline-image,
.layer-review-highlight,
.layer-review-compare-divider,
.layer-review-draw-box {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.layer-review-original {
  z-index: 8;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.layer-review-paper.is-compare-view .layer-review-original.is-visible {
  clip-path: inset(0 calc(100% - var(--compare-position, 50%)) 0 0);
  opacity: 1;
}

.layer-review-paper.is-compare-view .layer-review-original {
  opacity: 0.02;
}

.layer-review-background {
  z-index: 1;
  pointer-events: none;
}

.layer-review-items {
  z-index: 2;
  pointer-events: none;
}

.layer-review-layer {
  position: absolute;
  display: block;
  max-width: none;
  pointer-events: auto;
  cursor: move;
  touch-action: none;
  transition: opacity 100ms ease, filter 100ms ease;
  user-select: none;
}

.layer-review-layer:hover,
.layer-review-layer.is-selected {
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.95))
    drop-shadow(0 0 3px rgba(255, 92, 57, 0.7));
}

.layer-review-paper.is-compare-view .layer-review-layer {
  pointer-events: auto;
}

.layer-review-layer.is-hidden,
.layer-review-background.is-hidden,
.layer-review-highlight.is-hidden,
.layer-review-outline-image.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.layer-review-highlight {
  z-index: 6;
  border: 2px solid #ff6944;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.65) inset,
    0 0 24px rgba(255, 105, 68, 0.5);
  opacity: 0;
  pointer-events: none;
}

.layer-review-highlight.is-visible {
  opacity: 1;
}

.layer-review-outline-image {
  z-index: 7;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 1px rgba(0, 132, 160, 0.9));
  transition: opacity 120ms ease;
}

.layer-review-outline-image.is-visible {
  visibility: visible;
  opacity: 1;
}

.layer-review-repair-layer {
  z-index: 9;
  pointer-events: none;
}

.layer-review-repair-preview {
  position: absolute;
  overflow: hidden;
  border: 2px solid #ff6841;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.8) inset,
    0 0 18px rgba(255, 104, 65, 0.48);
  background: #fff;
  pointer-events: auto;
}

.layer-review-repair-preview img {
  position: absolute;
  display: block;
  max-width: none;
  pointer-events: none;
}

.layer-review-repair-preview button {
  position: absolute;
  z-index: 2;
  top: 3px;
  right: 3px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: #e54724;
  color: #fff;
  cursor: pointer;
  font: 800 12px/1 sans-serif;
}

.layer-review-compare-divider {
  z-index: 11;
  left: var(--compare-position, 50%);
  width: 2px;
  margin-left: -1px;
  background: #ff6a43;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
  opacity: 0;
  pointer-events: none;
}

.layer-review-compare-divider.is-visible {
  opacity: 1;
}

.layer-review-draw-box {
  z-index: 12;
  inset: auto;
  display: none;
  border: 2px dashed #ffd45a;
  background: rgba(255, 212, 90, 0.12);
  box-shadow: 0 0 0 1px rgba(30, 28, 24, 0.75) inset;
  pointer-events: none;
}

.layer-review-draw-box.is-visible {
  display: block;
}

.layer-review-paper.is-repairing {
  cursor: crosshair;
}

.layer-review-paper.is-repairing .layer-review-layer,
.layer-review-paper.is-repairing .layer-review-repair-preview {
  pointer-events: none;
}

.layer-review-empty {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  background: rgba(24, 23, 21, 0.82);
  color: #fff;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.layer-review-empty.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.layer-review-empty strong {
  font-size: 13px;
}

.layer-review-empty small {
  color: #b9b2a9;
  font-size: 10px;
}

.layer-review-loader {
  width: 27px;
  height: 27px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ff7957;
  border-radius: 50%;
  animation: exportSpin 0.85s linear infinite;
}

.layer-review-stage-tip {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 16px 10px;
  background: #1d1c19;
  color: #8f8981;
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
}

.layer-review-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: #fffdf9;
}

.layer-review-summary {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 0.62fr 0.62fr 0.78fr 1fr 0.72fr;
  border-bottom: 1px solid var(--line);
}

.layer-review-summary > div {
  min-width: 0;
  padding: 13px 10px 12px;
  border-right: 1px solid var(--line);
}

.layer-review-summary > div:last-child {
  border-right: 0;
}

.layer-review-summary span,
.layer-review-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-review-summary span {
  margin-bottom: 5px;
  color: #938b82;
  font-size: 8px;
}

.layer-review-summary strong {
  color: #403a34;
  font-size: 11px;
}

.layer-review-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.layer-review-list-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  color: #615a53;
  font-size: 10px;
  font-weight: 800;
}

.layer-review-list-head button {
  padding: 4px 7px;
  border: 0;
  border-radius: 6px;
  background: #f2eee7;
  color: #786e64;
  cursor: pointer;
  font: inherit;
  font-size: 9px;
}

.layer-review-list {
  min-height: 90px;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 9px 8px;
}

.layer-review-row {
  display: grid;
  min-height: 52px;
  grid-template-columns: 25px 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  padding: 5px 7px 5px 4px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  outline: none;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    opacity 120ms ease;
}

.layer-review-row-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}

.layer-review-row:hover,
.layer-review-row:focus-visible {
  border-color: #e4dcd2;
  background: #faf7f2;
}

.layer-review-row.is-selected {
  border-color: #efb49f;
  background: #fff5ef;
}

.layer-review-row.is-layer-hidden {
  opacity: 0.52;
}

.layer-review-eye {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #6d655c;
  cursor: pointer;
  font-size: 14px;
}

.layer-review-thumb {
  position: relative;
  display: block;
  width: 42px;
  height: 38px;
  overflow: hidden;
  border: 1px solid #e5dfd7;
  border-radius: 6px;
  background:
    linear-gradient(45deg, #eeeae3 25%, transparent 25%),
    linear-gradient(-45deg, #eeeae3 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eeeae3 75%),
    linear-gradient(-45deg, transparent 75%, #eeeae3 75%),
    #fff;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  background-size: 10px 10px;
}

.layer-review-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.layer-review-thumb-background {
  background: linear-gradient(135deg, #e7efe8, #f6e7d7);
}

.layer-review-row-copy {
  min-width: 0;
}

.layer-review-row-copy strong,
.layer-review-row-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-review-row-copy strong {
  color: #403a34;
  font-size: 10px;
  font-weight: 700;
}

.layer-review-row-copy small {
  margin-top: 3px;
  color: #9b9288;
  font-size: 8px;
}

.layer-review-row-badge {
  padding: 3px 5px;
  border-radius: 999px;
  background: #f1ede6;
  color: #8d847a;
  font-size: 7px;
  font-weight: 800;
  white-space: nowrap;
}

.layer-review-row-badge.has-outline {
  background: #e6f4f6;
  color: #247786;
}

.layer-review-outline-toggle {
  min-width: 47px;
  padding: 4px 6px;
  border: 1px solid #ddd5cb;
  border-radius: 999px;
  background: #fff;
  color: #9a9085;
  cursor: pointer;
  font-size: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.layer-review-outline-toggle:hover {
  border-color: #73aeb7;
  color: #247786;
}

.layer-review-outline-toggle.is-outline-selected {
  border-color: #a8d5dc;
  background: #e6f4f6;
  color: #1f6c78;
}

.layer-review-vector-toggle {
  min-width: 51px;
  padding: 4px 6px;
  border: 1px solid #d9ddc8;
  border-radius: 999px;
  background: #fff;
  color: #858a6b;
  cursor: pointer;
  font-size: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.layer-review-vector-toggle:hover {
  border-color: #95ad66;
  color: #526b27;
}

.layer-review-vector-toggle.is-vector-selected {
  border-color: #b8cf8b;
  background: #eff7df;
  color: #49651d;
}

.layer-review-vector-toggle.is-vector-ready {
  border-color: #7e9f47;
  background: #dfeec2;
  color: #385416;
}

.layer-review-vector-toggle:disabled {
  cursor: wait;
  opacity: 0.66;
}

.layer-review-note {
  flex: 0 0 auto;
  margin: 4px 12px 10px;
  padding: 10px 11px;
  border: 1px solid #dfecec;
  border-radius: 9px;
  background: #f1f9f9;
}

.layer-review-note strong,
.layer-review-note span {
  display: block;
}

.layer-review-note strong {
  color: #315f64;
  font-size: 9px;
}

.layer-review-note span {
  margin-top: 4px;
  color: #708b8d;
  font-size: 8px;
  line-height: 1.55;
}

.layer-review-actions {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 0.8fr 1.4fr;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.layer-review-actions button {
  min-height: 42px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
}

.layer-review-cancel {
  border: 1px solid #ddd5cb;
  background: #fff;
  color: #655d55;
}

.layer-review-confirm {
  border: 1px solid #1f1d19;
  background: #1f1d19;
  color: #fff;
}

.layer-review-confirm:hover:not(:disabled) {
  background: #f05a32;
  border-color: #f05a32;
}

.layer-review-actions button:disabled {
  cursor: wait;
  opacity: 0.48;
}

@media (max-width: 1000px) {
  .layer-review-body {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .layer-review-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .layer-review-toolbar-group {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .layer-review-toolbar-group::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 760px) {
  .layer-review-overlay {
    padding: 0;
  }

  .layer-review-dialog {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .layer-review-header {
    min-height: 58px;
    padding: 10px 13px;
  }

  .layer-review-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(315px, 50dvh) minmax(0, 1fr);
  }

  .layer-review-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .layer-review-summary > div {
    padding: 9px 8px;
  }

  .layer-review-list {
    max-height: none;
  }

  .layer-review-note {
    display: none;
  }

  .layer-review-actions {
    padding: 9px 11px max(10px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 520px) {
  .layer-review-header h2 {
    font-size: 13px;
  }

  .layer-review-header .viewer-kicker {
    display: none;
  }

  .layer-review-toolbar {
    min-height: 47px;
    padding: 7px 9px;
  }

  .layer-review-toolbar button {
    min-height: 29px;
    padding: 5px 8px;
    font-size: 9px;
  }

  .layer-review-stage-tip {
    padding: 6px 9px 7px;
    font-size: 8px;
  }

  .layer-review-summary {
    grid-template-columns: 0.7fr 0.7fr 1.05fr 0.8fr;
  }

  .layer-review-summary span {
    font-size: 7px;
  }

  .layer-review-summary strong {
    font-size: 9px;
  }

  .layer-review-row {
    grid-template-columns: 24px 38px minmax(0, 1fr) auto;
    gap: 5px;
  }

  .layer-review-thumb {
    width: 38px;
    height: 34px;
  }

  .layer-review-actions button {
    min-height: 38px;
    font-size: 9px;
  }
}
