:root {
  --black: #111111;
  --black-2: #191919;
  --graphite: #666666;
  --muted: #6f6f6b;
  --off-white: #f7f7f5;
  --white: #ffffff;
  --soft-grey: #e7e7e4;
  --soft-grey-2: #d7d7d2;
  --orange: #c9430f;
  --orange-dark: #a93209;
  --orange-bright: #ff6a2d;
  --panel-width: 292px;
  --adjust-width: 318px;
  --topbar-height: 68px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--off-white);
  color: var(--black);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, canvas:focus-visible { outline: 3px solid var(--black); outline-offset: 2px; box-shadow: 0 0 0 5px var(--white); }

svg {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--soft-grey);
  background: color-mix(in srgb, var(--off-white) 92%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  color: var(--black);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--black);
  color: var(--orange-bright);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -.04em;
}

.brand-word { font-size: 18px; font-weight: 900; letter-spacing: -.04em; }
.brand-product { padding-left: 10px; border-left: 1px solid var(--soft-grey-2); color: var(--graphite); font-size: 14px; }

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--soft-grey);
  border-radius: 999px;
  background: var(--white);
  color: var(--graphite);
  font-size: 13px;
  font-weight: 600;
}

.privacy-pill svg { color: #427f55; }
.top-actions { justify-self: end; display: flex; gap: 8px; }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  transition: transform .18s ease, background .18s ease, color .18s ease, opacity .18s ease;
}

.button:active { transform: translateY(1px) scale(.99); }
.button-primary { background: var(--orange); color: #fff; box-shadow: 0 8px 22px rgba(255, 90, 31, .2); }
.button-primary:hover { background: var(--orange-dark); }
.button-ghost { background: var(--white); border: 1px solid var(--soft-grey); }
.button-ghost:hover { border-color: var(--soft-grey-2); background: #fcfcfb; }
.button-light { background: #fff; color: var(--black); min-width: 150px; }

.editor-shell {
  min-height: calc(100vh - var(--topbar-height) - 42px);
  display: grid;
  grid-template-columns: var(--panel-width) minmax(360px, 1fr) var(--adjust-width);
  grid-template-areas: "presets workspace adjust";
  gap: 0;
}

.panel {
  min-width: 0;
  padding: 22px 18px;
  background: var(--white);
}

.presets-panel { grid-area: presets; border-right: 1px solid var(--soft-grey); }
.adjust-panel { grid-area: adjust; border-left: 1px solid var(--soft-grey); overflow-y: auto; max-height: calc(100vh - var(--topbar-height)); }

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading h1, .panel-heading h2 { margin: 1px 0 0; font-size: 24px; line-height: 1.1; letter-spacing: -.04em; }
.eyebrow { margin: 0; color: var(--orange); font-size: 11px; font-weight: 850; letter-spacing: .13em; }
.count-badge { padding: 5px 8px; border-radius: 999px; background: var(--off-white); color: var(--graphite); font-size: 12px; font-weight: 700; }

.category-strip {
  display: flex;
  gap: 6px;
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-strip::-webkit-scrollbar { display: none; }

.preset-search {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid var(--soft-grey);
  border-radius: 12px;
  background: var(--off-white);
  color: var(--muted);
}
.preset-search:focus-within { border-color: color-mix(in srgb, var(--orange) 55%, var(--soft-grey)); background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 10%, transparent); }
.preset-search svg { flex: 0 0 auto; width: 17px; height: 17px; }
.preset-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--black); font-size: 13px; }
.preset-search input::placeholder { color: var(--muted); }

.category-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--soft-grey);
  border-radius: 999px;
  background: var(--white);
  color: var(--graphite);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}
