:root {
  --bg: #0c0e0c;
  --bg-2: #141814;
  --bg-3: #1c221c;
  --ink: #e8efe4;
  --muted: #8a9788;
  --line: #2a332a;
  --amber: #d4a017;
  --amber-hot: #f0c14b;
  --green: #6b9f5a;
  --green-dim: #3d5c36;
  --danger: #c45c4a;
  --common: #8a9788;
  --uncommon: #5a9f7a;
  --rare: #4a8fd4;
  --legendary: #d4a017;
  --mythic: #e85d4c;
  --font-display: "Bebas Neue", Impact, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --radius: 4px;
  --max: 1100px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(107, 159, 90, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(212, 160, 23, 0.12), transparent 50%),
    linear-gradient(180deg, #0a0c0a 0%, var(--bg) 40%, #101410 100%);
  line-height: 1.5;
}

.bg-noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.site-header,
.site-main,
.site-footer { position: relative; z-index: 1; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--green-dim);
  color: var(--amber-hot);
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  border: 1px solid var(--green);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  color: var(--amber);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  font-size: 0.9rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover { color: var(--ink); }

.nav-credits {
  color: var(--amber);
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  background: var(--bg-2);
}

.site-main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
}

h1, h2 {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  font-weight: 400;
  margin: 0 0 0.4rem;
  line-height: 1.1;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }

.muted { color: var(--muted); }
.tiny { font-size: 0.8rem; }
.hidden { display: none !important; }

a { color: var(--green); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn:hover { border-color: var(--green); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--amber-hot), var(--amber));
  color: #1a1408;
  border-color: #a67c0f;
}

.btn-primary:hover { border-color: var(--amber-hot); }

.btn-ghost { background: transparent; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

.alert {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  border-color: var(--danger);
  background: rgba(196, 92, 74, 0.12);
  color: #f0b4aa;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: center;
  min-height: min(70vh, 560px);
  padding: 1rem 0 2.5rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--green);
  margin: 0 0 0.5rem;
}

.hero-brand {
  font-size: clamp(3.5rem, 10vw, 6rem);
  color: var(--amber);
  margin-bottom: 0.6rem;
  text-shadow: 0 0 40px rgba(212, 160, 23, 0.25);
  animation: brandIn 0.8s ease both;
}

.hero-lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 34ch;
  margin: 0 0 1.4rem;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.hero-visual {
  display: flex;
  justify-content: center;
  perspective: 900px;
}

.tcg-card-hero {
  width: min(220px, 70vw);
  transform: rotateY(-12deg) rotateZ(-4deg);
  animation: floatCard 4s ease-in-out infinite;
}

@keyframes brandIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes floatCard {
  0%, 100% { transform: rotateY(-12deg) rotateZ(-4deg) translateY(0); }
  50% { transform: rotateY(-8deg) rotateZ(-2deg) translateY(-10px); }
}

.section { margin: 2.5rem 0; }
.section-narrow { max-width: 640px; }
.section-head { margin-bottom: 1.25rem; }
.section-head p { margin: 0; color: var(--muted); }
.section-head.row,
.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.steps li { margin-bottom: 0.5rem; }

/* Feed */
.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(20, 24, 20, 0.7);
}

.feed-item {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  animation: feedIn 0.35s ease;
}

.feed-item:last-child { border-bottom: 0; }
.feed-item .serial { color: var(--amber); font-variant-numeric: tabular-nums; }
.feed-empty { padding: 1rem; color: var(--muted); }

@keyframes feedIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.pull-toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  max-width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.pull-toast {
  padding: 0.7rem 0.9rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-left-width: 3px;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.35s ease, toastOut 0.4s ease 4.2s forwards;
}

.pull-toast.rarity-common { border-left-color: var(--common); }
.pull-toast.rarity-uncommon { border-left-color: var(--uncommon); }
.pull-toast.rarity-rare { border-left-color: var(--rare); }
.pull-toast.rarity-legendary { border-left-color: var(--legendary); }
.pull-toast.rarity-mythic { border-left-color: var(--mythic); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* Login */
.login-panel {
  max-width: 420px;
  margin: 2rem auto;
  padding: 1.75rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.login-panel label {
  display: block;
  margin: 0.9rem 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.login-panel input[type="password"],
.login-panel input[type="text"],
.open-controls select {
  width: 100%;
  padding: 0.75rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  border-radius: var(--radius);
}

.login-panel .check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Packs */
.credit-box {
  text-align: right;
  display: grid;
  gap: 0.5rem;
  justify-items: end;
}

.credit-val {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--amber);
  letter-spacing: 0.04em;
}

.credit-val span {
  font-size: 0.9rem;
  color: var(--muted);
  font-family: var(--font-body);
}

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.pack-shop {
  display: flex;
  flex-wrap: wrap;
  gap: 2.25rem 2.75rem;
  justify-content: center;
  align-items: flex-start;
  padding: 0.5rem 0 1.5rem;
}

.pack-shop-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: min(220px, 100%);
}

.pack-shop-face {
  display: block;
  color: inherit;
  text-decoration: none;
  perspective: 800px;
}

.pack-shop-deck {
  position: relative;
  transition: transform 0.28s ease;
}

.pack-shop-deck::before,
.pack-shop-deck::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--green-dim);
  background:
    linear-gradient(160deg, #1c261c, #101510 60%, #0a0e0a);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  z-index: -1;
  pointer-events: none;
}

