.photo-editor {
  --editor-muted: #c3bdc9;
  --editor-hint: #b1a8b5;
  --editor-border: #37333c;
  --editor-well: #141419;
  --editor-tint: color-mix(in oklab, var(--pink) 14%, var(--panel));
  --editor-focus: color-mix(in oklab, var(--pink) 48%, var(--editor-border));
  max-width: 1200px;
  padding-top: 10px;
  padding-bottom: 40px;
  font-size: 15px;
}

.photo-editor-toolbar {
  position: sticky;
  top: 89px;
  z-index: 10;
  padding: 8px 0 12px;
  background: var(--bg);
}
.photo-editor-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.photo-editor-title-row h1 { font-size: clamp(24px, 3.1vw, 36px); font-weight: 750; letter-spacing: -.038em; line-height: 1.13; margin: 0; }
.photo-editor-apply { min-height: 46px; padding: 8px 12px 8px 15px; flex: none; font-size: 15px; font-weight: 700; }
.photo-editor-apply .icon { width: 17px; height: 17px; }
.photo-editor-apply:disabled { cursor: default; opacity: 1; transform: none; background: color-mix(in oklab, var(--pink) 75%, var(--panel)); }
.photo-editor-apply-price { padding: 3px 7px; border-radius: 7px; background: #321b2818; font-size: 13px; }
.photo-editor-rules-link { color: var(--pink2); font-size: 14px; justify-self: start; }
.photo-editor-rules-link:hover { text-decoration: underline; }
.photo-editor-status { margin: 6px 0 0; color: var(--editor-muted, var(--muted)); font-size: 13px; }
.photo-editor-status:empty { display: none; }
.photo-editor-status.is-error { color: var(--pink2); }
.photo-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.photo-editor-controls { display: grid; gap: 11px; min-width: 0; }
.photo-editor-result-column { display: grid; gap: 11px; min-width: 0; }
.photo-editor-panel { padding: 15px; min-width: 0; border-radius: 17px; border-color: var(--editor-border); }
.photo-editor-source { padding: 7px; min-width: 0; border-radius: 17px; border-color: var(--editor-border); }
.photo-editor-file { display: none; }
.photo-editor-upload {
  display: flex;
  width: 100%;
  min-height: 66px;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  text-align: left;
  background: var(--editor-well);
  border: 1px dashed color-mix(in oklab, var(--editor-muted) 28%, var(--editor-border));
  border-radius: 11px;
}
.photo-editor-upload:hover { border-color: var(--pink); background: var(--editor-tint); }
.photo-editor-upload img { width: 44px; height: 44px; object-fit: cover; border-radius: 9px; flex: none; }
.photo-editor-upload strong, .photo-editor-upload small { display: block; }
.photo-editor-upload strong { font-size: 16px; font-weight: 700; }
.photo-editor-upload small, .photo-editor-placeholder small { color: var(--editor-muted); font-size: 14px; }
.photo-editor-mark {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  flex: none;
  border-radius: 11px;
  background: var(--editor-tint);
  color: var(--pink2);
  font-size: 22px;
  line-height: 1;
}
.photo-editor-selection {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--editor-focus);
  border-radius: 11px;
  background: var(--editor-tint);
}
.photo-editor-selection h2 { margin: 0 0 7px; font-size: 14px; font-weight: 700; }
.photo-editor-selection dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.photo-editor-selection dt { color: var(--editor-muted); font-size: 13px; margin-bottom: 2px; }
.photo-editor-selection dd { margin: 0; color: var(--editor-muted); font-size: 15px; overflow-wrap: anywhere; }
.photo-editor-selection dd.is-selected { color: var(--text); font-weight: 650; }
.photo-editor-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border-radius: 10px;
  padding: 4px;
  background: var(--editor-well);
}
.photo-editor-modes button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 39px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--editor-muted);
  font-weight: 650;
}
.photo-editor-modes button .icon { width: 17px; height: 17px; }
.photo-editor-modes button:hover { background: var(--panel2); }
.photo-editor-modes button[aria-pressed="true"] {
  color: var(--pink2);
  background: var(--editor-tint);
  border-color: var(--editor-focus);
}
.photo-editor-search { margin: 10px 0; }
.photo-editor-search input { width: 100%; height: 42px; padding-block: 7px; font-size: 15px; background: var(--editor-well); border-color: var(--editor-border); }
.photo-editor-search input::placeholder { color: var(--editor-hint); }
.photo-editor-search .icon { top: 13px; width: 16px; height: 16px; color: var(--editor-hint); }
.photo-editor-presets { max-height: clamp(164px, 27vh, 248px); padding: 3px 2px 4px 3px; overflow-y: auto; scrollbar-width: thin; scrollbar-gutter: stable; scrollbar-color: #68606d transparent; }
.photo-editor-options { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-editor-presets .chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 37px; padding: 6px 10px;
  border: 1px solid var(--editor-border); border-radius: 8px; background: var(--panel2); color: var(--text);
  font-size: 14px; text-align: left; overflow-wrap: anywhere;
}
.photo-editor-presets .chip:hover { border-color: var(--editor-focus); }
.photo-editor-presets .chip[hidden] { display: none; }
.photo-editor-presets .chip[data-editor-featured][aria-pressed="false"] {
  background: color-mix(in oklab, var(--pink) 8%, var(--editor-well));
  border-color: color-mix(in oklab, var(--pink) 66%, var(--editor-border));
  color: var(--pink2); font-weight: 650;
}
.photo-editor-presets .chip[data-editor-featured][aria-pressed="false"]::before { content: '✦' / ''; color: var(--pink); font-size: .85em; }
.photo-editor-presets .chip[aria-pressed="true"] { color: var(--pink2); background: var(--editor-tint); border-color: var(--pink); font-weight: 650; }
.photo-editor-presets .chip[aria-pressed="true"]::before { content: '✓' / ''; font-size: .9em; }
.photo-editor-presets .chip:focus-visible { outline-offset: -2px; }
.photo-editor-empty { margin: 8px 0; color: var(--editor-muted); font-size: 14px; }
.photo-editor-details { padding-block: 0; }
.photo-editor-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
.photo-editor-details summary::-webkit-details-marker { display: none; }
.photo-editor-details summary::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-right: 3px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translateY(-2px);
}
.photo-editor-details[open] summary::after { transform: rotate(225deg); }
.photo-editor-details-body { padding: 1px 0 14px; }
.photo-editor-option-group + .photo-editor-option-group,
.photo-editor-age + .photo-editor-option-group { margin-top: 18px; }
.photo-editor-panel .photo-editor-option-group h3, .photo-editor-age-label { margin: 0; color: var(--editor-muted); font-size: 14px; font-weight: 550; }
.photo-editor-option-group .photo-editor-options { margin-top: 8px; }
.photo-editor-option-group .chip { font-size: 14px; color: var(--editor-muted); }
.photo-editor-option-group .chip.active { color: var(--pink2); }
.photo-editor-age { margin-top: 18px; }
.photo-editor-age-label, .photo-editor-age-ticks { display: flex; align-items: center; justify-content: space-between; }
.photo-editor-age-label output { color: var(--pink2); font-size: 17px; font-weight: 700; }
.photo-editor-age input { width: 100%; margin: 8px 0 0; accent-color: var(--pink); }
.photo-editor-age-ticks { color: var(--editor-muted); font-size: 12px; }
.photo-editor-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.photo-editor-result-heading h2 { font-size: 19px; margin: 0; }
.photo-editor-result-heading .btn { font-size: 14px; }
.photo-editor-placeholder {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  min-height: 330px;
  padding: 16px;
  text-align: center;
  background: radial-gradient(ellipse at center, var(--editor-tint), var(--editor-well) 72%);
  border: 1px solid var(--editor-border);
  border-radius: 11px;
}
.photo-editor-placeholder .photo-editor-mark { margin-bottom: 4px; }
.photo-editor-placeholder strong { font-size: 17px; font-weight: 680; }
.photo-editor-output { display: block; width: 100%; max-height: min(62vh, 520px); object-fit: contain; border-radius: 11px; }

