/* ═══════════════════════════════════════════════
   MUDWATER BINDER — style.css
   Dark swamp luxury. Card collector culture.
═══════════════════════════════════════════════ */

:root {
  --bg:        #0a0b08;
  --bg2:       #101309;
  --surface:   #151810;
  --surface2:  #1c2014;
  --border:    #2a3020;
  --gold:      #c9a84c;
  --gold2:     #e8c96b;
  --gold-dim:  #7a6228;
  --green:     #3d6b2e;
  --green2:    #5a9e46;
  --text:      #e8e4d8;
  --text2:     #9a9888;
  --text3:     #5e5c52;
  --radius:    8px;
  --radius-lg: 14px;
  --shadow:    0 4px 32px rgba(0,0,0,.7);
  --transition:.2s cubic-bezier(.4,0,.2,1);
  /* type colors */
  --col-cards: #c9a84c;
  --col-packs: #7dd3fc;
  --col-boxes: #c084fc;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── BG CANVAS ── */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .065;
}
/* MUDWATER #114 "The Tonic" neon ape skull, cut out of the card; fixed decorative layer */
#bgSkull {
  position: fixed; z-index: 0; pointer-events: none;
  left: 50%; top: 54%;
  width: min(82vw, 620px); aspect-ratio: 382 / 343;
  transform: translate(-50%, -50%) rotate(-4deg);
  background: url("/assets/skull-tonic.webp") center / contain no-repeat;
  opacity: .11;
  filter: saturate(.9);
}
@media (max-width: 600px) { #bgSkull { width: 92vw; top: 58%; opacity: .1; } }

/* ══ HEADER ══════════════════════════════════════ */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10,11,8,.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
  font-size: 28px;
  color: var(--gold);
  line-height: 1;
  animation: spin-slow 12s linear infinite;
  display: inline-block;
}
@keyframes spin-slow { to { transform: rotate(360deg); } }
.logo-text {
  font-family: 'IM Fell English', serif;
  font-size: 20px;
  color: var(--gold2);
  letter-spacing: .05em;
  line-height: 1;
}
.logo-sub {
  display: block;
  font-size: 9px;
  letter-spacing: .3em;
  color: var(--text2);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 100px;
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover, .nav-link.active {
  color: var(--gold2);
  background: rgba(201,168,76,.1);
}
.wallet-zone { margin-left: auto; }

/* ══ BUTTONS ══════════════════════════════════════ */
.btn-primary {
  background: var(--gold);
  color: #0a0b08;
  border: none;
  border-radius: 100px;
  padding: 10px 24px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: var(--gold2); transform: translateY(-1px); }
.btn-primary.small { padding: 7px 16px; font-size: 11px; }
.btn-primary.block-btn { display: block; width: 100%; text-align: center; margin-top: 20px; text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 100px;
  padding: 10px 24px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.btn-ghost:hover { border-color: var(--gold2); color: var(--gold2); }
.btn-ghost.small { padding: 7px 16px; font-size: 11px; }

.btn-connect {
  background: rgba(201,168,76,.12);
  color: var(--gold2);
  border: 1px solid var(--gold-dim);
  border-radius: 100px;
  padding: 8px 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-connect:hover { background: rgba(201,168,76,.2); border-color: var(--gold); }

.btn-disconnect {
  background: none; border: none;
  color: var(--text3); cursor: pointer;
  font-size: 14px; padding: 2px 4px;
  transition: color var(--transition);
}
.btn-disconnect:hover { color: #ef4444; }

.btn-share {
  background: rgba(93,163,74,.15);
  color: var(--green2);
  border: 1px solid rgba(93,163,74,.3);
  border-radius: 100px;
  padding: 7px 16px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-share:hover { background: rgba(93,163,74,.25); border-color: var(--green2); }
.btn-share.small { padding: 7px 16px; font-size: 11px; }

.wallet-info {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
}
.wallet-addr {
  font-size: 12px; font-weight: 600;
  color: var(--gold2);
  font-family: monospace; letter-spacing: .02em;
}

/* ══ HERO ══════════════════════════════════════════ */
.hero {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center;
  padding: 100px 24px 80px;
}
.hero-eyebrow {
  font-size: 11px; font-weight: 700;
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 24px; opacity: .8;
}
.hero-title {
  font-family: 'IM Fell English', serif;
  font-size: clamp(52px, 10vw, 96px);
  line-height: 1.0; color: var(--text);
  margin-bottom: 24px;
  text-shadow: 0 0 60px rgba(201,168,76,.2);
}
.hero-sub {
  max-width: 540px; color: var(--text2);
  font-size: 16px; line-height: 1.7; margin-bottom: 40px;
}
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-bottom: 64px; }
.hero-stats {
  display: flex; gap: 48px; flex-wrap: wrap; justify-content: center;
  border-top: 1px solid var(--border); padding-top: 40px;
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-num { font-family: 'IM Fell English', serif; font-size: 36px; color: var(--gold2); }
.stat-label { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--text3); }

/* ══ PAGE ══════════════════════════════════════════ */
.page {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto;
  padding: 100px 24px 80px;
  min-height: 100vh;
}

/* ══ BINDER HEADER ═════════════════════════════════ */
.binder-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 24px;
  flex-wrap: wrap; margin-bottom: 28px;
  padding-bottom: 28px; border-bottom: 1px solid var(--border);
}
.binder-identity { display: flex; align-items: flex-start; gap: 20px; }
.binder-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dim), var(--green));
  border: 2px solid var(--gold-dim); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; overflow: hidden;
}
.binder-meta h2 {
  font-family: 'IM Fell English', serif;
  font-size: 28px; color: var(--text); margin-bottom: 4px;
}
.binder-wallet-short { font-family: monospace; font-size: 12px; color: var(--text3); margin-bottom: 4px; }
.binder-twitter { color: var(--gold); font-size: 13px; }
.binder-bio { color: var(--text2); font-size: 14px; margin-top: 8px; max-width: 400px; }
.binder-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ══ TOTALS ROW ════════════════════════════════════ */
.binder-totals {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px;
}
.total-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 20px;
  flex: 1; min-width: 130px;
}
.total-pill.accent { border-color: var(--gold-dim); background: rgba(201,168,76,.06); }
.total-icon { font-size: 20px; }
.total-num {
  font-family: 'IM Fell English', serif;
  font-size: 24px; color: var(--gold2);
}
.total-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text3); }

