:root {
  --indigo: #1e3359;
  --indigo-deep: #0c1528;
  --ink: #f4f1ea;
  --ink-muted: #b6c5e0;
  --thread: #dc9c45;
  --card-red: #c42a3c;
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--indigo);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--thread); color: var(--indigo-deep); }

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
body.hand-cursor #stage { cursor: none; }

#fabric {
  position: absolute;
  inset: 0;
  background-color: var(--indigo);
  background-image: var(--denim);
  background-size: 240px 240px;
}

#seams {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: visible;
}

#light {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(ellipse 46vmax 40vmax at var(--lx, 70%) var(--ly, 55%), rgb(150 185 245 / .13), transparent 70%),
    radial-gradient(ellipse 85% 85% at 50% 50%, transparent 45%, rgb(3 7 18 / .62) 100%);
}

/* Pocket */
#pocket {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  filter: drop-shadow(0 .6vmin .7vmin rgb(2 6 16 / .55));
}
#pocket .cloth {
  position: absolute;
  inset: 0;
  background-color: var(--indigo);
  background-image: var(--denim);
  background-size: 240px 240px;
  background-position: 37px 11px;
  filter: brightness(1.08) saturate(1.04);
  clip-path: polygon(0 0, 100% 0, 96% 83.93%, 50% 100%, 4% 83.93%);
}
#pocket .stitching {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.thread path {
  fill: none;
  stroke: var(--thread);
  stroke-width: 5.5;
  stroke-dasharray: 17 11;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.thread .thread-shadow path { stroke: #050b18; stroke-opacity: .45; }

#lip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(to top, rgb(3 8 20 / .55), rgb(3 8 20 / .18) 45%, transparent);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

/* Card */
.card {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  perspective: 1600px;
  transform-origin: 50% 50%;
}
.card.free { z-index: 8; }
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
}
.face {
  position: absolute;
  inset: 0;
  border-radius: 4.6%/3.3%;
  overflow: hidden;
  box-shadow: 0 6px 14px rgb(0 0 0 / .4);
  transition: box-shadow .7s var(--ease-out);
}
.card.free .face { box-shadow: 0 40px 90px rgb(0 0 0 / .55), 0 12px 24px rgb(0 0 0 / .3); }
.face svg { display: block; width: 100%; height: 100%; }
/* One face at a time: the flip swaps faces at 90deg instead of relying on 3D backfaces */
.face.front, .card-inner.front-up .face.back { visibility: hidden; }
.card-inner.front-up .face.front { visibility: visible; }
.face-art { position: absolute; inset: 0; }
.face.front > * { position: absolute; inset: 0; }
.face-art { z-index: 0; }

/* Holo foil: rainbow bands + glitter shifted by tilt, strongest on the frame and art window */
.holo {
  z-index: 1;
  pointer-events: none;
  background-image:
    var(--glitter),
    repeating-linear-gradient(115deg, #ff7773 0%, #ffed5f 6%, #a8ff5f 12%, #83fff7 18%, #7894ff 24%, #d875ff 30%, #ff7773 36%),
    repeating-linear-gradient(65deg, rgb(0 0 0 / .28) 0 1.5px, transparent 1.5px 4px);
  background-size: 220px 220px, 400% 400%, auto;
  background-position: center, var(--hx, 50%) var(--hy, 50%), center;
  mix-blend-mode: color-dodge;
  filter: brightness(.62) contrast(1.5) saturate(1.3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 250 350' preserveAspectRatio='none'%3E%3Cpath fill-rule='evenodd' d='M0 0H250V350H0ZM9 9H241V341H9Z'/%3E%3Crect x='17' y='38' width='216' height='146' rx='6'/%3E%3Crect x='9' y='188' width='232' height='153' fill-opacity='.15'/%3E%3C/svg%3E") 0 0 / 100% 100%;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 250 350' preserveAspectRatio='none'%3E%3Cpath fill-rule='evenodd' d='M0 0H250V350H0ZM9 9H241V341H9Z'/%3E%3Crect x='17' y='38' width='216' height='146' rx='6'/%3E%3Crect x='9' y='188' width='232' height='153' fill-opacity='.15'/%3E%3C/svg%3E") 0 0 / 100% 100%;
  opacity: 0;
  transition: opacity .8s ease .3s;
}
.card.shown .holo { opacity: 1; }

.glare {
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(circle at var(--gx, 30%) var(--gy, 20%), rgb(255 255 255 / .55), rgb(255 255 255 / 0) 50%);
  mix-blend-mode: overlay;
  opacity: 0;
  transition: opacity .5s ease;
}
.card.shown .glare { opacity: 1; }

/* Laminate: glossy rim and a soft top-left sheen */
.face.front::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .75), inset 0 2px 0 rgb(255 255 255 / .6);
  background: linear-gradient(155deg, rgb(255 255 255 / .12), transparent 22%);
}

