/*------------------------------------------------------------------------
  FONTS & BASE STYLES, GLOBALS
------------------------------------------------------------------------*/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

body {
  font-family: Arial, sans-serif;
  background: #fff;
  color: #000;
  margin: 0;
  padding: 20px;
  /* Add iOS safe area support */
  padding-top: max(20px, env(safe-area-inset-top));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  top: env(safe-area-inset-top);
}

html,
body {
  touch-action: manipulation !important;
  overflow-x: hidden !important;
  overflow-y: hidden !important; /* New addition */
  zoom: 1 !important;
  transform: scale(1) !important;
  margin: 0 !important;
  padding: 0 !important;
  max-width: 100% !important;
  height: 100vh !important;
}

/* Prevent zoom on form inputs */
input,
textarea,
select {
  font-size: 16px !important; /* Prevents iOS zoom on focus */
}

/*(body.dark {
    background: #333;
    color: #fff;
} */

body.dark {
  background: #333333;
  color: #fff;
  min-height: 100vh;
  margin: 0;
  position: relative;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
}

.container.scrollable {
  height: inherit !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  position: relative !important;
  padding-bottom: 20px !important;
}

.hidden {
  display: none !important;
}

/* DISABLE ALL HOVER EFFECTS ON MOBILE */
@media (hover: none) and (pointer: coarse) {
  *:hover:not(.mobile-popup-content):not(.mobile-popup-content *) {
    transform: none;
    opacity: inherit !important;
    /*box-shadow: inherit !important; */
    scale: none !important;
    filter: inherit !important;
  }
}

.rotate-icon {
  font-size: 48px;
  margin-bottom: 20px;
  animation: rotate 2s linear infinite;
}

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

/*-----------------------------------------------------------------------
    HIDE SCROLLBAR EVERYWHERE
------------------------------------------------------------------------*/
/* Hide scrollbar while keeping scroll functionality */

/* For Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: transparent;
}

/* For Firefox */
html {
  scrollbar-width: none;
}

/* Alternative method for body and all elements */
body {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

body::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Hide scrollbars for all scrollable elements */
* {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

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

/* Specifically for any containers that might have their own scroll */
.container,
.game-grid,
.lightbox-thumbnails {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.container::-webkit-scrollbar,
.game-grid::-webkit-scrollbar,
.lightbox-thumbnails::-webkit-scrollbar {
  display: none;
}

/*------------------------------------------------------------------------
  HEADER & NAVIGATION
------------------------------------------------------------------------*/
.header {
  position: fixed;
  top: env(safe-area-inset-top); /* Changed from 0 */
  left: 0;
  width: 100%;
  z-index: 25;
  background: #283044;
  padding: 12px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .header::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top);
    background: #1a1f2e;
    z-index: -1;
  }
}

body.dark .header {
  background: #1a1f2e;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 30px;
}

.logo {
  font-size: 24px;
  font-weight: 300;
  color: #fff;
  text-decoration: none;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.header-search-bar {
  display: flex;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  background: none;
  width: 400px;
  max-width: 400px;
  backdrop-filter: blur(10px);
}

body.dark .header-search-bar {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.search-input-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

#search-input {
  padding: 0;
  padding-right: 28px;
  width: 100%;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 14px;
  height: 28px;
}

#search-input:focus {
  outline: none;
}

#search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

body.dark #search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.clear-search-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
}

.clear-search-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  transform: translateY(-50%) scale(1.1);
}

body.dark .clear-search-btn {
  color: rgba(255, 255, 255, 0.4);
}

body.dark .clear-search-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
}

.header-search-bar button {
  padding: 4px 12px;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 400;
  height: 28px;
  min-width: 60px;
  transition: all 0.15s ease;
}

.header-search-bar button:hover {
  background: rgba(255, 255, 255, 0.3);
}

body.dark .header-search-bar button {
  background: rgba(255, 255, 255, 0.1);
}

body.dark .header-search-bar button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.nav-pane {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-pane > a {
  text-decoration: none;
  color: #fff;
  font-weight: 400;
  font-size: 0.9rem;
  padding: 0 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  position: relative;
  backdrop-filter: blur(10px);
  height: 40px; /* Match search bar height */
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.nav-pane > a:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-pane > a:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Active state for current section */
.nav-pane > a.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.logo {
  cursor: pointer;
  display: flex;
  align-items: center;
  height: 100%;
}

.logo-image {
  height: 40px; /* Adjust this to match your current nav bar height */
  width: auto; /* Maintains aspect ratio */
  object-fit: contain;
  transition: opacity 0.2s ease;
}

.logo-image:hover {
  opacity: 0.8;
}

@media (hover: none) and (pointer: coarse) {
  .search-result-card img:hover {
    transform: none;
  }
}

.emoji-icon {
  width: auto;
  height: 1.5em;
  vertical-align: middle;
}

button[onclick='showAddToListMenu()'] .emoji-icon {
  height: 20px;
}

button[onclick='showSetPlatformMenu()'] .emoji-icon {
  height: 24px;
}

.library-sidebar .emoji-icon {
  height: 1.8em;
}

.context-menu .emoji-icon {
  font-size: 20px;
}

.library-games.list-mode .emoji-icon {
  aspect-ratio: auto !important;
  align-self: center !important;
  height: 30px !important;
}

.library-games.compact-mode .emoji-icon {
  height: 2em !important;
  align-self: center;
}

.search-result-card .emoji-icon {
  width: auto !important;
  height: 30px;
  align-self: center;
}
.search-control-container:first-child .emoji-icon {
  margin-left: 8px;
}

@media (max-width: 1000px) {
  .search-result-card .emoji-icon {
    width: 1em !important;
    height: 1em;
    padding-top: 8px;
    align-self: center;
  }
}

.game-list-item .emoji-icon {
  width: auto !important;
  height: 2em !important;
  display: flex !important;
  align-self: center !important;
}

#game-list.compact .game-list-item .emoji-icon {
  height: auto !important;
  width: 30px !important;
}

.game-list-item .hltb-times {
  bottom: 2px;
}

.empty-lists-state {
  margin: 0 auto;
  text-align: center;
}
.empty-lists-state .emoji-icon {
  height: 100px;
}

/*------------------------------------------------------------------------
  SECTIONS & LAYOUT
------------------------------------------------------------------------*/
.section {
  display: block;
  margin-top: 80px;
}

@media (max-width: 1000px) {
  .section {
    margin-top: 80px;
    padding: 0 15px;
  }
}

.section.hidden {
  display: none;
}

/*------------------------------------------------------------------------
    WELCOME POPUP
------------------------------------------------------------------------*/
@media (hover: none) and (pointer: coarse) {
  body.popup-active {
    overflow: hidden !important;
    position: unset !important;
    width: 100% !important;
  }
}

/* Welcome popup for first-time visitors */
.welcome-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw; /* Full viewport width */
  height: 100vh; /* Full viewport height */
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000; /* Higher z-index to ensure it's on top */
  padding: 20px;
  box-sizing: border-box;
}

.welcome-popup.hidden {
  display: none;
}

.welcome-content {
  background: #fff;
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  padding: 40px 30px;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  margin: auto; /* Additional centering */
  transform: translateZ(0); /* Force hardware acceleration for smoother rendering */
}

body.dark .welcome-content {
  background: #444;
  color: #fff;
}

.welcome-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: #333;
}

body.dark .welcome-title {
  color: #fff;
}

.welcome-text {
  font-size: 14px;
  line-height: 1.6;
  color: #555;
  margin-bottom: 25px;
}

body.dark .welcome-text {
  color: #ccc;
}

.welcome-signature {
  font-size: 14px;
  color: #666;
  margin-top: 20px;
  font-style: italic;
}

body.dark .welcome-signature {
  color: #aaa;
}

.welcome-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.welcome-btn:hover {
  background: #0056b3;
  /*transform: translateY(-1px); */
}

/*------------------------------------------------------------------------
  SEARCH RESULTS
------------------------------------------------------------------------*/
.search-results {
  margin-top: 80px;
  width: 100%;
  max-width: 622px !important; /* Single column width */
  margin-left: auto;
  margin-right: auto;
  padding-top: 0;
}

/* Desktop: single column layout */

.search-filter-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  gap: 12px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

body.dark .search-filter-container {
  background: rgba(255, 255, 255, 0.05);
}

#platform-filter {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  min-width: 150px;
  height: 35px;
}

/* Dark mode for platform filter */
body.dark #platform-filter {
  background: #444;
  border-color: #555;
  color: #fff;
}

/* Library filter selects - same styling as search filters */
#library-platform-filter,
#library-genre-filter,
#library-category-filter,
#library-sort-filter {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  font-size: 12px !important;
  min-width: 150px;
  height: 35px;
}

/* Dark mode for library filters */
body.dark #library-platform-filter,
body.dark #library-genre-filter,
body.dark #library-category-filter,
body.dark #library-sort-filter {
  background: none;
  border-color: #555;
  color: #fff;
}

/* Group headers - selectable parent platforms */
#platform-filter .platform-group-header {
  color: #333 !important;
  font-weight: 700;
  font-size: 12px;
  background-color: #f0f0f0 !important;
  padding-top: 4px;
  padding-bottom: 2px;
}

/* Disabled options (like separators) */
#platform-filter option[disabled] {
  color: #999 !important;
  font-weight: 600;
  font-size: 11px;
  background-color: #f8f9fa !important;
  padding-top: 4px;
  padding-bottom: 2px;
}

/* Dark mode group headers */
body.dark #platform-filter .platform-group-header {
  color: #fff !important;
  background-color: #444 !important;
}

body.dark #platform-filter option[disabled] {
  color: #aaa !important;
  background-color: #555 !important;
}

/* Platform options - indented */
#platform-filter .platform-option {
  color: #333;
  font-size: 12px;
  padding-left: 8px;
}

/* Dark mode platform options */
body.dark #platform-filter .platform-option {
  color: #fff;
}

/* Optional: Add subtle styling to make groups more distinct */
#platform-filter option:not([disabled]):hover {
  background-color: #e9ecef;
}

body.dark #platform-filter option:not([disabled]):hover {
  background-color: #666;
}

/* Dark mode adjustments */
body.dark #platform-filter option[data-group='nintendo'] {
  color: #ff4757;
}
body.dark #platform-filter option[data-group='playstation'] {
  color: #5352ed;
}
body.dark #platform-filter option[data-group='xbox'] {
  color: #2ed573;
}
body.dark #platform-filter option[data-group='pc'] {
  color: #ffa502;
}
body.dark #platform-filter option[data-group='sega'] {
  color: #70a1ff;
}
body.dark #platform-filter option[data-group='other'] {
  color: #aaa;
}

#platform-filter,
#category-filter,
#sort-filter,
#genre-filter {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.1);
  font-size: 12px !important;
  min-width: 150px;
  height: 35px;
}

body.dark #platform-filter,
body.dark #category-filter,
body.dark #sort-filter,
body.dark #genre-filter {
  background: none;
  border-color: #555;
  color: #fff;
}

/* Ensure filters group together on the left */
.filter-left {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 1000px) {
  .filter-left {
    width: 100%;
  }

  #platform-filter {
    width: 48%;
  }

  #category-filter {
    width: 48%;
  }

  #sort-filter {
    width: 48%;
  }

  #genre-filter {
    width: 48%;
  }
}

.filter-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto; /* Push to the right */
}

.filter-results-count {
  font-size: 12px;
  color: #444;
  font-weight: 500;
}

body.dark .filter-results-count {
  color: #aaa;
}

.clear-results-btn {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid #ddd;
  color: #444;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 35px;
}

body.dark .clear-results-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  background: none;
}

.clear-results-btn:hover {
  background: rgba(58, 44, 227, 0.07);
}

body.dark .clear-results-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.filter-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-results-count {
  font-size: 12px;
  color: #222;
  font-weight: 500;
}

body.dark .filter-results-count {
  color: #aaa;
}

/* Desktop card styles */
.search-result-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
}

body.dark .search-result-card {
  background: rgba(255, 255, 255, 0.02);
}

.search-result-card .hltb-times {
  display: none;
}

.search-result-card .search-game-controls {
  opacity: 1;
}

body.dark .search-result-card {
  background: rgba(255, 255, 255, 0.08);
}

.search-result-card img {
  width: 120px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease;
  aspect-ratio: 3/4;
}

.search-result-card img:hover {
  transform: scale(1.08);
}

/* ENSURES DESKTOP SEARCH RESULT CARDS WILL SHOW HOVER EFFECT */
@media screen and (min-width: 770px) {
  /* Desktop hover for dark mode */
  body.dark .search-result-card:hover {
    background: rgba(255, 255, 255, 0.12);
  }
}

.search-result-card .game-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  min-height: 160px;
  margin: 0;
  padding: 0;
  justify-content: flex-start;
}

.game-title-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 95%;
}

.game-title {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 16px;
  text-decoration: none;
  color: #000;
  cursor: pointer;
  margin: 0;
  line-height: 1.2;
  position: relative;
  display: inline-block;
  width: fit-content;
}

.game-title::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 50%;
  width: 0;
  height: 1px;
  background-color: #000;
  transition: all 0.1s ease;
  transform: translateX(-50%);
}

.game-title:hover {
  transform: scale(1.03);
  transition: all 0.3s ease;
}

body.dark .game-title {
  color: #fff;
}

body.dark .game-title::after {
  background-color: #fff;
}

.developer-name {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: #222;
  margin-top: 4px;
}

body.dark .developer-name {
  color: #aaa;
}

.release-date {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 12px;
  color: #444;
  margin-top: 2px;
}

body.dark .release-date {
  color: #aaa;
}

.platform-separator {
  color: #222;
}

#game-popup-content .platform-separator {
  color: #fff;
}

body.dark .platform-separator {
  color: #aaa;
}

/* Default: single column for fallback */
.search-results-grid {
  display: block;
}

@media (min-width: 1000px) {
  /* Fix the parent container constraint */
  .container {
    max-width: none !important;
    width: 100% !important;
    padding: 0 20px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
  }

  .search-results {
    max-width: none !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 80px auto 0 auto !important;
  }

  .search-results-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 15px !important;
    margin-top: 15px !important;
    width: 100% !important;
  }

  .search-result-card {
    max-width: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
  }
}

/* For very wide screens, add some reasonable max-width */
@media (min-width: 1400px) {
  .search-results {
    max-width: 1400px !important;
    width: 100%;
  }
}

/* MOBILE-SPECIFIC STYLES - Two column layout optimized for mobile */
@media screen and (max-width: 1000px) {
  .search-results {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    margin-bottom: 90px !important;
  }

  .search-results-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    margin: 15px 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .search-result-card {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    margin: 0 !important;
    padding: 12px 8px 25px 8px !important; /* UPDATED: Added bottom padding for button space */
    min-height: 280px !important;
    width: 100% !important;
    max-width: none !important;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    position: relative !important;
  }

  .search-result-card img {
    width: 150px;
    height: auto !important;
    border-radius: 6px !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
    margin-bottom: 8px !important;
  }

  .search-result-card .game-info {
    align-items: center !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 0 !important; /* UPDATED: Back to 0 so text stays under image */
    justify-content: flex-start !important;
    min-height: 0 !important;
    position: static !important; /* UPDATED: Remove relative positioning */
  }

  .search-result-card .game-title-container {
    align-items: center !important;
    width: 100% !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    margin-bottom: -12px !important; /* ADDED: Space between text and buttons */
  }

  .search-result-card .game-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-align: center !important;
    word-wrap: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow-wrap: break-word !important;
  }

  .search-result-card .developer-name {
    font-size: 10px !important;
    text-align: center !important;
    opacity: 0.8 !important;
    margin: 2px 0 !important;
  }

  .search-result-card .release-date {
    font-size: 9px !important;
    text-align: center !important;
    opacity: 0.7 !important;
    margin: 0 !important;
  }

  .search-result-card .search-game-controls {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    justify-content: right !important;
    gap: 10px !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    position: absolute !important;
    bottom: 0px !important;
    margin-top: 0 !important;
  }
}

/* Remove hover effects on mobile for better touch experience */
@media (max-width: 600px) {
  .game-title:hover::after {
    width: 0 !important;
  }

  .game-title::after {
    display: none !important;
  }
}

