:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: #0d0f12;
  color: #f2f4f7;
  --panel: #15181d;
  --panel-raised: #1b2027;
  --line: #2b323b;
  --muted: #9aa4b1;
  --quiet: #687381;
  --accent: #b9e7ca;
  --accent-ink: #0d2417;
}
* {
  box-sizing: border-box;
}
body {
  min-width: 320px;
  margin: 0;
  padding: 2.5rem 1rem 4rem;
}
.app-shell {
  width: min(100%, 58rem);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}
.menu-bar {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 2.3rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.menu-brand {
  margin-right: 0.7rem;
  color: #f2f4f7;
  font-size: 0.85rem;
  font-weight: 750;
}
.menu-item {
  position: relative;
}
.menu-item summary {
  border-radius: 0.35rem;
  cursor: pointer;
  list-style: none;
  padding: 0.4rem 0.55rem;
  font-size: 0.78rem;
}
.menu-item summary::-webkit-details-marker {
  display: none;
}
.menu-item summary:hover,
.menu-item[open] summary {
  background: #ffffff10;
  color: #fff;
}
.menu-popover {
  position: absolute;
  top: 2.1rem;
  left: 0;
  z-index: 10;
  display: grid;
  min-width: 10rem;
  gap: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #1b2027;
  box-shadow: 0 0.8rem 2rem #0008;
  padding: 0.35rem;
}
.menu-popover button {
  border: 0;
  border-radius: 0.3rem;
  background: transparent;
  color: #e7ebef;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.45rem 0.55rem;
  text-align: left;
  white-space: nowrap;
}
.menu-popover button:hover:not(:disabled) {
  background: #ffffff12;
}
.menu-popover button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.hero {
  padding: 0.5rem 0.25rem 1rem;
}
.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1, h2, p {
  margin-top: 0;
}
h1 {
  max-width: 32rem;
  margin-bottom: 0.7rem;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}
h2 {
  margin-bottom: 0.3rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.lede {
  max-width: 42rem;
  margin-bottom: 1rem;
  color: #bdc5ce;
  line-height: 1.55;
}
.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.privacy-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0.2rem #b9e7ca22;
}
.auto-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.7rem 1rem;
  border-color: #617469;
  background: linear-gradient(135deg, #172019, var(--panel));
}
.auto-description,
.auto-note {
  max-width: 40rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}
.auto-key-field {
  max-width: 42rem;
  margin-top: 0.8rem;
}
.auto-button {
  min-width: 9rem;
  min-height: 3.2rem;
  font-size: 1rem;
}
.auto-note {
  grid-column: 1 / -1;
  color: #8f9e94;
  font-size: 0.72rem;
}
.advanced {
  display: grid;
  gap: 0.8rem;
}
.advanced > summary {
  width: max-content;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
  list-style-position: inside;
}
.advanced > summary:hover {
  color: #fff;
}
.advanced-content {
  display: grid;
  gap: 1rem;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--panel);
  padding: 1.15rem;
}
.step-panel {
  display: grid;
  gap: 1rem;
}
.step-heading {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}
.step-heading p {
  max-width: 42rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}
.step-number {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #617469;
  border-radius: 50%;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}
