/* R8 final overrides. Loaded after the inherited production stylesheet. */
body[data-stage="CHAPTER_MENU"] .chapter-set--main {
  --stage-art: url("../image/r8/主三牌暗場_OpenArt.png") !important;
  background-color: #120706 !important;
  background-image: var(--stage-art), radial-gradient(circle at 50% 50%, #2b140d 0, #140806 48%, #050202 100%) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: cover, cover !important;
}

.r8-film-transition,
.r8-transition-b,
.r8-transition-c {
  position: absolute !important;
  z-index: 92 !important;
  inset: 0 !important;
  overflow: hidden !important;
  background: radial-gradient(circle at 50% 50%, #2b140d 0, #140806 48%, #050202 100%) !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.r8-film-transition.is-active,
.r8-transition-b.is-active,
.r8-transition-c.is-active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto;
}

.r8-film-transition.is-finishing,
.r8-transition-b.is-entering-answer,
.r8-transition-c.is-finishing { opacity: 0 !important; }

.r8-transition-film {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: transparent;
}

.r8-film-grade {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, .35);
  background: linear-gradient(180deg, rgba(0, 0, 0, .04), transparent 56%, rgba(0, 0, 0, .18));
}

body[data-stage="CHAPTER_MENU"] #chapterMenu,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-active {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  overflow: hidden !important;
  transform: none !important;
}

body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign {
  position: absolute !important;
  top: 27% !important;
  width: 16.4% !important;
  height: 51% !important;
  min-height: 0 !important;
  padding: 0 1.25% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: .18 !important;
  filter: brightness(.32) saturate(.7) !important;
  transform: none !important;
  transition: opacity 420ms ease, filter 420ms ease, transform 420ms ease !important;
  animation: none !important;
}

body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign:nth-of-type(1) { left: 19.3% !important; }
body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign:nth-of-type(2) {
  left: 40.7% !important;
  top: 23.5% !important;
  width: 18.6% !important;
  height: 56% !important;
}
body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign:nth-of-type(3) { left: 64.5% !important; }

body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign::before {
  display: none !important;
}

body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign::after { content: none !important; }
body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign span,
body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign strong,
body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign em {
  opacity: 0 !important;
  transition: opacity 360ms ease !important;
}

body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-left .chapter-sign:nth-of-type(1),
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-center .chapter-sign:nth-of-type(2),
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-right .chapter-sign:nth-of-type(3) {
  opacity: 1 !important;
  filter: brightness(1) saturate(1) !important;
}

body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-left .chapter-sign:nth-of-type(1)::before,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-center .chapter-sign:nth-of-type(2)::before,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-right .chapter-sign:nth-of-type(3)::before,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-left .chapter-sign:nth-of-type(1) span,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-left .chapter-sign:nth-of-type(1) strong,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-left .chapter-sign:nth-of-type(1) em,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-center .chapter-sign:nth-of-type(2) span,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-center .chapter-sign:nth-of-type(2) strong,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-center .chapter-sign:nth-of-type(2) em,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-right .chapter-sign:nth-of-type(3) span,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-right .chapter-sign:nth-of-type(3) strong,
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-spot-right .chapter-sign:nth-of-type(3) em {
  opacity: 1 !important;
}

body[data-stage="CHAPTER_MENU"] #chapterMenu.is-choice-locked .chapter-sign { pointer-events: none; }
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-choice-locked[data-active-chapter="memory"] .chapter-sign:not([data-chapter="memory"]),
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-choice-locked[data-active-chapter="present"] .chapter-sign:not([data-chapter="present"]),
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-choice-locked[data-active-chapter="mahjong"] .chapter-sign:not([data-chapter="mahjong"]) {
  opacity: .16 !important;
  filter: brightness(.18) saturate(.55) !important;
}
body[data-stage="CHAPTER_MENU"] #chapterMenu.is-choice-locked .chapter-sign.is-selected {
  opacity: 1 !important;
  filter: brightness(1.12) saturate(1.04) !important;
  transform: translateY(-3px) !important;
}

