:root{
  --bg-1: #0b0f19;
  --bg-2: #12192b;
  --bg-3: #1b1036;
  --glow-1: 255 0 122;
  --glow-2: 64 160 255;
  --glow-3: 255 130 30;
  --card: rgba(255,255,255,0.08);
  --blur: 25px;
  --radius: 66px;
  --text: #e7ecff;
  --muted: #9fb0ff;
  --accent: #7c5cff;
  --accent-2: #ff5cc8;
  --line-color: rgba(255,255,255,0.15);
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  background: var(--bg-1); /* Fallback color for performance */
  background:
    radial-gradient(1200px 800px at 10% 0%, rgba(var(--glow-2)/0.25) 0%, transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(var(--glow-1)/0.20) 0%, transparent 60%),
    radial-gradient(1200px 800px at 50% 120%, rgba(var(--glow-3)/0.18) 0%, transparent 65%),
    linear-gradient(180deg, var(--bg-3), var(--bg-2) 40%, var(--bg-1));
  margin: 0;
  color: var(--text);
  font-family: "Nunito", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  overflow: hidden; 
  -webkit-user-select: none;
  user-select: none;
  cursor: default;
}

.sites-page { overflow: auto; }

/* Performance: promote orbs to own layer */
.orbs, .orbs::before, .orbs::after {
  position: fixed;
  inset: -20vmax;
  content: "";
  pointer-events: none;
  filter: blur(60px);
  mix-blend-mode: screen;
  opacity: .55;
  background:
    radial-gradient(closest-side, rgba(var(--glow-2)/0.35), transparent 70%) 20% 10%/45vmax 45vmax no-repeat,
    radial-gradient(closest-side, rgba(var(--glow-1)/0.30), transparent 70%) 85% 15%/45vmax 45vmax no-repeat,
    radial-gradient(closest-side, rgba(var(--glow-3)/0.28), transparent 70%) 50% 85%/60vmax 60vmax no-repeat;
  animation: float 22s ease-in-out infinite;
  z-index: -1;
  will-change: transform; /* Performance Hint */
  transform: translateZ(0);
}
.orbs::before { animation-duration: 28s; animation-direction: reverse; }
.orbs::after  { animation-duration: 34s; }

@keyframes float {
  0%,100% { transform: translate3d(0,0,0) scale(1); }
  50%     { transform: translate3d(0,-2.5%,0) scale(1.03); }
}

/* --- APPLE INTELLIGENCE STYLE LOADER --- */
#loader-overlay {
  position: fixed;
  inset: 0;
  background: #000; /* Deep black for contrast */
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.8s ease-out, visibility 0.8s;
}

#loader-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Container for the glowing blobs */
.ai-glow-container {
  position: relative;
  width: 150px;
  height: 150px;
  filter: blur(25px); /* Soften everything together */
  animation: pulse-glow 3s ease-in-out infinite alternate;
}

.ai-blob {
  position: absolute;
  border-radius: 50%;
  mix-blend-mode: screen; /* Crucial for light mixing */
  animation: move-blob 4s infinite ease-in-out;
}

.blob-1 {
  background: rgb(var(--glow-1)); /* Pink */
  width: 100px; height: 100px;
  top: 0; left: 10px;
  animation-delay: 0s;
}
.blob-2 {
  background: rgb(var(--glow-2)); /* Blue */
  width: 110px; height: 90px;
  bottom: 0; right: 10px;
  animation-delay: -1.5s;
}
.blob-3 {
  background: rgb(var(--glow-3)); /* Orange */
  width: 80px; height: 80px;
  bottom: 10px; left: 20px;
  animation-delay: -3s;
}

.loading-text {
  margin-top: 40px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.8);
  animation: fadeText 1.5s infinite alternate;
}

@keyframes move-blob {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -20px) scale(1.1); }
  66% { transform: translate(-15px, 15px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.05); opacity: 1; }
}
@keyframes fadeText { from { opacity: 0.4; } to { opacity: 1; } }


/* --- MAIN CONTENT 3D ANIMATION --- */
/* The shell is the perspective container */
.shell {
  min-height: 100%;
  display: grid;
  place-items: center; 
  padding: 4vmin 2vmin 100px;
  max-width: 1800px;
  margin: 0 auto;
  width: 95%;
  perspective: 2000px; /* Enable 3D space */
}

/* Initial state hidden */
.hidden-container .card {
  opacity: 0;
}