.optional {
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 500;
}
.file-drop,
.reference-drop {
  position: relative;
  display: grid;
  min-height: 7rem;
  place-items: center;
  align-content: center;
  gap: 0.25rem;
  border: 1px dashed #53606d;
  border-radius: 0.7rem;
  background: #11151a;
  color: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.file-drop:hover,
.reference-drop:hover,
.reference-drop.is-dragging {
  border-color: var(--accent);
  background: #1b2820;
}
.drop-icon {
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1;
}
.drop-title {
  font-size: 0.92rem;
  font-weight: 700;
}
.drop-subtitle,
.action-note,
.meta,
.compare-hint {
  color: var(--muted);
  font-size: 0.78rem;
}
input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.meta {
  margin: -0.35rem 0 0;
}
.reference-save {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.reference-save .button {
  min-height: 2.2rem;
  font-size: 0.78rem;
}
.prompt-details {
  margin-top: 0.7rem;
}
.prompt-details > summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
}
.prompt-details > summary:hover {
  color: #fff;
}
.prompt-text {
  max-height: 16rem;
  margin: 0.6rem 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: #101318;
  color: #cdd5dd;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  line-height: 1.5;
  padding: 0.7rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.prompt-details .key-warning {
  margin: 0.5rem 0 0;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.field {
  display: grid;
  gap: 0.4rem;
  color: #cbd2da;
  font-size: 0.8rem;
}
.key-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
}
.check-label input {
  accent-color: var(--accent);
}
.clear-key {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  padding: 0;
  text-decoration: underline;
}
.clear-key:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.key-warning {
  color: var(--quiet);
  font-size: 0.68rem;
  line-height: 1.35;
}
input:not([type="file"]),
textarea,
select {
  width: 100%;
  min-width: 0;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #101318;
  color: inherit;
  font: inherit;
  padding: 0.65rem 0.7rem;
}
.denoise-mode {
  display: grid;
  min-width: 14rem;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
}
input:not([type="file"]):focus,
textarea:focus,
select:focus,
button:focus-visible,
input[type="range"]:focus-visible,
.file-drop:focus-within,
.reference-drop:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.reference-actions,
.action-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}
.reference-drop {
  min-height: 3.4rem;
  flex: 1 1 15rem;
  padding: 0.6rem 1rem;
}
.button {
  min-height: 2.7rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0.65rem 0.9rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 120ms ease, opacity 120ms ease;
}
.button:hover:not(:disabled) {
  filter: brightness(1.12);
}
.button-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.button-secondary {
  border-color: #52606c;
  background: #20262e;
  color: #f2f4f7;
}
button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}
.strength {
  display: grid;
  min-width: 13rem;
  flex: 1 1 13rem;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
}
.strength output {
  float: right;
  color: #e9edf1;
  font-variant-numeric: tabular-nums;
}
input[type="range"] {
  accent-color: var(--accent);
}
.work {
  display: grid;
  gap: 0.55rem;
  border-color: #526b5b;
  background: #172019;
}
.work[hidden] {
  display: none;
}
.work-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #d8f3df;
  font-size: 0.87rem;
}
.cancel-work {
  margin-left: auto;
  border: 1px solid #78917e;
  border-radius: 0.35rem;
  background: transparent;
  color: #d8f3df;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  padding: 0.35rem 0.55rem;
}
.cancel-work:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.spinner {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  border: 2px solid #52645a;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
progress {
  width: 100%;
  height: 0.45rem;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: #2a342d;
  overflow: hidden;
}
progress::-webkit-progress-bar {
  background: #2a342d;
}
progress::-webkit-progress-value,
progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}
progress:not([value]) {
  background: linear-gradient(90deg, #2a342d 0%, #6a8b72 50%, #2a342d 100%);
  background-size: 200% 100%;
  animation: indeterminate 1.2s ease-in-out infinite;
}
.preview-panel {
  display: grid;
  gap: 1rem;
}
.preview-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}
.preview-header .eyebrow {
  margin-bottom: 0.3rem;
}
.preview-header h2 {
  margin-bottom: 0;
}
.viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(12rem, 0.75fr);
  gap: 0.8rem;
}
.viewer-main {
  min-width: 0;
}
.viewer-side {
  display: grid;
  align-content: start;
  gap: 0.8rem;
}
figure {
  min-width: 0;
  margin: 0;
}
figcaption {
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
}
canvas {
  display: block;
  width: 100%;
  height: auto;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: #080a0c;
}
.compare-frame {
  position: relative;
  min-height: 5rem;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 0.55rem;
  background: #080a0c;
  touch-action: none;
  cursor: default;
}
.compare-frame.is-panning {
  cursor: grabbing;
}
.compare-stage {
  position: relative;
  width: 100%;
  height: 100%;
  transform: scale(1);
  transform-origin: center center;
  transition: transform 140ms ease;
  will-change: transform;
}
.viewer-label {
  position: absolute;
  top: 0.7rem;
  z-index: 2;
  border: 1px solid #ffffff33;
  border-radius: 999px;
  background: #0d0f12bb;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.5rem;
  text-transform: uppercase;
  pointer-events: none;
}
.viewer-label-after {
  top: 3.4rem;
  right: 0.7rem;
}
.viewer-label-before {
  left: 0.7rem;
}
.zoom-controls {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  border: 1px solid #ffffff33;
  border-radius: 0.45rem;
  background: #0d0f12dd;
  color: #fff;
  padding: 0.2rem;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}
