@font-face {
  font-family: Geist;
  src: url('assets/geist.woff2') format('woff2');
  font-weight: 400 750;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('assets/instrument-serif.woff2') format('woff2');
  font-display: swap;
}
:root {
  color-scheme: dark;
  --base: #181513;
  --panel: #221d1a;
  --well: #161311;
  --line: #3d322c;
  --text: #fbefe3;
  --muted: #c2afa3;
  --accent: #f4af8b;
  --ink: #291b15;
  --display: 'Instrument Serif', Georgia, serif;
  font-family: Geist, system-ui, sans-serif;
  color: var(--text);
  background: var(--base);
  scroll-behavior: smooth;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select, input { font: inherit; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
button:not(:disabled), select, input[type=range] { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
.wrap { width: min(100% - 96px, 1320px); margin-inline: auto; }
.symbols { display: none; }
.icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.topbar { border-bottom: 1px solid var(--line); }
.topbar-inner {
  min-height: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; width: fit-content; font-size: 17px; font-weight: 590; letter-spacing: -.045em; }
.wordmark strong { color: var(--accent); font-weight: 650; }
nav { display: flex; align-items: center; gap: 31px; color: var(--muted); font-size: 13px; font-weight: 550; }
nav a:hover, nav a:focus-visible, .nav-editor { color: var(--text); }
.topbar .header-login { justify-self: end; min-height: 36px; padding-inline: 17px; color: #ffd0b4; background: #3b2922; border-color: #805945; }
.topbar .header-login:hover { background: #50362a; }

.intro { padding-block: 42px 29px; scroll-margin-top: 12px; }
.intro h1 { font: 400 clamp(55px, 6.4vw, 100px)/.94 var(--display); letter-spacing: -.026em; }
.intro p { margin-top: 14px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.strength-tip, .marketplace-tip { display: flex; align-items: start; gap: 11px; }
.strength-tip { margin-bottom: 16px; border: 1px solid #2b4664; border-radius: 10px; padding: 11px 14px; background: #151f32; color: #e0e9ef; }
.strength-tip p { align-self: center; font-size: 13px; line-height: 1.5; }
.tip-icon { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; font-size: 14px; font-weight: 700; }
.strength-tip .tip-icon { background: #294e78; color: #e0efff; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 360px); gap: 16px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 15px; background: var(--panel); min-width: 0; }
.photo-panel { overflow: hidden; scroll-margin-top: 12px; }
.photo-toolbar, .photo-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-inline: 17px; }
.photo-toolbar { min-height: 64px; }
.photo-caption { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 11px; row-gap: 3px; min-width: 0; }
.photo-caption h2, .controls h2 { font-size: 14px; font-weight: 640; }
.photo-caption > span { font-size: 12px; color: var(--muted); max-width: 34ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-footer { min-height: 44px; font-size: 12px; color: var(--muted); }
.stage {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1.79;
  padding: 0;
  background: var(--well);
  overflow: hidden;
  container-type: size;
}
.image-frame {
  --split: 49%;
  position: relative;
  width: min(100cqw, calc(100cqh * var(--photo-ratio, 1.5)));
  height: min(100cqh, calc(100cqw / var(--photo-ratio, 1.5)));
}
.stage[data-sample="true"] .image-frame { width: 100%; height: 100%; }
.image-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage[data-sample="true"] canvas { object-fit: cover; object-position: 50% 65%; }
#edited { clip-path: inset(0 0 0 var(--split)); }
.image-frame:has(#edited:not([hidden])) #original { clip-path: inset(0 calc(100% - var(--split)) 0 0); }
.stage-overlay { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 20px; }
.stage-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 22px; text-align: center; background: radial-gradient(ellipse at center, #241c19, var(--well) 72%); }
.stage-empty::before { content: ''; position: absolute; inset: 14px; border: 1px dashed #4a3931; border-radius: 10px; pointer-events: none; }
.photo-add-icon { display: grid; place-items: center; width: 82px; height: 82px; border: 1px solid #77503c; border-radius: 22px; background: #382820; color: var(--accent); margin-bottom: 4px; }
.photo-add-icon .icon { width: 51px; height: 51px; stroke-width: 1.3; }
.stage-empty .button { min-width: 146px; }
.stage-empty p { color: var(--muted); font-size: 13px; }
.stage-empty a { color: #ffd0b5; text-decoration: underline; text-underline-offset: 3px; }
.stage-empty a:hover { color: var(--text); }
.drop-message { display: none; pointer-events: none; gap: 8px; justify-items: center; color: var(--text); background: #211713e8; border: 2px dashed var(--accent); }
.drop-message .icon { width: 26px; height: 26px; }
.stage.dragging .drop-message { display: grid; }
.image-label { position: absolute; top: 14px; background: #1d1716e6; color: #fff6f0; border: 1px solid #ffffff37; border-radius: 5px; padding: 5px 9px; font-size: 11px; font-weight: 550; pointer-events: none; }
.original-label { left: 14px; }
.edited-label { right: 14px; }
.compare-line { position: absolute; inset-block: 0; width: 2px; left: var(--split); translate: -50%; background: #fff0e6d9; pointer-events: none; }
.compare-line > span { display: grid; place-items: center; position: absolute; top: 50%; left: 50%; translate: -50% -50%; border-radius: 50%; width: 36px; height: 36px; color: var(--ink); background: #fae5d6; box-shadow: 0 2px 14px #0007; }
#compare {
  position: absolute;
  inset: 0;
  appearance: none;
  background: transparent;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
}
#compare::-webkit-slider-thumb { appearance: none; width: 1px; height: 36px; }
#compare::-moz-range-thumb { border: 0; width: 1px; height: 36px; }
#compare-ui:focus-within .compare-line > span { outline: 3px solid var(--accent); outline-offset: 3px; }

.button { display: inline-flex; min-height: 41px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; padding: 8px 13px; line-height: 1.25; background: none; font-size: 13px; font-weight: 610; }
.button:disabled { opacity: .44; cursor: default; }
.button-light { background: #f5e5d7; color: var(--ink); white-space: nowrap; }
.button-light:hover { background: #fff2e8; }
.controls-section { padding: 17px 18px; }
.controls-section + .controls-section { border-top: 1px solid var(--line); }
.browse { justify-content: start; width: 100%; margin-top: 12px; min-height: 52px; border-color: #805945; background: #3b2922; color: #ffd0b4; }
.browse:hover { background: #50362a; }
.browse .end-icon { margin-left: auto; }
.secondary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.quiet { border-color: var(--line); color: var(--muted); }
.quiet:hover, .quiet[aria-expanded=true] { background: #312621; color: var(--text); }
.quiet .icon { width: 16px; height: 16px; }
.selection { display: flex; align-items: center; gap: 11px; margin-bottom: 19px; }
#selection-image { flex: none; width: 44px; height: 44px; background: #3b2922; border: 1px solid #805945; border-radius: 7px; }
.selection-copy { min-width: 0; overflow-wrap: anywhere; }
.selection-copy > span { display: block; color: var(--muted); font-size: 11px; }
.selection-label { margin-bottom: 3px; }
#preset-author { margin-top: 4px; }
.selection-copy h3 { font-size: 14px; line-height: 1.25; font-weight: 650; }
.slider-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.slider-line output { color: var(--accent); font-variant-numeric: tabular-nums; }
.slider {
  width: 100%;
  margin: 5px 0 12px;
  height: 20px;
  accent-color: var(--accent);
}
.button-primary { background: var(--accent); color: var(--ink); min-height: 43px; }
.button-primary:not(:disabled):hover { background: #ffc5a7; }
#strength { display: block; margin-bottom: 0; }
#advanced { border-top: 1px solid var(--line); margin-top: 13px; padding-top: 14px; }
.marketplace-tip { margin-top: 13px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: #2a221e; }
.marketplace-tip .tip-icon { background: #47342b; color: #ffd0b5; }
.marketplace-tip h3 { font-size: 12px; margin: 3px 0 4px; }
.marketplace-tip p { font-size: 12px; line-height: 1.5; color: var(--muted); }
.marketplace-tip a { color: #ffd0b5; text-decoration: underline; text-underline-offset: 3px; }
.marketplace-tip code { color: var(--text); }
.advanced-header, .export-heading { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.advanced-header { margin-bottom: 14px; }
.advanced-header h3 { font-size: 13px; }
.text-button { padding: 3px 0; background: transparent; border: 0; color: #f5bd9d; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--text); }
.button-wide { width: 100%; }
.format { position: relative; color: var(--muted); }
.format select { border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); appearance: none; font-size: 12px; padding: 6px 25px 6px 9px; }
.format .icon { position: absolute; width: 14px; height: 14px; right: 6px; top: 50%; translate: 0 -50%; pointer-events: none; }
.button-download { margin-top: 10px; min-height: 41px; width: 100%; border-color: #80604e; color: var(--text); }
.button-download:not(:disabled):hover { background: #3b2922; }
.export-section p { text-align: center; margin-top: 8px; font-size: 11px; color: var(--muted); }
.status { grid-column: 1 / -1; padding: 9px 12px; background: #34261f; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; overflow-wrap: anywhere; }
.status[data-error=true] { color: #ffc4bc; border-color: #a46760; }

.library { padding-block: 36px 54px; scroll-margin-top: 20px; }
.library-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.library h2 { font: 400 clamp(42px, 4vw, 59px)/.95 var(--display); letter-spacing: -.02em; }
.library-heading p { color: var(--muted); margin-top: 7px; font-size: 13px; }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.preset-card { position: relative; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.preset-card:has([aria-pressed=true]) { border-color: #b47d60; }
.preset-select { display: block; text-align: left; padding: 0; border: 0; border-radius: 10px; overflow: hidden; width: 100%; background: transparent; }
.preset-select:hover .preset-text { background: #302621; }
.preset-select canvas { display: block; aspect-ratio: 2.35; object-fit: cover; width: 100%; height: auto; background: var(--well); }
.preset-text { display: flex; flex-direction: column; gap: 4px; padding: 12px 50px 13px 13px; }
.preset-text strong { font-size: 14px; }
.preset-description { font-size: 12px; color: var(--muted); }
.preset-author { margin-top: 3px; font-size: 11px; color: #dbb6a2; }
.share-button { position: absolute; bottom: 12px; right: 10px; width: 34px; min-height: 34px; padding: 0; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.site-footer .wrap { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }

dialog { width: min(calc(100% - 32px), 420px); border: 1px solid #805945; border-radius: 14px; padding: 24px; background: var(--panel); color: var(--text); }
dialog::backdrop { background: #110b09b8; }
dialog h2 { font: 400 44px/1 var(--display); margin-bottom: 20px; }
dialog label { display: block; font-size: 13px; margin-bottom: 7px; }
dialog input { width: 100%; padding: 11px 12px; background: var(--well); border: 1px solid var(--line); border-radius: 7px; color: var(--text); }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 17px; }
.dialog-actions .button { width: auto; }

@media (min-width: 761px) {
  .workspace:has(#advanced:not([hidden])) .photo-panel:has(.image-frame:not([hidden])) { position: sticky; top: 14px; }
}
@media (max-width: 1060px) {
  .wrap { width: calc(100% - 56px); }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(290px, 320px); }
  .stage { aspect-ratio: 1.3; }
}
@media (max-width: 760px) {
  .wrap { width: calc(100% - 36px); }
  .topbar-inner { min-height: 60px; gap: 12px; }
  nav { gap: 18px; }
  .intro { padding-block: 30px 22px; }
  .intro h1 { text-wrap: balance; }
  .intro p { font-size: 14px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .stage { aspect-ratio: 1.42; }
  .stage-empty { gap: 11px; }
  .photo-add-icon { width: 62px; height: 62px; border-radius: 17px; }
  .photo-add-icon .icon { width: 38px; height: 38px; }
  .preset-grid { grid-template-columns: 1fr; }
  .preset-select canvas { aspect-ratio: 2.6; }
}
@media (max-width: 475px) {
  .topbar-inner .nav-editor { display: none; }
  .topbar .header-login { padding-inline: 12px; }
}
@media (max-width: 395px) {
  .wrap { width: calc(100% - 26px); }
  .wordmark { font-size: 15px; }
  nav { gap: 12px; font-size: 12px; }
  .intro h1 { font-size: 52px; }
  .photo-toolbar, .photo-footer { padding-inline: 12px; }
  .photo-caption > span { max-width: 21ch; }
}
@media (max-width: 760px) and (min-height: 580px) {
  .photo-panel:has(.image-frame:not([hidden])) { position: sticky; top: 0; z-index: 1; }
  .stage { max-height: 34svh; }
  .controls :is(a, button, input, select) { scroll-margin-top: min(49svh, 420px); }
}
@media (prefers-reduced-motion: reduce) { :root { scroll-behavior: auto; } }
