/* Layout: one 1440x900 stage scaled to fit the window, inside a block-print frame that game.js draws around the whole window. Arched ceremony niches across the top, the dealt spread below. */
:root{
  --ground:#F4ECDD; --paper:#FFFBF3; --ink:#3B2B27; --ink-soft:#5E4840; --suit-red:#B23A3A;
  --rose:#A93B63; --rose-deep:#7E2648; --bloom:#D9478A; --marigold:#E7A93C; --sage:#6F8F4E; --leaf:#6E9150; --stem:#557A3A;
  --display:'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --body:Figtree, 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}
html,body{height:100%}
html{background:var(--ground)}
[hidden]{display:none !important}
body{margin:0;padding:0;background:var(--ground);color:var(--ink);font-family:var(--body);overflow:hidden}
#fit{position:relative;width:100%;height:100%;overflow:hidden}
#stage{position:absolute;left:0;top:0;width:1440px;height:900px;transform-origin:0 0;background:var(--ground);overflow:hidden;user-select:none;-webkit-user-select:none}
/* The frame is drawn by game.js around the whole window (or the whole scrolling page on phone). */
.frame-view{position:absolute;left:0;top:0;z-index:40;pointer-events:none}
.frame-view svg{display:block}
.screen{position:absolute;inset:0}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
a,.link{color:var(--rose);font-size:14px;font-weight:500;text-decoration:underline;text-underline-offset:4px;cursor:pointer}
.link:hover{color:var(--rose-deep)}
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
:focus-visible{outline:3px solid var(--bloom);outline-offset:3px;border-radius:6px}
.btn{display:inline-flex;align-items:center;justify-content:center;height:50px;padding:0 36px;border-radius:25px;background:var(--rose);color:#FFF6EC;font-size:15px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;box-shadow:0 4px 0 var(--rose-deep),0 12px 20px rgba(120,40,70,.3);transition:transform .12s,box-shadow .12s}
.btn:hover{transform:translateY(-1px)}
.btn:active{transform:translateY(3px);box-shadow:0 1px 0 var(--rose-deep),0 6px 10px rgba(120,40,70,.25)}
.caps{font-family:var(--display);font-weight:600;letter-spacing:.3em;font-size:13px;color:var(--ink-soft)}
.title-sm{margin:0;font-family:var(--display);font-style:italic;font-size:28px;font-weight:500;color:var(--rose)}
header.bar{position:absolute;top:80px;left:96px;right:96px;display:flex;align-items:center;justify-content:space-between;z-index:5}

/* Arches */
.rim{position:relative;border-radius:999px 999px 0 0;background:var(--marigold);box-shadow:0 2px 0 rgba(255,255,255,.55) inset,0 40px 60px -24px rgba(90,40,30,.45);padding:16px 16px 0;box-sizing:border-box}
.rim2{height:100%;border-radius:999px 999px 0 0;background:var(--rose);outline:3px dotted #F6E3C2;outline-offset:-9px;padding:18px 18px 0;box-sizing:border-box;box-shadow:inset 0 3px 6px rgba(80,20,40,.35)}
.recess{position:relative;height:100%;border-radius:999px 999px 0 0}
.step-top{height:20px;background:linear-gradient(#F7E8CC,#E9D3AD);border-radius:3px 3px 0 0;box-shadow:0 1px 0 #FFF7E6 inset}
.step-front{display:flex;justify-content:center;align-items:center;gap:14px;height:46px;background:var(--rose);box-shadow:inset 0 4px 6px rgba(60,10,30,.35),0 26px 30px -14px rgba(70,30,30,.5)}
.dia{width:15px;height:15px;transform:rotate(45deg);background:var(--marigold);display:flex;align-items:center;justify-content:center}
.dia i{width:5px;height:5px;border-radius:50%;background:var(--rose)}

/* Intro flowers */
.stem{position:absolute;bottom:72px;width:4px;background:var(--stem);border-radius:2px}
.leaf{position:absolute;width:44px;height:16px;border-radius:50%;background:var(--leaf);box-shadow:inset 0 -3px 0 rgba(30,50,15,.25)}
.mari{position:absolute;width:96px;height:96px;border-radius:50%;background:repeating-radial-gradient(circle,#F2A23A 0 6px,#E0742A 6px 11px,#C9462C 11px 14px);box-shadow:0 10px 16px rgba(120,50,20,.3),inset 0 -6px 10px rgba(110,30,10,.35)}
.mari i{position:absolute;left:38px;top:38px;width:20px;height:20px;border-radius:50%;background:#F7D26A}
.bract{position:absolute;width:26px;height:26px;border-radius:3px 18px 3px 18px;background:var(--bloom);box-shadow:inset -3px -3px 0 rgba(120,20,60,.25),0 4px 6px rgba(120,20,60,.2)}
.back{position:absolute;width:170px;height:238px;border-radius:9px;box-shadow:0 2px 2px rgba(60,30,20,.2),0 24px 30px -8px rgba(60,30,20,.45)}

/* Niches */
.niches{position:absolute;top:128px;left:0;right:0;display:flex;justify-content:center;gap:44px;z-index:3}
.niche{display:flex;flex-direction:column;align-items:center}
.n-rim{width:220px;height:176px;border-radius:110px 110px 0 0;background:var(--marigold);padding:8px 8px 0;box-sizing:border-box;box-shadow:0 2px 0 rgba(255,255,255,.55) inset,0 22px 30px -18px rgba(90,40,30,.45);transition:box-shadow .4s}
.niche.locked .n-rim{box-shadow:0 2px 0 rgba(255,255,255,.55) inset,0 0 0 4px rgba(231,169,60,.35),0 0 30px rgba(231,169,60,.55),0 22px 30px -18px rgba(90,40,30,.45)}
.n-rim2{height:100%;border-radius:104px 104px 0 0;padding:7px 7px 0;box-sizing:border-box;outline:2px dotted #F6E3C2;outline-offset:-5px}
.n-recess{height:100%;border-radius:98px 98px 0 0;display:flex;align-items:flex-end;justify-content:center;gap:8px;padding-bottom:12px;box-sizing:border-box}
.sill-top{width:238px;height:9px;background:linear-gradient(#F7E8CC,#E5CDA4);border-radius:2px 2px 0 0}
.sill-front{width:250px;height:14px;background:repeating-linear-gradient(90deg,var(--rose) 0 10px,var(--marigold) 10px 13px);box-shadow:inset 0 3px 4px rgba(60,10,30,.35),0 14px 16px -10px rgba(70,30,30,.45)}
.cer{margin:10px 0 0}
.niche.locked .cer{color:var(--rose)}
.slot{position:relative;width:62px;height:87px;border-radius:5px;border:1.5px dashed rgba(255,248,235,.85);box-sizing:border-box;display:flex;align-items:center;justify-content:center;font:italic 600 20px/1 var(--display);color:rgba(255,248,235,.95);transition:transform .35s cubic-bezier(.2,.8,.2,1),box-shadow .2s,background .2s}
.slot.glow{border:2px solid #EEF7E2;background:rgba(110,145,80,.22);box-shadow:0 0 0 4px rgba(120,170,80,.55),0 0 22px rgba(150,205,110,.9)}
.slot.filled{border:0;overflow:hidden;box-shadow:0 2px 2px rgba(40,30,20,.2),0 10px 14px -4px rgba(40,30,20,.45)}
.slot.filled img{display:block;width:100%;height:100%}
.slot .ph .pip{font-size:22px}
.slot .ph .art{inset:8px 6px}
.slot .ph .note{display:none}
.slot .ph .ix{font-size:9px}
.niche.locked .slot.k{transform:rotate(6deg) translateX(-14px);z-index:2}
.niche.locked .slot.q{transform:rotate(-7deg) translateX(14px);z-index:1}
.niche.locked .n-recess{flex-direction:row-reverse}

/* Cards */
.card{position:relative;display:block;width:140px;height:196px;border-radius:9px;overflow:hidden;background:#fff;box-shadow:0 2px 2px rgba(60,30,20,.18),0 18px 26px -8px rgba(60,30,20,.42);transition:transform .25s cubic-bezier(.2,.8,.2,1),box-shadow .25s}
.card img{display:block;width:100%;height:100%;pointer-events:none}
.card.royal{outline:2px solid var(--marigold);outline-offset:3px}
.ph{position:absolute;inset:0;background:#fff;border-radius:9px}
.ph .art{position:absolute;inset:14px 13px;border-radius:5px;background:repeating-linear-gradient(135deg,#F6EEE0 0 7px,#FBF6EC 7px 14px);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px}
.ph .pip{font-size:44px;line-height:1;color:#2C2523;opacity:.85}
.ph.red .pip,.ph.red .ix{color:var(--suit-red)}
.ph .note{font-size:9.5px;letter-spacing:.14em;text-transform:uppercase;color:#8A7166}
.ph .ix{position:absolute;top:5px;left:6px;font:600 15px/1 var(--display);text-align:center;color:#2C2523;background:#fff;padding:2px 3px;border-radius:0 0 6px 0;z-index:1}
.ph .ix.b{top:auto;left:auto;bottom:5px;right:6px;transform:rotate(180deg)}
.foil{position:absolute;inset:0;background:linear-gradient(115deg,transparent 35%,rgba(255,214,120,.55) 45%,rgba(255,250,235,.8) 50%,rgba(232,150,42,.45) 55%,transparent 65%);background-size:260% 100%;mix-blend-mode:screen;pointer-events:none;opacity:0;transition:opacity .25s}
.lifted .foil{opacity:1;animation:sheen 2.6s ease-in-out infinite}
@keyframes sheen{0%{background-position:110% 0}100%{background-position:-40% 0}}

/* Spread */
.floor{position:absolute;left:230px;top:624px;width:980px;height:110px;border-radius:50%;background:radial-gradient(ellipse,rgba(120,70,40,.2),rgba(120,70,40,0) 70%);pointer-events:none}
.spread{position:absolute;left:220px;top:355px;width:1000px;height:340px;perspective:1600px;z-index:4}
.spread-tilt{position:absolute;inset:0;transform:rotateX(10deg);transform-origin:50% 90%;transform-style:preserve-3d}
/* The tilted container shares the cards' 3D plane and would otherwise win hit tests on parts of cards. */
.spread-tilt{pointer-events:none}
.spot{pointer-events:auto}
.spot{position:absolute;width:140px;display:flex;flex-direction:column;align-items:center;gap:10px}
.spot.deal{animation:dealIn .55s cubic-bezier(.2,.8,.2,1) both;animation-delay:calc(var(--i) * 70ms)}
@keyframes dealIn{from{opacity:0;translate:0 -140px}}
.spot.lifted{z-index:10}
.spot.lifted .card{transform:translateY(-12px) scale(1.3);box-shadow:0 3px 3px rgba(60,30,20,.18),0 34px 40px -10px rgba(60,30,20,.5)}
.spot .card.shake{animation:shake .42s}
@keyframes shake{20%{translate:-10px 0}40%{translate:9px 0}60%{translate:-6px 0}80%{translate:4px 0}}
.lbl{margin:0;font-size:13px;font-weight:500;text-align:center;color:var(--ink);transition:opacity .2s}
.spot.lifted .lbl{opacity:0}
.spot.dragging{opacity:.25}
.ghost{position:absolute;z-index:60;pointer-events:none;width:140px;height:196px;border-radius:9px;overflow:hidden;box-shadow:0 30px 40px -10px rgba(60,30,20,.55);transform:rotate(-4deg) scale(1.08)}
.ghost img{display:block;width:100%;height:100%}

/* Corner sprigs */
.corner{position:absolute;width:210px;height:210px;pointer-events:none;top:624px}
.cl-stem{position:absolute;background:var(--stem);border-radius:2px}
.cl-leaf{position:absolute;border-radius:50%;background:var(--leaf);box-shadow:inset 0 -3px 0 rgba(30,50,15,.25)}
.cl-bract{position:absolute;width:22px;height:22px;border-radius:3px 15px 3px 15px;background:var(--bloom);box-shadow:inset -3px -3px 0 rgba(120,20,60,.25),0 4px 6px rgba(120,20,60,.2)}
.cl-dot{position:absolute;border-radius:50%;background:radial-gradient(circle at 40% 35%,#FFC24A,#E8962A 60%,#C9701A)}
.cl-mari{position:absolute;border-radius:50%;background:repeating-radial-gradient(circle,#F2A23A 0 5px,#E0742A 5px 9px,#C9462C 9px 11px);box-shadow:0 8px 12px rgba(120,50,20,.3),inset 0 -5px 8px rgba(110,30,10,.35)}
.cl-mari i{position:absolute;left:17px;top:17px;width:20px;height:20px;border-radius:50%;background:#F7D26A}

/* Meaning strip + actions */
.under{position:absolute;left:0;right:0;top:681px;display:flex;flex-direction:column;align-items:center;gap:26px;z-index:5}
.strip{display:flex;align-items:baseline;gap:14px;padding:9px 24px;min-height:24px;background:var(--paper);outline:7px dotted var(--ground);outline-offset:-3px;box-shadow:0 2px 2px rgba(60,30,20,.12),0 16px 22px -10px rgba(60,30,20,.35)}
.strip .sym{font:600 20px/1 var(--display);white-space:nowrap;color:var(--ink)}
.strip .sym.red{color:var(--suit-red)}
.strip .txt{font-size:15px;line-height:1.45;white-space:nowrap}
.strip .txt.quiet{color:var(--ink-soft)}
.toast{position:absolute;left:50%;top:356px;translate:-50% 0;z-index:30;background:var(--ink);color:#FBF3E6;font-size:14px;padding:9px 18px;border-radius:20px;box-shadow:0 10px 20px rgba(40,20,10,.25);opacity:0;transition:opacity .25s;pointer-events:none}
.toast.show{opacity:1}
/* Just married (after all four ceremonies) */
#married{background:var(--ground);z-index:20}
#married .big{position:absolute;width:160px;height:224px;border-radius:10px;overflow:hidden;box-shadow:0 3px 3px rgba(40,30,20,.2),0 30px 40px -10px rgba(40,30,20,.55)}
#married .big img{display:block;width:100%;height:100%}
#married .big .foil{opacity:1;animation:sheen 2.6s ease-in-out infinite}

.bead{position:absolute;width:22px;height:22px;border-radius:50%;background:repeating-radial-gradient(circle,#F2A23A 0 3px,#E0742A 3px 6px,#C9462C 6px 8px);box-shadow:0 3px 4px rgba(120,50,10,.35),inset 0 -2px 3px rgba(110,30,10,.35)}
.br{position:absolute;width:18px;height:18px;border-radius:2px 12px 2px 12px;background:var(--bloom);box-shadow:inset -2px -2px 0 rgba(120,20,60,.25),0 3px 4px rgba(120,20,60,.25)}
/* Entrance, about 2.5s: fade in over the fading play screen, arch rises, couple meet,
   garland blooms bead by bead, then the caption, title and button. */
#play.leaving{animation:playOut .9s ease forwards}
@keyframes playOut{to{opacity:0;scale:1.03;filter:blur(2px)}}
#married.show{animation:fadeIn .8s ease both}
#married.show .married-arch{animation:rise 1s cubic-bezier(.2,.8,.2,1) .25s both}
#married.show .big-k{animation:fromLeft .9s cubic-bezier(.2,.8,.2,1) .7s both}
#married.show .big-q{animation:fromRight .9s cubic-bezier(.2,.8,.2,1) .7s both}
#married.show #garland > *{animation:bloom .45s cubic-bezier(.2,.8,.3,1.4) both;animation-delay:calc(1.05s + var(--i) * 20ms)}
#married.show .married-caps{animation:riseIn .7s ease 1.6s both}
#married.show .married-title{animation:riseIn .9s cubic-bezier(.2,.8,.2,1) 1.8s both}
#married.show .married-continue{animation:riseIn .6s ease 2.3s both}
@keyframes fadeIn{from{opacity:0}}
@keyframes fromLeft{from{opacity:0;translate:-70px 0}}
@keyframes fromRight{from{opacity:0;translate:70px 0}}
@keyframes bloom{from{opacity:0;scale:.2}}
@keyframes riseIn{from{opacity:0;translate:0 14px}}
@keyframes rise{from{opacity:0;translate:0 30px}}

/* Finale */
.couples{position:absolute;top:184px;left:0;right:0;display:flex;justify-content:center;gap:64px}
.couple{display:flex;flex-direction:column;align-items:center;gap:10px}
.couple .pair{display:flex}
.mini{position:relative;width:76px;height:106px;border-radius:6px;overflow:hidden;box-shadow:0 2px 2px rgba(40,30,20,.2),0 10px 14px -4px rgba(40,30,20,.4);transition:transform .2s}
.mini img{display:block;width:100%;height:100%}
.couple .pair .mini:first-child{transform:rotate(-6deg) translateX(12px)}
.couple .pair .mini:last-child{transform:rotate(6deg) translateX(-12px)}
.couple .name{font-family:var(--display);font-style:italic;font-size:20px;font-weight:600;color:var(--rose)}
.fans{position:absolute;top:338px;left:0;right:0;display:grid;grid-template-columns:repeat(2,516px);justify-content:center;column-gap:84px;row-gap:22px}
.fan-row{display:flex;flex-direction:column;gap:10px}
.fan{display:flex;padding-top:8px;height:120px}
.fan .mini{flex:none;margin-left:-44px;cursor:pointer}
.fan .mini:first-child{margin-left:0}
.fan .mini.ph-mini .ph .pip{font-size:28px}
.fan .mini.ph-mini .ph .art{inset:9px 8px}
.fan .mini.ph-mini .ph .note{display:none}
.fan .mini.ph-mini .ph .ix{font-size:11px}
.fan .mini.on{transform:translateY(-14px) scale(1.12) !important;z-index:5}
.couple .mini.on{transform:translateY(-10px) scale(1.12) !important;z-index:5}

@media (prefers-reduced-motion: reduce){
  .spot.deal,#married.show .married-arch,#married.show .big-k,#married.show .big-q,#married.show #garland > *,#married.show .married-caps,#married.show .married-title,#married.show .married-continue,#play.leaving{animation:none}
  #married.show{animation:fadeIn .35s ease both}
  .lifted .foil,#married .big .foil{animation:none;background-position:40% 0}
  .card,.slot,.mini{transition:none}
}

/* Screen layout (desktop, 1440x900 stage). These were inline styles in the prototype. */
.flank{position:absolute;top:0;width:140px;height:900px}
.flank-l{left:180px}
.flank-r{left:1120px;transform:scaleX(-1)}
.intro-head{position:absolute;top:88px;left:0;right:0;display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center}
.intro-names{margin:0;font-size:15px;letter-spacing:.42em;color:var(--rose)}
.intro-title{margin:0;font-family:var(--display);font-style:italic;font-weight:500;font-size:64px;line-height:1.05;color:var(--rose)}
.intro-line{margin:2px 0 0;font-size:16px;color:var(--ink-soft)}
.intro-arch{position:absolute;left:500px;top:228px;width:440px;display:flex;flex-direction:column;align-items:center}
.intro-rim{width:440px;height:430px}
.intro-recess{background:radial-gradient(ellipse at 50% 85%,#B8CBA0,#8FA97B 70%);box-shadow:inset 0 28px 44px rgba(40,55,25,.5),inset 14px 0 24px rgba(40,55,25,.25),inset -14px 0 24px rgba(40,55,25,.25)}
.intro-stack{position:absolute;left:0;right:0;bottom:34px;height:270px;perspective:900px}
.back-1{left:72px;top:24px;transform:rotateX(14deg) rotateZ(-12deg) translateZ(-20px)}
.back-2{left:132px;top:24px;transform:rotateX(14deg) rotateZ(10deg) translateZ(-10px)}
.back-3{left:102px;top:12px;transform:rotateX(14deg) translateZ(10px)}
.intro-step-top{width:500px}
.intro-step-front{width:540px}
.intro-actions{position:absolute;left:0;right:0;bottom:70px;display:flex;flex-direction:column;align-items:center;gap:14px}
.corner-l{left:66px}
.corner-r{left:1164px;transform:scaleX(-1)}
.married-rim{position:absolute;left:470px;top:134px;width:500px;height:470px;box-shadow:0 2px 0 rgba(255,255,255,.55) inset,0 0 0 6px rgba(231,169,60,.25),0 0 60px rgba(231,169,60,.45),0 40px 60px -24px rgba(90,40,30,.45)}
.married-cards{position:absolute;inset:0;perspective:1000px}
.big-k{left:98px;top:140px;transform:rotateY(14deg) rotateZ(-5deg)}
.big-q{left:176px;top:140px;transform:rotateY(-14deg) rotateZ(5deg);z-index:2}
.married-plinth{position:absolute;left:0;right:0;top:604px;display:flex;flex-direction:column;align-items:center}
.married-step-top{width:540px}
.married-step-front{width:580px}
.married-text{position:absolute;left:0;right:0;top:684px;display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center}
.married-caps{margin:0;letter-spacing:.32em;color:#8A5A12}
.married-title{margin:0;font-family:var(--display);font-style:italic;font-weight:500;font-size:48px;line-height:1;color:var(--rose)}
.married-continue{margin-top:10px}
.fin-head{position:absolute;top:80px;left:0;right:0;display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center}
.fin-title{margin:0;font-family:var(--display);font-style:italic;font-weight:500;font-size:48px;line-height:1.05;color:var(--rose)}
.fin-sub{margin:0;font-size:15px;color:var(--ink-soft)}
.fin-under{position:absolute;left:0;right:0;top:684px;display:flex;flex-direction:column;align-items:center;gap:18px}
.fin-actions{display:flex;flex-direction:column;align-items:center;gap:12px}
.fan-label{font-size:12px}
.intro-corner{display:none}

/* All four ceremonies complete: a full-window shower of petals and marigold beads over the Just Married screen. */
.shower{position:absolute;inset:0;z-index:35;pointer-events:none;overflow:hidden}
.shower i{position:absolute;top:-40px;left:var(--x);width:var(--w);height:var(--w);animation:fall var(--t) cubic-bezier(.35,.1,.65,1) var(--d) both}
.shower i.bead{background:repeating-radial-gradient(circle,#F2A23A 0 calc(var(--w) * .14),#E0742A calc(var(--w) * .14) calc(var(--w) * .27),#C9462C calc(var(--w) * .27) calc(var(--w) * .36))}
.shower i.br.soft{background:#EE8DB5}
@keyframes fall{0%{opacity:0;transform:translate(0,0) rotate3d(1,1,0,0deg)}6%{opacity:1}100%{opacity:.85;transform:translate(var(--sx),calc(100vh + 80px)) rotate3d(1,.6,.2,var(--r))}}
@media (prefers-reduced-motion: reduce){ .shower{display:none} }

/* Ceremony complete, in place: when a pair locks, a foil shimmer sweeps the niche and both cards,
   the marigold glow pulses, petals drift from the arch, and the label briefly reads
   "Ceremony complete" ("Just Married!" for The Wedding). Then play simply continues. */
.niche{position:relative}
.n-rim{position:relative}
.n-rim > .shine{border-radius:inherit}
.niche.celebrate .shine,.niche.celebrate .slot .foil{opacity:1;animation:sheen 1.3s ease-in-out 2}
.niche.celebrate{animation:nichePop .7s cubic-bezier(.2,.8,.2,1)}
.niche.celebrate .n-rim{animation:glowPulse 1.3s ease-in-out 2}
@keyframes nichePop{40%{transform:translateY(-6px) scale(1.03)}}
@keyframes glowPulse{50%{box-shadow:0 2px 0 rgba(255,255,255,.55) inset,0 0 0 6px rgba(231,169,60,.45),0 0 48px rgba(231,169,60,.85),0 22px 30px -18px rgba(90,40,30,.45)}}
.cer-wrap{position:relative;display:flex;justify-content:center}
.cheer{position:absolute;left:-20px;right:-20px;top:4px;margin:0;text-align:center;white-space:nowrap;font-family:var(--display);font-style:italic;font-weight:600;font-size:22px;line-height:1;color:var(--rose);opacity:0;pointer-events:none}
.niche.celebrate .cheer{animation:cheer 2.8s ease-out}
.niche.celebrate .cer{animation:cheerOut 2.8s ease-out}
@keyframes cheer{0%{opacity:0;translate:0 6px}12%,82%{opacity:1;translate:0 0}100%{opacity:0}}
@keyframes cheerOut{0%,100%{opacity:1}12%,82%{opacity:0}}
.petal{position:absolute;left:50%;top:22px;z-index:6;pointer-events:none;animation:petal 1.6s cubic-bezier(.2,.7,.3,1) forwards}
@keyframes petal{0%{opacity:0;transform:translate(-50%,0) rotate(0) scale(.6)}15%{opacity:1}100%{opacity:0;transform:translate(calc(-50% + var(--x)),var(--y)) rotate(var(--r)) scale(1)}}
@media (prefers-reduced-motion: reduce){
  .niche.celebrate,.niche.celebrate .n-rim{animation:none}
  .niche.celebrate .shine,.niche.celebrate .slot .foil{animation:none;background-position:40% 0}
  .petal{display:none}
}

/* Printed-card finish: a fine paper grain and soft light from the top left over every card face
   (spread, niche slots, finale, Just Married, drag ghost). Overlays only; the art files are untouched. */
.card::before,.mini::before,.slot.filled::before,#married .big::before,.ghost::before{content:'';position:absolute;inset:0;z-index:2;pointer-events:none;border-radius:inherit;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");background-size:160px 160px;mix-blend-mode:overlay;opacity:.5}
.card::after,.mini::after,.slot.filled::after,#married .big::after,.ghost::after{content:'';position:absolute;inset:0;z-index:3;pointer-events:none;border-radius:inherit;background:linear-gradient(150deg,rgba(255,252,240,.30) 0%,rgba(255,252,240,.08) 28%,rgba(255,255,255,0) 48%,rgba(70,40,20,.05) 72%,rgba(70,40,20,.15) 100%);box-shadow:inset 0 0 0 1px rgba(60,30,20,.10),inset 0 1px 0 rgba(255,255,255,.55),inset 0 0 18px rgba(80,50,30,.10)}

/* ---------- Phone layout (below 700px wide), mockups P1–P4 ----------
   A 390x844 stage (390x1234 for the scrolling finale), scaled to the screen by game.js.
   Everything phone-specific lives in this block, so desktop is untouched. */
@media (max-width: 699px){
  #stage{width:390px;height:844px}
  #stage.tall{height:1234px}
  #fit:has(#stage.tall){overflow-y:auto;-webkit-overflow-scrolling:touch}
  .btn{height:50px;padding:0 30px;border-radius:25px;font-size:13.5px}
  .link{font-size:13px}
  header.bar{top:46px;left:44px;right:43px}
  .title-sm{font-size:21px}
  .dia{width:10px;height:10px}
  .dia i{width:3px;height:3px}

  /* Intro (P1) */
  .flank{display:none}
  .intro-head{top:56px;gap:3px}
  .intro-names{font-size:11px}
  .intro-title{font-size:42px}
  .intro-line{margin:4px 0 0;max-width:250px;font-size:14px;line-height:1.45}
  .intro-arch{left:60px;top:200px;width:270px}
  .intro-rim{width:270px;height:288px;padding:10px 10px 0;box-shadow:0 2px 0 rgba(255,255,255,.55) inset,0 26px 40px -18px rgba(90,40,30,.45)}
  .intro-rim .rim2{padding:10px 10px 0;outline-width:2px;outline-offset:-5px}
  .intro-stack{bottom:20px;height:170px;perspective:600px}
  .back{width:96px;height:134px;border-radius:6px;box-shadow:0 2px 2px rgba(60,30,20,.2),0 14px 18px -6px rgba(60,30,20,.45)}
  .back-1{left:33px;top:14px}
  .back-2{left:101px;top:14px}
  .back-3{left:67px;top:7px}
  .step-top{height:12px}
  .step-front{height:28px;gap:9px}
  .step-front .dia:nth-child(n+16){display:none}
  .intro-step-top{width:298px}
  .intro-step-front{width:324px}
  .intro-actions{bottom:176px;gap:12px}
  .intro-corner{display:block;top:686px;transform-origin:0 0}
  .intro-corner-l{left:31px;transform:scale(.55)}
  .intro-corner-r{left:359px;transform:scale(-.55,.55)}

  /* Play (P2) */
  .corner-l,.corner-r,.floor{display:none}
  .niches{top:86px;display:grid;grid-template-columns:repeat(2,150px);justify-content:center;column-gap:8px;row-gap:12px}
  .n-rim{width:132px;height:104px;border-radius:66px 66px 0 0;padding:5px 5px 0;box-shadow:0 2px 0 rgba(255,255,255,.55) inset,0 14px 20px -12px rgba(90,40,30,.45)}
  .niche.locked .n-rim{box-shadow:0 2px 0 rgba(255,255,255,.55) inset,0 0 0 3px rgba(231,169,60,.35),0 0 20px rgba(231,169,60,.55),0 14px 20px -12px rgba(90,40,30,.45)}
  .n-rim2{border-radius:61px 61px 0 0;padding:4px 4px 0;outline-width:1.5px;outline-offset:-3px}
  .n-recess{border-radius:57px 57px 0 0;gap:5px;padding-bottom:7px}
  .sill-top{width:142px;height:5px}
  .sill-front{width:150px;height:10px;background:repeating-linear-gradient(90deg,var(--rose) 0 7px,var(--marigold) 7px 9px)}
  .cer{margin-top:6px;font-size:9.5px;letter-spacing:.16em;white-space:nowrap}
  .cheer{font-size:15px;top:3px}
  .slot{width:38px;height:53px;border-radius:3px;font-size:14px}
  .slot.glow{box-shadow:0 0 0 3px rgba(120,170,80,.55),0 0 14px rgba(150,205,110,.9)}
  .niche.locked .slot.k{transform:rotate(6deg) translateX(-9px)}
  .niche.locked .slot.q{transform:rotate(-7deg) translateX(9px)}
  .spread{left:0;top:395px;width:390px;height:300px;perspective:1000px}
  .spread-tilt{transform:rotateX(6deg)}
  .spot{width:84px;gap:6px}
  .card{width:84px;height:118px;border-radius:6px;touch-action:none;box-shadow:0 2px 2px rgba(60,30,20,.18),0 12px 18px -6px rgba(60,30,20,.42)}
  .card.royal{outline-width:1.5px;outline-offset:2px}
  .ph{border-radius:6px}
  .card .ph .art{inset:9px 8px}
  .card .ph .pip{font-size:28px}
  .card .ph .note{font-size:7px}
  .card .ph .ix{font-size:10px;top:3px;left:4px}
  .card .ph .ix.b{top:auto;left:auto;bottom:3px;right:4px}
  .spot.lifted .card{transform:translateY(-8px) scale(1.25);box-shadow:0 3px 3px rgba(60,30,20,.18),0 22px 28px -8px rgba(60,30,20,.5)}
  @keyframes dealIn{from{opacity:0;translate:0 -80px}}
  .lbl{font-size:11px;white-space:nowrap}
  .ghost{width:84px;height:118px;border-radius:6px}
  .under{top:703px;gap:14px}
  .strip{box-sizing:border-box;width:313px;min-height:54px;align-items:center;gap:10px;padding:8px 14px;outline-width:5px;outline-offset:-2px}
  .strip .sym{font-size:17px}
  .strip .txt{font-size:13px;white-space:normal}
  #dealBtn{height:44px;border-radius:22px}
  .toast{top:40px;max-width:300px;width:max-content;text-align:center;font-size:12.5px;padding:8px 14px}
  /* Just married (P3) */
  .married-rim{left:45px;top:130px;width:300px;height:312px;padding:10px 10px 0;box-shadow:0 2px 0 rgba(255,255,255,.55) inset,0 0 0 4px rgba(231,169,60,.25),0 0 40px rgba(231,169,60,.45),0 26px 40px -18px rgba(90,40,30,.45)}
  .married-rim .rim2{padding:10px 10px 0;outline-width:2px;outline-offset:-5px}
  #married .big{width:104px;height:146px;border-radius:7px}
  .big-k{left:54px;top:114px}
  .big-q{left:104px;top:114px}

  .bead{width:14px;height:14px;background:repeating-radial-gradient(circle,#F2A23A 0 2px,#E0742A 2px 4px,#C9462C 4px 5px)}
  .br{width:12px;height:12px;border-radius:2px 8px 2px 8px}
  .married-plinth{top:442px}
  .married-step-top{width:310px;height:11px}
  .married-step-front{width:330px}
  .married-text{top:512px}
  .married-caps{font-size:10.5px}
  .married-title{font-size:40px}
  .married-continue{margin-top:18px}

  /* Finale / deck view (P4) */
  .fin-head{top:54px;gap:6px;padding:0 44px}
  .fin-title{font-size:34px}
  .fin-sub{font-size:12.5px;line-height:1.5;max-width:300px}
  .couples{top:150px;display:grid;grid-template-columns:repeat(2,150px);justify-content:center;column-gap:8px;row-gap:18px}
  .couple{gap:8px}
  .mini{width:60px;height:84px;border-radius:5px}
  .couple .pair .mini:first-child{transform:rotate(-6deg) translateX(10px)}
  .couple .pair .mini:last-child{transform:rotate(6deg) translateX(-10px)}
  .couple .name{font-size:15px}
  .couple .mini.on{transform:translateY(-8px) scale(1.12) !important}
  .fans{top:415px;grid-template-columns:306px;row-gap:19px}
  .fan-row{gap:8px}
  .fan-label{font-size:10.5px}
  .fan{padding-top:6px;height:84px}
  .fan .mini{width:50px;height:70px;margin-left:-25px;border-radius:4px}
  .fan .mini.ph-mini .ph .pip{font-size:20px}
  .fan .mini.ph-mini .ph .art{inset:6px 5px}
  .fan .mini.ph-mini .ph .ix{font-size:8px;top:3px;left:3px}
  .fan .mini.ph-mini .ph .ix.b{top:auto;left:auto;bottom:3px;right:3px}
  .fan .mini.on{transform:translateY(-10px) scale(1.2) !important}
  .mini .ph{border-radius:4px}
  .fin-under{top:948px;gap:14px}
}
