:root {
  --bg: #02060d;
  --panel: rgba(8, 15, 30, 0.9);
  --panel-alt: rgba(11, 20, 38, 0.85);
  --border: rgba(84, 242, 194, 0.35);
  --accent: #54f2c2;
  --accent-strong: #a78bfa;
  --text: #f4fbff;
  --muted: #7c8fa8;
  --shadow: 0 25px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, BlinkMacSystemFont;
  background: radial-gradient(circle at top, #0a1430 0%, #03060d 55%);
  color: var(--text);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(2, 6, 13, 0.8);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.brand-mark {
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 0.9rem;
  color: var(--muted);
}

.controls select,
.controls button {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  margin-left: 0.6rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.controls button:hover,
.controls select:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.status-bar {
  margin: 1rem 2.5rem 0;
  padding: 0.7rem 1.2rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.9rem;
}

.helper-callout {
  margin: 1rem 2.5rem 0;
  padding: 1rem 1.4rem;
  border-radius: 14px;
  background: rgba(167, 139, 250, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.15);
  color: var(--text);
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.25);
}

.helper-callout ol {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.helper-text {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.8rem;
}

.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0;
}

.mode-tab {
  border: none;
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 1.6rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.mode-tab.active {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: 0 10px 25px rgba(84, 242, 194, 0.2);
}

section {
  background: var(--panel);
  border-radius: 18px;
  padding: 1.3rem;
  margin: 1.2rem 2.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

#demoView main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.section-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

#goalTree,
#artifactViewer,
#timeline {
  background: var(--panel-alt);
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

#timeline {
  max-height: 260px;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.4;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(167, 139, 250, 0.15);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 0.1rem 0.7rem;
  font-size: 0.8rem;
  margin-right: 0.6rem;
}

.agent-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.8rem;
}

.agent-card {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 1rem;
  background: linear-gradient(160deg, rgba(84, 242, 194, 0.08), rgba(167, 139, 250, 0.05));
}

.agent-card button {
  width: 100%;
  margin-top: 0.7rem;
  border: none;
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
  background: rgba(84, 242, 194, 0.18);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease;
}

.agent-card button:hover {
  background: rgba(84, 242, 194, 0.28);
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.roster-card {
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}

.roster-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.roster-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.roster-mission {
  font-size: 0.9rem;
  margin: 0.4rem 0 0.6rem;
  color: var(--text);
}

.roster-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.roster-tag {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(84, 242, 194, 0.15);
  color: var(--accent);
}

.roster-toggle {
  margin-top: 0.6rem;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
}

.roster-details {
  display: none;
  margin-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.8rem;
}

.roster-details.open {
  display: block;
}

.detail-group {
  margin-bottom: 0.8rem;
}

.detail-group ul {
  margin: 0.3rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.telemetry {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.tabs .tab {
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: var(--panel-alt);
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.tabs .tab.active {
  border-color: var(--accent);
  color: var(--text);
}

#artifactViewer {
  min-height: 220px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 0.9rem;
}

.hidden {
  display: none;
}

#activeView {
  background: rgba(7, 14, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.active-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.connector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.connector-card {
  border-radius: 16px;
  padding: 1rem;
  background: var(--panel-alt);
  border: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.connector-card h3 {
  margin: 0;
}

.connector-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.connector-status {
  font-size: 0.85rem;
  color: var(--accent);
}

.connector-card button {
  align-self: flex-start;
  border: none;
  border-radius: 999px;
  padding: 0.45rem 1.2rem;
  background: rgba(167, 139, 250, 0.25);
  color: var(--text);
  cursor: pointer;
}

.active-footer {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  #demoView main {
    grid-template-columns: 1fr;
  }

  header {
    flex-direction: column;
    gap: 1rem;
  }
}
