/* Moze — Milady brown/cream */

:root {
  --brown: #5c1a2e;
  --brown-dark: #3d0f1e;
  --maroon: #800000;
  --cream: #fff8ee;
  --cream-mid: #f0e6d6;
  --tan: #f0d9c8;
  --tan-hover: #e0c0a8;
  --border: #777;
  --text: #000;
  --muted: #4b4b4b;
  /* Neon — same as section bar (.m_box_bar) */
  --neon: #C6E607;
  --neon-soft: #e8f78a;
  --neon-deep: #9bb505;
  --neon-glow: #d4ff2a;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  font: 1.2em;
  font-family: "Hiragino Kaku Gothic Pro", Osaka, Meiryo, "MS PGothic", arial, helvetica, clean, sans-serif;
  margin: 0;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/></svg>"),
    linear-gradient(var(--cream-mid), var(--cream), var(--cream), white, white);
  background-attachment: fixed, fixed;
  color: var(--text);
  overflow-x: hidden;
  max-width: 100vw;
}

.banner-top {
  margin: 1em;
  text-align: center;
}

.banner-img {
  border: 2px solid gray;
  max-width: 500px;
  width: 100%;
  height: auto;
  padding: 0;
  transition: opacity 0.35s ease;
}

/* ── Collection stats strip (under banner) — simple + chart ── */
.stats-hero {
  max-width: 43em;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

.stats-hero-inner {
  margin: 1em; /* same as .m_box */
  background: #fff;
  border: 1px solid var(--brown);
  padding: 1em 1.1em 1.05em;
  box-sizing: border-box;
}

.stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75em;
  margin-bottom: 0.95em;
}

.stats-head-left {
  display: flex;
  align-items: center;
  gap: 0.65em;
  min-width: 0;
}

.stats-avatar {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border: 1.5px solid var(--brown);
  margin: 0;
  flex-shrink: 0;
}

.stats-title {
  margin: 0;
  font-size: 1.2em;
  font-weight: 800;
  color: var(--brown-dark);
  line-height: 1.15;
}

.stats-sub {
  margin: 0.15em 0 0;
  font-size: 0.78em;
  color: var(--muted);
}

.stats-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em;
  flex-shrink: 0;
}

a.stats-cta,
.stats-cta {
  flex-shrink: 0;
  padding: 0.45em 0.9em;
  background: #2081e2 !important;
  color: #fff !important;
  border: 1px solid #1868b7 !important;
  font-weight: 800;
  font-size: 0.8em;
  text-decoration: none !important;
}

a.stats-cta:hover,
.stats-cta:hover {
  background: #1868b7 !important;
  color: #fff !important;
}

.stats-btn-secondary {
  padding: 0.45em 0.85em;
  background: #fff;
  color: var(--brown);
  border: 1px solid var(--brown);
  font-weight: 800;
  font-size: 0.78em;
  font-family: inherit;
  cursor: pointer;
}

.stats-btn-secondary:hover {
  background: var(--cream);
}

.stats-btn-secondary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.stats-snap-status {
  margin: -0.35em 0 0.75em;
  color: var(--muted);
  text-align: right;
}

.stats-snap-status[hidden] {
  display: none !important;
}

.stats-snap-status.is-error {
  color: #a00;
}

.stats-snap-status.is-ok {
  color: #2a6a2a;
}

/* Mint progress */
.stats-mint {
  margin-bottom: 0.9em;
}

.stats-mint-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35em 0.75em;
  margin-bottom: 0.4em;
}

.stats-mint-label {
  font-size: 0.72em;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats-mint-nums {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35em 0.5em;
  font-size: 0.95em;
  color: var(--brown-dark);
}

.stats-mint-nums strong {
  font-size: 1.25em;
  font-weight: 800;
}

.stats-dim { color: var(--muted); font-weight: 600; }

.stats-pill {
  display: inline-block;
  padding: 0.12em 0.45em;
  background: var(--cream);
  border: 1px solid var(--cream-mid);
  font-size: 0.78em;
  font-weight: 800;
  color: var(--brown);
}

.stats-free {
  font-weight: 800;
  color: var(--neon-deep);
  font-size: 0.85em;
  letter-spacing: 0.04em;
}

.stats-progress {
  height: 12px;
  background: var(--cream-mid);
  border: 1px solid #e0d5c4;
  overflow: hidden;
}

.stats-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-deep), var(--neon));
  transition: width 0.65s ease;
  min-width: 0;
}

/* Metric row */
.stats-metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border: 1px solid var(--cream-mid);
  margin-bottom: 0.95em;
}

.stats-metric {
  padding: 0.55em 0.4em 0.5em;
  text-align: center;
  border-right: 1px solid var(--cream-mid);
  min-width: 0;
  background: #fffcf7;
}

.stats-metric:last-child { border-right: none; }

.stats-metric-label {
  display: block;
  font-size: 0.62em;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2em;
}

.stats-metric-val {
  display: block;
  font-size: 0.92em;
  font-weight: 800;
  color: var(--brown-dark);
  line-height: 1.2;
  word-break: break-word;
}

@media (max-width: 720px) {
  .stats-hero { max-width: 100%; }

  .stats-hero-inner {
    margin: 0.65em 0.5em; /* match mobile .m_box */
    padding: 0.85em 0.7em 0.8em;
  }

  .stats-head {
    flex-wrap: wrap;
  }

  .stats-head-actions {
    width: 100%;
  }

  .stats-cta,
  .stats-btn-secondary {
    flex: 1 1 auto;
    text-align: center;
  }

  .stats-snap-status {
    text-align: center;
  }

  .stats-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-metric:nth-child(3n) { border-right: none; }
  .stats-metric:nth-child(n+4) {
    border-top: 1px solid var(--cream-mid);
  }
}

.page-wrap {
  max-width: 43em;
  margin: auto;
  position: relative;
  z-index: 1;
}

