body:has(.editor-main) {
  --studio-ink: #182231;
  --studio-muted: #4b596d;
  --studio-line: #dbe2eb;
  --studio-blue: #2453cf;
  background: #f4f6fa;
  color: var(--studio-ink);
}

.editor-site-nav {
  height: 64px;
  max-width: 1320px;
  border-color: var(--studio-line);
  padding-inline: clamp(16px, 3vw, 34px);
}

.editor-site-nav .billing-nav { color: #2c3b52; }
.editor-main {
  max-width: 1320px;
  margin-inline: auto;
  padding-inline: clamp(14px, 3vw, 34px);
}
.editor-main .editor-area { margin-block-start: clamp(20px, 4vw, 42px); }
.studio-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin-block-end: 18px;
}
.editor-main #editor-title {
  font-size: clamp(31px, 5vw, 46px);
  line-height: 1.1;
  letter-spacing: -.05em;
  color: var(--studio-ink);
}
html[lang=ta] .editor-main #editor-title { letter-spacing: normal; }
#studio-project {
  color: var(--studio-muted);
  font-size: 14px;
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}
.studio-heading .header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: auto;
  margin: 0;
}
.editor-main #save-status { display: inline; color: var(--studio-muted); font-size: 12px; margin: 0 6px 0 0; }
.studio-heading .header-actions button { flex: 0 0 auto; }
.editor-main button, .editor-main input, .editor-main select, .editor-main textarea { font-size: 14px; }
.editor-main .primary, .editor-main .outline, .editor-main .quiet {
  min-height: 42px;
  border-radius: 9px;
  padding: 9px 12px;
  line-height: 1.25;
  font-weight: 650;
}
.editor-main .primary { background: var(--studio-blue); border-color: var(--studio-blue); color: #fff; }
.editor-main .primary:hover:not(:disabled) { background: #1b42aa; }
.editor-main .quiet { color: #35445a; border-color: #d4dce8; background: #fff; }
.editor-main button:disabled { opacity: .5; }
.editor-main :focus-visible { outline: 3px solid #2453cf; outline-offset: 3px; }

.studio-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 480px);
  padding: 4px;
  margin: 0 0 16px;
  border: 1px solid var(--studio-line);
  border-radius: 13px;
  background: #e9eef6;
}
.studio-steps a {
  display: grid;
  place-items: center;
  min-height: 43px;
  padding: 6px 4px;
  border-radius: 9px;
  color: #415168;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: center;
  text-decoration: none;
}
.studio-steps a:hover { color: var(--studio-blue); }
.studio-steps a[aria-current=step] {
  background: #fff;
  color: #183b98;
  box-shadow: 0 1px 4px #25345123;
}

.editor-main [hidden] { display: none !important; }
.editor-main .card {
  background: white;
  border: 1px solid var(--studio-line);
  border-radius: 17px;
  padding: clamp(13px, 2.6vw, 23px);
  box-shadow: 0 9px 28px #2634540b;
}
.editor-main :is(#foto, #details, #export) { scroll-margin-top: 18px; }
.editor-main .card-head h2 { color: var(--studio-ink); font-size: clamp(19px, 2.5vw, 23px); }
.editor-main .card-head :is(h2, h3) { margin: 0; }
.editor-main .studio-card-head { margin-bottom: 13px; }
.studio-card-head .tag { color: #495975; background: #eef2f8; font-size: 12px; }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 340px); gap: clamp(14px, 2vw, 24px); }
.studio-view, .studio-sidebar { min-width: 0; }
.studio-canvas { background: #182336; border-radius: 13px; padding: 10px; color: #fff; }
.photo-card:not(.has-photo) .studio-canvas { display: none; }
.editor-main .view-tabs { margin: 0 0 9px; padding: 0; border: 0; gap: 4px; background: transparent; }
.editor-main .view-tabs button {
  min-height: 37px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #d7dfec;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}
.editor-main .view-tabs .selected { background: #f1f4f9; color: #182336; box-shadow: none; }
.editor-main #photo-name { margin-inline-start: auto; color: #d7dfec; max-width: min(45%, 20ch); font-size: 11px; }
.editor-main .photo-card .stage {
  height: clamp(265px, 44vw, 540px);
  border: 0;
  border-radius: 8px;
  background-color: #e5e9f0;
}
.editor-main .stage.comparing { gap: 2px; }
.editor-main .canvas-label { font-size: 11px; color: #243044; }
.editor-main .canvas-wrap canvas { object-fit: contain; }
.editor-main .image-status { color: var(--studio-muted); font-size: 13px; margin: 10px 0 0; }
.editor-main .review {
  margin-top: 12px;
  padding: 13px;
  border: 1px solid #b7c6f0;
  border-radius: 10px;
  background: #f3f6ff;
}
.editor-main .review p { margin: 5px 0 10px; }
.editor-main .progress-wrap { margin-top: 10px; }
.editor-main .photo-toolbar { gap: 8px; margin: 10px 0; }
.editor-main .thumbs button { width: 67px; height: 61px; }
.editor-main .photo-order-actions { margin-inline-start: auto; }

.editor-main #drop {
  position: relative;
  min-height: 262px;
  padding: 23px 15px;
  border: 1px dashed #899cbc;
  border-radius: 13px;
  background: #f1f5fc;
  color: #263955;
  cursor: pointer;
}
.editor-main #drop:focus-within, .editor-main #drop.over { outline: 2px solid var(--studio-blue); outline-offset: 2px; }
.editor-main #drop > strong { font-size: 19px; color: #233958; }
.editor-main #drop > span:not(.upload-symbol), .editor-main #drop > small { color: #4d5d75; font-size: 13px; }
.editor-main .upload-symbol {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 5px;
  border-radius: 12px;
  background: #dfe8ff;
  color: #1c43ac;
  font-size: 26px;
  line-height: 1;
}
.editor-main .photo-card.has-photo #drop {
  min-height: 45px;
  padding: 7px 10px;
  justify-content: center;
}
.editor-main .photo-card.has-photo #drop .upload-symbol { width: 24px; height: 24px; margin: 0; font-size: 17px; border-radius: 5px; }
.editor-main .photo-card.has-photo #drop > strong { font-size: 13px; }

.studio-sidebar { align-self: start; }
#studio-tools {
  padding: 10px;
  border: 1px solid var(--studio-line);
  border-radius: 12px;
  background: #f7f9fc;
}
.tool-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: #e8edf5;
}
.editor-main .tool-tabs button {
  min-height: 39px;
  padding: 5px 3px;
  overflow-wrap: anywhere;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #374860;
  font-size: 12px;
  font-weight: 700;
}
.editor-main .tool-tabs button[aria-selected=true] {
  color: #1b3b89;
  background: white;
  box-shadow: 0 1px 4px #25345125;
}
.tool-panel { padding: 10px 2px 2px; }
.light-controls { display: grid; gap: 12px; }
.light-controls output { float: right; font-variant-numeric: tabular-nums; color: var(--studio-blue); }
.light-controls input { display: block; width: 100%; margin-top: 5px; }
#retouch-dialog { width: min(94vw, 720px); border: 1px solid #dbe2eb; border-radius: 15px; }
#retouch-dialog::backdrop { background: #182231a6; }
#retouch-canvas { display: block; max-width: 100%; max-height: 52vh; width: auto; height: auto; touch-action: none; cursor: crosshair; }
#retouch-apply { margin-top: 10px; }
#shape-dialog { width: min(94vw, 620px); border: 1px solid #dbe2eb; border-radius: 15px; }
#shape-dialog::backdrop { background: #182231a6; }
#shape-canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 44vh; margin-inline: auto; touch-action: none; }
.shape-sliders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
#shape-kind { width: 100%; margin-bottom: 8px; }
#shape-dialog [hidden] { display: none; }
#shape-dialog .drawing-contour { cursor: crosshair; }
#shape-undo { margin-block: 8px; }
.shape-sliders input { display: block; width: 100%; margin-top: 4px; }
.tool-hint { margin: 0 0 9px; padding: 9px; border-radius: 7px; background: #e9effa; color: #374b6d; font-size: 13px; }
.tool-panel .processing-actions { display: grid; gap: 7px; }
.editor-main .tool-panel .processing-actions, .editor-main .tool-panel .cutout-open { margin: 0 0 8px; }
.editor-main .tool-panel .quick-effects { gap: 6px; margin: 10px 0; }
.editor-main .quick-effects > span, .editor-main .quick-backgrounds > span { color: var(--studio-muted); font-weight: 650; }
.editor-main .quick-effects button { flex: 1; padding-inline: 7px; font-size: 12px; }
.photo-templates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 15px;
}
.photo-templates > strong { grid-column: 1 / -1; color: var(--studio-muted); font-size: 13px; }
.editor-main .photo-templates button {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  padding: 8px 3px;
  border: 1px solid var(--studio-line);
  border-radius: 8px;
  background: #fff;
  color: var(--studio-ink);
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 650;
}
.editor-main .photo-templates button:hover:not(:disabled) { border-color: var(--studio-blue); }
.photo-templates small { color: var(--studio-muted); }
.temshape-shape { display: block; height: 22px; border: 1px solid #a8b7d0; border-radius: 3px; }
.temshape-shape.square { aspect-ratio: 1; }
.temshape-shape.portrait { aspect-ratio: 4 / 5; background: #f1ece4; }
.temshape-shape.wide { aspect-ratio: 16 / 9; background: linear-gradient(165deg,#f6f2eb,#d8c5b2); }
.temshape-shape.food-tile { background: #e9d5bc; }
.editor-main .quick-backgrounds { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.editor-main .quick-backgrounds > span { width: 100%; }
.editor-main .quick-backgrounds .swatch { width: 31px; height: 31px; min-height: 31px; padding: 0; }
.editor-main .background-advanced, .editor-main .ai-background, .editor-main .more-tools {
  margin: 10px 0 0;
  padding: 10px;
  border: 1px solid var(--studio-line);
  border-radius: 9px;
  background: #fff;
}
.editor-main .background-advanced > summary, .editor-main .ai-background > summary, .editor-main .more-tools > summary { color: #2c3e58; font-size: 13px; cursor: pointer; }
.editor-main .background-advanced[open] > summary { margin-bottom: 9px; }
.editor-main .background-advanced .tool-grid { display: block; margin-bottom: 9px; }
.editor-main .position-sliders, .editor-main .effect-sliders { grid-template-columns: 1fr; }
.editor-main .photo-scenes button img { height: 70px; object-fit: cover; }
.editor-main .background-upload { width: 100%; justify-content: center; }
.layer-tools { display: grid; gap: 8px; }
.layer-tools + .layer-tools { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--studio-line); }
.layer-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 9px; }
.layer-tools input[type=color] { width: 100%; min-height: 43px; padding: 4px; }
.layer-tools p { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
#layer-logo-controls { display: grid; gap: 8px; }
.sample-drawer {
  border: 1px solid var(--studio-line);
  border-radius: 11px;
  padding: 12px;
  background: #fff;
}
.has-photo .sample-drawer { margin-top: 10px; }
.sample-drawer summary { color: #34465f; cursor: pointer; font-weight: 700; }
.editor-main .sample-gallery { margin: 10px 0 0; }
.editor-main .sample-gallery > div { gap: 7px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.editor-main .sample-card { min-height: 74px; font-size: 12px; }
.editor-main .sample-card img { height: auto; aspect-ratio: 1; object-fit: cover; }
.editor-main .sample-card span { color: #273a55; }

.editor-main .details-card, .editor-main .export-card { margin-top: 0; }
.editor-main #form { max-width: none; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 13px 18px; }
.editor-main #form > :is(.two,.more-details,.primary,.simple-note) { grid-column: 1 / -1; }
.editor-main #form > .primary { justify-self: start; }
.editor-main #form label, .editor-main .tool-panel label, .editor-main .export-grid label { color: #33445c; font-size: 13px; }
.editor-main .export-box { background: #f4f7fc; border-color: var(--studio-line); }

.step-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.step-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d4dce8;
  text-align: center;
  text-decoration: none;
}
.export-actions { justify-content: flex-start; }
.image-export {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(235px, 330px);
  align-items: center;
  gap: clamp(12px, 3vw, 24px);
}
.export-preview {
  display: grid;
  place-items: center;
  height: clamp(200px, 34vw, 405px);
  min-width: 0;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--studio-line);
  border-radius: 13px;
  background-color: #f5f7fa;
  background-image: conic-gradient(#e3e8ef 25%, transparent 0 50%, #e3e8ef 0 75%, transparent 0);
  background-size: 18px 18px;
}
.export-preview canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.image-export-options h3 { margin: 0; font-size: 19px; }
.image-export-options p { margin: 5px 0; overflow-wrap: anywhere; color: var(--studio-muted); }
.editor-main .image-download { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 15px; }
.editor-main .image-download :is(#download-image, #download-photos) { grid-column: 1 / -1; }
.editor-main .image-download #download-note { color: var(--studio-muted); }
.listing-export { margin-top: 20px; }
.marketplace-export {
  display: grid;
  grid-template-columns: minmax(0, 280px) 1fr;
  align-items: end;
  gap: 8px 18px;
  margin-top: 20px;
  padding: clamp(14px, 3vw, 22px);
  background: #f3f6fb;
  border-radius: 13px;
}
.marketplace-export h3 { margin: 0 0 4px; }
.marketplace-export :is(h3, #marketplace-guide, .marketplace-actions) { grid-column: 1 / -1; }
.marketplace-export p { margin: 0; }
.marketplace-export select { width: 100%; }
.marketplace-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.marketplace-actions a { color: #2345a1; }
@media (max-width: 520px) { .marketplace-export { grid-template-columns: minmax(0, 1fr); } }
.image-export:not([hidden]) ~ .listing-export { border-top: 1px solid var(--studio-line); padding-top: 19px; }

@media (max-width: 780px) {
  .studio-grid { grid-template-columns: minmax(0,1fr); }
  .editor-main .photo-card .stage { height: clamp(245px, 67vw, 460px); }
  .editor-main #drop { min-height: 200px; }
  .editor-main .sample-card img { aspect-ratio: 4/3; }
}
@media (max-width: 520px) {
  .editor-main .header-actions { width: 100%; }
  .editor-main #save-status { width: 100%; order: 1; }
  .editor-main .header-actions button { flex: 1; min-width: 0; white-space: normal; }
  .editor-main #form { grid-template-columns: minmax(0,1fr); }
  .editor-main #photo-name { display: none; }
  .editor-main .view-tabs button { flex: 1; }
  .editor-main .view-tabs { flex-wrap: wrap; }
  .editor-main input:not([type=range]), .editor-main select, .editor-main textarea { font-size: 16px; }
  .editor-main .step-actions > * { flex: 1 1 auto; }
  .image-export { grid-template-columns: minmax(0, 1fr); }
  .editor-main .export-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 780px) {
  .studio-view, .studio-sidebar { display: contents; }
  .studio-grid { gap: 9px; }
  #upload-errors { order: -1; }
  .studio-canvas { order: 0; }
  #photo-status, #progress-wrap, #review { order: 1; }
  #studio-tools { order: 2; }
  .studio-grid .photo-toolbar { order: 3; margin: 0; }
  .studio-grid #drop { order: 4; }
  .studio-grid #sample-drawer { order: 5; margin-top: 0; }
  .editor-main .photo-card .stage { height: clamp(220px, 54vw, 375px); }
}