/* One bright sweep across the card once the rainbow has drawn in */
.card.shown .face.front::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 36%, rgb(255 255 255 / .55) 46%, rgb(255 255 255 / .95) 50%, rgb(255 255 255 / .55) 54%, transparent 64%);
  mix-blend-mode: overlay;
  transform: translateX(-130%);
  animation: sheen 1.3s 1.05s cubic-bezier(.45, 0, .2, 1) forwards;
}
@keyframes sheen { to { transform: translateX(130%); } }

/* Rainbow draws in band by band, then the clouds pop in */
.card .arc { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.card.drawn .arc { animation: draw .75s cubic-bezier(.3, .7, .2, 1) forwards; animation-delay: calc(.1s + var(--i) * .09s); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.card .cloud { transform-box: fill-box; transform-origin: 50% 80%; transform: scale(0); }
.card.drawn .cloud { animation: pop .45s cubic-bezier(.2, .9, .3, 1.25) forwards; animation-delay: var(--d); }
@keyframes pop { to { transform: scale(1); } }
.card .twinkle { animation: twinkle 2.2s ease-in-out infinite; }
.card .twinkle.t2 { animation-delay: -1.1s; }
@keyframes twinkle { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }

/* Card typography (inline SVG text) */
.qmark { font: 800 230px var(--font); font-variation-settings: "wdth" 85, "opsz" 96; }
.you { font: 640 32px var(--font); font-variation-settings: "wdth" 85, "opsz" 48; letter-spacing: -.02em; }
.gay { font: 820 76px var(--font); font-variation-settings: "wdth" 80, "opsz" 96; letter-spacing: -.04em; }
.fine { font: 600 7.6px var(--font); letter-spacing: .16em; }
.tag { font: 700 7.2px var(--font); letter-spacing: .14em; }
.hp-label { font: 800 8px var(--font); letter-spacing: .06em; }
.hp { font: 800 20px var(--font); }
.cname { font-weight: 780; font-family: var(--font); font-variation-settings: "wdth" 80, "opsz" 48; letter-spacing: -.02em; }

/* Grab target for keyboard users, sits over the visible part of the card */
#cardHit {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: inherit;
}
#cardHit:focus-visible { outline: 2px solid var(--thread); outline-offset: 4px; }
#cardHit[disabled] { visibility: hidden; }

/* Hint */
#hint {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
}
#hint.on { opacity: 1; }
#hint .ring {
  position: absolute;
  left: -22px;
  top: -22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgb(255 255 255 / .85);
  animation: ring 1.6s ease-out infinite;
}
@keyframes ring {
  0% { transform: scale(.45); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}
#hint .pill {
  position: absolute;
  right: calc(100% + var(--pill-gap, 40px));
  top: -17px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px 0 11px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 560;
  color: var(--indigo-deep);
  background: var(--ink);
  box-shadow: 0 8px 22px rgb(0 0 0 / .35);
}
#hint .pill svg { animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-3px); } }

/* Hand */
#hand {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  pointer-events: none;
  filter: drop-shadow(0 2.2vmin 2.4vmin rgb(2 6 16 / .5));
}
#hand img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#hand .h-closed { opacity: 0; }
#hand.pinched .h-closed { opacity: 1; }
#hand.pinched .h-open { opacity: 0; }
#hand .sleeve-ext { position: absolute; top: 0; }

#veil {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgb(10 18 38 / .5), rgb(4 8 20 / .82));
  backdrop-filter: blur(5px) saturate(.8);
  -webkit-backdrop-filter: blur(5px) saturate(.8);
  opacity: 0;
  transition: opacity .6s ease;
}
#veil.on { opacity: 1; }

