:root {
    --bg: #000000;
    --surface: #111318;
    --surface-2: #1a1f29;
    --text: #ffffff;
    --muted: #9aa4b2;
    --accent: #3b82f6;
    --radius: 14px;
  }

  /* Base */
  * { 
    box-sizing: border-box; 
    /* Ensure smooth background rendering */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  html, body { 
    height: 100%; 
    scroll-padding-top: 18vh;
  }
  html {
    background-color: #000000;
    background-image: linear-gradient(to top right, rgb(0, 0, 0), rgb(14, 5, 31));
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
  }
  body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    background-color: transparent;
    background-image: linear-gradient(to top right, rgb(0, 0, 0), rgb(14, 5, 31));
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
    color: var(--text);
    min-height: 100vh;
    /* Ensure smooth rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }

  /* Fixed top area (20% of viewport height) */
  .top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 14vh;
    padding-left: 10%;
   padding-right: 10%;
    background: var(--bg);
    z-index: 1000;
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .top-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
  }

  .brand-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 56px;
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: 16px;
  }

  .logo {
    width: 250px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    letter-spacing: 0.5px;
  }

  .logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none; /* Prevent any click interactions */
    /* High-quality image rendering for crisp scaling */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    /* Fallback for modern browsers */
    image-rendering: auto;
    /* Ensure smooth scaling on high DPI displays */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    /* Prevent blurry scaling */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* High-quality logo rendering for index.html */
  .logo {
    /* High-quality image rendering for crisp scaling */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    /* Fallback for modern browsers */
    image-rendering: auto;
    /* Ensure smooth scaling on high DPI displays */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    /* Prevent blurry scaling */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Enhanced image quality for high DPI displays */
  @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo-image,
    .logo {
      image-rendering: -webkit-optimize-contrast !important;
      image-rendering: crisp-edges !important;
      /* Force hardware acceleration for better performance */
      will-change: transform;
      /* Ensure pixel-perfect rendering */
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
    }
  }

  /* Additional quality improvements for all logo images */
  img[src*="logo.png"] {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

/* Avatar images inside the Top Accounts table */
.top-account-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

  .title {
    font-size: 1.5rem;
    font-weight: 700;

  }

  .subtitle {
    margin: 2px 0 0 0;
    font-size: 0.9rem;
    color: var(--muted);
  }

  /* Rounded navbar */
  nav.navbar {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  }

  .nav-list {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: auto;
  }

  .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: var(--text);
    text-decoration: none;
    border-radius: 10px;
    white-space: nowrap;
    transition: background-color 160ms ease, color 160ms ease;
  }

  .nav-link:hover {
    background: var(--surface-2);
  }

  .nav-actions {
    display: inline-flex;
    gap: 8px;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    background: var(--surface-2);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease;
  }

  .btn:hover {
    background: #243041;
    border-color: rgba(255, 255, 255, 0.18);
  }

  /* Main content starts below the fixed 20vh top area */
  main {
    margin-top: 13vh;
    padding: 24px 10% 48px;
  }

  /* Main Split Section Styles */
  .main-split-section {
    width: 100%;
    max-width: none;
    margin: 0 0 16px;
    background: linear-gradient(180deg, 
      rgba(255,255,255,0.04) 0%, 
      rgba(255,255,255,0.02) 50%, 
      rgba(0, 0, 0, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 20px;
    min-height: calc(100vh - 20vh);
  }

  /* Centered main container (image -> two info buttons -> communities) */
  .main-center-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
  }
  
  .main-intro-text {
    width: 40%;
    max-width: 40%;
    text-align: center;
    color: #ffffff;
  }
  
  .main-intro-text .content p {
    margin: 0;
  }
  
  .intro-divider {
    width: 60%;
    height: 1px;
    background: rgba(255, 255, 255, 0.85);
    margin: 10px auto 12px auto;
  }

  .main-split-container {
    display: flex;
    gap: 30px;
    height: 100%;
    min-height: calc(100vh - 25vh);
  }

  /* Left Section */
  .left-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-right: 15px;
  }

  .left-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
    height: 100%;
  }

  .main-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    text-align: left;
  }

  .text-block {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
  }

  .text-block p {
    margin: 0;
    line-height: 1.6;
    color: var(--text);
    font-size: 1.1rem;
  }

  .communities-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    text-align: left;
  }

  .communities-text-block {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
  }

  .communities-text-block p {
    margin: 0;
    line-height: 1.6;
    color: var(--text);
    font-size: 1.1rem;
  }

  .communities-buttons {
    display: flex;
    flex-direction: row;
    gap: 12px;
    flex: 1;
    justify-content: flex-start;
    align-items: center;
  }

  /* Landscape mode: put community buttons on one line with horizontal scroll and responsive sizing */
  @media (orientation: landscape) and (min-width: 769px) {
    .communities-buttons {
      display: flex;
      flex-wrap: nowrap;
      gap: 10px;
      overflow-x: hidden;
      overflow-y: hidden; /* we will fit on one line */
      padding: 8px 8px 8px 8px;
      align-items: center;
      justify-content: flex-start;
      position: relative;
      width: 100%;
      box-sizing: border-box;
    }

    /* Custom scrollbar for landscape mode */
    .communities-buttons::-webkit-scrollbar {
      height: 6px;
    }

    .communities-buttons::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 3px;
    }

    .communities-buttons::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.3);
      border-radius: 3px;
    }

    .communities-buttons::-webkit-scrollbar-thumb:hover {
      background: rgba(255, 255, 255, 0.5);
    }

    /* Firefox scrollbar styling */
    .communities-buttons {
      scrollbar-width: thin;
      scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
    }

    /* Button sizing for single-line equal-width layout */
    .communities-buttons .community-btn {
      flex: 1 1 0%;
      width: auto !important; /* equal distribute */
      min-width: 0; /* allow shrinking to avoid overflow */
      max-width: 100%;
      min-height: 48px;
      padding: clamp(8px, 1.2vw, 14px) clamp(10px, 1.6vw, 18px);
      font-size: clamp(0.82rem, 1.1vw, 1.05rem);
      max-width: none;
      justify-content: space-between;
      box-sizing: border-box;
    }
    .communities-buttons .community-btn .btn-text {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis; /* show ... when text doesn't fit */
      max-width: 100%;
      display: inline-block;
      flex: 1 1 auto; /* allow text to shrink within button */
      min-width: 0;   /* required for ellipsis inside flex container */
    }
    .communities-buttons .community-btn .btn-right {
      flex: 0 0 auto; /* don't shrink controls */
      margin-left: 8px;
    }

    /* Add subtle border to indicate scrollable area */
    .communities-buttons {
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 8px;
      padding: 8px;
      background: rgba(255, 255, 255, 0.02);
    }

    /* Show scroll indicator when content overflows */
    .communities-buttons:after {
      content: "";
      position: absolute;
      top: 0;
      right: 2px;
      width: 20px;
      height: 100%;
      background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15));
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.3s ease;
      border-radius: 3px;
    }

    .communities-buttons.scrollable:after {
      opacity: 1;
    }

    /* Add a subtle shadow to indicate scrollable content */
    .communities-buttons.scrollable {
      box-shadow: inset 0 -10px 10px -10px rgba(255, 255, 255, 0.1);
    }
  }

  .community-btn {
    width: 37.5%;
    padding: 15px 22px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
    overflow: hidden;
  }

  .community-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
  }

  .community-btn.highlight {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
    animation: highlightPulse 2s ease-in-out;
  }

  @keyframes highlightPulse {
    0% {
      background: rgba(255, 255, 255, 0.25);
      border-color: rgba(255, 255, 255, 0.5);
      box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
      transform: scale(1.05);
    }
    50% {
      background: rgba(255, 255, 255, 0.35);
      border-color: rgba(255, 255, 255, 0.7);
      box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
      transform: scale(1.08);
    }
    100% {
      background: rgba(255, 255, 255, 0.1);
      border-color: rgba(255, 255, 255, 0.2);
      box-shadow: none;
      transform: scale(1);
    }
  }

  .community-btn .btn-text {
    flex: 1;
    text-align: left;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .community-btn .btn-separator {
    flex-shrink: 0;
    margin: 0 4px;
    opacity: 0.7;
  }

  .community-btn svg {
    flex-shrink: 0;
    vertical-align: middle;
    margin-top: 1px;
  }

  .community-btn .btn-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  /* Right Section */
  .right-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-left: 15px;
  }

  .right-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    align-items: center;
    justify-content: center;
  }

  .zoom-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    text-align: center;
    padding: 10px 20px;
  }

  .image-container {
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, 
      rgba(255,255,255,0.04) 0%, 
      rgba(255,255,255,0.02) 50%, 
      rgba(255,255,255,0.01) 100%);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
  }

  /* Adjust image height when used in the centered layout */
  .main-center-container .image-container {
    height: calc(100vh - 30vh);
    max-height: 72vh;
  }
  /* Square variant when no Graph URL is available to avoid squishing */
  .main-center-container .image-container.square-container {
    aspect-ratio: 1 / 1;
    height: auto;
    max-height: none;
  }

  .image-container .center-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border: none;
    transition: transform 220ms ease, box-shadow 220ms ease;
    border-radius: 10px;
    cursor: pointer;
    object-fit: contain;
  }

  .image-container .center-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
  }

  .content-block {
    width: 100%;
    max-width: none;
    margin: 0 0 16px;
    background: linear-gradient(180deg, 
      rgba(255,255,255,0.04) 0%, 
      rgba(255,255,255,0.02) 50%, 
      rgba(0, 0, 0, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 15px;
  }

  /* Info buttons row below the image */
  .info-buttons-row {
    display: flex;
    gap: 12px;
    width: 100%;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
  }

  .info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 9999px;
    background: rgba(255,255,255,0.06);
    border: 2px solid #ffffff;
    color: #ffffff;
    font-weight: 700;
    min-width: 220px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  }

  .info-btn .btn-text {
    color: #ffffff;
    font-weight: 700;
  }

  .info-btn:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.09);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  }

  .info-btn:active {
    transform: translateY(0);
  }

  /* Image block with side columns */
  .image-block {
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 14vh);
    margin-bottom: 6vh;
    width: 100%;
  }

  .side-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    min-width: 120px;
  }

  /* Visual connection lines from side buttons to communities */
  .side-column::after {
    content: "";
    position: fixed;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, 
      rgba(255, 255, 255, 0.1) 0%, 
      rgba(255, 255, 255, 0.3) 50%, 
      rgba(255, 255, 255, 0.1) 100%);
    z-index: 50;
    animation: pulse 3s ease-in-out infinite;
  }

  .side-column.left::after {
    right: -20px;
  }

  .side-column.right::after {
    left: -20px;
  }

  @keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
  }

  .side-column.left {
    left: 60px;
  }

  /* Instructional text for side buttons */
  .side-column::before {
    content: "Communautés";
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0.8;
    transition: opacity 0.3s ease;
  }

  .side-column:hover::before {
    opacity: 1;
  }

  /* Hide "Communautés" text in portrait mode, show only in landscape */
  @media (orientation: portrait) {
    .side-column::before {
      display: none;
    }
  }

  .side-column.right {
    right: 60px;
  }

  .side-btn {
    width: 100%;
    min-width: 180px;
    height: 75px;
    justify-content: center;
    font-size: 21px;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
  }

  /* Enhanced side button indicators */
  .side-btn:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  /* Left button tooltips (appear on the right) */
  .side-column.left .side-btn:hover::after {
    content: "↓ Naviguer vers la communauté";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-left: 15px;
    animation: slideInRight 0.3s ease;
    pointer-events: none;
  }

  .side-column.left .side-btn:hover::before {
    content: "";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid rgba(0, 0, 0, 0.9);
    margin-left: 9px;
    z-index: 1000;
    pointer-events: none;
  }

  /* Right button tooltips (appear on the left) */
  .side-column.right .side-btn:hover::after {
    content: "↓ Naviguer vers la communauté";
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-right: 15px;
    animation: slideInLeft 0.3s ease;
    pointer-events: none;
  }

  .side-column.right .side-btn:hover::before {
    content: "";
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid rgba(0, 0, 0, 0.9);
    margin-right: 9px;
    z-index: 1000;
    pointer-events: none;
  }

  @keyframes slideInRight {
    from {
      opacity: 0;
      transform: translateY(-50%) translateX(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(-50%) translateX(0);
    }
  }

  @keyframes slideInLeft {
    from {
      opacity: 0;
      transform: translateY(-50%) translateX(10px);
    }
    to {
      opacity: 1;
      transform: translateY(-50%) translateX(0);
    }
  }

  .center-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
  }

  .image-wrapper {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
      rgba(255,255,255,0.04) 0%, 
      rgba(255,255,255,0.02) 50%, 
      rgba(255,255,255,0.01) 100%);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
  }
  
  /* Ensure iframes inside image-wrapper are clickable */
  .image-wrapper iframe.center-image {
    pointer-events: auto !important;
    z-index: 10;
  }

  .center-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border: none;
    transition: transform 220ms ease, box-shadow 220ms ease;
    border-radius: 10px;
    z-index: 1;
    outline: none;
    position: relative;
  }
  
  /* Ensure iframes are fully interactive */
  iframe.center-image {
    pointer-events: auto !important;
    z-index: 10 !important;
    position: relative;
  }

  .center-image.zoomed {
    transform: scale(1.6);
    cursor: zoom-out;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  }

  .center-image.image-loading {
    opacity: 0.7;
    transition: opacity 0.3s ease;
  }

  /* Enhanced clickable image indicators - only for images, not iframes */
  .center-image:not(.logo-image) {
    cursor: pointer;
  }
  
  /* Iframes should not have pointer cursor or hover effects */
  iframe.center-image:not(.logo-image) {
    cursor: default;
  }

  .center-image:not(.logo-image):hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
  }
  
  /* Disable hover effects for iframes */
  iframe.center-image:not(.logo-image):hover {
    transform: none;
    box-shadow: none;
    border: none;
  }

  .center-image:not(.logo-image):hover::after {
    content: "Cliquer pour agrandir";
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 1000;
    animation: fadeInUp 0.3s ease;
  }
  
  /* Don't show hover text for iframes */
  iframe.center-image:not(.logo-image):hover::after {
    content: none;
  }

  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateX(-50%) translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
  }

  /* Image caption with zoom instruction - only for images, not iframes */
  .center-image:not(.logo-image):not(iframe)::after {
    content: "🔍 Cliquer sur l'image pour zoomer";
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0.9;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none; /* Don't block clicks on the image itself */
  }

  .center-image:not(.logo-image):not(iframe):hover::after {
    opacity: 1;
    background: rgba(0, 0, 0, 0.9);
  }
  
  /* Ensure iframes have no overlay and pointer events work */
  iframe.center-image:not(.logo-image)::after {
    content: none !important;
    display: none !important;
    pointer-events: none !important;
  }
  
  /* Modal styles */
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
  }

  .modal-window {
    width: min(960px, 96vw);
    max-height: 85vh;
    overflow: auto;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 20px 24px;
    position: relative;
    color: var(--text);
    z-index: 10001;
  }
  
  .modal-title {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 1.4rem;
    font-weight: 700;
    text-align: left;
  }

  /* Portrait-mode layout and overlay fixes */
  @media (max-width: 768px) and (orientation: portrait) {
    /* Ensure the mobile community dropdown overlays above content */
    .mobile-dropdown-container,
    .custom-dropdown {
      position: relative;
      z-index: 20000;
    }
    .custom-dropdown .dropdown-menu {
      position: absolute;
      z-index: 20010;
    }

    /* Stack two-column rows vertically to prevent overlap */
    .layout-row.two-columns {
      flex-direction: column !important;
      align-items: stretch;
      gap: 12px;
    }
    .layout-row.two-columns .layout-module {
      width: 100% !important;
    }

    /* Center text inside text-module buttons and let them size naturally */
    .layout-row.two-columns .layout-module[data-type="text"] .text-module-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      width: 100%;
      height: auto !important;
      white-space: normal;
    }

    /* Order modules: stats first, then text buttons, then others */
    .layout-row.two-columns .layout-module[data-type="stats"] {
      order: 1;
    }
    .layout-row.two-columns .layout-module[data-type="text"] {
      order: 2;
    }
    .layout-row.two-columns .layout-module:not([data-type="stats"]):not([data-type="text"]) {
      order: 3;
    }
    
    /* Let statistics adapt to content height in portrait */
    .statistics-module .statistics-container {
      flex: 0 0 auto !important;
    }
    .statistics-box {
      height: auto !important;
    }
  }

  .modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
  }

  .modal-close:hover {
    opacity: 1;
  }

  .modal-content {
    line-height: 1.6;
    font-size: 1.05rem;
  }
  /* Enable pointer events for iframes */
  iframe.center-image {
    pointer-events: auto !important;
  }



  @media (max-width: 900px) {
    .image-block {
      min-height: 50vh;
    }
  }

  /* Red block with flexbox layout for dynamic column sizing */
  .text-actions-block {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-top: 1vh;
    border-color: rgba(0,0,0,0.15);
  }

  /* Single column layout for statistics */
  .text-actions-block .text-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .top-accounts-column {
    display: flex;
    flex-direction: column;
  }

  .top-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
  }
  
  /* Tooltip for truncated descriptions in top accounts */
  #desc-tooltip {
    position: fixed;
    max-width: 280px;
    background: rgba(0,0,0,0.9);
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 12px;
    line-height: 1.4;
    z-index: 30050;
    display: none;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    white-space: normal;
  }

  .account-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
  }

  .account-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
  }

  .account-item .rank {
    font-weight: bold;
    color: var(--accent);
    min-width: 30px;
  }

  .account-item .name {
    font-weight: 500;
    flex: 1;
  }

  .account-item .followers {
    color: var(--muted);
    font-size: 0.9em;
  }

  .text-content h3 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
  }


  .text-actions-block .text-column {
    display: flex;
    align-items: flex-start;
  }

  .text-actions-block .text-content {
    width: 100%;
  }

  .text-actions-block .actions-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    justify-content: flex-start;
  }

  .text-actions-block .btn {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.18);
  }

  /* Custom tooltip styles */
  .custom-tooltip {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    position: absolute;
    z-index: 9999;
  }

  /* Graph Grid Styles for index.html */
  .graph-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Default: 2 columns for desktop */
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
  }

  .graph-section {
    aspect-ratio: 1;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    /* Ensure smooth background rendering */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
  }

  .graph-section:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(255,255,255,0.2);
  }

  .graph-section h3 {
    margin: 0 0 15px 0;
    text-align: center;
    font-size: 1.2em;
    color: #ffffff;
  }

  .graph-section img {
    max-width: 80%;
    max-height: 70%;
    object-fit: contain;
    border-radius: 4px;
  }

  /* Responsive design for portrait/vertical screens */
  @media (max-width: 768px) and (orientation: portrait) {
    .graph-grid {
      grid-template-columns: 1fr; /* Single column for portrait mode */
      gap: 15px; /* Slightly smaller gap for mobile */
      padding: 15px; /* Smaller padding for mobile */
    }
    
    .graph-section {
      aspect-ratio: 1.2; /* Slightly taller for better mobile viewing */
    }
    
    .graph-section h3 {
      font-size: 1.1em; /* Slightly smaller font for mobile */
    }
  }

  /* Additional mobile optimization for very small screens */
  @media (max-width: 480px) {
    .graph-grid {
      padding: 10px;
      gap: 10px;
    }
    
    .graph-section {
      aspect-ratio: 1.1;
    }
  }

  /* Responsive design for main split section */
  @media (max-width: 768px) {
    /* Increase margin-top to prevent title from being hidden behind fixed header */
    main {
      margin-top: 16vh;
    }
    
    .main-split-container {
      flex-direction: column;
      gap: 20px;
      min-height: auto;
    }
    
    .left-section,
    .right-section {
      padding: 0;
    }
    
    .left-content {
      gap: 20px;
      overflow: visible;
    }
    
    .left-section {
      overflow: visible;
    }
    
    .main-title {
      font-size: 1.8rem;
    }
    
    .communities-title {
      font-size: 1.5rem;
    }
    
    .text-block,
    .communities-text-block {
      padding: 15px;
    }

    /* Hide desktop buttons in mobile */
    .desktop-buttons {
      display: none;
    }

    /* Mobile dropdown styles */
    .mobile-dropdown-container {
      display: block;
      margin-top: 20px;
      position: relative;
      overflow: visible;
      z-index: 10;
    }

    .dropdown-title {
      font-size: 1.2rem;
      margin-bottom: 15px;
      color: #fff;
      text-align: center;
    }

    .dropdown-wrapper {
      width: 100%;
      position: relative;
      overflow: visible;
    }

    /* Custom dropdown styles */
    .custom-dropdown {
      position: relative;
      width: 100%;
      z-index: 1;
    }

    .custom-dropdown.dropdown-disabled .dropdown-trigger {
      cursor: not-allowed;
      opacity: 0.6;
    }
    
    .dropdown-trigger {
      width: 100%;
      padding: 12px 16px;
      background: rgba(255, 255, 255, 0.1);
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 8px;
      color: #fff;
      cursor: pointer;
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .dropdown-trigger:hover {
      background: rgba(255, 255, 255, 0.15);
      border-color: rgba(255, 255, 255, 0.3);
    }

    .dropdown-arrow {
      transition: transform 0.3s ease;
    }

    .custom-dropdown.open .dropdown-arrow {
      transform: rotate(180deg);
    }

    .dropdown-menu {
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      background: rgba(26, 26, 46, 0.95);
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 8px;
      margin-top: 4px;
      max-height: 0;
      overflow: hidden;
      opacity: 0;
      visibility: hidden;
      display: block;
      transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
      z-index: 30000; /* Ensure above stats and titles */
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .custom-dropdown.open .dropdown-menu {
      max-height: 400px !important;
      opacity: 1 !important;
      visibility: visible !important;
      overflow-y: auto !important;
      overflow-x: hidden !important;
      display: block !important;
    }

    .dropdown-option {
      padding: 12px 16px;
      cursor: pointer;
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      background: rgba(255, 255, 255, 0.05);
    }

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

    .dropdown-option.disabled {
      opacity: 0.6;
      cursor: not-allowed;
      pointer-events: none;
    }
    
    .dropdown-option:hover {
      background: rgba(255, 255, 255, 0.15);
    }

    .dropdown-option .btn-text {
      flex: 1;
      text-align: left;
      color: #fff;
    }

    .dropdown-option .btn-right {
      display: flex;
      align-items: center;
      gap: 4px;
      flex-shrink: 0;
    }

    .dropdown-option .btn-separator {
      opacity: 0.7;
    }
  }

  /* Hide mobile dropdown in desktop */
  @media (min-width: 769px) {
    .mobile-dropdown-container {
      display: none;
    }
  }
    
    .text-block p,
    .communities-text-block p {
      font-size: 1rem;
    }
    
    .community-btn {
      width: 45%;
      padding: 12px 18px;
      font-size: 1rem;
    }
    
    .zoom-title {
      font-size: 1.2rem;
      padding: 8px 15px;
    }
    
    .image-container {
      min-height: 300px;
    }
  }

  @media (max-width: 480px) {
    .main-split-section {
      padding: 15px;
    }
    
    .main-split-container {
      gap: 15px;
    }
    
    .left-content {
      gap: 15px;
    }
    
    .main-title {
      font-size: 1.6rem;
    }
    
    .communities-title {
      font-size: 1.3rem;
    }
    
    .text-block,
    .communities-text-block {
      padding: 12px;
    }
    
    .community-btn {
      width: 52.5%;
      padding: 9px 15px;
      font-size: 0.9rem;
    }
    
    .zoom-title {
      font-size: 1.1rem;
      padding: 6px 12px;
    }
    
    .image-container {
      min-height: 250px;
    }
  }

  /* Responsive design for main.html - Portrait/Mobile mode */
  @media (max-width: 768px) and (orientation: portrait) {
    /* Hide navbar text in portrait mode, but keep icons */
    .nav-link {
      padding: 8px;
      min-width: 44px;
      justify-content: center;
    }
    
    /* Hide text content but keep SVG icons */
    .nav-link:not(.return-to-main):not(.return-to-top) {
      font-size: 0; /* Hide text */
    }
    
    .nav-link:not(.return-to-main):not(.return-to-top) svg {
      font-size: 30px; /* Restore icon size */
    }
    
      .nav-link.return-to-main,
  .nav-link.return-to-top {
    font-size: 12px;
    padding: 8px 12px;
  }

    
    /* Hide landscape text in portrait mode */
    .landscape {
      display: none !important;
    }
    
    /* Make image shorter in portrait mode */
    .image-block {
      height: calc(100vh - 14vh);
    }
    
    .center-area {
      height: 60% !important; /* Make image area shorter */
    }
    
    /* Make buttons stick to sides in portrait mode */
    .side-column.left {
      justify-content: flex-start !important;
    }
    
    .side-column.right {
      justify-content: flex-end !important;
    }
    
    /* Make right buttons float to the right */
    .side-column.right .side-btn {
      float: right !important;
      margin-left: auto !important;
    }
    
    /* Make buttons square with abbreviated text */
    .side-btn {
      width: 45px !important;
      height: 45px !important;
      min-width: 45px !important;
      border-radius: 6px !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      font-size: 14px !important;
      font-weight: bold !important;
      padding: 0 !important;
      position: relative !important;
      overflow: hidden !important;
      text-overflow: clip !important;
      white-space: nowrap !important;
    }
    

  }

  /* Additional mobile optimizations for very small screens */
  @media (max-width: 480px) {
    .side-btn {
      width: 40px !important;
      height: 40px !important;
      min-width: 40px !important;
      font-size: 12px !important;
    }
    
    .side-column.left,
    .side-column.right {
      gap: 6px;
    }
  }
  
  /* Ensure original button styling in landscape mode */
  @media (min-width: 769px), (orientation: landscape) {
    .side-btn {
      width: auto !important;
      height: auto !important;
      border-radius: 6px !important;
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
      font-size: 21px !important;
      font-weight: 500 !important;
      padding: 12px 24px !important;
      position: relative !important;
      overflow: visible !important;
      text-overflow: unset !important;
      white-space: normal !important;
      min-width: 180px !important;
    }
    

  }

/* PhotoSwipe Custom Styles */
.pswp {
  --pswp-bg: rgba(0, 0, 0, 0.95);
  --pswp-placeholder-bg: rgba(0, 0, 0, 0.3);
  --pswp-ui-bg: rgba(0, 0, 0, 0.8);
  --pswp-ui-element-color: #fff;
  --pswp-ui-element-hover-color: #fff;
  --pswp-ui-element-hover-bg: rgba(255, 255, 255, 0.2);
  --pswp-ui-element-active-bg: rgba(255, 255, 255, 0.3);
  --pswp-ui-element-disabled-color: rgba(255, 255, 255, 0.3);
  --pswp-ui-element-disabled-bg: rgba(255, 255, 255, 0.1);
  --pswp-ui-element-border-radius: 4px;
  --pswp-ui-element-margin: 8px;
  --pswp-ui-element-padding: 8px;
  --pswp-ui-element-font-size: 14px;
  --pswp-ui-element-font-weight: 500;
  --pswp-ui-element-text-transform: none;
  --pswp-ui-element-letter-spacing: 0;
  --pswp-ui-element-line-height: 1.2;
  --pswp-ui-element-text-decoration: none;
  --pswp-ui-element-text-shadow: none;
  --pswp-ui-element-box-shadow: none;
  --pswp-ui-element-transition: all 0.3s ease;
  --pswp-ui-element-transform: none;
  --pswp-ui-element-opacity: 1;
  --pswp-ui-element-visibility: visible;
  --pswp-ui-element-pointer-events: auto;
  --pswp-ui-element-cursor: pointer;
  --pswp-ui-element-user-select: none;
  --pswp-ui-element-touch-action: manipulation;
  --pswp-ui-element-outline: none;
  --pswp-ui-element-border: none;
  --pswp-ui-element-background: transparent;
  --pswp-ui-element-fill: currentColor;
  --pswp-ui-element-stroke: none;
  --pswp-ui-element-stroke-width: 0;
  --pswp-ui-element-stroke-linecap: butt;
  --pswp-ui-element-stroke-linejoin: miter;
  --pswp-ui-element-stroke-miterlimit: 4;
  --pswp-ui-element-stroke-dasharray: none;
  --pswp-ui-element-stroke-dashoffset: 0;
  --pswp-ui-element-stroke-opacity: 1;
  --pswp-ui-element-fill-opacity: 1;
  --pswp-ui-element-fill-rule: nonzero;
  --pswp-ui-element-clip-rule: nonzero;
  --pswp-ui-element-mask: none;
  --pswp-ui-element-filter: none;
  --pswp-ui-element-backdrop-filter: none;
  --pswp-ui-element-mix-blend-mode: normal;
  --pswp-ui-element-isolation: auto;
  --pswp-ui-element-object-fit: fill;
  --pswp-ui-element-object-position: 50% 50%;
  --pswp-ui-element-resize: none;
  --pswp-ui-element-appearance: none;
  --pswp-ui-element-writing-mode: horizontal-tb;
  --pswp-ui-element-direction: ltr;
  --pswp-ui-element-unicode-bidi: normal;
  --pswp-ui-element-text-orientation: mixed;
  --pswp-ui-element-text-combine-upright: none;
  --pswp-ui-element-text-emphasis: none;
  --pswp-ui-element-text-emphasis-color: currentColor;
  --pswp-ui-element-text-emphasis-style: none;
  --pswp-ui-element-text-emphasis-position: over;
  --pswp-ui-element-text-indent: 0;
  --pswp-ui-element-text-justify: auto;
  --pswp-ui-element-text-overflow: clip;
  --pswp-ui-element-text-rendering: auto;
  --pswp-ui-element-text-size-adjust: auto;
  --pswp-ui-element-text-underline-position: auto;
  --pswp-ui-element-text-underline-offset: auto;
  --pswp-ui-element-text-decoration-color: currentColor;
  --pswp-ui-element-text-decoration-line: none;
  --pswp-ui-element-text-decoration-skip: objects;
  --pswp-ui-element-text-decoration-skip-ink: auto;
  --pswp-ui-element-text-decoration-style: solid;
  --pswp-ui-element-text-decoration-thickness: auto;
  --pswp-ui-element-text-underline-offset: auto;
  --pswp-ui-element-text-underline-position: auto;
  --pswp-ui-element-text-emphasis: none;
  --pswp-ui-element-text-emphasis-color: currentColor;
  --pswp-ui-element-text-emphasis-style: none;
  --pswp-ui-element-text-emphasis-position: over;
  --pswp-ui-element-text-combine-upright: none;
  --pswp-ui-element-text-orientation: mixed;
  --pswp-ui-element-writing-mode: horizontal-tb;
  --pswp-ui-element-direction: ltr;
  --pswp-ui-element-unicode-bidi: normal;
  --pswp-ui-element-resize: none;
  --pswp-ui-element-appearance: none;
  --pswp-ui-element-object-fit: fill;
  --pswp-ui-element-object-position: 50% 50%;
  --pswp-ui-element-mix-blend-mode: normal;
  --pswp-ui-element-isolation: auto;
  --pswp-ui-element-filter: none;
  --pswp-ui-element-backdrop-filter: none;
  --pswp-ui-element-mask: none;
  --pswp-ui-element-clip-rule: nonzero;
  --pswp-ui-element-fill-rule: nonzero;
  --pswp-ui-element-fill-opacity: 1;
  --pswp-ui-element-stroke-opacity: 1;
  --pswp-ui-element-stroke-dashoffset: 0;
  --pswp-ui-element-stroke-dasharray: none;
  --pswp-ui-element-stroke-miterlimit: 4;
  --pswp-ui-element-stroke-linejoin: miter;
  --pswp-ui-element-stroke-linecap: butt;
  --pswp-ui-element-stroke-width: 0;
  --pswp-ui-element-stroke: none;
  --pswp-ui-element-fill: currentColor;
  --pswp-ui-element-color: #fff;
  --pswp-ui-element-background: transparent;
  --pswp-ui-element-border: none;
  --pswp-ui-element-outline: none;
  --pswp-ui-element-touch-action: manipulation;
  --pswp-ui-element-user-select: none;
  --pswp-ui-element-cursor: pointer;
  --pswp-ui-element-visibility: visible;
  --pswp-ui-element-opacity: 1;
  --pswp-ui-element-transform: none;
  --pswp-ui-element-transition: all 0.3s ease;
  --pswp-ui-element-box-shadow: none;
  --pswp-ui-element-text-shadow: none;
  --pswp-ui-element-text-decoration: none;
  --pswp-ui-element-letter-spacing: 0;
  --pswp-ui-element-line-height: 1.2;
  --pswp-ui-element-text-transform: none;
  --pswp-ui-element-font-weight: 500;
  --pswp-ui-element-font-size: 14px;
  --pswp-ui-element-padding: 8px;
  --pswp-ui-element-margin: 8px;
  --pswp-ui-element-border-radius: 4px;
  --pswp-ui-element-disabled-bg: rgba(255, 255, 255, 0.1);
  --pswp-ui-element-disabled-color: rgba(255, 255, 255, 0.3);
  --pswp-ui-element-active-bg: rgba(255, 255, 255, 0.3);
  --pswp-ui-element-hover-bg: rgba(255, 255, 255, 0.2);
  --pswp-ui-element-hover-color: #fff;
  --pswp-ui-element-color: #fff;
  --pswp-ui-bg: rgba(0, 0, 0, 0.8);
  --pswp-placeholder-bg: rgba(0, 0, 0, 0.3);
  --pswp-bg: rgba(0, 0, 0, 0.95);
}

/* Additional PhotoSwipe styling for better integration */
.pswp__button {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 4px !important;
}

.pswp__button:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Responsive PhotoSwipe fixes for different screen resolutions */
.pswp__img {
  /* Improve image quality on high DPI displays */
  image-rendering: auto !important;
  /* Ensure proper touch handling */
  touch-action: manipulation !important;
  pointer-events: auto !important;
}

/* Fix for pixelated images on different resolutions */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .pswp__img {
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: crisp-edges !important;
  }
}