.game-cover-placeholder {
  /* Match your actual game cover dimensions */
  width: 120px !important; /* Much smaller to match real covers */
  height: 160px !important; /* Match your game cover height */
  max-width: 120px;
  flex-shrink: 0;
  background:
    linear-gradient(135deg, #6278d9 0%, #4d2575 100%),
    radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='20' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='grid' width='20' height='20' patternUnits='userSpaceOnUse'%3E%3Cpath d='M 20 0 L 0 0 0 20' fill='none' stroke='%23ffffff' stroke-width='0.3' opacity='0.1'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23grid)'/%3E%3C/svg%3E");
  background-size:
    cover,
    cover,
    cover,
    20px 20px;
  background-position:
    center,
    center,
    center,
    0 0;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#game-popup-content .game-cover-placeholder {
  /* Match your actual game cover dimensions */
  width: 350px !important; /* Much smaller to match real covers */
  height: 334px !important; /* Match your game cover height */
  flex-shrink: 0;
  background:
    linear-gradient(135deg, #6278d9 0%, #4d2575 100%),
    radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='20' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='grid' width='20' height='20' patternUnits='userSpaceOnUse'%3E%3Cpath d='M 20 0 L 0 0 0 20' fill='none' stroke='%23ffffff' stroke-width='0.3' opacity='0.1'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23grid)'/%3E%3C/svg%3E");
  background-size:
    cover,
    cover,
    cover,
    20px 20px;
  background-position:
    center,
    center,
    center,
    0 0;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  max-width: 250px;
}

#game-popup-content .popup-cover img {
  width: 100%;
  height: auto;
  margin: 0 auto;
}

#game-popup-content .no-image-icon img {
  width: 75%;
  height: auto;
  margin: 0 auto;
}

.no-image-icon {
  width: 40px;
  height: 40px;
  opacity: 0.8;
  padding: 10px;
  filter: brightness(1.2) drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
}

/* Reset transforms on search results */
.game-result,
.game-card.search-item,
.thumbnail.search-result {
  transform: scale(1) !important;
}

.game-result:hover,
.game-card.search-item:hover,
.thumbnail.search-result:hover {
  transform: scale(1.05) !important;
}

/*---------------------------------------------------------
 SEARCH RESULT TAGS & BUTTONS
----------------------------------------------------------*/
/* Category tags styling */
.game-tags {
  display: flex;
  gap: 6px;
  margin: 4px 0;
  flex-wrap: wrap;
}

@media (max-width: 1000px) {
  .game-tags {
    display: block;
    margin: 4px 0 12px;
  }
}

.category-dlc {
  background: #e74c3c;
  color: white;
}
.category-expansion {
  background: #f39c12;
  color: white;
}
.category-remake {
  background: #9b59b6;
  color: white;
}
.category-remaster {
  background: #3498db;
  color: white;
}
.category-bundle {
  background: #1abc9c;
  color: white;
}
.category-standalone {
  background: #007565;
  color: white;
}
.category-port {
  background: #95a5a6;
  color: white;
}
.category-pack {
  background: #2ecc71;
  color: white;
}
.category-expanded {
  background: #f39c12;
  color: white;
}
.category-update {
  background: #5555f7;
  color: white;
}

/* Coming soon pill - positioned under platform icons */
.category-tag,
.coming-soon-tag {
  font-size: 10px;
  padding: 4px 6px; /* Consistent padding for same height */
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1; /* Consistent line height */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0; /* Remove any default margins */
}

@media (max-width: 1000px) {
  .category-tag,
  .coming-soon-tag {
    padding: 4px 4px;
  }
}

.coming-soon-tag {
  background: #068708;
  color: white;
  letter-spacing: 0.3px;
  animation: pulse-glow-green 2s ease-in-out infinite alternate;
  width: 80px;
  max-width: 100px;
}

body.dark .coming-soon-tag {
  background: #068708;
}

/* List icon - upper right positioning */
.in-lists-icon {
  position: absolute;
  top: 5px; /* Match status icon exactly */
  right: 8px;
  font-size: 26px; /* Match status icon exactly */
  color: #666;
  z-index: 4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  line-height: 26px; /* Set line-height equal to font-size */
  height: 24px; /* Set explicit height */
  display: flex;
  align-items: center;
}

body.dark .in-lists-icon {
  color: #ccc;
}

/* Animation for coming soon */
@keyframes pulse-glow-green {
  0% {
    box-shadow: 0 1px 3px rgba(6, 135, 8, 0.4);
  }
  100% {
    box-shadow: 0 1px 4px rgba(6, 135, 8, 0.6);
  }
}

/* Enhanced Game Controls Layout */
.search-game-controls {
  position: absolute;
  bottom: 0px;
  right: 0px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

/* Mobile stays the same */
@media (max-width: 1000px) {
  .search-game-controls {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    justify-content: center;
    margin-top: 12px;
    gap: 12px;
  }
}

/* Container for each button and its menu */
.search-control-container {
  position: relative; /* Creates positioning context for menus */
  display: inline-block;
}

/* Container for each button and its menu */
.search-control-container {
  position: relative; /* Creates positioning context for menus */
  display: inline-block;
}

/* Menu positioning - basic attachment to buttons */
.search-control-container .context-menu {
  position: absolute;
  top: 100%; /* Directly below the button */
  margin-top: 2px;
  z-index: 1100;
  min-width: 152px;
  /* JavaScript will handle left/right alignment dynamically */
}

/* Ensure menus appear above everything */
.search-control-container .context-menu:not(.hidden) {
  display: block;
}

/* /* Enhanced Control Buttons - Unified Design */
.search-control-btn,
.control-btn,
.popup-control-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.3s cubic-bezier(0.3, 0, 0.2, 1);
}

#search-results .search-control-btn {
  bottom: 5px;
}

#search-results .options-icon {
  filter: invert(25%) !important;
  height: 20px !important;
  aspect-ratio: 1;
}

body.dark #search-results .options-icon {
  filter: invert(100%) !important;
}

@media (max-width: 1000px) {
  body.dark .search-control-btn {
    background: none;
  }
}

body.dark .popup-control-btn {
  color: #000 !important;
}

#game-popup-content .control-btn {
  height: 30px;
  width: 30px;
}

.search-control-btn:hover::before,
.control-btn:hover::before,
.popup-control-btn:hover::before {
  left: 100%;
}

/* Active state */
.search-control-btn:active,
.control-btn:active,
.popup-control-btn:active {
  transform: translateY(0) scale(0.98);
  transition: all 0.1s ease;
}

/* Menu active state */
.search-control-btn.menu-active,
.control-btn.menu-active,
.popup-control-btn.menu-active {
  transform: scale(1.02);
}

.status-btn {
  position: relative;
}

body.dark .popup-control-btn {
  color: #000 !important;
}

/*------------------------------------------------------------------------
  SEARCH PLACEHOLDER
------------------------------------------------------------------------*/
.search-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  color: #666;
  min-height: 600px;
}

.search-placeholder-icon {
  font-size: 100px;
  margin-bottom: 0;
}

@media (max-width: 1000px) {
  .search-placeholder-icon {
    font-size: 70px;
    margin-bottom: -15px;
  }
}

.search-placeholder h3 {
  font-size: 24px;
  font-weight: 500;
  margin: 0 0 8px 0;
  color: #444;
}

.search-placeholder p {
  font-size: 16px;
  margin: 0 0 32px 0;
  opacity: 0.8;
}

.search-suggestions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.search-suggestions span {
  font-size: 14px;
  color: #777;
}

@media (max-width: 1000px) {
  .search-suggestions span {
    font-size: 16px;
  }
}

.suggestion-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.suggestion-tag {
  background: rgba(0, 123, 255, 0.1);
  color: #007bff;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 123, 255, 0.2);
}

.suggestion-tag:hover {
  background: rgba(0, 123, 255, 0.2);
  transform: translateY(-1px);
}

body.dark .search-placeholder {
  color: #aaa;
}

body.dark .search-placeholder h3 {
  color: #fff;
}

body.dark .suggestion-tag {
  background: rgba(13, 110, 253, 0.2);
  color: #4dabf7;
  border-color: rgba(13, 110, 253, 0.3);
}

body.dark .suggestion-tag:hover {
  background: rgba(13, 110, 253, 0.3);
}

/*------------------------------------------------------------------------
  LISTS OVERVIEW
------------------------------------------------------------------------*/
.lists-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.list-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.list-thumbnail {
  width: 300px;
  height: 300px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  background: #eee;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.list-thumbnail:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

body.dark .list-thumbnail {
  background: #333;
  outline: #000;
}

.list-thumbnail img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: none;
}

/* Empty lists get different background */
.list-thumbnail.empty-list {
  background: #ccc;
}

body.dark .list-thumbnail.empty-list {
  background: #666;
}

/* Hide the 4 cover images (direct children of list-thumbnail) */
.list-thumbnail.empty-list > img {
  display: none;
}

/* Make sure the empty state is visible */
.list-thumbnail.empty-list .empty-list-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* Ensure the controller icon specifically shows */
.list-thumbnail.empty-list .empty-list-icon img {
  display: block !important;
}

.list-name {
  text-align: center;
  margin: 10px 0 0 0;
  padding: 0;
  font-weight: bold;
  width: 100%;
  box-sizing: border-box;
}

.edit-icon {
  position: absolute;
  right: 6px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  color: #000;
}

#game-lists .game-lists-header,
#game-lists .lists-overview {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

.game-lists-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.game-lists-header h2 {
  margin: 0;
}

.create-list-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #007bff;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.create-list-button::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 2px;
  background: white;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.create-list-button::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 12px;
  background: white;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.create-list-button:hover {
  background: #0056b3;
  transform: scale(1.05);
}

body.dark .create-list-button {
  background: #605cb7;
}

body.dark .create-list-button:hover {
  background: #6e6ac4;
}

.empty-list-state {
  position: absolute;
  top: 50%;
  left: 50%;
  /*transform: translate(-50%, -50%); */
  pointer-events: none;
  z-index: 5;
  text-align: center;
}

.empty-list-icon {
  font-size: 48px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin-top: 8px;
  background: none;
}

.empty-list-text {
  font-size: 14px;
  color: #555;
  font-weight: 700;
}

body.dark .empty-list-text {
  color: #ccc;
}

/*------------------------------------------------------------------------
  GAME LIST - GENERAL
------------------------------------------------------------------------*/
.list-detail-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  max-width: 1200px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.list-detail-header h2 {
  margin: 0;
  flex: 1;
}

@media (max-width: 1000px) {
  .list-detail-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
  }

  .list-header-buttons {
    width: 100%; /* Force buttons to take full width = new line */
    margin-left: 0; /* Remove auto margin */
    justify-content: flex-end;
    gap: 6px;
    display: flex;
    flex-shrink: 0;
    order: 2; /* Ensure buttons come after title */
  }

  #list-title {
    width: 100%; /* Give title full width */
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    order: 1; /* Ensure title comes first */
  }

  .game-count {
    font-size: 0.6em !important;
    font-weight: normal !important;
    color: #aaa;
    margin-left: 0 !important;
  }
}

.list-header-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.back-to-lists-btn {
  background: linear-gradient(135deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%);
  border: 1px solid #6f62c2;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-size: 14px;
  color: #fff;
  font-weight: 400;
  white-space: nowrap;
  height: 32px;
}

.back-to-lists-btn:hover {
  background: linear-gradient(135deg, rgb(109, 136, 253) 0%, rgb(148, 94, 201) 100%);
}

body.dark .back-to-lists-btn {
  color: #ccc;
  transition: background 0.3s ease;
}

body.dark .back-to-lists-btn:hover {
  background: linear-gradient(135deg, rgb(109, 136, 253) 0%, rgb(148, 94, 201) 100%);
}

.view-toggle-icon {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 16px;
  color: #444;
  line-height: 1;
}

.view-toggle-icon:hover {
  background: #f5f5f5;
  border-color: #007bff;
}

body.dark .view-toggle-icon {
  border-color: #555;
  color: #ccc;
}

body.dark .view-toggle-icon:hover {
  background: #444;
  border-color: #0d6efd;
}

.game-count {
  font-weight: normal;
  color: #666;
  font-size: 0.7em;
  margin-left: 8px;
}

body.dark .game-count {
  color: #aaa;
}

/*------------------------------------------------------------------------
  GAME LIST - GALLERY VIEW
------------------------------------------------------------------------*/
#game-list.gallery {
  display: flex;
  /* grid-template-columns: repeat(5, 1fr); */
  gap: 15px;
  /*! padding: 20px 0; */
  /*! width: min-content; */
  /*! margin-left: auto; */
  /*! margin-right: auto; */
  max-width: 1200px;
  flex-wrap: wrap;
  justify-content: center;
}

#game-list.gallery .gallery-item {
  position: relative;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  width: auto;
}

#game-list.gallery .gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

#game-list.gallery img {
  width: 208px;
  height: inherit;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 0.3s ease;
  display: block;
}

#game-list.gallery .gallery-item:hover img {
  filter: brightness(1.1);
}

/* Gallery title overlay - shown on hover */
.gallery-title-container {
  display: none;
}

#game-list.gallery .gallery-item:hover .gallery-title-container {
  opacity: 1;
}

#game-list.mini-gallery .options-icon {
  padding-right: 0px;
  right: 5px;
  bottom: -2px;
  height: 18px !important;
  width: 18px !important;
}

#game-list.gallery .options-icon {
  padding-right: 0px !important;
  height: 20px !important;
  position: relative;
  right: 4px;
  bottom: -2px;
}

.gallery-title {
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Gallery game controls - positioned in title container */
.gallery-game-controls {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#game-list.gallery .gallery-item:hover .gallery-game-controls {
  opacity: 1;
}

.gallery-game-controls .control-btn {
  width: 28px;
  height: 28px;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  backdrop-filter: blur(10px);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.gallery-game-controls .control-btn:hover {
  transform: scale(1.05);
}

/* Mobile responsive adjustments */
@media (max-width: 1000px) {
  #game-list.gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px !important;
    padding-top: 0px;
    display: grid;
    width: 100%;
  }

  .gallery-title {
    font-size: 11px;
  }

  .gallery-game-controls {
    opacity: 1 !important; /* Always visible on mobile */
    margin-top: 6px;
  }

  .gallery-game-controls .control-btn {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .gallery-title-container {
    opacity: 1; /* Always visible on mobile */
    padding: 15px 8px 10px 8px;
  }
}

/* Dark mode adjustments */
body.dark #game-list.gallery .gallery-item {
  background: rgba(255, 255, 255, 0.08);
}

body.dark .gallery-game-controls .control-btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.game-list-options {
  height: 30px;
  z-index: 1;
  position: absolute;
  bottom: -2px;
  right: 0px;
}

/*------------------------------------------------------------------------
  GAME LIST - LIST VIEW
------------------------------------------------------------------------*/

/* Game numbering system */
.game-number {
  background: #f0f0f0;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  position: relative;
  align-self: center;
}

.game-number::after {
  content: attr(data-number);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 600;
  color: #666;
}

body.dark .game-number {
  background: #555;
}

body.dark .game-number::after {
  color: #ccc;
}

/* Main list container */
#game-list {
  max-width: 1200px;
  margin: 0 auto;
  columns: 2;
  padding-top: 20px;
}

@media (max-width: 1000px) {
  #game-list {
    columns: 1;
    padding-top: 0px;
  }
}

/* List result cards */
.list-result-card {
  position: relative;
  overflow: visible;
  margin: 0 auto 20px auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  display: flex;
  align-items: flex-start;
  width: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.list-result-card:hover {
  background: rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  /*transform: translateY(-2px); */
}

body.dark .list-result-card {
  background: rgba(255, 255, 255, 0.05);
}

body.dark .list-result-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Game list item layout */
.game-list-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin: 0;
  padding: 0;
  width: 100%;
  position: relative;
}

.game-list-item img {
  width: auto;
  height: 155px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  align-self: flex-start;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.game-list-item img:hover {
  transform: scale(1.02);
}

.game-list-item .game-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  position: relative;
  min-height: 155px;
  justify-content: flex-start;
}