.photo-editor-examples { max-width: 920px; margin: 35px auto 0; }
.photo-editor-examples header { margin-bottom: 19px; text-align: center; }
.photo-editor-examples h2 { margin: 0; font-size: clamp(23px, 4vw, 30px); font-weight: 750; letter-spacing: -.025em; }
.photo-editor-examples header p { margin: 5px 0 0; color: var(--editor-muted); }
.photo-example-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.photo-example-gallery figure { min-width: 0; margin: 0; }
.photo-example {
  position: relative; isolation: isolate; aspect-ratio: 2 / 3; overflow: hidden;
  border: 1px solid var(--editor-border); border-radius: 14px; background: var(--panel);
}
.photo-example:has(input:focus-visible) { outline: 2px solid var(--pink); outline-offset: 3px; }
.photo-example-frame { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.photo-example[data-example="low-angle"] .photo-example-frame { object-position: center 24%; }
.photo-example-after { clip-path: inset(0 0 0 var(--split)); }
.photo-example-tag {
  position: absolute; top: 10px; padding: 4px 9px; border-radius: 7px;
  background: #101014d9; color: var(--text); font-size: 13px; font-weight: 700; pointer-events: none;
}
.photo-example-before-tag { left: 10px; }
.photo-example-after-tag { right: 10px; }
.photo-example-line, .photo-example-handle { position: absolute; pointer-events: none; }
.photo-example-line {
  left: var(--split); top: 0; bottom: 0; width: 2px; transform: translateX(-50%);
  background: var(--text); box-shadow: 0 0 7px #1010148c;
}
.photo-example-handle {
  top: 50%; left: clamp(21px, var(--split), calc(100% - 21px)); transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 40px; height: 40px; border: 2px solid var(--pink2);
  border-radius: 50%; background: var(--pink); color: #321b28; box-shadow: 0 2px 10px #10101480;
  font-size: 24px; font-weight: 650; line-height: 1;
}
.photo-example input[type="range"] {
  appearance: none; position: absolute; z-index: 2; inset: 0; margin: 0; width: 100%; height: 100%;
  opacity: 0; cursor: ew-resize; touch-action: pan-y;
}
.photo-example input[type="range"]::-webkit-slider-thumb { appearance: none; width: 1px; height: 100%; }
.photo-example input[type="range"]::-moz-range-thumb { width: 1px; border: 0; }
.photo-example-gallery figcaption { margin-top: 6px; color: var(--editor-muted); text-align: center; font-size: 13px; }

.photo-preset-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.photo-preset-list .model-settings { margin: 0; min-width: 0; }
.photo-preset-list ul { display: grid; gap: 7px; padding: 0; margin: 12px 0 0; list-style: none; }
.photo-preset-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 7px; overflow-wrap: anywhere; }
.photo-preset-list li .btn { flex: none; }
.photo-preset-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.photo-preset-actions .photo-preset-arrow { padding-inline: 8px; min-width: 30px; }
.photo-preset-form .photo-editor-status { color: var(--muted); }

