:root {
    /* --- LIGHT THEME (Default) --- */
    --primary-color: #e60012; 
    --primary-gradient: linear-gradient(135deg, #ff4d4d 0%, #b30000 100%);
    
    /* BACKGROUNDS */
    --html-bg: #e60012; 
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    
    /* BORDERS */
    --card-border: #000000; 
    --card-border-hover: #666666; 

    /* TEXT */
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    
    /* NAV */
    --nav-bg: #141414;
    --nav-text: #888888;
    --nav-active: #ffffff;
    --input-bg: #ffffff;
    
    /* SHADOWS */
    --shadow: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-hover: 0 8px 20px rgba(0,0,0,0.2);
    
    /* Feature Badge Colors */
    --feat-hdr: #f1c40f;
    --feat-dlss: #76b900;
    --feat-vrr: #00b7ff;
    --feat-cross: #8e44ad;
    --feat-share: #e67e22;
}

/* --- DARK MODE --- */
html.dark-mode, body.dark-mode {
    --primary-color: #e60012; 
    --primary-gradient: linear-gradient(135deg, #1f1f1f 0%, #000000 100%);
    --html-bg: #121212;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --card-border: #444444; 
    --card-border-hover: #e60012;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --border-color: #333333;
    --nav-bg: #000000;
    --input-bg: #2a2a2a;
    --shadow: 0 4px 15px rgba(0,0,0,0.6);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.8);
}

/* --- LUIGI MODE --- */
html.luigi-mode, body.luigi-mode {
    --primary-color: #2ecc71;
    --primary-gradient: linear-gradient(135deg, #2ecc71 0%, #219150 100%);
    --html-bg: #2ecc71;
}

/* GLOBAL RESET */
* { box-sizing: border-box; }

html { 
    min-height: 100%; 
    overflow-y: scroll;
    overflow-x: hidden; 
    background-color: var(--html-bg);
}

body {
    font-family: 'Segoe UI', 'Inter', sans-serif; 
    margin: 0; min-height: 100vh; 
    color: var(--text-main); 
    padding-bottom: 50px;
    background-color: transparent;
    background-image: radial-gradient(rgba(0,0,0,0.15) 1.5px, transparent 1.5px), var(--primary-gradient);
    background-size: 30px 30px, 100% 100%;
    background-attachment: scroll;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Logo Image Styling */
.header-logo {
    height: 45px;       /* Good size for Desktop */
    width: auto;        /* Maintain aspect ratio */
    display: block;
    object-fit: contain;
}

/* Hide the old text styles just in case */
.logo-area h1 {
    display: none; 
}

/* Mobile Adjustment */
@media (max-width: 600px) {
    .header-logo {
        height: 32px;   /* Smaller for Mobile Header */
    }
}

/* --- HEADER --- */
header {
    background: var(--nav-bg); 
    color: white; 
    padding: 0;
    position: sticky; top: 0; z-index: 1000;
    box-shadow: var(--shadow);
    border-bottom: 3px solid var(--primary-color);
    height: 72px; /* Increased from 60px to allow breathing room */
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.3s ease;
}
.header-inner {
    width: 100%; max-width: 1200px;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px;
}

.logo-area { display: flex; align-items: center; text-decoration: none; }
header h1 { margin: 0; font-size: 1.3rem; letter-spacing: 1px; white-space: nowrap; color: white; }
header h1 span { color: var(--primary-color); }

/* NAVIGATION */
/* NAVIGATION */
.main-nav { display: flex; align-items: center; gap: 15px; /* Increased gap from 5px */ }

.nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: transparent; border: none;
    color: var(--nav-text); text-decoration: none;
    padding: 6px 14px; /* Increased padding */
    border-radius: 8px;
    transition: all 0.2s ease; cursor: pointer;
    min-width: 60px; /* Increased width */
    position: relative;
}

.nav-item svg { 
    width: 24px; height: 24px; /* Increased from 20px */
    fill: currentColor; margin-bottom: 3px; 
    transition: transform 0.2s, fill 0.2s; 
}
.nav-item:hover, .nav-item.active {
    color: var(--nav-active);
    background: rgba(255,255,255,0.05);
}

.nav-item:hover svg, .nav-item.active svg {
    fill: var(--primary-color);
    transform: translateY(-2px);
}

.nav-item svg { width: 20px; height: 20px; fill: currentColor; margin-bottom: 2px; transition: transform 0.2s, fill 0.2s; }
.nav-text { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

.nav-badge {
    position: absolute; top: 2px; left: 2px;
    background: var(--primary-color); color: white;
    border-radius: 50%; min-width: 18px; height: 18px;
    padding: 0 4px; font-size: 0.65rem;
    display: flex; justify-content: center; align-items: center;
    font-weight: bold; border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 100; pointer-events: none;
}

.nav-avatar-img {
    width: 32px; height: 32px; /* Increased from 28px */
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2); /* Default: Subtle grey/transparent, NOT red */
    object-fit: cover; background: #333;
    transition: border-color 0.2s ease; /* Smooth transition when activating */
}

/* NEW RULE: Only make the border Red/Primary when the tab is Active */
.nav-item.active .nav-avatar-img {
    border-color: var(--primary-color);
}
/* THEME TOGGLE */
.theme-toggle-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; margin-left: 10px; color: #ccc;
    transition: 0.2s;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,0.2); color: white; transform: rotate(15deg); }

/* --- SEARCH --- */
.search-container { 
    max-width: 800px; margin: 20px auto 10px; padding: 0 10px; 
    display: flex; gap: 10px; justify-content: center; 
}
.search-input-style { 
    height: 40px; padding: 0 15px; 
    font-size: 0.9rem; font-weight: 600; 
    border: 2px solid var(--border-color); 
    background: var(--card-bg); color: var(--text-main);
    border-radius: 20px; outline: none; box-sizing: border-box; 
}
.search-input-style:focus { border-color: var(--primary-color); }
#sortSelect { width: 220px; flex-shrink: 0; }
#searchInput { flex-grow: 1; }

/* --- GRID SYSTEM --- */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.game-grid { 
    display: grid; 
    /* Ensures max 4 per row on desktop */
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); 
    gap: 20px; align-items: stretch;
}

/* INFINITE SCROLL SPINNER */
.loading-spinner {
    display: none;
    width: 40px; height: 40px; margin: 30px auto;
    border: 4px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}
html.dark-mode .loading-spinner { border-color: rgba(255,255,255,0.1); border-top-color: var(--primary-color); }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- GAME CARD --- */
.game-card {
    background: var(--card-bg); border-radius: 8px; overflow: hidden; 
    display: flex; flex-direction: column; height: 100%;
    border: 2px solid var(--card-border); 
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer; position: relative;
    -webkit-tap-highlight-color: transparent;
    backface-visibility: hidden; transform-style: preserve-3d;
}

.game-card:hover { 
    transform: translateY(-4px); 
    box-shadow: var(--shadow-hover); 
    border-color: var(--card-border-hover); 
}
/* 1. The Container (Holds the shape) */
.card-img { 
    width: 100%; 
    height: 180px; /* Mobile Height */
    background-color: #202020; 
    border-bottom: 1px solid var(--border-color); 
    position: relative; /* Needed for badges to sit on top */
    overflow: hidden;   /* Ensures image stays inside rounded corners */
}

/* 2. The Real Image (Fills the container) */
.card-img-content {
    width: 100%;
    height: 100%;
    object-fit: cover; /* This makes it behave exactly like background-size: cover */
    display: block;
    transition: transform 0.3s ease; /* Smooth zoom effect */
}

/* 3. Hover Effect (Zoom the image, not the container) */
.game-card:hover .card-img-content {
    transform: scale(1.1);
}

/* 4. Desktop Height Adjustment (Keep your existing media queries) */
@media (min-width: 1000px) {
    .index-layout .card-img { height: 200px; }
}
@media (min-width: 1400px) {
    .index-layout .card-img { height: 260px; }
}
@media (max-width: 600px) {
    .card-img { height: 120px; }
}
.card-content { 
    padding: 12px; display: flex; flex-direction: column; 
    gap: 5px; flex: 1; background: var(--card-bg); justify-content: flex-start; 
}
.card-content h3 { 
    margin: 0; font-size: 1rem; line-height: 1.2; font-weight: 800; 
    color: var(--text-main); 
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; 
}
.publisher-text { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; margin: 0; }
.info-row { 
    display: flex; justify-content: space-between; 
    font-size: 0.75rem; font-weight: bold; color: var(--text-muted); 
    border-bottom: 1px solid var(--border-color); padding-bottom: 4px; margin-bottom: 4px; 
}

