:root {
    /* Color Palette (Dark Theme - Default) */
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --primary-color: #6a0dad; /* Purple */
    --secondary-color: #ff00ff; /* Magenta */
    --accent: #00e5ff; /* Cyan/Glow */
    --accent-glow: #00e5ff;
    
    --bg-secondary: #252525;
    --bg-header: #1a1a1a;
    --bg-hover: #2a2a2a;
    
    /* Fonts */
    --font-main: 'Oswald', sans-serif;
    --font-heading: 'Cinzel', serif;
}

/* --- THEMES --- */

/* Pink / Girly Theme */
[data-theme="pink"] {
    --bg-dark: #1a0510;
    --bg-panel: #2d0a1e;
    --text-main: #ffe6f2;
    --text-muted: #ffb3d9;
    --primary-color: #ff1493; /* Deep Pink */
    --secondary-color: #ff69b4; /* Hot Pink */
    --accent: #ffc0cb; /* Pink */
    --accent-glow: #ff69b4;
    --bg-secondary: #3d0e28;
    --bg-header: #2d0a1e;
    --bg-hover: #4d1232;
}

/* Blue / Boyish Theme */
[data-theme="blue"] {
    --bg-dark: #050a14;
    --bg-panel: #0a1929;
    --text-main: #e6f1ff;
    --text-muted: #8892b0;
    --primary-color: #0056b3;
    --secondary-color: #00bcd4; /* Cyan */
    --accent: #64ffda; /* Teal */
    --accent-glow: #00bcd4;
    --bg-secondary: #112240;
    --bg-header: #0a1929;
    --bg-hover: #172a45;
}

/* Matrix / Hacker Theme */
[data-theme="matrix"] {
    --bg-dark: #000000;
    --bg-panel: #0a0a0a;
    --text-main: #00ff41;
    --text-muted: #008f11;
    --primary-color: #003b00;
    --secondary-color: #008f11;
    --accent: #00ff41;
    --accent-glow: #00ff41;
    --bg-secondary: #0d0d0d;
    --bg-header: #050505;
    --bg-hover: #1a1a1a;
}

/* Light / High Contrast Theme */
[data-theme="light"] {
    --bg-dark: #f4f4f4;
    --bg-panel: #ffffff;
    --text-main: #121212;
    --text-muted: #555555;
    --primary-color: #6a0dad;
    --secondary-color: #ff00ff;
    --accent: #007bff; /* Blue for better visibility on white */
    --accent-glow: #6a0dad;
    --bg-secondary: #e0e0e0;
    --bg-header: #ffffff;
    --bg-hover: #f0f0f0;
}

