/* $ICY — Icy Tower pack system design language.
   Ported from the EMRLD (Emerald Arena) design system: deep dark base that
   never flips light, Cinzel display (engraved monument), Outfit body,
   IBM Plex Mono for the 11px letterspaced uppercase "system voice".
   One icy accent (#4DA6FF) + glow (#9FD4FF). GOLD IS RESERVED FOR
   LEGENDARY PULLS ONLY (EMRLD rule: gold = jackpot only). Red for errors
   only. Signature motif: the frost-line — a luminous 1px gradient divider. */

/* ============================== tokens ============================== */

:root {
  --bg: #04070d;
  --bg-raised: #071019;
  --panel: #0a1622;
  --panel-2: #0e1e2e;
  --line: #142a40;
  --line-soft: #0f2030;
  --ink: #eaf3fc;
  --ink-dim: #b8cde0;
  --muted: #7d93b8;
  --faint: #47607e;
  --icy: #4da6ff;
  --icy-deep: #1857a6;
  --glow: #9fd4ff;
  --icy-dim: rgba(77, 166, 255, 0.12);
  --icy-line: rgba(77, 166, 255, 0.38);
  --icy-glow: rgba(77, 166, 255, 0.22);

  /* rarity ramp — gold is LEGENDARY ONLY */
  --common: #8fa8c4;
  --rare: #4da6ff;
  --epic: #a06bff;
  --epic-dim: rgba(160, 107, 255, 0.14);
  --legendary: #ffd700;
  --legendary-dim: rgba(255, 215, 0, 0.12);
  --red: #cf5f5f;

  --display: "Cinzel", "Times New Roman", serif;
  --body: "Outfit", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --nav-h: 58px;
  --pad-x: clamp(16px, 3vw, 40px);
}

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
}

::selection {
  background: var(--icy);
  color: var(--bg);
}
:focus-visible {
  outline: 2px solid var(--icy);
  outline-offset: 2px;
}

/* mono label: the letterspaced uppercase system voice */
.mono-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* signature motif: luminous frost-line divider */
.frost-line {
  height: 1px;
  border: none;
  background: linear-gradient(90deg, transparent, var(--icy-line), transparent);
}

/* ============================== fixed nav ============================== */