#game-list.list .list-result-card {
  padding: 15px !important;
}

/* Title and coming soon container */
.title-and-coming-soon {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.list-coming-soon-tag {
  background: #068708;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 2px rgba(6, 135, 8, 0.3);
  line-height: 1;
  flex-shrink: 0;
}

body.dark .list-coming-soon-tag {
  background: #068708;
}

/* Game controls positioning */
.game-controls {
  position: absolute;
  bottom: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
}

#game-list .empty-message {
  text-align: center;
  width: 100%;
  margin: 40px auto;
  padding: 40px 20px;
  color: #000;
  font-size: 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.08);
  max-width: 600px;
  /* Override all grid/flex properties from parent */
  display: block !important;
  position: static !important;
  grid-column: unset !important;
  justify-self: unset !important;
  align-self: unset !important;
  flex: none !important;
  order: unset !important;
}

body.dark #game-list .empty-message {
  color: #aaa;
  background: rgba(255, 255, 255, 0.03);
}

/* Empty state container - clean layout without view mode interference */
#game-list.empty-state {
  display: block !important;
  columns: unset !important;
  grid-template-columns: unset !important;
  flex-direction: unset !important;
  flex-wrap: unset !important;
  gap: unset !important;
  justify-content: unset !important;
  align-items: unset !important;
  padding: 20px;
}

#game-list .control-btn.menu-btn {
  align-items: center;
  justify-content: center;
}

/* These rules are now handled by the main empty-message rule above */


/* Disable hover effects during drag but allow detection */
body.dragging *:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Game cards are now draggable */
.list-result-card,
.gallery-item,
.status-game-card {
  cursor: grab;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform; /* Optimize for animations */
  position: relative;
}

/* Ensure gallery items can transform properly */
.gallery-item {
  display: inline-block;
  vertical-align: top;
}

/* Ensure all view containers allow smooth transitions */
.list {
  position: relative;
}

/* Remove default transitions - will be applied when needed */

/* Prevent layout issues during drag */
.dragging-source {
  visibility: hidden !important;
}

.list-result-card:active,
.gallery-item:active {
  cursor: grabbing;
}

/* Gallery image container for options overlay */
.gallery-image-container {
  position: relative;
  display: inline-block;
  width: 100%;
  height: 100%;
}

.gallery-image-container img {
  width: 100%;
  height: auto;
  display: block;
}

/* Options overlay in bottom right corner */
.gallery-options-overlay {
  position: absolute;
  bottom: 8px;
  right: 0px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.gallery-options-overlay .options-icon {
  width: 20px !important;
  height: 20px !important;
  filter: brightness(0) invert(1);
}

/* Options icon styling */
.options-icon {
  width: auto !important;
  height: 15px !important;
  /*filter: invert(100%);*/
  transition: all 0.2s ease;
  position: absolute;
  align-self: center;
}

/* Dark theme - use white icon */
body.dark .options-icon {
  filter: brightness(0) invert(1);
}

#game-popup-content .options-icon {
  width: 24px !important;
  height: 24px !important;
}

#game-popup-content .options-icon {
  transform: scale(1.05);
  transition: all 0.2s ease;
}

/* Popup content uses dark icon specifically */
.popup-content .options-icon {
  content: url('assets/images/icons/options-dark.png');
  filter: none;
}

/* Mobile sizing */
@media (max-width: 1000px) {
  .options-icon {
    width: 20px !important;
    height: 20px;
  }

  #game-popup-content .options-icon {
    width: 18px;
    height: 18px;
  }
}

#game-list .options-icon {
  height: 22px !important;
  position: absolute;
  align-self: center;
  padding-right: 15px;
}

#lists-overview .options-icon {
  height: 20px !important;
  filter: invert(100%);
}

/*------------------------------------------------------------------------
  COMPACT MODE
------------------------------------------------------------------------*/
#game-list.compact {
  display: block;
  columns: 2;
  gap: 10px;
  padding: 20px 30px;
}

@media (max-width: 1000px) {
  #game-list.compact {
    columns: 1;
    max-width: 100vw;
    padding: 0;
    box-sizing: border-box;
  }
  #game-list.compact .game-title {
    font-size: 12px;
  }
}

#game-list.compact .list-result-card {
  margin: 0 auto;
  min-height: 60px;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px !important;
}

#game-list.compact .game-list-item {
  gap: 10px;
  min-height: 45px;
  width: 100%;
  align-items: center;
}

#game-list.compact .game-list-item img {
  width: 54px;
  height: 72px;
  object-fit: cover;
  flex-shrink: 0;
}

#game-list.compact .game-info {
  min-height: auto;
  justify-content: center;
  flex: 1;
}

#game-list.compact .game-title {
  font-size: 14px !important;
  margin: 0;
}

#game-list.list .game-title {
  font-size: 14px !important;
  margin: 0;
}

#game-list.compact .developer-name,
#game-list.compact .release-date {
  display: none;
}

#game-list.compact .game-controls {
  position: static;
  margin-left: auto;
  margin-right: 5px;
  align-items: center;
  flex-shrink: 0;
}

#game-list.compact .game-number {
  width: 20px;
  height: 20px;
}

#game-list.compact .game-number::after {
  font-size: 10px;
}

/*------------------------------------------------------------------------
  RESPONSIVE DESIGN FOR LIST VIEW
------------------------------------------------------------------------*/
@media (max-width: 1000px) {
  .list-result-card {
    padding: 12px;
    margin-bottom: 15px;
    width: auto;
  }
  .list-result-card .hltb-times {
    transform: scale(0.75);
  }

  .game-list-item .developer-name .release-date {
    font-size: 8px;
  }

  .game-list-item {
    gap: 12px;
  }

  .game-list-item img {
    height: 120px;
  }

  .game-list-item .game-info {
    min-height: 120px;
    max-width: 220px;
  }

  .game-controls {
    bottom: 5px;
    right: 5px;
    gap: 0;
  }
}
/*------------------------------------------------------------------------
  HLTB TIMES
------------------------------------------------------------------------*/
.hltb-times {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  position: absolute;
  bottom: 0;
  left: 0;
  background: rgba(247, 248, 251, 0.52);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark .hltb-times {
  color: #fff;
}

.hltb-times table {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
}

.hltb-times td {
  padding: 2px 4px;
  border: none;
  text-align: left;
}

.hltb-times td:first-child {
  color: #222;
  font-weight: 500;
  padding-right: 8px;
  text-align: right;
}

.hltb-times td:last-child {
  color: #222;
  font-weight: 600;
  text-align: right;
}

body.dark .hltb-times {
  background: #48568d6e;
}

body.dark .hltb-times td:first-child {
  color: #ccc;
  font-weight: 500;
  padding-right: 8px;
  text-align: left;
}

body.dark .hltb-times td:last-child {
  color: #ccc;
  font-weight: 600;
  text-align: right;
}

.popup-hltb {
  display: flex;
  align-items: center;
}

.popup-hltb .hltb-times {
  position: static;
  margin: 0;
  font-size: 12px;
  padding: 6px 10px;
}

.hltb-logo-link {
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.game-list-item .hltb-logo-link img:hover {
  opacity: 0.8;
  transition: opacity 0.2s ease;
  transform: scale(0.45);
}

.library-games.list-mode .hltb-logo-link img:hover {
  opacity: 0.8;
  transition: opacity 0.2s ease;
  transform: scale(0.45);
}

.hltb-logo {
  width: auto;
  display: block;
  transform: scale(0.4); /* Scale it down further */
  clip-path: inset(20px 10px 20px 10px); /* Clip transparent edges */
  margin: -60px;
  transition: all 0.2s ease;
  filter: brightness(0) saturate(90%) invert(13%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(85%) contrast(59%);
}

body.dark .hltb-logo {
  filter: none;
}

/*------------------------------------------------------------------------
  POPUP/MODAL
------------------------------------------------------------------------*/
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 30;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}

.popup.hidden {
  display: none !important;
}

#remove-game-modal.popup,
#create-list-modal.popup,
#confirm-modal.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100000;
}

#remove-game-modal .popup-content,
#create-list-modal .popup-content,
#confirm-modal .popup-content {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  margin: 0;
}

.popup-content {
  background: #fff;
  border-radius: 16px;
  max-width: 1000px;
  width: 100%;
  margin: 60px auto 20px auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  /*padding: 20px; */
  top: env(safe-area-inset-top);
}

body.dark .popup-content {
  background: #222;
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: #000;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ccc;
  z-index: 31;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: #fff;
}

/* Game popup close button - use image instead of text */
#game-popup .close-btn {
  background: url('assets/images/icons/close-btn.png') no-repeat center;
  background-size: contain;
  width: 26px;
  height: 26px;
  border: none;
  position: absolute;
  top: 25px;
  right: 22px;
  cursor: pointer;
}

#game-popup .close-btn:hover {
  transform: scale(1.1);
  transition: transform 0.2s ease;
}

.popup-header {
  display: flex;
  gap: 20px;
  padding: 30px;
  position: relative;
  overflow: hidden;
}

.popup-header::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background-image: var(--cover-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(15px) brightness(0.4);
  z-index: 1;
}

body.dark .popup-header::before {
  filter: blur(15px) brightness(0.3);
}

.popup-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.2);
  z-index: 2;
}

.popup-header > * {
  position: relative;
  z-index: 3;
}

body.dark .popup-header::after {
  background: rgba(68, 68, 68, 0.2);
}

.popup-cover {
  flex-shrink: 0;
  width: 250px;
  aspect-ratio: 3 / 4;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.popup-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.popup-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 267px;
}

@media (max-width: 1000px) {
  .popup-cover {
    flex-shrink: 0;
    width: 250px;
    aspect-ratio: 3 / 4;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }
}
.popup-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: #fff;
  line-height: 1.2;
}

body.dark .popup-title {
  color: #fff;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.title-row h2 {
  margin: 0;
}

.popup-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.platforms-row {
  align-items: flex-start;
}

.add-row {
  margin-top: 0px;
}

.meta-label {
  font-weight: 600;
  color: #fff;
  min-width: 80px;
  font-size: 14px;
}

body.dark .meta-label {
  color: #aaa;
}

.meta-value {
  color: #000;
  font-size: 12px;
  display: inline;
  text-transform: uppercase;
  margin-top: 2px;
}

.popup-content .meta-value {
  color: #fff;
}

.popup-content .platforms-row .meta-value {
  color: #fff;
}

body.dark .meta-value {
  color: #aaa;
}

.search-result-card .meta-value {
  font-size: 11px;
}

@media (max-width: 1000px) {
  .search-result-card .meta-value {
    display: none;
  }

  .search-result-card .hltb-times {
    display: none;
  }

  .popup-content .platforms-row .meta-value {
    max-width: 60%;
  }
}

/* Platform icon text - match developer/release date styling */
.game-popup .platform-text {
  font-size: 13px;
  color: #fff;
  font-weight: normal;
}

/* Right justify all meta-labels */
.game-popup .meta-label {
  text-align: right;
  justify-content: flex-end;
}

/* If the labels are in a flex container, this ensures right alignment */
.game-popup .meta-row .meta-label,
.game-popup .game-meta .meta-label {
  text-align: right;
  justify-content: flex-end !important;
  display: flex;
  align-items: center;
}

/* Right-align text within meta-labels while keeping position */
.popup-meta .meta-label {
  text-align: right;
}

.popup-badges {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  margin-top: auto;
}

.popup-esrb-rating {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  margin-left: 0;
}

.popup-esrb-rating img {
  width: 30px;
  height: auto;
  border-radius: 0;
  clip-path: inset(1px);
}

.popup-coming-soon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #068708;
  color: white;
  padding: 6px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: 12px;
  box-shadow: 0 1px 3px rgba(6, 135, 8, 0.3);
  line-height: 1;
  flex-shrink: 0;
  vertical-align: text-top;
  align-self: center;
}

body.dark .popup-coming-soon-badge {
  background: #068708;
  box-shadow: 0 1px 3px rgba(6, 135, 8, 0.4);
}

.popup-description,
.popup-section {
  padding: 25px 30px 25px 30px;
}

.popup-description h3,
.popup-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 15px 0;
  color: #333;
  border-bottom: 2px solid #eee;
  padding-bottom: 8px;
}

body.dark .popup-description h3,
body.dark .popup-section h3 {
  color: #fff;
  border-bottom-color: #555;
}

.popup-description p {
  color: #555;
  line-height: 1.6;
  margin: 0;
  font-size: 15px;
}

body.dark .popup-description p {
  color: #ccc;
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.screenshot-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.screenshot-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.video-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.resource-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.resource-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px;
  background: rgba(0, 123, 255, 0.25);
  border-radius: 8px;
  text-decoration: none;
  color: #007bff;
  transition: all 0.3s ease;
  font-weight: 500;
}

.resource-link:hover {
  background: rgba(0, 123, 255, 0.35);
  transform: translateY(-2px);
}

body.dark .resource-link {
  background: rgba(13, 110, 253, 0.2);
  color: #ccc;
}

body.dark .resource-link:hover {
  background: rgba(13, 110, 253, 0.3);
}

.resource-icon {
  font-size: 18px;
}

.image-enlarger {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 35;
  cursor: pointer;
}

.image-enlarger.hidden {
  display: none;
}

.image-enlarger img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.enlarger-close {
  position: absolute;
  top: 30px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  backdrop-filter: blur(10px);
}

/* Add these styles to your styles.css file */

.ratings-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.rating-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
  gap: 2px;
}

.rating-source {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  text-align: center;
  color: #fff;
  line-height: 1;
}

body.dark .rating-source {
  color: #ccc;
}

.rating-score {
  color: #fff;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  min-width: 45px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  line-height: 1;
}

body.dark .rating-score {
  color: #000;
}

.rating-count {
  font-size: 10px;
  color: #fff;
  margin-top: 1px;
  text-align: center;
  line-height: 1;
  max-width: 85px;
  word-wrap: break-word;
}

body.dark .rating-count {
  color: #ccc;
}

.no-ratings {
  font-size: 12px;
  color: #fff;
  font-style: italic;
}

body.dark .no-ratings {
  color: #aaa;
}

/* Responsive adjustments for ratings */
@media (max-width: 1000px) {
  .ratings-container {
    gap: 8px;
    justify-content: flex-start;
  }

  .rating-item {
    min-width: 60px;
  }

  .rating-source {
    font-size: 9px;
  }

  .rating-score {
    font-size: 11px;
    padding: 3px 6px;
    min-width: 40px;
  }

  .rating-count {
    font-size: 8px;
    max-width: 70px;
  }
}
/* Confirmation modal styles - add to your MODAL VARIATIONS section */
.confirm-modal {
  max-width: 350px !important;
  padding: 25px !important;
  text-align: center;
}

.confirm-modal h3 {
  margin: 0 0 15px 0;
  color: #dc3545;
  font-size: 18px;
}

.confirm-modal p {
  margin: 0 0 20px 0;
  color: #666;
  font-size: 14px;
}

body.dark .confirm-modal p {
  color: #ccc;
}

.confirm-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-buttons button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.confirm-buttons .cancel-btn {
  background: #6c757d;
  color: white;
}

.confirm-buttons .danger-btn {
  background: #dc3545;
  color: white;
}
.popup-game-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.popup-control-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #ddd;
  background: #f8f9fa;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #666;
  transition: all 0.2s ease;
}

.popup-control-btn:hover {
  background: #007bff;
  border-color: #007bff;
  color: white;
  transform: scale(1.05);
}

body.dark .popup-control-btn {
  border-color: #555;
  background: #777;
  color: #ccc;
}

body.dark .popup-control-btn:hover {
  background: #0d6efd;
  border-color: #0d6efd;
  color: white;
}
/*------------------------------------------------------------------------
  MODAL VARIATIONS
------------------------------------------------------------------------*/
.quick-success-popup {
  max-width: 280px !important;
  width: auto !important;
  padding: 16px 20px !important;
  text-align: center;
  margin: 0 auto !important;
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 1000 !important;
}

.quick-success-popup h3 {
  color: #28a745;
  font-size: 24px;
  margin: 0 0 8px 0;
  font-weight: normal;
}

