* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: #fff3c8;
  background: #03172f;
  font-family: "HarmonyOS Sans SC", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button {
  font: inherit;
}

.viewport {
  position: relative;
  display: grid;
  width: 100vw;
  height: 100vh;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 40%, rgba(38, 126, 228, 0.34), transparent 45%),
    #04132b;
}

.viewport::before {
  position: absolute;
  inset: -2%;
  z-index: 0;
  content: "";
  background-image:
    linear-gradient(rgba(4, 17, 42, 0.28), rgba(4, 17, 42, 0.28)),
    url("../assets/world-map/悬浮素材-主背景图.png");
  background-position: center;
  background-size: cover;
  filter: blur(9px) brightness(0.72) saturate(1.08);
  transform: scale(1.04);
}

.stage {
  position: relative;
  z-index: 1;
  width: min(100vw, 177.6833156217vh);
  aspect-ratio: 1672 / 941;
  overflow: hidden;
  isolation: isolate;
  background: #08235a;
  box-shadow: 0 0 72px rgba(0, 0, 0, 0.74);
}

.map-bg,
.stage img {
  user-select: none;
  -webkit-user-drag: none;
}

.map-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage::before,
.stage::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  content: "";
  pointer-events: none;
}

.stage::before {
  background:
    linear-gradient(180deg, rgba(0, 6, 28, 0.08), rgba(0, 6, 28, 0.3)),
    radial-gradient(circle at 52% 55%, transparent 42%, rgba(2, 8, 28, 0.22) 100%);
}

.stage::after {
  opacity: 0.78;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 240, 174, 0.86) 0 0.09%, transparent 0.34%),
    radial-gradient(circle at 35% 18%, rgba(255, 255, 255, 0.7) 0 0.08%, transparent 0.28%),
    radial-gradient(circle at 75% 17%, rgba(255, 233, 166, 0.82) 0 0.09%, transparent 0.3%),
    radial-gradient(circle at 88% 58%, rgba(255, 255, 255, 0.62) 0 0.08%, transparent 0.3%);
  animation: sky-twinkle 3.8s ease-in-out infinite alternate;
}

.back-button,
.profile-panel,
.resource-bar,
.game-title,
.island,
.mentor,
.route,
.scroll-modal {
  position: absolute;
}

.back-button,
.profile-panel,
.resource-bar,
.game-title,
.island,
.mentor,
.route {
  z-index: 6;
  transition:
    opacity 260ms ease,
    transform 260ms ease,
    filter 260ms ease;
}

/* ── Back Button ──────────────────────────────────────────── */
.back-button {
  top: 2%;
  right: 2.2%;
  z-index: 10;
  width: 5.5%;
  aspect-ratio: 1;
  transform-origin: center;
  text-decoration: none;
  filter: drop-shadow(0 0.7vmin 0.42vmin rgba(0,0,0,0.58));
}

.back-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 0.7vmin 0.42vmin rgba(0,0,0,0.58))
    drop-shadow(0 0 0.65vmin rgba(255,215,104,0.36));
  transform-origin: center;
  animation: breathe-float 2.05s ease-in-out infinite;
}

.back-button:hover,
.back-button:focus-visible {
  filter: brightness(1.12);
}
.back-button:focus-visible {
  outline: 0.25vmin solid rgba(255,236,161,0.92);
  outline-offset: 0.4vmin;
}

.profile-panel {
  top: 1.1%;
  left: 0.8%;
  width: 22.5%;
  height: 14.4%;
  padding: 2.15% 1.7% 1% 9.15%;
  background: transparent;
}

.profile-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 0.55vmin 0.45vmin rgba(0, 0, 0, 0.58))
    drop-shadow(0 0 0.5vmin rgba(255, 202, 80, 0.45));
}

.profile-copy {
  position: relative;
  z-index: 2;
  width: 100%;
  text-shadow: 0 0.2vmin 0.25vmin rgba(0, 0, 0, 0.72);
}

