.landing {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--color-ocean-light) 0%, var(--color-ocean) 60%, var(--color-ocean-deep) 100%);
  color: var(--color-text-inverse);
  padding:
    max(env(safe-area-inset-top, 0), 1.5rem)
    max(env(safe-area-inset-right, 0), 1.25rem)
    max(env(safe-area-inset-bottom, 0), 1.5rem)
    max(env(safe-area-inset-left, 0), 1.25rem);
  overflow: hidden;
}

/* Decorative bubbles in the background. */
.landing__bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.landing__bubbles span {
  position: absolute;
  bottom: -120px;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  filter: blur(1px);
  animation: bubble-rise 9s linear infinite;
}

.landing__bubbles span:nth-child(1) { left: 8%;  width: 18px; height: 18px; animation-delay: 0s;   animation-duration: 11s; }
.landing__bubbles span:nth-child(2) { left: 22%; width: 36px; height: 36px; animation-delay: -3s;  animation-duration: 13s; }
.landing__bubbles span:nth-child(3) { left: 42%; width: 22px; height: 22px; animation-delay: -1s;  animation-duration: 8s; }
.landing__bubbles span:nth-child(4) { left: 60%; width: 30px; height: 30px; animation-delay: -5s;  animation-duration: 10s; }
.landing__bubbles span:nth-child(5) { left: 78%; width: 20px; height: 20px; animation-delay: -2s;  animation-duration: 12s; }
.landing__bubbles span:nth-child(6) { left: 90%; width: 26px; height: 26px; animation-delay: -7s;  animation-duration: 14s; }

@keyframes bubble-rise {
  0%   { transform: translateY(0)         scale(1);   opacity: 0; }
  10%  { opacity: 0.6; }
  100% { transform: translateY(-120vh)    scale(1.2); opacity: 0; }
}

.landing__hero {
  position: relative;
  text-align: center;
  margin-top: clamp(2rem, 8vh, 5rem);
}

.landing__logo {
  font-size: clamp(3.5rem, 14vw, 6rem);
  line-height: 1;
  margin-bottom: 1rem;
  animation: float 3.5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

.landing__title {
  font-size: clamp(1.5rem, 5.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  max-width: 22ch;
  margin: 0 auto;
}

.landing__subtitle {
  margin: 1rem auto 0;
  font-size: clamp(0.9rem, 3.5vw, 1.05rem);
  opacity: 0.85;
  max-width: 32ch;
  line-height: 1.5;
}

.landing__cta {
  position: relative;
  margin: clamp(2rem, 6vh, 4rem) auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: center;
  max-width: 480px;
  width: 100%;
}

.landing__begin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(80vw, 320px);
  min-height: 64px;
  padding: 1rem 2.5rem;
  background: #fff;
  color: var(--color-ocean-deep);
  font-size: clamp(1.05rem, 4.5vw, 1.25rem);
  font-weight: 800;
  border-radius: 999px;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.25),
    0 0 0 6px rgba(255, 255, 255, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  touch-action: manipulation;
  letter-spacing: 0.01em;
  animation: pulse-glow 2.4s ease-in-out infinite;
}

.landing__begin-btn:hover { transform: translateY(-2px); }
.landing__begin-btn:active { transform: scale(0.97); }

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25), 0 0 0 6px rgba(255, 255, 255, 0.18); }
  50%      { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25), 0 0 0 14px rgba(255, 255, 255, 0.10); }
}

.landing__hint {
  font-size: 0.8rem;
  opacity: 0.7;
}

.landing__footer {
  position: relative;
  margin-top: auto;
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.6;
  padding-top: 1.5rem;
}

/* Tablet: scale things up nicely. */
@media (min-width: 600px) {
  .landing__title { max-width: 26ch; }
  .landing__begin-btn { min-width: 360px; }
}

/* Small "あそびかた ❓" help button under the begin button so kids can
   re-open the how-to modal whenever they want. */
.landing__help-btn {
  margin-top: 0.75rem;
  background: rgba(255, 255, 255, 0.16);
  color: var(--color-text-inverse);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  transition: background 0.2s;
}
.landing__help-btn:active { background: rgba(255, 255, 255, 0.28); }

/* ===========================================================
   Intro / how-to modal — shown once per session on first
   landing view, and on demand from the help button.
   =========================================================== */

.intro-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  /* QA bug #9: don't let a swipe on the backdrop bounce the page behind
     the modal. (No touch-action here — it would cascade to the sheet and
     kill its own scrolling.) */
  overscroll-behavior: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 61, 98, 0.78);          /* ocean-deep, semi-transparent */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding:
    max(env(safe-area-inset-top, 0), 1rem)
    1rem
    max(env(safe-area-inset-bottom, 0), 1rem)
    1rem;
  animation: intro-fade-in 0.25s ease-out;
}
.intro-modal[hidden] { display: none; }

@keyframes intro-fade-in { from { opacity: 0; } to { opacity: 1; } }

.intro-modal__sheet {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  /* QA bug #9: swiping the sheet rubber-banded its content past the modal
     edges (iOS overscroll), cutting off the steps. Contain the scroll to
     the sheet and allow vertical panning only. */
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: var(--color-foam);
  color: var(--color-ocean-deep);
  border-radius: 24px;
  padding: 1.5rem 1.4rem 1.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  animation: intro-slide-up 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes intro-slide-up {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Close button — top-right of the sheet. */
.intro-modal__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(10, 61, 98, 0.08);
  color: var(--color-ocean-deep);
  font-size: 22px;
  line-height: 1;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.intro-modal__close:active { background: rgba(10, 61, 98, 0.18); }

/* Corner decorations — starfish top-left, coral bottom-right. */
.intro-modal__deco {
  position: absolute;
  pointer-events: none;
  opacity: 0.95;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}
.intro-modal__deco--tl {
  width: 64px; height: 64px;
  top: -22px; left: -18px;
  transform: rotate(-18deg);
}
.intro-modal__deco--br {
  width: 78px; height: 78px;
  bottom: -22px; right: -14px;
  transform: rotate(8deg);
}

.intro-modal__title {
  margin: 0.25rem 0 0.25rem;
  font-size: 1.55rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.02em;
}

.intro-modal__intro {
  margin: 0 0 1.15rem;
  text-align: center;
  font-size: 1rem;
  opacity: 0.78;
}

.intro-modal__steps {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.intro-modal__step {
  display: grid;
  grid-template-columns: 38px 44px 1fr;
  align-items: center;
  gap: 0.85rem;
  background: #fff;
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(10, 61, 98, 0.08);
}

.intro-modal__num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-coral);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 4px rgba(255, 118, 117, 0.4);
}

.intro-modal__icon {
  font-size: 1.9rem;
  line-height: 1;
  text-align: center;
}

.intro-modal__step p {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-ocean-deep);
}

.intro-modal__start {
  width: 100%;
  background: var(--color-coral);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.95rem;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 118, 117, 0.45);
  transition: transform 0.15s;
}
.intro-modal__start:active { transform: scale(0.98); }
