/**
 * 强制盖茨比角色页面双列显示和深色背景
 * 所有规则仅对gatsby和theater页面生效，不影响其他页面
 */

/* 只对gatsby和theater页面应用以下所有样式 */
body:has([class*="gatsbyBookPage"]) [class*="pageHeader"],
body:has([class*="theaterPage"]) [class*="pageHeader"] {
  text-align: center;
  padding: 0 0 60px 0;
  max-width: 1000px;
  margin: 0 auto;
}

body:has([class*="gatsbyBookPage"]) [class*="pageTitle"],
body:has([class*="theaterPage"]) [class*="pageTitle"] {
  font-size: 64px !important;
  font-weight: 400 !important;
  color: #f4d03f !important;
  letter-spacing: 12px !important;
  margin-bottom: 24px !important;
  font-family: 'Playfair Display', 'Georgia', serif !important;
  text-shadow: 0 4px 20px rgba(244, 208, 63, 0.8), 0 0 40px rgba(244, 208, 63, 0.4) !important;
  line-height: 1.2 !important;
}

body:has([class*="gatsbyBookPage"]) [class*="pageSubtitle"],
body:has([class*="theaterPage"]) [class*="pageSubtitle"] {
  font-size: 20px !important;
  line-height: 1.8 !important;
  color: #ffffff !important;
  font-weight: 400 !important;
  opacity: 1 !important;
  font-style: italic !important;
  margin-bottom: 0 !important;
  letter-spacing: 3px !important;
  max-width: 900px !important;
  margin: 0 auto !important;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8) !important;
}

body:has([class*="gatsbyBookPage"]) [class*="pageDivider"],
body:has([class*="theaterPage"]) [class*="pageDivider"] {
  margin: 48px 0;
  text-align: center;
}

body:has([class*="gatsbyBookPage"]) [class*="dividerDiamond"],
body:has([class*="theaterPage"]) [class*="dividerDiamond"] {
  font-size: 20px;
  color: #d4af37;
  opacity: 0.5;
}

body:has([class*="gatsbyBookPage"]) [class*="cardsContainer"],
body:has([class*="gatsbyBookPage"]) [class*="card-container"],
body:has([class*="gatsbyBookPage"]) div[class*="gatsby"] > div > div:not([class*="Modal"]):not([class*="modal"]):not([class*="qrCode"]),
body:has([class*="theaterPage"]) [class*="cardsContainer"],
body:has([class*="theaterPage"]) [class*="card-container"] {
  grid-template-columns: repeat(2, 1fr) !important;
  display: grid !important;
  max-width: 1200px !important;
  margin: 0 auto !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 40px !important;
  padding: 0 !important;
}