.pack-shop-deck::before {
  transform: translate(5px, 5px) rotate(1.8deg);
}

.pack-shop-deck::after {
  transform: translate(10px, 10px) rotate(3.4deg);
  opacity: 0.85;
}

.pack-shop-face:hover .pack-shop-deck,
.pack-shop-face:focus-visible .pack-shop-deck {
  transform: translateY(-8px) rotate(-2deg);
}

.pack-shop .pack-body {
  background:
    radial-gradient(ellipse at 50% 18%, rgba(212, 160, 23, 0.16), transparent 48%),
    repeating-linear-gradient(
      -35deg,
      #162016 0 10px,
      #121a12 10px 20px
    ),
    linear-gradient(160deg, #243024, #121812 60%, #0c100c);
}

.pack-shop .pack-label {
  font-size: clamp(0.95rem, 2.6vw, 1.2rem);
  letter-spacing: 0.1em;
  text-align: center;
  line-height: 1.15;
  padding: 0 0.85rem;
  max-width: 100%;
  word-break: break-word;
}

.pack-shop-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  width: 100%;
}

.pack-shop-meta h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.pack-shop-meta > p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}

.pack-shop-meta .pack-set-size {
  font-size: 0.78rem;
}

.pack-odds {
  width: 100%;
  font-size: 0.8rem;
  color: var(--muted);
}

