:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-muted: #eef1ed;
  --ink: #171a18;
  --muted: #6e756f;
  --line: #dce1db;
  --line-strong: #c7cec6;
  --accent: #f05a2b;
  --accent-dark: #d7471d;
  --green: #226b4d;
  --green-soft: #dfece5;
  --yellow: #ffc857;
  --danger: #c33b32;
  --shadow: 0 18px 50px rgba(25, 31, 27, 0.1);
  --radius: 8px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgba(240, 90, 43, 0.24);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  height: 72px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

.brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  gap: 11px;
  justify-self: start;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--ink);
  border-radius: 7px;
  color: #fff;
  display: inline-flex;
  font-size: 17px;
  font-weight: 760;
  height: 38px;
  justify-content: center;
  position: relative;
  width: 38px;
}

.brand-mark::after {
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50%;
  bottom: -2px;
  content: "";
  height: 8px;
  position: absolute;
  right: -2px;
  width: 8px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-size: 16px;
  line-height: 1.1;
}

.brand-copy span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.topbar-center {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 8px;
}

.status-pulse {
  background: #39a16d;
  border: 3px solid var(--green-soft);
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.connection-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
  justify-self: end;
  min-height: 38px;
  padding: 0 12px;
}

.connection-button:hover {
  background: var(--surface-muted);
  border-color: #aab2aa;
}

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

.connection-dot {
  background: #a7ada8;
  border-radius: 50%;
  height: 7px;
  width: 7px;
}

.connection-button.connected .connection-dot {
  background: #2c9b67;
  box-shadow: 0 0 0 3px var(--green-soft);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(350px, 420px) minmax(0, 1fr);
  margin: 0 auto;
  min-height: calc(100vh - 72px);
  width: min(1540px, 100%);
}

.composer {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 72px);
  position: sticky;
  top: 72px;
}

.composer-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 30px 28px 24px;
  scrollbar-color: #c9cec9 transparent;
  scrollbar-width: thin;
}

.section-heading,
.label-row,
.settings-title,
.quality-row,
.gallery-toolbar,
.history-heading,
.dialog-header,
.endpoint-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.section-heading {
  margin-bottom: 26px;
}

.eyebrow {
  color: var(--accent);
  display: block;
  font-size: 10px;
  font-weight: 800;
  margin-bottom: 7px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 23px;
  line-height: 1.25;
}

.mode-badge {
  background: var(--green-soft);
  border-radius: 5px;
  color: var(--green);
  font-size: 11px;
  font-weight: 750;
  padding: 6px 8px;
}

.form-section {
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  padding-bottom: 22px;
}

.label-row {
  margin-bottom: 10px;
}

.label-row label,
.input-label,
.setting-group legend,
.settings-title {
  color: #333834;
  font-size: 12px;
  font-weight: 760;
}

.optional,
.field-hint,
.input-help {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.text-tool {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--accent-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 750;
  gap: 5px;
  padding: 4px 0;
}

.text-tool:hover {
  color: #9f2c0d;
}

.text-tool:disabled {
  cursor: wait;
  opacity: 0.6;
}

.text-tool svg {
  height: 15px;
  width: 15px;
}

.text-tool.is-loading svg {
  animation: spin 0.9s linear infinite;
}

.textarea-wrap {
  position: relative;
}

.textarea-wrap textarea {
  background: #fafbf9;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  line-height: 1.7;
  min-height: 156px;
  padding: 14px 14px 34px;
  resize: vertical;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
  width: 100%;
}

.textarea-wrap textarea:hover {
  border-color: #aeb6ae;
}

.textarea-wrap textarea:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 90, 43, 0.1);
  outline: 0;
}

.textarea-wrap textarea::placeholder {
  color: #9ca29d;
}

.char-count {
  bottom: 10px;
  color: #9aa09b;
  font-size: 10px;
  position: absolute;
  right: 12px;
}

.prompt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.prompt-suggestions button {
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 5px;
  color: #59605a;
  font-size: 10px;
  padding: 6px 8px;
}

.prompt-suggestions button:hover {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink);
}

