:root{
  --page-bg: #0f1a24;
  --card-bg: #1e2933;
  --card-text: #e6eef8;
  --muted: #9aa4ad;
  --muted-2: #cbd5e1;
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --danger: #b91c1c;
  --overlay-start: rgba(2,6,23,0.55);
  --overlay-end: rgba(2,6,23,0.85);
  --shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Authentication Styles */
.auth-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--page-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-form {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  margin: 1rem;
}

.auth-form h2 {
  color: var(--card-text);
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.auth-form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 1rem;
  border: 1px solid #374151;
  border-radius: 8px;
  background: var(--page-bg);
  color: var(--card-text);
  font-size: 1rem;
  box-sizing: border-box;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.auth-form button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 1rem;
}

.auth-form button:hover {
  background: var(--accent-strong);
}

.auth-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-form p {
  text-align: center;
  color: var(--muted);
  margin: 0;
}

.auth-form a {
  color: var(--accent);
  text-decoration: none;
}

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

body {
  font-family: Arial, sans-serif;
  background: var(--page-bg);
  color: var(--card-text);
  margin: 0;
  padding: 0; /* Remove padding to allow full-width navigation */
  height: 100vh; /* Fixed height to prevent scrolling */
  overflow: hidden; /* Prevent page scrolling */
  box-sizing: border-box;
  /* iOS Safari optimizations */
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

/* Container for the main left/right columns */
.main-container {
  display: flex;
  gap: 24px; /* Slightly increased gap for better visual separation */
  padding: 0 20px 20px 20px; /* Padding on sides and bottom, but not top */
  flex: 1; /* Take remaining space after navigation */
  min-height: 0; /* Allow flex shrinking */
  max-width: 1400px; /* Set maximum width for centering - same as search/stats */
  width: 100%; /* Use full available width up to max */
  margin: 0 auto; /* Center the container */
  box-sizing: border-box;
  overflow: visible; /* Allow inner components to handle scrolling */
  height: 100%; /* Use full available height */
}

/* Large screen optimization - same as search/stats */
@media (min-width: 1200px) {
  .main-container {
    gap: 32px; /* Even more gap on large screens */
    padding: 0 40px 20px 40px; /* More padding on large screens */
  }
  
  .left {
    flex: 0 0 450px; /* Slightly wider on large screens */
  }
}

/* Mobile optimization - same as search/stats */
@media (max-width: 768px) {
  .main-container {
    max-width: none; /* Remove max-width constraint on mobile */
    padding: 0 16px 0 16px; /* Remove bottom padding to use full height */
    /* Use same gap as desktop for consistency */
    height: 100%; /* Use full available height on mobile */
    max-height: 100%; /* Ensure it doesn't exceed viewport */
    overflow: hidden; /* Prevent main container overflow, let children handle scrolling */
    flex: 1; /* Take remaining space after navigation */
    position: relative; /* Ensure proper positioning */
    overscroll-behavior: contain; /* Prevent overscroll from bubbling up to body */
    overscroll-behavior-y: contain; /* Specifically prevent vertical overscroll */
  }
}

/* iOS Safari safe area support */
@supports (padding-top: env(safe-area-inset-top)) {
  body {
    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));
  }
}

/* Mobile-first responsive layout */
@media (max-width: 768px) {
  html, body {
    height: 100vh; /* Use full viewport height */
    max-height: 100vh; /* Ensure it doesn't exceed viewport */
    overflow: hidden; /* Prevent any scrolling */
    position: fixed; /* Fix position to prevent scroll */
    width: 100%; /* Ensure full width */
    overscroll-behavior: none; /* Completely disable overscroll behavior */
    overscroll-behavior-y: none; /* Specifically disable vertical overscroll */
  }
  
  body {
    flex-direction: column;
    padding: 10px;
    gap: 10px;
    /* iOS Safari viewport fix */
    position: fixed; /* Reinforce fixed positioning */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
  
  /* iOS Safari safe area adjustments for mobile */
  @supports (padding-top: env(safe-area-inset-top)) {
    body {
      padding-top: max(10px, env(safe-area-inset-top));
      padding-left: max(10px, env(safe-area-inset-left));
      padding-right: max(10px, env(safe-area-inset-right));
      padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
  }
}

/* Modern pill-shaped navigation bar */
.mobile-nav {
  display: flex;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px; /* Full pill shape for the container */
  padding: 8px;
  margin: 4px auto 16px auto; /* Explicit auto centering */
  position: sticky;
  top: 4px; /* Much higher position */
  z-index: 100;
  width: 500px; /* Wider on desktop */
  max-width: calc(100vw - 40px); /* Responsive fallback for small screens */
  position: relative; /* For the sliding indicator */
  gap: 8px; /* Add spacing between buttons */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth transitions */
}

/* Search mode styling */
.mobile-nav.search-mode {
  width: 600px; /* Wider for search */
  max-width: calc(100vw - 20px); /* More space for search */
  padding: 4px; /* Less padding for search input */
}

/* Navigation search container (hidden by default) */
.nav-search-container {
  display: none; /* Hidden by default */
  width: 100%;
  position: relative;
  flex: 1; /* Take full width like buttons do */
}

/* Navigation close button */
.nav-close-btn {
  position: absolute;
  right: 16px;
  top: 0;
  bottom: 0;
  margin: auto 0;
  height: 24px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  width: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 0;
  font-size: 24px;
  font-weight: bold;
  line-height: 1;
}

.nav-close-btn:hover {
  color: white;
  transform: scale(1.1);
}

.nav-close-btn:active {
  transform: scale(0.95);
}

/* Navigation search input (hidden by default) */
.nav-search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-size: 16px;
  padding: 14px 50px 14px 32px; /* Match button padding exactly */
  border-radius: 50px;
  font-family: inherit;
  box-sizing: border-box;
  height: 100%;
}

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

/* Show search container when in search mode */
.mobile-nav.search-mode .nav-search-container {
  display: flex;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

/* Hide navigation buttons when in search mode (but not the back button) */
.mobile-nav.search-mode > button {
  display: none;
}

/* Hide sliding indicator when in search mode */
.mobile-nav.search-mode::before {
  opacity: 0;
  pointer-events: none;
}

/* Sliding background indicator */
.mobile-nav::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  width: calc((100% - 16px - 32px) / 5); /* Total width minus padding (16px) and gaps (32px), divided by 5 buttons */
  height: calc(100% - 16px);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 25px;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  z-index: 0;
}

/* Move indicator based on active button */
.mobile-nav[data-active="games"]::before {
  left: 8px; /* First position */
}

.mobile-nav[data-active="upnext"]::before {
  left: calc(8px + 1 * ((100% - 16px - 32px) / 5 + 8px)); /* Second position */
}

.mobile-nav[data-active="stats"]::before {
  left: calc(8px + 2 * ((100% - 16px - 32px) / 5 + 8px)); /* Third position */
}

.mobile-nav[data-active="search"]::before {
  left: calc(8px + 3 * ((100% - 16px - 32px) / 5 + 8px)); /* Fourth position */
}

.mobile-nav[data-active="profile"]::before {
  left: calc(8px + 4 * ((100% - 16px - 32px) / 5 + 8px)); /* Fifth position */
}

.mobile-nav button {
  background: transparent; /* Always transparent now */
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 14px 0; /* Remove horizontal padding to match indicator exactly */
  border-radius: 25px;
  font-size: 13px; /* Slightly larger font for wider bar */
  font-weight: 600;
  transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Only animate color */
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
  text-align: center;
  z-index: 1; /* Above the sliding background */
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav button.active {
  color: white; /* Only change text color, background handled by sliding indicator */
  background: transparent; /* Remove background since sliding indicator handles it */
  box-shadow: none; /* Remove shadow since sliding indicator handles it */
  transform: none; /* Remove transform since sliding indicator handles it */
}

.mobile-nav button:hover:not(.active) {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.05); /* Subtle hover for non-active buttons */
}

/* Subtle animation on active state change */
.mobile-nav button:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .mobile-nav {
    position: -webkit-sticky; /* WebKit prefix for iOS Safari */
    position: sticky; /* Make sticky on mobile */
    top: 10px; /* Account for body padding */
    margin: 0 auto 12px auto; /* Remove top margin to prevent movement */
    width: calc(100vw - 40px); /* Account for body padding (10px × 2) + some margin (10px × 2) */
    max-width: none; /* Full width on mobile */
    padding: 6px;
    z-index: 100; /* Ensure it stays on top */
  }
  
  .mobile-nav.search-mode {
    width: calc(100vw - 32px); /* Slightly wider for search on mobile */
    margin: 12px auto; /* Use auto margins for proper centering */
    padding: 4px;
  }
  
  /* Remove mobile-specific button styling - use desktop styling instead */
  
  .nav-search-input {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px 20px;
    /* Disable focus outline to prevent overlap */
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }
  
  .nav-back-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* Stats Toggle Styles */
.stats-toggle-container {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 4px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}

.stats-toggle-container::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

.stats-toggle-container[data-active="social"]::before {
  transform: translateX(100%);
}

.stats-toggle-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 14px 0;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
  text-align: center;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-toggle-btn.active {
  color: white;
}

.stats-toggle-btn:hover:not(.active) {
  color: rgba(255, 255, 255, 0.9);
}

/* Social Stats Components */
.social-games-section {
  margin-top: 0;
  background: transparent;
  height: calc(100vh - 200px); /* Reduced height to show bottom rounding properly */
  max-height: calc(100vh - 200px); /* Ensure it doesn't exceed viewport bounds */
  display: flex;
  flex-direction: column;
  overflow: visible; /* Allow inner components to handle scrolling */
}

/* User view toggle specific styles */
.user-view-toggle {
  margin-top: 16px;
  margin-bottom: 16px;
  flex-shrink: 0; /* Prevent shrinking on small viewports */
  min-height: 48px; /* Ensure minimum touch target size */
}

/* User toggle sliding indicator */
.user-view-toggle::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

/* Move indicator when stats button is active */
.user-view-toggle[data-active="stats"]::before {
  transform: translateX(100%);
}

/* Responsive behavior for user view toggle */
@media (max-width: 768px) {
  .user-view-toggle {
    margin: 12px 0 16px 0;
    min-height: 44px; /* iOS minimum touch target */
  }
  
  .user-view-toggle .stats-toggle-btn {
    padding: 12px 8px;
    font-size: 13px;
  }
}

@media (max-height: 600px) {
  .user-view-toggle {
    margin: 8px 0 12px 0;
    min-height: 40px;
  }
  
  .user-view-toggle .stats-toggle-btn {
    padding: 10px 8px;
    font-size: 12px;
  }
}

/* Ensure the right column inside social games section has proper height */
.social-games-section .right {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  max-height: calc(100vh - 281px); /* Further reduced to ensure bottom rounding shows */
  min-height: 0; /* important for children to be able to scroll */
  overflow: visible; /* allow inner scrolling element to control overflow */
}

/* Ensure table wrapper inside social games section is scrollable and can shrink/grow */
.social-games-section .table-wrapper {
  flex: 1 1 auto; /* take remaining vertical space inside .right */
  min-height: 0; /* allow to be smaller than content and enable overflow */
  max-height: none; /* don't artificially cap; rely on flex sizing */
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 0 0 20px 20px; /* Match main table bottom rounding */
}

.browse-users-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.9);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.browse-users-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  color: white;
}

