:root {
    /* Color Palette - Premium Light & Green */
    --bg-dark: #f8fafc;
    /* Slate 50 - Main Background */
    --bg-card: #ffffff;
    /* White - Card Background */
    --bg-sidebar: #ffffff;
    /* White - Sidebar */

    --primary: #059669;
    /* Emerald 600 - Main Green */
    --primary-glow: rgba(5, 150, 105, 0.3);
    --secondary: #64748b;
    /* Slate 500 - Secondary Text/Icons */
    --accent: #0ea5e9;
    /* Sky 500 */

    --text-main: #0f172a;
    /* Slate 900 - Main Text */
    --text-muted: #64748b;
    /* Slate 500 - Muted Text */

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Glassmorphism / Shadows */
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: 1px solid rgba(226, 232, 240, 0.8);
    /* Slate 200 */
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);

    /* Dimensions */
    --sidebar-width: 260px;
    --border-radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    /* Prevent body scroll, use inner scroll */
    height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
    /* Subtle Green Gradient */
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: relative;
    z-index: 10;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    font-family: 'Outfit', sans-serif;
}

.brand-icon {
    font-size: 1.75rem;
    color: var(--primary);
    /* filter: drop-shadow(0 4px 6px var(--primary-glow)); */
    /* Cleaner look without glow */
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #1e293b;
}

.highlight {
    color: var(--primary);
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-section {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    margin: 1.5rem 0 0.75rem 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    font-weight: 600;
}

.nav-item:hover {
    background-color: #f1f5f9;
    /* Slate 100 */
    color: var(--text-main);
}

.nav-item.active {
    background-color: #ecfdf5;
    /* Emerald 50 */
    color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: var(--glass-border);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #34d399);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    border-bottom: var(--glass-border);
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

.top-bar h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.75rem;
    color: #1e293b;
    width: 40%;
    flex-shrink: 0;
}

.actions {
    display: flex;
    gap: 1rem;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
    padding-bottom: 6rem;
    /* Extra padding for bottom nav on mobile */
}

/* Component: Buttons */
.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
    background-color: #047857;
    /* Emerald 700 */
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-main);
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.btn-danger {
    background-color: #fee2e2;
    color: var(--danger);
    border: 1px solid #fecaca;
    box-shadow: none;
}

.btn-danger:hover {
    background-color: #fecaca;
}

/* Card Styling */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 2rem;
    border: var(--glass-border);
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-title i {
    color: var(--primary);
}

.team-detail-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

.team-identity-card {
    padding: 2rem;
}