.upload-zone {
  background: #fafbf9;
  border: 1px dashed #bfc6bf;
  border-radius: var(--radius);
  min-height: 82px;
  overflow: hidden;
  transition: background 150ms ease, border-color 150ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  background: #f4f8f5;
  border-color: var(--green);
}

.upload-empty {
  align-items: center;
  display: flex;
  gap: 12px;
  min-height: 82px;
  padding: 14px;
}

.upload-icon {
  align-items: center;
  background: var(--green-soft);
  border-radius: 6px;
  color: var(--green);
  display: flex;
  flex: 0 0 auto;
  height: 42px;
  justify-content: center;
  width: 42px;
}

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

.upload-empty > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-empty strong {
  font-size: 12px;
}

.upload-empty small {
  color: var(--muted);
  font-size: 10px;
}

.upload-preview {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 64px minmax(0, 1fr) 32px;
  min-height: 82px;
  padding: 8px;
}

.upload-preview img {
  background: var(--surface-muted);
  border-radius: 5px;
  height: 64px;
  object-fit: cover;
  width: 64px;
}

.upload-file-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.upload-file-info strong {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-info span {
  color: var(--muted);
  font-size: 10px;
}

.settings-section {
  border: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-title {
  margin-bottom: 17px;
}

.settings-title svg {
  color: var(--muted);
  height: 15px;
  width: 15px;
}

.input-label {
  display: block;
  margin-bottom: 8px;
}

.key-input-wrap {
  align-items: center;
  display: flex;
  position: relative;
}

.key-input-wrap > svg {
  color: var(--muted);
  height: 16px;
  left: 12px;
  pointer-events: none;
  position: absolute;
  width: 16px;
}

.key-input-wrap input {
  background: #fafbf9;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  height: 42px;
  padding: 0 42px 0 38px;
  width: 100%;
}

.key-input-wrap input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 90, 43, 0.1);
  outline: 0;
}

.model-select-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 42px;
}

.model-select-wrap {
  align-items: center;
  display: flex;
  min-width: 0;
  position: relative;
}

.model-select-wrap > svg:first-child {
  color: var(--muted);
  height: 16px;
  left: 12px;
  pointer-events: none;
  position: absolute;
  width: 16px;
  z-index: 1;
}

.model-select-wrap select {
  appearance: none;
  background: #fafbf9;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  height: 42px;
  min-width: 0;
  overflow: hidden;
  padding: 0 38px;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.model-select-wrap select:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 90, 43, 0.1);
  outline: 0;
}

.model-select-wrap select:disabled {
  color: #8a918b;
  cursor: not-allowed;
}

.model-select-wrap .select-chevron {
  height: 15px;
  pointer-events: none;
  position: absolute;
  right: 12px;
  width: 15px;
}

.model-refresh {
  height: 42px;
  width: 42px;
}

.model-refresh.is-loading svg {
  animation: spin 0.9s linear infinite;
}

.input-help {
  display: block;
  margin-top: 6px;
}

.setting-group {
  border: 0;
  margin: 19px 0 0;
  padding: 0;
}

.setting-group legend {
  margin-bottom: 9px;
  padding: 0;
}

.segmented-control {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, 1fr);
}

.segmented-control label {
  min-width: 0;
}

.segmented-control input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.segmented-control span {
  align-items: center;
  background: #fafbf9;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 2px 7px;
  grid-template-columns: 22px 1fr;
  grid-template-rows: auto auto;
  min-height: 58px;
  padding: 8px;
}

.segmented-control span:hover {
  border-color: #aeb6ae;
}

.segmented-control input:checked + span {
  background: #fff7f3;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.segmented-control input:focus-visible + span {
  outline: 3px solid rgba(240, 90, 43, 0.22);
  outline-offset: 2px;
}

.ratio-icon {
  border: 1.5px solid #7d857e;
  border-radius: 2px;
  display: block;
  grid-row: 1 / 3;
  justify-self: center;
}

.square {
  height: 17px;
  width: 17px;
}

.portrait {
  height: 20px;
  width: 14px;
}

