/* =========================================
   RESET & VARIABLES (INFERNO THEME)
   ========================================= */
:root {
    /* Brand Colors (Inferno) */
    --primary: #E50914;       /* Energetic Red */
    --primary-dark: #B40710;
    --primary-glow: rgba(229, 9, 20, 0.4);

    --bg-main: #141414;       /* Near Black */
    --bg-surface: #1F1F1F;    /* Dark Grey */
    --bg-surface-hover: #2C2C2C; /* Lighter Grey */

    --text-main: #FFFFFF;     /* White */
    --text-muted: #A0A0A0;    /* Light Grey */
    --text-dark: #141414;

    --border: #3A3A3A;
    --border-active: var(--primary);

    --danger: #E50914; /* Using primary red for danger */
    --success: #10B981;
    
    /* Spacing & Layout */
    --container-padding: 1.25rem;
    --radius-sm: 2px; /* Sharper corners */
    --radius-md: 6px;
    --radius-lg: 10px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 20px var(--primary-glow);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.4);

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Inter', sans-serif; /* Unified font */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.6;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
a:hover { color: var(--primary); }
ul { list-style: none; }
img, svg { display: block; max-width: 100%; }

/* =========================================
   TYPOGRAPHY
   ========================================= */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

h1 { font-size: 2.5rem; text-shadow: 0 0 20px rgba(255, 255, 255, 0.1); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* =========================================
   LAYOUT UTILITIES
   ========================================= */
.container {
    width: 100%;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
    margin-left: auto;
    margin-right: auto;
}

/* Mobile-first: container is fluid by default */
@media (min-width: 640px) { .container { max-width: 640px; } }
@media (min-width: 768px) { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1024px; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }

main.container {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 4rem;
}

/* =========================================
   BUTTONS (Modern & Sharp)
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

@media (min-width: 640px) {
    .btn { width: auto; }
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-main);
    border-color: var(--primary);
}

.btn-primary:active,
.btn-sm:active,
.btn-success:active {
    transform: none;
    box-shadow: none;
}

.btn-primary:hover {
    background-color: #ff1a28; /* Brighter red on hover */
    border-color: #ff1a28;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(229, 9, 20, 0.1);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}


/* =========================================
   NAVBAR (Dark & Sleek)
   ========================================= */
.navbar {
    background-color: rgba(20, 20, 20, 0.8);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.75rem 0;
    backdrop-filter: blur(12px);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.brand-logo {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 900;
    transform: skew(-10deg);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Mobile Nav Toggle */
.nav-toggle { display: none; }
.nav-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    padding: 5px;
}
.nav-toggle-label span {
    display: block;
    width: 28px;
    height: 3px;
    background-color: var(--text-main);
    transition: 0.3s;
}

/* Mobile Nav Links (Side Drawer) */
.nav-links {
    display: flex; /* Always flex, visibility toggled via transform */
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 250px;
    background-color: rgba(20, 20, 20, 0.98); /* High opacity background */
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--border);
    padding: 5rem 2rem 2rem; /* Top padding to clear toggle */
    gap: 1rem;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 99; /* Below toggle label */
    margin-top: 0;
    border-top: none;
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
}

.nav-toggle:checked ~ .nav-links {
    transform: translateX(0);
}

.nav-item {
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.5rem 0;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}
.nav-item:hover { color: var(--primary); text-shadow: 0 0 8px var(--primary-glow); }

.nav-btn { width: 100%; margin-top: 0.5rem; }

@media (min-width: 768px) {
    .nav-toggle-label { display: none; }
    .nav-links {
        display: flex !important;
        width: auto;
        flex-direction: row;
        align-items: center;
        gap: 2rem;
        padding: 0;
        margin: 0;
        border: none;
        
        /* Reset mobile fixed positioning */
        position: static;
        height: auto;
        background-color: transparent;
        backdrop-filter: none;
        transform: none;
        box-shadow: none;
    }
    .nav-btn { width: auto; margin-top: 0; }
}

/* =========================================
   HOME / LANDING (Simplified Hero)
   ========================================= */
.hero-section {
    padding: 4rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Hero Title & Glitch Effect */
.hero-title {
    font-size: 3.2rem; /* Slightly bigger for mobile */
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.75rem; /* Adjusted spacing */
    position: relative;
    display: inline-block;
    color: var(--text-main);
    text-shadow: 0 0 20px var(--primary); /* Red Glow */
}

@media (min-width: 640px) {
    .hero-title { font-size: 6rem; } /* Much bigger for desktop */
}

/* Glitch Layers */
.hero-title::before,
.hero-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
    overflow: hidden;
}

.hero-title::before {
    left: 2px;
    text-shadow: -2px 0 #00ffff; /* Cyan Shift */
    clip-path: inset(20% 0 30% 0);
    animation: glitch-anim-1 3s infinite linear alternate-reverse;
}

.hero-title::after {
    left: -2px;
    text-shadow: -2px 0 var(--primary); /* Red Shift */
    clip-path: inset(40% 0 40% 0);
    animation: glitch-anim-2 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip-path: inset(20% 0 80% 0); }
    20% { clip-path: inset(60% 0 10% 0); }
    40% { clip-path: inset(40% 0 50% 0); }
    60% { clip-path: inset(80% 0 5% 0); }
    80% { clip-path: inset(10% 0 70% 0); }
    100% { clip-path: inset(30% 0 20% 0); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(10% 0 60% 0); }
    20% { clip-path: inset(30% 0 10% 0); }
    40% { clip-path: inset(80% 0 5% 0); }
    60% { clip-path: inset(40% 0 40% 0); }
    80% { clip-path: inset(70% 0 10% 0); }
    100% { clip-path: inset(20% 0 50% 0); }
}