/* Ensure PhotoSwipe pan and zoom functionality works properly */
.pswp__zoom-wrap {
  touch-action: manipulation !important;
  pointer-events: auto !important;
}

.pswp__item {
  touch-action: manipulation !important;
  pointer-events: auto !important;
}

/* Bootstrap Alert positioning fix - very specific selector */
.alert.alert-primary.alert-dismissible {
  position: relative;
  top: 14vh; /* Position below the fixed header */
  z-index: 1001; /* Above header to ensure visibility and closability */
  margin: 0 auto !important;
  width: 80% !important; /* Match navbar content width */
  border-radius: 8px !important;
  /* Darker primary color */
  background-color: #0a4d8c !important;
  border-color: #0a4d8c !important;
  color: white !important;
}

/* Ensure content never appears under the header */
main {
  position: relative;
  z-index: 1; /* Below header and alert */
  margin-top: 14vh; /* Push content below the fixed header */
}

/* Ensure all content sections are properly positioned */
.content-block,
.section,
.communities-buttons {
  position: relative;
}

/* Ensure header elements maintain their original styling */
.top-bar {
  background: var(--bg) !important;
}

.navbar {
  background: var(--surface) !important; /* Dark grey navbar background */
}

.title {
  color: white !important;
}

/* Hide the header title on small portrait screens */
@media (max-width: 768px) and (orientation: portrait) {
  .top-bar .title {
    display: none;
  }
}