.landscape {
  height: 14px;
  width: 20px;
}

.segmented-control input:checked + span .ratio-icon {
  border-color: var(--accent);
}

.segmented-control b {
  font-size: 11px;
}

.segmented-control small {
  color: var(--muted);
  font-size: 9px;
}

.quality-row {
  margin-top: 19px;
}

.quality-row > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.quality-row .input-label,
.quality-row .input-help {
  margin: 0;
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  appearance: none;
  background: #fafbf9;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  height: 38px;
  min-width: 96px;
  padding: 0 34px 0 12px;
}

.select-wrap svg {
  height: 15px;
  pointer-events: none;
  position: absolute;
  right: 10px;
  top: 12px;
  width: 15px;
}

.composer-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 16px 28px 18px;
}

.generate-button {
  background: var(--ink);
  border: 0;
  border-radius: 7px;
  color: #fff;
  height: 50px;
  overflow: hidden;
  position: relative;
  transition: background 150ms ease, transform 120ms ease;
  width: 100%;
}

.generate-button::after {
  background: var(--accent);
  content: "";
  height: 100%;
  position: absolute;
  right: 0;
  top: 0;
  transition: width 180ms ease;
  width: 4px;
}

.generate-button:hover {
  background: #2a2e2b;
}

.generate-button:hover::after {
  width: 9px;
}

.generate-button:active {
  transform: translateY(1px);
}

.generate-button:disabled {
  cursor: wait;
  opacity: 0.9;
}

.button-default,
.button-loading {
  align-items: center;
  display: inline-flex;
  gap: 9px;
  justify-content: center;
}

.button-default svg,
.button-loading svg {
  height: 17px;
  width: 17px;
}

.button-loading svg {
  animation: spin 0.9s linear infinite;
}

.composer-footer p {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 9px;
  gap: 5px;
  justify-content: center;
  margin-top: 9px;
}

.composer-footer p svg {
  color: var(--green);
  height: 12px;
  width: 12px;
}

.gallery {
  min-width: 0;
  padding: 30px clamp(24px, 4vw, 60px) 48px;
}

.gallery-toolbar {
  margin: 0 auto 18px;
  max-width: 920px;
  min-height: 43px;
}

.gallery-toolbar h2 {
  font-size: 20px;
  line-height: 1.2;
}

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

.icon-button,
.action-button,
.secondary-button,
.primary-button {
  align-items: center;
  border-radius: 7px;
  display: inline-flex;
  justify-content: center;
}

.icon-button {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  height: 36px;
  padding: 0;
  width: 36px;
}

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

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

.action-button {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  gap: 7px;
  height: 36px;
  padding: 0 12px;
}

.action-button:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

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

.canvas-area {
  align-items: center;
  background-color: #e9ede8;
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.45) 25%, transparent 25%), linear-gradient(-45deg, rgba(255, 255, 255, 0.45) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.45) 75%), linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.45) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  justify-content: center;
  margin: 0 auto;
  max-width: 920px;
  min-height: min(680px, calc(100vh - 175px));
  overflow: hidden;
  padding: clamp(24px, 5vw, 54px);
  position: relative;
}

.empty-state {
  align-items: center;
  display: flex;
  flex-direction: column;
  max-width: 430px;
  text-align: center;
}

.inspiration-stack {
  height: 164px;
  margin-bottom: 24px;
  position: relative;
  width: 270px;
}

.inspiration-stack img {
  background: #d5dad4;
  border: 5px solid #fff;
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(30, 38, 32, 0.16);
  height: 132px;
  object-fit: cover;
  position: absolute;
  top: 12px;
  width: 98px;
}

.inspiration-one {
  left: 12px;
  transform: rotate(-8deg);
}

.inspiration-two {
  left: 86px;
  top: 2px !important;
  transform: rotate(1deg);
  z-index: 2;
}

.inspiration-three {
  right: 11px;
  transform: rotate(8deg);
}