/* z-index 65 keeps the nav above the shop overlay (60) so it stays reachable
   from every view, but below the pack-opening stage (70) - that sequence is
   cinematic and nothing should sit on top of it. */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 65;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--pad-x);
  background: rgba(4, 7, 13, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-right: 20px;
  text-decoration: none;
}
.site-nav .brand:hover .wordmark {
  color: var(--glow);
}
.site-nav .wordmark {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--ink);
  white-space: nowrap;
  transition: color 0.18s ease;
}
.ticker-chip {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--icy);
  border: 1px solid var(--icy-line);
  background: var(--icy-dim);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.chain-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.balance-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
  border: 1px solid var(--icy-line);
  border-radius: 999px;
  padding: 6px 14px;
  background: var(--icy-dim);
  white-space: nowrap;
}
.balance-chip .v {
  color: var(--glow);
  font-weight: 500;
}
.balance-chip.bumping .v {
  animation: bal-bump 0.5s ease;
}
@keyframes bal-bump {
  30% {
    color: var(--icy);
    text-shadow: 0 0 12px var(--icy-glow);
  }
}
.cta-nav {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 9px 18px;
  border-radius: 6px;
  background: var(--icy);
  border: 1px solid var(--icy);
  color: var(--bg);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.cta-nav:hover {
  background: transparent;
  color: var(--icy);
}
.wallet-btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--icy-line);
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.wallet-btn:hover:not(:disabled) {
  color: var(--icy);
  border-color: var(--icy);
}
.wallet-btn.connected {
  color: var(--glow);
}
.wallet-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* ---------------------------- nav links ---------------------------- */
/* Same "system voice" as the shop tabs (mono, uppercase, letterspaced) and
   the same active marker - a 2px icy underline - so the top nav and the
   section tabs underneath it read as one navigation system. */

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.nav-links a {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  padding: 0 13px;
  line-height: calc(var(--nav-h) - 2px);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.nav-links a:hover {
  color: var(--ink-dim);
}
.nav-links a[aria-current="page"] {
  color: var(--glow);
  border-bottom-color: var(--icy);
}
/* outbound links (token explorer, socials) sit apart from the in-app views -
   one divider before the group, not one per link */
.nav-links .nav-ext {
  margin-left: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.nav-links .nav-ext + .nav-ext {
  margin-left: 0;
  padding-left: 0;
  border-left: none;
}
.nav-links .nav-ext a::after {
  content: "↗";
  font-size: 9px;
  margin-left: 5px;
  vertical-align: 1px;
  opacity: 0.7;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* --------------------------- mobile drawer --------------------------- */

.nav-toggle {
  display: none;
  position: relative;
  width: 38px;
  height: 34px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.nav-toggle:hover {
  border-color: var(--icy-line);
}
.nav-toggle span[aria-hidden] {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 1.5px;
  background: var(--ink-dim);
  transition: transform 0.22s ease, opacity 0.15s ease;
}
.nav-toggle span:nth-child(1) { top: 11px; }
.nav-toggle span:nth-child(2) { top: 16px; }
.nav-toggle span:nth-child(3) { top: 21px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

/* ------------------------- skip link / a11y ------------------------- */

.skip-link {
  position: fixed;
  top: -60px;
  left: var(--pad-x);
  z-index: 95;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--bg);
  background: var(--icy);
  padding: 9px 16px;
  border-radius: 0 0 6px 6px;
  transition: top 0.18s ease;
}
.skip-link:focus {
  top: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* game area sits below the nav */
#wrap {
  padding-top: var(--nav-h);
}

/* ======================== skinbar rarity tints ======================== */

#skinbar button {
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
#skinbar button.rarity-rare {
  border-color: var(--icy-line);
  color: var(--glow);
}
#skinbar button.rarity-epic {
  border-color: rgba(160, 107, 255, 0.5);
  color: var(--epic);
}
#skinbar button.rarity-legendary {
  border-color: rgba(255, 215, 0, 0.45);
  color: var(--legendary);
}
#skinbar button.rarity-common {
  color: var(--common);
}

/* ============================ pack shop overlay ============================ */

.packshop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 7, 13, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.packshop[hidden] {
  display: none;
}
.packshop .shop-inner {
  max-width: 1120px;
  margin: 0 auto;
  /* the site nav stays on top of this overlay - clear it */
  padding: calc(var(--nav-h) + 34px) var(--pad-x) 96px;
}
.shop-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 8px;
}
.shop-head .head-copy {
  margin-right: auto;
}
.shop-head .mono-label {
  display: block;
  margin-bottom: 12px;
}
.shop-head .mono-label b {
  color: var(--icy);
  font-weight: 500;
}
.shop-head h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0;
}
.shop-head .lede {
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.55;
  max-width: 54ch;
  margin-top: 14px;
}
.shop-close {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  border-radius: 6px;
  padding: 10px 16px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.shop-close:hover {
  color: var(--icy);
  border-color: var(--icy-line);
}

/* tabs */
.shop-tabs {
  display: flex;
  gap: 4px;
  margin: 26px 0 30px;
  border-bottom: 1px solid var(--line);
}
.shop-tabs button {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 12px 18px;
  cursor: pointer;
  margin-bottom: -1px;
}
.shop-tabs button:hover {
  color: var(--ink-dim);
}
.shop-tabs button.active {
  color: var(--glow);
  border-bottom-color: var(--icy);
}
.shop-tabs .coll-count {
  color: var(--faint);
  margin-left: 8px;
}

/* honesty chip — launch/status note (EMRLD .sim-note) */
.sim-note {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.8;
  color: var(--muted);
  border: 1px dashed var(--icy-line);
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--icy-dim);
  margin: 0 0 26px;
}
.sim-note b {
  color: var(--icy);
  font-weight: 500;
}
.error-note {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--red);
  margin: -10px 0 20px;
  min-height: 0;
}

