#card{width:min(430px,calc(100vw - 28px),calc((100dvh - 36px)*.66667));height:auto;aspect-ratio:2/3;padding:0;max-height:none;border:0;border-radius:0;background:#f7eedc;overflow:visible;box-shadow:none}#card .paper{position:relative;width:100%;height:100%;padding:0;border-radius:0;background:#f7eedc url('./merry-bright.svg') center/100% 100% no-repeat;overflow:hidden;isolation:isolate}#card .paper:before,#card .paper:after,#card .holiday-art,#card .card-rule{display:none}#card .card-kicker{position:absolute;top:16%;right:17%;width:47%;margin:0;text-align:right;font:italic 10px/1.6 Georgia,serif;letter-spacing:.09em;color:#9b7645}#card .card-title{position:absolute;top:21%;right:17%;margin:0;text-align:right;font:500 22px/1.4 'Songti SC','Noto Serif CJK SC',serif;letter-spacing:.18em;color:#d52e44}#card .letter,#card textarea{position:absolute;top:32%;left:13%;width:74%;height:40%;max-height:none;min-height:0;padding:0 3px 3px 0;margin:0;font:16px/1.95 'Songti SC','Noto Serif CJK SC',Georgia,serif;letter-spacing:.015em;color:#514d40;white-space:pre-wrap;overflow-wrap:anywhere;overflow:auto;scrollbar-width:thin;scrollbar-color:#b99a6355 transparent;background:transparent;border:0;border-radius:0;box-shadow:none}#card .letter{outline:none}#card .letter:focus-visible{outline:1px dotted #b5945b77;outline-offset:5px}#card textarea{outline:1px dashed #ad8a5666;outline-offset:6px;resize:none}#card [hidden]{display:none!important}#card .actions{position:absolute;left:12%;bottom:15%;width:42%;margin:0;display:flex;gap:9px;min-height:30px;flex-wrap:wrap}#card #saved{flex:0 0 100%;min-height:15px;font-size:10px;color:#9c876d;max-width:100%;order:3}#card #edit,#card #save{width:29px;height:29px;border-radius:50%;background:#faf1dd99;border:1px solid #b5976544;color:#987243;box-shadow:none;backdrop-filter:none}#card #edit svg,#card #save svg{width:15px;height:15px}#card #close{position:absolute;top:3.3%;right:4.5%;width:26px;height:26px;border-radius:50%;color:#987243;background:#fff8e6bb;border:1px solid #b9a47544;z-index:3;backdrop-filter:none}#card #close svg{width:15px;height:15px}#card::backdrop{background:#06121bc9;backdrop-filter:blur(9px)}#card[open]{animation:card-arrive .3s ease-out}@keyframes card-arrive{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}@media(max-width:390px){#card .letter,#card textarea{font-size:15px;line-height:1.85}#card .card-title{font-size:20px}#card .card-kicker{font-size:8px}}@media(max-height:600px){#card .letter,#card textarea{font-size:13px;line-height:1.75}#card .card-title{font-size:17px}#card .card-kicker{font-size:8px}}@media(prefers-reduced-motion:reduce){#card[open]{animation:none}}