/* If main image comes from parameters (not folder), hide zoom helper text above image */
.main-center-container.using-param-image .zoom-title {
  display: none !important;
}

/* Mobile pagination row (hidden by default; shown in portrait) */
.mobile-pagination-row {
  display: none;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 8px 0 12px 0;
}

.mobile-pagination-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  padding: 6px 12px;
  transition: all 0.3s ease;
  min-width: 44px;
  height: 36px;
  font-size: 1rem;
}

.mobile-pagination-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.mobile-pagination-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 768px) and (orientation: portrait) {
  .mobile-pagination-row {
    display: flex;
    justify-content: center;
  }
  /* Ensure full content is visible for posts/clips when expanded */
  .posts-content,
  .clips-content {
    overflow: visible !important;
  }
  
  /* Use only the horizontal mobile pagination in portrait */
  .posts-pagination {
    display: none !important;
  }
  
  /* Remove extra right padding reserved for vertical pagination */
  .top-posts-container {
    padding-right: 0 !important;
    padding-left: 0 !important;
    justify-content: center !important;
    align-items: center !important;
  }
  
  /* Scale down Bluesky embeds to fit on small portrait screens */
  .top-post-item .bsky-embed-wrapper {
    transform: scale(0.85);
    transform-origin: top center;
    display: inline-block;
    width: auto;
    margin: 0 auto;
  }
  
  .top-post-item {
    overflow: visible;
    margin: 0 auto;
    padding: 0 8px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }
  
  /* Ensure the embedded blockquote doesn't exceed container width */
  .top-post-item blockquote.bluesky-embed {
    max-width: 100% !important;
    display: inline-block;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  
  /* Make intro text full width-ish on small screens for readability */
  .main-intro-text {
    width: 90% !important;
    max-width: 90% !important;
  }
  .intro-divider {
    width: 80%;
  }
}
/* Fix navbar text color */
.navbar *,
.nav-list,
.nav-list *,
.nav-link,
.nav-link *,
.nav-actions,
.nav-actions * {
  color: white !important;
}

/* Fix top accounts table text color */
.top-accounts-table,
.top-accounts-table *,
.top-accounts-table .header-cell,
.top-accounts-table .table-cell,
.top-accounts-table th,
.top-accounts-table td {
  color: white !important;
}

/* Make images clickable in gallery mode */
.center-image {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: none;
  outline: none;
}

.section-image {
  border: none;
  outline: none;
}

/* Ensure section image links work as normal links */
a .section-image {
  cursor: default;
}

/* Top Accounts Table Styling */
.top-accounts-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  scroll-left: 0;
  scroll-snap-align: start;
}