/* The Animation */
.loaded .card {
  animation: flyIn3D 1.2s cubic-bezier(0.19, 1, 0.22, 1) forwards;
  will-change: transform, filter, opacity;
}

@keyframes flyIn3D {
  0% {
    opacity: 0;
    /* Start far back, slightly tilted, and lower */
    transform: translate3d(0, 50px, -150px) rotateX(10deg);
    /* Heavy blur start */
    filter: blur(40px); 
  }
  40% {
    opacity: 1;
    /* Blur fades out relatively quickly to save performance */
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    /* Land in place */
    transform: translate3d(0, 0, 0) rotateX(0deg);
    filter: blur(0px);
  }
}

/* --- CARD STYLING --- */
.card {
  position: relative;
  width: 100%;
  max-width: 1600px;
  padding: 50px 40px 80px 40px;
  border-radius: var(--radius);
  /* Optimization: Simplified gradient slightly */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.06)) padding-box,
    conic-gradient(from 180deg at 50% 50%,
      rgba(var(--glow-2)/0.6),
      rgba(var(--glow-1)/0.6),
      rgba(var(--glow-3)/0.6),
      rgba(var(--glow-2)/0.6)) border-box;
  border: 1px solid transparent;
  /* Performance Warning: backdrop-filter is heavy, but key to design. */
  backdrop-filter: blur(var(--blur)) saturate(1.15);
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
  
  overflow: visible; 
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-style: preserve-3d; /* Keep elements sharp */
}

.title {
  font-size: clamp(32px, 5vw, 60px);
  line-height: 1.1;
  margin: 0 0 10px 0;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(98deg, #ffffff 0%, #dfe6ff 40%, #cbb6ff 70%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 30px rgba(124,92,255,0.25);
}

.sub {
  font-size: clamp(14px, 1.5vw, 16px);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

/* --- BUTTON STYLES --- */
.btn {
  --btn-ring: 124 92 255;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: .8em;
  padding: 14px 28px;
  border-radius: 33px;
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06)) padding-box,
    radial-gradient(120% 220% at 0% 0%, rgba(var(--glow-2)/0.55), rgba(var(--glow-1)/0.0)) border-box;
  border: 1px solid rgba(255,255,255,0.12);
  /* Use simple shadow for performance initially */
  box-shadow: 0 10px 25px rgba(0,0,0,.45);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  width: 100%;
  box-sizing: border-box;
  z-index: 2;
  will-change: transform;
}
.btn:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(255,255,255,0.22);
  box-shadow: 0 18px 40px rgba(0,0,0,.5);
}

/* --- TREE STRUCTURE --- */
.tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.level-1 { z-index: 5; }

.root-btn {
  min-width: 220px;
  font-size: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.2), rgba(255,255,255,0.08)) padding-box, border-box;
  justify-content: center;
  gap: 15px;
}

.level-2-wrapper {
  display: flex;
  justify-content: center;
  gap: 120px;
  width: 100%;
  position: relative;
}

.branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 500px;
  position: relative;
}

.node-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  z-index: 2;
}

.level-2-btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 0;
  min-width: 320px;
}

.level-3-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  position: relative;
  padding-top: 0;
  align-items: center;
}

.level-3-btn {
  padding: 12px 24px;
  font-size: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  width: 90%;
  min-width: 280px;
}
.level-3-btn:hover { background: rgba(255,255,255,0.08); }

/* Connectors */
.connector-vertical {
  width: 2px;
  height: 50px;
  background: var(--line-color);
  margin-bottom: 0;
}

.connector-vertical-small {
  width: 2px;
  height: 25px;
  background: var(--line-color);
}

/* BADGES & STATUS */
.badge {
  font-size: 0.7em;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px currentColor;
}
.online { background-color: #00ff88; color: #00ff88; }
.offline { background-color: #ff3b3b; color: #ff3b3b; }

.hint {
  margin-top: 18px;
  color: rgba(231,236,255,0.66);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: .9;
  font-weight: 700;
}
kbd {
  font: inherit;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  border-bottom-color: rgba(0,0,0,.35);
  padding: 2px 8px;
  border-radius: 33px;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.35);
  color: #fff;
}

/* Responsive */
@media (max-width: 900px) {
  .level-2-wrapper {
    flex-direction: column;
    gap: 50px;
    align-items: center;
  }
  .branch, .level-2-btn, .level-3-btn { min-width: unset; width: 100%; max-width: 400px; }
}