:root {
  --bg: #0b0806;
  --surface: #17110d;
  --surface-2: #21170f;
  --ink: #fffaf5;
  --muted: #b8a99d;
  --line: rgba(255, 244, 232, .14);
  --accent: #ff6b00;
  --accent-light: #ffb06e;
  --success: #6ee7a4;
  --error: #ff8b82;
  --radius: 1.4rem;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 0%, rgba(255,107,0,.12), transparent 25rem),
    var(--bg);
  font-family: "DM Sans", sans-serif;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, select { font: inherit; }
button, label[for] { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
em { color: var(--accent); font-style: normal; }
[hidden] { display: none !important; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .75rem 1rem; color: #17100b; background: #fff; border-radius: 999px; }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 4px; }

.studio-header {
  width: min(100% - 2rem, 88rem);
  min-height: 5.5rem;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
}
.brand { font-family: "Syne", sans-serif; font-size: 1.65rem; font-weight: 800; letter-spacing: -.06em; }
.brand span { color: var(--accent); }
.studio-wordmark { text-align: center; text-transform: uppercase; }
.studio-wordmark span { display: block; color: var(--muted); font-size: .58rem; font-weight: 700; letter-spacing: .24em; }
.studio-wordmark strong { display: block; margin-top: .18rem; font-family: "Syne", sans-serif; font-size: .88rem; letter-spacing: .08em; }
.back-link { justify-self: end; color: var(--muted); font-size: .78rem; font-weight: 700; transition: color .2s; }
.back-link:hover { color: var(--ink); }

main { width: min(100% - 2rem, 88rem); margin: 0 auto; }
.welcome-step {
  min-height: calc(100svh - 5.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(20rem, .72fr);
  align-items: center;
  gap: clamp(3rem, 9vw, 9rem);
  padding: clamp(4rem, 8vw, 8rem) 0;
}
.eyebrow { margin: 0 0 1.4rem; color: var(--accent-light); font-size: .7rem; font-weight: 800; letter-spacing: .28em; text-transform: uppercase; }
.welcome-copy h1, .upload-copy h2, .workspace-intro h2 {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: clamp(4.8rem, 10vw, 10rem);
  font-weight: 600;
  line-height: .78;
  letter-spacing: -.075em;
  text-transform: uppercase;
}
.lead { max-width: 38rem; margin: 2.5rem 0; color: #d5c9bf; font-size: clamp(1rem, 1.5vw, 1.25rem); line-height: 1.65; }
.flow-list { max-width: 34rem; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.flow-list li { display: grid; grid-template-columns: 3.5rem 1fr; padding: .9rem 0; border-bottom: 1px solid var(--line); color: #d8cec6; font-size: .85rem; }
.flow-list span { color: var(--accent); font-family: "Syne", sans-serif; font-size: .7rem; font-weight: 700; }

.client-card { padding: clamp(1.5rem, 4vw, 2.6rem); background: #f4eee8; color: #20140d; box-shadow: 1.2rem 1.2rem 0 var(--accent); }
.card-heading { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.step-number { display: grid; place-items: center; width: 3rem; height: 3rem; border: 1px solid rgba(32,20,13,.2); border-radius: 50%; font-family: "Syne", sans-serif; font-size: .75rem; font-weight: 800; }
.card-heading p { margin: 0 0 .15rem; color: #77685e; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; }
.card-heading h2 { margin: 0; font-family: "Syne", sans-serif; font-size: 1.7rem; text-transform: uppercase; }
.client-card > label { display: block; margin: 1rem 0 .4rem; font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.client-card > label span { color: #806f64; font-weight: 500; text-transform: none; }
.client-card input {
  width: 100%;
  height: 3.25rem;
  padding: 0 .2rem;
  border: 0;
  border-bottom: 1px solid rgba(32,20,13,.28);
  border-radius: 0;
  color: #20140d;
  background: transparent;
  outline: 0;
  transition: border-color .2s;
}
.client-card input:focus { border-color: var(--accent); }
.client-card input::placeholder { color: #9a8e85; }
.primary-button, .quote-button {
  width: 100%; min-height: 3.8rem; margin-top: 2rem; padding: .85rem 1.2rem; border: 0; border-radius: 999px;
  color: #fff; background: #17100c; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  font-weight: 800; transition: transform .25s var(--ease), background .25s;
}
.primary-button:hover, .quote-button:hover { background: var(--accent); transform: translateY(-2px); }
.privacy-note { margin: .8rem 0 0; color: #7e7066; text-align: center; font-size: .66rem; }

.upload-step { min-height: calc(100svh - 5.5rem); display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(3rem, 9vw, 9rem); padding: 5rem 0; }
.upload-copy h2, .workspace-intro h2 { font-size: clamp(3.5rem, 7vw, 7.3rem); line-height: .86; }
.upload-copy > p:last-child, .workspace-intro > p:last-child { max-width: 34rem; color: var(--muted); line-height: 1.7; }
.drop-zone {
  min-height: 31rem; padding: 3rem 1.5rem; border: 1px dashed rgba(255,176,110,.5); background: rgba(255,107,0,.045);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; transition: background .25s, border-color .25s, transform .25s;
}
.drop-zone.is-dragging { border-color: var(--accent); background: rgba(255,107,0,.12); transform: scale(.99); }
.drop-mark { width: 5rem; height: 5rem; margin-bottom: 2rem; display: grid; place-items: center; border: 1px solid var(--accent); border-radius: 50%; color: var(--accent); font-size: 2.6rem; font-weight: 200; }
.drop-kicker { margin: 0; font-family: "Syne", sans-serif; font-size: 1.25rem; font-weight: 700; text-transform: uppercase; }
.drop-or { margin: .8rem; color: var(--muted); font-size: .7rem; }
.file-button, .replace-button { min-height: 3rem; padding: .8rem 1.5rem; border-radius: 999px; background: #fff; color: #21130b; cursor: pointer; font-size: .8rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.file-status { min-height: 1.1rem; margin: 1.2rem 0 0; color: var(--muted); font-size: .67rem; letter-spacing: .04em; }
.file-status.error { color: var(--error); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.workspace { padding: clamp(4rem, 8vw, 7rem) 0; }
.workspace-intro { display: grid; grid-template-columns: 1fr .65fr; align-items: end; gap: 2rem; margin-bottom: 3.5rem; }
.workspace-intro .eyebrow { grid-column: 1 / -1; margin-bottom: -.5rem; }
.workbench { display: grid; grid-template-columns: minmax(16rem, .31fr) minmax(0, 1fr); border: 1px solid var(--line); background: #100c09; }
.control-panel { border-right: 1px solid var(--line); }
.panel-section { padding: 1.5rem; border-bottom: 1px solid var(--line); }
.panel-label, .controls-grid > label { display: block; margin-bottom: 1rem; color: var(--accent-light); font-size: .62rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.product-tabs { display: grid; gap: .5rem; }
.product-tab { min-height: 3rem; padding: .7rem .8rem; border: 1px solid var(--line); color: var(--muted); background: transparent; cursor: pointer; display: flex; align-items: center; gap: 1rem; text-align: left; font-weight: 700; transition: color .2s, background .2s, border-color .2s; }
.product-tab span { color: #75685e; font-size: .62rem; }
.product-tab[aria-selected="true"] { color: #20130c; background: var(--accent); border-color: var(--accent); }
.product-tab[aria-selected="true"] span { color: #522000; }
.controls-grid { display: grid; gap: .8rem; }
.controls-grid > label { margin: .4rem 0 -.2rem; }
.controls-grid select { width: 100%; min-height: 2.8rem; padding: 0 .75rem; border: 1px solid var(--line); color: var(--ink); background: #18120e; }
.range-heading { display: flex; justify-content: space-between; align-items: center; margin-top: .55rem; color: #dbd0c7; font-size: .75rem; }
.range-heading output { color: var(--accent-light); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.position-reset {
  min-height: 2.65rem; margin-top: .35rem; border: 1px solid var(--line); color: var(--ink); background: transparent;
  cursor: pointer; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.position-reset:hover { border-color: var(--accent); color: var(--accent-light); }
.image-summary strong { display: block; overflow: hidden; margin-bottom: 1rem; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.replace-button { width: 100%; background: transparent; color: var(--ink); border: 1px solid var(--line); }

.preview-panel { min-width: 0; padding: clamp(1rem, 3vw, 2rem); }
.preview-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.preview-heading span { color: var(--accent-light); font-size: .6rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.preview-heading h3 { margin: .25rem 0 0; font-family: "Syne", sans-serif; font-size: clamp(1rem, 2vw, 1.5rem); text-transform: uppercase; }
.preview-heading > p { margin: 0; color: var(--muted); font-size: .65rem; }
.preview-heading i { display: inline-block; width: .45rem; height: .45rem; margin-right: .4rem; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 .25rem rgba(110,231,164,.1); }
.stage { position: relative; min-height: 34rem; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 45%, #302117, #120d09 68%); }
.stage::before { content: ""; position: absolute; inset: 0; opacity: .3; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 3rem 3rem; mask-image: radial-gradient(circle, #000, transparent 72%); }
#renderCanvas { position: relative; z-index: 1; display: block; max-width: 100%; max-height: 64vh; cursor: grab; touch-action: none; user-select: none; filter: drop-shadow(0 1.5rem 2.5rem rgba(0,0,0,.4)); transition: opacity .18s, transform .18s; }
#renderCanvas.is-changing { opacity: .25; transform: scale(.985); }
#renderCanvas.is-dragging { cursor: grabbing; }
.loading-state { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: .8rem; color: var(--muted); background: rgba(11,8,6,.72); font-size: .72rem; }
.loading-state span { width: 1rem; height: 1rem; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-state.is-hidden { display: none; }
.template-hint { margin: .9rem 0 0; color: #82766d; text-align: center; font-size: .66rem; }
.drag-hint { margin: .4rem 0 0; color: var(--accent-light); text-align: center; font-size: .68rem; font-weight: 700; }
.drag-hint span { display: inline-block; margin-right: .3rem; color: var(--accent); }

.quote-bar { margin-top: 1rem; padding: 1.1rem 1.2rem; display: grid; grid-template-columns: 1fr minmax(15rem, .32fr); align-items: center; gap: 2rem; color: #21130b; background: var(--accent); }
.quote-bar > div span { display: block; margin-bottom: .2rem; font-size: .58rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.quote-bar > div strong { font-family: "Syne", sans-serif; font-size: clamp(1rem, 2vw, 1.35rem); text-transform: uppercase; }
.quote-button { margin: 0; background: #17100c; }
.share-status { min-height: 1.5rem; margin: .8rem 0 0; color: var(--muted); text-align: right; font-size: .7rem; }
.share-status.success { color: var(--success); }
.share-status.error { color: var(--error); }

.quote-dialog {
  width: min(calc(100% - 1.5rem), 34rem); max-height: min(92dvh, 48rem); padding: 0; border: 0;
  color: #21130b; background: transparent; overflow: visible;
}
.quote-dialog::backdrop { background: rgba(5,3,2,.78); backdrop-filter: blur(10px); }
.quote-dialog-card {
  position: relative; max-height: min(92dvh, 48rem); padding: 1.45rem; overflow-y: auto; overscroll-behavior: contain;
  border-top: .42rem solid var(--accent); background: #f5eee8; box-shadow: 0 2.5rem 7rem rgba(0,0,0,.58);
}
.quote-dialog-close {
  position: absolute; top: .8rem; right: .8rem; z-index: 2; width: 2.7rem; height: 2.7rem; border: 1px solid rgba(33,19,11,.18);
  border-radius: 50%; color: #21130b; background: rgba(255,255,255,.7); cursor: pointer; font-size: 1.5rem; line-height: 1;
}
.quote-dialog-step { margin: 0 3rem .55rem 0; color: #a44208; font-size: .64rem; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.quote-dialog h2 { margin: 0 3rem .9rem 0; font-family: "Syne", sans-serif; font-size: clamp(1.7rem, 5vw, 2.7rem); line-height: .95; text-transform: uppercase; }
.quote-render-preview { display: block; width: 100%; max-height: 16rem; object-fit: contain; background: #170e09; }
.quote-dialog-card > p:not(.quote-dialog-step) { margin: 1rem 0; color: #6e5d51; font-size: .83rem; line-height: 1.5; }
.quote-dialog-actions { display: grid; gap: .7rem; }
.quote-download-button, .quote-whatsapp-button {
  width: 100%; min-height: 3.5rem; padding: .8rem 1rem; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  gap: .65rem; font-size: .8rem; font-weight: 900;
}
.quote-download-button { color: #fff; background: #21130b; }
.quote-whatsapp-button { color: #082e17; background: #52d273; }
.quote-download-button span, .quote-whatsapp-button span { display: grid; place-items: center; width: 1.55rem; height: 1.55rem; border: 1px solid currentColor; border-radius: 50%; font-size: .7rem; }
.quote-dialog-card > small { display: block; margin-top: .85rem; color: #7a685b; text-align: center; font-size: .64rem; line-height: 1.4; }
.quote-dialog button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.ad-transition { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1.5rem; color: var(--ink); background: var(--accent); overflow: hidden; }
.ad-grid { position: absolute; inset: -10%; opacity: .28; background-image: linear-gradient(rgba(32,14,4,.25) 1px, transparent 1px), linear-gradient(90deg, rgba(32,14,4,.25) 1px, transparent 1px); background-size: 5rem 5rem; transform: perspective(600px) rotateX(58deg) scale(1.4); animation: gridMove 2.2s linear infinite; }
.ad-copy { position: relative; width: min(90vw, 55rem); text-align: center; }
.ad-copy p { margin: 0 0 1.5rem; color: #542100; font-size: .68rem; font-weight: 800; letter-spacing: .28em; text-transform: uppercase; }
.ad-copy strong { display: block; font-family: "Syne", sans-serif; font-size: clamp(2.5rem, 7vw, 6.5rem); line-height: .92; letter-spacing: -.055em; text-transform: uppercase; }
.ad-progress { width: min(24rem, 70vw); height: 2px; margin: 2.5rem auto 1rem; overflow: hidden; background: rgba(44,16,0,.22); }
.ad-progress span { display: block; width: 100%; height: 100%; background: #281006; transform-origin: left; animation: progress 2.4s var(--ease) forwards; }
.ad-copy small { color: #5d2500; font-size: .7rem; }

.studio-footer { width: min(100% - 2rem, 88rem); margin: 0 auto; padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; color: #796d64; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes gridMove { to { transform: perspective(600px) rotateX(58deg) scale(1.4) translateY(5rem); } }

@media (max-width: 850px) {
  .studio-header { grid-template-columns: 1fr auto; }
  .studio-wordmark { display: none; }
  .welcome-step, .upload-step { grid-template-columns: 1fr; gap: 3.5rem; }
  .welcome-copy h1 { font-size: clamp(4.5rem, 22vw, 8rem); }
  .client-card { box-shadow: .65rem .65rem 0 var(--accent); }
  .workspace-intro { grid-template-columns: 1fr; }
  .workspace-intro .eyebrow { grid-column: auto; }
  .workbench { grid-template-columns: 1fr; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; }
  .panel-section { border-right: 1px solid var(--line); }
  .image-summary { grid-column: 1 / -1; }
  .product-tabs { grid-template-columns: repeat(3, 1fr); }
  .product-tab { flex-direction: column; gap: .25rem; text-align: center; }
  .stage { min-height: 27rem; }
  .quote-bar { grid-template-columns: 1fr; gap: 1rem; }
}

@media (max-width: 520px) {
  body { background: radial-gradient(circle at 100% 0%, rgba(255,107,0,.1), transparent 17rem), var(--bg); }
  main, .studio-header, .studio-footer { width: min(100% - 1.25rem, 88rem); }
  .studio-header {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 4.25rem;
    background: rgba(11,8,6,.9);
    backdrop-filter: blur(14px);
  }
  .brand { font-size: 1.4rem; }
  .back-link { font-size: 0; }
  .back-link span { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid var(--line); border-radius: 50%; font-size: 1.05rem; }
  .welcome-step {
    min-height: auto;
    padding: 2.5rem 0 3.25rem;
    gap: 2rem;
  }
  .eyebrow { margin-bottom: .85rem; font-size: .57rem; letter-spacing: .21em; line-height: 1.5; }
  .welcome-copy h1 { font-size: clamp(3.55rem, 18vw, 4.8rem); line-height: .82; }
  .lead { margin: 1.35rem 0; font-size: .9rem; line-height: 1.55; }
  .flow-list li { grid-template-columns: 2.5rem 1fr; padding: .62rem 0; font-size: .72rem; }
  .client-card { padding: 1.25rem; box-shadow: none; border-top: .4rem solid var(--accent); }
  .card-heading { margin-bottom: 1rem; }
  .card-heading h2 { font-size: 1.35rem; }
  .client-card > label { margin-top: .75rem; font-size: .66rem; }
  .client-card input { height: 2.85rem; font-size: .9rem; }
  .primary-button { min-height: 3.35rem; margin-top: 1.35rem; padding-inline: 1.1rem; font-size: .82rem; }
  .upload-step { min-height: auto; padding: 2.5rem 0 3.5rem; gap: 1.6rem; }
  .upload-copy h2, .workspace-intro h2 { font-size: clamp(3rem, 15vw, 4rem); line-height: .86; }
  .upload-copy > p:last-child, .workspace-intro > p:last-child { font-size: .82rem; line-height: 1.55; }
  .drop-zone { min-height: 19rem; padding: 2rem 1rem; }
  .drop-mark { width: 4rem; height: 4rem; margin-bottom: 1.3rem; }
  .workspace { padding: 2.5rem 0 5rem; }
  .workspace-intro { gap: .85rem; margin-bottom: 1.5rem; }
  .workbench { border: 0; background: transparent; }
  .preview-panel { order: 1; padding: 0; }
  .control-panel {
    order: 2;
    grid-template-columns: 1fr;
    margin-top: .75rem;
    border: 1px solid var(--line);
    background: #100c09;
  }
  .panel-section, .image-summary { grid-column: auto; padding: 1.1rem; border-right: 0; }
  .panel-label, .controls-grid > label { margin-bottom: .7rem; }
  .product-tab { min-height: 3.15rem; padding: .55rem .25rem; font-size: .72rem; }
  .controls-grid select { min-height: 3rem; }
  input[type="range"] { min-height: 2rem; }
  .replace-button { min-height: 3rem; }
  .preview-heading { align-items: center; margin-bottom: .7rem; }
  .preview-heading > p { display: none; }
  .preview-heading h3 { font-size: 1rem; }
  .stage { min-height: 0; aspect-ratio: 4 / 3; border: 1px solid var(--line); }
  #renderCanvas { width: 100%; height: auto; max-height: none; filter: drop-shadow(0 .8rem 1.4rem rgba(0,0,0,.32)); }
  .template-hint { margin: .65rem .5rem 0; line-height: 1.45; }
  .drag-hint { margin-top: .35rem; font-size: .64rem; }
  .quote-bar {
    position: relative;
    z-index: 2;
    margin-top: .75rem;
    padding: .8rem;
    gap: .65rem;
    box-shadow: 0 .75rem 2rem rgba(0,0,0,.42);
  }
  .quote-bar > div strong { font-size: .82rem; line-height: 1.2; }
  .quote-button { min-height: 3.2rem; padding: .75rem 1rem; font-size: .78rem; }
  .share-status { min-height: 0; margin: .8rem .25rem 0; text-align: left; line-height: 1.45; }
  .ad-copy p { margin-bottom: 1rem; font-size: .56rem; letter-spacing: .2em; }
  .ad-copy strong { font-size: clamp(2.25rem, 12vw, 3.2rem); }
  .studio-footer { flex-direction: column; }
  .quote-dialog { width: calc(100% - 1rem); max-height: calc(100dvh - 1rem); }
  .quote-dialog-card { max-height: calc(100dvh - 1rem); padding: 1.05rem; padding-bottom: max(1.05rem, env(safe-area-inset-bottom)); }
  .quote-dialog-close { top: .65rem; right: .65rem; }
  .quote-render-preview { max-height: 12.5rem; }
  .quote-download-button, .quote-whatsapp-button { min-height: 3.7rem; font-size: .78rem; }
}

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