:root {
  --bg: #07111b;
  --bg-elevated: rgba(11, 19, 31, 0.88);
  --bg-soft: rgba(18, 29, 45, 0.72);
  --line: rgba(136, 172, 216, 0.18);
  --line-strong: rgba(136, 172, 216, 0.34);
  --text: #f4f7fb;
  --muted: #8ea4bf;
  --accent: #5ae2c7;
  --accent-strong: #7ef7de;
  --accent-warm: #ffb86a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(69, 117, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #09111a 0%, #07111b 45%, #050b12 100%);
}

a,
button {
  font: inherit;
}

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

button {
  border: 0;
  cursor: pointer;
  background: none;
  color: inherit;
}

.site-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(32px);
  opacity: 0.8;
  pointer-events: none;
}

.ambient-one {
  top: -6rem;
  right: -10rem;
  width: 28rem;
  height: 28rem;
  background: rgba(62, 205, 176, 0.18);
}

.ambient-two {
  bottom: -8rem;
  left: -8rem;
  width: 22rem;
  height: 22rem;
  background: rgba(84, 102, 255, 0.15);
}

.grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(113, 144, 182, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(113, 144, 182, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 80%);
  pointer-events: none;
}

.topbar,
.page {
  position: relative;
  z-index: 1;
}

.topbar {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  width: 2.85rem;
  height: 2.85rem;
  display: grid;
  place-items: center;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(90, 226, 199, 0.22), rgba(73, 101, 255, 0.22));
  border: 1px solid rgba(151, 194, 228, 0.25);
  color: var(--accent-strong);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.brand-copy {
  display: grid;
  gap: 0.15rem;
}

.brand-copy strong {
  font-size: 1rem;
}

.brand-copy span {
  color: var(--muted);
  font-size: 0.85rem;
}

.nav {
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  background: rgba(8, 14, 24, 0.72);
  border-radius: 999px;
  backdrop-filter: blur(16px);
}

.nav a {
  padding: 0.7rem 1rem;
  border-radius: 999px;
  color: var(--muted);
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav a:hover,
.nav a.is-active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.page {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.page-landing {
  display: grid;
  gap: 1.5rem;
}

.panel {
  background: linear-gradient(180deg, rgba(17, 28, 42, 0.88), rgba(10, 17, 28, 0.88));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  padding: 4rem;
}

.hero h1,
.page-header h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2.9rem, 7vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.eyebrow,
.feature-kicker,
.stat-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lead {
  max-width: 48rem;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
}

.hero-actions,
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, rgba(90, 226, 199, 0.18), rgba(56, 115, 255, 0.2));
  border: 1px solid rgba(113, 233, 206, 0.42);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.stat-row,
.feature-grid,
.flow-grid,
.hud-row,
.studio-grid {
  display: grid;
  gap: 1rem;
}

.stat-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 2.5rem;
}