.table-header {
  display: flex;
  background-color: rgba(255, 255, 255, 0.1);
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  font-weight: bold;
}

.table-row {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color 0.2s ease;
}

.table-row:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.table-cell {
  flex: 1;
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  min-width: 0;
  overflow: hidden;
}

/* Specific column sizing */
.table-cell:first-child {
  flex: 0 0 40px; /* Index column - fixed width for numbers up to 99 */
  max-width: 40px;
  text-align: center;
}

.table-cell:nth-child(2) {
  flex: 0 0 180px; /* Name column - increased width to prevent cropping */
  max-width: 180px;
}

/* Avatar image column: wide enough for header text "Avatar" */
.top-accounts-table .table-cell.avatar-column {
  flex: 0 0 100px;
  max-width: 100px;
  min-width: 100px;
  text-align: center;
}

.header-cell {
  font-weight: bold;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

  .value-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    width: 100%;
  }
  
  .value {
    font-weight: 500;
    color: #ffffff;
    font-size: 0.9rem;
  }
  
  /* Ensure description fits on one line with ellipsis within its column */
  .top-accounts-table .desc-truncated {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
  }
  
  .progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    min-width: 2px;
  }

/* Responsive adjustments for the table */
@media (max-width: 768px) {
  .table-cell {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  .header-cell {
    font-size: 0.75rem;
  }
  
  .value {
    font-size: 0.8rem;
  }
  
  .value-container {
    width: 100%;
    text-align: center;
  }
  
  .value {
    text-align: center;
  }
  
  .progress-bar-container {
    height: 4px;
    width: 60%;
    margin: 0 auto;
  }
}

/* Statistics boxes styling */
.statistics-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 0;
}