/* ── Stake scan pixel preview ── */
.stake-scan-preview {
  margin: 0.75em 0 1em;
  padding: 0.85em 0.6em 1em;
  border: 1px dashed var(--border);
  background: linear-gradient(180deg, #fffef9, #f7f0e4);
}

.stake-scan-preview[hidden] {
  display: none !important;
}

.stake-scan-title {
  margin: 0.2em 0 0.15em;
  font-weight: 700;
  color: var(--brown);
}

.stake-scan-sub {
  margin: 0 0 0.75em;
  color: var(--muted);
}

.stake-scan-cards {
  display: flex;
  justify-content: center;
  gap: 0.65em;
  flex-wrap: wrap;
}

.stake-scan-card {
  width: min(28vw, 120px);
  aspect-ratio: 1;
  border: 2px solid var(--brown);
  background: #111;
  overflow: hidden;
  box-shadow: 2px 2px 0 rgba(92, 26, 46, 0.15);
  position: relative;
}

.stake-scan-card canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Token # labels intentionally removed during scan loading */

/* ── Raffle ── */
.raffle-panel {
  padding: 0.6em 0.9em 1.1em;
}

.raffle-prize-art {
  margin: 0.35em 0 0.85em;
  text-align: center;
}

/* Side-by-side prize cards — click to switch active raffle */
.raffle-prize-picker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 0.75em 1em;
  margin: 0.25em 0 0.65em;
}

.raffle-prize-card {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  cursor: pointer;
  background: transparent;
  border: 2px solid transparent;
  padding: 0.4em 0.45em 0.55em;
  max-width: 200px;
  flex: 1 1 140px;
  color: inherit;
  text-align: center;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.raffle-prize-card:hover {
  border-color: var(--brown);
}

.raffle-prize-card:focus {
  outline: none;
}

.raffle-prize-card:focus-visible {
  border-color: var(--neon-deep);
  box-shadow: 0 0 0 2px var(--neon);
}

.raffle-prize-card.is-active {
  border-color: var(--neon-deep);
  background: linear-gradient(180deg, #f8ffd4, #fffef5);
  box-shadow: 3px 3px 0 rgba(92, 26, 46, 0.12);
  transform: translateY(-2px);
}

.raffle-prize-card .raffle-prize-frame,
.raffle-prize-card .raffle-prize-frame img,
.raffle-prize-card .raffle-prize-badge,
.raffle-prize-card .raffle-prize-id {
  pointer-events: none; /* clicks go to the button */
}

/* Both prizes always use full Moze-style frame (same border + outline) */
.raffle-prize-card .raffle-prize-frame {
  width: 100%;
  max-width: 168px;
  border: 3px solid var(--neon-deep);
  outline: 2px solid var(--neon);
  outline-offset: 3px;
  box-shadow: 3px 3px 0 rgba(92, 26, 46, 0.18);
  background: #c6e607;
}

.raffle-prize-card.is-active .raffle-prize-frame {
  /* same frame — selection shown by card chrome, not thinner/thicker art border */
  border: 3px solid var(--neon-deep);
  outline: 2px solid var(--neon);
  outline-offset: 3px;
}

.raffle-card-label {
  display: block;
  margin-top: 0.45em;
  font-weight: 800;
  font-size: 0.88em;
  color: var(--brown);
  line-height: 1.2;
}

.raffle-card-sub {
  display: block;
  margin-top: 0.12em;
  color: var(--muted);
  font-size: 0.75em;
}

.raffle-prize-frame {
  position: relative;
  display: inline-block;
  width: min(72vw, 220px);
  aspect-ratio: 1;
  /* Sharp square + green outline (no curve) */
  border: 3px solid var(--neon-deep);
  border-radius: 0;
  overflow: hidden;
  background: #c6e607;
  outline: 2px solid var(--neon);
  outline-offset: 3px;
  box-shadow: 3px 3px 0 rgba(92, 26, 46, 0.18);
}

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

.raffle-opensea-btn {
  display: inline-block;
  margin-top: 0.55em;
  padding: 0.45em 0.95em;
  font-size: 0.9em;
  font-weight: 700;
  color: #fff !important;
  background: #2081e2;
  border: 2px solid #1868b7;
  border-radius: 0;
  text-decoration: none !important;
  box-shadow: 2px 2px 0 rgba(24, 104, 183, 0.25);
}

.raffle-opensea-btn:hover {
  background: #1868b7;
  color: #fff !important;
}

.raffle-entries-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0.75em 0 0.9em;
  border: 2px solid var(--neon-deep);
  background: linear-gradient(180deg, #f8ffd4, #eef7a8);
}

.raffle-entries-item {
  padding: 0.65em 0.4em;
  text-align: center;
  border-right: 1px solid rgba(155, 181, 5, 0.55);
}

.raffle-entries-item:last-child {
  border-right: none;
}

.raffle-entries-label {
  display: block;
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.2em;
}

.raffle-entries-num {
  font-size: 1.35em;
  color: var(--brown);
  line-height: 1.1;
}

@media (max-width: 520px) {
  .raffle-entries-banner {
    grid-template-columns: 1fr;
  }
  .raffle-entries-item {
    border-right: none;
    border-bottom: 1px solid rgba(155, 181, 5, 0.55);
  }
  .raffle-entries-item:last-child {
    border-bottom: none;
  }
}

/* Wallet connect modal */
.wallet-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1em;
}

.wallet-modal[hidden] {
  display: none !important;
}

.wallet-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 10, 20, 0.45);
}

.wallet-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 340px);
  background: var(--cream);
  border: 2px solid var(--brown);
  padding: 1.15em 1.1em 1em;
  box-shadow: 4px 4px 0 rgba(92, 26, 46, 0.2);
  text-align: center;
}

.wallet-modal-title {
  margin: 0 0 0.3em;
  color: var(--brown);
  font-size: 1.2em;
  text-align: center;
}

.wallet-modal-sub {
  margin: 0 auto 0.9em;
  color: var(--muted);
  text-align: center;
  max-width: 18em;
  line-height: 1.35;
}

.wallet-modal-list {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin: 0 0 0.85em;
}

.wallet-modal-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  width: 100%;
  min-height: 3.1em;
  padding: 0.65em 1em;
  border: 1px solid var(--brown);
  background: #fff;
  color: var(--brown);
  font: inherit;
  font-weight: 700;
  font-size: 1em;
  line-height: 1.2;
  cursor: pointer;
  box-sizing: border-box;
}

.wallet-modal-item:hover {
  background: var(--neon-soft);
}

.wallet-modal-item:focus-visible {
  outline: 2px solid var(--neon-deep);
  outline-offset: 2px;
}

/* Fixed icon slot so text lines up across wallets */
.wallet-modal-icon,
.wallet-modal-icon-fallback {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
}

.wallet-modal-icon-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--neon);
  border: 1px solid var(--brown);
  font-size: 0.9em;
}

.wallet-modal-item-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 7em;
  text-align: left;
  gap: 0.1em;
}