.quick-success-popup p {
  font-size: 14px;
  margin: 0;
  line-height: 1.3;
}

.create-list-popup {
  max-width: 400px !important;
  padding: 25px !important;
}

.create-list-popup h3 {
  margin: 0 0 20px 0;
  text-align: center;
}

.create-list-popup input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

body.dark .create-list-popup input {
  background: #555;
  border-color: #666;
  color: #fff;
}

.create-list-popup input:focus {
  outline: none;
  border-color: #007bff;
}

.create-list-popup .modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.create-list-popup .modal-buttons button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.create-list-popup .modal-buttons button:first-child {
  background: #6c757d;
  color: white;
}

.create-list-popup .modal-buttons button:last-child {
  background: linear-gradient(135deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%);
  color: white;
}

.list-name-error {
  color: #dc3545;
  font-size: 14px;
  margin-top: 0;
  margin-bottom: 0;
  display: none;
  font-weight: 500;
}

.list-name-error.show {
  display: block;
}

#create-list-modal .popup-content {
  background: #fff !important;
  border-radius: 12px !important;
  max-width: 400px !important;
  width: 400px !important;
  padding: 30px !important;
  margin: 60px auto 20px auto !important;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
  overflow: visible !important;
}

body.dark #create-list-modal .popup-content {
  background: #444 !important;
}

#create-list-modal .popup-content::before,
#create-list-modal .popup-content::after {
  content: none !important;
  display: none !important;
}

#create-list-modal .close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 28px !important;
  cursor: pointer;
  color: #666;
  width: 30px !important;
  height: 30px !important;
  background: none !important;
  border-radius: 50%;
}

body.dark #create-list-modal .close-btn {
  color: #ccc;
}

/*------------------------------------------------------------------------
  CONTEXT MENUS
------------------------------------------------------------------------*/
.context-menu {
  position: absolute;
  background: #fff;
  color: #000;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 1);
  z-index: 1100;
  padding: 5px 0;
  font-size: 12px;
}

body.dark .context-menu {
  background: #3a3a46 !important;
  color: #fff;
  font-family: 'Inter', sans-serif;
}

.context-menu div {
  padding: 5px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #555 !important;
}

body.dark .context-menu div {
  color: #ccc !important;
}

.context-menu div:hover {
  background: #f0f0f0;
}

body.dark .context-menu div:hover {
  background: #555;
}

.context-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
  color: inherit;
}

.context-menu .menu-item:hover {
  background: #f0f0f0;
}

body.dark .context-menu .menu-item:hover {
  background: #555;
}

.context-menu .menu-item-disabled {
  color: #999;
  background: #f5f5f5;
  cursor: not-allowed;
  opacity: 0.6;
}

.context-menu .menu-item-disabled:hover {
  background: #f5f5f5 !important;
}

body.dark .context-menu .menu-item-disabled {
  color: none;
  /*background: none; */
}

body.dark .context-menu .menu-item-disabled:hover {
  background: #555 !important;
}

.status-context-menu {
  min-width: 160px;
}

.status-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 500;
}

.status-menu-item .status-icon {
  font-size: 18px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.status-menu-item .no-status-icon {
  font-size: 18px;
}

.status-menu-item .status-name {
  font-size: 12px;
  display: flex;
  align-items: center;
  line-height: 1;
  padding-left: 5px;
}

.menu-divider {
  height: 1px;
  background: #eee;
  margin: 4px 0;
  padding: 0 !important;
}

body.dark .menu-divider {
  background: #555;
}

.menu-divider:hover {
  background: #eee !important;
}

body.dark .menu-divider:hover {
  background: #999 !important;
}

/* Control containers for proper menu positioning */
.game-control-container,
.library-control-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-popup-content .game-control-container {
  position: absolute;
  display: flex;
  right: 20px;
  top: 60px;
  border-radius: 24px;
  align-content: center;
}

/* Menu positioning for game lists and library */
.game-control-container .context-menu,
.library-control-container .context-menu {
  position: absolute;
  top: 100%;
  margin-top: 2px;
  z-index: 1100;
  min-width: 152px;
}

.game-control-container .context-menu:not(.hidden),
.library-control-container .context-menu:not(.hidden) {
  display: block;
}

.game-control-container .control-btn {
  border-radius: 24px;
  align-items: center;
  justify-content: center;
}

.library-control-container .context-menu {
  position: absolute;
  top: 100%;
  margin-top: 2px;
  z-index: 1100;
  min-width: 152px;
}

.menu-item.remove-item {
  color: #ff6b6b !important;
}

/* Narrower width for Game Lists context menu */
#game-menu.context-menu {
  min-width: 135px;
}

/* Make remove items red with higher specificity */
.context-menu .menu-item.remove-item,
#game-menu .menu-item.remove-item {
  color: #ff6b6b !important;
}

/* Prevent menu positioning conflicts */
#status-menu {
  pointer-events: auto;
  touch-action: auto;
}

#status-menu.hidden {
  pointer-events: none;
}

/* Ensure menu items are clickable */
.status-menu-item {
  pointer-events: auto;
  cursor: pointer;
}

/* Enhanced context menu styling with higher specificity */
#game-menu.context-menu,
#status-menu.context-menu,
#add-menu.context-menu,
#platform-menu.context-menu {
  background: rgb(217, 217, 217) !important;
  border: 1px solid #cababa !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
  z-index: 1100 !important;
  padding: 5px 0 !important;
  font-size: 11px !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

body.dark #game-menu.context-menu,
body.dark #status-menu.context-menu,
body.dark #add-menu.context-menu,
body.dark #platform-menu.context-menu {
  background: #2f2f41 !important;
  border: 1px solid #666 !important;
  color: #fff !important;
}

#game-menu.context-menu div:hover,
#status-menu.context-menu div:hover,
#add-menu.context-menu div:hover,
#platform-menu.context-menu div:hover {
  background: #f0f0f0 !important;
}

body.dark #game-menu.context-menu div:hover,
body.dark #status-menu.context-menu div:hover,
body.dark #add-menu.context-menu div:hover,
body.dark #platform-menu.context-menu div:hover {
  background: #2f2f41dc !important;
}

.menu-divider {
  height: 1px;
  background-color: #ddd;
  margin: 4px 0;
}

.menu-item.remove-item {
  color: #dc3545; /* Red color for destructive action */
}

.menu-item.remove-item:hover {
  background-color: #f8d7da;
}
/*------------------------------------------------------------------------
  statistics DASHBOARD
------------------------------------------------------------------------*/
.statistics-dashboard {
  margin-top: 40px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.statistics-dashboard h3 {
  text-align: center;
  margin: 0 0 20px 0;
  color: #333;
}

body.dark .statistics-dashboard {
  background: rgba(255, 255, 255, 0.1);
}

body.dark .statistics-dashboard h3 {
  color: #fff;
}

.statistics-content {
  display: flex;
  gap: 30px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.statistics-stats {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.8);
  padding: 15px 20px;
  border-radius: 8px;
  text-align: center;
  min-width: 120px;
}

body.dark .stat-card {
  background: rgba(255, 255, 255, 0.1);
}

.stat-number {
  font-size: 24px;
  font-weight: bold;
  color: #333;
}

body.dark .stat-number {
  color: #fff;
}

.stat-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 5px;
}

body.dark .stat-label {
  color: #ccc;
}

.statistics-chart {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
}

#status-chart {
  max-width: 300px;
  max-height: 300px;
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 150px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-label {
  color: #333;
}

body.dark .legend-label {
  color: #fff;
}

/*------------------------------------------------------------------------
  AUTHENTICATION STYLES
------------------------------------------------------------------------*/
.auth-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-menu {
  position: relative;
  display: inline-block;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #ccc;
  transition: border-color 0.2s ease;
  vertical-align: middle;
}

.user-avatar:hover {
  border-color: #9185f7b5;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #f8f9fa; /* Dark background instead of white */
  border: 1px solid #ddd; /* Dark border */
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 120px;
  z-index: 1000;
  margin-top: 5px;
  color: #333;
}

.user-dropdown div {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid #444; /* Dark separator */
  transition: background-color 0.2s ease;
  color: #333; /* White text */
  font-size: 14px;
  justify-content: space-between;
}

/* Dark mode styles */
body.dark .user-dropdown {
  background: rgb(51, 51, 51); /* Your current dark background */
  border: 1px solid #555;
  color: #fff; /* Light text */
}

body.dark .user-dropdown div {
  color: #fff; /* Light text for menu items */
}

body.dark .user-dropdown div:hover {
  background: rgba(0, 0, 0, 0.1); /* Dark hover effect */
}

.user-dropdown div:last-child {
  border-bottom: none;
}

.user-dropdown div:first-child {
  border-top: none;
}

.username-display {
  font-weight: 500;
  color: #888 !important;
  cursor: default !important;
  font-size: 14px;
}

.username-display:hover {
  background-color: transparent !important;
}

.hidden {
  display: none;
}

.user-menu .username {
  display: none; /* Hide the original username span */
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 14px;
  color: #555;
}
body.dark .form-group label {
  color: #ccc;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

body.dark .form-group input {
  background: #555;
  border-color: #666;
  color: #fff;
}

body.dark .form-group input:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

/* Modal buttons */
.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 25px;
}

.modal-buttons button {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 100px;
  pointer-events: auto; /* CRITICAL: Ensure buttons can be clicked */
  position: relative; /* CRITICAL: Ensure proper positioning */
  z-index: 10; /* CRITICAL: Ensure buttons are above other elements */
}

.modal-buttons button[type='submit'] {
  background: #007bff;
  color: white;
  pointer-events: auto !important;
}

.modal-buttons button[type='submit']:hover {
  background: #0056b3;
}

.modal-buttons button[type='button'] {
  background: #6c757d;
  color: white;
  pointer-events: auto !important;
}

.modal-buttons button[type='button']:hover {
  background: #545b62;
}

/* Auth switch links */
.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: #666;
}

.auth-switch a {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  text-decoration: underline;
}

body.dark .auth-switch {
  color: #aaa;
}

body.dark .auth-switch a {
  color: #4dabf7;
}

/* Dashboard specific styling */
.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dashboard-section {
  padding: 15px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

body.dark .dashboard-section {
  background: rgba(255, 255, 255, 0.05);
}

.dashboard-section h4 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 16px;
}

body.dark .dashboard-section h4 {
  color: #fff;
}

.dashboard-section p {
  margin: 5px 0;
  color: #666;
  font-size: 14px;
}

body.dark .dashboard-section p {
  color: #ccc;
}

/* Dashboard buttons */
.dashboard-btn {
  padding: 8px 16px;
  margin-right: 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  background: #007bff;
  color: white;
  transition: all 0.2s ease;
}

.dashboard-btn:hover {
  background: #0056b3;
}

.dashboard-btn.danger {
  background: #dc3545;
}

.dashboard-btn.danger:hover {
  background: #c82333;
}

/* Login/Register Modal Styling */
#user-dashboard-modal .popup-content {
  background: #fff !important;
  border-radius: 12px !important;
  max-width: 600px !important;
  width: 600px !important;
  padding: 30px !important;
  margin: 60px auto 20px auto !important;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
  overflow: visible !important;
}

@media (max-width: 1000px) {
  #login-modal .popup-content,
  #register-modal .popup-content,
  #user-dashboard-modal .popup-content {
    max-width: 400px !important;
    width: 400px !important;
  }
}

#login-modal .popup-content,
#register-modal .popup-content {
  background: #fff !important;
  border-radius: 12px !important;
  max-width: 400px !important;
  width: 400px !important;
  padding: 30px !important;
  margin: 60px auto 20px auto !important;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
  overflow: visible !important;
}

body.dark #login-modal .popup-content,
body.dark #register-modal .popup-content,
body.dark #user-dashboard-modal .popup-content {
  background: #444 !important;
  color: #fff;
}
/* Remove any background images/effects from auth modals */
#login-modal .popup-content::before,
#login-modal .popup-content::after,
#register-modal .popup-content::before,
#register-modal .popup-content::after,
#user-dashboard-modal .popup-content::before,
#user-dashboard-modal .popup-content::after {
  content: none !important;
  display: none !important;
}

/* Modal headers */
#login-modal h3,
#register-modal h3,
#user-dashboard-modal h3 {
  text-align: center;
  margin: 0 0 25px 0;
  font-size: 24px;
  font-weight: 600;
  color: #333;
}
body.dark #login-modal h3,
body.dark #register-modal h3,
body.dark #user-dashboard-modal h3 {
  color: #fff;
}

/* Close button for auth modals */
#login-modal .close-btn,
#register-modal .close-btn,
#user-dashboard-modal .close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 20px !important;
  cursor: pointer;
  color: #999;
  width: 30px !important;
  height: 30px !important;
  background: none !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#login-modal .close-btn:hover,
#register-modal .close-btn:hover,
#user-dashboard-modal .close-btn:hover {
  color: #666;
  background: rgba(0, 0, 0, 0.05) !important;
}

body.dark #login-modal .close-btn,
body.dark #register-modal .close-btn,
body.dark #user-dashboard-modal .close-btn {
  color: #ccc;
}

body.dark #login-modal .close-btn:hover,
body.dark #register-modal .close-btn:hover,
body.dark #user-dashboard-modal .close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05) !important;
}

.delete-btn {
  background-color: #ff6b6b;
  color: white;
}

.delete-btn:hover {
  background-color: #ff5252;
}

.cancel-btn {
  background-color: #666;
  color: white;
}

.cancel-btn:hover {
  background-color: #555;
}

/* Confirm Delete Modal */
#confirm-delete-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

#confirm-delete-modal.hidden {
  display: none;
}

#confirm-delete-modal .modal-content {
  background-color: #2a2a2a;
  color: white;
  padding: 30px;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#confirm-delete-modal h3 {
  margin: 0 0 15px 0;
  color: #ff6b6b;
}

#confirm-delete-modal p {
  margin: 0 0 25px 0;
  line-height: 1.4;
}

#confirm-delete-modal .modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

#confirm-delete-modal .btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  min-width: 80px;
}

.delete-btn {
  background-color: #ff6b6b;
  color: white;
}

.delete-btn:hover {
  background-color: #ff5252;
}

.cancel-btn {
  background-color: #666;
  color: white;
}

.cancel-btn:hover {
  background-color: #555;
}

/* Enhanced Dashboard Styling */
.avatar-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
}

body.dark .avatar-controls {
  background: rgba(255, 255, 255, 0.02);
}

.current-avatar-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dashboard-avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(0, 123, 255, 0.3);
  transition: all 0.2s ease;
}

.dashboard-avatar-preview:hover {
  border-color: rgba(0, 123, 255, 0.6);
  transform: scale(1.05);
}

.avatar-status {
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

body.dark .avatar-status {
  color: #aaa;
}

.avatar-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Data Statistics */
.data-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
  padding: 15px;
  background: rgba(0, 123, 255, 0.05);
  border-radius: 8px;
  border-left: 4px solid #007bff;
}

body.dark .data-stats {
  background: rgba(13, 110, 253, 0.1);
  border-left-color: #0d6efd;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-number {
  font-size: 24px;
  font-weight: bold;
  color: #007bff;
  line-height: 1;
}

body.dark .stat-number {
  color: #4dabf7;
}

.stat-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

body.dark .stat-label {
  color: #aaa;
}

/* Enhanced Dashboard Buttons */
.dashboard-btn.primary {
  background: #007bff;
  color: white;
  font-weight: 600;
}

.dashboard-btn.primary:hover {
  background: #0056b3;
  transform: translateY(-1px);
}

/* Button spacing */
.dashboard-section .dashboard-btn {
  margin-right: 8px;
  margin-bottom: 8px;
}
/* Theme Controls */
.theme-controls {
  display: flex;
  gap: 8px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
}

body.dark .theme-controls {
  background: rgba(255, 255, 255, 0.02);
}

.theme-btn {
  padding: 8px 20px;
  border: 2px solid #ddd;
  background: #fff;
  color: #666;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 80px;
}

.theme-btn:hover {
  border-color: #007bff;
  color: #007bff;
}

