@font-face {
  font-family: "Tiny5";
  src: url("assets/Tiny5-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Quetine";
  src: url("Quetine.otf") format("opentype");
  font-display: swap;
}

:root {
  --bg: #17131f;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: rgba(255, 255, 255, 0.065);
  --ink: #f5f0ff;
  --muted: #a99db8;
  --line: rgba(188, 176, 210, 0.18);
  --line-strong: rgba(188, 176, 210, 0.32);
  --green: #76ee45;
  --gold: #ffc24b;
  --pink: #df3a9b;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(223, 58, 155, 0.1), transparent 28rem),
    radial-gradient(circle at 90% 18%, rgba(118, 238, 69, 0.08), transparent 25rem),
    var(--bg);
  color: var(--ink);
  font-family: "Tiny5", Arial, sans-serif;
  letter-spacing: 0;
}

button,
select,
a {
  font: inherit;
}

a {
  color: var(--gold);
  text-decoration: none;
}

a:hover,
button:hover {
  color: var(--green);
}

.market-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  gap: 18px;
  align-items: center;
  padding: 14px max(16px, calc((100% - 1320px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(23, 19, 31, 0.9);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
}

.brand img {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  object-fit: cover;
  image-rendering: pixelated;
}

.market-header nav {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 2vw, 24px);
  overflow-x: auto;
  white-space: nowrap;
}

.market-header nav a {
  color: var(--muted);
}

.market-header nav a:hover,
.market-header nav a[aria-current="page"] {
  color: var(--ink);
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 34px;
  min-height: 34px;
  padding: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--ink);
}

.raffle-callout {
  display: inline-block;
  justify-self: end;
  color: #ff2323;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.raffle-callout:hover {
  animation: raffleWiggle 0.42s steps(2, end) infinite;
  color: #ff6b57;
}

@keyframes raffleWiggle {
  0%,
  100% {
    transform: translateX(0) rotate(0deg);
  }

  25% {
    transform: translateX(-2px) rotate(-2deg);
  }

  50% {
    transform: translateX(2px) rotate(2deg);
  }

  75% {
    transform: translateX(-1px) rotate(-1deg);
  }
}

.utility-shell,
.utility-footer {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
}

.collage-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 500px);
  gap: clamp(18px, 4vw, 44px);
  align-items: start;
  padding: clamp(26px, 5vw, 62px) 0 26px;
}

.tool-panel,
.canvas-panel {
  border-top: 1px solid var(--line);
  background: transparent;
}

.tool-panel {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding-top: 22px;
}

.canvas-panel {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 10px;
  padding-top: 22px;
  justify-items: stretch;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--green);
  font-size: 0.9rem;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  font-size: clamp(2.65rem, 6vw, 5.35rem);
  line-height: 0.86;
}

h2 {
  color: var(--ink);
  font-size: clamp(1.25rem, 2.2vw, 1.8rem);
  line-height: 0.95;
}

.intro {
  max-width: 72ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(0.92rem, 1.35vw, 1.05rem);
  line-height: 1.35;
}

.controls,
.picker-panel {
  display: grid;
  gap: 12px;
}

.wallet-row {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 10px;
}

.format-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.format-options label,
.check-field,
.select-field {
  min-width: 0;
}

.format-options label {
  display: block;
  cursor: pointer;
}

.format-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.format-options span {
  display: grid;
  gap: 5px;
  min-height: 78px;
  align-content: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  text-transform: uppercase;
}

.format-options small {
  color: var(--muted);
  font-size: 0.72rem;
}

.format-options input:checked + span {
  border-color: rgba(118, 238, 69, 0.7);
  background: rgba(37, 67, 51, 0.72);
  color: var(--green);
}

.studio-options {
  display: grid;
  grid-template-columns: minmax(130px, 190px) minmax(180px, 1fr);
  gap: 10px;
  align-items: end;
}

.select-field,
.check-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  text-transform: uppercase;
}

.check-field {
  min-height: 38px;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.check-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.select-field > span {
  font-size: 0.78rem;
  color: var(--muted);
}

.collage-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, max-content));
  gap: 10px;
  align-items: center;
}

select,
button,
.status {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

select {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg);
  color: var(--ink);
}

