﻿:root{
  --ink:#2b2219;
  --ink-2:#4b3d2e;
  --muted:#7d6b57;
  --faint:#a6937c;
  --line:#ece1d1;
  --line-soft:#f4ebdc;
  --panel:#fbf6ec;
  --card:#fffdf8;
  --r:14px;
  --shadow:0 1px 2px rgba(70,52,32,.06),0 18px 44px -26px rgba(70,52,32,.3);
  --shadow-soft:0 1px 2px rgba(70,52,32,.05),0 10px 28px -18px rgba(70,52,32,.22);
}

*{box-sizing:border-box}

[hidden]{display:none !important}

html,body{height:100%}

body{
  margin:0;
  min-height:100%;
  background:#f7f1e6;
  color:var(--ink);
  font:400 15px/1.5 ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  display:flex;flex-direction:column;align-items:center;
  padding:20px 28px 28px;
}

.sr-only{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
  clip:rect(0 0 0 0);white-space:nowrap;border:0;
}

/* ---------- slim page header ---------- */

.topbar{
  width:min(1320px,100%);
  height:48px;
  display:flex;align-items:center;justify-content:space-between;
  flex:none;
}

.brand{
  display:flex;align-items:center;gap:9px;
  color:var(--ink);text-decoration:none;font-weight:650;font-size:15px;letter-spacing:-.01em;
}
.brand-mark{display:grid;place-items:center;color:var(--ink)}
.brand-name .amp{color:var(--faint);font-weight:500;margin:0 1px}

.privacy{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}

/* ---------- the editor card ---------- */

.app{
  width:min(1320px,100%);
  height:min(780px,calc(100vh - 112px));
  min-height:560px;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  background:var(--card);
  border:1px solid var(--line);
  border-radius:20px;
  overflow:hidden;
  box-shadow:0 1px 2px rgba(70,52,32,.04),0 24px 60px -32px rgba(70,52,32,.24);
}

.workspace{
  min-width:0;min-height:0;
  display:flex;flex-direction:column;
  padding:18px 22px 14px;
  gap:10px;
  background:var(--card);
}

.toolbar{flex:none}

.tabs{
  display:grid;grid-template-columns:repeat(6,1fr);gap:4px;
  background:#f8f2e7;border-radius:12px;padding:5px;
}
.tab{
  appearance:none;border:0;background:transparent;
  height:58px;border-radius:9px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;
  font:inherit;font-size:11.5px;font-weight:600;color:var(--muted);
  cursor:pointer;letter-spacing:-.005em;
  transition:background .14s ease,color .14s ease,box-shadow .14s ease;
}
.tab svg{opacity:.72;transition:opacity .14s ease}
.tab:hover{color:var(--ink-2)}
.tab.is-on{
  background:#fff;color:var(--ink);
  box-shadow:0 1px 2px rgba(70,52,32,.12),0 0 0 .5px rgba(70,52,32,.04);
}
.tab.is-on svg{opacity:1}
.tab:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(70,52,32,.14)}

.subbar{
  flex:none;
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;row-gap:8px;
  min-height:32px;
}
.subbar-label{font-size:12px;color:var(--faint);margin-right:2px;flex:none;white-space:nowrap}
.subbar-gap{flex:1}
.subbar-div{width:1px;height:18px;background:var(--line);margin:0 4px}

