@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;700&family=JetBrains+Mono:wght@400;500;700&display=swap");

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: local("JetBrains Mono");
}

:root {
  --canvas: #fdfcfc;
  --surface-soft: #f8f7f7;
  --surface-card: #f1eeee;
  --ink: #201d1d;
  --ink-deep: #0f0000;
  --charcoal: #302c2c;
  --body: #424245;
  --mute: #646262;
  --stone: #6e6e73;
  --ash: #9a9898;
  --hairline: rgba(15, 0, 0, 0.12);
  --hairline-strong: #646262;
  --surface-dark: #201d1d;
  --surface-dark-elevated: #302c2c;
  --on-dark: #fdfcfc;
  --accent: #007aff;
  --danger: #ff3b30;
  --warning: #ff9f0a;
  --success: #30d158;
  --font: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --rounded-sm: 4px;
  --section: 96px;
  --col: 960px;
  --frame: 1100px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  background: var(--canvas);
  color: var(--ink);
  min-height: 100vh;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; background: none; border: 0; }
button { cursor: pointer; }
code, pre { font-family: var(--font); }
.hidden { display: none !important; }

.wrap { width: min(var(--col), calc(100% - 48px)); margin: 0 auto; }
.wrap-wide { width: min(var(--frame), calc(100% - 48px)); margin: 0 auto; }

.site-header {
  height: 56px;
  border-bottom: 1px solid var(--hairline);
  background: var(--canvas);
  position: sticky;
  top: 0;
  z-index: 40;
}
.nav-inner {
  width: min(var(--frame), calc(100% - 48px));
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: baseline; gap: 10px; font-weight: 500; }
.brand-ascii { font-weight: 700; letter-spacing: 0.04em; }
.brand-sub { color: var(--mute); font-weight: 400; font-size: 14px; }
.nav-links { display: flex; gap: 8px; list-style: none; margin-left: auto; }
.nav-links a { font-weight: 500; padding: 8px 12px; color: var(--ink); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-mobile-toggle { display: none; padding: 8px 12px; color: var(--mute); }
.nav-mobile-menu { display: none; border-bottom: 1px solid var(--hairline); background: var(--canvas); padding: 8px 24px 16px; }
.nav-mobile-menu.open { display: block; }
.nav-mobile-menu a { display: block; padding: 8px 0; font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 4px 20px;
  border-radius: var(--rounded-sm);
  font-weight: 500;
  line-height: 2;
  white-space: nowrap;
}
.btn-primary { background: var(--ink); color: var(--on-dark); }
.btn-primary:active { background: var(--ink-deep); }
.btn-secondary { background: var(--canvas); color: var(--ink); border: 1px solid var(--hairline-strong); }
.btn-ghost { color: var(--mute); padding: 4px 12px; }
.btn-sm { height: 32px; padding: 4px 12px; font-size: 14px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--rounded-sm);
  font-size: 14px;
  line-height: 2;
  background: var(--surface-dark);
  color: var(--on-dark);
}
.badge-mute { background: transparent; color: var(--mute); padding: 0; }

.input-field {
  height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-sm);
  background: var(--surface-soft);
  color: var(--ink);
  width: 100%;
  outline: none;
}
.input-field:focus { background: var(--canvas); border-color: var(--ink); }
.input-field::placeholder { color: var(--ash); }

.section { padding: var(--section) 0; border-top: 1px solid var(--hairline); }
.section:first-of-type { border-top: 0; }
.heading-md { font-size: 16px; font-weight: 700; line-height: 1.5; margin-bottom: 16px; }
.display { font-size: 38px; font-weight: 700; line-height: 1.5; }
.body { color: var(--body); }
.mute { color: var(--mute); }
.caption { font-size: 14px; line-height: 2; color: var(--mute); }
.link { text-decoration: underline; }

