:root {
  --bg: #050508;
  --ink: #e9ffe4;
  --dim: #8d9a8a;
  --lime: #7cff6b;
  --lime-2: #c6ff4d;
  --lav: #b9a3ff;
  --coral: #ff6f61;
  --amber: #ffb020;
  --panel: rgba(12, 13, 18, .86);
  --line: rgba(124, 255, 107, .16);
  --g: 10px;
  --sl: max(var(--g), env(safe-area-inset-left));
  --sr: max(var(--g), env(safe-area-inset-right));
  --st: max(var(--g), env(safe-area-inset-top));
  --sb: max(8px, env(safe-area-inset-bottom));
  --foot: 22px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font: 14px/1.35 ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
#wall { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
#wall.grabbing { cursor: grabbing; }
#wall:focus-visible { box-shadow: inset 0 0 0 2px var(--lime); }
button, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; padding: 8px 12px;
  color: var(--dim); font-size: 13px; pointer-events: none; transition: opacity .4s; }
.status.gone { opacity: 0; }

/* Floating UI */
.ui { position: absolute; z-index: 2; }
.screen .ui { display: none !important; }
.icon { width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); cursor: pointer; position: relative;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); -webkit-tap-highlight-color: transparent; }
.icon svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon:hover { border-color: rgba(124, 255, 107, .45); }
.icon:focus-visible, .chip:focus-visible, .open:focus-visible, .brand:focus-visible, .go:focus-visible, .tick:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.icon[aria-expanded="true"] { border-color: var(--lime); }
.icon.small { width: 34px; height: 34px; border-radius: 10px; }
.icon.small svg { width: 16px; height: 16px; }
.dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); }

.top { top: var(--st); left: var(--sl); right: var(--sr); display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: inline-flex; flex-direction: column; gap: 5px; padding: 8px 10px 7px; border-radius: 12px; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.mark { width: 99px; height: 21px; display: block; }
.mark rect { fill: var(--lime); }
.mark rect.b { fill: var(--lav); }
.count { font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.count b { color: var(--ink); font-weight: 600; }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 0 rgba(124, 255, 107, .6); animation: live 2.4s infinite; }
.live.off { background: var(--dim); animation: none; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(124, 255, 107, .55); } 70% { box-shadow: 0 0 0 7px rgba(124, 255, 107, 0); } 100% { box-shadow: 0 0 0 0 rgba(124, 255, 107, 0); } }
.tools { display: flex; gap: 8px; }

