@import url("./type-scale.css?v=20260821-type1");

/* Ghost AI slime v8 — hide the legacy CSS mascot until WebGL truly fails. */
.mascot-stage {
  position: relative;
  width: min(418px, 84vw);
  height: 350px;
  margin: 4px auto 0;
  overflow: visible;
  isolation: isolate;
}

/*
 * The old CSS robot remains in the markup only as a last-resort fallback.
 * Keep it fully hidden during normal startup so it never flashes before the
 * Three.js mascot finishes its first render. A small timeout in index.html
 * adds .webgl-failed only when the WebGL mascot never becomes ready.
 */
.mascot-stage .soft-bot,
.mascot-stage .bot-shadow,
.mascot-stage > .orbit {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.mascot-stage.webgl-failed:not(.webgl-ready) .soft-bot,
.mascot-stage.webgl-failed:not(.webgl-ready) .bot-shadow,
.mascot-stage.webgl-failed:not(.webgl-ready) > .orbit {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: none !important;
}

.three-slime-canvas {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100% !important;
  height: 100% !important;
  display: block;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease, filter .28s ease, transform .28s ease;
  filter:
    saturate(1.035)
    contrast(1.025)
    drop-shadow(0 24px 42px rgba(73, 105, 181, .18));
}

.mascot-stage::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 50%;
  width: 91%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 52%, rgba(113, 226, 255, .24), transparent 29%),
    radial-gradient(circle at 50% 50%, rgba(100, 137, 255, .14), transparent 45%),
    radial-gradient(circle at 56% 44%, rgba(167, 177, 255, .12), transparent 55%),
    radial-gradient(circle at 44% 38%, rgba(255,255,255,.68), transparent 64%);
  filter: blur(28px);
  opacity: .93;
  pointer-events: none;
  animation: slimeAura 4.8s ease-in-out infinite;
}

.mascot-stage::after {
  content: "LIVE INFERENCE · NEURAL CORE · ADAPTIVE AI";
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 25px;
  transform: translateX(-50%);
  color: rgba(58, 79, 119, .58);
  font: 500 7px/1 var(--mono, "DM Mono", monospace);
  letter-spacing: .15em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease, letter-spacing .22s ease;
  pointer-events: none;
}

.mascot-stage.webgl-ready .three-slime-canvas { opacity: 1; }

.mascot-stage.webgl-ready:hover .three-slime-canvas {
  filter:
    saturate(1.08)
    contrast(1.035)
    drop-shadow(0 28px 50px rgba(64, 103, 202, .25))
    drop-shadow(0 0 24px rgba(112, 224, 255, .12));
  transform: translateY(-2px) scale(1.008);
}

.mascot-stage.webgl-ready:hover::before { opacity: 1; }

.mascot-stage.webgl-ready:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
  letter-spacing: .18em;
}

.mascot-stage.webgl-ready .soft-bot,
.mascot-stage.webgl-ready .bot-shadow,
.mascot-stage.webgl-ready > .orbit {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.mascot-stage.webgl-ready .mascot-caption {
  z-index: 8;
  bottom: 1px;
  color: #7d848e;
  font-size: 9.5px;
  letter-spacing: .11em;
  transition: color .2s ease, transform .2s ease, letter-spacing .2s ease;
}

.mascot-stage.webgl-ready:hover .mascot-caption {
  color: var(--blue);
  transform: translateX(-50%) translateY(-1px);
  letter-spacing: .13em;
}

.mascot-speech {
  position: absolute;
  z-index: 14;
  top: 22px;
  right: -82px;
  width: max-content;
  max-width: 190px;
  min-width: 118px;
  padding: 10px 13px 11px;
  border: 1px solid rgba(99, 119, 157, .20);
  border-radius: 17px 17px 17px 7px;
  background: rgba(255, 255, 255, .90);
  box-shadow:
    0 12px 30px rgba(49, 72, 115, .13),
    inset 0 1px 0 rgba(255, 255, 255, .82);
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
  color: #35415b;
  font-family: "Noto Sans KR", Inter, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -.015em;
  text-align: left;
  opacity: 0;
  transform: translateY(7px) scale(.97);
  transform-origin: 20% 100%;
  pointer-events: none;
  transition:
    opacity .22s ease,
    transform .22s cubic-bezier(.2,.75,.25,1),
    box-shadow .22s ease;
}

.mascot-speech::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -7px;
  width: 13px;
  height: 13px;
  background: rgba(255, 255, 255, .90);
  border-right: 1px solid rgba(99, 119, 157, .16);
  border-bottom: 1px solid rgba(99, 119, 157, .16);
  transform: rotate(45deg);
}

.mascot-speech.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.mascot-speech.is-speaking {
  box-shadow:
    0 14px 34px rgba(49, 72, 115, .16),
    0 0 0 4px rgba(116, 209, 255, .06),
    inset 0 1px 0 rgba(255, 255, 255, .88);
}

.mascot-speech.is-speaking::before {
  content: "✦";
  position: absolute;
  top: -9px;
  right: 11px;
  color: #8acfff;
  font-size: 10px;
  opacity: .8;
  animation: speechSpark 1.35s ease-in-out infinite;
}

@keyframes slimeAura {
  0%, 100% {
    transform: translate(-50%, -50%) scale(.97);
    filter: blur(28px);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.035);
    filter: blur(31px);
  }
}

@keyframes speechSpark {
  0%, 100% { transform: scale(.8) rotate(0deg); opacity: .4; }
  50% { transform: scale(1.2) rotate(20deg); opacity: 1; }
}

@media (max-width: 900px) {
  .mascot-speech {
    right: -34px;
    top: 13px;
    max-width: 170px;
  }
}

@media (max-width: 700px) {
  .mascot-stage {
    width: min(330px, 89vw);
    height: 280px;
  }

  .mascot-stage::before {
    width: 94%;
    filter: blur(21px);
  }

  .mascot-stage::after {
    bottom: 20px;
    font-size: 6px;
    letter-spacing: .12em;
  }

  .mascot-speech {
    top: 0;
    right: -2px;
    max-width: 152px;
    min-width: 100px;
    padding: 8px 10px 9px;
    border-radius: 14px 14px 14px 6px;
    font-size: 10.5px;
  }
}

@media (max-width: 390px) {
  .mascot-stage {
    width: min(300px, 91vw);
    height: 255px;
  }

  .mascot-stage.webgl-ready .mascot-caption {
    font-size: 8.5px;
  }

  .mascot-speech {
    right: 0;
    max-width: 140px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .three-slime-canvas { transition: none; }
  .mascot-stage::before { animation: none; }
  .mascot-stage::after { display: none; }
  .mascot-speech,
  .mascot-speech.is-visible { transition: none; }
  .mascot-speech.is-speaking::before { animation: none; }
}