/* ============================ pack tier cards ============================ */

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.pack-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.25s ease;
}
.pack-card:hover {
  border-color: var(--icy-line);
  transform: translateY(-2px);
}
.pack-card::before {
  /* faint crystalline sheen across the top */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 120px;
  background: linear-gradient(180deg, var(--icy-dim), transparent);
  opacity: 0.6;
  pointer-events: none;
}
.pack-card.tier-avalanche::before {
  background: linear-gradient(180deg, var(--epic-dim), transparent);
}
.pack-card .card-index {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--icy);
}
.pack-card h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  margin: 10px 0 4px;
  letter-spacing: 0.02em;
}
.pack-card .pack-sub {
  font-size: 13.5px;
  color: var(--ink-dim);
  margin: 0 0 18px;
}
.pack-card .pack-art {
  height: 96px;
  margin: 0 0 18px;
  display: grid;
  place-items: center;
}
/* CSS crystal glyph — a faceted diamond built from clipped divs */
.crystal-glyph {
  position: relative;
  width: 74px;
  height: 86px;
  filter: drop-shadow(0 0 18px var(--icy-glow));
  transition: transform 0.35s ease;
}
.pack-card:hover .crystal-glyph {
  transform: translateY(-4px) scale(1.05);
}
.crystal-glyph i {
  position: absolute;
  inset: 0;
  display: block;
  clip-path: polygon(50% 0%, 100% 30%, 78% 100%, 22% 100%, 0% 30%);
  background: linear-gradient(160deg, var(--glow) 0%, var(--icy) 38%, var(--icy-deep) 100%);
  opacity: 0.92;
}
.crystal-glyph i + i {
  clip-path: polygon(50% 0%, 100% 30%, 50% 42%);
  background: linear-gradient(200deg, #fff, transparent 70%);
  opacity: 0.5;
}
.crystal-glyph i + i + i {
  clip-path: polygon(0% 30%, 50% 42%, 22% 100%);
  background: linear-gradient(20deg, #021024, transparent 80%);
  opacity: 0.55;
}
.tier-glacier .crystal-glyph {
  width: 84px;
  height: 96px;
}
.tier-avalanche .crystal-glyph {
  width: 94px;
  height: 106px;
  filter: drop-shadow(0 0 22px var(--epic-dim)) drop-shadow(0 0 10px var(--icy-glow));
}
.tier-avalanche .crystal-glyph i {
  background: linear-gradient(160deg, #d9c2ff 0%, var(--epic) 40%, #3b1e78 100%);
}

/* ---------------------- rarity aura on the higher tiers ----------------------
   The crystal IS the pack, so the aura radiates from it rather than ringing the
   card. Frost stays bare so the escalation reads at a glance: plain → icy →
   epic. Gold is deliberately absent — that stays LEGENDARY-only. */

.pack-card .pack-art {
  position: relative;
}
.pack-card .pack-art::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--aura-size, 200px);
  height: var(--aura-size, 200px);
  translate: -50% -50%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(
    circle closest-side,
    var(--aura-core) 0%,
    var(--aura) 34%,
    transparent 74%
  );
  /* This resting opacity is also the reduced-motion state: the keyframes only
     modulate around it, so killing the animation still leaves a real aura
     rather than an invisible one. */
  opacity: 0.62;
  animation: aura-breathe 4.6s ease-in-out infinite;
}
/* the entry pack gets no aura — that is the point of the ladder */
.pack-card.tier-frost .pack-art::before {
  display: none;
}
.pack-card.tier-glacier .pack-art::before {
  --aura-core: rgba(159, 212, 255, 0.5);
  --aura: rgba(77, 166, 255, 0.4);
  --aura-size: 210px;
}
.pack-card.tier-avalanche .pack-art::before {
  --aura-core: rgba(199, 168, 255, 0.58);
  --aura: rgba(160, 107, 255, 0.46);
  --aura-size: 240px;
}
@keyframes aura-breathe {
  0%,
  100% {
    opacity: 0.46;
    scale: 0.88;
  }
  50% {
    opacity: 0.92;
    scale: 1.1;
  }
}

/* the rarer tiers also sit a little off the page */
.pack-card.tier-glacier {
  border-color: rgba(77, 166, 255, 0.26);
  box-shadow: 0 14px 46px -22px rgba(77, 166, 255, 0.65);
}
.pack-card.tier-avalanche {
  border-color: rgba(160, 107, 255, 0.3);
  box-shadow: 0 14px 50px -20px rgba(160, 107, 255, 0.7);
}
.pack-card.tier-glacier:hover {
  border-color: var(--icy);
  box-shadow: 0 16px 58px -18px rgba(77, 166, 255, 0.85);
}
.pack-card.tier-avalanche:hover {
  border-color: var(--epic);
  box-shadow: 0 16px 62px -16px rgba(160, 107, 255, 0.9);
}

/* odds table — transparent drop rates, mono voice */
.odds {
  border-top: 1px solid var(--line-soft);
  margin-bottom: 18px;
}
.odds .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.odds .k {
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 10.5px;
}
.odds .v {
  color: var(--ink-dim);
}
.odds .r-common {
  color: var(--common);
}
.odds .r-rare {
  color: var(--rare);
}
.odds .r-epic {
  color: var(--epic);
}
.odds .r-legendary {
  color: var(--legendary);
}
.pack-guarantee {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--glow);
  margin: 0 0 18px;
}