#rays {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 7;
  pointer-events: none;
}
#rays::before, #rays::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  transition: opacity .9s ease;
}
#rays::before {
  width: 190vmax;
  height: 190vmax;
  left: -95vmax;
  top: -95vmax;
  background: repeating-conic-gradient(from 0deg,
    rgb(228 3 3 / .3) 0 4deg, transparent 4deg 10deg,
    rgb(255 140 0 / .3) 10deg 14deg, transparent 14deg 20deg,
    rgb(255 237 0 / .26) 20deg 24deg, transparent 24deg 30deg,
    rgb(0 128 38 / .3) 30deg 34deg, transparent 34deg 40deg,
    rgb(36 64 142 / .4) 40deg 44deg, transparent 44deg 50deg,
    rgb(115 41 130 / .4) 50deg 54deg, transparent 54deg 60deg);
  -webkit-mask-image: radial-gradient(circle, #000 4%, rgb(0 0 0 / .5) 18%, transparent 42%);
  mask-image: radial-gradient(circle, #000 4%, rgb(0 0 0 / .5) 18%, transparent 42%);
  animation: spin 50s linear infinite;
}
#rays::after {
  width: 72vmin;
  height: 72vmin;
  left: -36vmin;
  top: -36vmin;
  background: conic-gradient(#e40303, #ff8c00, #ffed00, #008026, #24408e, #732982, #e40303);
  filter: blur(60px);
  animation: spin 9s linear infinite reverse;
}
#rays.on::before { opacity: 1; }
#rays.on::after { opacity: .55; }
@keyframes spin { to { rotate: 360deg; } }

#confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 7;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Chrome */
.intro {
  position: fixed;
  top: max(24px, env(safe-area-inset-top));
  left: max(28px, env(safe-area-inset-left));
  z-index: 5;
  max-width: min(400px, calc(100vw - 56px));
  pointer-events: none;
}
.intro h1 {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 700;
  font-variation-settings: "wdth" 80, "opsz" 96;
  letter-spacing: -.025em;
  line-height: 1;
}
.intro p {
  margin: 10px 0 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.intro > * { transition: opacity .4s ease, transform .55s var(--ease-out); }
body.revealing .intro > :not(.gift) { opacity: 0; pointer-events: none; }
body.revealing .intro .gift { transform: translateY(var(--gift-lift, 0)); }
.intro .gift {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--thread);
  background: rgb(10 18 36 / .5);
  border: 1px solid rgb(220 156 69 / .45);
}


.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 580;
  cursor: pointer;
  transition: transform .18s var(--ease-out), background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--thread); outline-offset: 3px; }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.ghost {
  color: var(--ink);
  background: rgb(10 18 36 / .45);
  border: 1px solid rgb(255 255 255 / .28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ghost:not([disabled]):hover { background: rgb(10 18 36 / .7); border-color: rgb(255 255 255 / .5); }
.solid {
  color: var(--indigo-deep);
  background: var(--ink);
  border: 0;
  box-shadow: 0 10px 28px rgb(0 0 0 / .35);
}
.solid:hover { background: #fff; transform: translateY(-1px); box-shadow: 0 14px 34px rgb(0 0 0 / .4); }
.solid:active { transform: scale(.97); }
.solid img { width: 22px; height: 22px; margin-left: -4px; }

kbd {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgb(12 21 40 / .1);
  color: rgb(12 21 40 / .7);
}

#reveal {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .35s ease, transform .5s var(--ease-out), visibility 0s .35s;
}
#reveal.on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .45s ease .05s, transform .6s var(--ease-out) .05s, visibility 0s;
}
#reveal h2 {
  margin: 0;
  font-size: clamp(26px, 2.8vw, 38px);
  font-weight: 680;
  font-variation-settings: "wdth" 82, "opsz" 96;
  letter-spacing: -.02em;
  line-height: 1.1;
}
#reveal p {
  margin: 6px 0 18px;
  font-size: 17px;
  color: var(--ink-muted);
}

@media (max-width: 699px) {
  .intro { top: max(20px, env(safe-area-inset-top)); left: 20px; }
  .intro p { font-size: 15px; }
  #hint .pill { font-size: 13px; height: 32px; top: -16px; }
  kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card .arc { stroke-dashoffset: 0; }
  .card .cloud { transform: none; }
  .card.drawn .arc, .card.drawn .cloud { animation: none; }
  #hint .ring, #hint .pill svg, .card.shown .face.front::after, .card .twinkle, #rays::before, #rays::after { animation: none; }
  #hint .ring { opacity: .8; transform: none; }
}