.category-button.is-active { border-color: var(--black); background: var(--black); color: #fff; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: calc(100vh - 342px);
  padding: 2px 2px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.preset-carousel-bar { display: none; }
.preset-arrow { cursor: pointer; }

.preset-tile { position: relative; min-width: 0; }

.preset-card {
  position: relative;
  width: 100%;
  min-width: 0;
  border: 2px solid transparent;
  border-radius: 13px;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.preset-card canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  background: linear-gradient(135deg, #d5d5d0, #f1f1ed);
  object-fit: cover;
}

.preset-card span { display: block; padding: 6px 2px 2px; overflow: hidden; color: var(--graphite); font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.preset-card:hover canvas { filter: brightness(1.03); }
.preset-card.is-active { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 8%, transparent); }
.preset-card.is-active span { padding-inline: 5px; color: var(--black); }
.preset-card.is-active::after { content: ""; position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border: 2px solid white; border-radius: 50%; background: var(--orange); box-shadow: 0 1px 5px rgba(0,0,0,.25); }

.preset-favorite {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 9px;
  background: rgba(17,17,17,.58);
  color: rgba(255,255,255,.76);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.preset-favorite svg { width: 15px; height: 15px; }
.preset-favorite.is-active { background: var(--orange); color: #fff; }
.preset-favorite.is-active svg { fill: currentColor; }
.preset-empty { margin: 22px 0; color: var(--muted); text-align: center; font-size: 13px; }

.intensity-card {
  margin-top: 2px;
  padding: 15px;
  border: 1px solid var(--soft-grey);
  border-radius: 14px;
  background: var(--off-white);
}

.control-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.control-label-row label { font-size: 13px; font-weight: 750; }
.control-label-row output { color: var(--orange); font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 800; }
.range-ends { display: flex; justify-content: space-between; margin-top: 2px; color: var(--muted); font-size: 10px; }

.range {
  width: 100%;
  height: 28px;
  margin: 5px 0 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(to right, var(--orange) 0 var(--range-fill, 50%), var(--soft-grey) var(--range-fill, 50%) 100%); }
.range::-moz-range-track { height: 4px; border-radius: 999px; background: var(--soft-grey); }
.range::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--orange); }
.range::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -7px; appearance: none; border: 3px solid #fff; border-radius: 50%; background: var(--orange); box-shadow: 0 1px 5px rgba(0,0,0,.26); }
.range::-moz-range-thumb { width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; background: var(--orange); box-shadow: 0 1px 5px rgba(0,0,0,.26); }

.workspace {
  grid-area: workspace;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(480px, 1fr) auto;
  padding: 16px;
  background: var(--off-white);
}

.stage {
  position: relative;
  min-height: 480px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 18px;
  overflow: hidden;
  border-radius: 22px;
  background: #151515;
  isolation: isolate;
}

.stage-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .42;
  background-image:
    linear-gradient(rgba(255,255,255,.027) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.027) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, rgba(255,90,31,.09), transparent 43%);
  background-size: 28px 28px, 28px 28px, 100% 100%;
  transition: opacity .22s ease;
}

body.has-image .stage-grid { opacity: 0; }

.empty-state {
  width: min(470px, calc(100% - 36px));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 26px;
  border: 1px dashed rgba(255,255,255,.22);
  border-radius: 22px;
  color: #fff;
  text-align: center;
}

.upload-orb {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  background: var(--orange);
  color: white;
  cursor: pointer;
  box-shadow: 0 16px 44px rgba(255, 90, 31, .27);
  transition: transform .2s ease;
}
.upload-orb:hover { transform: translateY(-2px) rotate(-2deg); }
.upload-orb svg { width: 30px; height: 30px; stroke-width: 1.6; }
.empty-kicker { margin: 0 0 8px; color: var(--orange-bright); font-size: 11px; font-weight: 850; letter-spacing: .14em; }
.empty-state h2 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1; letter-spacing: -.05em; }
.empty-state > p:not(.empty-kicker) { margin: 14px 0 20px; color: rgba(255,255,255,.63); font-size: 14px; }
.empty-privacy { margin-top: 16px; color: rgba(255,255,255,.4); font-size: 12px; }