#card #save{background:#d63849;color:#fff9ee;border-color:#d63849}#card #edit{color:#167456;border-color:#16745655}#card .card-kicker{color:#218368}#card #close{color:#c82d43;background:#fff8ecdd;border-color:#da586044}
/* Two steps: a flat illustrated envelope, then the supplied open interior. */
#card{width:min(650px,calc(100vw - 20px),calc((100dvh - 32px)*.8854));aspect-ratio:1360/1536;background:none;border-radius:0;transition:width .25s ease}#card .paper{background:transparent url('./card-interior.webp') center/100% 100% no-repeat;border-radius:0}#card .card-kicker,#card .card-title{display:none}#card .letter,#card textarea{top:61.3%;left:17%;width:64%;height:22.5%;font-size:clamp(12px,2.8vw,18px);line-height:1.85;color:#704330;padding:0 4px 3px 0;background:transparent}#card .actions{left:15%;bottom:8%;width:38%;gap:7px}#card #saved{font-size:10px;min-height:0}#card #edit,#card #save{width:27px;height:27px}#card #close{top:3.4%;right:4%;color:#9a2531;background:#fff1dfd9;border-color:#b7554d66}#envelope{display:none;padding:0;border:0;background:none;border-radius:4px;width:100%;height:100%;overflow:hidden;backdrop-filter:none}#envelope img{display:block;width:100%;height:100%;object-fit:contain}#card[data-stage=envelope]{width:min(690px,calc(100vw - 28px));aspect-ratio:3/2}#card[data-stage=envelope] .paper{background:none;overflow:visible}#card[data-stage=envelope] #envelope{display:block;animation:envelope-arrive .35s ease-out}#card[data-stage=envelope] .letter,#card[data-stage=envelope] textarea,#card[data-stage=envelope] .actions{display:none!important}#card[data-stage=envelope] #close{top:10px;right:10px}#card[data-stage=letter] .paper{animation:letter-arrive .45s ease-out}@keyframes envelope-arrive{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:none}}@keyframes letter-arrive{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:none}}@media(max-width:420px){#card .letter,#card textarea{font-size:12px;line-height:1.85}#card .actions{bottom:7.8%}#card #saved{font-size:9px}#card #edit,#card #save{width:24px;height:24px}}@media(prefers-reduced-motion:reduce){#card[data-stage=envelope] #envelope,#card[data-stage=letter] .paper{animation:none}#card{transition:none}}
/* Explicit dimensions keep the cover visible in mobile WebViews. */
#card{height:min(calc((100vw - 20px)*1.129412),calc(100dvh - 32px),734px);width:auto;aspect-ratio:1360/1536}#card .paper{position:absolute;inset:0;width:100%;height:100%}#card[data-stage=envelope]{width:min(690px,calc(100vw - 28px));height:auto;aspect-ratio:3/2}#card[data-stage=envelope] .paper{position:absolute;inset:0}#card[data-stage=envelope] #envelope{position:absolute;inset:0;width:100%;height:100%;touch-action:manipulation}#envelope img{pointer-events:none}#card[data-stage=envelope] .paper{min-height:0}
@font-face{font-family:ChristmasHand;src:url('./fonts/handwriting.woff') format('woff');font-display:block;font-weight:400;font-style:normal}
/* Large mobile letter: artwork above, generous writing panel below. */
#card[data-stage=letter]{width:min(700px,calc(100vw - 12px));height:min(940px,calc(100dvh - 20px));max-height:calc(100dvh - 20px);aspect-ratio:auto;margin:auto;border-radius:6px;overflow:hidden}#card[data-stage=letter] .paper{background:#a52425;overflow:hidden}#card[data-stage=letter] .paper:before,#card[data-stage=letter] .paper:after{content:'';display:block;position:absolute;left:0;right:0;inset:auto;border:0;border-radius:0;pointer-events:none;z-index:0;width:100%}#card[data-stage=letter] .paper:before{top:0;height:36%;background:url('./card-top.webp') center/100% 100% no-repeat}#card[data-stage=letter] .paper:after{top:36%;bottom:0;height:64%;background:url('./card-bottom-unruled.webp') center/100% 100% no-repeat}#card[data-stage=letter] .letter,#card[data-stage=letter] textarea{top:48%;left:15.5%;width:69%;height:35%;padding:0 4px;font-family:ChristmasHand,'STKaiti','KaiTi',cursive;font-size:clamp(20px,5.3vw,27px);font-weight:400;line-height:1.85;letter-spacing:.02em;color:#744634;z-index:2;max-height:none;min-height:0;white-space:pre-wrap;-webkit-overflow-scrolling:touch}#card[data-stage=letter] .actions{left:13%;bottom:6%;width:43%;z-index:2;margin:0}#card[data-stage=letter] #edit,#card[data-stage=letter] #save{width:33px;height:33px}#card[data-stage=letter] #close{top:12px;right:12px;z-index:4;width:32px;height:32px}#card[data-stage=letter] #saved{font-size:11px}@media(min-width:700px){#card[data-stage=letter]{width:min(700px,calc((100dvh - 28px)*.85));height:calc(100dvh - 28px)}#card[data-stage=letter] .letter,#card[data-stage=letter] textarea{font-size:25px}}@media(max-height:560px){#card[data-stage=letter] .letter,#card[data-stage=letter] textarea{font-size:18px;line-height:1.65}}@media(orientation:landscape) and (max-height:560px){#card[data-stage=letter]{width:min(680px,calc(100vw - 24px));height:calc(100dvh - 12px)}#card[data-stage=letter] .paper:before{width:38%;height:100%;top:0;left:0}#card[data-stage=letter] .paper:after{width:62%;height:100%;top:0;left:38%}#card[data-stage=letter] .letter,#card[data-stage=letter] textarea{left:47%;top:20%;width:44%;height:53%}#card[data-stage=letter] .actions{left:47%;bottom:9%;width:35%}}
/* Balanced upper/lower pages, with fixed, fitted lettering on both. */
#card[data-stage=letter]{width:min(700px,calc(100vw - 12px),calc((100dvh - 22px)*.78));height:auto;aspect-ratio:.78;max-height:calc(100dvh - 22px)}#card[data-stage=letter] .paper:before{top:0;left:0;width:100%;height:51%}#card[data-stage=letter] .paper:after{top:51%;left:0;width:100%;height:49%;bottom:0}#card[data-stage=letter] #letter-top,#card[data-stage=letter] #letter{position:absolute;display:block;overflow:hidden;overscroll-behavior:none;touch-action:none;white-space:pre-wrap;font-family:ChristmasHand,'STKaiti','KaiTi',cursive;font-weight:400;line-height:1.6;letter-spacing:.015em;color:#744634;z-index:2;padding:0;margin:0;max-height:none;min-height:0;scrollbar-width:none}#card[data-stage=letter] #letter-top{top:12%;left:39%;width:47%;height:25%;font-size:22px}#card[data-stage=letter] #letter{top:61%;left:16%;width:67%;height:24%;font-size:22px}#card[data-stage=letter] #letter:focus-visible{outline:none}#card[data-stage=letter] .actions{left:13%;bottom:6%;width:40%}#card[data-stage=letter] textarea{top:15%;left:16%;width:68%;height:65%;overflow:hidden;resize:none;touch-action:auto;font-size:18px;line-height:1.65;background:#fff4e9ed;padding:12px;box-sizing:border-box}#card[data-stage=envelope] #letter-top,#card [hidden]{display:none!important}@media(orientation:landscape) and (max-height:560px){#card[data-stage=letter]{width:calc((100dvh - 20px)*.78);height:auto;aspect-ratio:.78}#card[data-stage=letter] #letter-top,#card[data-stage=letter] #letter{line-height:1.45}}