/* ══ BINDER TABS ═══════════════════════════════════ */
.binder-tabs {
  display: flex; gap: 4px; margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.binder-tab {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none;
  color: var(--text3); cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 10px 20px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.binder-tab:hover { color: var(--text2); }
.binder-tab.active { color: var(--gold2); border-bottom-color: var(--gold); }
.binder-tab[data-tab="packs"].active { color: #7dd3fc; border-bottom-color: #7dd3fc; }
.binder-tab[data-tab="boxes"].active { color: #c084fc; border-bottom-color: #c084fc; }
.tab-icon { font-size: 16px; }
.tab-count {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 100px; padding: 1px 7px;
  font-size: 11px; color: var(--text3);
}
.binder-tab.active .tab-count { border-color: currentColor; color: currentColor; }

/* ══ FILTER BAR ════════════════════════════════════ */
.filter-bar {
  display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap; margin-bottom: 28px;
}
.filter-bar input[type="text"],
.filter-bar select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px; padding: 9px 14px; outline: none;
  transition: border-color var(--transition);
}
.filter-bar input[type="text"] { flex: 1; min-width: 200px; }
.filter-bar input[type="text"]:focus,
.filter-bar select:focus { border-color: var(--gold-dim); }
.filter-bar select { cursor: pointer; }
.view-toggle { display: flex; gap: 4px; }
.vtog {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text3);
  font-size: 16px; padding: 8px 12px;
  cursor: pointer; transition: all var(--transition);
}
.vtog.active { border-color: var(--gold-dim); color: var(--gold2); background: rgba(201,168,76,.08); }

/* ══ CARD GRID ═════════════════════════════════════ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}
.card-grid.list-view { grid-template-columns: 1fr; gap: 8px; }

/* ── individual card item ── */
.card-item {
  position: relative; cursor: pointer;
  border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card-item:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 48px rgba(0,0,0,.8), 0 0 24px rgba(201,168,76,.12);
  border-color: var(--gold-dim);
  z-index: 2;
}
/* type borders */
.card-item.type-cards { border-color: rgba(201,168,76,.2); }
.card-item.type-cards:hover { border-color: rgba(201,168,76,.5); box-shadow: 0 16px 48px rgba(0,0,0,.8), 0 0 24px rgba(201,168,76,.2); }
.card-item.type-packs { border-color: rgba(125,211,252,.2); }
.card-item.type-packs:hover { border-color: rgba(125,211,252,.5); box-shadow: 0 16px 48px rgba(0,0,0,.8), 0 0 24px rgba(125,211,252,.2); }
.card-item.type-boxes { border-color: rgba(192,132,252,.2); }
.card-item.type-boxes:hover { border-color: rgba(192,132,252,.5); box-shadow: 0 16px 48px rgba(0,0,0,.8), 0 0 24px rgba(192,132,252,.2); }
/* rarity extras */
.card-item.foil { border-color: rgba(192,132,252,.35); }
.card-item.serialized { border-color: rgba(245,158,11,.4); }
.card-item.cracked-ice { border-color: rgba(125,211,252,.45); }

.card-img-wrap {
  position: relative; aspect-ratio: 2.5/3.5;
  overflow: hidden; background: var(--surface2);
}
/* packs/boxes: landscape ratio */
.card-item.type-packs .card-img-wrap,
.card-item.type-boxes .card-img-wrap { aspect-ratio: 3/2; }

.card-img-wrap img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .4s ease;
}
.card-item:hover .card-img-wrap img { transform: scale(1.05); }
.card-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 36px; color: var(--gold-dim);
}

/* foil shimmer */
.card-item.foil .card-img-wrap::after,
.card-item.cracked-ice .card-img-wrap::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg,
    rgba(192,132,252,.2) 0%, rgba(96,165,250,.2) 25%,
    rgba(52,211,153,.2) 50%, rgba(251,191,36,.2) 75%,
    rgba(244,114,182,.2) 100%
  );
  mix-blend-mode: color; pointer-events: none;
  animation: foil-shimmer 3s ease-in-out infinite alternate;
}
@keyframes foil-shimmer {
  0%  { opacity: .4; }
  100% { opacity: 1; }
}