.community-header {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.back-to-social-stats-btn,
.back-to-users-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.back-to-social-stats-btn:hover,
.back-to-users-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  color: white;
}

.community-header h2 {
  margin: 0;
  margin-bottom: 3px;
  color: white;
  font-size: 24px;
  font-weight: 600;
}

.user-join-info {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  font-style: italic;
  margin-bottom: 5px;
}

/* Mobile community header adjustments */
@media (max-width: 768px) {
  .community-header {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 12px 16px;
    padding-bottom: 12px;
    align-items: center;
  }
  
  .back-to-social-stats-btn,
  .back-to-users-btn {
    grid-row: span 2;
    grid-column: 1;
    padding: 6px 10px;
    font-size: 13px;
    align-self: center;
  }
  
  .community-header h2 {
    grid-column: 2;
    grid-row: 1;
    font-size: 20px;
    margin: 0;
    line-height: 1.2;
  }
  
  .user-join-info {
    grid-column: 2;
    grid-row: 2;
    font-size: 13px;
    margin: 0;
  }
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.user-card {
  background: rgba(0,0,0,0.03); /* Same as stats cards and even table rows */
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.user-info h3 {
  margin: 0 0 8px 0;
  color: white;
  font-size: 18px;
  font-weight: 600;
}

.user-stats {
  display: flex;
  gap: 16px;
}

.user-stat {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.user-latest-game {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin-top: 8px;
}

.user-meta {
  margin-top: 8px;
}

.join-date {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-style: italic;
}

.view-games-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-start;
  padding: 0;
}

.user-summary {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.user-summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
}

.summary-stat {
  text-align: center;
}

.summary-value {
  display: block;
  color: white;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

.summary-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-games-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-game-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.3s ease;
}

.user-game-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.game-main-info {
  flex: 1;
}

.game-title {
  margin: 0 0 8px 0;
  color: white;
  font-size: 16px;
  font-weight: 500;
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.game-platform,
.game-genre {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.game-status {
  padding: 2px 8px;
  border-radius: 4px;
}

.game-status.completed {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.game-status.dnf {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.game-stats {
  text-align: right;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.game-rating {
  margin-bottom: 4px;
}

.rating-stars {
  color: var(--accent);
  margin-right: 4px;
}

.game-hours,
.game-date {
  margin-bottom: 4px;
}

.no-games {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  padding: 40px;
}

/* Left side: Search + Results */
.left {
  flex: 0 0 420px; /* Fixed width instead of percentage for better control */
  min-width: 380px; /* Minimum width to ensure usability */
  max-width: 480px; /* Maximum width to prevent too wide search results */
}

/* When right column is hidden (search or stats page active), left takes full width */
.right.mobile-hidden + .left,
.main-container:has(.right.mobile-hidden) .left {
  flex: 1; /* Take full width */
  min-width: auto; /* Remove width constraints */
  max-width: none;
}

/* Keep the left column fixed and make results scroll internally */
.left {
  display: flex;
  flex-direction: column;
  height: 100%; /* Use full available height from main-container */
  overflow: hidden; /* Prevent content from expanding beyond container */
}

/* Navigation-based hiding - works on all screen sizes */
.left.mobile-hidden,
.right.mobile-hidden {
  display: none;
}

/* Mobile responsive left column */
@media (max-width: 768px) {
  .left {
    flex: 1;
    max-width: none;
    min-width: auto; /* Remove desktop minimum width constraints */
    height: 100%; /* Use full available height */
    max-height: calc(100vh - 80px); /* Account for navigation height */
    overflow: hidden; /* Prevent content from expanding beyond container */
  }
  
  /* Allow stats section to scroll on mobile */
  .stats-section {
    height: 100%; /* Use full height of left column */
    overflow: hidden; /* Let stats-container handle scrolling */
  }
  
}

/* Search and Stats sections */
.search-section, .stats-section, .profile-section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevent section from scrolling */
  width: 100%;
  box-sizing: border-box;
  height: 100%; /* Use full available height from parent */
  min-height: 0; /* Allow flex shrinking */
}

.stats-container {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 24px; /* Increased padding to match card styling */
  color: white;
  overflow-y: auto; /* Allow vertical scrolling */
  overflow-x: hidden; /* Prevent horizontal scrolling */
  flex: 1; /* Take available space in stats-section */
  width: 100%; /* Ensure stats container uses full width */
  box-sizing: border-box;
  min-height: 0; /* Allow flex shrinking */
  /* Flex layout for direct children */
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Smooth scrolling */
  scroll-behavior: smooth;
  /* Custom scrollbar for better aesthetics */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.profile-container {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 24px; /* Increased padding to match card styling */
  color: white;
  overflow-y: auto; /* Allow vertical scrolling */
  overflow-x: hidden; /* Prevent horizontal scrolling */
  width: 100%; /* Ensure stats container uses full width */
  box-sizing: border-box;
  min-height: 0; /* Allow flex shrinking */
  /* Smooth scrolling */
  scroll-behavior: smooth;
  /* Custom scrollbar for better aesthetics */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}


/* Mobile stats container adjustments */
@media (max-width: 768px) {
  .stats-container {
    padding: 16px; /* Reduced padding on mobile */
    overflow-y: auto; /* Enable scrolling on mobile */
    height: 100%; /* Use full available height */
    flex: 1; /* Take available space in flex container */
    max-height: calc(100vh - 120px); /* Account for navigation and padding */
  }
  
  /* Ensure stats section can scroll on mobile */
  .stats-section {
    overflow: hidden; /* Let container handle scrolling */
    height: 100%; /* Use full height */
  }
}

/* Custom scrollbar for webkit browsers */
.stats-container::-webkit-scrollbar {
  width: 6px;
}

.stats-container::-webkit-scrollbar-track {
  background: transparent;
}

.stats-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.stats-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.stats-container h2 {
  color: white;
  font-size: 20px; /* Slightly larger */
  font-weight: 600;
}

.stats-content {
  
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%; /* Ensure stats content uses full width */
  box-sizing: border-box;
}

/* Ensure user stats content also has proper gaps */
#userStatsContent {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.stats-loading {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

/* Stats Cards */
.stat-card {
  background: rgba(0,0,0,0.03); /* Same as even table rows */
  backdrop-filter: blur(8px); /* Add backdrop filter for consistency */
  border-radius: 20px; /* Much more rounded */
  padding: 20px; /* More generous padding */
  border: 1px solid rgba(255,255,255,0.12);
}




.stat-card h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--card-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--card-text);
  margin: 0 0 4px 0;
}

.stat-label {
  font-size: 12px;
  color: var(--muted-2);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%; /* Ensure grid uses full width */
}

/* Enhanced stats grid for larger screens */
@media (min-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr); /* 3 columns on larger screens */
    gap: 16px; /* More gap on larger screens */
  }
}

@media (min-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr); /* 4 columns on very large screens */
    gap: 16px; /* Even more gap */
  }
}

/* Responsive stats grid */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
    /* Use same gap as desktop for consistency */
  }
}

/* Single column stats */
.stat-card.full-width {
  grid-column: 1 / -1;
}

/* Top items list */
.top-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
}

.top-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.top-list li:last-child {
  border-bottom: none;
}

.top-list .item-name {
  color: var(--card-text);
  font-size: 13px;
}

.top-list .item-count {
  color: var(--muted);
  font-size: 12px;
}

/* Progress Bars */
.progress-bar {
  width: 100%;
  height: 8px; /* Slightly taller */
  background: rgba(255,255,255,0.12);
  border-radius: 10px; /* More rounded */
  overflow: hidden;
  margin: 12px 0 6px 0; /* Increased margins */
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #22c55e);
  border-radius: 10px; /* More rounded */
  transition: width 0.8s ease;
}