.theme-btn.active {
  background: #007bff;
  border-color: #007bff;
  color: white;
}

body.dark .theme-btn {
  background: #555;
  border-color: #666;
  color: #ccc;
}

body.dark .theme-btn:hover {
  border-color: #0d6efd;
  color: #4dabf7;
}

body.dark .theme-btn.active {
  background: #0d6efd;
  border-color: #0d6efd;
  color: white;
}

/* Make username clickable */
.username {
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

.username:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* CSS TO CONTROL THE DROP DOWN THEME TOGGLE */

.theme-toggle {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s;
  padding-top: 12px !important;
}

.theme-toggle:hover {
  background: rgba(78, 78, 78, 0.329);
}

.theme-label {
  font-size: 14px;
  text-align: left;
}

/* Dark theme support */
body.dark .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

body.dark .menu-divider {
  background: #555;
}

/*--------------------------------
  ABOUT SECTION 
----------------------------------*/
.about-modal {
  width: auto;
}

.about-section {
  margin-bottom: 20px;
}

.about-section h4 {
  color: #007bff;
  margin-bottom: 10px;
  font-size: 16px;
}

.about-section ul {
  margin: 10px 0;
  padding-left: 20px;
}

.about-section li {
  margin-bottom: 8px;
  line-height: 1.4;
}

.acknowledgment {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #007bff;
}

.acknowledgment a {
  color: #007bff;
  text-decoration: none;
}

.acknowledgment a:hover {
  text-decoration: underline;
}

.about-footer {
  text-align: center;
  font-style: italic;
  color: #666;
  margin-top: 20px;
}

/* Dark theme support */
body.dark .acknowledgment {
  background: #333;
  color: #fff;
}

body.dark .about-footer {
  color: #ccc;
}
/*------------------------------------------------------------------------
  RESPONSIVE DESIGN
------------------------------------------------------------------------*/
@media (max-width: 1000px) {
  .header-content {
    gap: 15px;
    padding: 0 15px;
  }

  .logo {
    font-size: 20px;
  }

  .header-search-bar {
    width: 400px;
    max-width: 400px;
    padding: 4px 8px;
  }

  .nav-pane {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
  }

  .nav-pane a {
    font-size: 1rem;
  }

  .clear-search-btn {
    right: 6px;
    width: 24px;
    height: 24px;
    font-size: 16px;
  }

  .search-result-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  /* Original positions when no status badge */
  .coming-soon-tag .category-tag {
    background: #068708;
    color: white;
    padding: 6px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 4;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 4px rgba(6, 135, 8, 0.3);
    animation: pulse-glow-green 2s ease-in-out infinite alternate;
    min-width: 60px;
    text-align: center;
    max-width: 80px;
    margin: -5px auto 10px;
  }

  .control-btn {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }

  .list-header-buttons {
    gap: 6px;
    margin-left: auto;
  }

  .back-to-lists-btn {
    font-size: 12px;
    padding: 4px 8px;
    margin-right: auto;
  }

  .popup {
    padding: 10px;
  }

  .popup-content {
    margin: 40px auto 10px auto;
  }

  .popup-header {
    flex-direction: column;
    align-items: center;
    /*text-align: center; */
    padding: 20px;
  }

  .popup-title {
    font-size: 22px;
    text-align: center !important;
    margin: 0 auto !important;
  }

  .popup-coming-soon-badge {
    font-size: 10px;
    padding: 6px 6px;
    display: block;
    margin: 0 auto;
    margin-bottom: 10px;
    max-width: 80px;
  }

  .screenshot-grid {
    grid-template-columns: 1fr;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .resource-links {
    grid-template-columns: 1fr;
  }

  .search-placeholder {
    padding: 40% 15px;
    min-height: 250px;
  }

  .search-placeholder h3 {
    font-size: 20px;
  }

  .search-placeholder p {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .suggestion-tags {
    gap: 6px;
  }

  .suggestion-tag {
    padding: 4px 10px;
    font-size: 17px !important;
  }

  .statistics-content {
    flex-direction: column;
  }

  .statistics-stats {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .statistics-chart {
    flex-direction: column;
    gap: 20px;
  }

  .chart-legend {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    min-width: auto;
  }
}

@media (max-width: 600px) {
  .header-search-bar {
    display: none;
  }

  .header-content {
    gap: 10px;
  }
}

@media (max-width: 600px) {
  .clear-search-btn {
    display: none !important;
  }

  .header-search-bar {
    display: none;
  }

  .header-content {
    gap: 10px;
  }

  /* Existing mobile styles... */
  .game-title:hover::after {
    width: 0 !important;
  }

  .game-title::after {
    display: none !important;
  }
}

/* Clean display button icons */
.library-display-controls .display-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: none;
  border-radius: 5.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: none;
  color: #666;
  width: 34px;
  height: 33px;
  flex-shrink: 0;
}

/* Light theme PNG Icons */

.library-display-controls .display-btn:nth-child(1) {
  background-image: url('assets/images/icons/compact.png');
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-position: center;
}

.library-display-controls .display-btn:nth-child(2) {
  background-image: url('assets/images/icons/list.png');
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-position: center;
}

.library-display-controls .display-btn:nth-child(3) {
  background-image: url('assets/images/icons/gallery.png');
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-position: center;
}

.library-display-controls .display-btn:nth-child(4) {
  background-image: url('assets/images/icons/mini-gallery.png');
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-position: center;
}

/* Light theme active buttons use dark icons for contrast */
.library-display-controls .display-btn.active:nth-child(1) {
  background-image: url('assets/images/icons/compact-dark.png');
}

.library-display-controls .display-btn.active:nth-child(2) {
  background-image: url('assets/images/icons/list-dark.png');
}

.library-display-controls .display-btn.active:nth-child(3) {
  background-image: url('assets/images/icons/gallery-dark.png');
}

.library-display-controls .display-btn.active:nth-child(4) {
  background-image: url('assets/images/icons/mini-gallery-dark.png');
}

/* Dark theme PNG Icons */
body.dark .library-display-controls .display-btn:nth-child(1) {
  background-image: url('assets/images/icons/compact-dark.png');
}

body.dark .library-display-controls .display-btn:nth-child(2) {
  background-image: url('assets/images/icons/list-dark.png');
}

body.dark .library-display-controls .display-btn:nth-child(3) {
  background-image: url('assets/images/icons/gallery-dark.png');
}

body.dark .library-display-controls .display-btn:nth-child(4) {
  background-image: url('assets/images/icons/mini-gallery-dark.png');
}

/* Dark theme support */
body.dark .library-display-controls .display-btn {
  color: #ccc;
}

/* Active state with pseudo-element for gradient */
.library-display-controls .display-btn.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%);
  border-radius: 5.5px;
  z-index: -1;
}

.library-display-controls .display-btn.active {
  color: #fff;
}

/*------------------------------------------------------------------------
  LIBRARY SECTION
------------------------------------------------------------------------*/
.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.library-header h2 {
  margin: 0;
}

@media (max-width: 1000px) {
  .library-header {
    margin-bottom: 10px;
  }
}

.library-view-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 4px;
}

body.dark .library-view-toggle {
  background: rgba(255, 255, 255, 0.1);
}

.lib-view-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: 5.5px;
  cursor: pointer;
  font-size: 14px;
  color: #000;
  transition: all 0.2s ease;
}

.lib-view-btn.active {
  background: linear-gradient(135deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%);
  color: white;
}

body.dark .lib-view-btn {
  color: #ccc;
}

body.dark .lib-view-btn.active {
  background: linear-gradient(135deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%);
}

.library-view {
  max-width: 1200px;
  margin: 0 auto;
}

.library-view.hidden {
  display: none;
}

/* New Library Layout */
.library-content {
  display: flex;
  gap: 30px;
  min-height: 600px;
}

.library-sidebar {
  width: 250px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 20px;
  flex-shrink: 0;
  height: fit-content;
}

body.dark .library-sidebar {
  background: rgba(255, 255, 255, 0.1);
}

.library-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  user-select: none;
}

.library-nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.library-nav-item.active {
  background: linear-gradient(270deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%);
  color: white;
}

body.dark .library-nav-item:hover {
  background: rgba(255, 255, 255, 0.15);
}

body.dark .library-nav-item.active {
  background: linear-gradient(270deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%);
}

.nav-icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.nav-label {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  padding-left: 10px;
}

.nav-count {
  font-size: 12px;
  color: #666;
  font-weight: 600;
}

.library-nav-item.active .nav-count {
  color: rgba(255, 255, 255, 0.8);
}

body.dark .nav-count {
  color: #aaa;
}

.library-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.library-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /*
  padding-bottom: 5px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  */
}

.library-main-header h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

@media (max-width: 1000px) {
  .library-main-header {
    position: relative; /* Only on mobile */
  }

  .mobile-count {
    font-size: 16px;
    vertical-align: middle;
    color: #999;
  }
}

/* Ensure desktop layout stays normal */
@media (min-width: 1001px) {
  .library-main-header {
    position: static; /* Reset any positioning */
  }
}

.library-display-controls {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 4px;
}

@media (max-width: 1000px) {
  .library-display-controls {
    padding: 3px;
  }
}

body.dark .library-display-controls {
  background: rgba(255, 255, 255, 0.1);
}

body.dark .display-btn {
  color: #ccc;
}

.display-btn.active {
  background: linear-gradient(135deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%);
  color: #fff;
}

.library-games {
  position: relative;
  min-height: 400px;
}

/* Remove min-height for mini-gallery mode to prevent stretching */
.library-games.mini-gallery-mode {
  min-height: auto;
}

/* List Mode */
.library-games.list-mode {
  display: block;
  columns: 2;
  gap: 10px;
  min-width: 850px !important;
}

.library-games.list-mode .status-game-card {
  display: flex;
  align-items: stretch; /* Make all flex children the same height */
  gap: 15px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  transition: all 0.2s ease;
  position: relative;
  height: 150px;
  margin-bottom: 10px;
  overflow: auto;
}

.library-games.list-mode .status-game-card:hover {
  background: rgba(0, 0, 0, 0.1);
}

.library-games.list-mode .status-game-card img {
  aspect-ratio: 3/4; /* Maintain proper game cover proportions */
  height: 100%; /* Take full height of the container */
  width: auto; /* Width adjusts to maintain aspect ratio */
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

/* The status-game-info will determine the height */
.library-games.list-mode .status-game-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  justify-content: flex-start;
  position: relative;
}

body.dark .status-game-card {
  background: rgba(255, 255, 255, 0.05);
}

body.dark .status-game-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

/*-------------------------------------------------------
     LIBRARY AND GAME LIST CSS FOR MOBILE 
--------------------------------------------------------*/

@media (max-width: 1000px) and (min-width: 400px) {
  .library-games.list-mode .status-game-info {
    gap: 0 !important;
  }

  .library-games.list-mode .status-game-title {
    line-height: 1 !important;
  }

  .library-games.list-mode .status-game-meta.developer {
    margin-top: 2px !important;
    font-weight: 500 !important;
  }

  .library-games.list-mode .status-game-meta,
  .game-list-item .release-date {
    margin: 1px !important;
    line-height: 1 !important; /* Note: line-height: 0 might hide text */
    font-size: 11px !important;
  }

  .library-games.list-mode .hltb-times {
    margin-top: 0 !important;
    padding: 2px !important;
    position: absolute !important;
  }

  .library-games.list-mode .hltb-times table {
    line-height: 1.2 !important;
    width: 125px !important;
  }

  .library-games.list-mode .status-game-controls {
    bottom: 10px !important;
    right: 2px !important;
    display: flex !important;
    transform: scale(0.85) !important;
  }

  .library-games.list-mode .status-game-card img {
    height: auto;
  }

  .library-games.list-mode .hltb-times .hltb-logo {
    padding-right: 5px !important;
    margin-right: 20px !important;
    position: relative !important;
    left: 37px !important;
    top: 0.8em;
    transform: scale(0.6);
  }

  .library-games.mini-gallery-mode {
    columns: 4;
  }

  .library-main-header h3 {
    font-size: 22px;
  }

  .game-cover-placeholder {
    /* Match your actual game cover dimensions */
    width: 150px !important; /* Much smaller to match real covers */
    height: 200px !important; /* Match your game cover height */
    max-width: 150px !important;
    margin-bottom: 8px !important;
  }

  .no-image-icon {
    transform: scale(0.85);
    object-fit: contain !important;
  }

  #game-list.gallery {
    gap: 15px !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    justify-content: center !important;
    margin: 0 auto !important;
    width: 100% !important;
    padding: 0 !important;
  }

  #game-list.gallery img {
    width: 100% !important; /* Fill column width */
    height: auto !important; /* Maintain aspect ratio */
  }

  #game-list.mini-gallery {
    gap: 8px !important;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    justify-content: center !important;
    margin: 0 auto !important;
    width: 100% !important;
    padding: 0 !important;
  }

  #game-list.mini-gallery img {
    width: 100% !important; /* Fill column width */
    height: auto !important; /* Maintain aspect ratio */
  }

  .game-list-item .hltb-times .hltb-logo {
    padding-right: 5px !important;
    margin-right: 20px !important;
    position: relative !important;
    left: 10px !important;
    top: 0.8em;
    transform: scale(0.6);
  }

  .game-list-item .title-and-coming-soon {
    margin-bottom: 0 !important;
  }

  #game-list.list .game-title {
    font-size: 12px !important;
  }

  .game-list-item .developer-name {
    margin-top: 0px !important;
    font-weight: 500 !important;
    font-size: 11px !important;
  }

  .game-list-item .hltb-times {
    margin-top: 0 !important;
    padding: 6px !important;
    margin-left: -25px !important;
    max-width: 85% !important;
    bottom: -8px !important;
    font-size: 12px !important;
    right: -20px;
  }

  .game-list-item .hltb-times table {
    line-height: 1.2 !important;
    width: 135px !important;
  }

  .game-list-item .hltb-times .hltb-logo {
    padding-right: 12px !important;
    margin: -50px !important;
    transform: scale(0.6) !important;
    top: -0.05em !important;
  }

  .game-list-item .game-controls {
    transform: scale(0.75) !important;
    gap: 6px !important;
    display: grid;
    right: -5px !important;
    bottom: -15px;
  }

  #game-list.gallery img {
    width: 100%;
  }

  /* COMPACT VIEW CSS */
  #game-list.compact .game-title {
    font-size: 12px !important;
  }

  #game-list.compact .game-controls {
    margin-right: -20px !important;
    display: flex !important;
  }

  #game-list.compact .control-btn {
    margin: 0 5px !important;
  }

  .game-list.compact .game-controls {
    bottom: 4px !important;
    right: 2px !important;
    display: flex !important;
    transform: scale(1) !important;
  }

  .game-list.compact .game-info {
    gap: 0 !important;
    max-width: 50% !important;
  }

  .game-list.compact .game-controls .control-btn {
    margin: 0 -2px !important;
  }

  #game-list.compact .list-result-card {
    width: 95%;
    min-height: 50px;
    height: 70px;
    margin-bottom: 10px;
  }

  #game-list.compact .game-list-item img {
    width: 58px !important;
    height: auto !important;
  }
}

/* SAME LIBRARY / GAME LIST CSS AS ABOVE BUT FOR SMALLER PHONES */