body:has([class*="gatsbyBookPage"]) [class*="gatsbyBookPage"],
body:has([class*="gatsbyBookPage"]) [class*="gatsby"][class*="Page"],
body:has([class*="theaterPage"]) [class*="theaterPage"] {
  background: linear-gradient(135deg, #0a0908 0%, #1a1816 50%, #0a0908 100%) !important;
  min-height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* 只对gatsby和theater页面的body应用深色背景 */
body:has([class*="gatsbyBookPage"]),
body:has([class*="theaterPage"]) {
  background: linear-gradient(135deg, #0a0908 0%, #1a1816 50%, #0a0908 100%) !important;
}

/* 确保根容器也是深色背景 - 仅限gatsby和theater页面 */
body:has([class*="gatsbyBookPage"]) #root,
body:has([class*="theaterPage"]) #root {
  background: linear-gradient(135deg, #0a0908 0%, #1a1816 50%, #0a0908 100%) !important;
  min-height: 100vh !important;
}

body:has([class*="gatsbyBookPage"]) [class*="pageContent"],
body:has([class*="theaterPage"]) [class*="pageContent"] {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 100px;
}

/* gatsby-theater 页面修复 */
body:has([class*="theaterPage"]) [class*="welcomeContainer"] {
  display: grid !important;
  grid-template-columns: 1fr 2fr 1fr !important;
  align-items: center !important;
  gap: 40px !important;
  max-width: 1400px !important;
  margin: 0 auto !important;
  padding: 60px 80px !important;
}

body:has([class*="theaterPage"]) [class*="welcomeCharacterLeft"] {
  justify-self: end !important;
}

body:has([class*="theaterPage"]) [class*="welcomeCharacterRight"] {
  justify-self: start !important;
}

body:has([class*="theaterPage"]) [class*="welcomeCenter"] {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}

body:has([class*="theaterPage"]) [class*="continueButton"],
body:has([class*="theaterPage"]) [class*="choiceButton"] {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

/* 移动端适配 */
@media (max-width: 480px) {
  body:has([class*="gatsbyBookPage"]) [class*="cardsContainer"],
  body:has([class*="gatsbyBookPage"]) [class*="card-container"],
  body:has([class*="gatsbyBookPage"]) div[class*="gatsby"] > div > div,
  body:has([class*="theaterPage"]) [class*="cardsContainer"],
  body:has([class*="theaterPage"]) [class*="card-container"] {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
  }

  body:has([class*="gatsbyBookPage"]) [class*="pageHeader"],
  body:has([class*="theaterPage"]) [class*="pageHeader"] {
    padding: 0 0 30px 0;
  }

  body:has([class*="gatsbyBookPage"]) [class*="pageTitle"],
  body:has([class*="theaterPage"]) [class*="pageTitle"] {
    font-size: 32px;
    letter-spacing: 4px;
  }

  body:has([class*="gatsbyBookPage"]) [class*="pageSubtitle"],
  body:has([class*="theaterPage"]) [class*="pageSubtitle"] {
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: 1px;
  }

  body:has([class*="gatsbyBookPage"]) [class*="pageContent"],
  body:has([class*="theaterPage"]) [class*="pageContent"] {
    padding: 0 20px !important;
  }

  body:has([class*="gatsbyBookPage"]) [class*="gatsbyBookPage"],
  body:has([class*="gatsbyBookPage"]) [class*="gatsby"][class*="Page"],
  body:has([class*="theaterPage"]) [class*="theaterPage"] {
    display: block !important;
    padding: 40px 0;
  }

  body:has([class*="theaterPage"]) [class*="welcomeContainer"] {
    grid-template-columns: 1fr !important;
    padding: 20px !important;
    gap: 20px !important;
  }

  body:has([class*="theaterPage"]) [class*="welcomeCharacterLeft"],
  body:has([class*="theaterPage"]) [class*="welcomeCharacterRight"] {
    justify-self: center !important;
  }
}

/* 盖茨比剧场样式覆盖 */
body:has([class*="theaterPage"]) [class*="backButton"] {
  color: #ffffff !important;
  width: 32px !important;
  height: 32px !important;
  background: rgba(255, 255, 255, 0.15) !important;
  border-radius: 50% !important;
}

body:has([class*="theaterPage"]) [class*="backButton"]:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  color: black !important;
}

body:has([class*="theaterPage"]) [class*="continueButton"] {
  background: linear-gradient(135deg, rgb(211, 47, 47) 0%, rgb(255, 111, 0) 100%) !important;
  border-radius: 24px !important;
  padding: 12px 40px !important;
}

body:has([class*="theaterPage"]) [class*="theaterPage"] {
  background: #000 !important;
  font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

body:has([class*="theaterPage"]) [class*="oldTheaterBg"] {
  background: linear-gradient(180deg, #0d1b3a 0%, #1a2c5e 50%, #0a1428 100%) !important;
  opacity: 0.95 !important;
}

body:has([class*="theaterPage"]) [class*="welcomeContainer"] {
  padding: 60px 60px 40px !important;
}

body:has([class*="theaterPage"]) [class*="welcomeContainer"] [class*="continueButton"],
body:has([class*="theaterPage"]) button[class*="continueButton"] {
  background: linear-gradient(135deg, #d32f2f 0%, #ff6f00 100%) !important;
  border: none !important;
  border-radius: 24px !important;
  padding: 12px 40px !important;
  color: #ffffff !important;
  font-size: 1.1rem !important;
  font-weight: 500 !important;
  letter-spacing: 1px !important;
  box-shadow: 0 4px 16px rgba(211, 47, 47, 0.4) !important;
  transition: all 0.3s ease !important;
  cursor: pointer !important;
}

body:has([class*="theaterPage"]) [class*="welcomeContainer"] [class*="continueButton"]:hover,
body:has([class*="theaterPage"]) button[class*="continueButton"]:hover {
  background: linear-gradient(135deg, #b71c1c 0%, #e65100 100%) !important;
  box-shadow: 0 6px 20px rgba(183, 28, 28, 0.6) !important;
  transform: translateY(-2px) !important;
}

body:has([class*="theaterPage"]) [class*="dialogBox"] {
  padding: 24px 32px !important;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(212, 175, 55, 0.15) 100%) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  border: 1px solid rgba(212, 175, 55, 0.6) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 32px rgba(212, 175, 55, 0.4), 0 4px 16px rgba(0, 0, 0, 0.5) !important;
  text-align: center !important;
}

body:has([class*="theaterPage"]) [class*="dialogText"] {
  font-size: 1.05rem !important;
  line-height: 1.6 !important;
  color: #f0e6d2 !important;
  letter-spacing: 0.8px !important;
  text-align: center !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 1), 0 0 10px rgba(255, 255, 255, 0.3) !important;
  padding: 24px 0 !important;
  position: relative !important;
}

body:has([class*="theaterPage"]) [class*="dialogText"]::before {
  content: '" ' !important;
  position: absolute !important;
  left: -10px !important;
  top: 24px !important;
  font-size: 1.5rem !important;
  color: #a8b5d0 !important;
  opacity: 0.8 !important;
}

body:has([class*="theaterPage"]) [class*="dialogText"]::after {
  content: ' "' !important;
  position: absolute !important;
  right: -10px !important;
  bottom: 24px !important;
  font-size: 1.5rem !important;
  color: #a8b5d0 !important;
  opacity: 0.8 !important;
}

/* 保护二维码弹窗样式 */
[class*="qrCodeModal"],
[class*="qrCodeModal"] * {
  grid-template-columns: none !important;
  grid-template-rows: none !important;
}

[class*="qrCodeModal"] {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  background: rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important;
}

[class*="qrCodeModalContent"] {
  position: relative !important;
  display: block !important;
  background: linear-gradient(135deg, #1a1a1a 0%, #2b2620 50%, #1a1a1a 100%) !important;
  border: 2px solid #d4af37 !important;
  border-radius: 8px !important;
  padding: 48px 60px 40px !important;
  max-width: 550px !important;
  width: 90% !important;
  height: auto !important;
  max-height: none !important;
  min-height: auto !important;
  overflow: visible !important;
  text-align: center !important;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.3), 0 0 60px rgba(212, 175, 55, 0.4), 0 20px 80px rgba(0, 0, 0, 0.8) !important;
}

[class*="qrCodeWrapper"] {
  display: block !important;
  width: 180px !important;
  height: 180px !important;
  margin: 0 auto 24px !important;
  padding: 4px !important;
  background: #ffffff !important;
  border: 2px solid #d4af37 !important;
  border-radius: 4px !important;
  box-sizing: content-box !important;
}

[class*="qrCodeImage"] {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

[class*="qrCodeModalContent"] h2,
[class*="modalTitle"] {
  display: block !important;
  font-size: 26px !important;
  font-weight: 600 !important;
  color: #d4af37 !important;
  margin: 0 0 18px 0 !important;
  text-align: center !important;
}

[class*="qrCodeModalContent"] p,
[class*="modalDesc"],
[class*="modalSubDesc"] {
  display: block !important;
  font-size: 16px !important;
  color: rgba(245, 245, 245, 0.85) !important;
  margin: 0 0 32px 0 !important;
  text-align: center !important;
}

[class*="modalSubDesc"] {
  font-size: 14px !important;
  color: rgba(212, 175, 55, 0.9) !important;
  margin: 0 !important;
}

[class*="qrCodeModalContent"] [class*="closeButton"],
[class*="qrCodeModalContent"] > button:first-child {
  position: absolute !important;
  top: 18px !important;
  right: 18px !important;
  width: 36px !important;
  height: 36px !important;
  background: rgba(212, 175, 55, 0.15) !important;
  border: 1px solid rgba(212, 175, 55, 0.5) !important;
  border-radius: 4px !important;
  color: #d4af37 !important;
  font-size: 18px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