/* Time Period Stats */
.time-period {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px; /* More rounded */
  padding: 16px; /* Increased padding */
  margin: 0 0 16px 0; /* Increased margin */
  border: 1px solid rgba(255,255,255,0.08);
}

.time-period:last-child {
  margin-bottom: 0;
}

.time-period h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--card-text);
  font-weight: 600;
}

.time-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
}

.time-stat {
  color: var(--muted);
}

.time-stat strong {
  color: var(--card-text);
  font-weight: 600;
}

/* Highlight Stats */
.highlight-stat {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.highlight-stat .stat-value {
  background: linear-gradient(135deg, #a855f7, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Achievement-style badges */
.achievement {
  display: flex;
  align-items: center;
  gap: 16px; /* Increased gap */
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px; /* Much more rounded */
  padding: 16px; /* Increased padding */
  margin: 12px 0; /* Increased margin */
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-left: 4px solid #fbbf24; /* Slightly thicker border */
  transition: all 0.3s ease;
}

.achievement:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(251, 191, 36, 0.4);
}

.achievement-icon {
  font-size: 22px; /* Slightly larger */
  width: 40px; /* Larger icon area */
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251, 191, 36, 0.25);
  border-radius: 50%;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.achievement-text {
  flex: 1;
}

.achievement-title {
  font-size: 13px;
  color: var(--card-text);
  font-weight: 600;
  margin: 0 0 2px 0;
}

.achievement-desc {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

.search-container {
  width: 100%;
  max-width: 100%; /* Prevent expansion beyond container */
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px; /* Much more rounded like navigation */
  overflow: hidden;
  margin-bottom: 20px;
  flex-shrink: 0; /* Prevent search bar from shrinking */
  box-sizing: border-box; /* Include padding in width calculation */
}

.search-container input {
  width: 100%;
  padding: 16px 20px; /* More generous padding */
  font-size: 16px;
  border: none;
  outline: none;
  background: transparent;
  color: white;
  border-radius: 25px; /* Match container */
}


.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  padding: 1px; /* Small padding to prevent content borders from being obscured by rounding */
  padding-right: 7px; /* 1px base + 6px for scrollbar space */
  /* Use flex to fill remaining space like the table */
  flex: 1 1 auto;
  min-height: 0; /* Allow flexbox to work properly */
  width: 100%; /* Ensure results use full width */
  box-sizing: border-box;
}

/* Shared visual card style used by search results and details */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 25px; /* Much more rounded like navigation */
  padding: 20px 24px 70px 24px; /* Increased padding for more premium feel */
  width: 100%;
  max-width: 100%; /* Prevent cards from expanding beyond container */
  box-sizing: border-box; /* Include padding in width calculation */
  overflow: hidden; /* Handle any content overflow */
  background-size: cover;
  background-position: center center;
  color: var(--card-text);
  overflow: hidden;
  min-height: 120px;
  max-height: 300px; /* Prevent cards from taking full height */
  flex: 0 0 auto; /* Don't grow to fill space */
  transition: all 0.6s ease;
}

/* Better overlay implementation using background layering */
.card {
  /* Combine the dimming overlay directly with background-image */
  background-blend-mode: normal;
  position: relative;
}

/* Regular cards get a full overlay (same as details card) */
.card:not(#detailsCard) {
  background-image: 
    linear-gradient(var(--overlay-start) 0%, var(--overlay-start) 100%),
    var(--card-bg-image, none);
}

/* Details card gets a full overlay */
#detailsCard {
  background: 
    linear-gradient(var(--overlay-start), var(--overlay-start)),
    var(--card-bg-image, none);
  background-size: 
    100% 100%,
    var(--bg-scale, cover);
  background-position: 
    center center,
    var(--bg-position, center center);
  background-repeat: no-repeat, no-repeat;
  background-attachment: local, local;
  background-blend-mode: normal;
  margin-bottom: 20px; /* Space from search container below */
  position: relative;
  border: none; /* Remove border from details card */
  
  /* Better image scaling with fallbacks */
  --bg-scale: cover;
  --bg-position: center center;
}

/* Improved scaling for landscape images */
#detailsCard[data-image-aspect="landscape"] {
  --bg-scale: cover;
  --bg-position: center top;
}

/* Improved scaling for portrait images */
#detailsCard[data-image-aspect="portrait"] {
  --bg-scale: cover;
  --bg-position: center center;
}

/* Improved scaling for square images */
#detailsCard[data-image-aspect="square"] {
  --bg-scale: cover;
  --bg-position: center center;
}

/* Alternative scaling mode for better fit */
#detailsCard.scale-contain {
  --bg-scale: contain;
}

#detailsCard.scale-cover {
  --bg-scale: cover;
}

#detailsCard.scale-fill {
  --bg-scale: 100% 100%;
}

/* Social details card - matches main details card styling */
#socialDetailsCard {
  background: 
    linear-gradient(var(--overlay-start), var(--overlay-start)),
    var(--card-bg-image, none);
  background-size: 
    100% 100%,
    var(--bg-scale, cover);
  background-position: 
    center center,
    var(--bg-position, center center);
  background-repeat: no-repeat, no-repeat;
  background-attachment: local, local;
  background-blend-mode: normal;
  margin-bottom: 20px;
  position: relative;
  height: 350px; /* Fixed height for collapsed state */
  min-height: 350px; /* Match fixed height */
  max-height: 350px; /* Enforce maximum height for collapsed state */
  overflow: hidden; /* Handle content overflow gracefully */
  border: none;
  
  /* Better image scaling with fallbacks */
  --bg-scale: cover;
  --bg-position: center center;
}

/* Improved scaling for social details card */
#socialDetailsCard[data-image-aspect="landscape"] {
  --bg-scale: cover;
  --bg-position: center top;
}

#socialDetailsCard[data-image-aspect="portrait"] {
  --bg-scale: cover;
  --bg-position: center center;
}

#socialDetailsCard[data-image-aspect="square"] {
  --bg-scale: cover;
  --bg-position: center center;
}

#socialDetailsCard.scale-contain {
  --bg-scale: contain;
}

#socialDetailsCard.scale-cover {
  --bg-scale: cover;
}

#socialDetailsCard.scale-fill {
  --bg-scale: 100% 100%;
}

/* Allow social details card to expand when description is expanded */
#socialDetailsCard:has(.details-description.expanded),
#socialDetailsCard.expanded {
  height: auto; /* Allow natural height when expanded */
  max-height: none; /* Remove height constraint when expanded */
  min-height: 350px; /* Maintain minimum height */
  overflow: hidden; /* Keep overflow hidden to maintain border-radius clipping */
  border-radius: 25px !important; /* Force rounded corners to be maintained when expanded */
}

#socialDetailsCard .card-content {
  gap: 12px;
}

#socialDetailsCard img {
  display: none; /* using background-image instead */
}

/* Social details card text styling - match main details card */
#socialDetailsCard .details-title {
  font-size: 24px;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0;
  line-height: 1.2;
  word-break: break-word;
  white-space: normal;
  transition: all 0.5s ease;
}

#socialDetailsCard .details-meta {
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.4;
  margin: 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#socialDetailsCard .meta-badge {
  background: rgba(255,255,255,0.08);
  color: var(--muted-2);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  font-weight: 500;
  display: inline-block;
}

/* Easter egg badges in social details card - override default social styling */
#socialDetailsCard .easter-egg-badge {
  background: rgb(64, 65, 29) !important; /* Custom dark green background */
  color: gold !important; /* Gold text */
  border: 1px solid gold !important; /* Subtle gold border */
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5) !important; /* Golden glow effect */
  font-weight: 600 !important; /* Bolder text for emphasis */
}

#socialDetailsCard .details-description {
  margin: 0;
  color: var(--muted-2);
  font-size: 14px;
  line-height: 1.5;
  transition: all 0.5s ease;
}

#socialDetailsCard .dates {
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  white-space: nowrap;
}

#socialDetailsCard .rating {
  color: gold;
  font-size: 13px;
  margin: 0;
}

#socialDetailsCard .details-actions .status {
  background: var(--status-bg, linear-gradient(135deg, #198754, #157347));
  color: var(--status-text, white);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(25, 135, 84, 0.3);
}

/* Social details card actions have same layout as main details */
#socialDetailsCard > .details-actions {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 20px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* Responsive scaling adjustments */
@media (max-width: 768px) {
  #detailsCard {
    --bg-scale: cover;
    --bg-position: center center;
  }
  
  /* Better mobile scaling for landscape images */
  #detailsCard[data-image-aspect="landscape"] {
    --bg-position: center top;
  }
  
  /* Better mobile scaling for portrait images */
  #detailsCard[data-image-aspect="portrait"] {
    --bg-position: center center;
  }
}

/* High DPI displays */
@media (min-resolution: 2dppx) {
  #detailsCard {
    background-size: 
      100% 100%,
      var(--bg-scale, cover);
  }
  
  .mobile-game-modal .details-card {
    background-size: 100% 100%, var(--bg-scale, cover);
  }
}

.card .card-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  color: var(--card-text);
  min-height: 0;
  z-index: 2;
  gap: 8px;
  position: relative;
  transition: all 0.4s ease;
}

.card .card-top {
  display: flex;
  align-items: flex-start;
  gap: 0;
  flex-direction: column;
}

.card h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #f1f5f9;
  line-height: 1.2;
  word-break: break-word;
  white-space: normal;
}

/* Details card gets larger title */
#detailsCard h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 6px 0;
}

/* Make details-title inherit the same styling as card h2 */
.details-title {
  font-size: 24px;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0; /* Remove bottom margin since header handles spacing */
  line-height: 1.2;
  word-break: break-word;
  white-space: normal;
  transition: all 0.5s ease;
}

