/* Recruiting by letter (letter.js, LetterService.php): a sealed letter of applicants, torn open along its top,
   and the applicants laid out on the table to choose from. The letter's light, its bursts and the tint are
   drawn over the page (canvases and layers letter.js adds); the envelope itself is all CSS here. */

/* ---------------------------------------------------------------- the table of applicants */
.pack-table { position: relative; display: flex; flex-wrap: wrap; gap: calc(var(--gap, 28px) + 8px) var(--gap, 28px);
  justify-content: center; align-content: flex-start; padding: 26px 0 30px; min-height: 340px; width: 100%; max-width: calc(var(--per, 3) * var(--cw, 220px) + (var(--per, 3) - 1) * var(--gap, 28px)); margin: 0 auto; }
.pack-table[hidden] { display: none; }
.pack-table .stage { width: var(--cw); flex: 0 0 var(--cw); cursor: pointer; transition: opacity .3s, translate .25s; }
.pack-table .cardback { border-width: max(3px, calc(var(--cw) * .025)); }
/* on a phone they overlap a little, like a hand of cards (letter.js layout) */
.pack-table.overlap { column-gap: 0; max-width: calc(var(--per, 3) * var(--cw, 220px) + (var(--per, 3) - 1) * var(--gap, 0px)); }
.pack-table.overlap .stage:not(:nth-child(3n + 1)) { margin-left: var(--gap); }
.pack-table.overlap .stage:nth-child(3n + 1) { rotate: -3deg; }
.pack-table.overlap .stage:nth-child(3n + 3) { rotate: 3deg; translate: 0 6px; }
.pack-table.overlap .stage:nth-child(3n + 1):nth-last-child(2) { rotate: 0deg; } /* (a lone card on its row: straight) */
.pack-table .stage.leaving { opacity: 0; translate: 0 30px; transition: opacity .5s, translate .5s; pointer-events: none; }
.draw.intro .pack-table { display: none; }
/* The letter fades up by itself (letter.js), so the table takes no part in the page's own fade-ins: they
   would start again as the scene settles and blink it out. */
main.draw > .pack-table, main.draw.arrive > .pack-table, main.view-in > .pack-table { animation: none; }
/* (the applicants' places stay hidden under the letter until they come out of it: not the stage's fade-in) */
.draw.arrive .pack-table .stage { animation: none; }

