:root {
  --bg: #071014;
  --bg-soft: #0c171d;
  --panel: rgba(17, 29, 37, 0.86);
  --panel-strong: #101d25;
  --border: rgba(138, 163, 176, 0.18);
  --text: #eef7f9;
  --muted: #91a8b3;
  --cyan: #2ee6d6;
  --green: #73f59b;
  --amber: #f7c35f;
  --red: #ff6f7d;
  --blue: #63a8ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Inter", Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 10%, rgba(46, 230, 214, 0.16), transparent 26rem),
    radial-gradient(circle at 82% 4%, rgba(247, 195, 95, 0.12), transparent 24rem),
    linear-gradient(135deg, #061014 0%, #0a1119 46%, #0a1518 100%);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 75%);
}

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

button,
textarea {
  font: inherit;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #031112;
  font-weight: 800;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(46, 230, 214, 0.34);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
}

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

.status-pill,
.api-badge,
.timestamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  background: rgba(115, 245, 155, 0.1);
  border: 1px solid rgba(115, 245, 155, 0.22);
  border-radius: 999px;
}

.pulse {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(115, 245, 155, 0.7);
  animation: pulse 1.8s infinite;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.72fr);
  gap: 28px;
  align-items: stretch;
  padding: 64px 0 34px;
}

.hero-copy {
  display: flex;
  min-height: 430px;
  flex-direction: column;
  justify-content: center;
}

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

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

h1 {
  max-width: 780px;
  margin-bottom: 20px;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 720px;
  color: #bad0d8;
  font-size: 18px;
  line-height: 1.7;
}

.hero-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.primary-link,
.secondary-link,
.analyze-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  color: var(--text);
  font-weight: 800;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.primary-link,
.analyze-button {
  color: #031112;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  border: 0;
}

.secondary-link,
.ghost-button {
  background: rgba(255, 255, 255, 0.05);
}

.button-icon {
  width: 11px;
  height: 11px;
  margin-right: 10px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.signal-panel,
.panel,
.result-card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.signal-panel {
  display: flex;
  min-height: 430px;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

.scan-grid {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(46, 230, 214, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 230, 214, 0.12) 1px, transparent 1px);
  background-size: 34px 34px;
}

.scan-grid::after {
  position: absolute;
  inset: -60% 0 auto;
  height: 60%;
  content: "";
  background: linear-gradient(to bottom, transparent, rgba(46, 230, 214, 0.2), transparent);
  animation: scan 4s linear infinite;
}

.signal-header,
.signal-footer,
.signal-chart {
  position: relative;
  z-index: 1;
}

.signal-header,
.signal-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.signal-header span,
.signal-footer small {
  color: var(--muted);
}

.signal-chart {
  display: flex;
  height: 190px;
  align-items: end;
  gap: 12px;
  padding-top: 42px;
}

.signal-chart span {
  flex: 1;
  min-width: 16px;
  background: linear-gradient(to top, rgba(99, 168, 255, 0.42), var(--cyan));
  border-radius: 6px 6px 2px 2px;
  animation: equalize 2.8s ease-in-out infinite alternate;
}

.signal-chart span:nth-child(even) {
  animation-delay: 0.5s;
}

.signal-footer {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.signal-footer strong,
.signal-footer small {
  display: block;
}

.panel {
  margin: 24px 0;
  padding: 24px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 34px);
}

.api-badge.mock {
  color: var(--amber);
  background: rgba(247, 195, 95, 0.1);
  border-color: rgba(247, 195, 95, 0.24);
}

.alert-form label {
  display: block;
  margin-bottom: 10px;
  color: #cfe0e5;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 142px;
  resize: vertical;
  padding: 16px;
  color: var(--text);
  line-height: 1.55;
  background: rgba(4, 12, 16, 0.72);
  border: 1px solid rgba(138, 163, 176, 0.28);
  border-radius: 8px;
  outline: none;
}

textarea:focus {
  border-color: rgba(46, 230, 214, 0.72);
  box-shadow: 0 0 0 3px rgba(46, 230, 214, 0.12);
}

.loading {
  display: none;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  color: var(--muted);
}

.loading.visible {
  display: flex;
}

.loader {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(46, 230, 214, 0.18);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.result-card {
  min-height: 252px;
  padding: 22px;
}

.highlight-card,
.recommendation-card {
  grid-column: span 3;
  min-height: auto;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title h3 {
  margin-bottom: 0;
  font-size: 18px;
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(46, 230, 214, 0.15);
  border: 1px solid rgba(46, 230, 214, 0.3);
}

.card-icon.knowledge {
  background: rgba(99, 168, 255, 0.15);
  border-color: rgba(99, 168, 255, 0.34);
}

.card-icon.diagnostics {
  background: rgba(247, 195, 95, 0.14);
  border-color: rgba(247, 195, 95, 0.34);
}

.card-icon.root {
  background: rgba(255, 111, 125, 0.14);
  border-color: rgba(255, 111, 125, 0.32);
}

.card-icon.recommend {
  background: rgba(115, 245, 155, 0.14);
  border-color: rgba(115, 245, 155, 0.32);
}

.result-card ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-card li {
  position: relative;
  padding-left: 18px;
  color: #c9d9de;
  line-height: 1.55;
}

.result-card li::before {
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 7px;
  height: 7px;
  content: "";
  background: var(--cyan);
  border-radius: 50%;
}

.result-card p {
  margin-bottom: 0;
  color: #d2e1e5;
  line-height: 1.7;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  min-height: 146px;
  padding: 18px;
  background: rgba(4, 12, 16, 0.54);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.metric-card small {
  color: var(--muted);
  font-weight: 700;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 14px 0;
}

.metric-value strong {
  font-size: 34px;
}

.metric-value span {
  color: var(--muted);
}

.metric-bar {
  height: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.metric-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  border-radius: inherit;
}

.workflow {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
}

.workflow::before {
  position: absolute;
  top: 50%;
  right: 8%;
  left: 8%;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--cyan), var(--blue), var(--green));
  transform: translateY(-50%);
}

.agent-node {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 128px;
  align-content: center;
  gap: 8px;
  padding: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.agent-node span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #031112;
  font-weight: 800;
  background: var(--cyan);
  border-radius: 50%;
}

.agent-node strong {
  font-size: 18px;
}

.agent-node small {
  color: var(--muted);
}

.agent-node.active {
  border-color: rgba(46, 230, 214, 0.66);
  box-shadow: 0 0 34px rgba(46, 230, 214, 0.14);
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 10px rgba(115, 245, 155, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(115, 245, 155, 0);
  }
}

@keyframes scan {
  to {
    transform: translateY(280%);
  }
}

@keyframes equalize {
  to {
    transform: scaleY(0.76);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

  .highlight-card,
  .recommendation-card {
    grid-column: auto;
  }

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

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

  .workflow::before {
    top: 8%;
    bottom: 8%;
    left: 34px;
    width: 2px;
    height: auto;
    transform: none;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 22px, 1180px);
  }

  .topbar {
    align-items: flex-start;
  }

  .nav-links {
    display: none;
  }

  .status-pill {
    min-width: max-content;
  }

  .hero {
    padding-top: 36px;
  }

  .hero-copy,
  .signal-panel {
    min-height: auto;
  }

  h1 {
    font-size: 42px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .signal-footer {
    flex-direction: column;
  }
}
