/* Custom Colors */
:root {
  --primary-color: #2F6BFF;
  --secondary-color: #6FA3FF;
  --button-gradient: linear-gradient(180deg, #4A8BFF 0%, #2F6BFF 100%);
  --card-bg: #FFFFFF;
  --page-bg: #F4F7FB; /* Assuming body background from shared.css is similar or light */
  --text-main: #1F2D3D;
  --text-black: #000000;
  --border-color: #D6E2FF;
  --glow-color: #A5C4FF;
  --header-offset: 120px; /* Default, will be overridden by shared.css if present */
}

/* Base styles for the page */
.page-game-bai {
  font-family: 'Arial', sans-serif;
  color: var(--text-main); /* Default text color for light background */
  background-color: var(--page-bg); /* Page background */
  line-height: 1.6;
  padding-bottom: 40px;
}

/* Hero Section */
.page-game-bai__hero-section {
  position: relative;
  overflow: hidden;
  padding-top: 10px; /* Small top padding, not --header-offset */
  margin-bottom: 40px;
}

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

.page-game-bai__hero-content {
  max-width: 1150px;
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
  position: relative; /* Ensure text is above image if z-index is used, but not overlapping */
  z-index: 1; /* Ensure content is layered correctly */
}

.page-game-bai__main-title {
  font-size: clamp(2.5rem, 4vw, 3.2rem); /* Responsive font size */
  color: var(--text-black);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 15px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.page-game-bai__description {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  color: var(--text-main);
  margin-bottom: 30px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.page-game-bai__hero-cta {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

/* General Section Styles */
.page-game-bai__section {
  padding: 40px 0;
  margin-bottom: 20px;
}

.page-game-bai__article-wrap {
  max-width: 1150px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-game-bai__section-title {
  font-size: clamp(2rem, 3vw, 2.5rem);
  color: var(--text-black);
  font-weight: 700;
  text-align: center;
  margin-bottom: 30px;
  line-height: 1.3;
}

/* Buttons */
.page-game-bai__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  max-width: 100%; /* Ensure responsiveness */
  box-sizing: border-box;
  white-space: normal; /* Allow text wrapping */
  word-wrap: break-word; /* Allow text wrapping */
  min-width: 180px; /* Minimum width for buttons */
}

.page-game-bai__btn-primary {
  background: var(--button-gradient);
  color: #ffffff;
  border: 2px solid transparent;
}

.page-game-bai__btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(var(--primary-color), 0.3);
}

.page-game-bai__btn-secondary {
  background: var(--card-bg);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.page-game-bai__btn-secondary:hover {
  background: var(--primary-color);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(var(--primary-color), 0.2);
}

.page-game-bai__btn-small {
  padding: 8px 20px;
  font-size: 0.95rem;
  min-width: unset;
}

/* Intro Text */
.page-game-bai__intro-text p {
  margin-bottom: 20px;
  font-size: 1.05rem;
  color: var(--text-main);
  text-align: justify;
}

/* Game Grid */
.page-game-bai__game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.page-game-bai__game-card {
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  text-align: center;
  padding-bottom: 25px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.page-game-bai__game-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.page-game-bai__game-image {
  width: 100%;
  height: 200px; /* Fixed height for consistency */
  object-fit: cover;
  margin-bottom: 20px;
  display: block; /* Ensure it behaves as a block element */
}

.page-game-bai__game-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-black);
  margin-bottom: 10px;
  padding: 0 15px;
}

.page-game-bai__game-title a {
  color: inherit;
  text-decoration: none;
}

.page-game-bai__game-title a:hover {
  color: var(--primary-color);
}

.page-game-bai__game-description {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 20px;
  padding: 0 15px;
  flex-grow: 1; /* Allow description to take available space */
}

/* Features Section */
.page-game-bai__feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.page-game-bai__feature-item {
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  padding: 30px;
  text-align: center;
  transition: transform 0.3s ease;
}

.page-game-bai__feature-item:hover {
  transform: translateY(-5px);
}

.page-game-bai__feature-icon {
  width: 100%;
  max-width: 250px; /* Constrain icon size */
  height: auto;
  margin-bottom: 20px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.page-game-bai__feature-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-black);
  margin-bottom: 15px;
}

.page-game-bai__feature-item p {
  font-size: 0.95rem;
  color: var(--text-main);
}

.page-game-bai__cta-text {
  text-align: center;
  font-size: 1.1rem;
  margin-top: 40px;
  font-weight: 500;
}

.page-game-bai__cta-text a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.page-game-bai__cta-text a:hover {
  text-decoration: underline;
}

/* How to Play Section */
.page-game-bai__step-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.page-game-bai__step-item {
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  padding: 25px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.page-game-bai__step-figure {
  margin: 0 0 20px 0;
}

.page-game-bai__step-image {
  width: 100%;
  height: 180px; /* Fixed height for consistency */
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
  display: block;
}

.page-game-bai__step-caption {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
}

.page-game-bai__step-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-black);
  margin-bottom: 15px;
}

.page-game-bai__step-item p {
  font-size: 0.95rem;
  color: var(--text-main);
  flex-grow: 1;
}

.page-game-bai__bottom-cta {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 40px;
  flex-wrap: wrap;
}

/* Promotion CTA Section */
.page-game-bai__promotion-cta {
  background-color: var(--primary-color);
  color: #ffffff;
  padding: 60px 0;
  text-align: center;
  margin-top: 40px;
}

.page-game-bai__promotion-cta .page-game-bai__section-title {
  color: #ffffff;
  margin-bottom: 20px;
}

.page-game-bai__promotion-description {
  font-size: 1.1rem;
  max-width: 800px;
  margin: 0 auto 30px auto;
  line-height: 1.7;
}

.page-game-bai__promo-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.page-game-bai__promo-buttons .page-game-bai__btn-primary {
  background: var(--card-bg);
  color: var(--primary-color);
  border: 2px solid var(--card-bg);
}

.page-game-bai__promo-buttons .page-game-bai__btn-primary:hover {
  background: #f0f0f0;
  box-shadow: 0 4px 10px rgba(255, 255, 255, 0.3);
}

.page-game-bai__promo-buttons .page-game-bai__btn-secondary {
  background: transparent;
  color: #ffffff;
  border: 2px solid #ffffff;
}

.page-game-bai__promo-buttons .page-game-bai__btn-secondary:hover {
  background: #ffffff;
  color: var(--primary-color);
}

/* FAQ Section */
.page-game-bai__faq-section {
  padding-bottom: 60px;
}

.page-game-bai__faq-list {
  margin-top: 40px;
}

.page-game-bai__faq-item {
  margin-bottom: 15px;
}

.page-game-bai__faq-item details {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--card-bg);
}