#card[data-opening=true] #envelope{opacity:.85;cursor:progress}#card[data-opening=true] .paper:after{content:"";display:block;position:absolute;left:calc(50% - 13px);top:calc(50% - 13px);width:26px;height:26px;border:2px solid #fff8e999;border-top-color:#b32d37;border-radius:50%;background:none;animation:spin 1s linear infinite;z-index:4}

#card[data-stage=letter]{border:0;border-radius:0;box-shadow:none;background:transparent}#card[data-stage=letter] .paper{background:transparent;box-shadow:none;border-radius:0}#card[data-stage=letter] .paper:before,#card[data-stage=letter] .paper:after{background-size:108% 111%;background-position:center}#card[data-stage=letter] #letter-top,#card[data-stage=letter] #letter{font-size:19px;line-height:1.6}#card[data-stage=letter] #letter-top{height:28%;top:10.5%}#card[data-stage=letter] #letter{top:60%;height:27%}@media(min-width:700px){#card[data-stage=letter] #letter-top,#card[data-stage=letter] #letter{font-size:23px}}

.card-doodle{position:absolute;z-index:2;height:auto;aspect-ratio:1;object-fit:contain;pointer-events:none}#card-doodle-top{left:18%;top:12%;width:14%;transform:rotate(-10deg)}#card-doodle-bottom{right:5%;top:54%;width:10%;transform:rotate(9deg)}#card[data-stage=envelope] .card-doodle{display:none}

