:root {
  --bg: #060914;
  --bg2: #0c1220;
  --grid: rgba(100,150,255,0.04);
  --accent1: #3b82f6;
  --accent2: #8b5cf6;
  --accent3: #06b6d4;
  --accent4: #10b981;
  --accent5: #f59e0b;
  --accent6: #ef4444;
  --text: #e2e8f0;
  --text-dim: #64748b;
  --border: rgba(100,150,255,0.15);
  --glow1: rgba(59,130,246,0.3);
  --glow2: rgba(139,92,246,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  font-family: 'Syne', sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.detail-link-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--accent1) 0%, var(--accent2) 100%);
  padding: 12px 32px;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.detail-link-banner a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.detail-link-banner a:hover {
  text-decoration: underline;
  transform: scale(1.05);
}

.wrapper {
  position: relative;
  z-index: 1;
  padding: 40px 32px 80px;
  max-width: 1400px;
  margin: 0 auto;
  margin-top: 50px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 52px;
  animation: fadeDown 0.6s ease both;
}

.header-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent1);
  border: 1px solid var(--accent1);
  padding: 4px 14px;
  border-radius: 2px;
  margin-bottom: 16px;
  opacity: 0.8;
}

.header h1 {
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  background: linear-gradient(135deg, #fff 0%, var(--accent3) 50%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.header p {
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 1px;
  font-family: 'JetBrains Mono', monospace;
}

/* Architecture container */
.arch {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Layer rows */
.layer {
  position: relative;
  animation: fadeUp 0.5s ease both;
}

.layer-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  padding-left: 4px;
}

.layer-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-wrap: wrap;
}

/* Node cards */
.node {
  flex: 1;
  min-width: 160px;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--bg2);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: default;
}

.node:hover {
  transform: translateY(-2px);
}

.node::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: 8px;
}

.node:hover::before { opacity: 1; }

/* Color variants */
.node.blue { border-color: rgba(59,130,246,0.35); }
.node.blue::before { background: radial-gradient(ellipse at top left, rgba(59,130,246,0.1), transparent 60%); }
.node.blue:hover { box-shadow: 0 0 24px rgba(59,130,246,0.2); }
.node.blue .node-icon { color: var(--accent1); }
.node.blue .node-title { color: var(--accent1); }

.node.purple { border-color: rgba(139,92,246,0.35); }
.node.purple::before { background: radial-gradient(ellipse at top left, rgba(139,92,246,0.1), transparent 60%); }
.node.purple:hover { box-shadow: 0 0 24px rgba(139,92,246,0.2); }
.node.purple .node-icon { color: var(--accent2); }
.node.purple .node-title { color: var(--accent2); }

.node.cyan { border-color: rgba(6,182,212,0.35); }
.node.cyan::before { background: radial-gradient(ellipse at top left, rgba(6,182,212,0.1), transparent 60%); }
.node.cyan:hover { box-shadow: 0 0 24px rgba(6,182,212,0.2); }
.node.cyan .node-icon { color: var(--accent3); }
.node.cyan .node-title { color: var(--accent3); }

.node.green { border-color: rgba(16,185,129,0.35); }
.node.green::before { background: radial-gradient(ellipse at top left, rgba(16,185,129,0.1), transparent 60%); }
.node.green:hover { box-shadow: 0 0 24px rgba(16,185,129,0.2); }
.node.green .node-icon { color: var(--accent4); }
.node.green .node-title { color: var(--accent4); }

.node.amber { border-color: rgba(245,158,11,0.35); }
.node.amber::before { background: radial-gradient(ellipse at top left, rgba(245,158,11,0.1), transparent 60%); }
.node.amber:hover { box-shadow: 0 0 24px rgba(245,158,11,0.2); }
.node.amber .node-icon { color: var(--accent5); }
.node.amber .node-title { color: var(--accent5); }

.node.red { border-color: rgba(239,68,68,0.35); }
.node.red::before { background: radial-gradient(ellipse at top left, rgba(239,68,68,0.1), transparent 60%); }
.node.red:hover { box-shadow: 0 0 24px rgba(239,68,68,0.2); }
.node.red .node-icon { color: var(--accent6); }
.node.red .node-title { color: var(--accent6); }

.node-icon {
  font-size: 22px;
  margin-bottom: 8px;
  display: block;
}

.node-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.node-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
  font-family: 'JetBrains Mono', monospace;
}

.node-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tag-blue { background: rgba(59,130,246,0.15); color: var(--accent1); border: 1px solid rgba(59,130,246,0.2); }
.tag-purple { background: rgba(139,92,246,0.15); color: var(--accent2); border: 1px solid rgba(139,92,246,0.2); }
.tag-cyan { background: rgba(6,182,212,0.15); color: var(--accent3); border: 1px solid rgba(6,182,212,0.2); }
.tag-green { background: rgba(16,185,129,0.15); color: var(--accent4); border: 1px solid rgba(16,185,129,0.2); }
.tag-amber { background: rgba(245,158,11,0.15); color: var(--accent5); border: 1px solid rgba(245,158,11,0.2); }

/* Connector arrows between layers */
.connector {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 30px;
  gap: 8px;
  position: relative;
}

.connector-line {
  width: 2px;
  height: 100%;
  background: linear-gradient(to bottom, var(--border), transparent);
  position: absolute;
  left: 50%;
}

.connector-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 1px;
  background: var(--bg);
  padding: 2px 8px;
  z-index: 1;
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* Central orchestrator highlight */
.node.orchestrator {
  flex: 2;
  min-width: 280px;
  border: 1px solid rgba(139,92,246,0.5);
  background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(59,130,246,0.08));
  box-shadow: 0 0 40px rgba(139,92,246,0.1), inset 0 0 40px rgba(59,130,246,0.03);
}

.node.orchestrator .node-title {
  font-size: 16px;
  font-weight: 800;
}

/* Flow section for RL loop */
.rl-loop {
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 12px;
  padding: 20px;
  background: rgba(245,158,11,0.03);
  position: relative;
}

.rl-loop-title {
  position: absolute;
  top: -10px;
  left: 20px;
  background: var(--bg);
  padding: 0 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--accent5);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Data flow arrows */
.flow-arrows {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0;
}

.arrow {
  font-size: 16px;
  color: var(--text-dim);
  animation: pulse 2s infinite;
}

.flow-box {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
}

.legend-title {
  width: 100%;
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Wide node */
.node.wide { flex: 3; }

/* Animations */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.layer:nth-child(1) { animation-delay: 0.1s; }
.layer:nth-child(2) { animation-delay: 0.2s; }
.layer:nth-child(3) { animation-delay: 0.3s; }
.layer:nth-child(4) { animation-delay: 0.4s; }
.layer:nth-child(5) { animation-delay: 0.5s; }
.layer:nth-child(6) { animation-delay: 0.6s; }
.layer:nth-child(7) { animation-delay: 0.7s; }

.pulse-ring {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent4);
  animation: ringPulse 2s infinite;
}

@keyframes ringPulse {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 4px 0;
}

/* Footer */
.footer {
  margin: 60px auto 0;
  padding: 24px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  width: 100%;
  max-width: 1400px;
}

.footer-text {
  line-height: 1.8;
  margin-bottom: 8px;
  text-align: center;
}

.footer-credit {
  font-weight: 600;
  color: var(--accent3);
}

.footer-year {
  color: var(--accent1);
  font-weight: 600;
}

@media (max-width: 768px) {
  .layer-row { flex-direction: column; }
  .node { min-width: unset; }
  .node.orchestrator, .node.wide { flex: 1; min-width: unset; }
}
