:root {
  --bg: #f3f3f0;
  --bg-sunken: #ebebe6;
  --surface: #ffffff;
  --ink: #17170f;
  --ink-soft: #45453c;
  --muted: #7a7a70;
  --line: #e3e3dc;
  --line-strong: #d2d2c9;
  --black: #101010;
  --live: #1c8c4d;
  --live-soft: #eaf5ee;
  --gold: #9a6a12;
  --gold-soft: #f8f1e2;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  --shell: 1180px;
}

* {
  box-sizing: border-box;
}

/* Layout rules below set display explicitly, which would otherwise beat [hidden]. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

p {
  margin: 0;
}

ol, ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
  letter-spacing: -0.01em;
}

.micro {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  padding: 10px 14px;
  background: var(--black);
  color: #fff;
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: 1px;
}

.dot--live {
  background: var(--live);
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--x,
.btn--solid {
  background: var(--black);
  border-color: var(--black);
  color: #fbfbf7;
}

.btn--x:hover:not([disabled]),
.btn--solid:hover:not([disabled]) {
  background: #292926;
}

.btn--ghost {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.btn--ghost:hover:not([disabled]) {
  border-color: var(--ink);
}

.btn--lg {
  padding: 12px 22px;
  font-size: 15px;
}

.btn--sm {
  padding: 7px 13px;
  font-size: 13px;
}

.btn--xs {
  padding: 4px 9px;
  font-size: 11px;
}

.btn--full {
  width: 100%;
}

.x-glyph {
  font-size: 1.05em;
  line-height: 1;
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(243, 243, 240, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 11px 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--black);
  text-decoration: none;
}

.brand__mark {
  display: block;
  line-height: 0;
}

.brand__text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topnav {
  display: flex;
  gap: 4px;
  margin-right: auto;
}

.topnav a {
  padding: 6px 11px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
}

.topnav a:hover {
  background: var(--bg-sunken);
  color: var(--ink);
}

.ticker {
  display: flex;
  gap: 6px;
}

.ticker__item {
  display: flex;
  flex-direction: column;
  min-width: 74px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.ticker__label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ticker__value {
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.topbar__auth {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
}

/* ---------- Hero ---------- */

.hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 58px 22px 40px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--live);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(30px, 5.4vw, 50px);
}

.hero__lead {
  margin: 18px auto 0;
  max-width: 660px;
  color: var(--ink-soft);
  font-size: 16.5px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

.hero__stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 32px 0 0;
}