.pack-odds summary {
  cursor: pointer;
  list-style: none;
  color: var(--green);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.pack-odds summary::-webkit-details-marker {
  display: none;
}

.pack-odds .odds {
  margin-top: 0.45rem;
  text-align: left;
}

.pack-shop-meta .pack-cost {
  margin: 0.15rem 0 0.15rem;
}

.pack-shop-meta .btn {
  min-width: 7.5rem;
}

.pack-card {
  padding: 1.25rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pack-art {
  height: 100px;
  border: 1px solid var(--line);
  background:
    repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(107, 159, 90, 0.08) 8px, rgba(107, 159, 90, 0.08) 16px),
    linear-gradient(145deg, var(--bg-3), var(--bg));
}

.pack-street .pack-art {
  background:
    linear-gradient(145deg, #1a2218, #0e120e),
    repeating-linear-gradient(90deg, transparent, transparent 12px, rgba(138, 151, 136, 0.1) 12px, rgba(138, 151, 136, 0.1) 13px);
}

.pack-premium .pack-art,
.pack-legends .pack-art {
  background:
    radial-gradient(circle at 30% 30%, rgba(212, 160, 23, 0.35), transparent 55%),
    linear-gradient(145deg, #2a2210, #12100a);
  border-color: rgba(212, 160, 23, 0.4);
}

.odds {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--muted);
  display: grid;
  gap: 0.25rem;
}

.odds .dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.dot.rarity-common { background: var(--common); }
.dot.rarity-uncommon { background: var(--uncommon); }
.dot.rarity-rare { background: var(--rare); }
.dot.rarity-legendary { background: var(--legendary); }
.dot.rarity-mythic { background: var(--mythic); }

.pack-cost {
  margin: 0.25rem 0 0.5rem;
  font-weight: 600;
  color: var(--amber);
}

.pack-set-size {
  margin: 0;
  font-size: 0.82rem;
  color: var(--green);
}

/* Cards — TCG frame */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 1rem;
}

.card-slot {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-share {
  display: block;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  width: 100%;
}

.share-actions {
  display: flex;
  gap: 0.35rem;
  width: 100%;
}

.share-actions .card-share {
  flex: 1 1 0;
  min-width: 0;
}

.share-actions-compact {
  width: auto;
  justify-content: center;
}

.share-actions-compact .card-share {
  flex: 0 0 auto;
}

.card-share:hover {
  color: var(--amber);
  border-color: var(--amber);
}

.card-share:disabled,
.card-share.is-copying {
  opacity: 0.7;
  cursor: wait;
}

.card-share.is-copied {
  color: var(--green);
  border-color: var(--green);
}

.card-share.is-copy-failed {
  color: var(--mythic);
  border-color: var(--mythic);
}

.card-share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: auto;
  min-width: 4.5rem;
  padding: 0.28rem 0.55rem;
  letter-spacing: 0.06em;
}
.card-share-icon svg {
  flex: 0 0 auto;
  opacity: 0.85;
}

.tcg-card {
  --frame: #6a7466;
  --frame-hi: #9aa392;
  --frame-lo: #3a4238;
  --plate: #1a2018;
  --ink-on-plate: var(--ink);
  position: relative;
  width: 100%;
  aspect-ratio: 2.5 / 3.5;
  border-radius: 10px;
  padding: 0;
  background: linear-gradient(145deg, var(--frame-hi), var(--frame) 40%, var(--frame-lo));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 10px 22px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.tcg-card.rarity-uncommon {
  --frame: #3d7a58;
  --frame-hi: #6bb08a;
  --frame-lo: #234a34;
}

.tcg-card.rarity-rare {
  --frame: #3a6fa8;
  --frame-hi: #6aa0d4;
  --frame-lo: #1e3f66;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15) inset,
    0 0 18px rgba(74, 143, 212, 0.28),
    0 10px 22px rgba(0, 0, 0, 0.45);
}

.tcg-card.rarity-legendary {
  --frame: #b8860f;
  --frame-hi: #e0c060;
  --frame-lo: #6e4e08;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 0 22px rgba(212, 160, 23, 0.4),
    0 10px 22px rgba(0, 0, 0, 0.45);
}

.tcg-card.rarity-mythic {
  --frame: #c24a3c;
  --frame-hi: #e88a7c;
  --frame-lo: #6e2218;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 0 26px rgba(232, 93, 76, 0.45),
    0 10px 22px rgba(0, 0, 0, 0.45);
}

.tcg-frame {
  position: absolute;
  inset: 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px;
  border-radius: 6px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(107, 159, 90, 0.12), transparent 55%),
    linear-gradient(180deg, #161b14 0%, #0e120e 100%);
  border: 1px solid rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  overflow: hidden;
}

.tcg-nameplate {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  min-height: 1.55rem;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  background: linear-gradient(180deg, #2a3226, var(--plate));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-color: rgba(0, 0, 0, 0.5);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.tcg-nameplate .card-name {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  letter-spacing: 0.04em;
  line-height: 1.05;
  color: var(--ink-on-plate);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tcg-art-window {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  margin: 0 1px;
  border-radius: 3px;
  background:
    radial-gradient(circle at 50% 40%, #243024, #0a0c0a 70%);
  border: 1px solid rgba(0, 0, 0, 0.65);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 4px 10px rgba(0, 0, 0, 0.35) inset;
  overflow: hidden;
}

.tcg-art-window::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 28%, transparent 70%, rgba(0, 0, 0, 0.25));
}

.card-art {
  width: min(78%, 110px);
  height: auto;
  max-height: 82%;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.55));
  z-index: 1;
}

/* Portraits / NPCs — bleed to the art frame edges */
.tcg-art-window.art-fill {
  background: #0a0c0a;
}
.tcg-art-window.art-fill .card-art {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center top;
  filter: none;
  border-radius: 0;
}

.card-art-fallback {
  width: 48px;
  height: 48px;
  background: var(--bg-3);
  border: 1px dashed var(--line);
}

.tcg-typebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.12rem 0.4rem;
  border-radius: 2px;
  background: linear-gradient(180deg, #222a20, #151a14);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.tcg-typebar .card-cat {
  color: var(--muted);
  margin: 0;
  font-size: inherit;
  letter-spacing: inherit;
}

.tcg-rarity-label {
  color: var(--frame-hi);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.tcg-textbox {
  flex: 0 0 auto;
  min-height: 2.4rem;
  max-height: 3.6rem;
  padding: 0.3rem 0.4rem;
  border-radius: 2px;
  background: rgba(8, 10, 8, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.tcg-textbox-compact {
  min-height: 0.55rem;
  max-height: 0.55rem;
  padding: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  border: 0;
}

.tcg-textbox .card-desc {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.25;
  color: #b7c2b4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tcg-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.1rem 0.25rem 0.05rem;
  margin-top: auto;
  gap: 0.2rem;
}

.tcg-footer .card-serial {
  margin: 0;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  justify-self: start;
}

.tcg-footer .card-float {
  justify-self: center;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: #9aab96;
  opacity: 0.95;
}

.tcg-footer .card-float-empty {
  min-width: 1px;
}

.tcg-footer .tcg-gem {
  justify-self: end;
}

.tcg-gem {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--frame-hi), var(--frame-lo));
  box-shadow: 0 0 6px color-mix(in srgb, var(--frame-hi) 50%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.qty-badge {
  flex-shrink: 0;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.28rem;
  border-radius: 2px;
  background: rgba(107, 159, 90, 0.2);
  border: 1px solid var(--green);
  color: var(--green);
}

.tcg-packbar {
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
  padding: 0.15rem 0.25rem;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tcg-card-missing {
  filter: grayscale(1) brightness(0.55);
  opacity: 0.72;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35) !important;
}

.tcg-card-missing .tcg-nameplate .card-name {
  color: #8a9386;
}

.tcg-card-missing .card-art {
  opacity: 0.55;
}

.view-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  flex-wrap: wrap;
}

.view-tab {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius);
}

.view-tab:hover { color: var(--ink); border-color: var(--green); }
.view-tab.is-active {
  color: #1a1408;
  background: linear-gradient(180deg, var(--amber-hot), var(--amber));
  border-color: #a67c0f;
}

.dex-hint { margin: 0 0 1.25rem; }
.dex-pack { margin-bottom: 2rem; }
.dex-pack-title {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.finish-badge {
  flex-shrink: 0;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  padding: 0.12rem 0.28rem;
  border-radius: 2px;
  font-weight: 700;
  text-transform: uppercase;
}

.finish-badge-foil,
.finish-badge-shiny,
.finish-badge-mirror {
  background: rgba(212, 160, 23, 0.22);
  border: 1px solid var(--amber);
  color: var(--amber-hot);
}
.finish-badge-fade,
.finish-badge-holo,
.finish-badge-radiant {
  background: linear-gradient(90deg, #f66, #fc6, #6c6, #6cf, #c6f);
  border: 1px solid #fff;
  color: #111;
}
.finish-badge-ghost {
  background: rgba(160, 220, 255, 0.12);
  border: 1px solid rgba(180, 230, 255, 0.55);
  color: #c8ecff;
}
.finish-badge-ember {
  background: rgba(255, 100, 30, 0.2);
  border: 1px solid #ff6a20;
  color: #ffb080;
}

.card-new-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  padding: 0.18rem 0.42rem;
  border-radius: 2px;
  background: linear-gradient(180deg, #f0c14b, #d4a017);
  color: #1a1408;
  border: 1px solid #ffe08a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transform: rotate(-6deg);
}

.tcg-card.is-new-pull {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 0 0 1px rgba(240, 193, 75, 0.35),
    0 0 18px rgba(212, 160, 23, 0.28),
    0 10px 22px rgba(0, 0, 0, 0.45);
}

.finish-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
}

.tcg-card.finish-foil .finish-overlay,
.tcg-card.finish-mirror .finish-overlay {
  opacity: 1;
  background: linear-gradient(
    115deg,
    transparent 28%,
    rgba(255, 255, 255, 0.18) 44%,
    rgba(212, 160, 23, 0.4) 50%,
    rgba(255, 255, 255, 0.12) 56%,
    transparent 72%
  );
  background-size: 220% 100%;
  animation: foilShine 2.8s linear infinite;
  mix-blend-mode: soft-light;
}

.tcg-card.finish-shiny .finish-overlay {
  opacity: 1;
  background-image:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 70% 20%, #fff, transparent),
    radial-gradient(1px 1px at 40% 70%, #dff, transparent),
    radial-gradient(1.5px 1.5px at 80% 60%, #fff, transparent),
    radial-gradient(1px 1px at 10% 80%, #eef, transparent),
    linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, 0.35) 50%, transparent 60%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 200% 100%;
  animation: shinySparkle 1.8s linear infinite;
  mix-blend-mode: screen;
}
.tcg-card.finish-shiny {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 0 20px rgba(220, 235, 255, 0.35),
    0 10px 22px rgba(0, 0, 0, 0.45);
}

.tcg-card.finish-fade .finish-overlay {
  opacity: 0.55;
  background: linear-gradient(
    125deg,
    rgba(232, 93, 76, 0.55),
    rgba(212, 160, 23, 0.35),
    rgba(74, 143, 212, 0.55),
    rgba(156, 80, 200, 0.45)
  );
  background-size: 300% 300%;
  animation: fadeWash 4s ease-in-out infinite;
  mix-blend-mode: color;
}

.tcg-card.finish-holo .finish-overlay,
.tcg-card.finish-radiant .finish-overlay {
  opacity: 0.7;
  background: linear-gradient(
    110deg,
    rgba(255, 80, 80, 0.5),
    rgba(255, 200, 60, 0.5),
    rgba(80, 255, 120, 0.5),
    rgba(60, 180, 255, 0.5),
    rgba(200, 100, 255, 0.5),
    rgba(255, 80, 80, 0.5)
  );
  background-size: 300% 100%;
  animation: holoSweep 2.4s linear infinite;
  mix-blend-mode: soft-light;
}
.tcg-card.finish-holo,
.tcg-card.finish-radiant {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 0 24px rgba(180, 120, 255, 0.45),
    0 10px 22px rgba(0, 0, 0, 0.45);
}

.tcg-card.finish-ghost {
  animation: ghostPulse 2.8s ease-in-out infinite;
}
.tcg-card.finish-ghost .finish-overlay {
  opacity: 0.45;
  background:
    radial-gradient(circle at 50% 40%, rgba(180, 230, 255, 0.45), transparent 65%),
    linear-gradient(180deg, rgba(200, 240, 255, 0.2), transparent);
  mix-blend-mode: screen;
  animation: ghostVeil 3.2s ease-in-out infinite;
}
.tcg-card.finish-ghost .card-art {
  filter: drop-shadow(0 0 8px rgba(160, 220, 255, 0.7)) saturate(0.7) brightness(1.15);
}

.tcg-card.finish-ember {
  box-shadow:
    0 1px 0 rgba(255, 180, 80, 0.25) inset,
    0 0 28px rgba(255, 90, 20, 0.5),
    0 10px 22px rgba(0, 0, 0, 0.5);
}
.tcg-card.finish-ember .finish-overlay {
  opacity: 0.65;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(255, 80, 0, 0.65), transparent 55%),
    linear-gradient(0deg, rgba(255, 120, 20, 0.35), transparent 50%);
  animation: emberFlicker 1.1s ease-in-out infinite;
  mix-blend-mode: screen;
}
.tcg-card.finish-ember .tcg-gem {
  background: linear-gradient(135deg, #ffb060, #c03000);
  box-shadow: 0 0 10px rgba(255, 100, 20, 0.8);
}

.dex-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.version-pips {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
}
.version-pip {
  width: 1.15rem;
  height: 1.15rem;
  font-size: 0.55rem;
  line-height: 1.15rem;
  text-align: center;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.32);
  background: rgba(0, 0, 0, 0.28);
  font-weight: 700;
  letter-spacing: 0;
  padding: 0;
  font-family: inherit;
  appearance: none;
}
button.version-pip.is-owned {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
button.version-pip.is-owned:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.55);
}
.version-pip.is-owned {
  color: #f4efe6;
  border-color: rgba(212, 160, 23, 0.65);
  background: rgba(212, 160, 23, 0.22);
}
.version-pip.is-owned.is-active {
  box-shadow: 0 0 0 2px var(--amber);
  background: rgba(212, 160, 23, 0.4);
}
.version-pip-ghost.is-owned {
  border-color: rgba(160, 220, 255, 0.7);
  background: rgba(120, 190, 230, 0.25);
  color: #d8f2ff;
}
.version-pip-ember.is-owned {
  border-color: rgba(255, 120, 40, 0.75);
  background: rgba(255, 90, 20, 0.28);
  color: #ffd0b0;
}

@keyframes foilShine {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
@keyframes shinySparkle {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 100% 0; }
  to { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, -100% 0; }
}
@keyframes fadeWash {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes holoSweep {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}
@keyframes ghostPulse {
  0%, 100% { opacity: 0.88; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(1.08); }
}
@keyframes ghostVeil {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.6; }
}
@keyframes emberFlicker {
  0%, 100% { opacity: 0.45; transform: translateY(0); }
  40% { opacity: 0.75; transform: translateY(-1px); }
  70% { opacity: 0.55; transform: translateY(1px); }
}

.foil-badge { display: none; }

/* legacy aliases kept quiet */
.mini-card,
.preview-card .card-inner,
.reveal-card .card-face {
  display: none;
}

.sig-disclosure {
  margin: 0 0 1.25rem;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem 0.55rem;
}

.sig-disclosure > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--amber);
  padding: 0.45rem 0.15rem;
}

.sig-disclosure > summary::-webkit-details-marker {
  display: none;
}

.sig-disclosure > summary::before {
  content: "▸ ";
  color: var(--muted);
}

.sig-disclosure[open] > summary::before {
  content: "▾ ";
}

.sig-disclosure .sig-box {
  margin-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.sig-box {
  display: grid;
  gap: 0.75rem;
  max-width: 468px;
}

.sig-hint {
  font-size: 0.8rem;
  line-height: 1.35;
  margin: 0;
  max-width: 468px;
}

.sig-hint code {
  font-size: 0.75rem;
}

.sig-variant {
  display: grid;
  gap: 0.3rem;
}

.sig-variant-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.sig-preview {
  display: block;
  width: min(468px, 100%);
  height: auto;
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, #1a1f1a 25%, transparent 25%),
    linear-gradient(-45deg, #1a1f1a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1f1a 75%),
    linear-gradient(-45deg, transparent 75%, #1a1f1a 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #0c0e0c;
}

.sig-code {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  word-break: break-all;
  background: var(--bg-3);
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  cursor: text;
  user-select: all;
}

.lb-table tr.is-me td {
  background: rgba(212, 160, 23, 0.12);
}

.lb-pack-pick {
  margin: 0 0 1rem;
}

.lb-pack-pick select {
  margin-left: 0.5rem;
}

/* Open stage */
.open-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  min-height: 70vh;
}

.open-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  width: 100%;
  max-width: 480px;
}

.open-controls label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.open-controls select { min-width: 200px; }

.open-credits { margin-left: auto; color: var(--muted); }
.open-credits strong { color: var(--amber); font-size: 1.2rem; }

.stage-area {
  position: relative;
  width: min(280px, 80vw);
  height: 380px;
  display: grid;
  place-items: center;
}

.stage-area-hand {
  width: min(720px, 100%);
  height: auto;
  min-height: 320px;
  padding: 0.5rem 0 1rem;
}

.pack-count {
  position: absolute;
  bottom: 1.1rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  z-index: 1;
}

.card-hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(0.5rem, 2vw, 1.25rem);
  flex-wrap: wrap;
  width: 100%;
}

.sleeve-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  animation: sleeveDeal 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 0.12s);
}

