:root {
  --bg: #10131a;
  --panel: #171b25;
  --line: #262c3a;
  --ink: #f2f4f8;
  --muted: #9aa3b5;
  --accent: #3982f7;
  --accent-ink: #ffffff;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px 20px 60px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Rubik", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

header {
  max-width: 1100px;
  margin: 0 auto 28px;
}

.home {
  font-family: "JINKY", sans-serif;
  font-size: 34px;
  color: var(--accent);
  text-decoration: none;
}

.home:hover {
  color: #6ba4ff;
}

h1 {
  margin: 10px 0 4px;
  font-size: 28px;
}

.tagline {
  margin: 0;
  color: var(--muted);
}

.setup,
.bar,
#status,
#counts,
#collections,
footer,
main {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

/* ------------------------------------------------------------- endpoint */

.setup {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
}

.setup label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

#rpc {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0d1017;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

#rpc:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ bar */

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 9px 14px;
}

button:hover {
  border-color: var(--accent);
}

#connect {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
}

#connect:hover {
  background: #2f72e0;
}

.chip {
  font-size: 13px;
  padding: 7px 12px;
}

.chip.on {
  border-color: var(--accent);
  color: var(--accent);
}

.spacer {
  flex: 1;
}

#wallet {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--muted);
}

#status {
  min-height: 20px;
  margin: 0 auto 6px;
  font-size: 14px;
  color: var(--muted);
}

#status.error {
  color: var(--danger);
}

#counts {
  margin: 0 auto 20px;
  font-size: 13px;
  color: var(--muted);
}

/* ----------------------------------------------------------------- grid */

main {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cover {
  position: relative;
  aspect-ratio: 2 / 3;
  background: #0d1017;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.cover.broken::after {
  content: "no cover";
  color: var(--muted);
  font-size: 12px;
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
}

.body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.body h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.collection {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.facts {
  margin: 0;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.facts div {
  display: flex;
  flex-direction: column;
}

.facts dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-size: 13px;
}

.read {
  align-self: flex-start;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 7px;
}

.read:hover {
  background: #2f72e0;
}

.explorer {
  margin-top: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
}

.explorer:hover {
  color: var(--accent);
}

.muted {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.empty {
  grid-column: 1 / -1;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

/* ---------------------------------------------------------- collections */

#collections {
  margin-top: 34px;
}

#collections h2 {
  font-size: 16px;
  margin: 0 0 12px;
}

.collection-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.pin {
  font-size: 12px;
  padding: 5px 10px;
}

.pin.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.cname {
  font-weight: 500;
}

.ccount {
  color: var(--muted);
  font-size: 12px;
}

.collection-row code {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

footer code {
  color: #b8c4da;
}

@media (max-width: 520px) {
  main {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