@media (max-width: 399px) {
  .library-games.list-mode .status-game-info {
    gap: 0 !important;
  }

  .library-games.list-mode .status-game-title {
    line-height: 1 !important;
    font-size: 10.5px;
  }

  .library-games.list-mode .status-game-meta.developer {
    margin-top: 2px !important;
    font-weight: 500 !important;
  }

  .library-games.list-mode .status-game-meta,
  .game-list-item .release-date {
    margin: 1px !important;
    line-height: 1 !important; /* Note: line-height: 0 might hide text */
    font-size: 11px !important;
  }

  .library-games.list-mode .hltb-times {
    margin-top: 0 !important;
    padding: 2px !important;
    position: absolute !important;
    transform: scale(0.9);
    left: -10px;
  }

  .library-games.list-mode .hltb-times table {
    line-height: 1.2 !important;
    width: 125px !important;
  }

  .library-games.list-mode .status-game-controls {
    bottom: 10px !important;
    right: 2px !important;
    display: flex !important;
    transform: scale(0.75) !important;
  }

  .library-games.list-mode .status-game-card img {
    height: auto;
  }

  .library-games.list-mode .hltb-times .hltb-logo {
    padding-right: 5px !important;
    margin-right: 20px !important;
    position: relative !important;
    left: 38px !important;
    top: 0.8em;
    transform: scale(0.6);
  }

  .library-main-header h3 {
    font-size: 18px;
  }

  .game-count {
    font-size: 0.55em !important;
  }

  #game-list.gallery .gallery-item {
    width: fit-content !important;
  }

  .game-list-item {
    position: relative !important;
  }

  .game-list-item .hltb-times .hltb-logo {
    padding-right: 5px !important;
    margin-right: 20px !important;
    position: relative !important;
    top: 0.8em !important;
    transform: scale(0.6) !important;
  }

  #game-list.list .game-list-item .title-and-coming-soon {
    margin-bottom: 0 !important;
  }

  #game-list.list .game-list-item .game-number::after {
    font-size: 10px !important;
  }

  #game-list.list .game-list.list .game-info {
    flex: unset !important;
    left: 15% !important;
    max-width: 70% !important;
  }

  #game-list.list .game-list.list .game-number {
    width: 20px !important;
    height: 20px !important;
    align-self: flex-end !important;
  }

  #game-list.list .game-list-item img {
    position: absolute !important;
  }

  .game-list-item .game-info {
    left: 26% !important;
    max-width: 55% !important;
    min-height: 100px;
  }

  .list-result-card {
    padding: 10px;
    border-radius: 8px;
    height: 150px;
  }

  .game-list-item img {
    height: 150px;
  }

  .title-and-coming-soon {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  #game-list.list .game-title {
    font-size: 12px !important;
  }

  #game-list.list .game-list-item .developer-name {
    margin-top: 0px !important;
    font-weight: 500 !important;
    font-size: 11px !important;
  }

  #game-list.list .game-list-item .hltb-times {
    margin-top: 0 !important;
    padding: 6px !important;
    position: relative !important;
    margin-left: -24px !important;
    max-width: 180px !important;
    font-size: 12px !important;
  }

  #game-list.list .game-list-item .hltb-times table {
    line-height: 1.2 !important;
    width: 140px !important;
  }

  #game-list.list .game-list-item .hltb-times .hltb-logo {
    transform: scale(0.45) !important;
    top: 1.5em !important;
  }

  #game-list.list .game-list-item .game-controls {
    transform: scale(0.7) !important;
    gap: 6px !important;
    right: -4px !important;
    flex-direction: column !important;
    bottom: -45px !important;
  }

  /* COMPACT VIEW CSS */
  #game-list.compact .game-title {
    font-size: 11px !important;
  }

  #game-list.compact .game-controls {
    margin-right: -4px !important;
  }

  #game-list.compact .game-info {
    left: 0 !important;
    width: 150px;
  }

  .game-list.compact .game-controls {
    bottom: 4px !important;
    right: 2px !important;
    display: flex !important;
    transform: scale(1) !important;
  }

  .game-list.compact .game-info {
    gap: 0 !important;
    max-width: 50% !important;
  }

  .game-list.compact .game-controls .control-btn {
    margin: 0 -2px !important;
  }

  #game-list.compact .list-result-card {
    max-width: 100% !important;
    height: 60px !important;
  }

  #game-list.compact .game-list-item img {
    width: auto !important;
  }

  #game-list.compact .game-controls .control-btn {
    margin: 0 -4px !important;
    right: 5px;
  }
}

/* HLTB positioning - directly under release date */
.library-games.list-mode .hltb-times {
  margin-top: 8px; /* Space after release date */
  align-self: flex-start;
  background: #cbcbcc;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.dark .library-games.list-mode .hltb-times {
  background: #48568d6e;
  color: #fff;
}

.library-games.list-mode .status-game-controls .control-btn {
  width: 24px !important;
  height: 24px !important;
  display: flex !important;
  justify-content: center;
  align-items: center;
  padding: 0 !important;
  margin: 1px 0 0 0 !important;
}

/* Ensure HLTB table styling is consistent */
.library-games.list-mode .hltb-times table {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
}

.library-games.list-mode .hltb-times td {
  padding: 2px 4px;
  border: none;
  text-align: left;
  font-size: 10.5px;
}

.library-games.list-mode .hltb-times td:first-child {
  color: #222;
  font-weight: 500;
  padding-right: 8px;
}

.library-games.list-mode .hltb-times td:last-child {
  color: #222;
  font-weight: 600;
  text-align: right;
}

body.dark .library-games.list-mode .hltb-times td:first-child {
  color: #ccc;
  font-weight: 500;
  padding-right: 8px;
}

body.dark .library-games.list-mode .hltb-times td:last-child {
  color: #ccc;
  font-weight: 600;
  text-align: right;
}

.library-games.list-mode .status-game-title {
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  color: #333;
  line-height: 1.2;
  word-wrap: break-word;
}

.library-games.list-mode .status-game-meta {
  font-size: 14px;
  color: #444;
  line-height: 1.3;
}

.library-games.list-mode .status-game-controls {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.library-games.list-mode .options-icon {
  height: 22px !important;
  width: 22px !important;
  display: block !important;
}

/* Library Gallery Mode - Fixed from Scratch */
.library-games.gallery-mode {
  gap: 10px;
  padding: 0px;
  grid-template-columns: repeat(4, 1fr);
  display: grid;
}

body.dark .library-games.gallery-mode .status-game-card {
  background: rgba(255, 255, 255, 0.08);
}

.library-games.gallery-mode .status-game-card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Image fills entire card */
.library-games.gallery-mode .status-game-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  cursor: pointer;
  display: block;
}

/* Title overlay at bottom */
.library-games.gallery-mode .status-game-title,
.library-games.gallery-mode .status-game-controls {
  display: none !important;
}

/* Hide status-game-info completely in gallery mode */
.library-games.gallery-mode .status-game-info {
  display: none !important;
}

/* Dark mode adjustments */
body.dark .library-games .status-game-card {
  background: rgba(255, 255, 255, 0.08);
}

body.dark .library-games .status-game-card:hover {
  background: rgba(255, 255, 255, 0.12);
}

body.dark .library-games .status-game-title {
  color: #fff;
}

body.dark .library-games .status-game-title:hover {
  color: #4dabf7;
}

body.dark .library-games .status-game-meta {
  color: #aaa;
}

/* Empty state */
.library-games-empty {
  align-items: center;
  justify-content: center;
  text-align: center;
  width: max-content;
  position: absolute;
}

.library-games-empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.7;
}

.library-games-empty h4 {
  font-size: 20px;
  margin: 0 0 12px 0;
  color: #444;
}

.library-games-empty p {
  font-size: 16px;
  margin: 0;
  opacity: 0.8;
  max-width: 400px;
  line-height: 1.5;
}

body.dark .library-games-empty {
  color: #aaa;
}

body.dark .library-games-empty h4 {
  color: #fff;
}

/* Prevent display mode classes from affecting empty state positioning */
#library-games-container .library-games-empty {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  display: flex !important;
  flex-direction: column !important;
  grid-column: unset !important;
  grid-row: unset !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  width: max-content !important;
  z-index: 1 !important;
}

/* Ensure the container maintains relative positioning */
#library-games-container {
  position: relative;
  padding-top: 5px;
}

#library-games-container.gallery-mode .options-icon {
  right: -2px !important;
  bottom: -2px !important;
}

/* Responsive design */
@media (max-width: 1000px) {
  .library-content {
    flex-direction: column;
    gap: 20px;
  }

  .library-sidebar {
    width: 80%;
    max-width: 600px; /* Optional: prevents it from getting too wide */
    margin: 0 auto; /* Centers horizontally */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 4px;
    padding: 15px;
  }

  .library-nav-item {
    margin-bottom: 0;
    padding: 10px 12px;
  }

  .library-games.gallery-mode {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .library-games.list-mode .status-game-card {
    padding: 12px;
    gap: 12px;
    max-height: 100px;
  }

  .library-games.list-mode .status-game-card img {
    width: auto;
    height: 100px;
  }
}

/* Hide status pill text on mobile, keep icons only */
@media (max-width: 1000px) {
  .status-pill {
    /* Hide text content */
    font-size: 0;

    /* Pill styling */
    min-width: auto;
    width: auto;
    flex: none;
    padding: 8px;

    /* Center icons */
    display: flex;
    align-items: center;
    justify-content: center;

    /* Tooltip setup */
    position: relative;
  }

  .status-pill span:not(.icon) {
    display: none;
  }

  .status-pill .nav-label {
    display: none;
  }

  .status-pill .icon {
    font-size: 22px !important;
    height: 28px;
    width: 28px;
    align-items: center;
    justify-content: center;
    display: flex;
  }

  .status-pill:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
  }

  .status-filter-row {
    justify-content: space-evenly;
    display: flex;
    gap: 0;
    margin: auto;
    overflow: auto;
  }
}

/* Fine-tune for very small screens */
@media (max-width: 399px) {
  .status-pill {
    padding: 6px !important;
  }

  .status-pill .icon {
    font-size: 16px;
    height: 18px;
    width: 18px;
    align-items: center;
    justify-content: center;
    display: flex;
  }
}

.status-game-title {
  font-family: 'Inter', sans-serif !important;
  font-weight: 300 !important;
  font-size: 18px !important;
  text-decoration: none !important;
  color: #000 !important;
  cursor: pointer !important;
  margin: 0 !important;
  line-height: 1.2 !important;
  position: relative !important;
  display: inline-block !important;
  width: fit-content !important;
}

.status-game-title::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 50%;
  width: 0;
  height: 1px;
  transition: all 0.1s ease;
  transform: translateX(-50%);
}

body.dark .status-game-title {
  color: #fff !important;
}

.status-game-meta {
  font-family: 'Inter', sans-serif !important;
  font-weight: 500 !important;
  font-size: 12px !important;
  color: #888 !important;
  margin-top: 0px !important;
  line-height: 1.2 !important;
}

.status-game-meta.developer {
  font-weight: 500 !important;
  color: #666 !important;
  margin-top: 0px !important;
}

body.dark .status-game-meta {
  color: #999 !important;
}

body.dark .status-game-meta.developer {
  color: #aaa !important;
}

/* Fix gallery mode image sizing */
.library-games.gallery-mode .status-game-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  aspect-ratio: 3/4; /* Force proper game cover aspect ratio */
  height: auto; /* Let it size naturally */
}

.library-games.gallery-mode .status-game-card img {
  width: 100%;
  height: auto;
  object-fit: cover; /* This will crop to fit while maintaining aspect ratio */
  object-position: center top; /* Focus on the top-center of the image */
  cursor: pointer;
  flex-shrink: 0;
}

/* Alternative: If you want to show full covers without cropping */
.library-games.gallery-mode .status-game-card.full-cover img {
  height: auto; /* Let image determine height */
  max-height: 240px; /* But don't let it get too tall */
  object-fit: contain; /* Show full image without cropping */
}
/* Compact Mode */
.library-games.compact-mode {
  display: block;
  columns: 2;
  gap: 8px;
  min-width: 850px !important;
}

.library-games.compact-mode .status-game-card {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
  min-height: 60px;
  margin-bottom: 8px;
}

.library-games.compact-mode .status-game-card:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* 1. Game cover image (leftmost) */
.library-games.compact-mode .status-game-card img {
  width: auto;
  height: 60px;
  object-fit: contain;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 4px;
}

.library-games.compact-mode .status-indicator img {
  cursor: default;
}

.library-games.compact-mode .status-game-info {
  position: relative; /* Add this if not already present */
  padding-left: 10px;
}

.library-games.compact-mode .status-game-title {
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #333 !important;
  line-height: 1.3 !important;
  margin: 0 !important;
  cursor: pointer;
  word-wrap: break-word;
  max-width: 280px;
}

@media (max-width: 880px) {
  .library-games.compact-mode,
  .library-games.list-mode {
    columns: 1;
    min-width: auto !important;
  }
}

@media (max-width: 1000px) {
  .library-games.compact-mode .status-game-title {
    font-size: 13px !important;
  }

  .library-games.compact-mode .status-game-info {
    max-width: 65%;
  }
}

@media (max-width: 400px) {
  .library-games.compact-mode .status-game-title {
    font-size: 11px !important;
  }
  .library-games.compact-mode .status-game-info {
    max-width: 60%;
  }
}
body.dark .library-games.compact-mode .status-game-title {
  color: #fff !important;
}

.library-game-options {
  display: inline-block;
  /*transform: translateY(2px); /* Adjust this value as needed */
}

/* 3. Game option/status buttons */
.library-games.compact-mode .status-game-controls {
  display: flex;
  gap: 2px;
  align-items: center;
  position: absolute;
  right: 12px;
}

.library-games.compact-mode .library-control-container {
  height: 32px;
  width: 32px;
  align-content: center;
}

/* Mobile gallery controls - always visible */
@media (max-width: 1000px) {
  .gallery-game-controls {
    opacity: 1 !important;
    position: static;
    margin-top: 8px;
    justify-content: center;
  }

  .library-games.compact-mode .library-control-container {
    height: auto;
  }

  .gallery-item:hover .gallery-game-controls {
    opacity: 1 !important;
  }
}

/* Compact mode adjustments */
.library-games.compact-mode .status-game-controls .control-btn {
  width: 22px;
  height: 22px;
  overflow: initial;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center !important;
  padding: 0;
}

body.dark .library-games.compact-mode .status-game-controls .control-btn {
  color: #fff;
  align-items: center;
}

/* Dark mode adjustments */
body.dark .library-games.compact-mode .status-game-card {
  background: rgba(255, 255, 255, 0.05);
}

body.dark .library-games.compact-mode .status-game-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.library-games.compact-mode .options-icon {
  height: 22px !important;
  width: 22px !important;
  display: block !important;
}

.options-icon:hover {
  transform: scale(1.05) !important;
  transition: all 0.2s ease;
}

.library-games.list-mode .status-game-title {
  font-size: 15px !important;
  font-weight: 300 !important;
  color: #000 !important;
  line-height: 1.2;
  margin: 0 !important;
  cursor: pointer;
}

body.dark .library-games.list-mode .status-game-title {
  color: #fff !important;
}

.library-games.list-mode .status-game-meta {
  font-size: 12px;
  color: #444 !important;
  line-height: 1.2;
  margin: 0;
}

.library-games.list-mode .status-game-meta.developer {
  font-weight: 600;
  color: #444 !important;
  margin-top: 2px;
}

body.dark .library-games.list-mode .status-game-meta {
  color: #999 !important;
}

body.dark .library-games.list-mode .status-game-meta.developer {
  color: #aaa !important;
}

.library-games.list-mode .status-game-controls {
  position: absolute;
  bottom: 15px;
  right: 15px;
  display: flex;
  flex-shrink: 0;
}

/*------------------------------------------------------------------------
 LIGHTBOX
------------------------------------------------------------------------*/
/* Prevents zoom of UI when lightbox is active */
body.lightbox-active {
  touch-action: none !important;
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}

#lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none !important; /* Hidden by default */
  z-index: 10000;
  justify-content: center;
  align-items: center;
}

#lightbox-overlay.active {
  display: flex !important; /* Only show when active */
}

#lightbox-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

/* Lightbox Container */
.lightbox-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  touch-action: pinch-zoom pan-x pan-y;
}

/* Lightbox image should handle zoom */
.lightbox-image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  touch-action: pinch-zoom; /* Allow zoom on image specifically */
}

/* Prevent touch manipulation on navigation buttons */
.lightbox-nav,
.lightbox-close {
  touch-action: manipulation; /* Prevents zoom on buttons */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Navigation Buttons - FIXED */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 24px;
  font-weight: normal;
  font-family: Arial, sans-serif;
  width: 45px;
  height: 45px;
  min-width: 45px;
  min-height: 45px;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  flex-shrink: 0;
  line-height: 1;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.05);
}

.lightbox-nav.prev {
  left: 10px;
  transform: translateY(-50%) translateX(-1px); /* Fine-tune left arrow */
}