.sleeve-share[hidden] {
  display: none !important;
}

.hand-hint {
  margin: 1rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.sleeve-card {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  width: min(180px, 30vw);
  aspect-ratio: 2.5 / 3.5;
  perspective: 1000px;
  cursor: pointer;
  --heat: 74, 143, 212;
  --heat-hot: 120, 180, 255;
  position: relative;
  z-index: 0;
}

.sleeve-card:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
}

/* Chase heat — rare+ face-down sleeves flicker; hover fans the flame */
.sleeve-card.sleeve-heat {
  z-index: 1;
}
.sleeve-card.heat-legendary {
  --heat: 212, 160, 23;
  --heat-hot: 255, 200, 80;
}
.sleeve-card.heat-mythic {
  --heat: 232, 93, 76;
  --heat-hot: 255, 160, 60;
}
.sleeve-card.sleeve-heat:not(.is-flipped)::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 12px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% 108%, rgba(var(--heat-hot), 0.55), transparent 70%),
    radial-gradient(ellipse 55% 35% at 20% 95%, rgba(var(--heat), 0.35), transparent 65%),
    radial-gradient(ellipse 55% 35% at 80% 95%, rgba(var(--heat-hot), 0.3), transparent 65%);
  filter: blur(6px);
  opacity: 0.45;
  animation: sleeveHeatIdle 1.8s ease-in-out infinite;
  transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}