.wallet-modal-item-name {
  display: block;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.wallet-modal-item-note {
  display: block;
  font-size: 0.68em;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.wallet-modal-empty {
  margin: 0.4em 0;
  color: var(--muted);
  text-align: center;
}

.wallet-modal-cancel {
  width: 100%;
  margin: 0 auto;
  display: block;
}

body.wallet-modal-open {
  overflow: hidden;
}

.raffle-prize-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0 !important;
  max-width: none !important;
  border: none !important;
}

.raffle-prize-frame img:hover {
  border: none !important;
}

.raffle-prize-badge {
  position: absolute;
  top: 0.45em;
  left: 0.45em;
  font-size: 0.65em;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.2em 0.45em;
  background: var(--neon);
  color: var(--brown-dark);
  border: 1px solid var(--brown);
}

.raffle-prize-id {
  position: absolute;
  left: 0.4em;
  bottom: 0.4em;
  font-size: 0.78em;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  background: rgba(0, 0, 0, 0.35);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}

.raffle-prize-caption {
  margin: 0.55em 0 0.15em;
  color: var(--muted);
}

.raffle-head {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  margin: 0.4em 0 0.3em;
  text-align: center;
}

.raffle-title {
  margin: 0;
  font-size: 1.15em;
  color: var(--brown);
  text-align: center;
}

.raffle-prize {
  margin: 0.25em 0 0;
  color: var(--muted);
  text-align: center;
}

.raffle-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em;
  justify-content: center;
  align-items: center;
}

.raffle-pill {
  display: inline-block;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.28em 0.55em;
  border: 1px solid var(--brown);
  background: var(--cream);
  color: var(--brown);
}

.raffle-pill.is-open {
  background: var(--neon);
  border-color: var(--neon-deep);
  color: var(--brown-dark);
}

.raffle-pill.is-closed {
  background: #eee;
  color: var(--muted);
}

.raffle-pill-cost {
  background: #fff;
}

.raffle-desc {
  margin: 0.35em 0 0.75em;
}

/* Raffle countdown + entries — stake-style cards, centered */
.raffle-countdown {
  margin: 0.65em auto 0.3em;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.raffle-countdown-label {
  margin: 0 0 0.35em;
  font-size: 0.68em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  width: 100%;
}

/* Time row: compact + centered — fixed 2-digit width so timer never jumps */
.raffle-cd-dash.stake-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(3.7em, 3.9em));
  gap: 6px;
  justify-content: center;
  justify-items: stretch;
  margin: 0 auto;
  max-width: none;
  width: max-content;
}

.raffle-cd-dash .stake-stat {
  padding: 0.35em 0.22em 0.3em;
  min-width: 0;
  text-align: center;
}

.raffle-cd-dash .stake-stat-label {
  font-size: 0.55em;
  letter-spacing: 0.03em;
}

.raffle-cd-dash .stake-stat strong,
.raffle-cd-dash .stake-stat .slot-num {
  font-size: 0.95em;
  /* must match setSlotNumber step (1.25em) or digits clip/offset */
  min-height: 1.25em;
  display: flex;
  justify-content: center;
  align-items: center;
}

.raffle-cd-dash .slot-odometer {
  height: 1.25em;
  font-size: 1em;
  line-height: 1.25em;
  /* keep 2-digit clock stable while reels roll */
  min-width: 1.3em;
  justify-content: center;
}

.raffle-cd-dash .slot-digit {
  height: 1.25em;
  width: 0.62em;
}

.raffle-cd-dash .slot-digit.slot-sym {
  width: 0.28em;
}

.raffle-cd-dash .slot-reel span,
.raffle-cd-dash .slot-digit.slot-sym .slot-static {
  height: 1.25em;
  line-height: 1.25em;
}

/* Soft tick for seconds (no blur / multi-turn) */
.raffle-cd-dash .slot-odometer .slot-reel {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.raffle-cd-dash .stake-stat-unit {
  font-size: 0.5em;
}

/* Entries row: 3 cards centered as a group */
.raffle-entries-dash.stake-dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 5.25em));
  gap: 8px;
  justify-content: center;
  margin: 0.85em auto 0.75em;
  width: max-content;
  max-width: 100%;
}

.raffle-entries-dash .stake-stat {
  padding: 0.5em 0.3em;
}

.raffle-countdown-end {
  margin: 0.4em 0 0;
  color: #a00;
  font-weight: 700;
  font-size: 0.8em;
  text-align: center;
}

.raffle-countdown.is-ended .stake-stat {
  opacity: 0.55;
}

@media (max-width: 420px) {
  .raffle-cd-dash.stake-dashboard {
    grid-template-columns: repeat(4, minmax(3.25em, 3.45em));
    gap: 4px;
  }
  .raffle-entries-dash.stake-dashboard {
    grid-template-columns: repeat(3, minmax(0, 4.6em));
    gap: 6px;
  }
}

/* legacy entries banner (if any leftover) */
.raffle-entries-banner {
  display: none;
}

.raffle-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border: 1px solid var(--cream-mid);
  background: #fffef9;
  margin-bottom: 0.9em;
  max-width: 16em;
  margin-left: auto;
  margin-right: auto;
}

.raffle-metric {
  padding: 0.55em 0.4em;
  text-align: center;
  border-right: 1px solid var(--cream-mid);
}

.raffle-metric:last-child {
  border-right: none;
}

.raffle-metric.highlight {
  background: linear-gradient(180deg, #f4ffc2, #eef7a8);
}

.raffle-metric-label {
  display: block;
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.2em;
}

.raffle-metric-val {
  font-size: 1.05em;
  color: var(--brown);
}

.raffle-enter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  margin: 0.4em 0;
}

/* Shake when click but can't enter (no wallet / low $MOZE / closed) */
#raffle-enter.is-shake {
  animation: raffle-btn-shake 0.45s ease-in-out;
}

@keyframes raffle-btn-shake {
  0%, 100% { transform: translateX(0); }
  12% { transform: translateX(-7px) rotate(-1deg); }
  24% { transform: translateX(7px) rotate(1deg); }
  36% { transform: translateX(-6px); }
  48% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  72% { transform: translateX(4px); }
  84% { transform: translateX(-2px); }
  96% { transform: translateX(2px); }
}

@media (prefers-reduced-motion: reduce) {
  #raffle-enter.is-shake {
    animation: none;
    outline: 2px solid #a00;
  }
}