.lightbox-nav.next {
  right: 10px;
  transform: translateY(-50%) translateX(1px); /* Fine-tune right arrow */
}

.lightbox-nav.prev:hover {
  transform: translateY(-50%) translateX(-1px) scale(1.1);
}

.lightbox-nav.next:hover {
  transform: translateY(-50%) translateX(1px) scale(1.1);
}

.lightbox-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox-close {
  position: absolute;
  top: -50px;
  right: -10px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 0;
  font-weight: normal;
  font-family: Arial, sans-serif;
  width: 45px;
  height: 45px;
  min-width: 45px;
  min-height: 45px;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  flex-shrink: 0;
  line-height: 1;
}

.lightbox-close::after {
  content: '×';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 30px;
  line-height: 1;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Image Counter */
.lightbox-counter {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0, 0, 0, 0.5);
  padding: 16px;
  border-radius: 20px;
  font-size: 14px;
  backdrop-filter: blur(10px);
}

/* Thumbnails Strip */
.lightbox-thumbnails {
  position: absolute;
  bottom: -120px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  max-width: 90vw;
  overflow-x: auto;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.lightbox-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.lightbox-thumbnail:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

.lightbox-thumbnail.active {
  opacity: 1;
  border-color: #007bff;
}

/* Prevent iOS zoom and scrolling issues in lightbox */
.lightbox-overlay.active {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation; /* Prevents zoom but allows pan */
}

/* Prevent body scroll when lightbox is open */
body.lightbox-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* MOBILE LIGHTBOX - CLEAN VERSION */

/* Hide all controls on mobile/touch devices */
@media (hover: none) and (pointer: coarse) {
  .lightbox-nav,
  .lightbox-close,
  .lightbox-thumbnails {
    display: none !important;
  }
}

/* Mobile lightbox - full screen experience with tappable areas */
@media (max-width: 1000px) {
  /* Use dynamic viewport units that adjust to URL bar */
  .lightbox-overlay.active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
    min-height: 90vh !important;
    max-height: none !important;
    z-index: 10000 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: rgba(0, 0, 0, 0.95) !important;
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: manipulation !important;
  }

  /* Container adapts to real available height */
  .lightbox-overlay.active .lightbox-container {
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height */
    max-width: 100% !important;
    max-height: 100vh !important;
    max-height: 100dvh !important; /* Dynamic viewport height */
    padding: 0 15px !important;
    margin: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box !important;
    position: relative !important;
  }

  /* Image sizing relative to container - more conservative for landscape */
  .lightbox-overlay.active .lightbox-image {
    max-width: calc(100vw - 30px) !important;
    max-height: calc(100vh - 30px) !important;
    max-height: calc(100dvh - 30px) !important; /* Dynamic viewport height */
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    touch-action: pinch-zoom !important;
    display: block !important;
    margin: auto !important;
    position: relative !important;
  }

  /* Swipe hint */
  .lightbox-swipe-hint {
    position: absolute !important; /* Changed from fixed to absolute */
    bottom: 35% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    color: white !important;
    background: rgba(0, 0, 0, 0.8) !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    opacity: 0.8 !important;
    pointer-events: none !important;
    animation: fadeInOut 3s ease-in-out !important;
    z-index: 10001 !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  @keyframes fadeInOut {
    0%,
    100% {
      opacity: 0;
    }
    20%,
    80% {
      opacity: 0.8;
    }
  }
}

@media (max-width: 1000px) and (orientation: landscape) {
  .lightbox-overlay.active .lightbox-image {
    max-width: calc(100vw - 30px) !important;
    max-height: calc(100dvh - 30px) !important; /* Use dvh for better mobile support */
    object-fit: contain !important;
    width: auto !important;
    height: auto !important;
    position: relative !important;
  }

  /* Also ensure the overlay uses dynamic viewport height */
  .lightbox-overlay.active {
    height: 100dvh !important; /* Dynamic viewport height */
  }

  .lightbox-swipe-hint {
    display: none !important;
  }
}

/* Alternative fallback for browsers that don't support dvh */
@media (max-width: 1000px) and (orientation: landscape) {
  .lightbox-overlay.active .lightbox-image {
    max-height: calc(100vh - 60px) !important; /* Extra padding for mobile UI */
  }
}

/* Wider breakfpoint for phones in lansdcape view to ensure counter is hidden */
@media (max-width: 1024px) {
  .lightbox-counter {
    display: none !important;
  }
}

/* Alternative approach - if you want larger tappable areas */
@media (max-width: 1000px) {
  .lightbox-container.large-tap-area {
    padding: 40px 20px !important; /* More generous tappable areas */
  }

  .lightbox-container.large-tap-area .lightbox-image {
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100vh - 80px) !important; /* More top/bottom space */
  }
}

/* Force hide controls on any small screen */
@media (max-width: 1000px), (max-height: 568px) {
  .lightbox-nav,
  .lightbox-close,
  .lightbox-thumbnails {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* Fallback for browsers that don't support dvh */
@supports not (height: 100dvh) {
  @media (max-width: 1000px) {
    .lightbox-overlay.active {
      height: 100vh !important;
      /* Force minimal UI on iOS Safari */
      height: calc(100vh - env(keyboard-inset-height, 0px)) !important;
    }

    .lightbox-container {
      height: 100vh !important;
      max-height: calc(100vh - env(keyboard-inset-height, 0px)) !important;
    }

    .lightbox-image {
      max-height: calc(100vh - 30px - env(keyboard-inset-height, 0px)) !important;
    }
  }
}

/*-----------------------------------------------------
    RETRO FLOOR GRID
------------------------------------------------------*/
/* lIGHT MODE */

/*
.grid-floor {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 30%;
  pointer-events: none;
  z-index: -1;
  background: linear-gradient(to top, #25254b 0%, #aaaac4 50%, rgba(216, 216, 234, 0.5) 80%, transparent 100%);
  overflow: hidden;
}

.grid-floor::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200vw;
  height: 100%;
  background-image:
    linear-gradient(90deg, rgba(26, 26, 28, 0.8) 1px, transparent 2px),
    linear-gradient(0deg, rgba(26, 26, 28, 0.8) 1px, transparent 2px);
  background-size: 80px 40px;
  background-position: 0 0;

  transform: translateX(-50%) perspective(400px) rotateX(60deg);
  transform-origin: bottom center;

  opacity: 0.8;
  mask: linear-gradient(to top, black 0%, transparent 70%);
  -webkit-mask: linear-gradient(to top, black 0%, transparent 70%);
}

.grid-floor::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(100, 150, 255, 0.3);
  box-shadow: 0 0 10px rgba(100, 150, 255, 0.2);
}
*/

@media (max-width: 1000px) {
  .grid-floor {
    height: 40%;
    background: linear-gradient(to top, #82829a 20%, #ccc 50%, rgba(216, 216, 234, 0.4) 80%, transparent 100%);
  }

  .grid-floor::before {
    background-image:
      linear-gradient(90deg, rgba(26, 26, 28, 0.8) 1px, transparent 1px),
      linear-gradient(0deg, rgba(26, 26, 28, 0.8) 1px, transparent 1px);
    background-size: 60px 40px;
  }
}

body.dark .grid-floor {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 650px;
  pointer-events: none;
  z-index: -1;
  background: linear-gradient(to top, #1a1a2e 0%, #2d2d4a 50%, rgba(45, 45, 74, 0.5) 80%, transparent 100%);
  overflow: hidden;
}

body.dark .grid-floor::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200vw; /* Much wider than viewport */
  height: 100%;
  background-image: 
        /* Use background-size to control spacing instead of repeating gradients */
    linear-gradient(90deg, rgba(100, 150, 255, 0.3) 1px, transparent 1px),
    linear-gradient(0deg, rgba(100, 150, 255, 0.4) 1px, transparent 1px);
  background-size: 80px 40px; /* Fixed grid size */
  background-position: 0 0;

  transform: translateX(-50%) perspective(400px) rotateX(60deg);
  transform-origin: bottom center;

  opacity: 0.8;
  mask: linear-gradient(to top, black 0%, transparent 70%);
  -webkit-mask: linear-gradient(to top, black 0%, transparent 70%);
}

body.dark .grid-floor::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(100, 150, 255, 0.3);
  box-shadow: 0 0 10px rgba(100, 150, 255, 0.2);
}

/*---------------------------------------------------
    MOBILE SEARCH
----------------------------------------------------*/
/* Mobile Search Bar - only visible on mobile */
.mobile-search-container {
  display: none; /* Hidden by default */
  margin: 20px 0 30px 0;
  width: 100%;
  max-width: 400px;
}

.mobile-search-bar {
  display: flex;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

body.dark .mobile-search-bar {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.mobile-search-input-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

#mobile-search-input {
  padding: 0;
  padding-right: 28px;
  width: 100%;
  border: none;
  background: transparent;
  color: #333;
  font-size: 16px; /* Prevent zoom on iOS */
  height: 32px;
}

body.dark #mobile-search-input {
  color: #fff;
}

#mobile-search-input:focus {
  outline: none;
}

#mobile-search-input::placeholder {
  color: rgba(0, 0, 0, 0.6);
}

body.dark #mobile-search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.mobile-clear-search-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(0, 0, 0, 0.6);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mobile-clear-search-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.9);
}

body.dark .mobile-clear-search-btn {
  color: rgba(255, 255, 255, 0.6);
}

body.dark .mobile-clear-search-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.mobile-search-bar button {
  padding: 6px 16px;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  background: rgba(0, 123, 255, 0.8);
  color: #fff;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 500;
  height: 32px;
  min-width: 70px;
  transition: all 0.15s ease;
}

.mobile-search-bar button:hover {
  background: linear-gradient(135deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%);
}

body.dark .mobile-search-bar button:hover {
  background: rgba(0, 123, 255, 1);
}

/* Show mobile search only on mobile screens */
@media (max-width: 600px) {
  .mobile-search-container {
    display: block;
  }

  /* Update the placeholder text for mobile */
  .search-placeholder p {
    display: none; /* Hide "Search for any game above" text on mobile */
  }
}
/* Mobile Search Header - appears above results */
.mobile-search-header {
  display: none; /* Hidden by default */
  margin-bottom: 15px;
}

.back-to-search-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.back-to-search-btn:hover {
  background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.back-to-search-btn:active {
  transform: translateY(0);
}

/* Show mobile search header only on mobile */
@media (max-width: 600px) {
  .mobile-search-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
}

/*------------------------------------------------------------------------
  iOS-STYLE MOBILE MENU SYSTEM
------------------------------------------------------------------------*/
.mobile-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.mobile-popup.hidden {
  opacity: 0;
  pointer-events: none;
}

.mobile-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
}

@media (max-width: 1000px) {
  .mobile-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
  }
}

.mobile-popup-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border-radius: 12px;
  width: 85%;
  max-width: 320px;
  max-height: 70vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 1);
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.mobile-popup.hidden .mobile-popup-content {
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
}
.mobile-popup:not(.hidden) .mobile-popup-content {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.mobile-popup-header {
  padding: 16px 20px 8px;
  border-bottom: 1px solid #e5e5e7;
  position: relative;
}

.menu-title-container {
  display: inline-grid;
  align-items: center;
  min-height: 32px;
}

.menu-back-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #007aff;
  padding: 4px 8px 4px 0;
  margin-right: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
}

.menu-back-btn:hover {
  background: rgba(0, 122, 255, 0.1);
  border-radius: 8px;
}

.menu-title-content {
  flex: 1;
}

.menu-title-content h3,
.mobile-popup-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1d1d1f;
  line-height: 1.2;
  text-align: center;
}

.menu-subtitle {
  font-size: 14px;
  color: #86868b;
  margin-top: 10px;
  font-weight: 400;
  text-align: center;
}

.mobile-popup-close {
  position: absolute;
  top: 10px;
  left: 10px;
  background: none;
  border: none;
  font-size: 24px;
  color: #86868b;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.mobile-popup-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

.mobile-popup-body {
  overflow-y: auto;
  max-height: calc(85vh - 80px);
  padding: 0 0 20px;
}

button[onclick*='setGameStatusFromSearch'] {
  padding: 0px 20px !important;
}

.mobile-action-section {
  margin: 16px 0 0;
}

.mobile-action-section:first-child {
  margin-top: 8px;
}

.mobile-action-section h4 {
  margin: 0 0 8px;
  padding: 0 20px;
  font-size: 13px;
  color: #86868b;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-align: center;
}

.mobile-action-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 6px 20px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative;
  border-bottom: 1px solid #f2f2f7;
  min-height: 36px;
  box-sizing: border-box;
}

.mobile-action-item:last-child {
  border-bottom: none;
}

.mobile-action-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.mobile-action-item:active {
  background: rgba(0, 0, 0, 0.08);
}

.mobile-action-item.active {
  background: rgba(0, 122, 255, 0.1);
}

.mobile-action-item.selected {
  background: rgba(52, 199, 89, 0.1);
}

.mobile-action-item.in-list {
  background: rgba(0, 0, 0, 0.02);
  pointer-events: none;
}

.mobile-action-item.clear-option {
  color: #ff3b30;
}

.mobile-action-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  border-radius: 8px;
  background: none !important;
  flex-shrink: 0;
  background: none;
}

.mobile-action-icon.create-new {
  background: none;
  color: #e5e5e5 !important;
  font-size: 30px;
  font-weight: 300;
  align-items: baseline;
  border-radius: 30px;
}

body.dark .mobile-action-icon.create-new {
  color: white;
  background: linear-gradient(135deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%) !important;
}

/* Dark theme support for mobile action icons */
body.dark .mobile-action-icon img[src*='platform.png'] {
  content: url('assets/images/icons/platform-dark.png');
}

body.dark .mobile-action-icon img[src*='compact.png'] {
  content: url('assets/images/icons/compact-dark.png');
}

body.dark .mobile-action-icon img[src*='status.png'] {
  content: url('assets/images/icons/status-dark.png');
}

.mobile-action-icon .emoji-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* Dark mode styling for sm_controller.png */
body.dark .emoji-icon[src*='sm_controller.png'] {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

body.dark .status-indicator img[src*='sm_controller.png'],
body.dark .no-status-icon img[src*='sm_controller.png'] {
  filter: brightness(0) invert(1);
  opacity: 0.7;
}

/* Game list no status icon scaling and theming */
.status-indicator .emoji-icon[src*='status.png'] {
  transform: scale(0.8) !important;
}

/* Dark mode support for status.png in game lists */
body.dark .status-indicator .emoji-icon[src*='status.png'] {
  content: url('assets/images/icons/status-dark.png') !important;
  transform: scale(0.8) !important;
}

.mobile-action-text {
  flex: 1;
  min-width: 0;
}

.mobile-action-name {
  font-size: 14px;
  font-weight: 300;
  color: #1d1d1f;
  margin: 0;
  line-height: 1.2;
}

.mobile-action-description {
  font-size: 14px;
  color: #86868b;
  margin: 2px 0 0;
  line-height: 1.2;
}

.mobile-action-checkmark {
  color: #34c759;
  font-size: 18px;
  font-weight: 600;
  margin-left: 8px;
  flex-shrink: 0;
}

.mobile-action-arrow {
  color: #c7c7cc;
  font-size: 18px;
  margin-left: 8px;
  flex-shrink: 0;
}

/*------------------------------------------------------------------------
  DARK MODE SUPPORT
------------------------------------------------------------------------*/
body.dark .mobile-popup-content {
  background: #333;
}

body.dark .mobile-popup-header {
  border-bottom-color: #555;
}

body.dark .menu-title-content h3,
body.dark .mobile-popup-header h3 {
  color: #ffffff;
}

body.dark .menu-subtitle {
  color: #8e8e93;
}

body.dark .mobile-popup-close {
  color: #8e8e93;
}

body.dark .mobile-popup-close:hover {
  background: rgba(255, 255, 255, 0.05);
}

body.dark .mobile-action-section h4 {
  color: #8e8e93;
}

body.dark .mobile-action-item {
  border-bottom-color: #555;
}

body.dark .mobile-action-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

body.dark .mobile-action-item:active {
  background: rgba(255, 255, 255, 0.1);
}

body.dark .mobile-action-item.in-list {
  background: rgba(255, 255, 255, 0.02);
}

body.dark .mobile-action-name {
  color: #ffffff;
}

body.dark .mobile-action-description {
  color: #8e8e93;
}

body.dark .mobile-action-arrow {
  color: #48484a;
}

/*------------------------------------------------------------------------
  MOBILE BUTTON SIZING (Keep existing touch targets)
------------------------------------------------------------------------*/
@media (max-width: 1000px) {
  .search-control-btn,
  .control-btn,
  .popup-control-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 22px !important;
  }

  #game-popup-content .control-btn {
    width: 30px !important;
    height: 30px !important;
    align-items: center;
    color: #000 !important;
  }

  .library-games.list-mode .status-game-controls .control-btn,
  .library-games.compact-mode .status-game-controls .control-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 22px !important;
  }

  .search-game-controls .search-control-btn {
    width: 40px !important;
    height: 25px !important;
    font-size: 30px !important;
    border: none !important;
    transform: scale(1.15) !important;
  }

  .game-controls .control-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
    text-indent: -1.5px;
  }
}