.meta-badges {
  display: flex;
  gap: 6px;
  margin: 0;
  flex-wrap: wrap;
  align-items: flex-start;
}

.meta-badges .badge {
  background: rgba(255,255,255,0.08);
  color: var(--muted-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.card .card-content p.description {
  margin: 8px 0 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  min-height: calc(1.4em * 3); /* Reserve space for exactly 3 lines */
}

/* Details card gets larger description */
#detailsCard .card-content p.description {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px; /* Match card content gap */
  transition: all 0.4s ease;
  overflow: hidden;
  color: var(--muted-2) !important; /* Force same color as meta info values */
}

/* Animate the description content changes */
#detailsCard .card-content {
  transition: all 0.3s ease;
}

/* Read More/Less button */
.read-more-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit; /* Match description text size */
  font-weight: 400; /* Normal weight like description text */
  padding: 0;
  text-decoration: underline;
  transition: opacity 0.2s ease;
  margin-top: 0; /* No gap - continue on same line conceptually */
  margin-left: 4px; /* Small space after the "..." */
  line-height: inherit; /* Match description line height */
  display: inline; /* Make it truly inline with text */
}

.read-more-btn:hover {
  opacity: 0.8;
}




/* Card actions positioned at bottom */
.card > .card-actions {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 16px;
  z-index: 3;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
}

/* Details card actions have different layout */
#detailsCard > .card-actions {
  left: 24px;
  right: 24px;
  bottom: 20px;
  justify-content: space-between;
  gap: 12px;
}

.add {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 20px; /* More rounded */
  cursor: pointer;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

.add:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.add-to-wishlist {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.add-to-wishlist:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.15);
}

/* Button styling for card actions */
.card-actions .edit {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px; /* Much more rounded */
  padding: 10px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.card-actions .edit:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.card-actions .status {
  background: linear-gradient(135deg, #198754, #157347);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 18px; /* Much more rounded */
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(25, 135, 84, 0.3);
  transition: all 0.3s ease;
}

.card-actions .status:hover {
  background: linear-gradient(135deg, #157347, #0f5132);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(25, 135, 84, 0.4);
}

.details-actions .edit,
.details-actions .add-to-games,
.details-actions .status {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px; /* Much more rounded */
  padding: 10px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.details-actions .edit:hover,
.details-actions .add-to-games:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.details-actions .status {
  background: var(--status-bg, linear-gradient(135deg, #198754, #157347));
  color: var(--status-text, white);
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(25, 135, 84, 0.3);
}

/* Right side: Table + details */
.right {
  flex: 1; /* Take remaining space, now much more since left has fixed width */
  min-width: 600px; /* Ensure minimum usable width for table */
  display: flex;
  flex-direction: column;
  gap: 0; /* Remove gap so search and table connect seamlessly */
  min-height: 0; /* important for children to be able to scroll */
  transition: all 0.3s ease;
  overflow: visible; /* allow inner scrolling element to control overflow */
  border-radius: 20px; /* Round the entire container */
}

/* Mobile responsive right column */
@media (max-width: 768px) {
  .right {
    flex: 1;
    max-width: none;
    min-width: auto; /* Remove desktop minimum width constraints */
    height: 100%; /* Use full available height */
    max-height: 100%; /* Ensure it uses full height */
    overflow: hidden; /* Prevent overflow, let table wrapper handle scrolling */
    display: flex;
    flex-direction: column;
  }
  
  /* On mobile games page, hide the details card completely */
  .right #detailsCard {
    display: none !important;
  }
}

.table-wrapper {
  flex: 1 1 auto; /* take remaining vertical space inside .right */
  min-height: 0; /* allow to be smaller than content and enable overflow */
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 0; /* No gap since search is separate */
  margin-bottom: 0; /* Ensure no bottom margin */
  transition: all 0.3s ease, opacity 0.2s ease;
  scrollbar-gutter: stable;
  position: relative;
  box-sizing: border-box;
  border-radius: 0 0 20px 20px; /* Match table bottom rounding */
  scroll-snap-type: none; /* Disable scroll snapping to prevent row visibility issues */
}




/* Mobile table improvements */
@media (max-width: 768px) {
  .table-wrapper {
    flex: 1;
    min-height: 0; /* Remove minimum height constraint */
    max-height: none; /* Remove max-height constraint to use full screen */
    height: 100%; /* Use full available height */
    margin-top: 0; /* Remove any top margin to connect with search */
    overflow-x: hidden; /* Prevent horizontal scrolling */
    overflow-y: auto; /* Ensure vertical scrolling */
    padding-right: 0; /* Remove padding, let scrollbar overlay content */
    border-radius: 0 0 20px 20px; /* Ensure bottom rounding matches */
    scroll-snap-type: none; /* Disable snap scroll on mobile */
    overscroll-behavior: none; /* Completely disable overscroll behavior */
    overscroll-behavior-y: none; /* Specifically disable vertical overscroll */
    overscroll-behavior-x: none; /* Disable horizontal overscroll too */
    -webkit-overflow-scrolling: touch; /* Enable momentum scrolling on iOS */
    /* Additional iOS Safari specific fixes */
    -webkit-transform: translateZ(0); /* Force hardware acceleration */
    transform: translateZ(0); /* Force hardware acceleration */
    /* Prevent the rubber band effect */
    overscroll-behavior-block: none; /* Prevent block direction overscroll */
    overscroll-behavior-inline: none; /* Prevent inline direction overscroll */
  }
  
  .table-search {
    margin-bottom: 0; /* Remove any bottom margin */
    padding: 12px 16px; /* Base padding to match main-container mobile padding */
    border-radius: 20px 20px 0 0; /* Ensure top rounding */
    border-bottom: none; /* Remove bottom border to connect seamlessly */
  }
  
  /* Make table more touch-friendly and show only title column */
  table {
    width: 100%;
    min-width: unset; /* Remove minimum width constraint */
    table-layout: fixed; /* Fix table layout for better width control */
  }
  
  th, td {
    padding: 12px 8px;
    font-size: 14px;
  }
  
  /* Hide all columns except title on mobile */
  .table-wrapper table th:nth-child(2), /* Hours */
  .table-wrapper table td:nth-child(2),
  .table-wrapper table th:nth-child(3), /* Rating */
  .table-wrapper table td:nth-child(3),
  .table-wrapper table th:nth-child(4), /* Start Date */
  .table-wrapper table td:nth-child(4),
  .table-wrapper table th:nth-child(5), /* End Date */
  .table-wrapper table td:nth-child(5),
  .table-wrapper table th:nth-child(6), /* Status */
  .table-wrapper table td:nth-child(6) {
    display: none;
  }
  
  /* Hide entire table header on mobile */
  .table-wrapper table thead {
    display: none;
  }
  
  /* Disable snap alignment on table rows for mobile */
  .table-wrapper tbody tr {
    scroll-snap-align: none;
  }
  
  /* Make title column take full width and handle long text properly */
  .table-wrapper table th:nth-child(1),
  .table-wrapper table td:nth-child(1) {
    width: 100% !important;
    max-width: 0; /* Force text wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
  }
  
  /* Override any desktop column width styles */
  #gamesTable th,
  #gamesTable td,
  #socialGamesTable th,
  #socialGamesTable td {
    width: auto !important;
  }
  
  #gamesTable th:nth-child(1),
  #gamesTable td:nth-child(1) {
    width: 100% !important;
  }
  
  /* Ensure game-name cells are properly styled for mobile */
  td.game-name {
    width: 100% !important;
    max-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    text-align: left;
    padding: 12px 8px;
  }
}

.table-search {
  flex-shrink: 0; /* Don't shrink in flexbox */
  background: rgb(35, 39, 47); /* Solid dark background */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px 20px 0 0; /* Rounded top corners only */
  padding: 12px 10px; /* Match table header padding exactly */
  border-bottom: none; /* Remove bottom border to connect with table */
  position: relative;
  z-index: 10;
  box-sizing: border-box;
  margin-bottom: 0; /* Ensure no bottom margin */
}

.table-search input {
  width: 100%;
  padding: 10px 16px; /* More generous padding */
  font-size: 14px;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border-radius: 20px; /* Very rounded input */
  box-sizing: border-box;
  /* Disable all focus outlines to prevent overlap */
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

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

.table-search input:focus {
  background: rgba(255, 255, 255, 0.15);
  /* Ensure no focus outline or box shadow */
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

/* Small screens: allow horizontal scrolling instead of collapsing columns */
@media (max-width: 700px) {
  .table-wrapper {
    max-height: 75vh; /* Use 75% of viewport height */
    height: 75vh; /* Use 75% of viewport height */
    overflow: auto;
    padding-right: 0; /* Remove padding, let scrollbar overlay content */
    margin-top: 0; /* Ensure no gap between search and table */
    margin-bottom: 16px; /* Add bottom margin for breathing room */
  }
  
  /* Override table layout for mobile single-column display */
  .table-wrapper table {
    width: 100% !important;
    table-layout: auto !important;
    min-width: auto !important; /* Remove 700px minimum width constraint */
  }
  
  /* Fix mobile header positioning and search overlap */
  .table-search {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 15;
    padding: 12px 16px; /* Match mobile main-container padding */
    margin-bottom: 0; /* Remove any bottom margin */
    border-radius: 20px 20px 0 0; /* Ensure proper rounding */
  }
  /* On narrow screens make result cards more compact */
  .card {
    padding: 12px 16px 80px 16px; /* Increased bottom padding from 60px to 80px for more space */
    min-height: 100px;
  }
  
  .card h2 {
    font-size: 16px;
  }
  
  #detailsCard h2 {
    font-size: 20px;
  }
  
  .details-title {
    font-size: 20px;
  }
  
  .card .card-content p.description {
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 11px;
  }
  
  #detailsCard .card-content p.description {
    font-size: 13px;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  
  .details-description {
    font-size: 13px;
  }
  
  .meta-badges .badge {
    font-size: 10px;
    padding: 1px 4px;
  }
  
  .card > .card-actions {
    left: 16px;
    right: 16px;
    bottom: 16px; /* Increased from 12px to provide more space */
  }
  
  #detailsCard {
    display: flex !important;
    flex-direction: column !important;
    padding: 16px 20px 16px 20px !important; /* Override desktop padding */
    height: auto !important; /* Override desktop fixed height */
    max-height: 80vh !important;
    min-height: 300px !important;
    overflow: hidden !important; /* Override desktop overflow */
    margin-bottom: 20px !important; /* Space from search container below */
  }
  
  #detailsCard .card-content {
    flex: 1 !important; /* Take all available space except buttons */
    margin-bottom: 0 !important; /* No margin, use flex gap instead */
    overflow-y: auto !important; /* Allow content to scroll if needed */
    padding-bottom: 20px !important; /* Internal padding for content */
    min-height: 0 !important; /* Allow flex shrinking */
  }
  
  #detailsCard > .card-actions {
    position: relative !important; /* Override desktop absolute positioning */
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    background: transparent !important; /* Remove background */
    padding: 20px 16px !important; /* Increased padding: top/bottom and left/right */
    border-radius: 8px !important;
    margin-top: 32px !important; /* Increased space from content */
    flex-shrink: 0 !important; /* Don't shrink the buttons */
  }
  
  .details-actions {
    position: relative !important; /* Override desktop absolute positioning */
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    background: transparent !important; /* Remove background */
    padding: 0 !important; /* Remove padding */
    border-radius: 8px !important;
    margin-top: 0 !important; /* Remove margin-top */
    flex-shrink: 0 !important; /* Don't shrink the buttons */
  }
  
  /* Remove mobile-specific action button sizing - use desktop sizing instead */
}

/* Details Card: use larger sizing */
#detailsCard {
  padding: 24px 28px 90px 28px; /* increased bottom padding for more space between text and buttons */
  height: 350px; /* Fixed height for collapsed state - increased from 280px */
  min-height: 350px; /* Match fixed height */
  max-height: 350px; /* Enforce maximum height for collapsed state */
  overflow: hidden; /* Handle content overflow gracefully */
  border-radius: 25px !important; /* Force rounded corners to be maintained, matching other cards */
}

/* Allow details card to expand when description is expanded */
#detailsCard:has(.details-description.expanded),
#detailsCard.expanded {
  height: auto; /* Allow natural height when expanded */
  max-height: none; /* Remove height constraint when expanded */
  min-height: 350px; /* Maintain minimum height - increased from 280px */
  overflow: hidden; /* Keep overflow hidden to maintain border-radius clipping */
  border-radius: 25px !important; /* Force rounded corners to be maintained when expanded, matching other cards */
}