.pack-table.choosing:not(.focus) .stage:hover { translate: 0 -6px; }
/* one applicant looked over: their card and its pages (home.js chooseFrom) */
.pack-detail { width: 100%; display: grid; justify-items: center; margin: 18px 0 6px; text-align: left; } /* (the scene around it is centred; the card's pages are not) */
.pack-detail[hidden] { display: none; }
.draw.letters > .stage, .draw.letters > .recruit-wrap { display: none; }
.pack-note { text-align: center; color: var(--text-dim); min-height: 1.4em; margin: -6px 0 6px; }
.pack-note[hidden] { display: none; }
.pack-choose { display: flex; flex-direction: column; align-items: center; gap: 34px; margin: 0 0 14px; } /* (well apart, so a thumb meant for one never finds the other) */
.pack-choose #pack-back { min-height: 40px; padding: 8px 18px; border: 1px solid var(--btn2-line); border-radius: var(--btn-r); background: var(--btn2-bg); color: var(--btn2-fg); font: var(--btn-font); text-decoration: none; }
.pack-choose #pack-back:hover { border-color: var(--brass); color: var(--gold); }
.pack-choose[hidden] { display: none; }
.godbanner { text-align: center; font: 400 1.7rem/1.2 var(--display); color: #ffd166; text-shadow: 0 0 16px rgba(255, 209, 102, .9); margin: 4px 0 -6px; animation: godin .7s ease-out both; }
.godbanner[hidden] { display: none; }
@keyframes godin { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }

/* the room's lights go down while the tear runs into Epic (a little) and Legendary (more): letter.js dimLights */
.letter-dim { position: fixed; inset: 0; z-index: 5; pointer-events: none; opacity: 0; transition: opacity .7s;
  background: radial-gradient(ellipse 70% 70% at 50% 45%, rgba(var(--shade-rgb), .72), rgba(var(--shade-rgb), .9)); }
body.letter-dimmed .letter-dim { opacity: .5; }
body.letter-dimmed-deep .letter-dim { opacity: 1; }
:root[data-theme="dark"] .letter-dim { background: radial-gradient(ellipse 70% 70% at 50% 45%, rgba(var(--shade-rgb), .3), rgba(var(--shade-rgb), .75)); }
body.letter-dimmed .pack-table { position: relative; z-index: 6; }

/* ---------------------------------------------------------------- the letter */
/* The letter: a sealed parchment envelope, torn open along its top. The cards sit between its back and its front. */
.letter { position: absolute; --pa: #efe2c2; --pb: #d9c49a; --g: #c9cbc4; --p: 0; --amp: .4; --tear: 14%; container-type: inline-size; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.letter.dragging { cursor: grabbing; }
.letter > * { position: absolute; }
/* The letter is made like the cards' backs: oxblood paper in the worn diamond lattice, a cream rim and a
   fine brass rule inside it, folded like an envelope, sealed in red wax, with a pasted address label.
   Worn like a common card: dust, specks, a mottle, a crease, a stain, scuffed corners, a dog-ear. */
.letter { --ox: var(--back); --ox-d: var(--back-deep); --rule: max(6px, 3cqw); --rad: max(10px, 4cqw); }
.env-back { inset: 0; z-index: 0; border-radius: var(--rad); box-shadow: 0 20px 44px rgba(0,0,0,.6), 0 4px 10px rgba(0,0,0,.4);
  background: radial-gradient(ellipse at 50% 0%, var(--in1), var(--in2) 70%), var(--ox-d); }
/* The front, the flap and the top are one envelope cut in pieces, so each paints its own slice of the
   same letter-sized picture (the lattice, the shading and the edge vignette all run straight across
   the cut): --lh is the letter's height (it's always 0.64 of its width) and --oy is how far down the
   letter this piece starts. */
.env-front, .env-strip { --lh: 64cqw; --oy: 0px; overflow: hidden;
  --lattice: repeating-linear-gradient(45deg, transparent 0 9px, rgba(255,255,255,.055) 9px 10px) 0 var(--oy),
    repeating-linear-gradient(-45deg, transparent 0 9px, rgba(255,255,255,.055) 9px 10px) 0 var(--oy);
  background: var(--lattice), radial-gradient(ellipse 120% 90% at 50% 55%, var(--ox) 0%, var(--ox-d) 100%) 0 var(--oy) / 100% var(--lh) no-repeat; }
.env-front { --oy: calc(var(--lh) * -.14); }
.env-front { left: 0; right: 0; bottom: 0; top: var(--tear); z-index: 2; pointer-events: none; border-radius: 0 0 var(--rad) var(--rad); }
/* the top, above the tear: once it's cut right across, it comes off in one piece */
.env-top { inset: 0 0 auto 0; height: var(--tear); z-index: 3; pointer-events: none; }
.letter { --cutp: 0; }
.env-strip { position: absolute; left: 0; right: 0; top: 0; height: 100%; border-radius: var(--rad) var(--rad) 0 0; pointer-events: none; }
/* the envelope's flap: folded down over the front to a point under the seal, a shade darker, its
   edge catching the light and casting a soft shadow onto the paper below; above the tear it's all flap */
.env-flap { position: absolute; inset: 0 0 auto 0; height: 44%; z-index: 1; pointer-events: none;
  filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, .55)) drop-shadow(0 8px 12px rgba(0, 0, 0, .45)); }
.env-flap::before { content: ""; position: absolute; inset: 0; --oy: calc(var(--lh) * -.14);
  clip-path: polygon(0 0, 100% 0, 100% 2%, 54.5% 93%, 52% 98%, 50% 100%, 48% 98%, 45.5% 93%, 0 2%);
  background: var(--lattice), var(--flapc); }