.photo-rules-form { display: grid; gap: 12px; }
.photo-rules-form label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.photo-rules-form input { width: 17px; height: 17px; flex: none; margin: 2px 0 0; accent-color: var(--pink); }
.photo-rules-form a, .photo-rules-sources a { color: var(--pink2); text-decoration: underline; text-underline-offset: 3px; }
.photo-rules-form button { white-space: normal; }
.photo-rules-form .photo-editor-status { margin: 0; }
.photo-rules-page { max-width: 900px; padding-top: 26px; padding-bottom: 48px; }
.photo-rules-document { margin-top: 12px; line-height: 1.65; }
.photo-rules-document h1 { margin: 4px 0 6px; line-height: 1.15; font-size: clamp(24px, 5vw, 34px); }
.photo-rules-document h2 { margin: 0 0 7px; font-size: 17px; }
.photo-rules-document section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.photo-rules-document p { margin: 0 0 9px; }
.photo-rules-sources { font-size: 12px; }
.photo-editor-mobile-menu { display: none; }

@media (max-width: 680px) {
  .site-header.photo-editor-site-header { padding-bottom: 0; }
  .photo-editor-site-header .header-inner {
    min-height: 62px; height: auto; flex-wrap: nowrap; gap: 8px; padding: 8px 14px;
  }
  .photo-editor-site-header .brand { gap: 6px; font-size: 23px; }
  .photo-editor-site-header .brand small { margin-left: 1px; }
  .photo-editor-site-header .brand-mark { font-size: 26px; }
  .photo-editor-site-header .header-right { gap: 8px; }
  .photo-editor-site-header .header-inner > .nav,
  .photo-editor-site-header .user-btn,
  .photo-editor-site-header .header-right > .guest-bonus { display: none; }
  .photo-editor-site-header .balance-btn, .photo-editor-site-header .header-login { min-height: 44px; }
  .photo-editor-mobile-menu { display: block; }
  .photo-editor-mobile-menu summary {
    display: grid; place-items: center; width: 44px; height: 44px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
    cursor: pointer; list-style: none;
  }
  .photo-editor-mobile-menu summary::-webkit-details-marker { display: none; }
  .photo-editor-menu-links {
    position: absolute; top: calc(100% + 6px); right: 14px;
    display: grid; min-width: 190px; max-width: calc(100% - 28px); padding: 5px;
    border: 1px solid var(--line); border-radius: 13px; background: var(--panel);
    box-shadow: 0 12px 30px #0008;
  }
  .photo-editor-menu-links a, .photo-editor-menu-links button {
    display: flex; align-items: center; gap: 9px; min-height: 44px;
    padding: 6px 10px; border-radius: 8px; color: var(--text); text-align: left;
  }
  .photo-editor-menu-links .active, .photo-editor-menu-links button { color: var(--pink2); }
  .photo-editor-menu-links .active, .photo-editor-menu-links a:hover { background: var(--panel2); }
  .photo-editor-menu-links .count { margin-left: auto; }

  .photo-editor { padding: 12px 14px 24px; }
  .photo-editor-toolbar { position: static; padding: 4px 0 11px; }
  .photo-editor-title-row h1 { font-size: clamp(22px, 6vw, 26px); }
  .photo-editor-apply { width: 100%; min-height: 49px; padding: 8px 10px; font-size: 15px; }
  .photo-editor-apply:disabled { background: #5d4151; color: #f0d3e0; }
  .photo-editor-apply-price { font-size: 12px; }
  .photo-editor-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .photo-editor-panel { padding-inline: 11px; }
  .photo-editor-source { padding: 0; border: 0; background: transparent; }
  .photo-editor-upload { border-radius: 16px; }
  .photo-editor-upload:not(.has-preview) {
    min-height: 154px; flex-direction: column; justify-content: center; gap: 8px;
    padding: 14px; text-align: center;
    background: radial-gradient(ellipse at top, var(--editor-tint), var(--editor-well) 82%);
  }
  .photo-editor-upload:not(.has-preview) .photo-editor-mark { width: 49px; height: 49px; border-radius: 14px; }
  .photo-editor-upload small { font-size: 12px; }
  .photo-editor-examples-link {
    display: inline-flex; align-items: center; gap: 7px; min-height: 44px;
    justify-self: center; padding: 0 5px; color: var(--pink2); font-size: 13px;
  }
  .photo-editor-examples-link .icon { width: 16px; height: 16px; }
  .photo-editor-compact-settings h2 { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
  .photo-editor-compact-rows { padding: 0; border-color: var(--editor-border); border-radius: 16px; }
  .photo-editor-compact-row {
    display: grid; grid-template-columns: 18px minmax(0, 1fr) minmax(0, 1.2fr) 10px;
    align-items: center; gap: 8px; width: 100%; min-height: 52px;
    padding: 8px 10px; text-align: left; font-size: 14px;
  }
  .photo-editor-compact-row + .photo-editor-compact-row { border-top: 1px solid var(--editor-border); }
  .photo-editor-compact-row .icon { width: 17px; height: 17px; color: var(--pink2); }
  .photo-editor-compact-row strong { font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
  .photo-editor-compact-row span { text-align: right; color: var(--pink2); font-size: 12px; overflow-wrap: anywhere; }
  .photo-editor-compact-row::after {
    content: ''; width: 6px; height: 6px; border: solid var(--editor-hint); border-width: 0 1.5px 1.5px 0;
    transform: rotate(-45deg);
  }
  .photo-editor-rules-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; }
  .photo-editor-result-column { display: contents; }
  .photo-editor-result:not(.has-output) { display: none; }
  .photo-editor-examples { margin-top: 21px; }

  .photo-editor-mobile-action {
    position: fixed; z-index: 19; inset: auto 0 0; display: grid; gap: 5px;
    padding: 9px max(14px, env(safe-area-inset-right)) calc(9px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    background: var(--bg); border-top: 1px solid var(--editor-border);
  }
  .photo-editor-mobile-action .photo-editor-status { margin: 0; font-size: 12px; text-align: center; }
  .photo-editor-mobile-action .photo-editor-apply:hover { transform: none; }
  body:has(.photo-editor-mobile-action) #footer { padding-bottom: calc(94px + env(safe-area-inset-bottom)); }
  html:has(.photo-editor-site-header) { scroll-padding-top: 73px; }
  html:has(.photo-editor-sheet[open]) { overflow: hidden; }
  .photo-editor-sheet {
    position: fixed; inset: auto 0 0; margin: 0 auto; padding: 0; width: 100%; max-width: 540px;
    max-height: min(76dvh, 620px); overflow: hidden;
    border-color: var(--editor-border); border-radius: 20px 20px 0 0; color: var(--text);
  }
  .photo-editor-sheet[open] { display: flex; flex-direction: column; }
  .photo-editor-sheet::backdrop { background: #08070bb5; }
  .photo-editor-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px 5px; }
  .photo-editor-sheet-head h2 { margin: 0; font-size: 20px; font-weight: 720; }
  .photo-editor-sheet-head .icon-button { width: 44px; height: 44px; }
  .photo-editor-sheet-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 0 14px calc(14px + env(safe-area-inset-bottom)); }
  .photo-editor-sheet .photo-editor-search { position: sticky; z-index: 1; top: 0; padding: 4px 0 7px; margin: 0 0 4px; background: var(--panel); }
  .photo-editor-sheet .photo-editor-search input { font-size: 16px; min-height: 44px; }
  .photo-editor-sheet .photo-editor-search .icon { top: 17px; }
  .photo-editor-sheet .photo-editor-presets { max-height: none; overflow: visible; padding: 1px; scrollbar-gutter: auto; }
  .photo-editor-sheet .photo-editor-presets .photo-editor-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-editor-sheet .photo-editor-options .chip { min-height: 44px; white-space: normal; line-height: 1.3; font-size: 13px; }
  .photo-editor-sheet .photo-editor-option-group h3 { margin: 0; color: var(--editor-muted); font-size: 14px; font-weight: 550; }
  .photo-preset-list { grid-template-columns: 1fr; }
  .photo-rules-page { padding-top: 18px; padding-bottom: 28px; }
}

@media (max-width: 510px) {
  .photo-example-gallery { grid-template-columns: minmax(0, 1fr); }
  .photo-example-handle { width: 42px; height: 42px; }
}

@media (pointer: coarse) {
  .photo-editor-presets .chip, .photo-editor-modes button { min-height: 44px; }
  .photo-editor-search input { min-height: 44px; font-size: 16px; }
}
