:root {
  color-scheme: dark;
  --bg: #080d11;
  --panel: #0f171c;
  --panel-2: #131f25;
  --line: rgba(117, 255, 233, 0.22);
  --kaspa: #70fff0;
  --kaspa-2: #35d4bf;
  --text: #f3fbfa;
  --muted: #8aa2a0;
  --warning: #f5c76b;
  --danger: #ff7f9d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 48% 0%, rgba(112, 255, 240, 0.16), transparent 34rem),
    linear-gradient(135deg, #080d11 0%, #11171b 48%, #071411 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: calc(100vh - 86px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 13, 17, 0.78);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: clamp(18px, 2vw, 24px);
}

.brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(112, 255, 240, 0.58));
}

.wallet-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button,
.icon-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-weight: 750;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  display: inline-grid;
  place-items: center;
  font-size: 20px;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.vault-button {
  color: var(--kaspa);
  background: rgba(112, 255, 240, 0.1);
}

.button:hover,
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(112, 255, 240, 0.62);
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary {
  border-color: rgba(112, 255, 240, 0.8);
  background: linear-gradient(180deg, var(--kaspa), var(--kaspa-2));
  color: #06100f;
  box-shadow: 0 0 28px rgba(53, 212, 191, 0.26);
}

.secondary {
  background: rgba(112, 255, 240, 0.1);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 20px;
  padding: clamp(18px, 4vw, 56px);
}

.sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding-right: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-tab {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(112, 255, 240, 0.1);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.tool-tab:not(.active) {
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
}

.tool-tab:not(.active) .tool-dot {
  opacity: 0.42;
  box-shadow: none;
}

.tool-tab:hover {
  border-color: rgba(112, 255, 240, 0.52);
}

.tool-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--kaspa);
  box-shadow: 0 0 18px var(--kaspa);
}

.panel {
  border: 1px solid rgba(112, 255, 240, 0.24);
  border-radius: 8px;
  background: rgba(15, 23, 28, 0.82);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.tool-panel {
  display: block;
}

.panel-head,
.snapshot-form,
.status-panel {
  padding: clamp(18px, 3vw, 32px);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.eyebrow,
.muted {
  margin: 0 0 8px;
  color: var(--kaspa);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.02;
}

h2 {
  font-size: 18px;
}

.wallet-pill {
  flex: 0 0 auto;
  max-width: 290px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.mode-grid {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mode-card {
  min-height: 148px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-2);
  cursor: pointer;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 9px;
  align-content: start;
}

.mode-card input {
  accent-color: var(--kaspa);
}

.mode-card:has(input:checked) {
  border-color: rgba(112, 255, 240, 0.82);
  box-shadow: inset 0 0 0 1px rgba(112, 255, 240, 0.18), 0 0 28px rgba(112, 255, 240, 0.11);
}

.mode-card span {
  font-weight: 850;
}

.mode-card small,
.muted {
  color: var(--muted);
}

.mode-card strong {
  color: var(--kaspa);
  align-self: end;
  justify-self: center;
  text-align: center;
}

.warning {
  margin-top: 18px;
  border: 1px solid rgba(245, 199, 107, 0.38);
  border-radius: 8px;
  padding: 12px 14px;
  color: #ffe6ab;
  background: rgba(245, 199, 107, 0.09);
}

.form-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  color: #c6d8d6;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #0a1115;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus {
  border-color: var(--kaspa);
  box-shadow: 0 0 0 3px rgba(112, 255, 240, 0.12);
}

input:disabled,
select:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--kaspa) 50%), linear-gradient(135deg, var(--kaspa) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 12px) 19px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field-hint {
  color: var(--muted);
  line-height: 1.45;
}

.collections-panel {
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.collection-head,
.summary-row,
.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stepper span {
  width: 28px;
  text-align: center;
  color: var(--kaspa);
  font-weight: 900;
}

.collections-list {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.collection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
}

.summary-row {
  margin-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 18px;
}

.summary-row > div {
  display: grid;
  gap: 4px;
}

.status-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.16);
}

.status-panel p {
  color: var(--muted);
}

.pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--kaspa);
  box-shadow: 0 0 0 0 rgba(112, 255, 240, 0.7);
  animation: pulse 1.6s infinite;
}

.download {
  width: fit-content;
  text-decoration: none;
}

.footer-flow {
  min-height: 86px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  color: var(--kaspa);
  font-weight: 900;
  border-top: 1px solid rgba(112, 255, 240, 0.18);
  background: #07100f;
}

.footer-flow::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(112, 255, 240, 0.35), transparent);
  filter: blur(18px);
  transform: translateX(-100%);
  animation: flow 5s linear infinite;
}

.footer-flow span {
  position: relative;
  text-shadow: 0 0 18px rgba(112, 255, 240, 0.85);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid rgba(112, 255, 240, 0.35);
  border-radius: 8px;
  padding: 14px 16px;
  background: #0d171b;
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  z-index: 10;
}

.vault-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.vault-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.vault-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid rgba(112, 255, 240, 0.28);
  border-radius: 8px;
  background: #0b1216;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.vault-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vault-copy,
.vault-address,
.vault-empty,
.vault-list {
  margin: 0;
  padding-inline: 22px;
}