.sleeve-card.sleeve-heat:not(.is-flipped):hover::after,
.sleeve-card.sleeve-heat:not(.is-flipped):focus-visible::after {
  opacity: 1;
  filter: blur(4px);
  transform: scale(1.04);
  animation: sleeveHeatRoar 0.55s ease-in-out infinite alternate;
}
.sleeve-card.sleeve-heat:not(.is-flipped) .sleeve-flame {
  display: block;
  position: absolute;
  inset: -2px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  box-shadow:
    inset 0 0 0 1px rgba(var(--heat-hot), 0.35),
    0 0 12px rgba(var(--heat), 0.35),
    0 0 28px rgba(var(--heat-hot), 0.2);
  background:
    linear-gradient(180deg, transparent 55%, rgba(var(--heat), 0.18) 100%);
  transition: opacity 0.18s ease;
}
.sleeve-card.sleeve-heat:not(.is-flipped):hover .sleeve-flame,
.sleeve-card.sleeve-heat:not(.is-flipped):focus-visible .sleeve-flame {
  opacity: 1;
  animation: sleeveFlameLick 0.45s ease-in-out infinite alternate;
}
.sleeve-card.sleeve-heat:not(.is-flipped):hover .sleeve-back,
.sleeve-card.sleeve-heat:not(.is-flipped):focus-visible .sleeve-back {
  border-color: rgba(var(--heat-hot), 0.75);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.45),
    0 0 22px rgba(var(--heat), 0.45),
    0 0 48px rgba(var(--heat-hot), 0.25);
}
.sleeve-card.sleeve-heat:not(.is-flipped):hover .sleeve-logo,
.sleeve-card.sleeve-heat:not(.is-flipped):focus-visible .sleeve-logo {
  color: rgb(var(--heat-hot));
  text-shadow: 0 0 12px rgba(var(--heat), 0.7);
}
.sleeve-flame {
  display: none;
}
@keyframes sleeveHeatIdle {
  0%, 100% { opacity: 0.35; transform: scale(1) translateY(0); }
  50% { opacity: 0.55; transform: scale(1.02) translateY(-2px); }
}
@keyframes sleeveHeatRoar {
  from { opacity: 0.85; transform: scale(1.03) translateY(0); }
  to { opacity: 1; transform: scale(1.08) translateY(-4px); }
}
@keyframes sleeveFlameLick {
  from { box-shadow: inset 0 0 0 1px rgba(var(--heat-hot), 0.35), 0 0 12px rgba(var(--heat), 0.4), 0 0 28px rgba(var(--heat-hot), 0.2); }
  to { box-shadow: inset 0 0 0 1px rgba(var(--heat-hot), 0.55), 0 0 20px rgba(var(--heat), 0.65), 0 0 42px rgba(var(--heat-hot), 0.4); }
}
@media (prefers-reduced-motion: reduce) {
  .sleeve-card.sleeve-heat:not(.is-flipped)::after,
  .sleeve-card.sleeve-heat:not(.is-flipped):hover::after,
  .sleeve-card.sleeve-heat:not(.is-flipped):focus-visible::after,
  .sleeve-card.sleeve-heat:not(.is-flipped):hover .sleeve-flame,
  .sleeve-card.sleeve-heat:not(.is-flipped):focus-visible .sleeve-flame {
    animation: none;
  }
}