/* Doodles sit inside the cream writing panels, away from edge artwork. */
#card[data-stage=letter] #card-doodle-top{left:72%;top:32%;width:9%;transform:rotate(-7deg)}#card[data-stage=letter] #card-doodle-bottom{right:22%;top:82%;width:9%;transform:rotate(7deg)}#card[data-stage=letter] #letter-top{top:11%;height:20%}#card[data-stage=letter] #letter{top:60%;height:21%}
#card[data-stage=letter] #card-doodle-top{left:69%;top:7%;width:9%}#card[data-stage=letter] #card-doodle-bottom{left:76%;right:auto;top:63%;width:9%}#card[data-stage=letter] #letter-top{top:17%;height:23%;width:47%}#card[data-stage=letter] #letter{top:60%;height:27%;width:58%}

@font-face{font-family:StarSwash;src:url('./fonts/english-fancy.woff') format('woff');font-display:block}@font-face{font-family:StarBrush;src:url('./fonts/chinese-fancy.woff') format('woff');font-display:block}#star-card .star-zh{font-family:StarBrush,ChristmasHand,cursive;font-size:clamp(36px,9.5vw,52px);letter-spacing:.12em}#star-card .star-en{font-family:StarSwash,Georgia,cursive;font-style:normal;font-size:clamp(34px,9vw,51px);line-height:1.6;top:48%;width:82%;text-align:center}#star-card .star-en:after{content:'';display:block;width:75%;height:27px;margin:3px auto 0;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 30'%3E%3Cpath d='M10 17C50-8 72 35 112 14S188-3 226 15M120 14C80 40 38 20 49 10S85 8 91 20M120 14C160 40 204 20 193 10S159 8 151 20' stroke='%23e5c17e' fill='none' stroke-width='1.3'/%3E%3C/svg%3E") center/contain no-repeat}

#card[data-stage=letter] #letter-top{top:13%;left:35%;width:52%;height:27%}#card[data-stage=letter] #letter{top:59.5%;left:15%;width:61%;height:29%}#card[data-stage=letter] #card-doodle-top{top:8%;left:69%}#card[data-stage=letter] #card-doodle-bottom{left:78%;top:65%;width:8%}

#card[data-stage=letter]:not([data-ready=true]) #letter-top,#card[data-stage=letter]:not([data-ready=true]) #letter,#card[data-stage=letter]:not([data-ready=true]) textarea,#card[data-stage=letter]:not([data-ready=true]) .card-doodle,#card[data-stage=letter]:not([data-ready=true]) .actions{visibility:hidden}#card[data-stage=letter][data-ready=true] #letter-top,#card[data-stage=letter][data-ready=true] #letter,#card[data-stage=letter][data-ready=true] .card-doodle,#card[data-stage=letter][data-ready=true] .actions{visibility:visible}

/* Present background, ink and doodles as a single decoded image. */
#card-composite{display:none;position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:1}#card[data-stage=letter] #card-composite{display:block}#card[data-stage=letter] .paper:before,#card[data-stage=letter] .paper:after{display:none!important}#card[data-stage=letter]:not([data-editing=true]) #letter-top,#card[data-stage=letter]:not([data-editing=true]) #letter,#card[data-stage=letter] .card-doodle{display:none!important}#card[data-stage=letter][data-editing=true] #card-composite{opacity:.3}#card[data-stage=letter] textarea{z-index:3}#card[data-stage=letter] .actions{z-index:4}#card[data-stage=envelope] #card-composite{display:none!important}

#star-card{width:min(860px,calc(100vw - 20px),calc((100dvh - 30px)*1.5));height:auto;aspect-ratio:3/2;background:#fff5da url('./star-landscape-festive.webp') center/100% 100% no-repeat;max-width:none;max-height:none}#star-card .star-zh{position:absolute;top:31%;left:15%;width:70%;font-family:StarBrush,ChristmasHand,cursive;font-size:clamp(32px,7.3vw,66px);line-height:1.25;letter-spacing:.16em;color:#b62a33;text-align:center;white-space:nowrap;writing-mode:horizontal-tb;transform:none}#star-card .star-en{position:absolute;top:51%;left:12%;width:76%;font-family:StarSwash,Georgia,cursive;font-size:clamp(28px,6.6vw,61px);line-height:1.35;color:#ad7625;text-align:center;white-space:nowrap;writing-mode:horizontal-tb;transform:none}#star-card .star-en:after{height:clamp(14px,3vw,28px);margin:4px auto 0;width:65%}#star-card #star-close{color:#a87b36;border-color:#c39e5e88;background:#fff7e2b0;top:10px;right:10px}#star-card::backdrop{background:#18202d99;backdrop-filter:blur(7px)}