/* SKELETON LOADING */
.skeleton-card {
    background: var(--card-bg); border-radius: 8px;
    height: 380px; position: relative; overflow: hidden;
    border: 2px solid transparent;
}
.skeleton-card::after {
    content: ""; position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(128, 128, 128, 0.1) 20%, rgba(128, 128, 128, 0.2) 60%, rgba(255, 255, 255, 0));
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-img { height: 180px; background: rgba(0,0,0,0.1); margin-bottom: 10px; }
html.dark-mode .sk-img { background: rgba(255,255,255,0.05); }
.sk-line { height: 12px; background: rgba(0,0,0,0.05); margin: 10px 12px; border-radius: 4px; }
html.dark-mode .sk-line { background: rgba(255,255,255,0.05); }
.sk-line.short { width: 60%; }

/* SPECS & BADGES */
.specs-box { 
    background: rgba(0,0,0,0.03); padding: 6px; border-radius: 3px; 
    font-size: 0.75rem; font-weight: 600; color: var(--text-main); 
    display: flex; flex-direction: column; gap: 2px; position: relative; 
    border: 1px solid var(--border-color); 
}
.spec-line { display: flex; align-items: center; gap: 5px; }
.spec-icon { 
    display: flex; align-items: center; justify-content: center; 
    width: 16px; height: 16px; color: var(--text-muted); 
}
.spec-icon svg { width: 100%; height: 100%; }

.feature-row { display: flex; justify-content: center; gap: 5px; margin: 4px 0; min-height: 18px; flex-wrap: wrap; }
.feature-badge { display: inline-flex; align-items: center; justify-content: center; font-size: 0.65rem; padding: 1px 5px; border-radius: 4px; font-weight: 900; text-transform: uppercase; color: white; box-shadow: 0 1px 2px rgba(0,0,0,0.2); line-height: 1; }
.feat-hdr { background: var(--feat-hdr); color: white; } 
.feat-dlss { background: var(--feat-dlss); } .feat-vrr { background: var(--feat-vrr); } .feat-amiibo { background: var(--primary-color); } .feat-cross { background: var(--feat-cross); } .feat-share { background: var(--feat-share); }
.feat-inactive { background: transparent !important; border: 1px solid var(--border-color); color: var(--text-muted) !important; box-shadow: none; opacity: 1; filter: none; }

