#welcome-guide {
  position: absolute;
  z-index: 6;
  bottom: max(46px, calc(env(safe-area-inset-bottom) + 18px));
  right: clamp(70px, 11vw, 180px);
  display: grid;
  grid-template-columns: auto minmax(0, 335px);
  align-items: end;
  gap: 8px;
  max-width: calc(100% - 28px);
  pointer-events: none;
  animation: welcome-arrive .42s cubic-bezier(.2,.8,.3,1) both;
}

#welcome-guide[hidden] { display: none; }

.welcome-mascot {
  position: relative;
  grid-area: 1 / 1;
  display: grid;
  justify-items: center;
  justify-self: end;
}

.welcome-mascot img {
  display: block;
  width: auto;
  height: clamp(145px, 30dvh, 292px);
  filter: drop-shadow(0 9px 9px #142a39aa);
  animation: welcome-float 3s ease-in-out infinite;
}

.welcome-bubble {
  position: relative;
  grid-area: 1 / 2;
  align-self: center;
  isolation: isolate;
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-left: 7px;
  padding: clamp(12px, 2.4vw, 21px);
  color: var(--modal-text);
  border: 2px solid #fff3b1;
  border-radius: 21px;
  background:
    radial-gradient(ellipse 95% 80% at 18% 0%, #e7ffd786, transparent 61%),
    linear-gradient(148deg, #449c74 0%, #257454 39%, #153f33 100%);
  box-shadow: 0 0 0 1px #71542c, 0 5px 0 #234334, 0 10px 25px #12252176,
    inset 0 2px 1px #ffffd2a6, inset 0 -3px 3px #0a3d2f86;
}

.welcome-bubble::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 33%;
  left: -11px;
  width: 20px;
  height: 20px;
  rotate: 45deg;
  border: solid #fff3b1;
  border-width: 0 0 2px 2px;
  border-radius: 0 0 0 5px;
  background: #398463;
}

.welcome-bubble h2 {
  margin: 0 25px 6px 0;
  color: var(--modal-gold);
  font: 800 clamp(23px, 3vw, 33px)/.98 var(--modal-font);
  text-shadow: var(--modal-shadow);
}

.welcome-bubble p {
  margin: 0;
  font: 700 clamp(13px, 1.5vw, 16px)/1.34 var(--modal-copy-font);
  text-shadow: var(--modal-copy-shadow);
}

#welcome-guide button {
  min-height: 44px;
  font-size: clamp(16px, 2vw, 19px);
  cursor: pointer;
  pointer-events: auto;
}

#welcome-guide button:focus-visible {
  outline: 3px solid var(--modal-gold);
  outline-offset: 4px;
}

#welcome-guide #welcome-close {
  position: absolute;
  top: -10px;
  right: -7px;
  z-index: 1;
  width: 44px;
  height: 44px;
  padding: 0 0 2px;
  border-radius: 50%;
  font: 800 25px/1 system-ui, sans-serif;
}

@keyframes welcome-arrive {
  from { opacity: 0; translate: 0 18px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes welcome-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}

@media (max-width: 600px) {
  #welcome-guide {
    right: auto;
    left: 11px;
    width: min(calc(100% - 22px), 400px);
    max-width: none;
    bottom: max(96px, calc(env(safe-area-inset-bottom) + 81px));
    gap: 4px;
  }
  .welcome-mascot img { height: clamp(106px, 19dvh, 164px); }
  .welcome-bubble { align-self: end; }
}

@media (max-height: 500px) {
  #welcome-guide {
    right: 72px;
    left: auto;
    bottom: max(27px, env(safe-area-inset-bottom));
    width: min(395px, calc(100% - 85px));
  }
  .welcome-mascot img { height: clamp(91px, 29dvh, 155px); }
}

@media (prefers-reduced-motion: reduce) {
  #welcome-guide, .welcome-mascot img { animation: none; }
}