/* quantity badge (for packs/boxes: may have multiple) */
.card-qty-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.7); border: 1px solid rgba(255,255,255,.12);
  color: var(--text); font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 100px;
  backdrop-filter: blur(4px);
}

.card-rarity-badge {
  position: absolute; top: 8px; right: 8px;
  font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 100px;
  backdrop-filter: blur(8px);
}
.badge-foil       { background: rgba(192,132,252,.3); color: #e9d5ff; border: 1px solid rgba(192,132,252,.4); }
.badge-serialized { background: rgba(245,158,11,.3);  color: #fde68a; border: 1px solid rgba(245,158,11,.4); }
.badge-cracked-ice{ background: rgba(125,211,252,.3); color: #bae6fd; border: 1px solid rgba(125,211,252,.4); }
.badge-standard   { background: rgba(255,255,255,.07); color: var(--text3); border: 1px solid var(--border); }
.badge-pack       { background: rgba(125,211,252,.2); color: #bae6fd; border: 1px solid rgba(125,211,252,.3); }
.badge-box        { background: rgba(192,132,252,.2); color: #e9d5ff; border: 1px solid rgba(192,132,252,.3); }

.card-info { padding: 12px; }
.card-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px;
}
.card-serial-txt { font-size: 10px; color: var(--gold); font-family: monospace; }
.card-type-label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); margin-top: 2px; }

/* list view */
.card-grid.list-view .card-item { display: flex; align-items: center; gap: 16px; border-radius: var(--radius); }
.card-grid.list-view .card-img-wrap { width: 56px; flex-shrink: 0; border-radius: var(--radius) 0 0 var(--radius); aspect-ratio: unset !important; height: 78px; }
.card-grid.list-view .card-item:hover { transform: translateX(4px); }
.card-grid.list-view .card-rarity-badge { display: none; }
.card-grid.list-view .card-info { flex: 1; display: flex; align-items: center; gap: 16px; }
.card-grid.list-view .card-name { white-space: normal; flex: 1; }

/* ══ LOADING / EMPTY ═══════════════════════════════ */
.loading-state, .empty-state {
  text-align: center; padding: 80px 24px; color: var(--text2);
}
.swamp-loader {
  width: 48px; height: 48px;
  border: 3px solid var(--border); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .9s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ MODALS ════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow); animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-title { font-family: 'IM Fell English', serif; font-size: 28px; color: var(--gold2); margin-bottom: 8px; }
.modal-sub { color: var(--text2); margin-bottom: 28px; font-size: 14px; }
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: .15em; text-transform: uppercase;
  color: var(--text3); margin-bottom: 6px;
}
.form-group .optional { color: var(--text3); font-weight: 400; }
.form-group input,
.form-group textarea {
  width: 100%; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-family: 'Space Grotesk', sans-serif;
  font-size: 14px; padding: 10px 14px; outline: none; resize: vertical;
  transition: border-color var(--transition);
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--gold-dim); }
.modal-actions { display: flex; gap: 10px; margin-top: 28px; }

/* card detail modal */
.card-modal { max-width: 720px; position: relative; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--text3);
  font-size: 20px; cursor: pointer; transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }
.card-modal-inner { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.card-modal-img-wrap {
  flex: 0 0 220px; border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
}
.card-modal-img-wrap img { width: 100%; display: block; }
.card-modal-info { flex: 1; min-width: 200px; }
.card-modal-type { font-size: 10px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--text3); margin-bottom: 4px; }
.card-modal-rarity { font-size: 10px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 8px; }
.card-modal-name { font-family: 'IM Fell English', serif; font-size: 26px; color: var(--text); margin-bottom: 8px; }
.card-modal-serial { font-size: 12px; color: var(--gold); font-family: monospace; margin-bottom: 16px; }
.card-modal-attrs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.attr-row {
  display: flex; justify-content: space-between; font-size: 13px;
  padding: 8px 12px; background: var(--bg2);
  border-radius: var(--radius); border: 1px solid var(--border);
}
.attr-key { color: var(--text3); }
.attr-val { color: var(--text); font-weight: 600; }