.team-stats-row {
    display: flex;
    justify-content: space-around;
    font-family: 'Outfit', sans-serif;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

/* Utility: Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.stats-page-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.stats-sub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid #f1f5f9;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}


.stat-card:hover {
    transform: translateY(-4px);
}

.stat-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: #1e293b;
    margin-bottom: 0;
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue {
    background: #e0f2fe;
    color: #0284c7;
}

.stat-icon.green {
    background: #d1fae5;
    color: #059669;
}

.stat-icon.purple {
    background: #f3e8ff;
    color: #7c3aed;
}

/* Table Styling */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th {
    text-align: center;
    padding: 0.85rem 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

td {
    text-align: center;
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    font-weight: 500;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

/* Player Position Badges */
.badge-pos {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 800;
    border-radius: 20px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.pos-rusher {
    background-color: #000000;
    color: #ef4444;
}

.pos-support {
    background-color: #fce300;
    color: #000000;
}

.pos-back {
    background-color: #3b82f6;
    color: #ffffff;
}

.pos-flex {
    background-color: #10b981;
    color: #ffffff;
}

.pos-center {
    background-color: #6366f1;
    color: #ffffff;
}

.pos-anchor {
    background-color: #475569;
    color: #ffffff;
}

.pos-suplente {
    background-color: #e2e8f0;
    color: #475569;
}

/* Sticky Equipo column in standings */
.standings-table th:nth-child(2),
.standings-table td:nth-child(2) {
    position: sticky;
    left: 0;
    z-index: 5;
    background-color: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.08);
    /* Sombra útil para indicar superposición */
}

.standings-table th:nth-child(2) {
    background-color: #f8fafc;
    /* Coincidir con el fondo de los headers */
    z-index: 30;
}

/* Bonus Points Display - Scoreboard Ribete */
.bonus-ribete {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #fbbf24;
    color: #000;
    font-size: 0.75rem;
    font-weight: 950;
    padding: 2px 10px;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    z-index: 20;
    border: 2px solid #fff;
}

.live-ambient-logo {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 400px;
    height: 400px;
    opacity: 0.08;
    /* Subtle watermark effect */
    pointer-events: none;
    z-index: 0;
    filter: saturate(0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.live-ambient-logo.left {
    left: -50px;
    transform: translateY(-50%) rotate(-10deg);
}

.live-ambient-logo.right {
    right: -50px;
    transform: translateY(-50%) rotate(10deg);
}

.live-ambient-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Team Logo in Team List */
.team-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.team-cell:hover {
    transform: scale(1.02);
}

.team-logo-small {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    padding: 2px;
}

/* Team Navigation Bar Items */
.team-nav-item {
    transition: all 0.2s ease;
    opacity: 0.6;
}

.team-nav-item img {
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.team-nav-item:hover,
.team-nav-item.active {
    opacity: 1;
}

.team-nav-item:hover img,
.team-nav-item.active img {
    transform: scale(1.1);
}

/* Team Navigation Bar Container */
.team-nav-bar {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    align-items: center;
    justify-content: space-around;
    padding: 0.5rem 1rem;

    /* Flush with container edges */
    margin-top: -2.5rem;
    margin-left: -2.5rem;
    margin-right: -2.5rem;
    margin-bottom: 2rem;

    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: var(--glass-border);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);

    /* Sticky Header Effect */
    position: sticky;
    top: -2.5rem;
    z-index: 50;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.team-nav-bar::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar for clean look */
}

/* Form Styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
}

.form-input {
    width: 100%;
    padding: 0.85rem 1rem;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Material Design Outlined Floating Labels */
.form-floating {
    position: relative;
    margin-bottom: 0.5rem;
}

.form-floating .form-input {
    height: 50px;
    padding: 1rem 0.75rem 0.25rem 0.75rem;
}

.form-floating label {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    transform: translateY(-50%);
    font-size: 0.95rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: all 0.2s ease;
    background-color: transparent;
    padding: 0 4px;
    z-index: 1;
}

.form-floating .form-input:focus~label,
.form-floating .form-input:not(:placeholder-shown)~label {
    top: 0;
    left: 0.6rem;
    transform: translateY(-50%) scale(0.85);
    background-color: white;
    color: var(--primary);
    font-weight: 700;
}

.form-floating .form-input::placeholder {
    color: transparent;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    /* Slate 900 with opacity */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: white;
    width: 95%;
    max-width: 900px;
    border-radius: 20px;
    border: none;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 95vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: #0f172a;
}

.close-modal {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #64748b;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2.5rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}


/* Score Inputs */
.score-input {
    width: 80px !important;
    height: 60px;
    font-size: 2rem !important;
    text-align: center;
    font-weight: 800;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
}

.score-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    outline: none;
    background: white;
}

/* Remove Arrows from Number Input */
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.score-input {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Mobile Components - Hidden by default */
.mobile-bottom-bar {
    display: none;
}

.mobile-overlay {
    display: none;
}

.hide-on-mobile {
    display: inline-flex;
}

/* Default state */

/* =========================================================================
   MOBILE OPTIMIZATIONS (Media Queries)
   ========================================================================= */
@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }

    /* Layout adjustments */
    .app-container {
        flex-direction: column;
    }

    /* New Mobile Bottom Navigation */
    .mobile-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
        z-index: 2000;
        justify-content: space-between;
        align-items: center;
        padding: 0 1.5rem;
        border-top: var(--glass-border);
    }

    .mobile-menu-btn {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-main);
        cursor: pointer;
        padding: 0.5rem;
    }

    .mobile-overlay {
        display: none;
    }

    .mobile-overlay.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1050;
        backdrop-filter: blur(2px);
    }

    .sidebar {
        /* Redesign to be an off-canvas menu Sliding up from bottom */
        position: fixed;
        bottom: 60px;
        left: 0;
        width: 100%;
        height: auto;
        max-height: calc(100vh - 60px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        background: #ffffff;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
        z-index: 1999;
        padding: 1.5rem 1.5rem;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        border-right: none;
        overflow-y: auto;

        transform: translateY(100vh);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.open {
        transform: translateY(0);
    }

    .sidebar .brand {
        display: none;
    }

    .sidebar .nav-section {
        display: flex;
    }

    .sidebar .user-profile {
        display: flex;
    }

    .sidebar .user-profile:not(:has(.avatar)) {
        display: none !important;
        border: none;
    }

    .sidebar .nav-section {
        margin-top: 1rem;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
        gap: 0.5rem;
    }

    .nav-item {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        text-align: left;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        gap: 1rem;
        border-radius: 12px;
    }

    .nav-item i {
        font-size: 1.15rem;
        width: 25px;
        text-align: center;
        margin-bottom: 0;
    }

    /* Main Content Area */
    .main-content {
        position: relative;
    }

    /* Fade-out effect at the bottom */
    .main-content::after {
        content: '';
        position: fixed;
        bottom: 60px;
        /* Just above the mobile bottom bar */
        left: 0;
        width: 100%;
        height: 25px;
        background: linear-gradient(to top, rgba(248, 250, 252, 1) 0%, rgba(248, 250, 252, 0) 100%);
        pointer-events: none;
        z-index: 99;
        /* Below the overlay but above content */
    }

    .top-bar {
        padding: 0 1rem;
        min-height: 60px;
        flex-wrap: wrap;
        /* Allow wrapping if needed */
        justify-content: center;
        align-items: center;
        /* Center content on mobile */
        gap: 0.5rem;
    }

    .top-bar h2 {
        font-size: 1.25rem;
        width: 100%;
        text-align: center;
        margin: 0 !important;
    }

    #header-dynamic-content {
        display: none !important;
        /* Hide dynamic header stats on mobile to save space */
    }

    .top-bar .actions {
        width: 100%;
        display: none !important;
    }

    .top-bar .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .content-area {
        padding: 0.75rem 0.5rem;
        padding-bottom: 4rem;
    }

    /* Cards & Grids */
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Tables */
    .table-container {
        border-radius: 8px;
    }

    th,
    td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Specific overrides for tables to prevent breaking */
    table {
        min-width: 100%;
    }

    /* Modals */
    .modal {
        width: 95%;
        padding: 1.5rem;
        max-height: 80vh;
        margin-bottom: 4rem;
        /* Evitar la ocultación bajo mobile-bottom-bar */
        overflow-y: auto;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stats-page-grid,
    .stats-sub-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Force stats tables to fit mobile screen instead of forcing scrolling */
    .stats-page-grid table,
    .stats-sub-grid table {
        min-width: 100% !important;
    }

    /* Team detail view fixes */
    .team-detail-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .team-detail-grid .card {
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .team-nav-bar {
        padding: 0.5rem !important;
        gap: 0.5rem !important;
        justify-content: flex-start !important;
        margin-top: -0.75rem !important;
        margin-left: -0.5rem !important;
        margin-right: -0.5rem !important;
        top: -0.75rem !important;
        border-radius: 0 !important;
    }

    .team-identity-card {
        padding: 1.5rem 1rem !important;
        width: 100%;
        box-sizing: border-box;
    }

    .team-identity-card img {
        width: 120px !important;
        height: 120px !important;
    }

    .team-stats-row {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 0.25rem;
    }

    .team-stats-row .team-stat-item {
        flex: 1;
        min-width: 0;
    }

    .team-stats-row .stat-val {
        font-size: 1.15rem !important;
    }

    .team-stats-row .stat-lbl {
        font-size: 0.55rem !important;
        font-weight: 700;
        letter-spacing: -0.5px;
    }

    /* Force roster table to fit screen instead of scrolling */
    .roster-table-container {
        overflow-x: hidden !important;
        width: 100%;
    }

    .roster-table-container table {
        min-width: 100% !important;
        width: 100% !important;
    }

    /* Decrease table padding on sides to let it naturally fit 390px width */
    .table-container th,
    .table-container td {
        padding: 0.5rem 0.35rem !important;
        font-size: 0.75rem;
    }

    /* Toggle icons vs text on mobile tables */
    .roster-table-container .desktop-text {
        display: none !important;
    }

    .roster-table-container .mobile-icon {
        display: inline-block !important;
        font-size: 1.1rem;
    }

    #team-content-area>div {
        grid-template-columns: 1fr !important;
    }

    /* Match manager (Admin) fixes */
    #match-details-container {
        grid-template-columns: 1fr !important;
    }

    [id^="match-manager-"]>div {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* Racing Style Player Number */
.racing-number {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    font-style: italic;
    color: white;
    text-shadow:
        -1.5px -1.5px 0 var(--primary),
        1.5px -1.5px 0 var(--primary),
        -1.5px 1.5px 0 var(--primary),
        1.5px 1.5px 0 var(--primary),
        -1.5px 0 0 var(--primary),
        1.5px 0 0 var(--primary),
        0 -1.5px 0 var(--primary),
        0 1.5px 0 var(--primary),
        3px 3px 0px rgba(0, 0, 0, 0.2);
    line-height: 1;
    min-width: 38px;
    text-align: right;
    letter-spacing: -1px;
    padding-right: 10px;
}

/* Animations */
@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-80px);
    }

    60% {
        opacity: 1;
        transform: translateX(15px);
    }

    80% {
        transform: translateX(-5px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(80px);
    }

    60% {
        opacity: 1;
        transform: translateX(-15px);
    }

    80% {
        transform: translateX(5px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }

    60% {
        opacity: 1;
        transform: translateY(-10px);
    }

    80% {
        transform: translateY(5px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Live Match View Refined (Light/Outdoor Theme) --- */
.live-match-container {
    width: calc(100% + 5rem);
    /* Negate total horizontal padding */
    height: calc(100vh - 80px);
    /* Fill remaining vertical space */
    margin-left: -2.5rem;
    margin-right: -2.5rem;
    margin-top: -2.5rem;
    margin-bottom: -6rem;
    /* Negate bottom padding */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #f1f5f9;
    /* Clear background */
    overflow: hidden;
    position: relative;
    padding: 0;
    /* Remove internal padding */
}

.live-field-perspective {
    width: 100%;
    height: 100%;
    perspective: 1500px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
    border-radius: 40px;
    /* Stadium curve */
    overflow: hidden;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.05);
}

.live-field {
    width: 95vw;
    max-width: 1200px;
    height: 75vh;
    /* Combined Grass Gradient and Grid */
    background:
        linear-gradient(rgba(255, 255, 255, 0.2) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.2) 2px, transparent 2px),
        linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    background-size: 5% 7.14%, 5% 7.14%, 100% 100%;
    border: 10px solid #fff;
    border-radius: 30px;
    position: relative;
    transform: rotateX(30deg);
    /* Slightly less tilt for larger campo */
    transform-origin: center;
    transform-style: preserve-3d;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.2);
    /* overflow removed to preserve 3D children */
}

.field-surface {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.2) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.2) 2px, transparent 2px),
        linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    background-size: 5.26% 7.14%, 5.26% 7.14%, 100% 100%;
    border: 10px solid #fff;
    border-radius: 30px;
    overflow: hidden;
    /* Clips the base arcs perfectly */
    z-index: 0;
    transform: translateZ(0);
}