.raffle-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
}

.raffle-qty input {
  width: 3.2em;
  text-align: center;
  font-size: 1em;
  font-weight: 700;
  padding: 0.35em 0.2em;
  border: 1px solid var(--brown);
  background: #fff;
  color: var(--brown);
}

.raffle-cost-line {
  margin: 0.15em 0 0.35em;
  color: var(--muted);
}

.raffle-top {
  margin-top: 0.85em;
  padding-top: 0.6em;
  border-top: 1px solid var(--cream-mid);
}

.raffle-top[hidden] {
  display: none !important;
}

.raffle-top-label {
  margin: 0 0 0.35em;
  text-align: center;
}

.raffle-top-hint {
  margin: 0 0 0.5em;
  text-align: center;
  color: var(--muted);
}

.raffle-top-list {
  margin: 0 auto;
  padding: 0;
  max-width: 24em;
  font-size: 0.9em;
  list-style: none;
  /* ~10 rows visible, rest scroll */
  max-height: 22.5em;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--cream-mid);
  background: #fff;
}

.raffle-top-list:empty {
  border: none;
  max-height: none;
}

.raffle-top-list li {
  margin: 0;
  padding: 0.4em 0.55em;
  display: flex;
  justify-content: space-between;
  gap: 0.75em;
  align-items: baseline;
  border-bottom: 1px solid var(--cream-mid);
  background: #fffef9;
  text-align: left;
}

.raffle-top-list li:last-child {
  border-bottom: none;
}

.raffle-top-list .raffle-entry-rank {
  color: var(--muted);
  font-size: 0.85em;
  min-width: 1.5em;
}

.raffle-top-list .raffle-entry-addr {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 0.92em;
}

.raffle-top-list .raffle-entry-tickets {
  font-weight: 700;
  color: var(--brown);
  white-space: nowrap;
}

.raffle-top-empty {
  margin: 0.4em 0 0;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 560px) {
  .raffle-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .raffle-metric:nth-child(2) {
    border-right: none;
  }
  .raffle-metric:nth-child(1),
  .raffle-metric:nth-child(2) {
    border-bottom: 1px solid var(--cream-mid);
  }
  .stake-scan-card {
    width: min(30vw, 100px);
  }
}

/* Fixed graffiti stickers — bottom left / bottom right (Left.png / Right.png) */
.graffiti-deco {
  pointer-events: none;
  user-select: none;
}

.graffiti-deco-img {
  position: fixed;
  /* Above green footer so stickers are never painted under it */
  z-index: 4;
  bottom: 1.25rem; /* JS lifts further when footer is in view */
  width: clamp(150px, 18vw, 250px);
  height: auto;
  max-width: none !important;
  margin: 0 !important;
  border: none !important;
  display: block;
  opacity: 1;
  filter: none;
  image-rendering: auto;
  transition: bottom 0.15s ease-out;
  will-change: bottom;
}

.graffiti-deco-img:hover {
  border: none !important;
}

.graffiti-deco-left {
  left: max(0.35rem, env(safe-area-inset-left));
}

.graffiti-deco-right {
  right: max(0.35rem, env(safe-area-inset-right));
}

@media (max-width: 960px) {
  .graffiti-deco-img {
    width: clamp(110px, 15vw, 170px);
    bottom: 0.6rem;
  }
}

/* Hide on narrow screens so they don't cover content */
@media (max-width: 720px) {
  .graffiti-deco {
    display: none;
  }
}

a {
  color: blue;
  text-decoration: underline;
}

a:hover {
  color: red;
}

img {
  display: block;
  margin: auto;
  max-width: 20em;
  border: 1px solid var(--border);
}

img:hover {
  border: 1px solid purple;
}

.hero-img {
  max-width: 16em;
  transition: opacity 0.25s ease;
}

.hero-gif {
  image-rendering: auto;
}

.inline-img {
  max-width: 14em;
}

/* Boxes */
.m_box {
  border: 1px solid var(--brown);
  margin: 1em;
  background-color: white;
}

.m_box_red {
  border: 1px solid var(--maroon);
  margin: 1em;
  background-color: #ffffee;
}

.m_box_bar {
  background: #C6E607;
  color: var(--brown-dark);
}

.m_box_bar_red {
  background: #C6E607;
  color: var(--brown-dark);
}

h2 {
  margin: 0.001em 0 0.001em 0.25em;
  font-size: 1.1em;
}

p {
  margin: 0.5em 1em;
  color: var(--text);
}

.centered-text { text-align: center; }
.intro { font-size: 1em; }
.links { font-size: 0.95em; }
.fine { font-size: 0.85em; color: var(--muted); }
.hero-caption { font-size: 0.9em; color: var(--muted); }

hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 0.8em 1em;
}

ul {
  list-style-type: circle;
  margin: 0.5em 1.5em;
}

li { margin: 0.3em 0; }

/* Trait Parallels */
.parallel-block {
  padding: 0.3em 1em 0.6em;
}

.parallel-title {
  margin: 0.5em 1em 0.4em !important;
}

.compare-wide {
  max-width: 100%;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  margin: 0.4em auto;
}

.compare-wide:hover {
  border: 1px solid purple;
}

.whitelist-img {
  display: block;
  max-width: 70%;
  height: auto;
  border: 1px solid var(--border);
  margin: 0.4em auto 1em;
}

/* Gallery */
.gallery-search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
  justify-content: center;
  align-items: center;
  margin: 0.5em 1em 0.25em;
}

.gallery-search input {
  flex: 1 1 12em;
  max-width: 16em;
  padding: 0.45em 0.65em;
  font-size: 0.9em;
  border: 1px solid var(--brown);
  font-family: inherit;
}

.gallery-search input:focus {
  outline: none;
  border-color: var(--neon-deep);
  box-shadow: 0 0 0 1px var(--neon);
}

.gallery-search-btn {
  font-size: 0.85em !important;
  padding: 0.45em 0.9em !important;
}

.gallery_container {
  display: grid;
  grid-template-columns: 33.33% 33.33% 33.33%;
  padding: 0.5em;
}

.gallery_item {
  text-align: center;
  cursor: pointer;
  padding: 0.3em;
}

.gallery_item img {
  border: 1px solid var(--border);
  max-width: 80%;
  height: auto;
  object-fit: cover;
}

.gallery_item:hover img { border: 1px solid purple; }