.sleeve-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sleeve-card.is-flipped .sleeve-inner {
  transform: rotateY(180deg);
}

.sleeve-back,
.sleeve-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 6px;
  overflow: hidden;
}

.sleeve-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 2px solid var(--green-dim);
  background:
    radial-gradient(circle at 50% 30%, rgba(212, 160, 23, 0.18), transparent 55%),
    repeating-linear-gradient(
      -35deg,
      #162016,
      #162016 10px,
      #121812 10px,
      #121812 20px
    );
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.sleeve-logo {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.08em;
  color: var(--amber);
}

.sleeve-tap {
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  color: var(--muted);
}

.sleeve-front {
  /* sleeve face is itself a tcg-card */
  padding: 0;
  display: block;
  background: linear-gradient(145deg, var(--frame-hi, #9aa392), var(--frame, #6a7466) 40%, var(--frame-lo, #3a4238));
  border: 0;
  transform: rotateY(180deg);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  text-align: left;
  color: var(--ink);
}

.sleeve-front.tcg-card {
  --frame: #6a7466;
  --frame-hi: #9aa392;
  --frame-lo: #3a4238;
}

.sleeve-front.rarity-uncommon {
  --frame: #3d7a58;
  --frame-hi: #6bb08a;
  --frame-lo: #234a34;
}
.sleeve-front.rarity-rare {
  --frame: #3a6fa8;
  --frame-hi: #6aa0d4;
  --frame-lo: #1e3f66;
}
.sleeve-front.rarity-legendary {
  --frame: #b8860f;
  --frame-hi: #e0c060;
  --frame-lo: #6e4e08;
}
.sleeve-front.rarity-mythic {
  --frame: #c24a3c;
  --frame-hi: #e88a7c;
  --frame-lo: #6e2218;
}

.sleeve-front .tcg-frame {
  position: absolute;
}

.sleeve-front .tcg-textbox {
  min-height: 2.8rem;
  max-height: 3.8rem;
}

.sleeve-front .card-art {
  width: min(78%, 100px);
}
.sleeve-front .tcg-art-window.art-fill .card-art {
  width: 100%;
  height: 100%;
  max-height: none;
}

.sleeve-front.foil::before {
  /* use tcg foil sheen */
  display: none;
}

.sleeve-card.hit-burst {
  animation: sleeveHit 0.55s ease;
}

@keyframes sleeveDeal {
  from { opacity: 0; transform: translateY(24px) scale(0.9); }
  to { opacity: 1; transform: none; }
}

@keyframes sleeveHit {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.06); }
}

