* {
  cursor:
    url("./assets/cursor.png") 5 2,
    pointer !important;
}

body.intro-active {
  overflow: hidden;
}

body.intro-active #app,
body.intro-active .sparkle-field {
  opacity: 0;
}

#app,
.sparkle-field {
  transition: opacity 0.7s ease;
}

.game-intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  isolation: isolate;
  min-height: 100svh;
  overflow: hidden;
  color: #fff7d1;
  background: #063f62;
}

.game-intro.is-leaving {
  pointer-events: none;
  animation: introCurtain 0.9s cubic-bezier(0.72, 0, 0.22, 1) forwards;
}

.intro-backdrop {
  position: absolute;
  inset: -4%;
  z-index: -5;
  background:
    linear-gradient(
      90deg,
      rgba(2, 32, 56, 0.16),
      rgba(2, 32, 56, 0.04) 48%,
      rgba(2, 26, 48, 0.32)
    ),
    url("./assets/background.webp") center / cover no-repeat;
  filter: saturate(1.18) contrast(1.04);
  animation: introIslandPush 6s cubic-bezier(0.18, 0.78, 0.22, 1) both;
}

.intro-backdrop::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(
      90deg,
      rgba(0, 17, 36, 0.72),
      rgba(0, 23, 45, 0.26) 42%,
      transparent 72%
    ),
    linear-gradient(
      180deg,
      rgba(7, 47, 77, 0.08),
      transparent 50%,
      rgba(2, 22, 38, 0.34)
    );
}

.intro-sunburst {
  position: absolute;
  z-index: -3;
  top: -28vmin;
  right: -13vmin;
  width: min(94vmin, 980px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    repeating-conic-gradient(
      from 10deg,
      rgba(255, 222, 105, 0.26) 0 5deg,
      transparent 5deg 14deg
    ),
    radial-gradient(
      circle,
      rgba(255, 250, 202, 0.95) 0 5%,
      rgba(255, 201, 65, 0.38) 18%,
      transparent 52%
    );
  mix-blend-mode: screen;
  opacity: 0;
  animation: introSunrise 5.6s ease-out 0.35s both;
}

.intro-captain {
  position: absolute;
  z-index: 3;
  right: clamp(-85px, 1vw, 24px);
  bottom: -12%;
  width: min(61vw, 820px);
  max-height: 114vh;
  object-fit: contain;
  object-position: right bottom;
  filter: drop-shadow(0 24px 35px rgba(0, 18, 32, 0.72))
    drop-shadow(0 0 25px rgba(255, 201, 62, 0.3));
  transform-origin: 58% 90%;
  animation: captainBoarding 5.4s cubic-bezier(0.15, 0.78, 0.18, 1) both;
}

.intro-story {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: clamp(30px, 6vw, 110px);
  width: min(41vw, 590px);
  transform: translateY(-50%);
  text-shadow: 0 4px 24px rgba(0, 20, 37, 0.82);
  animation: introStoryReveal 5.4s ease-out both;
}

.intro-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
  color: #a9f7ff;
  font-size: clamp(0.66rem, 1vw, 0.85rem);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.intro-eyebrow::before {
  width: 42px;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, #3adff6, #fff0a0);
  box-shadow: 0 0 12px #4de8ff;
}

.intro-logo {
  display: block;
  width: min(92%, 500px);
  margin: 0 0 4px -3%;
  filter: drop-shadow(0 10px 18px rgba(0, 17, 31, 0.68));
}

.intro-story h1 {
  max-width: 12ch;
  margin: 0;
  color: #fff6ce;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.75rem, 3.6vw, 3.8rem);
  font-style: italic;
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.intro-copy {
  max-width: 490px;
  margin: 14px 0 0;
  color: #e9fbff;
  font-size: clamp(0.86rem, 1.2vw, 1.05rem);
  font-weight: 600;
  line-height: 1.5;
}

.intro-progress {
  position: relative;
  width: min(100%, 430px);
  height: 10px;
  margin-top: 24px;
  overflow: visible;
  border: 2px solid rgba(255, 234, 154, 0.68);
  border-radius: 999px;
  background: rgba(2, 29, 47, 0.74);
  box-shadow:
    inset 0 3px 5px rgba(0, 10, 18, 0.72),
    0 0 20px rgba(50, 221, 244, 0.18);
}

.intro-progress-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    #18cce4,
    #58f4ff 48%,
    #ffd65b 78%,
    #fff2a4
  );
  box-shadow: 0 0 16px #55efff;
  transform: scaleX(0);
  transform-origin: left;
  animation: introLoad 4.5s cubic-bezier(0.1, 0.7, 0.2, 1) 0.25s forwards;
}