.env-flap::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 2 L45.5 93 L48 98 L50 100 L52 98 L54.5 93 L100 2' fill='none' stroke='rgba(255,215,190,.22)' stroke-width='1.2' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat; }
.env-strip { background: var(--lattice), var(--flapc); }
.env-front, .env-strip { --flapc: radial-gradient(ellipse 90% 60% at 50% 0%, color-mix(in srgb, var(--ox) 66%, #000), color-mix(in srgb, var(--ox-d) 62%, #000)) 0 var(--oy) / 100% var(--lh) no-repeat; }
/* wear, as on a common card: dirt, scuffs, dust and specks over the whole letter, top included, laid
   out in the letter's own coordinates like the paper so they run unbroken across the cut */
.env-wear { position: absolute; inset: 0; pointer-events: none; z-index: 2; mix-blend-mode: normal;
  --at: 0 var(--oy) / 100% var(--lh) no-repeat;
  background:
    radial-gradient(ellipse 22% 26% at 82% 70%, rgba(20, 6, 2, .35), transparent 70%) var(--at),
    radial-gradient(ellipse 12% 14% at 14% 34%, rgba(20, 6, 2, .3), transparent 70%) var(--at),
    radial-gradient(ellipse 26% 9% at 68% 6%, rgba(20, 6, 2, .32), transparent 70%) var(--at),
    radial-gradient(ellipse 14% 7% at 22% 9%, rgba(20, 6, 2, .26), transparent 70%) var(--at),
    radial-gradient(ellipse 9% 5% at 41% 4%, rgba(255, 230, 205, .07), transparent 70%) var(--at),
    radial-gradient(circle at 0 100%, rgba(255, 238, 214, .22), transparent 9%) var(--at),
    radial-gradient(circle at 100% 0, rgba(255, 238, 214, .16), transparent 8%) var(--at),
    var(--fw-dust) 0 var(--oy) / 130px 130px repeat,
    var(--fw-specks-d) 0 var(--oy) / 150px 150px repeat,
    var(--fw-mottle) 0 var(--oy) / 180% calc(var(--lh) * 1.8) no-repeat; }
.env-front > .env-wear::after, .env-strip > .env-wear::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 72% 76% at 50% 50%, transparent 62%, rgba(10, 4, 2, .5) 100%) 0 var(--oy) / 100% var(--lh) no-repeat; }
/* ---------------------------------------------------------------- the letter's grades
   A letter comes in five grades, from a plain oxblood one sealed in red to a black-and-gold one:
   each its own paper, wax and trim (the trim drawn over the whole letter in its own coordinates, so
   it runs unbroken across the cut); the finer ones catch the light now and then. */
.letter { --w1: #d9746f; --w2: #b4323a; --w3: #8a1820; --w4: #5a0e12; --w5: #b5303a; --w6: #7e141b; --wink: #3a0508;
  --wcrack: rgba(40, 4, 6, .5); --wlit: rgba(255, 150, 140, .2); --wglint: rgba(255, 150, 140, .5);
  --in1: #1d0a0b; --in2: #3a1416; --trim: none; }
.letter[data-tier="uncommon"] { --ox: #2f5a3d; --ox-d: #1a3524; --in1: #0a1a10; --in2: #173322;
  --w1: #f0b27a; --w2: #c2773a; --w3: #8f4f1f; --w4: #5c300f; --w5: #b8692f; --w6: #7a3e15; --wink: #3a1a06;
  --wcrack: rgba(40, 18, 4, .5); --wlit: rgba(255, 200, 150, .22); --wglint: rgba(255, 210, 160, .5); --trim: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 64' preserveAspectRatio='none'%3E%3Crect vector-effect='non-scaling-stroke' x='2.8' y='2.8' width='94.4' height='58.4' rx='2.6' fill='none' stroke='%23c58f4f' stroke-opacity='.55' stroke-width='1' stroke-dasharray='3 2.5'/%3E%3C/svg%3E"); }
.letter[data-tier="rare"] { --ox: #284a86; --ox-d: #142a55; --in1: #070f22; --in2: #12234a;
  --w1: #ffffff; --w2: #d6dde8; --w3: #9aa6b8; --w4: #5d6879; --w5: #c4ccd8; --w6: #8892a3; --wink: #1f2633;
  --wcrack: rgba(20, 26, 38, .45); --wlit: rgba(255, 255, 255, .3); --wglint: rgba(255, 255, 255, .6); --trim: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 64' preserveAspectRatio='none'%3E%3Crect vector-effect='non-scaling-stroke' x='3.4' y='3.4' width='93.2' height='57.2' rx='2.2' fill='none' stroke='%23d4dceb' stroke-opacity='.4' stroke-width='1'/%3E%3Cg fill='none' stroke='%23d4dceb' stroke-opacity='.75' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.2' d='M2.6 11 V5.4 Q2.6 2.6 5.4 2.6 H11'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.3 9 Q4.3 4.3 9 4.3'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M11 2.6 q2.4 0 3 2 M2.6 11 q0 2.4 2 3'/%3E%3C/g%3E%3Cg transform='translate%28100 0%29 scale%28-1 1%29'%3E%3Cg fill='none' stroke='%23d4dceb' stroke-opacity='.75' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.2' d='M2.6 11 V5.4 Q2.6 2.6 5.4 2.6 H11'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.3 9 Q4.3 4.3 9 4.3'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M11 2.6 q2.4 0 3 2 M2.6 11 q0 2.4 2 3'/%3E%3C/g%3E%3C/g%3E%3Cg transform='translate%280 64%29 scale%281 -1%29'%3E%3Cg fill='none' stroke='%23d4dceb' stroke-opacity='.75' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.2' d='M2.6 11 V5.4 Q2.6 2.6 5.4 2.6 H11'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.3 9 Q4.3 4.3 9 4.3'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M11 2.6 q2.4 0 3 2 M2.6 11 q0 2.4 2 3'/%3E%3C/g%3E%3C/g%3E%3Cg transform='translate%28100 64%29 scale%28-1 -1%29'%3E%3Cg fill='none' stroke='%23d4dceb' stroke-opacity='.75' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.2' d='M2.6 11 V5.4 Q2.6 2.6 5.4 2.6 H11'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.3 9 Q4.3 4.3 9 4.3'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M11 2.6 q2.4 0 3 2 M2.6 11 q0 2.4 2 3'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }
.letter[data-tier="epic"] { --ox: #55286a; --ox-d: #2e123f; --in1: #12061a; --in2: #2a1238;
  --w1: #ffe9a8; --w2: #e2b04c; --w3: #a8771f; --w4: #6b460c; --w5: #d9a440; --w6: #94661a; --wink: #3d2706;
  --wcrack: rgba(50, 30, 4, .5); --wlit: rgba(255, 236, 170, .3); --wglint: rgba(255, 240, 190, .6); --trim: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 64' preserveAspectRatio='none'%3E%3Crect vector-effect='non-scaling-stroke' x='2.4' y='2.4' width='95.2' height='59.2' rx='2.6' fill='none' stroke='%23ddb055' stroke-opacity='.55' stroke-width='1.1'/%3E%3Crect vector-effect='non-scaling-stroke' x='3.6' y='3.6' width='92.8' height='56.8' rx='2' fill='none' stroke='%23ddb055' stroke-opacity='.3' stroke-width='.8'/%3E%3Cg fill='none' stroke='%23ddb055' stroke-opacity='.85' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.4' d='M2.4 13 V5.4 Q2.4 2.4 5.4 2.4 H13'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.4 10 Q4.4 4.4 10 4.4'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M13 2.4 q3 0 3.6 2.4 q.4 1.6 -1.2 1.6 M2.4 13 q0 3 2.4 3.6 q1.6 .4 1.6 -1.2'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M6.6 6.6 l2.2 2.2'/%3E%3C/g%3E%3Cg transform='translate%28100 0%29 scale%28-1 1%29'%3E%3Cg fill='none' stroke='%23ddb055' stroke-opacity='.85' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.4' d='M2.4 13 V5.4 Q2.4 2.4 5.4 2.4 H13'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.4 10 Q4.4 4.4 10 4.4'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M13 2.4 q3 0 3.6 2.4 q.4 1.6 -1.2 1.6 M2.4 13 q0 3 2.4 3.6 q1.6 .4 1.6 -1.2'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M6.6 6.6 l2.2 2.2'/%3E%3C/g%3E%3C/g%3E%3Cg transform='translate%280 64%29 scale%281 -1%29'%3E%3Cg fill='none' stroke='%23ddb055' stroke-opacity='.85' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.4' d='M2.4 13 V5.4 Q2.4 2.4 5.4 2.4 H13'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.4 10 Q4.4 4.4 10 4.4'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M13 2.4 q3 0 3.6 2.4 q.4 1.6 -1.2 1.6 M2.4 13 q0 3 2.4 3.6 q1.6 .4 1.6 -1.2'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M6.6 6.6 l2.2 2.2'/%3E%3C/g%3E%3C/g%3E%3Cg transform='translate%28100 64%29 scale%28-1 -1%29'%3E%3Cg fill='none' stroke='%23ddb055' stroke-opacity='.85' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.4' d='M2.4 13 V5.4 Q2.4 2.4 5.4 2.4 H13'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.4 10 Q4.4 4.4 10 4.4'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M13 2.4 q3 0 3.6 2.4 q.4 1.6 -1.2 1.6 M2.4 13 q0 3 2.4 3.6 q1.6 .4 1.6 -1.2'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M6.6 6.6 l2.2 2.2'/%3E%3C/g%3E%3C/g%3E%3Cpath vector-effect='non-scaling-stroke' fill='%23ddb055' fill-opacity='.8' d='M50 1.3 l1.1 1.1 l-1.1 1.1 l-1.1 -1.1 z'/%3E%3Cpath vector-effect='non-scaling-stroke' fill='%23ddb055' fill-opacity='.8' d='M50 60.5 l1.1 1.1 l-1.1 1.1 l-1.1 -1.1 z'/%3E%3Cpath vector-effect='non-scaling-stroke' fill='%23ddb055' fill-opacity='.8' d='M2.4 30.9 l1.1 1.1 l-1.1 1.1 l-1.1 -1.1 z'/%3E%3Cpath vector-effect='non-scaling-stroke' fill='%23ddb055' fill-opacity='.8' d='M97.6 30.9 l1.1 1.1 l-1.1 1.1 l-1.1 -1.1 z'/%3E%3C/svg%3E"); }
.letter[data-tier="legendary"] { --ox: #2c2622; --ox-d: #14110f; --in1: #050404; --in2: #1a1512;
  --w1: #fff6c8; --w2: #f3cd63; --w3: #c8952a; --w4: #7d5512; --w5: #eec25a; --w6: #b2801f; --wink: #4a3006;
  --wcrack: rgba(70, 44, 6, .5); --wlit: rgba(255, 244, 190, .35); --wglint: rgba(255, 248, 210, .7); --trim: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 64' preserveAspectRatio='none'%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L110 29.4'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L107.956 44.9292'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L101.961 59.4001'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L92.4263 71.8265'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L79.9999 81.3616'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L65.529 87.3556'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L49.9998 89.4'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L34.4706 87.3555'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L19.9997 81.3614'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L7.57336 71.8262'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L-1.96171 59.3997'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L-7.95565 44.9288'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L-10 29.3996'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L-7.95543 13.8704'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L-1.96127 -0.600445'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L7.57398 -13.0268'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L20.0005 -22.5618'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L34.4715 -28.5557'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L50.0007 -30.6'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L65.5298 -28.5554'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L80.0006 -22.5612'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L92.427 -13.0259'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L101.962 -0.5993'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke='%23f5d27a' stroke-opacity='.10' stroke-width='1.2' d='M50 29.4 L107.956 13.8717'/%3E%3Crect vector-effect='non-scaling-stroke' x='2.2' y='2.2' width='95.6' height='59.6' rx='2.8' fill='none' stroke='%23f5d27a' stroke-opacity='.8' stroke-width='1.4'/%3E%3Crect vector-effect='non-scaling-stroke' x='3.6' y='3.6' width='92.8' height='56.8' rx='2' fill='none' stroke='%23f5d27a' stroke-opacity='.45' stroke-width='.8'/%3E%3Cg fill='none' stroke='%23f5d27a' stroke-opacity='.95' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.4' d='M2.4 13 V5.4 Q2.4 2.4 5.4 2.4 H13'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.4 10 Q4.4 4.4 10 4.4'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M13 2.4 q3 0 3.6 2.4 q.4 1.6 -1.2 1.6 M2.4 13 q0 3 2.4 3.6 q1.6 .4 1.6 -1.2'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M6.6 6.6 l2.2 2.2'/%3E%3C/g%3E%3Cg transform='translate%28100 0%29 scale%28-1 1%29'%3E%3Cg fill='none' stroke='%23f5d27a' stroke-opacity='.95' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.4' d='M2.4 13 V5.4 Q2.4 2.4 5.4 2.4 H13'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.4 10 Q4.4 4.4 10 4.4'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M13 2.4 q3 0 3.6 2.4 q.4 1.6 -1.2 1.6 M2.4 13 q0 3 2.4 3.6 q1.6 .4 1.6 -1.2'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M6.6 6.6 l2.2 2.2'/%3E%3C/g%3E%3C/g%3E%3Cg transform='translate%280 64%29 scale%281 -1%29'%3E%3Cg fill='none' stroke='%23f5d27a' stroke-opacity='.95' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.4' d='M2.4 13 V5.4 Q2.4 2.4 5.4 2.4 H13'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.4 10 Q4.4 4.4 10 4.4'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M13 2.4 q3 0 3.6 2.4 q.4 1.6 -1.2 1.6 M2.4 13 q0 3 2.4 3.6 q1.6 .4 1.6 -1.2'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M6.6 6.6 l2.2 2.2'/%3E%3C/g%3E%3C/g%3E%3Cg transform='translate%28100 64%29 scale%28-1 -1%29'%3E%3Cg fill='none' stroke='%23f5d27a' stroke-opacity='.95' vector-effect='non-scaling-stroke'%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1.4' d='M2.4 13 V5.4 Q2.4 2.4 5.4 2.4 H13'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M4.4 10 Q4.4 4.4 10 4.4'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M13 2.4 q3 0 3.6 2.4 q.4 1.6 -1.2 1.6 M2.4 13 q0 3 2.4 3.6 q1.6 .4 1.6 -1.2'/%3E%3Cpath vector-effect='non-scaling-stroke' stroke-width='1' d='M6.6 6.6 l2.2 2.2'/%3E%3C/g%3E%3C/g%3E%3Cpath vector-effect='non-scaling-stroke' fill='%23f5d27a' fill-opacity='.95' d='M50 1 l1.4 1.4 l-1.4 1.4 l-1.4 -1.4 z'/%3E%3Cpath vector-effect='non-scaling-stroke' fill='%23f5d27a' fill-opacity='.95' d='M50 60.2 l1.4 1.4 l-1.4 1.4 l-1.4 -1.4 z'/%3E%3Cpath vector-effect='non-scaling-stroke' fill='%23f5d27a' fill-opacity='.95' d='M2.4 30.6 l1.4 1.4 l-1.4 1.4 l-1.4 -1.4 z'/%3E%3Cpath vector-effect='non-scaling-stroke' fill='%23f5d27a' fill-opacity='.95' d='M97.6 30.6 l1.4 1.4 l-1.4 1.4 l-1.4 -1.4 z'/%3E%3C/svg%3E"); }
.env-front > .env-wear::before, .env-strip > .env-wear::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: var(--trim) 0 var(--oy) / 100% var(--lh) no-repeat; }
/* the finest catch the light: a sheen that sweeps across now and then */
.letter[data-tier="epic"] .env-front > .env-wear::after, .letter[data-tier="legendary"] .env-front > .env-wear::after,
.letter[data-tier="epic"] .env-strip > .env-wear::after, .letter[data-tier="legendary"] .env-strip > .env-wear::after {
  background: radial-gradient(ellipse 72% 76% at 50% 50%, transparent 62%, rgba(10, 4, 2, .5) 100%) 0 var(--oy) / 100% var(--lh) no-repeat,
    linear-gradient(105deg, transparent 40%, rgba(255, 240, 200, .16) 48%, rgba(255, 250, 230, .3) 50%, rgba(255, 240, 200, .16) 52%, transparent 60%) var(--sheen) var(--oy) / 300% var(--lh) no-repeat;
  animation: sheen 5.5s ease-in-out infinite; }
.letter[data-tier="legendary"] .env-front > .env-wear::after, .letter[data-tier="legendary"] .env-strip > .env-wear::after { animation-duration: 3.8s; }
@property --sheen { syntax: "<percentage>"; inherits: false; initial-value: 110%; }
@keyframes sheen { 0%, 55% { --sheen: 110%; } 100% { --sheen: -10%; } }
/* the address label: gilt edged on the finest */
.letter[data-tier="epic"] .env-label, .letter[data-tier="legendary"] .env-label { box-shadow: 0 1px 2px rgba(0,0,0,.45), inset 0 0 0 1px rgba(201, 153, 74, .7), inset 0 0 0 3px rgba(255, 240, 200, .5), inset 0 0 3cqw rgba(110, 68, 22, .25); }
.letter[data-tier="rare"] .env-post { color: rgba(212, 220, 235, .55); border-color: rgba(212, 220, 235, .4); }
.letter[data-tier="uncommon"] .env-post { color: rgba(197, 143, 79, .6); border-color: rgba(197, 143, 79, .45); }
.letter[data-tier="epic"] .env-post, .letter[data-tier="legendary"] .env-post { color: rgba(245, 210, 122, .7); border-color: rgba(245, 210, 122, .55); }
/* the pasted address label */
.env-label { position: absolute; left: 9%; bottom: 13%; z-index: 4; padding: 2.2cqw 3.6cqw 2cqw; rotate: -2.5deg; display: grid; gap: .6cqw;
  background: radial-gradient(ellipse at 70% 80%, rgba(110, 68, 22, .18), transparent 60%), linear-gradient(170deg, var(--card), var(--card-edge));
  box-shadow: 0 1px 2px rgba(0,0,0,.45), inset 0 0 0 1px rgba(90, 62, 30, .25), inset 0 0 3cqw rgba(110, 68, 22, .25);
  clip-path: polygon(0 3%, 6% 0, 50% 2%, 100% 0, 99% 60%, 100% 100%, 70% 98%, 3% 100%, 0 70%); }
.env-label b { font: 400 clamp(12px, 4.4cqw, 21px)/1 var(--display); color: var(--ink); }
.env-label small { font: italic clamp(9px, 2.6cqw, 12px)/1 var(--serif); color: var(--ink-soft); border-top: 1px solid rgba(90, 62, 30, .3); padding-top: .8cqw; }
/* a guild postmark in the corner */
.env-post { position: absolute; right: 8%; bottom: 12%; z-index: 4; width: 14%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; rotate: 14deg; color: rgba(240, 207, 142, .5);
  border: 2px dashed rgba(240, 207, 142, .38); box-shadow: 0 0 0 3px rgba(240, 207, 142, .12); }
.env-post svg { width: 52%; }
/* the wax seal: a pooled, irregular blob, old and worn (dulled, chipped, cracked, scuffed), a ? pressed in */
.env-seal { position: absolute; left: 50%; top: 46%; width: 21%; aspect-ratio: 1; translate: -50% -50%; z-index: 4; display: grid; place-items: center;
  background:
    linear-gradient(118deg, transparent 47%, var(--wcrack) 48%, var(--wlit) 49.2%, transparent 50.5%) 0 0 / 100% 100% no-repeat,
    linear-gradient(32deg, transparent 70%, var(--wcrack) 70.8%, transparent 72%) 0 0 / 100% 100% no-repeat,
    radial-gradient(ellipse 30% 18% at 70% 78%, rgba(255, 190, 180, .14), transparent 70%),
    radial-gradient(circle at 36% 30%, var(--w1) 0, var(--w2) 20%, var(--w3) 50%, var(--w4) 82%);
  clip-path: polygon(50% 0, 62% 5%, 73% 2%, 80% 13%, 94% 17%, 95% 31%, 100% 45%, 93% 52%, 97% 63%, 98% 74%, 86% 85%, 78% 96%, 64% 94%, 52% 99%, 44% 94%, 37% 97%, 24% 98%, 16% 86%, 5% 77%, 7% 62%, 0 48%, 6% 41%, 4% 33%, 3% 19%, 15% 11%, 27% 3%, 38% 6%);
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.5)) saturate(.85); }
.env-seal::before { content: ""; position: absolute; inset: 15%; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--w5), var(--w6) 70%), var(--fw-specks-d);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.5), inset 0 -2px 3px var(--wlit), 0 0 0 1px var(--wlit); }
/* dust and scuffs over the whole seal */
.env-seal::after { content: ""; position: absolute; inset: 0; background: var(--fw-dust) 0 0 / 70px 70px, radial-gradient(circle at 78% 22%, rgba(255, 220, 210, .22), transparent 14%); opacity: .55; mix-blend-mode: screen; }
.env-seal b { position: relative; z-index: 1; font: 400 clamp(20px, 11cqw, 52px)/1 var(--display); color: var(--wink); margin-top: 4%;
  text-shadow: 0 1.5px 0 var(--wglint), 0 -1px 1px rgba(0, 0, 0, .7), 0 0 6px rgba(0, 0, 0, .25); }