/* ══ SEARCH PAGE ═══════════════════════════════════ */
.search-header { margin-bottom: 32px; }
.search-header h2 { font-family: 'IM Fell English', serif; font-size: 36px; color: var(--gold2); margin-bottom: 8px; }
.search-header p { color: var(--text2); }
.search-bar-wrap { display: flex; gap: 12px; margin-bottom: 40px; flex-wrap: wrap; }
.search-bar-wrap input {
  flex: 1; min-width: 260px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: 'Space Grotesk', sans-serif; font-size: 14px;
  padding: 12px 16px; outline: none; transition: border-color var(--transition);
}
.search-bar-wrap input:focus { border-color: var(--gold-dim); }
.collectors-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.collector-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; cursor: pointer;
  transition: all var(--transition); display: flex; align-items: center; gap: 16px;
}
.collector-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.collector-card-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dim), var(--green));
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.collector-card-name { font-weight: 600; color: var(--text); font-size: 15px; }
.collector-card-wallet { font-family: monospace; font-size: 11px; color: var(--text3); }
.collector-card-counts { font-size: 11px; color: var(--text2); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.count-pill { color: var(--gold); }

/* ══ TOAST ═════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
  z-index: 999; background: var(--surface); border: 1px solid var(--border);
  border-radius: 100px; padding: 12px 24px; font-size: 13px;
  color: var(--text); box-shadow: var(--shadow); animation: fadeIn .2s ease;
  white-space: nowrap;
}
.toast.success { border-color: var(--green2); color: var(--green2); }
.toast.error   { border-color: #ef4444; color: #fca5a5; }

/* ══ FOOTER ════════════════════════════════════════ */
.site-footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border); padding: 24px;
  text-align: center; display: flex; flex-direction: column;
  gap: 4px; font-size: 11px; color: var(--text3); letter-spacing: .05em;
}

/* ══ DOWNLOAD PROGRESS OVERLAY ══════════════════════ */
#dlOverlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,.88);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s ease;
}
.dl-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px 36px;
  width: 360px;
  text-align: center;
  box-shadow: 0 0 60px rgba(201,168,76,.15), var(--shadow);
}
.dl-logo {
  font-size: 52px;
  animation: spin-slow 4s linear infinite;
  display: inline-block;
  margin-bottom: 16px;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(201,168,76,.6);
}
.dl-title {
  font-family: 'IM Fell English', serif;
  font-size: 20px;
  color: var(--gold2);
  letter-spacing: .15em;
  margin-bottom: 24px;
}
.dl-bar-wrap {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}
.dl-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold2));
  border-radius: 100px;
  transition: width .3s ease;
  box-shadow: 0 0 8px rgba(201,168,76,.5);
}
.dl-status {
  font-size: 12px;
  color: var(--text3);
  font-family: monospace;
  margin-bottom: 24px;
  letter-spacing: .04em;
  min-height: 18px;
}
.dl-cancel {
  font-size: 11px;
  color: var(--text3);
  cursor: pointer;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: color var(--transition);
}
.dl-cancel:hover { color: #ef4444; }

/* ══ PFP PICKER ══════════════════════════════════════ */
.pfp-picker-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding: 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pfp-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dim), var(--green));
  border: 2px solid var(--gold-dim);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  overflow: hidden;
}
.pfp-preview:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,.2);
}
.pfp-pick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pfp-hint {
  font-size: 11px;
  color: var(--text3);
  letter-spacing: .04em;
}

/* ══ UTILS ══════════════════════════════════════════ */
.hidden { display: none !important; }

/* ══ RESPONSIVE ════════════════════════════════════ */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero-title { font-size: 48px; }
  .binder-header { flex-direction: column; }
  .card-modal-inner { flex-direction: column; }
  .card-modal-img-wrap { flex: 0 0 auto; width: 100%; }
  .modal { padding: 28px 20px; }
  .binder-tabs { overflow-x: auto; }
  .binder-tab { flex-shrink: 0; }
}

/* ══ DOWNLOAD RESULT (flip video) ═══════════════════ */
button.dl-cancel {
  background: none; border: none; font-family: 'Space Grotesk', sans-serif;
  display: inline-block; padding: 6px 12px; margin-top: 4px;
}
.dl-box { max-width: calc(100vw - 32px); max-height: calc(100dvh - 24px); overflow-y: auto; }
.dl-result { margin-bottom: 18px; }
.dl-preview {
  display: block; width: 100%; max-height: 40vh; object-fit: contain;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: #000; margin-bottom: 16px;
}
.dl-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.dl-link { text-decoration: none; display: inline-block; }
.btn-ghost.active { border-color: var(--gold); color: var(--gold2); background: rgba(201,168,76,.1); }

