/* $REAGENT HQ — the desk's own palette, type and parts, so the two read as one
   project. Manrope for anything a person reads, mono only for machine text:
   addresses and the contract. Green is the brand, gold the accent; red appears
   once, on the flags in the arcade. */

:root {
  --paper: #f4f6ef;
  --white: #fff;
  --ink: #16301f;
  --muted: #57685b;
  --soft: #8a9789;
  --green: #256b41;
  --green-bright: #38935c;
  --green-deep: #123726;
  --green-light: #e2f0e2;
  --gold: #a87a1f;
  --gold-bright: #d9ae4b;
  --gold-light: #faeecd;
  --line: #ccd6c8;
  --line-soft: #e4ebe0;
  --red: #b23c22;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;
  --nav-h: 62px;
  --r: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 500 16px/1.62 var(--sans); -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(ellipse 900px 520px at 78% -6%, #dfeadb66, transparent 70%);
}
body.modal-open { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3 { margin: 0; }
img { max-width: 100%; }
code { font-family: var(--mono); }
[hidden] { display: none !important; }
::selection { background: var(--gold-light); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.wrap { width: min(1280px, calc(100% - 40px)); margin: auto; }
.spacer { margin-left: auto; }

/* ---------------------------------------------------------------- nav */
.nav {
  height: var(--nav-h); border-bottom: 1px solid var(--line);
  background: #f6f8f2; position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 0 max(20px, calc((100vw - 1280px) / 2));
}
.nav-mark { display: flex; gap: 10px; align-items: center; flex: none; font-weight: 800; letter-spacing: -.02em; }
.nav-mark img { width: 30px; height: 34px; object-fit: contain; image-rendering: pixelated; }
.nav-mark em {
  font-style: normal; font-size: 11.5px; font-weight: 800; letter-spacing: .1em;
  color: #7d5a13; background: var(--gold-light); border: 1px solid #e2caa0;
  padding: 2px 8px; border-radius: 999px;
}
.navbtn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px;
  border-radius: 999px; font-size: 13.5px; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--line); background: var(--white); color: var(--ink);
  transition: transform .14s, box-shadow .14s, background .14s;
}
.navbtn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px #16301f18; }
.navbtn.dark { background: var(--ink); color: #eef5e8; border-color: var(--ink); }
.navbtn.dark:hover { background: #1f4029; }
.navbtn svg { width: 16px; height: 16px; fill: currentColor; }
.navbtn.play { background: var(--gold-light); border-color: #e2caa0; color: #6b4c0f; }
.navbtn.play:hover { background: #f6e4b8; }
.navbtn.play i { font-style: normal; font-size: 10px; }

/* ---------------------------------------------------------------- parts */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 1px 0 #16301f08; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--green); background: var(--green-light); border: 1px solid #c6dcc4;
}
.chip.gold { color: #7d5a13; background: var(--gold-light); border-color: #e2caa0; }
.chip.red { color: var(--red); background: #fce6de; border-color: #efc2b3; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--line); background: #fbfcf8; color: var(--ink);
  transition: background .14s, border-color .14s;
}
.pill:hover { background: #eef4ea; border-color: #b9c8b4; }
.pill:disabled { opacity: .6; cursor: progress; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 50px; padding: 13px 24px; border-radius: 999px;
  font-size: 15px; font-weight: 800; white-space: nowrap;
  border: 1px solid #23492f; color: #fffbed;
  background: linear-gradient(160deg, #35784c, #17402a);
  box-shadow: 0 8px 20px #16301f2e, inset 0 1px 0 #ffffff36;
  transition: transform .15s, box-shadow .15s;
}
.button:hover { transform: translateY(-2px); box-shadow: 0 12px 26px #16301f38, inset 0 1px 0 #ffffff36; }
.button.ghost { background: var(--white); color: var(--ink); border-color: var(--line); box-shadow: none; }
.button.ghost:hover { box-shadow: 0 8px 20px #16301f14; }

/* ---------------------------------------------------------------- hero */
.hero { padding: 46px 0 34px; display: grid; grid-template-columns: 1fr 1.12fr; gap: 32px; align-items: center; }
.kicker { font-size: 12.5px; font-weight: 800; letter-spacing: .14em; color: var(--gold); }
.hero h1 { font-size: 58px; line-height: 1.02; letter-spacing: -.045em; font-weight: 800; margin-top: 14px; }
.hero h1 em { font-style: normal; color: var(--green-bright); }
.hero .say { font-size: 18px; color: var(--muted); margin-top: 16px; max-width: 460px; }
.hero-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.hero-art { display: flex; align-items: center; justify-content: center; gap: 18px; }
.hero-art img { width: 128px; height: 143px; flex: none; object-fit: contain; image-rendering: pixelated; animation: bob 4.6s steps(3, end) infinite; }
.hero-word { position: relative; flex: 1 1 auto; min-width: 0; }
.hero-word canvas { display: block; width: 100%; max-width: 520px; height: auto; }
.hero-live {
  position: absolute; top: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--green); padding: 5px 14px; border-radius: 999px;
  border: 1px solid #c6d4c0; background: #eaf2e6;
}
.hero-live i, .ca-label i, .auto i, .status i, .game-log i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green-bright); flex: none; display: inline-block;
}
@keyframes bob { 50% { transform: translateY(-7px); } }
@keyframes pulse { 50% { opacity: .35; } }

/* ------------------------------------------------------------ contract */
.contract { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; flex-wrap: wrap; }
.ca-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.contract code { font-size: 14px; color: var(--ink); padding: 0 6px; word-break: break-all; }
.auto { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--soft); }
.auto i { animation: pulse 2s ease-in-out infinite; }

/* -------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; margin-top: 20px; align-items: start; }
.main-col { display: grid; gap: 20px; min-width: 0; }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.facts > * {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px 15px; min-width: 0;
}
.facts small { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); }
.facts strong { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.facts .burn { background: linear-gradient(160deg, #fdf4dc, #f6e7c0); border-color: #e2caa0; transition: transform .14s, box-shadow .14s; }
.facts .burn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px #a87a1f22; }
.facts .burn small { color: #8a6516; }
.facts .burn strong { color: #6b4c0f; }
.facts .burn p { color: #7d5a13; }
.facts .burn code { font-size: 12px; white-space: nowrap; }

/* --------------------------------------------------------------- board */
.board { overflow: hidden; scroll-margin-top: calc(var(--nav-h) + 16px); }
.board-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.board-head h2 { font-size: 17px; font-weight: 800; letter-spacing: -.02em; display: inline; }
.board-head span { font-size: 13px; color: var(--soft); margin-left: 10px; }

.top-ten { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.holder {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  padding: 14px 18px; background: var(--white); transition: background .14s;
  border-top: 1px solid var(--line-soft);
}
.holder:nth-child(-n+2) { border-top: 0; }
.holder:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.holder:hover { background: #f7faf4; }
.holder canvas { grid-row: span 2; width: 48px; height: 48px; image-rendering: pixelated; border-radius: 10px; background: #f1f5ec; }
.holder .who { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.holder .rank { font-size: 13px; font-weight: 800; color: var(--soft); font-variant-numeric: tabular-nums; }
.holder code { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.holder .pct { font-size: 13px; font-weight: 800; color: var(--green); text-align: right; font-variant-numeric: tabular-nums; }
.holder .amount { font-size: 14px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.holder .bar { height: 5px; border-radius: 999px; background: var(--line-soft); overflow: hidden; align-self: center; min-width: 60px; }
.holder .bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-bright), var(--green)); }
.holder.first { background: linear-gradient(160deg, #fffaf0, #fdf2d8); }
.holder.first .rank { color: var(--gold); }
.holder.first .bar i { background: linear-gradient(90deg, var(--gold-bright), var(--gold)); }
.holder.first canvas { background: #faeecd; }

.rest-ten { display: grid; }
.row {
  display: grid; grid-template-columns: 30px 44px minmax(0, 1fr) auto 64px 120px; gap: 14px; align-items: center;
  padding: 10px 18px; border-top: 1px solid var(--line-soft); transition: background .14s;
}
.row:first-child { border-top: 0; }
.row:hover { background: #f7faf4; }
.row canvas { width: 30px; height: 30px; image-rendering: pixelated; border-radius: 7px; background: #f1f5ec; }
.row .rank { font-size: 13px; font-weight: 800; color: var(--soft); font-variant-numeric: tabular-nums; }
.row code { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amount { font-size: 13.5px; font-weight: 700; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.row .pct { font-size: 13px; font-weight: 800; color: var(--green); text-align: right; font-variant-numeric: tabular-nums; }
.row .bar { height: 4px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.row .bar i { display: block; height: 100%; background: var(--green-bright); border-radius: inherit; }

.loading { grid-column: 1 / -1; display: grid; justify-items: center; gap: 4px; padding: 48px 20px; background: var(--white); text-align: center; }
.loading i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--green); animation: spin .9s linear infinite; margin-bottom: 6px; }
.loading b { font-weight: 800; }
.loading span { font-size: 13.5px; color: var(--soft); }
.loading.bad i { animation: none; border-color: #efc2b3; }
@keyframes spin { to { transform: rotate(360deg); } }

.status { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--soft); padding: 0 4px; }
.status i { animation: pulse 2s ease-in-out infinite; }
.refreshing .holder, .refreshing .row { animation: flash .8s ease; }
@keyframes flash { 30% { background: #f0f7ea; } }

/* -------------------------------------------------------------- repost */
.repost { position: sticky; top: calc(var(--nav-h) + 20px); overflow: hidden; }
.repost-head { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; padding: 18px 18px 14px; }
.repost-head small { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.repost-head h2 { font-size: 21px; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; margin-top: 6px; }
.repost-head p { font-size: 14.5px; color: var(--muted); margin-top: 6px; }
.x-mark {
  flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ink); color: #f2f7ec; font-size: 18px;
}
.repost-shot { display: block; margin: 0 14px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #000; transition: transform .16s, box-shadow .16s; }
.repost-shot:hover { transform: translateY(-2px); box-shadow: 0 12px 28px #16301f2a; }
.repost-shot img { display: block; width: 100%; height: auto; }
.repost-foot {
  display: flex; justify-content: center; margin: 14px; padding: 10px; border-radius: 999px;
  font-size: 13.5px; font-weight: 800; border: 1px solid var(--line); background: #fbfcf8;
}
.repost-foot:hover { background: #eef4ea; }

.site-foot { margin-top: 50px; padding: 22px 0 46px; border-top: 1px solid var(--line); display: flex; gap: 20px; align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--soft); }
.site-foot .links { margin-left: auto; display: flex; gap: 18px; font-weight: 600; }
.site-foot a:hover { color: var(--gold); }

/* ---------------------------------------------------------------- game */
.game-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; visibility: hidden; opacity: 0; transition: opacity .18s, visibility .18s; }
.game-modal.open { visibility: visible; opacity: 1; }
.game-backdrop { position: absolute; inset: 0; background: #16301f59; backdrop-filter: blur(3px); }
.game-window {
  position: relative; width: min(470px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 80px #16301f40; transform: translateY(10px); transition: transform .2s;
}
.game-modal.open .game-window { transform: none; }
.game-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.game-head small { font-size: 11.5px; font-weight: 800; letter-spacing: .14em; color: var(--gold); }
.game-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.game-actions { display: flex; align-items: center; gap: 10px; }
.close { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--white); font-size: 20px; line-height: 1; }
.close:hover { background: #eef4ea; }
.game-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 18px 12px; }
.game-stats span { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; }
.game-stats small { display: block; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); }
.game-stats b { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--green); }
.game-shell { position: relative; margin: 0 18px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fbfcf8; }
.game-shell canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.game-overlay {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px;
  text-align: center; background: #f4f6efe6; padding: 20px; transition: opacity .2s;
}
.game-overlay.hidden { opacity: 0; pointer-events: none; }
.game-overlay img { width: 84px; height: 94px; object-fit: contain; image-rendering: pixelated; animation: bob 4.6s steps(3, end) infinite; }
.game-overlay small { font-size: 11.5px; font-weight: 800; letter-spacing: .14em; color: var(--gold); margin-top: 4px; }
.game-overlay h3 { font-size: 21px; font-weight: 800; letter-spacing: -.03em; line-height: 1.25; }
.game-overlay .button { margin-top: 8px; min-height: 46px; padding: 11px 22px; }
.game-overlay p { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--soft); }
.touch-controls { display: none; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 18px 0; }
.touch-controls button { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); font-size: 14px; color: var(--green); touch-action: manipulation; }
.touch-controls button:active { background: var(--green-light); }
.game-log { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px 16px; }
.game-log span { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 13px; color: var(--muted); }
.game-log em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#gameState.danger { color: var(--red); background: #fce6de; border-color: #efc2b3; }
#gameState.done { color: #7d5a13; background: var(--gold-light); border-color: #e2caa0; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .dev-only { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 26px; padding-bottom: 50px; }
  .hero-art { justify-content: flex-start; }
  .layout { grid-template-columns: 1fr; }
  .repost { position: static; max-width: 560px; }
  .row { grid-template-columns: 30px 36px minmax(0, 1fr) auto 64px; }
  .row .bar { display: none; }
}
@media (max-width: 760px) {
  .desk-only, .wide-only { display: none; }
  .navbtn.dark:not(.buy) { padding: 8px 10px; }
  .top-ten { grid-template-columns: 1fr; }
  .holder:nth-child(odd) { border-right: 0; }
  .holder:nth-child(2) { border-top: 1px solid var(--line-soft); }
  .hero h1 { font-size: 44px; }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 32px); }
  .nav { padding: 0 16px; gap: 6px; }
  .nav-mark span { display: none; }
  .navbtn { padding: 7px 11px; font-size: 12.5px; }
  .hero { padding-top: 30px; }
  .hero h1 { font-size: 38px; }
  .hero .say { font-size: 16px; }
  .hero-art { gap: 10px; padding-bottom: 40px; }
  .hero-art img { width: 72px; height: 80px; }
  .hero-live { font-size: 11px; padding: 4px 11px; top: calc(100% + 12px); }
  .hero-actions .button { flex: 1 1 auto; }
  .contract code { font-size: 12px; flex-basis: 100%; padding: 0; order: 1; }
  .contract .ca-label { order: 0; }
  .contract > :not(.ca-label):not(code) { order: 2; }
  .contract .spacer { display: none; }
  .facts strong { font-size: 18px; white-space: normal; line-height: 1.25; }
  .holder { padding: 12px 14px; gap: 4px 12px; }
  .row { grid-template-columns: 26px minmax(0, 1fr) auto 58px; gap: 10px; padding: 10px 14px; }
  .row canvas { display: none; }
  .board-head span { display: none; }
  .site-foot .links { margin-left: 0; }
}
@media (hover: none), (max-width: 760px) {
  .touch-controls { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

.grok-kicker { display: inline-flex; align-items: center; gap: 8px; }
.grok-kicker img { width: 20px; height: 20px; border-radius: 5px; }