.hero__stat {
  flex: 1 1 150px;
  max-width: 220px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.hero__stat dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero__stat dd {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.hero__note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  gap: 22px;
  align-items: start;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 8px 22px 70px;
}

.col--main {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.col--side {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Panels ---------- */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.panel--flat {
  background: none;
  border: none;
  border-radius: 0;
  overflow: visible;
}

.panel__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel--flat .panel__head {
  padding: 4px 2px 14px;
  border-bottom: none;
  align-items: flex-start;
}

.panel__head h2 {
  font-size: 20px;
}

.panel__meta {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.panel__note {
  max-width: 330px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  text-align: right;
}

/* ---------- Feed ---------- */

.feed {
  max-height: 620px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.msg {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  animation: rise 0.28s ease;
}

.msg:last-child {
  border-bottom: none;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.msg--mine {
  background: #fcfcf8;
  box-shadow: inset 2px 0 0 var(--black);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-sunken);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  user-select: none;
}

.avatar--lg {
  width: 42px;
  height: 42px;
  font-size: 14px;
}

.avatar--sm {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 10px;
}

.msg__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
}

.msg__name {
  font-size: 14px;
  font-weight: 700;
}

.msg__handle,
.msg__time {
  color: var(--muted);
  font-size: 12.5px;
}

.badge {
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge--mine {
  border-color: var(--black);
  color: var(--black);
}

.msg__body {
  margin-top: 3px;
  color: var(--ink);
  font-size: 14.5px;
  overflow-wrap: anywhere;
}

.msg__reply {
  color: var(--muted);
}

.msg__foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.msg__foot .mono {
  font-variant-numeric: tabular-nums;
}

.feed__empty {
  padding: 26px 18px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ---------- Composer ---------- */

.composer {
  border-top: 1px solid var(--line);
  background: var(--bg-sunken);
}

.composer__locked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
}

.composer__locked p {
  color: var(--ink-soft);
  font-size: 13.5px;
}

.composer__form {
  padding: 14px 18px;
}

.composer__label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.composer__row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer__row input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}

.composer__row input:focus {
  outline: none;
  border-color: var(--ink);
}

.prefix {
  color: var(--muted);
}

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

/* ---------- Steps ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.step {
  display: flex;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.step__num {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.step h3 {
  font-size: 15px;
}

.step p {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
}

/* ---------- Roster ---------- */

.roster {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rosteritem {
  display: grid;
  grid-template-columns: 34px 34px minmax(0, 1.05fr) minmax(0, 1.35fr) 108px 100px;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.rosteritem--mine {
  border-color: var(--black);
}

.rosteritem__rank {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.rosteritem__who {
  min-width: 0;
}

.rosteritem__name {
  font-size: 13.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rosteritem__handle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
}

.rosteritem__handle .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rosteritem__take {
  color: var(--ink-soft);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rosteritem__id {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
}

.rosteritem__state {
  display: block;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rosteritem__share {
  text-align: right;
}

.rosteritem__pct {
  font-family: var(--mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.rosteritem__pctlabel {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- Rewards ---------- */

.prose {
  max-width: 640px;
  color: var(--ink-soft);
  font-size: 15px;
}

.prose--muted {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.payout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.payout li {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--gold-soft);
}

.payout__k {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.payout__v {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Cards ---------- */

.card {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card--quiet {
  background: var(--bg-sunken);
}

.card__title {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.card__sub {
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card__lead {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.55;
}

.card__ticker {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
}

.card__body > .btn {
  margin-top: 12px;
}

.card__foot {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.kv {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.kv li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.kv li > span:first-child {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kv li > span:last-child {
  font-variant-numeric: tabular-nums;
}

.kv--modal {
  margin-top: 18px;
}

.pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-sunken);
  font-size: 11.5px;
}

.pill--live {
  background: var(--live-soft);
  color: var(--live);
}

.miniprofile {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 12px;
}

.miniprofile__name {
  font-size: 14.5px;
  font-weight: 700;
}

.miniprofile__handle {
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chips li {
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 11.5px;
}

.permlist {
  margin-top: 12px;
}

.permlist li {
  position: relative;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.7;
}

.permlist li::before {
  content: "✓";
  position: absolute;
  left: 2px;
  color: var(--live);
}

.permlist__no {
  color: var(--muted);
  text-decoration: line-through;
}

.permlist li.permlist__no::before {
  content: "×";
  color: #b03b2e;
}

.permlist--modal {
  margin: 16px 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-sunken);
}

.contract {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 7px 9px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
}

.contract__addr {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaders {
  margin-top: 10px;
}

.leaders li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.leaders li:last-child {
  border-bottom: none;
}

.leaders__who {
  flex: 1 1 auto;
  min-width: 0;
}

.leaders__name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaders__meta {
  color: var(--muted);
  font-size: 11px;
}

.leaders__val {
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  background: var(--bg-sunken);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 22px;
}

.footer__note {
  max-width: 520px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Modals ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 20, 16, 0.44);
  overflow-y: auto;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 22px 24px 24px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  animation: rise 0.2s ease;
}

.modal h2 {
  font-size: 23px;
}

.modal__lead {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 14px;
}

.modal__foot {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
}

.modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 0 6px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal__close:hover {
  color: var(--ink);
}

.demofield {
  margin-bottom: 14px;
}

.demofield label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field__error {
  margin-top: 7px;
  color: #b03b2e;
  font-size: 12px;
}

.progress {
  height: 5px;
  margin: 18px 0 14px;
  border-radius: 999px;
  background: var(--bg-sunken);
  overflow: hidden;
}

.progress__bar {
  width: 0;
  height: 100%;
  background: var(--black);
  transition: width 0.35s ease;
}

.scanlog {
  max-height: 200px;
  overflow-y: auto;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.85;
}

.scanlog li::before {
  content: "› ";
  color: var(--muted);
}

.scanlog li:last-child {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--black);
  color: #fbfbf7;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(20, 20, 16, 0.18);
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .col--side {
    position: static;
  }

  .topnav,
  .ticker {
    display: none;
  }

  .brand {
    margin-right: auto;
  }
}

@media (max-width: 760px) {
  .rosteritem {
    grid-template-columns: 26px 34px minmax(0, 1fr) 100px;
    row-gap: 6px;
  }

  .rosteritem__take {
    grid-column: 3 / 5;
    white-space: normal;
  }

  .rosteritem__id {
    grid-column: 1 / 4;
    text-align: left;
  }

  .panel__note {
    text-align: left;
  }

  .panel__head {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero {
    padding-top: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .dot--live,
  .msg,
  .modal {
    animation: none;
  }

  .btn,
  .progress__bar {
    transition: none;
  }
}