.hero-tui {
  background: var(--surface-dark);
  color: var(--on-dark);
  padding: 64px 32px 32px;
}
.hero-ascii {
  white-space: pre;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  font-size: 13px;
  color: var(--on-dark);
  margin: 0 0 32px;
}
.tui-prompt {
  background: var(--surface-dark-elevated);
  border-radius: var(--rounded-sm);
  padding: 8px 12px;
  max-width: 720px;
  margin: 0 auto 24px;
  color: var(--on-dark);
  overflow-x: auto;
}
.tui-prompt .tok { color: var(--accent); }
.tui-prompt .ok { color: var(--success); }
.tui-prompt .warn { color: var(--warning); }
.tui-hints { text-align: center; color: var(--ash); font-size: 14px; line-height: 2; }

.list-row { padding: 8px 0; color: var(--body); }
.list-row b { color: var(--ink); font-weight: 500; }
.mark { color: var(--mute); margin-right: 12px; }

.snippet {
  background: var(--surface-card);
  border-radius: var(--rounded-sm);
  padding: 12px 16px;
  position: relative;
  overflow-x: auto;
}
.snippet pre { margin: 0; font-size: 16px; line-height: 1.5; white-space: pre; }
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--rounded-sm);
  color: var(--mute);
  font-size: 14px;
}
.copy-btn:active { color: var(--ink); }

.tabs { display: flex; border-bottom: 1px solid var(--hairline-strong); margin-bottom: 12px; }
.tab { padding: 8px 16px; color: var(--mute); font-weight: 500; line-height: 2; border-radius: 0; background: none; }
.tab.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ash); }

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 32px 0;
  margin-top: 0;
}
.footer-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--hairline);
  border-left: 0;
  border-right: 0;
}
.footer-links a {
  text-align: center;
  padding: 12px 8px;
  font-size: 14px;
  line-height: 2;
  border-right: 1px solid var(--hairline);
}
.footer-links a:last-child { border-right: 0; }
.footer-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  font-size: 14px;
  line-height: 2;
  color: var(--mute);
}

.kol-toolbar { display: flex; gap: 8px; align-items: center; margin: 16px 0 16px; flex-wrap: wrap; }
.kol-toolbar .input-field { max-width: 360px; }
.sort-tabs { display: flex; flex-wrap: wrap; width: 100%; }
.kol-fomo { display: inline-block; margin-top: 8px; font-size: 14px; line-height: 2; text-decoration: underline; }
.kol-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kol-card {
  border-top: 1px solid var(--hairline);
  padding: 16px 16px 16px 0;
  min-width: 0;
}
.kol-card:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--hairline); }
.kol-rank { color: var(--ash); font-size: 14px; }
.kol-handle { font-weight: 700; }
.kol-name { color: var(--mute); font-size: 14px; }
.pnl-pos { color: var(--success); font-weight: 500; }
.pnl-neg { color: var(--danger); font-weight: 500; }
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  margin: 8px 0;
  font-size: 14px;
  line-height: 2;
  color: var(--mute);
}
.stat-grid b { color: var(--ink); font-weight: 500; }
.addr { font-size: 14px; color: var(--stone); word-break: break-all; cursor: pointer; }

.docs-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  padding: 48px 0 var(--section);
}
.docs-toc { position: sticky; top: 72px; align-self: start; }
.docs-toc a {
  display: block;
  padding: 8px 0;
  font-size: 14px;
  line-height: 2;
  color: var(--mute);
  border-bottom: 1px solid var(--hairline);
}
.docs-toc a:hover, .docs-toc a.active { color: var(--ink); }
.md h1 { font-size: 38px; font-weight: 700; line-height: 1.5; margin: 0 0 24px; }
.md h2 { font-size: 16px; font-weight: 700; margin: 48px 0 16px; padding-top: 16px; border-top: 1px solid var(--hairline); scroll-margin-top: 72px; }
.md h3 { font-size: 16px; font-weight: 500; margin: 24px 0 8px; scroll-margin-top: 72px; }
.md p, .md li { color: var(--body); margin: 0 0 12px; }
.md a { text-decoration: underline; }
.md ul { list-style: none; }
.md li { padding: 8px 0; }
.md table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; margin: 12px 0 24px; }
.md th, .md td { text-align: left; vertical-align: top; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--hairline); }
.md th { color: var(--ink); font-weight: 500; }
.md td { color: var(--body); }
.md code { background: var(--surface-card); padding: 0 6px; border-radius: var(--rounded-sm); font-size: 14px; }
.md .snippet code { background: none; padding: 0; font-size: 16px; }
.md ol { list-style: decimal; padding-left: 1.5rem; margin: 8px 0 24px; }
.md ol li { color: var(--body); margin: 0 0 16px; padding: 0; }
.md ol li p { margin: 0 0 8px; }

