:root {
  color-scheme: dark;
  --bg: #050607;
  --panel: rgba(12, 15, 18, 0.84);
  --panel-strong: rgba(18, 24, 29, 0.94);
  --line: rgba(192, 214, 215, 0.16);
  --text: #edf7f4;
  --muted: #8aa09d;
  --cyan: #42f2e8;
  --green: #66f0a8;
  --red: #ff4f5f;
  --gold: #f3c75f;
  --steel: #9fb4c7;
  --violet: #b38cff;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 79, 95, 0.1), transparent 22rem),
    linear-gradient(110deg, rgba(66, 242, 232, 0.08), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent 82%);
}

#merge-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.64;
}

.merge-shell {
  position: relative;
  z-index: 1;
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 44px;
}

.merge-header {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.back-link,
.header-status,
.hero-actions a,
.hero-actions span,
.panel-head > span {
  border: 1px solid var(--line);
  background: rgba(5, 6, 7, 0.64);
  color: var(--text);
  text-decoration: none;
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.task-node-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border-radius: 5px;
  border-color: rgba(66, 242, 232, 0.42);
  background:
    linear-gradient(135deg, rgba(66, 242, 232, 0.16), rgba(102, 240, 168, 0.08)),
    rgba(5, 6, 7, 0.72);
  color: var(--text);
  box-shadow:
    inset 0 0 0 1px rgba(237, 247, 244, 0.04),
    0 10px 28px rgba(66, 242, 232, 0.08);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.task-node-cta::before {
  content: "";
  width: 3px;
  align-self: stretch;
  margin: -9px 0 -9px -7px;
  background: var(--green);
  box-shadow: 0 0 18px rgba(102, 240, 168, 0.68);
}

.task-node-cta::after {
  content: "";
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.82;
}

.task-node-cta:hover,
.task-node-cta:focus-visible {
  border-color: rgba(102, 240, 168, 0.64);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(237, 247, 244, 0.06),
    0 14px 32px rgba(66, 242, 232, 0.14);
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(102, 240, 168, 0.88);
  animation: blink 1.8s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.12); }
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 18px;
  align-items: stretch;
  margin-top: 16px;
}

.hero-copy,
.operator-panel,
.panel,
.metric-tile {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.3);
}

.hero-copy {
  min-height: 360px;
  padding: clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  position: relative;
}

.hero-copy::after {
  content: "AI";
  position: absolute;
  right: clamp(14px, 5vw, 64px);
  top: 24px;
  color: rgba(255, 255, 255, 0.035);
  font-size: clamp(120px, 20vw, 320px);
  font-weight: 900;
  line-height: 0.8;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(70px, 13vw, 190px);
  line-height: 0.82;
  font-weight: 900;
  text-transform: uppercase;
}

h2 {
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1;
  font-weight: 800;
}

.hero-line {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 22px 0 0;
  color: #c8d8d5;
  font-size: clamp(18px, 2.2vw, 28px);
  line-height: 1.28;
}

.hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.operator-panel {
  padding: 22px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 18px;
}

.nft-frame {
  min-height: 260px;
  border: 1px solid rgba(66, 242, 232, 0.26);
  background: #07090a;
  overflow: hidden;
  position: relative;
}

.nft-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(180deg, transparent 0, transparent 7px, rgba(255, 255, 255, 0.04) 8px),
    linear-gradient(180deg, transparent, rgba(66, 242, 232, 0.12));
  mix-blend-mode: screen;
  pointer-events: none;
}

.nft-frame img {
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
  display: block;
  filter: saturate(1.05) contrast(1.08);
}

.operator-label,
.wallet-line,
.metric-tile span,
.metric-tile small,
.event-time,
.commit-meta,
.wallet-meta {
  color: var(--muted);
}

.operator-label {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  font-size: 12px;
}

