/* Only the character follows the edge; the bubble stays level at its baseline. */
.hero-edge-mascot { position: absolute; z-index: 4; transform: translate(-50%, -91.3%); pointer-events: none; }
.hero-mascot-body.edge-mascot {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0;
  background: none; pointer-events: auto; transform-origin: 50% 91.3%;
  transform: translateY(var(--mascot-edge-y, 0px)) rotate(var(--mascot-edge-angle, 0deg));
}
.mascot-trigger { cursor: pointer; }
.mascot-trigger:focus-visible { outline: 2px solid var(--orange); outline-offset: -10px; border-radius: 24px; }
.floating-mascot-body {
  position: absolute; left: 30px; top: 0; width: 150px; height: 150px;
  padding: 0; border: 0; background: none; pointer-events: auto;
}
[data-mascot-interactive] .mascot-figure > img,
.floating-chat .mascot-figure > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform: none;
}
.mascot-hover-pose, .mascot-escape-pose { visibility: hidden; }
[data-mascot-interactive][data-mascot-behavior='idle'] .mascot-video-canvas { visibility: hidden; }
[data-mascot-interactive][data-mascot-behavior='idle'] .mascot-video-poster { visibility: visible; }
[data-mascot-interactive][data-mascot-behavior='hover'] .mascot-video-poster { visibility: hidden; }
[data-mascot-interactive][data-mascot-behavior='hover'] .mascot-hover-pose { visibility: visible; }
[data-mascot-behavior='hover'][data-mascot-state='greeting'][data-mascot-frame-ready='true']:not([data-mascot-paused='true']) .mascot-hover-pose { visibility: hidden; }
[data-mascot-interactive][data-mascot-behavior='escape'] :is(.mascot-video-poster, .mascot-video-canvas, .mascot-hover-pose) { visibility: hidden; }
[data-mascot-interactive][data-mascot-behavior='escape'] .mascot-escape-pose { visibility: visible; }
.mascot-talk, [data-mascot-state] .greeting-bubble {
  z-index: 5; pointer-events: auto; opacity: 1; visibility: visible; transform: none;
  border: 0; cursor: pointer; transition: box-shadow 200ms ease;
}
.mascot-talk .mascot-talk-text { display: none; }
[data-mascot-behavior='hover'] .mascot-talk .mascot-talk-text { display: inline-block; animation: greeting-type 480ms steps(6,end) both; }
[data-mascot-state='ready'] .greeting-bubble > span { animation: none; }
.mascot-talk i { font-style: normal; color: #777; }
.floating-chat .mascot-talk {
  --mascot-bubble-background: #fff;
  --mascot-bubble-border: #d0d3da;
  left: auto; right: 146px; top: 88px; width: max-content; min-width: 42px; height: auto;
  display: flex; gap: 8px; align-items: center; justify-content: center; padding: 12px 14px;
  background: var(--mascot-bubble-background);
  box-shadow: inset 0 0 0 1px var(--mascot-bubble-border), 0 3px 14px #00071f12;
  color: var(--ink); font: 700 14px/1.4 var(--font-ja);
}
.floating-chat .mascot-talk::after {
  content: ''; position: absolute; right: 8px; bottom: -7px; width: 8px; height: 8px;
  background: linear-gradient(45deg, transparent 43%, var(--mascot-bubble-border) 44% 56%, var(--mascot-bubble-background) 57%);
  border-right: 1px solid var(--mascot-bubble-border);
  clip-path: polygon(0 0,100% 0,100% 100%);
}
.mascot-talk:is(:hover,:focus-visible) { box-shadow: 0 5px 24px #00071f25; }
.floating-chat .mascot-talk:is(:hover,:focus-visible) { box-shadow: inset 0 0 0 1px var(--mascot-bubble-border), 0 5px 24px #00071f25; }
.mascot-talk:focus-visible { outline: 2px solid var(--orange); outline-offset: 4px; }
.hero-edge-mascot .mascot-talk .mascot-idle-text { display: inline-block; }
.hero-edge-mascot[data-mascot-behavior='hover'] .mascot-talk .mascot-idle-text { display: none; }
.hero-edge-mascot[data-mascot-autoplay='true'] .mascot-hover-pose { visibility: hidden; }
.hero-edge-mascot[data-mascot-autoplay='true'] .mascot-video-poster { visibility: visible; }
.hero-edge-mascot[data-mascot-autoplay='true'][data-mascot-state='greeting'][data-mascot-frame-ready='true']:not([data-mascot-paused='true']) .mascot-video-canvas { visibility: visible; }
.hero-edge-mascot[data-mascot-autoplay='true'][data-mascot-state='greeting'][data-mascot-frame-ready='true']:not([data-mascot-paused='true']) .mascot-video-poster { visibility: hidden; }
/* Run in from the right, then return to the front-facing idle pose. The
   supplied escape pose faces right, so only this entrance mirrors it. */
.hero-edge-mascot[data-mascot-interactive][data-mascot-state='entering'] :is(.mascot-video-poster, .mascot-video-canvas, .mascot-hover-pose) { visibility: hidden; }
.hero-edge-mascot[data-mascot-interactive][data-mascot-state='entering'] .mascot-escape-pose { visibility: visible; transform: scaleX(-1); }
.floating-chat { transition: transform 480ms cubic-bezier(.22,1,.36,1), opacity 180ms ease; }
/* Hide immediately when the hero takes over; fading out would overlap both figures. */
.floating-chat[data-hero-visible='true'] { opacity: 0; visibility: hidden; pointer-events: none; transition: none; }
.floating-chat[data-mascot-behavior='escape'] { transform: translateX(calc(100% + 44px)); pointer-events: none; transition-duration: 440ms, 180ms; transition-timing-function: cubic-bezier(.4,0,.2,1), ease; }
.floating-chat[data-mascot-behavior='escape'] .mascot-talk { opacity: 0; pointer-events: none; }
@media(max-width:767px) {
  .floating-mascot-body { left: 26px; width: 104px; height: 104px; }
  .floating-chat .mascot-talk { right: 103px; top: 59px; min-width: 36px; padding: 10px 12px; font-size: 12px; }
}
@media(prefers-reduced-motion:reduce) { [data-mascot-behavior='hover'] .mascot-talk .mascot-talk-text { animation: none; } .floating-chat { transition: none; } }
html[data-motion-paused='true'] .mascot-talk .mascot-talk-text { animation: none; }