.use-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.use-card {
  border: 1px solid var(--hairline);
  background: var(--canvas);
  padding: 24px 20px;
}
.use-idx { color: var(--ash); font-size: 14px; line-height: 2; }
.use-card h3 { font-size: 16px; font-weight: 700; margin: 4px 0 12px; }
.use-card p { color: var(--body); margin: 0; }
@media (min-width: 850px) {
  .use-grid { grid-template-columns: repeat(3, 1fr); gap: 0; }
  .use-card { border-left: 0; }
  .use-card:first-child { border-left: 1px solid var(--hairline); }
}

.log-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.log-table th, .log-table td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.log-table th { color: var(--mute); font-weight: 500; }
.ok-yes { color: var(--success); }
.ok-no { color: var(--danger); }

.llms-hero { padding: 48px 0 24px; }
.tui-frame {
  background: var(--surface-dark);
  color: var(--on-dark);
  padding: 24px;
  min-height: 480px;
}
.tui-bar { display: flex; justify-content: space-between; gap: 12px; color: var(--ash); font-size: 14px; margin-bottom: 16px; }
.tui-frame pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.6;
  max-height: 70vh;
  overflow: auto;
  color: var(--on-dark);
}

dialog.modal { border: 0; padding: 0; background: transparent; max-width: 100%; }
dialog.modal::backdrop { background: rgba(15, 0, 0, 0.35); }
dialog.modal[open] { display: grid; place-items: center; width: 100%; height: 100%; }
.modal-box {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  width: min(420px, calc(100vw - 32px));
  padding: 24px 20px;
}
.modal-title { font-weight: 700; margin-bottom: 8px; }
.modal-subtitle { color: var(--mute); margin-bottom: 16px; font-size: 14px; line-height: 2; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast-host { position: fixed; top: 16px; right: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast-item { background: var(--ink); color: var(--on-dark); padding: 8px 12px; border-radius: var(--rounded-sm); font-size: 14px; }
.toast-error { background: var(--danger); }
.toast-success { background: var(--success); color: var(--ink-deep); }

.dropdown { position: relative; }
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--canvas);
  border: 1px solid var(--hairline);
  min-width: 180px;
  z-index: 50;
}
.dropdown-menu.open { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 2;
}
.auth-pill { font-size: 14px; color: var(--mute); padding: 4px 8px; }

.hero-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--hairline); margin-top: 48px; }
.metric { padding: 16px 16px 0 0; }
.metric + .metric { border-left: 1px solid var(--hairline); padding-left: 16px; }
.metric .label { font-size: 14px; color: var(--mute); line-height: 2; }
.metric .value { font-weight: 700; }

@media (max-width: 850px) {
  :root { --section: 64px; }
  .footer-links { grid-template-columns: 1fr 1fr; }
  .footer-links a { border-bottom: 1px solid var(--hairline); }
  .docs-shell { grid-template-columns: 1fr; gap: 24px; }
  .docs-toc { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .kol-grid { grid-template-columns: 1fr; }
  .kol-card:nth-child(even) { padding-left: 0; border-left: 0; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-mobile-toggle { display: inline-flex; }
  .display { font-size: 28px; }
  .hero-tui { padding: 40px 16px 24px; }
  .hero-ascii { font-size: 8px; }
  .kol-toolbar { flex-direction: column; align-items: stretch; }
  .kol-toolbar .input-field { max-width: none; }
  .hero-metrics { grid-template-columns: 1fr; }
  .metric + .metric { border-left: 0; border-top: 1px solid var(--hairline); padding: 16px 0 0; }
  .footer-links { grid-template-columns: 1fr; }
  .footer-meta { flex-direction: column; }
}
@media (max-width: 640px) {
  :root { --section: 48px; }
  .wrap, .wrap-wide, .nav-inner { width: calc(100% - 32px); }
}