.field-players {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
    transform-style: preserve-3d;
}

/* Field Markings - Low Z-index to stay under players */
.field-line-center-h {
    position: absolute;
    left: 50%;
    top: 0;
    width: 3px;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    z-index: 1;
    transform: translateZ(1px);
    /* Keep low but visible */
}

.field-center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 15vh;
    height: 15vh;
    border: 3px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    z-index: 1;
}

.field-base-left,
.field-base-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) translateZ(1px);
    width: 30px;
    /* Narrower for elegant hockey-style area */
    height: 55%;
    /* Vertical span */
    z-index: 1;
    opacity: 0.9;
    /* More solid "painted" look */
}

.field-base-left {
    left: 0;
    border-radius: 0 100px 100px 0 / 0 50% 50% 0;
    /* Half-ellipse curve */
}

.field-base-right {
    right: 0;
    border-radius: 100px 0 0 100px / 50% 0 0 50%;
    /* Half-ellipse curve */
}

/* Overlays */
.live-overlay-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    /* UI always on top */
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.live-overlay-scoreboard {
    position: absolute;
    top: 4rem;
    /* Increased from 1.5rem to avoid overlapping players */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.75rem 2rem;
    border-radius: 50px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
}

.live-score-num {
    font-size: 3rem;
    font-weight: 900;
    font-family: 'Outfit';
    color: #1e293b;
    min-width: 1.2ch;
    text-align: center;
}