.vault-copy {
  padding-top: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.vault-address {
  margin-top: 14px;
  color: var(--kaspa);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.vault-list {
  display: grid;
  gap: 10px;
  padding-block: 18px 22px;
}

.vault-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.vault-item h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.vault-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.vault-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.vault-badge {
  border: 1px solid rgba(112, 255, 240, 0.24);
  border-radius: 999px;
  padding: 4px 8px;
  color: #bffcf5;
  font-size: 12px;
  background: rgba(112, 255, 240, 0.08);
}

.vault-badge.failed {
  border-color: rgba(255, 127, 157, 0.32);
  color: #ffb5c5;
  background: rgba(255, 127, 157, 0.08);
}

.vault-empty {
  padding-block: 18px 22px;
  color: var(--muted);
}

.xray-form {
  padding: clamp(18px, 3vw, 32px);
}

.xray-note,
.xray-disclaimer {
  border: 1px solid rgba(112, 255, 240, 0.22);
  border-radius: 8px;
  padding: 12px 14px;
  color: #c7e9e6;
  background: rgba(112, 255, 240, 0.06);
  line-height: 1.5;
}

.xray-grid {
  grid-template-columns: minmax(0, 1fr) 190px;
}

.xray-options,
.xray-filters {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 190px 170px minmax(180px, 1fr);
  gap: 14px;
  align-items: end;
}

.xray-filters {
  margin-top: 0;
  grid-template-columns: 1fr repeat(3, minmax(150px, 190px));
}

.check-field {
  min-height: 46px;
  border: 1px solid rgba(112, 255, 240, 0.22);
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(112, 255, 240, 0.06);
}

.check-field input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--kaspa);
}

.xray-results {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: clamp(18px, 3vw, 32px);
  display: grid;
  gap: 18px;
}

.xray-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.xray-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.xray-stats span,
.relationship-flags span {
  border: 1px solid rgba(112, 255, 240, 0.22);
  border-radius: 999px;
  padding: 6px 9px;
  color: #bffcf5;
  font-size: 12px;
  background: rgba(112, 255, 240, 0.08);
}

.xray-canvas-wrap {
  width: 100%;
  aspect-ratio: 900 / 460;
  min-height: 280px;
  border: 1px solid rgba(112, 255, 240, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(rgba(112, 255, 240, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(112, 255, 240, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(112, 255, 240, 0.12), transparent 28rem),
    #071013;
  background-size: 42px 42px, 42px 42px, auto, auto;
}

#xrayGraph {
  width: 100%;
  height: 100%;
  display: block;
}

#xrayGraph text {
  fill: #b9d2cf;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.target-node {
  fill: var(--kaspa);
  filter: url(#glow);
  stroke: rgba(255, 255, 255, 0.8);
  stroke-width: 2;
}

.graph-node {
  fill: #0f171c;
  stroke: var(--kaspa);
  stroke-width: 2;
  filter: url(#glow);
}

.entity-ring {
  fill: none;
  stroke: rgba(245, 199, 107, 0.64);
  stroke-width: 2;
  stroke-dasharray: 5 7;
}

.risk-ring {
  fill: none;
  stroke: rgba(255, 127, 157, 0.62);
  stroke-width: 2;
}

.graph-node.indirect {
  stroke: var(--warning);
}

.graph-node.krc20-holder {
  stroke: #ff7f9d;
  stroke-width: 3;
}

.relationship-list,
.cluster-list {
  display: grid;
  gap: 10px;
}

.cluster-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cluster-item {
  border: 1px solid rgba(112, 255, 240, 0.16);
  border-radius: 8px;
  padding: 14px;
  background: rgba(112, 255, 240, 0.045);
}

.cluster-item h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.relationship-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.relationship-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  cursor: pointer;
}

.relationship-main h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.relationship-flags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 12px;
}

.relationship-evidence {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.relationship-evidence p {
  margin: 6px 0 0;
}

.relationship-evidence code {
  display: inline-block;
  max-width: 100%;
  margin: 3px 5px 3px 0;
  border: 1px solid rgba(112, 255, 240, 0.16);
  border-radius: 6px;
  padding: 3px 6px;
  color: #dcfffb;
  background: rgba(0, 0, 0, 0.22);
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 14px rgba(112, 255, 240, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(112, 255, 240, 0);
  }
}

@keyframes flow {
  to {
    transform: translateX(100%);
  }
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    padding-right: 0;
  }

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

  .xray-options,
  .xray-filters,
  .cluster-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar,
  .panel-head,
  .summary-row {
    align-items: stretch;
    flex-direction: column;
  }

  .wallet-actions {
    width: 100%;
  }

  .wallet-actions .button {
    flex: 1;
  }

  .vault-item {
    grid-template-columns: 1fr;
  }

  .mode-grid,
  .form-grid,
  .collection-row,
  .xray-grid,
  .relationship-item {
    grid-template-columns: 1fr;
  }

  .xray-result-head {
    flex-direction: column;
  }

  .xray-stats,
  .relationship-flags {
    justify-content: flex-start;
  }

  h1 {
    font-size: 32px;
  }

  .summary-row .button {
    width: 100%;
  }
}