.gallery_item .desc {
  padding: 0.35em 0.2em 0.5em;
  font-size: smaller;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.1em;
  line-height: 1.25;
}

.gallery_item .desc .nick {
  color: var(--brown-dark);
  font-weight: 700;
  font-size: 0.95em;
}

.gallery_item .desc .tok {
  color: var(--muted);
  font-size: 0.85em;
  opacity: 0.85;
}

/* Lightbox — art left, story right (centered as a pair) */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5em;
  z-index: 1000;
  cursor: zoom-out;
  overflow: auto;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-panel {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1.25em;
  max-width: min(1040px, 94vw);
  width: auto;
  margin: auto;
  cursor: default;
}

.lightbox-art {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-art img,
.lightbox #lightbox-img {
  max-width: min(48vw, 520px);
  max-height: min(78vh, 640px);
  width: auto;
  height: auto;
  border: 2px solid var(--cream);
  display: block;
  margin: 0;
  object-fit: contain;
  cursor: default;
}

.lightbox-side {
  flex: 0 1 320px;
  width: min(320px, 36vw);
  min-width: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75em;
  max-height: min(78vh, 640px);
  overflow: hidden;
}

.lightbox-caption {
  color: var(--cream);
  font-size: 0.9em;
  text-align: left;
  margin: 0;
  line-height: 1.4;
  flex: 0 0 auto;
}

.lightbox-story {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85em 1em;
  background: rgba(255, 248, 238, 0.08);
  border: 1px solid rgba(198, 230, 7, 0.5);
  color: var(--cream);
  font-size: 0.88em;
  line-height: 1.5;
  text-align: left;
  cursor: default;
  scrollbar-width: thin;
}

.lightbox-story p {
  margin: 0 0 0.55em;
  color: inherit;
}

.lightbox-story p:last-child {
  margin-bottom: 0;
}

.lightbox-story .story-label {
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--neon);
  font-weight: 700;
  margin-bottom: 0.45em;
}

.lightbox-close {
  position: absolute;
  top: 0.75em;
  right: 1em;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 2em;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

@media (max-width: 720px) {
  .lightbox-panel {
    flex-direction: column;
    align-items: center;
  }

  .lightbox-art img,
  .lightbox #lightbox-img {
    max-width: min(92vw, 420px);
    max-height: 48vh;
  }

  .lightbox-side {
    max-width: min(92vw, 420px);
    max-height: 38vh;
    align-items: center;
  }

  .lightbox-caption {
    text-align: center;
  }

  .lightbox-story {
    text-align: center;
  }

  .lightbox-story .story-label {
    text-align: center;
  }
}

/* Trait Lab */
.trait-lab {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
  padding: 0.8em;
}

.composer-wrap {
  text-align: center;
}

.composer-canvas {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid var(--neon-deep);
  background: white;
  max-width: 18em;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--neon-soft);
}

.composer-canvas img,
.composer-canvas .composer-preview,
.composer-canvas .composer-pixel-fx {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: none;
  margin: 0;
  max-width: none;
  display: block;
}

.composer-canvas .composer-pixel-fx {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.composer-canvas.is-generating {
  outline: 2px solid var(--neon);
  outline-offset: 2px;
}

.composer-canvas.is-generating::after {
  content: 'Generating…';
  position: absolute;
  left: 50%;
  bottom: 0.45em;
  transform: translateX(-50%);
  font-size: 0.68em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(92, 26, 46, 0.72);
  padding: 0.2em 0.55em;
  pointer-events: none;
  z-index: 2;
}

.composer-canvas img:hover { border: none; }

.composer-empty {
  font-size: 0.8em;
  color: var(--muted);
  padding: 1em;
}

.composer-caption {
  font-size: 0.85em;
  color: var(--muted);
  margin: 0.4em 0 0 !important;
}

.composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  justify-content: center;
  margin-top: 0.6em;
}

.composer-actions .connect-button {
  font-size: 0.85em;
  padding: 0.45em 1.2em;
  background: var(--neon);
  color: var(--brown-dark);
  border: 1px solid var(--brown-dark);
  font-weight: 600;
}

.composer-actions .connect-button:hover:not(:disabled) {
  background: var(--neon-glow);
  color: var(--brown-dark);
}

.composer-actions .connect-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.trait-picker {
  border: 1px solid var(--neon-deep);
  background: #fff;
}

.trait-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 6px;
  background: var(--neon);
  border-bottom: 1px solid var(--neon-deep);
}

.trait-tab {
  font-size: 0.65em;
  padding: 4px 8px;
  border: 1px solid var(--brown-dark);
  background: rgba(255, 255, 255, 0.85);
  color: var(--brown-dark);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.trait-tab:hover {
  background: var(--neon-glow);
  border-color: var(--brown-dark);
}

.trait-tab.active {
  background: var(--brown-dark);
  border-color: var(--brown-dark);
  color: var(--neon);
  box-shadow: 0 0 8px rgba(198, 230, 7, 0.55);
}

.trait-tab span { opacity: 0.75; }

.trait-tab.active span {
  opacity: 0.9;
  color: var(--neon-soft);
}

.trait-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 4px;
  padding: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.trait-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid transparent;
  background: #fafafa;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

.trait-item:hover { border-color: var(--neon-deep); }
.trait-item.active {
  border-color: var(--neon-deep);
  background: var(--neon-soft);
  box-shadow: inset 0 0 0 1px var(--neon);
}

.trait-item img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border: 1px solid #ccc;
  max-width: none;
  margin: 0;
}

.trait-item img:hover { border-color: #ccc; }

.trait-item span {
  font-size: 0.55em;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Staking */
.stake-panel {
  margin: 0.5em 1em 1.1em;
  padding: 0 0.25em 0.5em;
}

/* display:grid/flex overrides native [hidden] — force hide until connect */
.stake-panel [hidden],
.stake-gated[hidden],
.stake-dashboard[hidden],
.stake-toolbar[hidden],
.stake-coverflow[hidden],
.stake-actions[hidden],
.stake-details[hidden],
.stake-wallet-chip[hidden] {
  display: none !important;
}

.stake-connect-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5em;
}

/* Connected → hover shows Disconnect */
#stake-connect.is-connected {
  position: relative;
  min-width: 7.5em;
}

#stake-connect.is-connected .stake-conn-hover {
  display: none;
}

#stake-connect.is-connected:hover,
#stake-connect.is-connected:focus-visible {
  background: #5c1a2e;
  color: #fff;
  border-color: #5c1a2e;
}