/* ══ ALBUM VIEW ═══════════════════════════════════ */
.album { position: relative; z-index: 1; }
.album-book {
  position: relative;
  max-width: 520px; margin: 0 auto;
  padding: 14px 14px 14px 34px;
  border-radius: 10px 18px 18px 10px;
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(90,158,70,.10), transparent 60%),
    repeating-linear-gradient(115deg, rgba(255,255,255,.012) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #1d2414 0%, #12170c 55%, #0b0e07 100%);
  border: 1px solid #33391f;
  box-shadow: 0 24px 60px rgba(0,0,0,.75), inset 0 0 0 1px rgba(201,168,76,.08), inset 0 0 40px rgba(0,0,0,.6);
  perspective: 1800px;
}
/* stitched gold edge */
.album-book::before {
  content: ''; position: absolute; inset: 6px 6px 6px 26px;
  border: 1px dashed rgba(201,168,76,.28); border-radius: 6px 14px 14px 6px; pointer-events: none;
}
/* binder rings on the spine */
.album-book::after {
  content: ''; position: absolute; left: 8px; top: 10%; bottom: 10%; width: 14px;
  background: radial-gradient(circle at 7px 7px, #e8c96b 0 3px, #7a6228 3.5px 5.5px, transparent 6px) 0 0 / 14px 25% repeat-y;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.8));
  pointer-events: none;
}
.album-book.wide { max-width: 1040px; padding: 16px; border-radius: 18px; }
.album-book.wide::before { inset: 6px; border-radius: 14px; }
.album-book.wide::after {
  left: 50%; transform: translateX(-50%); top: 8%; bottom: 8%; z-index: 4;
}
.album-stage { position: relative; transform-style: preserve-3d; }
.album-spread { display: grid; grid-template-columns: 1fr; gap: 0; }
.album-book.wide .album-spread { grid-template-columns: 1fr 1fr; }

.album-leaf {
  position: relative;
  background:
    repeating-linear-gradient(0deg, rgba(201,168,76,.025) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #171b10, #11140b);
  border: 1px solid #2a3020;
  border-radius: 4px 10px 10px 4px;
  padding: 12px 12px 10px;
  box-shadow: inset 0 0 30px rgba(0,0,0,.55);
  min-height: 100%;
}
.album-leaf.left  { border-radius: 10px 3px 3px 10px; box-shadow: inset -18px 0 24px -12px rgba(0,0,0,.8), inset 0 0 30px rgba(0,0,0,.5); }
.album-leaf.right { border-radius: 3px 10px 10px 3px; box-shadow: inset 18px 0 24px -12px rgba(0,0,0,.8), inset 0 0 30px rgba(0,0,0,.5); }
.album-leaf.single { box-shadow: inset 16px 0 22px -14px rgba(0,0,0,.85), inset 0 0 30px rgba(0,0,0,.5); }
.album-leaf.blank { display: flex; align-items: center; justify-content: center; }
.leaf-blank { font-size: 64px; color: rgba(201,168,76,.12); }

.leaf-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 2px 8px; margin-bottom: 10px;
  border-bottom: 1px solid rgba(201,168,76,.15);
}
.leaf-title { font-family: 'IM Fell English', serif; font-style: italic; color: var(--gold); font-size: 15px; }
.leaf-no { font-family: 'IM Fell English', serif; color: var(--gold-dim); font-size: 15px; letter-spacing: .1em; }
.leaf-foot {
  margin-top: 10px; text-align: center;
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--text3);
}

.leaf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-packs .leaf-grid, .type-boxes .leaf-grid { grid-template-columns: repeat(2, 1fr); }

/* a plastic binder pocket */
.pocket {
  position: relative; display: block; width: 100%;
  aspect-ratio: 2.5/3.5;
  padding: 4px; border-radius: 6px; cursor: pointer;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(232,228,216,.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 2px 6px rgba(0,0,0,.5);
  font: inherit; color: inherit;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.type-packs .pocket, .type-boxes .pocket { aspect-ratio: 3/2; }
.pocket.empty { cursor: default; background: rgba(0,0,0,.18); border-style: dashed; border-color: rgba(201,168,76,.08); box-shadow: inset 0 0 12px rgba(0,0,0,.4); }
.pocket-art {
  position: relative; display: block; width: 100%; height: 100%;
  border-radius: 4px; overflow: hidden; background: var(--surface2);
}
.pocket-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pocket-art .card-placeholder { font-size: 24px; }
/* sleeve glare */
.pocket::after {
  content: ''; position: absolute; inset: 0; border-radius: 6px; pointer-events: none;
  background: linear-gradient(125deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.03) 28%, transparent 45%, transparent 70%, rgba(255,255,255,.05) 100%);
}
.pocket:not(.empty):hover, .pocket:not(.empty):focus-visible {
  transform: translateY(-3px) rotate(-.6deg);
  border-color: var(--gold-dim);
  box-shadow: 0 10px 22px rgba(0,0,0,.7), 0 0 14px rgba(201,168,76,.15);
  outline: none; z-index: 2;
}
.pocket.foil { border-color: rgba(192,132,252,.35); }
.pocket.serialized { border-color: rgba(245,158,11,.4); }
.pocket.cracked-ice { border-color: rgba(125,211,252,.45); }
.pocket.foil .pocket-art::after, .pocket.cracked-ice .pocket-art::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(192,132,252,.2) 0%, rgba(96,165,250,.2) 25%, rgba(52,211,153,.2) 50%, rgba(251,191,36,.2) 75%, rgba(244,114,182,.2) 100%);
  mix-blend-mode: color; animation: foil-shimmer 3s ease-in-out infinite alternate;
}
.pocket-tag {
  position: absolute; left: 50%; bottom: -1px; transform: translate(-50%, 50%);
  font-family: monospace; font-size: 9px; color: var(--gold);
  background: var(--bg); border: 1px solid rgba(201,168,76,.25);
  border-radius: 100px; padding: 0 6px; line-height: 15px; z-index: 1;
}