.profile-name {
  color: #fff8e0;
  font-size: clamp(12px, 2.1vmin, 26px);
  font-weight: 700;
  line-height: 1.05;
}

.profile-level {
  margin-top: 0.8%;
  color: #ff940e;
  font-size: clamp(11px, 1.9vmin, 22px);
  font-weight: 900;
}

.profile-exp {
  position: relative;
  width: 70%;
  height: 2.1vmin;
  min-height: 10px;
  margin-top: 2.1%;
  overflow: hidden;
  border: 0.12vmin solid rgba(80, 36, 8, 0.75);
  border-radius: 0.45vmin;
  background: #201515;
  box-shadow: inset 0 0.22vmin 0.25vmin rgba(0, 0, 0, 0.66);
}

.profile-exp span {
  display: block;
  width: 63%;
  height: 100%;
  background: linear-gradient(90deg, #fb6b00, #ffd33e);
}

.profile-exp strong {
  position: absolute;
  inset: 0 5% 0 auto;
  display: grid;
  place-items: center;
  color: #fff7df;
  font-size: clamp(8px, 1.35vmin, 16px);
  font-weight: 800;
}

.resource-bar {
  top: 2.2%;
  right: 2%;
  display: flex;
  align-items: flex-start;
  gap: 1.1vmin;
  height: 8.4%;
}

.resource {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 7.8vmin;
  height: 3.6vmin;
  padding: 0 2.2vmin 0 0.9vmin;
  border: 0.12vmin solid rgba(231, 176, 73, 0.72);
  border-radius: 999px;
  color: #fff1cf;
  background: rgba(4, 13, 36, 0.88);
  box-shadow: inset 0 0 0.8vmin rgba(255, 197, 74, 0.12);
}

.resource span {
  margin-right: 0.7vmin;
  font-size: clamp(14px, 2vmin, 26px);
  line-height: 1;
}

.resource strong {
  font-size: clamp(10px, 1.45vmin, 18px);
  font-weight: 700;
}

.resource b {
  position: absolute;
  top: 50%;
  right: 0.45vmin;
  display: grid;
  width: 2vmin;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  color: #ffd45d;
  font-size: clamp(12px, 1.8vmin, 22px);
  transform: translateY(-50%);
}

.resource small {
  position: absolute;
  top: 100%;
  left: 50%;
  padding: 0.15vmin 0.95vmin 0.28vmin;
  border-radius: 0 0 0.7vmin 0.7vmin;
  color: #fff;
  font-size: clamp(7px, 1.05vmin, 12px);
  background: rgba(2, 8, 24, 0.76);
  transform: translateX(-50%);
}

.gem span {
  color: #21ddff;
}

.energy span {
  color: #ffb21d;
}

.game-title {
  top: 1.4%;
  left: 25.7%;
  z-index: 8;
  width: 25.5%;
  filter:
    drop-shadow(0 0.7vmin 0.42vmin rgba(0, 0, 0, 0.6))
    drop-shadow(0 0 0.75vmin rgba(39, 183, 255, 0.55));
}

.island {
  z-index: 7;
  display: block;
  color: inherit;
  text-decoration: none;
  transform-origin: center bottom;
  animation:
    island-arrive 700ms ease-out both,
    island-float 3.8s ease-in-out 760ms infinite;
}

.island-vocab {
  cursor: pointer;
}

.island-vocab:hover,
.island-vocab:focus-visible {
  filter: brightness(1.08) saturate(1.04);
}

.island-vocab:focus-visible {
  outline: 0.22vmin solid rgba(255, 232, 142, 0.9);
  outline-offset: 0.6vmin;
  border-radius: 1vmin;
}

.island-art,
.island-badge,
.island-label,
.unavailable-label {
  position: absolute;
  display: block;
  height: auto;
  pointer-events: none;
}

.island-art {
  left: 50%;
  top: 0;
  width: 100%;
  filter:
    drop-shadow(0 1.15vmin 0.65vmin rgba(0, 0, 0, 0.42))
    drop-shadow(0 0 1.1vmin rgba(33, 201, 255, 0.17));
  transform: translateX(-50%);
}

.island-badge {
  left: 50%;
  z-index: 3;
  width: 19.5%;
  filter: drop-shadow(0 0.45vmin 0.35vmin rgba(0, 0, 0, 0.56));
  transform: translateX(-50%);
  animation: badge-float 2.8s ease-in-out infinite;
}

.island-label {
  left: 50%;
  z-index: 4;
  filter:
    drop-shadow(0 0.55vmin 0.35vmin rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 0.6vmin rgba(255, 199, 70, 0.3));
  transform: translateX(-50%);
}

.unavailable-label {
  left: 50%;
  z-index: 5;
  width: 48%;
  filter:
    drop-shadow(0 0.5vmin 0.35vmin rgba(0, 0, 0, 0.46))
    drop-shadow(0 0 0.45vmin rgba(255, 198, 71, 0.22));
  transform: translateX(-50%);
}

.island-vocab {
  left: 18.9%;
  top: 28.6%;
  width: 24.2%;
  height: 43%;
  animation: island-arrive 700ms ease-out both;
  animation-delay: 0ms;
}

.island-vocab .island-art,
.island-vocab .island-label {
  animation: vocab-link-float 3.8s ease-in-out 760ms infinite;
}

.island-vocab .island-badge {
  top: -10.5%;
}

.island-vocab .island-label {
  top: 62.5%;
  width: 55%;
}

.island-origin {
  left: 43.6%;
  top: 31.6%;
  width: 20.4%;
  height: 46%;
  animation-delay: 70ms, 830ms;
}

.island-origin .island-badge {
  top: -3%;
}

.island-origin .island-label {
  top: 66%;
  width: 63%;
}

.island-origin .unavailable-label {
  top: 78.5%;
}

.island-grammar {
  right: 13.6%;
  top: 29.2%;
  width: 20.2%;
  height: 46.5%;
  animation-delay: 130ms, 890ms;
}

.island-grammar .island-badge {
  top: -4.2%;
}

.island-grammar .island-label {
  top: 66.5%;
  width: 61%;
}

.island-grammar .unavailable-label {
  top: 79%;
}

.route {
  z-index: 5;
  width: 13.8%;
  height: 1.1%;
  border-top: 0.45vmin dashed rgba(255, 216, 97, 0.9);
  filter: drop-shadow(0 0 0.55vmin rgba(255, 228, 91, 0.86));
  transform-origin: left center;
}

.route-left {
  left: 36.5%;
  top: 59.9%;
  width: 9.7%;
  transform: rotate(-5deg);
}

.route-right {
  left: 62.2%;
  top: 58.7%;
  width: 8.2%;
  transform: rotate(1deg);
}

.mentor {
  left: 1.2%;
  bottom: -0.2%;
  width: 28.5%;
  height: 34.2%;
}

.mentor-role {
  position: absolute;
  left: 4.5%;
  bottom: 0.8%;
  z-index: 2;
  width: 40%;
  filter:
    drop-shadow(0 0.95vmin 0.6vmin rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 0.8vmin rgba(116, 214, 255, 0.24));
  animation: mentor-float 3.2s ease-in-out infinite;
}

.speech-bubble {
  position: absolute;
  left: 37.5%;
  bottom: 12.2%;
  z-index: 1;
  width: 49.5%;
  filter: drop-shadow(0 0.45vmin 0.35vmin rgba(0, 0, 0, 0.38));
}

.speech-copy {
  position: absolute;
  left: 41.6%;
  bottom: 22.8%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42%;
  min-height: 31%;
  margin: 0;
  color: #321807;
  font-family: "KaiTi", "STKaiti", "FZKai-Z03", "Microsoft YaHei", serif;
  font-size: clamp(13px, 1.72vmin, 20px);
  font-weight: 900;
  line-height: 1.5;
  text-align: center;
  text-shadow: 0 0.08vmin 0 rgba(255, 246, 204, 0.72);
  pointer-events: none;
}

.scroll-modal {
  left: 50%;
  top: 50.3%;
  z-index: 30;
  width: 44.5%;
  height: 84.8%;
  color: #251206;
  transform: translate(-50%, -50%);
  filter:
    drop-shadow(0 1.4vmin 1vmin rgba(0, 0, 0, 0.64))
    drop-shadow(0 0 1.7vmin rgba(255, 189, 63, 0.22));
  transition:
    opacity 260ms ease,
    transform 320ms ease,
    visibility 260ms ease;
}

.scroll-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.scroll-copy {
  position: absolute;
  left: 18.6%;
  top: 14.9%;
  width: 62.8%;
  height: 66.9%;
  text-align: left;
  overflow: visible;
}

.scroll-copy h1 {
  position: relative;
  margin: 0 0 3.4%;
  color: #4c230b;
  font-family: "KaiTi", "STKaiti", "FZKai-Z03", "STSong", "SimSun", serif;
  font-size: clamp(23px, 3.4vmin, 44px);
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
  letter-spacing: 0;
  text-shadow:
    0 0.12vmin 0 #ffe4a1,
    0 0.24vmin 0 rgba(120, 67, 20, 0.24),
    0 0.42vmin 0.35vmin rgba(255, 232, 156, 0.34);
}

.scroll-copy h1::before,
.scroll-copy h1::after {
  position: absolute;
  top: 50%;
  width: 21%;
  height: 0.14vmin;
  min-height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(121, 64, 23, 0.68), transparent);
}