#stake-connect.is-connected:hover .stake-conn-idle,
#stake-connect.is-connected:focus-visible .stake-conn-idle {
  display: none;
}

#stake-connect.is-connected:hover .stake-conn-hover,
#stake-connect.is-connected:focus-visible .stake-conn-hover {
  display: inline;
}

/* Touch: no reliable hover — show Disconnect when connected on coarse pointers */
@media (hover: none) {
  #stake-connect.is-connected .stake-conn-idle {
    display: none;
  }
  #stake-connect.is-connected .stake-conn-hover {
    display: inline;
  }
  #stake-connect.is-connected {
    background: #5c1a2e;
    color: #fff;
    border-color: #5c1a2e;
  }
}

.stake-wallet-chip {
  font-size: 0.82em;
}

.stake-status {
  min-height: 1.2em;
  margin: 0.35em 0.5em 0.6em !important;
}

.stake-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0.5em 0 0.75em;
}

@media (max-width: 520px) {
  .stake-dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stake-stat {
  border: 1px solid var(--brown);
  background: #fff;
  padding: 0.55em 0.4em;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stake-stat.highlight {
  background: var(--neon-soft);
  border-color: var(--neon-deep);
}

.stake-stat-label {
  font-size: 0.65em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.stake-stat strong,
.stake-stat .slot-num {
  font-size: 1.15em;
  color: var(--brown-dark);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

/* Slot / odometer number scroll */
.slot-num {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 1.25em;
}

.slot-odometer {
  display: inline-flex;
  align-items: stretch;
  height: 1.25em;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--brown-dark);
  font-size: 1em;
  line-height: 1.25em;
}

.slot-digit {
  position: relative;
  display: inline-block;
  width: 0.62em;
  height: 1.25em;
  overflow: hidden;
}

.slot-digit.slot-sym {
  width: 0.32em;
}

.slot-digit.slot-sym .slot-static {
  display: block;
  height: 1.25em;
  line-height: 1.25em;
  text-align: center;
}

.slot-reel {
  display: flex;
  flex-direction: column;
  will-change: transform;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.slot-reel span {
  display: block;
  height: 1.25em;
  line-height: 1.25em;
  text-align: center;
  font-weight: 700;
}

.stake-stat.highlight .slot-odometer {
  color: var(--brown-dark);
}

/* brief blur kick on spin */
.slot-odometer.is-spinning .slot-reel {
  filter: blur(0.35px);
  transition:
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.55s ease;
}

.stake-stat-unit {
  font-size: 0.62em;
  color: var(--muted);
}

.stake-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 0.4em 0 0.65em;
}

.stake-btn-sm {
  font-size: 0.75em !important;
  padding: 0.4em 0.75em !important;
}

.stake-claim {
  background: var(--neon) !important;
  color: var(--brown-dark) !important;
  border-color: var(--brown-dark) !important;
}

.stake-claim:hover:not(:disabled) {
  background: var(--neon-glow) !important;
}

/* Coverflow (Originkit-style) for staked NFTs */
.stake-coverflow {
  --cf-w: min(410px, 88vw);
  --cf-h: min(412px, 88vw);
  position: relative;
  margin: 0.65em 0 0.4em;
  padding: 0.5em 0 0.25em;
  min-height: calc(var(--cf-h) + 3.5em);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cf-stage {
  position: relative;
  width: var(--cf-w);
  height: var(--cf-h);
  perspective: 1600px;
  transform-style: preserve-3d;
  margin: 0 auto;
}

.cf-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--cf-w);
  height: var(--cf-h);
  margin: 0;
  padding: 0;
  border: 2px solid #222;
  border-radius: 4px;
  overflow: hidden;
  background: #1a1a1a;
  cursor: pointer;
  font-family: inherit;
  transform-style: preserve-3d;
  transform-origin: center center;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.cf-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
  margin: 0;
  max-width: none;
  display: block;
  user-select: none;
  pointer-events: none;
}

.cf-card .stake-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  color: #fff;
  font-size: 0.85em;
  font-weight: 700;
  z-index: 2;
}

.cf-card .stake-badge {
  font-size: 0.72em;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.cf-card.staked .stake-badge {
  background: var(--neon);
  color: var(--brown-dark);
}

.cf-card.selected {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px var(--neon), 0 12px 40px rgba(0, 0, 0, 0.35);
}

.cf-card.selected::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 1.6em;
  height: 1.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--neon);
  color: var(--brown-dark);
  font-size: 0.95em;
  font-weight: 900;
  border: 1px solid var(--brown-dark);
}

.cf-card .cf-dim {
  position: absolute;
  inset: 0;
  background: #000;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 1;
}

.cf-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-70%);
  z-index: 5;
  width: 2.2em;
  height: 2.2em;
  border: 1px solid var(--brown-dark);
  background: var(--neon);
  color: var(--brown-dark);
  font-size: 1.4em;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  border-radius: 2px;
}

.cf-nav:hover {
  background: var(--neon-glow);
}

.cf-prev { left: 0.15em; }
.cf-next { right: 0.15em; }

.cf-share-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
  justify-content: center;
  margin-top: 0.75em;
  width: 100%;
}

.cf-hint {
  margin: 0.45em 0 0 !important;
  width: 100%;
}

@media (max-width: 480px) {
  .stake-coverflow {
    --cf-w: min(300px, 78vw);
    --cf-h: min(300px, 78vw);
  }
  .cf-nav {
    width: 1.9em;
    height: 1.9em;
    font-size: 1.2em;
  }
}

.stake-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  justify-content: center;
  margin: 0.55em 0 0.4em;
}

.stake-details {
  margin-top: 0.75em;
  padding: 0.65em 0.85em;
  border-top: 1px solid #e5e5e5;
  text-align: left;
  font-size: 0.85em;
}

.stake-details p {
  margin: 0.3em 0;
}

.stake-details ul {
  margin: 0.35em 0 0.5em 1.2em;
  padding: 0;
  color: var(--text);
}

.stake-details li {
  margin: 0.25em 0;
}

.addr-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  margin-top: 0.65em;
}

