:root {
  --bg: #05080d;
  --bg-2: #070c14;
  --panel: rgba(10, 17, 27, 0.84);
  --panel-solid: #0a111b;
  --line: #1a2a3b;
  --line-soft: rgba(26, 42, 59, 0.6);
  --text: #e8f1ff;
  --muted: #7f93a8;
  --dim: #53667a;
  --green: #45f0a5;
  --green-soft: rgba(69, 240, 165, 0.12);
  --amber: #ffb347;
  --amber-soft: rgba(255, 179, 71, 0.12);
  --red: #ff5f7e;
  --red-soft: rgba(255, 95, 126, 0.12);
  --blue: #5aa9ff;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --radius: 14px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(90, 169, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 169, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 0%, black, transparent 78%);
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  top: -22%;
  left: 50%;
  width: 980px;
  height: 640px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(69, 240, 165, 0.1), transparent 66%);
  pointer-events: none;
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

code,
.mono {
  font-family: var(--mono);
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, rgba(5, 8, 13, 0.94), rgba(5, 8, 13, 0.72));
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(69, 240, 165, 0.45);
  border-radius: 11px;
  color: var(--green);
  font-size: 21px;
  box-shadow: inset 0 0 22px rgba(69, 240, 165, 0.12),
    0 0 24px rgba(69, 240, 165, 0.08);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-text strong {
  letter-spacing: 0.12em;
  font-size: 13px;
}

.brand-text small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 26px;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.nav a {
  transition: color 0.2s ease;
}

.nav a:hover {
  color: var(--text);
}

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
}

.status[data-state="live"] {
  color: var(--green);
  border-color: rgba(69, 240, 165, 0.3);
  background: var(--green-soft);
}

.status[data-state="live"] .status-dot,
.status[data-state="polling"] .status-dot,
.status[data-state="sim"] .status-dot {
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 1.8s infinite;
}

.status[data-state="polling"] {
  color: var(--amber);
  border-color: rgba(255, 179, 71, 0.3);
  background: var(--amber-soft);
}

.status[data-state="sim"] {
  color: var(--blue);
  border-color: rgba(90, 169, 255, 0.3);
  background: rgba(90, 169, 255, 0.1);
}

.status[data-state="error"] {
  color: var(--red);
  border-color: rgba(255, 95, 126, 0.3);
  background: var(--red-soft);
}

.status[data-state="paused"] {
  color: var(--muted);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(69, 240, 165, 0.45);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(69, 240, 165, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(69, 240, 165, 0);
  }
}

/* ---------- layout ---------- */

main {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  padding-bottom: 60px;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 60px;
  align-items: center;
  padding: 74px 0 56px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-line {
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.hero h1 {
  margin: 22px 0 18px;
  font-size: clamp(46px, 5.6vw, 78px);
  font-weight: 560;
  line-height: 0.94;
  letter-spacing: -0.045em;
}

.hero h1 em {
  color: var(--green);
  font-style: normal;
}

.lede {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 30px;
}

.primary,
.ghost {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 16px;
  background: transparent;
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: 0.2s ease;
}

.primary {
  border-color: rgba(69, 240, 165, 0.55);
  background: var(--green);
  color: #04110b;
  font-weight: 700;
}

.primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 26px rgba(69, 240, 165, 0.25);
}

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

.ghost:hover {
  color: var(--text);
  border-color: #2d4660;
  background: rgba(255, 255, 255, 0.02);
}

.hero-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(14, 24, 36, 0.95), rgba(7, 12, 20, 0.92));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% -10%, rgba(90, 169, 255, 0.14), transparent 50%);
  pointer-events: none;
}

.hero-panel-head {
  display: flex;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.state-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 28px 18px;
}

.state-node {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(5, 9, 14, 0.55);
}

.state-kicker {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
}

