  * {
    box-sizing: border-box;
  }

  body {
    margin: 0;
	padding: 0;
    font-family: Arial, sans-serif;
	display: flex;
    flex-direction: column;
    min-height: 100vh;
	overflow-x: hidden;
  }
  
  header h1 {
    text-align: center;
  }

  /* Slideshow container */
  .slideshow-container {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    box-sizing: border-box;
  }
  
  .slideshow-section {
    width: 100%;
    max-width: 1100px;
    padding: 0 16px;
    margin: 0 auto;
    box-sizing: border-box;
  }
     
  /* Slideshow box */
  .slideshow-container {
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
  }
  
  /* Hide the images by default */
  .mySlides {
    display: none;
  }
     
  /* Caption text */
  .text {
    color: #f2f2f2;
    font-size: 15px;
    padding: 8px 12px;
    position: absolute;
    bottom: 8px;
    width: 100%;
    text-align: center;
  }
     
  /* Number text (1/3 etc) */
  .numbertext {
    color: #f2f2f2;
    font-size: 12px;
    padding: 8px 12px;
    position: absolute;
    top: 0;
  }
     
  /* The dots/bullets/indicators */
  .dot {
    cursor: pointer;
    height: 15px;
    width: 15px;
    margin: 0 2px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.6s ease;
  }
     
  .active, .dot:hover {
    background-color: #717171;
  }
     
  /* Fading animation */
  .fade {
    animation-name: fade;
    animation-duration: 1.5s;
  }
     
  @keyframes fade {
    from {opacity: .4}
    to {opacity: 1}
  }

  .wrapper {	
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
  }

  .game-section {
    max-width: 1100px;           /* Match download-options */
    margin: 0 auto;              /* Center it */
    padding: 0 16px 10px 16px;   /* Same padding left/right as download-options */
    box-sizing: border-box;
  }

  .game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }

  .game-header h2 {
    margin: 0;
  }

  .game-section h2 {
    text-align: left; /* Or center if you want */
    margin-bottom: 10px;
  }
    
  .search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
  }

  .search-input-wrapper input
  {
    padding: 10px;
    border: 1px solid #DDD;
    border-radius: 8px;
  }
  
  .search-input-wrapper button {
    padding: 8px 16px;
    font-size: 16px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
  }
  
  .search-input-wrapper button:hover {
    background-color: #1e7e34;
  }
  
  .search-input-container {
    position: relative;
    width: 220px;
  }
  
  #game-search {
    padding: 8px 32px 8px 12px; /* space for the ✖ icon */
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    width: 220px;
  }

  #pagination {
    transition: opacity 0.3s ease;
  }

  .clear-button {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    font-size: 18px;
    color: #999;
    cursor: pointer;
    display: none;
    user-select: none;
    line-height: 1;
    background: none;
  }
  
  .clear-button:hover {
    color: #333;
  }

  .game-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
	cursor: pointer;
  }
  
  .game-row span {
    margin: 0;
    color: blue;
	white-space: nowrap;
  }
  
  .custom-tooltip {
    position: fixed;
    background-color: #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
    display: none;
  }

  .game-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: 4px;
  }
  
  .button-row {
    display: flex;
    gap: 10px; /* spacing between buttons */
    align-items: center;
  }

  .thumb {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
  }

  .info {
    flex-grow: 1;
    padding: 0 15px;
    min-width: 200px;
  }

  .info h3 {
    margin: 0 0 5px;
    font-size: 18px;
  }

  .info p {
    margin: 0;
    font-size: 14px;
    color: #444;
  }

  .download-btn {
    text-decoration: none;
    background-color: #28a745;
    color: white;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
    white-space: nowrap;
	border:1px;
  }

  .download-btn:hover {
    background-color: #1e7e34;
  }

  .demo-btn {
    text-decoration: none;
    background-color: #ff7f27;
    color: white;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
    white-space: nowrap;
	border:1px;
	cursor:pointer;
  }

  .demo-btn:hover {
    background-color: #ff6700;
  }
  
  .slideshow-container {
    position: relative;
  }
  
  .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5); /* dark overlay */
  display: none; /* hidden by default */
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 20px 30px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  font-size: 18px;
}
.modal-content button {
  margin-top: 15px;
  padding: 8px 16px;
  border: none;
  background-color: #007bff;
  color: white;
  border-radius: 6px;
  cursor: pointer;
}
.modal-content button:hover {
  background-color: #0056b3;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #D61889; /* NES pink */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

  /* Responsive layout */
  @media (max-width: 768px) {
    .game-item {
      flex-direction: column;
      align-items: flex-start;
    }

    .thumb {
      width: 100%;
      height: auto;
      margin-bottom: 10px;
    }

    .info {
      padding: 0;
    }

    .download-btn {
      margin-top: 10px;
    }
	
	.demo-btn {
      margin-top: 10px;
    }
  }

  @media (max-width: 480px) {
    .info h3 {
      font-size: 16px;
    }

    .info p {
      font-size: 13px;
    }

    .download-btn {
      font-size: 13px;
      padding: 6px 12px;
    }
	
	.demo-btn {
      font-size: 13px;
      padding: 6px 12px;
    }
  }
   
/******************************/
  .qr-modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.qr-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  text-align: center;
}
  
  .qr-wrapper {
    position: relative;
    display: inline-block;
    padding: 10px;
    background-color: white; /* Optional background */
  }
  
  .qr-img {
    width: 250px;
    height: 250px;
    display: block;
  }
  
  /* Common corner style */
  .qr-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 4px solid rgb(214, 26, 137);
  }
  
  /* Top Left */
  .qr-corner.tl {
    top: -5px;
    left: -5px;
    border-right: none;
    border-bottom: none;
  }
  
  /* Top Right */
  .qr-corner.tr {
    top: -5px;
    right: -5px;
    border-left: none;
    border-bottom: none;
  }
  
  /* Bottom Left */
  .qr-corner.bl {
    bottom: -5px;
    left: -5px;
    border-right: none;
    border-top: none;
  }
  
  /* Bottom Right */
  .qr-corner.br {
    bottom: -5px;
    right: -5px;
    border-left: none;
    border-top: none;
  }
