:root {
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #1c1915;
  --muted: #5e584e;
  --line: #e3d9c8;
  --accent: #b8431f;
  --sticker: #f2c94c;
  --shadow: 4px 4px 0 #1c1915;
  --sans: "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }

.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
header.site {
  background: var(--card);
  border-bottom: 2px solid var(--ink);
}
.site-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}
.brand-mark { display: block; width: 30px; height: 30px; flex: 0 0 auto; }
.brand-wordmark span { color: var(--accent); }
nav.top a { color: inherit; margin-left: 16px; font-weight: 650; }
main { padding: 36px 0 76px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
h1 { font-size: clamp(2.1rem, 4vw, 3.4rem); margin: 0 0 12px; }
h2 { font-size: 1.7rem; margin: 2rem 0 0.6rem; }
.lede { font-size: 1.15rem; max-width: 68ch; }
.muted { color: var(--muted); }
.kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}

.banners {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 8px 0 28px;
}
.banner {
  min-height: 84px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
  font-weight: 750;
}
.banner small { display: block; font-weight: 550; color: var(--muted); margin-top: 4px; }
.banner-open { box-shadow: none; border-style: dashed; color: var(--muted); font-weight: 600; }
.banner-image { padding: 0; overflow: hidden; background: #0d1d3f; }
.banner-image img { display: block; width: 100%; height: 100%; object-fit: cover; }

.hero-row { display: flex; gap: 28px; align-items: flex-start; }
.sticker {
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  background: var(--sticker);
  border: 2px solid var(--ink);
  border-radius: 22px 26px 18px 24px;
  box-shadow: var(--shadow);
  transform: rotate(-7deg);
  font-weight: 800;
  letter-spacing: -0.04em;
  text-align: center;
  padding: 8px;
  line-height: 1.05;
  font-size: 15px;
}
.sticker.long { font-size: 11px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 24px 0 30px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 12px 14px;
}
.stat b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 0.82rem; }

.prose { max-width: 72ch; }
.prose p, .note { max-width: 72ch; }
.note {
  background: var(--card);
  border-left: 4px solid var(--ink);
  padding: 12px 14px;
  margin: 18px 0 22px;
}

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); margin: 18px 0 26px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { text-align: left; padding: 12px 14px 0; font-weight: 700; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }

.links { columns: 2; padding-left: 18px; }
.links li { break-inside: avoid; margin: 0 0 6px; }
.related { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 0; list-style: none; }
.crumbs { font-size: 0.92rem; margin-bottom: 18px; }
.crumbs a { color: inherit; }

.az { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 8px; }
.az a {
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--ink);
  background: var(--card);
  min-width: 36px;
  text-align: center;
  padding: 4px 8px;
  font-weight: 700;
}
.letter { margin-top: 28px; }
.coins, .rank-list { columns: 4; margin: 0; padding: 0; list-style: none; }
.rank-list { columns: unset; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 18px; }
.rank-list a b, .rank-list a { font-variant-numeric: tabular-nums; }
.coins li, .rank-list li { break-inside: avoid; }
.coins a, .rank-list a { display: block; padding: 4px 0; color: inherit; text-decoration: none; }
.coins a:hover, .rank-list a:hover { color: var(--accent); }
.coins small, .rank-list small { color: var(--muted); }

details { border-top: 1px solid var(--line); padding: 14px 0; }
summary { cursor: pointer; font-weight: 700; }
footer.site {
  border-top: 2px solid var(--ink);
  padding: 30px 0 44px;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 800px) {
  .stats, .banners { grid-template-columns: 1fr 1fr; }
  .coins { columns: 2; }
  .rank-list { grid-template-columns: 1fr 1fr; }
  .hero-row { display: block; }
  .sticker { margin-bottom: 16px; }
}
@media (max-width: 560px) {
  .stats, .banners, .links { grid-template-columns: 1fr; columns: 1; }
  .coins { columns: 1; }
  .rank-list { grid-template-columns: 1fr; }
  nav.top a { margin-left: 10px; }
}