.page-game-bai__faq-item summary {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-black);
  padding: 20px 25px;
  cursor: pointer;
  list-style: none; /* Hide default marker */
  position: relative;
  transition: background-color 0.3s ease;
}

.page-game-bai__faq-item summary::-webkit-details-marker,
.page-game-bai__faq-item summary::marker {
  display: none; /* Hide marker for webkit and standard */
}

.page-game-bai__faq-item summary::after {
  content: '+';
  position: absolute;
  right: 25px;
  font-size: 1.5rem;
  line-height: 1;
  transition: transform 0.3s ease;
}

.page-game-bai__faq-item details[open] summary::after {
  content: '-';
  transform: rotate(0deg);
}

.page-game-bai__faq-item details[open] summary {
  background-color: #f8f8f8;
}

.page-game-bai__faq-item details p {
  font-size: 1rem;
  color: var(--text-main);
  padding: 0 25px 20px 25px;
  margin: 0;
}

/* Responsive Styles */
@media (max-width: 1024px) {
  .page-game-bai__main-title {
    font-size: clamp(2.2rem, 4.5vw, 3rem);
  }
  .page-game-bai__description {
    font-size: clamp(0.95rem, 1.7vw, 1.15rem);
  }
  .page-game-bai__section-title {
    font-size: clamp(1.8rem, 3.5vw, 2.2rem);
  }
  .page-game-bai__game-image,
  .page-game-bai__step-image {
    height: 180px; /* Adjust height for slightly smaller screens */
  }
}