.detail-badge-row { display: flex; justify-content: center; gap: 3px; margin: 2px 0; flex-wrap: nowrap; }
.detail-badge { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; padding: 2px 0; border-radius: 3px; font-weight: 800; text-transform: uppercase; color: white; box-shadow: 0 1px 2px rgba(0,0,0,0.2); text-align: center; white-space: nowrap; overflow: hidden; line-height: 1.1; }
.bg-cross { background: #9b59b6; } .bg-online { background: #3498db; } .bg-local { background: #2ecc71; } .bg-coop { background: #e67e22; }
.bg-joy { background: #ff4757; } .bg-pro { background: #2f3542; } .bg-mouse { background: #bdc3c7; color: #333; } .bg-gyro { background: #f1c40f; color: #333; } .bg-touch { background: #74b9ff; color: #333; }
.badge-inactive { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted) !important; box-shadow: none; opacity: 1; filter: none; }
.badge-inactive span { visibility: visible; }

/* FIX FOR DUPLICATION TEXT */
.mobile-text { display: none !important; } 
.desktop-text { display: inline !important; }

.hdr-tag { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); background: #111; color: gold; font-size: 0.65rem; padding: 2px 6px; border-radius: 2px; font-weight: bold; }

/* --- CARD BUTTONS --- */
.card-bottom-wrapper { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 5px; border-top: 0 !important; }
.action-btn, .std-btn { border: none; padding: 0; height: 32px; line-height: 32px; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 0.75rem; width: 100%; display: block; text-align: center; text-decoration: none; box-sizing: border-box; transition: transform 0.1s, filter 0.1s; box-shadow: 0 2px 4px rgba(0,0,0,0.1); color: white; }
.action-btn:hover, .std-btn:hover { opacity: 1; filter: brightness(1.1); transform: scale(1.02); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.btn-remove { background: #ffebee; color: #c62828; } .btn-complete { background: #f0f0f0; color: #555; } .btn-complete.done { background: #fff8e1; color: #b38f00; }
.btn-add-col { background: #28a745; color: white; } .btn-amazon { background: #ff9900; color: black; }
.btn-trailer { background: #00d2be !important; color: white !important; }
.btn-col-add { background: #007bff; color: white; } .btn-col-active { background: #218838; color: white; }
.btn-wishlist-add { background: #f1c40f; color: black; }
.btn-wishlist-active { background: #8e44ad; color: white; } 

.btn-row { display: flex; gap: 5px; width: 100%; }
.btn-row .action-btn, .btn-row .std-btn { flex: 1; }

/* REDESIGNED ADMIN EDIT BUTTON */
.admin-edit-btn { position: absolute; top: 40px; left: 10px; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(4px); color: white; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 20px; padding: 4px 12px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; z-index: 20; cursor: pointer; text-decoration: none; transition: all 0.2s ease; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.admin-edit-btn:hover { background: var(--primary-color); border-color: var(--primary-color); transform: translateY(-1px) scale(1.02); box-shadow: 0 4px 10px rgba(230, 0, 18, 0.4); }

/* PROFILE SPECIFIC */
#collectionsContainer .action-btn, #collectionsContainer .std-btn { border: none !important; }
#collectionsContainer .game-card .card-content { padding: 8px; gap: 2px; }
#collectionsContainer .game-card .card-img { height: 140px; }
#collectionsContainer .game-card h3 { font-size: 0.9rem; margin-bottom: 2px; }
#collectionsContainer .card-bottom-wrapper { padding-top: 5px; gap: 5px; }
#collectionsContainer .game-card .action-btn, #collectionsContainer .game-card .std-btn { height: 28px; line-height: 28px; font-size: 0.7rem; }
/* UPDATED: Centering Logic */
#collectionsContainer .user-rating { 
    margin-top: 2px; 
    margin-bottom: 4px; 
    padding-bottom: 4px; 
    font-size: 0.9rem; 
    display: flex;
    justify-content: center; 
    width: 100%;
}
#collectionsContainer .rating-label { font-size: 0.7rem; }

/* CONSOLE BANNERS */
.console-banner { position: absolute; top: 0; left: 0; width: 100%; padding: 4px 0; text-align: center; font-size: 0.65rem; font-weight: 900; text-transform: uppercase; color: white; letter-spacing: 1px; box-shadow: 0 2px 4px rgba(0,0,0,0.5); border-bottom: 2px solid black; z-index: 5; }
.con-sw1 { background: linear-gradient(90deg, #00d2be, #00a896); } 
.con-sw2 { background: linear-gradient(90deg, #e60012, #ff4d4d); }
.con-enh { background: linear-gradient(90deg, #f39c12, #e67e22); } 
.con-edi { background: linear-gradient(90deg, #9b59b6, #8e44ad); }
html.luigi-mode .con-sw2 { background: linear-gradient(90deg, #2ecc71, #27ae60); }

/* EXPAND/VIEW BADGE */
.expand-badge { position: absolute; bottom: 5px; right: 5px; background: rgba(0, 0, 0, 0.7); color: white; font-size: 0.7rem; padding: 4px 8px; border-radius: 4px; font-weight: bold; display: flex; align-items: center; gap: 4px; backdrop-filter: blur(2px); transition: background 0.2s; z-index: 10; pointer-events: none; }
.game-card:hover .expand-badge { background: var(--primary-color); }
.expand-icon { width: 12px; height: 12px; fill: white; }

/* SHARED MATCH BADGE */
.match-badge { background-color: #8e44ad; color: white; font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; margin-left: 5px; font-weight: bold; display: inline-block; }

/* PAGINATION */
.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; margin: 30px 0; padding: 10px; }
.page-btn { background: var(--card-bg); border: 2px solid var(--card-bg); color: var(--primary-color); padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 800; font-size: 0.9rem; transition: all 0.2s ease; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.page-btn:hover { background: var(--primary-color); color: white; transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.page-btn.active { background: #333; color: white; border-color: #333; cursor: default; transform: none; }

/* --- ADMIN & FORM STYLES --- */
.admin-panel, .submit-container { background: var(--card-bg); max-width: 800px; margin: 20px auto; padding: 25px; border-radius: 12px; border-top: 5px solid #333; box-shadow: 0 5px 15px rgba(0,0,0,0.2); box-sizing: border-box; color: var(--text-main); }
.submit-container { border: none; max-width: 600px; }
.img-upload-row { display: flex; gap: 5px; }
.form-group { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-group-search { display: grid; grid-template-columns: 3fr 1fr; gap: 15px; margin-bottom: 15px; }
.admin-actions-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 15px; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px dashed #eee; }
input, select, textarea { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 4px; box-sizing: border-box; font-family: inherit; font-size: 0.95rem; height: 45px; background: var(--input-bg); color: var(--text-main); }
textarea { height: auto; }
.performance-group { background: var(--bg-color); border: 1px solid var(--border-color); border-radius: 8px; padding: 20px; margin-bottom: 25px; }
.performance-group h4 { margin: 0 0 15px 0; font-size: 0.9rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--primary-color); display: inline-block; padding-bottom: 5px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.check-grid label { display: flex; align-items: center; background: var(--bg-color); border: 1px solid var(--border-color); padding: 10px 15px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--text-main); transition: all 0.2s ease; }
.check-grid label:hover { border-color: var(--primary-color); background: var(--card-bg); transform: translateY(-2px); box-shadow: 0 3px 6px rgba(0,0,0,0.1); }
.check-grid label input { width: auto; height: auto; margin-right: 10px; transform: scale(1.2); accent-color: var(--primary-color); }
.btn-group { display: flex; gap: 10px; margin-top: 25px; }
.btn-group button { width: 100%; padding: 12px; border: none; border-radius: 4px; font-weight: bold; cursor: pointer; color: white; }

/* SEARCH RESULT LIST */
.search-results-container { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 400px; overflow-y: auto; border: 1px solid var(--border-color); padding: 10px; border-radius: 8px; background: var(--bg-color); }
.search-result-item { display: flex; gap: 15px; background: var(--card-bg); padding: 10px; border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; transition: 0.2s; align-items: center; color: var(--text-main); }
.search-result-item:hover { transform: translateY(-2px); border-color: var(--primary-color); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.search-result-img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; background: #eee; }
.search-result-info { flex: 1; }
.search-result-title { font-weight: bold; font-size: 0.9rem; display: block; }
.search-result-meta { font-size: 0.75rem; color: var(--text-muted); }

/* --- ENHANCED USER TABLE --- */
.user-table-wrapper { max-height: 400px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 8px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); margin-top: 15px; }
.user-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.user-table th { background: var(--bg-color); color: var(--text-muted); font-weight: 700; text-transform: uppercase; font-size: 0.75rem; padding: 12px 15px; position: sticky; top: 0; z-index: 2; text-align: left; border-bottom: 2px solid var(--border-color); }
.user-table td { padding: 10px 15px; border-bottom: 1px solid var(--border-color); color: var(--text-main); vertical-align: middle; }
.user-table tr:last-child td { border-bottom: none; }
.user-table tr:hover { background-color: var(--bg-color); }
.user-role-select { padding: 4px 8px; border: 1px solid var(--border-color); border-radius: 4px; font-size: 0.8rem; background: var(--input-bg); cursor: pointer; height: auto; width: 100%; color: var(--text-main); }
.user-delete-btn { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; padding: 4px 10px; border-radius: 4px; font-weight: bold; font-size: 0.75rem; cursor: pointer; transition: 0.2s; width: auto; }
.user-delete-btn:hover { background: #c62828; color: white; border-color: #c62828; }
.toggle-users-btn { background: none; border: 1px solid #6c5ce7; color: #6c5ce7; border-radius: 20px; padding: 5px 12px; font-size: 0.75rem; cursor: pointer; font-weight: bold; transition:0.2s; }
.toggle-users-btn:hover { background: #6c5ce7; color: white; }

/* --- PROFILE PAGE --- */
.profile-container { 
    background: var(--card-bg); padding: 30px; margin: 120px auto 15px auto; max-width: 850px; width: 90%; 
    border-radius: 12px; border: 3px solid #141414; box-shadow: 0 10px 30px rgba(0,0,0,0.3); 
    text-align: center; position: relative; box-sizing: border-box; 
    opacity: 0; animation: fadeInProfile 0.5s ease-out forwards;
    color: var(--text-main);
}
@keyframes fadeInProfile { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.profile-avatar { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 4px solid #141414; background-color: #eee; margin-top: -85px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); position: relative; z-index: 2; }
.profile-header h2 { margin: 15px 0 5px 0; color: var(--primary-color); font-size: 2rem; font-weight: 800; }
.bio-text { font-size: 0.95rem; color: var(--text-muted); margin: 15px auto; max-width: 600px; line-height: 1.5; white-space: pre-wrap; text-align: left; }
.stats-container { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; align-items: center; }
/* --- UPDATED PROFILE STATS (Flexible Width) --- */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap; /* Allows wrapping on tiny mobile screens */
}

/* --- PROFILE STATS (Desktop / Global) --- */
.stats-row { 
    display: flex; 
    justify-content: center; 
    gap: 10px; 
    width: 100%; 
    /* No wrap by default on desktop, so 5 items stay on 1 line */
    flex-wrap: nowrap; 
}

.stat-box { 
    background: var(--bg-color); 
    border: 1px solid var(--border-color); 
    padding: 8px 5px; 
    border-radius: 8px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    
/* DESKTOP MAGIC: Grow equally to fit the line */
    flex: 0 0 130px; /* Don't grow, stay fixed width */
    width: auto; /* Let flex handle the width */
    min-width: 80px; /* Prevent them from getting unreadable */
}

/* Keep the first row (Followers) small and centered on Desktop */
.stats-row:first-child .stat-box {
    flex: 0 0 130px; /* Don't grow, stay fixed width */
}
    
}

/* Keep the first row (Followers) small and centered on Desktop */
.stats-row:first-child .stat-box {
    flex: 0 0 130px; /* Don't grow, stay fixed width */
}
.stat-value { font-size: 1.2rem; font-weight: 900; color: var(--text-main); display: block; line-height: 1; }
.stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; font-weight: bold; margin-top: 2px; }
.action-bar-top { position: absolute; top: 15px; width: 100%; left: 0; padding: 0 20px; box-sizing: border-box; display: flex; justify-content: space-between; }
.top-btn { border: none; padding: 6px 14px; border-radius: 20px; cursor: pointer; font-weight: bold; font-size: 0.8rem; color: white; transition: opacity 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.top-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-find { background: #007bff; } .btn-edit { background: #333; } .btn-follow { background: #28a745; } .btn-unfollow { background: #555; }
.update-badge { background: linear-gradient(135deg, var(--primary-color), #ff4d4d); color: white; font-size: 0.6rem; padding: 3px 8px; border-radius: 12px; font-weight: bold; text-transform: uppercase; box-shadow: 0 2px 4px rgba(0,0,0,0.15); align-self: flex-start; margin-left: 0; white-space: nowrap; }
.friend-code-badge { background-color: var(--primary-color); color: white; border: 2px solid #000; border-radius: 12px; padding: 2px 8px; font-weight: bold; margin-top: 0; font-size: 0.75rem; display: inline-block; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.completed-badge { position: absolute; bottom: 8px; right: 8px; background: none; border: none; box-shadow: none; color: #ffd700; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.8)); width: 32px; height: 32px; z-index: 10; pointer-events: none; }
.completed-badge svg { width: 32px; height: 32px; }

/* LOGOUT BUTTON STYLING */
.btn-logout { background: var(--card-bg); border: 1px solid var(--primary-color); color: var(--primary-color); }
.btn-logout:hover { background: #ffebee; }

/* ADMIN BUTTON STYLING (Profile) */
.btn-admin { 
    background: linear-gradient(135deg, #00d2be, #007bff);
    color: white; border: none; padding: 10px 20px; border-radius: 20px; 
    font-weight: bold; font-size: 0.85rem; display: inline-block; 
    text-decoration: none; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.btn-admin:hover { transform: translateY(-2px); }

/* Right actions container for stacking */
.right-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* BIRTHDAY STYLES */
.birthday-avatar { border-color: gold !important; box-shadow: 0 0 15px gold; animation: pulseGold 2s infinite; }
@keyframes pulseGold { 0% { box-shadow: 0 0 10px gold; } 50% { box-shadow: 0 0 25px gold; } 100% { box-shadow: 0 0 10px gold; } }
.birthday-badge { background: linear-gradient(45deg, #ff9a9e, #fad0c4); color: #c0392b; border: 2px solid white; padding: 4px 10px; border-radius: 15px; font-weight: bold; font-size: 0.8rem; margin-left: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); vertical-align: middle; }

/* CONFETTI */
.confetti { position: fixed; top: -10px; width: 10px; height: 10px; background-color: #f0f; animation: confetti-fall 4s linear forwards; z-index: 9999; }
@keyframes confetti-fall { to { transform: translateY(100vh) rotate(720deg); } }

/* USER REVIEW BUTTON (NEW STYLE) */
.btn-review-read { 
    background: #9b59b6 !important; color: white !important; 
    border: none; border-radius: 8px; font-weight: bold; height: 28px; 
    line-height: 28px; font-size: 0.7rem; padding: 0 12px; cursor: pointer; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: transform 0.1s; 
    width: auto; flex: 0 0 auto; white-space: nowrap;
}
.btn-review-read:hover { transform: scale(1.02); filter: brightness(1.1); }

.visitor-review-row { display: flex; justify-content: center; align-items: center; gap: 10px; width: 100%; }
.visitor-likes { font-weight: 800; color: #007bff; font-size: 0.8rem; white-space: nowrap; }

/* --- MODALS --- */
.modal-overlay { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.85); z-index: 99999; backdrop-filter: blur(4px); 
    justify-content: center; align-items: center; 
}
#editModal .modal-content { max-width: 500px; }
.modal-content { background: var(--card-bg); width: 100%; max-width: 350px; margin: 50px auto; border-radius: 12px; text-align: left; box-shadow: 0 20px 50px rgba(0,0,0,0.5); display: flex; flex-direction: column; max-height: 80vh; position: relative; animation: slideUp 0.2s ease-out; padding: 0; overflow: hidden; color: var(--text-main); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-content h3, .modal-content input, .modal-content textarea, .modal-content .check-container { margin-left: 15px; margin-right: 15px; width: calc(100% - 30px); }
.modal-content h3 { margin-top: 20px; color: var(--text-main); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 20px 15px; }
.save-btn { background: var(--primary-color); color: white; padding: 10px 20px; border-radius: 4px; border:none; font-weight:bold; cursor:pointer; transition: 0.2s; }
.save-btn:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.cancel-btn { background: #eee; color: #333; padding: 10px 20px; border-radius: 4px; border:none; font-weight:bold; cursor:pointer; }


/* --- UNIVERSAL TAB STYLES --- */
.tab-header {
    display: flex;
    background: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    flex-shrink: 0;
    width: 100%;
}

.tab-btn {
    flex: 1; /* Equal width for all tabs */
    padding: 1px 10px; /* Comfortable padding */
    background: none;
    border: none;
    
    /* Font Styling */
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted); /* Default Gray */
    
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    
    /* Alignment Magic (Fixes the icon wrapping) */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Space between icon and text */
    white-space: nowrap; /* Prevents "Find" from dropping below icon */
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    background: var(--card-bg);
}

.tab-btn:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

/* Specific fix for the Find tab icon color */
#tabFind {
    opacity: 1; 
}






//.tab-header { display: flex; background: var(--card-bg); border-bottom: 2px solid var(--border-color); flex-shrink: 0; }
//.tab-btn { flex: 1; padding: 15px; background: none; border: none; font-weight: 800; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-main); cursor: pointer; transition: 0.2s; border-bottom: 3px solid transparent; }
//.tab-btn.active { color: var(--primary-color); border-bottom: 3px solid var(--primary-color); background: var(--card-bg); }
//.tab-btn.active:hover { color: var(--primary-color); }
//.tab-btn:hover { background-color: var(--bg-color); color: var(--primary-color); }
#socialListResults, #userSearchResults { flex-grow: 1; overflow-y: auto; padding: 15px; background: var(--bg-color); }
.user-list-item { display: flex; align-items: center; gap: 15px; padding: 12px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 8px; text-decoration: none; color: var(--text-main); transition: transform 0.1s; }
.user-list-item:hover { transform: translateY(-2px); border-color: var(--border-color); box-shadow: 0 4px 8px rgba(0,0,0,0.05); }
.user-list-item img { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 2px solid #000; background: #eee; }
.user-info { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; font-weight: 800; font-size: 0.95rem; line-height: 1.2; }
.user-arrow { color: var(--text-muted); font-weight: bold; }
.modal-footer { padding: 15px; border-top: 1px solid var(--border-color); background: var(--card-bg); text-align: right; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 4px; box-sizing: border-box; font-family: inherit; font-size: 0.9rem; }

/* REVIEW MODALS */
.btn-review-write { background: linear-gradient(135deg, #6c5ce7, #a29bfe); color: white; transition: all 0.2s ease; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; box-shadow: 0 4px 6px rgba(108, 92, 231, 0.25); }
.btn-review-write:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(108, 92, 231, 0.4); filter: brightness(1.1); }

/* --- MODAL LAYOUT LOGIC --- */

/* COMMON: Flex Column Structure */
.modal-content {
    background: var(--card-bg); 
    width: 100%; 
    max-width: 350px; 
    margin: 50px auto; 
    border-radius: 12px; 
    text-align: left; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); 
    display: flex; 
    flex-direction: column; /* ALWAYS COLUMN for outer wrapper */
    max-height: 90vh; 
    position: relative; 
    color: var(--text-main); 
}

/* Image */
.modal-hero-img { 
    width: 100%; 
    height: 140px; /* Mobile Height */
    background-size: cover; 
    background-position: center top; 
    position: relative; 
    border-bottom: 1px solid var(--border-color); 
    background-color: #202020; 
    flex-shrink: 0; 
    display: block !important; 
}

/* MOBILE: Hide image ONLY if reviews exist */
@media (max-width: 767px) {
    .modal-content.has-reviews .modal-hero-img {
        display: none !important;
    }
}

/* Body Content */
.modal-body { 
    padding: 20px; 
    overflow: hidden; /* Hide outer scroll */
    flex: 1; 
    display: flex; 
    flex-direction: column; 
}

.modal-reviews-list { 
    flex-grow: 1; 
    max-height: none; 
    overflow-y: auto; /* Scroll ONLY reviews */
    margin: 10px 0 0 0; /* Reduced from 15px */
    padding-right: 5px; 
    border-top: none; 
    border-bottom: none; 
}

/* Footer Buttons */
#mButtons { 
    margin-top: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; /* Tighter gap */
    flex-shrink: 0; /* Keep buttons fixed height */
    padding-top: 5px; /* Reduced from 10px */
}

/* Review Items */
.modal-review-item { background: var(--bg-color); border-radius: 8px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 8px; color: var(--text-main); }
.m-review-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; margin-bottom: 5px; }
.m-review-user { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-main); font-weight: 700; font-size: 0.9rem; transition: color 0.2s; }
.m-review-user:hover { color: #007bff; }
.m-review-user img { width: 35px; height: 35px; border-radius: 50%; object-fit: cover; border: 1px solid #ccc; }
.m-review-likes { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 15px; padding: 4px 10px; font-size: 0.8rem; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; gap: 5px; transition: all 0.2s; font-weight: bold; }
.m-review-likes:hover { border-color: #0984e3; color: #0984e3; background: #f0f8ff; }
.m-review-likes.liked { background: #0984e3; color: white; border-color: #0984e3; }
.m-review-content { font-size: 0.95rem; line-height: 1.5; color: var(--text-main); white-space: pre-wrap; }
.modal-title { margin: 0; font-size: 1.6rem; color: var(--text-main); font-weight: 800; }

.close-modal-btn { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.6); color: white; border: none; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; z-index: 50; font-size: 1.2rem; line-height: 1; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.close-modal-btn:hover { background: var(--primary-color); }

/* DESKTOP MODAL FIX (Split View) */
@media (min-width: 768px) {
    #gameModal .modal-content { 
        max-width: 900px; 
        flex-direction: row; /* Side by side */
        height: 85vh; /* Taller viewport height */
        max-height: 900px;
    }
    .modal-hero-img { 
        width: 35%; /* Fixed width for image */
        height: 100%; 
        border-bottom: none;
        border-right: 1px solid var(--border-color);
        display: block !important; /* Always show on desktop */
    }
    /* PINNED BUTTONS FIX */
    .modal-body {
        width: 65%; /* Rest for content */
        overflow: hidden; /* Prevent body scroll */
        display: flex;
        flex-direction: column;
        padding: 20px;
    }
    .modal-reviews-list {
        flex-grow: 1;
        overflow-y: auto; /* Internal scroll for reviews */
        min-height: 0;
        margin-bottom: 10px;
        border: none; /* Redundant safety */
    }
    #mButtons {
        flex-shrink: 0; /* Pins to bottom */
        margin-top: 0;
        padding-top: 10px;
        border-top: none; /* Ensure no line above */
    }

    .modal-title { font-size: 2rem; }
    #gameModal .std-btn, #gameModal .action-btn { height: 48px; line-height: 48px; font-size: 1rem; }
    #gameModal .btn-row { gap: 15px; }
    #reviewModal .modal-content { max-width: 700px; }
    #reviewWriteText { min-height: 300px; font-size: 1rem; }
    .review-content-display { max-height: 500px; }
}

/* RESPONSIVE & LAYOUT FIXES */
@media (min-width: 1000px) {
    /* STRICT 4 COLUMNS ON DESKTOP */
    .game-grid.index-layout { grid-template-columns: repeat(4, 1fr) !important; gap: 20px; }
    .game-grid.profile-layout { grid-template-columns: repeat(5, 1fr); gap: 20px; }
    .index-layout .card-img { height: 200px; }
    .feature-row { flex-wrap: nowrap !important; gap: 3px !important; }
    .feature-badge { font-size: 0.7rem !important; padding: 2px 4px !important; flex: 0 1 auto; }
}

@media (min-width: 1400px) {
    .container { max-width: 1600px; } 
    .index-layout .card-img { height: 260px; }
    .game-grid.index-layout { gap: 30px; }
    .index-layout .console-banner { font-size: 0.95rem; padding: 8px 0; }
    .index-layout .card-content h3 { font-size: 1.3rem; line-height: 1.3; margin-bottom: 5px; }
    .index-layout .publisher-text { font-size: 0.85rem; }
    .index-layout .info-row { font-size: 0.85rem; }
    .index-layout .rating-label { font-size: 0.85rem; }
    .index-layout .user-rating { font-size: 1.2rem; }
    .index-layout .action-btn, .index-layout .std-btn { height: 42px; line-height: 42px; font-size: 0.9rem; }
}

@media (max-width: 600px) {
    /* HEADER FIXES */
    header { padding: 0 5px; height: 60px; }
    .header-inner { padding: 0 10px; gap: 5px; justify-content: space-between; }
    header h1 { font-size: 1rem; } 
    .nav-item { padding: 8px 5px; min-width: auto; } 
    .nav-text { display: none; }
    .logo-area { margin-right: auto; }
    .theme-toggle-btn { margin-left: 5px; width: 28px; height: 28px; }
    .nav-badge { top: 0px; left: 0px; width: 16px; height: 16px; font-size: 0.6rem; }

    /* GRID */
    .game-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 15px; }
    .card-img { height: 120px; }
    
    /* RESTORED MOBILE CONTENT FORMATTING */
    .card-content { padding: 6px !important; gap: 2px !important; }
    .card-content h3 { font-size: 0.8rem !important; margin-bottom: 2px !important; }
    .publisher-text { font-size: 0.6rem !important; margin-bottom: 2px !important; }
    .info-row { font-size: 0.6rem !important; padding-bottom: 2px !important; margin-bottom: 2px !important; }
    .specs-box { display: flex !important; flex-direction: column !important; gap: 2px !important; padding: 3px !important; font-size: 0.6rem !important; }
    .spec-line { gap: 3px !important; }
    .spec-icon { width: 12px !important; height: 12px !important; }
    
    /* MOBILE STARS & RATINGS FIX */
    .user-rating { margin-top: 2px !important; margin-bottom: 2px !important; justify-content: center !important; }
    .star-icon { font-size: 0.65rem !important; letter-spacing: -1px; margin: 0 !important; }
    .rating-label { font-size: 0.6rem !important; margin-right: 2px !important; }
    .vote-count { font-size: 0.6rem !important; margin-left: 2px !important; }

    /* BADGES (Shrunk text for duplication fix) */
    .detail-badge { font-size: 0.55rem !important; padding: 1px 0 !important; }
    .feature-row { flex-wrap: wrap !important; justify-content: center !important; gap: 1px !important; }
    .feature-badge { flex: 0 0 auto !important; padding: 1px 2px !important; }
    .mobile-break { display: block !important; width: 100% !important; flex-basis: 100% !important; height: 0 !important; margin: 0 !important; }
    .expand-badge { font-size: 0.6rem; padding: 3px 6px; bottom: 4px; right: 4px; }
    
    /* FORCE HIDE/SHOW FOR TEXT */
    .desktop-text { display: none !important; } 
    .mobile-text { display: inline !important; }
    
    /* SEARCH */
    .search-container { flex-direction: row; align-items: center; max-width: 98%; gap: 5px; padding: 0 5px; }
    #sortSelect { width: 120px; flex-shrink: 0; font-size: 0.75rem; padding: 0 5px; }
    #searchInput { width: auto; flex-grow: 1; font-size: 0.8rem; }

    /* FORMS */
    .submit-container, .admin-panel { width: 90%; padding: 20px; margin: 20px auto; }
    .submit-container .form-group, .admin-panel .form-group { display: grid; grid-template-columns: 1fr; gap: 10px; }
    .admin-actions-bar { grid-template-columns: 1fr; gap: 10px; }
    .admin-actions-bar > div { text-align: center; }
    
    /* Login Box */
    .login-box { width: 90%; margin: 20px auto; padding: 20px; }
    
    /* Profile specific mobile adjustments */
    .profile-avatar { width: 80px; height: 80px; margin-top: -60px; border-width: 3px; }
    .profile-container { margin-top: 60px; padding: 20px 10px; position: relative; } 
   

.stats-container { 
    gap: 10px; 
    margin-top: 15px; 






}

.stat-value { font-size: 1rem; }
    .stat-label { font-size: 0.55rem; }
    .action-bar-top { position: absolute; top: 10px; left: 0; right: 0; padding: 0 10px; display: flex; justify-content: space-between; }
    .top-btn { padding: 5px 10px; font-size: 0.7rem; white-space: nowrap; }
    .right-actions { gap: 5px; margin-right: 0; display: flex; flex-direction: column; align-items: flex-end; }
    .admin-edit-btn { top: 28px; left: 6px; padding: 2px 8px; font-size: 0.65rem; }
    
    /* Force date input to full width */
    .submit-container input[type="date"], .admin-panel input[type="date"] { width: auto !important; flex-grow: 0 !important; min-width: 160px; }
}

/* --- CENTER USER RATING (GLOBAL) --- */
.user-rating {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* --- MOBILE MODAL BANNER LOGIC --- */
#mMobileBanner { display: none; }

@media (max-width: 767px) {
    /* Only show this container if we are on mobile AND the reviews class is active */
    .modal-content.has-reviews #mMobileBanner {
        display: block;
        width: 100%;
        height: 30px; /* Reserves space so banner doesn't cover title */
        position: relative;
        background-color: var(--card-bg); /* Match card bg */
    }

    /* Ensure the banner sits flush at the top like on index */
    .modal-content.has-reviews #mMobileBanner .console-banner {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 55; /* Below close button (z-60) */
        border-radius: 12px 12px 0 0; /* Match modal rounded corners */
        box-shadow: none; /* Optional: cleaner look without shadow on mobile header */
    }
    
    /* Ensure title has breathing room */
    .modal-content.has-reviews .modal-body {
        padding-top: 10px;
    }
}

/* --- UPDATED RATING STYLES --- */

/* 1. Perfect Alignment for Index/Profile Cards */
.user-rating {
    display: flex;
    justify-content: center; /* Center horizontally */
    align-items: center;     /* Center vertically (make them inline) */
    width: 100%;
    gap: 4px;                /* Consistent space between text/stars/count */
    line-height: 1;          /* Removes extra height causing misalignment */
}

/* Ensure the text label sits evenly with stars */
.rating-label {
    font-size: 0.75rem;
    position: relative;
    top: 1px; /* Micro-adjustment to align text baseline with stars */
}

/* Ensure stars don't add extra height */
.star-icon {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

/* 2. Fix "Too Big" Count in Large Modal */
.vote-count-modal {
    font-size: 0.9rem !important; /* Force smaller size */
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 5px;
    vertical-align: middle;
}

/* Optional: Mobile adjustment for the rating label to keep it readable */
@media (max-width: 600px) {
    .rating-label { font-size: 0.65rem; }
}

/* --- TIGHTER STARS ON MOBILE --- */

@media (max-width: 600px) {
    /* 1. Remove the flex gap so stars touch/get closer */
    .user-rating {
        gap: 0px !important; 
    }

    /* 2. Pull stars even closer together */
    .star-icon {
        margin: 0 -1px; /* Negative margin pulls them tight */
        font-size: 0.7rem !important; /* Slightly smaller stars for mobile */
    }

    /* 3. Add spacing back to the Text Label and Count so they aren't squashed */
    .rating-label {
        margin-right: 4px;
    }
    .vote-count, 
    .vote-count-modal {
        margin-left: 4px;
    }
}

/*Genre Text */
.genre-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 5px;
    margin-top: -2px; /* Pull it slightly closer to publisher */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- COMMUNITY MODAL MOBILE TWEAKS --- */
@media (max-width: 600px) {
    #communityModal .modal-content {
        width: 90% !important;      /* Reduces width to 85% of screen */
        max-width: 320px;           /* Ensures it doesn't get too wide */
        margin: 15vh auto;          /* Vertically centers it better */
        height: auto;
        max-height: 70vh;           /* Prevents it from being too tall */
    }
}


/* --- MOBILE LAYOUT & BOTTOM NAV --- */
@media (max-width: 600px) {
    /* 1. HEADER - ONE LINE LAYOUT */
    header {
        height: 60px;
        padding: 0 5px;
    }

    .header-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0 10px;
    }

    .logo-area {
        flex-grow: 1;
    }
    
    .logo-area h1 {
        font-size: 1.1rem;
    }

    /* 2. TOP RIGHT CONTROLS */
    .main-nav {
        width: auto;
        margin: 0;
        padding: 0;
        gap: 10px;
        overflow: visible;
        justify-content: flex-end;
    }

    /* Only show About in header */
    #mainNav .nav-item { display: none !important; }
    #mainNav .nav-item[href="about.html"] { 
        display: flex !important; 
        flex-direction: row;
        gap: 5px;
        padding: 5px 8px;
        background: rgba(0,0,0,0.05);
    }
    
    .theme-toggle-btn {
        position: static; 
        margin: 0;
    }

    /* 3. BODY PADDING */
    body { padding-bottom: 70px; }

    /* 4. BOTTOM NAV CONTAINER */
    .bottom-nav {
        display: flex; 
        justify-content: space-around; 
        align-items: center;
        position: fixed; 
        bottom: 0; 
        left: 0; 
        width: 100%;
        
        /* Force Height & Box Sizing */
        height: 50px !important; 
        box-sizing: content-box; 
        padding-bottom: env(safe-area-inset-bottom);
        
         background: #ffffff !important; /* Solid white instead of rgba */ 
        //backdrop-filter: none !important; /* REMOVE THIS (Performance Killer) */
        //-webkit-backdrop-filter: none !important; /* REMOVE THIS */
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1); 
        z-index: 999;
        
        /* SCROLL ANIMATION */
        transition: transform 0.3s ease-in-out;
        will-change: transform; 
    }

    /* --- THIS IS THE MISSING CLASS TO HIDE IT --- */
    .bottom-nav.nav-hidden {
        transform: translateY(100%);
    }

    html.dark-mode .bottom-nav { 
        background: #1e1e1e !important;  }

    /* 5. BOTTOM NAV ITEMS */
    .b-nav-item {
        display: flex; 
        flex-direction: column; 
        align-items: center; 
        justify-content: center;
        text-decoration: none; 
        color: var(--text-muted); 
        background: none; 
        border: none;
        font-size: 0.6rem !important; 
        font-weight: 700; 
        width: 20%; 
        cursor: pointer; 
        transition: 0.2s;
    }

    .b-nav-item.active, .b-nav-item:hover { 
        color: var(--primary-color); 
    }

    .b-nav-item svg { 
        width: 20px !important; 
        height: 20px !important; 
        margin-bottom: 1px !important; 
        fill: currentColor; 
    }
    
    /* 6. CENTER "FLOAT" BUTTON (Profile) */
    .b-nav-item.center-float { 
        position: relative; 
        top: -15px !important; 
    }
    
    .b-nav-item.center-float img {
        width: 56px; 
        height: 56px; 
        border-radius: 50%; 
        object-fit: cover;
        border: 4px solid var(--card-bg);
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }
    
    .b-nav-item.active.center-float img {
        border-color: var(--primary-color);
    }

    .b-nav-avatar { 
        width: 24px; 
        height: 24px; 
        border-radius: 50%; 
        border: 2px solid var(--text-muted); 
        object-fit: cover; 
    }
}
/* --- ENLARGE BIO BOX ON MOBILE --- */
@media (max-width: 600px) {
    #editBio {
        height: 140px !important;     /* Force a taller fixed height */
        min-height: 140px;            /* Prevent it from shrinking */
        font-size: 1rem;              /* Ensure text is readable */
        padding: 15px;                /* Add comfortable padding */
    }
}

/* --- ENLARGE BIO BOX ON MOBILE --- */
@media (max-width: 600px) {
    #editBio {
        height: 140px !important;     /* Force a taller fixed height */
        min-height: 140px;            /* Prevent it from shrinking */
        font-size: 1rem;              /* Ensure text is readable */
        padding: 15px;                /* Add comfortable padding */
    }
}

/* --- ACCOUNT SETTINGS MODAL MOBILE WIDTH --- */
@media (max-width: 600px) {
    #editModal .modal-content {
        width: 90% !important;      /* Reduce width to 85% of screen */
        max-width: 340px;           /* Cap the width so it doesn't get too big */
        margin: 5vh auto;           /* Center it vertically and horizontally */
    }
}

/* --- BUTTON VERTICAL SPACING CONTROL --- */

/* 1. Index Page Game Box */
.card-bottom-wrapper {
    /* Controls vertical distance between Amazon, Trailer row, and Collection btn */
    gap: 7px !important; 
}

/* 2. Enlarged Game Modal */
#mButtons {
    /* Controls vertical distance inside the large popup */
    gap: 7px !important; 
}

/* --- REDUCE GAP ABOVE MODAL BUTTONS --- */

/* 1. Pull the buttons up */
#mButtons {
    /* Changes the default 20px gap to 5px */
    margin-top: 5px !important; 
    
    /* Removes extra padding added in desktop view */
    padding-top: 2px !important; 
}

/* 2. Remove bottom spacing from the reviews list */
.modal-reviews-list {
    margin-bottom: 5px !important;
}

/* --- RAWG ATTRIBUTION FOOTER --- */
.rawg-footer {
    text-align: center;
    margin-top: 20px;
    padding-bottom: 30px;
    color: rgba(255, 255, 255, 0.9); /* White text to contrast with Red background */
    font-size: 0.8rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3); /* Slight shadow for readability */
}

.rawg-footer a {
    color: white;
    text-decoration: underline;
}


.rawg-footer a:hover {
    opacity: 0.8;
}

/* --- INDEX RATING COUNT SIZE (DESKTOP) --- */
@media (min-width: 601px) {
    .vote-count {
        font-size: 0.85rem !important; /* Change this value to resize (e.g. 0.6rem or 12px) */
        color: var(--text-muted);      /* Ensures it stays subtle */
        font-weight: normal;           /* Ensures it isn't bold */
        margin-left: 3px;              /* Slight spacing from the stars */
    }
}

/* --- EXTERNAL FOOTER (About Page) --- */
.external-footer {
    text-align: center;
    margin-top: 20px;
    padding-bottom: 30px;
    color: rgba(255, 255, 255, 0.9); /* White text to contrast with Red background */
    font-size: 0.8rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3); /* Slight shadow for readability */
}

.external-footer a {
    color: white;
    text-decoration: underline;
}

.external-footer a:hover {
    opacity: 0.8;
}

/* --- PROFILE REVIEW MODAL STYLES --- */

/* Header with Avatar and Date */
.review-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.review-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.review-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Thumbs Up Button */
.thumbs-up-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.thumbs-up-btn:hover {
    background: #f0f8ff;
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-1px);
}

.thumbs-up-btn.liked {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Container for the Like Button */
.like-container {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end; /* Pushes button to the right */
    border-top: 1px dashed var(--border-color);
    padding-top: 15px;
}

/* Review Text Display Area */
.review-content-display {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-main);
    white-space: pre-wrap; /* Preserves paragraphs */
    max-height: 400px;
    overflow-y: auto;
}

/* Delete Button (Admin/Self) */
.btn-review-delete {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.75rem;
    transition: 0.2s;
}
.btn-review-delete:hover {
    background: #c62828;
    color: white;
}

/* --- PROFILE REVIEW MODAL STYLES --- */

/* Header Layout */
.review-modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* Avatar Styling - Fixes "Squashed/Invisible" issue */
.review-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    flex-shrink: 0; /* CRITICAL: Prevents image from disappearing */
    background-color: #ccc;
    display: block;
}

/* Meta Data (Date) */
.review-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Thumbs Up Button Styling */
.thumbs-up-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.thumbs-up-btn:hover {
    background: #f0f8ff;
    border-color: #007bff;
    color: #007bff;
}

.thumbs-up-btn.liked {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Review Text Area */
.review-content-display {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-main);
    white-space: pre-wrap;
    margin-bottom: 15px;
}

/* Button Container */
.like-container {
    display: flex;
    justify-content: flex-end;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
}

/* --- ENHANCED PROFILE REVIEW MODAL (Matches Index Style) --- */

/* 1. Make the container look like a distinct "Card" */
#reviewReadMode {
    background-color: var(--bg-color) !important; /* Contrast background (Gray/Dark) */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 5px 0 0 0;
    padding: 15px !important; /* Internal spacing */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* 2. Refine the Header to match Index */
.review-modal-header {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
}

/* 3. Match Avatar Styling */
#reviewReadAvatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ccc;
    margin-right: 12px;
    flex-shrink: 0; /* Prevents squashing */
}

/* 4. Match Username/Date Text */
#reviewReadUser {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-main);
}
.review-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 5. Match Content Typography */
.review-content-display {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-main);
    white-space: pre-wrap; /* Keeps paragraphs */
}

/* 6. Clean up the Like Button area */
.like-container {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color); /* Subtle separator */
    display: flex;
    justify-content: flex-end;
}

/* --- POLISHED PROFILE REVIEW BOX --- */

/* 1. Main Card Container */
#reviewReadMode {
    background-color: var(--bg-color) !important; /* Light Grey (or Dark Grey in Dark Mode) */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* 2. Header: Remove line, improve spacing */
.review-modal-header {
    border-bottom: none !important; /* Removes line below avatar */
    margin-bottom: 10px;
    padding-bottom: 0;
}

/* 3. Review Text: Give it a "Speech Bubble" look */
.review-content-display {
    background-color: var(--card-bg); /* White (or Black in Dark Mode) to contrast container */
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 10px;
}

/* 4. Like Button Area: Remove lines and tighten spacing */
.like-container {
    border-top: none !important; /* Removes line above like button */
    margin-top: 5px;
    padding-top: 0;
    display: flex;
    justify-content: flex-end; /* Aligns button to the right */
}

/* 5. Refine the Like Button itself */
.thumbs-up-btn {
    margin-top: 0;
    padding: 5px 12px;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* --- REFINED PROFILE REVIEW BOX (Grey Text Bubble) --- */

/* 1. Outside Container (White) */
#reviewReadMode {
    background-color: var(--card-bg) !important; /* White */
    border: none !important; /* No Border */
    box-shadow: none !important; /* Flattens it against the modal */
    padding: 5px 10px !important; /* Minimal outer padding */
}

/* 2. Inner Text Area (Slightly Grey) */
.review-content-display {
    background-color: var(--bg-color) !important; /* Light Grey */
    padding: 20px;
    border-radius: 12px; /* Soft rounded corners */
   border: 1px solid var(--border-color);
    
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 10px;
}

/* 3. Header Spacing */
.review-modal-header {
    border-bottom: none !important;
    margin-bottom: 15px;
    padding-left: 5px; /* Align with text bubble */
}

/* 4. Like Button Spacing */
.like-container {
    border-top: none !important;
    padding-right: 5px; /* Align with text bubble */
}

/* --- FINAL MODAL POLISH --- */

/* 1. Remove the line above the Close button (Footer) */
.modal-footer {
    border-top: none !important;
    padding-top: 10px; /* Adjust spacing since line is gone */
}

/* 2. Close Button Hover Effect */
.cancel-btn {
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.cancel-btn:hover {
    background-color: #d0d0d0 !important; /* Darker Grey on hover */
    transform: translateY(-1px); /* Subtle lift */
    cursor: pointer;
}

/* Dark Mode Hover Adjustment */
html.dark-mode .cancel-btn:hover {
    background-color: #444 !important; /* Dark Grey for Dark Mode */
    color: #fff;
}

/* --- SEARCH & FILTER DRAWER --- */
.controls-wrapper {
    max-width: 800px;
    margin: 20px auto 10px;
    padding: 0 15px;
    position: relative;
}

.search-primary-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

#searchInput {
    flex-grow: 1;
    height: 45px; /* Taller touch target */
    border-radius: 8px;
    border: 2px solid var(--border-color);
    padding: 0 15px;
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text-main);
}

.filter-toggle-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    height: 45px;
    padding: 0 15px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-main);
    transition: all 0.2s;
    min-width: 50px;
    justify-content: center;
}

.filter-toggle-btn:hover, .filter-toggle-btn.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-color);
}

/* The Drawer */
.filter-drawer {
    margin-top: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    animation: slideDownFade 0.2s ease-out;
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 Columns on Desktop & Mobile */
    gap: 15px;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.drawer-select {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0 10px;
    background: var(--bg-color);
    color: var(--text-main);
    font-weight: 600;
}

/* Mobile Tweak: Ensure Drawer columns fit well */
@media (max-width: 400px) {
    .filter-grid {
        grid-template-columns: 1fr; /* 1 Column on very small phones */
    }
}

/* --- TOAST NOTIFICATIONS (FIXED) --- */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000000; /* Ensure this is the highest number in your CSS */
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: auto;
}

.toast {
    background-color: var(--card-bg); /* Matches theme */
    color: var(--text-main);
    padding: 12px 25px;
    border-radius: 50px; /* Pill shape looks more modern */
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    opacity: 0;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    
    /* Animation: Slide Up, Stay, Fade Out */
    animation: toast-in-out 3.5s forwards; 
}

.toast.success { border-left: 5px solid #2ecc71; }
.toast.error { border-left: 5px solid #e74c3c; }
.toast.info { border-left: 5px solid #3498db; }

@keyframes toast-in-out {
    0% { opacity: 0; transform: translateY(20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* --- CUSTOM CONFIRM MODAL --- */
#customConfirmModal .modal-content {
    max-width: 320px !important;
    text-align: center;
    padding: 25px;
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#customConfirmModal h3 {
    margin: 0 0 10px 0;
    color: var(--text-main);
}

#customConfirmModal p {
    color: var(--text-muted);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.confirm-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-btn-yes {
    background: #c0392b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    flex: 1;
    transition: transform 0.1s;
}

.confirm-btn-yes:hover {
    background: #e74c3c;
    transform: translateY(-2px);
}

.confirm-btn-no {
    background: var(--bg-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    flex: 1;
    transition: background 0.2s;
}

.confirm-btn-no:hover {
    background: var(--border-color);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* --- STATUS BADGES --- */
.status-btn {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 6px 0;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    width: 100%;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: transform 0.1s;
}
.status-btn:hover { transform: scale(1.02); filter: brightness(1.1); }

/* Color Coding */
.stat-Backlog { background: #95a5a6; color: white; }        /* Grey */
.stat-NotStarted { background: #7f8c8d; color: white; }     /* Dark Grey */
.stat-Playing { background: #3498db; color: white; }        /* Blue */
.stat-OnHold { background: #f39c12; color: white; }         /* Orange */
.stat-Completed { background: #2ecc71; color: white; }      /* Green */
.stat-100Complete { background: #9b59b6; color: white; }    /* Purple */
.stat-Dropped { background: #e74c3c; color: white; }        /* Red */

/* Status Modal List */
.status-option {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-main);
    font-weight: bold;
    cursor: pointer;
    text-align: left;
}
.status-option:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* --- BOTTOM NAVIGATION (Mobile Only) --- */
.bottom-nav {
    display: none; /* Hidden on Desktop */
}

@media (max-width: 600px) {
    /* 1. HIDE OLD NAV ITEMS ON MOBILE */
    /* We keep About in the top header, hide everything else */
    #mainNav .nav-item {
        display: none !important;
    }
    
    /* Only show "About" in the top header on mobile */
    #mainNav .nav-item[href="about.html"] {
        display: flex !important;
    }

    /* 2. BODY PADDING */
    /* Ensure content isn't hidden behind the fixed bar */
    body {
        padding-bottom: 80px; 
    }

    /* 3. BOTTOM BAR CONTAINER */
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        background: rgba(255, 255, 255, 0.95); /* Glass effect light */
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
        z-index: 999;
        padding-bottom: env(safe-area-inset-bottom); /* iOS Safe Area */
    }

    /* Dark Mode Adjustment */
    html.dark-mode .bottom-nav {
        background: rgba(30, 30, 30, 0.95);
    }

    /* 4. BOTTOM NAV ITEMS */
    .b-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-muted);
        background: none;
        border: none;
        font-size: 0.65rem;
        font-weight: 700;
        width: 20%; /* 5 items = 20% each */
        cursor: pointer;
        transition: 0.2s;
    }

    .b-nav-item svg {
        width: 24px;
        height: 24px;
        margin-bottom: 3px;
        fill: currentColor;
    }

    .b-nav-item.active, .b-nav-item:hover {
        color: var(--primary-color);
    }
    
    /* 5. THE CENTRAL "+" BUTTON (Submit) */
    .b-nav-item.add-btn {
        position: relative;
        top: -20px; /* Float above the bar */
    }

    .b-nav-item.add-btn div {
        width: 48px;
        height: 48px;
        background: var(--primary-gradient);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
        border: 3px solid var(--card-bg); /* Border creates separation from bar */
    }

    .b-nav-item.add-btn svg {
        fill: white;
        margin: 0;
        width: 28px;
        height: 28px;
    }
    
    /* 6. PROFILE PIC IN NAV */
    .b-nav-avatar {
        width: 26px;
        height: 26px;
        border-radius: 50%;
        border: 2px solid var(--text-muted);
        object-fit: cover;
    }
    .b-nav-item.active .b-nav-avatar {
        border-color: var(--primary-color);
    }
}

/* --- MOBILE NOTIFICATION BADGE --- */
    /* Ensure the nav item can hold the absolute badge */
     .b-nav-item {
        position: relative; /* Critical for badge positioning */
    }

/* 2. Style the Badge to float Top-Left of the Icon */
    .mobile-badge {
        position: absolute;
        
        /* Position vertically */
        top: 3px; 
        
        /* Position horizontally: Start at center (50%), move left by 12px to hit the icon */
        left: 50%; 
        margin-left: -20px; 
        
        /* Circle Styling */
        background: var(--primary-color); /* Matches theme red/green */
        color: white;
        border-radius: 50%; /* Perfect circle */
        width: 18px;
        height: 18px;
        
        /* Text alignment */
        font-size: 0.6rem;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
        
        /* White border to separate from icon */
        border: 2px solid var(--card-bg); 
        z-index: 20;
    }

/* --- PROFILE GAME CARD TWEAKS --- */

/* 1. Force Rating and Buttons to the bottom of the card */
#collectionsContainer .game-card .card-content {
    display: flex;
    flex-direction: column;
    /* This ensures the flexbox takes up full height to allow spacing logic to work */
    height: 100%; 
}

#collectionsContainer .user-rating {
    /* "auto" margin pushes this element (and everything below it) to the bottom */
    margin-top: auto !important; 
    
    /* Add a little breathing room above the stars */
    padding-top: 8px;
    margin-bottom: 4px !important;
}

/* 2. Reduce space between buttons */
#collectionsContainer .card-bottom-wrapper {
    /* Reduce the vertical gap between buttons (Default was 12px) */
    gap: 2px !important; 
    
    /* Remove extra margin since the rating is now handling the spacing */
    margin-top: 0 !important;
}

/* --- MOBILE NAV FIX (Paste at the bottom of style.css) --- */
@media (max-width: 600px) {

    /* 1. Header Container Spacing */
    #mainNav { 
        gap: 8px !important; 
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end;
        width: auto !important; /* Prevents stretching */
    }

    /* 2. Hide ALL nav items by default on Mobile */
    #mainNav .nav-item { display: none !important; }

    /* 3. Show ONLY 'About' & 'Submit' with LOCKED DIMENSIONS */
    #mainNav .nav-item[href="about.html"],
    #mainNav .nav-item[href="submit.html"] { 
        display: flex !important; 
        align-items: center;
        justify-content: center;
        
        /* FIXED SIZES PREVENT JUMPING (Mobile Only) */
        width: 40px !important; 
        height: 36px !important; 
        padding: 0 !important;
        margin: 0 !important;
        
        /* Visual Style */
        background: rgba(0,0,0,0.05); 
        border-radius: 8px;
        transition: background 0.2s;
    }

    /* Dark Mode Pill Color */
    html.dark-mode #mainNav .nav-item[href="about.html"],
    html.dark-mode #mainNav .nav-item[href="submit.html"] {
        background: rgba(255,255,255,0.15);
    }

    /* 4. Force Text Hidden (Mobile Only) */
    #mainNav .nav-item .nav-text {
        display: none !important;
    }
    
    /* 5. Lock Icon Size (Mobile Only) */
    #mainNav .nav-item svg {
        width: 24px !important;
        height: 24px !important;
        margin: 0 !important;
        fill: currentColor;
    }

    /* 6. Fixed Order: Submit (Left), About (Right) */
    #mainNav .nav-item[href="submit.html"] { order: -1 !important; }
    #mainNav .nav-item[href="about.html"]  { order: 0 !important; }
}

/* --- PLAZA MODAL SIZE FIX --- */
/* Forces the list area to always be at least 300px tall, 
   preventing the "one line" collapsed look */
#socialListResults, 
#socialFindArea {
    min-height: 350px !important;
}

/* Ensure the tabs have enough breathing room globally */
.tab-btn {
    padding: 15px 10px !important;
}

/* --- TALLER ACTIVITY MODAL (Mobile Only) --- */
    #communityModal .modal-content {
        height: 80vh !important;      /* Forces it to be 80% of screen height */
        max-height: 85vh !important;  /* Safety cap */
        margin: 10vh auto !important; /* Less top margin so it fits vertically */
        display: flex !important;
        flex-direction: column !important;
    }

    /* Ensure the list inside stretches to fill that new height */
    #communityFeedList {
        flex-grow: 1 !important;
        overflow-y: auto !important;
        min-height: 0 !important;
    }

/* --- HEADER TAGLINE STYLES --- */

/* 1. Layout the Logo and Text side-by-side */
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none; /* Removes underline from text */
}

/* 2. Style the Text */
.header-tagline {
    color: rgba(255, 255, 255, 0.75); /* Soft White */
    font-size: 0.75rem; /* Small, readable size */
    font-weight: 500;
    line-height: 1.2;
    max-width: 250px; /* Wraps text if it gets too long */
    display: block;
}

/* 3. Hide on Mobile (Crucial to keep buttons visible) */
@media (max-width: 768px) {
    .header-tagline {
        display: none !important;

    }

/* --- MOBILE HEADER TEXT FIX (Right of Logo) --- */

    /* 1. Container: Keep items side-by-side (Row), but limit width */
    .logo-area {
        flex-direction: row !important;   /* Side by side */
        align-items: center !important;   /* Vertically centered */
        gap: 6px !important;              /* Small gap between logo and text */
        max-width: 65%;                   /* Stop before hitting the buttons on the right */
        flex-grow: 0;                     /* Don't expand unnecessarily */
    }

    /* 2. Logo: Shrink slightly for mobile so text fits */
    .header-logo {
        height: 28px !important;          /* 28px fits well on mobile bars */
        width: auto;
        flex-shrink: 0;                   /* Prevent logo from squashing */
    }

    /* 3. Tagline: Make it visible, tiny, and wrap text */
    .header-tagline {
        display: block !important;        /* Force show on mobile */
        font-size: 0.5rem !important;     /* Tiny text (approx 8px) */
        line-height: 1.1 !important;      /* Tight line spacing */
        white-space: normal !important;   /* Allow text to wrap to next line */
        color: rgba(255, 255, 255, 0.8);  /* Readable soft white */
        text-align: left;
    }