#detailsCard .card-content {
  gap: 12px;
}

#detailsCard img {
  display: none; /* using background-image instead */
}





/* Additional styling for details card elements */
.details-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end; /* Bottom align both title and dates */
  gap: 16px;
  margin-bottom: 12px;
}

.details-meta {
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.4;
  margin: 12px 0; /* Add consistent spacing above and below meta */
}

/* Details card and search card meta styling */
#detailsMeta, .card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Style meta items as badges like search cards */
.meta-badge {
  background: rgba(255,255,255,0.08); /* Match search card badge background */
  color: var(--muted-2); /* Match search card badge text color */
  padding: 4px 8px; /* Slightly larger padding than search badges */
  border-radius: 4px;
  font-size: 12px; /* Slightly larger than search badges */
  white-space: nowrap;
  font-weight: 500; /* Medium weight for better readability */
  display: inline-block;
}

/* Easter egg badges - special styling */
.meta-badge.easter-egg-badge {
  background: rgb(64, 65, 29); /* Custom dark green background */
  color: gold; /* Gold text */
  border: 1px solid gold; /* Subtle gold border */
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5); /* Golden glow effect */
  font-weight: 600; /* Bolder text for emphasis */
}

/* Legacy support for old meta structure (can be removed later) */
.meta-title {
  background: rgba(255,255,255,0.08);
  color: var(--muted-2);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  font-weight: 500;
  display: inline-block;
}

.meta-stars {
  font-size: 1.1em;
  line-height: inherit;
  vertical-align: baseline;
  margin-left: 4px;
}

.details-right {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Bottom align with header */
}

.dates {
  color: var(--muted-2); /* Match description text color */
  font-size: 13px; /* Match description text size */
  line-height: 1.4; /* Match description text line height */
  margin: 0;
  white-space: nowrap;
}

.rating {
  color: gold;
  font-size: 13px;
  margin: 0;
}

.details-description {
  margin: 0; /* Remove top margin since meta handles spacing */
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  transition: all 0.5s ease;
}

.details-actions {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 20px;
  z-index: 3;
  display: flex;
  justify-content: flex-start; /* Left align the buttons */
  align-items: center;
  gap: 12px;
}

.details-actions .status {
  margin-left: auto; /* Push status button to the right */
}

/* Selected table row */
table tbody tr.selected {
  background: rgba(59,130,246,0.08);
}

/* Selected table row cells - apply background to cells for proper corner clipping */
table tbody tr.selected td {
  background: rgba(59,130,246,0.08);
}

/* Ensure last row shows selected state on cells, not row */
table tbody tr.selected:last-child {
  background: transparent !important;
}

table tbody tr.selected:last-child td {
  background: rgba(59,130,246,0.08) !important;
}

/* Ensure last row shows hover state */
tbody tr:last-child:hover td {
  background: rgba(59,130,246,0.06) !important;
}

.edit {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 10px 18px;
  border-radius: 18px; /* Much more rounded */
  cursor: pointer;
  color: white;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.edit:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

table {
  width: 100%;
  border-spacing: 0;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  table-layout: fixed; /* Fixed layout prevents overflow */
  border-radius: 0 0 20px 20px; /* Only bottom corners rounded */
  box-sizing: border-box;
  max-width: 100%;
  margin-top: 0; /* Ensure no top margin */
  margin-bottom: 0; /* Ensure no bottom margin */
}

th {
  text-align: left;
  padding: 12px 16px; /* Increased padding for better spacing */
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  color: #ddd;
  height: 48px; /* Fixed height to match td */
  line-height: 24px; /* Consistent line height */
  box-sizing: border-box;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  background: rgb(35, 39, 47);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 5;
  white-space: nowrap;
  font-weight: 600;
  box-sizing: border-box;
  min-height: 45px;
}

/* Remove right border from last header */
th:last-child {
  border-right: none;
}

/* Column alignment */
th:not(:first-child):not(:last-child),
td:not(:first-child):not(:last-child) {
  text-align: left;
}

th:first-child, th:last-child,
td:first-child, td:last-child {
  text-align: left;
}

td {
  padding: 12px 16px; /* Match header padding */
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  height: 48px; /* Fixed height to match th */
  line-height: 24px; /* Consistent line height */
}

/* Allow Title column to wrap */
td:first-child {
  white-space: normal;
  word-wrap: break-word;
  overflow: visible;
  text-overflow: unset;
}

/* Allow Status column full content */
td:last-child {
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
}

/* Remove right border from last cell in each row */
td:last-child {
  border-right: none;
}



tbody tr:last-child td,
tr.last-visible-row td {
  border-bottom: none !important; /* Force removal of bottom border on last visible row */
}

/* Add bottom border radius to last visible row cells */
tbody tr:last-child td:first-child,
tr.last-visible-row td:first-child {
  border-bottom-left-radius: 20px !important; /* Force left corner radius */
}

tbody tr:last-child td:last-child,
tr.last-visible-row td:last-child {
  border-bottom-right-radius: 20px !important; /* Force right corner radius */
}

/* Ensure the row background is rounded */
tbody tr:last-child,
tr.last-visible-row {
  background: transparent !important; /* Remove row background */
}

/* Apply background and rounding to individual cells of last visible row */
tbody tr:last-child td,
tr.last-visible-row td {
  background: inherit; /* Inherit from parent row initially */
}

/* Apply zebra stripe background directly to last visible row cells with rounding */
tbody tr:last-child:nth-child(odd) td,
tr.last-visible-row:nth-child(odd) td {
  background: rgba(255,255,255,0.01);
}

tbody tr:last-child:nth-child(even) td,
tr.last-visible-row:nth-child(even) td {
  background: rgba(0,0,0,0.03);
}

/* Round the corners of the background on specific cells */
tbody tr:last-child td:first-child,
tr.last-visible-row td:first-child {
  border-bottom-left-radius: 20px !important;
}

tbody tr:last-child td:last-child,
tr.last-visible-row td:last-child {
  border-bottom-right-radius: 20px !important;
}

tr:last-child td:first-child,
tr.last-visible-row td:first-child {
  border-bottom-left-radius: 20px; /* Match table border-radius */
}

tr:last-child td:last-child,
tr.last-visible-row td:last-child {
  border-bottom-right-radius: 20px; /* Match table border-radius */
}

/* Add extra right padding to the rightmost column (Status) for both tables */
#gamesTable th:nth-child(6),
#gamesTable td:nth-child(6),
#socialGamesTable th:nth-child(6),
#socialGamesTable td:nth-child(6) {
  padding-right: 32px; /* Extra right padding for rightmost column */
  padding-left: 8px;
}

