:root {
  --bg: #fff2f7;
  --ink: #4b372f;
  --ink-soft: #6a534a;
  --line: #ecdde5;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.88;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M12 21s-7.2-4.5-9.4-8.3C.8 9.6 2.4 6 5.9 6c2.2 0 3.6 1.2 4.4 2.4C11.1 7.2 12.5 6 14.7 6c3.5 0 5.1 3.6 3.3 6.7C15.8 16.5 12 21 12 21z'/%3E%3C/svg%3E") 10 10, auto;
}

.read-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 120;
  height: 4px;
  background: rgba(255,255,255,.45);
  backdrop-filter: blur(2px);
}
.read-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #e4a6bf, #bc678a);
}

.hero {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.hero-image-wrap {
  position: relative;
  width: 100%;
}

.hero-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22%;
  background: linear-gradient(
    to bottom,
    rgba(255, 245, 248, 0) 0%,
    rgba(255, 245, 248, 0.72) 55%,
    rgba(255, 245, 248, 0.96) 100%
  );
  pointer-events: none;
}

.hero-title-box {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  width: min(92vw, 980px);
  margin-inline: auto;
  padding: clamp(0.8rem, 1.6vw, 1.2rem) clamp(1rem, 2vw, 1.6rem);
  transform: translateX(clamp(18px, 4vw, 64px));
  pointer-events: none;
}

.hero-kicker {
  margin: 0 0 0.8rem 0;
  font-size: clamp(0.85rem, 1.4vw, 1.2rem);
  letter-spacing: 0.18em;
  font-weight: 700;
  color: #fff;
  text-shadow:
    -1px -1px 0 #6a4a46,
    1px -1px 0 #6a4a46,
    -1px 1px 0 #6a4a46,
    1px 1px 0 #6a4a46,
    0 0 10px rgba(255, 255, 255, 0.85),
    0 0 18px rgba(255, 233, 199, 0.55);
}

.hero-title-box h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4.8vw, 4.2rem);
  line-height: 1.1;
  font-weight: 800;
  color: #fff;
  text-shadow:
    -1px -1px 0 #6a4a46,
    1px -1px 0 #6a4a46,
    -1px 1px 0 #6a4a46,
    1px 1px 0 #6a4a46,
    -2px 0 0 #6a4a46,
    2px 0 0 #6a4a46,
    0 -2px 0 #6a4a46,
    0 2px 0 #6a4a46,
    0 0 14px rgba(255, 255, 255, 0.9),
    0 0 24px rgba(255, 230, 195, 0.62);
  text-wrap: balance;
}

.story-section {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: 120vh;
  border-top: 1px solid var(--line);
}
.story-section.reverse {
  flex-direction: row-reverse;
}
.story-image {
  flex: 0 0 33.333%;
  width: 33.333%;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow: hidden;
}

.story-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translateY(0);
  will-change: transform;
}

.story-text {
  flex: 0 0 66.667%;
  width: 66.667%;
  padding: 3rem 2.6rem;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-text-inner {
  width: min(560px, 72%);
  margin: 0 auto;
  padding: 96px 0;
}
.story-text-inner h2 {
  margin: 0 0 1rem;
  line-height: 1.35;
  font-size: clamp(1.48rem, 2.7vw, 2.2rem);
  color: #4f3941;
}
.story-text-inner p {
  font-size: 1.1rem;
  line-height: 2;
  margin: 0 0 1.4em;
  color: var(--ink-soft);
}

#intro-story .story-text {
  background: #fff;
}

.game-section {
  --game-safe-y: clamp(18px, 3vh, 40px);
  --game-safe-x: clamp(12px, 2vw, 24px);
  position: relative;
  width: 100%;
  min-height: auto;
  padding: var(--game-safe-y) var(--game-safe-x);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  background: #fdf1f7;
  border-top: 1px solid var(--line);
}
.game-frame {
  width: min(1280px, 100%);
  height: max(820px, calc(100svh - (var(--game-safe-y) * 2)));
  border: none;
  display: block;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(183, 104, 140, .16);
  background: #fff;
}