/* the cutting guide: not part of the letter, laid over it to show where to tear (a bright, marching
   dashed line right across the top with an arrowhead, and a tag); it goes as the tear starts */
.cut-guide { top: calc(var(--tear) - 16px); left: -4%; right: -6%; height: 32px; z-index: 6; cursor: pointer; transition: opacity .3s; }
.cut-guide::before { content: ""; position: absolute; left: 0; right: 14px; top: 14px; height: 4px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, #fff4dc 0 12px, transparent 12px 20px) 0 0 / 20px 4px repeat-x;
  filter: drop-shadow(0 0 4px rgba(255, 214, 140, .95)) drop-shadow(0 1px 1px rgba(0, 0, 0, .7)); animation: cut-march .8s linear infinite; }
.cut-guide::after { content: ""; position: absolute; right: 0; top: 7px; border: 9px solid transparent; border-left: 14px solid #fff4dc; border-right: 0;
  filter: drop-shadow(0 0 4px rgba(255, 214, 140, .95)) drop-shadow(0 1px 1px rgba(0, 0, 0, .7)); }
@keyframes cut-march { to { background-position: 20px 0; } }
.cut-tag { position: absolute; left: 0; bottom: 28px; rotate: -4deg; transform-origin: 0 100%; white-space: nowrap;
  font: italic 600 clamp(13px, 4cqw, 19px)/1 var(--serif); color: var(--ink); padding: .45em 1.3em .45em .7em;
  background: linear-gradient(170deg, var(--card), var(--card-edge)); clip-path: polygon(0 0, 86% 0, 100% 50%, 86% 100%, 0 100%);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .55)); animation: cut-bob 1.6s ease-in-out infinite; }
