/* PRINTR PACK — card + pack + rip styles */

:root {
  --ink: #0a0a0a;
  --dark: #0F172A;
  --cream: #f1ead6;
  --cream-2: #e6dfc7;
  --primary: #4F46E5;
  --secondary: #EF4444;
  --accent: #F59E0B;
  --green: #22c55e;
  --purple: #a855f7;
}

/* ───────── doc shell ───────── */
.doc {
  font-family: 'Archivo', system-ui, sans-serif;
  background: var(--dark);
  color: white;
  min-height: 100vh;
  padding: 0;
  margin: 0;
}
.doc__hero {
  position: relative;
  padding: 72px 32px 56px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, rgba(79,70,229,0.35), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(239,68,68,0.22), transparent 50%),
    #0a0e1c;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.doc__inner { max-width: 1280px; margin: 0 auto; }

.tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(79,70,229,0.4);
  background: rgba(79,70,229,0.12);
  color: #b6b3ff;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.doc__title {
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: clamp(48px, 9vw, 128px);
  line-height: 0.9;
  margin: 0 0 20px;
  letter-spacing: -0.02em;
}
.doc__title em { font-style: normal; color: var(--secondary); }
.doc__lede {
  font-size: 20px;
  color: rgba(255,255,255,0.72);
  max-width: 760px;
  line-height: 1.5;
}

.doc__section {
  padding: 64px 32px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.doc__section--dark { background: #0a0e1c; }
.doc__section--demo {
  background:
    radial-gradient(ellipse at center, rgba(79,70,229,0.18), transparent 60%),
    #060912;
  padding: 32px 0 80px;
}
.doc__h {
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: 14px;
  color: var(--primary);
  letter-spacing: 0.3em;
  margin: 0 0 10px;
}
.doc__h2 {
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
.doc__p { font-size: 16px; color: rgba(255,255,255,0.72); line-height: 1.65; max-width: 720px; }
.doc__p strong { color: white; }

.kgrid { display: grid; gap: 16px; margin-top: 28px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kcard {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 20px;
}
.kcard__k {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--primary);
  margin-bottom: 8px;
}
.kcard__v {
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: 26px;
  margin-bottom: 6px;
}
.kcard__d { font-size: 13px; color: rgba(255,255,255,0.6); line-height: 1.5; }

/* ───────── trading card ───────── */
.card {
  --c-w: 280px;
  --c-h: 392px;
  width: var(--c-w);
  height: var(--c-h);
  position: relative;
  border-radius: 14px;
  background: var(--cream);
  color: var(--ink);
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0,0,0,0.55), 0 0 0 2px var(--card-edge, #1a1f2a);
  font-family: 'Archivo', system-ui, sans-serif;
  user-select: none;
}
.card--lg { --c-w: 320px; --c-h: 448px; }
.card--xs { --c-w: 200px; --c-h: 280px; }

/* paper grain */
.card::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0,0,0,0.05) 0, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0,0,0,0.04) 0, transparent 40%);
  pointer-events: none; mix-blend-mode: multiply;
}

.card__hdr {
  background: var(--card-hdr, #0a0a0a);
  color: white;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Archivo Black', system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.2em;
  position: relative;
  z-index: 2;
}
.card__hdr-r { color: var(--card-rarity, var(--primary)); }

.card__art {
  position: relative;
  height: 230px;
  background: var(--card-bg, linear-gradient(135deg, #b5b9c5, #6e7585));
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
/* halftone dot overlay on art */
.card__art::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(0,0,0,0.18) 1px, transparent 1.5px);
  background-size: 6px 6px;
  opacity: 0.5;
  mix-blend-mode: multiply;
}
.card__art-mascot {
  position: relative; z-index: 2;
  max-height: 95%;
  max-width: 85%;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.25));
}
.card__art-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  display: block;
}
/* Photo-art cards: dim the halftone dots so the art reads cleanly */
.card__art--photo { background: var(--ink); }
.card__art--photo::before {
  opacity: 0.18;
  background-size: 4px 4px;
  z-index: 3;
}
/* soft fade where the art meets the cream paper meta strip */
.card__art--photo::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 24px;
  background: linear-gradient(to bottom, transparent, var(--cream));
  pointer-events: none;
  z-index: 4;
}
.card__art-glyph {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: 92px;
  color: rgba(0,0,0,0.18);
  letter-spacing: -0.02em;
  z-index: 1;
}

