:root {
  --bg: #07110e;
  --bg-accent: #020706;
  --panel: rgba(10, 18, 15, 0.88);
  --panel-strong: rgba(8, 14, 12, 0.96);
  --ink: #d9ffe7;
  --muted: #82aa94;
  --line: rgba(79, 255, 173, 0.17);
  --brand: #57ffb2;
  --brand-deep: #a7ffd1;
  --safe: #57ffb2;
  --warn: #f1d66b;
  --risk: #ff667d;
  --unknown: #8fb4ff;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
  --radius-xl: 8px;
  --radius-lg: 6px;
  --radius-md: 4px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(87, 255, 178, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(143, 180, 255, 0.12), transparent 22%),
    linear-gradient(180deg, #091311 0%, var(--bg) 44%, var(--bg-accent) 100%);
  font-family: "IBM Plex Mono", monospace;
}

.noise,
body::before,
body::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(87, 255, 178, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(87, 255, 178, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.7;
}

body::after {
  content: "";
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02) 0,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 4px
  );
  background-size: 100% 4px;
  opacity: 0.12;
}

.noise {
  z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 0.6px, transparent 0.6px);
  background-size: 8px 8px;
  opacity: 0.06;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero,
.layout,
.insights {
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
}

.hero-copy::before,
.hero-card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(87, 255, 178, 0.08);
  pointer-events: none;
}

.hero-copy,
.hero-card {
  border-radius: var(--radius-xl);
  padding: 20px 24px;
}

.eyebrow,
.card-kicker,
.field-label,
.sample-group span,
.select-wrap span {
  margin: 0 0 10px;
  color: var(--brand-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.btc-logo {
  display: block;
  flex-shrink: 0;
}

h1,
h2,
h3,
p,
ul,
ol,
dl {
  margin-top: 0;
}

h1 {
  max-width: none;
  margin-bottom: 12px;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow: 0 0 22px rgba(87, 255, 178, 0.14);
}

.hero-text,
.hero-note,
.research-link,
.status-message,
.result-summary p,
.insight-card p,
.tier-list,
.hero-points {
  color: var(--muted);
}

.hero-text {
  max-width: 56ch;
  font-size: 1.08rem;
  line-height: 1.6;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 0;
  margin: 20px 0 0;
  list-style: none;
}

.hero-points li {
  padding: 9px 12px;
  border-radius: 2px;
  background: rgba(10, 26, 20, 0.74);
  border: 1px solid var(--line);
}

.hero-card ol {
  padding-left: 18px;
  margin-bottom: 18px;
  line-height: 1.7;
}

.research-link {
  margin-bottom: 14px;
  line-height: 1.6;
}

.research-link a {
  color: var(--brand-deep);
  font-weight: 700;
  text-decoration: underline;
}

a {
  color: var(--brand-deep);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 24px;
  margin-bottom: 24px;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 24px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
}

#clear-button {
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease;
}

#clear-button:hover {
  color: var(--ink);
  border-color: rgba(79, 255, 173, 0.35);
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  min-height: 54px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(2, 9, 7, 0.92);
  color: var(--ink);
}

input {
  padding: 0 16px;
  box-shadow: inset 0 0 0 1px rgba(87, 255, 178, 0.03);
}

textarea {
  resize: vertical;
  min-height: 160px;
  padding: 14px 16px;
  box-shadow: inset 0 0 0 1px rgba(87, 255, 178, 0.03);
}

select {
  padding: 0 40px 0 14px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--brand-deep) 50%),
    linear-gradient(135deg, var(--brand-deep) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

button {
  border: 0;
  cursor: pointer;
}

#check-button,
.sample-button {
  transition: transform 180ms ease, opacity 180ms ease, background-color 180ms ease;
}

#check-button {
  padding: 0 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(87, 255, 178, 0.2) 0%, rgba(87, 255, 178, 0.06) 100%);
  color: var(--brand-deep);
  font-weight: 700;
  border: 1px solid rgba(87, 255, 178, 0.34);
  text-transform: uppercase;
}

#check-button:hover,
.sample-button:hover {
  transform: translateY(-1px);
}

.controls-row {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: 18px;
  margin-top: 16px;
  align-items: end;
}

.endpoint-wrap {
  min-width: 0;
}

.endpoint-wrap[hidden] {
  display: none;
}

