:root{
  --ink:#241f1b;
  --muted:#786f68;
  --paper:#f7f1eb;
  --card:rgba(255,255,255,.82);
  --line:rgba(47,38,31,.10);
  --accent:#c95f4d;
  --accent-2:#e99c72;
  --shadow:0 22px 70px rgba(70,46,28,.12);
  --radius:28px;
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  color:var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(241,184,150,.34), transparent 28%),
    radial-gradient(circle at 88% 26%, rgba(203,174,198,.28), transparent 30%),
    linear-gradient(180deg,#fbf7f3 0%,#f2ebe4 100%);
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  min-height:100vh;
  overflow-x:hidden;
}

button,input{font:inherit}
button{color:inherit}
button:focus-visible,input:focus-visible,label:focus-within{
  outline:3px solid rgba(201,95,77,.25);
  outline-offset:3px;
}
.hidden{display:none!important}

.ambient{
  position:fixed;
  width:30rem;height:30rem;
  border-radius:50%;
  filter:blur(70px);
  opacity:.28;
  pointer-events:none;
  z-index:-1;
}
.ambient-a{background:#efad8d;left:-12rem;top:16rem}
.ambient-b{background:#b59bc3;right:-12rem;top:5rem}

.shell{width:min(1180px,calc(100% - 32px));margin:0 auto;padding:24px 0 42px}

.hero{
  display:flex;align-items:center;justify-content:space-between;
  padding:8px 2px 24px;
}
.brand{display:flex;gap:14px;align-items:center}
.mark{
  width:46px;height:46px;border-radius:15px;
  display:grid;place-items:center;
  background:linear-gradient(145deg,#d76c55,#b94e43);
  box-shadow:0 10px 30px rgba(178,75,60,.23);
}
.mark svg{width:29px;fill:white}
.mark .stroke{fill:none;stroke:white;stroke-width:2;stroke-linecap:round}
.brand h1{
  font-family:Georgia,"Times New Roman",serif;
  font-size:1.55rem;letter-spacing:-.04em;
  margin:0 0 2px;
}
.brand p{margin:0;color:var(--muted);font-size:.83rem}
.v1-badge{
  font-size:.72rem;font-weight:800;letter-spacing:.08em;
  padding:8px 11px;border-radius:999px;
  background:rgba(255,255,255,.55);border:1px solid rgba(255,255,255,.7);
  color:#6c6057;
}

.studio{display:grid;grid-template-columns:minmax(0,.92fr) minmax(0,1.08fr);gap:22px;align-items:start}
.panel{
  border:1px solid rgba(255,255,255,.76);
  background:var(--card);
  backdrop-filter:blur(24px);
  -webkit-backdrop-filter:blur(24px);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.controls{padding:25px}
.preview{padding:25px;min-height:680px;position:sticky;top:18px}

.step{padding:2px 0 24px}
.step+.step{border-top:1px solid var(--line);padding-top:24px}
.step-head{display:flex;gap:13px;align-items:flex-start;margin-bottom:15px}
.step-index{
  flex:0 0 30px;height:30px;border-radius:10px;
  display:grid;place-items:center;font-size:.78rem;font-weight:850;
  color:#9e5144;background:#f8e5dc;border:1px solid #f2d6ca;
}
.step h2,.preview h2{font-size:1.05rem;margin:1px 0 3px;letter-spacing:-.025em}
.step p,.preview p{margin:0;color:var(--muted);font-size:.84rem;line-height:1.45}

.dropzone{
  min-height:92px;
  border:1.5px dashed rgba(93,73,60,.22);
  border-radius:20px;padding:15px;
  display:grid;grid-template-columns:auto 1fr auto;gap:13px;align-items:center;
  background:rgba(248,244,240,.85);
  cursor:pointer;transition:.22s ease;
}
.dropzone:hover{transform:translateY(-1px);border-color:rgba(201,95,77,.42);background:#fffaf6}
.dropzone input{display:none}
.drop-icon{
  width:46px;height:46px;border-radius:15px;
  display:grid;place-items:center;background:white;border:1px solid var(--line);
}
.drop-icon svg{width:21px;fill:none;stroke:#7e695d;stroke-width:1.8}
.dropzone strong,.dropzone span{display:block}
.dropzone strong{font-size:.9rem;margin-bottom:4px}
#dropHint{font-size:.75rem;color:var(--muted)}
.drop-action{
  padding:8px 11px;border-radius:10px;background:#efe7e0;
  font-size:.75rem!important;font-weight:800;color:#5f5148;
}

.segmented{
  background:#eee7e1;border-radius:14px;padding:4px;display:grid;gap:4px;
}
.segmented.two{grid-template-columns:1fr 1fr}
.seg{
  border:0;background:transparent;border-radius:11px;padding:10px 12px;
  font-weight:750;font-size:.82rem;cursor:pointer;transition:.2s ease;
}
.seg.active{background:white;box-shadow:0 5px 16px rgba(56,42,33,.08)}

.palette-wrap{padding-top:14px}
.swatches{display:flex;flex-wrap:wrap;gap:8px}
.swatch{
  width:31px;height:31px;border-radius:10px;border:2px solid rgba(255,255,255,.9);
  box-shadow:0 0 0 1px rgba(0,0,0,.08),0 3px 10px rgba(0,0,0,.06);
  cursor:pointer;position:relative;transition:.18s;
}
.swatch.selected{transform:translateY(-2px);box-shadow:0 0 0 2px #332b26,0 5px 12px rgba(0,0,0,.08)}
.swatch.selected:after{
  content:"✓";position:absolute;inset:0;display:grid;place-items:center;
  color:white;font-size:.74rem;font-weight:900;text-shadow:0 1px 3px rgba(0,0,0,.5);
}
.custom-color{
  margin-top:11px;display:inline-flex;align-items:center;gap:8px;
  font-size:.77rem;font-weight:700;cursor:pointer;color:#5d5149;
}
.custom-color input{width:28px;height:28px;padding:0;border:0;background:transparent;cursor:pointer}
.microcopy{font-size:.72rem!important;margin-top:9px!important}

.control-block{padding:1px 1px 16px}
.control-line{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.control-line label{font-size:.82rem;font-weight:750}
.control-line output{
  min-width:42px;text-align:center;padding:6px 9px;border-radius:10px;
  background:#2e2925;color:white;font-size:.76rem;font-weight:800;
}
.range{width:100%;accent-color:var(--accent)}
.range-labels{display:flex;justify-content:space-between;color:#9a918b;font-size:.67rem;margin-top:2px}

.style-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.style-card{
  border:1px solid var(--line);background:rgba(255,255,255,.62);
  border-radius:16px;padding:11px 7px 10px;cursor:pointer;text-align:left;
  transition:.2s ease;min-width:0;
}
.style-card:hover{transform:translateY(-1px)}
.style-card.active{border-color:rgba(201,95,77,.6);background:#fff8f3;box-shadow:0 6px 20px rgba(201,95,77,.08)}
.style-card strong,.style-card small{display:block}
.style-card strong{font-size:.74rem;margin-top:8px}
.style-card small{font-size:.64rem;color:var(--muted);margin-top:2px}
.style-dot{width:100%;height:20px;border-radius:8px;display:block}
.style-dot.faithful{background:linear-gradient(90deg,#7d8f79,#d7a774,#9d6c64)}
.style-dot.soft{background:linear-gradient(90deg,#c7b7d7,#f1c4b1,#ccd9c1)}
.style-dot.graphic{background:linear-gradient(90deg,#22343b 0 33%,#e0a154 33% 66%,#c45a49 66%)}
.style-dot.pop{background:linear-gradient(90deg,#2654d7,#f0c400,#eb4f7b)}

.primary,.secondary{
  width:100%;border:0;border-radius:17px;cursor:pointer;font-weight:850;
  display:flex;align-items:center;justify-content:center;gap:8px;transition:.2s ease;
}
.primary{
  min-height:54px;color:white;
  background:linear-gradient(135deg,#d66b54,#bd5147);
  box-shadow:0 12px 28px rgba(178,75,60,.24);
}
.primary:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 15px 32px rgba(178,75,60,.29)}
.primary:disabled{opacity:.42;cursor:not-allowed;box-shadow:none}
.primary svg{width:18px;fill:none;stroke:currentColor;stroke-width:2.3}

.empty-state{
  min-height:628px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;
  padding:30px;
}
.empty-state h2{font-size:1.22rem;margin-top:25px}
.empty-state p{max-width:340px;margin-top:8px}
.mini-art{
  width:230px;aspect-ratio:4/3;border-radius:24px;
  background:#f8efe7;border:1px solid rgba(72,56,45,.08);
  box-shadow:inset 0 0 0 9px rgba(255,255,255,.42),0 18px 38px rgba(81,57,40,.08);
  position:relative;overflow:hidden;transform:rotate(-2deg);
}
.shape{position:absolute;border-radius:50%}
.s1{width:150px;height:105px;background:#e8b694;left:-22px;bottom:-28px}
.s2{width:120px;height:96px;background:#aab9a1;right:-18px;bottom:-12px}
.s3{width:90px;height:90px;background:#cab3cc;right:26px;top:22px}
.line{position:absolute;height:1px;background:rgba(66,50,40,.55);transform-origin:left}
.l1{width:170px;left:24px;top:83px;transform:rotate(21deg)}
.l2{width:130px;left:44px;top:116px;transform:rotate(-12deg)}
.num{
  position:absolute;width:22px;height:22px;border-radius:50%;
  display:grid;place-items:center;background:rgba(255,255,255,.82);
  font-size:.69rem;font-weight:850;color:#59483d;
}
.n1{left:56px;top:94px}.n2{right:38px;top:55px}

.preview-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.eyebrow{
  display:block;font-size:.65rem;text-transform:uppercase;letter-spacing:.12em;
  font-weight:900;color:#a56252;margin-bottom:3px;
}
.preview-head h2{font-size:1.08rem;margin:0}
.view-switch{display:flex;gap:4px;padding:4px;background:#eee7e1;border-radius:12px}
.view-btn{
  border:0;background:transparent;padding:7px 9px;border-radius:9px;
  font-size:.7rem;font-weight:800;cursor:pointer;color:#72675f;
}
.view-btn.active{background:white;color:#302923;box-shadow:0 3px 10px rgba(0,0,0,.06)}

.canvas-frame{
  position:relative;border-radius:21px;overflow:hidden;
  background:#eee9e4;border:1px solid rgba(54,42,34,.09);
  min-height:340px;display:grid;place-items:center;
}
.canvas-frame canvas{width:100%;height:auto;display:block;background:white}
.processing{
  position:absolute;inset:0;background:rgba(250,246,242,.93);
  backdrop-filter:blur(8px);display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;
}
.processing strong{font-size:.9rem;margin-top:12px}
.processing span{font-size:.73rem;color:var(--muted);margin-top:4px}
.spinner{
  width:34px;height:34px;border-radius:50%;
  border:3px solid #eadfd7;border-top-color:var(--accent);
  animation:spin .8s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}

.legend-preview{display:flex;gap:7px;flex-wrap:wrap;margin:13px 2px 17px}
.legend-chip{
  display:flex;align-items:center;gap:6px;padding:5px 8px 5px 5px;
  border-radius:999px;background:#f4eee8;border:1px solid var(--line);
  font-size:.68rem;font-weight:800;color:#5c5048;
}
.legend-chip i{width:17px;height:17px;border-radius:50%;display:grid;place-items:center;font-style:normal;font-size:.58rem;color:white;text-shadow:0 1px 3px rgba(0,0,0,.55)}

.print-card{
  border-top:1px solid var(--line);padding-top:17px;
}
.print-card h3{font-size:.96rem;margin:0 0 3px}
.print-card p{font-size:.76rem}
.format-row{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin:13px 0 9px}
.format-btn{
  border:1px solid var(--line);background:#f5efea;border-radius:11px;
  padding:8px;cursor:pointer;font-size:.73rem;font-weight:850;
}
.format-btn.active{background:#302923;color:white;border-color:#302923}
.secondary{
  min-height:48px;background:white;border:1px solid rgba(50,39,32,.12);
  box-shadow:0 7px 18px rgba(55,40,31,.06);
}
.secondary:hover{transform:translateY(-1px)}
.secondary svg{width:18px;fill:none;stroke:currentColor;stroke-width:1.8}

footer{
  display:flex;justify-content:space-between;gap:14px;
  padding:18px 6px 0;color:#8b817a;font-size:.7rem;
}

.print-area{display:none}

@media (max-width:900px){
  .studio{grid-template-columns:1fr}
  .preview{position:relative;top:auto;min-height:0}
  .empty-state{min-height:440px}
}
@media (max-width:560px){
  .shell{width:min(100% - 20px,1180px);padding-top:14px}
  .hero{padding-bottom:16px}
  .brand p{font-size:.72rem}
  .panel{border-radius:23px}
  .controls,.preview{padding:18px}
  .style-grid{grid-template-columns:repeat(2,1fr)}
  .style-card{padding:10px}
  .style-dot{height:18px}
  .dropzone{grid-template-columns:auto 1fr}
  .drop-action{display:none!important}
  .preview-head{align-items:flex-end}
  .view-btn{padding:7px 8px}
  .canvas-frame{min-height:260px}
  footer{flex-direction:column;gap:5px}
}

@media print{
  body{background:white!important}
  body > *:not(.print-area){display:none!important}
  .print-area{
    display:flex!important;flex-direction:column;
    width:100%;height:auto;min-height:100vh;
    background:white;color:#111;padding:0;
  }
  .print-header{
    display:flex;align-items:flex-end;justify-content:space-between;
    gap:12px;border-bottom:.35mm solid #d5d5d5;padding-bottom:3mm;margin-bottom:4mm;
    font-family:Arial,sans-serif;
  }
  .print-header strong{display:block;font-size:12pt}
  .print-header span{display:block;font-size:7pt;color:#666;margin-top:1mm}
  #printMeta{font-size:7pt;color:#666}
  .print-canvas-wrap{display:flex;justify-content:center;align-items:center;flex:1;min-height:0}
  #printCanvas{max-width:100%;max-height:72vh;width:auto;height:auto}
  .print-legend{
    display:grid;grid-template-columns:repeat(8,1fr);
    gap:2mm;margin-top:4mm;padding-top:3mm;border-top:.35mm solid #ddd;
    font-family:Arial,sans-serif;
  }
  .print-legend-item{
    display:flex;align-items:center;gap:1.5mm;font-size:7pt;font-weight:700;
    min-width:0;
  }
  .print-legend-swatch{
    width:6mm;height:6mm;border-radius:1.5mm;border:.25mm solid rgba(0,0,0,.22);
    display:grid;place-items:center;color:white;font-size:6pt;font-weight:700;
    text-shadow:0 .2mm .5mm rgba(0,0,0,.45);
    flex:0 0 auto;
  }
}