.find { top: calc(var(--st) + 50px); right: var(--sr); display: flex; gap: 6px; padding: 6px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.find input { width: min(56vw, 200px); height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: #08090d; font-size: 16px; }
.find input:focus { outline: 2px solid var(--lime); outline-offset: 0; }
.go { width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--lime); display: grid; place-items: center; cursor: pointer; }
.go svg { width: 20px; height: 20px; fill: none; stroke: #07120a; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Filters: bottom sheet on phones */
.sheet { left: var(--sl); right: var(--sr); bottom: calc(var(--sb) + 4px); z-index: 4; max-height: min(72dvh, 520px); display: flex; flex-direction: column;
  border-radius: 18px; background: rgba(10, 11, 15, .96); border: 1px solid var(--line); box-shadow: 0 -10px 40px rgba(0, 0, 0, .6); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px 14px; }
.sheet h2 { margin: 0; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--lime); }
.sheet h3 { margin: 12px 0 6px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 500; }
.sheet-body { overflow: auto; overscroll-behavior: contain; padding: 4px 14px 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: #0b0c11; cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px; -webkit-tap-highlight-color: transparent; }
.chip small { color: var(--dim); font-size: 11px; }
.chip[aria-checked="true"] { background: var(--lime); color: #07120a; border-color: var(--lime); }
.chip[aria-checked="true"] small { color: #1f3a1a; }
.tiny { margin: 14px 0 0; color: var(--dim); font-size: 12px; }

/* Ticker */
.ticker { left: var(--sl); bottom: calc(var(--sb) + var(--foot)); margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px;
  max-width: calc(100% - var(--sl) - var(--sr) - 56px); pointer-events: none; }
.tick { pointer-events: auto; display: flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 9px; font-size: 12px; cursor: pointer; border: 0; text-align: left;
  background: var(--panel); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); max-width: 100%; white-space: nowrap; overflow: hidden; }
.tick .k { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tick .t { color: var(--dim); margin-left: auto; padding-left: 6px; }
.tick.fresh { animation: tickin .6s ease-out; }
@keyframes tickin { from { transform: translateX(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.ticker li:nth-child(n+4) { display: none; }
.k-minted { background: var(--lime); } .k-repainted { background: var(--lav); } .k-listed { background: var(--amber); } .k-sold { background: var(--coral); }

.zoom { right: var(--sr); bottom: calc(var(--sb) + var(--foot)); display: flex; flex-direction: column; gap: 6px; }

/* Card */
.card { left: var(--sl); right: var(--sr); bottom: calc(var(--sb) + var(--foot)); z-index: 3; margin: 0 auto; max-width: 380px;
  display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 16px; background: rgba(10, 11, 15, .96); border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
#cardArt { width: 100px; height: 100px; flex: none; image-rendering: pixelated; border-radius: 10px; background: #050508; border: 1px solid var(--line); }
.card-text { min-width: 0; flex: 1; padding-right: 30px; }
.card p { margin: 0; }
.num { font-size: 18px; font-weight: 700; color: var(--lime); letter-spacing: .02em; }
.name { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name:empty { display: none; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px !important; font-size: 13px; color: var(--dim); }
.pill { padding: 1px 7px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); color: var(--dim); }
.pill.on { color: #07120a; background: var(--lime); border-color: var(--lime); }
.pill.paint { color: #120b24; background: var(--lav); border-color: var(--lav); }
.owner { font-size: 12px; color: var(--dim); margin-top: 3px !important; }
.open { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 7px 12px; min-height: 36px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: #07120a; background: var(--lime); text-decoration: none; }
.open svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.close { position: absolute; top: 8px; right: 8px; }

.foot { left: 0; right: 0; bottom: var(--sb); height: var(--foot); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--dim);
  pointer-events: none; text-shadow: 0 1px 2px #000; }
.foot b { color: var(--ink); font-weight: 600; margin-left: .4em; }

@media (max-width: 759px), (max-height: 460px) {
  .card-open .zoom, .card-open .ticker { display: none; }
}
/* Short screens (phone landscape) */
@media (max-height: 460px) {
  :root { --g: 8px; --foot: 18px; }
  .brand { padding: 6px 8px; flex-direction: row; align-items: center; gap: 10px; }
  .mark { width: 66px; height: 14px; }
  .ticker li:nth-child(n+3) { display: none; }
  .zoom { flex-direction: row; }
  .find { top: calc(var(--st) + 46px); }
  .sheet { left: auto; width: min(420px, calc(100% - var(--sl) - var(--sr))); top: var(--st); bottom: var(--sb); max-height: none; }
  .card { max-width: 420px; padding: 10px; }
  #cardArt { width: 80px; height: 80px; }
}
@media (max-width: 359px) {
  .count .of { display: none; }
  .count::after { content: " awake"; }
}
/* Larger screens */
@media (min-width: 760px) and (min-height: 461px) {
  :root { --g: 16px; --foot: 28px; }
  .icon { width: 44px; height: 44px; }
  .mark { width: 132px; height: 28px; }
  .count { font-size: 13px; }
  .find { top: calc(var(--st) + 56px); }
  .sheet { left: auto; top: calc(var(--st) + 56px); bottom: auto; width: 360px; max-height: calc(100dvh - var(--st) - var(--sb) - 80px); }
  .ticker li:nth-child(n+4) { display: flex; }
  .ticker li:nth-child(n+6) { display: none; }
  .tick { font-size: 13px; }
  .card { left: auto; right: calc(var(--sr) + 60px); margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .live, .tick.fresh, .card { animation: none; }
}
.status a { color: var(--lime); pointer-events: auto; }
