html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: rgb(255, 255, 255);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

canvas {
  position: fixed;
  inset: 0;
  display: block;
  z-index: 0;
  touch-action: none;
  cursor: grab;
}
canvas:active { cursor: grabbing; }

/* --------- TEXT OVERLAY LAYER ---------- */
#textLayer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  pointer-events: none;
  perspective: 1000px;
  user-select: none;
  transition: opacity 0.4s ease;
}

#textLayer .phrase {
  display: inline-block;
  transform-style: preserve-3d;
  padding: 16px 22px;
  border-radius: 18px;
  mix-blend-mode: difference;
}

#textLayer .letter {
  display: inline-block;
  transform-style: preserve-3d;
  font-size: clamp(17px, 3.6vw, 43px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: black;
  opacity: 0;
  transform: translate3d(0, 0, -800px) scale(0.8);
}

#textLayer .letter.space {
  width: 0.35em;
}

/* --------- CARD INFO OVERLAY ---------- */
#cardInfo {
  position: fixed;
  bottom: 80px;
  left: 28px;
  z-index: 20;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#cardInfo.visible {
  opacity: 1;
  transform: translateY(0);
}

#cardInfo .card-info-title {
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 800;
  color: #111;
  line-height: 1.2;
  margin-bottom: 6px;
}

#cardInfo .card-info-desc {
  font-size: clamp(13px, 2vw, 16px);
  font-weight: 400;
  color: #444;
  padding-left: 20px;
}

/* --------- CATEGORY NAVIGATION ---------- */
#categoryNav {
  position: fixed;
  bottom: 80px;
  left: 28px;
  z-index: 20;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  opacity: 0;
  pointer-events: auto;
}

#categoryNav .category {
  margin-bottom: 4px;
  cursor: pointer;
}

#categoryNav .category-title {
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 800;
  color: #111;
  line-height: 1.2;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
}

#categoryNav .category.active .category-title {
  transform: translateY(-4px);
}

#categoryNav .subcategories {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  padding-left: 20px;
}

#categoryNav .category.active .subcategories {
  max-height: 200px;
}

#categoryNav .sub-item {
  font-size: clamp(13px, 2vw, 16px);
  font-weight: 400;
  color: #444;
  line-height: 1.6;
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

#categoryNav .category.active .sub-item {
  opacity: 1;
  transform: translateX(0);
}

#categoryNav .category.active .sub-item:nth-child(1) { transition-delay: 0.08s; }
#categoryNav .category.active .sub-item:nth-child(2) { transition-delay: 0.16s; }
#categoryNav .category.active .sub-item:nth-child(3) { transition-delay: 0.24s; }

#categoryNav .sub-item:hover {
  color: #000;
}

#categoryNav .sub-item.selected {
  color: #000;
  font-weight: 600;
}

/* --------- LEGAL FOOTER ---------- */
#legalFooter {
  position: fixed;
  bottom: 16px;
  left: 28px;
  z-index: 20;
  font-size: 11px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  opacity: 0;
}

#legalFooter .legal-links {
  margin-bottom: 4px;
}

#legalFooter .legal-links a {
  color: rgba(80, 80, 80, 0.6);
  text-decoration: none;
  transition: color 0.2s ease;
  margin-right: 12px;
}

#legalFooter .legal-links a:hover {
  color: rgba(30, 30, 30, 0.9);
}

#legalFooter .copyright {
  color: rgba(80, 80, 80, 0.5);
  display: block;
}

/* --------- MOBILE ---------- */
@media (max-width: 768px) {
  #categoryNav {
    bottom: 70px;
    left: 16px;
  }

  #categoryNav .category-title {
    font-size: clamp(20px, 6vw, 32px);
  }

  #categoryNav .subcategories {
    padding-left: 14px;
  }

  #categoryNav .sub-item {
    font-size: clamp(11px, 3vw, 14px);
  }

  #legalFooter {
    bottom: 10px;
    left: 16px;
    font-size: 9px;
  }

  #cardInfo {
    bottom: 70px;
    left: 16px;
  }

  #cardInfo .card-info-title {
    font-size: clamp(20px, 6vw, 32px);
  }

  #cardInfo .card-info-desc {
    font-size: clamp(11px, 3vw, 14px);
    padding-left: 14px;
  }
}