/******************************/	 
.header {   
  /* max-width: 1065px; */
  width: 100%;  /* stretch to wrapper */
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-image: url('../images/header-background.jpg');
  background-size: cover;
  background-position: center;
  /*background-color: #D61889;*/
  color: white;
  padding: 10px 20px;
  margin: 0 auto 5px auto;
  height: 65px;
  border-radius:6px;
  position: relative;
}

.header h1 {
  text-align: center;
  flex: 1;
}

.user-section {
  position: absolute;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-section button {
  padding: 6px 12px;
  border: none;
  background-color: white;
  color: #D61889;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

.user-section button:hover {
  background-color: #f2f2f2;
}

#welcomeUser {
  font-weight: bold;
}

.admin-dropdown {
  position: relative;
  display: inline-block;
}

.admin-dropdown button {
  padding: 6px 12px;
  cursor: pointer;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: white;
  min-width: 200px;
  padding: 8px 0;
  border-radius: 5px; /* rounded corners */
  box-shadow: 0px 2px 8px rgba(0,0,0,0.2);
  z-index: 1000;
  margin-top: 10px; /* space for arrow */
}

.dropdown-content.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Add a triangle arrow pointing to login button */
.dropdown-content::before {
  content: "";
  position: absolute;
  top: -10px; /* move it above the box */
  right: 20px; /* adjust to align with login button */
  border-width: 0 8px 10px 8px;
  border-style: solid;
  border-color: transparent transparent white transparent;
}

.dropdown-content a {
  color: black;
  padding: 8px 12px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {
  background-color: #f1f1f1;
}

.admin-dropdown:hover .dropdown-content {
  display: block;
}

/****************************/	 
.captcha-container {
  margin-bottom: 16px;
}

#captchaCode {
  background-color: #eee;
  padding: 6px 12px;
  margin-left: 6px;
  border-radius: 8px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #D61A89;
  user-select: none;
}
/****************************/	

  @keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
  }

  .site-footer {
    background-color: #1a1a1a;
    color: #fff;
    padding: 20px 0;
    text-align: center;
    font-size: 14px;
    margin-top: 40px;
    border-top: 2px solid #444;
  }
     
  .site-footer a {
    color: #00d1ff;
    text-decoration: none;
  }
     
  .site-footer a:hover {
    text-decoration: underline;
  }
     
  .option-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;	/*gap (30px) + margin (10px left + 10px right) = 30px visual space*/
    max-width: 1100px;
    margin: 0 auto;
  }
  
  .option-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    border: 2px solid #ddd;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    height: 100%;
    text-align: left;
    position: relative;
  }
  
  .option-card .download-btn {
    margin-top: auto;
    margin-bottom: 10px;
    align-self: center;
  }

  /* Mỗi option chiếm 100% chiều rộng trên mobile */
  .option-card {
    flex: 1 1 100%;
    max-width: 100%;
    background-color: #fff3e0;
    border: 2px solid #ff9800;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
  }
  
  /**************************************************/
	
 .download-options {
   max-width: 1100px;
   margin: 0 auto;
   padding: 20px 16px;
   text-align: left;
   box-sizing: border-box;
 }