.hero-tag {
    display: inline-block;
    background: rgba(229, 9, 20, 0.1);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--primary);
    border-radius: 4px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    letter-spacing: 0.1em;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Feature Grid */
.features-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 4rem;
}

@media (min-width: 640px) {
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-section { padding: 6rem 0; }
}
@media (min-width: 1024px) {
    .features-grid { grid-template-columns: repeat(3, 1fr); }
}

.feature-card {
    background: var(--bg-surface);
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.feature-card:hover .feature-icon {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
    transition: 0.3s;
}

/* =========================================
   DASHBOARD & LISTS
   ========================================= */
.dashboard-head {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}
@media (min-width: 640px) {
    .dashboard-head { flex-direction: row; justify-content: space-between; align-items: flex-end; }
}

.tourney-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tourney-item {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--border);
    transition: 0.2s;
}
.tourney-item:hover {
    border-color: var(--primary);
    background: var(--bg-surface-hover);
}

.t-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.t-title { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--text-main); }
.t-meta { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.25rem; }

.t-status {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}
.t-status.in_progress { background: rgba(255, 165, 0, 0.2); color: #ffa500; border: 1px solid #ffa500; }
.t-status.completed { background: rgba(16, 185, 129, 0.2); color: #10b981; border: 1px solid #10b981; }

.t-actions { display: flex; gap: 0.5rem; margin-top: auto; }

@media (min-width: 768px) {
    .tourney-item { flex-direction: row; align-items: center; justify-content: space-between; }
    .t-header { flex-direction: column; }
    .t-actions { margin-top: 0; }
}

/* =========================================
   FORMS
   ========================================= */
.card-form {
    background: var(--bg-surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    max-width: 480px;
    margin: 0 auto;
    box-shadow: var(--shadow-card);
}

.form-group { margin-bottom: 1.5rem; }
.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 1rem;
    transition: 0.2s;
    background: var(--bg-main);
    color: var(--text-main);
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-main);
    box-shadow: 0 0 10px var(--primary-glow);
}

.form-actions {
    display: flex;
    flex-direction: column; /* Stack buttons on mobile */
    gap: 1rem;
    margin-top: 2rem; /* Add some space above the buttons */
}

@media (min-width: 640px) {
    .form-actions {
        flex-direction: row; /* Align buttons side-by-side on larger screens */
        justify-content: flex-end; /* Push buttons to the right */
        gap: 1rem;
    }
    
    .form-actions .btn {
        width: auto; /* Buttons take natural width on larger screens */
    }
}

/* =========================================
   FOOTER (Updated)
   ========================================= */
.footer {
    background: var(--bg-surface);
    padding: 3rem 0 2rem;
    margin-top: auto;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-grid {
    display: grid;
    gap: 2rem;
    text-align: left;
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}

.footer-brand-logo {
    display: inline-block;
    margin-bottom: 1rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-main);
}

.footer-desc {
    max-width: 300px;
}

.footer-col h5 {
    color: var(--text-main);
    margin-bottom: 1rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-menu li {
    margin-bottom: 0.5rem;
}

.footer-menu a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-menu a:hover {
    color: var(--primary);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

@media (min-width: 768px) {
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* =========================================
   BRACKET STYLES (Global)
   ========================================= */
.bracket-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 3rem; /* Increased padding below header */
}
.bracket-header .actions {
    display: flex;
    gap: 0.75rem; /* Padding between buttons */
}
@media (min-width: 640px) {
    .bracket-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.bracket-wrapper, .bracket-container {
    display: flex;
    overflow-x: auto;
    padding: 2rem 0 4rem;
    gap: 4rem;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    min-width: 260px;
}

.round-title {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
    font-weight: 700;
}

.round-matches {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1;
    gap: 2rem;
}

/* Match Card */
.match-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    display: block;
    color: var(--text-main);
}

.match-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--primary-glow);
}

.match-id {
    font-size: 0.7rem;
    padding: 2px 6px;
    color: var(--text-muted);
    text-align: center; /* Centered */
    width: 100%; /* Take full width to center effectively */
    display: block; /* Ensure it takes full width */
    margin-bottom: 0.5rem; /* Add some space below ID */
}

.match-player {
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: background 0.2s;
}

.match-player.winner {
    background: rgba(229, 9, 20, 0.15); /* Red tint for winner */
    color: var(--primary);
    font-weight: 700;
}

.match-divider {
    display: none; /* Removed horizontal line */
}

.match-meta {
    text-align: center;
    padding: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Connectors (Desktop) */
@media (min-width: 769px) {
    .bracket-round { 
        position: relative;
        justify-content: space-around;
    }
    
    .match-card::after {
        content: '';
        position: absolute;
        right: -2rem;
        top: 50%;
        width: 2rem;
        height: 2px;
        background: var(--border);
        z-index: -1;
    }
    
    .bracket-round:last-child .match-card::after { display: none; }
}

/* Mobile */
@media (max-width: 768px) {
    .bracket-wrapper, .bracket-container {
        flex-direction: column;
        gap: 3rem;
        overflow-x: visible;
    }
    .bracket-round { min-width: 100%; }
}

@media (max-width: 768px) {
    /* Spacing in manage-header */
    .manage-header .breadcrumbs {
        margin-bottom: 1rem;
    }

    .manage-header h2 {
        margin-bottom: 1.5rem;
    }

    .share-bar {
        margin-top: 2rem;
    }

    /* Share bar internal spacing */
    .share-input-group {
        gap: 0.75rem;
    }

    /* Match card enhancements */
    .match-card {
        box-shadow: 0 6px 15px rgba(0,0,0,0.4);
    }
    
    .match-player {
        padding: 1rem 1.25rem;
        font-size: 1.05rem;
    }

    .match-player .name {
        font-size: 1.05rem;
    }

    .match-divider {
        margin: 0 1rem;
        height: 2px;
    }

    .p-btn {
        padding: 1.25rem;
        font-size: 1.1rem;
    }

    .modal-content {
        border-top-left-radius: var(--radius-lg);
        border-top-right-radius: var(--radius-lg);
    }

    .modal-header h3 {
        font-size: 1.5rem;
    }
}

/* =========================================
   TOURNAMENT MANAGE PAGE
   ========================================= */
.manage-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.manage-header .breadcrumbs a {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
}
.manage-header .breadcrumbs a:hover {
    color: var(--primary);
}
.manage-header h2 {
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}
.status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}
.status-badge.setup { background-color: rgba(251, 146, 60, 0.2); color: #fb923c; } /* orange */
.status-badge.in_progress { background-color: rgba(229, 9, 20, 0.2); color: var(--primary); } /* red */
.status-badge.completed { background-color: rgba(16, 185, 129, 0.2); color: var(--success); } /* green */

/* Mobile-first: single column */
.manage-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.panel {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

@media (min-width: 1024px) {
    .panel {
        padding: 2rem;
    }
}

/* Add Player Form */
.add-player-form {
    display: flex;
    flex-direction: column; /* Stack on mobile */
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.add-player-form .form-input {
    width: 100%;
}

.add-player-form .btn {
    width: 100%;
    justify-content: center;
}

@media (min-width: 640px) {
    .add-player-form {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .add-player-form .form-input {
        flex-grow: 1;
        width: auto;
        min-width: 0;
    }
    
    .add-player-form .btn {
        flex-shrink: 0;
        width: auto;
    }
}

/* Winner Display on Dashboard */
.winner-display {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.winner-text {
    color: #FFD700;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Improved Player Chips */
.player-chip {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.9rem;
    gap: 0.5rem;
    transition: all 0.2s;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.player-chip:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.player-chip .player-name {
    font-weight: 500;
}

.btn-icon-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: all 0.2s;
    margin-left: 4px;
}

.btn-icon-delete:hover {
    color: #fff;
    background-color: var(--danger);
}

.btn-icon-delete svg {
    width: 12px;
    height: 12px;
}


/* Actions Panel */
.actions-panel h3 {
    margin-bottom: 1.5rem;
}
.action-card {
    background-color: var(--bg-main);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}
.action-card > p {
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 1rem;
}
.btn-success {
    background-color: var(--success);
    color: white;
    border-color: var(--success);
}
.btn-success:hover {
    background-color: #14C48C;
}

.btn-disabled {
    background-color: #374151 !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
}
.btn-block {
    width: 100%;
}

/* Encounters Input (replaces inline styles) */
.form-input-sm {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: 0.2s;
}
.form-input-sm:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-main);
    box-shadow: 0 0 10px var(--primary-glow);
}





/* =========================================
   LEAGUE & LEADERBOARD STYLES
   ========================================= */
.league-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem; /* Increased padding between Leaderboard and Matches on mobile */
}
@media (min-width: 1024px) {
    .league-container {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
}

/* Table Styles Override/Addition */
.table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}
.table th, .table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

/* Mobile Table Optimizations */
@media (max-width: 640px) {
    .table th, .table td {
        padding: 0.75rem 0.5rem; /* Reduced padding */
        font-size: 0.85rem; /* Smaller font */
    }
    
    /* Compact headers */
    .table th {
        letter-spacing: 0;
    }
    
    .table .player-name {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.table th {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    background-color: rgba(255,255,255,0.02);
    font-weight: 700;
}
.table td {
    color: var(--text-main);
}
.table .points {
    font-weight: 800;
    color: var(--primary);
}
.rank-1 .player-name {
    color: #ffd700; /* Gold */
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* Match List Row (League) */
.finalize-action {
    grid-column: 1 / -1;
}

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.match-card-row {
    display: flex;
    flex-direction: column; /* Mobile First: Stack */
    gap: 0.75rem; /* Reduced gap */
    background: var(--bg-surface);
    padding: 1rem; /* Reduced padding */
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid var(--border);
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
}

.match-card-row:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}
.match-card-row.completed {
    opacity: 0.8;
    background: var(--bg-surface); /* Keep consistent */
}

.match-info {
    display: flex;
    justify-content: center; /* Center match-id */
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.matchup {
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.matchup .vs {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin: 0;
}

.match-status {
    text-align: center;
}

.badge-success, .badge-pending {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}
.badge-pending {
    background: var(--primary); /* Red background */
    color: var(--text-main); /* White text */
    border: 1px solid var(--primary);
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Desktop Row Layout */
@media (min-width: 640px) {
    .match-card-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
    }
    
    .match-info {
        width: auto;
        flex-direction: column;
        border-bottom: none;
        padding-bottom: 0;
        gap: 0.25rem;
        align-items: flex-start;
        min-width: 120px;
    }
    
    .matchup {
        flex-direction: row;
        gap: 1rem;
        font-size: 1rem;
    }
    
    .match-status {
        min-width: 120px;
        text-align: right;
    }
}

/*
* Added by Agent.
* CSS for controlling the visibility and positioning of mobile and desktop notification bells.
*/
.desktop-only-bell-icon {
    display: none; /* Hidden by default (mobile first) */
}

.mobile-only-bell-icon {
    display: none; /* Hidden by default on desktop */
}

@media (max-width: 767px) {
    .mobile-only-bell-icon {
        display: inline-flex; /* Display it on mobile */
        order: 2; /* Position it after brand, before toggle, in flex order */
        color: var(--text-muted); /* Match other nav items */
        align-items: center; /* Vertically align with hamburger */
        cursor: pointer;
    }
    .mobile-only-bell-icon:hover {
        color: var(--primary);
    }
    
    .nav-toggle-label {
        order: 3; /* Position it after the bell */
        z-index: 100; /* Ensure it's above the fixed menu */
        position: relative;
    }
    /* Ensure the brand is first */
    .navbar .brand {
        order: 1;
    }
}

@media (min-width: 768px) {
    .desktop-only-bell-icon {
        display: inline-flex; /* Display on desktop */
        color: var(--text-muted); /* Match other nav items */
        align-items: center; /* Vertical align */
        cursor: pointer;
        margin-right: -1rem; /* Adjust spacing with other nav items, since nav-links has 2rem gap */
    }
    .desktop-only-bell-icon:hover {
        color: var(--primary);
    }

    .mobile-only-bell-icon {
        display: none; /* Hide mobile bell on desktop */
    }
}

/*
* Added by Agent.
* CSS for Navbar User Dropdown & Responsive Links
*/
.mobile-nav-link {
    display: block;
}

.desktop-dropdown {
    display: none; /* Hidden on mobile */
    position: relative;
    cursor: pointer;
    height: 100%;
    align-items: center;
    margin-left: 0.5rem; /* Spacing */
}

.user-name-glow {
    color: #FFD700; /* Gold */
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    padding: 0.5rem 0;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%; /* Below the parent */
    right: 0;
    background-color: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    min-width: 180px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    z-index: 1000;
    padding: 0.5rem 0;
    margin-top: 0; /* Attached to bottom */
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-link {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-muted);
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.dropdown-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary);
    padding-left: 1.5rem; /* Slide effect */
}

/* Show dropdown on hover */
.desktop-dropdown:hover .dropdown-menu {
    display: block;
}

.nav-divider {
    display: none;
}

@media (min-width: 768px) {
    .mobile-nav-link {
        display: none !important; /* Force hide on desktop */
    }
    
    .desktop-dropdown {
        display: flex; /* Visible on desktop */
    }

    .nav-divider {
        display: block;
        width: 1px;
        height: 24px;
        background-color: var(--border);
        margin: 0 0.5rem;
        opacity: 0.5;
    }
}