.wallet-line {
  margin: 8px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.metric-tile {
  min-height: 158px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  border-top-width: 3px;
}

.metric-meta {
  min-height: 38px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.metric-tile span,
.metric-tile small {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-tile strong {
  font-size: 44px;
  line-height: 1;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.accent-cyan { border-top-color: var(--cyan); }
.accent-red { border-top-color: var(--red); }
.accent-green { border-top-color: var(--green); }
.accent-gold { border-top-color: var(--gold); }
.accent-steel { border-top-color: var(--steel); }
.accent-violet { border-top-color: var(--violet); }

.main-grid {
  display: grid;
  grid-template-columns: 1.08fr 1fr 0.78fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-head strong {
  font-size: 48px;
  line-height: 0.9;
}

.merge-core {
  grid-row: span 2;
  min-height: 640px;
}

.merge-core canvas {
  width: 100%;
  height: 520px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.24);
}

.chart-panel {
  grid-column: span 2;
  position: relative;
}

.chart-panel canvas {
  width: 100%;
  height: 360px;
  display: block;
  cursor: crosshair;
  border: 1px solid rgba(66, 242, 232, 0.08);
  background:
    linear-gradient(180deg, rgba(66, 242, 232, 0.035), rgba(255, 79, 95, 0.025)),
    rgba(0, 0, 0, 0.18);
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  min-width: 210px;
  max-width: min(300px, calc(100% - 32px));
  padding: 12px 13px;
  border: 1px solid rgba(66, 242, 232, 0.26);
  border-left: 3px solid var(--cyan);
  background: rgba(5, 6, 7, 0.92);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.42),
    0 0 28px rgba(66, 242, 232, 0.08);
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 14px));
  transition: opacity 120ms ease;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.tooltip-date {
  margin-bottom: 9px;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tooltip-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 8px;
  align-items: baseline;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.tooltip-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  box-shadow: 0 0 12px currentColor;
}

.tooltip-row strong {
  color: var(--text);
  font-size: 12px;
}

.tooltip-average {
  color: rgba(237, 247, 244, 0.52);
}

.modality-panel,
.wallet-panel {
  min-height: 330px;
}

.modality-bars {
  display: grid;
  gap: 14px;
}

.modality-row {
  display: grid;
  grid-template-columns: minmax(116px, 170px) minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bar-track {
  height: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.bar-fill {
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 20px currentColor;
}

.feed-panel {
  grid-column: span 2;
}

.event-feed,
.commit-list,
.wallet-events {
  display: grid;
  gap: 10px;
}

.event-item,
.commit-item,
.wallet-item {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.event-item.subject-event {
  position: relative;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px 12px;
  padding: 14px 14px 14px 11px;
  border-left-width: 1px !important;
  background:
    linear-gradient(90deg, rgba(66, 242, 232, 0.08), rgba(255, 79, 95, 0.025) 54%, rgba(0, 0, 0, 0.04)),
    rgba(255, 255, 255, 0.035);
}

.event-item.subject-event::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 32px;
  bottom: -12px;
  width: 1px;
  background: linear-gradient(180deg, rgba(66, 242, 232, 0.36), rgba(66, 242, 232, 0));
}

.event-item.subject-event:last-child::before {
  display: none;
}

.subject-node {
  position: relative;
  z-index: 1;
  width: 13px;
  height: 13px;
  margin-top: 3px;
  border: 1px solid currentColor;
  background: rgba(5, 6, 7, 0.96);
  box-shadow:
    0 0 0 4px rgba(66, 242, 232, 0.05),
    0 0 18px currentColor;
}

.subject-body {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.event-top,
.commit-top,
.wallet-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.event-type {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.event-time,
.commit-meta,
.wallet-meta {
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.event-detail,
.commit-title,
.wallet-value {
  margin: 0;
  color: #d8e4e1;
  line-height: 1.42;
}

.event-item.subject-event .event-detail {
  color: #edf7f4;
  font-size: 14px;
}

.subject-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.subject-signal,
.subject-model {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.subject-signal {
  color: var(--text);
}

.github-panel,
.wallet-panel {
  max-height: 470px;
  overflow: hidden;
}

.commit-list,
.wallet-events {
  max-height: 385px;
  overflow: auto;
  padding-right: 4px;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .merge-core,
  .chart-panel,
  .feed-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 780px) {
  .merge-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 12px;
  }

  .merge-header,
  .hero-actions,
  .event-top,
  .commit-top,
  .wallet-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-grid,
  .main-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: 380px;
    padding: 26px 18px;
  }

  .operator-panel {
    grid-template-columns: 110px 1fr;
    grid-template-rows: auto;
    align-items: center;
  }

  .nft-frame,
  .nft-frame img {
    min-height: 110px;
  }

  .merge-core {
    min-height: auto;
  }

  .merge-core canvas,
  .chart-panel canvas {
    height: 300px;
  }

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