/* burn CTA — the token utility moment */
.burn-btn {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 20px;
  border-radius: 6px;
  border: 1px solid var(--icy);
  background: var(--icy);
  color: var(--bg);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  width: 100%;
}
.burn-btn:hover:not(:disabled) {
  background: transparent;
  color: var(--icy);
}
.burn-btn:disabled {
  background: transparent;
  border-color: var(--line);
  color: var(--faint);
  cursor: not-allowed;
}
.burn-btn .burn-sub {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.18em;
  margin-top: 5px;
  font-weight: 400;
  opacity: 0.75;
}
.faucet-row {
  margin-top: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.faucet-row .hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

/* ============================ collection grid ============================ */

.coll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.coll-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 14px 12px;
  text-align: center;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.coll-card.owned {
  cursor: pointer;
}
.coll-card.owned:hover {
  transform: translateY(-2px);
}
.coll-card.owned.r-common {
  border-color: rgba(143, 168, 196, 0.4);
}
.coll-card.owned.r-rare {
  border-color: var(--icy-line);
}
.coll-card.owned.r-epic {
  border-color: rgba(160, 107, 255, 0.5);
}
.coll-card.owned.r-legendary {
  border-color: rgba(255, 215, 0, 0.5);
  background: linear-gradient(var(--legendary-dim), transparent 60%), var(--panel);
}
.coll-card .preview {
  height: 72px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}
.coll-card .preview canvas {
  image-rendering: pixelated;
  height: 66px;
  width: auto;
}
.coll-card.locked .preview {
  filter: grayscale(1) brightness(0.35);
}
.coll-card .name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.2;
}
.coll-card.locked .name {
  color: var(--faint);
}
.coll-card .rarity-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 6px;
  color: var(--muted);
}
.coll-card .rarity-tag.r-common {
  color: var(--common);
}
.coll-card .rarity-tag.r-rare {
  color: var(--rare);
}
.coll-card .rarity-tag.r-epic {
  color: var(--epic);
}
.coll-card .rarity-tag.r-legendary {
  color: var(--legendary);
}
.coll-card .equipped-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--icy);
  box-shadow: 0 0 8px var(--icy-glow), 0 0 3px var(--icy);
}
.coll-card .lock-glyph {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}
.coll-sec-label {
  margin: 30px 0 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.coll-sec-label .frost-line {
  flex: 1;
}

/* ========================= 3D opening stage ========================= */

.pack-stage {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: radial-gradient(ellipse 90% 70% at 50% 42%, #081420 0%, var(--bg) 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pack-stage[hidden] {
  display: none;
}
.pack-stage canvas.gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.stage-label {
  position: absolute;
  top: 34px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}
.stage-label b {
  color: var(--icy);
  font-weight: 500;
}
.stage-skip {
  position: absolute;
  bottom: 30px;
  right: 30px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--faint);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}
.stage-skip:hover {
  color: var(--ink-dim);
  border-color: var(--icy-line);
}

/* white->rarity flash at the shatter moment */
.stage-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

/* CSS-3D fallback pack (if the three.js CDN is unreachable) */
.fallback-pack {
  position: relative;
  width: 150px;
  height: 175px;
  transform-style: preserve-3d;
  animation: fb-idle 3.4s ease-in-out infinite;
}
.fallback-pack .crystal-glyph {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 34px var(--icy-glow));
}
.fallback-pack.charging {
  animation: fb-shake 0.09s linear infinite;
}
.fallback-pack.burst {
  animation: fb-burst 0.55s ease-out forwards;
}
@keyframes fb-idle {
  0%, 100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-14px) rotate(2deg);
  }
}
@keyframes fb-shake {
  0% {
    transform: translate(-3px, 2px) rotate(-2deg);
  }
  50% {
    transform: translate(3px, -2px) rotate(2deg);
  }
  100% {
    transform: translate(-2px, -1px) rotate(0deg);
  }
}
@keyframes fb-burst {
  60% {
    transform: scale(1.35);
    opacity: 1;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

/* ============================ card reveal row ============================ */

.reveal-layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.reveal-layer.on {
  opacity: 1;
  pointer-events: auto;
}
.reveal-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}
/* entry animation lives on the wrapper: animating opacity on the 3D card
   itself makes Chrome flatten preserve-3d and the front shows mirrored */
.reveal-wrap {
  perspective: 1000px;
  opacity: 0;
  translate: 0 26px;
  animation: card-in 0.45s ease forwards;
}
@keyframes card-in {
  to {
    opacity: 1;
    translate: 0 0;
  }
}
.reveal-card {
  width: 148px;
  height: 208px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.2, 0.7, 0.25, 1.05);
  transform: rotateY(180deg);
  cursor: pointer;
}
.reveal-card.flipped {
  transform: rotateY(0deg);
  cursor: default;
}
.reveal-card .face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
/* card back — frost sigil */
.reveal-card .back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, var(--panel-2), var(--panel) 60%);
  border: 1px solid var(--icy-line);
  display: grid;
  place-items: center;
}
.reveal-card .back .sigil {
  width: 54px;
  height: 62px;
  clip-path: polygon(50% 0%, 100% 30%, 78% 100%, 22% 100%, 0% 30%);
  background: linear-gradient(160deg, var(--icy-line), var(--icy-dim));
  box-shadow: 0 0 24px var(--icy-glow);
}
.reveal-card .back::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  pointer-events: none;
}
/* card front */
.reveal-card .front {
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 12px 12px;
}
.reveal-card.r-common .front {
  border-color: rgba(143, 168, 196, 0.45);
}
.reveal-card.r-rare .front {
  border-color: var(--icy);
  box-shadow: 0 0 26px rgba(77, 166, 255, 0.25);
}
.reveal-card.r-epic .front {
  border-color: var(--epic);
  box-shadow: 0 0 30px rgba(160, 107, 255, 0.3);
  background: linear-gradient(var(--epic-dim), transparent 55%), var(--panel);
}
.reveal-card.r-legendary .front {
  border-color: var(--legendary);
  box-shadow: 0 0 38px rgba(255, 215, 0, 0.32);
  background: linear-gradient(var(--legendary-dim), transparent 55%), var(--panel);
}
/* shine sweep on epic+ */
.reveal-card.r-epic .front::after,
.reveal-card.r-legendary .front::after {
  content: "";
  position: absolute;
  inset: -40% -120%;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.16) 50%, transparent 58%);
  transform: translateX(-70%);
  animation: shine 2.6s ease-in-out 0.4s infinite;
  pointer-events: none;
}
@keyframes shine {
  0% {
    transform: translateX(-70%);
  }
  55%, 100% {
    transform: translateX(70%);
  }
}
.reveal-card .rar-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}
.reveal-card.r-common .rar-label {
  color: var(--common);
}
.reveal-card.r-rare .rar-label {
  color: var(--rare);
}
.reveal-card.r-epic .rar-label {
  color: var(--epic);
}
.reveal-card.r-legendary .rar-label {
  color: var(--legendary);
}
.reveal-card .preview {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
}
.reveal-card .preview canvas {
  image-rendering: pixelated;
  height: 92px;
  width: auto;
}
.reveal-card .skin-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  text-align: center;
  line-height: 1.15;
}
.reveal-card .dup-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 7px;
  color: var(--faint);
  text-align: center;
  line-height: 1.5;
}
.reveal-card .dup-tag.new {
  color: var(--glow);
}
.reveal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.reveal-actions button {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-dim);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.reveal-actions button:hover {
  color: var(--icy);
  border-color: var(--icy-line);
}
.reveal-actions button.primary {
  background: var(--icy);
  border-color: var(--icy);
  color: var(--bg);
  font-weight: 600;
}
.reveal-actions button.primary:hover {
  background: transparent;
  color: var(--icy);
}