#photoCanvas {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  display: block;
  margin: auto;
  box-shadow: 0 22px 70px rgba(0,0,0,.42);
  transform-origin: center;
  transition: transform .2s ease;
}
body.is-designing #photoCanvas { touch-action: none; cursor: grab; }
body.is-designing #photoCanvas.is-dragging { cursor: grabbing; }
body.is-masking #photoCanvas { touch-action: none; cursor: crosshair; }
body.is-masking #photoCanvas.is-mask-dragging { cursor: grabbing; }

.canvas-tools {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  gap: 7px;
}

.stage-button {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(16,16,16,.76);
  color: rgba(255,255,255,.86);
  backdrop-filter: blur(10px);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}
.stage-button:hover, .stage-button.is-active { background: rgba(255,90,31,.9); color: #fff; }

.processing-indicator {
  position: absolute;
  top: 14px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17,17,17,.78);
  color: #fff;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
  font-size: 12px;
  font-weight: 700;
}
.spinner { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.25); border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.drop-overlay {
  position: absolute;
  inset: 10px;
  z-index: 20;
  place-items: center;
  border: 2px dashed var(--orange);
  border-radius: 18px;
  background: rgba(17,17,17,.88);
  color: #fff;
  backdrop-filter: blur(8px);
}
.drop-overlay:not([hidden]) { display: grid; }
.drop-overlay div { display: grid; place-items: center; gap: 10px; }
.drop-overlay span { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; background: var(--orange); font-size: 34px; font-weight: 300; }

.workspace-footer { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 8px 3px 0; color: var(--muted); font-size: 12px; }
.workspace-footer p { margin: 0; color: var(--black); font-weight: 750; }
.file-info { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.adjust-heading { align-items: center; }
.history-actions { display: flex; gap: 5px; }
.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--soft-grey);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
}
.icon-button:hover:not(:disabled) { border-color: var(--soft-grey-2); background: var(--off-white); }
.icon-button:disabled { opacity: .35; cursor: not-allowed; }

.tool-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin: -3px 0 14px;
  padding: 4px;
  border-radius: 12px;
  background: var(--off-white);
}
.tool-tab { min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--graphite); cursor: pointer; font-size: 12px; font-weight: 800; }
.tool-tab.is-active { background: var(--white); color: var(--black); box-shadow: 0 2px 9px rgba(0,0,0,.08); }
.tool-view[hidden] { display: none !important; }

.auto-enhance-button {
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--orange) 35%, var(--soft-grey));
  border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--orange) 7%, white), #fff);
  cursor: pointer;
  text-align: left;
}
.auto-enhance-button > svg { flex: 0 0 auto; width: 25px; height: 25px; color: var(--orange); }
.auto-enhance-button span { display: flex; flex-direction: column; }
.auto-enhance-button strong { font-size: 13px; }
.auto-enhance-button small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.auto-enhance-button:hover { border-color: var(--orange); }

.adjustment-group { padding: 16px 0; border-top: 1px solid var(--soft-grey); }
.adjustment-group h3 { margin: 0 0 12px; color: var(--graphite); font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.adjustment-row { margin-bottom: 13px; }
.adjustment-row:last-child { margin-bottom: 0; }
.adjustment-row .range { margin-top: 1px; }
.adjustment-row output { min-width: 38px; padding: 2px 6px; border-radius: 6px; background: var(--off-white); color: var(--graphite); text-align: right; }
.adjustment-row.is-changed output { background: color-mix(in srgb, var(--orange) 11%, white); color: var(--orange-dark); }

.reset-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  border: 1px solid var(--soft-grey);
  border-radius: 12px;
  background: var(--off-white);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}