/* Statistics container margin - no top margin since title handles spacing */
.statistics-module .statistics-container {
  margin-top: 0;
}

/* Single statistic - takes full width */
.statistics-container.stats-single {
  flex-direction: column;
}

.statistics-container.stats-single .statistics-box {
  flex: 0 0 100%;
  max-width: 100%;
}

/* Two statistics - stacked vertically */
.statistics-container.stats-two {
  flex-direction: column;
}

.statistics-container.stats-two .statistics-box {
  flex: 0 0 100%;
  max-width: 100%;
}

/* Three statistics - stacked vertically */
.statistics-container.stats-three {
  flex-direction: column;
}

.statistics-container.stats-three .statistics-box {
  flex: 0 0 100%;
  max-width: 100%;
}

/* Four statistics - 2x2 grid */
.statistics-container.stats-four {
  flex-wrap: wrap;
}

.statistics-container.stats-four .statistics-box {
  flex: 0 0 calc(50% - 6px);
  max-width: calc(50% - 8px);
}

/* Five or more statistics - use default flex behavior */
.statistics-container.stats-many {
  flex-wrap: wrap;
}

.statistics-box {
  background-color: #000000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 120px;
  text-align: right;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.statistics-value {
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 4px;
  line-height: 1.2;
}

/* Style for word lists in statistics - make words bigger and bold */
.statistics-value.word-list {
  font-size: 1.4rem;
  line-height: 1.6;
}

.statistics-value.word-list .word-list-item {
  font-size: 1.4rem;
  font-weight: 700;
  display: inline-block;
  margin: 0 2px;
}

.statistics-key {
  color: #ffffff;
  font-size: 0.9rem;
  opacity: 0.8;
  line-height: 1.2;
  margin-top: auto; /* Push to bottom of the box */
}

/* Landscape mode: responsive layouts */
@media (min-width: 769px) {
  /* Single statistic - takes full width */
  .statistics-container.stats-single .statistics-box {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  /* Two statistics - side by side */
  .statistics-container.stats-two .statistics-box {
    flex: 0 0 calc(50% - 6px);
    max-width: calc(50% - 6px);
  }
  
  /* Three statistics - side by side */
  .statistics-container.stats-three .statistics-box {
    flex: 0 0 calc(33.333% - 8px);
    max-width: calc(33.333% - 8px);
  }
  
  /* Four statistics - 2x2 grid */
  .statistics-container.stats-four .statistics-box {
    flex: 0 0 calc(50% - 6px);
    max-width: calc(50% - 6px);
  }
  
  /* Five or more statistics - 3 per line */
  .statistics-container.stats-many .statistics-box {
    flex: 0 0 calc(33.333% - 8px);
    max-width: calc(33.333% - 8px);
  }

/* When a stats module is configured as singleLine, always show 3 statistics per row (desktop)
   and use a horizontal layout so they align on one row when possible */
.statistics-container.stats-singleline {
  flex-direction: row;
  flex-wrap: wrap;
}
.statistics-container.stats-singleline .statistics-box {
  flex: 0 0 calc(33.333% - 8px);
  max-width: calc(33.333% - 8px);
}

/* When a stats module is NOT singleLine (half-width), always show 2 statistics per row (desktop)
   and use a horizontal layout so they align on one row when possible */
.statistics-container.stats-twocolumns {
  flex-direction: row;
  flex-wrap: wrap;
}
.statistics-container.stats-twocolumns .statistics-box {
  flex: 0 0 calc(50% - 6px);
  max-width: calc(50% - 6px);
}
}

/* Portrait mode: force full width for all statistics boxes */
@media (max-width: 768px) {
  /* Override all responsive layout classes in portrait mode */
  .statistics-container.stats-single .statistics-box,
  .statistics-container.stats-two .statistics-box,
  .statistics-container.stats-three .statistics-box,
  .statistics-container.stats-four .statistics-box,
  .statistics-container.stats-many .statistics-box,
  .statistics-container.stats-twocolumns .statistics-box,
  .statistics-container.stats-singleline .statistics-box {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  
  /* Force all stats containers to stack vertically in portrait mode */
  .statistics-container.stats-single,
  .statistics-container.stats-two,
  .statistics-container.stats-three,
  .statistics-container.stats-four,
  .statistics-container.stats-many,
  .statistics-container.stats-twocolumns,
  .statistics-container.stats-singleline {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
  }
  
  /* Stack columns vertically in portrait mode */
  .row {
    flex-direction: column !important;
    height: auto !important;
    min-height: auto !important;
  }
  
  .columns-row {
    flex-direction: column !important;
    height: auto !important;
    min-height: auto !important;
  }
  
  .text-column,
  .top-accounts-column {
    width: 100% !important;
    padding: 10px 0 !important;
  }
  
  /* Adjust spacing for stacked layout */
  .text-column {
    margin-bottom: 20px;
  }
  
  /* Top accounts table base styles */
  .top-accounts-table {
    font-size: 0.9rem;
    position: relative;
    max-width: 100%;
    /* Default: no horizontal scrolling */
    overflow-x: visible;
    white-space: normal;
  }
  
  /* Enable horizontal scrolling only in portrait mode */
  @media (max-width: 768px) and (orientation: portrait) {
    .top-accounts-table {
      overflow-x: auto !important;
      white-space: nowrap !important;
      -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
      scrollbar-width: thin; /* Firefox */
      scrollbar-color: rgba(255, 255, 255, 0.3) transparent; /* Firefox */
      /* Ensure proper sizing for horizontal scroll */
      width: 100%;
      min-width: 0;
      scroll-left: 0; /* Start scroll at the left */
      direction: ltr; /* Ensure left-to-right direction */
    }
  }
  
  /* Custom scrollbar for webkit browsers - only in portrait mode */
  @media (max-width: 768px) and (orientation: portrait) {
    .top-accounts-table::-webkit-scrollbar {
      height: 6px;
    }
    
    .top-accounts-table::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 3px;
    }
    
    .top-accounts-table::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.3);
      border-radius: 3px;
    }
    
    .top-accounts-table::-webkit-scrollbar-thumb:hover {
      background: rgba(255, 255, 255, 0.5);
    }
  }
  
  /* Clip placeholder styles to replace images */
  .clip-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
  }
  
  .play-icon-large {
    font-size: 3rem;
    color: white;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  }
  
  .clip-text {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  
  .clip-subtext {
    font-size: 0.75rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    margin-top: 4px;
  }
  
  .clip-error-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 20px;
  }
  
  .clip-error-placeholder .play-icon-large {
    font-size: 3rem;
    color: #ff6b6b;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  }
  
  /* Special styling for CSP blocked clips */
  .clip-error-placeholder .play-icon-large:contains('🚫') {
    color: #ff4757;
    animation: pulse 2s infinite;
  }
  
  @keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
  }
  
  /* Ensure table content doesn't wrap and maintains proper widths */
  .table-header,
  .table-row {
    min-width: max-content !important;
    display: flex !important;
    width: max-content !important; /* Allow table to be wider than container */
    flex-shrink: 0 !important;
  }
  
  /* Add smooth scrolling behavior */
  .top-accounts-table {
    scroll-behavior: smooth;
  }
  
  /* Improve touch scrolling on mobile */
  .top-accounts-table {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  
  /* Prevent any layout shifts during scrolling */
  .top-accounts-table {
    /* Force hardware acceleration for smooth scrolling */
    transform: translateZ(0);
    will-change: scroll-position;
  }
  
  .table-cell {
    padding: 6px 8px;
    flex-shrink: 0 !important; /* Prevent cells from shrinking */
    min-width: 80px !important; /* Ensure minimum width for readability */
    white-space: nowrap !important; /* Prevent text wrapping */
  }
  
  .table-cell:first-child {
    flex: 0 0 30px !important;
    max-width: 30px !important;
    min-width: 30px !important;
  }
  
  .table-cell:nth-child(2) {
    flex: 0 0 150px !important;
    max-width: 150px !important;
    min-width: 150px !important;
  }
  
  /* Ensure other cells have reasonable minimum widths */
  .table-cell:not(:first-child):not(:nth-child(2)) {
    min-width: 150px !important;
    flex: 0 0 150px !important;
  }
  
  /* Ensure header cells align with data cells */
  .header-cell {
    justify-content: center; /* Center header text */
    font-weight: bold;
    text-align: center;
      /* Header cells need more width for full text display */
  min-width: 150px !important;
  flex: 0 0 150px !important;
  }
  
  /* Specific header cell widths for better text display */
  .header-cell:first-child {
    flex: 0 0 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
  }
  
  .header-cell:nth-child(2) {
    flex: 0 0 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
  }
  
  /* Portrait mode specific styles */
  @media (max-width: 768px) and (orientation: portrait) {
    .table-header,
    .table-row {
      display: grid;
      grid-template-columns: 30px 100px repeat(auto-fit, 100px);
      gap: 0;
      align-items: stretch;
    }
    
    .table-cell {
      min-width: 0; /* Allow grid to control sizing */
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .table-cell:first-child {
      justify-content: center;
    }
    
    .table-cell:nth-child(2) {
      justify-content: flex-start;
    }
    
    .table-cell:not(:first-child):not(:nth-child(2)) {
      justify-content: center;
    }
  }
  
  /* Add scroll indicators for portrait mode only */
  .top-accounts-table::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.3));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    /* Hide by default - only show in portrait mode */
    display: none;
  }
  
  .top-accounts-table::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, transparent, rgba(0, 0, 0, 0.3));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    /* Hide by default - only show in portrait mode */
    display: none;
  }
  
  /* Show scroll indicators only in portrait mode */
  @media (max-width: 768px) and (orientation: portrait) {
    .top-accounts-table::after,
    .top-accounts-table::before {
      display: block;
    }
    
    .top-accounts-table.scrollable::after {
      opacity: 1;
    }
    
    .top-accounts-table.scrollable-left::before {
      opacity: 1;
    }
  }
  
  /* Scroll hint removed - no longer needed */
}