.live-team-name-score {
    font-family: 'Outfit';
    font-weight: 800;
    font-size: 1.1rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.live-team-shield {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: white;
    padding: 4px;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.live-team-shield img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Player Markers - Billboard Effect */
.live-player-marker {
    position: absolute;
    /* Counter-rotate exactly to stay vertical against the terrain */
    transform: translate(-50%, -100%) translateZ(80px) rotateX(-35deg);
    transform-style: preserve-3d;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.17, 0.67, 0.83, 0.67);
    z-index: 100;
    /* Above field lines */
    pointer-events: auto;
}

/* Removed hover scaling to prevent overlapping cards */
.live-player-marker:hover {
    z-index: 200;
}

.live-player-identity {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.live-player-avatar-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    background: #fff;
    border-radius: 15px;
    padding: 4px;
    border: 4px solid #fff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.team-logo-small {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
    background: white;
    padding: 2px;
    border: 1px solid #e2e8f0;
}

.live-player-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 11px;
    display: block;
}

.live-player-dorsal {
    position: absolute;
    bottom: -10px;
    right: -15px;
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 950;
    font-style: italic;
    color: var(--team-color, #fff);
    /* Team primary for fill */
    text-shadow:
        -2px -2px 0 var(--team-secondary, #000),
        2px -2px 0 var(--team-secondary, #000),
        -2px 2px 0 var(--team-secondary, #000),
        2px 2px 0 var(--team-secondary, #000),
        -2px 0 0 var(--team-secondary, #000),
        2px 0 0 var(--team-secondary, #000),
        0 -2px 0 var(--team-secondary, #000),
        0 2px 0 var(--team-secondary, #000),
        4px 4px 0px rgba(0, 0, 0, 0.3);
    line-height: 1;
    z-index: 20;
}

.live-player-nick {
    margin-top: 12px;
    font-size: 1rem;
    /* Larger Nick */
    font-weight: 900;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.95);
    padding: 4px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    text-transform: uppercase;
}

.live-player-points-tag {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #fbbf24;
    color: #000;
    font-size: 0.8rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 100px;
    border: 3px solid #fff;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    z-index: 30;
}