/* Star greeting is floating outlined lettering, with no card or decorative panel. */
#star-card{background:none!important;background-image:none!important;border:0!important;box-shadow:none!important;overflow:visible;padding:0;width:min(850px,calc(100vw - 24px),calc((100dvh - 28px)*1.7));height:auto;aspect-ratio:1.7;border-radius:0}#star-card::backdrop{background:#06132333;backdrop-filter:none}#star-card[open]{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:18px}#star-card .star-zh,#star-card .star-en{position:static;left:auto;top:auto;width:100%;margin:0;white-space:nowrap;color:transparent;-webkit-text-fill-color:transparent;-webkit-text-stroke:.8px #ffdfa0;text-shadow:0 0 12px #ffd16a33;text-align:center;writing-mode:horizontal-tb;transform:none}#star-card .star-zh{font-family:StarBrush,ChristmasHand,cursive;font-size:clamp(40px,11vw,88px);line-height:1.25;letter-spacing:.15em}#star-card .star-en{font-family:StarSwash,Georgia,cursive;font-size:clamp(37px,10vw,80px);line-height:1.4;-webkit-text-stroke:.65px #ffe8b9}#star-card .star-zh:before,#star-card .star-zh:after,#star-card .star-en:before,#star-card .star-en:after,#star-card .star-doodle{display:none!important}#star-card #star-close{position:absolute;right:0;top:-20px;background:transparent;border:0;color:#fff1cc;backdrop-filter:none}
/* Strong lettering with a dark outer stroke remains clear over the live scene. */
#star-card .star-zh,#star-card .star-en{color:#ffe6a2;-webkit-text-fill-color:#ffe6a2;-webkit-text-stroke:1.2px #3d2414;paint-order:stroke fill;font-weight:400;text-shadow:1px 0 0 #ffe6a2,-1px 0 0 #ffe6a2,0 1px 0 #ffe6a2,0 -1px 0 #ffe6a2,0 2px 3px #1e100de6,0 0 5px #211408cc}#star-card .star-zh{font-weight:700}#star-card .star-en{font-weight:700;-webkit-text-stroke:1px #3d2414}#star-card::backdrop{background:#07111f73;backdrop-filter:none}
/* Open, widely spaced calligraphy with a strong hollow outline. */
#star-card[open]{gap:32px}#star-card .star-zh,#star-card .star-en{color:transparent;-webkit-text-fill-color:transparent;font-weight:400;-webkit-text-stroke:1.25px #ffe1a0;paint-order:stroke fill;text-shadow:none;filter:drop-shadow(1px 0 0 #29170f) drop-shadow(-1px 0 0 #29170f) drop-shadow(0 1px 0 #29170f) drop-shadow(0 -1px 0 #29170f)}#star-card .star-zh{letter-spacing:.3em;padding-left:.3em;font-size:clamp(38px,10vw,80px);line-height:1.4}#star-card .star-en{letter-spacing:.065em;word-spacing:.25em;font-size:clamp(32px,8.6vw,70px);line-height:1.65;-webkit-text-stroke:1px #ffebbb}#star-card{aspect-ratio:1.6}