@media (max-width: 399px) {
  .search-control-btn,
  .control-btn,
  .popup-control-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 20px !important;
  }

  .library-games.list-mode .status-game-controls .control-btn,
  .library-games.compact-mode .status-game-controls .control-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
    text-indent: -3px;
    padding-top: 5px;
  }

  .game-controls .control-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 22px !important;
    text-indent: -1.5px;
  }

  .search-game-controls .search-control-btn {
    width: 40px !important;
    height: 25px !important;
    font-size: 20px !important;
    padding-top: 0 !important;
    text-indent: 0 !important;
  }

  #game-popup .close-btn {
    top: 20px;
    right: 15px;
  }

  #game-popup-content .game-control-container {
    right: 14px;
  }

  .popup-title {
    font-size: 18px;
  }
}

/*------------------------------------------------------------------------
  MOBILE LIBRARY FILTER & statistics 
------------------------------------------------------------------------*/
/* Mobile Library Header */
.mobile-library-header {
  padding: 8px 0;
  margin-bottom: 10px;
  display: none; /* Hidden by default, show on mobile */
}

.status-pill {
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  white-space: nowrap;
  text-align: center;
}

.status-pill:hover {
  background: #555;
  border-color: #777;
}

.status-pill.active {
  background: rgba(0, 0, 0, 0.1);
}

.status-pill .icon {
  font-size: 16px;
}

/* Mobile statistics/Status Toggle - Upper Right Viewport */
.mobile-statistics-toggle {
  display: none; /* Hidden by default, show on mobile */
  z-index: 1000;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  padding: 3px;
  z-index: auto;
}

.mobile-toggle-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #000;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark .mobile-toggle-btn {
  color: #fff;
}

.mobile-toggle-btn:hover {
  background: #444;
  color: white;
}

.mobile-toggle-btn:last-child,
.mobile-toggle-btn:last-child.active {
  padding-top: calc(var(--button-padding, 8px) - 3px);
  padding-bottom: calc(var(--button-padding, 8px) + 0px);
}

.mobile-toggle-btn.active {
  background: linear-gradient(135deg, rgb(102, 126, 234) 0%, rgb(118, 75, 162) 100%);
  color: white;
}

.compact-mode .game-title {
  font-size: 14px;
}

@media (max-width: 1000px) {
  .library-games.list-mode .status-game-title {
    font-size: 13px !important;
  }
}

.compact-mode .developer-name,
.compact-mode .release-date {
  font-size: 12px;
}

.compact-mode .game-number {
  font-size: 12px;
}

/* Mobile Media Queries */
@media (max-width: 1000px) {
  /* Show mobile components */
  .mobile-library-header {
    display: flex;
  }

  .mobile-statistics-toggle {
    display: flex;
  }

  /* Hide desktop sidebar */
  .library-sidebar {
    display: none;
  }

  /* Hide desktop view toggle */
  .library-view-toggle {
    display: none;
  }

  /* Hide the big white status text */
  .library-status-text,
  .current-status-display,
  .status-header {
    display: none !important;
  }

  .status-pill {
    padding: 8px !important;
    gap: 2px !important;
    border-radius: 8px !important;
  }

  .status-pill .icon {
    font-size: 16px;
  }

  /* Enhanced compact view scaling on mobile */
  .compact-mode .control-btn {
    transform: scale(0.75);
    font-size: 11px;
    margin: 0 -4px;
    right: 18px;
  }

  .compact-mode .game-title {
    font-size: 13px;
  }

  .compact-mode .developer-name,
  .compact-mode .release-date {
    font-size: 11px;
  }
}

@media (max-width: 400px) {
  .mobile-toggle-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .mobile-statistics-toggle {
    top: 15px;
    right: 15px;
  }

  .status-pill {
    font-size: 11px;
  }

  .status-pill .icon {
    font-size: 14px;
    line-height: 1.1;
  }

  /* Further scaling for very small screens */
  .compact-mode .control-btn {
    transform: scale(0.7);
  }
}

/*------------------------------------------------------------------------
  MINI GALLERY VIEW - LIBRARY
------------------------------------------------------------------------*/
/* Mini Gallery Mode - Very Dense Grid */
.library-games.mini-gallery-mode {
  grid-template-columns: repeat(6, 1fr);
  display: grid;
  gap: 8px;
  align-content: start; /* Prevent vertical stretching */
}

.library-games.mini-gallery-mode .status-game-card {
  border-radius: 6px;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.03);
  aspect-ratio: 3/4; /* Maintain consistent card ratio */
  height: auto; /* Let aspect-ratio control height */
}

body.dark .library-games.mini-gallery-mode .status-game-card {
  background: rgba(255, 255, 255, 0.05);
}

.library-games.mini-gallery-mode .status-game-card:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* Image fills entire mini card */
.library-games.mini-gallery-mode .status-game-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  cursor: pointer;
}

.library-games.mini-gallery-mode .status-game-title {
  display: none !important;
}

.library-games.mini-gallery-mode .status-game-card:hover .status-game-title {
  display: none !important;
}

/* Very minimal controls - only show on hover */
.library-games.mini-gallery-mode .status-game-controls {
  display: none !important;
}

.library-games.mini-gallery-mode .status-game-card:hover .status-game-controls {
  display: none !important;
}

/* Hide status-game-info completely in gallery and mini gallery mode */
.library-games.mini-gallery-mode .status-game-info {
  display: none !important;
}

.library-games.mini-gallery-mode .options-icon {
  height: 18px !important;
  width: 18px !important;
  right: -4px;
  bottom: -4px;
}

/*------------------------------------------------------------------------
  MINI GALLERY VIEW - GAME LISTS
------------------------------------------------------------------------*/
/* Mini Gallery for Game Lists */
#game-list.mini-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  padding: 15px 0;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

#game-list.mini-gallery .list-result-card,
#game-list.mini-gallery .gallery-item {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  aspect-ratio: 3/4;
  background: rgba(255, 255, 255, 0.03);
  margin: 0;
  padding: 0;
  display: block;
}

body.dark #game-list.mini-gallery .list-result-card,
body.dark #game-list.mini-gallery .gallery-item {
  background: rgba(255, 255, 255, 0.05);
}

#game-list.mini-gallery .list-result-card:hover,
#game-list.mini-gallery .gallery-item:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* Image fills entire mini card */
#game-list.mini-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: filter 0.2s ease;
  display: block;
}

#game-list.mini-gallery .list-result-card:hover img,
#game-list.mini-gallery .gallery-item:hover img {
  filter: brightness(1.1);
}

/* Mini gallery title overlay */
#game-list.mini-gallery .game-title,
#game-list.mini-gallery .gallery-title {
  display: none;
}

#game-list.mini-gallery .list-result-card:hover .game-title,
#game-list.mini-gallery .gallery-item:hover .gallery-title {
  opacity: 1;
  transform: translateY(0);
}

/* Mini gallery controls */
#game-list.mini-gallery .game-controls,
#game-list.mini-gallery .gallery-game-controls {
  display: none !important;
}

#game-list.mini-gallery .list-result-card:hover .game-controls,
#game-list.mini-gallery .gallery-item:hover .gallery-game-controls {
  opacity: 1;
}

.library-games.mini-gallery-mode .control-btn,
#game-list.mini-gallery .control-btn {
  display: none !important;
}

#game-list.mini-gallery .control-btn {
  width: 20px;
  height: 20px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  backdrop-filter: blur(5px);
  border-radius: 3px;
}

#game-list.mini-gallery .control-btn:hover {
  transform: scale(1.1);
}

/* Hide other info in mini gallery */
#game-list.mini-gallery .game-info,
#game-list.mini-gallery .game-list-item,
#game-list.mini-gallery .developer-name,
#game-list.mini-gallery .release-date,
#game-list.mini-gallery .game-number {
  display: none;
}

/*------------------------------------------------------------------------
  RESPONSIVE ADJUSTMENTS FOR MINI GALLERY
------------------------------------------------------------------------*/
/* Desktop - more columns */
@media (min-width: 1200px) {
  .library-games.mini-gallery-mode,
  #game-list.mini-gallery {
    gap: 8px;
    margin: 0 auto;
    justify-content: center;
  }
}

/* Tablet */
@media (max-width: 1200px) and (min-width: 1000px) {
  .library-games.mini-gallery-mode,
  #game-list.mini-gallery {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 10px;
    margin: 0 auto;
    justify-content: center;
  }
}

/* Mobile */
@media (max-width: 1000px) {
  .library-games.mini-gallery-mode,
  #game-list.mini-gallery {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 0;
    margin: 0 auto;
    justify-content: center;
    width: 100%;
    min-height: auto !important;
  }

  .library-games.mini-gallery-mode .status-game-title,
  #game-list.mini-gallery .game-title,
  #game-list.mini-gallery .gallery-title {
    display: none;
  }

  .library-games.mini-gallery-mode .status-game-controls,
  #game-list.mini-gallery .game-controls,
  #game-list.mini-gallery .gallery-game-controls {
    opacity: 1;
  }
}

/*------------------------------------------------------------------------
  USER SUBSCRIPTION, PAYMENT PROCESSING, STRIPE 
------------------------------------------------------------------------*/
.subscription-section {
  margin-top: 30px;
  padding: 20px 0;
  border-top: 1px solid #eee;
}

.subscription-section h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 20px;
}

.subscription-section p {
  margin: 0 0 20px 0;
  color: #666;
  font-size: 14px;
}

.pro-features {
  background: #555;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.features-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 400px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .features-list {
    grid-template-columns: 1fr;
  }
}

.features-list .feature {
  font-size: 14px;
  color: #fff;
  text-align: left;
  padding: 0;
  margin: 0;
}

.subscription-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .subscription-plans {
    grid-template-columns: 1fr;
  }
}

.plan-card {
  position: relative;
  background: #555;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.plan-card:hover {
  border-color: #007bff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.plan-card.popular {
  text-transform: uppercase;
  border: 1px solid #ccc;
}

.plan-card.popular:hover {
  border-color: #28a745;
}

.plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #28a745;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

.plan-name {
  font-size: 18px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 10px;
}

.plan-price {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 5px;
}

.plan-price span {
  font-size: 14px;
  color: #fff;
  font-weight: normal;
}

.plan-savings {
  color: #28a745;
  font-size: 12px;
  font-weight: bold;
  margin-top: 5px;
}

.plan-features {
  text-align: left;
  margin-bottom: 20px;
}

.feature {
  font-size: 14px;
  color: #555;
  margin-bottom: 8px;
  padding-left: 0;
}

.subscribe-btn {
  width: 100%;
  background: #007bff;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
}

.subscribe-btn:hover {
  background: #0056b3;
}

.plan-card.popular .subscribe-btn {
  background: #28a745;
}

.plan-card.popular .subscribe-btn:hover {
  background: #1e7e34;
}

.current-subscription {
  background: #e8f5e8;
  border: 1px solid #28a745;
  border-radius: 8px;
  padding: 15px;
}

.subscription-status {
  display: flex;
  align-items: center;
  gap: 15px;
}

.status-icon {
  font-size: 24px;
}

.status-info {
  flex: 1;
}

.status-title {
  font-weight: bold;
  color: #28a745;
  margin-bottom: 4px;
}

.status-details {
  font-size: 14px;
  color: #666;
}

.manage-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.manage-btn:hover {
  background: #0056b3;
}

/* Payment Modal Styles */
.payment-popup {
  max-width: 500px;
  width: 90%;
  padding: 15px;
}

.payment-summary {
  background: #555;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
}

.plan-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#payment-element {
  margin-bottom: 20px;
}

.payment-actions {
  display: flex;
  gap: 10px;
}

.payment-actions button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.payment-actions button[type='button'] {
  background: #6c757d;
  color: white;
}

.payment-actions button[type='submit'] {
  background: #28a745;
  color: white;
  position: relative;
}

.payment-actions button[type='submit']:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff3d;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.payment-security {
  text-align: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.security-badge {
  font-size: 14px;
  color: #28a745;
  margin-bottom: 5px;
}

.security-text {
  font-size: 12px;
  color: #666;
}

.hidden {
  display: none !important;
}

/* Mobile touch support for drag and drop */
.list-result-card,
.gallery-item {
  touch-action: pan-y; /* Allow vertical scroll, enable drag */
  user-select: none; /* Prevent text selection during drag */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  /* Smooth transitions for graceful repositioning */
  transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
}

/* Active dragging state - handled by JavaScript inline styles */
.list-result-card.dragging-active,
.gallery-item.dragging-active {
  cursor: grabbing !important;
}

/* Drag placeholder styling */
.drag-placeholder {
  background: transparent !important;
  border: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
}



/* Mobile-specific improvements */
@media (max-width: 768px) {
  .list-result-card,
  .gallery-item {
    /* Larger touch target */
    min-height: 80px;
    touch-action: pan-y; /* Allow vertical scrolling but not horizontal */
  }
  
  
  /* Prevent accidental selections on mobile */
  .list-result-card *,
  .gallery-item * {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
}

/* Smooth hover disabled during drag */
body.dragging .list-result-card:hover,
body.dragging .gallery-item:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Sortable.js drag and drop styles */
.sortable-ghost {
  opacity: 0.4;
}

.sortable-chosen {
  opacity: 0.8 !important;
  transform: scale(1.02) !important;
  background: #3d3d3d !important;
  border: 2px solid #007bff !important;
  border-radius: 8px !important;
  z-index: 9999 !important;
}

.sortable-drag {
  opacity: 0.8 !important;
  transform: scale(1.02) !important;
  background: #3d3d3d !important;
  border: 2px solid #007bff !important;
  border-radius: 8px !important;
  z-index: 9999 !important;
}

.sortable-fallback {
  opacity: 0.8 !important;
  transform: scale(1.02) !important;
  background: #3d3d3d !important;
  border: 2px solid #007bff !important;
  border-radius: 8px !important;
  z-index: 9999 !important;
}

/* Custom drag and drop styles */
.custom-dragging {
  cursor: grabbing !important;
  opacity: 1 !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3) !important;
  border: 2px solid #007bff !important;
  transition: transform 0.2s ease !important;
}

body.dark .custom-dragging {
  border-color: #0d6efd !important;
  background: rgba(13, 110, 253, 0.05) !important;
}

/* Removed .dragging-source - not needed for new drag system */

.drag-placeholder {
  border: 2px dashed #007bff !important;
  background: rgba(0, 123, 255, 0.1) !important;
  box-sizing: border-box;
  border-radius: 8px;
  margin: 5px;
  opacity: 1 !important;
  visibility: visible !important;
}

body.dark .drag-placeholder {
  border-color: #0d6efd !important;
  background: rgba(13, 110, 253, 0.1) !important;
}

/* Ensure placeholder works in all views */
.gallery .drag-placeholder,
.mini-gallery .drag-placeholder {
  display: inline-block;
  vertical-align: top;
}

.list .drag-placeholder {
  display: block;
  width: calc(100% - 10px);
}

/* Remove default transition - will be applied dynamically during drag */