.scroll-copy h1::before {
  left: 0;
}

.scroll-copy h1::after {
  right: 0;
}

.scroll-copy p {
  margin: 0 0 1.24%;
  color: #35200f;
  font-family: "FangSong", "STFangsong", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  font-size: clamp(11px, 1.43vmin, 18px);
  font-weight: 600;
  line-height: 1.64;
  letter-spacing: 0;
  overflow-wrap: break-word;
  word-break: normal;
  text-align: left;
  text-indent: 2em;
  text-shadow: 0 0.07vmin 0 rgba(255, 242, 196, 0.68);
}

.scroll-copy .sign {
  margin-top: 2%;
  color: #2d1708;
  font-family: "KaiTi", "STKaiti", "FZKai-Z03", "STSong", "SimSun", serif;
  font-size: clamp(10px, 1.28vmin, 16px);
  font-weight: 700;
  line-height: 1.48;
  text-align: right;
  text-indent: 0;
}

.journey-button {
  position: absolute;
  left: 50%;
  bottom: -12.8%;
  width: 58%;
  min-height: 6.1vmin;
  border: 0.16vmin solid rgba(255, 222, 121, 0.98);
  border-radius: 0.55vmin;
  color: #ffeaa6;
  font-family: "Microsoft YaHei", "PingFang SC", "HarmonyOS Sans SC", sans-serif;
  font-size: clamp(16px, 2.65vmin, 34px);
  font-weight: 900;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), transparent 28%),
    linear-gradient(90deg, transparent, rgba(255, 232, 135, 0.14), transparent),
    linear-gradient(180deg, #1b6c9e, #073059 70%, #03162e);
  box-shadow:
    0 0.55vmin 0.65vmin rgba(0, 0, 0, 0.44),
    inset 0 0 0 0.12vmin rgba(19, 8, 2, 0.52),
    inset 0 0 1.2vmin rgba(34, 190, 255, 0.32),
    0 0 1.2vmin rgba(255, 214, 92, 0.34);
  text-shadow:
    0 0.16vmin 0 #7a3100,
    0 0.28vmin 0.12vmin rgba(0, 0, 0, 0.86),
    0 0 0.8vmin rgba(255, 207, 71, 0.6);
  cursor: pointer;
  transform: translateX(-50%);
  animation: journey-breathe 1.7s ease-in-out infinite;
}

