body { font-family: system-ui, sans-serif; margin: 0; background: #111; color: #fff; line-height: 1.5; }

/* Sidebar Styles */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  background: #1a1a1a;
  border-right: 1px solid #333;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-x: hidden; /* Hide horizontal overflow during transition */
  transition: width 0.3s ease, transform 0.3s ease;
  
  /* Desktop Default: Minimized */
  width: 60px; 
  transform: translateX(0); /* Always visible on desktop */
}

/* Sidebar Hover State (Desktop) */
@media (min-width: 769px) {
  .sidebar:hover {
    width: 260px;
  }
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Space between title and close btn */
  padding: 1rem;
  height: 60px; /* Fixed height to match collapsed width for alignment if needed */
  border-bottom: 1px solid #333;
  background: #222;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.sidebar-header h3 {
  margin: 0;
  color: #f0f;
  font-size: 1.2rem;
  white-space: nowrap;
  opacity: 0; /* Hidden in collapsed state */
  transition: opacity 0.2s ease;
}

/* Show header text on hover */
@media (min-width: 769px) {
  .sidebar:hover .sidebar-header h3 {
    opacity: 1;
    transition-delay: 0.1s; /* Slight delay to prevent flickering */
  }
}

.sidebar-close {
  /* Only for mobile usually, but if present on desktop, hide it in collapsed state */
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0;
  display: none; /* Hidden by default on desktop, used in mobile logic */
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0.25rem; /* Reduced padding for collapsed state */
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  color: #ddd;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s;
  font-size: 0.95rem;
  white-space: nowrap;
  height: 40px; /* Fixed height for consistency */
}

.sidebar-link:hover {
  background: #222;
  color: #fff;
}

.category-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 24px; /* Fixed width for icon alignment */
  text-align: center;
}

.category-name {
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Show category text on hover */
@media (min-width: 769px) {
  .sidebar:hover .category-name {
    opacity: 1;
    transition-delay: 0.1s;
  }
}

.sidebar-divider {
  height: 1px;
  background: #333;
  margin: 0.5rem 0;
}

/* Main Wrapper */
.main-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin-left: 60px; /* Space for collapsed sidebar */
  transition: margin-left 0.3s ease;
}

/* Sidebar Overlay (Mobile Only) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 999;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Header Layout */
header {
  background: #222;
  border-bottom: 1px solid #333;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

/* Hide sidebar toggle on desktop since it's always visible/hoverable */
@media (min-width: 769px) {
  .sidebar-toggle {
    display: none;
  }
}

.logo { 
  color: #f0f; 
  font-weight: bold; 
  text-decoration: none; 
  font-size: 1.5rem; 
  flex-shrink: 0;
}

.search-container {
  flex: 1;
  max-width: 600px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #1a1a1a;
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid #333;
  position: relative;
}

#searchInput {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  min-width: 0;
}
#searchInput:focus { outline: none; }

/* Search Dropdown Styles */
.search-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 1000;
}

.search-dropdown.active {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  text-decoration: none;
  color: #fff;
  border-bottom: 1px solid #333;
  transition: background 0.2s;
}

.search-result-item:hover {
  background: #2a2a2a;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item img {
  width: 60px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.search-result-item span {
  flex: 1;
  font-size: 0.95rem;
}

.search-mobile-badge {
  font-size: 1rem;
  flex-shrink: 0;
}

.search-no-results {
  padding: 1rem;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
}

.search-more-results {
  padding: 0.75rem;
  text-align: center;
  color: #f0f;
  font-size: 0.85rem;
  font-weight: 500;
  border-top: 1px solid #333;
}

.mobile-filter-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem;
  border-left: 1px solid #333;
}