.helper-text {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.sample-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.sample-button {
  padding: 6px 12px;
  border-radius: 2px;
  background: rgba(10, 24, 19, 0.88);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  transition: transform 180ms ease, color 180ms ease, border-color 180ms ease;
}

.sample-button:hover {
  color: var(--ink);
  border-color: rgba(79, 255, 173, 0.35);
}

.status-message {
  min-height: 24px;
  margin: 16px 0 0;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.risk-badge {
  padding: 10px 14px;
  border-radius: 2px;
  font-weight: 700;
  border: 1px solid transparent;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
}

.risk-badge.mini {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 6px;
}

.badge-label {
  display: block;
  font-size: 1rem;
}

.badge-tier {
  display: block;
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.65;
  letter-spacing: 0.08em;
}

.risk-badge.neutral {
  color: var(--muted);
  background: rgba(93, 85, 117, 0.08);
  border-color: rgba(93, 85, 117, 0.14);
}

.risk-badge.high {
  color: var(--risk);
  background: rgba(179, 59, 46, 0.1);
  border-color: rgba(179, 59, 46, 0.16);
}

.risk-badge.medium {
  color: var(--warn);
  background: rgba(169, 105, 19, 0.12);
  border-color: rgba(169, 105, 19, 0.16);
}

.risk-badge.low {
  color: var(--safe);
  background: rgba(46, 125, 88, 0.1);
  border-color: rgba(46, 125, 88, 0.16);
}

.risk-badge.unknown {
  color: var(--unknown);
  background: rgba(93, 85, 117, 0.1);
  border-color: rgba(93, 85, 117, 0.16);
}

.result-panel {
  transition: border-color 300ms ease, box-shadow 300ms ease;
}

.result-panel[data-risk="high"] {
  border-color: rgba(255, 102, 125, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 102, 125, 0.18), var(--shadow);
}

.result-panel[data-risk="medium"] {
  border-color: rgba(241, 214, 107, 0.5);
  box-shadow: 0 0 0 1px rgba(241, 214, 107, 0.15), var(--shadow);
}

.result-panel[data-risk="low"] {
  border-color: rgba(87, 255, 178, 0.45);
  box-shadow: 0 0 0 1px rgba(87, 255, 178, 0.15), var(--shadow);
}

.result-panel[data-risk="unknown"] {
  border-color: rgba(143, 180, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(143, 180, 255, 0.12), var(--shadow);
}

.result-summary {
  padding: 18px 0 8px;
}

.result-summary.empty {
  min-height: 140px;
}

.result-summary .mono {
  word-break: break-all;
  overflow-wrap: break-word;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 10px;
}

.result-summary h2 {
  margin-bottom: 10px;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  line-height: 1.02;
}

.batch-panel-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.export-csv-button {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.export-csv-button:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.batch-panel {
  margin: 6px 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(7, 14, 12, 0.88);
  border-radius: var(--radius-md);
}

.batch-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.batch-summary {
  margin: 0;
  color: var(--muted);
}

.batch-list {
  display: grid;
  gap: 10px;
}

.batch-item {
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: rgba(3, 10, 8, 0.9);
  color: var(--ink);
}

.batch-item.active {
  border-color: rgba(87, 255, 178, 0.48);
  box-shadow: inset 0 0 0 1px rgba(87, 255, 178, 0.18);
}

.batch-item-top,
.batch-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.batch-item-top {
  margin-bottom: 8px;
}

.batch-address {
  font-family: "IBM Plex Mono", monospace;
  word-break: break-all;
}

.batch-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 10px 0 0;
}

.metrics-grid div {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(7, 14, 12, 0.88);
  border: 1px solid var(--line);
}

.metrics-grid dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.metrics-grid dd {
  margin: 0;
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
}

.actions-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.action-link {
  margin: 14px 0 0;
  color: var(--muted);
}

.action-link a {
  color: var(--brand-deep);
}

.actions-panel ul,
.tier-list {
  padding-left: 18px;
  margin-bottom: 0;
  line-height: 1.7;
}

.tier-guide {
  list-style: none;
  padding-left: 0;
}

.tier-guide li {
  display: flex;
  align-items: center;
  padding: 4px 0;
}

.insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.insight-card {
  min-height: 180px;
}

.explainer {
  margin-top: 32px;
  position: relative;
  z-index: 1;
}

.explainer-header {
  margin-bottom: 20px;
}

.explainer-header h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.explainer-header p {
  color: var(--muted);
  max-width: 80ch;
  line-height: 1.7;
  margin-bottom: 10px;
}

.explainer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.explainer-card {
  min-height: 0;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  margin: 10px 0 6px;
}

.data-table th,
.data-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
}

.data-table th {
  color: var(--brand-deep);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.table-note {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.tip-jar {
  margin-top: 48px;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.tip-label {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

.tip-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 24, 19, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 16px;
}

.tip-address {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  color: var(--brand);
  text-decoration: none;
}

.tip-address:hover {
  text-decoration: underline;
}

.tip-copy {
  padding: 4px 12px;
  border-radius: var(--radius-md);
  background: rgba(87, 255, 178, 0.1);
  border: 1px solid rgba(87, 255, 178, 0.3);
  color: var(--brand-deep);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 180ms ease;
}

.tip-copy:hover {
  background: rgba(87, 255, 178, 0.18);
}

.tip-note {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.7;
}

@media (max-width: 960px) {
  .hero,
  .layout,
  .insights,
  .controls-row,
  .explainer-grid {
    grid-template-columns: 1fr;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  #check-button {
    min-height: 54px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 20px;
  }

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

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

  .batch-panel-header,
  .batch-item-top,
  .batch-item-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}
