:root {
  --stage: #101012;
  --sidebar: #15161a;
  --surface: #202127;
  --surface-hover: rgba(204, 221, 255, 0.08);
  --surface-active: rgba(204, 221, 255, 0.12);
  --border: rgba(204, 221, 255, 0.06);
  --border-strong: rgba(204, 221, 255, 0.14);
  --text: #f5fbff;
  --text-secondary: rgba(224, 245, 255, 0.6);
  --text-muted: rgba(224, 245, 255, 0.35);
  --primary: #ef2d2d;
  --danger: #ef7373;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  color: var(--text);
  background: var(--stage);
  letter-spacing: 0;
}

:root[data-theme="light"] {
  --stage: #f6f7f9;
  --sidebar: #ffffff;
  --surface: #f1f3f6;
  --surface-hover: rgba(19, 33, 50, 0.07);
  --surface-active: rgba(19, 33, 50, 0.12);
  --border: rgba(19, 33, 50, 0.1);
  --border-strong: rgba(19, 33, 50, 0.22);
  --text: #1b2430;
  --text-secondary: #526071;
  --text-muted: #667382;
  --primary: #ef2d2d;
  --danger: #c43f4a;
  color-scheme: light;
}

:root[data-theme="light"] .prompt-dock,
:root[data-theme="light"] .tool-popover,
:root[data-theme="light"] .reference-preview-delete,
:root[data-theme="light"] .delete-confirm-dialog,
:root[data-theme="light"] .inpaint-dialog,
:root[data-theme="light"] .inpaint-mark-guide {
  background: #ffffff;
}

:root[data-theme="light"] .delete-confirm-modal {
  background: rgba(20, 30, 42, 0.38);
}

:root[data-theme="light"] .delete-confirm-dialog {
  border-color: rgba(19, 33, 50, 0.14);
  box-shadow: 0 24px 72px rgba(19, 33, 50, 0.2);
}

:root[data-theme="light"] .delete-confirm-header h2,
:root[data-theme="light"] .delete-confirm-close {
  color: #1b2430;
}

:root[data-theme="light"] .delete-confirm-copy {
  color: #667382;
}

:root[data-theme="light"] .delete-confirm-close:hover,
:root[data-theme="light"] .delete-confirm-close:focus-visible {
  background: rgba(19, 33, 50, 0.08);
}

:root[data-theme="light"] .delete-confirm-cancel {
  background: #eef1f5;
  color: #263342;
}

:root[data-theme="light"] .delete-confirm-cancel:hover,
:root[data-theme="light"] .delete-confirm-cancel:focus-visible {
  background: #e2e7ed;
}

:root[data-theme="light"] .delete-confirm-submit {
  background: #ef2d2d;
  color: #ffffff;
}

:root[data-theme="light"] .delete-confirm-submit:hover,
:root[data-theme="light"] .delete-confirm-submit:focus-visible {
  background: #d92323;
}

:root[data-theme="light"] .result-record + .result-record {
  border-color: rgba(19, 33, 50, 0.1);
}

:root[data-theme="light"] .sidebar-content {
  scrollbar-color: rgba(19, 33, 50, 0.24) transparent;
}

:root[data-theme="light"] .history-status.succeeded {
  background: #268c5c;
}

:root[data-theme="light"] .history-menu,
:root[data-theme="light"] .history-rename-input,
:root[data-theme="light"] .toast {
  border-color: rgba(19, 33, 50, 0.14);
  background: #ffffff;
  color: #263342;
}

:root[data-theme="light"] .history-menu,
:root[data-theme="light"] .toast {
  box-shadow: 0 14px 34px rgba(19, 33, 50, 0.16);
}

:root[data-theme="light"] .reference-preview {
  border-color: rgba(19, 33, 50, 0.16);
  background: #e9edf2;
}

:root[data-theme="light"] .reference-button.has-reference {
  background: rgba(19, 33, 50, 0.06);
}

:root[data-theme="light"] .image-count-options {
  background: rgba(19, 33, 50, 0.06);
}

:root[data-theme="light"] .image-count-options button:hover,
:root[data-theme="light"] .image-count-options button.active {
  background: rgba(19, 33, 50, 0.12);
}

:root[data-theme="light"] .ratio-options {
  background: rgba(19, 33, 50, 0.06);
}

:root[data-theme="light"] .ratio-options button:hover,
:root[data-theme="light"] .ratio-options button.active {
  background: rgba(19, 33, 50, 0.1);
}

:root[data-theme="light"] .model-options {
  background: rgba(19, 33, 50, 0.06);
}

:root[data-theme="light"] .model-options button:hover,
:root[data-theme="light"] .model-options button.active {
  background: rgba(19, 33, 50, 0.1);
}

:root[data-theme="light"] .result-image-open:focus-visible {
  outline-color: var(--primary);
}

:root[data-theme="light"] .result-day {
  color: #364454;
}

:root[data-theme="light"] .result-day::after {
  background: rgba(19, 33, 50, 0.1);
}

:root[data-theme="light"] .result-prompt {
  color: #263342;
}

:root[data-theme="light"] .result-mode-label {
  border-color: rgba(19, 33, 50, 0.13);
  background: rgba(19, 33, 50, 0.07);
  color: #455364;
}

:root[data-theme="light"] .result-mode-label:not(.is-static):hover,
:root[data-theme="light"] .result-mode-label:not(.is-static):focus-visible {
  border-color: rgba(19, 33, 50, 0.24);
  background: rgba(19, 33, 50, 0.12);
  color: #182331;
}

:root[data-theme="light"] .result-action-button {
  border: 1px solid rgba(19, 33, 50, 0.1);
  background: #e9edf2;
  color: #3e4c5d;
}

:root[data-theme="light"] .result-action-button:hover,
:root[data-theme="light"] .result-action-button:focus-visible {
  background: #dde3ea;
  color: #182331;
  outline: none;
}

:root[data-theme="light"] .result-action-button.delete-action:hover,
:root[data-theme="light"] .result-action-button.delete-action:focus-visible {
  color: #c43f4a;
}

:root[data-theme="light"] .canvas-area {
  scrollbar-color: rgba(19, 33, 50, 0.28) transparent;
}

:root[data-theme="light"] .canvas-area::-webkit-scrollbar-thumb {
  background: rgba(19, 33, 50, 0.28);
}

:root[data-theme="light"] .inpaint-header h2,
:root[data-theme="light"] .inpaint-close,
:root[data-theme="light"] .inpaint-mark-trigger,
:root[data-theme="light"] .inpaint-tool,
:root[data-theme="light"] .inpaint-zoom button,
:root[data-theme="light"] .inpaint-zoom output {
  color: #263342;
}

