/* ═══════════════════════════════════════════════════════════
   kxi — strict black & white brutalist system
   1px hairlines · sharp corners · inversion hovers · film grain
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg:   #000000;  /* background          */
  --fg:   #ffffff;  /* foreground          */
  --g1:   #e8e8e8;  /* bright data         */
  --g2:   #a8a8a8;  /* secondary text      */
  --g3:   #666666;  /* muted text          */
  --g4:   #333333;  /* inner hairlines     */
  --g5:   #1a1a1a;  /* subtle fill         */
  --line: #ffffff;  /* structural hairline */
  --mono: 'JetBrains Mono', 'Space Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --sans: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--fg); color: var(--bg); }

* { scrollbar-width: thin; scrollbar-color: var(--fg) var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--fg); border: 2px solid var(--bg); }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 1px dashed var(--fg);
  outline-offset: 3px;
}

/* ── film grain overlay (~4%) ─────────────────────────────── */
body::after {
  content: "";
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 9s steps(10) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-4%, -6%); }
  20% { transform: translate(-9%, 3%); }
  30% { transform: translate(5%, -10%); }
  40% { transform: translate(-3%, 9%); }
  50% { transform: translate(-8%, -4%); }
  60% { transform: translate(7%, 2%); }
  70% { transform: translate(-1%, 7%); }
  80% { transform: translate(3%, -8%); }
  90% { transform: translate(-6%, 4%); }
}

/* ── blinking cursor ──────────────────────────────────────── */
.cursor, .blink { animation: blink 1.06s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* ── buttons: inversion on hover ──────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 11px 22px;
  border: 1px solid var(--fg);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover, .btn:active { background: var(--fg); color: var(--bg); }
.btn-solid { background: var(--fg); color: var(--bg); }
.btn-solid:hover, .btn-solid:active { background: var(--bg); color: var(--fg); }
.btn-sm { padding: 8px 16px; font-size: 10.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.btn[disabled]:hover, .btn[disabled]:active { background: transparent; color: var(--fg); }
.btn-solid[disabled]:hover, .btn-solid[disabled]:active { background: var(--fg); color: var(--bg); }

/* ── header wallet chip + offline bar ─────────────────────── */
#walletChip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.offline-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 16px;
  padding: 7px 24px;
  border-top: 1px solid var(--line);
  background: var(--fg);
  color: var(--bg);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.offline-bar a { color: var(--bg); font-weight: 700; text-decoration: none; border-bottom: 1px solid var(--bg); }
.offline-bar a:hover { background: var(--bg); color: var(--fg); }

/* ── header ───────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.logo {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}
.main-nav { display: flex; justify-self: center; }
.main-nav a {
  color: var(--g2);
  text-decoration: none;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 8px 14px;
}
.main-nav a:hover { color: var(--bg); background: var(--fg); }
.header-actions { justify-self: end; }

/* ── hero ─────────────────────────────────────────────────── */
.hero { border-bottom: 1px solid var(--line); }
.hero-inner {
  max-width: 1240px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 150px 24px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-kicker {
  font-size: 11.5px;
  letter-spacing: 0.16em;
  color: var(--g2);
  margin-bottom: 28px;
}
.hero-title {
  font-family: var(--sans);
  font-weight: 900;
  font-size: clamp(38px, 9.2vw, 148px);
  line-height: 0.96;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  margin-bottom: 28px;
}
.ht-line { display: block; }
.ht-outline { color: var(--fg); }
@supports ((-webkit-text-stroke: 1px #fff) or (text-stroke: 1px #fff)) {
  .ht-outline { color: transparent; -webkit-text-stroke: 1.5px var(--fg); }
}
.hero-sub {
  max-width: 560px;
  color: var(--g2);
  font-size: 13.5px;
  margin-bottom: 36px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 56px; }

/* ── live stats bar ───────────────────────────────────────── */
.stats-bar {
  display: flex;
  border: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.stats-bar::-webkit-scrollbar { display: none; }
.stat {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 20px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
  flex: 1 0 auto;
}
.stat:last-child { border-right: none; }
.stat-label {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--g3);
}
.stat-value {
  font-size: 14.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── sections ─────────────────────────────────────────────── */
.section { border-bottom: 1px solid var(--line); scroll-margin-top: 61px; }
main > .section:last-child { border-bottom: 0; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 88px 24px; }
.section-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding-bottom: 18px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--g4);
}
.section-num { color: var(--g3); font-size: 13px; }
.section-head h2 {
  font-family: var(--sans);
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(26px, 3.6vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1;
}
.section-note {
  margin-left: auto;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--g3);
  white-space: nowrap;
}

/* ── mining terminal ──────────────────────────────────────── */
.mining-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  border: 1px solid var(--line);
}
.terminal { display: flex; flex-direction: column; min-width: 0; }
.terminal-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--g2);
}
.terminal-live { white-space: nowrap; }
.live-dot { animation: blink 1.2s steps(2, start) infinite; }
.terminal-body {
  height: 430px;
  overflow-y: auto;
  padding: 18px 16px;
  font-size: 12.5px;
  line-height: 1.75;
  scrollbar-width: none;
}
.terminal-body::-webkit-scrollbar { display: none; }
.t-line { white-space: pre-wrap; word-break: break-all; color: var(--g1); }
.t-prompt { color: var(--fg); }
.t-dim { color: var(--g3); }
.t-near { color: var(--fg); }
.t-hit {
  display: table;
  max-width: 100%;
  background: var(--fg);
  color: var(--bg);
  font-weight: 700;
  padding: 0 10px;
  margin: 3px 0;
}
.t-err {
  background: var(--g5);
  border-left: 3px solid var(--fg);
  padding-left: 10px;
  color: var(--fg);
}
.t-block {
  border-top: 1px solid var(--g4);
  border-bottom: 1px solid var(--g4);
  padding: 3px 0;
  color: var(--fg);
}

