/* 砂城秘譚 20 周年慶：桌機主視覺 cover，右側互動層獨立定位，確保安全邊距。 */
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: #edc88b;
  font-family: "Noto Sans TC", Arial, sans-serif;
  color: #2f2417;
}
body::-webkit-scrollbar {
  display: none;
}

/* 週年慶活動預告：奶油金框與藍寶石呼應主視覺。 */
.anniversary-modal .modal-dialog {
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 36px);
}
.anniversary-modal .modal-content {
  position: relative;
  border: 3px solid #9c541d;
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 50% 0, #fffdf1 0, transparent 65%),
    linear-gradient(135deg, #fff1c2, #fffbeb 48%, #f9d88f);
  box-shadow: 0 0 0 3px #ffda70, 0 0 0 5px #764524,
    inset 0 0 0 3px #fff5c8, inset 0 0 0 5px #dca43f,
    0 24px 70px #2c180b80;
  color: #62401e;
}
.anniversary-modal .modal-body {
  padding: 40px 28px 30px;
  text-align: center;
}
.coming-soon-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #c08b38;
  border-radius: 50%;
  background: #fff5d8;
  color: #74431f;
  font: 28px/1 Arial, sans-serif;
  cursor: pointer;
}
.coming-soon-gem {
  width: 34px;
  height: 34px;
  margin: 0 auto 24px;
  transform: rotate(45deg);
  border: 2px solid #ffdc6c;
  background: conic-gradient(from 0deg, #c6f8ff, #159be6, #084a98, #58e2ff, #c6f8ff);
  box-shadow: 0 0 0 2px #ac701c, 0 0 22px #e8b93d80;
}
.coming-soon-eyebrow {
  margin: 0 0 10px;
  color: #946321;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2em;
}
.anniversary-modal h2 {
  margin: 0;
  color: #71401b;
  font-size: clamp(30px, 8vw, 40px);
  font-weight: 900;
  letter-spacing: .16em;
  text-indent: .16em;
  text-shadow: 0 2px #fff8dd;
}
.coming-soon-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px auto;
  color: #c28a2c;
}
.coming-soon-divider::before,
.coming-soon-divider::after {
  content: "";
  width: 72px;
  height: 1px;
  background: #d9b162;
}
#comingSoonDescription {
  margin: 0 0 24px;
  font-size: 16px;
  line-height: 1.9;
}
.coming-soon-confirm {
  min-width: 164px;
  min-height: 46px;
  padding: 10px 28px;
  border: 2px solid #aa681e;
  border-radius: 12px;
  background: linear-gradient(#fff6cd, #f6cc68);
  box-shadow: inset 0 0 0 2px #fff1bb, 0 3px 0 #965121;
  color: #633612;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.coming-soon-close:hover,
.coming-soon-confirm:hover {
  filter: brightness(1.06);
}
.coming-soon-close:focus-visible,
.coming-soon-confirm:focus-visible {
  outline: 3px solid #087abb;
  outline-offset: 4px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
#cover {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 550px;
  overflow: hidden;
  background: #eac78e url("../images/bg_top_bg.jpg") center center/cover
    no-repeat;
}
/* Logo follows the scene's background cover coordinates. */
.cover-scene {
  position: absolute;
  width: max(100vw, 220.2151svh);
  aspect-ratio: 2048/930;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.game-logo {
  position: absolute;
  left: 30%;
  top: 1.8%;
  width: 19.2%;
  z-index: 2;
  pointer-events: auto;
}
/* The buttons are anchored to VIEWPORT right, not the cropped background right. */
.cover-actions {
  position: absolute;
  z-index: 3;
  top: 5%;
  bottom: 5%;
  right: 7%;
  /* 桌機依視窗等比例縮放（不設 px 上限），大螢幕維持與 1440 寬相同比例 */
  width: 40%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: max(6px, 1vh);
}
.anniversary {
  width: 95%;
  height: auto;
  max-height: 38%;
  object-fit: contain;
  flex: 0 1 auto;
  filter: drop-shadow(0 0 10px rgba(255, 207, 56, 0.2));
}
.event-date {
  width: 70%;
  height: auto;
  max-height: 12%;
  object-fit: contain;
  flex: 0 1 auto;
}
.gift-links {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1%;
  flex: 0 1 auto;
}
.gift-one {
  width: 50.5%;
}
.gift-two {
  width: 48.5%;
}
.wave-links {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex: 0 1 auto;
}
.wave-links > a {
  width: 20%;
  min-width: 0;
}
.art-link {
  display: block;
  text-decoration: none;
  transform-origin: center;
  transition:
    transform 0.22s ease,
    filter 0.22s ease;
}
.art-link img {
  display: block;
  width: 100%;
  height: auto;
}
/* Gentle independent breathing on button artwork, avoiding layout movement. */
.gift-links .art-link img,
.wave-links .art-link img {
  animation: button-breathe 3s ease-in-out infinite;
  will-change: filter;
}
.gift-links .art-link:nth-child(2) img,
.wave-links .art-link:nth-child(even) img {
  animation-delay: -1.5s;
}
@keyframes button-breathe {
  0%,
  100% {
    filter: drop-shadow(0 0 3px rgba(255, 211, 67, 0.26)) brightness(1);
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(255, 222, 100, 0.82)) brightness(1.12);
    scale: 1.02;
  }
}

.art-link:hover {
  transform: translateY(-3px) scale(1.04);
}
.art-link:hover img {
  filter: drop-shadow(0 0 18px rgba(255, 237, 149, 0.95)) brightness(1.15);
  animation-play-state: paused;
}
.art-link:focus-visible {
  outline: 3px solid #0077dd;
  outline-offset: 3px;
  border-radius: 10px;
}

/* ================================
   Tablet｜768px ~ 1199px
================================ */
@media (min-width: 768px) and (max-width: 1199.98px) {
  #cover {
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;

    /* 平板沿用手機版背景 */
    background-image: url("../images/homepage_xs.webp");
    background-position: center top;
    background-size: 100% auto;
    background-repeat: no-repeat;
    background-color: #f6d69e;
  }

  .cover-scene {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    transform: none;
  }

  .game-logo {
    position: relative;
    left: auto;
    top: auto;
    width: min(40%, 340px);
    margin: 20px auto 0;
    display: block;
  }

  .cover-actions {
    position: relative;
    top: auto;
    bottom: auto;
    right: auto;

    width: 100%;
    min-height: 100vh;
    min-height: 100svh;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;

    gap: 12px;
    padding: 80vw 6% 40px;
  }

  .anniversary {
    width: min(75%, 540px);
    max-height: none;
  }

  .event-date {
    width: min(58%, 420px);
    max-height: none;
  }

  .gift-links {
    width: min(85%, 680px);
    justify-content: center;
    gap: 1.5%;
    margin-top: 8px;
  }

  .wave-links {
    width: min(88%, 700px);
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    margin-top: 8px;
  }

  .wave-links > a {
    width: 20%;
    min-width: 0;
  }
}

/* Mobile: use dedicated tall illustration and put interactive UI below the main characters. */
@media (max-width: 767.98px) {
  #cover {
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    background-image: url(../images/homepage_xs.webp);
    background-position: center top;
    background-size: 100% auto;
    background-repeat: no-repeat;
    background-color: #f6d69e;
  }
  .cover-scene {
    position: absolute;
    inset: 0 auto auto 0;
    left: 0;
    top: 0;
    transform: none;
    width: 100%;
    height: auto;
    aspect-ratio: auto;
  }
  .game-logo {
    position: relative;
    left: auto;
    top: auto;
    width: min(52%, 260px);
    margin: 48px auto 0;
    display: block;
  }
  .cover-actions {
    position: relative;
    top: auto;
    bottom: auto;
    right: auto;
    width: 100%;
    min-height: 80vh;
    min-height: 80svh;
    justify-content: flex-end;
    gap: 10px;
    padding: 80vh 10px 24px;
    padding: 80svh 10px 24px;
  }
  .anniversary {
    width: min(93%, 480px);
    max-height: none;
  }
  .event-date {
    width: min(80%, 390px);
    max-height: none;
  }
  .gift-links {
    width: min(100%, 510px);
    gap: 1.5%;
    margin-top: 5px;
  }
  .wave-links {
    width: min(100%, 540px);
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 5px;
  }
  .wave-links > a {
    width: 20%;
    min-width: 0;
  }
}
@media (max-width: 430px) {
  .cover-actions {
    padding-top: 48vh;
    padding-top: 48svh;
    padding-left: 5px;
    padding-right: 5px;
    gap: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .art-link,
  .gift-links .art-link img,
  .wave-links .art-link img {
    transition: none;
    animation: none;
  }
}

/* =============================
   右上角快捷連結
============================= */
.top-links {
  position: absolute;
  /* 以 1440 寬為基準等比例放大：280px / 15px / 30px，小於 1440 時維持原尺寸 */
  top: max(15px, 1.04vw);
  right: 3%;
  z-index: 20;

  width: max(280px, 19.44vw);
  aspect-ratio: 8 / 1;

  background: url("../images/btn.png") center / 100% 100% no-repeat;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;

  padding: 0 max(30px, 2.08vw);
  white-space: nowrap;
  color: #fff;
  font-size: max(15px, 1.04vw);
  font-weight: 700;
  text-shadow: 0 1px 3px #241d43;
}

.top-links a {
  color: #fff;
  text-decoration: none;
  transition:
    color 0.2s ease,
    text-shadow 0.2s ease;
}

.top-links a:hover {
  color: #ffe9a0;
  text-shadow: 0 0 8px rgba(255, 223, 120, 0.8);
}

/* reset.css 的 a { outline:none } 會吃掉鍵盤焦點框，僅在鍵盤操作時補回 */
.top-links a:focus-visible {
  outline: 2px solid #ffe9a0;
  outline-offset: 2px;
  border-radius: 4px;
}

/* 平板 */
@media (max-width: 1199.98px) {
  .top-links {
    width: 300px;
    top: 12px;
    right: 2%;
    font-size: 13px;
    padding: 0 26px;
  }
}

/* 手機 */
@media (max-width: 767.98px) {
  .top-links {
    width: min(78%, 310px);
    top: 8px;
    right: 50%;
    transform: translateX(50%);
    font-size: clamp(11px, 3vw, 14px);
    padding: 0 22px;
  }
}


/* ===========================================
   20週年主視覺：桌機版人物分層、進場與微動態
   坐標相對於 cover-scene，與背景 cover 裁切同步。
   手機及平板完全沿用 homepage_xs.webp。
=========================================== */
.cover-role {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}
.cover-role img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  transform-origin: 50% 75%;
}
/* 駱駝與少女：對照參考圖左側前景 */
.cover-role-left {
  left: 17.3%;
  top: 17.5%;
  width: 22.2%;
  animation: role-enter-left 1.15s cubic-bezier(.2,.8,.2,1) .15s both;
}
/* 海盜與小怪：對照參考圖城門右側 */
.cover-role-right {
  left: 40.6%;
  top: 16.5%;
  width: 15.6%;
  animation: role-enter-right 1.2s cubic-bezier(.18,.85,.24,1) .5s both;
}
.cover-role-left img {
  animation: role-float-left 5s ease-in-out 1.5s infinite;
}
.cover-role-right img {
  animation: role-float-right 4.2s ease-in-out 1.8s infinite;
}
@keyframes role-enter-left {
  from { opacity: 0; transform: translate3d(-70px, 34px, 0) scale(.94); }
  to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes role-enter-right {
  from { opacity: 0; transform: translate3d(55px, -48px, 0) scale(.9); }
  to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes role-float-left {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-7px) rotate(-.4deg); }
}
@keyframes role-float-right {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(1deg); }
}
/* 原站 1199.98px 以下會切換 homepage_xs，不疊加角色 */
@media (max-width: 1199.98px) {
  .cover-role { display: none !important; }
  /* 手機/平板 .cover-actions(z-index:3) 的上方 padding 會蓋住 Logo，提高 Logo 層級讓它可點 */
  .game-logo { z-index: 4; }
}
@media (prefers-reduced-motion: reduce) {
  .cover-role { opacity: 1; animation: none; will-change: auto; }
  .cover-role img { animation: none; }
}