/* ============================== toasts ============================== */

.toast-rack {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  background: rgba(10, 22, 34, 0.95);
  border: 1px solid var(--icy-line);
  border-radius: 8px;
  padding: 10px 18px;
  animation: toast-in 0.3s ease, toast-out 0.4s ease 3.2s forwards;
  white-space: nowrap;
}
.toast b {
  color: var(--glow);
  font-weight: 500;
}
.toast.gold b {
  color: var(--legendary);
}
.toast.err {
  border-color: var(--red);
  color: var(--red);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ========================== reduced motion ========================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal-wrap {
    opacity: 1;
    translate: 0 0;
  }
}

/* ============================== mobile ============================== */

/* Three steps down: drop the status chips first (they are context, not
   navigation), then fold the links into a drawer, then tighten the rest. */

@media (max-width: 1180px) {
  .site-nav .chain-badge {
    display: none;
  }
  .nav-links a {
    padding: 0 10px;
  }
}

@media (max-width: 980px) {
  .nav-toggle {
    display: block;
  }
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 4px var(--pad-x) 12px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.6);
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    line-height: 1;
    padding: 15px 4px 15px 12px;
    border-bottom: 1px solid var(--line-soft);
    border-left: 2px solid transparent;
  }
  .nav-links a[aria-current="page"] {
    border-bottom-color: var(--line-soft);
    border-left-color: var(--icy);
  }
  .nav-links li:last-child a {
    border-bottom: none;
  }
  .nav-links .nav-ext {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--line);
    margin-top: 6px;
    padding-top: 6px;
  }
}

