@font-face {
  font-family: "Press Start 2P";
  src: url("/fonts/press-start-2p.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("/fonts/silkscreen.ttf") format("truetype");
  font-display: swap;
}
:root {
  --void: #07060a;
  --ink: #f4ead2;
  --mute: #8a7d68;
  --wood: #3a2a1c;
  --frame: #e4d3b0;
  --flash: #ff3b6a;
  --acid: #7cff6b;
  --gold: #ffe56a;
  --tile-a: #14110d;
  --tile-b: #1c1812;
  --cell: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--void);
  color: var(--ink);
  font-family: "Silkscreen", monospace;
  image-rendering: pixelated;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { image-rendering: pixelated; image-rendering: crisp-edges; }

.noise, .scan {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 80;
}
.noise {
  opacity: .07;
  background-image: repeating-conic-gradient(#fff 0 25%, #0000 0 50%);
  background-size: 3px 3px;
}
.scan {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, .18) 2px 3px
  );
}

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: #0b090c;
  border-bottom: 4px solid var(--wood);
}
.brand {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--gold);
  min-width: 0;
}
.top nav {
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  min-width: 0;
}
.top nav a { font-size: 12px; color: var(--mute); flex-shrink: 0; }
.top nav a:hover { color: var(--gold); }
.wallet-chip {
  border: 0;
  background: #1d1b22;
  color: var(--ink);
  padding: 8px 10px;
  cursor: pointer;
  font-size: 11px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.payee {
  font-size: 10px;
  word-break: break-all;
  color: var(--gold);
  user-select: all;
}
.wallet-chip.on,
.fire.on {
  background: #1d3a22;
  color: var(--acid);
}
.chain-pill {
  padding: 6px 8px;
  background: var(--gold);
  color: #1a1208;
  font-size: 11px;
}

.hall {
  position: relative;
  min-height: 100vh;
  padding: 18px 16px 72px;
  overflow: hidden;
}
.floor {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 0;
  height: 38%;
  background:
    repeating-linear-gradient(90deg, var(--tile-a) 0 48px, var(--tile-b) 48px 96px),
    repeating-linear-gradient(0deg, var(--tile-a) 0 48px, var(--tile-b) 48px 96px);
  background-blend-mode: multiply;
  transform: perspective(400px) rotateX(62deg);
  transform-origin: 50% 100%;
  border-top: 4px solid #2a2118;
}
.hall-copy {
  position: relative;
  z-index: 6;
  text-align: center;
  pointer-events: none;
}
.hall-copy .cta, .hall-copy a { pointer-events: auto; }
.eyebrow {
  color: var(--flash);
  font-size: 10px;
  letter-spacing: .18em;
  margin-bottom: 14px;
}
.hall h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(28px, 6vw, 56px);
  color: var(--gold);
  line-height: 1.15;
}
.lead {
  margin: 16px auto 0;
  max-width: 620px;
  color: var(--mute);
  font-size: 13px;
  line-height: 1.7;
}
.ring-space { height: 430px; }
.stats {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 22px;
  align-items: stretch;
}
.stats i {
  display: grid;
  min-width: 140px;
  padding: 10px 12px;
  background: #120f0c;
  border: 4px solid var(--wood);
  font-style: normal;
  text-align: left;
}
.stats b {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--acid);
}
.stats span { font-size: 10px; color: var(--mute); }

.ring-wrap {
  position: absolute;
  left: -8%;
  right: -8%;
  top: 40px;
  height: 680px;
  perspective: 520px;
  perspective-origin: 50% 62%;
  z-index: 2;
}
.ring {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  cursor: grab;
  touch-action: none;
}
.ring:active { cursor: grabbing; }
.card {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 132px;
  height: 210px;
  margin: -105px 0 0 -66px;
  background: #0c0a08;
  border: 8px solid var(--frame);
  outline: 4px solid var(--wood);
  transform-style: preserve-3d;
  backface-visibility: hidden;
}
.card .pic {
  position: relative;
  display: block;
  height: 168px;
}
.card img {
  width: 100%;
  height: 168px;
  object-fit: cover;
  background: #ece6d6;
  display: block;
}
.card .tag {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #16120d;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: .08em;
}