.reset-button:hover { background: #efefec; }
.section-reset { margin-top: 12px; }

.tool-section { padding: 15px 0; border-top: 1px solid var(--soft-grey); }
.tool-section:first-child { border-top: 0; padding-top: 2px; }
.tool-section > h3 { margin: 0 0 12px; color: var(--graphite); font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.aspect-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.aspect-button { min-height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--soft-grey); border-radius: 11px; background: #fff; color: var(--graphite); cursor: pointer; font-size: 11px; font-weight: 750; }
.aspect-button.is-active { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 6%, white); color: var(--black); box-shadow: inset 0 0 0 1px var(--orange); }
.aspect-icon { display: block; border: 1.5px solid currentColor; border-radius: 2px; }
.aspect-icon.landscape { width: 24px; height: 17px; }
.aspect-icon.square { width: 19px; height: 19px; }
.aspect-icon.portrait { width: 16px; height: 20px; }
.aspect-icon.portrait-tall { width: 15px; height: 21px; }
.aspect-icon.story { width: 11px; height: 21px; }
.aspect-icon.wide { width: 25px; height: 14px; }
.crop-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 12px 0 4px; }
.transform-button { min-width: 0; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; border: 1px solid var(--soft-grey); border-radius: 11px; background: var(--white); color: var(--graphite); cursor: pointer; font-size: 10px; font-weight: 750; }
.transform-button:hover, .transform-button.is-active { border-color: var(--orange); color: var(--orange-dark); }
.transform-button svg { width: 20px; height: 20px; }
.crop-sliders { margin-top: 12px; }

