/* pack-simulator.css
   Dark only, matching card-maker.css and the gallery.
   The reveal overlay and card preview modal keep the class names pack-simulator.js
   toggles (.open, .opening, .cardSlot, .revealed) — those are behaviour, not decoration. */

@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-Black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #0e0f12;
  --surface: #14161b;
  --surface-2: #191c22;
  --surface-3: #21252d;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.20);
  --text: #f1f3f7;
  --muted: #949cab;
  --accent: #f5c518;
  --accent-ink: #1a1400;

  --radius: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "LT Museum", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -8%, rgba(80, 92, 118, 0.24), transparent 36rem),
    var(--bg);
}

body.packOverlayOpen { overflow: hidden; }

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 20px 56px;
}

/* ===== Top bar ===== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.14));
}

.brand-wordmark {
  display: block;
  width: 156px;
  height: auto;
}

.brand-sub {
  margin: 3px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}

.topActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Controls ===== */

button,
input,
select {
  font: inherit;
  color: var(--text);
}

input,
select {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

input:hover,
select:hover { border-color: rgba(255, 255, 255, 0.30); }

input:focus,
select:focus,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.22);
}

select {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

button {
  cursor: pointer;
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  font-weight: 700;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.08s ease;
}

button:hover:not([disabled]) {
  background: #2a2f39;
  border-color: rgba(255, 255, 255, 0.32);
}

button:active:not([disabled]) { transform: translateY(1px); }

button[disabled] {
  opacity: 0.4;
  cursor: default;
}

button.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}

button.primary:hover:not([disabled]) {
  background: #ffd83a;
  border-color: transparent;
}

a.topLink {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

a.topLink:hover {
  background: #2a2f39;
  border-color: rgba(255, 255, 255, 0.32);
}

/* ===== Panels ===== */

.panel {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.panel-title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #cbd2de;
}

.controlsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 12px;
  align-items: end;
}

.oddsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #c2c9d5;
}

.hint {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

#status {
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12.5px;
  color: #c6ccd8;
}

/* ===== Pack results ===== */

.packBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.packTitle {
  font-size: 16px;
  font-weight: 700;
}

.packGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
}

.emptyState {
  grid-column: 1 / -1;
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}


/* ===== Reveal overlay ===== */

.packOverlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 7, 10, 0.86);
  backdrop-filter: blur(3px);
}

.packOverlay.open { display: flex; }

.packStage {
  position: relative;
  width: min(1180px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.6);
}

.packOverlayTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.overlayEyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
}

#overlayPackTitle {
  margin-top: 5px;
  font-size: 21px;
  font-weight: 900;
}

.overlayActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.packOverlayGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 18px;
}

@media (max-width: 720px) {
  .shell { padding: 16px 14px 44px; }
  .topbar { justify-content: center; text-align: center; }
  .packGrid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
  .packOverlayGrid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
  .packStage { padding: 16px; }
}

/* ==========================================================
   REVEAL MACHINERY - preserved from the original page.
   The flip, the rarity glows and every keyframe below are what make
   opening a pack feel like opening a pack. pack-simulator.js toggles
   these classes, so the selectors have to stay exactly as they are.
   ========================================================== */

.cardSlot {
  position: relative;
  aspect-ratio: 63 / 88;
  border-radius: 14px;
  perspective: 1000px;
  cursor: pointer;
}

.cardInner {
  position: absolute;
  inset: 0;
  transition: transform var(--flip-ms, 420ms) ease;
  will-change: transform;
  transform-style: preserve-3d;
}

.cardSlot.revealed .cardInner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(128,128,128,.18);
  box-shadow: 0 8px 18px rgba(0,0,0,.16);
  background: transparent;
}

.back {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.15), transparent 28%),
    linear-gradient(135deg, #151515, #2b2040 45%, #111);
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: 0;
  box-sizing: border-box;
  letter-spacing: .02em;
}

.back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.back div { padding: 12px; }

/* Card fronts should not get a simulator-made rectangle around them.
   Let the rendered PNG keep its own card silhouette instead of clipping it
   into the simulator's rounded face shape. */
.front {
  transform: rotateY(180deg);
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: visible;
}

.front img {
  width: 104%;
  height: 104%;
  object-fit: cover;
  display: block;
  transform: translate(-2%, -2%);
  background: transparent;
  border-radius: 0;
  clip-path: inset(0 round 0);
}

.cardSlot .front.face,
.cardSlot.rarity-r .front.face,
.cardSlot.rarity-sr .front.face,
.cardSlot.rarity-se .front.face {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.fallback {
  height: 100%;
  padding: 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(145deg, #252525, #111);
  color: #fff;
}
.fallbackName { font-size: 16px; font-weight: 700; }
.fallbackMeta { font-size: 12px; opacity: .8; }

.rarityBadge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0,0,0,.72);
  color: #fff;
  pointer-events: none;
}