.cta {
  position: relative;
  z-index: 4;
  display: block;
  width: max-content;
  margin: 8px auto 0;
  padding: 14px 18px;
  background: var(--flash);
  color: #fff8ee;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  box-shadow: 6px 6px 0 #6b1028;
}
.cta:hover { translate: 2px 2px; box-shadow: 4px 4px 0 #6b1028; }
.hint {
  position: relative;
  z-index: 4;
  text-align: center;
  margin-top: 14px;
  color: var(--mute);
  font-size: 10px;
}

.gun {
  padding: 40px 16px 64px;
  background: #0b0a0d;
  border-top: 4px solid var(--wood);
  border-bottom: 4px solid var(--wood);
}
.console {
  max-width: 880px;
  margin: 0 auto;
  background: #101014;
  border: 4px solid #2c2a32;
}
.console-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #19181f;
  color: var(--acid);
  font-size: 11px;
}
.lamp {
  width: 10px;
  height: 10px;
  background: var(--acid);
}
.lamp.dim { background: #3a3a28; }
.console-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 0;
}
.readout, .controls { padding: 18px; }
.readout { border-right: 4px solid #2c2a32; }
.k { color: var(--mute); font-size: 10px; margin-top: 12px; }
.k:first-child { margin-top: 0; }
.v { margin-top: 6px; font-size: 13px; line-height: 1.5; }
.v.big {
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  color: var(--gold);
}
.v.neon { color: var(--acid); }
.stock-cuts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.stock-cuts i { min-width: 0; }
.stock-cuts .k { display: block; margin: 0; }
.stock-cuts .v {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}
.controls label, .modal-lab { display: block; font-size: 10px; color: var(--mute); }
textarea {
  width: 100%;
  margin: 8px 0 6px;
  padding: 10px;
  border: 4px solid var(--wood);
  background: #120f0c;
  color: var(--ink);
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
}
.stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  margin: 10px 0 16px;
}
.stepper button, .stepper input, .fire {
  border: 0;
  background: #1d1b22;
  height: 44px;
  text-align: center;
}
.stepper input { width: 100%; }
.stepper.locked button,
.stepper.locked input {
  opacity: .45;
  cursor: not-allowed;
}
#qtyLock {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--mute, #8a8074);
}
#deployTx {
  width: 100%;
  margin: 0 0 10px;
  padding: 10px;
  border: 4px solid var(--wood);
  background: #120f0c;
  color: var(--ink);
}
.fire {
  width: 100%;
  margin-bottom: 10px;
  cursor: pointer;
}
.fire.hot {
  background: var(--flash);
  color: #fff8ee;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  box-shadow: 5px 5px 0 #6b1028;
}
.fire:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.fine, .log { font-size: 10px; color: var(--mute); line-height: 1.6; }
.log { min-height: 48px; margin-top: 10px; color: var(--acid); }