@media (max-width: 700px) {
  .site-nav {
    gap: 8px;
  }
  .nav-right {
    gap: 8px;
  }
  .site-nav .chain-badge,
  .site-nav .ticker-chip {
    display: none;
  }
  .cta-nav {
    padding: 9px 13px;
  }
  .shop-head h1 {
    font-size: 32px;
  }
  .reveal-card {
    width: 118px;
    height: 170px;
  }
  .reveal-card .preview canvas {
    height: 68px;
  }
  .stage-skip {
    bottom: 18px;
    right: 16px;
  }
}

/* ========================================================================
   REWARDS PANEL - play-to-earn weighting (rewards.js)
   Deliberately restrained: this screen is about numbers being legible and
   honest, not about spectacle. Gold stays LEGENDARY-only here too.
   ======================================================================== */

.rw-wrap { padding-bottom: 28px; }

.rw-formula {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 18px 0;
}
.rw-eq {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--glow);
  margin: 10px 0 8px;
  letter-spacing: 0.3px;
}
.rw-eq sup { font-size: 10px; color: var(--icy); }
.rw-note {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  margin: 8px 0 0;
}

.rw-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.rw-stat {
  border: 1px solid var(--line-soft);
  background: var(--bg-raised);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rw-stat .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--faint);
}
.rw-stat .v { font-size: 20px; color: var(--ink); font-family: var(--mono); }
.rw-stat .v.rw-total { color: var(--glow); }
.rw-stat .v.r-common { color: var(--common); }
.rw-stat .v.r-rare { color: var(--rare); }
.rw-stat .v.r-epic { color: var(--epic); }
.rw-stat .v.r-legendary { color: var(--legendary); }