.spark-badge {
  align-items: center;
  background: var(--accent);
  border: 4px solid #eef1ed;
  border-radius: 50%;
  bottom: 0;
  color: #fff;
  display: flex;
  height: 43px;
  justify-content: center;
  left: 114px;
  position: absolute;
  width: 43px;
  z-index: 3;
}

.spark-badge svg {
  height: 18px;
  width: 18px;
}

.empty-state h3 {
  font-size: 22px;
  margin-bottom: 9px;
}

.empty-state p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.generation-state {
  align-items: center;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.generation-visual {
  align-items: center;
  background: #202421;
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--yellow);
  display: flex;
  height: 168px;
  justify-content: center;
  margin-bottom: 25px;
  overflow: hidden;
  position: relative;
  width: 168px;
}

.generation-grid {
  background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  inset: 0;
  position: absolute;
}

.generation-visual svg {
  height: 30px;
  position: relative;
  width: 30px;
  z-index: 2;
}

.scan-line {
  animation: scan 2.2s ease-in-out infinite;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 18px var(--accent);
  height: 2px;
  left: 0;
  position: absolute;
  top: 10px;
  width: 100%;
  z-index: 1;
}

.generation-state strong {
  font-size: 17px;
  margin-bottom: 6px;
}

.generation-state > span {
  color: var(--muted);
  font-size: 12px;
}

.generation-state button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  margin-top: 20px;
  padding: 5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-view {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  max-height: calc(100vh - 230px);
  max-width: 100%;
  position: relative;
  width: 100%;
}

.result-frame {
  display: flex;
  max-height: calc(100vh - 240px);
  max-width: 100%;
  position: relative;
}

.result-frame img {
  box-shadow: 0 18px 54px rgba(24, 31, 26, 0.2);
  display: block;
  max-height: calc(100vh - 240px);
  max-width: 100%;
  object-fit: contain;
}

.image-index {
  background: rgba(18, 21, 19, 0.76);
  border-radius: 4px;
  bottom: 10px;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 5px 7px;
  position: absolute;
  right: 10px;
}

.result-caption {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 14px auto 0;
  max-width: 920px;
}

.result-caption > div:first-child {
  min-width: 0;
}

.result-caption span,
.history-heading span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.result-caption p {
  display: -webkit-box;
  font-size: 11px;
  line-height: 1.6;
  margin-top: 3px;
  max-width: 660px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result-meta {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 10px;
  padding-top: 16px;
}

.history-section {
  border-top: 1px solid var(--line);
  margin: 28px auto 0;
  max-width: 920px;
  padding-top: 17px;
}

.history-heading {
  margin-bottom: 10px;
}

.history-heading > div {
  align-items: center;
  display: flex;
  gap: 7px;
}

.history-heading b {
  align-items: center;
  background: var(--ink);
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  font-size: 8px;
  height: 17px;
  justify-content: center;
  min-width: 17px;
}

.history-heading button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 10px;
}

.history-list {
  display: grid;
  gap: 9px;
  grid-auto-columns: 76px;
  grid-auto-flow: column;
  overflow-x: auto;
  padding-bottom: 5px;
}

.history-item {
  background: #e0e4df;
  border: 2px solid transparent;
  border-radius: 6px;
  height: 76px;
  overflow: hidden;
  padding: 0;
  position: relative;
  width: 76px;
}

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

.history-item img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.history-item span {
  background: rgba(17, 20, 18, 0.72);
  bottom: 3px;
  color: #fff;
  font-size: 8px;
  padding: 2px 4px;
  position: absolute;
  right: 3px;
}

.key-dialog {
  background: transparent;
  border: 0;
  max-width: min(460px, calc(100vw - 28px));
  padding: 0;
  width: 100%;
}

.key-dialog::backdrop {
  background: rgba(18, 22, 19, 0.62);
  backdrop-filter: blur(5px);
}

.key-dialog form {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(15, 20, 17, 0.3);
  padding: 25px;
}

.dialog-icon {
  align-items: center;
  background: var(--ink);
  border-radius: 7px;
  color: #fff;
  display: flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

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

.dialog-copy {
  margin: 24px 0 22px;
}

.dialog-copy h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.dialog-copy p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.key-input-wrap input {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  padding-right: 42px;
}

.key-input-wrap button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  display: flex;
  height: 32px;
  justify-content: center;
  position: absolute;
  right: 6px;
  width: 32px;
}