.pack-3d {
  width: 180px;
  height: 240px;
  transform-style: preserve-3d;
  transition: transform 0.3s ease, opacity 0.2s;
  opacity: 1;
}

.pack-3d[data-state="idle"] .pack-body {
  animation: none;
  opacity: 1;
  transform: none;
  filter: none;
}

.pack-body {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(160deg, #243024, #121812 60%, #0c100c);
  border: 2px solid var(--green-dim);
  display: grid;
  place-items: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.pack-body::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(107, 159, 90, 0.35);
}

.pack-label {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.12em;
  color: var(--amber);
  z-index: 1;
  text-align: center;
  line-height: 1.15;
  padding: 0 0.75rem;
  max-width: 100%;
  word-break: break-word;
}

.stage-area-pack .pack-label {
  font-size: clamp(1rem, 3.5vw, 1.45rem);
}

.pack-3d[data-state="shake"] .pack-body {
  animation: packShake 0.45s ease;
}

.pack-3d[data-state="tear"] .pack-body {
  animation: packTear 0.55s ease forwards;
}

.pack-3d[data-state="done"] {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

@keyframes packShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-8px) rotate(-3deg); }
  40% { transform: translateX(8px) rotate(3deg); }
  60% { transform: translateX(-6px) rotate(-2deg); }
  80% { transform: translateX(6px) rotate(2deg); }
}