@media (max-width: 768px) {
  /* 1. Top section padding/spacing */
  .page-game-bai__hero-section {
    padding-top: 10px !important; /* Small top padding */
    margin-bottom: 30px;
  }
  .page-game-bai__hero-content {
    padding: 30px 15px;
  }
  .page-game-bai__main-title {
    font-size: 2.2rem !important; /* Fixed for mobile */
    margin-bottom: 10px;
  }
  .page-game-bai__description {
    font-size: 1rem !important; /* Fixed for mobile */
    margin-bottom: 20px;
  }
  .page-game-bai__hero-cta {
    flex-direction: column !important; /* Stack buttons vertically */
    gap: 10px !important;
  }
  .page-game-bai__btn {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 15px !important;
    font-size: 1rem !important;
  }

  /* 2. Single-column long text containers */
  .page-game-bai__article-wrap {
    padding: 0 15px !important; /* Adjust padding for mobile */
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .page-game-bai__section {
    padding: 30px 0 !important;
  }
  .page-game-bai__section-title {
    font-size: 1.8rem !important; /* Fixed for mobile */
    margin-bottom: 25px !important;
  }
  .page-game-bai__intro-text p,
  .page-game-bai__feature-item p,
  .page-game-bai__step-item p,
  .page-game-bai__faq-item details p,
  .page-game-bai__promotion-description {
    font-size: 0.95rem !important; /* Ensure readability */
    line-height: 1.5 !important;
  }

  /* 3. General images and figure */
  .page-game-bai img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-game-bai__game-image {
    height: 150px !important; /* Further adjust image height for mobile */
  }
  .page-game-bai__step-image {
    height: 120px !important; /* Further adjust image height for mobile */
  }
  .page-game-bai__feature-icon {
    max-width: 180px !important; /* Adjust feature icon size */
  }
  .page-game-bai__game-grid,
  .page-game-bai__feature-grid,
  .page-game-bai__step-list {
    grid-template-columns: 1fr !important; /* Single column layout */
    gap: 20px !important;
  }
  .page-game-bai__game-card,
  .page-game-bai__feature-item,
  .page-game-bai__step-item {
    padding: 20px !important;
  }
  .page-game-bai__game-title {
    font-size: 1.2rem !important;
  }
  .page-game-bai__feature-title,
  .page-game-bai__step-title {
    font-size: 1.1rem !important;
  }
  .page-game-bai__step-caption {
    font-size: 1rem !important;
  }

  /* 4. Buttons and button containers */
  .page-game-bai__hero-cta,
  .page-game-bai__bottom-cta,
  .page-game-bai__promo-buttons {
    flex-direction: column !important; /* Stack buttons vertically */
    gap: 10px !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
  .page-game-bai__btn {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-wrap: break-word !important;
  }
  .page-game-bai__promo-buttons .page-game-bai__btn {
    min-width: unset !important; /* Allow full width */
  }

  /* 5. Registration tutorial and FAQ blocks */
  .page-game-bai__how-to-play .page-game-bai__article-wrap {
    padding: 0 15px !important;
  }
  .page-game-bai__faq-item summary {
    font-size: 1rem !important;
    padding: 15px 20px !important;
  }
  .page-game-bai__faq-item details p {
    padding: 0 20px 15px 20px !important;
  }
  .page-game-bai__faq-item summary::after {
    right: 20px !important;
    font-size: 1.2rem !important;
  }
  .page-game-bai__promotion-cta {
    padding: 40px 15px !important;
  }
}