.intro-progress-fill img {
  position: absolute;
  right: -5px;
  top: -7px;
  width: 20px;
}

.intro-progress-copy {
  display: flex;
  width: min(100%, 430px);
  justify-content: space-between;
  margin-top: 8px;
  color: #d8f9ff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.intro-progress-copy strong {
  color: #ffe478;
  font-variant-numeric: tabular-nums;
}

.intro-waves {
  position: absolute;
  z-index: 4;
  right: -10%;
  bottom: -12%;
  width: 72%;
  height: 33%;
  pointer-events: none;
  filter: drop-shadow(0 -5px 12px rgba(74, 232, 255, 0.28));
}

.intro-waves span {
  position: absolute;
  left: 0;
  width: 120%;
  height: 72%;
  border: clamp(4px, 0.65vw, 9px) solid rgba(110, 242, 255, 0.66);
  border-bottom: 0;
  border-radius: 50%;
  transform: rotate(-5deg);
  animation: waveSweep 2.6s ease-in-out infinite alternate;
}

.intro-waves span:nth-child(2) {
  left: -10%;
  bottom: -16%;
  opacity: 0.58;
  animation-delay: -0.8s;
}

.intro-waves span:nth-child(3) {
  left: 9%;
  bottom: -30%;
  opacity: 0.34;
  animation-delay: -1.5s;
}

.intro-coins {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}

.intro-coins i {
  position: absolute;
  top: -11vh;
  width: clamp(18px, 2.6vw, 38px);
  aspect-ratio: 1;
  border: 3px solid #fff0a2;
  border-radius: 50%;
  background: radial-gradient(
    circle at 34% 28%,
    #fff4a9 0 8%,
    #ffd846 26%,
    #d98808 72%,
    #7f3d03 100%
  );
  box-shadow:
    inset 0 0 0 3px rgba(132, 66, 2, 0.36),
    0 0 12px rgba(255, 202, 47, 0.56);
  animation: introCoinFall 3.8s linear infinite;
}

.intro-coins i::after {
  position: absolute;
  inset: 25%;
  content: "";
  border: 2px solid rgba(126, 67, 4, 0.58);
  border-radius: 50%;
}

.intro-coins i:nth-child(1) {
  left: 8%;
  animation-delay: 0.4s;
}
.intro-coins i:nth-child(2) {
  left: 24%;
  animation-delay: 2.1s;
  animation-duration: 4.7s;
}
.intro-coins i:nth-child(3) {
  left: 41%;
  animation-delay: 1.2s;
  animation-duration: 4.2s;
}
.intro-coins i:nth-child(4) {
  left: 56%;
  animation-delay: 3s;
}
.intro-coins i:nth-child(5) {
  left: 70%;
  animation-delay: 0.8s;
  animation-duration: 4.8s;
}
.intro-coins i:nth-child(6) {
  left: 83%;
  animation-delay: 2.5s;
}
.intro-coins i:nth-child(7) {
  left: 92%;
  animation-delay: 1.6s;
  animation-duration: 4.4s;
}
.intro-coins i:nth-child(8) {
  left: 34%;
  animation-delay: 3.5s;
  animation-duration: 5s;
}

.intro-skip {
  position: absolute;
  z-index: 9;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  min-height: 44px;
  padding: 0 18px;
  color: #fff7d2;
  background: rgba(2, 33, 52, 0.7);
  border: 1px solid rgba(255, 230, 128, 0.72);
  border-radius: 999px;
  box-shadow: 0 9px 26px rgba(0, 21, 38, 0.5);
  backdrop-filter: blur(10px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor:
    url("./assets/cursor.png") 5 2,
    pointer !important;
}

.intro-skip:hover,
.intro-skip:focus-visible {
  color: #082d40;
  background: linear-gradient(#fff2a4, #eeb439);
  outline: 3px solid rgba(87, 235, 255, 0.6);
  outline-offset: 3px;
}

.intro-disclaimer {
  position: absolute;
  z-index: 8;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom));
  margin: 0;
  color: rgba(235, 251, 255, 0.86);
  font-size: 0.7rem;
  font-weight: 700;
}

@keyframes introIslandPush {
  from {
    transform: scale(1.12);
    filter: saturate(0.85) brightness(0.64);
  }
  to {
    transform: scale(1.01);
    filter: saturate(1.18) brightness(1);
  }
}

