:root{color-scheme:light;--paper:#faf6ef;--ink:#392820;--muted:#69554a;--line:#deccbe;--cta:#633a3e;font:17px/1.55 system-ui,sans-serif;color:var(--ink);background:var(--paper)}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0}
button,input,textarea,select{font:inherit;color:inherit}
button{min-height:46px;cursor:pointer;border:1px solid var(--line);background:#fffaf4;border-radius:999px;padding:8px 17px}
button:hover{background:#f3e7dc}
:focus-visible{outline:3px solid #815461;outline-offset:3px}
.bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px max(16px,calc((100vw - 1100px)/2));border-bottom:1px solid var(--line)}
.brand{display:flex;align-items:center;gap:8px;font-size:25px;letter-spacing:-.06em;font-weight:650}
.brand img{width:34px;height:34px;object-fit:contain}
#download-card,#blow{background:var(--cta);color:#fff;border-color:var(--cta)}
main{width:min(1100px,calc(100% - 32px));margin:0 auto;padding-bottom:32px}
.intro{text-align:center;margin:23px auto 16px}
h1,h2{font-family:Georgia,serif;font-weight:400;line-height:1.13;margin:0}
h1{font-size:clamp(33px,5vw,60px);letter-spacing:-.045em}
.intro p{margin:8px 0;color:var(--muted)}
.choices{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;margin-bottom:23px}
.choices [aria-pressed=true]{background:#ead9cc;border-color:#9c7664;font-weight:650}
.workspace{display:grid;grid-template-columns:minmax(0,1.38fr) minmax(290px,1fr);gap:24px;align-items:start}
.card{--base:#f9e0df;--glow:#fff6ee;--text:#532634;--stroke:#a9616e;min-width:0;position:relative;isolation:isolate;border-radius:8px;background:radial-gradient(ellipse at 50% 25%,var(--glow),var(--base) 84%);color:var(--text);text-align:center;box-shadow:0 14px 40px #4b312019;padding:clamp(24px,5vw,48px) clamp(22px,4vw,43px)}
.card[data-palette="1"]{--base:#dfe9dd;--glow:#f6f7ed;--text:#293e31;--stroke:#62816c}
.card[data-palette="2"]{--base:#eee0ce;--glow:#fffaf0;--text:#523628;--stroke:#9e755a}
.card::before{content:"";pointer-events:none;position:absolute;inset:10px;border:1px solid var(--frame-color,var(--stroke));border-radius:4px}
.card[data-frame=double]::before{border:4px double var(--frame-color,var(--stroke))}
.card[data-frame=none]::before{display:none}
.scene{position:relative;width:min(100%,340px);margin:0 auto 17px}
.art{display:block;width:100%;aspect-ratio:1.2;object-fit:contain}
.flames{display:none;position:absolute;inset:0;pointer-events:none}
.card[data-kind=cake]:not(.blown) .flames{display:block}
.flames i{position:absolute;left:var(--x);top:var(--y);width:3%;height:7%;border-radius:60% 40% 55% 50%;background:radial-gradient(ellipse at 50% 70%,#fffde8 12%,#ffce65 44%,#ef7032 83%);box-shadow:0 0 12px #ffaa57;transform-origin:50% 100%;transform:translate(-50%,-100%);animation:flicker 1.1s alternate infinite}
.flames i:nth-child(2){animation-delay:-.4s}
.flames i:nth-child(3){animation-delay:-.75s}
@keyframes flicker{to{transform:translate(-50%,-100%) rotate(6deg) scale(.8,1.08)}}
.photo{margin:5px auto 24px;padding:9px;background:#fffdf9;width:min(100%,300px);box-shadow:0 7px 16px #4533292c;transform:rotate(-2deg)}
.photo img{display:block;width:100%;aspect-ratio:4/3;object-fit:cover}
.photo figcaption{font-size:16px;padding:5px}
.occasion{font-size:16px;letter-spacing:.10em;text-transform:uppercase;margin:0 0 8px}
.letter h2{font-size:clamp(35px,6vw,64px);overflow-wrap:break-word;letter-spacing:-.04em}
#wish,#signature{white-space:pre-wrap;overflow-wrap:break-word}
#wish{font-size:18px;margin:14px auto 0;max-width:36ch}
#signature{margin:17px 0 0;font-weight:650}
#blow{margin-top:20px}
.editor{background:#fffaf4;border:1px solid var(--line);border-radius:16px;padding:21px}
.editor h2{font-size:27px;margin-bottom:16px}
form{display:grid;gap:13px}
label{display:grid;gap:4px;font-weight:600}
input,textarea,select{width:100%;min-width:0;background:#fffdf9;border:1px solid #a88e7f;border-radius:8px;padding:8px 11px;min-height:45px;font-weight:400}
textarea{resize:vertical}
fieldset{border:0;padding:0;margin:0}
legend{padding:0;margin-bottom:4px;font-weight:600}
.save-note,#photo-error{color:var(--muted);margin:0;font-size:16px}
#photo-controls button{margin-top:8px}
.credit{text-align:center;font-size:14px;margin-top:32px}
.credit a{color:#665247}
.preview .workspace{display:block;max-width:610px;margin:26px auto}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
@media(max-width:700px){.workspace{display:flex;flex-direction:column;gap:14px}.workspace>*,.editor{width:100%}.editor{padding:16px}.scene{width:min(100%,275px)}.intro{margin-top:18px}.choices{margin-bottom:16px}.card{padding-block:25px}}
@media(prefers-reduced-motion:reduce){.flames i{animation:none}}
.card[data-kind=cake] .art{aspect-ratio:711/650}
.flames i:nth-child(1){--x:39.8%;--y:4.5%}
.flames i:nth-child(2){--x:50%;--y:5.5%}
.flames i:nth-child(3){--x:60.4%;--y:5.4%}
.card[data-kind=bouquet] .scene{width:min(100%,320px)}
.card[data-kind=bouquet] .art{aspect-ratio:1.08}

/* Local Cyrillic display faces; functional text keeps the system face. */
@font-face{font-family:PostcardPoster;src:url("../../fonts/chrome-unbounded.ttf") format("truetype");font-display:swap;font-weight:100 900}
@font-face{font-family:PostcardRound;src:url("../../fonts/nunito-black.ttf") format("truetype");font-display:swap;font-weight:900}
@font-face{font-family:PostcardHand;src:url("../../fonts/lemon-signature.ttf") format("truetype");font-display:swap}
.card[data-palette="3"]{--base:#1b32a2;--glow:#2c49c8;--text:#fff5cf;--stroke:#ffe590}
.card[data-palette="4"]{--base:#f0e6cd;--glow:#fffaf0;--text:#33402b;--stroke:#776b48}
.card[data-palette="5"]{--base:#e6d6ef;--glow:#fff4fa;--text:#492d4c;--stroke:#886795}
.paper-ornament{display:none}
.card[data-kind=poster]{overflow:hidden;padding:clamp(27px,5vw,52px) clamp(22px,5vw,62px) clamp(34px,6vw,65px)}
.card[data-kind=poster] .letter{position:relative;padding:clamp(25px,6vw,54px) clamp(16px,3vw,28px);background:var(--glow);border-radius:48% 48% 7px 7px / 13% 13% 7px 7px;box-shadow:0 4px 20px #1f174440}
.card[data-kind=poster] .paper-ornament{display:block;position:absolute;inset:0;z-index:-1;background:repeating-linear-gradient(117deg,transparent 0 14px,#e9b96455 14px 22px),radial-gradient(circle at center,transparent 30%,var(--base))}
.card[data-kind=poster] .occasion{letter-spacing:.14em;padding-bottom:17px;border-bottom:1px solid currentColor;margin-bottom:18px}
.card[data-kind=poster] h2{font-family:PostcardPoster,sans-serif;font-weight:850;font-size:clamp(29px,5vw,58px);letter-spacing:-.07em;text-transform:uppercase;line-height:1.06}
.card[data-kind=poster] #signature{display:inline-block;padding:5px 14px;border:1px solid currentColor;border-radius:99px}
.card[data-kind=herbarium]{background:repeating-linear-gradient(0deg,#83613408 0 1px,transparent 1px 5px),radial-gradient(ellipse at 50% 25%,var(--glow),var(--base) 84%)}
.card[data-kind=herbarium] .art{aspect-ratio:2}
.card[data-kind=herbarium] .occasion{letter-spacing:.13em}
.card[data-kind=herbarium] h2{font-family:PostcardHand,Georgia,serif;font-size:clamp(42px,7vw,76px)}
.card[data-kind=herbarium] #signature{font-family:Georgia,serif;font-style:italic}
.card[data-kind=album]{background:radial-gradient(circle,#80518435 1px,transparent 1.4px) 0 0/13px 13px,radial-gradient(ellipse at 50% 25%,var(--glow),var(--base) 84%)}
.card[data-kind=album] .letter{position:relative;background:var(--glow);padding:18px 14px 20px;border-radius:5px;box-shadow:2px 4px 0 #62365b25}
.card[data-kind=album] .photo{position:relative;transform:rotate(-4deg);box-shadow:8px 8px 0 #8a609d70,0 6px 16px #4533292c}
.card[data-kind=album] .photo::before{content:"";position:absolute;z-index:1;width:38%;height:22px;top:-9px;left:31%;transform:rotate(7deg);background:repeating-linear-gradient(120deg,#e1b569df 0 5px,#f6d69be8 5px 10px)}
.card[data-kind=album] h2{font-family:PostcardRound,sans-serif;font-weight:900;font-size:clamp(30px,4.8vw,52px);letter-spacing:-.055em}
.card[data-type=serif] #recipient{font-family:Georgia,serif;font-weight:400;text-transform:none;letter-spacing:-.04em}
.card[data-type=hand] #recipient{font-family:PostcardHand,Georgia,serif;font-weight:400;text-transform:none;letter-spacing:normal}
.card[data-type=bold] #recipient{font-family:PostcardPoster,sans-serif;font-weight:850;text-transform:uppercase;letter-spacing:-.07em;font-size:clamp(27px,4.8vw,53px)}
.card[data-type=rounded] #recipient{font-family:PostcardRound,sans-serif;font-weight:900;text-transform:none;letter-spacing:-.045em}
.advanced{border-block:1px solid var(--line);padding:8px 0}
.advanced summary{cursor:pointer;min-height:44px;display:list-item;align-content:center;font-weight:650}
.advanced label{margin:8px 0}
.check{display:flex;align-items:center;gap:8px;min-height:44px}
.check input{width:20px;height:20px;min-height:0}
#image-fit{margin-top:8px}
.card:not(.original-cake) .flames,.card.quiet .flames{display:none}
.card.quiet.original-cake:not(.blown) .flames{display:block}
.card.quiet .flames i{animation:none}
.card[data-align=start] .letter{text-align:start}
.card[data-align=start] #wish{margin-inline-start:0}
.card[data-body-type=serif] #wish{font-family:Georgia,serif}
.card[data-scale=small] #recipient{font-size:clamp(25px,4vw,42px)}
.card[data-scale=large] #recipient{font-size:clamp(39px,7vw,76px)}
.card[data-shape=square]{min-height:min(82vw,550px);align-content:center}
.card[data-shape=portrait]{min-height:min(116vw,700px);align-content:center}
.card[data-layout=bottom]{display:flex;flex-direction:column;justify-content:center}
.card[data-layout=bottom] .scene{order:2;margin-top:24px;margin-bottom:0}
.card[data-fit=contain] .photo img{object-fit:contain}
@media(min-width:601px){
 .card.has-art[data-layout=side]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);gap:20px;align-items:center}
 .card.has-art[data-layout=side] .scene{margin:0}
 .card.has-art[data-layout=side] #recipient{font-size:clamp(25px,3vw,42px)}
}
.card[data-palette="6"]{--base:#272335;--glow:#393144;--text:#fff2d3;--stroke:#d0b377}
.card[data-palette="7"]{--base:#fbdcba;--glow:#fff1dc;--text:#512e3c;--stroke:#ae695e}
.card[data-kind=telegram]{background:repeating-linear-gradient(135deg,#ad675b 0 12px,#fcf2df 12px 24px,#436b78 24px 36px,#fcf2df 36px 48px);padding:18px}
.card[data-kind=telegram] .letter{background:var(--glow);padding:32px 25px}
.card[data-kind=telegram] .occasion{border-bottom:1px dashed currentColor;padding-bottom:12px;margin-bottom:16px}
.card[data-kind=telegram] .scene{background:var(--glow);margin-bottom:0;padding-top:12px}
.card[data-kind=midnight]{padding-block:65px;background:repeating-radial-gradient(ellipse at 50% 0%,transparent 0 14px,#b9945144 15px 16px,transparent 17px 21px),var(--base)}
.card[data-kind=midnight] .letter{background:var(--glow);padding:24px 14px;border-radius:48% 48% 8px 8px / 18% 18% 8px 8px}
.card[data-kind=confetti]{background:radial-gradient(circle at 10% 16%,#dc735c 3px,transparent 4px),radial-gradient(circle at 64% 27%,#8356ac 2px,transparent 3px),radial-gradient(circle at 76% 80%,#529085 3px,transparent 4px),var(--base);background-size:53px 47px,61px 59px,69px 67px;padding-block:48px}
.card[data-kind=confetti] .letter{background:var(--glow);padding:23px 14px;border:2px solid var(--stroke);border-radius:11px;box-shadow:6px 7px 0 var(--stroke)}
.card[data-kind=love]{padding-block:50px;background:repeating-linear-gradient(90deg,transparent 0 15px,#89556826 15px 16px),repeating-linear-gradient(0deg,transparent 0 15px,#89556826 15px 16px),var(--base)}
.card[data-kind=love] .letter{background:var(--glow);padding:25px 15px;border-radius:55% 55% 4px 4px / 15% 15% 4px 4px}
.card[data-kind=love] .occasion{border-bottom:1px solid currentColor;padding-bottom:11px}

/* A centred canvas with independent inspector blocks. */
main{width:min(1600px,calc(100% - 32px))}
.workspace{display:block;position:relative;padding-inline:320px}
.canvas-stage{width:min(100%,600px);margin:auto;position:sticky;top:20px}
.editor{position:absolute;top:0;right:0;width:296px;padding:0;background:none;border:0}
.editor>h2{font:600 18px system-ui;margin:0 0 12px}
.control-block{background:#fffaf4;border:1px solid var(--line);border-radius:12px;padding:12px 15px}
.control-block summary{font-weight:650;cursor:pointer;min-height:32px}
.control-block[open] summary{margin-bottom:12px}
.control-block label,.control-block fieldset{margin-top:12px}
.hint,#layer-status{font-size:16px;color:var(--muted);margin:7px 0}
.asset-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:12px 0}
.asset-grid button{border-radius:9px;padding:6px;font-size:16px;min-width:0}
.asset-grid img{width:100%;height:60px;object-fit:contain;display:block}
.control-block>button{margin-top:8px;width:100%}
.layer-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}
.layer-actions button{font-size:16px;padding:6px 9px}
select{appearance:none;padding-inline-end:44px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23523b31' stroke-width='1.5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 18px center}
[dir=rtl] select{background-position:left 18px center}
.card{overflow:hidden;min-height:580px}
.card .letter,.card .scene{position:relative;z-index:2}
#layer-canvas{position:absolute;inset:0;pointer-events:none}
.card-layer{position:absolute;transform:translate(-50%,-50%) rotate(var(--rotation));width:var(--size);left:var(--x);top:var(--y);opacity:var(--opacity);pointer-events:auto;touch-action:none;cursor:move;border:0;background:none;border-radius:0;padding:0;min-height:0;z-index:3;line-height:0}
.card-layer img{width:100%;display:block;pointer-events:none;user-select:none}
.card-layer:hover{background:none}
.card-layer.selected{outline:2px solid #91606d;outline-offset:5px}
.preview .card-layer{pointer-events:none;outline:none;cursor:default}
.preview .workspace{padding-inline:0}
.preview .canvas-stage{position:static}
@media(max-width:1150px){.workspace{padding-inline:0 314px}.canvas-stage{position:sticky}.card{padding-inline:26px}}
@media(max-width:760px){.workspace{display:flex;flex-direction:column;padding:0}.canvas-stage{position:static}.editor{position:static;width:100%}.card{min-height:480px}.preview .workspace{display:block}.asset-grid{grid-template-columns:repeat(5,minmax(0,1fr))}}
.asset-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-block:12px}
.asset-grid button{display:grid;justify-items:center;font-size:16px;border-radius:8px;padding:8px;gap:5px}
.asset-grid img{width:75px;height:65px;object-fit:contain}
.layer-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}
.layer-actions button{font-size:16px;padding:6px 10px}
input[type=range]{padding:0;accent-color:#633a3e}
@media(min-width:1151px){.workspace{display:grid;grid-template-columns:296px minmax(0,1fr) 296px;gap:24px;padding:0}.canvas-stage{grid-column:2;align-self:start}.editor{grid-column:3;position:static;width:100%}}
@media(min-width:761px) and (max-width:1150px){.workspace{display:grid;grid-template-columns:minmax(0,1fr) 296px;gap:18px;padding:0}.canvas-stage{align-self:start}.editor{position:static;width:100%}}
.image-tools{position:absolute;z-index:8;display:flex;flex-wrap:wrap;justify-content:center;gap:3px;width:188px;transform:translateX(-50%);padding:4px;background:#fffdf9;border:1px solid #c7a8ad;border-radius:10px;box-shadow:0 3px 14px #462c3426;pointer-events:auto}
.image-tools button{width:56px;height:44px;min-height:44px;padding:10px;border:0;border-radius:6px;background:#fffdf9;touch-action:none}
.image-tools button:hover{background:#efe2e5}
.image-tools svg{width:23px;height:23px;display:block;margin:auto}
.image-tools button:nth-child(1),.image-tools button:nth-child(2){border:1px solid #c7a8ad}
.preview .image-tools{display:none}
.card-layer.selected{outline:2px solid #91606d;outline-offset:3px}
.card-layer.selected::after{content:"";position:absolute;inset:-5px;border:2px solid #fff;pointer-events:none}
.change-main{position:absolute;top:14px;right:14px;z-index:7;display:flex;gap:6px;align-items:center;font-size:16px;padding:7px 11px;min-height:44px;background:#fffaf4f2;box-shadow:0 2px 10px #462c341a}
.change-main svg{width:20px;height:20px}
.preview .change-main{display:none}
#main-image-dialog{width:min(540px,calc(100% - 28px));max-height:85dvh;overflow:auto;border:1px solid #deccbe;border-radius:18px;padding:23px;background:#fffaf4;color:#392820;font:17px/1.5 system-ui}
#main-image-dialog::backdrop{background:#271c205c}
.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:20px}
.dialog-head h2{font-size:29px}
#main-image-dialog>button{margin:5px}
#main-image-dialog h3{font-size:18px}

/* Three independent work areas keep the canvas in view. */
.settings-panel{display:grid;gap:12px;align-content:start;min-width:0}
.settings-panel>h2{font:650 18px/1.4 system-ui;margin:0}
.editor,#editor-form{display:contents}
@media(min-width:961px){
 body:not(.preview){height:100dvh;overflow:hidden}
 body:not(.preview) main{height:calc(100dvh - 71px);display:flex;flex-direction:column;padding-bottom:14px}
 .intro{margin:12px 0 8px}
 h1{font-size:36px}
 .intro p{display:none}
 .choices{flex-wrap:nowrap;overflow-x:auto;justify-content:flex-start;flex-shrink:0;margin:0 0 12px;padding-bottom:5px}
 .choices button{white-space:nowrap;flex-shrink:0}
 .workspace{display:grid;grid-template-columns:minmax(240px,280px) minmax(0,1fr) minmax(240px,280px);gap:20px;padding:0;flex:1;min-height:0}
 .text-panel{grid-column:1;grid-row:1}
 .image-panel{grid-column:3;grid-row:1}
 .settings-panel{overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding-right:6px;padding-bottom:14px}
 .canvas-stage{grid-column:2;grid-row:1;position:static;align-self:start;max-height:100%;width:100%;margin:0 auto;overflow:auto;scrollbar-width:thin}
 .control-block{padding:10px 12px}
 .control-block label{margin-top:8px}
 .control-block[open] summary{margin-bottom:8px}
 textarea{min-height:90px}
 .preview main{display:block;height:auto}
 .preview .workspace{display:block;max-width:610px}
}
@media(max-width:960px){
 .workspace{display:flex;flex-direction:column;padding:0;gap:18px}
 .canvas-stage{position:static;width:min(100%,600px)}
 .settings-panel{width:100%}
}
@media(min-width:961px){
 body:not(.preview) .workspace{height:calc(100dvh - 210px);flex:none;grid-template-rows:minmax(0,1fr)}
 .settings-panel{min-height:0;height:100%}
 .canvas-stage{height:100%;overflow:hidden}
}
/* Stock cutouts sit directly on the card; author images retain their design. */
.card .photo.decorative-image{background:transparent;padding:0;box-shadow:none;transform:none}
.card .photo.decorative-image::before,.card .photo.decorative-image::after{display:none}
.card .photo.decorative-image img{aspect-ratio:auto;max-height:310px;object-fit:contain}
.card.free-main .scene{visibility:hidden;pointer-events:none}
body:not(.preview) #art,body:not(.preview) #photo-preview{cursor:move}
.preview #art,.preview #photo-preview{pointer-events:none}
/* Editor action colours are independent of the postcard palette. */
.card .change-main{color:#fffaf4;background:#633a3e;border:1px solid #fffaf4;box-shadow:0 2px 12px #24141c40}
.card .change-main:hover{color:#fffaf4;background:#49292e}
.card .change-main:focus-visible{outline:3px solid #fffaf4;outline-offset:2px;box-shadow:0 0 0 6px #633a3e}
.template-examples{position:relative;flex-shrink:0;margin-bottom:12px}
.template-examples>summary{cursor:pointer;width:max-content;margin:auto;font-size:16px;min-height:36px;align-content:center;color:#633a3e}
.template-examples[open] .choices{position:absolute;top:100%;left:50%;transform:translateX(-50%);width:min(760px,calc(100vw - 32px));z-index:15;display:flex;flex-wrap:wrap;justify-content:center;gap:8px;background:#fffaf4;border:1px solid #deccbe;border-radius:14px;padding:16px;box-shadow:0 8px 24px #39282026;margin:0}
.template-examples[open] .choices{gap:8px}
@media(min-width:961px){body:not(.preview) .workspace{height:calc(100dvh - 210px)}}
/* Editor tools keep their own foreground instead of inheriting the card theme. */
.image-tools{color:#392820;background:#fffdf9;border-color:#8b646d}
.image-tools button{color:#392820;background:#fffdf9;border:1px solid #b99ba2}
.image-tools button:hover{color:#fffaf4;background:#633a3e;border-color:#633a3e}
.image-tools button:focus-visible{outline:3px solid #633a3e;outline-offset:2px}
.image-tools svg{color:inherit;stroke:currentColor}
/* Floating controls live outside the clipped artboard and scaled canvas. */
body>.image-tools{position:fixed;z-index:100;transform:none}
.cake-library-art{position:relative;display:block;width:75px;line-height:0}
.asset-grid .cake-library-art img{width:100%;height:auto}
.cake-static-fire{position:absolute;inset:0;pointer-events:none}
.cake-static-fire i{position:absolute;width:3%;height:7%;transform:translate(-50%,-100%);border-radius:60% 40% 55% 50%;background:radial-gradient(ellipse at 50% 70%,#fffde8 12%,#ffce65 44%,#ef7032 83%);box-shadow:0 0 5px #ffaa57;animation:none}
.cake-static-fire i:nth-child(1){left:39.8%;top:4.5%}
.cake-static-fire i:nth-child(2){left:50%;top:5.5%}
.cake-static-fire i:nth-child(3){left:60.4%;top:5.4%}
/* Preview removes controls without changing the artboard's working geometry. */
@media(min-width:961px){
 body.preview{height:100dvh;overflow:hidden}
 body.preview main{height:calc(100dvh - 71px);display:flex;flex-direction:column;padding-bottom:14px}
 body.preview .intro[hidden]{display:block!important;visibility:hidden}
 body.preview .template-examples[hidden]{display:block!important;visibility:hidden}
 body.preview .workspace{display:grid;grid-template-columns:minmax(240px,280px) minmax(0,1fr) minmax(240px,280px);gap:20px;padding:0;height:calc(100dvh - 210px);flex:none;grid-template-rows:minmax(0,1fr);max-width:none;margin:0}
 body.preview .canvas-stage{grid-column:2;grid-row:1;position:static;width:100%;margin:0 auto;height:100%;overflow:visible}
}
@media(max-width:960px){
 body.preview .workspace{max-width:none;margin:0;display:flex}
 body.preview .canvas-stage{width:min(100%,600px)}
}
.card[data-palette="8"]{--base:#daeaf8;--glow:#f4f9ff;--text:#263d55;--stroke:#6b8aa7}
.card[data-palette="9"]{--base:#d9f0e8;--glow:#f4fcf8;--text:#244539;--stroke:#668b7b}
.card[data-palette="10"]{--base:#f6edbc;--glow:#fffce7;--text:#4a4026;--stroke:#9b8a4f}
.card[data-palette="11"]{--base:#ecd5dc;--glow:#fff1f5;--text:#563040;--stroke:#a16e80}
.card[data-palette="12"]{--base:#ad5748;--glow:#874236;--text:#fff8ee;--stroke:#f2c5ad}
.card[data-palette="13"]{--base:#632b3e;--glow:#78394c;--text:#fff2dc;--stroke:#d6ad8d}
.card[data-palette="14"]{--base:#23483d;--glow:#30594c;--text:#fff5dc;--stroke:#b8c49b}
.card[data-palette="15"]{--base:#205365;--glow:#2f6273;--text:#fff6df;--stroke:#aec6ca}
.card[data-palette="16"]{--base:#543b63;--glow:#654a76;--text:#fff3df;--stroke:#cbb4d5}
.card[data-palette="17"]{--base:#694b3e;--glow:#76574a;--text:#fff5e4;--stroke:#d8bda0}
.card[data-kind="blank"][data-palette="18"]{--base:#ffffff;--glow:#ffffff}
.card[data-palette="18"]{--base:#fffdf8;--glow:#ffffff;--text:#3d3029;--stroke:#a18b7d}
.card[data-palette="19"]{--base:#e2e3e5;--glow:#f6f6f7;--text:#34343d;--stroke:#85858d}
.card[data-type=modern] #recipient{font-family:Arial,Helvetica,sans-serif;font-weight:700;letter-spacing:-.04em;text-transform:none}
.card[data-type=book] #recipient{font-family:Palatino,"Palatino Linotype","Book Antiqua",Georgia,serif;font-weight:400;letter-spacing:-.025em;text-transform:none}
.card[data-type=italic] #recipient{font-family:Georgia,serif;font-weight:400;font-style:italic;letter-spacing:-.025em;text-transform:none}
.card[data-type=mono] #recipient{font-family:"Courier New",Courier,monospace;font-weight:700;letter-spacing:-.06em;font-size:clamp(28px,4.2vw,50px);text-transform:none}
.card[data-type=humanist] #recipient{font-family:"Trebuchet MS",Arial,sans-serif;font-weight:700;letter-spacing:-.04em;text-transform:none}
.card[data-type=classic] #recipient{font-family:"Times New Roman",Times,serif;font-weight:400;letter-spacing:0;text-transform:none}
.card[data-body-type=modern] #wish{font-family:Arial,Helvetica,sans-serif}
.card[data-body-type=mono] #wish{font-family:"Courier New",Courier,monospace}
.card[data-body-type=humanist] #wish{font-family:"Trebuchet MS",Arial,sans-serif}
body:not(.preview) .movable-text{cursor:move;touch-action:none;position:relative}
.selected-text{outline:2px solid #b18b97;outline-offset:5px}
.text-toolbar{position:fixed;z-index:101;display:flex;align-items:center;gap:5px;padding:5px;border:1px solid #8b646d;border-radius:10px;background:#fffdf9;color:#392820;box-shadow:0 3px 14px #39282026}
.text-toolbar button{font:600 16px/1.3 system-ui;min-width:44px;min-height:44px;padding:6px 10px;background:#fffdf9;color:#392820;border:1px solid #b99ba2;border-radius:6px}
.text-toolbar button:hover{background:#633a3e;color:#fffaf4}
.text-toolbar output{font:16px system-ui;min-width:44px;text-align:center}
.preview .text-toolbar{display:none}
.canvas-zoom{position:sticky;bottom:0;z-index:20;display:flex;justify-content:center;align-items:center;gap:6px;padding:7px;background:#faf6eff5;color:#392820;border-radius:10px;margin-top:8px}
.canvas-zoom button{min-width:44px;min-height:44px;padding:6px 10px;font-size:16px;background:#fffaf4;color:#392820}
.canvas-zoom output{min-width:48px;text-align:center;font-size:16px}
@media(min-width:961px){.canvas-stage,body.preview .canvas-stage{overflow:auto;scrollbar-width:thin}}
.canvas-zoom{position:static;margin:0;padding:0;flex-wrap:wrap}
.card-resize-handle{position:fixed;z-index:90;width:44px;height:44px;min-height:44px;padding:9px;border-radius:9px;background:#fffdf9;color:#392820;border:2px solid #805660;box-shadow:0 2px 8px #39282030;touch-action:none;cursor:nwse-resize}
.card-resize-handle svg{width:22px;height:22px;display:block}
.preview .card-resize-handle{display:none}
.card.custom-canvas-height{min-height:0!important;max-height:none;align-content:start}
.card-resize-handle{cursor:ns-resize}
.card[data-kind$="_example"]{height:650px;min-height:650px;padding:44px 34px}
.card[data-kind$="_example"] #recipient{font-size:44px}
.card[data-kind$="_example"] #wish{font-size:18px}
.card[data-kind=birthday_example] .letter,.card[data-kind=love_example] .letter{padding-top:235px}
.card[data-kind=thanks_example] .letter{padding-top:140px}
.card[data-kind=thanks_example] #wish{max-width:26ch}
.card[data-kind=thanks_example] #signature{margin-top:35px}
.card[data-kind=success_example] .letter{padding-top:170px}
.card[data-kind=success_example] #recipient{font-size:46px}
/* Keep the scaled artboard centred within the symmetric inspector columns. */
.canvas-stage>.card{margin-inline:auto}
@media(min-width:961px){
 .canvas-stage,body.preview .canvas-stage{display:flex;flex-direction:column;align-items:center}
 .canvas-stage>.card{flex-shrink:0}
 .canvas-stage>.credit{width:100%}
}
.mobile-dock,.mobile-edit-text{display:none}
.mobile-sheet{width:min(600px,100%);max-width:100%;max-height:78dvh;margin:auto auto 0;inset:auto 0 0;border:1px solid #deccbe;border-radius:20px 20px 0 0;background:#faf6ef;color:#392820;padding:14px 16px calc(18px + env(safe-area-inset-bottom));overflow:auto}
.mobile-sheet::backdrop{background:#24191e55}
.mobile-sheet-head{display:flex;justify-content:space-between;align-items:center;gap:12px;position:sticky;top:-14px;background:#faf6ef;padding:10px 0;z-index:2}
.mobile-sheet-head h2{font:600 21px system-ui}
.mobile-sheet-head button{background:#633a3e;color:#fffaf4}
.mobile-sheet-content .control-block{border:0;padding:0}
.mobile-sheet-content summary{display:none}
.mobile-sheet-content label{display:grid;margin-block:12px}
.mobile-sheet-content .check{display:flex}
@media(max-width:760px){
 body:not(.preview){padding-bottom:86px}
 .bar{position:sticky;top:0;z-index:30;background:#faf6eff5}
 .bar .brand{font-size:23px}
 #download-card{font-size:16px;padding:8px 12px}
 .intro h1{font-size:27px}
 .intro p{display:none}
 .intro{margin:14px 0 8px}
 .template-examples{margin-bottom:10px}
 .settings-panel{display:none}
 .mobile-dock{position:fixed;z-index:80;bottom:0;left:0;right:0;padding:9px 10px calc(9px + env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(4,1fr);gap:6px;background:#fffaf4;border-top:1px solid #deccbe;box-shadow:0 -4px 16px #39282012}
 .mobile-dock button{font-size:16px;font-weight:600;min-height:48px;padding:6px;border-radius:10px}
 .mobile-edit-text{display:block}
 .text-toolbar{max-width:calc(100vw - 16px);flex-wrap:wrap;justify-content:center}
 .text-toolbar button{min-height:44px}
 .movable-text[contenteditable=true]{cursor:text;touch-action:auto;user-select:text;background:#fffaf4;color:#392820;border-radius:5px;outline:2px solid #805660}
 body:not(.preview) .movable-text::after{content:"";display:inline-block;width:13px;height:13px;margin-left:6px;background:currentColor;clip-path:polygon(15% 70%,70% 15%,90% 35%,35% 90%,10% 95%);opacity:.7;pointer-events:none}
 .preview .mobile-dock{display:none}
 .card-resize-handle{z-index:70}
 .mobile-sheet .asset-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:760px){
 body:not(.preview){padding-bottom:env(safe-area-inset-bottom)}
 .bar{background:#faf6ef}
 .mobile-dock{position:sticky;top:var(--mobile-header-height,71px);bottom:auto;left:auto;right:auto;z-index:29;padding:8px 10px;background:#fffaf4;border-top:0;border-bottom:1px solid #deccbe;box-shadow:0 3px 10px #3928200d}
}
@media(max-width:760px){.card-resize-handle{display:none}}
.gift-language{width:150px;min-height:44px;font-size:16px;margin-inline-start:auto;margin-inline-end:10px}
[dir=rtl] .settings-panel,[dir=rtl] .mobile-sheet{text-align:right}
[dir=rtl] #recipient,[dir=rtl] #wish,[dir=rtl] #signature,[dir=rtl] #occasion{direction:rtl}
[dir=rtl] .card[data-align=start] .letter{text-align:right}
[dir=rtl] .text-panel{direction:rtl}
@media(max-width:760px){.gift-language{width:48px;padding-inline:5px 20px;margin-inline:0 6px;background-position:right 7px center}.bar{gap:4px}.brand img{width:28px}.brand{font-size:20px!important}}

@media(max-width:760px){.gift-language{width:64px;padding:4px;background-image:none;text-align:center;font-size:16px}}

.brand{direction:ltr;unicode-bidi:isolate}

.embedded-workspace .bar{padding:10px 16px;justify-content:flex-end}.embedded-workspace .bar .brand,.embedded-workspace .bar .gift-language{display:none}.embedded-workspace .intro{margin-top:12px}
/* Account constructor uses the entire space left by the workspace navigation. */
@media(min-width:961px){
 body.embedded-workspace{height:100dvh;overflow:hidden}
 body.embedded-workspace .bar{position:absolute;inset:0 0 auto auto;border:0;z-index:4;padding:10px 16px;background:transparent}
 body.embedded-workspace main{width:100%;height:100dvh;max-width:none;padding:12px 16px 12px;display:flex;flex-direction:column}
 body.embedded-workspace .intro{margin:0 180px 8px;flex-shrink:0}
 body.embedded-workspace .intro h1{font-size:32px}
 body.embedded-workspace .template-examples{margin-bottom:10px;flex-shrink:0}
 body.embedded-workspace .workspace{flex:1;height:auto;min-height:0;grid-template-columns:minmax(220px,260px) minmax(0,1fr) minmax(220px,260px);gap:16px}
 body.embedded-workspace .settings-panel{height:100%;min-height:0;scrollbar-width:thin;scrollbar-color:#a88e7f transparent}
 body.embedded-workspace #studio-assets{max-height:clamp(300px,52dvh,660px);overflow-y:auto;scrollbar-width:thin;scrollbar-color:#a88e7f transparent;padding:2px 4px 2px 0}
 body.embedded-workspace .canvas-stage{height:100%;min-height:0}
 body.embedded-workspace.preview .workspace{margin:0;max-width:none}
}
@media(min-width:961px){
 body.embedded-workspace .control-block{padding:10px}
 body.embedded-workspace .control-block>summary{font-size:16px;line-height:1.4}
 body.embedded-workspace .text-panel label{font-size:16px;line-height:1.4;margin-top:8px}
 body.embedded-workspace .text-panel input,body.embedded-workspace .text-panel textarea{font-size:16px;line-height:1.4;padding:8px 10px}
 body.embedded-workspace .text-panel textarea{height:90px;min-height:90px}
 body.embedded-workspace .image-panel .control-block>p{font-size:16px;line-height:1.4;margin:8px 0}
 body.embedded-workspace .settings-panel{gap:8px}
}
.embedded-workspace #studio-assets button{padding:5px;align-items:center}
.embedded-workspace #studio-assets button>img{width:100%;height:clamp(82px,11dvh,108px);object-fit:contain}
.embedded-workspace #studio-assets .cake-library-art{width:min(100%,96px)}

.textile-frame{display:none;position:absolute;inset:2px;container-type:size;pointer-events:none}
.card[data-ornament] .textile-frame{display:block}
.card[data-ornament]::before{display:none}
/* Equal slices and equal border widths keep corners square. Repeat clips the
   end tiles instead of stretching the artwork to fill the remaining space. */
.textile-frame::before{
  content:"";position:absolute;inset:0;border:solid transparent;
  border-width:min(8cqmin,46px);
  border-image-source:var(--ornament);
  border-image-slice:24%;
  border-image-repeat:repeat;
}
.card[data-ornament="floral"] .textile-frame::before{border-width:min(13cqmin,78px)}
.textile-frame.dyed::before{filter:url(#thread-dye)}
.color-controls:not([hidden]){display:flex;align-items:end;flex-wrap:wrap;gap:8px}
.color-controls input{width:54px;height:40px;padding:3px;cursor:pointer}

