/* Layout: fixed left sidebar with one button per page, quiet cream content column on the right. */
:root {
  --crust: #8c300e;
  --deep: #2b150e;
  --cream: #ffffff;
  --paper: #ffffff;
  --butter: #fbca4f;
  --line: #eee6dc;
  --muted: #7a5a48;
  --head: "Press Start 2P", ui-monospace, monospace;
  --body: "VT323", ui-monospace, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--cream);
  color: var(--deep);
  font-family: var(--body);
  font-size: 22px;
  line-height: 1.35;
}
img { image-rendering: pixelated; max-width: 100%; }
a { color: var(--crust); }
h1, h2, h3 { font-family: var(--head); font-weight: 400; line-height: 1.5; margin: 0 0 14px; text-wrap: balance; }
h1 { font-size: clamp(18px, 3vw, 26px); }
h2 { font-size: 15px; margin-top: 8px; }
h3 { font-size: 11px; }
p { margin: 0 0 14px; max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: 19px; }
.eyebrow { font-family: var(--head); font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.lead { font-size: 25px; }

/* shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--paper) 230px, var(--line) 230px 232px, transparent 232px); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 32px; }
.side {
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  background: var(--paper); color: var(--deep);
  padding: 22px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--crust); font-family: var(--head); font-size: 12px; }
.brand small { display: block; font-family: var(--body); font-size: 18px; color: var(--muted); margin-top: 4px; }
.menu { display: grid; gap: 6px; }
.menu a {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--deep);
  font-family: var(--head); font-size: 10px;
  padding: 12px 12px;
  border: 2px solid transparent;
}
.menu a::before { content: ""; width: 8px; height: 8px; background: currentColor; opacity: .35; flex: none; }
.menu a:hover { border-color: var(--line); }
.menu a.active { background: var(--crust); border-color: var(--crust); color: var(--paper); }
.menu a.active::before { background: var(--butter); opacity: 1; }
.menu a:focus-visible, .xbtn:focus-visible, .btn:focus-visible, .wallet-btn:focus-visible, .wallet-option:focus-visible, .wallet-close:focus-visible { outline: 2px dashed var(--crust); outline-offset: 3px; }
.side-foot { margin-top: auto; display: grid; gap: 12px; }
.wallet-btn {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%;
  font-family: var(--head); font-size: 9px; line-height: 1.4; padding: 12px; cursor: pointer;
  color: var(--paper); background: var(--crust); border: 0; box-shadow: 0 4px 0 var(--deep);
}
.wallet-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
.wallet-btn:disabled { opacity: .7; cursor: wait; transform: none; }
.wallet-btn.connected { background: var(--deep); }
.wallet-btn .dot { width: 8px; height: 8px; background: #3dbe6e; flex: none; }
.wallet-modal {
  position: fixed; inset: 0; z-index: 40; background: rgba(43, 21, 14, .55);
  display: grid; place-items: center; padding: 16px;
}
.wallet-modal[hidden] { display: none; }
.wallet-panel {
  width: min(420px, 100%); background: var(--paper); color: var(--deep);
  border: 2px solid var(--deep); box-shadow: 8px 8px 0 var(--deep);
  padding: 20px; display: grid; gap: 14px; max-height: min(80vh, 640px); overflow: auto;
}
.wallet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.wallet-head h2 { margin: 0; }
.wallet-close {
  font-family: var(--head); font-size: 9px; background: transparent; border: 2px solid var(--deep);
  color: var(--deep); padding: 8px 10px; cursor: pointer;
}
.wallet-list { display: grid; gap: 8px; }
.wallet-option {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  font-family: var(--body); font-size: 22px; background: var(--paper); border: 2px solid var(--line);
  color: var(--deep); padding: 10px 12px; cursor: pointer;
}
.wallet-option:hover { border-color: var(--crust); }
.wallet-option img, .wallet-mark { width: 32px; height: 32px; flex: none; image-rendering: auto; }
.wallet-mark { display: grid; place-items: center; background: var(--butter); font-family: var(--head); font-size: 12px; }
.wallet-addr {
  font-size: 20px; word-break: break-all; background: #fff8ec; border: 2px dashed var(--line);
  padding: 10px; margin: 0;
}
.wallet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.wallet-error, .wallet-note { margin: 0; }
.wallet-error { color: var(--crust); }
.xbtn {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  text-decoration: none; color: var(--deep); background: var(--butter);
  font-family: var(--head); font-size: 10px; padding: 12px;
  box-shadow: 0 4px 0 #b9822a;
}
.xbtn:active { transform: translateY(4px); box-shadow: none; }
.xbtn svg { width: 14px; height: 14px; fill: currentColor; }
.status { font-size: 18px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.status i { width: 8px; height: 8px; background: var(--butter); display: block; }

/* content */
.main { padding: 56px 48px 72px; }
.page { max-width: 880px; display: grid; gap: 40px; }
.block { display: grid; gap: 4px; }

.card { background: var(--paper); border: 2px solid var(--line); padding: 22px; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.btn {
  display: inline-block; font-family: var(--head); font-size: 10px; text-decoration: none;
  color: var(--paper); background: var(--crust); border: 0; padding: 13px 16px; cursor: pointer;
  box-shadow: 0 4px 0 var(--deep);
}
.btn:active { transform: translateY(4px); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--deep); border: 2px solid var(--deep); box-shadow: none; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 2px dotted var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }

.stat { font-variant-numeric: tabular-nums; }
.stat .n { font-family: var(--head); font-size: 22px; color: var(--crust); display: block; margin: 8px 0 4px; }
.stat .l { color: var(--muted); font-size: 19px; }

.badge { font-family: var(--head); font-size: 8px; padding: 5px 7px; background: var(--butter); color: var(--deep); }
.badge.gray { background: var(--line); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--line); font-weight: 400; }
thead th { font-family: var(--head); font-size: 9px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.empty-row td { text-align: center; color: var(--muted); padding: 28px 12px; }

label { display: grid; gap: 6px; }
input, select {
  font-family: var(--body); font-size: 22px; color: var(--deep);
  background: var(--paper); border: 2px solid var(--deep); padding: 6px 10px; border-radius: 0; width: 100%;
}
input:focus, select:focus { outline: 3px solid var(--butter); outline-offset: 0; }

details { border-bottom: 2px solid var(--line); }
summary { cursor: pointer; padding: 14px 0; font-family: var(--head); font-size: 10px; line-height: 1.6; }
details p { padding-bottom: 8px; }

.post { padding: 20px 0; border-bottom: 2px solid var(--line); }
.post:first-child { padding-top: 0; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 19px; margin-bottom: 8px; }
.post-meta img { width: 24px; height: 24px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { font-family: var(--head); font-size: 9px; padding: 9px 11px; background: transparent; border: 2px solid var(--deep); color: var(--deep); cursor: pointer; }
.seg button.active { background: var(--deep); color: var(--paper); }

.docs { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 40px; align-items: start; }
.toc { position: sticky; top: 24px; display: grid; gap: 4px; font-size: 19px; }
.toc a { text-decoration: none; color: var(--muted); padding: 2px 0; }
.toc a:hover, .toc a.active { color: var(--crust); }
.docs section { scroll-margin-top: 24px; padding-bottom: 12px; }

.foot { color: var(--muted); font-size: 17px; border-top: 2px solid var(--line); padding-top: 16px; }

/* mobile: sidebar becomes a top bar with a scrollable row of page buttons */
.menu-toggle { display: none; }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .side { border-bottom: 2px solid var(--line); position: sticky; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; z-index: 5; }
  .brand small { display: none; }
  .menu { order: 3; flex-basis: 100%; min-width: 0; max-width: 100%; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .menu a { white-space: nowrap; padding: 9px 10px; font-size: 9px; }
  .menu a::before { display: none; }
  .side-foot { margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; }
  .wallet-btn { width: auto; padding: 9px 11px; }
  .status { display: none; }
  .xbtn { padding: 9px 11px; }
  .xbtn span { display: none; }
  .main { padding: 32px 16px 56px; }
  .g2, .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs { grid-template-columns: 1fr; }
  .toc { display: none; }
}
@media (max-width: 480px) {
  .hero { grid-template-columns: 1fr; }
  .hero img { order: -1; width: 112px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .stat .n { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
