/* The typeface is Basteleur, two weights only: Moonlight (400) and Bold (700). It is loaded by css/fonts.css. */
:root {
  --wall: #2b1114; --wall-deep: #140708;
  --gilt: #d9b45a; --gilt-hi: #f5df9d;
  --right: #4fe38a; --right-hi: #b6ffd0;
  --cream: #f3ead8; --ink: #1b1512; --muted: #cdb9a2;
  --panel: #1b0a0d; --panel-hi: #33161b; --line: rgba(243, 234, 216, .14); /* the app's own surfaces: side bar, tab bar, boxes */
  --side: 236px;
  --cw: 170px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* The plain wall. js/bg.js hangs a real painting over it. */
html { background: var(--wall-deep) radial-gradient(120% 70% at 50% 0%, #51202a 0%, var(--wall) 42%, var(--wall-deep) 100%) fixed; }
body {
  margin: 0; min-height: 100vh; color: var(--cream);
  font-family: 'Basteleur', 'Iowan Old Style', Palatino, Georgia, serif; font-synthesis: none;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--gilt-hi); outline-offset: 3px; }
h1 { font-size: clamp(1.9rem, 6vw, 2.5rem); font-weight: 700; line-height: 1.05; margin: 0 0 12px; }
h2 { font-size: 1.4rem; font-weight: 700; margin: 40px 0 6px; }
p { margin: 0; }
h1, h2, .lede, .note, .foot, .label, .odds, .daily, .hand-pay, .shelf-price { text-shadow: 0 1px 3px rgba(10, 3, 4, .8); }
.lede { max-width: 58ch; color: #e6d7c2; font-size: 1.02rem; line-height: 1.5; }
.note { color: var(--muted); }
.foot { margin-top: 28px; color: var(--muted); font-size: .92rem; display: flex; gap: 20px; flex-wrap: wrap; }

/* ---------- the wall ---------- */
/* js/bg.js hangs a real wall covering here, one for each section, and fades between them. */
#bg { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100lvh; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-art { position: absolute; inset: -4%; background: center / cover no-repeat; opacity: 0; transition: opacity 1.1s ease; animation: wall-drift 80s ease-in-out infinite alternate; }
.bg-art.on { opacity: 1; }
.bg-art:not(.on) { animation-play-state: paused; } /* only the wall you can see drifts */
@keyframes wall-drift { from { transform: scale(1); } to { transform: scale(1.07) translate(1.4%, -1%); } }
.bg-glow { position: absolute; inset: 0; opacity: 0; mix-blend-mode: screen; background: radial-gradient(90% 70% at 55% 30%, var(--c, #d9b45a), transparent 72%); }

/* ---------- app frame ---------- */
/* On a wide screen the name, the three sections and your money live in a side bar.
   On a phone the name and the money make a slim bar on top and the sections become tabs under the thumb. */
.top {
  position: fixed; z-index: 20; left: 0; top: 0; bottom: 0; width: var(--side); overflow-y: auto;
  display: flex; flex-direction: column; gap: 30px; padding: 28px 14px 24px;
  background: var(--panel); border-right: 1px solid var(--line);
}
.brand { padding: 0 12px; font-size: 1.7rem; font-weight: 700; line-height: 1; color: var(--gilt-hi); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button {
  display: flex; align-items: center; gap: 13px; padding: 11px 12px; border-radius: 8px; text-align: left;
  font-size: 1.08rem; color: var(--muted); transition: background-color .15s, color .15s;
}
.nav svg { flex: none; width: 23px; height: 23px; }
.nav button:hover { color: var(--cream); background: rgba(243, 234, 216, .06); }
.nav button.on { color: var(--gilt-hi); background: var(--panel-hi); font-weight: 700; }
.hud { margin-top: auto; display: flex; flex-direction: column; gap: 14px; padding: 20px 12px 0; border-top: 1px solid var(--line); }
.hud-money { font-size: 2.2rem; font-weight: 700; line-height: 1; color: var(--gilt-hi); }
.hud-money.bump { animation: bump .6s var(--ease); transform-origin: 0 60%; }
@keyframes bump { 30% { transform: scale(1.14); color: #fff; } }
.hud-found { display: flex; flex-direction: column; gap: 8px; font-size: .92rem; color: var(--muted); }
.meter { display: block; height: 6px; border-radius: 3px; background: rgba(243, 234, 216, .16); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--gilt); transition: width .9s var(--ease); }

main { margin-left: var(--side); container-type: inline-size; }
.view { max-width: 1120px; margin: 0 auto; padding: 40px 34px 90px; }
.view:not([hidden]) { animation: view-in .22s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px 40px; flex-wrap: wrap; }
.view-head > :first-child { flex: 1 1 340px; min-width: 0; }
.view-head > .daily { flex: none; }

@media (max-width: 899px) {
  .top {
    position: sticky; bottom: auto; width: auto; overflow: visible; flex-direction: row; align-items: center; gap: 12px;
    padding: 11px 16px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; font-size: 1.4rem; }
  .hud { margin: 0 0 0 auto; padding: 0; border: 0; }
  .hud-found { display: none; } /* the Collection tab says it */
  .hud-money { font-size: 1.5rem; }
  .hud-money.bump { transform-origin: 100% 60%; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; flex-direction: row; gap: 4px;
    padding: 6px 8px max(6px, env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line);
  }
  .nav button { flex: 1; min-width: 0; flex-direction: column; justify-content: center; gap: 4px; padding: 7px 0 6px; font-size: .82rem; }
  /* five tabs or more (Fuse and Trade join the three): smaller labels, no gaps */
  .nav:has(button:nth-child(5)) { gap: 0; padding-left: 4px; padding-right: 4px; }
  .nav:has(button:nth-child(5)) button { font-size: .7rem; }
  .nav svg { width: 25px; height: 25px; }
  main { margin-left: 0; }
  .view { padding: 24px 16px 124px; }
}

/* ---------- buttons ---------- */
.btn {
  background: var(--gilt); color: var(--ink); font-weight: 700; text-shadow: none;
  padding: .66em 1.25em .6em; border-radius: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  transition: transform .12s, background-color .12s;
}
.btn:hover { background: var(--gilt-hi); transform: translateY(-1px); }
.btn:active { background: #c29d45; transform: translateY(1px); }
.btn:disabled { background: rgba(10, 4, 5, .4); color: var(--muted); font-weight: 400; box-shadow: inset 0 0 0 1px rgba(205, 185, 162, .35); cursor: default; transform: none; }
.btn-big { font-size: 1.2rem; padding: .74em 1.7em .68em; border-radius: 10px; }
.link { text-decoration: underline; text-underline-offset: 3px; color: var(--gilt-hi); }
.link:hover { color: #fff; }

/* ---------- tier looks ---------- */
/* --frame is the metal rim round the card, --foil how strong the rainbow foil is, --glow the light behind it. */
.tier-common    { --tier: #c9b28f; --foil: 0;   --glow: 0;  --rim: .2em;
  --frame: linear-gradient(135deg, #8a6038, #4f331b 30%, #a57a4c 55%, #4a2f18 80%, #7a5230); }
.tier-uncommon  { --tier: #ff9d57; --foil: 0;   --glow: 0;  --rim: .2em;
  --frame: linear-gradient(135deg, #c98345, #6b3a16 30%, #f0aa66 52%, #6b3a16 78%, #b5743a); }
.tier-rare      { --tier: #9fd4ff; --foil: .3;  --glow: .3; --rim: .24em;
  --frame: linear-gradient(135deg, #eef2f6, #8793a3 30%, #ffffff 50%, #7a8696 75%, #dfe6ee); }
.tier-epic      { --tier: #ffd24a; --foil: .42; --glow: .5; --rim: .28em; --gem-glow: #ffd24a;
  --frame: linear-gradient(135deg, #f6d878, #9a6f14 30%, #fff1b0 50%, #a87a18 75%, #f2c94e); }
.tier-legendary { --tier: #ff4d3d; --foil: .55; --glow: .7; --rim: .3em;  --gem-glow: #ff4d3d;
  --frame: linear-gradient(135deg, #fff3bf, #b88a1c 22%, #fff7d6 45%, #c2931f 68%, #ffe58a 90%); }
.tier-priceless { --tier: #ffffff; --foil: .8;  --glow: .9; --rim: .32em; --gem-glow: #ffffff;
  --frame: linear-gradient(135deg, #ffd1f0, #b8f1ff, #fff2a8, #c9ffcf, #d9c8ff, #ffd1f0); }
/* The little gem that stands for a tier wherever one is named. */
.gem {
  display: inline-block; flex: none; width: .56em; height: .56em; margin: 0 .6em 0 .15em; transform: rotate(45deg); border-radius: .07em; vertical-align: .06em;
  background: linear-gradient(135deg, #fff -40%, var(--tier) 55%); box-shadow: 0 0 .55em var(--gem-glow, transparent);
}
.tier-priceless .gem { background: conic-gradient(#ff9fd6, #9fe8ff, #fff2a8, #b6ffbf, #cdb8ff, #ff9fd6); }

/* ---------- card ---------- */
/* Full art: the painting fills the card behind a thin metal rim. Only the rarity and the price are printed on it. */
.card {
  width: var(--cw); aspect-ratio: 5 / 7; font-size: calc(var(--cw) / 16); position: relative; perspective: 60em;
  flex: none; cursor: pointer; user-select: none; -webkit-user-select: none; transition: transform .35s var(--ease);
}
.card::before {
  content: ''; position: absolute; inset: -9%; border-radius: 2em; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, var(--tier), transparent); filter: blur(1.2em);
}
.card-inner { position: absolute; inset: 0; transition: transform .65s cubic-bezier(.2, .85, .25, 1.05); }
/* A card lies flat until the pointer leans it, or it is one that turns over (`turns`: dealt face
   down). A card in 3D costs the graphics card a layer for each face, and a full collection is 145. */
.card.is-tilting .card-inner, .card.turns .card-inner {
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(calc(var(--ry, 0deg) + var(--flip, 0deg)));
}
.card.is-tilting .card-inner { transition: transform .08s linear; }
.card.is-facedown { --flip: 180deg; }
.card-face {
  position: absolute; inset: 0; border-radius: .9em; overflow: hidden;
  box-shadow: 0 .5em 1.2em rgba(0, 0, 0, .55);
}
.card.turns .card-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.card-front { padding: var(--rim); background: var(--frame); }
.tier-epic .card-front, .tier-legendary .card-front, .tier-priceless .card-front {
  box-shadow: 0 .5em 1.2em rgba(0, 0, 0, .55), 0 0 1.5em color-mix(in srgb, var(--tier) 32%, transparent);
}
/* The two best tiers have light running round the rim. */
.tier-legendary .card-front::before, .tier-priceless .card-front::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 240%; aspect-ratio: 1; margin: -120% 0 0 -120%;
  background: conic-gradient(#ffe58a, #ff4d3d 10%, #fff3bf 22%, #b88a1c 36%, #ffe58a 50%, #ff4d3d 60%, #fff7d6 72%, #c2931f 86%, #ffe58a);
}
.tier-priceless .card-front::before {
  background: conic-gradient(#ffb3e6, #9fe8ff, #fff2a8, #b6ffbf, #cdb8ff, #ffb3e6, #9fe8ff, #fff2a8, #b6ffbf, #cdb8ff, #ffb3e6);
}
/* Nothing on a card or a pack moves for ever unless it is on screen: MP.watch (js/card.js) gives
   it `live` while any of it shows. Off screen there is no animation, so no layer and no frames. */
.card.live .card-front::before { animation: spin 7s linear infinite; }
.card.live.tier-priceless .card-front::before { animation-duration: 4s; }
.card-art { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: calc(.9em - var(--rim)); background: #1b1512; isolation: isolate; }
.card-art img { /* a little bigger than the frame, so it can slide behind it as the card tilts */
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; display: block;
  transform: scale(1.1) translate(calc(var(--px, 0) * -2.6%), calc(var(--py, 0) * -2.6%)); transition: transform .5s var(--ease);
}
.card.is-tilting .card-art img, .card.is-tilting .card-info > * { transition: transform .1s linear; }
.card-art::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 0 .06em rgba(0, 0, 0, .65), inset 0 0 1em rgba(0, 0, 0, .28); }
.card-foil, .card-glare { position: absolute; inset: 0; pointer-events: none; }
.card-foil { /* rainbow foil cut into small diamonds, strongest where the pointer is */
  z-index: 1; mix-blend-mode: color-dodge; opacity: calc(var(--foil) * .1); transition: opacity .35s;
  background:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, .4) 0 .05em, transparent .05em .36em),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, .4) 0 .05em, transparent .05em .36em),
    repeating-linear-gradient(115deg, #ff7ab8 0%, #ffd86b 9%, #7dffb0 18%, #6bd0ff 27%, #b98cff 36%, #ff7ab8 45%);
  background-size: auto, auto, 260% 260%; background-position: 0 0, 0 0, var(--mx, 50%) var(--my, 50%);
}
.card-glare { z-index: 2; background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .75), transparent 55%); mix-blend-mode: overlay; opacity: 0; transition: opacity .35s; }
.card.is-tilting .card-foil { opacity: calc(.1 + var(--foil) * .4); }
.card.is-tilting .card-glare { opacity: .38; }
.card-info { /* the only print on the card: the rarity over a big price */
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: .3em;
  padding: 2.4em .5em .72em; line-height: 1; white-space: nowrap; color: #fff; text-shadow: 0 .05em .22em rgba(0, 0, 0, .95), 0 0 .6em rgba(0, 0, 0, .6);
  background: linear-gradient(180deg, rgba(10, 4, 5, 0), rgba(10, 4, 5, .4) 38%, rgba(10, 4, 5, .88));
}
.card-info > * { transform: translate(calc(var(--px, 0) * .16em), calc(var(--py, 0) * .1em)); transition: transform .5s var(--ease); }
.card-tier { display: flex; align-items: center; max-width: 100%; font-weight: 600; font-size: max(1.05em, 8.5px); color: var(--tier); }
.card-tier .gem { margin: 0 .5em 0 0; }
.tier-priceless .card-tier span {
  background: linear-gradient(90deg, #ff9fd6, #9fe8ff, #fff2a8, #b6ffbf, #cdb8ff, #ff9fd6) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none;
}
/* Sliding the rainbow through lettering repaints it every frame, and a repaint makes the browser
   walk the whole page. So it only runs where one card has the stage; in a list it is still. */
#reveal .card.live.tier-priceless .card-tier span, #fuse-show .card.live.tier-priceless .card-tier span { animation: slide 3s linear infinite; }
@keyframes slide { to { background-position: 200% 0; } }
.card-price { font-weight: 700; font-size: max(2.25em, 13px); font-variant-numeric: tabular-nums; }
.card-price.pop { animation: pricepop .5s var(--ease); }
@keyframes pricepop { 35% { transform: scale(1.35); color: var(--gilt-hi); } }
.card-count, .card-new { position: absolute; z-index: 3; top: .7em; font-size: max(.98em, 8.5px); line-height: 1; padding: .34em .55em; border-radius: .3em; font-weight: 700; }
.card-count { right: .7em; background: rgba(12, 6, 5, .8); color: var(--cream); }
.card-new { left: .7em; background: linear-gradient(180deg, #fff3c4, var(--gilt)); color: var(--ink); box-shadow: 0 .1em .4em rgba(0, 0, 0, .5); }
.card.in-hand { outline: .2em solid var(--gilt-hi); outline-offset: .22em; border-radius: .9em; }
.card.in-hand::after {
  content: 'In hand'; position: absolute; left: 50%; top: 40%; transform: translateX(-50%); white-space: nowrap;
  font-size: max(1.1em, 9px); font-weight: 600; padding: .38em .8em; border-radius: .3em;
  background: rgba(12, 6, 5, .86); color: var(--gilt-hi);
}

/* The wall label that goes with a card: the title lives here, not on the card. */
.hung { margin: 0; width: var(--cw); display: flex; flex-direction: column; align-items: center; gap: 9px; }
.label { width: 100%; text-align: center; line-height: 1.18; }
.label-title { font-weight: 600; font-size: .92rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.label-sub { margin-top: 3px; font-size: .78rem; line-height: 1.25; color: var(--muted); }

.card-back { transform: rotateY(180deg); background: #2a0d10; }
.card-back-in {
  position: absolute; inset: .42em; z-index: 1; border-radius: .6em; display: grid; place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(217, 180, 90, .07) 0 .1em, transparent .1em .9em),
    repeating-linear-gradient(-45deg, rgba(217, 180, 90, .07) 0 .1em, transparent .1em .9em),
    radial-gradient(circle at 50% 45%, #6a252c, #2a0d10 75%);
  box-shadow: inset 0 0 0 .12em var(--gilt), inset 0 0 0 .45em #2a0d10, inset 0 0 0 .5em rgba(217, 180, 90, .55);
}
.card.charging .card-back::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 190%; aspect-ratio: 1; margin: -95% 0 0 -95%;
  background: conic-gradient(transparent 0 55%, var(--tier) 78%, #fff 94%, transparent 100%);
  animation: spin .55s linear infinite;
}
.card-crest {
  width: 7em; height: 7em; border-radius: 50%; display: grid; place-items: center; color: var(--gilt-hi);
  border: .14em solid var(--gilt); box-shadow: 0 0 0 .3em #2a0d10, 0 0 0 .38em rgba(217, 180, 90, .6); background: #2a0d10;
}
.card-crest span { font-size: 4.4em; font-weight: 700; line-height: 1; }

/* A painting not found yet is an empty frame on the wall. */
.card-mystery { cursor: default; }
.card-empty {
  position: absolute; inset: 0; border-radius: .9em; display: grid; place-items: center; background: rgba(10, 4, 5, .5);
  box-shadow: inset 0 0 0 .1em color-mix(in srgb, var(--tier) 36%, transparent), inset 0 0 0 .55em rgba(10, 4, 5, .55),
    inset 0 0 0 .62em color-mix(in srgb, var(--tier) 16%, transparent), inset 0 .6em 1.8em rgba(0, 0, 0, .7);
}
.card-empty span { font-size: 5.2em; font-weight: 700; line-height: 1; color: color-mix(in srgb, var(--tier) 42%, transparent); }

/* The whole painting, uncropped, for the close-up. */
.card.is-whole { aspect-ratio: var(--ar); width: min(92vw, 980px, calc(var(--wh, 56vh) * var(--ar))); font-size: clamp(11px, 2.3vmin, 19px); cursor: default; perspective: 140em; }
.card.is-whole .card-art img { transform: none; object-position: 50% 50%; }

/* flipping a card in the reveal */
.card.charging { transform: scale(1.1); transition: transform var(--charge, 400ms) ease-in; z-index: 3; }
.card.charging::before { opacity: 1; transition: opacity var(--charge, 400ms) ease-in; }
.card.charging .card-inner { animation: jitter .11s linear infinite; }
.card.revealed::before { opacity: var(--glow); transition: opacity .6s; }
.card.lifted { transform: translateY(-8%) scale(1.3); transition: transform .5s cubic-bezier(.2, .8, .3, 1); z-index: 4; }
.card.spin .card-inner { animation: spin1 .85s cubic-bezier(.3, .1, .2, 1) both; }
.card.spin-long .card-inner { animation: spin2 1.15s cubic-bezier(.3, .05, .15, 1) both; }
@keyframes spin1 { from { transform: rotateY(180deg); } to { transform: rotateY(720deg); } }
@keyframes spin2 { from { transform: rotateY(180deg); } to { transform: rotateY(1080deg); } }
.card.slam { animation: slam .36s cubic-bezier(.2, .9, .3, 1); }
@keyframes slam { 0% { transform: translateY(-8%) scale(1.3); } 55% { transform: translateY(1.5%) scale(.95); } 100% { transform: none; } }
@keyframes jitter {
  0%, 100% { transform: rotateY(180deg) translate(0, 0) rotate(0deg); }
  25% { transform: rotateY(180deg) translate(.14em, -.1em) rotate(.7deg); }
  75% { transform: rotateY(180deg) translate(-.14em, .1em) rotate(-.7deg); }
}

/* ---------- pack ---------- */
/* A foil booster: pinked crimps, cover art in the pack's colour, rainbow foil that follows the pointer. */
.pack {
  --pw: 190px; width: var(--pw); aspect-ratio: 16 / 25; font-size: calc(var(--pw) / 16); position: relative; flex: none;
  perspective: 70em; user-select: none; -webkit-user-select: none;
  --foil-bg: linear-gradient(100deg, var(--p1) 0%, var(--p2) 20%, var(--p1) 36%, var(--p3) 52%, var(--p1) 66%, var(--p2) 84%, var(--p1) 100%);
  --ribs: repeating-linear-gradient(90deg, rgba(255, 255, 255, .3) 0 .09em, rgba(0, 0, 0, .36) .09em .27em);
}
.pack-tilt {
  position: absolute; inset: 0; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1); filter: drop-shadow(0 1.1em 1.2em rgba(0, 0, 0, .6));
}
.pack.is-tilting .pack-tilt { transition: transform .08s linear; }
.foil { position: absolute; left: 0; right: 0; overflow: hidden; background: var(--foil-bg); }
.foil::before { /* the wrapper bulges: dark at the sides, a soft highlight left of centre */
  content: ''; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, 0) 13%, rgba(255, 255, 255, .17) 31%, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0) 80%, rgba(0, 0, 0, .6) 100%);
}
.foil::after { /* rainbow foil */
  content: ''; position: absolute; inset: 0; z-index: 6; pointer-events: none; mix-blend-mode: overlay;
  background: repeating-linear-gradient(115deg, #ff7ab8 0%, #ffd86b 9%, #7dffb0 18%, #6bd0ff 27%, #b98cff 36%, #ff7ab8 45%);
  background-size: 240% 240%; background-position: var(--mx, 50%) var(--my, 50%);
  opacity: var(--holo, .14); transition: opacity .35s;
}
.pack.is-tilting .foil::after { opacity: calc(var(--holo, .14) + .3); }
.pack-cathedral { --holo: .17; }
.pack-museum { --holo: .2; }
.pack-royal { --holo: .24; }
.pack-vault { --holo: .34; }
.pack-strip {
  top: 0; height: 12%; z-index: 2; clip-path: var(--clip-strip);
  background: linear-gradient(180deg, transparent 66%, rgba(0, 0, 0, .4) 66% 72%, rgba(255, 255, 255, .3) 72% 77%, transparent 77%), var(--ribs), var(--foil-bg);
}
.pack-main { top: 0; bottom: 0; clip-path: var(--clip-main); }
.pack-art { position: absolute; left: 0; right: 0; top: 9%; height: 66%; -webkit-mask-image: linear-gradient(180deg, #000 58%, transparent 97%); mask-image: linear-gradient(180deg, #000 58%, transparent 97%); }
.pack-art img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.25) brightness(1.05); }
.pack-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, var(--p3), var(--p2) 55%); mix-blend-mode: multiply; }
.pack-vault .pack-art img { filter: grayscale(1) contrast(1.35) brightness(.95); }
.pack-vault .pack-art::after { background: linear-gradient(180deg, #b9b3d4, #33334a 70%); }
.pack-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .45) 9%, transparent 26%, transparent 44%, color-mix(in srgb, var(--p1) 82%, #000) 74%); }
.pack-edge { position: absolute; left: 5%; right: 5%; top: 13.5%; bottom: 10%; border: .09em solid color-mix(in srgb, var(--p3) 75%, transparent); border-radius: .45em; box-shadow: inset 0 0 0 .2em rgba(0, 0, 0, .28), 0 0 0 .06em rgba(0, 0, 0, .5); }
.pack-level { position: absolute; left: 10%; top: 15.5%; font-size: 1.5em; font-weight: 700; line-height: 1; color: var(--p3); text-shadow: 0 .08em .2em rgba(0, 0, 0, .9); }
.pack-medal {
  position: absolute; left: 50%; top: 58%; width: 4.7em; height: 4.7em; transform: translate(-50%, -50%); border-radius: 50%;
  display: grid; place-items: center; color: var(--p3);
  background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--p2) 65%, #000), #060404 82%);
  border: .16em solid var(--p3); box-shadow: 0 0 0 .13em rgba(0, 0, 0, .7), 0 0 0 .22em color-mix(in srgb, var(--p3) 45%, transparent), 0 .35em .9em rgba(0, 0, 0, .7);
}
.pack-medal svg { width: 2.7em; height: 2.7em; }
.pack-label { position: absolute; left: 7%; right: 7%; top: 68.5%; text-align: center; }
.pack-name {
  font-size: 1.82em; font-weight: 700; line-height: 1; padding: 0 .12em .1em;
  background: linear-gradient(180deg, #fff 10%, var(--p3) 55%, color-mix(in srgb, var(--p3) 55%, var(--p1))); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 .07em .08em rgba(0, 0, 0, .9));
}
.pack-sub { font-size: .92em; margin-top: .3em; color: color-mix(in srgb, var(--p3) 80%, transparent); text-shadow: 0 .08em .2em rgba(0, 0, 0, .9); }
.pack-crimp { position: absolute; left: 0; right: 0; bottom: 0; height: 7.5%; background: linear-gradient(180deg, rgba(255, 255, 255, .3) 0 8%, rgba(0, 0, 0, .4) 8% 16%, transparent 16%), var(--ribs), var(--foil-bg); }
.pack-sheen { position: absolute; inset: 0; z-index: 4; pointer-events: none; mix-blend-mode: overlay; overflow: hidden; }
.pack-sheen::before { /* a band of light on a wide strip: the strip is moved, so nothing is repainted */
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 260%;
  background: linear-gradient(105deg, transparent 36%, rgba(255, 255, 255, .75) 50%, transparent 64%);
}
.pack.live .pack-sheen::before { animation: sheen 3.6s ease-in-out infinite; }
@keyframes sheen { 0% { transform: translateX(-80%); } 55%, 100% { transform: translateX(36.92%); } }
.pack-light { position: absolute; left: 0; right: 0; top: 7.5%; height: 18%; z-index: 4; opacity: 0; pointer-events: none; background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--beam, #fff) 75%, transparent) 38%, transparent); }
.pack-cracks { position: absolute; inset: 0; z-index: 7; pointer-events: none; opacity: 0; }
.pack-cracks svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 .25em var(--beam, #fff)) drop-shadow(0 0 .7em var(--beam, #fff)); }
.pack-cracks polyline { fill: none; stroke: #fff; stroke-width: 3px; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: var(--crack, 1); transition: stroke-dashoffset .36s ease-out; }
/* opening a pack */
.pack.drop { animation: packdrop .54s cubic-bezier(.35, 0, .4, 1) both; }
@keyframes packdrop {
  0% { transform: translateY(-115vh) rotate(-14deg); }
  68% { transform: translateY(0) rotate(2deg) scale(1.05, .94); }
  84% { transform: translateY(-3.5%) rotate(-1deg) scale(.98, 1.02); }
  100% { transform: none; }
}
.pack.idle { animation: packfloat 3.2s ease-in-out infinite; }
@keyframes packfloat { 0%, 100% { transform: translateY(0) rotate(-1.2deg); } 50% { transform: translateY(-2.5%) rotate(1.2deg); } }
.pack.torn .pack-strip { clip-path: var(--clip-strip-torn); animation: tearoff .95s cubic-bezier(.3, .5, .5, 1) forwards; }
@keyframes tearoff {
  0% { transform: none; opacity: 1; }
  28% { transform: translate(calc(var(--dir, 1) * 35%), -110%) rotate(calc(var(--dir, 1) * 22deg)); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(calc(var(--dir, 1) * 125%), 300%) rotate(calc(var(--dir, 1) * 150deg)) scaleY(.5); opacity: 0; }
}
.pack.torn .pack-light { opacity: 1; transition: opacity .12s; }
.pack.torn .pack-sheen { display: none; }
.pack.charging .pack-cracks { opacity: 1; }
.pack.charging .pack-tilt { animation: packvib .085s linear infinite; }
@keyframes packvib {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(var(--vib, .05em), calc(var(--vib, .05em) * -.6)) rotate(.5deg); }
  75% { transform: translate(calc(var(--vib, .05em) * -1), calc(var(--vib, .05em) * .6)) rotate(-.5deg); }
}
.pack.half { pointer-events: none; transition: transform .9s cubic-bezier(.12, .7, .25, 1), opacity .45s .42s; }
.pack.half .pack-strip, .pack.half .pack-cracks, .pack.half .pack-light, .pack.half .pack-sheen { display: none; }
.pack.half .pack-tilt { animation: none; transform: none; }
.pack.half-l .pack-tilt { clip-path: var(--clip-half-l); }
.pack.half-r .pack-tilt { clip-path: var(--clip-half-r); }
.pack.half-l { transform-origin: 0% 60%; }
.pack.half-r { transform-origin: 100% 60%; }
.pack.half-l.fly { transform: translate3d(-95%, 8%, 0) rotateY(-72deg) rotate(-18deg); opacity: 0; }
.pack.half-r.fly { transform: translate3d(95%, 8%, 0) rotateY(72deg) rotate(18deg); opacity: 0; }

/* ---------- shop ---------- */
.daily { display: flex; align-items: center; gap: 16px; font-size: 1.02rem; max-width: 100%; }
.daily .pack { --pw: 62px; transform: rotate(-7deg); margin: -6px 4px -6px 0; pointer-events: none; }
.daily-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.daily-text strong { font-size: 1.12rem; font-weight: 700; color: var(--gilt-hi); }
.daily.ready { padding: 12px 18px 12px 14px; border-radius: 12px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), 0 10px 30px rgba(0, 0, 0, .35); }
.reveal-note, .report-note { color: var(--gilt-hi); font-weight: 600; font-size: 1.15rem; text-align: center; }
.reveal-note:empty, .report-note:empty { display: none; }
.shelf { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 44px 14px; margin: 38px 0 0; align-items: start; }
.shelf .pack { --pw: clamp(112px, 14cqw, 158px); }
.shelf-item { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.shelf-item .pack { cursor: pointer; transition: transform .25s var(--ease); margin-bottom: 6px; }
.shelf-item:not(.poor) .pack:hover { transform: translateY(-.6em) scale(1.03); }
.shelf-item.poor .pack { cursor: default; }
.shelf-item.poor .pack-tilt { filter: saturate(.75) brightness(.72) drop-shadow(0 1.1em 1.2em rgba(0, 0, 0, .6)); }
.shelf-price { font-size: 1.55rem; font-weight: 700; line-height: 1; color: var(--gilt-hi); font-variant-numeric: tabular-nums; }
/* how much of a pack's price you have saved */
.shelf-saved { width: min(100%, 132px); margin: -2px 0 2px; }
.shelf-item .btn { font-size: .98rem; max-width: 100%; }
.odds { list-style: none; margin: 4px 0 0; padding: 0; color: var(--muted); font-size: .82rem; line-height: 1.3; text-align: left; }
.odds li { display: flex; align-items: baseline; padding: 2.5px 0; }
.odds .gem { margin: 0 .6em 0 .2em; }
@container (max-width: 880px) { .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); } .shelf .pack { --pw: clamp(120px, 26cqw, 190px); } }
@media (max-width: 560px) {
  .shelf { grid-template-columns: 1fr 1fr; gap: 36px 12px; }
  .shelf .pack { --pw: min(38vw, 180px); }
  .view-head > .daily { flex: 1 1 100%; }
  .daily.ready { flex-wrap: wrap; }
  .daily.ready .daily-text { flex: 1; }
  .daily.ready .btn { flex: 1 1 100%; }
}

/* ---------- restore screen ---------- */
.hand { display: flex; justify-content: center; gap: clamp(8px, 2.5vw, 30px); margin: 34px 0 22px; --cw: clamp(96px, 28vw, 210px); }
.hand-slot { width: var(--cw); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hand-slot .label { margin-top: 10px; }
/* held like a hand of cards: the outer two lean away */
.hand-card { transition: transform .35s var(--ease); }
.hand-slot:first-child .hand-card { transform: rotate(-3.5deg); }
.hand-slot:last-child .hand-card { transform: rotate(3.5deg); }
.hand-slot:nth-child(2) .hand-card { transform: translateY(-3%); }
.hand-slot .hand-card:hover { transform: none; }
.hand-empty {
  width: var(--cw); aspect-ratio: 5 / 7; display: grid; place-items: center; text-align: center; padding: 10px;
  border: 1.5px dashed rgba(217, 180, 90, .55); border-radius: calc(var(--cw) / 16 * .9); background: rgba(10, 4, 5, .4); color: var(--muted); font-size: .95rem;
}
.hand-pay { color: var(--gilt-hi); font-size: .9rem; text-align: center; }
.play-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.grid { --cw: clamp(96px, 28vw, 156px); display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--cw), 1fr)); gap: 26px 14px; justify-items: center; align-items: start; margin-top: 18px; }
.grid .card:not(.card-mystery):hover, .hand .card:hover { transform: translateY(-.45em) scale(1.04); z-index: 3; }
.tier-head { display: flex; align-items: center; gap: 0; }
.tier-head .gem { font-size: 1.1em; }
.tier-head small { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .95rem; font-weight: 400; color: var(--muted); }
.tier-head .meter { width: 96px; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; overflow: hidden; display: flex; flex-direction: column; align-items: center;
  background: radial-gradient(90% 70% at 50% 42%, #47191f, #0f0506 82%);
}
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

#reveal { padding-bottom: max(26px, env(safe-area-inset-bottom)); touch-action: none; --beam: #fff; }
.reveal-stage { position: relative; flex: 1; width: 100%; display: grid; place-items: center; min-height: 0; }
.reveal-stage.shake { animation: shake var(--shake-ms, 300ms) linear; }
@keyframes shake {
  0%, 100% { transform: none; }
  10% { transform: translate(calc(var(--amp) * -1), calc(var(--amp) * .6)); }
  22% { transform: translate(calc(var(--amp) * .85), calc(var(--amp) * -.9)); }
  34% { transform: translate(calc(var(--amp) * -.7), calc(var(--amp) * -.4)); }
  46% { transform: translate(calc(var(--amp) * .6), calc(var(--amp) * .75)); }
  58% { transform: translate(calc(var(--amp) * -.5), calc(var(--amp) * .2)); }
  70% { transform: translate(calc(var(--amp) * .35), calc(var(--amp) * -.3)); }
  84% { transform: translate(calc(var(--amp) * -.18), calc(var(--amp) * .12)); }
}
.reveal-stage::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 30% 78% at 50% -6%, rgba(255, 238, 214, .16), transparent 72%); }
.reveal-pack, .reveal-cards { grid-area: 1 / 1; }
.reveal-pack::after {
  content: ''; grid-area: 1 / 1; align-self: end; z-index: -1; pointer-events: none; width: min(92vw, 560px); height: 110px; transform: translateY(58%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--beam) 42%, transparent), transparent);
}
.reveal-pack:empty::after { display: none; }
.reveal-pack { display: grid; place-items: center; perspective: 1400px; z-index: 2; }
.reveal-pack > .pack { grid-area: 1 / 1; --pw: min(62vw, 300px, 40vh); cursor: pointer; }
.reveal-cards { --gap: clamp(8px, 2.6vw, 30px); display: flex; gap: var(--gap); --cw: min(28vw, 230px, 34vh); z-index: 1; }
.reveal-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.reveal-slot.front { z-index: 5; }
.reveal-slot.deal { animation: deal .82s cubic-bezier(.2, .7, .3, 1) both; animation-delay: calc(var(--k) * 130ms + 80ms); }
@keyframes deal {
  0% { transform: translate(calc(var(--i) * -1 * (100% + var(--gap))), 5vh) scale(.5) rotate(var(--spin)); opacity: 0; }
  12% { opacity: 1; }
  58% { transform: translate(calc(var(--i) * -.22 * (100% + var(--gap))), -9vh) scale(1.1) rotate(calc(var(--spin) * .06)); }
  86% { transform: translate(0, 1.3vh) scale(1.03, .96) rotate(0deg); }
  100% { transform: none; opacity: 1; }
}
.reveal-tag { width: var(--cw); min-height: 3.6em; opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s var(--ease); }
.reveal-tag.show { opacity: 1; transform: none; }
.reveal-tag .label-title { font-size: clamp(.8rem, 2.9vw, 1.08rem); }
.reveal-tag .label-sub { font-size: clamp(.7rem, 2.4vw, .9rem); }
.reveal-hint { min-height: 1.6em; font-size: 1.15rem; color: var(--muted); padding: 0 16px; text-align: center; z-index: 2; }
.reveal-foot { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 16px 0; z-index: 2; }
.reveal-total { font-size: 1.1rem; text-align: center; }

/* the light: a beam out of the torn pack, a glow behind it, rays and a dimmed room for big pulls */
.reveal-beam { /* a shaft of light out of the pack: white hot at the mouth, fading up and out */
  position: absolute; width: calc(var(--bw, 200px) * 3.4); height: 120vh; pointer-events: none; z-index: 1; opacity: 0;
  transform: translate(-50%, -100%) scaleY(0); transform-origin: 50% 100%;
  background:
    radial-gradient(ellipse 12% 100% at 50% 100%, #fff 0%, #fff 20%, color-mix(in srgb, var(--beam) 78%, #fff) 44%, color-mix(in srgb, var(--beam) 50%, transparent) 72%, transparent 100%),
    radial-gradient(ellipse 16.5% 80% at 50% 100%, color-mix(in srgb, var(--beam) 34%, transparent), transparent 100%);
  transition: transform .22s cubic-bezier(.2, .9, .3, 1), opacity .15s;
}
.reveal-beam.on { opacity: .95; transform: translate(-50%, -100%) scaleY(1); }
.reveal-beam.pulse { animation: beampulse .36s ease-out; }
@keyframes beampulse { 0% { transform: translate(-50%, -100%) scale(1.9, 1.06); filter: brightness(1.9); } 100% { transform: translate(-50%, -100%) scale(1, 1); filter: brightness(1); } }
.reveal-beam.out { opacity: 0; transform: translate(-50%, -100%) scale(.12, 1.15); transition: transform .26s ease-in, opacity .26s ease-in; }
#reveal.rainbow .reveal-beam, #reveal.rainbow .reveal-glow { animation: hue 1.1s linear infinite; }
#reveal.rainbow .reveal-rays { animation: spin 6s linear infinite, hue 1.1s linear infinite; }
#reveal.rainbow .reveal-stamp.go { animation: stamp 2.4s cubic-bezier(.15, .9, .2, 1) both, hue 1.1s linear infinite; }
@keyframes hue { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(360deg); } }
.reveal-glow {
  position: absolute; width: 130vmin; height: 130vmin; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--beam) 50%, transparent), transparent);
}
.reveal-glow.on { opacity: .8; }
.reveal-rays {
  position: absolute; left: 50%; top: 45%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; opacity: 0; transition: opacity .5s; pointer-events: none;
  background:
    repeating-conic-gradient(from 0deg, transparent 0deg, color-mix(in srgb, var(--beam) 20%, transparent) 3deg, transparent 6.5deg, transparent 12deg),
    repeating-conic-gradient(from 5deg, transparent 0deg, color-mix(in srgb, var(--beam) 11%, transparent) 8deg, transparent 15deg, transparent 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, rgba(0, 0, 0, .5) 14%, transparent 40%); mask-image: radial-gradient(circle, #000 0, rgba(0, 0, 0, .5) 14%, transparent 40%);
  animation: spin 16s linear infinite;
}
#reveal.big-pull .reveal-rays { opacity: .75; }
#reveal.huge-pull .reveal-rays { opacity: 1; animation-duration: 6s; }
@keyframes spin { to { transform: rotate(360deg); } }
.reveal-dim { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .45s; background: radial-gradient(62% 52% at 50% 45%, transparent 30%, rgba(0, 0, 0, .82)); }
#reveal.big-pull .reveal-dim { opacity: 1; }
.reveal-slash {
  position: absolute; height: 5px; margin-top: -2.5px; border-radius: 3px; pointer-events: none; opacity: 0; z-index: 4;
  background: linear-gradient(90deg, transparent, #fff 25%, #fff 75%, transparent); transform-origin: var(--so, 0%) 50%;
  box-shadow: 0 0 14px 4px var(--beam), 0 0 44px 12px color-mix(in srgb, var(--beam) 60%, transparent);
}
.reveal-slash.go { animation: slash .46s ease-out both; }
@keyframes slash {
  0% { transform: rotate(-2.5deg) scaleX(0); opacity: 1; }
  26% { transform: rotate(-2.5deg) scaleX(1); opacity: 1; }
  100% { transform: rotate(-2.5deg) scale(1.06, .15); opacity: 0; }
}
.reveal-stamp {
  position: absolute; left: 0; right: 0; top: 4%; text-align: center; white-space: nowrap; pointer-events: none; opacity: 0;
  font-size: clamp(3rem, 13vw, 10rem); font-weight: 700; line-height: 1; color: var(--beam);
}
.reveal-stamp.go { animation: stamp 2.4s cubic-bezier(.15, .9, .2, 1) both; }
@keyframes stamp { 0% { transform: scale(2.6); opacity: 0; } 11% { transform: scale(1); opacity: .6; } 24% { opacity: .22; } 100% { transform: scale(1.05); opacity: .16; } }
.reveal-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 6; background: radial-gradient(circle, #fff, rgba(255, 240, 200, .7) 40%, transparent 78%); }
.reveal-flash.go { animation: flash .75s ease-out; }
@keyframes flash { from { opacity: var(--flash, .5); } to { opacity: 0; } }

/* The mini game (Restore) is styled in css/restore.css. */

/* ---------- painting close-up ---------- */
#inspect { justify-content: safe center; gap: 22px; padding: 24px 16px; background: rgba(12, 4, 5, .9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); overflow: auto; }
.inspect-card { flex: none; }
/* a museum wall label: card stock and ink */
.inspect-text {
  flex: none; width: min(92vw, 420px); padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 5px;
  background: var(--cream); color: #4a3b30; border-radius: 3px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: .98rem; line-height: 1.35;
}
.inspect-text h2 { margin: 0; color: var(--ink); font-size: 1.55rem; font-weight: 700; line-height: 1.05; text-shadow: none; }
.inspect-text .inspect-by { color: var(--ink); margin-bottom: 6px; }
.inspect-text .link { color: #7a4a12; align-self: flex-start; margin-top: 4px; }
.inspect-text .link:hover { color: var(--ink); }

/* Left alone for a minute, the game holds still until the next move (js/main.js sets `idle`). */
.idle *, .idle *::before, .idle *::after { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) { /* nothing is ever `live` then, so cards and packs are already still */
  .reveal-rays, .pack.idle, .view:not([hidden]), .bg-art { animation: none; }
}
