/* Brolly Boxes screen transition (W4, 21 Nov 2026): the screen is packed into a cardboard box. Four corrugated flaps fold shut
   (left, right, then top and bottom over them), brown packing tape zips across the seam, a paper shipping label gets the level
   stamp; then the tape tears and the flaps spring open. Above the map and the win card (.nm, z 20), below toasts (z 40).
   Motion is transform / opacity only, no filters; hidden (display none) when idle. */
.bx{position:fixed;inset:0;z-index:30;overflow:hidden;pointer-events:auto;perspective:1100px;perspective-origin:50% 50%;
  font-family:"Baloo 2","Trebuchet MS","Segoe UI",system-ui,sans-serif;font-weight:800;-webkit-user-select:none;user-select:none;touch-action:none;
  --bx-k:1;--bx-card:#c8995f;--bx-card2:#b98750;--bx-ink:#6b4424;--bx-tape:#a9743c}
.bx[hidden]{display:none}
.bx.open{pointer-events:none}
.bx.quick{--bx-k:.86}
/* the dark inside of the box: seen between the flaps while they fold */
.bx-in{position:absolute;inset:0;background:#3a2414;opacity:0;transition:opacity .18s linear}
.bx.shut .bx-in{opacity:1}
.bx.open .bx-in{opacity:0;transition:opacity .1s linear}
/* a flap: kraft board with faint flutes, a darker fold line at its hinge, the corrugated cut edge on its free side */
.bx-f{position:absolute;will-change:transform;backface-visibility:visible;
  background:repeating-linear-gradient(90deg,rgba(90,56,26,.07) 0 2px,rgba(255,236,200,.05) 2px 9px),linear-gradient(160deg,var(--bx-card),var(--bx-card2));
  transition:transform calc(.17s*var(--bx-k)) cubic-bezier(.3,1.28,.55,1)}
.bx-l,.bx-r{top:0;bottom:0;width:calc(50% + 1px)}
.bx-t,.bx-b{left:0;right:0;height:calc(50% + 1px);background:repeating-linear-gradient(90deg,rgba(90,56,26,.08) 0 2px,rgba(255,236,200,.06) 2px 9px),linear-gradient(170deg,#d2a56b,#c08e55)}
.bx-l{left:0;transform-origin:0 50%;transform:rotateY(-104deg);box-shadow:inset 26px 0 30px -18px rgba(60,34,14,.55)}
.bx-r{right:0;transform-origin:100% 50%;transform:rotateY(104deg);box-shadow:inset -26px 0 30px -18px rgba(60,34,14,.55);transition-delay:calc(.04s*var(--bx-k))}
.bx-t{top:0;transform-origin:50% 0;transform:rotateX(104deg);box-shadow:inset 0 26px 30px -18px rgba(60,34,14,.5),0 6px 14px rgba(40,20,8,.4);transition-delay:calc(.09s*var(--bx-k))}
.bx-b{bottom:0;transform-origin:50% 100%;transform:rotateX(-104deg);box-shadow:inset 0 -26px 30px -18px rgba(60,34,14,.5),0 -6px 14px rgba(40,20,8,.4);transition-delay:calc(.13s*var(--bx-k))}
.bx.shut .bx-f{transform:none}
/* open: top and bottom spring up first, the side flaps follow */
.bx.open .bx-f{transition:transform calc(.3s*var(--bx-k)) cubic-bezier(.55,-.3,.75,.5)}
.bx.open .bx-t{transition-delay:.05s}.bx.open .bx-b{transition-delay:.08s}.bx.open .bx-l{transition-delay:.11s}.bx.open .bx-r{transition-delay:.13s}
/* the corrugated cut edge (the wavy middle layer of the board, seen end-on) */
.bx-edge{position:absolute;background:repeating-linear-gradient(90deg,#7d532b 0 3px,#e6c592 3px 5px,#b98a55 5px 8px);box-shadow:0 0 0 1px rgba(70,42,18,.5)}
.bx-t .bx-edge{left:0;right:0;bottom:0;height:9px}
.bx-b .bx-edge{left:0;right:0;top:0;height:9px}
.bx-l .bx-edge,.bx-r .bx-edge{top:0;bottom:0;width:9px;background:repeating-linear-gradient(0deg,#7d532b 0 3px,#e6c592 3px 5px,#b98a55 5px 8px)}
.bx-l .bx-edge{right:0}.bx-r .bx-edge{left:0}
/* printed "this way up" mark: two arrows over a bar in a frame, as shapes (no words) */
.bx-up{position:absolute;width:76px;height:82px;border:4px solid var(--bx-ink);border-radius:4px;opacity:.62;display:block}
.bx-t .bx-up{left:8%;top:22%;transform:rotate(-2deg)}
.bx-b .bx-up{right:8%;bottom:20%;transform:rotate(1.5deg)}
.bx-up i{position:absolute;top:9px;width:24px;height:46px;background:var(--bx-ink);clip-path:polygon(50% 0,100% 46%,68% 46%,68% 100%,32% 100%,32% 46%,0 46%)}
.bx-up i:nth-child(1){left:9px}.bx-up i:nth-child(2){right:9px}
.bx-up u{position:absolute;left:9px;right:9px;bottom:8px;height:6px;background:var(--bx-ink)}
/* packing tape across the seam: zips in from the left, then tears in the middle */
.bx-tape{position:absolute;left:-2%;right:-2%;top:50%;height:54px;margin-top:-27px;transform:scaleX(0);transform-origin:0 50%;
  transition:transform calc(.15s*var(--bx-k)) cubic-bezier(.4,0,.2,1) calc(.2s*var(--bx-k))}
.bx.shut .bx-tape{transform:none}
.bx-tape i{position:absolute;top:0;bottom:0;width:50.5%;opacity:.95;
  background:linear-gradient(rgba(255,240,205,.35),rgba(255,240,205,0) 22%,rgba(60,30,8,.0) 70%,rgba(60,30,8,.22)),linear-gradient(90deg,var(--bx-tape),#b98447 30%,#a06c34 62%,var(--bx-tape));
  transition:transform .26s cubic-bezier(.4,0,.9,.5),opacity .2s linear .06s}
.bx-tape .l{left:0;clip-path:polygon(0 0,100% 0,96% 14%,100% 30%,95% 48%,100% 64%,96% 82%,100% 100%,0 100%)}
.bx-tape .r{right:0;clip-path:polygon(0 0,100% 0,100% 100%,0 100%,4% 82%,0 64%,5% 48%,0 30%,4% 14%)}
.bx.open .bx-tape{transform:none;transition:none}
.bx.open .bx-tape .l{transform:translate3d(-58%,-34px,0) rotate(-9deg);opacity:0}
.bx.open .bx-tape .r{transform:translate3d(58%,30px,0) rotate(8deg);opacity:0}
/* the paper shipping label with the level stamp */
.bx-mid{position:absolute;left:50%;top:50%;width:0;height:0;display:flex;align-items:center;justify-content:center}
.bx-label{position:relative;flex:none;width:176px;height:122px;border-radius:5px;background:linear-gradient(#fffdf4,#f3e8cf);box-shadow:0 3px 0 rgba(70,42,18,.45),0 8px 16px rgba(40,20,8,.3);
  opacity:0;transform:translate3d(0,10px,0) rotate(-3deg) scale(.9);transition:transform calc(.14s*var(--bx-k)) cubic-bezier(.3,1.4,.5,1) calc(.16s*var(--bx-k)),opacity .08s linear calc(.16s*var(--bx-k))}
.bx.shut .bx-label{opacity:1;transform:rotate(-3deg)}
.bx.open .bx-label{opacity:0;transform:translate3d(-40px,-46px,0) rotate(-14deg) scale(.9);transition:transform .24s cubic-bezier(.4,0,.9,.5),opacity .16s linear .04s}
.bx-lines{position:absolute;left:14px;top:16px;width:74px;display:block}
.bx-lines u{display:block;height:6px;margin-bottom:9px;border-radius:3px;background:#cdbfa3}
.bx-lines u:nth-child(2){width:78%}.bx-lines u:nth-child(3){width:52%}
.bx-code{position:absolute;left:14px;bottom:14px;width:74px;height:26px;background:repeating-linear-gradient(90deg,#3a2a1e 0 2px,rgba(0,0,0,0) 2px 4px,#3a2a1e 4px 7px,rgba(0,0,0,0) 7px 9px,#3a2a1e 9px 10px,rgba(0,0,0,0) 10px 13px)}
.bx-name{position:absolute;left:10px;right:10px;bottom:10px;height:34px;display:grid;place-items:center;border-radius:3px;background:#fffdf4;color:#3a2a1e;font-size:15px;line-height:1.05;text-align:center;
  border-top:2px dashed #cdbfa3;overflow:hidden}
.bx-name[hidden]{display:none}
.bx.big .bx-label{width:min(86vw,260px);height:150px}
.bx.big .bx-name{font-size:17px;height:44px}
/* the stamp: a round ink mark that lands with a thump */
.bx-stamp{position:absolute;right:10px;top:10px;width:74px;height:74px;border-radius:50%;display:grid;place-items:center;color:#b8402f;border:4px solid #b8402f;box-shadow:inset 0 0 0 3px #fffdf4,inset 0 0 0 5px #b8402f;
  opacity:0;transform:scale(2.3) rotate(18deg);transition:transform calc(.13s*var(--bx-k)) cubic-bezier(.3,1.5,.5,1) calc(.27s*var(--bx-k)),opacity .06s linear calc(.27s*var(--bx-k))}
.bx.shut .bx-stamp{opacity:.92;transform:rotate(9deg)}
.bx-stamp b{font-size:34px;line-height:1;display:grid;place-items:center}
.bx-stamp b.long{font-size:25px}
.bx-stamp b.mk svg{display:block;width:40px;height:40px}
.bx.big .bx-stamp{top:8px}
@media (max-height:440px){.bx-tape{height:44px;margin-top:-22px}.bx-label{width:160px;height:108px}.bx-stamp{width:66px;height:66px}.bx-stamp b{font-size:29px}.bx.big .bx-label{height:128px}.bx-up{transform:scale(.8)}}
/* reduced motion: the closed box fades in and out, nothing travels or folds */
.bx.rm{opacity:0;transition:opacity .15s linear}
.bx.rm.shut{opacity:1}
.bx.rm .bx-f,.bx.rm .bx-tape,.bx.rm .bx-tape i{transform:none!important;transition:none}
.bx.rm .bx-in{opacity:1;transition:none}
.bx.rm .bx-label,.bx.rm .bx-stamp{transition:none}
.bx.rm .bx-label{opacity:1;transform:rotate(-3deg)}.bx.rm .bx-stamp{opacity:.92;transform:rotate(9deg)}

/* operator 22 Nov ("there should be a lot of brollys in the decor"): the removal firm's brolly mark printed on the side
   flaps, and brolly-print packing tape */
.bx-l::after,.bx-r::after,.bx-t::after,.bx-b::after{content:"";position:absolute;top:50%;width:min(132px,30vw);aspect-ratio:1;margin-top:max(-66px,-15vw);opacity:.5;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%236b4424' d='M50 9C26 9 7 27 4 51Q15 43 27 51Q38 43 50 51Q62 43 73 51Q85 43 96 51C93 27 74 9 50 9Z'/%3E%3Cpath fill='none' stroke='%23c8995f' stroke-width='2.4' d='M50 10Q38 28 27 51M50 10Q62 28 73 51M50 10V51'/%3E%3Crect fill='%236b4424' x='47' y='2' width='6' height='9' rx='2'/%3E%3Cpath fill='none' stroke='%236b4424' stroke-width='6' stroke-linecap='round' d='M50 50V82a9 9 0 0 1-18 0'/%3E%3C/svg%3E") center/contain no-repeat;pointer-events:none}
.bx-l::after{left:22%;transform:rotate(-8deg)}
.bx-r::after{right:22%;transform:rotate(7deg)}
.bx-t::after{top:auto;bottom:12%;margin-top:0;right:9%;transform:rotate(6deg)}
.bx-b::after{top:12%;margin-top:0;left:9%;transform:rotate(-5deg)}
.bx-tape i::after{content:"";position:absolute;inset:6px 0;opacity:.55;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%23f3dfb4' d='M50 9C26 9 7 27 4 51Q15 43 27 51Q38 43 50 51Q62 43 73 51Q85 43 96 51C93 27 74 9 50 9Z'/%3E%3Cpath fill='none' stroke='%23a9743c' stroke-width='2.4' d='M50 10Q38 28 27 51M50 10Q62 28 73 51M50 10V51'/%3E%3Crect fill='%23f3dfb4' x='47' y='2' width='6' height='9' rx='2'/%3E%3Cpath fill='none' stroke='%23f3dfb4' stroke-width='6' stroke-linecap='round' d='M50 50V82a9 9 0 0 1-18 0'/%3E%3C/svg%3E") 0 50%/38px 38px repeat-x;pointer-events:none}
.bx-tape .r::after{background-position:19px 50%}