/* turning sheet */
.album-sheet {
  position: absolute; top: 0; bottom: 0; z-index: 5;
  transform-style: preserve-3d; pointer-events: none;
}
.album-sheet.single { left: 0; right: 0; transform-origin: left center; }
.album-sheet.wide.from-right { left: 50%; right: 0; transform-origin: left center; animation: turn-r2l .85s cubic-bezier(.45,.05,.3,1) forwards; }
.album-sheet.wide.from-left  { left: 0; right: 50%; transform-origin: right center; animation: turn-l2r .85s cubic-bezier(.45,.05,.3,1) forwards; }
.album-sheet.peel-next { animation: peel-next .75s cubic-bezier(.45,.05,.3,1) forwards; }
.album-sheet.peel-prev { animation: peel-prev .75s cubic-bezier(.45,.05,.3,1) forwards; }
.sheet-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.sheet-face > .album-leaf { height: 100%; }
.sheet-face.back { transform: rotateY(180deg); }
.sheet-face::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(90deg, rgba(0,0,0,.0), rgba(0,0,0,.45));
  opacity: 0; animation: sheet-shade .8s ease forwards;
}
@keyframes sheet-shade { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }
@keyframes turn-r2l { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes turn-l2r { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
@keyframes peel-next {
  0%   { transform: rotateY(0); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: rotateY(-98deg); opacity: 0; }
}
@keyframes peel-prev {
  0%   { transform: rotateY(-98deg); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: rotateY(0); opacity: 1; }
}

.album-nav {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  margin: 22px auto 6px;
}
.album-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--gold-dim);
  color: var(--gold2); font-size: 24px; line-height: 1; cursor: pointer;
  font-family: 'IM Fell English', serif;
  transition: all var(--transition);
}
.album-btn:hover:not(:disabled) { background: rgba(201,168,76,.12); border-color: var(--gold); }
.album-btn:disabled { opacity: .3; cursor: default; }
.album-folio { display: flex; flex-direction: column; align-items: center; min-width: 120px; }
.folio-roman { font-family: 'IM Fell English', serif; font-size: 22px; color: var(--gold2); line-height: 1.1; }
.folio-num { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--text3); }
.album-hint { text-align: center; font-size: 11px; color: var(--text3); letter-spacing: .04em; }

