:root{color-scheme:light;--cream:#fff0cc;--ink:#812638;--ivory:#fff5e3;--red:#c71936;--burgundy:#a20e27;
  font-family:"PingFang SC","Microsoft YaHei",system-ui,sans-serif;color:var(--cream);background:#460b13}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;overscroll-behavior-x:none}
body{background:radial-gradient(ellipse at 50% 36%,#942536,#450912 72%)}
[hidden]{display:none!important}
button,a{-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none;padding:0}
img{display:block;max-width:100%}
button:focus-visible,a:focus-visible{outline:2px solid #f5ca77;outline-offset:4px}
.app{container-type:inline-size;width:min(100%,470px);margin:0 auto;position:relative;min-height:100svh;background:#a9152c;overflow:hidden}
.screen{min-height:100svh;position:relative}
.home{isolation:isolate;height:100svh;min-height:540px;overflow:hidden;touch-action:pan-y}
.home-backdrop{position:absolute;inset:0;width:100%;height:100%;max-width:none;object-fit:fill;z-index:-3;pointer-events:none}
.belt{position:absolute;left:0;right:0;top:71.06%;height:3.4%;background:url('assets/common/belt.webp') repeat-x 0 0 / 100% 100%;z-index:-1}
.cases{position:absolute;inset:0 0 25.8%;z-index:2;pointer-events:none}
.case{left:50%;bottom:0;position:absolute;width:min(49%,24svh);transform:translateX(calc(-50% + var(--slot) * 62cqw));pointer-events:auto;
  transition:opacity .2s;outline-offset:-4px}
.case img{width:100%;height:auto;user-select:none;-webkit-user-drag:none}
.case[data-offscreen="true"]{visibility:hidden;pointer-events:none}
.case[data-chosen="true"]{visibility:hidden}
.chooser{position:absolute;display:flex;justify-content:center;align-items:center;gap:4cqw;top:77.2%;width:100%;left:0;z-index:3}
.direction{height:44px;width:44px;border-radius:50%;display:grid;place-items:center;font-size:32px;color:#ffecd2;text-shadow:0 2px 5px #5b100e}
.direction:hover{background:#6a120d49}
.plaque{position:relative;background:linear-gradient(#e5d9cb,#a18c82);padding:1.45cqw;border-radius:3cqw;box-shadow:0 3px 5px #610a11a0;min-width:27cqw}
.plaque strong{display:block;text-align:center;white-space:nowrap;font-size:5.2cqw;line-height:1.15;color:#ac2018;background:#ffe6cb;padding:1.8cqw 1.4cqw;border-radius:1.4cqw;box-shadow:inset 0 0 4px #bb897a}
.plaque::after{content:"";height:3.8cqw;width:77%;left:11.5%;position:absolute;top:100%;background:linear-gradient(#c7b1a2,#b49a8b);clip-path:polygon(20% 0,80% 0,80% 55%,95% 60%,100% 100%,0 100%,5% 60%,20% 55%)}
.conveyor-controls{position:absolute;top:86.5%;left:50%;transform:translateX(-50%);z-index:3}
.dots{display:flex;justify-content:center;gap:3px}
.dot{width:23px;height:20px;display:grid;place-items:center}
.dot::after{content:"";width:5px;height:5px;border-radius:99px;background:#ffe4aa75}
.dot[aria-current=true]::after{width:12px;background:#ffedb5}
.conveyor-toggle{position:absolute;top:50%;left:calc(100% + 8px);transform:translateY(-50%);width:40px;height:40px;display:grid;place-items:center;color:#ffe4a7;border-radius:50%}
.conveyor-toggle::before{content:"";width:4px;height:9px;border-inline:2px solid currentColor;box-sizing:content-box}
.conveyor-toggle[data-paused="true"]::before{width:0;height:0;border:5px solid transparent;border-left:7px solid currentColor;margin-left:5px}
.instruction{position:absolute;bottom:7%;width:100%;margin:0;text-align:center;font-size:3.55cqw;font-weight:550;letter-spacing:.07em;text-shadow:0 2px 4px #651508}
.opening{position:absolute;inset:0;z-index:5;pointer-events:none;overflow:hidden}
.opening::before{content:"";position:absolute;inset:0;background:linear-gradient(#430c23b8,#760d2580 62%,#370513b0);opacity:0;transition:opacity .65s ease-out}
.opening.revealing::before{opacity:1}
.home.is-opening .chooser,.home.is-opening .conveyor-controls,.home.is-opening .instruction{opacity:0;pointer-events:none}
.home.is-opening .case:not([data-chosen=true]){opacity:0}
#opening-frame{position:absolute;display:block;max-width:none;height:auto;transform-origin:68% 71%;will-change:transform}
.celebration{position:absolute;width:0;height:0}
.celebration::before,.celebration::after{content:"";position:absolute;pointer-events:none}
.celebration::before{width:155cqw;height:115cqw;left:-87cqw;top:-57cqw;border-radius:50%;opacity:0;
  background:radial-gradient(ellipse,#fff9d9 4%,#ffdc82e8 21%,#ffb64cab 38%,#ff7c432b 58%,transparent 72%);mix-blend-mode:screen}
.celebration::after{inset:-18cqw auto auto -18cqw;width:36cqw;height:36cqw;border:2px solid #ffdea0;border-radius:50%;opacity:0;box-shadow:0 0 19px #ffbf64,inset 0 0 13px #ffca73}
.celebration.burst::before{animation:glow .92s ease-out both}
.celebration.burst::after{animation:ring-out .75s ease-out both}
.beam-field{position:absolute;width:1px;height:1px;opacity:0;mix-blend-mode:screen}
.beam{position:absolute;width:var(--length);height:var(--spread);left:-3cqw;top:calc(var(--spread)*-.5);transform-origin:3cqw 50%;
  transform:rotate(var(--angle));clip-path:polygon(0 43%,100% 0,100% 100%,0 57%);background:linear-gradient(90deg,#fff6c2,#ffcb6ccf 37%,#ffad4b55 69%,transparent);filter:blur(1px)}
.burst .beam-field{animation:beams-out .9s cubic-bezier(.12,.64,.23,1) both}
.box-core{position:absolute;left:-16cqw;top:-11cqw;width:32cqw;height:22cqw;opacity:0;background:radial-gradient(ellipse,#fffdf1,#fff3aacb 30%,#ffca6266 52%,transparent 73%);mix-blend-mode:screen}
.burst .box-core{animation:glow .65s ease-out both}
.wish-flight{position:absolute;object-fit:contain;opacity:0;filter:drop-shadow(0 2px 2px #661809b0) drop-shadow(0 0 14px #ffba5f8c);will-change:transform,opacity}
.opening.revealing .wish-flight{animation:wish-out .72s both}
.spark{position:absolute;opacity:0;left:0;top:0;width:var(--w);height:var(--h);border-radius:1px;background:var(--color);transform:translate(-50%,-50%)}
.spark.star{clip-path:polygon(50% 0,61% 37%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 37%);filter:drop-shadow(0 0 4px #ffe6a5)}
.burst .spark{animation:sparkfly .71s cubic-bezier(.12,.61,.29,1) both;animation-delay:var(--delay)}
@keyframes sparkfly{0%{opacity:0;transform:scale(.15)}14%{opacity:1}65%{opacity:1}100%{opacity:0;transform:translate(var(--x),var(--y)) rotate(var(--rot)) scale(.53)}}
@keyframes glow{0%{opacity:0;transform:scale(.28)}20%{opacity:1}49%{opacity:.78}100%{opacity:.09;transform:scale(1.35)}}
@keyframes ring-out{0%{opacity:0;transform:scale(.22,.12)}21%{opacity:.87}100%{opacity:0;transform:scale(3.45,2.4)}}
@keyframes beams-out{0%{opacity:0;transform:rotate(-7deg) scale(.17)}22%{opacity:.94}58%{opacity:.66}100%{opacity:0;transform:rotate(6deg) scale(1.18)}}
@keyframes wish-out{
  0%{opacity:0;transform:translate(var(--fly-x),var(--fly-y)) rotate(-12deg) scale(.09)}
  18%{opacity:1;animation-timing-function:cubic-bezier(.12,.6,.28,1)}
  74%{opacity:1;transform:translate(0,-5px) rotate(1deg) scale(1.045)}
  100%{opacity:1;transform:translate(0,0) rotate(0) scale(1);filter:drop-shadow(0 0 0 #66180900) drop-shadow(0 0 0 #ffba5f00)}
}

.red-paper{background:var(--inner-background,url('assets/inner/red.webp')) center/100% 100% no-repeat #ae1230;isolation:isolate}
.red-paper::before{content:"";position:absolute;inset:0;background:var(--inner-texture,url('assets/inner/paper.webp')) repeat;opacity:.25;mix-blend-mode:soft-light;pointer-events:none;z-index:-1}
.red-paper,.cream{display:flex;flex-direction:column;padding:20px 5% max(19px,env(safe-area-inset-bottom))}
.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;gap:20px}
.brand{width:32%;min-width:95px;height:auto}
.text-button{min-height:37px;text-decoration:underline;text-underline-offset:5px;text-decoration-color:#ffe7c083;font-size:13px;white-space:nowrap}
.back{min-height:36px;align-self:flex-start;color:#f5d0a4;font-size:13px}
h1,h2,p{margin:0}
h1{font-size:clamp(22px,5.8cqw,28px);line-height:1.25}
h1:focus{outline:none}
.result-main{flex:1;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:12px 0 18px}
.result-art{width:92%;height:clamp(160px,38svh,340px);margin:4px 0}
.result-art img{width:100%;height:100%;object-fit:contain}
.result.measuring{position:absolute;inset:0 0 auto;visibility:hidden;pointer-events:none}
.result.has-arrived :is(.header,.back,.result-main>h1,.wish-name,.wish-line,.actions){animation:result-arrive .29s ease-out both}
@keyframes result-arrive{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}
.wish-name{font-size:16px;font-weight:750;color:#ffe9b8}
.wish-line{font-size:13px;color:#f8d798;line-height:1.55;max-width:90%}
.actions{display:grid;gap:10px}
.button{width:100%;min-height:49px;display:flex;align-items:center;justify-content:center;gap:11px;padding:12px 16px;border:1px solid transparent;
 text-align:center;font-size:15px;font-weight:700;line-height:1.35;border-radius:99px;text-decoration:none;cursor:pointer}
.button:active{transform:translateY(1px)}
.button-cream{background:#fff1ce;color:#a71027;box-shadow:0 4px 0 #740f2870}
.button-outline{border-color:#ffdbb5b3;color:var(--cream)}
.button-red{background:#bf1535;color:#fff4db}
.button-red-outline{border-color:#c22344;color:#a31132}
.again{margin:2px auto 0}
.cream{background:var(--cream-background,url('assets/inner/cream.webp')) center/100% 100% no-repeat var(--ivory);color:var(--ink)}
.modal-header{display:flex;justify-content:space-between;align-items:center;gap:10px}
.close{font-family:system-ui,sans-serif;min-width:44px;min-height:44px;font-size:29px;color:#a5263e}
.wall-tip{margin:clamp(9px,2.1svh,24px) 0 12px;text-align:center;font-size:12px;color:#8c6252}
.wall-frame{flex:1;min-height:0;display:grid;place-items:center;padding:0 0 15px}
.wall-frame img{object-fit:contain;width:auto;height:auto;max-height:min(59svh,630px);max-width:86%;border-radius:9px;box-shadow:0 4px 15px #86461812}
.wall-frame img,#photo-image{-webkit-touch-callout:default;user-select:auto}
.greeting h1{margin:6px 0 14px}
.greeting-form,.greeting-output{display:grid;gap:8px;width:100%}
.greeting-wish{display:grid;justify-items:center;gap:8px;margin-bottom:12px}
.greeting-wish img{height:clamp(98px,21svh,184px);width:80%;object-fit:contain}
.greeting-wish p{color:#ffe4aa;font-size:14px;font-weight:700}
.greeting-form label{font-size:14px;font-weight:700}
.greeting-form input{width:100%;min-height:46px;padding:11px 14px;background:#fff1d5;color:#802037;border:1px solid #ffdfab;border-radius:11px;font:inherit;font-size:16px}
.greeting-form input::placeholder{color:#91614f}
.greeting-form input:focus-visible{outline:2px solid #ffce7d;outline-offset:2px}
.greeting-form label:not(:first-of-type){margin-top:7px}
.greeting-form .button{margin-top:12px}
.greeting-form .button:disabled{opacity:.66;cursor:progress}
.greeting-error,.greeting-note{font-size:12px;color:#ffe1b6}
.greeting-output{justify-items:center;gap:10px}
.greeting-output img{width:auto;height:auto;max-width:93%;max-height:54svh;object-fit:contain;border-radius:8px;box-shadow:0 7px 25px #65031955;-webkit-touch-callout:default;user-select:auto}
.greeting-output .actions{width:100%}
.photo-overlay{position:fixed;z-index:20;inset:0;display:grid;place-items:center;padding:12px;background:#280811ab;overscroll-behavior:contain}
.photo-save{display:flex;flex-direction:column;border-radius:16px;padding:10px 16px 16px;width:min(100%,410px);max-height:calc(100vh - 24px);max-height:100%;overflow:hidden}
.photo-content{min-height:0;overflow:auto;overscroll-behavior:contain}
.photo-save h2{font-size:20px}
.photo-save .wall-tip{margin:3px 0 12px;line-height:1.5}
#photo-image{width:auto;height:auto;max-height:67vh;max-height:67svh;max-width:100%;object-fit:contain;margin:0 auto;border-radius:8px}
#close-photo,#generate-greeting{touch-action:manipulation}
.sticker h1{margin:5px 0 13px}
.voucher{background:#fff0d6;border:1px solid #fff2da;outline:1px solid #dea873;outline-offset:-7px;border-radius:12px;padding:15px 14px 16px;color:#852137;text-align:center}
.voucher-state{font-size:12px;color:#b82f40;margin-bottom:8px}
.claim-code{display:flex;align-items:center;justify-content:center;gap:9px;margin:0 auto 12px;color:#981831;font-size:14px}
.claim-code strong{font-size:clamp(20px,7cqw,30px);font-variant-numeric:tabular-nums;letter-spacing:.12em}
#save-voucher:disabled{opacity:.55;cursor:default}
.stores-list{margin-top:14px;padding:12px 14px;border:1px solid #ffc78b80;border-radius:10px;font-size:13px}
.stores-list ul{margin:10px 0 0;padding-left:18px}
.stores-list li+li{margin-top:8px}
.multiline{white-space:pre-line}
.sticker-sheet{height:clamp(155px,35svh,315px);width:auto;margin:0 auto 8px;border-radius:3px}
.voucher h2{font-size:21px;line-height:1.3}
.sticker-pick{margin:7px auto 0;display:flex;align-items:center;justify-content:center;gap:7px;font-size:13px;font-weight:650;color:#964441}
.sticker-pick img{width:auto;height:28px;max-width:44px;object-fit:contain;padding:2px;border-radius:3px;background:#bc24317d}
.voucher-copy{margin:9px 0 0;border-top:1px solid #e1c7a2;padding-top:10px;font-size:clamp(11px,3.2cqw,13px);line-height:1.6}
.voucher-note{margin-top:6px;font-size:11px;color:#896954;line-height:1.45}
.sticker .actions{margin-top:auto;padding-top:14px}
.toast{position:fixed;z-index:20;left:50%;bottom:23px;transform:translateX(-50%);background:#391216;color:#fff0d2;border-radius:70px;padding:10px 16px;width:max-content;max-width:90vw;font-size:13px;pointer-events:none}
.rules{width:min(88vw,395px);border:0;border-radius:18px;background:#fff3da;color:#892035;padding:18px 20px;box-shadow:0 18px 70px #3e111585}
.rules::backdrop{background:#2d070ba0}
.rules h2{font-size:21px}
.rules p{line-height:1.6;margin:10px 0;font-size:14px}
.rules .button{margin-top:14px}
@media(min-width:530px){.app{width:min(470px,max(340px,50svh));box-shadow:0 0 65px #1f0108a0}}
@media(max-height:730px){.red-paper,.cream{padding-top:13px}.header{margin-bottom:5px}.result-main{gap:7px}.button{min-height:43px}.actions{gap:8px}.sticker-sheet{height:24svh}}
@media(prefers-reduced-motion:reduce){.case,.button{transition:none}.conveyor-toggle{display:none}.celebration.burst::before,.burst .spark,.result.has-arrived *{animation:none}}
