/* Mobile Responsiveness Enhancements for Hack Slash */

/* Force mobile styles to load immediately and override conflicts */

/* Hide back-link on mobile devices */
@media (max-width: 768px) {
  .back-link,
  a.back-link,
  .back-container .back-link,
  .back-container {
    display: none !important;
  }
}
@media (max-width: 768px) {
  /* Critical mobile overrides */
  body {
    font-size: 14px !important;
    padding: 15px 10px !important;
    padding-top: 100px !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  
  /* Ensure mobile navbar stays fixed */
  .navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    width: 100% !important;
    max-width: 100vw !important;
    padding: 10px 15px !important;
    box-sizing: border-box !important;
  }
  
  /* Force mobile layout for main containers */
  .main-container {
    padding: 0 10px !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Ensure cards are mobile-friendly */
  .card, .profile-card, .about-main-card {
    margin: 10px 0 !important;
    border-radius: 12px !important;
    padding: 20px 15px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Profile page specific fixes */
  .profile-container {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  .profile-info-section {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .profile-stats {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .login-restriction {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Rank column styling */
.rank-col {
  font-weight: bold;
  color: #000000; /* Black for all ranks */
  padding-left: 10px; /* Move rank text to the right */
}

/* Player column styling - Mobile only */
@media (max-width: 768px) {
  .player-col {
    display: flex;
    align-items: center;
    min-width: 0; /* Allow flex item to shrink */
  }
  
  .player-name {
    padding-left: 10px; /* Move only the player name text to the right */
  }
}

.player-name {
  color: #333;
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 5px;
}

/* Table border styling */
.table-header {
  border-bottom: 2px solid rgba(202, 73, 127, 0.5);
  border-top: 1px solid rgba(202, 73, 127, 0.3);
  border-left: 1px solid rgba(202, 73, 127, 0.3);
  border-right: 1px solid rgba(202, 73, 127, 0.3);
  background: rgba(202, 73, 127, 0.05);
}

/* Responsive Player column header styling */
@media (min-width: 1200px) {
  .table-header .player-col {
    color: #000000; /* Black text for "Player" header */
    text-align: center; /* Center the "Player" text */
    padding-left: 200px; /* Large screens */
  }
}

@media (min-width: 992px) and (max-width: 1199px) {
  .table-header .player-col {
    color: #000000; /* Black text for "Player" header */
    text-align: center; /* Center the "Player" text */
    padding-left: 150px; /* Medium-large screens */
  }
}

@media (min-width: 769px) and (max-width: 991px) {
  .table-header .player-col {
    color: #000000; /* Black text for "Player" header */
    text-align: center; /* Center the "Player" text */
    padding-left: 100px; /* Medium screens */
  }
}

@media (max-width: 768px) {
  .table-header .player-col {
    color: #000000; /* Black text for "Player" header */
    text-align: center; /* Center the "Player" text */
    padding-left: 20px; /* Small screens */
  }
  
  /* Mobile leaderboard table - wider layout to prevent overlapping */
  .table-header, .player-row {
    grid-template-columns: 60px 3fr 120px 100px 100px 100px; /* Wider player column and level column for mobile */
    gap: 30px; /* Much larger gap for mobile */
    font-size: 0.9rem; /* Same as desktop font size */
    min-width: 750px; /* Increased to accommodate much wider layout */
  }
  
  /* Move player column contents much further to the left for extreme separation from level */
  .player-col {
    justify-content: flex-start;
    padding-left: 0;
    margin-left: -30px; /* Move contents much further left */
  }
  
  .player-name {
    text-align: left;
    margin-left: -20px; /* Much more left margin for player name */
  }
  
  .player-avatar {
    margin-left: -15px; /* Move avatar much further left */
  }
}

.player-row {
  border-bottom: 1px solid rgba(202, 73, 127, 0.3);
  border-left: 1px solid rgba(202, 73, 127, 0.2);
  border-right: 1px solid rgba(202, 73, 127, 0.2);
}

/* Special styling for top 3 ranks */
.player-row.rank-1 .rank-col {
  color: #000000; /* Black */
  font-weight: bold;
  font-size: 1.2rem;
}

.player-row.rank-2 .rank-col {
  color: #000000; /* Black */
  font-weight: bold;
  font-size: 1.1rem;
}

.player-row.rank-3 .rank-col {
  color: #000000; /* Black */
  font-weight: bold;
  font-size: 1.1rem;
}

/* Enhanced styling for rank 1 (Gold) */
.player-row.rank-1 {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0.15));
  border-left: 6px solid #FFD700;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.4), inset 0 0 20px rgba(255, 215, 0, 0.1);
  border-radius: 8px;
  margin: 2px 0;
}

/* Enhanced styling for rank 2 (Silver) */
.player-row.rank-2 {
  background: linear-gradient(135deg, rgba(230, 230, 250, 0.2), rgba(230, 230, 250, 0.1));
  border-left: 6px solid #E6E6FA;
  box-shadow: 0 0 20px rgba(230, 230, 250, 0.3), inset 0 0 15px rgba(230, 230, 250, 0.08);
  border-radius: 8px;
  margin: 2px 0;
}

/* Enhanced styling for rank 3 (Bronze) */
.player-row.rank-3 {
  background: linear-gradient(135deg, rgba(255, 140, 0, 0.2), rgba(255, 140, 0, 0.1));
  border-left: 6px solid #FF8C00;
  box-shadow: 0 0 18px rgba(255, 140, 0, 0.3), inset 0 0 12px rgba(255, 140, 0, 0.08);
  border-radius: 8px;
  margin: 2px 0;
}

/* Glow animations */
@keyframes goldGlow {
  from { text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.4); }
  to { text-shadow: 0 0 20px rgba(255, 215, 0, 1), 0 0 40px rgba(255, 215, 0, 0.6); }
}

@keyframes silverGlow {
  from { text-shadow: 0 0 12px rgba(230, 230, 250, 0.7), 0 0 25px rgba(230, 230, 250, 0.3); }
  to { text-shadow: 0 0 18px rgba(230, 230, 250, 0.9), 0 0 35px rgba(230, 230, 250, 0.5); }
}

@keyframes bronzeGlow {
  from { text-shadow: 0 0 10px rgba(255, 140, 0, 0.6), 0 0 20px rgba(255, 140, 0, 0.3); }
  to { text-shadow: 0 0 15px rgba(255, 140, 0, 0.8), 0 0 30px rgba(255, 140, 0, 0.5); }
}

/* Mobile-First Approach - Start with mobile styles */
@media (max-width: 768px) {
  /* Base mobile adjustments */
  body {
    padding: 15px 10px;
    padding-top: 100px; /* Increased to account for fixed navbar */
    font-size: 14px;
  }

  /* About Section Mobile Responsiveness */
  .about-section {
    margin: 40px 0 !important;
    padding: 0 15px !important;
  }
  
  .about-main-card {
    padding: 30px 20px !important;
  }
  
  .about-header h2 {
    font-size: 2rem !important;
  }
  
  .about-paragraph p {
    font-size: 1rem !important;
    text-align: justify !important;
  }

  /* Profile Page Mobile Responsiveness */
  .profile-container {
    padding: 15px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  .profile-info-section {
    flex-direction: column !important;
    text-align: center !important;
    gap: 20px !important;
    padding: 25px 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .profile-avatar i {
    font-size: 100px !important;
  }
  
  .profile-details h2 {
    font-size: 1.4rem !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    line-height: 1.2 !important;
    padding: 0 10px !important;
    box-sizing: border-box !important;
    white-space: normal !important;
  }
  
  .profile-actions {
    flex-direction: row !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .action-btn {
    min-width: 120px !important;
    padding: 10px 15px !important;
    font-size: 0.9rem !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .profile-stats {
    padding: 25px 20px !important;
    margin-top: 35px !important;
    margin-bottom: 25px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .profile-achievements,
  .profile-decks,
  .profile-matches,
  .profile-friends {
    padding: 25px 20px !important;
    margin-bottom: 25px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .profile-stats h2 {
    font-size: 1.8rem !important;
    word-wrap: break-word !important;
  }
  
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 15px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .login-restriction {
    padding: 30px 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .restriction-icon {
    font-size: 3rem !important;
  }
  
  .login-restriction h2 {
    font-size: 1.8rem !important;
    word-wrap: break-word !important;
  }
  
  .feature-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Admin Dashboard Mobile Responsiveness */
  .dashboard-container {
    padding: 0 10px !important;
  }
  
  .dashboard-header {
    padding: 20px 15px !important;
    margin: 20px auto !important;
  }
  
  .charts-section {
    padding: 20px 15px !important;
    margin: 20px auto !important;
  }
  
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  .charts-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  .chart {
    height: 250px !important;
  }
  
  .dashboard-header h1 {
    font-size: 2rem !important;
  }
  
  .charts-header h2 {
    font-size: 2rem !important;
  }

  /* Enhanced mobile navbar */
  .navbar {
    padding: 10px 15px;
    flex-wrap: wrap;
  }

  .navbar-left .logo {
    height: 40px;
  }

  .navbar-right {
    gap: 8px;
    flex-wrap: wrap;
  }

  .navbar-right button {
    padding: 8px 12px;
    font-size: 0.85rem;
    min-height: 36px;
    min-width: 60px;
  }

  /* Mobile hero section */
  .hero h1 {
    font-size: 2.2rem;
    line-height: 1.2;
    margin-bottom: 15px;
  }

  .hero p {
    font-size: 1rem;
    line-height: 1.4;
    padding: 0 10px;
  }

  /* Mobile container adjustments */
  .main-container {
    padding: 0 10px;
    max-width: 100%;
  }

  .hero-container {
    padding: 20px 15px;
    margin: 20px auto;
    border-radius: 12px;
  }

  /* Mobile card improvements */
  .card {
    padding: 20px 15px;
    margin: 20px auto;
    border-radius: 12px;
  }

  .card h2 {
    font-size: 1.4rem;
    margin-bottom: 15px;
  }

  .card p {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  /* Mobile bottom navbar - similar to Gradient dashboard */
  .mobile-bottom-navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(202, 73, 127, 0.2);
    padding: 8px 0 12px 0; /* Extra bottom padding for safe area */
    z-index: 1000;
    display: none; /* Hidden by default, shown on mobile */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  }

  .mobile-bottom-navbar .nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 10px;
  }

  .mobile-bottom-navbar .nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #666;
    transition: all 0.3s ease;
    padding: 12px;
    border-radius: 12px;
    min-width: 60px;
    min-height: 60px;
    flex: 1;
  }

  .mobile-bottom-navbar .nav-item:hover,
  .mobile-bottom-navbar .nav-item.active {
    color: #ca497f;
    background: rgba(202, 73, 127, 0.1);
    transform: translateY(-1px);
  }

  .mobile-bottom-navbar .nav-item i {
    font-size: 24px;
    transition: transform 0.2s ease;
  }

  .mobile-bottom-navbar .nav-item:hover i,
  .mobile-bottom-navbar .nav-item.active i {
    transform: scale(1.1);
  }

  /* Special styling for home button to make it stand out */
  .mobile-bottom-navbar .home-button {
    background: linear-gradient(135deg, #ca497f, #a03060);
    color: white !important;
    border-radius: 20px;
    min-width: 60px;
    min-height: 60px;
    box-shadow: 0 4px 15px rgba(202, 73, 127, 0.4);
    transform: translateY(-2px);
    position: relative;
    overflow: hidden;
  }

  .mobile-bottom-navbar .home-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
  }

  .mobile-bottom-navbar .home-button:hover::before {
    left: 100%;
  }

  .mobile-bottom-navbar .home-button:hover,
  .mobile-bottom-navbar .home-button.active {
    background: linear-gradient(135deg, #e05590, #ca497f);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(202, 73, 127, 0.6);
  }

  .mobile-bottom-navbar .home-button i {
    font-size: 24px;
  }

  /* Pulsing animation for home button */
  @keyframes homeButtonPulse {
    0% {
      box-shadow: 0 4px 15px rgba(202, 73, 127, 0.4);
    }
    50% {
      box-shadow: 0 4px 20px rgba(202, 73, 127, 0.6);
    }
    100% {
      box-shadow: 0 4px 15px rgba(202, 73, 127, 0.4);
    }
  }

  .mobile-bottom-navbar .home-button {
    animation: homeButtonPulse 3s ease-in-out infinite;
  }

  .mobile-bottom-navbar .home-button:hover,
  .mobile-bottom-navbar .home-button.active {
    animation: none;
  }

  /* Hide secondary navbar on mobile and show bottom navbar */
  .secondary-navbar-container {
    display: none;
  }
  
  /* Hide back-link on mobile (since we have bottom navbar) */
  .back-link,
  a.back-link,
  .back-container .back-link {
    display: none !important;
  }

  .mobile-bottom-navbar {
    display: block;
  }

  /* Add bottom padding to body to account for bottom navbar */
  body {
    padding-bottom: 80px !important;
  }

  /* Ensure content doesn't get hidden behind the bottom navbar */
  .main-container {
    margin-bottom: 20px;
  }

  /* Support for devices with safe areas (iPhone X and newer) */
  @supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-bottom-navbar {
      padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    
    body {
      padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
    }
  }

  /* Mobile navbar improvements */
  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
  }
  
  /* Hide patch notes button on mobile navbar */
  .patch-icon {
    display: none;
  }
  
  /* Keep logo and sign-out button visible */
  .navbar-right {
    gap: 8px;
  }

  .navbar-right button {
    min-height: 44px;
    min-width: 80px;
    font-size: 0.9rem;
  }

  /* Mobile video adjustments */
  .video-container {
    margin: 15px 0;
  }

  .video-container video {
    width: 100%;
    height: auto;
    border-radius: 8px;
  }

  /* Mobile play button */
  .play-button {
    display: block;
    margin: 15px auto;
    max-width: 200px;
  }

  .play-button img {
    width: 100%;
    height: auto;
  }

  /* Mobile form adjustments */
  .form-group {
    margin-bottom: 15px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100%;
    padding: 10px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Mobile button adjustments */
  button, .btn {
    padding: 12px 20px;
    font-size: 1rem;
    min-height: 44px;
    width: 100%;
    margin: 5px 0;
  }

  /* Mobile table adjustments */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
    font-size: 0.9rem;
  }

  /* Mobile grid adjustments */
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  /* Mobile text adjustments */
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.3rem; }
  h4 { font-size: 1.1rem; }
  h5 { font-size: 1rem; }
  h6 { font-size: 0.9rem; }

  /* Mobile spacing adjustments */
  .mobile-p-1 { padding: 5px; }
  .mobile-p-2 { padding: 10px; }
  .mobile-p-3 { padding: 15px; }
  .mobile-p-4 { padding: 20px; }
  .mobile-p-5 { padding: 25px; }

  .mobile-m-1 { margin: 5px; }
  .mobile-m-2 { margin: 10px; }
  .mobile-m-3 { margin: 15px; }
  .mobile-m-4 { margin: 20px; }
  .mobile-m-5 { margin: 25px; }

  /* Mobile utility classes */
  .mobile-text-center { text-align: center; }
  .mobile-text-left { text-align: left; }
  .mobile-text-right { text-align: right; }
  .mobile-hidden { display: none; }
  .mobile-block { display: block; }
  .mobile-flex { display: flex; }
  .mobile-flex-col { flex-direction: column; }
  .mobile-flex-row { flex-direction: row; }
  .mobile-justify-center { justify-content: center; }
  .mobile-justify-between { justify-content: space-between; }
  .mobile-items-center { align-items: center; }
  .mobile-w-full { width: 100%; }
  .mobile-w-half { width: 50%; }

  /* Touch-friendly improvements */
  * {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box !important;
  }

  /* Prevent horizontal scrolling globally */
  html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Better touch targets */
  button, .btn, a {
    min-height: 44px;
    min-width: 44px;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Prevent zoom on input focus */
  input, select, textarea {
    font-size: 16px;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Smooth scrolling */
  html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Better viewport handling */
  .main-container {
    min-height: calc(100vh - 120px);
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Card improvements for mobile */
  .card, .profile-card, .about-main-card {
    margin: 10px 0;
    border-radius: 12px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Better spacing for mobile */
  .section-spacing {
    margin: 30px 0;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Improved button spacing */
  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .btn-group.horizontal {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
  body {
    padding: 20px 15px;
    padding-top: 90px;
  }

  .navbar {
    padding: 12px 20px;
  }

  .navbar-left .logo {
    height: 45px;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero p {
    font-size: 1.1rem;
  }

  .card {
    padding: 20px 18px;
    margin: 20px auto;
  }

  .card h2 {
    font-size: 1.5rem;
  }

  .card p {
    font-size: 0.95rem;
  }

  .secondary-navbar {
    flex-direction: row;
    gap: 15px;
    padding: 15px 20px;
  }

  .secondary-navbar a {
    padding: 10px 15px;
    font-size: 0.9rem;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  body {
    padding: 10px 5px;
    padding-top: 90px; /* Increased to account for fixed navbar */
    font-size: 13px;
  }

  /* About Section Small Mobile */
  .about-main-card {
    padding: 25px 15px !important;
  }
  
  .about-header h2 {
    font-size: 1.8rem !important;
  }
  
  .about-paragraph p {
    font-size: 0.95rem !important;
    text-align: justify !important;
  }

  /* Profile Page Small Mobile */
  .profile-container {
    padding: 10px !important;
  }
  
  .profile-info-section {
    padding: 20px 15px !important;
  }
  
  .profile-avatar i {
    font-size: 80px !important;
  }
  
  .profile-details h2 {
    font-size: 1.2rem !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    line-height: 1.2 !important;
    padding: 0 5px !important;
    box-sizing: border-box !important;
    white-space: normal !important;
  }
  
  .profile-level {
    font-size: 1.1rem !important;
  }
  
  .action-btn {
    min-width: 100px !important;
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
  }
  
  .profile-stats {
    padding: 20px 15px !important;
    margin-top: 30px !important;
    margin-bottom: 20px !important;
  }
  
  .profile-achievements,
  .profile-decks,
  .profile-matches,
  .profile-friends {
    padding: 20px 15px !important;
    margin-bottom: 20px !important;
  }
  
  .profile-stats h2 {
    font-size: 1.6rem !important;
  }
  
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  
  .login-restriction {
    padding: 25px 15px !important;
  }
  
  .restriction-icon {
    font-size: 2.5rem !important;
  }
  
  .login-restriction h2 {
    font-size: 1.6rem !important;
  }
  
  .feature-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  /* Admin Dashboard Small Mobile */
  .dashboard-container {
    padding: 0 5px !important;
  }
  
  .dashboard-header {
    padding: 15px 10px !important;
    margin: 15px auto !important;
  }
  
  .charts-section {
    padding: 15px 10px !important;
    margin: 15px auto !important;
  }
  
  .dashboard-header h1 {
    font-size: 1.8rem !important;
  }
  
  .charts-header h2 {
    font-size: 1.8rem !important;
  }

  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    padding: 8px 10px;
  }
  
  /* Hide patch notes button on small mobile navbar */
  .patch-icon {
    display: none;
  }
  
  /* Keep logo and sign-out button visible */
  .navbar-right {
    gap: 8px;
  }

  .navbar-left .logo {
    height: 35px;
  }

  .navbar-right button {
    padding: 6px 10px;
    font-size: 0.8rem;
    min-height: 32px;
    min-width: 50px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .hero p {
    font-size: 0.9rem;
  }

  .card {
    padding: 15px 10px;
    margin: 15px auto;
  }

  .card h2 {
    font-size: 1.2rem;
  }

  .card p {
    font-size: 0.85rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .secondary-navbar {
    padding: 10px;
    margin: 15px 5px;
  }

  .secondary-navbar a {
    padding: 10px 15px;
    font-size: 0.9rem;
  }
}

/* ===== Replies Section Mobile Fixes ===== */
/* Global safety for content wrapping */
.reply-content {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Make embedded media within replies responsive */
.reply-content img,
.reply-content video,
.reply-content iframe {
  max-width: 100%;
  height: auto;
}

@media (max-width: 768px) {
  .reply-item {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .reply-content {
    white-space: normal;
  }

  .reply-actions {
    flex-wrap: wrap;
  }

  .nested-replies {
    max-width: 100%;
    overflow-x: hidden;
  }

  .reply-form {
    width: 100%;
  }

  .reply-header {
    width: 100%;
  }

  .reply-author-info h4,
  .reply-meta {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 480px) {
  .nested-replies {
    margin-left: 10px;
    padding-left: 10px;
    max-width: 100%;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    padding-top: 60px;
  }

  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    min-height: 50px;
  }
  
  /* Hide patch notes button on landscape mobile navbar */
  .patch-icon {
    display: none;
  }
  
  /* Keep logo and sign-out button visible */
  .navbar-right {
    gap: 8px;
  }

  .hero-container {
    padding: 10px;
    margin: 5px auto;
  }

  .hero h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
  }

  .hero p {
    font-size: 0.9rem;
    margin-bottom: 15px;
  }

  .card {
    padding: 10px;
    margin: 10px auto;
  }

  /* Landscape mobile profile adjustments */
  .profile-info-section {
    flex-direction: row;
    padding: 15px;
  }

  .profile-avatar i {
    font-size: 60px;
  }

  .profile-details h2 {
    font-size: 1rem;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    hyphens: auto !important;
    max-width: 100% !important;
    line-height: 1.2 !important;
    padding: 0 5px !important;
    box-sizing: border-box !important;
    white-space: normal !important;
  }

  .profile-actions {
    flex-direction: column;
    gap: 8px;
  }

  .action-btn {
    min-width: 80px;
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  /* Landscape mobile about section */
  .about-main-card {
    padding: 15px;
  }

  .about-header h2 {
    font-size: 1.6rem;
  }

  .about-paragraph p {
    font-size: 0.9rem;
    text-align: justify;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .navbar-left .logo {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  /* This can be expanded if dark mode is implemented */
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Forum Topic Mobile Responsiveness */
@media (max-width: 768px) {
  /* Forum topic container */
  .forum-topic-container {
    padding: 0 10px;
    margin: 0 auto;
    max-width: 100%;
  }

  /* Topic navigation */
  .topic-navigation {
    margin-bottom: 15px;
  }

  .back-link {
    font-size: 0.9rem;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  /* Topic header - now in card */
  .topic-content .card-header {
    display: flex;
    flex-direction: column;
  }

  .topic-content .card-header h2 {
    font-size: 1.4rem;
    line-height: 1.3;
    margin-bottom: 8px;
    word-wrap: break-word;
    order: 1;
  }

  .topic-content .card-header .topic-meta {
    font-size: 0.85rem;
    color: #666;
    order: 2;
    margin: 0;
  }

  /* Topic content */
  .topic-content {
    margin-bottom: 20px;
  }

  .post {
    padding: 15px;
    border-radius: 12px;
  }

  .post-content {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
  }

  /* Post actions - mobile layout */
  .post-actions {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .topic-vote-section {
    justify-content: center;
    order: 2;
  }

  .post-stats {
    justify-content: center;
    order: 1;
  }

  .reply-counter-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    margin: 0;
  }

  /* Forum cards */
  .forum-card {
    margin-bottom: 15px;
    border-radius: 12px;
  }

  .card-header {
    padding: 14px 8px;
  }

  .card-header h2 {
    font-size: 1.2rem;
  }

  .card-content {
    padding: 14px 8px;
  }

  .card-actions {
    padding: 14px 8px;
  }

  /* Reply items */
  .reply-item {
    padding: 8px;
    margin-bottom: 12px;
    border-radius: 10px;
  }

  .reply-header {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 12px;
  }

  .reply-author {
    gap: 8px;
  }

  .reply-author-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .reply-author-info h4 {
    font-size: 0.9rem;
  }

  .reply-meta {
    font-size: 0.8rem;
  }

  .reply-content {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 12px;
  }

  .reply-actions {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .reply-vote-section {
    justify-content: center;
    order: 2;
  }

  .reply-action-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    justify-content: center;
    order: 1;
  }

  /* Nested replies (reduced indent on mobile to widen text) */
  .nested-replies {
    margin-left: 2px;
    padding-left: 4px;
  }

  /* Reply form */
  .reply-form {
    padding: 15px;
    margin-top: 12px;
  }

  .reply-form textarea {
    min-height: 80px;
    padding: 10px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .reply-form-actions {
    flex-direction: column;
    gap: 8px;
  }

  .reply-form-btn {
    padding: 10px 16px;
    font-size: 0.9rem;
    width: 100%;
  }

  /* Guest reply prompt */
  .guest-reply-prompt {
    padding: 20px 15px;
    margin: 20px 0;
  }

  .prompt-content h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
  }

  .prompt-content p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 15px;
  }

  .prompt-actions {
    flex-direction: column;
    gap: 10px;
  }

  .login-prompt-btn,
  .signup-prompt-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
  }

  /* Empty state */
  .empty-state {
    padding: 30px 15px;
  }

  .empty-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
  }

  .empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  .empty-state p {
    font-size: 0.85rem;
  }

  /* Reply to topic button */
  .reply-to-topic-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
  }

  /* Touch-friendly vote buttons */
  .topic-vote-btn,
  .reply-vote-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  /* Better touch targets for action buttons */
  .reply-action-btn {
    min-height: 44px;
    padding: 12px 16px;
  }

  /* Improved spacing for mobile */
  .topic-navigation {
    padding: 10px 0;
  }

  .topic-header {
    padding: 15px 0;
  }

  .topic-content {
    padding: 15px 0;
  }

  .replies-section {
    padding: 15px 0;
  }

  /* Mobile-friendly breadcrumb */
  .topic-breadcrumb {
    font-size: 0.85rem;
    margin-top: 8px;
  }
}

/* Small mobile devices - Forum Topic */
@media (max-width: 480px) {
  .forum-topic-container {
    padding: 0 2px;
  }

  .topic-content .card-header h2 {
    font-size: 1.2rem;
    margin-bottom: 6px;
  }

  .topic-content .card-header .topic-meta {
    font-size: 0.8rem;
    margin: 0;
  }

  .post {
    padding: 12px;
  }

  .post-content {
    font-size: 0.9rem;
  }

  .card-header,
  .card-content,
  .card-actions {
    padding: 12px 15px;
  }

  .reply-item {
    padding: 12px;
  }

  .reply-author-avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .reply-author-info h4 {
    font-size: 0.85rem;
  }

  .reply-content {
    font-size: 0.85rem;
  }

  .nested-replies {
    margin-left: 2px;
    padding-left: 4px;
  }

  /* Shift replies section slightly left and trim inner paddings further */
  .replies-section {
    margin-left: -2px;
  }

  /* Narrower side paddings for replies card on very small screens */
  .replies-section .card-header,
  .replies-section .card-content,
  .replies-section .card-actions {
    padding-left: 4px;
    padding-right: 4px;
  }

  .replies-section .reply-item {
    padding-left: 8px;
    padding-right: 8px;
  }

  .reply-form {
    padding: 12px;
  }

  .guest-reply-prompt {
    padding: 15px 12px;
  }

  .empty-state {
    padding: 25px 12px;
  }

  .empty-state i {
    font-size: 2rem;
  }

  .empty-state h3 {
    font-size: 1rem;
  }

  .empty-state p {
    font-size: 0.8rem;
  }

  /* Even smaller touch targets for small devices */
  .topic-vote-btn,
  .reply-vote-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .reply-action-btn {
    min-height: 40px;
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  .reply-to-topic-btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
}

/* Additional mobile overflow handling for profile names */
@media (max-width: 768px) {
  .profile-info-section {
    overflow: hidden !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .profile-details {
    max-width: 100% !important;
    overflow: hidden !important;
    word-wrap: break-word !important;
    box-sizing: border-box !important;
  }
  
  .profile-details h2 {
    max-width: 100% !important;
    font-size: 1.1rem !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    line-height: 1.3 !important;
  }
}