body.scroll-open .resource-bar,
body.scroll-open .game-title {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-1.2%);
}

body.scroll-open .island {
  filter: brightness(0.98) saturate(1.02);
}

body.scroll-open .route {
  opacity: 1;
}

body.scroll-closed .scroll-modal {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -48%) scale(0.9);
}

body.scroll-closed:not(.is-closing) .scroll-modal {
  display: none;
}

body.is-entering .scroll-modal {
  animation: scroll-in 620ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

body.is-closing .scroll-modal {
  animation: scroll-out 330ms ease-in both;
}

@keyframes scroll-in {
  from {
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes scroll-out {
  to {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.86);
  }
}

@keyframes island-arrive {
  from {
    opacity: 0;
    transform: translateY(4%) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes island-float {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-1.8%) scale(1.018);
  }
}

@keyframes vocab-link-float {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  50% {
    transform: translateX(-50%) translateY(-1.8%) scale(1.018);
  }
}

@keyframes badge-float {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  50% {
    transform: translateX(-50%) translateY(-7%) scale(1.045);
  }
}

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

@keyframes journey-breathe {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.08);
  }
}

@keyframes sky-twinkle {
  from {
    opacity: 0.36;
  }
  to {
    opacity: 0.86;
  }
}

@keyframes breathe-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-1.45%) scale(1.025); }
}