.center-image:hover {
  transform: scale(1.02);
}

/* Mobile optimizations for fullscreen gallery */
@media (max-width: 768px) {
  .close-button {
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .zoom-indicator {
    bottom: 15px;
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .fullscreen-image.zoomed {
    transform: scale(1.5);
  }
}

/* Trending clips styles */
.trending-clips-row {
  margin-top: 20px;
  padding: 20px 0;
}

/* Top posts styles */
.top-posts-row {
  margin-top: 20px;
  padding: 20px 0;
}

.top-posts-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 20px;
  padding: 0 10px 0 10px;
  padding-right: 60px;
  position: relative;
  justify-content: space-around;
}

.top-post-item {
  width: calc(33.333% - 14px);
  max-width: calc(33.333% - 14px);
  margin-bottom: 20px;
  min-width: 350px;
}

.top-post-item blockquote.bluesky-embed {
  margin: 0;
  padding: 0;
  width: 100%;
}

/* Posts pagination styles - same as clips */
.posts-pagination {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  align-items: center;
}

/* Posts toggle button styling - same as clips */
.posts-toggle-btn {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 8px !important;
  color: #ffffff !important;
  cursor: pointer !important;
  font-size: 1.2rem !important;
  font-weight: 500 !important;
  width: 100% !important;
  padding: 12px 20px !important;
  margin-bottom: 15px !important;
  transition: all 0.3s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.pagination-info-header {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: bold;
  white-space: nowrap;
  text-align: right;
  opacity: 0.9;
  padding: 8px 20px 12px 20px;
  margin-bottom: 10px;
}

.posts-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-2px) !important;
}