.section-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading-row h3 { margin: 1px 0 0; font-size: 20px; letter-spacing: -.03em; }
.text-button { border: 0; background: transparent; color: var(--orange-dark); cursor: pointer; font-size: 12px; font-weight: 800; }
.color-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 8px; margin-bottom: 18px; }
.color-chip { width: 42px; height: 42px; justify-self: center; padding: 0; border: 3px solid #fff; border-radius: 50%; background: var(--chip-color); box-shadow: 0 0 0 1px var(--soft-grey-2); cursor: pointer; }
.color-chip.is-active { box-shadow: 0 0 0 2px var(--black); transform: scale(.92); }
.hue-range::-webkit-slider-runnable-track { background: linear-gradient(to right, #ff3b30, #ffcc00, #34c759, #00c7be, #007aff, #5856d6, #af52de, #ff2d55, #ff3b30); }

.mask-view { padding-bottom: 6px; }
.mask-add-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 2px 0 10px; }
.mask-type-button {
  min-width: 0;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border: 1px solid var(--soft-grey);
  border-radius: 12px;
  background: #fff;
  color: var(--graphite);
  cursor: pointer;
  text-align: center;
}
.mask-type-button:hover { border-color: var(--orange); color: var(--orange-dark); }
.mask-type-button:disabled { opacity: .42; cursor: not-allowed; }
.mask-type-button > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.mask-type-button strong { color: var(--black); font-size: 11px; }
.mask-type-button small { margin-top: 1px; font-size: 10px; white-space: nowrap; }
.mask-type-icon { position: relative; width: 27px; height: 21px; display: block; color: var(--orange); }
.mask-icon-radial { border: 2px solid currentColor; border-radius: 50%; box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--orange) 14%, transparent); }
.mask-icon-linear { border-radius: 4px; background: linear-gradient(135deg, color-mix(in srgb, var(--orange) 8%, transparent) 18%, currentColor 49%, currentColor 53%, color-mix(in srgb, var(--orange) 38%, transparent) 54%, transparent 82%); }
.mask-icon-brush::before { content: ""; position: absolute; left: 3px; top: 2px; width: 8px; height: 18px; border-radius: 8px 8px 3px 3px; background: currentColor; transform: rotate(38deg); }
.mask-icon-brush::after { content: ""; position: absolute; right: 2px; bottom: 1px; width: 9px; height: 7px; border-bottom: 2px solid currentColor; border-radius: 50%; transform: rotate(-12deg); }
.mask-status-row { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; color: var(--muted); font-size: 11px; }
.overlay-toggle { min-height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid var(--soft-grey); border-radius: 999px; background: #fff; color: var(--graphite); cursor: pointer; font-size: 10px; font-weight: 800; }
.overlay-toggle.is-active { border-color: color-mix(in srgb, #ff3b30 45%, var(--soft-grey)); color: var(--black); }
.overlay-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff3b30; opacity: .25; }
.overlay-toggle.is-active .overlay-dot { opacity: 1; box-shadow: 0 0 0 3px rgba(255,59,48,.12); }
#maskLayerList { max-height: 184px; padding-right: 2px; overflow-y: auto; overscroll-behavior: contain; }
.mask-inspector { padding-top: 15px; }
.toggle-row { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--soft-grey); border-radius: 11px; background: #fff; cursor: pointer; text-align: left; }
.toggle-row > span:first-child { display: flex; flex-direction: column; }
.toggle-row strong { font-size: 12px; }
.toggle-row small { color: var(--muted); font-size: 10px; }
.switch-track { width: 34px; height: 20px; flex: 0 0 auto; padding: 2px; border-radius: 999px; background: var(--soft-grey-2); transition: background .18s ease; }
.switch-track span { width: 16px; height: 16px; display: block; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.22); transition: transform .18s ease; }
.toggle-row.is-active .switch-track { background: var(--orange); }
.toggle-row.is-active .switch-track span { transform: translateX(14px); }
.brush-mode { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin-bottom: 14px; padding: 4px; border-radius: 11px; background: var(--off-white); }
.brush-mode-button { min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--graphite); cursor: pointer; font-size: 12px; font-weight: 800; }
.brush-mode-button.is-active { background: #fff; color: var(--orange-dark); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.mask-adjustments-section { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--soft-grey); }
.mask-control-group { border-top: 1px solid var(--soft-grey); }
.mask-control-group:first-child { border-top: 0; }
.mask-control-group summary { position: relative; padding: 11px 20px 11px 1px; color: var(--graphite); cursor: pointer; list-style: none; font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.mask-control-group summary::-webkit-details-marker { display: none; }
.mask-control-group summary::after { content: "+"; position: absolute; right: 3px; top: 50%; color: var(--orange-dark); transform: translateY(-50%); font-size: 17px; line-height: 1; }
.mask-control-group[open] summary::after { content: "−"; }
.mask-control-group .adjustment-row { padding-inline: 1px; }
.clear-brush-button { width: 100%; margin-top: 4px; }

.design-view { padding-bottom: 6px; }
.design-add-row { margin: 2px 0 14px; }
.add-layer-button {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: 1px solid color-mix(in srgb, var(--orange) 35%, var(--soft-grey));
  border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--orange) 8%, white), #fff);
  cursor: pointer;
  text-align: left;
}
.add-layer-button:hover { border-color: var(--orange); }
.add-layer-button > span:last-child { display: flex; flex-direction: column; }
.add-layer-button strong { font-size: 13px; }
.add-layer-button small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.add-layer-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--black);
  color: #fff;
  font: 800 20px/1 Georgia, serif;
}
.compact-heading { align-items: center; margin-bottom: 10px; }
.compact-heading h3 { font-size: 18px; }
.shape-section { padding-top: 12px; }
.shape-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.shape-button {
  min-width: 0;
  min-height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 3px;
  border: 1px solid var(--soft-grey);
  border-radius: 11px;
  background: #fff;
  color: var(--graphite);
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
}
.shape-button:hover { border-color: var(--orange); color: var(--orange-dark); }
.shape-swatch { width: 24px; height: 18px; display: grid; place-items: center; color: var(--black); }
.shape-rectangle { background: currentColor; }
.shape-rounded { border-radius: 6px; background: currentColor; }
.shape-circle { width: 20px; height: 20px; border-radius: 50%; background: currentColor; }
.shape-triangle { width: 0; height: 0; border-right: 11px solid transparent; border-bottom: 20px solid currentColor; border-left: 11px solid transparent; }
.shape-line { height: 3px; margin-block: 7px; background: currentColor; transform: rotate(-8deg); }
.shape-arrow, .shape-symbol { font-size: 25px; font-weight: 850; line-height: 1; }
.layer-count { min-width: 24px; padding: 2px 7px; border-radius: 999px; background: var(--off-white); color: var(--graphite); font-size: 11px; font-weight: 800; text-align: center; }
.layer-list { display: grid; gap: 6px; }
.layer-empty { margin: 0; padding: 13px; border: 1px dashed var(--soft-grey-2); border-radius: 11px; color: var(--muted); font-size: 12px; text-align: center; }
.layer-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 5px; border: 1px solid var(--soft-grey); border-radius: 11px; background: #fff; }
.layer-item.is-active { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.layer-select { min-width: 0; display: flex; align-items: center; gap: 9px; padding: 5px 7px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; text-align: left; }
.layer-select:hover { background: var(--off-white); }
.layer-kind { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: var(--off-white); color: var(--orange-dark); font-size: 13px; font-weight: 900; }
.layer-copy { min-width: 0; display: flex; flex-direction: column; }
.layer-copy strong, .layer-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-copy strong { font-size: 12px; }
.layer-copy small { color: var(--muted); font-size: 10px; }
.layer-actions { display: flex; align-items: center; gap: 2px; }
.layer-action, .mini-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--graphite);
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
}
.layer-action:hover, .mini-button:hover { background: var(--off-white); color: var(--black); }
.layer-action[aria-pressed="false"] { opacity: .48; }
.mini-actions { display: flex; gap: 3px; }
.mini-button { border: 1px solid var(--soft-grey); background: #fff; }
.mini-button-danger:hover { color: #a1261c; }
.mini-button:disabled, .secondary-button:disabled { opacity: .38; cursor: not-allowed; }
.overlay-inspector { padding-top: 15px; }
.field-label, .field-stack > span { display: block; margin-bottom: 5px; color: var(--graphite); font-size: 11px; font-weight: 800; }
.design-textarea, .field-stack select {
  width: 100%;
  border: 1px solid var(--soft-grey-2);
  border-radius: 10px;
  background: #fff;
  color: var(--black);
}
.design-textarea { min-height: 76px; resize: vertical; margin-bottom: 11px; padding: 10px; line-height: 1.4; }
.field-stack select { height: 42px; padding: 0 9px; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, .85fr); gap: 8px; margin-bottom: 13px; }
.color-field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.color-input { width: 100%; height: 42px; padding: 4px; border: 1px solid var(--soft-grey-2); border-radius: 10px; background: #fff; cursor: pointer; }
.alignment-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 2px 0 14px; padding: 4px; border-radius: 11px; background: var(--off-white); }
.alignment-button { min-height: 36px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 22px; line-height: 1; }
.alignment-button:first-child { text-align: left; }
.alignment-button:last-child { text-align: right; }
.alignment-button.is-active { background: #fff; color: var(--orange-dark); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.common-inspector { padding-top: 13px; border-top: 1px solid var(--soft-grey); }
.position-details { margin-top: 8px; border: 1px solid var(--soft-grey); border-radius: 11px; background: #fff; }
.position-details summary { padding: 10px 12px; cursor: pointer; color: var(--graphite); font-size: 12px; font-weight: 800; }
.position-details[open] summary { border-bottom: 1px solid var(--soft-grey); }
.position-details .adjustment-row { padding: 10px 12px 0; }
.order-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; padding: 4px 12px 12px; }
.secondary-button { min-height: 38px; padding: 5px 8px; border: 1px solid var(--soft-grey); border-radius: 9px; background: var(--off-white); cursor: pointer; font-size: 10px; font-weight: 800; }
.secondary-button:hover { border-color: var(--soft-grey-2); background: #efefec; }
.design-note { margin: 12px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.requires-image { transition: opacity .2s ease; }
body:not(.has-image) .requires-image { opacity: .42; pointer-events: none; user-select: none; }
body.has-image .empty-state { display: none; }

.mobile-dock { display: none; }
.site-footer { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 13px; padding: 10px 18px; border-top: 1px solid var(--soft-grey); color: var(--graphite); font-size: 12px; }
.site-footer a { color: var(--graphite); text-decoration: none; }
.site-footer a:hover { color: var(--orange); }
.footer-divider { width: 3px; height: 3px; border-radius: 50%; background: var(--orange); }

.download-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--black);
  overflow: visible;
}
.download-dialog::backdrop { background: rgba(10,10,10,.64); backdrop-filter: blur(7px); }
.dialog-card { max-height: calc(100vh - 28px); overflow-y: auto; padding: 24px; border-radius: 22px; background: var(--white); box-shadow: 0 28px 90px rgba(0,0,0,.35); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.dialog-heading h2 { margin: 2px 0 0; font-size: 26px; letter-spacing: -.04em; }
.option-group { margin: 0 0 20px; padding: 0; border: 0; }
.option-group legend { margin-bottom: 9px; font-size: 13px; font-weight: 800; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 12px; background: var(--off-white); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { min-height: 38px; display: grid; place-items: center; border-radius: 9px; color: var(--graphite); font-size: 13px; font-weight: 750; }
.segmented input:checked + span { background: var(--white); color: var(--black); box-shadow: 0 2px 9px rgba(0,0,0,.08); }
.segmented input:focus-visible + span, .radio-card input:focus-visible + span { outline: 3px solid var(--black); outline-offset: 2px; box-shadow: 0 0 0 5px var(--white); }
.resolution-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.radio-card { position: relative; cursor: pointer; }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card > span { min-height: 72px; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 11px; border: 1px solid var(--soft-grey); border-radius: 12px; }
.radio-card strong { font-size: 13px; }
.radio-card small { color: var(--muted); font-size: 10px; line-height: 1.3; }
.radio-card input:checked + span { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 6%, white); box-shadow: inset 0 0 0 1px var(--orange); }
.quality-control { margin-bottom: 15px; }
.export-note { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.dialog-download { width: 100%; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--black);
  color: #fff;
  box-shadow: 0 12px 36px rgba(0,0,0,.28);
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 650;
}

@media (max-width: 1120px) {
  :root { --panel-width: 244px; --adjust-width: 286px; }
  .preset-grid { grid-template-columns: 1fr; }
  .privacy-pill span { display: none; }
  .tool-tab { font-size: 10.5px; }
}

@media (max-width: 900px) {
  :root { --topbar-height: 62px; }
  body.has-image { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .topbar { grid-template-columns: 1fr auto; padding: 9px 12px; }
  .brand-product, .privacy-pill, .top-actions .button-primary { display: none; }
  .top-actions .button { min-height: 40px; padding: 0 12px; }
  .editor-shell { min-height: 0; display: block; }
  .workspace { grid-template-rows: auto auto; padding: 10px; }
  .stage { min-height: 0; height: clamp(240px, 50vh, 520px); height: clamp(240px, 50dvh, 520px); padding: 10px; border-radius: 17px; transition: height .26s cubic-bezier(.22,.61,.36,1); }
  body.has-image.mobile-tray-open .stage { height: clamp(260px, 58vh, 620px); height: clamp(260px, 58dvh, 620px); }
  body.has-image:not(.mobile-tray-open) .stage { height: clamp(240px, calc(100vh - var(--topbar-height) - 118px - env(safe-area-inset-bottom)), 760px); height: clamp(240px, calc(100dvh - var(--topbar-height) - 118px - env(safe-area-inset-bottom)), 760px); }
  body.has-image .workspace { position: sticky; top: var(--topbar-height); z-index: 20; background: var(--off-white); box-shadow: 0 12px 28px rgba(17,17,17,.09); }
  .canvas-tools { display: flex; }
  .canvas-tools #fitButton { display: none; }
  .canvas-tools .compare-button { width: 42px; padding: 0; justify-content: center; }
  .canvas-tools .compare-button span { display: none; }
  .workspace-footer { padding-inline: 3px; }
  .panel { display: none; width: auto; padding: 16px 14px 22px; border: 0; border-top: 1px solid var(--soft-grey); }
  .panel.mobile-active { display: block; }
  body:not(.has-image) .panel, body:not(.has-image) .mobile-dock { display: none; }
  .preset-carousel-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 2px 0 9px; color: var(--muted); font-size: 11px; font-weight: 700; }
  .preset-carousel-bar > div { display: flex; gap: 6px; }
  .preset-arrow { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 1px solid var(--soft-grey); border-radius: 11px; background: var(--white); color: var(--black); font-size: 18px; }
  .preset-arrow:disabled { opacity: .3; cursor: default; }
  .preset-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: clamp(126px, 34vw, 180px); gap: 10px; max-height: none; padding: 2px 34px 12px 2px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; scroll-behavior: smooth; scroll-padding-inline: 2px; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .preset-grid::-webkit-scrollbar { display: none; }
  .preset-tile { scroll-snap-align: start; scroll-snap-stop: normal; }
  .intensity-card { margin-top: 8px; }
  .adjust-panel { max-height: none; overflow: visible; }
  .mobile-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; min-height: 66px; display: grid; grid-template-columns: repeat(5, 1fr); padding: 5px max(7px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left)); border-top: 1px solid var(--soft-grey); background: rgba(255,255,255,.95); backdrop-filter: blur(18px); }
  .dock-button { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: 10px; background: transparent; color: var(--graphite); cursor: pointer; font-size: 11px; font-weight: 700; }
  .dock-button svg { font-size: 19px; }
  .dock-button.is-active { background: color-mix(in srgb, var(--orange) 9%, transparent); color: var(--orange); }
  .dock-download { background: var(--black); color: #fff; }
  .tool-tab, .overlay-toggle, .brush-mode-button, .secondary-button { min-height: 44px; }
  .layer-action, .mini-button { width: 44px; height: 44px; }
  .range { height: 44px; }
  .range::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -10px; }
  .range::-moz-range-thumb { width: 18px; height: 18px; }
  .site-footer { display: none; }
  .toast { bottom: 82px; }
}

@media (max-width: 540px) {
  .brand-word { font-size: 17px; }
  .top-actions .button span { display: none; }
  .top-actions .button { width: 40px; padding: 0; }
  .workspace { padding: 7px; }
  body:not(.has-image) .stage { min-height: 0; height: clamp(240px, 50vh, 520px); height: clamp(240px, 50dvh, 520px); }
  .empty-state { padding: 26px 16px; border: 0; }
  .upload-orb { width: 60px; height: 60px; margin-bottom: 16px; border-radius: 18px; }
  .empty-state h2 { font-size: 30px; }
  .empty-state > p:not(.empty-kicker) { max-width: 270px; margin-block: 10px 16px; }
  .preset-grid { grid-template-columns: none; grid-auto-columns: clamp(122px, 38vw, 152px); gap: 10px; }
  .preset-card span { font-size: 11px; }
  .panel-heading { margin-bottom: 14px; }
  .workspace-footer { min-height: 32px; justify-content: flex-end; padding-top: 5px; }
  .workspace-footer .file-info { display: none; }
  .resolution-options { grid-template-columns: 1fr; }
  .radio-card > span { min-height: 58px; }
  .dialog-card { padding: 20px 16px; }
}

@media (max-width: 900px) and (max-height: 520px) {
  .workspace { padding-block: 5px; }
  body.has-image.mobile-tray-open .stage { height: clamp(160px, 42vh, 260px); height: clamp(160px, 42dvh, 260px); }
  body.has-image:not(.mobile-tray-open) .stage { height: clamp(180px, calc(100vh - var(--topbar-height) - 104px - env(safe-area-inset-bottom)), 340px); height: clamp(180px, calc(100dvh - var(--topbar-height) - 104px - env(safe-area-inset-bottom)), 340px); }
  .workspace-footer { min-height: 24px; padding-top: 3px; }
}

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