.stat-card,
.flow-card,
.studio-card,
.hud-card {
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.stat-card strong,
.hud-card strong,
.flow-card h3,
.studio-card h3,
.state-card h3 {
  display: block;
  margin-top: 0.35rem;
}

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

.feature-card,
.overview,
.page-header,
.sidebar-card,
.game-surface,
.studio-sidebar,
.studio-main {
  padding: 1.5rem;
}

.feature-card h2,
.section-heading h2,
.card-heading h2 {
  margin: 0.55rem 0 0;
  font-size: 1.4rem;
  line-height: 1.1;
}

.feature-card p,
.flow-card p,
.surface-center p,
.mode-card span,
.studio-card p,
.state-card p,
.tree-item,
.surface-topline,
.studio-toolbar {
  color: var(--muted);
}

.overview {
  padding: 1.5rem;
}

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

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

.flow-card span {
  color: var(--accent-warm);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.page-header h1 {
  max-width: none;
  font-size: clamp(2.4rem, 5vw, 4rem);
}

.game-layout,
.studio-layout {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.game-layout {
  grid-template-columns: 300px minmax(0, 1fr);
}

.studio-layout {
  grid-template-columns: 280px minmax(0, 1fr);
}

.card-heading {
  margin-bottom: 1rem;
}

.mode-list,
.tree-list {
  display: grid;
  gap: 0.85rem;
}

.mode-card,
.tree-item {
  width: 100%;
  text-align: left;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.mode-card:hover,
.tree-item:hover,
.mode-card.is-selected,
.tree-item.is-active {
  border-color: var(--line-strong);
  background: rgba(90, 226, 199, 0.08);
  transform: translateY(-1px);
}

.mode-card strong {
  display: block;
  margin-bottom: 0.4rem;
}

.tree-item span {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.surface-topline,
.studio-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.surface-canvas {
  position: relative;
  min-height: 460px;
  margin: 1rem 0;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(126, 247, 222, 0.14);
  background:
    linear-gradient(180deg, rgba(8, 13, 20, 0.25), rgba(8, 13, 20, 0.7)),
    radial-gradient(circle at top, rgba(126, 247, 222, 0.08), transparent 35%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 36px
    );
}

.surface-stage {
  position: absolute;
  inset: 0;
}

.surface-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.surface-overlay {
  position: relative;
  z-index: 1;
  min-height: 460px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.surface-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.glass-card {
  backdrop-filter: blur(20px);
  background: linear-gradient(180deg, rgba(8, 14, 24, 0.74), rgba(8, 14, 24, 0.48));
  border: 1px solid rgba(151, 194, 228, 0.2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.surface-center {
  max-width: 28rem;
  padding: 1.5rem;
  text-align: center;
  align-self: flex-end;
  pointer-events: auto;
}

.surface-center h2 {
  margin: 0.8rem 0 0;
  font-size: 2rem;
}

.surface-badge {
  display: inline-flex;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 184, 106, 0.12);
  border: 1px solid rgba(255, 184, 106, 0.24);
  color: var(--accent-warm);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.state-card {
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}

.state-error {
  border-color: rgba(255, 120, 120, 0.45);
  background: rgba(255, 120, 120, 0.08);
}

.deck-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.meta-copy {
  margin-top: 1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.7;
}

.metric-card {
  min-height: 96px;
  padding: 1rem 1.1rem;
  pointer-events: auto;
}

.metric-card strong {
  display: block;
  margin-top: 0.45rem;
  font-size: 1rem;
  line-height: 1.4;
}

.hud-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.studio-top-grid,
.studio-grid {
  display: grid;
  gap: 1rem;
}

.studio-top-grid {
  grid-template-columns: 1.2fr 0.8fr;
  margin-top: 1rem;
}

.studio-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.studio-card {
  min-height: 180px;
}

.inspector-card {
  min-height: 100%;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.metric-strip div {
  padding: 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.pipeline-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.pipeline-step strong {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(90, 226, 199, 0.1);
  color: var(--accent-strong);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.pipeline-step span {
  color: var(--muted);
}

.pipeline-step.is-live {
  border-color: rgba(126, 247, 222, 0.4);
  background: rgba(90, 226, 199, 0.08);
}

.nav a.is-active::after {
  content: "";
}

@media (max-width: 960px) {
  .topbar,
  .page {
    width: min(100% - 1.25rem, 1180px);
  }

  .topbar,
  .page-header,
  .game-layout,
  .studio-layout,
  .studio-top-grid,
  .feature-grid,
  .flow-grid,
  .stat-row,
  .surface-stack,
  .metric-strip,
  .hud-row,
  .studio-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .page-header {
    display: grid;
  }

  .nav {
    justify-content: space-between;
  }

  .hero {
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 640px) {
  .nav {
    width: 100%;
    overflow-x: auto;
  }

  .nav a {
    white-space: nowrap;
  }

  .page {
    padding-bottom: 2.5rem;
  }

  .feature-card,
  .overview,
  .page-header,
  .sidebar-card,
  .game-surface,
  .studio-sidebar,
  .studio-main {
    padding: 1.1rem;
  }

  .surface-overlay {
    padding: 0.85rem;
  }
}