.download-options h2 {
  font-size: 24px;
  margin: 15px auto;
}

#downloadBtn {
    padding: 10px 20px;
	margin-bottom: 30px;
    background-color: #ccc;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: not-allowed;
}

#downloadBtn:enabled {
    background-color: #28a745;
    cursor: pointer;
}

#downloadBtn:enabled:hover {
    background-color: #1e7e34;
}

.slideshow-container {
  width: 100%;
  padding: 10px;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  margin-left: 0; /* align to left */
}

.slideshow-container iframe,
.slideshow-container img {
  border-radius: 0; /* prevent double rounding */
  width: 100%;
  height: auto;
  display: block;
}

.nes-carousel {
  position: relative;
  max-width: 1100px;
  margin-bottom: 6px; /* or 20px if you want more space */
}

/* Ensure the slide content is centered */
.nes-carousel .slide {
  display: none;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.nes-carousel .slide.active {
  display: flex; /* allow centering */
}

.nes-carousel iframe {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: none;
  display: block;
  margin: auto;
}

.nes-carousel .slide-content {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9; /* Maintain consistent height */
  overflow: hidden;
  background-color: #000;
  border-radius: 10px;
}

.nes-carousel .slide-content img,
.nes-carousel .slide-content iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Scales and crops to fill */
  border: none;
}

.slide {
  display: none;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: black;
}

.slide.active {
  display: block;
}

.slide iframe,
.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.video-gallery {
  overflow-x: auto;
  padding: 4px 0;
  margin: 0;
  display: flex;
  gap: 8px;
  scroll-behavior: smooth;
}

.video-gallery .thumbnail img {
  width: 100%;
  height: auto;
  max-width: 120px;
  border-radius: 8px;
  object-fit: cover;
}

.banner-slide {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 10px;
}

.video-slide iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
}

.video-slide {
  flex: 1 1 300px; /* grow/shrink but minimum width ~300px */
  max-width: 100%;
}

.video-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  justify-content: center;
  align-items: center;
  background: black;
  overflow: hidden;
}

.thumbnail-nav-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 8px 0 0;
}

.video-gallery {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: visible; /* prevent highlight cut-off */
  gap: 8px;
  padding: 4px 0; /* add vertical spacing */
  margin: 0;
  height: auto;
  background: transparent;
  scrollbar-width: none; /* Firefox */
}

.video-gallery::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.thumbnail {
  flex: 0 0 auto;
  width: 110px;
  height: 70px; /* slightly more height */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px; /* allow room for border or outline */
  box-sizing: border-box;
  border-radius: 8px;
  position: relative;
  overflow: visible;
  background-color: transparent;
}