.card__stamp {
  position: absolute;
  top: 36px; right: 10px;
  z-index: 3;
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--card-rarity, var(--primary));
  background: rgba(255,255,255,0.92);
  padding: 4px 7px;
  border: 1.5px solid var(--card-rarity, var(--primary));
  border-radius: 3px;
  transform: rotate(8deg);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.35);
}

.card__meta {
  padding: 10px 12px 8px;
  position: relative;
  z-index: 2;
}
.card__name {
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: 18px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.card__handle {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 10px;
  color: var(--card-rarity, var(--primary));
  letter-spacing: 0.05em;
  margin-top: 2px;
  display: flex;
  justify-content: space-between;
}
.card__handle-dept { color: rgba(0,0,0,0.5); }

.card__flavor {
  margin-top: 6px;
  font-style: italic;
  font-size: 11px;
  color: rgba(0,0,0,0.6);
  line-height: 1.3;
  padding-right: 4px;
  text-wrap: pretty;
}

.card__stats {
  position: absolute;
  bottom: 6px; left: 12px; right: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  z-index: 2;
}
.card__stat {
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 4px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 9px;
  display: flex; justify-content: space-between;
  letter-spacing: 0.04em;
}
.card__stat-v { font-family: 'Archivo Black', system-ui, sans-serif; color: var(--card-rarity, var(--primary)); }

.card__serial {
  position: absolute;
  left: 12px; top: 38px;
  z-index: 3;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 8px;
  color: rgba(255,255,255,0.9);
  background: rgba(0,0,0,0.6);
  padding: 2px 5px;
  border-radius: 2px;
  letter-spacing: 0.1em;
}

/* Holo border + shimmer for Epic/Legendary */
.card--holo { box-shadow: 0 0 0 2px transparent, 0 16px 50px rgba(0,0,0,0.55), 0 0 50px var(--card-glow, rgba(168,85,247,0.5)); }
.card--holo::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 14px;
  padding: 2px;
  background: conic-gradient(from var(--holo-rot, 0deg),
    #ff5d8f, #ffae00, #fff36a, #4dffae, #4fc5ff, #b07cff, #ff5d8f);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: 5;
  pointer-events: none;
  animation: holo-rot 5s linear infinite;
}
@property --holo-rot { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes holo-rot { to { --holo-rot: 360deg; } }

.card--legendary .card__art {
  background:
    conic-gradient(from var(--lg-rot,0deg), #ff5d8f33, #ffae0033, #fff36a33, #4dffae33, #4fc5ff33, #b07cff33, #ff5d8f33),
    linear-gradient(135deg, #fbbf24, #d97706);
  animation: lg-rot 8s linear infinite;
}
@keyframes lg-rot { to { --lg-rot: 360deg; } }

/* Holo shimmer overlay on the whole card */
.card--holo .card__art::after {
  content: '';
  position: absolute; inset: 0;
  background:
    linear-gradient(115deg,
      transparent 30%,
      rgba(255,255,255,0.35) 45%,
      rgba(255,255,255,0.0) 55%,
      rgba(255,255,255,0.25) 65%,
      transparent 80%);
  background-size: 400% 400%;
  background-position: 100% 0;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: holo-shine 4s ease-in-out infinite;
}
@keyframes holo-shine {
  0%, 100% { background-position: 100% 0; }
  50% { background-position: 0 100%; }
}

/* ───────── card back ───────── */
.cardback {
  --c-w: 280px;
  --c-h: 392px;
  width: var(--c-w);
  height: var(--c-h);
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 30%, rgba(79,70,229,0.3), transparent 60%),
    repeating-linear-gradient(45deg, #0a0e1c 0 14px, #0f172a 14px 28px);
  border: 2px solid #1a1f3d;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0,0,0,0.55);
  color: white;
}
.cardback__logo {
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: 38px;
  color: white;
  letter-spacing: -0.02em;
  text-shadow: 0 0 30px rgba(79,70,229,0.5);
}
.cardback__logo em { color: var(--secondary); font-style: normal; }
.cardback__sub {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: rgba(255,255,255,0.6);
  margin-top: 6px;
}
.cardback__seal {
  position: absolute;
  top: 16px; left: 16px;
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bungee', system-ui, sans-serif;
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.1em;
}
.cardback__strip {
  position: absolute;
  bottom: 12px; left: 12px; right: 12px;
  height: 24px;
  background: rgba(0,0,0,0.5);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 9px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.1em;
}

/* ───────── pack stage ───────── */
.stage {
  position: relative;
  width: 100%;
  height: 720px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1400px;
  perspective-origin: 50% 45%;
  overflow: hidden;
}

.stage__glow {
  position: absolute;
  width: 700px; height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--stage-glow, rgba(79,70,229,0.35)), transparent 65%);
  filter: blur(20px);
  z-index: 0;
  transition: background 0.6s;
  animation: pulse-glow 4s ease-in-out infinite;
}
@keyframes pulse-glow { 50% { transform: scale(1.1); } }

/* pack: 3D box with foil */
.pack {
  --p-w: 240px;
  --p-h: 360px;
  --p-d: 14px;
  position: relative;
  width: var(--p-w);
  height: var(--p-h);
  transform-style: preserve-3d;
  transform: rotateY(var(--pack-y, 0deg)) rotateX(var(--pack-x, -8deg));
  z-index: 2;
  transition: transform 0.25s ease-out;
}
.pack__face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: var(--foil, linear-gradient(135deg, #4F46E5, #a855f7));
  overflow: hidden;
  backface-visibility: hidden;
}
.pack__face--front { transform: translateZ(calc(var(--p-d) / 2)); }
.pack__face--back  { transform: translateZ(calc(var(--p-d) / -2)) rotateY(180deg); }
.pack__face--right {
  width: var(--p-d);
  left: auto; right: 0;
  transform: translateX(calc(var(--p-d) / 2)) rotateY(90deg);
  background: linear-gradient(180deg, #312e81, #1e1b4b);
  filter: brightness(0.7);
}
.pack__face--left {
  width: var(--p-d);
  transform: translateX(calc(var(--p-d) / -2)) rotateY(-90deg);
  background: linear-gradient(180deg, #312e81, #1e1b4b);
  filter: brightness(0.7);
}
.pack__face--top {
  height: var(--p-d);
  bottom: auto;
  transform: translateY(calc(var(--p-d) / -2)) rotateX(90deg);
  background: linear-gradient(90deg, #312e81, #1e1b4b);
  filter: brightness(0.6);
}
.pack__face--bottom {
  height: var(--p-d);
  top: auto;
  transform: translateY(calc(var(--p-d) / 2)) rotateX(-90deg);
  background: linear-gradient(90deg, #312e81, #1e1b4b);
  filter: brightness(0.6);
}

/* Holographic foil on front face */
.foil-rainbow {
  background:
    linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.55) 50%, transparent 65%),
    conic-gradient(from var(--foil-rot, 0deg) at 50% 50%,
      #ff5d8f, #ffae00, #fff36a, #4dffae, #4fc5ff, #b07cff, #ff5d8f);
  background-size: 200% 200%, 100% 100%;
  background-position: var(--shine-x, 100%) 0, 0 0;
  animation: foil-rot 6s linear infinite;
}
@property --foil-rot { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes foil-rot { to { --foil-rot: 360deg; } }

.pack__brand {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 28px 18px;
  text-align: center;
  z-index: 2;
}
.pack__top-strip {
  width: 100%;
  height: 28px;
  background: rgba(0,0,0,0.85);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.25em;
  color: white;
  border: 1px dashed rgba(255,255,255,0.3);
}
.pack__logo {
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: 40px;
  line-height: 0.85;
  color: white;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 0 rgba(0,0,0,0.4);
}
.pack__logo em { color: #fff36a; font-style: normal; }
.pack__sub {
  font-family: 'Archivo Black', system-ui, sans-serif;
  font-size: 11px;
  color: white;
  letter-spacing: 0.3em;
  background: rgba(0,0,0,0.6);
  padding: 4px 10px;
  border-radius: 999px;
  margin-top: 6px;
}
.pack__count {
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: 14px;
  color: white;
  letter-spacing: 0.15em;
  background: var(--secondary);
  padding: 6px 14px;
  border-radius: 4px;
  border: 2px dashed rgba(255,255,255,0.5);
  transform: rotate(-3deg);
}
.pack__char {
  width: 70%;
  height: auto;
  filter: drop-shadow(0 8px 0 rgba(0,0,0,0.3)) brightness(1.05) contrast(1.05);
}

.pack__notch {
  position: absolute;
  top: 36px; left: 0; right: 0;
  height: 4px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,0.4) 0 6px, transparent 6px 12px);
}

/* spinning idle state */
.pack--spin { animation: pack-spin 12s linear infinite; }
@keyframes pack-spin {
  0% { transform: rotateY(0deg) rotateX(-8deg); }
  100% { transform: rotateY(360deg) rotateX(-8deg); }
}
.pack--float { animation: pack-float 4s ease-in-out infinite; }
@keyframes pack-float {
  0%, 100% { transform: translateY(0) rotateY(var(--pack-y,0deg)) rotateX(-8deg); }
  50% { transform: translateY(-22px) rotateY(var(--pack-y,0deg)) rotateX(-8deg); }
}

/* tear state: pack scales up, top splits */
.pack__face--front .tear-clip {
  position: absolute; inset: 0;
  background: inherit;
  transition: clip-path 0.9s cubic-bezier(0.6, 0, 0.3, 1);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}
.pack--torn .tear-clip {
  clip-path: polygon(0 24%, 8% 22%, 16% 26%, 24% 21%, 33% 27%, 42% 22%, 51% 28%, 60% 21%, 70% 27%, 80% 22%, 90% 28%, 100% 24%, 100% 100%, 0 100%);
}
.pack__lid {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 26%;
  background: inherit;
  z-index: 3;
  transition: transform 1s cubic-bezier(0.5, 0, 0.4, 1), opacity 0.6s 0.5s;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 90% 75%, 80% 95%, 70% 70%, 60% 90%, 51% 70%, 42% 88%, 33% 70%, 24% 90%, 16% 72%, 8% 90%, 0 75%);
}
.pack--torn .pack__lid {
  transform: translateY(-160%) rotate(-9deg);
  opacity: 0;
}

/* hide pack faces when fully ripped */
.pack--rip-done .pack__face,
.pack--rip-done .pack__lid { opacity: 0; transition: opacity 0.5s; }

/* ───────── fanned cards ───────── */
.fan {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 4;
}
.fan__slot {
  position: absolute;
  width: 200px; height: 280px;
  opacity: 0;
  transform: translateY(20px) scale(0.7);
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
  pointer-events: auto;
  cursor: pointer;
  transform-style: preserve-3d;
}
.fan--open .fan__slot {
  opacity: 1;
}
/* fan out arc — 5 cards */
.fan--open .fan__slot[data-i="0"] { transform: translate(-340px, 30px) rotate(-14deg); }
.fan--open .fan__slot[data-i="1"] { transform: translate(-170px, -10px) rotate(-7deg); }
.fan--open .fan__slot[data-i="2"] { transform: translate(0, -20px) rotate(0deg); }
.fan--open .fan__slot[data-i="3"] { transform: translate(170px, -10px) rotate(7deg); }
.fan--open .fan__slot[data-i="4"] { transform: translate(340px, 30px) rotate(14deg); }

.flipper {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 1.5, 0.4, 1);
}
.fan__slot.is-flipped .flipper { transform: rotateY(180deg); }
.flipper__side {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center;
}
.flipper__side--back .cardback { --c-w: 200px; --c-h: 280px; transform: scale(1); }
.flipper__side--front { transform: rotateY(180deg); }
.flipper__side--front .card { --c-w: 200px; --c-h: 280px; transform: scale(1); }

.fan__slot:hover .flipper:not(.flipped) { transform: translateY(-6px) rotateZ(0); }

/* rare pull burst */
.burst {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s;
  z-index: 1;
}
.burst.is-on { opacity: 1; }
.burst__beam {
  position: absolute;
  left: 50%; top: 50%;
  width: 4px; height: 100vh;
  background: linear-gradient(to bottom, transparent, var(--burst-color, var(--accent)), transparent);
  transform-origin: center top;
  opacity: 0.55;
  animation: beam-spin 6s linear infinite;
}
@keyframes beam-spin { to { transform: rotate(360deg); } }
.burst__beam:nth-child(2) { animation-duration: 7s; animation-direction: reverse; opacity: 0.35; }
.burst__beam:nth-child(3) { animation-duration: 9s; opacity: 0.25; }

/* ───────── controls ───────── */
.controls {
  position: relative;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}
.btn {
  font-family: 'Bungee', 'Archivo Black', system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: 0.15em;
  padding: 14px 28px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn--primary {
  background: var(--secondary);
  color: white;
  box-shadow: 0 4px 0 #991f1f, 0 0 30px rgba(239,68,68,0.5);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #991f1f, 0 0 40px rgba(239,68,68,0.7);
}
.btn--primary:active { transform: translateY(2px); box-shadow: 0 0 0 #991f1f, 0 0 20px rgba(239,68,68,0.5); }
.btn--ghost {
  background: rgba(255,255,255,0.05);
  color: white;
  border-color: rgba(255,255,255,0.2);
}
.btn--ghost:hover { background: rgba(255,255,255,0.1); }

.stage__hud {
  position: absolute;
  top: 16px; left: 24px;
  z-index: 5;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.stage__phase {
  color: var(--primary);
  font-family: 'Bungee', system-ui, sans-serif;
  font-size: 13px;
}

/* roster grid */
.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
  margin-top: 36px;
}
.roster__group { margin-bottom: 40px; }
.roster__group-h {
  font-family: 'Bungee', system-ui, sans-serif;
  font-size: 20px;
  letter-spacing: 0.15em;
  margin: 0 0 8px;
}
.roster__group-meta {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.15em;
  margin-bottom: 18px;
}

/* sound toggle */
.sfx-toggle {
  position: absolute;
  top: 16px; right: 24px;
  z-index: 6;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  color: white;
  padding: 8px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  cursor: pointer;
}
.sfx-toggle:hover { background: rgba(255,255,255,0.14); }

/* Pull summary */
.summary {
  position: absolute;
  bottom: 32px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 12px 22px;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.1em;
  opacity: 0;
  transition: opacity 0.5s;
  display: flex; gap: 18px; align-items: center;
}
.summary.is-on { opacity: 1; }
.summary__hit {
  color: var(--accent);
  font-family: 'Bungee', system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: 0.2em;
}

/* ───────── mobile stack layout (≤640px) ───────── */
@keyframes stack-pulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(79,70,229,0.7)) drop-shadow(0 0 20px rgba(79,70,229,0.35)); }
  50%       { filter: drop-shadow(0 0 20px rgba(79,70,229,1.0)) drop-shadow(0 0 36px rgba(79,70,229,0.55)); }
}

@media (max-width: 640px) {
  /* shorter stage — more of the page is visible */
  .stage {
    height: 520px;
    perspective: 900px;
  }

  /* hide state HUD — progress pips replace it */
  .stage__hud { display: none; }

  /* shrink the pack */
  .pack { --p-w: 200px; --p-h: 300px; }

  /* shrink card slots */
  .fan__slot { width: 148px; height: 207px; }
  .flipper__side--back .cardback { --c-w: 148px; --c-h: 207px; }
  .flipper__side--front .card    { --c-w: 148px; --c-h: 207px; }

  /* ── mobile stack: 5 cards piled at center, card 4 on top ── */
  .fan--mobile-stack .fan__slot[data-i="4"] { transform: translate( 0px, 20px) rotate( 0.0deg) scale(1.00); z-index: 5; }
  .fan--mobile-stack .fan__slot[data-i="3"] { transform: translate( 1px, 28px) rotate(-2.5deg) scale(0.97); z-index: 4; }
  .fan--mobile-stack .fan__slot[data-i="2"] { transform: translate(-2px, 36px) rotate( 1.5deg) scale(0.94); z-index: 3; }
  .fan--mobile-stack .fan__slot[data-i="1"] { transform: translate( 2px, 44px) rotate(-1.5deg) scale(0.91); z-index: 2; }
  .fan--mobile-stack .fan__slot[data-i="0"] { transform: translate(-1px, 52px) rotate( 2.5deg) scale(0.88); z-index: 1; }

  /* pulse glow on the front unflipped card */
  .fan--mobile-stack .fan__slot.stack-active:not(.is-flipped) {
    animation: stack-pulse 2s ease-in-out infinite;
  }

  /* flipped cards fly up to the done pile */
  .fan--mobile-stack .fan__slot.is-flipped {
    transform: var(--done-pos, translate(0, -190px) scale(0.43)) !important;
    z-index: 10 !important;
    pointer-events: none;
  }

  /* ── progress pips ── */
  .mobile-pips {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 12;
  }
  .mobile-pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
  }
  .mobile-pip.is-done {
    background: var(--primary);
    transform: scale(1.25);
    border-color: var(--primary);
    box-shadow: 0 0 6px rgba(79,70,229,0.8);
  }

  /* summary banner sits above the pips */
  .summary { bottom: 52px; font-size: 11px; padding: 10px 16px; }

  /* sfx toggle — tighter on mobile */
  .sfx-toggle { top: 10px; right: 10px; font-size: 10px; padding: 6px 10px; }
}