@keyframes introSunrise {
  0%,
  14% {
    opacity: 0;
    transform: scale(0.46) rotate(-20deg);
  }
  42% {
    opacity: 0.85;
  }
  100% {
    opacity: 0.44;
    transform: scale(1.08) rotate(9deg);
  }
}

@keyframes captainBoarding {
  0% {
    opacity: 0;
    transform: translate3d(18%, 16%, 0) scale(0.88) rotate(2deg);
    filter: brightness(0.56) blur(8px);
  }
  20% {
    opacity: 1;
  }
  48% {
    transform: translate3d(0, 0, 0) scale(1);
    filter: brightness(0.92) blur(0);
  }
  100% {
    transform: translate3d(-1.5%, -1%, 0) scale(1.035);
    filter: brightness(1.08) blur(0);
  }
}

@keyframes introStoryReveal {
  0%,
  20% {
    opacity: 0;
    transform: translate(-30px, -46%);
  }
  48%,
  100% {
    opacity: 1;
    transform: translate(0, -50%);
  }
}

@keyframes introLoad {
  to {
    transform: scaleX(1);
  }
}

@keyframes waveSweep {
  from {
    transform: translateX(-2%) rotate(-6deg) scaleY(0.9);
  }
  to {
    transform: translateX(4%) rotate(-3deg) scaleY(1.08);
  }
}

@keyframes introCoinFall {
  0% {
    transform: translate3d(0, -8vh, 0) rotateY(0deg) rotateZ(0deg);
    opacity: 0;
  }
  12% {
    opacity: 0.9;
  }
  88% {
    opacity: 0.86;
  }
  100% {
    transform: translate3d(7vw, 124vh, 0) rotateY(960deg) rotateZ(300deg);
    opacity: 0;
  }
}

@keyframes introCurtain {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
  54% {
    opacity: 1;
    filter: brightness(1.34);
  }
  100% {
    opacity: 0;
    transform: scale(1.055);
    filter: brightness(1.8) blur(7px);
  }
}

@media (max-width: 760px) {
  .intro-backdrop {
    inset: -2%;
    background-position: 51% center;
  }
  .intro-backdrop::after {
    background: linear-gradient(
      180deg,
      rgba(1, 26, 48, 0.48),
      transparent 36%,
      rgba(1, 19, 33, 0.48)
    );
  }
  .intro-captain {
    right: -33vw;
    bottom: -8%;
    width: 139vw;
    max-width: none;
    max-height: 88vh;
    object-position: right bottom;
  }
  .intro-story {
    top: max(6.5vh, 42px);
    left: 18px;
    width: calc(100% - 36px);
    transform: none;
    text-align: center;
  }
  .intro-eyebrow {
    justify-content: center;
    margin-bottom: 2px;
    font-size: 0.61rem;
  }
  .intro-logo {
    width: min(80vw, 330px);
    margin: 0 auto -2px;
  }
  .intro-story h1 {
    max-width: 14ch;
    margin-inline: auto;
    font-size: clamp(1.45rem, 7.6vw, 2.4rem);
  }
  .intro-copy {
    max-width: 330px;
    margin: 8px auto 0;
    font-size: 0.74rem;
    line-height: 1.35;
  }
  .intro-progress {
    width: min(82vw, 330px);
    margin: 12px auto 0;
  }
  .intro-progress-copy {
    width: min(82vw, 330px);
    margin-inline: auto;
    font-size: 0.57rem;
  }
  .intro-waves {
    right: -32%;
    bottom: -5%;
    width: 145%;
    height: 28%;
  }
  .intro-disclaimer {
    top: max(13px, env(safe-area-inset-top));
    bottom: auto;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.58rem;
  }
  .intro-skip {
    right: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    transform: translateX(50%);
    min-height: 42px;
    white-space: nowrap;
  }
}

@media (max-height: 620px) and (min-width: 761px) {
  .intro-captain {
    width: min(55vw, 690px);
    bottom: -24%;
  }
  .intro-story {
    width: 45vw;
  }
  .intro-logo {
    width: min(72%, 370px);
  }
  .intro-copy {
    margin-top: 7px;
  }
  .intro-progress {
    margin-top: 11px;
  }
}

@media (max-width: 480px) {
  .intro-story {
    top: 20vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-backdrop,
  .intro-sunburst,
  .intro-captain,
  .intro-story,
  .intro-progress-fill,
  .intro-waves span,
  .intro-coins i,
  .game-intro.is-leaving {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
  .intro-captain,
  .intro-story,
  .intro-sunburst {
    opacity: 1 !important;
  }
}