@media (max-aspect-ratio: 1672 / 941) {
  .stage {
    width: auto;
    height: 100vh;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .stage {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
  }

  .map-bg {
    width: 178vh;
    max-width: none;
    transform: translateX(-33%);
  }

  .back-button {
    top: 2.2%;
    right: 3%;
    width: 14%;
  }

  .profile-panel {
    width: 52%;
    height: 10.8%;
    padding-top: 2.4%;
    padding-left: 20.5%;
  }

  .profile-avatar {
    width: 100%;
  }

  .resource-bar {
    top: 1.5%;
    right: 1.2%;
    gap: 0.55vmin;
    transform: scale(0.72);
    transform-origin: top right;
  }

  .game-title {
    top: 10.5%;
    left: 50%;
    width: 60%;
    transform: translateX(-50%);
  }

  .island-vocab {
    left: 5%;
    top: 29%;
    width: 46%;
  }

  .island-origin {
    left: 49%;
    top: 30.5%;
    width: 44%;
  }

  .island-grammar {
    right: 7%;
    top: 52%;
    width: 48%;
  }

  .unavailable-label {
    width: 52%;
  }

  .route {
    display: none;
  }

  .mentor {
    left: 1.5%;
    bottom: 8.5%;
    width: 47%;
  }

  .mentor-role {
    left: 1%;
    width: 43%;
  }

  .speech-bubble {
    left: 36%;
    width: 54%;
  }

  .speech-copy {
    left: 40.5%;
    bottom: 24.2%;
    width: 42%;
    min-height: 29%;
    font-size: clamp(10px, 2.9vmin, 15px);
  }

  .scroll-modal {
    width: 94%;
    height: 72%;
    top: 48%;
  }

  .scroll-copy {
    left: 18.4%;
    top: 16.4%;
    width: 63.4%;
    height: 64%;
  }

  .scroll-copy h1 {
    margin-bottom: 3%;
    font-size: clamp(24px, 7.2vmin, 34px);
  }

  .scroll-copy p {
    margin-bottom: 1.4%;
    font-size: clamp(9px, 2.55vmin, 12px);
    line-height: 1.42;
  }

  .journey-button {
    bottom: -14.5%;
    width: 64%;
    min-height: 10.5vmin;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .stage {
    width: 100vw;
    height: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

