/* ================= v9: Storytime & Decorate on the first page, envelope display stand, seal by stamp ================= */
/* right column: Storytime / Decorate always visible */
.v9 .col-r{gap:14px;justify-content:flex-start}
.v9 .v6-panel{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
.v9 .keepsake-side{display:flex;flex-direction:column;min-height:0;flex:1 1 auto;padding:12px 12px 10px;border-radius:14px;
 background:linear-gradient(180deg,rgba(251,247,236,.06),rgba(251,247,236,.02));box-shadow:inset 0 0 0 1px rgba(220,197,151,.28),0 10px 26px rgba(0,0,0,.18)}
.v9 .side-tabs{gap:6px;margin-bottom:8px;flex:none}
.v9 .side-tabs button{flex:1;padding:9px 10px;border-radius:18px;border:1px solid rgba(220,197,151,.4);background:transparent;font:500 12.5px/1 var(--sans);letter-spacing:.02em;color:var(--cream2,#efe4c8);transition:background .25s,color .25s}
.v9 .side-tabs button[aria-selected=true]{background:linear-gradient(180deg,#f7ecd2,#dcc597);color:#173f35;border-color:transparent;box-shadow:0 0 0 1px #b0894f55,0 4px 12px rgba(220,197,151,.25)}
.v9 .side-prompts,.v9 .side-extras{min-height:0;overflow:auto;scrollbar-width:thin;scrollbar-color:rgba(220,197,151,.35) transparent;padding-right:2px}
.v9 .side-extras .extras-list button{background:rgba(251,247,236,.04);transition:background .2s,transform .15s}
.v9 .side-extras .extras-list button:hover{background:rgba(220,197,151,.16)}
.v9 .side-extras .extras-list button:active{transform:scale(.96)}
.v9 .category-list{margin-bottom:8px}
.v9 .side-prompts .p-stack{height:150px}
.v9 .side-prompts .pc-tx{font-size:20px}
.v9 .side-prompts .p-act{margin-top:10px}
.v9 #doodle{height:96px}

/* ---------- envelope display stand ---------- */
.stand{flex:none;position:relative}
.stand-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
.stand-head .sec-h{margin:0}
.stand-edit{font:500 11px/1 var(--sans);color:var(--au2,#dcc597);padding:6px 10px;border-radius:14px;border:1px solid rgba(220,197,151,.35)}
.stand-edit:hover{background:rgba(220,197,151,.12)}
.stand.is-sealed .stand-edit{visibility:hidden}
.stand-stage{position:relative;height:172px;margin-top:2px}
.stand-back{position:absolute;left:8%;right:8%;bottom:16px;top:10px;border-radius:50% 50% 6px 6px/22% 22% 6px 6px;
 background:radial-gradient(80% 70% at 50% 35%,rgba(255,236,190,.16),rgba(255,236,190,0) 70%);pointer-events:none}
.stand-env{position:absolute;left:50%;bottom:11px;height:calc(100% - 8px);width:auto;max-width:92%;aspect-ratio:1;transform:translateX(-50%);padding:0;border-radius:6px;cursor:pointer;
 filter:drop-shadow(0 8px 10px rgba(0,0,0,.35));transition:filter .3s,opacity .3s}
.stand-env svg{position:absolute;inset:0;width:100%;height:100%;display:block;transform:rotate(-3deg);transform-origin:50% 92%;transition:transform .45s var(--ease)}
.stand-env:hover svg{transform:rotate(-1deg) translateY(-4px)}
.stand-env:focus-visible{outline:2px solid rgba(220,197,151,.7);outline-offset:4px}
.stand-ledge{position:absolute;left:6%;right:6%;bottom:0;height:14px;border-radius:3px 3px 6px 6px;
 background:linear-gradient(180deg,#fbeec4 0,#d8b56a 30%,#b0894f 60%,#6f5226 100%);box-shadow:0 8px 14px rgba(0,0,0,.45),inset 0 1px 0 rgba(255,255,255,.6)}
.stand-ledge::before{content:"";position:absolute;left:4%;right:4%;top:-5px;height:6px;border-radius:3px 3px 0 0;background:linear-gradient(180deg,#f6e3b0,#c9a464);box-shadow:inset 0 1px 0 #fff8}
.stand-ledge::after{content:"";position:absolute;left:0;right:0;top:3px;height:2px;background:repeating-linear-gradient(90deg,rgba(255,255,255,.7) 0 2px,transparent 2px 9px);opacity:.55}
.stand-ledge i{position:absolute;top:-8px;width:11px;height:11px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#fff,#f6eee7 45%,#d9c6b8 85%,#bca595);box-shadow:0 1px 2px rgba(0,0,0,.35)}
.stand-ledge i:first-child{left:-3px}.stand-ledge i:last-child{right:-3px}
.stand-cap{margin:8px 0 0;text-align:center;font:italic 14px/1.3 var(--corm);color:var(--cream2,#efe4c8);opacity:.85}
.stand-cap span{opacity:.75;font-size:13px}
.stand-stamp{display:none}
.stand.is-sealed .stand-env{filter:drop-shadow(0 8px 10px rgba(0,0,0,.35)) drop-shadow(0 0 14px rgba(255,226,160,.22))}

/* ---------- desk objects: the seal and the stamp both seal the letter ---------- */
.v9 .obj-stamp{pointer-events:auto;cursor:pointer;padding:0;transition:transform .35s var(--ease),filter .35s,opacity .2s}
.v9 .obj-stamp svg{width:100%;height:100%;display:block}
.v9 .obj-stamp:hover{transform:rotate(10deg) translateY(-4px);filter:drop-shadow(3px 14px 10px rgba(0,0,0,.45)) drop-shadow(0 0 8px rgba(255,226,160,.35))}
.v9 .obj-seal{cursor:pointer}
.v9 .obj-seal::after{content:attr(data-label)}
.v9 .obj-seal:not([data-label])::after{content:"Tap the seal"}
.v9 .obj-seal:hover{filter:drop-shadow(2px 8px 7px rgba(0,0,0,.45)) drop-shadow(0 0 10px rgba(255,226,160,.4))}
.v9 .obj-stamp:focus-visible,.v9 .obj-seal:focus-visible{outline:2px solid rgba(220,197,151,.7);outline-offset:4px;border-radius:50%}
.stamp-fly{filter:drop-shadow(4px 14px 10px rgba(0,0,0,.45))}
.stamp-fly svg{width:100%;height:100%;display:block}

/* ---------- seal animation: two-sided flap shows the lining when open ---------- */
.env-flap.v9-flap{transform-style:preserve-3d;filter:none}
.v9-flap-out,.v9-flap-in{position:absolute;inset:0;backface-visibility:hidden;-webkit-backface-visibility:hidden;filter:drop-shadow(0 4px 5px rgba(0,0,0,.22))}
.v9-flap-in{transform:rotateY(180deg)}
.v9-flap-out svg,.v9-flap-in svg{width:100%;height:100%;display:block}
.env-front .v9-pearls{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;filter:drop-shadow(0 .5px .5px rgba(0,0,0,.35))}
.env-back{overflow:hidden}

/* ---------- sealed card on the desk (replaces the full-screen overlay) ---------- */
.v9 .done{position:absolute;inset:0;z-index:6;background:none;padding:10px;display:grid;place-items:center}
.v9 .done[hidden]{display:none}
.v9 .done-in{max-width:520px;width:100%;animation:none}
.done-env{width:min(100%,440px);aspect-ratio:1;margin:-16% auto 2%;filter:drop-shadow(0 22px 30px rgba(0,0,0,.45))}
.done-env svg{width:100%;height:100%;display:block;transform:rotate(-2deg)}
.v9 .done h2{font-size:34px}
.v9 .done p{margin:10px 0 22px}
.desk.is-sealed .pages,.desk.is-sealed .kpg-switch{visibility:hidden}

/* ---------- Decorate pieces placed on the letter ---------- */
.ks-note .ks-in,.ks-card .ks-in{pointer-events:auto}
.ksx-text{min-height:2.4em;padding:.5em .6em;outline:none;font-family:var(--hand);color:var(--ink,#2b3640);font-size:calc(var(--pw)*.034*var(--hs,1));line-height:1.35;cursor:text;user-select:text;-webkit-user-select:text;white-space:pre-wrap;word-break:break-word;
 border:1px dashed rgba(176,137,79,.35);border-radius:4px;background:rgba(255,253,246,.35)}
.ks-note{filter:none!important}
.ks-note:not(.sel) .ksx-text:not(:focus){border-color:transparent;background:transparent}
.ksx-text:empty::before,.ks-ed:empty::before{content:attr(data-ph);opacity:.4;font-style:italic}
.ksx-ticket{background:linear-gradient(180deg,#f0dcc4,#e2c7a8);padding:9% 10%;border-left:3px dotted #fbf4e2;border-right:3px dotted #fbf4e2;box-shadow:0 2px 4px rgba(60,40,20,.18)}
.ksx-song{background:linear-gradient(160deg,#efe6f4,#ddd0e8);padding:9%;border:1px solid #fff9}
.ksx-song .song-icon{color:#ac8298;font-size:calc(var(--pw)*.045)}
.ksx-doodle{background:linear-gradient(#fffaf0,#f4ead6);padding:6%;outline:1px dashed #cdb488;outline-offset:-3px}
.ksx-doodle img{width:100%;display:block;pointer-events:none}
.ks-ed{outline:none;min-height:1.4em;font:italic calc(var(--pw)*.03)/1.3 Cormorant,serif;color:#24473b;cursor:text;user-select:text;-webkit-user-select:text}
.pol-corners{background:transparent!important;box-shadow:none!important;padding:0;position:relative}
.pol-corners .pol-img{border:7px solid transparent;border-image:linear-gradient(135deg,#d5bd90 0 12%,transparent 12% 88%,#d5bd90 88%) 12;background-clip:padding-box}

/* ---------- keepsake page wears the letter's paper colour and handwriting ---------- */
.v9 .kpg .kpg-sheet{background-color:var(--pbg,#f7f0e2)!important}
.v9 .kpg.pc-grid .kpg-sheet{background-image:linear-gradient(rgba(23,63,53,.07) 1px,transparent 1px),linear-gradient(90deg,rgba(23,63,53,.07) 1px,transparent 1px)!important;background-size:14px 14px!important}
.v9 .kpg.pc-florals .kpg-sheet{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cg opacity='.55'%3E%3Cg transform='translate(14 16)' fill='%23e7b9bb'%3E%3Ccircle cy='-2.6' r='2'/%3E%3Ccircle cx='2.5' cy='-.8' r='2'/%3E%3Ccircle cx='1.6' cy='2.2' r='2'/%3E%3Ccircle cx='-1.6' cy='2.2' r='2'/%3E%3Ccircle cx='-2.5' cy='-.8' r='2'/%3E%3Ccircle r='1.1' fill='%23d9b25c'/%3E%3C/g%3E%3Cg transform='translate(46 44)' fill='%23bfcdb0'%3E%3Ccircle cy='-2.2' r='1.7'/%3E%3Ccircle cx='2.1' cy='-.7' r='1.7'/%3E%3Ccircle cx='1.3' cy='1.8' r='1.7'/%3E%3Ccircle cx='-1.3' cy='1.8' r='1.7'/%3E%3Ccircle cx='-2.1' cy='-.7' r='1.7'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")!important;background-size:46px 46px!important}
.v9 .kpg.pp-scallop .kpg-sheet::before{border:1.5px dashed rgba(201,164,100,.7);border-radius:10px}
.v9 .kpg.pp-vellum .kpg-sheet{box-shadow:inset 0 0 0 9999px rgba(246,206,206,.18),0 14px 28px rgba(20,30,25,.3)!important}
.v9 .kpg .ex-text .ex-text{font-family:var(--hand,'La Belle Aurore'),cursive}
.v9 .kpg .kp-a{font-family:var(--hand,'La Belle Aurore'),cursive}

/* ---------- envelope options in Stationery: each swatch shows the real result ---------- */
.st-env-row{grid-template-columns:repeat(3,1fr)!important;gap:6px}
.v9 .st-env-sw{width:100%;max-width:72px;height:auto;aspect-ratio:1;box-shadow:none;background:none;border-radius:6px;position:relative}
.v9 .st-env-sw svg{position:absolute;inset:0;width:100%;height:100%}
.v9 #stPanel{max-height:min(46vh,420px);overflow:auto;scrollbar-width:thin;scrollbar-color:rgba(220,197,151,.35) transparent}
.st-wax{grid-template-columns:repeat(4,1fr)!important}

/* short desktop screens */
@media (max-height:900px) and (min-width:901px){.stand-stage{height:150px}.v9 .side-prompts .p-stack{height:132px}.v9 .side-prompts .pc-tx{font-size:18px}.v9 .objects{height:150px}}
@media (max-height:780px) and (min-width:901px){.stand-cap span{display:none}.v9 .objects{height:130px}}

/* ---------- phone ---------- */
@media (max-width:900px){
 .v9 .keepsake-side{padding:10px}
 .v9 .side-prompts,.v9 .side-extras{max-height:none;overflow:visible}
 .stand{order:4;margin-top:6px;padding:0 4px}
 .stand-stage{height:220px}
 .stand-env{left:44%}
 .stand-stamp{display:flex;flex-direction:column;align-items:center;gap:4px;position:absolute;right:2%;bottom:20px;width:68px;padding:0;color:var(--au2,#dcc597);font:italic 13px/1.1 var(--corm)}
 .stand-stamp-art{width:58px;height:58px;filter:drop-shadow(2px 6px 6px rgba(0,0,0,.45));transition:transform .3s var(--ease)}
 .stand-stamp-art svg{width:100%;height:100%;display:block}
 .stand-stamp:active .stand-stamp-art{transform:scale(.9,1.06)}
 .v9 .done{position:absolute;inset:0;padding:0}
 .done-env{width:min(92%,380px)}
 .v9 .done h2{font-size:28px}
 .v9 .done p{font-size:17px}
 .st-env-row{grid-template-columns:repeat(3,1fr)!important}
 .v9 #stPanel{max-height:52vh}
}
/* the back of the folded letter keeps the chosen paper colour */
.v9 .face.back{background:radial-gradient(120% 120% at 50% 40%,color-mix(in srgb,var(--pbg-fold,#f7f0df) 88%,#fff),color-mix(in srgb,var(--pbg-fold,#eadcbf) 86%,#8a6a35))}
.t-seal-ic[data-wax=gold]{background:radial-gradient(circle at 35% 30%,#f6e3a8,#cfa75c 60%,#7d5d2c)}
.desk.is-sealed .v4-desk{opacity:0;transition:opacity .4s}
