.pack-brief {
  display: grid;
  grid-template-columns: minmax(88px, 132px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 4vw, 26px);
}
.pack-brief .pack { pointer-events: none; }
.pack-brief .pack-label b { font-size: clamp(1rem, 3vw, 1.5rem); }
.brief-price { margin-bottom: 3px; font: 700 clamp(1.6rem, 5vw, 2.2rem)/1 var(--heading); color: var(--redink); }
.odds-list .odds-row {
  --odds-accent: #7cf7d1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 5px 0;
  border: 0;
  font-size: .875rem;
}
.odds-list .tier-rare { --odds-accent: #c7a9ff; }
.odds-list .tier-legendary { --odds-accent: var(--gold); }
.odds-row dd { margin: 0; color: var(--odds-accent); }
.odds-meter { grid-column: 1 / -1; height: 4px; border-radius: 999px; background: #ffffff18; }
.odds-meter span { display: block; height: 100%; border-radius: inherit; background: var(--odds-accent); }

body:has(.rip-theater[open]) { overflow: hidden; }
.rip-theater {
  --rip-accent: #d8ff5c;
  --rip-haze: #566826;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 0;
  background: #080a0e;
}
.rip-theater[data-tier="common"] { --rip-accent: #b9d0e1; --rip-haze: #30445b; }
.rip-theater[data-tier="uncommon"] { --rip-accent: #7cf7d1; --rip-haze: #21584d; }
.rip-theater[data-tier="rare"] { --rip-accent: #d2b6ff; --rip-haze: #533781; }
.rip-theater[data-tier="legendary"] { --rip-accent: #ffe08a; --rip-haze: #755622; }
.rip-theater::backdrop { background: #080a0e; }
.rip-frame {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse at 24% 46%, color-mix(in srgb, var(--rip-haze) 65%, transparent), transparent 57%),
    radial-gradient(ellipse at 72% 0%, #242c47a3, transparent 62%),
    #080a0e;
}
.rip-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .5;
  background: repeating-linear-gradient(108deg, transparent 0 42px, #dce8f810 42px 43px, transparent 43px 84px);
  mask-image: radial-gradient(ellipse at center, #000, transparent 72%);
  pointer-events: none;
}
.rip-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  width: min(100%, 1060px);
  min-height: 55px;
  padding-bottom: 12px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.rip-header form { justify-self: end; }
.rip-brand { display: flex; align-items: center; gap: 8px; font: 700 1.25rem/.95 var(--heading); text-transform: uppercase; }
.rip-brand img { flex: none; border-radius: 22%; }
.rip-serial { color: var(--mute); font: 600 .875rem/1.3 Inter, sans-serif; text-align: center; }
.rip-exit { white-space: nowrap; }
.rip-main { display: grid; align-content: center; flex: 1; padding: clamp(20px, 5vh, 55px) 0; }
#ripError { align-self: center; margin-top: 0; text-align: center; }
.rip-scene {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .95fr);
  grid-template-rows: 1fr 1fr;
  grid-template-areas: "art intro" "art controls";
  align-items: center;
  gap: 20px clamp(25px, 7vw, 95px);
  width: min(100%, 890px);
  margin: 0 auto;
}
.rip-intro { grid-area: intro; align-self: end; }
.rip-intro h2 { margin: 0 0 9px; color: var(--ink); font-size: clamp(2.5rem, 7vw, 5rem); line-height: .94; text-wrap: balance; }
.rip-intro p { color: #c3cad5; }
.rip-art { grid-area: art; display: grid; justify-items: center; position: relative; padding: 10px 0; isolation: isolate; }
.rip-art::before {
  content: "";
  position: absolute;
  width: min(112%, 450px);
  aspect-ratio: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid color-mix(in srgb, var(--rip-accent) 20%, transparent);
  outline: 1px solid color-mix(in srgb, var(--rip-accent) 10%, transparent);
  outline-offset: 20px;
  z-index: -1;
  border-radius: 50%;
  mask-image: linear-gradient(150deg, transparent 12%, #000 38%, #000 62%, transparent 89%);
  pointer-events: none;
}
.rip-controls { grid-area: controls; display: flex; flex-wrap: wrap; align-items: center; align-self: start; gap: 10px; position: relative; z-index: 1; }
.rip-controls .btn { min-height: 48px; padding: 10px 19px; }
.rip-controls .main { background: var(--rip-accent); border-color: var(--rip-accent); box-shadow: 0 0 24px color-mix(in srgb, var(--rip-accent) 25%, transparent); }
.rip-controls .main:enabled:hover { background: color-mix(in srgb, var(--rip-accent) 72%, white); }
.rip-secondary { background: #0b0f18b8; }
.rip-hint { flex-basis: 100%; color: var(--mute); font-size: .875rem; }
.rip-wrapper { position: relative; width: min(100%, 310px, 50svh); aspect-ratio: 64 / 94; container-type: inline-size; }
.rip-wrapper-body, .rip-wrapper-cap { position: absolute; inset: 0; will-change: transform; }
.rip-wrapper .pack {
  background:
    linear-gradient(110deg, #070b13 3%, #687f8466 12%, #b9f3bc45 15%, transparent 24%, #141f27a6 35%, transparent 47%, #e0ffd263 79%, #102b2399 84%, #101723 96%),
    repeating-linear-gradient(101deg, #d0ffd111 0 1px, transparent 1px 5px),
    linear-gradient(130deg, #293940, #202634 55%, #57634c);
  border-color: #d7ffa5a6;
  box-shadow: inset 0 7px #ffffff26, inset 0 -7px #ffffff1c, 0 22px 48px #040605bb;
}
.rip-wrapper .pack-brand { font-size: clamp(.95rem, 8cqw, 1.65rem); letter-spacing: .07em; }
.rip-wrapper .pack-window { margin-top: 8%; }
.rip-wrapper .pack-label b { font-size: clamp(1.7rem, 16cqw, 3.2rem); }
.rip-wrapper .pack-label small { font-size: clamp(.75rem, 6cqw, 1rem); letter-spacing: .15em; }
.rip-wrapper-cap { clip-path: polygon(0 0, 100% 0, 100% 15%, 82% 14%, 70% 16%, 46% 14%, 20% 16%, 0 15%); }
.rip-tear-track {
  --tear: 0;
  position: absolute;
  z-index: 2;
  inset: 5% 0 auto;
  height: 24%;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
}
.rip-tear-track span {
  display: block;
  position: absolute;
  inset: 41% 2% auto;
  height: 3px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #d8ff5cb0 0 10px, transparent 10px 15px);
  box-shadow: 0 0 14px #d8ff5c7d;
  pointer-events: none;
}
.rip-tear-track span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #ecff8a;
  box-shadow: 0 0 21px var(--redink);
  transform-origin: left;
  transform: scaleX(var(--tear));
}
.rip-tear-track[data-reverse="true"] span::after { transform-origin: right; }
[data-phase="tearing"] .rip-tear-track { opacity: 0; pointer-events: none; }
[data-phase="tearing"] .rip-wrapper-body {
  clip-path: polygon(0 15%, 20% 16%, 46% 14%, 70% 16%, 82% 14%, 100% 15%, 100% 100%, 0 100%);
  animation: rip-drop .56s ease-in forwards;
}
[data-phase="tearing"] .rip-wrapper-cap { animation: rip-peel .56s ease-out forwards; }
@keyframes rip-drop {
  20% { transform: translateY(2%) rotate(-2deg); }
  to { transform: translate(-12%, 31%) rotate(-10deg) scale(.92); opacity: 0; }
}
@keyframes rip-peel {
  to { transform: translate(27%, -20%) rotate(18deg) scale(.95); opacity: 0; }
}

.rip-progress { display: flex; gap: 8px; margin: 0 0 15px; padding: 0; list-style: none; }
.rip-progress li {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--mute);
  font: 700 .875rem/1 var(--heading);
}
.rip-progress li[data-revealed="true"] { color: #0a1015; background: #adc4cc; }
.rip-progress li[aria-current="step"] { color: #0a1015; background: var(--rip-accent); border-color: var(--rip-accent); box-shadow: 0 0 18px color-mix(in srgb, var(--rip-accent) 35%, transparent); }
.rip-progress .sr-only { position: absolute; }
.rip-card-stage { position: relative; width: min(100%, 300px, 47svh); aspect-ratio: 63 / 88; perspective: 1200px; }
.rip-card-stage::before, .rip-card-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border: 1px solid #aac5ad55;
  border-radius: 6% / 4.3%;
  background: #171e2b;
  transform: translate(5%, 2%) rotate(6deg) scale(.98);
}
.rip-card-stage::after { z-index: -2; transform: translate(9%, 4%) rotate(10deg) scale(.97); opacity: .6; }
.rip-card-stage[data-behind="0"]::before, .rip-card-stage[data-behind="0"]::after, .rip-card-stage[data-behind="1"]::after { display: none; }
.rip-card-button, .rip-card-turn { position: relative; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 6% / 4.3%; background: none; }
.rip-card-button { touch-action: manipulation; transition: transform .25s ease; }
.rip-card-button:hover { transform: translateY(-4px); }
.rip-card-button .rip-card-back { pointer-events: none; }
.rip-card-back {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 63 / 88;
  width: 100%;
  overflow: hidden;
  border: 2px solid #c9f788a6;
  border-radius: 6% / 4.3%;
  background: repeating-linear-gradient(122deg, transparent 0 12px, #a5d9c815 12px 13px), radial-gradient(ellipse at 42% 44%, #273e36, #121a28 71%);
  box-shadow: 0 12px 38px #050707a8, inset 0 0 25px #060b13;
}
.rip-card-back img { position: relative; z-index: 1; width: 37%; border-radius: 22%; box-shadow: 0 0 26px #c6f43262; }
.rip-card-back > span { position: absolute; bottom: 13%; color: #d8ff5c; font: 700 clamp(.875rem, 3vw, 1.375rem)/1 var(--heading); letter-spacing: .13em; text-transform: uppercase; }
.rip-orbit { position: absolute; width: 81%; height: 46%; border: 1px solid #abe3a383; border-radius: 50%; transform: rotate(-26deg); box-shadow: 0 0 13px #b2ed7038, inset 0 0 16px #a1c66638; }
.rip-orbit::before { content: ""; position: absolute; inset: 10% -7%; border: 1px solid #d5ffd05e; border-radius: 50%; transform: rotate(55deg); }
.rip-card-turn { transform-style: preserve-3d; }
.rip-card-turn.turning { animation: rip-turn .58s cubic-bezier(.24, .62, .26, 1) both; }
.rip-back-plane, .rip-front-plane { position: absolute; inset: 0; border-radius: inherit; backface-visibility: hidden; }
.rip-back-plane { transform: rotateY(180deg); }
.rip-front-plane { box-shadow: 0 0 46px color-mix(in srgb, var(--rip-accent) 38%, transparent), 0 20px 45px #020405b0; }
.rip-revealing .rip-intro h2, .rip-revealing .rip-intro p { animation: rip-title-in .4s .15s both; }
@keyframes rip-turn {
  from { transform: rotateY(-180deg) scale(.97); }
  54% { transform: rotateY(-36deg) scale(1.025); }
  to { transform: rotateY(0deg) scale(1); }
}
@keyframes rip-title-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.rip-summary { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: clamp(14px, 4vw, 26px); text-align: center; }
.rip-summary > .rip-intro, .rip-summary > .rip-controls { grid-area: auto; align-self: auto; }
.rip-summary .rip-controls { justify-content: center; position: sticky; bottom: 0; background: #0b0e16ee; border: 1px solid var(--line); border-radius: 14px; padding: 9px; }
.rip-pulls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 3vw, 23px); width: min(100%, 794px); margin: 0; padding: 0; list-style: none; }
.rip-pulls li { display: grid; align-content: start; justify-items: center; gap: 8px; }
.rip-pulls .btn { padding-inline: 6px; width: 100%; }
.pull-preview { width: 100%; padding: 0; border: 0; background: none; border-radius: 6% / 4.3%; }
.rip-intro .rip-spin-hint { margin-top: 8px; font-size: .875rem; }
.rip-pulls .card-face { box-shadow: 0 0 21px color-mix(in srgb, var(--foil) 28%, transparent), 0 16px 30px #03050895; }
.rip-copy { padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; background: #131820; color: var(--mute); font-size: .75rem; }
.rip-copy.new { color: #e3ff99; border-color: #d8ff5c52; }

@media (max-width: 640px) {
  .rip-frame { background: radial-gradient(ellipse at 50% 51%, color-mix(in srgb, var(--rip-haze) 65%, transparent), transparent 60%), radial-gradient(ellipse at 40% 0%, #242c478c, transparent 52%), #080a0e; }
  .rip-brand span { display: none; }
  .rip-header { grid-template-columns: 1fr auto 1fr; }
  .rip-serial { font-size: .8125rem; }
  .rip-exit { min-height: 40px; padding-inline: 9px; }
  .rip-scene { grid-template: "intro" auto "art" auto "controls" auto / minmax(0, 1fr); justify-items: center; row-gap: 18px; text-align: center; }
  .rip-art { width: 100%; padding-block: 7px; }
  .rip-art::before { width: min(94%, 305px); }
  .rip-wrapper, .rip-card-stage { width: min(63vw, 38svh, 252px); }
  .rip-card-stage { width: min(62vw, 38svh, 252px); }
  .rip-progress, .rip-controls { justify-content: center; }
  .rip-progress { gap: 5px; }
  .rip-progress li { width: 26px; height: 26px; }
  .rip-pulls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rip-summary { min-width: 0; }
  .rip-summary .card-tier { padding-inline: 4px; }
}
@media (max-width: 370px) {
  .pack-brief { grid-template-columns: 1fr; }
  .pack-brief .pack { display: none; }
  .rip-copy { font-size: .6875rem; padding-inline: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .rip-card-button { transition: none; }
  .rip-card-button:hover { transform: none; }
  .rip-card-turn.turning, .rip-revealing .rip-intro h2, .rip-revealing .rip-intro p { animation: none; }
}
