:root {
  --nf-purple: #8B6FD4;
  --nf-purple-deep: #5838A8;
  --nf-graphite-deep: #1A1E2E;
  --nf-text-muted: rgba(255, 255, 255, .65);
}

body[data-page="404"] {
  color: #fff;
  background: var(--nf-graphite-deep);
}

.not-found {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 140px 24px 80px;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% 30%, #2a2850 0%, var(--nf-graphite-deep) 70%);
}

.nf-inner {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 72px;
  align-items: center;
  width: 100%;
  max-width: 960px;
}

.nf-mascot-area {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.nf-code {
  margin-bottom: 8px;
  font-family: var(--font-h), Comfortaa, sans-serif;
  font-size: clamp(80px, 14vw, 160px);
  font-weight: 700;
  line-height: .95;
  color: #fff;
  letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--nf-purple) 0%, var(--brand) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nf-title {
  margin: 0 0 16px;
  font-family: var(--font-h), Comfortaa, sans-serif;
  font-size: clamp(26px, 3.6vw, 40px);
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

.nf-desc {
  max-width: 460px;
  margin-bottom: 32px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--nf-text-muted);
}

.nf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* White ghost button for dark background */
.btn--ai {
  display: inline-block;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  transition: background .2s, border-color .2s, transform .15s;
}
.btn--ai:hover {
  background: rgba(139, 111, 212, .2);
  border-color: var(--nf-purple);
  transform: translateY(-1px);
}

/* ===============================================
   Mascot — lifted from ai.css, only pieces needed
   =============================================== */
.mascot-wrap {
  position: relative;
  width: 260px;
  height: 280px;
  cursor: pointer;
}
.mascot-wrap svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
.mascot-wrap svg .eye {
  transition: transform .12s ease-out, d .18s ease;
}
.mascot-shadow {
  position: absolute;
  bottom: -20px;
  left: 50%;
  z-index: -1;
  width: 190px;
  height: 28px;
  background: rgba(139, 111, 212, .35);
  filter: blur(20px);
  border-radius: 50%;
  transform: translateX(-50%);
}
.thought-bubble {
  position: absolute;
  top: -14px;
  right: -48px;
  z-index: 5;
  padding: 12px 18px;
  font-family: var(--font-h), Comfortaa, sans-serif;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: #1A1E2E;
  white-space: nowrap;
  pointer-events: none;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  opacity: 0;
  transition: opacity .35s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
  transform: scale(.5) translateY(10px);
}
.thought-bubble::after {
  position: absolute;
  bottom: -6px;
  left: 24px;
  width: 14px;
  height: 14px;
  content: '';
  background: #fff;
  transform: rotate(45deg);
}
.thought-bubble.show {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Idle breathing */
.m-idle .ft { animation: nf-ft 2.4s ease-in-out infinite; }
.m-idle .fm { animation: nf-fm 2.4s ease-in-out infinite .12s; }
.m-idle .fb { animation: nf-fb 2.4s ease-in-out infinite .24s; }

@keyframes nf-ft{ 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

@keyframes nf-fm{ 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

@keyframes nf-fb{ 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }

/* Happy — small jump on click */
.happy .ft { animation: nf-hp-ft .7s cubic-bezier(.34, 1.56, .64, 1) infinite; }
.happy .fm { animation: nf-hp-fm .7s cubic-bezier(.34, 1.56, .64, 1) .08s infinite; }
.happy .fb { animation: nf-hp-fb .7s cubic-bezier(.34, 1.56, .64, 1) .16s infinite; }

@keyframes nf-hp-ft{ 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-22px) rotate(-4deg); } }

@keyframes nf-hp-fm{ 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }

@keyframes nf-hp-fb{ 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* Think — slight tilt */
.think .ft { animation: nf-th-ft 2.8s ease-in-out infinite; }
.think .fm { animation: nf-th-fm 2.8s ease-in-out infinite; }
.think .fb { animation: nf-th-fb 2.8s ease-in-out infinite; }

@keyframes nf-th-ft{ 0%, 100% { transform: rotate(0) translateY(0); } 50% { transform: rotate(8deg) translateY(-4px); } }

@keyframes nf-th-fm{ 0%, 100% { transform: rotate(0); } 50% { transform: rotate(4deg); } }

@keyframes nf-th-fb{ 0%, 100% { transform: rotate(0); } 50% { transform: rotate(2deg); } }

/* Surprise */
.surp .ft { animation: nf-sp-ft .5s ease-out infinite; }
.surp .fm { animation: nf-sp-fm .5s ease-out .05s infinite; }
.surp .fb { animation: nf-sp-fb .5s ease-out .1s infinite; }

@keyframes nf-sp-ft{ 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

@keyframes nf-sp-fm{ 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }

@keyframes nf-sp-fb{ 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

@media (max-width: 820px){
  .nf-inner {
    grid-template-columns: 1fr;
    gap: 40px;
    justify-items: center;
    text-align: center;
  }
  .nf-text { display: flex; flex-direction: column; align-items: center; }
  .nf-desc { margin-right: auto; margin-left: auto; }
  .nf-actions { justify-content: center; }
  .mascot-wrap { width: 220px; height: 240px; }
  .thought-bubble { right: -24px; padding: 10px 14px; font-size: 15px; }
}

@media (max-width: 480px){
  .not-found { padding: 120px 20px 60px; }
  .nf-code { font-size: 96px; }
  .thought-bubble { top: -30px; right: auto; left: 50%; transform: translateX(-50%) scale(.5) translateY(10px); }
  .thought-bubble.show { transform: translateX(-50%) scale(1) translateY(0); }
  .thought-bubble::after { left: 50%; margin-left: -7px; }
}
