.text-studio-entry{padding:14px;border:1px solid #d5ddcc;border-radius:12px;margin:14px 0;background:#f1f4e9}.text-studio-entry>button:first-child{width:100%;min-height:44px;background:#304133;color:#fff;border:0;border-radius:8px;font-weight:650}.text-studio-entry p{margin:8px 0 0}.text-studio-dialog{width:min(1080px,calc(100vw - 24px));max-width:none;max-height:calc(100dvh - 24px - env(safe-area-inset-bottom));overflow:auto;padding:0;border:1px solid #ccd5c3;border-radius:20px;background:#fdfdf8;color:#26352b}.text-studio-dialog::backdrop{background:rgba(20,32,23,.65)}.studio-header{padding:20px 24px 12px;display:flex;justify-content:space-between;gap:16px}.studio-header h2{font-family:Georgia,serif;font-size:28px;font-weight:500;margin:4px 0}.studio-header p{margin:4px 0;font-size:13px;color:#56634e}.studio-note{margin:0;padding:0 24px 16px;color:#52614a;font-size:13px;line-height:1.5}.studio-layout{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(280px,.85fr);gap:24px;padding:0 24px 20px}.studio-preview{min-width:0;align-self:start;position:sticky;top:12px}.studio-artboard{position:relative;width:fit-content;max-width:100%;margin:0 auto;background:#e4e8df;box-shadow:0 4px 22px #20302315;line-height:0}.studio-artboard canvas{display:block;max-width:100%;height:auto;max-height:56dvh;object-fit:contain;width:auto}.studio-overlays{position:absolute;inset:0;pointer-events:none;overflow:visible}.studio-box-handle{position:absolute;pointer-events:auto;touch-action:none;background:transparent!important;border:1px dashed #344e38!important;border-radius:2px!important;min-height:0!important;padding:0!important;min-width:0!important;outline-offset:4px;color:#fff;box-shadow:0 0 0 1px #ffffffa0}.studio-box-handle[aria-pressed=true]{border:2px solid #345e40!important}.studio-handle-label{position:absolute;left:0;top:0;transform:translate(-1px,-100%);background:#304c35;color:#fff;border-radius:4px 4px 0 0;padding:3px 6px;font-size:12px;line-height:1.2}.studio-resize{position:absolute;width:44px;height:44px;right:-22px;bottom:-22px;cursor:nwse-resize;touch-action:none}.studio-resize:after{content:'';position:absolute;width:13px;height:13px;border:2px solid #fff;background:#345e40;border-radius:3px;left:14px;top:14px;box-shadow:0 0 0 1px #345e40}.studio-overlays.guide-x:before,.studio-overlays.guide-y:after{content:'';position:absolute;pointer-events:none;border-color:#2d715db0;border-style:dashed;z-index:0}.studio-overlays.guide-x:before{left:50%;top:0;bottom:0;border-width:0 0 0 1px}.studio-overlays.guide-y:after{top:50%;left:0;right:0;border-width:1px 0 0}.studio-preview p{font-size:12px;line-height:1.5;color:#52614a;margin:12px 0}.studio-preview #studio-status{min-height:36px}.studio-nudge{display:flex;align-items:center;justify-content:center;gap:5px;font-size:12px;color:#52614a}.studio-nudge button{min-height:44px;min-width:44px}.studio-controls{min-width:0}.studio-controls label{display:flex;flex-direction:column;gap:7px;font-size:13px;font-weight:550;color:#384b37;margin:12px 0}.studio-controls textarea,.studio-controls select,.studio-controls input[type=number]{box-sizing:border-box;width:100%;min-height:44px;border:1px solid #cbd3c4;background:#fffefa;color:#293c2d;border-radius:8px;padding:9px 10px;font:inherit}.studio-controls textarea{resize:vertical}.studio-controls input[type=color]{width:100%;height:44px;border:1px solid #cbd3c4;border-radius:8px;padding:3px}.studio-controls input[type=range]{width:100%;min-height:30px;accent-color:#3a5b40}.studio-controls input[type=checkbox]{accent-color:#3a5b40;width:18px;height:18px;flex-shrink:0}.studio-two,.studio-three{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.studio-three{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.studio-type-row{display:flex;gap:12px;align-items:center;flex-wrap:wrap}.studio-type-row label{flex-direction:row;align-items:center;gap:5px;font-weight:400}.studio-type-row label:last-child{flex:1;min-width:110px;flex-direction:column;align-items:stretch}.studio-controls .studio-check{flex-direction:row;align-items:center;flex-wrap:wrap;font-weight:400}.studio-check span{font-size:12px;color:#56634e}.studio-box-heading{display:flex;justify-content:space-between;gap:10px;font-size:14px}.studio-box-heading span{color:#586950;font-size:12px}.studio-box-list{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}.studio-box-tab{font-size:12px!important;min-height:38px!important;max-width:100%;overflow-wrap:anywhere}.studio-box-tab[aria-pressed=true]{background:#e3ebda!important;border-color:#536e46!important;color:#294029!important}.studio-box-actions{display:flex;gap:8px;flex-wrap:wrap}.studio-box-actions button{flex:1}.text-studio-dialog button{font-family:inherit;cursor:pointer;border:1px solid #c7d1bf;border-radius:8px;background:#f5f7ef;color:#30432f;font-size:13px;padding:9px 12px;min-height:44px}.text-studio-dialog button:disabled{opacity:.45;cursor:default}.text-studio-dialog .primary-button{background:#304133;color:white;border-color:#304133}.text-studio-dialog :is(button,input,textarea,select):focus-visible{outline:3px solid #577b4d;outline-offset:3px}.studio-advanced{border-top:1px solid #dbe1d3;margin-top:14px;padding-top:12px}.studio-advanced summary{cursor:pointer;font-size:14px;min-height:32px}.studio-footer{position:sticky;bottom:0;z-index:3;display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 24px max(12px,env(safe-area-inset-bottom));background:#fdfdf8f5;border-top:1px solid #dce3d4}.studio-footer>div{display:flex;gap:8px}.studio-demo{position:fixed;inset:12px auto auto 50%;transform:translateX(-50%);z-index:15;max-height:calc(100dvh - var(--tour-clearance,440px) - 24px);overflow:auto}.studio-demo .studio-footer,.studio-demo .studio-nudge{display:none}.studio-demo .studio-artboard canvas{max-height:30dvh}
@media(max-width:760px),(max-height:500px){.text-studio-dialog{width:calc(100vw - 12px);max-height:calc(100dvh - 12px - env(safe-area-inset-bottom));border-radius:14px}.studio-header{padding:14px 16px 8px}.studio-note{padding:0 16px 12px}.studio-layout{grid-template-columns:1fr;gap:16px;padding:0 16px 16px}.studio-preview{position:static}.studio-artboard canvas{max-height:38dvh}.studio-controls :is(input,textarea,select){font-size:16px}.studio-controls label{font-size:14px}.studio-footer{padding-left:12px;padding-right:12px;flex-wrap:wrap}.studio-footer>div{margin-left:auto}.studio-box-tab{min-height:44px!important}.studio-three{grid-template-columns:repeat(3,minmax(0,1fr))}.studio-demo{max-height:calc(100dvh - var(--tour-clearance,440px) - 24px)}.studio-demo .studio-layout{grid-template-columns:1fr}.studio-demo .studio-controls{display:none}.studio-demo .studio-artboard canvas{max-height:20dvh}}
@media(max-height:360px){.studio-artboard canvas{max-height:60dvh}.studio-footer{position:static}.studio-header h2{font-size:22px}.studio-demo{display:none!important}}
@media(prefers-reduced-motion:reduce){.text-studio-dialog *{scroll-behavior:auto!important;transition:none!important}}
/* Use the actual visible keyboard viewport and the measured tour height. */
.text-studio-dialog{max-height:calc(var(--visible-height,100dvh) - 24px - env(safe-area-inset-bottom))}
.demo-active #text-studio[open]:not(:modal){top:max(8px,env(safe-area-inset-top));bottom:auto;min-height:0;max-height:max(0px,calc(var(--visible-height,100dvh) - var(--tour-clearance,440px) - 24px - env(safe-area-inset-top)));z-index:35;margin:0;left:50%;right:auto}
body.preview-short .studio-preview{position:static}body.preview-short .studio-artboard canvas{max-height:calc(var(--visible-height,100dvh) * .38)}body.preview-short .studio-controls :is(input,textarea,select){font-size:16px}body.preview-tiny .studio-footer{position:static}body.preview-tiny .text-studio-dialog{max-height:calc(var(--visible-height,100dvh) - 8px);border-radius:8px}
.studio-controls output{font-variant-numeric:tabular-nums;font-size:12px;color:#52614a}
.studio-header>div{min-width:0}.studio-header #studio-close{min-width:44px;flex-shrink:0}.studio-header #studio-scope,#studio-dimensions{overflow-wrap:anywhere}.studio-header #studio-title:focus{outline:none}
.text-studio-dialog:modal{position:fixed;top:calc(var(--visible-offset-top,0px) + max(8px,env(safe-area-inset-top)));bottom:auto;left:50%;right:auto;transform:translateX(-50%);margin:0;max-height:calc(var(--visible-height,100dvh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
body.preview-keyboard .studio-footer{position:static}body.preview-keyboard .studio-preview{position:static}
.text-studio-dialog .studio-footer{margin:0;max-width:none}.text-studio-dialog{scroll-padding-bottom:90px}.studio-controls :is(input,textarea,select,button){scroll-margin-block:20px 100px}body.preview-keyboard .text-studio-dialog{scroll-padding-bottom:12px}
/* Playback already carries the explanation; keep the studio demonstration visual. */
.studio-demo .studio-header{padding:8px 12px 0;align-items:center}.studio-demo .studio-header h2{font-size:18px;margin:0}.studio-demo .studio-header .eyebrow,.studio-demo #studio-scope,.studio-demo .studio-note,.studio-demo .studio-controls,.studio-demo #studio-status{display:none}.studio-demo .studio-layout{display:block;padding:4px 12px 10px}.studio-demo #studio-dimensions{margin:6px 0;font-size:11px}#text-studio.studio-demo .studio-artboard canvas{max-height:min(28dvh,max(30px,calc(var(--visible-height,100dvh) - var(--tour-clearance,440px) - 110px)))}
/* Editing view: photo and actions stay put; only the settings pane scrolls.
   Scoped to modal editing so the isolated playback presentation is unchanged. */
.text-studio-dialog:modal{display:flex;flex-direction:column;box-sizing:border-box;height:calc(var(--visible-height,100dvh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overflow:hidden;scroll-padding:0}
.text-studio-dialog:modal .studio-header{flex:0 0 auto;padding:14px 20px 10px;align-items:center;border-bottom:1px solid #d7dfcf;background:#f0f4e8}
.text-studio-dialog:modal .studio-header h2{font-size:25px}.text-studio-dialog:modal #studio-scope{max-height:3em;overflow:auto;font-size:12px;line-height:1.5}
.text-studio-dialog:modal .studio-layout{flex:1 1 auto;min-height:0;grid-template-columns:minmax(0,1.1fr) minmax(280px,.9fr);gap:20px;padding:18px 20px 12px;overflow:hidden}
.text-studio-dialog:modal .studio-preview{position:relative;top:auto;align-self:stretch;min-height:0;display:flex;flex-direction:column;justify-content:center;gap:10px;padding:12px;background:#edf2e6;border:1px solid #d5dfcd;border-radius:12px;overflow:hidden}
.text-studio-dialog:modal .studio-artboard{flex:0 1 auto;min-height:0;max-height:calc(100% - 46px);display:flex;align-items:center;justify-content:center}
.text-studio-dialog:modal .studio-artboard canvas{max-height:calc(var(--visible-height,100dvh) - 230px);max-width:100%;object-fit:contain}
.text-studio-dialog:modal #studio-dimensions{flex:0 0 auto;margin:0;font-size:12px;text-align:center;line-height:1.5;max-height:3em;overflow:auto}
.text-studio-dialog:modal .studio-controls{min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 8px 16px 4px;scroll-padding-block:12px 24px}
.text-studio-dialog:modal .studio-controls:focus-visible{outline:2px solid #577b4d;outline-offset:-2px}
.text-studio-dialog:modal .studio-note{padding:0;margin:0 0 12px;font-size:12px;line-height:1.5}
.text-studio-dialog:modal #studio-status{font-size:12px;line-height:1.5;color:#52614a;margin:0 0 10px}.text-studio-dialog:modal #studio-status.error{color:#8b3030}
.text-studio-dialog:modal .studio-nudge{justify-content:flex-start;flex-wrap:wrap;margin-bottom:16px}.text-studio-dialog:modal .studio-box-heading{padding-top:8px;border-top:1px solid #d7dfcf}
.text-studio-dialog:modal .studio-footer{position:relative;flex:0 0 auto;min-height:0;padding:10px 16px max(10px,env(safe-area-inset-bottom));background:#f7f9f1;gap:8px;flex-wrap:nowrap}
.text-studio-dialog:modal .studio-footer button{font-size:12px;padding:9px 10px;white-space:normal}.text-studio-dialog:modal .studio-footer>div{flex-shrink:0;gap:6px}
.text-studio-dialog:modal .studio-controls :is(input,textarea,select,button){scroll-margin-block:12px}
@media(max-width:760px){.text-studio-dialog:modal .studio-header{padding:8px 12px}.text-studio-dialog:modal .studio-header .eyebrow{display:none}.text-studio-dialog:modal .studio-header h2{font-size:21px}.text-studio-dialog:modal .studio-layout{grid-template-columns:1fr;grid-template-rows:minmax(80px,30%) minmax(0,1fr);padding:10px 12px 8px;gap:10px}.text-studio-dialog:modal .studio-preview{padding:8px;gap:5px}.text-studio-dialog:modal .studio-artboard{max-height:calc(100% - 22px)}.text-studio-dialog:modal .studio-artboard canvas{max-height:calc((var(--visible-height,100dvh) - 180px) * .3 - 32px);min-height:0}.text-studio-dialog:modal #studio-dimensions{font-size:11px;max-height:1.5em}.text-studio-dialog:modal .studio-controls{padding-right:4px}.text-studio-dialog:modal .studio-footer{padding:8px 10px max(8px,env(safe-area-inset-bottom))}}
/* Short/keyboard windows use a compact side-by-side photo and options.
   Even at narrow widths, the actual photo remains visible beside the fields. */
@media(max-height:500px){.text-studio-dialog:modal .studio-header{padding:4px 10px}.text-studio-dialog:modal .studio-header .eyebrow,.text-studio-dialog:modal #studio-scope{display:none}.text-studio-dialog:modal .studio-header h2{font-size:20px}.text-studio-dialog:modal .studio-layout{grid-template-columns:minmax(76px,.35fr) minmax(0,.65fr);grid-template-rows:minmax(0,1fr);padding:6px 8px;gap:8px}.text-studio-dialog:modal .studio-artboard canvas{max-height:calc(var(--visible-height,100dvh) - 155px)}.text-studio-dialog:modal .studio-preview{padding:5px}.text-studio-dialog:modal .studio-two,.text-studio-dialog:modal .studio-three{grid-template-columns:1fr}.text-studio-dialog:modal .studio-controls :is(input,textarea,select){font-size:16px}.text-studio-dialog:modal .studio-footer{padding-top:4px;padding-bottom:4px}}
body.preview-short .text-studio-dialog:modal .studio-header{padding:4px 10px}body.preview-short .text-studio-dialog:modal .studio-header .eyebrow,body.preview-short .text-studio-dialog:modal #studio-scope{display:none}body.preview-short .text-studio-dialog:modal .studio-header h2{font-size:20px}body.preview-short .text-studio-dialog:modal .studio-layout{grid-template-columns:minmax(76px,.35fr) minmax(0,.65fr);grid-template-rows:minmax(0,1fr);padding:6px 8px;gap:8px}body.preview-short .text-studio-dialog:modal .studio-artboard canvas{max-height:max(30px,calc(var(--visible-height,100dvh) - 155px))}body.preview-short .text-studio-dialog:modal .studio-preview{padding:5px}body.preview-short .text-studio-dialog:modal .studio-two,body.preview-short .text-studio-dialog:modal .studio-three{grid-template-columns:1fr}body.preview-short .text-studio-dialog:modal .studio-footer{position:relative;padding-top:4px;padding-bottom:4px}
/* Extremely small keyboard view: Cancel/Apply remain in the footer; reclaim
   the duplicate header so the real photo and a field can still share the view. */
body.preview-tiny .text-studio-dialog:modal .studio-header{display:none}body.preview-tiny .text-studio-dialog:modal .studio-layout{padding:4px 6px;gap:6px}body.preview-tiny .text-studio-dialog:modal .studio-artboard canvas{max-height:max(30px,calc(var(--visible-height,100dvh) - 95px))}body.preview-tiny .text-studio-dialog:modal #studio-dimensions{display:none}
/* The canvas fits the actual allocated grid cell, including keyboard/safe-area
   changes. Intrinsic aspect stays intact; overlay mapping measures that canvas. */
#text-studio:modal .studio-preview{display:grid;grid-template-rows:minmax(0,1fr) auto;align-items:center;justify-content:stretch}
#text-studio:modal .studio-artboard{width:100%;height:100%;min-width:0;min-height:0;max-height:none;display:flex;align-items:center;justify-content:center;box-shadow:none;background:transparent}
#text-studio:modal .studio-artboard canvas{width:auto;height:auto;min-width:0;min-height:0;max-width:100%;max-height:100%;flex:0 1 auto;object-fit:contain;box-shadow:0 4px 22px #20302315}
.text-studio-dialog .studio-advanced>summary{min-height:44px;display:flex;align-items:center}