@media (max-width: 640px) {
  .album-book { padding: 10px 10px 10px 28px; }
  .album-book::before { inset: 5px 5px 5px 22px; }
  .album-book::after { left: 6px; }
  .album-leaf { padding: 10px 8px 8px; }
  .leaf-grid { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .album-sheet { animation: none !important; }
}

/* ══ CARD DETAIL SHEET (scrollable, always-closable on iPhone) ══ */
html.modal-open, html.modal-open body { overscroll-behavior: none; }
.card-modal-overlay { padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.card-modal {
  max-height: calc(100vh - 32px);
  max-height: calc(100svh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  touch-action: pan-y; will-change: transform;
}
.card-modal-close {
  position: absolute; z-index: 5;
  top: calc(env(safe-area-inset-top) + 10px); right: calc(env(safe-area-inset-right) + 10px);
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(14,16,12,.88); border: 1px solid var(--gold-dim);
  color: var(--gold2); font-size: 18px; line-height: 1;
  box-shadow: 0 4px 16px rgba(0,0,0,.6);
  -webkit-tap-highlight-color: transparent;
}
.card-modal-close:hover, .card-modal-close:focus-visible { color: var(--text); border-color: var(--gold); }
.card-modal-grab { display: none; }
.card-modal-img-wrap { background: var(--surface2); }
.card-modal-img-wrap img.mw-img:not([src]) { aspect-ratio: 2.5/3.5; }
@media (max-width: 700px) {
  .card-modal-overlay { padding-left: 10px; padding-right: 10px; align-items: flex-end; }
  .card-modal { padding: 14px 16px 22px; border-radius: 18px; }
  .card-modal-grab { display: block; width: 44px; height: 5px; border-radius: 3px; background: rgba(232,228,216,.22); margin: 0 auto 12px; }
  .card-modal-inner { gap: 16px; }
  /* whole card visible: width limited by the smallest viewport height */
  .card-modal-img-wrap {
    width: min(100%, calc((100vh - 190px) * 0.714));
    width: min(100%, calc((100svh - 190px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 0.714));
    margin: 0 auto; flex: 0 0 auto;
  }
  .card-modal-info { min-width: 0; width: 100%; }
  .card-modal-name { padding-right: 0; }
}

/* ══ CARD ART LOADING STATES ══ */
.card-img-wrap.img-loading, .pocket-art.img-loading, .card-modal-img-wrap.img-loading {
  background: linear-gradient(110deg, var(--surface2) 30%, rgba(201,168,76,.09) 50%, var(--surface2) 70%) var(--surface2);
  background-size: 250% 100%; animation: mwShimmer 1.6s linear infinite;
}
.card-img-wrap.img-loading::before, .pocket-art.img-loading::before {
  content: '꩜'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: rgba(201,168,76,.22); pointer-events: none;
}
@keyframes mwShimmer { from { background-position: 125% 0; } to { background-position: -125% 0; } }
img.mw-img:not([src]) { visibility: hidden; }
img.mw-img[data-state="loading"] { opacity: 0; }
img.mw-img[data-state="ok"] { opacity: 1; transition: opacity .25s ease; }
.img-retry {
  position: absolute; inset: 0; z-index: 3; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: repeating-linear-gradient(135deg, rgba(201,168,76,.04) 0 8px, transparent 8px 16px), rgba(10,12,9,.85);
  color: var(--gold); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.img-retry-ico { font-size: 24px; line-height: 1; }
.pocket-art .img-retry-txt { font-size: 8px; }
.card-grid.list-view .img-retry-txt { display: none; }
.card-img-wrap .card-rarity-badge { z-index: 4; }

/* ══ MUDWATER COIN (3D CSS) ═════════════════════════════
   Modelled on the official spinning coin on mudwater.bayc.com: dark weathered
   metal, rope ring + anchor mark, black rim banded with gold chevrons. */
.mw-coin {
  --s: 28px; --t: calc(var(--s) * .13);
  display: inline-block; width: var(--s); height: var(--s); flex-shrink: 0;
  perspective: calc(var(--s) * 9); vertical-align: middle;
}
.mw-coin-xs { --s: 16px; }
.mw-coin-sm { --s: 30px; }
.mw-coin-lg { --s: 64px; }
.mw-coin-in {
  position: relative; display: block; width: 100%; height: 100%;
  transform-style: preserve-3d; animation: mwCoinSpin 3.8s linear infinite;
}
.mw-coin-in > i { position: absolute; inset: 0; border-radius: 50%; }
.mw-coin-edge {
  transform: translateZ(calc((var(--k) / 8 - .5) * var(--t)));
  background: repeating-conic-gradient(from 8deg, #0c0c0b 0 26deg, #d9b764 26deg 30deg, #0c0c0b 30deg 33deg, #d9b764 33deg 37deg, #0c0c0b 37deg 45deg);
}
.mw-coin-face {
  transform: translateZ(calc(var(--t) / 2 + .3px));
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23d9b764' stroke-linecap='round' stroke-linejoin='round'><circle cx='50' cy='50' r='44' stroke-width='2.4' stroke-dasharray='2.6 2.2' opacity='.75'/><circle cx='50' cy='50' r='39.5' stroke-width='.9' opacity='.45'/><circle cx='50' cy='25' r='6' stroke-width='4.2'/><path d='M50 31V80' stroke-width='5'/><path d='M36 41H64' stroke-width='4.6'/><path d='M27 60c2 13 11 21 23 21s21-8 23-21' stroke-width='4.6'/><path d='M22 66l5-7.5 7.5 2.5M78 66l-5-7.5-7.5 2.5' stroke-width='4.2'/></svg>") center / 100% no-repeat,
    radial-gradient(circle at 34% 28%, #6a645a 0%, #3a3731 38%, #1d1c19 72%, #121210 100%);
  box-shadow: inset 0 0 0 1px rgba(217,183,100,.55), inset 0 0 calc(var(--s) * .18) rgba(0,0,0,.7);
}
.mw-coin-face::after { /* moving glint */
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(115deg, transparent 35%, rgba(255,240,200,.22) 48%, transparent 60%);
}
.mw-coin-back { transform: rotateY(180deg) translateZ(calc(var(--t) / 2 + .3px)); }
@keyframes mwCoinSpin { from { transform: rotateX(12deg) rotateY(0deg); } to { transform: rotateX(12deg) rotateY(360deg); } }
@media (prefers-reduced-motion: reduce) { .mw-coin-in { animation-duration: 14s; } }
.swamp-loader.has-coin { border: 0; border-radius: 0; animation: none; width: auto; height: auto; display: flex; justify-content: center; }
.swamp-loader.has-coin .mw-coin-in { animation-duration: 1.6s; filter: drop-shadow(0 6px 14px rgba(201,168,76,.18)); }

/* ══ COLLECTOR BADGES ═══════════════════════════════════ */
.binder-badge-row { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; }
.mw-badge {
  --bc: var(--gold); position: relative; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 6px; border-radius: 999px; cursor: help;
  font: 600 10px/1.2 'Space Grotesk', sans-serif; letter-spacing: .12em; text-transform: uppercase;
  color: var(--bc); background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(0,0,0,.25)), var(--surface);
  border: 1px solid color-mix(in srgb, var(--bc) 55%, transparent);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.5); vertical-align: middle; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.mw-badge-ico { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; }
.mw-badge-ico svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.mw-badge.tier-loose { --bc: #9a8c6c; }
.mw-badge.tier-pack  { --bc: #c08a48; }
.mw-badge.tier-box   { --bc: #d6cdb4; }
.mw-badge.tier-case  { --bc: var(--gold2); box-shadow: inset 0 0 0 1px rgba(0,0,0,.5), 0 0 10px rgba(232,201,107,.18); }
.mw-badge.tier-vault { --bc: var(--gold2); background: linear-gradient(180deg, rgba(232,201,107,.18), rgba(0,0,0,.3)), var(--surface); box-shadow: 0 0 14px rgba(232,201,107,.3); }
.mw-badge::after { /* tooltip / tap label */
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px);
  width: max-content; max-width: 230px; white-space: normal; text-align: center;
  padding: 7px 10px; border-radius: 8px; background: #0d0f09; border: 1px solid var(--gold-dim);
  color: var(--text); font: 500 11px/1.35 'Space Grotesk', sans-serif; letter-spacing: .02em; text-transform: none;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 50;
}
.mw-badge:hover::after, .mw-badge:focus-visible::after, .mw-badge.tip-open::after { opacity: 1; transform: translate(-50%, 0); }
.collector-card-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.collector-card-name .mw-badge { font-size: 9px; padding: 2px 8px 2px 5px; }
.collector-card { overflow: visible; }

/* ══ PFP CROP EDITOR ════════════════════════════════════ */
.crop-overlay { z-index: 320; overscroll-behavior: contain; }
.crop-modal { max-width: 380px; width: 100%; max-height: calc(100dvh - 24px); overflow-y: auto; }
.crop-stage {
  position: relative; width: min(100%, 320px); aspect-ratio: 1; margin: 6px auto 14px; overflow: hidden;
  border-radius: 14px; background: #050604; touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab; outline: none;
}
.crop-stage.dragging { cursor: grabbing; }
.crop-stage:focus-visible { box-shadow: 0 0 0 2px var(--gold); }
.crop-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; pointer-events: none; -webkit-user-drag: none; }
.crop-mask { /* circular window */
  position: absolute; inset: 14px; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 999px rgba(6,7,4,.72); border: 2px solid rgba(232,201,107,.85);
}
.crop-mask::after { content: ''; position: absolute; inset: -7px; border-radius: 50%; border: 1px dashed rgba(201,168,76,.4); }
.crop-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.crop-controls input[type=range] { flex: 1; accent-color: var(--gold); min-width: 0; height: 28px; }
.crop-z { color: var(--gold); font-size: 18px; width: 14px; text-align: center; }
.crop-preview-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--text3); }
.crop-preview { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--gold-dim); background: #050604; }
.pfp-pick-actions .btn-ghost.small { justify-content: center; }

/* ══ SECURITY PIN SHEET ══════════════════════════ */
.pin-overlay { z-index: 340; overscroll-behavior: contain; }
.pin-modal {
  max-width: 380px; text-align: center; position: relative; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, rgba(61,107,46,.22), transparent 60%), var(--surface);
  border-color: rgba(161,134,61,.45);
}
.pin-sigil {
  width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 50%;
  display: grid; place-items: center; font-size: 28px; color: var(--gold2);
  border: 2px solid var(--gold-dim); box-shadow: 0 0 18px rgba(201,168,76,.18) inset;
}
.pin-title { font-size: 26px; }
.pin-sub { margin-bottom: 16px; }
.pin-step { min-height: 16px; font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--green2); margin-bottom: 10px; }
.pin-boxes { display: flex; justify-content: center; gap: 12px; }
.pin-box {
  width: 56px; height: 64px; border-radius: 12px; text-align: center;
  font: 700 28px/1 'Space Grotesk', sans-serif; color: var(--gold2); caret-color: var(--gold);
  background: var(--bg2); border: 1.5px solid var(--border); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  -webkit-appearance: none; appearance: none;
}
.pin-box:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,.18); }
.pin-box.filled { border-color: var(--gold-dim); }
.pin-boxes.shake { animation: pinShake .38s ease; }
@keyframes pinShake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.pin-error { min-height: 20px; margin-top: 12px; font-size: 13px; color: #f87171; }
.pin-actions { margin-top: 14px; justify-content: center; }
.pin-actions .btn-primary { flex: 1; }
.pin-forgot {
  margin-top: 16px; background: none; border: none; cursor: pointer;
  color: var(--text2); font: 600 13px 'Space Grotesk', sans-serif; text-decoration: underline; text-underline-offset: 3px;
}
.pin-forgot:hover { color: var(--gold2); }
@media (max-width: 480px) {
  /* top-anchored so the iPhone number pad never covers the boxes */
  .pin-overlay { align-items: flex-start; padding: max(14px, env(safe-area-inset-top)) 12px 12px; }
  .pin-modal { padding: 24px 18px 20px; }
  .pin-box { width: 58px; height: 66px; font-size: 30px; }
}

/* ── Security PIN section in the profile sheet ── */
.pin-section {
  margin: 4px 0 22px; padding: 14px 16px;
  background: linear-gradient(160deg, rgba(74,124,63,.10), rgba(201,168,76,.05));
  border: 1px solid var(--border); border-radius: var(--radius);
}
.pin-sec-row { display: flex; align-items: center; gap: 12px; }
.pin-sec-icon {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-size: 18px; color: var(--gold2);
  border: 1px solid var(--gold-dim); background: rgba(201,168,76,.08);
}
.pin-sec-text { flex: 1; min-width: 0; }
.pin-sec-title { font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--text2); }
.pin-sec-status { font-size: 13px; color: var(--text3); margin-top: 3px; line-height: 1.35; }
.pin-sec-status.on { color: var(--green2); }
.pin-section .btn-ghost.small { flex: none; min-height: 40px; white-space: nowrap; }
.pin-sec-forgot { margin-top: 10px; padding: 4px 0; font-size: 12px; }
/* brand-new profile: the PIN card is a required step */
.pin-section.required { border-color: rgba(201,168,76,.6); box-shadow: 0 0 0 1px rgba(201,168,76,.18), 0 0 18px rgba(201,168,76,.10); }
.pin-section.required .pin-sec-status:not(.on) { color: var(--gold2); }