/* Bag: zooms in for the card, then waits in the corner */
.bag {
  position: fixed;
  left: max(24px, env(safe-area-inset-left));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.bag[hidden] { display: none; }
.bag-art {
  position: relative;
  width: 92px;
  height: 92px;
  transform: scale(0);
  transform-origin: 50% 50%;
}
.bag-art img {
  position: relative;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 14px rgb(2 6 16 / .55));
  transition: transform .2s var(--ease-out);
}
.bag:hover .bag-art img { transform: translateY(-3px) rotate(-3deg); }
.bag:active .bag-art img { transform: scale(.95); }
.bag:focus-visible { outline: none; }
.bag:focus-visible .bag-art { outline: 2px solid var(--thread); outline-offset: 6px; border-radius: 22px; }
.bag-glow {
  position: absolute;
  inset: -22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 214 120 / .65), rgb(255 160 60 / .25) 45%, transparent 70%);
  opacity: 0;
}
.bag.ready:not(.seen) .bag-glow { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: .35; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.08); } }
.bag-count {
  position: absolute;
  right: 2px;
  top: 4px;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 750;
  color: #fff;
  background: #e0353f;
  box-shadow: 0 0 0 2px var(--indigo-deep);
  opacity: 0;
  transform: scale(.4);
  transition: opacity .3s ease, transform .4s var(--ease-out);
}
.bag.ready:not(.seen) .bag-count { opacity: 1; transform: none; }
.bag-prompt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px 0 12px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 620;
  white-space: nowrap;
  color: var(--indigo-deep);
  background: var(--ink);
  box-shadow: 0 8px 24px rgb(0 0 0 / .35);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .35s ease, transform .45s var(--ease-out);
  pointer-events: none;
}
.bag.ready .bag-prompt { opacity: 1; transform: none; pointer-events: auto; }
.bag.ready:not(.seen) .bag-prompt svg { animation: poke 1.2s ease-in-out infinite; }
@keyframes poke { 50% { transform: translateX(-3px); } }
.bag.seen .bag-prompt { background: rgb(10 18 36 / .6); color: var(--ink); border: 1px solid rgb(255 255 255 / .25); }

/* Inventory dialog */
#inventory {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  background: linear-gradient(180deg, #17223f, #0d1428);
  box-shadow: 0 40px 100px rgb(0 0 0 / .6), inset 0 0 0 1px rgb(255 255 255 / .1);
  overflow: auto;
}
#inventory::backdrop { background: rgb(3 7 18 / .7); backdrop-filter: blur(6px); }
#inventory[open] { animation: invIn .35s var(--ease-out); }
@keyframes invIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.inv { padding: 22px 24px 26px; }
.inv-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.inv-head h2 { margin: 0; font-size: 26px; font-weight: 700; font-variation-settings: "wdth" 82, "opsz" 96; letter-spacing: -.02em; }
.inv-cap { font-size: 13px; font-weight: 600; color: var(--ink-muted); font-variant-numeric: tabular-nums; padding: 3px 9px; border-radius: 999px; background: rgb(255 255 255 / .07); }
.inv-close {
  margin-left: auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: rgb(255 255 255 / .06);
  cursor: pointer;
  transition: background-color .15s ease;
}
.inv-close:hover { background: rgb(255 255 255 / .14); }
.inv-close:focus-visible { outline: 2px solid var(--thread); outline-offset: 2px; }
.inv-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.inv-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.slot {
  --r: #9aa3b5;
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: 10%;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid rgb(255 255 255 / .09);
  background: rgb(255 255 255 / .035);
  box-sizing: border-box;
}
.slot.empty { border-style: dashed; border-color: rgb(255 255 255 / .07); background: none; }
button.slot {
  cursor: pointer;
  background: radial-gradient(120% 90% at 50% 110%, color-mix(in srgb, var(--r) 38%, transparent), transparent 60%), rgb(255 255 255 / .05);
  border-color: color-mix(in srgb, var(--r) 45%, transparent);
  transition: transform .15s var(--ease-out), border-color .15s ease, box-shadow .2s ease;
}
button.slot:hover { transform: translateY(-2px); border-color: var(--r); }
button.slot[aria-pressed="true"] { border-color: var(--r); box-shadow: 0 0 0 2px var(--r), 0 0 26px color-mix(in srgb, var(--r) 45%, transparent); }
button.slot:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.slot { overflow: hidden; }
.slot img, .slot svg { position: absolute; inset: 10%; width: 80%; height: 80%; object-fit: contain; display: block; }
.slot svg { filter: drop-shadow(0 4px 8px rgb(0 0 0 / .4)); }
.r-common { --r: #9aa3b5; }
.r-legendary { --r: #f5b942; }

.inv-detail {
  --r: #9aa3b5;
  border-radius: 18px;
  padding: 18px;
  background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--r) 22%, transparent), transparent 70%), rgb(255 255 255 / .04);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--r) 35%, transparent);
}
.detail-art { position: relative; height: 220px; margin-bottom: 14px; }
.detail-art img, .detail-art svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 20px rgb(0 0 0 / .45)); }
.rarity { display: inline-block; font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: var(--r); }
.inv-detail h3 { margin: 4px 0 8px; font-size: 22px; font-weight: 700; font-variation-settings: "wdth" 85, "opsz" 48; letter-spacing: -.01em; }
.inv-detail p { margin: 0 0 14px; font-size: 15px; line-height: 1.5; color: var(--ink-muted); }
.inv-detail dl { margin: 0; display: grid; gap: 6px; }
.inv-detail dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding-top: 6px; border-top: 1px solid rgb(255 255 255 / .07); }
.inv-detail dt { color: var(--ink-muted); }
.inv-detail dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }

@media (max-width: 699px) {
  .bag-art { width: 78px; height: 78px; }
  .bag-prompt { font-size: 14px; height: 36px; }
  .inv { padding: 18px 16px 20px; }
  .inv-body { grid-template-columns: 1fr; }
  .inv-grid { gap: 8px; }
  .detail-art { height: 170px; }
  .drop-pop { top: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  .bag.ready:not(.seen) .bag-glow { animation: none; opacity: .7; }
  .bag.ready:not(.seen) .bag-prompt svg { animation: none; }
  #inventory[open] { animation: none; }
}

/* Reveal actions */
.reveal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn.small { min-height: 38px; padding: 0 16px; font-size: 14px; }

/* Rigged reroll deck */
.ghost-card {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  border-radius: 4.6%/3.3%;
  overflow: hidden;
  box-shadow: 0 16px 40px rgb(0 0 0 / .45);
}
.ghost-card svg { display: block; width: 100%; height: 100%; }

/* Achievement toast */
.toast {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 10px 10px;
  border-radius: 999px;
  color: var(--ink);
  background: rgb(14 22 44 / .92);
  border: 1px solid rgb(245 185 66 / .55);
  box-shadow: 0 16px 40px rgb(0 0 0 / .45), 0 0 30px rgb(245 185 66 / .2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translate(-50%, -140%);
  opacity: 0;
  transition: transform .5s var(--ease-out), opacity .3s ease;
  pointer-events: none;
}
.toast.on { transform: translate(-50%, 0); opacity: 1; }
.toast-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #2a1a00;
  background: radial-gradient(circle at 35% 30%, #ffe7a3, #f5b942 55%, #c98a16);
}
.toast-text { display: grid; line-height: 1.2; }
.toast-text small { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #f5b942; }
.toast-text strong { font-size: 16px; font-weight: 680; }

/* Inventory item actions */
.detail-actions { display: flex; gap: 8px; margin-top: 14px; }
.detail-actions .btn { flex: 1; justify-content: center; }
.detail-note { margin: 8px 0 0 !important; font-size: 12.5px !important; color: rgb(182 197 224 / .7) !important; }
.inv-detail { position: relative; }
.drop-pop {
  position: absolute;
  left: 50%;
  top: 150px;
  z-index: 2;
  width: max-content;
  max-width: calc(100% - 24px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 12px 12px;
  border-radius: 16px;
  background: rgb(12 19 38 / .95);
  border: 1px solid color-mix(in srgb, var(--r) 70%, transparent);
  box-shadow: 0 18px 44px rgb(0 0 0 / .55), 0 0 30px color-mix(in srgb, var(--r) 30%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translate(-50%, 10px) scale(.92);
  transition: opacity .25s ease, transform .45s cubic-bezier(.2, .9, .3, 1.2);
  pointer-events: none;
}
.drop-pop.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.pop-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #0d1428;
  background: linear-gradient(160deg, color-mix(in srgb, var(--r) 55%, #fff), var(--r));
}
.pop-text { display: grid; gap: 2px; line-height: 1.3; }
.pop-text strong { font-size: 15px; font-weight: 720; color: #fff; }
.pop-text span { font-size: 13.5px; color: var(--ink-muted); }

@media (max-width: 699px) {
  .toast { top: max(64px, env(safe-area-inset-top)); width: max-content; max-width: calc(100vw - 32px); padding: 8px 16px 8px 8px; gap: 10px; }
  .toast-icon { width: 34px; height: 34px; }
  .toast-text small { font-size: 9.5px; }
  .toast-text strong { font-size: 14px; }
  .inv-head { margin-bottom: 14px; }
  .inv-head h2 { font-size: 22px; }
  .inv-grid { grid-template-columns: repeat(6, 1fr); gap: 6px; }
  .slot { border-radius: 10px; }
  .inv-body { gap: 14px; }
  .inv-detail { padding: 14px; }
  .detail-art { height: 132px; margin-bottom: 10px; }
  .drop-pop { top: 70px; }
  .inv-detail h3 { font-size: 19px; margin: 2px 0 6px; }
  .inv-detail p { font-size: 14px; margin-bottom: 10px; }
  .inv-detail dl div { font-size: 13px; padding-top: 5px; }
  .detail-actions { margin-top: 10px; }
}
