:root {
  --bg: #040405;
  --surface: rgba(17, 17, 17, 0.84);
  --surface-2: rgba(12, 13, 14, 0.75);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.66);
  --line: rgba(0, 240, 255, 0.28);
  --line-strong: rgba(255, 56, 189, 0.75);
  --reactor: #00f0ff;
  --neon-pink: #ff38bd;
  --neon-lime: #c9ff00;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

body.studio-home {
  font-family: "Geist", "Inter", sans-serif;
  color: var(--text);
  overflow-x: hidden;
}

#monolithFx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

.home-shell {
  position: relative;
  z-index: 1;
  max-width: 1250px;
  margin: 0 auto;
  padding: 20px 16px 22px;
  display: grid;
  gap: 14px;
}

.command-node,
.node,
.telemetry {
  position: relative;
  border-radius: var(--radius);
  background:
    linear-gradient(150deg, rgba(0, 240, 255, 0.09), rgba(255, 56, 189, 0.04) 45%, rgba(12, 13, 14, 0.82) 75%),
    linear-gradient(165deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.command-node {
  padding: 22px 20px 18px;
  animation: revealUp 480ms ease both;
}

.studio-label {
  margin: 0;
  font-family: "Space Mono", monospace;
  font-size: clamp(0.96rem, 1vw + 0.5rem, 1.22rem);
  letter-spacing: 1.2px;
  opacity: 0.9;
  color: var(--neon-lime);
}

.command-node h1 {
  margin: 10px 0 8px;
  font-size: clamp(1.3rem, 2vw + 1rem, 2.2rem);
  font-weight: 600;
  letter-spacing: 0.2px;
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.24);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.45;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(150px, auto);
  gap: 12px;
}

.node {
  padding: 14px;
  min-height: 170px;
  isolation: isolate;
  transform: translateY(0) scale(1);
  transition:
    transform 180ms ease,
    border-color 140ms linear,
    box-shadow 180ms ease;
  animation: revealUp 440ms ease both;
}

.node::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid transparent;
  pointer-events: none;
  background: radial-gradient(
      220px circle at var(--mx, 50%) var(--my, 50%),
      rgba(255, 255, 255, 0.26),
      rgba(255, 255, 255, 0) 62%
    )
    border-box;
  mask:
    linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask:
    linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  opacity: 0;
  transition: opacity 120ms linear;
}

.node:hover::before,
.node:focus-within::before {
  opacity: 1;
}

.node:hover,
.node:focus-within {
  border-color: var(--line-strong);
  transform: translateY(-2px) scale(1.003);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.34),
    0 0 24px rgba(0, 240, 255, 0.26);
  animation: quakeHover 230ms linear infinite;
}

.node-main {
  grid-column: span 2;
  grid-row: span 2;
  min-height: 320px;
  animation:
    revealUp 440ms ease both,
    mainframeQuake 2.8s ease-in-out infinite 900ms;
  animation-delay: 70ms, 900ms;
}

.node-wide {
  grid-column: span 2;
  animation-delay: 230ms;
}

.node:nth-child(2) {
  animation-delay: 130ms;
}

.node:nth-child(3) {
  animation-delay: 180ms;
}

.node-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.node-chip,
.node-state,
.telemetry p {
  font-family: "Space Mono", monospace;
  font-size: 0.67rem;
  letter-spacing: 1px;
}

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

.node-state {
  color: #c7f7ff;
  border: 1px solid rgba(0, 240, 255, 0.58);
  border-radius: 999px;
  padding: 4px 8px;
  animation: statePulse 2.8s ease-in-out infinite;
}

.node h2,
.node h3 {
  margin: 12px 0 8px;
  line-height: 1.16;
  font-weight: 800;
  letter-spacing: 0.25px;
}

.node h2 {
  font-size: clamp(1.4rem, 2.2vw, 2.2rem);
  text-shadow: 0 0 16px rgba(0, 240, 255, 0.22);
}