.r8-transition-b .answer-reveal-plaque,
.r8-transition-b.is-active .answer-reveal-plaque {
  position: absolute !important;
  z-index: 5 !important;
  top: 50% !important;
  left: 50% !important;
  width: min(38vw, 620px) !important;
  height: min(66vh, 620px) !important;
  aspect-ratio: auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translate(-50%, -48%) !important;
  animation: none !important;
  transition: opacity 420ms ease, transform 520ms ease !important;
}

.r8-transition-b.is-answer-ready .answer-reveal-plaque {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  transform: translate(-50%, -50%) !important;
}

.r8-transition-b .answer-reveal-plaque::before,
.r8-transition-b .answer-plaque-chain { display: none !important; }

.r8-transition-b .answer-plaque-copy,
.r8-transition-b.is-active .answer-plaque-copy {
  position: absolute !important;
  inset: 21% 9% 18% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  color: #fff0d8 !important;
  opacity: 1 !important;
  text-align: center !important;
  text-shadow: 0 3px 12px rgba(0, 0, 0, .96) !important;
  transform: none !important;
  animation: none !important;
}

.r8-character-line {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: clamp(84px, 12vh, 132px);
  width: min(760px, calc(100vw - 44px));
  margin: 0;
  color: #fff4dc;
  font-family: Georgia, "Times New Roman", "Microsoft JhengHei", serif;
  font-size: clamp(28px, 3.1vw, 52px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 4px 18px #000, 0 0 36px rgba(0, 0, 0, .9);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 220ms ease, transform 260ms ease;
}
.r8-transition-c.show-princess-line .r8-princess-line,
.r8-transition-c.show-groom-line .r8-groom-line {
  opacity: 1;
  transform: translate(-50%, 0);
}

.afterstory-film-layer {
  position: absolute;
  z-index: 4;
  inset: 0;
  overflow: hidden;
  background: #0a0505;
  opacity: 1;
  transition: opacity 260ms ease;
}
.afterstory-film-layer video { width: 100%; height: 100%; object-fit: cover; }
.afterstory-film-grade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .06), transparent 56%, rgba(0, 0, 0, .34));
  box-shadow: inset 0 0 70px rgba(0, 0, 0, .28);
}

@media (max-width: 760px) {
  body[data-stage="CHAPTER_MENU"] .chapter-set--main { background-size: contain, cover !important; }
  .r8-transition-film,
  .afterstory-film-layer video { object-fit: contain; }
  body[data-stage="CHAPTER_MENU"] #chapterMenu {
    top: calc(50% - 28.125vw) !important;
    bottom: auto !important;
    height: 56.25vw !important;
  }
  body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign {
    top: 27% !important;
    width: 16.4% !important;
    height: 51% !important;
    padding: 0 1% !important;
  }
  body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign:nth-of-type(1) { left: 19.3% !important; }
  body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign:nth-of-type(2) {
    left: 40.7% !important;
    top: 23.5% !important;
    width: 18.6% !important;
    height: 56% !important;
  }
  body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign:nth-of-type(3) { left: 64.5% !important; }
  body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign span,
  body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign em { font-size: 8px !important; }
  body[data-stage="CHAPTER_MENU"] #chapterMenu .chapter-sign strong {
    margin: 3px 0 !important;
    font-size: clamp(10px, 3vw, 13px) !important;
    line-height: 1.22 !important;
  }
  .r8-transition-b .answer-reveal-plaque,
  .r8-transition-b.is-active .answer-reveal-plaque {
    width: min(54vw, 300px) !important;
    height: min(34vw, 210px) !important;
  }
  .r8-transition-b .answer-plaque-copy,
  .r8-transition-b.is-active .answer-plaque-copy { inset: 8% 4% !important; }
  .r8-transition-b .answer-plaque-copy small { font-size: 8px !important; }
  .r8-transition-b .answer-plaque-copy strong { margin: 2px 0 !important; font-size: clamp(17px, 5.2vw, 23px) !important; }
  .r8-transition-b .answer-plaque-copy em,
  .r8-transition-b .answer-plaque-copy b { font-size: 8px !important; }
  .r8-character-line { bottom: max(84px, 11svh); font-size: clamp(22px, 7vw, 31px); }
}