:root[data-theme="light"] .inpaint-tools,
:root[data-theme="light"] .inpaint-zoom,
:root[data-theme="light"] .inpaint-prompt-wrap {
  background: #f1f3f6;
}

:root[data-theme="light"] .inpaint-mark-trigger.active,
:root[data-theme="light"] .inpaint-mark-trigger:hover,
:root[data-theme="light"] .inpaint-mark-trigger:focus-visible,
:root[data-theme="light"] .inpaint-tool:hover,
:root[data-theme="light"] .inpaint-tool:focus-visible,
:root[data-theme="light"] .inpaint-tool.active,
:root[data-theme="light"] .inpaint-zoom button:hover,
:root[data-theme="light"] .inpaint-zoom button:focus-visible {
  background: rgba(19, 33, 50, 0.1);
  color: #182331;
}

:root[data-theme="light"] .inpaint-divider {
  background: rgba(19, 33, 50, 0.14);
}

:root[data-theme="light"] .inpaint-tool:disabled,
:root[data-theme="light"] .inpaint-zoom button:disabled {
  color: #73808f;
}

:root[data-theme="light"] .inpaint-prompt-wrap {
  border-color: rgba(19, 33, 50, 0.08);
}

:root[data-theme="light"] .inpaint-prompt-wrap:focus-within {
  border-color: rgba(19, 33, 50, 0.24);
}

:root[data-theme="light"] .inpaint-prompt-wrap textarea::placeholder {
  color: #657384;
}

:root[data-theme="light"] .inpaint-submit {
  background: #1b2430;
  color: #ffffff;
}

:root[data-theme="light"] .inpaint-submit:disabled,
:root[data-theme="light"] .inpaint-local-submit:disabled {
  background: #dfe4ea;
  color: #667382;
}

:root[data-theme="light"] .inpaint-local-submit {
  background: #1b2430;
  color: #ffffff;
}

:root[data-theme="light"] .inpaint-brush-size,
:root[data-theme="light"] .inpaint-color-palette {
  border-color: rgba(19, 33, 50, 0.12);
  background: #ffffff;
}

:root[data-theme="light"] .inpaint-brush-size input {
  background: linear-gradient(to right, #657384 var(--brush-progress), #d9dee5 var(--brush-progress));
}

:root[data-theme="light"] .inpaint-brush-size .inpaint-size-circle {
  color: #526071;
}

:root[data-theme="light"] .inpaint-color-palette button {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px rgba(19, 33, 50, 0.18);
}

:root[data-theme="light"] .inpaint-color-palette button.active {
  box-shadow: 0 0 0 2px #526071;
}

:root[data-theme="light"] .inpaint-mark-guide {
  border-color: rgba(19, 33, 50, 0.1);
  color: #263342;
}

:root[data-theme="light"] .inpaint-mark-guide > span:last-child {
  color: #667382;
}

:root[data-theme="light"] .lightbox-count {
  color: rgba(224, 245, 255, 0.62);
}

:root[data-theme="light"] .ratio-count-inline {
  color: var(--text);
}

:root[data-theme="light"] .submit-button {
  background: #e1e5ea;
  color: #8a96a5;
}

:root[data-theme="light"] .submit-button.ready {
  background: var(--primary);
  color: #fff;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  overflow: hidden;
  background: var(--stage);
}

button,
textarea,
a {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  min-height: 620px;
  background: var(--stage);
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--sidebar);
}

.sidebar-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0 20px;
}

.sidebar-header strong {
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}

.sidebar-content {
  flex: 1;
  min-height: 0;
  padding: 8px 16px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(224, 245, 255, 0.12) transparent;
}

.icon-button {
  display: inline-grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.icon-button:hover {
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--text);
}

.icon-button svg,
.new-chat svg,
.tool-chip svg,
.square-tool svg,
.submit-button svg,
.reference-button svg,
.error-state svg,
.generating-mark svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.new-chat,
.default-creation,
.history-item {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease;
}

.new-chat {
  min-height: 36px;
  padding: 2px 12px 2px 2px;
  font-size: 13px;
}

.new-chat.active,
.new-chat:hover,
.default-creation:hover,
.history-item:hover,
.history-item.active {
  background: var(--surface-hover);
}

.new-chat-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-hover);
}

.default-creation {
  min-height: 40px;
  margin-top: 4px;
  padding: 4px 8px 4px 2px;
  font-size: 13px;
}

.default-creation img,
.history-thumb,
.history-placeholder {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface);
}