.chips{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
.chip{
  appearance:none;cursor:pointer;
  height:30px;padding:0 10px;
  display:inline-flex;align-items:center;gap:6px;
  border:1px solid var(--line);border-radius:8px;background:#fff;
  font:inherit;font-size:12px;font-weight:600;color:var(--ink-2);
  transition:background .13s ease,border-color .13s ease,color .13s ease;
}
.chip:hover{border-color:#dccfb9}
.chip.is-on{background:var(--ink);border-color:var(--ink);color:#fff}
.chip:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(70,52,32,.14)}

.ratio-ico{
  width:13px;height:calc(13px / var(--a,1));
  border:1.3px solid currentColor;border-radius:2.5px;
  opacity:.85;display:inline-block;
}

/* style dots */

.style-dots{display:flex;align-items:center;gap:5px}
.style-dot{
  appearance:none;cursor:pointer;padding:3px;
  border:1px solid transparent;border-radius:9px;background:transparent;
  display:grid;place-items:center;
  transition:border-color .13s ease,box-shadow .13s ease,background .13s ease;
}
.style-dot:hover{background:#f9f3e9}
.style-dot.is-on{border-color:var(--ink-2);box-shadow:0 0 0 1px var(--ink-2)}
.style-dot:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(70,52,32,.14)}

.d-visual{
  width:36px;height:26px;border-radius:5px;
  display:grid;grid-template-columns:1fr 1fr;overflow:hidden;background:#f4ebdc;
  box-shadow:inset 0 0 0 1px rgba(70,52,32,.09);
}
.d-visual i{display:block;background:#d8c8b1}
.d-clean{gap:1px;background:#eee5d6}
.d-clean i{background:#dbccb6}
.d-soft{background:#fff;padding:3px;gap:3px;border:1px solid #f3ebdd}
.d-soft i{border-radius:3px;background:#e8ddcb}
.d-bold{background:#2b2219;padding:2px;gap:2px}
.d-bold i{border-radius:2px;background:#7a6a56}

.export-meta #meta-out{display:inline-flex;align-items:center;gap:6px}

.linkish{
  appearance:none;background:none;border:0;padding:2px;margin:0;
  display:inline-flex;align-items:center;gap:5px;
  font:inherit;font-size:12px;font-weight:600;color:var(--muted);
  cursor:pointer;border-radius:6px;white-space:nowrap;flex:none;
}
.linkish:hover{color:var(--ink)}
.linkish:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(70,52,32,.12)}
.linkish.sample{margin-top:4px;font-size:12.5px;text-decoration:underline;text-underline-offset:3px;text-decoration-color:#dccfb9}
.linkish.sample:hover{text-decoration-color:var(--ink)}
.linkish.reset{margin-top:14px;font-size:11.5px}

.canvas-wrap{
  position:relative;flex:1;min-height:0;
  display:grid;place-items:center;
  padding:4px;
}

#preview{
  display:block;
  border-radius:6px;
  background:#fff;
  box-shadow:0 1px 2px rgba(70,52,32,.05),0 14px 40px -14px rgba(70,52,32,.2);
  outline:1px solid rgba(70,52,32,.06);
  touch-action:none;
  cursor:default;
  opacity:0;
  transition:opacity .18s ease;
}
#preview.is-ready{opacity:1}
#preview.is-panning{cursor:grabbing}
#preview.is-divider{cursor:ew-resize}

/* ---------- upload (split in the middle) ---------- */

.empty{
  position:absolute;inset:0;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:12px;background:#fff;text-align:center;
}
.empty[hidden]{display:none}

.upload-split{
  width:min(820px,100%);
  display:grid;grid-template-columns:1fr 1fr;gap:18px;
  text-align:center;
}
.upload-col{display:flex;flex-direction:column;gap:8px;min-width:0}
.upload-title{
  margin:0;font-size:15px;font-weight:650;color:var(--ink);letter-spacing:-.01em;
  text-align:center;
}

.shot{
  position:relative;
  aspect-ratio:1/1;
  width:100%;
  height:auto;
  border:1.5px dashed #e6dac8;
  border-radius:14px;
  background:#fffcf6;
  display:grid;place-items:center;
  cursor:pointer;
  overflow:hidden;
  transition:border-color .14s ease,background .14s ease,box-shadow .14s ease;
}
.shot:hover{border-color:#b8a68f;background:#fdf8ef}
.shot:focus-within{box-shadow:0 0 0 3px rgba(70,52,32,.08)}
.shot.is-drag{border-color:var(--ink);background:#f4ebdd;border-style:solid}
.shot.is-filled{border-style:solid;border-color:transparent;background:#f4ebdd}

.shot-empty{display:flex;flex-direction:column;align-items:center;gap:6px;padding:16px;color:var(--faint)}
.shot-icon{
  width:58px;height:58px;border-radius:14px;background:#fff;
  display:grid;place-items:center;color:#9b8b76;
  box-shadow:0 1px 2px rgba(70,52,32,.08),0 6px 18px -8px rgba(70,52,32,.16);
  margin-bottom:6px;
}
.shot-empty b{font-size:14.5px;font-weight:650;color:var(--ink-2);letter-spacing:-.01em}
.shot-empty small{font-size:12px;color:var(--faint)}

.shot-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
.shot-shade{
  position:absolute;inset:auto 0 0 0;height:40%;
  background:linear-gradient(to top,rgba(2,6,23,.62),rgba(2,6,23,0));
  pointer-events:none;
}
.shot-name{
  position:absolute;left:10px;right:10px;bottom:8px;
  font-size:11px;color:#fdf9f1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  text-shadow:0 1px 2px rgba(0,0,0,.5);pointer-events:none;
}
.shot-clear{
  position:absolute;top:7px;right:7px;
  width:24px;height:24px;padding:0;
  display:grid;place-items:center;
  border:1px solid rgba(70,52,32,.1);
  border-radius:50%;
  background:rgba(255,255,255,.94);
  color:var(--ink-2);
  font-size:15px;line-height:1;
  cursor:pointer;
  opacity:0;transition:opacity .12s ease;
}
.shot:hover .shot-clear,.shot:focus-within .shot-clear{opacity:1}
.shot-clear:hover{background:#fff;color:var(--ink)}

.hint{
  margin:0;flex:none;text-align:center;
  font-size:11.5px;color:var(--faint);letter-spacing:.01em;
  transition:color .15s ease;
  white-space:pre-line;line-height:1.55;
}
/* crops hide part of the photo, so the "drag it" note has to stand out */
.hint.is-accent{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  align-self:center;
  padding:5px 12px;border-radius:999px;
  background:#fdf1d8;border:1px solid #f0dcb4;
  color:#8a5f14;font-weight:650;font-size:12px;
}
@media (max-width:560px){
  .hint.is-accent{font-size:11.5px;padding:5px 10px}
}

/* remove-a-photo buttons floating on the canvas */

.photo-x-layer{position:absolute;inset:0;pointer-events:none;z-index:6}
.photo-x{
  position:absolute;
  width:28px;height:28px;padding:0;
  transform:translate(-50%,-50%);
  display:grid;place-items:center;
  border:1px solid rgba(255,255,255,.34);
  border-radius:50%;
  background:rgba(70,52,32,.66);
  color:#fff;
  font-size:16px;line-height:1;
  cursor:pointer;
  pointer-events:auto;
  box-shadow:0 2px 10px rgba(70,52,32,.4);
  backdrop-filter:blur(3px);
  opacity:.94;
  transition:opacity .12s ease,background .12s ease,transform .12s ease,box-shadow .12s ease;
}
.photo-x:hover{opacity:1;background:#2b2219;transform:translate(-50%,-50%) scale(1.1);box-shadow:0 4px 14px rgba(70,52,32,.5)}
.photo-x:focus-visible{outline:none;opacity:1;box-shadow:0 0 0 3px rgba(70,52,32,.25)}

/* the two action pills in the middle of the toolbar */

.subbar-acts{display:flex;align-items:center;gap:8px;margin-left:12px}
.act{
  appearance:none;cursor:pointer;
  height:32px;padding:0 13px;
  display:inline-flex;align-items:center;gap:7px;
  border-radius:9px;white-space:nowrap;flex:none;
  font:inherit;font-size:12.5px;font-weight:650;letter-spacing:-.005em;
  transition:background .13s ease,border-color .13s ease,transform .06s ease,opacity .13s ease;
}
.act:active{transform:translateY(.5px)}
.act:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(70,52,32,.14)}
.act[disabled]{opacity:.45;cursor:default}

.act.auto{background:#eff6ff;border:1px solid #bfdbfe;color:#1d4ed8}
.act.auto:hover{background:#dbeafe;border-color:#93c5fd}
.act.auto svg{color:#2563eb}

.act.undo{background:#fdf9f1;border:1px solid #eadfcd;color:#4b3d2e}
.act.undo:hover{background:#f4ebdd;border-color:#dccfb9}
.act.undo svg{color:#7d6b57}
.act.undo[disabled]{opacity:.4}

.act.clear{background:#fef2f2;border:1px solid #fecaca;color:#dc2626}
.act.clear:hover{background:#fee2e2;border-color:#fca5a5}
.act.clear svg{color:#ef4444}

/* ---------- template picker modal ---------- */

body.modal-open{overflow:hidden}

.modal{
  position:fixed;inset:0;z-index:60;
  display:flex;align-items:center;justify-content:center;
  padding:24px;
}
.modal[hidden]{display:none}

.modal-scrim{
  position:absolute;inset:0;
  background:rgba(70,52,32,.38);
  animation:fadeIn .16s ease;
}

.modal-panel{
  position:relative;
  width:min(1060px,100%);
  max-height:min(760px,calc(100vh - 48px));
  display:flex;flex-direction:column;
  background:#fff;border-radius:16px;
  box-shadow:0 24px 64px rgba(70,52,32,.24),0 2px 8px rgba(70,52,32,.08);
  overflow:hidden;
  animation:popIn .18s ease;
}

@keyframes fadeIn{from{opacity:0}to{opacity:1}}
@keyframes popIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

.modal-head{
  flex:none;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:16px 20px 12px;
  border-bottom:1px solid var(--line-soft);
}
.modal-head h2{margin:0;font-size:17px;font-weight:700;letter-spacing:-.01em;color:var(--ink)}
.modal-x{
  appearance:none;cursor:pointer;border:0;background:transparent;
  width:30px;height:30px;border-radius:8px;
  font-size:22px;line-height:1;color:#a6937c;
  display:flex;align-items:center;justify-content:center;
}
.modal-x:hover{background:#f7f0e4;color:var(--ink)}

.modal-cats{
  flex:none;
  display:flex;gap:6px;align-items:center;
  padding:12px 20px;
  overflow-x:auto;
  border-bottom:1px solid var(--line-soft);
}

.cat{
  appearance:none;cursor:pointer;flex:none;
  display:inline-flex;align-items:center;gap:6px;
  font:inherit;font-size:13px;font-weight:600;
  padding:7px 14px;border-radius:99px;
  border:1px solid transparent;background:transparent;color:#7d6b57;
  transition:background .12s ease,color .12s ease;
}
.cat i{
  font-style:normal;font-size:10.5px;font-weight:700;
  min-width:18px;height:18px;padding:0 5px;border-radius:99px;
  display:inline-flex;align-items:center;justify-content:center;
  background:#f4ebdd;color:#a6937c;
}
.cat:hover{background:#f7f0e4;color:var(--ink)}
.cat.is-on{background:var(--ink-2);color:#fff}
.cat.is-on i{background:rgba(255,255,255,.18);color:#fff}
.cat:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(70,52,32,.16)}

.modal-grid{
  flex:1;min-height:0;
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:12px;
  padding:16px 20px 18px;
  overflow-y:auto;
  align-content:start;
}
.modal-grid::-webkit-scrollbar{width:10px}
.modal-grid::-webkit-scrollbar-thumb{background:#e7dbc7;border-radius:99px;border:3px solid #fff}

.tpl-card{
  position:relative;
  appearance:none;cursor:pointer;
  display:flex;flex-direction:column;gap:6px;
  padding:7px 7px 8px;
  border:1px solid var(--line);border-radius:11px;background:#fff;
  font:inherit;color:var(--ink);text-align:left;
  transition:border-color .13s ease,box-shadow .13s ease,transform .13s ease;
}
.tpl-card:hover{border-color:#d9cbb6;transform:translateY(-1px)}
.tpl-card.is-on{border-color:var(--ink-2);box-shadow:0 0 0 1.5px var(--ink-2)}
.tpl-card:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(70,52,32,.16)}
.tpl-card canvas{
  width:100%;height:auto;display:block;border-radius:7px;background:#f4ebdc;
  box-shadow:inset 0 0 0 1px rgba(70,52,32,.05);
}
.tpl-card b{
  font-size:12px;font-weight:650;letter-spacing:-.005em;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.tpl-card em{
  font-style:normal;font-size:10.5px;color:#a6937c;
  text-transform:uppercase;letter-spacing:.05em;
}

.tpl-card.is-on::after{
  content:"";
  position:absolute;top:12px;right:12px;
  width:18px;height:18px;border-radius:99px;
  background:var(--ink-2);
  box-shadow:0 1px 3px rgba(70,52,32,.3);
}
.tpl-card.is-on::before{
  content:"";
  position:absolute;top:17px;right:15.5px;
  width:9px;height:5px;
  border-left:2px solid #fff;border-bottom:2px solid #fff;
  transform:rotate(-45deg);
  z-index:1;
}

.modal-foot{
  flex:none;
  display:flex;align-items:center;justify-content:flex-end;gap:10px;
  padding:14px 20px;
  border-top:1px solid var(--line-soft);
  background:#fefaf3;
}
.modal-hint{margin-right:auto;font-size:12.5px;color:var(--muted)}
.modal-foot .btn{min-width:104px;justify-content:center}

@media (max-width:900px){
  .modal{padding:12px}
  .modal-panel{max-height:calc(100vh - 24px)}
  .modal-grid{grid-template-columns:repeat(2,minmax(0,1fr));padding:12px 14px}
  .modal-hint{display:none}
}

/* ---------- export bar ---------- */

.exportbar{
  flex:none;
  width:min(1320px,100%);
  margin-top:12px;
  border-top:0;
  padding-top:0;
  display:flex;flex-direction:column;align-items:center;gap:8px;
}

.export-note{
  margin:0;font-size:12px;color:var(--muted);line-height:1.4;text-align:center;
}
.export-note b{color:var(--ink);font-weight:650}

.export-row{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:center;width:100%;
}

.btn{
  appearance:none;cursor:pointer;
  height:40px;padding:0 16px;
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  border:1px solid var(--line);border-radius:10px;
  background:#fff;color:var(--ink);
  font:inherit;font-size:13px;font-weight:600;letter-spacing:-.005em;
  transition:background .13s ease,border-color .13s ease,transform .06s ease,opacity .13s ease;
}
.btn:hover{background:#fbf6ec;border-color:#e2d5c1}
.btn:active{transform:translateY(.5px)}
.btn.primary{background:var(--ink);border-color:var(--ink);color:#fff}
.btn.primary:hover{background:#3a2f23;border-color:#3a2f23}
.btn:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(70,52,32,.16)}
.btn[disabled]{opacity:.45;cursor:default;transform:none}

.export-dur{
  display:flex;align-items:center;gap:6px;
  margin-left:6px;padding-left:12px;border-left:1px solid var(--line-soft);
  font-size:11.5px;color:var(--faint);
}

.export-meta{
  margin:0;font-size:11.5px;color:var(--faint);
  display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:center;
}
.export-meta .dot{color:#dccfb9}

.chips.tiny{gap:4px}
.chips.tiny button{
  appearance:none;cursor:pointer;
  height:28px;padding:0 11px;
  border:1px solid var(--line);border-radius:8px;background:#fff;
  font:inherit;font-size:11.5px;font-weight:600;color:var(--ink-2);
}
.chips.tiny button.is-on{background:var(--ink);border-color:var(--ink);color:#fff}
.chips.tiny.two{display:grid;grid-template-columns:1fr 1fr}

/* ---------- fine tune drawer ---------- */

.drawer{position:fixed;inset:0;z-index:70;display:flex;justify-content:flex-end}
.drawer[hidden]{display:none}
.drawer-scrim{position:absolute;inset:0;background:rgba(70,52,32,.32)}
.drawer-panel{
  position:relative;
  width:min(360px,100%);
  height:100%;
  background:#fff;
  border-left:1px solid var(--line);
  box-shadow:-18px 0 44px -24px rgba(70,52,32,.4);
  display:flex;flex-direction:column;
  animation:slide-in .18s ease;
}
@keyframes slide-in{from{transform:translateX(24px);opacity:.6}to{transform:none;opacity:1}}

.drawer-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:16px 18px 12px;border-bottom:1px solid var(--line-soft);
}
.drawer-head h2{margin:0;font-size:13px;font-weight:650;letter-spacing:.03em;text-transform:uppercase}
.icon-btn{
  appearance:none;border:0;background:#f7f1e6;color:var(--ink-2);
  width:30px;height:30px;border-radius:8px;font-size:17px;line-height:1;cursor:pointer;
}
.icon-btn:hover{background:#f3ebde}

.drawer-body{padding:14px 18px 28px;overflow-y:auto;display:flex;flex-direction:column;gap:2px}

/* fields */

.field{margin-top:12px}
.field.tight{margin-top:12px}
.field-label{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  font-size:11.5px;font-weight:550;color:var(--muted);margin-bottom:6px;
}
.field-label b{font-weight:550;color:var(--ink-2);font-size:11px;font-variant-numeric:tabular-nums}

.inputs{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
input[type=text],select{
  width:100%;height:34px;
  border:1px solid var(--line);border-radius:8px;
  background:#fff;padding:0 10px;
  font:inherit;font-size:12.5px;color:var(--ink);
  outline:none;
  transition:border-color .13s ease,box-shadow .13s ease;
}
input[type=text]:focus,select:focus{border-color:#a9987f;box-shadow:0 0 0 3px rgba(70,52,32,.07)}
select{
  appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2364748b' stroke-width='1.6'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 9px center;background-size:13px;padding-right:28px;
}

input[type=range]{
  -webkit-appearance:none;appearance:none;
  width:100%;height:18px;background:transparent;cursor:pointer;display:block;
}
input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:99px;background:#efe6d7}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;
  width:15px;height:15px;margin-top:-5.5px;border-radius:50%;
  background:#fff;border:1.5px solid #c9b8a0;
  box-shadow:0 1px 2px rgba(70,52,32,.16);
}
input[type=range]:hover::-webkit-slider-thumb{border-color:var(--ink-2)}
input[type=range]:focus-visible{outline:none}
input[type=range]:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 3px rgba(70,52,32,.14)}

.switch{display:flex;align-items:center;gap:9px;cursor:pointer;user-select:none;margin-top:12px}
.switch input{position:absolute;opacity:0;width:0;height:0}
.switch .track{
  width:34px;height:20px;border-radius:99px;background:#ece2d2;position:relative;
  transition:background .15s ease;flex:none;
}
.switch .knob{
  position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;
  background:#fff;box-shadow:0 1px 2px rgba(70,52,32,.24);
  transition:transform .15s ease;
}
.switch input:checked + .track{background:var(--ink)}
.switch input:checked + .track .knob{transform:translateX(14px)}
.switch input:focus-visible + .track{box-shadow:0 0 0 3px rgba(70,52,32,.14)}
.switch-text{font-size:12.5px;font-weight:550;color:var(--ink-2)}

.swatches{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.sw{
  appearance:none;padding:0;cursor:pointer;
  width:28px;height:28px;border-radius:50%;
  background:var(--sw);
  border:1px solid rgba(70,52,32,.14);
  transition:transform .12s ease;
}
.sw:hover{transform:scale(1.06)}
.sw.is-on{box-shadow:0 0 0 2px #fff,0 0 0 3.5px var(--ink)}
.sw-caption{font-size:11.5px;color:var(--muted);font-weight:550;margin-right:2px}
.swatches.sm{margin-top:12px}
.swatches.sm .sw{width:22px;height:22px}

.sw-custom{
  display:grid;place-items:center;overflow:hidden;
  background:conic-gradient(#f87171,#fbbf24,#34d399,#60a5fa,#c084fc,#f87171);
}
.sw-custom input[type=color]{width:130%;height:130%;border:0;padding:0;background:none;cursor:pointer;opacity:0}

/* ---------- toast ---------- */

.toast{
  position:fixed;left:50%;bottom:26px;transform:translate(-50%,14px);
  background:var(--ink);color:#fff;
  padding:9px 15px;border-radius:10px;
  font-size:12.5px;font-weight:500;
  box-shadow:0 8px 26px rgba(70,52,32,.26);
  opacity:0;pointer-events:none;
  transition:opacity .18s ease,transform .18s ease;
  z-index:90;
  max-width:min(88vw,420px);text-align:center;
}
.toast.is-on{opacity:1;transform:translate(-50%,0)}

/* ---------- responsive ---------- */

@media (max-width:1100px){
  .app{height:min(740px,calc(100vh - 108px))}
  .shot{height:180px}
}

@media (max-width:900px){
  html,body{height:auto}
  body{padding:10px 12px 18px;min-height:100vh;justify-content:flex-start}
  .topbar{height:42px}
  .app{height:auto;min-height:0;flex:none}

  .workspace{padding:12px;gap:9px}
  .canvas-wrap{flex:none}
  /* the empty state drives the height on small screens, so nothing scrolls inside */
  .empty{position:relative;inset:auto;width:100%}

  .tab{height:50px;font-size:10.5px}
  .tab svg{width:26px;height:18px}
  .tabs{grid-template-columns:repeat(6,1fr);gap:3px;padding:4px}

  .subbar{flex-wrap:wrap;gap:7px 8px}
  .subbar-label{display:none}
  .subbar-div{display:none}
  .subbar-gap{flex:1 0 100%;height:0;order:1}
  #ratio{order:0;flex-wrap:nowrap;overflow-x:auto;max-width:100%;padding-bottom:1px}
  .chip{flex:none;height:28px;font-size:11.5px}
  #open-tune,#swap{order:2}
  .subbar-acts{margin-left:0;order:2}
  .act{height:30px;font-size:11.5px;padding:0 11px}
  .photo-x{width:24px;height:24px;font-size:14px}

  .upload-split{width:100%;gap:12px}
  .shot{height:auto;max-height:min(42vh,320px)}
  .shot-empty b{font-size:13px}
  .shot-empty small{font-size:11px}
  .upload-title{font-size:13.5px}

  .export-row{gap:6px}
  .btn{height:38px;padding:0 12px;font-size:12px}
  .export-dur{margin-left:0;padding-left:0;border-left:0;width:100%;justify-content:center}
}

@media (max-width:560px){
  .upload-split{gap:10px}
  .shot{height:auto;max-height:44vh}
  .shot-empty{padding:10px;gap:4px}
  .shot-empty b{font-size:12px;line-height:1.25}
  .shot-empty small{font-size:10.5px}
  .shot-icon{width:44px;height:44px;border-radius:12px;margin-bottom:2px}
  .privacy span{display:none}
}

@media (prefers-reduced-motion:reduce){
  *{transition:none !important;animation:none !important}
}

/* ---------- desktop type scale: read everything without squinting ---------- */

@media (min-width:901px){
  .brand{font-size:18px}
  .privacy{font-size:13.5px}

  .tab{font-size:14px;height:66px}
  .tab svg{width:34px;height:24px}
  .subbar-label{font-size:13.5px}
  .chip{font-size:13.5px;height:34px;padding:0 13px}
  .linkish{font-size:13.5px}
  .act{font-size:14px;height:36px;padding:0 15px}

  .upload-title{font-size:19px}
  .shot-empty b{font-size:17.5px}
  .shot-empty small{font-size:14px}
  .hint{font-size:13.5px}

  .export-note{font-size:14px}
  .btn{font-size:15.5px;height:44px;padding:0 20px}
  .export-dur{font-size:13.5px}
  .export-meta{font-size:13.5px}
  .chips.tiny button{font-size:13.5px;height:32px}

  .drawer-head h2{font-size:15px}
  .field-label{font-size:13.5px}
  .field-label b{font-size:13px}
  input[type=text],select{font-size:14.5px;height:38px}
  .switch-text{font-size:14.5px}
  .sw-caption{font-size:13.5px}

  .toast{font-size:15px}
}


/* ============================================================
   手机端触控补丁（beforeafterlab）
   - 把小按钮放大到拇指能稳定点中的尺寸（原 22–28px → 40px+）
   - 上传格上的删除 × 在触屏上没有 hover，改为常显
   - toast 上移，避免盖住模板弹窗底部的 Apply / Cancel
   ============================================================ */
@media (max-width: 560px) {
  .tab { height: 64px; }

  .chip { height: 40px; padding: 0 14px; font-size: 14px; }
  #ratio .chip { height: 40px; }

  .style-dot { padding: 6px; }
  .d-visual { width: 40px; height: 28px; }

  .act { height: 40px; padding: 0 16px; }
  .linkish { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; }
  .linkish.sample, .linkish.reset { font-size: 14px; }

  .btn { height: 46px; }
  .chips.tiny button { height: 36px; min-width: 44px; }

  .photo-x { width: 36px; height: 36px; font-size: 19px; }
  .shot-clear { width: 34px; height: 34px; font-size: 17px; opacity: 1; }

  .icon-btn { width: 40px; height: 40px; }
  .switch { min-height: 44px; margin-top: 6px; }
  .sw { width: 40px; height: 40px; }
  .swatches.sm .sw { width: 36px; height: 36px; }

  input[type=range] { height: 40px; }
  input[type=range]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -11px; }
  select { height: 44px; font-size: 15px; }

  #reset-pos { min-height: 40px; }
  .modal-foot .btn { min-height: 44px; }

  /* toast 只在模板弹窗打开时上移，平时别挡住下载按钮 */
  body.modal-open .toast { bottom: 96px; }

  /* 比例档位允许换行，别把 9:16 / 16:9 藏进横向滚动 */
  #ratio { flex-wrap: wrap; overflow: visible; }

  /* Fine tune 原来只是一行小字，手机上看着像标签；做成可点的按钮 */
  #open-tune {
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    padding: 0 14px;
    min-height: 40px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-2);
  }
}

/* ============================================================
   Overlay 版式：Before 叠在 After 上的透明度控制
   ============================================================ */
.ghost-row{
  flex:none;
  display:flex;align-items:center;gap:12px;
  padding:6px 14px;
  border:1px solid var(--line);border-radius:12px;background:#fff;
}
.ghost-name{font-size:12px;font-weight:600;color:var(--ink-2);white-space:nowrap}
.ghost-row input[type=range]{flex:1;min-width:80px}
.ghost-val{
  font-size:12px;font-weight:600;color:var(--muted);
  font-variant-numeric:tabular-nums;min-width:42px;text-align:right;
}
@media (max-width: 560px){
  .ghost-row{min-height:44px;padding:6px 12px;gap:10px}
  .ghost-name,.ghost-val{font-size:13.5px}
}

/* Vertical Stack 用不到比例档：留在原位，只做置灰不可点（避免整排控件跳位） */
#ratio.is-off,
.subbar-label.is-off { opacity: .45; }
#ratio.is-off .chip { pointer-events: none; }
/* 窄屏：布局标签一行横滑，避免 6 个标签各折两行、条带高度不齐 */
@media (max-width:560px){
  .tabs{
    grid-template-columns:repeat(3,minmax(0,1fr));
    grid-auto-rows:52px;gap:4px;padding:5px;border-radius:14px;
  }
  .tab{height:52px;font-size:11px;gap:3px;padding:0 2px}
  .tab span{white-space:nowrap;font-weight:600}
  .tab svg{width:24px;height:17px}
}
/* big pill CTA inside the empty upload cards */
.shot-empty{gap:12px;padding:22px}
.shot-cta{
  display:inline-flex;align-items:center;justify-content:center;gap:12px;
  padding:17px 34px;border-radius:999px;
  background:#5f4326;color:#fff;
  font-size:19px;font-weight:750;letter-spacing:-.01em;line-height:1;
  box-shadow:0 2px 4px rgba(70,52,32,.18),0 14px 30px -16px rgba(70,52,32,.55);
  transition:transform .15s ease, background .15s ease;
}
.shot:hover .shot-cta{background:#6d4e2d}
.shot:active .shot-cta{transform:translateY(1px)}
.shot-sub{font-size:15px;font-weight:600;color:#8a7862}
.shot-empty small{font-size:12.5px;color:#a9987f}
@media (max-width:560px){
  .shot-cta{padding:15px 24px;font-size:16px;gap:9px}
  .shot-sub{font-size:13.5px}
}

/* 窄屏：两张上传卡改成上下排列，按钮和说明都有完整宽度 */
@media (max-width:640px){
  .upload-split{grid-template-columns:1fr;gap:10px;width:100%}
  .shot{aspect-ratio:2.1/1}
  .shot-empty{gap:8px;padding:12px}
  .shot-cta{padding:13px 22px;font-size:15.5px;gap:9px}
  .shot-sub{font-size:13px}
  .shot-empty small{font-size:11.5px}
  .upload-title{font-size:14px}
  .empty{padding:8px 4px 10px}
}
/* 空状态时不要把画布也算进高度：否则窄屏下上传区会被挤到画布下方 */
.canvas-wrap:has(#empty:not([hidden])) #preview{display:none}
/* 窄屏导出区：主按钮通栏，说明紧跟其下，次级按钮两列 */
@media (max-width:640px){
  .exportbar{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:12px 14px 14px}
  .export-row{display:contents}
  #dl-png{
    grid-column:1 / -1;order:1;
    height:56px;border-radius:14px;
    font-size:17px;font-weight:750;letter-spacing:-.01em;
    gap:10px;
  }
  #dl-png svg{width:18px;height:18px}
  .export-meta{grid-column:1 / -1;order:2;margin:2px 0 4px;font-size:12.5px;line-height:1.45;text-align:center}
  #dl-gif{order:3}
  #dl-video{order:4}
  #dl-gif,#dl-video{height:44px;font-size:14px}
  .export-dur{grid-column:1 / -1;order:5;justify-content:center;margin-left:0;padding-left:0;border-left:0}
  .export-note{order:0;grid-column:1 / -1;margin:0 0 2px;text-align:center}
}
/* 上传后导出条滑入出现 */
@keyframes barPop{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.exportbar.is-popped{animation:barPop .32s cubic-bezier(.22,.9,.3,1) both}
@media (prefers-reduced-motion:reduce){.exportbar.is-popped{animation:none}}
.meta-mob{display:none}
@media (max-width:640px){
  .meta-desk{display:none}
  .meta-mob{display:inline}
  .export-meta #meta-out{display:none}
}
/* ---------- free / pro export ---------- */

.btn.pro{
  background:#f6d98a;
  border-color:#e8c56a;
  color:#6b4a15;
  font-weight:750;
}
.btn.pro:hover{background:#f2d076;border-color:#dfba58}
.btn.pro:active{transform:translateY(1px)}
.btn.pro svg{color:#8a5f14}

.export-row #dl-png.grow{flex:1}

/* the row pairs the two CTAs like the reference: primary + upgrade */
@media (min-width:641px){
  #dl-pro{flex:none}
}

.modal-panel--pro{max-width:520px}
.pro-body{padding:18px 22px 6px}
.pro-lead{margin:0 0 14px;font-size:14.5px;line-height:1.55;color:var(--ink-2)}
.pro-list{list-style:none;margin:0 0 16px;padding:0;display:grid;gap:10px}
.pro-list li{
  display:grid;gap:2px;padding:11px 13px;border-radius:12px;
  background:var(--panel);border:1px solid var(--line-soft);
}
.pro-list b{font-size:13.5px;color:var(--ink)}
.pro-list span{font-size:12.5px;line-height:1.45;color:var(--muted)}
.pro-price{display:flex;align-items:baseline;gap:8px;padding:4px 2px 8px}
.pro-amount{font-size:26px;font-weight:800;letter-spacing:-.02em;color:var(--ink)}
.pro-per{font-size:12.5px;color:var(--faint)}
.modal-foot--pro{align-items:center}
.modal-foot--pro .modal-hint{font-size:12px;color:var(--faint)}

html.is-locked{overflow:hidden}

/* mobile: primary + upgrade side by side, GIF / video under them */
@media (max-width:640px){
  #dl-png{grid-column:1 / 2 !important;order:1;height:56px;font-size:16px;padding:0 12px}
  #dl-pro{grid-column:2 / 3;order:1;height:56px;font-size:15px;padding:0 12px;border-radius:14px;justify-content:center}
  #dl-pro svg{width:16px;height:16px}
  .export-meta{order:2}
}

/* very narrow phones: stack the two CTAs so neither label wraps */
@media (max-width:420px){
  #dl-png{grid-column:1 / -1 !important;order:1;font-size:17px}
  #dl-pro{grid-column:1 / -1;order:2;font-size:15.5px}
  .export-meta{order:3}
  #dl-gif{order:4}
  #dl-video{order:5}
  .export-dur{order:6}
}
/* 外层页面接管导出按钮时（手机端悬浮窗），工具内不再重复显示导出条 */
@media (max-width:900px){
  body.has-dock .exportbar{display:none !important}
}
/* ---------- tablet touch targets (561–900px) ---------- */
/* phones already get 40px controls at <=560; tablets were still on the 28px
   desktop chips, which is a hard tap target on a touch screen */
@media (min-width:561px) and (max-width:900px){
  .chip{height:40px;padding:0 14px;font-size:14px}
  #ratio .chip{min-width:0}
  .act{height:40px;padding:0 16px;font-size:13.5px}
  .style-dot{padding:6px}
  .d-visual{width:40px;height:28px}
  .linkish{display:inline-flex;align-items:center;min-height:40px;padding:0 4px}
  .subbar-label{font-size:13px}
  .tab{height:56px;font-size:12.5px}
  .tab svg{width:28px;height:20px}
  .modal-x{width:44px;height:44px}
  .btn{height:44px;font-size:14px}
}
/* ---------- any touch screen, whatever the width (iPad landscape included) ---------- */
@media (pointer:coarse){
  .chip{height:42px;padding:0 15px;font-size:14px}
  .act{height:42px;padding:0 15px;font-size:13.5px}
  .style-dot{padding:6px}
  .d-visual{width:40px;height:28px}
  .tab{min-height:60px}
  .btn{min-height:44px}
  .linkish{display:inline-flex;align-items:center;min-height:40px}
  .modal-x{width:44px;height:44px}
  .switch{min-height:44px}
  input[type=range]{height:40px}
  #duration button{min-height:38px}
}

/* the ratio row is hidden (not just dimmed) in Vertical Stack */
#ratio[hidden],#ratio-label[hidden]{display:none !important}

/* Vertical Stack has no ratio control; a short note keeps the row balanced */
.stack-note{
  font-weight:600;color:var(--muted);white-space:nowrap;
  max-width:340px;overflow:hidden;text-overflow:ellipsis;
}
@media (max-width:760px){.stack-note{display:none !important}}