button {
  padding: 7px 11px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-transform: uppercase;
}

button:hover {
  border-color: rgba(118, 238, 69, 0.55);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#connectButton,
#shuffleButton,
#selectAllButton,
#downloadButton {
  background: var(--green);
  color: #111018;
}

#selectAllButton,
#clearSelectionButton {
  background: var(--surface-strong);
  color: var(--gold);
}

#clearSelectionButton {
  color: var(--gold);
}

.status {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  background: rgba(37, 67, 51, 0.68);
  color: #d6ffe4;
  line-height: 1.2;
}

.status[data-type="warning"] {
  background: rgba(79, 59, 42, 0.72);
  color: #ffe0b8;
}

.status[data-type="success"] {
  background: rgba(37, 67, 51, 0.72);
  color: #d6ffe4;
}

.wallet-status {
  background: var(--surface);
  color: var(--muted);
}

.picker-panel {
  margin-top: 4px;
}

.picker-panel .intro {
  margin-top: 0;
  font-size: 0.92rem;
}

.token-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, 76px);
  grid-auto-rows: 88px;
  gap: 8px;
  max-height: 540px;
  overflow: auto;
  padding-right: 4px;
  align-items: start;
  align-content: start;
}

.nft-token {
  display: grid;
  grid-template-rows: 62px 12px;
  gap: 5px;
  justify-items: center;
  align-content: start;
  width: 76px;
  height: 88px;
  min-height: 88px;
  padding: 6px 5px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--gold);
  box-shadow: none;
  overflow: hidden;
}

.nft-token img {
  display: block;
  width: 62px;
  height: 62px;
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: pixelated;
  flex: none;
}

.nft-token span {
  width: 100%;
  color: var(--ink);
  font-size: 0.72rem;
  line-height: 1;
  text-align: center;
}

.nft-token.is-selected {
  border-color: rgba(118, 238, 69, 0.7);
  background: rgba(37, 67, 51, 0.72);
}

.actions {
  display: flex;
  flex-wrap: wrap;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  max-height: calc(100svh - 150px);
  background: #ffffff;
  image-rendering: pixelated;
  object-fit: contain;
}

canvas[data-format="wallpaper"] {
  width: min(100%, 300px);
  justify-self: center;
}

canvas[data-format="feed"] {
  width: min(100%, 430px);
  justify-self: center;
}

.utility-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 900px) {
  .collage-shell {
    grid-template-columns: 1fr;
  }

  .canvas-panel {
    position: static;
  }

  .token-list {
    max-height: none;
  }

  canvas {
    max-height: none;
  }
}

@media (max-width: 540px) {
  .utility-shell,
  .utility-footer {
    width: min(100% - 20px, 1320px);
  }

  .brand span {
    display: none;
  }

  .market-header {
    grid-template-columns: auto auto;
    justify-content: space-between;
    padding-inline: 12px;
  }

  .menu-toggle {
    display: grid;
    align-content: space-between;
    justify-self: end;
  }

  .market-header nav,
  .raffle-callout {
    display: none;
  }

  .market-header[data-menu-open="true"] nav {
    display: grid;
    grid-column: 1 / -1;
    justify-content: stretch;
    width: 100%;
    gap: 0;
    overflow: visible;
  }

  .market-header[data-menu-open="true"] nav a {
    padding: 12px 0;
    border-top: 1px solid var(--line);
  }

  .market-header[data-menu-open="true"] .raffle-callout {
    display: inline-block;
    grid-column: 1 / -1;
    justify-self: start;
    padding: 12px 0 4px;
  }

  .raffle-callout {
    font-size: 0.72rem;
  }

  .wallet-row {
    grid-template-columns: 1fr;
  }

  .collage-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .format-options {
    grid-template-columns: 1fr;
  }

  .format-options span {
    min-height: 54px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .studio-options {
    grid-template-columns: 1fr;
  }

  .token-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 6px;
  }

  .nft-token {
    width: 100%;
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto;
    padding: 4px 3px 5px;
  }

  .nft-token img {
    width: min(100%, 54px);
    height: auto;
  }

  .nft-token span {
    font-size: 0.62rem;
  }

  .utility-footer {
    display: grid;
  }
}