.chain { padding: 36px 16px 48px; border-top: 4px solid var(--wood); }
.ledger { max-width: 880px; margin: 0 auto; display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding: 10px;
  background: #120f0c;
  border: 4px solid var(--wood);
}
.row img { width: 72px; height: 72px; object-fit: cover; background: #ece6d6; }
.row b { color: var(--gold); font-size: 12px; }
.row p { margin-top: 6px; font-size: 12px; line-height: 1.5; }
.row a { color: var(--acid); word-break: break-all; }
.row .txid { margin-top: 8px; font-size: 10px; }
.onchain {
  margin: 10px 0;
  padding: 8px;
  background: #0d1a10;
  border: 3px solid var(--acid);
  color: var(--acid);
  font-size: 11px;
  line-height: 1.5;
}
.carry {
  margin: 10px 0;
  color: var(--gold);
  font-size: 11px;
}
.swap-box { margin: 0 auto 20px; }
.wall { padding: 36px 16px 80px; }
.wall-head { max-width: 1100px; margin: 0 auto 20px; }
.wall h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  color: var(--gold);
}
.wall-head p { margin-top: 10px; color: var(--mute); font-size: 12px; }
.wall-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
}
.wall-tools input, .wall-tools select {
  height: 36px;
  border: 4px solid var(--wood);
  background: #120f0c;
  padding: 0 8px;
  min-width: 180px;
}
#wallCount { font-size: 11px; color: var(--mute); }
.frames {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  max-width: 1100px;
  margin: 0 auto;
}
.frame {
  position: relative;
  background: var(--frame);
  padding: 6px 6px 18px;
  outline: 3px solid var(--wood);
  cursor: pointer;
}
.frame .pic {
  position: relative;
  display: block;
}
.frame img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #ece6d6;
  display: block;
}
.sold-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  rotate: -18deg;
  background: var(--flash);
  color: #fff8ee;
  font-family: "Press Start 2P", monospace;
  font-style: normal;
  font-size: 8px;
  line-height: 1;
  padding: 6px 5px;
  box-shadow: 3px 3px 0 #6b1028;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
}
.sold-mark.big { font-size: 16px; padding: 10px 8px; }
.frame.sold { outline-color: var(--flash); }
.frame.sold img { filter: grayscale(1) brightness(.55); }
.frame.sold b { color: var(--flash); }
.frame.vaulted { outline-color: var(--acid); }
.frame.vaulted b { color: #1a4a22; }
.sold-line {
  margin: 10px 0;
  color: var(--flash);
  font-size: 11px;
}
.modal-card .pic { position: relative; }
.modal-card .pic.sold img { filter: grayscale(1) brightness(.55); }
.frame b {
  display: block;
  margin-top: 6px;
  font-size: 9px;
  color: #2a2118;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.frame em {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 1;
  background: #120f0c;
  color: var(--gold);
  font-style: normal;
  font-size: 8px;
  line-height: 1;
  padding: 3px 4px;
  pointer-events: none;
}
.frame.sold em { color: var(--flash); }
.frame.owned { outline-color: var(--acid); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #000c;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(560px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #120f0c;
  border: 6px solid var(--frame);
  outline: 4px solid var(--wood);
  padding: 12px;
  position: relative;
}
.modal-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #ece6d6;
}
.modal-meta { padding: 12px 4px 4px; }
.modal-meta p { color: var(--mute); font-size: 11px; }
.rarity-box {
  margin: 12px 0;
  padding: 10px;
  background: #0c0a08;
  outline: 3px solid var(--wood);
}
.rarity-top {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
  margin-bottom: 10px;
}
.rarity-top i { font-style: normal; display: block; }
.rarity-top span {
  display: block;
  color: var(--mute);
  font-size: 9px;
  letter-spacing: .06em;
}
.rarity-top b {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-size: 13px;
}
.rarity-top .neon { color: var(--acid); }
.rare-bars { display: grid; gap: 6px; }
.rare-bars .bar {
  display: grid;
  grid-template-columns: 92px 1fr 44px;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  color: var(--mute);
}
.rare-bars .track {
  display: block;
  height: 8px;
  background: #2a2118;
}
.rare-bars .bar i {
  display: block;
  height: 8px;
  background: var(--gold);
  box-shadow: 2px 2px 0 #6b5310;
}
.rare-bars .bar b {
  color: var(--ink);
  text-align: right;
  font-size: 9px;
}
.modal-meta h3 {
  margin: 8px 0;
  font-family: "Press Start 2P", monospace;
  font-size: 14px;
  line-height: 1.4;
}
.x {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border: 0;
  background: var(--flash);
  cursor: pointer;
}