.posts-toggle-btn:active {
  transform: translateY(0) !important;
  background: rgba(255, 255, 255, 0.2) !important;
}

.posts-arrow {
  transition: transform 0.3s ease !important;
  display: inline-block !important;
}

.posts-toggle-btn.open .posts-arrow {
  transform: rotate(180deg) !important;
}

/* Responsive design for posts */
@media (max-width: 768px) {
  .posts-pagination {
    right: 5px;
  }
  
  .top-posts-container {
    padding-right: 50px;
  }
  
  .top-post-item {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .posts-pagination {
    right: 5px;
  }
  
  .top-posts-container {
    padding-right: 45px;
  }
  
  .top-post-item {
    width: 100%;
    max-width: 100%;
  }
}

/* Clips pagination styles */
.clips-pagination {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.pagination-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  padding: 8px 12px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.pagination-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
  transform: none;
}

.pagination-btn svg {
  width: 20px;
  height: 20px;
}

/* Responsive design for pagination buttons */
@media (max-width: 768px) {
  .clips-pagination {
    right: 5px;
  }
  
  .trending-clips-container {
    padding-right: 50px;
  }
  
  .pagination-btn {
    min-width: 35px;
    height: 35px;
    padding: 6px 10px;
  }
  
  .pagination-btn svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 480px) {
  .clips-pagination {
    right: 5px;
  }
  
  .trending-clips-container {
    padding-right: 45px;
  }
  
  .pagination-btn {
    min-width: 30px;
    height: 30px;
    padding: 4px 8px;
  }
  
  .pagination-btn svg {
    width: 14px;
    height: 14px;
  }
}

/* Clips toggle button styling */
.clips-toggle-btn {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 8px !important;
  color: #ffffff !important;
  cursor: pointer !important;
  font-size: 1.2rem !important;
  font-weight: 500 !important;
  width: 100% !important;
  padding: 12px 20px !important;
  margin-bottom: 15px !important;
  transition: all 0.3s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.clips-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-2px) !important;
}

.clips-toggle-btn:active {
  transform: translateY(0) !important;
  background: rgba(255, 255, 255, 0.2) !important;
}

.clips-arrow {
  transition: transform 0.3s ease !important;
  display: inline-block !important;
}

.clips-toggle-btn.open .clips-arrow {
  transform: rotate(180deg) !important;
}

.trending-clips-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  padding: 0 10px 0 10px;
  padding-right: 60px;
  position: relative;
}

.trending-clip-square {
  width: 22%;
  height: 25vh;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.clip-title {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  color: white;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  margin: 0;
  font-size: 14px;
  max-width: 80%;
  word-wrap: break-word;
}

.clip-preview {
  position: relative;
}

.clip-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.clip-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  transition: transform 0.3s ease;
}

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

.clip-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  color: white;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
}

.play-icon-large {
  font-size: 2.5rem;
  margin-bottom: 10px;
  opacity: 0.8;
}

.clip-text {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 5px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.clip-subtext {
  font-size: 0.7rem;
  opacity: 0.8;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.play-icon {
  color: white;
  font-size: 24px;
  font-style: normal;
}

.play-button:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translate(-50%, -50%) scale(1.1);
}

.clip-iframe-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
}

.close-clip {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  z-index: 4;
  transition: all 0.3s ease;
}

.close-clip:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.trending-clip-square iframe {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  pointer-events: auto;
}

.clip-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 12px;
  pointer-events: none;
}

.trending-clip-square:hover .clip-overlay {
  opacity: 1;
}

.clip-overlay span {
  color: white;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  z-index: 3;
}

.trending-clip-square:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}