@keyframes cut-bob { 50% { translate: 4px 0; } }
.letter.started .cut-guide, .letter.torn .cut-guide { opacity: 0; pointer-events: none; }
/* the tear: a seam of light that runs with the finger, light pouring up out of it, and beams for the rarer heroes */
/* beams: a fan of light standing up out of the tear (they sway a little but never leave the top) */
/* just before the next rarity bursts through, the letter strains */
.letter.straining .env-front, .letter.straining .env-strip, .letter.straining .env-back { animation: strain .09s linear infinite !important; }
@keyframes strain { 0%, 100% { translate: 0 0; } 25% { translate: calc(var(--strain) * -2.2px) calc(var(--strain) * 1px); } 50% { translate: calc(var(--strain) * 2px) calc(var(--strain) * -1.2px); } 75% { translate: calc(var(--strain) * -1px) calc(var(--strain) * -1.6px); } }
.letter[data-r="uncommon"] .env-glow { box-shadow: 0 0 22px rgba(95, 224, 138, .35); }
.letter[data-r="rare"] .env-glow { box-shadow: 0 0 28px rgba(52, 110, 255, .55); }
.letter[data-r="epic"] .env-glow { box-shadow: 0 0 40px rgba(194, 124, 255, .6), 0 0 90px rgba(194, 124, 255, .3); }
.letter[data-r="legendary"] .env-glow { box-shadow: 0 0 50px rgba(255, 212, 94, .75), 0 0 120px rgba(255, 212, 94, .45), 0 0 220px rgba(255, 190, 60, .25); }
.stat-pop.tiny { font-size: .78rem; }
.stat-pop.tiny b { font-size: .86rem; margin-left: 3px; }