/* Theme Switcher UI */
.theme-switcher {
    display: inline-flex;
    gap: 8px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    align-items: center;
    vertical-align: middle;
    /* Absolute positioning for desktop to keep nav centered */
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.theme-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.theme-btn:hover {
    transform: scale(1.2);
    border-color: #fff;
}

.theme-btn.active {
    border-color: #fff;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Specific button colors for UI */
.theme-btn[data-set-theme="default"] { background: #121212; border-color: #6a0dad; }
.theme-btn[data-set-theme="pink"] { background: #ff1493; }
.theme-btn[data-set-theme="blue"] { background: #0056b3; }
.theme-btn[data-set-theme="matrix"] { background: #00ff41; }
.theme-btn[data-set-theme="light"] { background: #f4f4f4; }


body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Global Image Reset */
img {
    max-width: 100%;
    height: auto;
}

/* Form Container for Profile/Edit Pages */
.form-container {
    background: var(--bg-panel);
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    margin: 20px auto;
    border: 1px solid #333;
}
@media (max-width: 480px) {
    .form-container {
        padding: 15px;
        margin: 10px;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: #ffffff;
    margin-bottom: 1rem;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--secondary-color);
}

/* Layout */
.container-wide {
    width: 100% !important;
    max-width: none !important;
    padding: 0 20px;
    box-sizing: border-box;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header & Nav */
header {
    background: var(--bg-panel);
    border-bottom: 1px solid #333;
    padding: 0;
    margin-bottom: 0;
}

/* Header Banner */
.header-banner {
    position: relative;
    width: 100%;
    height: 250px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-bottom: 4px solid var(--primary-color);
}

.header-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.header-content {
    position: relative;
    z-index: 2;
}

.site-logo-text {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 15px var(--primary-color);
    margin-bottom: 5px;
}

.site-tagline {
    font-family: var(--font-main);
    font-size: 1.1rem;
    color: var(--accent);
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 300;
}

/* Navbar */
.navbar {
    background: #000;
    border-bottom: 1px solid #333;
    padding: 0 40px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center; /* Center align links */
    position: relative; /* For absolute positioning of theme switcher */
}

.navbar ul {
    list-style: none;
    display: flex;
    gap: 15px;
    margin: 0;
    padding: 0;
}

.menu-toggle {
    display: none;
    background: transparent;
    color: var(--text-main);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 15px;
}
.menu-toggle:hover {
    background: transparent;
    color: var(--primary-color);
    box-shadow: none;
}

.navbar li, .nav-links li {
    display: inline-block;
}

.navbar a, .nav-links a {
    color: var(--text-main);
    font-weight: bold;
    text-transform: uppercase;
    padding: 8px 15px;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.navbar a:hover, .navbar a.active, .nav-links a:hover, .nav-links a.active {
    color: #fff;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    text-shadow: none;
}

/* Theme Switcher */
.theme-switcher {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 8px;
    z-index: 1001;
}

.theme-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #555;
    transition: transform 0.2s, border-color 0.2s;
}

.theme-btn:hover {
    transform: scale(1.2);
}

.theme-btn.active {
    border-color: #fff;
    box-shadow: 0 0 5px #fff;
    transform: scale(1.1);
}

/* Theme Colors for Buttons */
.theme-btn[data-set-theme="default"] { background: #121212; border-color: #6a0dad; }
.theme-btn[data-set-theme="pink"] { background: #ff00ff; border-color: #ff00ff; }
.theme-btn[data-set-theme="blue"] { background: #00e5ff; border-color: #00e5ff; }
.theme-btn[data-set-theme="matrix"] { background: #00ff00; border-color: #00ff00; }
.theme-btn[data-set-theme="light"] { background: #f0f0f0; border-color: #ccc; }

/* Global Stats Bar */
.global-stats-bar {
    background: #0f0f0f;
    border-bottom: 1px solid #222;
    padding: 8px 40px;
    font-size: 0.85rem;
    color: #aaa;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-item a {
    color: var(--accent);
    text-decoration: none;
}

.stats-item a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn, button, input[type="submit"], .admin-btn {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-main);
    text-transform: uppercase;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
}

.btn:hover, button:hover, input[type="submit"]:hover, .admin-btn:hover {
    background: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
    color: #fff;
    text-decoration: none;
}

.btn-glow {
    box-shadow: 0 0 5px var(--primary-color);
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: 1px solid var(--primary-color);
}
.btn-primary:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #fff;
}

.btn-outline-primary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}
.btn-outline-primary:hover {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 10px var(--accent);
}

.btn-sm {
    padding: 5px 15px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 1.2rem;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-danger {
    background: #e74c3c;
}
.btn-danger:hover {
    background: #c0392b;
    box-shadow: 0 0 10px #e74c3c;
}

/* Cards & Panels */
.panel, .card, .game-card, .forum-section {
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Forms */
input[type="text"], input[type="password"], input[type="email"], input[type="number"], textarea, select {
    background: #2a2a2a;
    border: 1px solid #444;
    color: var(--text-main);
    padding: 10px;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
    font-family: var(--font-main);
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 5px rgba(0, 229, 255, 0.3);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: var(--bg-panel);
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #333;
}

th {
    background: var(--bg-header);
    color: var(--accent);
    text-transform: uppercase;
    font-size: 0.9rem;
}

tr:hover {
    background: var(--bg-hover);
}

.admin-table th, .admin-table td {
    padding: 15px;
}

/* Footer */
footer {
    background: #000;
    padding: 40px 0;
    margin-top: 50px;
    text-align: center;
    border-top: 1px solid #333;
    color: var(--text-muted);
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* --- Front-End Portal Styles --- */

/* Hero Slider */
.hero {
    height: 400px;
    position: relative;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--primary-color);
}

.hero-overlay {
    background: rgba(0,0,0,0.6);
    padding: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(5px);
    max-width: 800px;
    width: 90%;
}

.hero h1 {
    font-size: 3rem;
    margin: 0 0 10px;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
    color: #fff;
}

.hero p {
    font-size: 1.2rem;
    color: #ddd;
    margin-bottom: 25px;
}

/* Portal Grid Layout */
.portal-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 30px;
    align-items: start;
}

.portal-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-all {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: bold;
    text-transform: uppercase;
}

.view-all:hover {
    color: #fff;
    text-shadow: 0 0 5px var(--accent);
}

/* Game Grids */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* Game Cards */
.game-card {
    display: block;
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    text-decoration: none;
    color: inherit;
    padding: 0; /* Reset generic card padding */
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(106, 13, 173, 0.3);
    border-color: var(--primary-color);
}

.card-image {
    position: relative;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    overflow: hidden;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.game-card:hover .card-image img {
    transform: scale(1.1);
}

.card-image .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.game-card:hover .card-image .overlay {
    opacity: 1;
}

.card-image .overlay i {
    font-size: 3rem;
    color: #fff;
    text-shadow: 0 0 10px var(--primary-color);
}

.card-content {
    padding: 15px;
}

.card-content h3 {
    margin: 0 0 5px;
    font-size: 1rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-content .views {
    font-size: 0.8rem;
    color: #888;
}

/* Sidebar Widgets */
.widget {
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.widget h3 {
    margin-top: 0;
    font-size: 1.2rem;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Ranking List */
.ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ranking-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #333;
}

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

.ranking-list .rank {
    font-weight: bold;
    color: var(--accent);
    width: 30px;
}

.ranking-list .name {
    flex: 1;
    color: #ddd;
}

.ranking-list .score {
    font-weight: bold;
    color: var(--secondary-color);
}

/* Member Tags */
.member-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background: #333;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    color: #ccc;
    border: 1px solid #444;
}

/* Forum List */
.forum-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.forum-item {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 4px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    border: 1px solid #333;
}

.forum-icon {
    font-size: 1.5rem;
    color: var(--accent);
    padding-top: 5px;
}

.forum-details {
    flex: 1;
}

.thread-title {
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    display: block;
    margin-bottom: 5px;
}

.thread-meta {
    font-size: 0.8rem;
    color: #888;
    display: flex;
    gap: 15px;
}

.thread-meta a {
    color: #aaa;
}

.thread-meta a:hover {
    color: var(--accent);
}

/* Forum Thread View */
.thread-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.post {
    display: flex;
    background: var(--bg-panel);
    border: 1px solid #333;
    margin-bottom: 20px;
    border-radius: 4px;
    overflow: hidden;
}

.post-author {
    width: 200px;
    background: var(--bg-header);
    padding: 20px;
    text-align: center;
    border-right: 1px solid #333;
    flex-shrink: 0;
}

.post-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 2px solid var(--primary-color);
}

.post-body {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.post-meta {
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.post-content {
    flex: 1;
    line-height: 1.8;
    font-size: 1rem;
    word-wrap: break-word;
}

.post-attachment {
    margin-top: 20px;
    border-top: 1px solid #333;
    padding-top: 10px;
}

.attached-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid #444;
    margin-top: 5px;
    display: block;
}

/* Mobile Responsive Nav */
@media (max-width: 768px) {
    .portal-grid {
        grid-template-columns: 1fr;
    }
    
    .header-banner {
        height: 150px;
    }
    
    .site-logo-text {
        font-size: 2rem;
    }
    
    /* Improved Mobile Navigation */
    .navbar {
        height: auto;
        padding: 10px 20px;
        flex-direction: row; /* Keep logo and toggle on same line */
        justify-content: space-between;
        align-items: center;
        position: relative;
        /* Fix overflow issues */
        width: 100%;
        box-sizing: border-box;
    }
    
    .theme-switcher {
        position: static;
        transform: none;
        margin: 0;
    }

    .menu-toggle {
        display: block;
        /* No absolute positioning needed if flex container works */
        order: 2;
        font-size: 1.8rem;
        padding: 10px;
    }
    
    .navbar ul.nav-links {
        display: none !important; /* Force hide initially */
        width: 100%;
        flex-direction: column;
        position: absolute;
        top: 100%; /* Drop down below navbar */
        left: 0;
        right: 0;
        background: rgba(0,0,0,0.95);
        backdrop-filter: blur(10px);
        margin: 0;
        padding: 0;
        border-bottom: 2px solid var(--primary-color);
        z-index: 9999;
        box-shadow: 0 10px 20px rgba(0,0,0,0.5);
        max-height: 80vh; /* Prevent menu from being too tall */
        overflow-y: auto; /* Allow scrolling if menu is long */
    }
    
    .navbar ul.nav-links.active {
        display: flex !important; /* Force show when active */
        animation: slideDown 0.3s ease-out;
    }
    
    .navbar li {
        width: 100%;
        text-align: center;
        margin: 0;
    }
    
    /* Mobile Touch Targets */
    .nav-links a {
        display: block;
        padding: 15px 0; /* Larger touch target */
        border-bottom: 1px solid rgba(255,255,255,0.1);
        width: 100%;
        font-size: 1.1rem; /* Easier to read */
    }
    
    .nav-links a:hover, .nav-links a:active {
        background: rgba(255,255,255,0.05);
    }
    
    .hero {
        height: 300px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }

    /* Prevent horizontal scroll globally */
    body, html {
        overflow-x: hidden;
        max-width: 100%;
    }
    
    .post {
        flex-direction: column;
    }
    .post-author {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #333;
        display: flex;
        align-items: center;
        gap: 15px;
        padding: 10px;
        text-align: left;
    }
    .post-avatar {
        width: 50px;
        height: 50px;
        margin-bottom: 0;
    }
}

/* Mobile Grid Adjustment */
@media (max-width: 480px) {
    .grid-4 {
        /* Force 2 columns on mobile as per frontend-design skill */
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .game-card .card-content {
        padding: 10px;
    }
    
    .game-card .card-content h3 {
        font-size: 0.9rem;
    }
    
    .game-card .card-content .views {
        font-size: 0.7rem;
    }
    
    /* Hide non-essential elements on very small screens if needed */
    .hero {
        height: 200px; /* Reduce hero height further */
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .site-logo-text {
        font-size: 1.8rem; /* Smaller logo */
    }
}

/* Play Page Responsive */
@media (max-width: 768px) {
    .game-dashboard {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    .game-dashboard .panel {
        padding: 15px !important;
    }
    .game-dashboard .stat-box {
        padding: 12px !important;
    }
    .game-actions {
        flex-direction: column !important;
    }
    .game-actions .btn {
        width: 100% !important;
    }
    .game-tip-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 12px 15px !important;
    }
    .game-tip-bar .tip-text {
        display: block;
    }
    .game-header-panel h1 {
        font-size: 1.4rem !important;
    }
    .iframe-wrapper {
        padding-bottom: 75%; /* Taller on mobile for better visibility */
    }
}
@media (max-width: 480px) {
    .game-header-panel {
        padding: 15px !important;
    }
    .game-header-panel h1 {
        font-size: 1.2rem !important;
    }
}

/* Responsive Table */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile: Daily Challenges & Onboarding */
@media (max-width: 768px) {
    .daily-challenges-panel .challenges-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    .daily-challenges-panel .challenge-card {
        padding: 12px !important;
        min-height: auto;
    }
    .daily-challenges-panel .challenge-card .challenge-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .daily-challenges-panel .challenge-card .challenge-thumb {
        width: 48px !important;
        height: 48px !important;
    }
    .onboarding-panel .onboarding-tasks {
        flex-direction: column !important;
    }
    .onboarding-panel .onboarding-task {
        flex: 1 1 100% !important;
        min-width: 0;
    }
    .onboarding-panel .onboarding-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .profile-stats-bar {
        flex-wrap: wrap !important;
        justify-content: center;
        gap: 15px !important;
        padding: 12px 16px !important;
        border-radius: 12px !important;
    }
    .profile-stats-bar .p-stat {
        min-width: 50px;
    }
    .profile-grid-redesign {
        grid-template-columns: 1fr !important;
    }
    .profile-header-redesign {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px 16px !important;
        margin-top: -60px !important;
    }
    .profile-avatar-xl {
        width: 120px !important;
        height: 120px !important;
    }
    .profile-name-row {
        justify-content: center !important;
    }
    .profile-cover {
        height: 180px !important;
    }
}
@media (max-width: 480px) {
    .daily-challenges-panel .challenge-card .challenge-title {
        font-size: 0.95rem !important;
    }
    .onboarding-panel .onboarding-task {
        padding: 10px !important;
    }
}

/* --- New Profile Styles --- */

.profile-container {
    background: var(--bg-panel);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
}

.profile-cover {
    height: 250px;
    width: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
}

.profile-cover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to top, var(--bg-panel), transparent);
}

.profile-header-redesign {
    padding: 20px 30px 30px;
    display: flex;
    align-items: flex-end;
    gap: 30px;
    margin-top: -80px;
    position: relative;
    z-index: 2;
}

.profile-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar-xl {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 6px solid var(--bg-panel);
    object-fit: cover;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    background: var(--bg-panel);
}

.profile-info {
    flex: 1;
    padding-bottom: 10px;
}

.profile-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.profile-name {
    font-size: 2.5rem;
    margin: 0;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.profile-role-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: bold;
    background: var(--primary-color);
    color: #fff;
    vertical-align: middle;
    margin-left: 10px;
}

.profile-stats-bar {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    background: rgba(255,255,255,0.03);
    padding: 15px 25px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
    width: fit-content;
    border: 1px solid rgba(255,255,255,0.05);
}

.p-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.p-stat-value {
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}

.p-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
}

.profile-grid-redesign {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.section-card {
    background: var(--bg-panel);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
    margin-bottom: 20px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Achievement Badges */
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
}

.achievement-badge-card {
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 15px 10px;
    text-align: center;
    transition: transform 0.2s, background 0.2s;
    border: 1px solid transparent;
}

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

.badge-icon {
    font-size: 2rem;
    color: gold;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 5px rgba(255,215,0,0.5));
}

.badge-name {
    font-size: 0.75rem;
    color: #ddd;
    line-height: 1.2;
    display: block;
}

/* Responsive Profile */
@media (max-width: 768px) {
    .profile-header-redesign {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-top: -60px;
    }
    
    .profile-name-row {
        justify-content: center;
        flex-direction: column;
        gap: 10px;
    }
    
    .profile-stats-bar {
        width: 100%;
        justify-content: space-around;
        box-sizing: border-box;
    }
    
    .profile-grid-redesign {
        grid-template-columns: 1fr;
    }
}

.forum-row,
.thread-row {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.forum-row:hover,
.thread-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(106, 13, 173, 0.22), 0 0 10px rgba(0, 229, 255, 0.18);
    background: rgba(255,255,255,0.03);
}

.bbcode-toolbar {
    position: sticky;
    top: 10px;
    background: rgba(30,30,30,0.85);
    backdrop-filter: blur(2px);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 8px;
    z-index: 5;
}

.bbcode-preview {
    background: rgba(255,255,255,0.03);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text-main);
    line-height: 1.6;
}

.forum-thread-list .thread-row {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) 140px 80px 80px minmax(220px, 0.9fr);
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #222;
    align-items: center;
}

.forum-thread-list .forum-thread-header {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) 140px 80px 80px minmax(220px, 0.9fr);
    gap: 10px;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #333;
}

/* Desktop/tablet defaults for numeric columns */
.forum-thread-list .thread-views-cell,
.forum-thread-list .thread-replies-cell {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

@media (max-width: 768px) {
    .forum-thread-list .forum-thread-header {
        display: none;
    }

    .forum-thread-list .thread-row {
        grid-template-columns: 1fr;
        padding: 10px 0;
        gap: 6px;
    }

    .forum-thread-list .thread-row > div:nth-child(1) {
        font-size: 0.95rem;
    }

    .forum-thread-list .thread-row > div:nth-child(2),
    .forum-thread-list .thread-row > div:nth-child(3),
    .forum-thread-list .thread-row > div:nth-child(4),
    .forum-thread-list .thread-row > div:nth-child(5) {
        font-size: 0.8rem;
        color: var(--text-muted);
        text-align: left;
    }

    .forum-thread-list .thread-row > div:nth-child(2)::before {
        content: "Author: ";
        font-weight: 600;
        color: var(--text-main);
        margin-right: 4px;
    }

    .forum-thread-list .thread-row > div:nth-child(3)::before {
        content: "Views: ";
        font-weight: 600;
        color: var(--text-main);
        margin-right: 4px;
    }

    .forum-thread-list .thread-row > div:nth-child(4)::before {
        content: "Replies: ";
        font-weight: 600;
        color: var(--text-main);
        margin-right: 4px;
    }

    .forum-thread-list .thread-row > div:nth-child(5)::before {
        content: "Last post: ";
        font-weight: 600;
        color: var(--text-main);
        margin-right: 4px;
    }
}