.recent-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 4px 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 20px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-empty {
  padding: 12px 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.history-item {
  position: relative;
  min-height: 40px;
  padding: 4px 30px 4px 2px;
}

.history-entry {
  position: relative;
  min-width: 0;
}

.history-entry.menu-open {
  z-index: 12;
}

.history-more {
  position: absolute;
  z-index: 2;
  top: 6px;
  right: 4px;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, background 120ms ease;
}

.history-entry:hover .history-more,
.history-entry:focus-within .history-more,
.history-entry.menu-open .history-more,
.history-more:focus,
.history-more:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.history-more:hover,
.history-more:focus-visible,
.history-entry.menu-open .history-more {
  background: var(--surface-active);
  color: var(--text);
  outline: none;
}

.history-more svg {
  width: 16px;
  height: 16px;
}

.history-entry:hover .history-status,
.history-entry:focus-within .history-status,
.history-entry.menu-open .history-status {
  opacity: 0;
}

.history-menu {
  position: absolute;
  z-index: 20;
  top: 36px;
  right: 4px;
  width: 156px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #24262c;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

.history-menu button {
  display: flex;
  width: 100%;
  height: 36px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

.history-menu button:hover,
.history-menu button:focus-visible {
  background: var(--surface-active);
  color: var(--text);
  outline: none;
}

.history-menu button.danger:hover,
.history-menu button.danger:focus-visible {
  color: var(--danger);
}

.history-menu svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.history-rename-input {
  position: absolute;
  z-index: 4;
  top: 8px;
  right: 8px;
  left: 42px;
  width: auto;
  height: 24px;
  padding: 0 7px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  outline: none;
  background: #16171b;
  color: var(--text);
  font-size: 13px;
  line-height: 20px;
}

.history-entry.renaming .history-more,
.history-entry.renaming .history-status {
  opacity: 0;
  pointer-events: none;
}

.delete-confirm-modal {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
}

.delete-confirm-modal[hidden] {
  display: none;
}

.delete-confirm-dialog {
  width: min(508px, calc(100vw - 48px));
  padding: 32px;
  border: 1px solid rgba(204, 221, 255, 0.05);
  border-radius: 15px;
  background: #17181d;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.42);
}

.delete-confirm-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.delete-confirm-header h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #f5f7fa;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-confirm-close {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  color: #f5f7fa;
  cursor: pointer;
}

.delete-confirm-close:hover,
.delete-confirm-close:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.delete-confirm-close svg {
  width: 20px;
  height: 20px;
}

.delete-confirm-copy {
  margin: 22px 0 0;
  color: #989ba4;
  font-size: 14px;
  line-height: 22px;
  white-space: nowrap;
}

.delete-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
}

.delete-confirm-actions button {
  min-width: 80px;
  height: 36px;
  padding: 0 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.delete-confirm-cancel {
  background: #24262d;
  color: #f2f4f7;
}

.delete-confirm-cancel:hover,
.delete-confirm-cancel:focus-visible {
  background: #2d3038;
  outline: none;
}

.delete-confirm-submit {
  background: #f4f7fa;
  color: #17191e;
}

.delete-confirm-submit:hover,
.delete-confirm-submit:focus-visible {
  background: #ffffff;
  outline: none;
}

.history-placeholder {
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.history-placeholder svg {
  width: 14px;
}

.history-text {
  min-width: 0;
  flex: 1;
}

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

.history-text strong {
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
}

.history-text span {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 14px;
}

.history-status {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: var(--text-muted);
}

.history-status.succeeded {
  background: #52c78a;
}

.history-status.failed {
  background: var(--danger);
}

.history-status.queued,
.history-status.submitting,
.history-status.generating,
.history-status.saving {
  background: var(--primary);
  animation: pulse 1.4s ease-in-out infinite;
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 28px;
  min-height: 58px;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.connection-dot.online {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(239, 45, 45, 0.12);
}

.sidebar-footer strong,
.sidebar-footer span {
  display: block;
}

.sidebar-footer strong {
  font-size: 11px;
  font-weight: 500;
}

.sidebar-footer div > span {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-stage {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--stage);
}

.mobile-menu {
  position: absolute;
  z-index: 8;
  top: 16px;
  left: 16px;
  display: none;
}

.service-indicator {
  position: absolute;
  z-index: 5;
  top: 18px;
  right: 22px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 10px;
}

.service-indicator > span:first-child {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.service-indicator.online > span:first-child {
  background: var(--primary);
}

.canvas-area {
  position: absolute;
  inset: 60px 44px 210px;
  overflow-y: auto;
  pointer-events: none;
  scrollbar-color: rgba(224, 245, 255, 0.42) transparent;
  scrollbar-width: thin;
}

.canvas-area::-webkit-scrollbar {
  width: 7px;
}

.canvas-area::-webkit-scrollbar-track {
  background: transparent;
}

.canvas-area::-webkit-scrollbar-thumb {
  min-height: 42px;
  border: 2px solid var(--stage);
  border-radius: 999px;
  background: rgba(224, 245, 255, 0.42);
}

.canvas-area::-webkit-scrollbar-thumb:hover {
  background: rgba(224, 245, 255, 0.62);
}

.result-view {
  pointer-events: auto;
}

.result-thread {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 0 0 48px;
}

.result-record + .result-record {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid rgba(224, 245, 255, 0.06);
}

.result-record {
  scroll-margin-top: 18px;
}

.result-day {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 34px;
  color: rgba(245, 251, 255, 0.74);
  font-size: 22px;
  font-weight: 500;
  line-height: 32px;
}

.result-day::after {
  height: 1px;
  flex: 1;
  background: rgba(224, 245, 255, 0.035);
  content: "";
}

.result-prompt-row {
  display: flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
}

.result-mode-label {
  position: relative;
  display: inline-flex;
  height: 28px;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 3px;
  border: 1px solid rgba(224, 245, 255, 0.08);
  border-radius: 6px;
  background: rgba(204, 221, 255, 0.08);
  color: rgba(245, 251, 255, 0.72);
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.result-mode-label:not(.is-static):hover,
.result-mode-label:not(.is-static):focus-visible {
  border-color: rgba(224, 245, 255, 0.2);
  background: rgba(204, 221, 255, 0.13);
  color: rgba(245, 251, 255, 0.94);
  outline: none;
}

.result-mode-label img {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 3px;
  background: var(--surface);
  object-fit: cover;
}

.result-mode-label:not(.is-static)::after {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 4;
  width: max-content;
  padding: 7px 10px;
  border-radius: 6px;
  background: #24262d;
  color: #f5fbff;
  content: attr(data-tooltip);
  font-size: 12px;
  line-height: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  visibility: hidden;
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.result-mode-label:not(.is-static):hover::after,
.result-mode-label:not(.is-static):focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
  visibility: visible;
}

.result-mode-label.is-static {
  cursor: default;
}

.reference-thumbnail-preview {
  position: absolute;
  z-index: 12;
  top: calc(100% + 8px);
  left: 0;
  display: grid;
  width: 180px;
  padding: 4px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(224, 245, 255, 0.16);
  border-radius: 10px;
  background: #24262d;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
  visibility: hidden;
}

.reference-thumbnail-preview img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 240px;
  border-radius: 6px;
  object-fit: contain;
}

.reference-mode-label:hover .reference-thumbnail-preview {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

:root[data-theme="light"] .reference-thumbnail-preview {
  border-color: rgba(19, 33, 50, 0.14);
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(19, 33, 50, 0.16);
}

.result-prompt {
  min-width: 0;
  max-width: 100%;
  color: rgba(245, 251, 255, 0.84);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.result-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 20px;
}

.result-image-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  margin: 14px 0;
}

.result-image-wrap:not(.result-image-grid) .result-image-cell {
  width: fit-content;
  max-width: 100%;
}

.result-image-wrap:not(.result-image-grid) .result-image-media {
  max-height: 43vh;
}

.result-image-wrap:not(.result-image-grid) img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 43vh;
  object-fit: contain;
}

.result-image-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 3px;
}

.result-image-cell {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
}

.result-image-media {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.result-image-open {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.result-image-open:focus-visible {
  outline: 2px solid rgba(245, 251, 255, 0.72);
  outline-offset: -3px;
}

.result-image-grid .result-image-media {
  aspect-ratio: 1;
}

.result-image-grid img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.result-image-toolbar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 2;
  display: flex;
  width: max-content;
  max-width: calc(100% - 16px);
  height: 44px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid rgba(224, 245, 255, 0.14);
  border-radius: 8px;
  background: rgba(23, 24, 29, 0.92);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translate(-50%, 6px);
  visibility: hidden;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.result-image-cell:hover .result-image-toolbar,
.result-image-cell:focus-within .result-image-toolbar {
  opacity: 1;
  transform: translate(-50%, 0);
  visibility: visible;
}

.result-image-action {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  color: rgba(245, 251, 255, 0.9);
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.result-image-action:hover,
.result-image-action:focus-visible {
  background: #30323b;
  color: #fff;
  outline: none;
}

.result-image-action svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.result-image-action::after {
  position: absolute;
  right: 50%;
  bottom: calc(100% + 12px);
  z-index: 3;
  width: max-content;
  max-width: 120px;
  padding: 10px 13px;
  border-radius: 8px;
  background: #24262d;
  color: #f5fbff;
  content: attr(data-tooltip);
  font-size: 13px;
  line-height: 20px;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 4px);
  visibility: hidden;
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.result-image-action:hover::after,
.result-image-action:focus-visible::after {
  opacity: 1;
  transform: translate(50%, 0);
  visibility: visible;
}

.inline-generation-state {
  display: inline-flex;
  height: 38px;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
}

.inline-generation-state svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.result-record-failed p {
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 13px;
}

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

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

.result-action-button {
  display: inline-flex;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: rgba(245, 251, 255, 0.78);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.result-action-button:hover,
.result-action-button:focus-visible {
  background: #2a2c33;
  color: var(--text);
  outline: none;
}

.result-action-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.delete-action {
  border: 1px solid rgba(242, 100, 112, 0.34);
  background: rgba(242, 100, 112, 0.08);
  color: #ffafb6;
}

.delete-action:hover,
.delete-action:focus-visible {
  color: var(--danger);
  background: rgba(242, 100, 112, 0.14);
}

.lightbox-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  grid-template-rows: 72px minmax(0, 1fr) 48px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: rgba(19, 20, 22, 0.98);
  backdrop-filter: blur(22px);
}

.lightbox-return,
.lightbox-close,
.lightbox-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(224, 245, 255, 0.16);
  background: rgba(204, 221, 255, 0.06);
  color: rgba(245, 251, 255, 0.88);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.lightbox-return:hover,
.lightbox-return:focus-visible,
.lightbox-close:hover,
.lightbox-close:focus-visible,
.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  border-color: rgba(224, 245, 255, 0.28);
  background: rgba(204, 221, 255, 0.12);
  color: #fff;
  outline: none;
}

.lightbox-return {
  align-self: center;
  justify-self: start;
  height: 40px;
  gap: 6px;
  margin-left: 32px;
  padding: 0 14px;
  border-radius: 20px;
  font-size: 13px;
}

.lightbox-return svg,
.lightbox-close svg,
.lightbox-nav svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.7;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.lightbox-stage {
  position: relative;
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  min-width: 0;
  min-height: 0;
  align-items: center;
  padding: 8px 24px 16px;
}

.lightbox-center {
  display: flex;
  width: min(100%, 1080px);
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  justify-self: center;
}

.lightbox-figure {
  display: grid;
  width: 100%;
  max-height: 680px;
  min-height: 0;
  flex: 1 1 680px;
  min-width: 0;
  margin: 0;
  place-items: center;
}

.lightbox-figure img {
  display: block;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.lightbox-actions {
  display: flex;
  width: max-content;
  max-width: 100%;
  height: 44px;
  flex: 0 0 44px;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(224, 245, 255, 0.14);
  border-radius: 8px;
  background: rgba(23, 24, 29, 0.92);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

.lightbox-action {
  display: inline-flex;
  width: auto;
  height: 36px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: rgba(245, 251, 255, 0.82);
  cursor: pointer;
  font-size: 12px;
  line-height: 18px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease;
}

.lightbox-action:hover,
.lightbox-action:focus-visible {
  background: rgba(204, 221, 255, 0.12);
  color: #fff;
  outline: none;
}

.lightbox-action svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  stroke-width: 1.8;
}

.lightbox-nav {
  width: 40px;
  height: 40px;
  justify-self: center;
  border-radius: 50%;
}

.lightbox-rail {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  padding: 8px 18px 16px 0;
}

.lightbox-thumbnails {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.lightbox-thumbnails::-webkit-scrollbar {
  display: none;
}

.lightbox-thumbnail {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  padding: 2px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  opacity: 0.52;
  transition: border-color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.lightbox-thumbnail:hover,
.lightbox-thumbnail:focus-visible {
  opacity: 0.82;
  outline: none;
}

.lightbox-thumbnail.active {
  border-color: rgba(245, 251, 255, 0.86);
  opacity: 1;
}

.lightbox-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  object-fit: cover;
}

.lightbox-count {
  grid-column: 1 / 3;
  grid-row: 3;
  align-self: center;
  justify-self: end;
  margin-right: 32px;
  color: var(--text-muted);
  font-size: 11px;
}

/* Smart image editor, implemented from Figma node 31607:26639. */
.inpaint-modal { position: fixed; z-index: 60; inset: 0; display: grid; padding: 24px; place-items: center; background: rgba(0, 0, 0, 0.78); }
.inpaint-dialog { position: relative; display: flex; width: min(800px, 100%); height: min(673px, calc(100vh - 48px)); flex-direction: column; overflow: visible; border-radius: 16px; background: #15161a; box-shadow: 0 8px 10px rgba(8, 12, 20, 0.12), 0 28px 80px rgba(0, 0, 0, 0.32); }
.inpaint-header { display: flex; height: 72px; flex: 0 0 72px; align-items: center; justify-content: space-between; padding: 0 16px 0 24px; }
.inpaint-header h2 { margin: 0; color: #f5fbff; font-size: 16px; font-weight: 500; line-height: 24px; }
.inpaint-close { display: grid; width: 36px; height: 36px; padding: 0; place-items: center; border-radius: 8px; background: transparent; color: rgba(245, 251, 255, 0.9); cursor: pointer; }
.inpaint-close:hover, .inpaint-close:focus-visible { background: var(--surface-hover); outline: none; }
.inpaint-close svg { width: 20px; height: 20px; }
.inpaint-body { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 16px; padding: 0 24px 24px; }
.inpaint-workspace { position: relative; display: grid; width: 100%; height: 449px; min-height: 220px; flex: 1 1 449px; place-items: center; overflow: hidden; border-radius: 8px; background: #0f0f12; }
.inpaint-image-layer { position: relative; max-width: 100%; max-height: 100%; transform-origin: center; will-change: transform; }
.inpaint-image-layer img, .inpaint-image-layer canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.inpaint-image-layer img { object-fit: contain; pointer-events: none; user-select: none; }
.inpaint-image-layer canvas { cursor: crosshair; touch-action: none; }
.inpaint-image-layer canvas[data-tool="eraser"] { cursor: cell; }
.inpaint-image-layer canvas[data-tool="text"] { cursor: text; }
.inpaint-image-layer canvas[data-tool="pan"] { cursor: grab; }
.inpaint-image-layer canvas[data-tool="pan"].is-panning { cursor: grabbing; }
.inpaint-text-layer { position: absolute; z-index: 4; inset: 0; overflow: hidden; pointer-events: none; }
.inpaint-text-annotation { position: absolute; width: 148px; min-height: 26px; margin: 0; padding: 0; border: 0; outline: 0; background: transparent; color: #f5223b; caret-color: currentColor; cursor: move; font-family: "PingFang SC", sans-serif; font-size: 20px; font-weight: 400; line-height: 26px; overflow-wrap: anywhere; pointer-events: auto; text-shadow: none; user-select: none; white-space: pre-wrap; word-break: break-word; }
.inpaint-text-annotation[contenteditable="true"] { cursor: text; user-select: text; }
.inpaint-brush-cursor { position: absolute; z-index: 3; display: block; border: 1px solid rgba(245, 251, 255, 0.95); border-radius: 50%; background: rgba(239, 45, 45, 0.12); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.48); pointer-events: none; transform: translate(-50%, -50%); }
.inpaint-tools, .inpaint-zoom, .inpaint-tool-group, .inpaint-brush-size, .inpaint-color-palette { display: flex; align-items: center; }
.inpaint-toolbar-row { display: flex; width: 100%; height: 40px; flex: 0 0 40px; align-items: center; justify-content: space-between; }
.inpaint-tools, .inpaint-zoom { position: relative; height: 40px; padding: 2px; border-radius: 8px; background: rgba(204, 221, 255, 0.08); }
.inpaint-tools { width: 324px; gap: 2px; }
.inpaint-tool-group { gap: 2px; }
.inpaint-mark-trigger { display: flex; height: 36px; gap: 4px; align-items: center; padding: 0 14px 0 12px; border-radius: 8px; background: transparent; color: #f5fbff; font-size: 13px; cursor: pointer; }
.inpaint-mark-trigger.active, .inpaint-mark-trigger:hover, .inpaint-mark-trigger:focus-visible { background: rgba(204, 221, 255, 0.08); outline: none; }
.inpaint-mark-trigger svg { width: 16px; height: 16px; }
.inpaint-divider { width: 1px; height: 12px; margin: 0 3px; background: rgba(204, 221, 255, 0.06); }
.inpaint-tool, .inpaint-zoom button { display: grid; width: 36px; height: 36px; padding: 0; place-items: center; border-radius: 8px; background: transparent; color: rgba(245, 251, 255, 0.86); cursor: pointer; }
.inpaint-tool[data-tooltip] { position: relative; }
.inpaint-tool[data-tooltip]::after { position: absolute; bottom: calc(100% + 10px); left: 50%; z-index: 10; width: max-content; max-width: 120px; padding: 7px 10px; border-radius: 6px; background: #24262d; color: #f5fbff; content: attr(data-tooltip); font-size: 12px; font-weight: 400; line-height: 18px; opacity: 0; pointer-events: none; transform: translate(-50%, 4px); visibility: hidden; white-space: nowrap; transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease; }
.inpaint-tools:has(.inpaint-brush-size:not([hidden]), .inpaint-color-palette:not([hidden])) .inpaint-tool[data-tooltip]::after { top: calc(100% + 10px); bottom: auto; }
.inpaint-tool[data-tooltip]:hover::after, .inpaint-tool[data-tooltip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); visibility: visible; }
.inpaint-tool:hover, .inpaint-tool:focus-visible, .inpaint-tool.active, .inpaint-zoom button:hover, .inpaint-zoom button:focus-visible { background: rgba(204, 221, 255, 0.16); color: #f5fbff; outline: none; }
.inpaint-tool:disabled, .inpaint-zoom button:disabled { color: rgba(224, 245, 255, 0.2); cursor: default; }
.inpaint-tool:disabled:hover, .inpaint-zoom button:disabled:hover { background: transparent; }
.inpaint-tool svg, .inpaint-zoom svg, .inpaint-brush-size svg { width: 16px; height: 16px; stroke-width: 1.8; }
.inpaint-brush-size { position: absolute; z-index: 6; bottom: 46px; left: 0; width: 292px; height: 38px; gap: 10px; padding: 0 10px; border: 1px solid rgba(204, 221, 255, 0.08); border-radius: 8px; background: #22252a; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24); }
.inpaint-brush-size .inpaint-size-circle { display: block; flex: 0 0 auto; border: solid currentColor; border-radius: 50%; color: rgba(245, 251, 255, 0.92); }
.inpaint-brush-size .inpaint-size-circle-thin { width: 9px; height: 9px; border-width: 1px; }
.inpaint-brush-size .inpaint-size-circle-thick { width: 18px; height: 18px; border-width: 4px; }
.inpaint-brush-size input { --brush-progress: 33.33%; width: 100%; height: 12px; margin: 0; appearance: none; border-radius: 4px; background: linear-gradient(to right, rgba(224, 245, 255, 0.35) var(--brush-progress), rgba(204, 221, 255, 0.08) var(--brush-progress)); cursor: pointer; }
.inpaint-brush-size input::-webkit-slider-thumb { width: 4px; height: 16px; appearance: none; border: 0; border-radius: 1px; background: #92a0a9; }
.inpaint-color-palette { position: absolute; z-index: 6; bottom: 46px; left: 0; height: 40px; gap: 8px; padding: 0 8px; border: 1px solid rgba(204, 221, 255, 0.08); border-radius: 8px; background: #22252a; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24); }
.inpaint-color-palette button { position: relative; width: 22px; height: 22px; flex: 0 0 22px; padding: 0; border: 2px solid #22252a; border-radius: 50%; background: var(--swatch-color); box-shadow: 0 0 0 1px rgba(245, 251, 255, 0.08); cursor: pointer; }
.inpaint-color-palette button:hover, .inpaint-color-palette button:focus-visible { outline: 2px solid rgba(245, 251, 255, 0.5); outline-offset: 1px; }
.inpaint-color-palette button.active { box-shadow: 0 0 0 1px #f5fbff; }
.inpaint-zoom { width: 140px; gap: 4px; }
.inpaint-zoom output { width: 56px; color: #f5fbff; font-size: 13px; font-weight: 500; line-height: 36px; text-align: center; }
.inpaint-prompt-wrap { position: relative; display: flex; width: 100%; min-height: 56px; flex: 0 0 56px; align-items: center; gap: 12px; padding: 6px 12px 6px 16px; border: 1px solid transparent; border-radius: 12px; background: rgba(204, 221, 255, 0.08); }
.inpaint-prompt-wrap:focus-within { border-color: rgba(204, 221, 255, 0.18); }
.inpaint-prompt-wrap textarea { min-width: 0; min-height: 44px; max-height: 44px; flex: 1; padding: 10px 0; overflow-x: auto; overflow-y: hidden; resize: none; border: 0; outline: none; background: transparent; color: var(--text); font-size: 14px; line-height: 24px; white-space: nowrap; }
.inpaint-prompt-wrap textarea::placeholder { color: rgba(224, 245, 255, 0.35); }
.inpaint-prompt-actions { display: flex; height: 44px; flex: 0 0 auto; gap: 12px; align-items: center; }
.inpaint-submit { display: grid; width: 32px; height: 32px; padding: 0; place-items: center; border-radius: 50%; background: #f5fbff; color: #17181d; cursor: pointer; }
.inpaint-submit svg { width: 16px; height: 16px; }
.inpaint-submit:disabled { background: rgba(204, 221, 255, 0.16); color: rgba(224, 245, 255, 0.2); cursor: default; }
.inpaint-local-only { display: none; }
.inpaint-modal[data-mode="inpaint"] .inpaint-smart-only,
.inpaint-modal[data-mode="inpaint"] .inpaint-mark-trigger,
.inpaint-modal[data-mode="inpaint"] .inpaint-mark-guide { display: none; }
.inpaint-modal[data-mode="inpaint"] .inpaint-local-only { display: grid; }
.inpaint-modal[data-mode="inpaint"] .inpaint-dialog { width: min(930px, 100%); height: min(820px, calc(100vh - 48px)); }
.inpaint-modal[data-mode="inpaint"] .inpaint-header { border-bottom: 1px solid rgba(204, 221, 255, 0.08); }
.inpaint-modal[data-mode="inpaint"] .inpaint-body { gap: 16px; padding-top: 24px; }
.inpaint-modal[data-mode="inpaint"] .inpaint-workspace { flex-basis: 550px; min-height: 300px; }
.inpaint-modal[data-mode="inpaint"] .inpaint-tools { width: 252px; }
.inpaint-modal[data-mode="inpaint"] .inpaint-tool-group { gap: 4px; }
.inpaint-modal[data-mode="inpaint"] .inpaint-brush-size { width: 340px; }
.inpaint-modal[data-mode="inpaint"] .inpaint-prompt-wrap { min-height: 48px; flex-basis: 48px; border-radius: 8px; }
.inpaint-modal[data-mode="inpaint"] .inpaint-prompt-wrap textarea { min-height: 36px; max-height: 36px; padding: 6px 0; }
.inpaint-local-submit { width: 88px; height: 40px; flex: 0 0 40px; place-items: center; border-radius: 8px; background: #f5fbff; color: #17181d; font-size: 14px; font-weight: 500; cursor: pointer; }
.inpaint-local-submit:disabled { background: rgba(204, 221, 255, 0.16); color: rgba(224, 245, 255, 0.2); cursor: default; }
.inpaint-mark-guide { position: absolute; z-index: 8; bottom: 143px; left: -78px; display: flex; width: 280px; min-height: 226px; flex-direction: column; padding: 3px 8px 12px; overflow: hidden; border: 1px solid rgba(204, 221, 255, 0.08); border-radius: 16px; background: #24262c; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34); color: #f5fbff; opacity: 0; pointer-events: none; text-align: left; transform: translateY(4px); transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 120ms; visibility: hidden; }
.inpaint-modal[data-mode="smart-edit"]:has(.inpaint-mark-trigger:hover) .inpaint-mark-guide { opacity: 1; transform: translateY(0); transition-delay: 0s; visibility: visible; }
.inpaint-mark-guide-preview { position: relative; display: block; width: 262px; height: 154px; overflow: hidden; border-radius: 12px; background: #0f0f12; }
.inpaint-mark-guide-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.inpaint-mark-guide-box { position: absolute; top: 20px; left: 25px; width: 104px; height: 66px; border: 2px dotted var(--primary); }
.inpaint-mark-guide-pin { position: absolute; display: grid; width: 20px; height: 20px; place-items: center; border: 2px solid #fff; border-radius: 50%; background: var(--primary); color: #fff; font-family: Montserrat, Arial, sans-serif; font-size: 11px; font-weight: 600; line-height: 1; }
.inpaint-mark-guide-pin::after { position: absolute; top: 15px; left: 6px; width: 5px; height: 5px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; background: var(--primary); content: ""; transform: rotate(45deg); }
.inpaint-mark-guide-pin.pin-one { top: 76px; left: 121px; }
.inpaint-mark-guide-pin.pin-two { top: 42px; left: 186px; }
.inpaint-mark-guide strong { margin: 12px 4px 0; font-size: 14px; font-weight: 500; line-height: 22px; }
.inpaint-mark-guide > span:last-child { margin: 2px 4px 0; color: rgba(224, 245, 255, 0.35); font-size: 12px; line-height: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.generation-state,
.error-state {
  display: flex;
  max-width: 360px;
  flex-direction: column;
  align-items: center;
  color: var(--text);
  text-align: center;
  pointer-events: auto;
}

.generating-mark {
  position: relative;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--primary);
  overflow: hidden;
}

.generating-mark span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
  animation: scan 1.8s ease-in-out infinite;
}

.generation-state strong,
.error-state strong {
  font-size: 14px;
  font-weight: 500;
}

.generation-state > span,
.error-state > span {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.error-state > svg {
  width: 28px;
  height: 28px;
  margin-bottom: 14px;
  color: var(--danger);
}

.error-state button {
  min-height: 34px;
  margin-top: 18px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.prompt-dock {
  position: relative;
  z-index: 6;
  width: min(994px, calc(100% - 64px));
  height: 176px;
  padding: 16px;
  overflow: visible;
  border: 1px solid transparent;
  border-radius: 24px;
  background: rgba(32, 33, 39, 0.72);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(20px);
  transition: border-color 160ms ease, transform 220ms ease;
}

.composer-title {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(994px, calc(100% - 64px));
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  text-align: center;
  transform: translate(-50%, -152px);
}

.studio-stage.has-result .composer-title,
.studio-stage.is-generating .composer-title,
.studio-stage.has-error .composer-title {
  display: none;
}

.prompt-dock:focus-within {
  border-color: var(--border-strong);
}

.studio-stage.has-result .prompt-dock,
.studio-stage.is-generating .prompt-dock,
.studio-stage.has-error .prompt-dock {
  position: absolute;
  bottom: 16px;
  height: 176px;
}

.prompt-main {
  display: flex;
  height: 96px;
  gap: 12px;
  align-items: flex-start;
}

.reference-control {
  position: relative;
  width: 64px;
  height: 76px;
  flex: 0 0 64px;
  margin: 10px 8px 0;
  z-index: 4;
}

.reference-button {
  display: grid;
  position: relative;
  z-index: 3;
  width: 48px;
  height: 64px;
  place-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: 2px;
  background: var(--surface-hover);
  color: var(--text-muted);
  cursor: pointer;
  transform: rotate(-8deg);
  transition: color 140ms ease, background 140ms ease;
}

.reference-button.has-reference {
  position: static;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-style: dashed;
  border-radius: 6px;
  background: rgba(204, 221, 255, 0.06);
  color: var(--text-secondary);
  transform: none;
}

.reference-button.has-reference::after {
  display: none;
}

.reference-preview-list {
  display: none;
}

.reference-preview-card {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

.reference-preview {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(224, 245, 255, 0.12);
  border-radius: 6px;
  background: #3c4149;
  object-fit: cover;
}

.prompt-dock.has-references .prompt-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 44px minmax(0, 1fr);
  gap: 4px;
}

.prompt-dock.has-references .reference-control {
  display: flex;
  width: 100%;
  height: 44px;
  min-width: 0;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.prompt-dock.has-references .reference-preview-list {
  display: flex;
  min-width: 0;
  max-width: calc(100% - 48px);
  height: 44px;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  pointer-events: auto;
  scrollbar-width: none;
}

.prompt-dock.has-references .reference-preview-list::-webkit-scrollbar {
  display: none;
}

.reference-preview-delete {
  position: absolute;
  z-index: 6;
  right: -3px;
  top: -3px;
  display: grid;
  width: 18px;
  height: 18px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #24262c;
  color: var(--text);
  cursor: pointer;
}

.reference-preview-delete svg {
  width: 11px;
  height: 11px;
}

.reference-button:hover {
  background: var(--surface-active);
  color: var(--text);
}

.reference-button svg {
  transform: rotate(8deg);
}

.reference-button.has-reference svg {
  transform: none;
}

/* Keep reference images beside the model controls instead of occupying the prompt area. */
.dock-toolbar .reference-control {
  position: relative;
  z-index: 4;
  display: flex;
  width: auto;
  height: 36px;
  flex: 0 1 auto;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.dock-toolbar .reference-button,
.dock-toolbar .reference-button.has-reference {
  display: inline-flex;
  position: relative;
  width: auto;
  height: 36px;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  border-style: solid;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  transform: none;
}

.dock-toolbar .reference-button svg,
.dock-toolbar .reference-button.has-reference svg {
  transform: none;
}

.prompt-dock.has-references .prompt-main {
  display: grid;
  height: 96px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 44px 48px;
  gap: 4px;
}

.prompt-dock.has-references .prompt-input-wrap,
.prompt-dock.has-references .prompt-input-wrap textarea {
  height: 48px;
}

.prompt-dock.has-references .reference-control {
  display: flex;
  width: auto;
  height: 36px;
  min-width: 0;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.prompt-dock.has-references .reference-preview-list {
  display: flex;
  width: 100%;
  max-width: 100%;
  height: 44px;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
}


.prompt-dock.has-references .prompt-input-wrap,
.prompt-dock.has-references .prompt-input-wrap textarea {
  height: 48px;
}

.prompt-input-wrap {
  position: relative;
  min-width: 0;
  flex: 1;
  height: 96px;
}

.prompt-field-label,
.submit-label {
  display: none;
}

.prompt-input-wrap textarea {
  display: block;
  width: 100%;
  height: 96px;
  padding: 6px 54px 6px 0;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 24px;
}

.prompt-input-wrap textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.prompt-counter {
  position: absolute;
  top: 7px;
  right: 0;
  color: transparent;
  font-size: 10px;
  pointer-events: none;
  transition: color 140ms ease;
}

.prompt-input-wrap:focus-within .prompt-counter {
  color: var(--text-muted);
}

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

.tool-chips,
.submit-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-chip,
.square-tool {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.tool-chip {
  gap: 4px;
  padding: 0 14px;
}

.ratio-count-inline {
  margin-left: 5px;
  padding-left: 8px;
  border-left: 1px solid var(--border-strong);
  color: #fff;
  opacity: 1;
}

.ratio-shape-inline {
  flex: 0 0 auto;
}

.square-tool {
  position: relative;
  width: 36px;
  padding: 0;
}

.tool-chip:hover,
.square-tool:hover,
.tool-chip[aria-expanded="true"],
.square-tool[aria-expanded="true"] {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.static-chip {
  cursor: default;
}

.tool-menu-wrap {
  position: relative;
}

.tool-popover {
  position: absolute;
  z-index: 30;
  bottom: 44px;
  left: 0;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #24262c;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.ratio-popover {
  width: 404px;
}

.model-popover {
  width: 224px;
}

.model-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(224, 245, 255, 0.04);
}

.model-options button {
  height: 56px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.model-options button:hover,
.model-options button.active {
  background: rgba(204, 221, 255, 0.1);
  color: var(--text);
}

.model-options button.active {
  font-weight: 500;
}

.popover-title {
  display: block;
  margin-bottom: 9px;
  color: var(--text-muted);
  font-size: 11px;
}

.ratio-options {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(224, 245, 255, 0.04);
}

.ratio-options button {
  display: flex;
  min-width: 0;
  height: 56px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.ratio-options button svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.ratio-options button:hover,
.ratio-options button.active {
  background: rgba(204, 221, 255, 0.1);
  color: var(--text);
}

.ratio-options button.active {
  font-weight: 500;
}

.image-count-title {
  margin-top: 14px;
}

.image-count-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(224, 245, 255, 0.04);
}

.image-count-options button {
  height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.image-count-options button:hover,
.image-count-options button.active {
  background: rgba(204, 221, 255, 0.12);
  color: var(--text);
}

.shape {
  display: block;
  border: 1px solid currentColor;
  border-radius: 1px;
}

.shape.square { width: 14px; height: 14px; }
.shape.ultra-wide { width: 22px; height: 9px; }
.shape.landscape-four { width: 17px; height: 13px; }
.shape.landscape-three { width: 18px; height: 12px; }
.shape.wide { width: 20px; height: 11px; }
.shape.portrait-four { width: 12px; height: 16px; }
.shape.portrait-three { width: 11px; height: 17px; }
.shape.portrait { width: 9px; height: 16px; }

.cost-label {
  margin-right: 8px;
  color: var(--text-muted);
  font-family: Montserrat, Arial, sans-serif;
  font-size: 11px;
}

.submit-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  background: rgba(204, 221, 255, 0.16);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.submit-button.ready {
  background: var(--primary);
  color: #fff;
}

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

.submit-button:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.submit-button.is-submitting:disabled {
  cursor: wait;
  opacity: 0.55;
}

.form-error {
  position: absolute;
  right: 62px;
  bottom: 13px;
  max-width: 340px;
  margin: 0;
  overflow: hidden;
  color: var(--danger);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-scrim {
  display: none;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 48px));
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #24262c;
  color: var(--text);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes scan {
  0%, 100% { transform: translateY(-52px); }
  50% { transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

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

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(280px, 84vw);
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

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

  .mobile-menu {
    display: inline-grid;
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 15;
    inset: 0;
    background: rgba(0, 0, 0, 0.56);
  }

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

  .prompt-dock {
    width: min(760px, calc(100% - 48px));
  }
}

@media (max-width: 640px) {
  .service-indicator {
    top: 18px;
    right: 16px;
  }

  .service-indicator #service-status {
    display: none;
  }

  .prompt-dock,
  .studio-stage.has-result .prompt-dock,
  .studio-stage.is-generating .prompt-dock,
  .studio-stage.has-error .prompt-dock {
    position: absolute;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    height: 174px;
    padding: 12px;
    border-radius: 18px;
  }

  .composer-title {
    top: auto;
    bottom: 218px;
    width: calc(100% - 40px);
    font-size: 20px;
    line-height: 28px;
    transform: translateX(-50%);
  }

  .prompt-main {
    height: 104px;
    gap: 8px;
  }

  .reference-button {
    width: 42px;
    height: 56px;
  }

  .reference-control {
    width: 52px;
    height: 66px;
    flex-basis: 52px;
    margin: 10px 5px 0;
  }

  .prompt-input-wrap {
    height: 100px;
    padding: 9px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: rgba(204, 221, 255, 0.06);
  }

  .prompt-input-wrap textarea {
    height: 68px;
    padding: 4px 0 0;
    font-size: 13px;
  }

  .prompt-field-label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
  }

  .prompt-input-wrap:focus-within {
    border-color: var(--primary);
    background: rgba(204, 221, 255, 0.1);
  }

  .prompt-counter {
    display: none;
  }

  .dock-toolbar {
    height: 46px;
  }

  .submit-button {
    display: inline-flex;
    width: 66px;
    gap: 5px;
    justify-content: center;
    border-radius: 18px;
  }

  .submit-button svg {
    width: 15px;
    height: 15px;
  }

  .submit-label {
    display: inline;
    font-size: 12px;
    font-weight: 600;
  }

  .tool-chip {
    padding: 0 9px;
  }

  .static-chip span {
    display: none;
  }

  .cost-label {
    display: none;
  }

  .ratio-popover {
    left: -104px;
    width: min(360px, calc(100vw - 24px));
  }

  .ratio-options {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .tool-popover {
    bottom: 42px;
  }

  .canvas-area {
    inset: 60px 16px 208px;
  }

  .result-thread {
    padding-bottom: 28px;
  }

  .result-day {
    margin-bottom: 22px;
    font-size: 18px;
    line-height: 28px;
  }

  .result-prompt {
    font-size: 13px;
  }

  .result-prompt-row {
    gap: 6px;
  }

  .result-mode-label {
    font-size: 12px;
  }

  .result-meta {
    font-size: 12px;
  }

  .result-image-wrap img {
    max-height: 31vh;
  }

  .result-image-wrap:not(.result-image-grid) .result-image-media {
    max-height: 31vh;
  }

  .result-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-image-grid img {
    max-height: 100%;
  }

  .result-image-toolbar {
    gap: 2px;
    height: 40px;
    padding: 4px;
  }

  .result-image-action {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .result-image-action svg {
    width: 16px;
    height: 16px;
  }

  .result-actions {
    gap: 6px;
  }

  .result-action-button {
    height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }

  .form-error {
    right: 54px;
    bottom: 15px;
    max-width: 180px;
  }
}

@media (max-width: 370px) {
  .square-tool:nth-of-type(2) {
    display: none;
  }

  .tool-chip {
    padding: 0 7px;
  }
}

@media (max-width: 640px) {
  .lightbox-modal {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 64px minmax(0, 1fr) 76px 32px;
  }

  .lightbox-return {
    height: 36px;
    margin-left: 14px;
    padding: 0 11px;
  }

  .lightbox-close {
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
  }

  .lightbox-stage {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding: 4px 6px 10px;
  }

  .lightbox-nav {
    width: 34px;
    height: 34px;
  }

  .lightbox-figure img {
    border-radius: 6px;
  }

  .lightbox-center {
    gap: 8px;
  }

  .lightbox-actions {
    display: grid;
    width: min(100%, 236px);
    height: 76px;
    flex-basis: 76px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
  }

  .lightbox-action {
    width: 100%;
    height: 32px;
    padding: 0 7px;
    font-size: 11px;
  }

  .lightbox-rail {
    grid-column: 1;
    grid-row: 3;
    padding: 8px 12px;
  }

  .lightbox-thumbnails {
    flex-direction: row;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .lightbox-thumbnail {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .lightbox-count {
    grid-column: 1;
    grid-row: 4;
    margin-right: 14px;
  }

  .inpaint-modal { padding: 12px; }
  .inpaint-dialog { height: calc(100vh - 24px); border-radius: 12px; }
  .inpaint-header { height: 58px; flex-basis: 58px; padding: 0 10px 0 16px; }
  .inpaint-body { gap: 12px; padding: 0 16px 16px; }
  .inpaint-workspace { min-height: 220px; }
  .inpaint-toolbar-row { height: auto; min-height: 40px; flex-basis: auto; gap: 8px; }
  .inpaint-tools { width: auto; min-width: 0; overflow-x: auto; }
  .inpaint-mark-trigger { padding-right: 10px; padding-left: 10px; }
  .inpaint-mark-trigger span { display: none; }
  .inpaint-tool, .inpaint-zoom button { width: 34px; height: 36px; flex: 0 0 34px; }
  .inpaint-brush-size { width: min(240px, calc(100vw - 72px)); }
  .inpaint-color-palette { left: 0; }
  .inpaint-zoom { width: 116px; flex: 0 0 116px; }
  .inpaint-zoom output { width: 40px; }
  .inpaint-history-tools { display: none; }
  .inpaint-prompt-wrap { padding-left: 12px; }
  .inpaint-prompt-actions { gap: 6px; }
  .inpaint-mark-guide { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