/* Thumbnail style */
.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumbnail img:hover {
  transform: scale(1.05);
}

.thumbnail.selected {
  box-shadow: 0 0 0 3px #00aaff;
  border-radius: 8px;
}

.active-thumbnail {
  outline: 2px solid #2196f3;
  border-radius: 6px;
}

/* Arrow buttons for thumbnail scroll */
/* Slideshow arrow buttons */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  color: #888;
  font-size: 28px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, color 0.3s;
  pointer-events: auto;
}

.nav-arrow:hover {
  background: rgba(0,0,0,0.8);
  color: #fff;
}

.nav-arrow.left {
  left: -10px; /* You can adjust this value as needed */
}

.nav-arrow.right {
  right: -10px; /* You can adjust this value as needed */
}


/* Next & previous buttons */
.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  padding: 16px;
  margin-top: -22px;
  color: white;
  font-weight: bold;
  font-size: 18px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
}

/* Position the "next button" to the right */
.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

/* On hover, add a black background color with a little bit see-through */
.prev:hover, .next:hover {
  background-color: rgba(0,0,0,0.8);
}

.pagination {
  display: flex;
  justify-content: center; /* centers all items horizontally */
  align-items: center;      /* centers items vertically */
  gap: 10px;                /* space between buttons and page number */
  margin-top: 20px;         /* optional spacing above pagination */
}

.pagination button {
  margin: 0 5px;
  padding: 5px 10px;
  font-size: 14px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background-color: white;
  cursor: pointer;
}

.pagination button.active {
  background-color: #007bff;
  color: white;
  font-weight: bold;
}

.game-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  height: 360px;
  background-color: rgba(0, 0, 0, 0.95);
  padding: 20px;
  border-radius: 10px;
  z-index: 10000;
  text-align: center;
  color: white;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
  z-index: 10000;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.game-modal-content {
  position: relative;
  height: 100%;
}

.gallery-container {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  padding: 20px 40px;
  height: 100%;
  scroll-behavior: smooth;
  /* HIDE SCROLLBAR cross-browser */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE/Edge */
  -webkit-overflow-scrolling: touch; /* Enables momentum scroll on iOS */
}

.gallery-container::-webkit-scrollbar {
  display: none;  /* Chrome, Safari, Opera */
}

.gallery-container img {
  width: 200px;
  height: 300px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid white;
  flex-shrink: 0;
}

.game-modal-close {
  position: absolute;
  top: -15px;
  right: 20px;
  font-size: 34px;
  color: white;
  cursor: pointer;
}

#main-content.blur {
  filter: blur(5px);
  pointer-events: none; /* prevent interaction with blurred content */
  user-select: none;
  position: relative;
  z-index: 1;
}

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 32px;
  background: rgba(255,255,255,0.8);
  border: none;
  cursor: pointer;
  padding: 5px 10px;
  z-index: 10;
  display: none; /* Hide by default */
}

.arrow.left {
  left: 0;
}

.arrow.right {
  right: 0;
}
	
@media (min-width: 1024px) {
  .slideshow-container {
    max-width: 1200px;
  }
  .slide {
    height: 350px;
    aspect-ratio: auto; /* override aspect ratio if applied earlier */
  }

  .slide iframe,
  .slide img {
    height: 100%;
    object-fit: cover;
  }
}
  
@media (min-width: 768px) {
  .slideshow-container {
      max-width: 1100px;
      margin: 0 auto;
  }
  .option-card {
    flex: 1 1 calc(33.333% - 20px);
    max-width: calc(33.333% - 20px);
  }
  .thumbnail img {
    height: 60px;
  }
}

@media (max-width: 768px) {
  .header h1 {
	text-align: left;
	font-size:22px;
  }
  .game-search-box {
    justify-content: center;
  }
  .site-footer {
	font-size: 12px;
	padding: 15px 10px;
  }
}

@media (max-width: 480px) {
  .thumbnail img {
    height: 50px;
  }
}
