.stitch-page {
  background:
    radial-gradient(circle at 88% 7%, rgba(166, 201, 214, .31), transparent 27rem),
    radial-gradient(circle at 7% 35%, rgba(255, 200, 168, .24), transparent 24rem),
    var(--paper);
}

.back-home { justify-self: end; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 750; }
.back-home span { margin-left: 4px; color: var(--coral); }
.stitch-main { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.stitch-hero { min-height: 410px; display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: center; gap: 70px; padding: 60px 0 48px; }
.stitch-hero h1 { max-width: 790px; margin: 24px 0 16px; font-size: clamp(45px, 6vw, 70px); line-height: 1.04; letter-spacing: -.064em; }
.stitch-hero h1 em { color: var(--coral); font-family: Georgia, "Songti SC", serif; font-weight: 500; }
.stitch-hero > div > p { max-width: 690px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.75; }
.hero-links { display: flex; flex-wrap: wrap; gap: 15px; }
.stitch-illustration { width: 280px; height: 235px; position: relative; justify-self: end; }
.sheet { width: 106px; height: 148px; position: absolute; display: grid; grid-template-rows: 65% 35%; overflow: hidden; border: 5px solid #fff; border-radius: 9px; background: #fff; box-shadow: 0 16px 35px rgba(46, 54, 53, .16); }
.sheet i:first-child { background: linear-gradient(145deg, #8bbaab, #dce9dc); }
.sheet i:last-child { background: repeating-linear-gradient(#eee9e0 0 6px, #fff 6px 12px); }
.sheet-one { left: 3px; top: 40px; transform: rotate(-8deg); }
.sheet-two { left: 79px; top: 15px; z-index: 2; transform: rotate(2deg); }
.sheet-two i:first-child { background: linear-gradient(145deg, #f6a186, #ffe0bd); }
.sheet-three { left: 158px; top: 51px; transform: rotate(9deg); }
.sheet-three i:first-child { background: linear-gradient(145deg, #93b3d1, #d9e6f0); }
.stitch-illustration > b { width: 31px; height: 31px; position: absolute; left: 128px; top: 103px; z-index: 4; display: grid; place-items: center; border-radius: 50%; background: #22211f; color: #fff; font-size: 17px; box-shadow: 0 7px 18px rgba(0,0,0,.2); }
.stitch-illustration > em { position: absolute; right: 1px; bottom: 2px; color: #6e858d; font: italic 10px/1.2 Georgia, serif; letter-spacing: .13em; }

.stitch-workbench { margin-bottom: 90px; border: 1px solid rgba(105, 97, 87, .23); border-radius: 27px; background: rgba(255, 254, 250, .92); box-shadow: 0 25px 70px rgba(58, 51, 41, .1), inset 0 1px #fff; overflow: hidden; backdrop-filter: blur(14px); }
.workbench-heading { display: flex; align-items: end; justify-content: space-between; padding: 27px 29px 22px; border-bottom: 1px solid #e1dcd3; }
.workbench-heading > div:first-child > span, .panel-heading > div > span { color: #a19b92; font-size: 8px; font-weight: 850; letter-spacing: .16em; }
.workbench-heading h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: -.04em; }
.privacy-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: #edf4ef; color: #56806b; font-size: 9px; font-weight: 750; }
.privacy-chip i { width: 6px; height: 6px; border-radius: 50%; background: #4fa77c; }

.stitch-controls { display: grid; grid-template-columns: 1.8fr repeat(3, minmax(100px, .65fr)) .7fr 1fr; gap: 10px; align-items: end; padding: 18px 28px; border-bottom: 1px solid #e6e1d8; background: #f7f4ee; }
.stitch-controls fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.stitch-controls legend, .control-field > span { display: block; margin-bottom: 7px; color: #716c64; font-size: 9px; font-weight: 800; }
.segmented-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.segmented-control label, .format-options label { cursor: pointer; }
.segmented-control input, .format-options input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span { min-height: 38px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #d9d3c9; border-radius: 9px; background: #fff; color: #79736b; font-size: 9px; font-weight: 800; }
.segmented-control b { color: #9c958c; font-size: 13px; }
.segmented-control input:checked + span { border-color: #262522; background: #262522; color: #fff; box-shadow: 0 5px 13px rgba(38,37,34,.15); }
.segmented-control input:checked + span b { color: #ff8e74; }
.control-field { min-width: 0; display: block; }
.control-field > div, .control-field select { width: 100%; height: 38px; border: 1px solid #d7d1c8; border-radius: 9px; background: #fff; }
.control-field > div { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 0 10px; }
.control-field input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; font-size: 11px; font-weight: 750; }
.control-field small { color: #9d978e; font-size: 8px; }
.control-field select { padding: 0 8px; color: #45413b; font-size: 10px; font-weight: 750; outline: 0; }
.columns-field[hidden] { display: none; }
.background-row { height: 38px; display: flex; align-items: center; gap: 5px; }
.background-row input { width: 36px; height: 38px; border: 1px solid #d3cdc4; border-radius: 9px; padding: 3px; background: #fff; cursor: pointer; }
.background-row button { width: 21px; height: 21px; border: 2px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px #d2ccc2; cursor: pointer; }
.background-row button[data-color="#ffffff"] { --swatch: #fff; }
.background-row button[data-color="#f4f1ea"] { --swatch: #f4f1ea; }
.background-row button[data-color="#1d1c1a"] { --swatch: #1d1c1a; }
.background-row button.active { box-shadow: 0 0 0 2px var(--coral); }
.format-options { height: 38px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.format-options span { height: 100%; display: grid; place-items: center; border: 1px solid #d8d2c8; border-radius: 8px; background: #fff; color: #8e887f; font-size: 8px; font-weight: 850; }
.format-options input:checked + span { border-color: #f27a60; background: #fff2ed; color: #d55339; }

.stitch-studio { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.35fr); min-height: 610px; }
.source-panel, .preview-panel { min-width: 0; padding: 25px 28px 28px; }
.source-panel { border-right: 1px solid #e5e0d8; }
.preview-panel { background: #fbfaf6; }
.panel-heading { min-height: 41px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h3 { margin: 4px 0 0; font-size: 16px; letter-spacing: -.025em; }
.panel-heading button { border: 0; background: transparent; color: #8d877e; font-size: 9px; cursor: pointer; }
.panel-heading button:disabled { opacity: .35; cursor: default; }
.preview-heading em { color: #777168; font-size: 9px; font-style: normal; font-weight: 750; }
.stitch-drop-zone { min-height: 72px; display: flex; align-items: center; gap: 12px; margin-top: 15px; padding: 12px; border: 1.5px dashed #cfc8bd; border-radius: 13px; background: #f8f5ef; cursor: pointer; transition: border-color .18s, background .18s; }
.stitch-drop-zone.dragging { border-color: var(--coral); background: #fff3ed; }
.stitch-drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-symbol { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px 11px 11px 4px; background: #252421; color: #fff; font-size: 18px; }
.stitch-drop-zone > span:last-child { min-width: 0; display: grid; gap: 5px; }
.stitch-drop-zone strong { font-size: 11px; }
.stitch-drop-zone small { color: #969087; font-size: 8px; }
.import-message { min-height: 13px; margin: 7px 1px 0; color: #c6513d; font-size: 8px; }
.source-empty { min-height: 320px; display: grid; place-content: center; justify-items: center; gap: 12px; color: #aaa49b; text-align: center; }
.source-empty[hidden], .preview-empty[hidden] { display: none; }
.source-empty span { color: #d8d2c8; font: italic 36px Georgia, serif; }
.source-empty p { max-width: 190px; margin: 0; font-size: 10px; line-height: 1.65; }
.source-list { display: grid; gap: 7px; margin-top: 6px; }
.source-card { min-width: 0; display: grid; grid-template-columns: 28px 62px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 8px; border: 1px solid #e2ddd4; border-radius: 12px; background: #fff; transition: border-color .15s, opacity .15s, transform .15s; }
.source-card[draggable="true"] { cursor: grab; }
.source-card.dragging { opacity: .42; transform: scale(.98); }
.source-card.drag-target { border-color: var(--coral); }
.drag-handle { display: grid; place-items: center; color: #bbb4aa; font-size: 13px; letter-spacing: -3px; }
.source-thumb { width: 62px; height: 52px; display: block; object-fit: cover; border-radius: 8px; background: #e7e2da; }
.source-meta { min-width: 0; display: grid; gap: 5px; }
.source-meta strong { overflow: hidden; color: #444039; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.source-meta small { color: #9d978e; font-size: 8px; }
.source-actions { display: grid; grid-template-columns: repeat(2, 24px); gap: 3px; }
.source-actions button { width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 7px; background: #f3f0ea; color: #817b73; font-size: 10px; cursor: pointer; }
.source-actions button:hover:not(:disabled) { background: #e9e5de; color: #22211f; }
.source-actions button:disabled { opacity: .28; cursor: default; }
.source-actions .remove-source { grid-column: 1 / -1; width: 51px; color: #ae6658; }

.canvas-stage { min-height: 470px; max-height: 610px; display: grid; place-items: start center; overflow: auto; margin-top: 15px; padding: 28px; border-radius: 16px; background-color: #e7e4dd; background-image: linear-gradient(45deg, rgba(255,255,255,.4) 25%, transparent 25%), linear-gradient(-45deg, rgba(255,255,255,.4) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(255,255,255,.4) 75%), linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.4) 75%); background-size: 22px 22px; background-position: 0 0, 0 11px, 11px -11px, -11px 0; box-shadow: inset 0 0 0 1px rgba(110,102,91,.08); }
.preview-empty { min-height: 410px; align-self: stretch; display: grid; place-content: center; justify-items: center; color: #918b82; }
.preview-empty > span { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 13px; border-radius: 16px; background: rgba(255,255,255,.68); color: #77998b; font-size: 24px; transform: rotate(-4deg); }
.preview-empty strong { font-size: 11px; }
.preview-empty small { margin-top: 6px; color: #aaa49b; font-size: 8px; }
#stitchCanvas { display: block; width: auto; max-width: 100%; height: auto; border-radius: 2px; box-shadow: 0 12px 32px rgba(43,40,35,.18); }
#stitchCanvas[hidden] { display: none; }
.canvas-message { min-height: 13px; margin: 7px 2px 0; color: #9a6e43; font-size: 8px; }
.export-row { display: flex; align-items: end; justify-content: flex-end; gap: 15px; margin-top: 3px; }
.quality-control { min-width: 150px; display: grid; gap: 6px; color: #777168; font-size: 8px; }
.quality-control[hidden] { display: none; }
.quality-control span { display: flex; justify-content: space-between; }
.quality-control b { color: #d45b43; }
.quality-control input { width: 100%; accent-color: var(--coral); }
.export-button { min-width: 210px; height: 43px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 10px; background: var(--coral); color: #fff; font-size: 10px; font-weight: 900; box-shadow: 0 8px 18px rgba(255,107,74,.18); cursor: pointer; }
.export-button:hover:not(:disabled) { background: var(--coral-dark); }
.export-button:disabled { opacity: .4; cursor: not-allowed; }
.export-button svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.stitch-benefits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-bottom: 100px; overflow: hidden; border: 1px solid #ddd7ce; border-radius: 20px; background: #ddd7ce; }
.stitch-benefits article { min-height: 165px; position: relative; padding: 24px; background: rgba(247,244,238,.92); }
.stitch-benefits article > span { position: absolute; right: 19px; top: 17px; color: #b3ada4; font: italic 11px Georgia; }
.stitch-benefits strong { display: block; margin-top: 40px; font-size: 14px; }
.stitch-benefits p { max-width: 270px; margin: 8px 0 0; color: #7e7870; font-size: 10px; line-height: 1.65; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 30; padding: 11px 15px; border-radius: 10px; background: #242320; color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.2); font-size: 10px; font-weight: 750; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b94b3c; }

@media (max-width: 1040px) {
  .stitch-controls { grid-template-columns: 1.7fr repeat(3, 1fr); }
  .background-control, .format-control { grid-column: span 2; }
}

@media (max-width: 900px) {
  .stitch-hero { grid-template-columns: 1fr; gap: 15px; padding-bottom: 42px; }
  .stitch-illustration { display: none; }
  .stitch-studio { grid-template-columns: 1fr; }
  .source-panel { border-right: 0; border-bottom: 1px solid #e5e0d8; }
  .source-empty { min-height: 160px; }
}

@media (max-width: 650px) {
  .stitch-main { width: calc(100% - 24px); }
  .stitch-hero { min-height: 0; padding: 49px 4px 40px; }
  .stitch-hero h1 { font-size: 42px; }
  .stitch-hero > div > p { font-size: 13px; }
  .hero-links { display: grid; gap: 0; }
  .stitch-workbench { margin-bottom: 65px; border-radius: 20px; }
  .workbench-heading { padding: 20px 17px 17px; }
  .workbench-heading h2 { font-size: 20px; }
  .privacy-chip { display: none; }
  .stitch-controls { grid-template-columns: repeat(2, 1fr); padding: 15px; }
  .layout-control { grid-column: 1 / -1; }
  .background-control, .format-control { grid-column: span 1; }
  .source-panel, .preview-panel { padding: 19px 15px; }
  .canvas-stage { min-height: 380px; max-height: 520px; padding: 15px; }
  .preview-empty { min-height: 345px; }
  .export-row { align-items: stretch; flex-direction: column; }
  .export-button { width: 100%; }
  .stitch-benefits { grid-template-columns: 1fr; margin-bottom: 70px; }
  .stitch-benefits article { min-height: 140px; }
  .stitch-benefits strong { margin-top: 28px; }
}