.key-input-wrap button svg {
  height: 16px;
  width: 16px;
}

.endpoint-row {
  background: var(--surface-muted);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  margin-top: 11px;
  min-height: 36px;
  padding: 0 10px;
}

.endpoint-row code {
  color: #414741;
  font-size: 10px;
  margin-left: auto;
  margin-right: 8px;
}

.endpoint-row svg {
  color: var(--green);
  height: 13px;
  width: 13px;
}

.key-test-result {
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.5;
  margin-top: 12px;
  padding: 9px 11px;
}

.key-test-result.success {
  background: var(--green-soft);
  color: var(--green);
}

.key-test-result.error {
  background: #f8e5e2;
  color: var(--danger);
}

.dialog-actions {
  display: grid;
  gap: 9px;
  grid-template-columns: 1fr 1.35fr;
  margin-top: 22px;
}

.secondary-button,
.primary-button {
  border: 0;
  gap: 7px;
  height: 44px;
  padding: 0 14px;
}

.secondary-button {
  background: var(--surface-muted);
  color: #343a35;
}

.secondary-button:hover {
  background: #e1e6e0;
}

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

.primary-button:hover {
  background: #2b2f2c;
}

.secondary-button svg,
.primary-button svg {
  height: 15px;
  width: 15px;
}

.secondary-button:disabled,
.primary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.toast-region {
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  position: fixed;
  right: 22px;
  z-index: 80;
}

.toast {
  align-items: flex-start;
  animation: toast-in 180ms ease-out;
  background: #1f2421;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 14px 36px rgba(17, 22, 19, 0.2);
  color: #fff;
  display: flex;
  font-size: 11px;
  gap: 8px;
  line-height: 1.5;
  max-width: min(340px, calc(100vw - 30px));
  padding: 11px 13px;
}

.toast.success {
  border-left-color: #41b27b;
}

.toast.error {
  border-left-color: #ee6359;
}

.toast svg {
  flex: 0 0 auto;
  height: 15px;
  margin-top: 1px;
  width: 15px;
}

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

@keyframes scan {
  0%, 100% { top: 8px; opacity: 0.45; }
  50% { top: 156px; opacity: 1; }
}

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

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

  .topbar-center {
    display: none;
  }

  .workbench {
    display: block;
  }

  .composer {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    height: auto;
    position: static;
  }

  .composer-scroll {
    overflow: visible;
  }

  .composer-footer {
    position: static;
  }

  .gallery {
    min-height: 720px;
  }

  .canvas-area {
    min-height: 600px;
  }
}

@media (max-width: 560px) {
  .topbar {
    height: 62px;
    padding: 0 15px;
  }

  .brand-copy span {
    display: none;
  }

  .brand-mark {
    height: 34px;
    width: 34px;
  }

  .connection-button {
    padding: 0 10px;
  }

  .connection-button svg {
    display: none;
  }

  .composer-scroll {
    padding: 25px 18px 20px;
  }

  .composer-footer {
    padding: 14px 18px 17px;
  }

  .gallery {
    padding: 26px 15px 36px;
  }

  .gallery-toolbar {
    align-items: flex-end;
  }

  .canvas-area {
    min-height: 460px;
    padding: 24px 14px;
  }

  .inspiration-stack {
    transform: scale(0.88);
  }

  .empty-state h3 {
    font-size: 19px;
  }

  .result-actions .action-button span {
    display: none;
  }

  .result-actions .action-button {
    padding: 0;
    width: 36px;
  }

  .result-caption {
    gap: 10px;
  }

  .result-meta {
    max-width: 115px;
    text-align: right;
  }

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

  .dialog-actions .primary-button {
    grid-row: 1;
  }

  .toast-region {
    bottom: 14px;
    left: 15px;
    right: 15px;
  }

  .toast {
    max-width: none;
    width: 100%;
  }
}

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