/* Zebra striping and hover */
tbody tr:nth-child(odd) {
  background: rgba(255,255,255,0.01);
}
tbody tr:nth-child(even) {
  background: rgba(0,0,0,0.03);
}
tbody tr:hover td {
  background: rgba(59,130,246,0.06);
}



.game-status {
  text-align: left;
}

.modal {
  display: none; 
  position: fixed; 
  z-index: 1000; 
  left: 0; 
  top: 0; 
  width: 100%; 
  height: 100%; 
  background: rgba(0,0,0,0.75);
  justify-content: center; 
  align-items: center;
}

.modal-content {
  background: rgba(15, 26, 36, 0.95); /* Semi-transparent background */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 28px; /* Increased from 24px */
  border-radius: 25px; /* Much more rounded to match other elements */
  width: 720px; /* Increased width for better inline field layout */
  max-width: 90vw;
  max-height: 85vh; /* Limit height and add scroll if needed */
  overflow-y: auto; /* Allow scrolling for tall content */
  color: var(--card-text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Mobile modal optimizations */
@media (max-width: 768px) {
  .modal {
    padding: 0;
    align-items: flex-start;
  }
  
  .modal-content {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    padding: 20px;
    margin: 0;
    border-radius: 0;
    border: none;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-sizing: border-box;
  }
  
  /* Stack inline fields vertically on mobile */
  .field-row, .developer-row, .date-row, .platform-genre-row, .platform-genre-rating-row {
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .field-row label, .developer-row label, .date-row label, .platform-genre-row label, .platform-genre-rating-row label {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Larger touch targets for mobile */
  .modal-content input[type="text"],
  .modal-content input[type="number"],
  .modal-content input[type="date"],
  .modal-content select,
  .modal-content textarea {
    min-height: 48px;
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Specific date input fixes for mobile */
  .modal-content input[type="date"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .modal-content textarea {
    min-height: 80px;
  }
  
  /* Better mobile button layout */
  .modal-buttons {
    flex-direction: column;
    gap: 12px;
    margin-top: -15px;
    position: sticky;
    bottom: 0;
    background: rgb(15, 26, 36);
    padding: 12px 0 25px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: -25px;
    padding-bottom: 50px;
  }
  
  .modal-content button {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
    padding: 14px 20px;
  }
  
  /* Star rating mobile improvements */
  .star-rating {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 0 16px;
    min-height: 48px;
    align-items: center;
  }
  
  .star-rating .star {
    font-size: 24px;
    padding: 4px;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    box-sizing: border-box;
  }
  
  /* DNF checkbox mobile improvements */
  .dnf-checkbox-container {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 16px;
    box-sizing: border-box;
  }
  
  
  /* Modal title mobile styling */
  .modal-content h3 {
    font-size: 24px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: -20px;
    background: rgba(15, 26, 36, 0.95);
    backdrop-filter: blur(20px);
    margin-top: -20px;
    padding-top: 20px;
    z-index: 1;
  }
}

/* Extra small mobile screens */
@media (max-width: 480px) {
  .modal-content {
    padding: 16px;
  }
  
  .modal-content h3 {
    font-size: 20px;
    margin-top: -16px;
    padding-top: 16px;
  }
  
  .field-row, .developer-row, .date-row, .platform-genre-row, .platform-genre-rating-row {
    gap: 8px;
  }
  
  .modal-buttons {
    gap: 8px;
    margin-top: 20px;
  }
  
  .modal-content button {
    min-height: 44px;
    font-size: 15px;
    padding: 12px 16px;
  }
}

/* Field group styling for inline layout */
.field-group {
  margin-bottom: 16px; /* Spacing between groups */
}

.field-row, .developer-row, .date-row, .platform-genre-row, .platform-genre-rating-row {
  display: flex;
  gap: 16px; /* Space between inline fields */
  align-items: flex-end; /* Align to bottom of inputs */
  margin-bottom: -20px;
}

.field-row .field-item {
  flex: 1; /* Equal width by default */
}

.field-row .field-item.narrow {
  flex: 0 0 120px; /* Fixed narrow width for small fields */
}

.field-row .field-item.wide {
  flex: 2; /* Take more space */
}

.developer-row label,
.date-row label,
.platform-genre-row label,
.platform-genre-rating-row label {
  flex: 1;
  margin-bottom: 0;
}

/* End date container with integrated DNF toggle */

.dnf-checkbox-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
  font-family: inherit;
  font-size: 16px;
  height: 48px;
  line-height: 1;
  margin-bottom: 0; /* Match other fields */
  justify-content: center;
}

.dnf-checkbox-container:hover {
  border-color: var(--accent);
  background: rgba(255,255,255,0.05);
}

.dnf-checkbox {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.dnf-checkbox:checked {
  background: #dc2626;
  border-color: #dc2626;
}

.dnf-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}


.dnf-checkbox-container:has(.dnf-checkbox:checked) {
  background: rgba(220, 38, 38, 0.2);
  border-color: #dc2626;
}

.dnf-label {
  color: white;
  font-size: 16px;
  font-weight: 500;
  user-select: none;
  margin: 0;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}

/* Privacy Toggle Styles */
.privacy-toggle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  cursor: pointer;
  margin-top: 6px;
  height: 48px;
  box-sizing: border-box;
}

.privacy-toggle-container:hover {
  border-color: var(--accent);
  background: rgba(255,255,255,0.12);
}

.privacy-checkbox {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.privacy-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.privacy-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.privacy-toggle-container:has(.privacy-checkbox:checked) {
  background: rgba(33, 150, 243, 0.15);
  border-color: var(--accent);
}

.privacy-label {
  color: white;
  font-size: 16px;
  font-weight: 500;
  user-select: none;
  margin: 0;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}

.privacy-toggle-label {
  color: white;
  font-size: 16px;
  font-weight: 500;
  user-select: none;
  margin: 0;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}

/* Secret Fields Styles (Konami Code Easter Egg) */
.secret-fields {
  margin-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 18px;
}

.secret-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.secret-toggle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 18px;
  background: rgba(255, 215, 0, 0.1);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  cursor: pointer;
  height: 48px;
  box-sizing: border-box;
  min-width: 180px;
}

.secret-toggle-container:hover {
  border-color: rgba(255, 215, 0, 0.6);
  background: rgba(255, 215, 0, 0.15);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.secret-checkbox {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.secret-checkbox:checked {
  background: gold;
  border-color: gold;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.secret-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #000;
  font-size: 12px;
  font-weight: bold;
}

.secret-toggle-container:has(.secret-checkbox:checked) {
  background: rgba(255, 215, 0, 0.2);
  border-color: gold;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.secret-toggle-label {
  color: gold;
  font-size: 16px;
  font-weight: 600;
  user-select: none;
  margin: 0;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}



.modal-content h3 {
  margin: 0 0 20px 0; /* Reduced bottom margin */
  font-size: 20px; /* Slightly smaller */
  font-weight: 600;
  color: #f1f5f9;
  text-align: left;
}

.modal-content label {
  display: block;
  margin-bottom: 20px; /* Increased spacing between field groups */
  font-size: 13px; /* Slightly smaller */
  font-weight: 500;
  color: var(--muted-2);
}

/* Rating label styling - now matches other labels */
.modal-content label:has(.star-rating) {
  display: block; /* Standard block layout like other labels */
  margin-bottom: 20px; /* Match other label spacing */
}

/* Row layouts for compact design */
.date-row {
  display: flex;
  gap: 12px; /* Reduced gap */
  margin-bottom: 16px;
}

.date-row label {
  flex: 1;
  margin-bottom: 0;
}

.date-row .hours-field {
  flex: 0.5; /* Same width as other fields */
}

.date-row .dnf-checkbox-container {
  flex: 0; /* Smaller for DNF checkbox */
}

/* Hours input styling (now number input) */
.date-row .hours-field input[type="number"] {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  outline: none;
  border-radius: 18px;
  color: white;
  font-size: 16px;
  transition: all 0.3s ease;
  box-sizing: border-box;
  font-family: inherit;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-height: 48px;
  height: 48px;
  text-align: center;
}

.date-row .hours-field input[type="number"]:focus {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
}

/* Mobile styling for time input */
@media (max-width: 768px) {
  .date-row label:first-child, /* Start Date */
  .date-row label:nth-child(2) { /* End Date */
    flex: 0.5; /* Smaller width for date fields on mobile */
  }
  
  .date-row .hours-field {
    flex: 0.5; /* Same width as other fields on mobile */
  }
  
  .date-row .dnf-checkbox-container {
    flex: 0.5; /* Smaller for DNF checkbox on mobile */
  }
  
  .date-row .hours-field input[type="number"] {
    min-height: 48px;
    height: 48px;
    font-size: 16px;
  }
  
  /* Platform-hours-row mobile styling */
  .platform-hours-row {
    flex-wrap: wrap; /* Allow wrapping if needed */
    gap: 8px; /* Smaller gap on mobile */
  }
  
  .platform-hours-row label:nth-child(1) {
    flex: 1; /* Platform gets flexible space */
    min-width: 120px; /* Minimum readable width */
  }

  .platform-hours-row label:nth-child(2) {
    flex: 1; /* Genre gets flexible space */
    min-width: 100px; /* Minimum readable width */
  }

  .platform-hours-row label:nth-child(3) {
    flex: 0 0 80px; /* Hours gets fixed small width */
    max-width: 80px; /* Hard maximum width */
    min-width: 70px; /* Minimum for touch target */
  }
  
  /* Ensure hours input doesn't exceed container */
  .platform-hours-row label:nth-child(3) input[type="number"] {
    width: 100%;
    max-width: 70px; /* Hard limit for iOS */
    min-width: 60px;
    box-sizing: border-box;
    /* iOS Safari specific fixes */
    -webkit-appearance: none;
    appearance: none;
    -webkit-border-radius: 18px;
    border-radius: 18px;
    -webkit-text-size-adjust: 100%;
    font-size: 16px !important; /* Prevent zoom on iOS */
    padding: 12px 4px; /* Minimal horizontal padding for iOS */
    text-align: center;
    /* Prevent iOS from expanding input */
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    /* Force width constraints */
    overflow: hidden;
    white-space: nowrap;
  }
  
  /* Additional iOS input fixes */
  .modal-content input[type="number"] {
    -webkit-appearance: none;
    appearance: none;
    font-size: 16px !important; /* Prevent zoom on iOS */
    -webkit-text-size-adjust: 100%;
  }
}

.platform-genre-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.platform-hours-row label {
  margin-bottom: 0;
}

.platform-hours-row label:nth-child(1) {
  flex: 2; /* Platform gets more space */
}

.platform-hours-row label:nth-child(2) {
  flex: 2; /* Genre gets equal space to platform */
}

.platform-hours-row label:nth-child(3) {
  flex: 1; /* Hours gets less space */
}

.developer-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.developer-row label {
  flex: 1;
  margin-bottom: 0;
}

.modal-content input[type="date"] {
  width: 100%;
  padding: 14px 18px; /* More generous padding to match other inputs */
  margin-top: 10px; /* Increased space between label and input */
  background: rgba(255,255,255,0.08); /* More visible background */
  border: 1px solid rgba(255,255,255,0.15); /* Subtle border */
  outline: none; /* Match search bar - no outline */
  border-radius: 18px; /* Much more rounded */
  color: white; /* Match search bar text color */
  font-size: 16px;
  transition: all 0.3s ease;
  box-sizing: border-box;
  font-family: inherit;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content input[type="time"] {
  margin-top: 10px;
}


.modal-content input[type="text"],
.modal-content input[type="number"],
.modal-content input[type="password"],
.modal-content select,
.modal-content textarea {
  width: 100%;
  padding: 14px 18px; /* More generous padding */
  margin-top: 10px; /* Increased space between label and input */
  background: rgba(255,255,255,0.08); /* More visible background */
  border: 1px solid rgba(255,255,255,0.15); /* Subtle border */
  outline: none; /* Match search bar - no outline */
  border-radius: 18px; /* Much more rounded */
  color: white; /* Match search bar text color */
  font-size: 16px; /* Match search bar font size */
  transition: all 0.3s ease;
  box-sizing: border-box;
  font-family: inherit;
  resize: vertical; /* Allow vertical resize for textarea */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content input[type="date"]:focus,
.modal-content input[type="text"]:focus,
.modal-content input[type="number"]:focus,
.modal-content input[type="password"]:focus,
.modal-content select:focus,
.modal-content textarea:focus {
  outline: none; /* Match search bar - no outline */
  background: rgba(255,255,255,0.12); /* More visible background on focus */
  border-color: var(--accent);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.modal-content select option {
  background: var(--card-bg);
  color: var(--card-text);
}

.modal-content input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 12px; /* Reduced spacing from content */
  justify-content: flex-end; /* Align buttons to the right */
  align-items: center;
}

.dnf-checkbox {
  display: flex !important;
  align-items: center;
  font-size: 12px; /* Smaller font */
  color: var(--muted);
  cursor: pointer;
}

.dnf-checkbox input[type="checkbox"] {
  margin-right: 6px;
  transform: scale(1.0); /* Smaller checkbox */
}

.modal-content button {
  padding: 12px 20px; /* More generous padding */
  border: none;
  border-radius: 18px; /* Much more rounded */
  cursor: pointer;
  font-size: 14px; /* Slightly larger font */
  font-weight: 600;
  transition: all 0.3s ease;
  margin: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#saveDates {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

#saveDates:hover {
  background: linear-gradient(135deg, var(--accent-strong), #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

#addToUpNext {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

#addToUpNext:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

#deleteEdit {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
  box-shadow: 0 4px 15px rgba(185, 28, 28, 0.3);
}

#deleteEdit:hover {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(185, 28, 28, 0.4);
}

#cancelEdit {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--card-text);
}

#cancelEdit:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

/* Star Rating Styles - Updated to match input field aesthetic */
.star-rating {
  width: fit-content; /* Only as wide as contents */
  padding: 0px 18px 4px 18px;
  margin-top: 10px; /* Match other inputs spacing */
  background: rgba(255,255,255,0.08); /* More visible background */
  border: 1px solid rgba(255,255,255,0.15); /* Subtle border */
  border-radius: 18px; /* Much more rounded */
  display: flex;
  gap: 10px; /* Slightly more gap for better spacing */
  align-items: center;
  justify-content: flex-start;
  transition: all 0.3s ease;
  box-sizing: border-box;
  height: 48px; /* Increased height to match new padding */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}


.star {
  font-size: 20px; /* Smaller, more subtle */
  color: rgba(255,255,255,0.3); /* Subtle default color */
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  padding: 4px; /* Add some click area */
  border-radius: 3px;
}

.star:hover,
.star.hover {
  color: rgba(255,255,255,0.8); /* White on hover */

}

.star.selected {
  color: #ffd700; /* Gold when selected */
}

/* No rating option styling - matches the input aesthetic */
.star.no-rating {
  color: rgba(255,255,255,0.4);
  font-size: 18px;
  font-weight: bold;
  padding: 7px 8px 4px 8px;
  border-radius: 3px;
}


.star.no-rating.selected {
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.15);
}

/* Table column sizing for new expanded layout - apply to main and social tables */
#gamesTable,
#socialGamesTable {
  table-layout: fixed;
  width: 100%;
}

/* Clean table design complete */

/* Specific column widths */
#gamesTable th:nth-child(1) /* Title */,
#socialGamesTable th:nth-child(1) /* Title */
{
  text-align: left;
}

#gamesTable th:nth-child(2) /* Hours */,
#socialGamesTable th:nth-child(2) /* Hours */
{
  width: 80px;
  text-align: left; /* Left-align rating column content */
}

#gamesTable th:nth-child(3) /* Rating */,
#socialGamesTable th:nth-child(3) /* Rating */
{
  width: 105px;
  text-align: left; /* Left-align date columns content */
}

#gamesTable th:nth-child(4) /* Start Date */,
#socialGamesTable th:nth-child(4) /* Start Date */
{
  width: 118px; /* Increased to accommodate "In Progress" text */
  text-align: left; /* Left-align status column content */
}

#gamesTable th:nth-child(5) /* End Date */,
#socialGamesTable th:nth-child(5) /* End Date */
{
  width: 118px; /* Increased to accommodate "In Progress" text */
  text-align: left; /* Left-align status column content */
}

.game-end {
  
  width: 200px;
}

#gamesTable th:nth-child(6) /* Status */,
#socialGamesTable th:nth-child(6) /* Status */
{
  width: 109px;
  text-align: left;
}

/* Mobile touch improvements */
@media (max-width: 768px) {
  /* Improve touch targets */
  button {
    min-height: 44px;
    min-width: 44px;
    /* iOS Safari button optimizations */
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
    cursor: pointer;
  }
  
  /* Improve table row touch targets */
  table tr {
    cursor: pointer;
    /* iOS momentum scrolling */
    -webkit-overflow-scrolling: touch;
  }
  
  table td {
    padding: 12px 8px;
    font-size: 14px;
  }
  
  /* Improve search inputs for iOS */
  input[type="text"] {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
    /* Prevent iOS input styling */
    -webkit-border-radius: 8px;
  }
  
  /* iOS Safari input focus fix */
  input:focus {
    -webkit-tap-highlight-color: transparent;
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }
  
  /* Improve cards for touch */
  .card {
    margin-bottom: 15px;
    /* iOS touch optimization */
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.1);
  }
  
  /* Remove mobile-specific button styling - use desktop styling */
  
  /* Remove mobile-specific modal button styling - use desktop styling */
}

/* iOS Safari scrolling optimizations */
.table-wrapper,
.results,
.stats-content {
  -webkit-overflow-scrolling: touch;
}

/* Mobile game details modal */
.mobile-game-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  padding: 32px 20px; /* More padding: top/bottom and left/right */
  box-sizing: border-box;
  /* Animation properties */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-game-modal.animate-in {
  opacity: 1;
}

.mobile-game-modal-content {
  background: rgba(15, 26, 36, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  width: 100%;
  max-width: 100%; /* Use full available width within padding */
  height: 100%; /* Fill available height within padding */
  max-height: 100%; /* Don't exceed available space */
  overflow: hidden; /* Prevent modal content from scrolling */
  color: var(--card-text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  position: relative;
  display: flex;
  flex-direction: column;
  /* Animation properties */
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-game-modal.animate-in .mobile-game-modal-content {
  transform: scale(1) translateY(0);
}

/* Close button for mobile modal */
.mobile-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--card-text);
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

.mobile-modal-close:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

/* Modal details card styling */
.mobile-game-modal .details-card {
  background: linear-gradient(rgba(2,6,23,0.75), rgba(2,6,23,0.75)), var(--card-bg-image, none);
  background-size: 100% 100%, var(--bg-scale, cover);
  background-position: center center, var(--bg-position, center center);
  background-repeat: no-repeat, no-repeat;
  background-attachment: local, local;
  background-blend-mode: normal;
  border-radius: 25px;
  padding: 0; /* Remove padding to manage spacing with flexbox */
  margin: 0;
  border: none;
  overflow: hidden;
  min-height: 0;
  height: 100%; /* Fill modal content height */
  max-height: 100%;
  display: flex;
  flex-direction: column;
  
  /* Better mobile image scaling */
  --bg-scale: cover;
  --bg-position: center center;
}

.mobile-game-modal .details-card .card-content {
  flex: 1; /* Take available space between close button and actions */
  display: flex;
  flex-direction: column;
  gap: 0; /* Remove gap, manage spacing individually */
  color: var(--card-text);
  z-index: 2;
  position: relative;
  padding: 24px 28px 0 28px; /* Top and side padding */
  min-height: 0; /* Allow flex shrinking */
  overflow: hidden; /* Prevent content overflow */
}

.mobile-game-modal .details-header {
  display: flex;
  flex-direction: column; /* Stack title and dates vertically */
  align-items: flex-start;
  gap: 8px; /* Smaller gap for vertical stacking */
  margin-bottom: 16px;
  margin-top: 60px; /* More space for close button in padded modal */
  flex-shrink: 0; /* Don't shrink header */
}

.mobile-game-modal .details-title {
  font-size: 24px; /* Match desktop font size */
  font-weight: 600;
  color: #f1f5f9; /* Match desktop color */
  margin: 0;
  line-height: 1.2;
  word-break: break-word;
  white-space: normal;
  transition: all 0.5s ease; /* Match desktop transition */
  flex: 1;
  min-width: 0;
}

.mobile-game-modal .details-right {
  text-align: left; /* Change from right to left alignment */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Change from flex-end to flex-start */
  width: 100%; /* Take full width for proper positioning */
}

.mobile-game-modal .dates {
  color: var(--muted-2); /* Match desktop color */
  font-size: 13px; /* Match desktop font size */
  line-height: 1.4; /* Match desktop line height */
  margin: 0;
  white-space: normal; /* Allow wrapping for longer date ranges */
}

.mobile-game-modal .rating {
  display: none; /* Hide rating element */
}

.mobile-game-modal .details-meta {
  color: var(--muted-2); /* Match desktop color */
  font-size: 13px; /* Match desktop font size */
  line-height: 1.4; /* Match desktop line height */
  margin: 12px 0; /* Match desktop spacing - consistent with desktop */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex-shrink: 0; /* Don't shrink meta */
}

.mobile-game-modal .meta-badge {
  background: rgba(255,255,255,0.08); /* Match desktop background */
  color: var(--muted-2); /* Match desktop color */
  padding: 4px 8px; /* Match desktop padding */
  border-radius: 4px;
  font-size: 12px; /* Match desktop font size */
  white-space: nowrap;
  font-weight: 500; /* Match desktop font weight */
  display: inline-block;
}

/* Easter egg badges in mobile modal - override default mobile styling */
.mobile-game-modal .meta-badge.easter-egg-badge {
  background: rgb(64, 65, 29); /* Custom dark green background */
  color: gold; /* Gold text */
  border: 1px solid gold; /* Subtle gold border */
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5); /* Golden glow effect */
  font-weight: 600; /* Bolder text for emphasis */
}

.mobile-game-modal .details-description {
  margin: 0; /* Match desktop margin */
  color: var(--muted-2); /* Fix: use --muted-2 to match desktop */
  font-size: 14px; /* Match desktop font size */
  line-height: 1.5; /* Match desktop line height */
  transition: all 0.5s ease; /* Match desktop transition */
  flex: 1; /* Take remaining space */
  overflow-y: auto; /* Make scrollable */
  overflow-x: hidden; /* Prevent horizontal scroll */
  padding-right: 8px; /* Space for scrollbar */
  margin-bottom: 16px; /* Space before actions */
  /* Smooth scrolling */
  scroll-behavior: smooth;
  /* Custom scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Custom scrollbar for webkit browsers */
.mobile-game-modal .details-description::-webkit-scrollbar {
  width: 6px;
}

.mobile-game-modal .details-description::-webkit-scrollbar-track {
  background: transparent;
}

.mobile-game-modal .details-description::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.mobile-game-modal .details-description::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.mobile-game-modal .details-actions {
  display: flex;
  justify-content: space-between; /* Restore space-between for left/right alignment */
  align-items: center;
  gap: 12px;
  margin: 0 16px 16px 16px; /* Add side margins and bottom margin to prevent edge touching */
  padding: 16px 16px 16px 16px; /* Reduce padding since we're using margins */
  flex-shrink: 0; /* Don't shrink actions */
}

.mobile-game-modal .details-actions button {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0; /* Prevent buttons from shrinking */
  min-width: 80px; /* Minimum button width */
  white-space: nowrap; /* Prevent text wrapping */
}

.mobile-game-modal .details-actions button:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

.mobile-game-modal .details-actions .status {
  background: var(--status-bg, linear-gradient(135deg, #198754, #157347));
  color: var(--status-text, white);
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(25, 135, 84, 0.3);
  /* Allow interactions for wishlist delete functionality */
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Add active/pressed state for mobile status button */
.mobile-game-modal .details-actions .status:active {
  transform: translateY(2px);
  box-shadow: 0 2px 8px rgba(25, 135, 84, 0.3);
}

/* iOS Safari sticky positioning fallback */
@supports not (position: sticky) {
  .mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
  }
  
  body {
    padding-top: 70px; /* Account for fixed nav */
  }
}

/* Profile Section */
.profile-container {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 24px; /* Match stats container padding */
  color: white;
  width: 500px; /* Match navigation bar width */
  max-width: calc(100vw - 40px); /* Match navigation responsive fallback */
  margin: 0 auto; /* Center horizontally like navigation */
  box-sizing: border-box;
  /* Remove fixed height constraints to fit content */
}

/* Mobile profile container adjustments */
@media (max-width: 768px) {
  .profile-container {
    padding: 16px; /* Reduced padding on mobile */
  }
}

.profile-container h2 {
  margin: 0 0 24px 0; /* Match stats container */
  color: white; /* Match stats page title color */
  font-size: 20px; /* Match stats page */
  font-weight: 600;
}

.profile-container h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--card-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.profile-info,
.profile-stats,
.profile-settings {
  margin-bottom: 32px;
}

.profile-info h3,
.profile-settings h3 {
  margin: 0 0 20px 0; /* Match modal h3 spacing */
  font-size: 20px; /* Match modal h3 size */
  font-weight: 600; /* Match modal h3 weight */
  color: #f1f5f9; /* Match modal h3 color */
  text-align: left;
  border-bottom: none; /* Remove border to match modal */
  padding-bottom: 0; /* Remove padding to match modal */
}

.profile-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.profile-field:last-child {
  border-bottom: none;
}

.profile-field-label {
  font-weight: 500;
  color: var(--muted);
  min-width: 120px;
}

.profile-field-value {
  color: var(--card-text);
  flex: 1;
  text-align: right;
}

.profile-edit-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0; /* Match modal spacing */
}

.profile-edit-field label {
  font-weight: 500;
  color: var(--muted-2); /* Match modal label color */
  font-size: 13px; /* Match modal label size */
}

.profile-edit-field input {
  width: 100%;
  padding: 14px 18px; /* Match modal padding */
  margin-top: 10px; /* Match modal spacing */
  background: rgba(255,255,255,0.08); /* Match modal background */
  border: 1px solid rgba(255,255,255,0.15); /* Match modal border */
  outline: none;
  border-radius: 18px; /* Match modal border radius */
  color: white; /* Match modal text color */
  font-size: 16px; /* Match modal font size */
  transition: all 0.3s ease;
  box-sizing: border-box;
  font-family: inherit;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.profile-edit-field input:focus {
  outline: none;
  background: rgba(255,255,255,0.12); /* Match modal focus background */
  border-color: var(--accent);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2); /* Match modal focus shadow */
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 16px 0;
}



.stat-number {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
  display: block;
}

.stat-label {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.password-form {
  background: rgba(255,255,255,0.05);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  margin: 16px 0;
}

.password-form .profile-edit-field {
  margin: 12px 0;
}

.profile-actions {
  display: flex;
  flex-direction: row; /* Change to horizontal layout */
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* On smaller screens, stack the buttons vertically */
@media (max-width: 480px) {
  .profile-actions {
    flex-direction: column;
  }
}

.btn-secondary {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 10px 18px;
  border-radius: 18px; /* Much more rounded */
  cursor: pointer;
  color: white;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 14px;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(220, 38, 51, 0.9);
  border: 1px solid rgba(220, 38, 51, 0.6);
  padding: 10px 18px;
  border-radius: 18px; /* Much more rounded */
  cursor: pointer;
  color: white;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 14px;
}

.btn-danger:hover {
  background: rgba(220, 38, 51, 1);
  border-color: rgba(220, 38, 51, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(220, 38, 51, 0.3);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 10px 18px;
  border-radius: 18px; /* Much more rounded */
  cursor: pointer;
  color: white;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 14px;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-strong), #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* Mobile Profile Styles */
@media (max-width: 768px) {
  .profile-container {
    width: 100%;
    max-width: calc(100vw - 20px);
    margin: 10px auto;
    padding: 16px;
  }
  
  .profile-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .profile-field-value {
    text-align: left;
  }
  
  .profile-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .stat-card {
    padding: 12px;
  }
  
  .stat-number {
    font-size: 20px;
  }
  
  /* Hide main details cards on mobile - users will see modal instead */
  .right .details-card, #socialDetailsCard {
    display: none !important;
  }
}