.game-overlay {
  position: absolute;
  inset: var(--game-safe-y) var(--game-safe-x);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8vw;
  border-radius: 10px;
  background:
    linear-gradient(
      to right,
      rgba(255, 248, 251, 0.92) 0%,
      rgba(255, 248, 251, 0.88) 34%,
      rgba(255, 248, 251, 0.55) 58%,
      rgba(255, 248, 251, 0.18) 78%,
      rgba(255, 248, 251, 0.05) 100%
    );
  backdrop-filter: blur(4px);
  transition: opacity .5s ease, visibility .5s ease;
}
.game-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.game-overlay-inner {
  width: min(520px, 88%);
  color: #5e3f4d;
}
.game-kicker {
  margin: 0 0 12px;
  font-size: .92rem;
  letter-spacing: .08em;
  font-weight: 700;
  color: #b85c8d;
}
.game-overlay-inner h2 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1.15;
}
.game-overlay-inner p {
  margin: 0 0 24px;
  font-size: 1.08rem;
  line-height: 1.9;
  color: #6d525d;
}
.game-start-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  min-width: 210px;
  line-height: 1.2;
  background: linear-gradient(135deg, #d96d9f, #ec8fb8);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(217, 109, 159, 0.24);
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
  position: relative;
  z-index: 8;
}
.game-start-btn:hover,
.game-start-btn:focus,
.game-start-btn:active {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(217, 109, 159, 0.3);
  outline: none;
}
a:hover,
button:hover {
  filter: drop-shadow(0 0 8px rgba(234, 126, 179, 0.45));
}

.sparkle {
  position: fixed;
  width: 22px;
  height: 22px;
  pointer-events: none;
  color: #fff6ff;
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.98),
    0 0 12px rgba(255, 222, 244, 0.98),
    0 0 20px rgba(255, 170, 222, 0.9),
    0 0 30px rgba(255, 146, 205, 0.78);
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  animation: sparkleFade 1100ms ease-out forwards;
  z-index: 9999;
}
@keyframes sparkleFade {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.7); }
  55% { opacity: .95; transform: translate(-50%, -50%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.85); }
}

@media (max-width: 1024px) {
  .story-text-inner { width: min(520px, 78%); }
}

@media (max-width: 768px) {
  body { cursor: auto; }
  .hero {
    min-height: 0;
  }
  .hero-image-wrap {
    min-height: 0;
  }
  .hero-image {
    width: 100%;
    height: auto;
    display: block;
  }
  .hero-title-box {
    width: min(94vw, 640px);
    padding: 0.9rem 1rem;
    transform: translateX(clamp(8px, 2.4vw, 22px));
  }
  .hero-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
  }
  .hero-title-box h1 {
    font-size: clamp(1.9rem, 8vw, 3rem);
    line-height: 1.15;
  }
  .hero-overlay {
    height: 18%;
  }
  .story-section,
  .story-section.reverse {
    display: flex;
    flex-direction: column;
  }

  .story-image {
    order: 1;
    width: 100%;
    position: relative;
    top: auto;
    height: auto;
  }

  .story-text {
    order: 2;
    width: 100%;
    padding: 1.6rem 1.2rem 2rem;
  }

  .story-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
  }
  .story-text-inner {
    width: min(96%, 700px);
    padding: 0;
  }
  .story-text-inner p {
    font-size: 1rem;
    line-height: 1.9;
  }
  .game-section {
    min-height: auto;
    --game-safe-y: 14px;
    --game-safe-x: 12px;
  }
  .game-frame {
    height: max(760px, calc(100svh - (var(--game-safe-y) * 2)));
  }
  #game-section-1 .game-frame {
    touch-action: manipulation;
    pointer-events: auto;
  }
  .game-overlay {
    justify-content: center;
    align-items: center;
    padding: 24px;
    background:
      linear-gradient(
        to bottom,
        rgba(255, 248, 251, 0.9) 0%,
        rgba(255, 248, 251, 0.82) 45%,
        rgba(255, 248, 251, 0.35) 100%
      );
  }
  .game-overlay-inner {
    width: min(92%, 460px);
    text-align: left;
  }
  .game-overlay-inner h2 {
    font-size: clamp(1.8rem, 7vw, 2.4rem);
  }
  .game-overlay-inner p {
    font-size: 1rem;
    line-height: 1.8;
  }
}