@font-face{font-family:StarSlender;src:url('./fonts/star-slender.woff') format('woff');font-display:block;font-weight:400}#star-card{width:min(920px,calc(100vw - 16px),calc((100dvh - 60px)*1.15));aspect-ratio:1.15}#star-card[open]{gap:clamp(38px,8vw,66px)}#star-card .star-zh{font-family:StarSlender,StarBrush,cursive;font-size:clamp(74px,21vw,160px);line-height:1.05;letter-spacing:.16em;padding-left:.16em;transform:scale(.82,1.48);transform-origin:center;-webkit-text-stroke:.85px #ffe1a0;font-weight:400}#star-card .star-en{font-family:StarSwash,Georgia,cursive;font-size:clamp(48px,13.2vw,108px);line-height:1.1;letter-spacing:.045em;word-spacing:.16em;transform:scale(.88,1.4);transform-origin:center;-webkit-text-stroke:.8px #ffebbb;font-weight:400}@media(orientation:landscape) and (max-height:600px){#star-card{width:min(800px,calc(100vw - 40px));height:calc(100dvh - 50px);aspect-ratio:auto}#star-card .star-zh{font-size:clamp(66px,15vh,100px)}#star-card .star-en{font-size:clamp(42px,11vh,72px)}#star-card[open]{gap:40px}}

@font-face{font-family:StarFrench;src:url('./fonts/star-french.woff') format('woff');font-display:block;font-weight:400}#star-card .star-zh,#star-card .star-en{-webkit-text-fill-color:transparent;color:transparent;text-shadow:none;-webkit-text-stroke:1.1px #fff2bc;filter:drop-shadow(1px 0 0 #3b2516) drop-shadow(-1px 0 0 #3b2516) drop-shadow(0 1px 0 #3b2516) drop-shadow(0 -1px 0 #3b2516) drop-shadow(0 0 7px #ffd66b66)}#star-card .star-en{font-family:StarFrench,StarSwash,cursive;font-size:clamp(53px,14vw,116px);font-weight:400;font-feature-settings:'swsh' 1,'cswh' 1,'calt' 1,'liga' 1;letter-spacing:.025em;word-spacing:.22em;line-height:1.45;transform:scale(.87,1.35);-webkit-text-stroke:1.05px #fff5c9}#star-card[open]{gap:clamp(35px,8vw,64px)}
#star-card[open]{translate:0 -7vh}

#star-card .star-char{position:relative;display:inline-block;overflow:visible;vertical-align:baseline}#star-card .star-zh{overflow:visible}#star-card .saint-swirl,#star-card .joy-swirl{position:absolute;display:block;fill:none;stroke:#fff2bc;stroke-width:1.35;stroke-linecap:round;stroke-linejoin:round;pointer-events:none;overflow:visible;filter:none}#star-card .saint-swirl{width:.57em;height:.85em;left:-.43em;top:-.015em}#star-card .joy-swirl{width:1.02em;height:.52em;left:.64em;top:.56em}#star-card .star-zh{padding-left:.03em;letter-spacing:.16em}

#star-card .star-zh{display:block;width:100%;padding:0;line-height:0;letter-spacing:0;transform:none;filter:drop-shadow(0 1px 2px #24160eaa)}#star-card .star-zh img{display:block;width:100%;height:auto;max-height:none;object-fit:contain}#star-card[open]{gap:clamp(25px,6vw,48px)}

#star-card .star-exclamation{font-family:StarSwash,Georgia,serif;font-size:clamp(38px,9vw,72px);line-height:.85;color:transparent;-webkit-text-fill-color:transparent;-webkit-text-stroke:1.1px #fff5c9;filter:drop-shadow(0 1px 1px #29170f) drop-shadow(0 0 5px #ffd66b66);transform:scale(.9,1.25);margin-top:-8px}#star-card[open]{gap:clamp(22px,5vw,40px)}

#card[data-stage=letter] #card-doodle-top{left:69%;top:5.2%;width:9.5%}#card[data-stage=letter] #card-doodle-bottom{left:78%;top:65%;width:9%}

/* Keep enlarged source doodles inside the paper, separate from writing. */
#card[data-stage=letter] #card-doodle-top{left:65%;top:3.5%;width:15%;transform:none}#card[data-stage=letter] #card-doodle-bottom{left:77.5%;top:65%;width:14%;transform:none}#card[data-stage=letter] #letter-top{top:16.5%;height:23.5%}

#card[data-stage=letter] #card-doodle-top{top:6%;width:14%}#card[data-stage=letter] #letter-top{top:18%;height:22%}