.rw-mults { margin: 18px 0; }
.rw-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  margin: 0 6px 6px 0;
  color: var(--muted);
  opacity: 0.55;
}
.rw-chip.active { opacity: 1; border-width: 1px; }
.rw-chip.r-common.active { color: var(--common); border-color: var(--common); }
.rw-chip.r-rare.active { color: var(--rare); border-color: var(--rare); }
.rw-chip.r-epic.active { color: var(--epic); border-color: var(--epic); }
.rw-chip.r-legendary.active { color: var(--legendary); border-color: var(--legendary); }

.rw-runs { margin-top: 10px; }
.rw-run {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  align-items: baseline;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-raised);
  margin-bottom: 8px;
}
.rw-rank { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.rw-score { font-family: var(--mono); font-size: 16px; color: var(--ink); }
.rw-meta { font-size: 12px; color: var(--muted); }
.rw-tix { font-family: var(--mono); font-size: 13px; color: var(--icy); }
.rw-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 18px 0;
  line-height: 1.6;
}

@media (max-width: 560px) {
  /* score and tickets stay on the first row; the meta line wraps beneath
     them. Without explicit placement the auto-flow pushes .rw-tix onto a
     third row hard against the left edge. */
  .rw-run { grid-template-columns: 32px 1fr auto; }
  .rw-run .rw-tix { grid-column: 3; grid-row: 1; }
  .rw-run .rw-meta { grid-column: 2 / -1; grid-row: 2; }
}

/* ========================================================================
   GUIDE PANEL - "How it works" (nav.js)
   Reuses the .packshop shell so it inherits the overlay, the header and the
   close affordance; only the content grid below is new.
   ======================================================================== */

/* 420px minimum lands on a 2x2 for the four steps at full width - three
   columns would leave the last step orphaned on a row of its own */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 18px;
  margin-top: 4px;
}
@media (max-width: 560px) {
  .guide-grid {
    grid-template-columns: 1fr;
  }
}
.guide-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 20px 22px 24px;
}
.guide-card .step {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--faint);
}
.guide-card h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.01em;
  margin: 10px 0 0;
  color: var(--ink);
}
.guide-card p {
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.65;
  margin: 12px 0 0;
}
.guide-card ul {
  margin: 12px 0 0;
  padding-left: 17px;
  color: var(--ink-dim);
  font-size: 13.5px;
  line-height: 1.85;
}
.guide-card li::marker {
  color: var(--faint);
}
.guide-card b {
  color: var(--ink);
  font-weight: 500;
}
.guide-card .r-common { color: var(--common); }
.guide-card .r-rare { color: var(--rare); }
.guide-card .r-epic { color: var(--epic); }
.guide-card .r-legendary { color: var(--legendary); }

.kbd {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--glow);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
}
.guide-formula {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--glow);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 14px;
  overflow-x: auto;
}
.guide-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
/* the guide's calls to action are links, not buttons - they navigate */
a.cta-nav,
a.wallet-btn {
  display: inline-block;
  text-decoration: none;
  line-height: 1.2;
}
.guide-foot {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.9;
  color: var(--faint);
  margin-top: 26px;
}

/* ============================ tiny screens ============================ */

/* Below ~470px the nav has to keep four things on one line: the brand, the
   balance, the pack CTA and the menu. Everything sheds a word rather than a
   whole element - the chip's icy border already reads as $ICY, and "Packs"
   is the CTA people are looking for. */
@media (max-width: 470px) {
  .site-nav .brand {
    margin-right: 8px;
  }
  .site-nav .wordmark {
    font-size: 13px;
    letter-spacing: 0.1em;
  }
  .balance-chip {
    font-size: 11.5px;
    padding: 5px 10px;
    gap: 5px;
  }
  .balance-chip .unit {
    display: none;
  }
  .cta-nav {
    font-size: 10px;
    padding: 8px 11px;
    letter-spacing: 0.1em;
  }
  .cta-nav .cta-long {
    display: none;
  }
  /* three tabs plus their counters do not fit on one line this narrow -
     wrapping keeps them all reachable instead of clipping "Rewards" */
  .shop-tabs {
    flex-wrap: wrap;
  }
  .shop-tabs button {
    padding: 11px 12px;
  }
}
