.logo-editor{margin:20px 0;padding:20px;border:1px solid #d5dbce;border-radius:16px;background:#f8f8f3}
.logo-editor h4{margin:0 0 10px}.logo-editor p{font-size:14px;line-height:1.7}
.logo-editor-workspace{display:grid;grid-template-columns:minmax(0,1fr) minmax(130px,.65fr);align-items:center;gap:18px;margin:14px 0}.logo-editor-stage{position:relative;width:min(100%,320px,calc(320px * var(--logo-image-aspect,1)));max-width:320px;margin:0 auto;overflow:hidden;border:1px solid #e0e1d9;border-radius:12px;background:#f1eee7;line-height:0}
.logo-editor .logo-editor-base{display:block;width:100%;height:auto;margin:0;border-radius:0}
.logo-editor .logo-editor-overlay{position:absolute;max-width:none;height:auto;margin:0;transform:translate(-50%,-50%);border-radius:0;cursor:grab;touch-action:none;user-select:none;outline:1px dashed #526144;outline-offset:3px}
.logo-editor-overlay:focus-visible{outline:3px solid #526144;outline-offset:5px}.logo-editor-overlay:active{cursor:grabbing}
.logo-editor-controls{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;min-width:0}.logo-editor-control{display:block;font-size:14px}.logo-editor-control span{display:flex;justify-content:space-between;gap:8px}.logo-editor-control output{font-variant-numeric:tabular-nums;color:#606a55}.logo-editor-control input{display:block;width:100%;margin:10px 0;accent-color:#59654a}
.logo-editor-original{display:flex;align-items:center;gap:14px;margin:12px 0}.logo-editor-original img{width:68px;max-height:68px;object-fit:contain;border:1px solid #ddd;background:repeating-conic-gradient(#f3f3f3 0% 25%,white 0% 50%) 50% / 12px 12px}.logo-editor-original p{margin:0;color:#6e7566}
.logo-composite-progress{display:flex;align-items:center;gap:12px;padding:18px;background:#f1f3ec;border-radius:12px}.logo-composite-progress:before{content:'';width:18px;height:18px;border:2px solid #ccd3c1;border-top-color:#59654a;border-radius:50%;animation:logo-saving 1s linear infinite}@keyframes logo-saving{to{transform:rotate(360deg)}}
@media(max-width:620px){.logo-editor{padding:12px}.logo-editor-workspace{grid-template-columns:minmax(0,1fr);gap:10px;margin:12px 0}.logo-editor-stage{width:min(100%,220px,calc(220px * var(--logo-image-aspect,1)));max-width:220px}.logo-editor-controls{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.logo-editor-control{font-size:12px}.logo-editor-control span{display:block;line-height:1.4}.logo-editor-control output{display:block}.logo-editor-control input{margin:7px 0}.logo-editor-original img{width:48px;max-height:48px}}
@media(prefers-reduced-motion:reduce){.logo-composite-progress:before{animation:none}}

.ai-studio .logo-composite-preview{display:block;width:100%;max-width:560px;height:auto;margin:18px auto;border-radius:12px}

/* Customer lettering layer (story-text-layer.js). The stage is a size container so the text size in cqw matches the PNG. */
.text-editor{margin:20px 0;padding:20px;border:1px solid #d5dbce;border-radius:16px;background:#f8f8f3}
.text-editor h4{margin:0 0 10px}.text-editor p{font-size:14px;line-height:1.7}
.text-editor-workspace{display:grid;grid-template-columns:minmax(0,1fr) minmax(130px,.65fr);align-items:center;gap:18px;margin:14px 0}
.text-editor-stage{position:relative;container-type:inline-size;width:min(100%,360px);margin:0 auto;overflow:hidden;border:1px solid #e0e1d9;border-radius:12px;background:#f1eee7;line-height:0}
.text-editor .text-editor-base{display:block;width:100%;height:auto;margin:0;border-radius:0;user-select:none}
.text-editor-item{position:absolute;transform:translate(-50%,-50%);color:#fff;line-height:1.25;white-space:pre;text-align:center;text-shadow:0 .03em .08em rgba(40,40,40,.35);cursor:grab;touch-action:none;user-select:none;outline:1px dashed rgba(82,97,68,.8);outline-offset:3px}
.text-editor-item:focus-visible{outline:3px solid #526144;outline-offset:5px}.text-editor-item:active{cursor:grabbing}
.text-editor-controls{display:grid;gap:12px;min-width:0}.text-editor-control{display:grid;gap:6px;font-size:14px}
.text-editor-control input{width:100%;accent-color:#59654a}.text-editor-control select{min-height:40px;padding:6px 10px;border:1px solid #cbd3bf;border-radius:8px;background:#fff;font:inherit}
@media(max-width:620px){.text-editor{padding:12px}.text-editor-workspace{grid-template-columns:minmax(0,1fr);gap:10px}.text-editor-stage{width:min(100%,260px)}.text-editor-control{font-size:12px}}
/* Lettering placed on the logo editor's design (story-ai-studio.js renderPlacement): the stage sizes the words in cqw,
   and the size and font controls sit right under the design. */
.logo-editor-stage{container-type:inline-size}
.text-editor.is-attached{margin:0 0 12px;padding:14px 16px;background:#fff}
.text-editor.is-attached h4{margin:0 0 4px}.text-editor.is-attached p{margin:0 0 10px}
.text-editor.is-attached .text-editor-controls{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));align-items:end}
/* Large refine view (story-ai-studio.js openRefine): the design big on the left, words, lettering and logo on the right. */
.studio-refine-open{font-weight:600}
.refine-dialog{width:min(1180px,calc(100vw - 32px));max-width:none;max-height:calc(100vh - 32px);padding:0;border:0;border-radius:20px;background:#f7f6f2;color:inherit;box-shadow:0 24px 80px rgba(30,32,26,.28);overflow:hidden}
.refine-dialog::backdrop{background:rgba(30,32,26,.45)}
.refine-layout{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(320px,.85fr);height:min(760px,calc(100vh - 32px))}
.refine-preview{display:flex;align-items:center;justify-content:center;min-width:0;padding:32px;background:#efefee}
.refine-preview .logo-editor-stage{width:min(100%,calc((100vh - 120px) * var(--logo-image-aspect,1)));max-width:640px;margin:0;border:0;border-radius:12px;background:#efefee}
.refine-preview .logo-editor-base{display:block;width:100%;height:auto;margin:0;border-radius:0;user-select:none}
.refine-preview .logo-editor-overlay{position:absolute;max-width:none;height:auto;margin:0;transform:translate(-50%,-50%);border-radius:0;cursor:grab;touch-action:none;user-select:none;outline:1px dashed #526144;outline-offset:3px}
.refine-panel{display:flex;flex-direction:column;gap:14px;min-width:0;padding:32px;overflow:auto}
.refine-panel h3{margin:0;font-size:22px}
.refine-lead,.refine-help{margin:0;color:#6e7566;font-size:14px;line-height:1.6}
.refine-field{display:grid;gap:8px;font-weight:600}
.refine-field textarea{width:100%;min-height:58px;padding:14px 16px;border:1px solid #d5dbce;border-radius:10px;background:#fff;font:inherit;font-size:20px;font-weight:400;line-height:1.4;resize:vertical}
.refine-field textarea:focus{outline:2px solid #526144;outline-offset:1px}
.refine-controls>.muted{margin:0}
.refine-controls .logo-editor,.refine-controls .text-editor{margin:0 0 12px;padding:14px 16px;background:#fff}
.refine-controls .logo-editor-workspace{display:block;margin:8px 0}
.refine-controls .logo-editor-controls{grid-template-columns:minmax(0,1fr)}
.refine-controls .logo-editor-original{display:none}
.refine-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:auto;padding-top:14px;border-top:1px solid #e3e5dc}
@media(max-width:760px){
  .refine-dialog{width:100vw;height:100dvh;max-height:100dvh;margin:0;border-radius:0;overflow:auto}
  .refine-layout{grid-template-columns:minmax(0,1fr);height:auto}
  .refine-preview{position:sticky;top:0;z-index:2;padding:12px}
  .refine-preview .logo-editor-stage{width:min(100%,calc(40vh * var(--logo-image-aspect,1)))}
  .refine-panel{padding:18px;overflow:visible}
}