.node h3 {
  font-size: clamp(1.03rem, 1.25vw, 1.26rem);
  text-shadow: 0 0 14px rgba(255, 56, 189, 0.14);
}

.node p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
  max-width: 68ch;
}

.schematic {
  position: relative;
  margin: 8px 0 14px;
  height: 118px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(90deg, rgba(0, 240, 255, 0.2) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, rgba(255, 56, 189, 0.13) 0 1px, transparent 1px 28px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.path,
.dot {
  position: absolute;
  display: block;
}

.path {
  border-top: 2px dashed rgba(0, 240, 255, 0.8);
  animation: routeFlow 2.6s linear infinite;
}

.p1 {
  width: 38%;
  top: 27%;
  left: 6%;
  transform: rotate(14deg);
}

.p2 {
  width: 44%;
  top: 45%;
  right: 8%;
  transform: rotate(-10deg);
}

.p3 {
  width: 50%;
  top: 69%;
  left: 16%;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.55);
}

.d1 {
  top: 20%;
  left: 18%;
}

.d2 {
  top: 53%;
  left: 52%;
}

.d3 {
  top: 70%;
  left: 75%;
}

.launch-btn {
  display: inline-block;
  text-decoration: none;
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 1.02px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.38);
  padding: 8px 10px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 90ms linear;
}

.node:hover .launch-btn,
.node:focus-within .launch-btn {
  opacity: 1;
  transform: translateY(0);
}

.launch-btn:hover,
.launch-btn:focus-visible {
  border-color: var(--reactor);
  box-shadow:
    0 0 0 1px rgba(0, 240, 255, 0.45) inset,
    0 0 18px rgba(255, 56, 189, 0.28);
}

.telemetry {
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  animation: revealUp 520ms ease both;
  animation-delay: 280ms;
}

.telemetry p {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
}

.telemetry p:first-child::after {
  content: "  •";
  color: rgba(0, 240, 255, 0.92);
  animation: blinkDot 1.2s steps(2, end) infinite;
}

@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes routeFlow {
  from {
    border-top-color: rgba(0, 240, 255, 0.55);
  }
  50% {
    border-top-color: rgba(255, 56, 189, 0.92);
  }
  to {
    border-top-color: rgba(0, 240, 255, 0.55);
  }
}

@keyframes statePulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(0, 240, 255, 0);
  }
  50% {
    box-shadow:
      0 0 14px rgba(0, 240, 255, 0.24),
      0 0 20px rgba(255, 56, 189, 0.2);
  }
}

@keyframes blinkDot {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.35;
  }
}

@keyframes mainframeQuake {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  20% {
    transform: translate3d(0.35px, -0.25px, 0);
  }
  40% {
    transform: translate3d(-0.45px, 0.2px, 0);
  }
  60% {
    transform: translate3d(0.25px, 0.3px, 0);
  }
  80% {
    transform: translate3d(-0.25px, -0.2px, 0);
  }
}

@keyframes quakeHover {
  0%,
  100% {
    transform: translate3d(0, -2px, 0) scale(1.003);
  }
  25% {
    transform: translate3d(-0.7px, -1.8px, 0) scale(1.003);
  }
  50% {
    transform: translate3d(0.75px, -2.2px, 0) scale(1.003);
  }
  75% {
    transform: translate3d(-0.45px, -1.9px, 0) scale(1.003);
  }
}

@media (max-width: 1024px) {
  .bento-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .node-main {
    grid-column: span 2;
    grid-row: auto;
    min-height: 280px;
  }

  .node-wide {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .home-shell {
    padding: 12px 10px 14px;
    gap: 10px;
  }

  .command-node {
    padding: 16px 14px;
  }

  .bento-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .node,
  .node-main,
  .node-wide {
    grid-column: span 1;
    min-height: auto;
  }

  .schematic {
    height: 96px;
  }

  .launch-btn {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