/* the ripped edge: pale paper fibres showing along the tear, on the strip that comes off and on the letter */
.env-strip::before, .env-front::before { content: ""; position: absolute; left: 0; right: 0; height: 4px; z-index: 5; pointer-events: none; opacity: 0;
  background: linear-gradient(#efe2c8, #c9b391); }
.env-strip::before { bottom: -1px; clip-path: polygon(0 100%, 100% 100%, 100.0% 60%, 97.7% 56%, 96.3% 50%, 94.7% 64%, 91.8% 34%, 88.7% 53%, 86.0% 3%, 84.2% 88%, 81.1% 24%, 78.0% 9%, 75.4% 86%, 73.3% 74%, 71.4% 69%, 69.0% 21%, 67.3% 84%, 65.9% 9%, 63.6% 61%, 60.9% 58%, 59.2% 33%, 57.6% 53%, 56.0% 0%, 54.1% 48%, 51.8% 65%, 49.4% 86%, 48.1% 17%, 46.3% 75%, 44.2% 36%, 42.2% 44%, 39.3% 11%, 36.9% 8%, 35.1% 41%, 32.2% 6%, 30.8% 47%, 29.3% 44%, 26.7% 35%, 25.3% 11%, 22.4% 24%, 20.0% 62%, 18.4% 18%, 15.6% 15%, 12.5% 71%, 11.1% 74%, 9.4% 42%, 7.7% 21%, 4.9% 7%, 2.9% 84%, 1.4% 54%, 0.0% 69%); }
.env-front::before { top: 0; clip-path: polygon(0 0, 100% 0, 100.0% 80%, 98.1% 20%, 95.1% 11%, 92.1% 10%, 90.4% 93%, 87.7% 61%, 85.3% 25%, 83.9% 70%, 80.8% 21%, 77.8% 14%, 75.3% 97%, 72.1% 17%, 69.0% 93%, 67.3% 72%, 64.8% 58%, 61.9% 68%, 59.1% 69%, 57.3% 93%, 54.3% 89%, 52.6% 18%, 50.5% 77%, 47.7% 69%, 44.7% 46%, 41.5% 61%, 38.4% 15%, 37.0% 88%, 35.3% 29%, 33.6% 33%, 32.3% 55%, 29.5% 90%, 27.8% 48%, 26.5% 47%, 24.8% 53%, 21.7% 47%, 18.9% 58%, 17.5% 100%, 15.8% 54%, 14.5% 23%, 11.9% 25%, 10.6% 15%, 9.0% 48%, 5.8% 19%, 4.1% 43%, 1.3% 25%, 0.0% 11%); }
.letter.torn .env-strip::before, .letter.torn .env-front::before { opacity: .85; }
/* the rarity's glow round the letter: its own layer (so cutting the back's top off doesn't box it in);
   once the top's gone it hugs what's left */
.env-glow { inset: 0; z-index: 0; border-radius: var(--rad); pointer-events: none; transition: box-shadow .35s; }
.letter.torn .env-glow { top: var(--tear); border-radius: 0 0 var(--rad) var(--rad); }
/* once the top's cut off, it's gone from the back of the letter too */
.letter.torn .env-back { clip-path: inset(var(--tear) -80px -80px -80px); }
/* opened: the light swells before the heroes come out */
/* the hint: a finger sliding along the top */
.env-hint { top: var(--tear); left: 8%; right: 8%; height: 0; z-index: 5; pointer-events: none; }
.env-hint { left: 0; right: 0; }
.env-hint i { position: absolute; left: 0; top: 0; width: clamp(22px, 8cqw, 34px); aspect-ratio: 1; margin: -6px 0 0 -6px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,240,200,.55) 45%, transparent 70%); box-shadow: 0 0 12px rgba(255, 230, 170, .9); animation: env-swipe 2.2s ease-in-out infinite; }
@keyframes env-swipe { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 70% { left: 100%; opacity: 1; } 85%, 100% { left: 100%; opacity: 0; } }
.letter.started .env-hint { display: none; }
.env-open { left: 50%; top: 104%; translate: -50% 0; z-index: 5; background: none; border: 0; color: var(--text-dim); font: inherit; font-size: .9rem; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; white-space: nowrap; }
.letter.torn .env-open { display: none; }
.letter.gone > * { opacity: 0; translate: 0 24px; transition: opacity .4s, translate .4s; }

body.spotlit .letter { z-index: 6; }
.letter.nudge .env-hint i { animation: none; left: 0; opacity: 1; box-shadow: 0 0 24px #fff; }

/* ---------------------------------------------------------------- the light (letter.js draws it) */
/* the light out of the tear (WebGL, blended as light), the specks and impacts (2D), and the flash of a
   rarity's colour when it bursts through */
.lightfx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 7; pointer-events: none; mix-blend-mode: screen; display: none; }
.glowfx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 7; pointer-events: none; }
.tint { position: fixed; inset: 0; z-index: 7; pointer-events: none; opacity: 0; mix-blend-mode: screen;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, var(--c, #fff) 0%, color-mix(in srgb, var(--c, #fff) 40%, transparent) 45%, transparent 80%); }
@media (max-width: 620px) {
  .pack-table { padding: 18px 0 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .cut-guide::before, .cut-tag, .env-hint i { animation: none; }
}
