:root {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  color: #e2e8f0;
  background-color: #040612;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(76, 29, 149, 0.4), transparent 60%),
    radial-gradient(circle at 80% 0%, rgba(8, 145, 178, 0.35), transparent 55%), #02030a;
  color: #e2e8f0;
}

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

main {
  display: flex;
  flex-direction: column;
  gap: 4rem;
  padding: 0 5vw 5rem;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  padding: 4.5rem 5vw 4rem;
  align-items: center;
}

.hero__content h1 {
  font-size: clamp(2.8rem, 6vw, 4.2rem);
  margin: 0 0 1rem;
}

.lead {
  font-size: 1.1rem;
  max-width: 48ch;
  color: #cbd5f5;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.hero__visual {
  display: flex;
  justify-content: center;
  position: relative;
}

.grid {
  width: 280px;
  height: 280px;
  border-radius: 32px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(226, 232, 240, 0.1);
  overflow: hidden;
  position: relative;
}

.grid__glow,
.grid__pulse {
  position: absolute;
  inset: 0;
}

.grid__glow::before {
  content: "";
  position: absolute;
  width: 180%;
  height: 180%;
  top: -40%;
  left: -40%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.35), transparent 60%);
  animation: rotate 20s linear infinite;
}

.grid__pulse::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(90deg, rgba(226, 232, 240, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(226, 232, 240, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  animation: pulse 3.5s ease-in-out infinite;
}

section {
  background: rgba(2, 6, 23, 0.88);
  border-radius: 24px;
  padding: 2.75rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.7);
}

.section-heading {
  margin-bottom: 1.5rem;
}

.section-heading h2 {
  margin: 0.35rem 0;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.8rem;
  color: #94a3b8;
}

.card-grid,
.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.concept-card,
.strategy-grid article {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  padding: 1.35rem;
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.15), transparent 60%);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn.primary {
  background: linear-gradient(120deg, #2563eb, #7c3aed);
  color: #fff;
  box-shadow: 0 18px 30px rgba(76, 29, 149, 0.5);
}

.btn.secondary {
  background: #0f172a;
  color: #fff;
}

.btn.ghost {
  border: 1px solid rgba(226, 232, 240, 0.5);
  background: transparent;
  color: #e2e8f0;
}

.btn:active {
  transform: scale(0.97);
}

.lab__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.lab__status {
  flex: 1 1 240px;
  min-width: 200px;
  color: #cbd5f5;
}

.chip {
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.3);
  padding: 0.55rem 1.35rem;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: #cbd5f5;
  transition: background 0.2s, color 0.2s, border 0.2s;
}

.chip.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60a5fa;
  color: #fff;
}

.graph-wrapper {
  background: rgba(8, 12, 30, 0.9);
  border-radius: 24px;
  padding: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  transition: border 0.3s, box-shadow 0.3s;
}

.graph-wrapper.deadlock {
  border-color: #fb7185;
  box-shadow: 0 18px 40px rgba(225, 29, 72, 0.5);
}

.graph-wrapper.success {
  border-color: #4ade80;
  box-shadow: 0 18px 40px rgba(34, 197, 94, 0.45);
}

.graph {
  width: 100%;
  max-width: 640px;
  display: block;
  margin: 0 auto;
}

.graph line {
  stroke: rgba(148, 163, 184, 0.25);
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.6;
  transition: stroke 0.3s, opacity 0.3s;
}

.graph line[data-kind="request"].active {
  stroke: #fb923c;
  opacity: 1;
}

.graph line[data-kind="allocation"].active {
  stroke: #34d399;
  opacity: 1;
}

.node text {
  font-size: 1.1rem;
  text-anchor: middle;
  font-weight: 700;
  fill: #e2e8f0;
}

.node circle,
.node rect {
  fill: rgba(15, 23, 42, 0.8);
  stroke: rgba(148, 163, 184, 0.4);
  stroke-width: 3;
  transition: transform 0.3s, stroke 0.3s, fill 0.3s;
}

.node.process.holding circle {
  stroke: #4ade80;
  fill: rgba(34, 197, 94, 0.15);
}

.node.process.waiting circle {
  stroke: #fb923c;
  fill: rgba(251, 146, 60, 0.12);
  animation: pulse 1.5s ease-in-out infinite;
}

.node.resource.allocated rect {
  stroke: #34d399;
  fill: rgba(13, 148, 136, 0.15);
}

.node.attention circle,
.node.attention rect {
  stroke: #f472b6 !important;
  fill: rgba(244, 114, 182, 0.18) !important;
}

.legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
  font-size: 0.95rem;
  color: #cbd5f5;
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  margin-right: 0.4rem;
}

.dot.grant {
  background: #34d399;
}

.dot.wait {
  background: #fb923c;
}

.dot.dead {
  background: #f43f5e;
}

.lab__notes ul,
.reflection ol {
  padding-left: 1.2rem;
  color: #cbd5f5;
}

footer {
  text-align: center;
  padding: 2rem 0 3rem;
  color: #94a3b8;
}

@media (max-width: 720px) {
  .lab__controls {
    flex-direction: column;
    align-items: stretch;
  }

  section {
    padding: 2rem;
  }
}

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

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}