.zoom-button,
.zoom-reset {
  min-width: 1.7rem;
  min-height: 1.7rem;
  border: 0;
  border-radius: 0.28rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
}
.zoom-reset {
  min-width: auto;
  padding: 0 0.35rem;
  font-size: 0.68rem;
}
.zoom-button:hover:not(:disabled),
.zoom-reset:hover:not(:disabled) {
  background: #ffffff1c;
}
.zoom-button:disabled,
.zoom-reset:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}
.compare-frame canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
}
#afterCanvas {
  position: absolute;
  inset: 0;
}
#beforeCanvas {
  position: absolute;
  inset: 0;
  clip-path: inset(0 50% 0 0);
}
#wipe {
  position: absolute;
  right: 0.7rem;
  z-index: 4;
  bottom: 0.7rem;
  left: 0.7rem;
  width: calc(100% - 1.4rem);
  margin: 0;
  height: 2rem;
  appearance: none;
  background: transparent;
  cursor: ew-resize;
}
#wipe::-webkit-slider-runnable-track {
  height: 0.35rem;
  border: 1px solid #ffffffaa;
  border-radius: 999px;
  background: #0d0f12cc;
}
#wipe::-moz-range-track {
  height: 0.35rem;
  border: 1px solid #ffffffaa;
  border-radius: 999px;
  background: #0d0f12cc;
}
#wipe::-webkit-slider-thumb {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: -0.45rem;
  appearance: none;
  border: 2px solid #0d0f12;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px #ffffff;
}
#wipe::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid #0d0f12;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px #ffffff;
}
#wipe:disabled {
  visibility: hidden;
}
.wipe-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 3;
  width: 2px;
  background: #ffffff;
  box-shadow: 0 0 0 1px #0d0f1288;
  pointer-events: none;
}
.compare-frame[data-has-result="false"] .viewer-label-after,
.compare-frame[data-has-result="false"] .wipe-divider,
.compare-frame[data-has-result="false"] .zoom-controls {
  visibility: hidden;
}
.status {
  min-height: 1.25rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
.bottom-save {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding: 1rem 0 0.25rem;
}
.bottom-save .button {
  min-width: 12rem;
}
.status[data-state="error"] {
  color: #ffb4aa;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes indeterminate {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner,
  progress:not([value]) {
    animation: none;
  }
}
@media (max-width: 640px) {
  body {
    padding: 1.25rem 0.7rem 2.5rem;
  }
  .panel {
    padding: 0.9rem;
  }
  .field-grid,
  .viewer-layout {
    grid-template-columns: 1fr;
  }
  .auto-panel {
    grid-template-columns: 1fr;
  }
  .auto-button {
    width: 100%;
  }
  .viewer-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .preview-header {
    display: block;
  }
  .compare-hint {
    display: block;
    margin-top: 0.45rem;
  }
  .button {
    width: 100%;
  }
  .bottom-save {
    display: grid;
  }
  .action-line .strength {
    width: 100%;
  }
}