.mobile-filter-label input { display: none; }
.mobile-filter-label .icon-mobile { color: #555; display: flex; transition: color 0.2s; }
.mobile-filter-label input:checked + .icon-mobile { color: #f0f; }

.total-games-badge {
  color: #888;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  background: #2a2a2a;
  border-radius: 4px;
  white-space: nowrap;
  margin-right: 0.25rem;
  border: 1px solid #333;
}

/* Language Selector Styles */
.language-selector {
  position: relative;
  flex-shrink: 0;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: #ddd;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  font-weight: 500;
}

.lang-toggle:hover {
  background: #2a2a2a;
  border-color: #444;
  color: #fff;
}

.lang-current {
  font-weight: 600;
  color: #f0f;
}

.lang-arrow {
  transition: transform 0.2s;
  opacity: 0.6;
}

.language-selector:hover .lang-arrow,
.lang-dropdown.active + .lang-toggle .lang-arrow {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  min-width: 160px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 1000;
  overflow: hidden;
}

.lang-dropdown.active {
  display: block;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: #ddd;
  transition: background 0.2s;
  border-bottom: 1px solid #333;
}

.lang-option:last-child {
  border-bottom: none;
}

.lang-option:hover {
  background: #2a2a2a;
  color: #fff;
}

.lang-flag {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.lang-name {
  font-size: 0.95rem;
  font-weight: 500;
}

nav a {
  color: #ddd;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
nav a:hover { color: #fff; }

.header-nav {
    display: none; /* Hide header nav links on desktop as they are in sidebar */
}

/* Main Content */
main {
  flex: 1;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  /* Sidebar behaves like a drawer on mobile */
  .sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-header h3 { opacity: 1; }
  .category-name { opacity: 1; }
  .sidebar-close { display: block; }
  
  .main-wrapper {
    margin-left: 0;
  }
  
  .header-nav { display: block; } /* Show backup nav links if needed */
  
  .hero-overlay h1 { font-size: 1.75rem; }
  .game-hero { margin: 0; border-radius: 0; }
  .header-container { flex-wrap: wrap; }
  .search-container { order: 3; max-width: 100%; width: 100%; }
  
  /* Language selector adjustments for mobile */
  .language-selector {
    order: 2;
  }
  
  .lang-toggle {
    padding: 0.4rem 0.6rem;
  }
}

/* Stats */
.search-stats {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  color: #f0f;
  font-size: 0.9rem;
  display: none;
}

/* Hero Banner */
.game-hero {
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: 1rem auto 0;
  overflow: hidden;
  border-radius: 8px;
}

.game-hero img {
  width: 100%;
  height: auto;
  display: block;
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  padding: 2rem 1.5rem 1rem;
  color: #fff;
}

.hero-overlay h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2.5rem;
}

.mobile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 0, 255, 0.2);
  color: #f0f;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #f0f;
}

/* Catalog Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
  padding: 1rem;
  max-width: 1280px;
  margin: 0 auto;
}

/* Home: force 6 columns on desktop */
@media (min-width: 1200px) {
  #homeGamesGrid.game-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@media (max-width: 1199px) {
  #homeGamesGrid.game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  #homeGamesGrid.game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  #homeGamesGrid.game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.game-card { 
  display: block; 
  text-decoration: none; 
  color: inherit; 
  background: #222; 
  border-radius: 8px; 
  overflow: hidden; 
  transition: transform 0.2s;
  position: relative;
}
.game-card:hover { 
  transform: translateY(-4px); 
  z-index: 10;
}
.game-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }

/* Animated Thumbnails */
.game-thumb.animated {
  object-fit: cover;
  animation: none;
}

.game-card:hover .game-thumb.animated {
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(255, 0, 255, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(255, 0, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 0, 255, 0); }
}

/* Styling for Hover-Only Title */
.game-card h3 { 
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.75rem 1rem; 
  font-size: 1rem; 
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  color: #fff;
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.game-card:hover h3 {
  opacity: 1;
  transform: translateY(0);
}

.card-mobile-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 0, 255, 0.9);
  color: #fff;
  padding: 0.3rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Game Player */
.game-container {
  width: 100%;
  max-width: 1024px;
  margin: 1rem auto 0;
  background: #000;
  aspect-ratio: 16/9; 
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.game-container[data-orientation="portrait"] {
  max-width: 450px;
  aspect-ratio: 9/16;
}

@media (max-width: 768px) {
  .game-container {
    max-width: 100%;
  }
  .game-container[data-orientation="portrait"] {
    width: 100%;
    aspect-ratio: 9/16; 
  }
}

/* Ad Banner */
.ad-banner-container {
  max-width: 1024px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  text-align: center;
}
.ad-placeholder {
  background: #222;
  color: #555;
  height: 90px;
  width: 100%;
  max-width: 728px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #444;
  border-radius: 4px;
}

/* Game Details Section */
.game-content-wrapper {
  max-width: 1024px;
  margin: 0 auto;
  padding: 1rem;
}

.game-header { margin-bottom: 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.game-header h1 { margin: 0; font-size: 2rem; color: #fff; }

/* Image Gallery */
.game-gallery {
  margin: 2rem 0;
}

.game-gallery h3 {
  color: #f0f;
  margin-bottom: 1rem;
  border-bottom: 1px solid #333;
  padding-bottom: 0.5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.gallery-grid img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 2px solid #222;
  transition: border-color 0.2s;
}

.gallery-grid img:hover {
  border-color: #f0f;
}

/* Tags */
.tags-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.tag { 
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #333; 
  color: #ccc; 
  padding: 0.2rem 0.8rem; 
  border-radius: 20px; 
  font-size: 0.85rem; 
  text-transform: lowercase;
  text-decoration: none;
}
.tag:hover { background: #3d3d3d; color: #fff; }

/* Info Boxes */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  background: #1a1a1a;
  padding: 1.5rem;
  border-radius: 8px;
}
.info-box h3 { margin-top: 0; color: #f0f; border-bottom: 1px solid #333; padding-bottom: 0.5rem; }
.info-box p { color: #ddd; font-size: 0.95rem; line-height: 1.6; }

@media (max-width: 700px) {
  .info-grid { grid-template-columns: 1fr; }
}

/* Tag & Category Pages */
.tag-index-wrapper,
.tag-page-wrapper,
.cat-index-wrapper,
.cat-page-wrapper {
  max-width: 1024px;
  margin: 0 auto;
  padding: 1rem;
}

.cat-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: #ddd;
  font-size: 0.9rem;
}

.mobile-filter input[type="checkbox"] {
  cursor: pointer;
}

/* Added styles for category mobile filter icon */
.mobile-filter .icon-mobile {
  color: #555;
  display: flex;
  transition: color 0.2s;
}

.mobile-filter input:checked ~ .icon-mobile {
  color: #f0f;
}


/* Tag Grid */
.tag-grid,
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.tag-card,
.cat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #222;
  text-decoration: none;
  border-radius: 8px;
  overflow: hidden;
  padding-right: 1rem;
  transition: background 0.2s;
}
.tag-card:hover,
.cat-card:hover { background: #333; }

.tag-thumb,
.cat-thumb {
  width: 90px;
  height: 68px;
  flex-shrink: 0;
  background: #000;
}

.tag-thumb img,
.cat-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
  font-size: 1.2rem;
}

.tag-info h3,
.cat-info h3 {
  margin: 0;
  font-size: 1rem;
  color: #fff;
}

.tag-info .count,
.cat-info .count {
  color: #888;
  font-size: 0.85rem;
}

.tag-page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.muted { color: #aaa; }
.muted-link { color: #aaa; text-decoration: none; }
.muted-link:hover { color: #fff; }

/* Related Section */
.related-section {
  max-width: 1280px;
  margin: 3rem auto 1rem;
  padding: 0 1rem;
}
.related-section h2 { color: #fff; border-left: 4px solid #f0f; padding-left: 1rem; margin-bottom: 1rem; }

/* Load More Button */
.load-more-container {
  text-align: center;
  margin: 2rem 0;
}

.load-more-btn {
  background: #222;
  color: #fff;
  border: 1px solid #333;
  padding: 0.8rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.load-more-btn:hover {
  background: #333;
  border-color: #f0f;
  color: #f0f;
}

/* Footer Styles */
.footer-content {
  max-width: 1280px;
  margin: 0 auto;
}

.footer-links {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: #888;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #f0f;
}

.footer-links .separator {
  color: #444;
}

/* FAQ Section */
.faq-section {
  max-width: 1280px;
  margin: 3rem auto 2rem;
  padding: 0 1rem;
  box-sizing: border-box;
}

.faq-section h2 {
  color: #fff;
  border-left: 4px solid #f0f;
  padding-left: 1rem;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.faq-item {
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  margin-bottom: 1rem;
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item.active {
  border-color: #f0f;
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}

.faq-question:hover {
  background: #2a2a2a;
}

.faq-icon {
  flex-shrink: 0;
  transition: transform 0.3s;
  color: #f0f;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
  max-height: 500px;
}

.faq-answer p {
  padding: 0 1.5rem 1.5rem;
  margin: 0;
  color: #ccc;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .faq-question {
    font-size: 1rem;
    padding: 0.875rem 1rem;
  }
  
  .faq-answer p {
    padding: 0 1rem 1rem;
    font-size: 0.95rem;
  }
}