@keyframes packTear {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.05) rotate(-2deg); filter: brightness(1.3); }
  100% { transform: scale(0.4) translateY(-40px); opacity: 0; filter: brightness(2); }
}

.reveal-card {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  perspective: 1000px;
}

.reveal-card .card-face {
  width: min(220px, 75vw);
  aspect-ratio: 2.5 / 3.5;
  min-height: 0;
  transform: rotateY(90deg) scale(0.8);
  opacity: 0;
}

.reveal-card.show .card-face {
  animation: cardFlip 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.reveal-card.drama-high .card-face {
  animation-duration: 1.15s;
}

.reveal-card.burst::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 160, 23, 0.7), transparent 70%);
  animation: burst 0.8s ease-out forwards;
  pointer-events: none;
}

@keyframes cardFlip {
  0% { transform: rotateY(90deg) scale(0.8); opacity: 0; }
  55% { transform: rotateY(-8deg) scale(1.05); opacity: 1; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}

@keyframes burst {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(28); opacity: 0; }
}

.open-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.open-status {
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .hero-visual { order: -1; }
  .tcg-card-hero {
    width: 160px;
    transform: none;
    animation: floatCard 4s ease-in-out infinite;
  }
  @keyframes floatCard {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
  }
}

/* —— Admin —— */
.admin-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0 0;
  margin: 0 0 0.5rem;
  border-bottom: 1px solid var(--line);
}
.admin-subnav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0 0.65rem;
  border-bottom: 2px solid transparent;
}
.admin-subnav a.is-active,
.admin-subnav a:hover {
  color: var(--ink);
  border-bottom-color: var(--amber);
}
.admin-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}
.admin-kpi {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}
.admin-kpi .lbl {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}
.admin-kpi strong {
  font-size: 1.25rem;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}
.admin-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.admin-chart-box {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 1rem;
}
.admin-chart-box h2 {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.admin-period {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.admin-period select,
.admin-filter select,
.admin-filter input,
.admin-form input,
.admin-form textarea,
.admin-form select,
.trade-create .trade-message input {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.4rem 0.55rem;
  font: inherit;
  width: 100%;
}
.admin-split {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 1.25rem;
  align-items: start;
}
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--line);
}
.admin-table th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
}
.admin-form {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.admin-form h2 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.admin-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: var(--muted); }
.admin-form label.check { flex-direction: row; align-items: center; gap: 0.45rem; color: var(--ink); }
.admin-form label.check input { width: auto; }
.admin-form-danger { margin-top: 0.75rem; border-color: rgba(196, 92, 74, 0.45); }
.admin-filter { display: flex; gap: 0.5rem; align-items: end; }
.alert-ok {
  background: rgba(107, 159, 90, 0.15);
  border: 1px solid var(--green);
  color: var(--ink);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.row.gap { display: flex; gap: 0.5rem; flex-wrap: wrap; }
@media (max-width: 900px) {
  .admin-charts,
  .admin-split { grid-template-columns: 1fr; }
}

/* —— Trade & factions —— */
.nav-badge {
  display: inline-block;
  min-width: 1.1rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--amber);
  color: #111;
  font-size: 0.65rem;
  font-weight: 700;
  vertical-align: top;
}
.trade-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.trade-detail {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.trade-pick-card {
  position: relative;
  cursor: pointer;
  display: block;
}
.trade-pick-card input {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 5;
  width: 1.1rem;
  height: 1.1rem;
}
.trade-pick-card:has(input:checked) .tcg-card {
  outline: 2px solid var(--amber);
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.25);
}
.trade-create h2 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.15rem;
}
.trade-create .trade-message {
  display: block;
  margin: 0 0 0.75rem;
  max-width: 28rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.trade-create .trade-message input {
  display: block;
  margin-top: 0.35rem;
}
@media (max-width: 800px) {
  .trade-sides { grid-template-columns: 1fr; }
}