.state-node strong {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

.state-node small {
  color: var(--dim);
  font-size: 9px;
}

.state-node.pending strong {
  color: var(--amber);
}

.state-node.included strong {
  color: var(--green);
}

.state-node.final strong {
  color: var(--blue);
}

.state-arrow {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 12px;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.hero-meta > div {
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.hero-meta > div:last-child {
  border-right: 0;
}

.hero-meta span {
  display: block;
  font-family: var(--mono);
  font-size: 16px;
}

.hero-meta small {
  color: var(--dim);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- control bar ---------- */

.controlbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(12px);
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(5, 9, 14, 0.6);
}

.segmented button {
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.segmented button.active {
  background: var(--green);
  color: #04110b;
  font-weight: 700;
}

.filters {
  display: flex;
  gap: 4px;
}

.filters button {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.filters button:hover {
  color: var(--text);
}

.filters button.active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.control-actions .ghost {
  padding: 8px 11px;
  font-size: 11px;
}

.rate {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
}

.rate input {
  width: 78px;
  accent-color: var(--blue);
}

.rate span {
  width: 34px;
  color: var(--muted);
}

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.stat {
  position: relative;
  padding: 16px 16px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(90, 169, 255, 0.35), transparent);
}

.stat span {
  display: block;
  font-family: var(--mono);
  font-size: 25px;
  letter-spacing: -0.03em;
}

.stat label {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.stat.pending span {
  color: var(--amber);
}

.stat.included span {
  color: var(--green);
}

.stat.dropped span {
  color: var(--red);
}

/* ---------- workspace ---------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
}

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

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.live-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s infinite;
}

.live-indicator[data-mode="sim"] {
  color: var(--blue);
}

.live-indicator[data-mode="poll"] {
  color: var(--amber);
}

.table-wrap {
  max-height: 560px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #253a50 transparent;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0a121d;
}

th {
  padding: 10px 12px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(26, 42, 59, 0.42);
  color: var(--muted);
  white-space: nowrap;
}

tbody tr {
  transition: background 0.16s ease;
  cursor: pointer;
}

tbody tr:hover {
  background: rgba(90, 169, 255, 0.06);
}

tbody tr.selected {
  background: rgba(90, 169, 255, 0.1);
  box-shadow: inset 2px 0 0 var(--blue);
}

tbody tr.is-new {
  animation: rowFlash 1.4s ease;
}

@keyframes rowFlash {
  0% {
    background: rgba(69, 240, 165, 0.16);
  }
  100% {
    background: transparent;
  }
}

td.hash {
  color: var(--text);
  font-family: var(--mono);
  font-size: 10.5px;
}

td.method {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
}

td.money {
  font-family: var(--mono);
  color: #b9cbe0;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.state-badge::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.state-badge.pending {
  color: var(--amber);
  border-color: rgba(255, 179, 71, 0.28);
  background: var(--amber-soft);
}

.state-badge.included {
  color: var(--green);
  border-color: rgba(69, 240, 165, 0.28);
  background: var(--green-soft);
}

.state-badge.dropped,
.state-badge.failed {
  color: var(--red);
  border-color: rgba(255, 95, 126, 0.28);
  background: var(--red-soft);
}

.state-badge.none {
  color: var(--dim);
}

.empty td {
  padding: 38px 16px;
  text-align: center;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
}

.side {
  display: grid;
  gap: 14px;
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: 180px;
  padding: 10px 12px 0;
}

.legend {
  display: flex;
  gap: 14px;
  padding: 8px 16px 14px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 2px;
  margin-right: 6px;
  vertical-align: middle;
  background: currentColor;
}

.legend .l-pending {
  color: var(--amber);
}

.legend .l-included {
  color: var(--green);
}

.legend .l-dropped {
  color: var(--red);
}

.detail-panel {
  min-height: 250px;
}

.detail-empty {
  padding: 28px 18px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.6;
}

.detail-body {
  padding: 16px 17px 18px;
}

.detail-hash {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-hash code {
  flex: 1;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 7px;
  background: transparent;
  color: var(--dim);
  font-size: 9px;
}

.copy:hover {
  color: var(--text);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 12px;
}

.detail-field span {
  display: block;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-field strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #c9d9ea;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline {
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.timeline-title {
  margin-bottom: 9px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.timeline-item {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 0 0 12px 14px;
  border-left: 1px solid var(--line);
}

.timeline-item:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.timeline-dot {
  position: absolute;
  left: -4px;
  top: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 0 3px var(--panel-solid);
}

.timeline-item.pending .timeline-dot {
  background: var(--amber);
}

.timeline-item.included .timeline-dot {
  background: var(--green);
}

.timeline-item.dropped .timeline-dot,
.timeline-item.failed .timeline-dot {
  background: var(--red);
}

.timeline-time {
  margin-left: auto;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
}

.timeline-label {
  color: #c9d9ea;
  font-family: var(--mono);
  font-size: 10px;
}

/* ---------- how ---------- */

.how {
  margin-top: 54px;
  padding-top: 38px;
  border-top: 1px solid var(--line);
}

.section-head h2 {
  margin: 16px 0 26px;
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 550;
  letter-spacing: -0.035em;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.how-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.how-grid article > span {
  color: var(--green);
  font-family: var(--mono);
  font-size: 10px;
}

.how-grid h3 {
  margin: 10px 0 7px;
  font-size: 13px;
  font-weight: 600;
}

.how-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.how-grid code {
  color: #a9c8e6;
  font-size: 10.5px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  padding: 20px 0 30px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
}

footer strong {
  color: var(--muted);
  font-weight: 500;
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 34px;
    padding-top: 50px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .side {
    grid-template-columns: 1fr 1fr;
  }

  .how-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .topbar,
  main,
  footer {
    width: calc(100% - 28px);
  }

  .nav {
    display: none;
  }

  .topbar {
    gap: 12px;
  }

  .status {
    margin-left: auto;
    font-size: 9px;
    padding: 6px 9px;
  }

  .hero {
    padding: 38px 0 30px;
  }

  .hero h1 {
    font-size: 44px;
  }

  .state-flow {
    flex-direction: column;
    align-items: stretch;
  }

  .state-arrow {
    transform: rotate(90deg);
    text-align: center;
  }

  .controlbar {
    gap: 10px;
  }

  .control-actions {
    width: 100%;
    margin-left: 0;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .side {
    grid-template-columns: 1fr;
  }

  .how-grid {
    grid-template-columns: 1fr;
  }

  footer {
    flex-direction: column;
  }

  .table-wrap {
    max-height: 480px;
  }

  table {
    min-width: 720px;
  }
}