.trending-clip-square span {
  z-index: 2;
  position: relative;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Responsive design for trending clips */
@media (max-width: 768px) {
  .trending-clips-container {
    justify-content: center;
    gap: 10px;
  }
  
  .trending-clip-square {
    width: 45%;
    height: 150px;
    font-size: 0.9rem;
  }
  
  .trending-clip-square iframe {
    width: 100%;
    height: 100%;
    pointer-events: auto;
  }
}

@media (max-width: 480px) {
  .trending-clips-container {
    flex-direction: column;
    align-items: center;
  }
  
  .trending-clip-square {
    width: 80%;
    height: 180px;
  }
  
  .trending-clip-square iframe {
    width: 100%;
    height: 100%;
    pointer-events: auto;
  }
}

/* SousGraph subcategory button styles */
.sousgraph-link-container {
  width: 100%;
  margin-top: 30px;
  margin-bottom: 20px;
}

.sousgraph-rectangle {
  background-color: #000000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  gap: 20px;
  align-items: stretch;
}

.sousgraph-left-part {
  width: 70%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.sousgraph-description {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
}

.sousgraph-description p {
  margin: 0 0 1em 0;
}

.sousgraph-description p:last-child {
  margin-bottom: 0;
}

.sousgraph-right-part {
  width: 30%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.sousgraph-zoom-text {
  color: var(--text);
  font-size: 0.9rem;
  text-align: center;
  font-weight: 500;
}

.sousgraph-button {
  display: inline-block;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  width: 100%;
  max-width: 200px;
}

.sousgraph-button-image {
  width: 100%;
  height: auto;
  max-width: 200px;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  transition: transform 0.2s, box-shadow 0.2s;
}

.sousgraph-button:hover .sousgraph-button-image {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sousgraph-button:active .sousgraph-button-image {
  transform: scale(1);
}

/* Responsive design for sousgraph button */
@media (max-width: 768px) {
  .sousgraph-rectangle {
    flex-direction: column;
    gap: 20px;
  }
  
  .sousgraph-left-part {
    width: 100%;
  }
  
  .sousgraph-right-part {
    width: 100%;
  }
  
  .sousgraph-button {
    max-width: 100%;
  }
  
  .sousgraph-button-image {
    max-width: 100%;
  }
}

/* Dynamic layout styles for subcategories */
.dynamic-layout {
  width: 100%;
}

.community-name-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.community-name-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 600;
}

/* Slider styles for community sections */
.community-name-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.community-name-header .slider-arrow {
  transition: transform 0.2s ease;
}
section.slider-open .community-name-header .slider-arrow {
  transform: rotate(180deg);
}

.layout-row {
  display: flex;
  width: 100%;
  margin-bottom: 30px;
  margin-top: 0;
  gap: 20px;
  clear: both;
  overflow: visible;
  min-height: 0;
  position: relative;
  z-index: auto;
}

.layout-row.full-width {
  flex-direction: column;
  width: 100%;
  margin-bottom: 30px;
}

.layout-row.two-columns {
  flex-direction: row;
  width: 100%;
  align-items: stretch;
  gap: 20px;
}
  
  /* Make text-module buttons fill columns and center their labels */
  .layout-row.two-columns .layout-module[data-type="text"] .text-module-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    white-space: normal;
    align-self: stretch;
    box-sizing: border-box;
    flex: 1 0 auto; /* occupy full column height to match tallest neighbor */
  }

  /* Ensure text layout-modules in two-columns behave as equal-height containers */
  .layout-row.two-columns .layout-module[data-type="text"] {
    display: flex;
    flex-direction: column;
  }

/* Make text modules in the same row have equal heights */
.layout-row.two-columns .layout-module[data-type="text"] .text-module {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.layout-module {
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
  margin: 0;
}

/* Text modules have their own padding, so remove parent padding */
.layout-module[data-type="text"] {
  padding: 0;
  margin: 0;
  position: relative;
  top: auto;
  bottom: auto;
  left: auto;
  right: auto;
}

.layout-module.half-width {
  width: 50%;
  flex: 0 0 50%;
}

.layout-module.full-width {
  width: 100%;
  flex: 0 0 100%;
}

/* Module-specific styles */
.top-accounts-module {
  background-color: transparent;
  border-radius: 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  position: relative;
  z-index: auto;
  margin: 0;
}


.top-accounts-module .top-accounts-list {
  flex: 1;
}

/* Statistics module with title */
.statistics-module {
  background-color: transparent;
  border-radius: 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.statistics-module h3,
.top-accounts-module h3 {
  color: #ffffff;
  margin-top: 0;
  margin-bottom: 15px;
  flex-shrink: 0;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.5;
}

.statistics-module .statistics-container {
  flex: 1;
}

.top-posts-module,
.trending-clips-module {
  background-color: transparent;
  border-radius: 8px;
  padding: 15px;
}

.text-module {
  /* No background - transparent */
  background: transparent;
  
  /* No border */
  border: none;
  
  /* Improved padding and spacing */
  padding: 0;
  display: flex;
  flex-direction: column;
  width: 80%;
  margin: 0 auto;
  position: relative;
  z-index: auto;
  box-sizing: border-box;
  
  /* No shadows */
  box-shadow: none;
  
  min-height: 0;
  height: auto;
  overflow: visible;
}

.text-module .text-content {
  color: var(--text);
  line-height: 1.8;
  font-size: 1.125rem;
  margin: 0;
  padding: 0;
  padding-top: 15px;
  overflow: visible;
  width: 100%;
  border-top: 2px solid rgba(255, 255, 255, 0.3);
  
  /* Improved text rendering */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* Better text spacing */
  letter-spacing: 0.01em;
  word-spacing: 0.05em;
}

/* Text module title - white and above the frame, centered, bold and smaller */
.text-module-title {
  color: #ffffff;
  margin-top: 0;
  margin-bottom: 15px;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.2rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.3px;
  line-height: 1.5;
  text-align: center;
  width: 80%;
}

.text-module .text-content p {
  margin: 0 0 1.2em 0;
  line-height: 1.75;
  color: var(--text);
  font-size: 1.125rem;
  
  /* Subtle text shadow for readability */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Better paragraph spacing - remove margin from last paragraph */
.text-module .text-content p:last-child {
  margin-bottom: 0;
}

.text-module .text-content strong {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.text-module .text-content em {
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
}

/* When two text modules are side by side, align the text content below titles */
/* JavaScript will handle dynamic alignment based on actual title heights */
/* This CSS ensures proper flex layout structure */
.layout-row.two-columns .layout-module.half-width[data-type="text"] {
  display: flex;
  flex-direction: column;
}

/* Initial state - JavaScript will override these values dynamically */
.layout-row.two-columns .layout-module.half-width[data-type="text"] .text-module {
  margin-top: 0;
}

/* When text is next to stats or data module, add space to align with their content (after h3 title) */
/* The h3 title has font-size: 1.2rem, line-height: 1.5, so height is 1.2rem * 1.5 = 1.8rem + 15px margin-bottom */
.layout-module.half-width.text-align-with-content .text-content {
  margin-top: calc(1.2rem * 1.5 + 15px); /* h3 height (font-size * line-height) + margin-bottom = 1.8rem + 15px */
}

/* Ensure text module doesn't overlap with modules below */
.layout-module[data-type="text"] {
  margin-bottom: 0;
  margin-top: 0;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
  position: relative;
  top: auto;
  bottom: auto;
}

/* Force spacing between rows containing text and data modules */
.layout-row:has(.layout-module[data-type="text"]) + .layout-row:has(.layout-module[data-type="data"]) {
  margin-top: 30px !important;
}

.link-module {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-color: transparent;
  border-radius: 8px;
  padding: 15px;
}

.link-module .link-text {
  color: var(--text);
  font-size: 0.9rem;
  text-align: center;
  font-weight: 500;
}

/* Adjust posts and clips for half-width mode */
.layout-module.half-width .top-posts-container {
  padding-right: 50px;
}

.layout-module.half-width .top-post-item {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.layout-module.half-width .trending-clips-container {
  padding-right: 50px;
}

.layout-module.half-width .trending-clip-square {
  width: 45%;
  height: 30vh;
  min-width: 150px;
}

.layout-module.half-width .posts-pagination,
.layout-module.half-width .clips-pagination {
  right: 5px;
}

/* Responsive design for dynamic layout */
@media (max-width: 768px) {
  .layout-row.two-columns {
    flex-direction: column;
    gap: 20px;
  }
  
  .layout-module.half-width {
    width: 100% !important;
    flex: 0 0 auto !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
  }
  
  .layout-module.half-width .trending-clip-square {
    width: 45%;
    height: 25vh;
  }
  
  /* Ensure modules don't overlap and are properly stacked */
  .layout-module {
    position: relative;
    z-index: auto;
    margin-bottom: 0;
    margin-top: 0;
    overflow: visible;
    height: auto;
    min-height: 0;
    max-height: none;
  }
  
  .layout-row {
    margin-bottom: 30px;
    margin-top: 0;
    clear: both;
    min-height: 0;
    height: auto;
  }
  
  /* Prevent text module from overlapping with modules below */
  .layout-module[data-type="text"] {
    margin-bottom: 0;
    margin-top: 0;
    height: auto;
    min-height: 0;
    max-height: none;
  }
  
  /* Ensure proper spacing between rows - prevent overlap */
  .layout-row + .layout-row {
    margin-top: 0;
    padding-top: 0;
  }
  
  /* Force proper separation between text and data modules */
  .layout-row:has([data-type="text"]) + .layout-row:has([data-type="data"]) {
    margin-top: 30px !important;
    padding-top: 0 !important;
  }
  
  /* Alternative for browsers that don't support :has() */
  .layout-row[data-has-text="true"] + .layout-row[data-has-data="true"] {
    margin-top: 30px !important;
  }
  
  /* Prevent text module from being too large */
  .text-module {
    max-height: none;
    height: auto;
    overflow: visible;
    box-sizing: border-box;
  }
  
  .text-module .text-content {
    max-height: none;
    height: auto;
    overflow: visible;
  }
  
  /* Prevent top-accounts module from being too large */
  .top-accounts-module {
    max-height: none;
    height: auto;
    overflow: visible;
    box-sizing: border-box;
  }
  
  /* Ensure layout-module doesn't force height */
  .layout-module[data-type="text"],
  .layout-module[data-type="data"] {
    flex: 0 0 auto !important;
  }
}

/* Footer styles */
footer {
  background: var(--surface);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px 10%;
  margin-top: 40px;
  text-align: center;
}

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

footer nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

footer nav ul li {
  margin: 0;
}

footer nav ul li a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
  padding: 5px 10px;
}

footer nav ul li a:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 768px) {
  footer {
    padding: 15px 5%;
  }
  
  footer nav ul {
    gap: 20px;
  }
  
  footer nav ul li a {
    font-size: 0.9rem;
  }
}