.wallet-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: #000c;
  display: grid;
  place-items: center;
  padding: 16px;
}
.wallet-modal[hidden] { display: none; }
.wallet-card {
  width: min(420px, 100%);
  max-height: 88dvh;
  overflow: auto;
  background: #120f0c;
  border: 6px solid var(--frame);
  outline: 4px solid var(--wood);
  padding: 16px 12px 12px;
  position: relative;
}
.wallet-card h3 {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--gold);
  margin: 8px 36px 10px 4px;
  line-height: 1.5;
}
.wallet-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.wallet-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 0;
  background: #1d1b22;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}
.wallet-opt:hover, .wallet-opt:focus { background: #2a2730; color: var(--gold); }
.wallet-opt .on { color: var(--acid); font-size: 10px; }
.wallet-opt .off { color: var(--mute); font-size: 10px; }

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  border-top: 4px solid var(--wood);
  color: var(--mute);
  font-size: 10px;
}

@media (max-width: 760px) {
  .top {
    grid-template-columns: 1fr auto auto;
    gap: 8px 10px;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .top nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .top nav::-webkit-scrollbar { display: none; }
  .top nav a { font-size: 11px; }
  .brand { font-size: 11px; }
  .wallet-chip {
    max-width: 38vw;
    font-size: 10px;
    padding: 8px;
  }
  .chain-pill { font-size: 10px; padding: 6px 7px; }

  .hall {
    min-height: 0;
    padding: 12px 12px 36px;
  }
  .hall h1 { font-size: clamp(22px, 9vw, 40px); }
  .lead { font-size: 12px; margin-top: 12px; padding: 0 4px; }
  .eyebrow { font-size: 9px; }
  .stats { gap: 6px; margin-top: 14px; }
  .stats i {
    min-width: 0;
    flex: 1 1 28%;
    padding: 8px;
  }
  .stats b { font-size: 10px; }
  .ring-wrap {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: 100%;
    height: min(58vw, 300px);
    min-height: 220px;
    margin: 6px 0 4px;
    perspective: 380px;
  }
  .ring-space { display: none; }
  .card {
    width: 88px;
    height: 140px;
    margin: -70px 0 0 -44px;
    border-width: 6px;
    outline-width: 3px;
  }
  .card .pic, .card img { height: 106px; }
  .card .tag { height: 28px; font-size: 9px; }
  .floor { height: 26%; }
  .cta {
    width: calc(100% - 24px);
    max-width: 280px;
    text-align: center;
    font-size: 10px;
    padding: 14px 12px;
  }

  .gun, .chain, .wall { padding: 24px 12px 36px; }
  .console-grid { grid-template-columns: 1fr; }
  .readout { border-right: 0; border-bottom: 4px solid #2c2a32; }
  .readout, .controls { padding: 14px; }
  .v { font-size: 12px; word-break: break-word; }
  .v.big { font-size: 13px; line-height: 1.35; }
  .stepper { grid-template-columns: 48px 1fr 48px; }
  .stepper button, .stepper input, .fire, textarea, .wall-tools input, .wall-tools select {
    font-size: 16px;
  }
  .fire.hot { font-size: 11px; }
  .wall-tools { flex-direction: column; align-items: stretch; }
  .wall-tools input, .wall-tools select { min-width: 0; width: 100%; }
  .frames { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
  .row { grid-template-columns: 56px 1fr; }
  .row img { width: 56px; height: 56px; }
  .rare-bars .bar { grid-template-columns: 64px 1fr 40px; }
  .rarity-top { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .modal {
    padding: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    align-items: end;
  }
  .modal-card {
    width: 100%;
    max-height: 88dvh;
    border-width: 4px;
    outline-width: 3px;
  }
  .modal-meta h3 { font-size: 12px; }
  .foot { justify-content: center; }
}

@media (max-width: 420px) {
  .ring-wrap {
    height: 210px;
    min-height: 200px;
    perspective: 320px;
  }
  .card {
    width: 72px;
    height: 116px;
    margin: -58px 0 0 -36px;
    border-width: 5px;
  }
  .card .pic, .card img { height: 86px; }
  .card .tag { height: 24px; font-size: 8px; }
  .frames { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .frame { padding: 4px 4px 12px; }
  .frame b { font-size: 8px; }
}