body.market { background: #f8fafd; color: #0d1421; --head: 59px; }
body.market .wrap { width: min(1280px, calc(100% - 32px)); }
body.market main { padding-top: 28px; }
body.market header.site {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  border-bottom: 1px solid #eff2f5;
}
body.market .site-row { flex-wrap: nowrap; }
body.market .brand {
  font-family: var(--sans);
  font-weight: 750;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
body.market .brand-mark { width: 28px; height: 28px; }
body.market .brand-wordmark { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.market .brand-wordmark span { color: #3861fb; }
body.market nav.top { flex: 0 0 auto; white-space: nowrap; }
body.market nav.top a { text-decoration: none; color: #0d1421; }
body.market nav.top a:hover { color: #3861fb; }
body.market h1 { font-family: var(--sans); font-size: 1.45rem; font-weight: 750; letter-spacing: -0.03em; margin: 0 0 4px; }
body.market .banners.slim { gap: 10px; margin: 0 0 14px; }
body.market .banners.slim .banner {
  min-height: 48px;
  box-shadow: none;
  border: 1px solid #d6deeb;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}
body.market .muted { margin: 0; max-width: 68ch; font-size: 13px; color: #616e85; line-height: 1.4; }

.market-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 20px;
}
.search input {
  width: min(260px, 70vw);
  border: 1px solid #d6deeb;
  border-radius: 999px;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #0d1421;
  background: #fff;
}
.tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; }
.tabs button {
  border: 0;
  background: transparent;
  color: #616e85;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.tabs button.on { background: #fff; color: #0d1421; box-shadow: inset 0 0 0 1px #d6deeb; }
.shown { margin-left: auto; color: #616e85; font-size: 13px; font-variant-numeric: tabular-nums; }

.coin-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #fff;
  border: 1px solid #eff2f5;
  border-radius: 16px;
  overflow: hidden;
}
.coin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 14px;
  text-decoration: none;
  color: #0d1421;
  border-bottom: 1px solid #f4f6fa;
  border-right: 1px solid #f4f6fa;
}
.coin-row[hidden] { display: none; }
.coin-row:hover { background: #f8fafd; }
.coin-row .rank {
  width: 38px;
  flex: 0 0 auto;
  text-align: right;
  color: #808a9d;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.coin-row img { width: 28px; height: 28px; border-radius: 50%; background: #eff2f5; flex: 0 0 auto; }
.coin-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.coin-name b {
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.coin-name small { color: #808a9d; font-size: 13px; flex: 0 0 auto; }
.coin-row:hover b { color: #3861fb; }
.pill {
  font-style: normal;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3861fb;
  background: #eef2ff;
  border-radius: 999px;
  padding: 1px 6px;
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .coin-board { grid-template-columns: 1fr 1fr; }
  .market-bar { display: block; }
  .search input { width: 100%; margin-top: 12px; }
}
@media (max-width: 640px) {
  body.market nav.top a { margin-left: 10px; font-size: 13px; }
  .coin-board { grid-template-columns: 1fr; }
  .coin-row img { width: 24px; height: 24px; }
}

body.market article h1 { font-size: clamp(1.6rem, 3vw, 2.15rem); margin: 0 0 12px; }
body.market h2 { font-family: var(--sans); font-size: 1.15rem; font-weight: 750; margin: 2rem 0 0.65rem; }
body.market .kicker { color: #616e85; }
body.market .lede { font-size: 1.02rem; line-height: 1.6; margin-bottom: 22px; }
body.market .prose p { line-height: 1.7; margin: 0 0 1.1rem; }
body.market .coin-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 6px; }
body.market .coin-logo { width: 56px; height: 56px; border-radius: 50%; background: #eff2f5; flex: 0 0 auto; }
body.market .stat { background: #fff; border: 1px solid #eff2f5; border-radius: 12px; }
body.market .stat span { color: #616e85; }
body.market .table-wrap { background: #fff; border: 1px solid #eff2f5; border-radius: 16px; }
body.market .table-wrap th { background: #fff; color: #616e85; }
body.market .table-wrap a { color: #3861fb; font-weight: 650; text-decoration: none; }
body.market .crumbs { color: #616e85; font-size: 13px; }
body.market .crumbs a, body.market .prose a, body.market .related a, body.market .month-nav a { color: #3861fb; text-decoration: none; }
body.market .note { background: #fff; border-left-color: #3861fb; }
body.market details { border-top-color: #eff2f5; }
body.market footer.site { border-top: 1px solid #eff2f5; background: #fff; }
.path-grid, .month-grid { display: grid; gap: 12px; margin: 14px 0 30px; }
.path-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.month-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.path-grid a, .month-grid a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #eff2f5;
  border-radius: 12px;
  text-decoration: none;
  color: #0d1421;
}
.path-grid a b, .month-grid a b { font-weight: 750; }
.path-grid a small, .month-grid a small { color: #616e85; font-size: 12px; line-height: 1.35; }
.path-grid a:hover b, .month-grid a:hover b { color: #3861fb; }
.path-grid a[aria-current], .month-grid a[aria-current] { box-shadow: inset 0 0 0 1px #3861fb; }
.month-nav { display: flex; justify-content: space-between; gap: 12px; margin: 4px 0 8px; font-weight: 700; }
@media (max-width: 900px) {
  .path-grid, .month-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .path-grid { grid-template-columns: 1fr; }
  body.market .coin-head { display: block; }
  body.market .coin-logo { margin-bottom: 10px; }
}