/* Rare-slot drama: each tier gets a louder aura. */
.cardSlot.rarity-r .back.face {
  border-color: rgba(255, 214, 102, .82);
  box-shadow:
    0 0 0 2px rgba(255, 214, 102, .46),
    0 0 20px rgba(255, 214, 102, .32),
    0 14px 28px rgba(0,0,0,.34);
}
.cardSlot.rarity-sr .back.face {
  border-color: rgba(180, 120, 255, .9);
  box-shadow:
    0 0 0 2px rgba(180, 120, 255, .58),
    0 0 26px rgba(180, 120, 255, .46),
    0 0 44px rgba(110, 190, 255, .22),
    0 16px 32px rgba(0,0,0,.38);
}
.cardSlot.rarity-se .back.face {
  border-color: rgba(255,255,255,.95);
  box-shadow:
    0 0 0 2px rgba(255,255,255,.7),
    0 0 22px rgba(255, 230, 130, .7),
    0 0 42px rgba(255, 100, 220, .45),
    0 0 66px rgba(70, 220, 255, .35),
    0 18px 38px rgba(0,0,0,.42);
}

.cardSlot.rarity-r::after,
.cardSlot.rarity-sr::after,
.cardSlot.rarity-se::after {
  content: "";
  position: absolute;
  inset: -7px;
  z-index: -1;
  border-radius: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.cardSlot.rarity-r.revealed::after {
  opacity: .72;
  background: radial-gradient(circle, rgba(255,214,102,.36), transparent 62%);
}
.cardSlot.rarity-sr.revealed::after {
  opacity: .9;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.34), transparent 18%),
    radial-gradient(circle, rgba(180,120,255,.43), transparent 64%);
  animation: srPulse 1.8s ease-in-out infinite;
}
.cardSlot.rarity-se.revealed::after {
  opacity: 1;
  background:
    conic-gradient(from 0deg, rgba(255,220,120,.45), rgba(255,90,220,.42), rgba(80,220,255,.42), rgba(255,220,120,.45));
  filter: blur(10px);
  animation: secretSpin 3.2s linear infinite;
}

.cardSlot.rarity-sr.revealed .cardInner { animation: srPop .42s ease both; }
.cardSlot.rarity-se.revealed .cardInner { animation: secretPop .58s cubic-bezier(.18,1.35,.28,1) both; }
/* Only SR/Secret get the dramatic pre-reveal charge. Commons, uncommons, and regular rares just flip cleanly. */
.cardSlot.rarity-sr.revealing .cardInner,
.cardSlot.rarity-se.revealing .cardInner {
  animation: bigRevealCharge .62s cubic-bezier(.2,.8,.2,1) both;
}

.cardSlot.superReveal::before,
.cardSlot.secretReveal::before {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: 5;
  pointer-events: none;
  border-radius: 24px;
  opacity: 0;
  mix-blend-mode: screen;
}
.cardSlot.superReveal::before {
  background:
    radial-gradient(circle, rgba(255,255,255,.85), transparent 14%),
    radial-gradient(circle, rgba(180,120,255,.7), transparent 54%);
  animation: rareFlash .7s ease-out both;
}
.cardSlot.secretReveal::before {
  background:
    radial-gradient(circle, rgba(255,255,255,.95), transparent 12%),
    conic-gradient(from 0deg, rgba(255,220,120,.65), rgba(255,80,220,.55), rgba(80,230,255,.62), rgba(255,220,120,.65));
  filter: blur(4px);
  animation: secretFlash .95s ease-out both;
}


.cardSlot.rarity-r .rarityBadge { background: rgba(120, 78, 0, .86); }
.cardSlot.rarity-sr .rarityBadge { background: rgba(86, 42, 145, .88); }
.cardSlot.rarity-se .rarityBadge { background: linear-gradient(135deg, rgba(255,190,80,.94), rgba(170,80,255,.94), rgba(70,210,255,.94)); }