.addr-chip-label {
  font-size: 0.75em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.addr-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.35em 0.65em 0.35em 0.75em;
  border: 1px solid var(--brown-dark);
  background: var(--neon);
  color: var(--brown-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
}

.addr-chip:hover {
  background: var(--neon-glow);
}

.addr-chip.copied {
  background: var(--brown-dark);
  color: var(--neon);
}

.addr-chip-text {
  letter-spacing: 0.01em;
}

.addr-chip-action {
  font-size: 0.72em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2em 0.45em;
  border-left: 1px solid rgba(61, 15, 30, 0.35);
  padding-left: 0.55em;
  opacity: 0.9;
}

.addr-chip.copied .addr-chip-action {
  border-left-color: rgba(198, 230, 7, 0.4);
}

/* Holders Leaderboard — entire #leaderboard is [hidden] until user stakes */
#leaderboard[hidden] {
  display: none !important;
}

.lb-body {
  padding: 0.5em 0.75em 0.85em;
}

.lb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
  margin-bottom: 0.55em;
}

.lb-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--brown);
  background: #fff;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
}

.lb-table th,
.lb-table td {
  padding: 0.55em 0.65em;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.lb-table th {
  background: var(--neon);
  color: var(--brown-dark);
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
}

.lb-table tbody tr:last-child td {
  border-bottom: none;
}

.lb-table tbody tr:hover {
  background: #faf8f4;
}

.lb-table tr.lb-you {
  background: var(--neon-soft);
  font-weight: 700;
}

.lb-table tr.lb-you:hover {
  background: var(--neon-soft);
}

.lb-rank {
  width: 2.2em;
  font-weight: 800;
  color: var(--brown-dark);
}

.lb-wallet {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.lb-held,
.lb-staked {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.lb-empty {
  text-align: center;
  color: var(--muted);
  padding: 1.25em 0.5em !important;
}

.lb-footnote {
  margin: 0.55em 0.15em 0 !important;
}

#lb-gate-note {
  margin-top: 0.1em;
}

/* Whitelist / Mint */
.mint-box {
  padding: 1em;
  background: white;
  text-align: center;
}

.wl-form {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  align-items: center;
  max-width: 28em;
  margin: 0 auto;
}

.wl-form input {
  width: 100%;
  padding: 0.5em;
  font-size: 0.9em;
  border: 1px solid var(--border);
  font-family: inherit;
}

.wl-form input:focus {
  outline: none;
  border-color: var(--brown);
}

.connect-button {
  padding: 0.5em 1.5em;
  font-size: 1em;
  background: var(--tan);
  color: var(--brown);
  border: 1px solid var(--brown);
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
}

.connect-button:hover {
  background: var(--tan-hover);
  color: var(--brown-dark);
}

.wl-result {
  margin-top: 1em;
  padding: 0.8em;
  font-size: 0.95em;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
}

.wl-result.success { background: #f0fff0; }
.wl-result.fail { background: #fff0f0; }
.wl-result span { font-size: 0.85em; color: var(--muted); }

.amount-minted { font-style: italic; color: var(--muted); }
.current-supply { font-weight: bold; }

.mint-details {
  text-align: left;
  max-width: 20em;
  margin: 0.5em 0;
}

.mint-reserve-button a {
  color: var(--brown);
  font-weight: bold;
  font-size: 1.1em;
}

.mint-reserve-button a:hover { color: red; }

.mint-with-avatar {
  display: flex;
  align-items: stretch;
  gap: 1em;
  padding: 1em;
  background: white;
}

.mint-avatar {
  width: 180px;
  height: auto;
  object-fit: cover;
  border: 2px solid var(--maroon);
  flex-shrink: 0;
  margin: 0;
}

.mint-info { flex: 1; min-width: 0; }

.site-footer {
  position: relative;
  z-index: 1;
  margin-top: 2em;
  padding: 2.5em 1.5em 2em;
  background: #C6E607;
  color: var(--brown-dark);
  text-align: center;
  border-top: 1px solid var(--maroon);
}

.footer-about {
  max-width: 32em;
  margin: 0 auto 1em;
  line-height: 1.5;
  color: var(--brown-dark);
}

.footer-links {
  font-size: 1.05em;
  margin: 0 0 1em;
}

.footer-links span {
  margin: 0 0.5em;
  color: var(--brown-dark);
}

.site-footer a {
  color: var(--brown-dark);
  font-weight: bold;
}

.site-footer a:hover { color: var(--maroon); }

.footer-fine {
  font-size: 0.8em;
  margin: 0;
}

.stake-soft { font-size: 0.95em; }

.connect-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Mobile / tablet ── */
@media only screen and (max-width: 720px) {
  body {
    font-size: 1.05em;
    background-attachment: scroll, scroll;
  }

  .banner-top {
    margin: 0.6em 0.5em 0.4em;
  }

  .banner-img {
    max-width: 100%;
    border-width: 1px;
  }

  .page-wrap {
    max-width: 100%;
    padding: 0;
  }

  .m_box,
  .m_box_red {
    margin: 0.65em 0.5em;
  }

  .m_box_bar h2,
  .m_box_bar_red h2 {
    font-size: 1em;
    padding: 0.15em 0;
  }

  p {
    margin: 0.45em 0.75em;
  }

  .intro {
    font-size: 0.98em;
    line-height: 1.45;
  }

  .links {
    font-size: 0.95em;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25em 0.4em;
    justify-content: center;
    align-items: center;
  }

  .hero-img {
    max-width: min(72vw, 14em);
  }

  img {
    max-width: 100%;
  }

  /* Gallery — compact search (not full-height column) */
  .gallery-search {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: stretch;
    margin: 0.4em 0.6em 0.35em;
    gap: 0.35em;
  }

  .gallery-search input {
    flex: 1 1 auto;
    max-width: none;
    width: auto;
    min-width: 0;
    box-sizing: border-box;
    font-size: 16px; /* prevent iOS zoom on focus */
    line-height: 1.25;
    padding: 0.4em 0.55em;
    min-height: 0;
    height: auto;
  }

  .gallery-search-btn {
    width: auto;
    flex: 0 0 auto;
    min-height: 0;
    padding: 0.4em 0.75em !important;
    font-size: 0.85em !important;
    white-space: nowrap;
  }

  .gallery_container {
    grid-template-columns: 1fr 1fr;
    gap: 0.15em;
    padding: 0.35em 0.4em 0.6em;
  }

  .gallery_item {
    padding: 0.2em;
  }

  .gallery_item img {
    max-width: 92%;
  }

  .gallery_item .desc .nick {
    font-size: 0.82em;
    word-break: break-word;
  }

  .gallery_item .desc .tok {
    font-size: 0.78em;
  }

  /* Trait lab */
  .trait-lab {
    padding: 0.55em;
    gap: 0.65em;
  }

  .composer-canvas {
    max-width: min(88vw, 18em);
    border-width: 2px;
  }

  .composer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .composer-actions .connect-button {
    width: 100%;
    min-height: 2.7em;
    box-sizing: border-box;
  }

  .trait-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding: 6px 8px;
  }

  .trait-tabs::-webkit-scrollbar {
    display: none;
  }

  .trait-tab {
    flex: 0 0 auto;
    font-size: 0.62em;
    padding: 0.45em 0.65em;
    min-height: 2.2em;
  }

  .trait-items {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    max-height: 200px;
    gap: 6px;
  }

  .trait-item img {
    width: 52px;
    height: 52px;
  }

  .trait-item span {
    font-size: 0.58em;
  }

  /* Staking */
  .stake-panel {
    margin: 0.4em 0.5em 0.9em;
    padding: 0;
  }

  .stake-soft {
    font-size: 0.9em;
    line-height: 1.4;
  }

  .stake-connect-row {
    flex-direction: column;
    width: 100%;
    gap: 0.5em;
  }

  .stake-connect-row .connect-button,
  .stake-connect-row .addr-chip {
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    min-height: 2.75em;
  }

  .stake-dashboard {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .stake-stat {
    padding: 0.65em 0.35em;
  }

  .stake-stat-label {
    font-size: 0.6em;
  }

  .stake-stat strong,
  .stake-stat .slot-num {
    font-size: 1.05em;
  }

  .stake-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .stake-btn-sm {
    width: 100%;
    min-height: 2.6em;
    font-size: 0.8em !important;
    box-sizing: border-box;
  }

  .stake-toolbar .stake-claim {
    grid-column: 1 / -1;
  }

  .stake-coverflow {
    --cf-w: min(78vw, 300px);
    --cf-h: min(78vw, 300px);
    min-height: calc(var(--cf-h) + 5.5em);
    width: 100%;
    overflow: hidden;
  }

  .cf-nav {
    width: 2.4em;
    height: 2.4em;
    font-size: 1.25em;
    top: calc(50% - 1.6em);
    transform: none;
  }

  .cf-prev { left: 0.1em; }
  .cf-next { right: 0.1em; }

  .cf-share-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 0 0.25em;
  }

  .cf-share-bar .connect-button {
    width: 100%;
    min-height: 2.6em;
    box-sizing: border-box;
  }

  .cf-share-bar .stake-claim {
    grid-column: 1 / -1;
  }

  .cf-hint {
    font-size: 0.8em;
    padding: 0 0.5em;
  }

  .stake-actions {
    flex-direction: column;
    align-items: stretch;
    padding: 0 0.15em;
  }

  .stake-actions .connect-button {
    width: 100%;
    min-height: 2.7em;
    box-sizing: border-box;
  }

  .stake-details {
    font-size: 0.82em;
    padding: 0.55em 0.65em;
  }

  .addr-chip-row {
    flex-direction: column;
    align-items: stretch;
  }

  .addr-chip {
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
    min-height: 2.6em;
  }

  /* Mint */
  .mint-with-avatar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.85em 0.75em;
    gap: 0.75em;
  }

  .mint-avatar {
    width: min(70vw, 200px);
    max-width: 100%;
  }

  .mint-info {
    text-align: left;
    width: 100%;
  }

  .mint-details {
    max-width: none;
    margin: 0.4em 0;
    padding-left: 1.1em;
  }

  .amount-minted {
    text-align: center;
  }

  .mint-reserve-button {
    text-align: center;
  }

  .wl-form {
    max-width: none;
    padding: 0 0.25em;
  }

  .wl-form input {
    font-size: 16px;
    min-height: 2.6em;
    box-sizing: border-box;
  }

  .wl-form .connect-button {
    width: 100%;
    min-height: 2.7em;
  }

  .whitelist-img {
    max-width: 92%;
  }

  .lb-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .lb-toolbar .connect-button {
    width: 100%;
    min-height: 2.6em;
  }

  .lb-table {
    font-size: 0.8em;
  }

  .lb-table th,
  .lb-table td {
    padding: 0.5em 0.4em;
  }

  .compare-wide {
    margin: 0.3em auto;
  }

  .site-footer {
    padding: 1.75em 1em 2em;
    padding-bottom: max(2em, env(safe-area-inset-bottom));
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35em 0.5em;
    font-size: 0.98em;
  }

  .footer-links span {
    margin: 0 0.15em;
  }

  /* Lightbox mobile */
  .lightbox {
    padding: 0.75em 0.6em;
    align-items: flex-start;
    padding-top: max(0.75em, env(safe-area-inset-top));
  }

  .lightbox-panel {
    flex-direction: column;
    align-items: center;
    gap: 0.75em;
    max-width: 100%;
  }

  .lightbox-art img,
  .lightbox #lightbox-img {
    max-width: min(92vw, 400px);
    max-height: 46vh;
  }

  .lightbox-side {
    width: min(92vw, 400px);
    max-width: min(92vw, 400px);
    max-height: 40vh;
    min-width: 0;
    align-items: center;
  }

  .lightbox-caption {
    font-size: 0.82em;
    text-align: center;
  }

  .lightbox-story {
    font-size: 0.84em;
    padding: 0.7em 0.8em;
    text-align: center;
  }

  .lightbox-story .story-label {
    text-align: center;
  }

  .lightbox-close {
    top: 0.4em;
    right: 0.55em;
    font-size: 1.85em;
    min-width: 2.2em;
    min-height: 2.2em;
  }
}

@media only screen and (max-width: 380px) {
  body {
    font-size: 1em;
  }

  .gallery_item .desc .nick {
    font-size: 0.75em;
  }

  .stake-coverflow {
    --cf-w: min(84vw, 280px);
    --cf-h: min(84vw, 280px);
  }

  .stake-toolbar {
    grid-template-columns: 1fr;
  }

  .stake-toolbar .stake-claim {
    grid-column: auto;
  }
}

/* Prefer larger touch targets on coarse pointers */
@media (hover: none) and (pointer: coarse) {
  .connect-button,
  .trait-tab,
  .gallery-search-btn,
  .cf-nav,
  .addr-chip {
    min-height: 2.75em;
  }

  .gallery_item:hover img {
    border-color: var(--border);
  }

  a:hover {
    color: blue;
  }
}