/* ── mining controls ──────────────────────────────────────── */
.mining-controls {
  border-left: 1px solid var(--line);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.field-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--g2);
  margin-bottom: 8px;
}
.input {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  border-radius: 0;
  font-family: var(--mono);
  font-size: 13px;
  padding: 12px 14px;
}
.input::placeholder { color: var(--g3); }
.input:focus { outline: none; background: var(--fg); color: var(--bg); }
.input:focus::placeholder { color: var(--g2); }
.input-err { border-style: dashed; }
.field-error {
  display: none;
  margin-top: 8px;
  font-size: 11px;
  color: var(--fg);
  background: var(--g5);
  border-left: 3px solid var(--fg);
  padding: 7px 10px;
}
.field-error.show { display: block; }
.status-line {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--g3);
}
.status-value { color: var(--fg); font-weight: 700; }
.mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--g4);
}
.mini-stats > div { padding: 12px 14px; }
.mini-stats > div:nth-child(odd) { border-right: 1px solid var(--g4); }
.mini-stats > div:nth-child(-n+2) { border-bottom: 1px solid var(--g4); }
.mini-stats dt {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--g3);
  margin-bottom: 4px;
}
.mini-stats dd {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.note { font-size: 11px; color: var(--g3); line-height: 1.6; }

/* ── data tables ──────────────────────────────────────────── */
.table-border { border: 1px solid var(--line); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left;
  font-weight: 500;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--g3);
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--g4);
  color: var(--g1);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--fg); }
.data-table tbody tr:hover td { color: var(--bg); }
.td-dim { color: var(--g3); }
tr.flash td { animation: rowflash 1.5s steps(4) 1; }
@keyframes rowflash {
  0% { background: var(--fg); color: var(--bg); }
  100% { background: transparent; color: inherit; }
}

/* ── wallet & transfers ───────────────────────────────────── */
.wallet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
  align-items: start;
}
.panel-box {
  border: 1px solid var(--line);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sub-head-embedded {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--g2);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--g4);
}
.addr { word-break: break-all; text-align: right; color: var(--fg); }
.key-box {
  border: 1px dashed var(--g4);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.key-row { display: flex; gap: 10px; align-items: flex-start; }
.key-secret {
  flex: 1;
  font-size: 11px;
  line-height: 1.7;
  word-break: break-all;
  color: var(--g2);
  font-variant-numeric: tabular-nums;
}
.key-secret.revealed { color: var(--fg); background: var(--g5); padding: 6px 8px; border: 1px solid var(--g4); }
.key-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tx-status { color: var(--g3); }
.tx-status.sealed { color: var(--fg); font-weight: 700; }
.calc-rows { display: flex; flex-direction: column; }
.calc-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--g4);
  font-size: 12px;
  color: var(--g2);
}
.calc-row span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  padding-top: 2px;
  color: var(--g3);
}
.calc-total { border-bottom: none; padding-top: 14px; }
.calc-total span { color: var(--fg); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.order-log {
  border: 1px solid var(--g4);
  padding: 12px 14px;
  min-height: 76px;
  font-size: 11.5px;
  line-height: 1.8;
}

/* ── explorer ─────────────────────────────────────────────── */
.explorer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
}
.explorer-block { min-width: 0; }
.explorer-block + .explorer-block { border-left: 1px solid var(--line); }
.sub-head {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--g2);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.table-scroll { overflow-x: auto; }
.table-scroll .data-table { min-width: 580px; }

/* ── footer ───────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 11.5px;
  color: var(--g3);
}
.footer-mid { margin-left: auto; }
.footer-link {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--fg);
  padding: 1px 2px;
}
.footer-link:hover { background: var(--fg); color: var(--bg); }

/* ── noscript ─────────────────────────────────────────────── */
.noscript-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--fg);
  color: var(--bg);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 16px;
  text-align: center;
  z-index: 9500;
}

/* ── responsive ───────────────────────────────────────────── */
@media (max-width: 1020px) {
  .mining-grid { grid-template-columns: 1fr; }
  .mining-controls { border-left: none; border-top: 1px solid var(--line); }
  .terminal-body { height: 360px; }
  .wallet-grid { grid-template-columns: 1fr; gap: 32px; }
  .explorer-grid { grid-template-columns: 1fr; }
  .explorer-block + .explorer-block { border-left: none; border-top: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    height: auto;
    padding: 12px 16px;
    row-gap: 10px;
  }
  .main-nav {
    grid-row: 2;
    grid-column: 1 / -1;
    justify-self: stretch;
    border-top: 1px solid var(--g4);
    padding-top: 10px;
  }
  .main-nav a { flex: 1; text-align: center; padding: 8px 0; }
  .section { scroll-margin-top: 110px; }
  .hero-inner { padding: 120px 16px 40px; }
  .hero-title { font-size: clamp(34px, 11vw, 72px); }
  .hero-cta .btn { flex: 1; }
  .wrap { padding: 60px 16px; }
  .section-note { display: none; }
  .section-head { flex-wrap: wrap; }
  .terminal-body { height: 300px; font-size: 11.5px; }
  .stat { padding: 12px 14px; }
  .input { font-size: 16px; }
  .mining-controls, .panel-box { padding: 20px 16px; }
  .key-row { flex-direction: column; }
  .calc-row { flex-direction: column; gap: 4px; }
  .addr { text-align: left; }
  #walletChip { max-width: 170px; }
}

/* ── reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor, .blink, .live-dot { animation: none; }
  body::after { animation: none; }
  tr.flash td { animation: none; }
}