@keyframes srPulse {
  0%, 100% { transform: scale(.98); filter: blur(4px); }
  50% { transform: scale(1.04); filter: blur(7px); }
}
@keyframes secretSpin {
  to { transform: rotate(360deg); }
}
@keyframes srPop {
  0% { transform: rotateY(180deg) scale(.98); }
  60% { transform: rotateY(180deg) scale(1.045); }
  100% { transform: rotateY(180deg) scale(1); }
}
@keyframes secretPop {
  0% { transform: rotateY(180deg) scale(.94); }
  45% { transform: rotateY(180deg) scale(1.09); }
  100% { transform: rotateY(180deg) scale(1); }
}
@keyframes revealShake {
  0% { transform: translateX(0) rotate(0deg) scale(1); filter: brightness(1); }
  18% { transform: translateX(-4px) rotate(-1.2deg) scale(1.012); filter: brightness(1.15); }
  36% { transform: translateX(4px) rotate(1.2deg) scale(1.018); }
  54% { transform: translateX(-3px) rotate(-.7deg) scale(1.012); }
  72% { transform: translateX(3px) rotate(.7deg) scale(1.008); }
  100% { transform: translateX(0) rotate(0deg) scale(1); filter: brightness(1.28); }
}
@keyframes bigRevealCharge {
  0% { transform: translateY(0) scale(1); filter: brightness(1); }
  18% { transform: translateX(-6px) rotate(-1.8deg) scale(1.025); filter: brightness(1.24); }
  36% { transform: translateX(6px) rotate(1.8deg) scale(1.045); }
  54% { transform: translateX(-4px) rotate(-1deg) scale(1.06); }
  72% { transform: translateX(4px) rotate(1deg) scale(1.075); filter: brightness(1.65); }
  100% { transform: translateY(-8px) scale(1.09); filter: brightness(2.2); }
}
@keyframes rareFlash {
  0% { opacity: 0; transform: scale(.65) rotate(0deg); }
  18% { opacity: 1; transform: scale(1.08) rotate(8deg); }
  100% { opacity: 0; transform: scale(1.55) rotate(18deg); }
}
@keyframes secretFlash {
  0% { opacity: 0; transform: scale(.55) rotate(0deg); }
  14% { opacity: 1; transform: scale(1.15) rotate(70deg); }
  100% { opacity: 0; transform: scale(1.85) rotate(220deg); }
}



.packStage::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 0deg, transparent, rgba(255,255,255,.075), transparent 22%);
  opacity: 0;
  pointer-events: none;
}

.packOverlay.opening .packStage::before { animation: stageSweep 1.15s ease-out both; }

.packOverlayGrid .cardSlot {
  max-width: 190px;
  width: 100%;
  justify-self: center;
  transform-origin: center;
}

.packOverlayGrid .cardSlot.dealt {
  opacity: 0;
  transform: translate3d(0, -44px, 220px) scale(.66) rotate(var(--deal-rot));
  animation: cardDeal .58s cubic-bezier(.17,.84,.32,1.18) forwards;
}

.packOverlay.opening .packOverlayGrid::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: 170px;
  height: 238px;
  transform: translate(-50%, -50%);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.18), transparent 36%),
    linear-gradient(145deg, #151515, #302648 48%, #0b0b0d);
  box-shadow: 0 0 0 3px rgba(220,220,230,.75), 0 24px 46px rgba(0,0,0,.55), 0 0 48px rgba(255,214,102,.22);
  animation: sealedPack 1.08s ease both;
  pointer-events: none;
  z-index: 5;
}

@keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes stageSweep { 0% { opacity: 0; transform: rotate(0deg); } 35% { opacity: 1; } 100% { opacity: 0; transform: rotate(95deg); } }
@keyframes sealedPack {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.84) rotate(-4deg); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  58% { opacity: 1; transform: translate(-50%, -50%) scale(1.07) rotate(2deg); filter: brightness(1.35); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.45) rotate(10deg); filter: brightness(2); }
}
@keyframes cardDeal {
  0% { opacity: 0; transform: translate3d(0, -44px, 220px) scale(.66) rotate(var(--deal-rot)); filter: brightness(1.8); }
  45% { opacity: 1; }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(0deg); filter: brightness(1); }
}

  
/* ==========================================================
   OLD CLOUD IMAGE BLACK-RECTANGLE FIX
   Some already-saved card PNGs include a baked black matte outside
   the card frame. This masks only the outside matte for display.
   It does not affect the card image file itself.
========================================================== */
.front {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;

  /* Small crop: removes the baked exported rectangle while preserving the card border. */
  overflow: hidden !important;
  clip-path: inset(1.15% 1.15% 1.15% 1.15% round 2px);
}

.front img {
  width: 102.4% !important;
  height: 102.4% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  display: block !important;
  transform: translate(-1.2%, -1.2%) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.cardSlot .front.face,
.cardSlot.rarity-r .front.face,
.cardSlot.rarity-sr .front.face,
.cardSlot.rarity-se .front.face {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}


/* Locked / unlocked state for the admin-only pack rules. */
.lock-note,
.admin-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.lock-note::before { content: "🔒"; }

.admin-note {
  border-color: rgba(245, 197, 24, 0.4);
  background: rgba(245, 197, 24, 0.10);
  color: #ecd489;
}

.admin-note::before { content: "🔓"; }

.lock-note[hidden],
.admin-note[hidden] { display: none; }

input:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  background: var(--surface);
}
