/* NXGEN FC - CINEMATIC ESPORTS THEME V3 */
:root {
    --bg-dark: #0B0F1A;
    --bg-card: #151B2B;
    --gold: #D4AF37;
    --red: #E50914;
    --white: #ffffff;
    --text-muted: #A0AEC0;
    --ucl-blue: #001C55;
    --haitian-blue: #003da5;
    --haitian-red: #d21034;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-dark);
    color: var(--white);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1 { font-size: clamp(2rem, 8vw, 4rem); }
h2 { font-size: clamp(1.5rem, 6vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 4vw, 1.8rem); }

h1, h2, h3, h4, h5, h6, .cinzel {
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--gold);
}

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

/* Navbar overhaul */
.navbar {
    background: rgba(11, 15, 26, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    border-bottom: 2px solid var(--gold);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-links a {
    text-decoration: none;
    color: var(--white);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    padding: 10px 15px;
    letter-spacing: 1px;
}

.nav-links a:hover {
    color: var(--gold);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* Navigation layout: horizontal on desktop, hamburger menu on smaller screens */
.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li {
    list-style: none;
    position: relative;
}

.navbar .nav-links a {
    display: inline-block;
    padding: 8px 9px;
    font-size: 0.78rem;
}

.navbar .nav-links a.btn-primary {
    padding: 10px 18px;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 26px;
    height: 3px;
    border-radius: 2px;
}

@media screen and (max-width: 1280px) {
    .hamburger { display: flex; }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        padding: 10px 20px 20px;
        max-height: 80vh;
        overflow-y: auto;
        background: #0B0F1A;
        border-bottom: 2px solid var(--gold);
    }

    .nav-links.active { display: flex; }

    .navbar .nav-links a { display: block; padding: 12px 8px; font-size: 0.9rem; }
    .navbar .nav-links a.btn-primary { text-align: center; margin: 8px 0 0; }
    .lang-selector .dropdown-content { position: static !important; margin-top: 8px; }
    /* Phone menu: two columns, so every link fits on the screen without a long scroll. */
    .nav-links.active { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; max-height: 85vh; }
    .nav-links.active > li { min-width: 0; }
    .nav-links.active > li.lang-selector, .nav-links.active > li.nav-wide { grid-column: 1 / -1; margin-left: 0 !important; }
    .navbar .nav-links.active a { padding: 10px 6px; font-size: 0.82rem; border-bottom: 1px solid rgba(255,255,255,0.06); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, #B8860B 100%);
    color: #000 !important;
    padding: 14px 35px;
    min-height: 44px;
    border-radius: 0;
    font-weight: 900;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    transform: skew(-5deg) scale(1.05);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
}

/* Hero Section */
.hero-video-container {
    position: relative;
    height: 90vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#hero-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    transform: translate(-50%, -50%);
    z-index: -1;
}

.hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(11, 15, 26, 0.4) 0%, rgba(11, 15, 26, 0.9) 100%);
    z-index: 0;
}

/* Auth / Application Forms */
.auth-card {
    background: var(--bg-card);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 8px;
    padding: 40px;
    max-width: 450px;
    margin: 40px auto;
    color: var(--white);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label,
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    font-family: inherit;
    font-size: 1rem;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--gold);
}

select option {
    background: var(--bg-card);
    color: var(--white);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, #B8860B 100%);
    color: #000;
    padding: 12px 28px;
    border-radius: 6px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-gold:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Alerts / Flash Messages */
.alert {
    padding: 16px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    font-weight: 500;
    line-height: 1.5;
}

.alert p {
    margin: 0;
}

.alert p + p {
    margin-top: 8px;
}

.alert-success {
    background: rgba(46, 204, 113, 0.12);
    border-color: rgba(46, 204, 113, 0.4);
    color: #2ecc71;
}

.alert-danger,
.alert-error {
    background: rgba(210, 16, 52, 0.12);
    border-color: rgba(210, 16, 52, 0.4);
    color: #ff6b81;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 4px;
    padding: 25px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.card:hover {
    border-color: var(--gold);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.soccer-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--gold);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-around;
    background: var(--bg-card);
    padding: 30px;
    border-top: 1px solid var(--gold);
    border-bottom: 1px solid var(--gold);
    margin: 40px 0;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 900;
    color: var(--gold);
    display: block;
    line-height: 1;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 2px;
}

/* Match Card (Massive) */
.match-card-large {
    background: radial-gradient(circle at 50% 0%, rgba(212,175,55,0.18), rgba(11,15,26,0.92) 70%), #0B0F1A;
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    padding: 60px 40px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border: 1px solid var(--gold);
    margin-bottom: 50px;
}

.match-team {
    text-align: center;
    flex: 1;
}

.match-team img {
    width: 120px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
}

.match-score {
    font-size: clamp(2.5rem, 10vw, 5rem);
    font-weight: 900;
    font-family: 'Cinzel', serif;
    color: var(--white);
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    margin: 0 30px;
}

/* FUT Card */
.fut-card-front {
    background: linear-gradient(135deg, #0B0F1A 0%, #1c2538 100%) !important;
    border: 2px solid var(--gold) !important;
}

.fut-card-badge {
    color: var(--gold) !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.8s ease forwards; }

/* Mobile Menu */
.hamburger span {
    background: var(--gold) !important;
}

@media screen and (max-width: 768px) {
    .match-card-large {
        flex-direction: column;
        gap: 30px;
    }
    .match-score { font-size: clamp(2rem, 8vw, 3rem); }
    .nav-links {
        background: var(--bg-dark) !important;
    }

    /* Vertical Pitch Mobile Optimization */
    .pitch-canvas.vertical-pitch {
        height: 1000px;
        background: linear-gradient(to bottom, #1a3c1a 0%, #112211 100%);
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        align-items: center;
    }

    .pitch-canvas.vertical-pitch .pitch-player-card {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: translate3d(0,0,0) scale(0.9);
        margin: 10px 0;
    }

    .pitch-lines, .chemistry-lines-svg { display: none; } /* Hide lines on mobile vertical stack for clarity */
}

/* Glass Tile */
.glass-tile {
    backdrop-filter: blur(10px);
    background: rgba(11, 15, 26, 0.8);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
    padding: 20px;
}

/* Stat Pill */
.stat-pill {
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* OVR Badge */
.ovr-badge {
    background: linear-gradient(135deg, var(--gold) 0%, #B8860B 100%);
    color: #000;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    font-weight: 900;
    border: 2px solid #fff;
}

.ovr-badge span {
    font-size: 1.5rem;
    line-height: 1;
}

.ovr-badge small {
    font-size: 0.6rem;
    text-transform: uppercase;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.quick-action-card {
    text-align: center;
    padding: 40px 20px;
    transition: 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.quick-action-card i {
    font-size: 3rem;
    color: var(--gold);
    margin-bottom: 20px;
}

.quick-action-card:hover {
    background: rgba(212, 175, 55, 0.1);
    transform: translateY(-10px);
}

/* Sticky Performance Bar */
.performance-bar {
    background: rgba(11, 15, 26, 0.9);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 999;
    font-size: 0.85rem;
    color: var(--gold);
}

.performance-bar .container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.performance-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.performance-stat i {
    opacity: 0.7;
}

/* Table Enhancements */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.modern-table tr {
    background: rgba(255, 255, 255, 0.03);
    transition: 0.3s;
}

.modern-table tr:hover {
    background: rgba(255, 255, 255, 0.07);
}

.modern-table th {
    padding: 15px;
    text-align: left;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.modern-table td {
    padding: 15px;
}

.modern-table td:first-child {
    border-radius: 8px 0 0 8px;
}

/* Smart App Banner - Cinematic Refinement */
#pwa-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to right, var(--bg-dark), var(--bg-card));
    border-top: 3px solid var(--gold);
    padding: 20px;
    display: none;
    z-index: 10000;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.8);
    backdrop-filter: blur(15px);
}

#pwa-banner .banner-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

#pwa-banner img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    border: 1px solid var(--gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

#pwa-banner .banner-text h4 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--gold);
    font-family: 'Cinzel', serif;
}

#pwa-banner .banner-text p {
    margin: 5px 0 0;
    font-size: 0.9rem;
    color: var(--white);
    opacity: 0.8;
}

#pwa-banner .btn-primary {
    padding: 10px 25px;
    font-size: 0.8rem;
}

/* Dropdown visibility */
.show {
    display: block !important;
}

/* Floating Music Button */
.music-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: var(--gold);
    color: #000;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s;
}

.music-fab:hover {
    transform: scale(1.1);
}

@media screen and (max-width: 768px) {
    .music-fab {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
}

/* Animations */
@keyframes pulse-gold {
    0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(212, 175, 55, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(210, 16, 52, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(210, 16, 52, 0); }
    100% { box-shadow: 0 0 0 0 rgba(210, 16, 52, 0); }
}

.pulse-gold {
    animation: pulse-gold 2s infinite;
}

.pulse-red {
    animation: pulse-red 2s infinite;
}

/* --- Phase 22: Gaming System Overhaul --- */

/* FIFA-style Pitch Layout */
.pitch-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 1200px;
    background: radial-gradient(circle, #2e7d32 0%, #1b5e20 100%);
    margin: 40px auto;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

/* Pitch markings */
.pitch-lines {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
}

.pitch-line { border: 2px solid rgba(255, 255, 255, 0.3); position: absolute; }
.pitch-center-circle {
    width: 200px; height: 200px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.pitch-center-line { width: 100%; top: 50%; border-bottom: 2px solid rgba(255, 255, 255, 0.3); }

/* Refined FUT Card */
.fut-card {
    width: 160px;
    height: 230px;
    background: linear-gradient(135deg, #0B0F1A 0%, #1c2538 100%);
    border: 2px solid var(--gold);
    border-radius: 8px;
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translate3d(0, 0, 0);
    cursor: grab;
    z-index: 10;
    will-change: transform;
}

.fut-card:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.fut-card .player-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 5px;
}

.fut-card .player-name {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--gold);
    text-align: center;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.fut-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    width: 100%;
    font-size: 0.6rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 5px;
    background: rgba(255,255,255,0.05);
}

.stat-val { font-weight: 900; color: var(--white); }
.stat-lbl { color: var(--text-muted); text-transform: uppercase; }

/* Chemistry Lines */
.chemistry-lines-svg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 5;
    pointer-events: none;
}

.chemistry-line {
    stroke-width: 4;
    stroke-linecap: round;
    fill: none;
    transition: 0.5s stroke;
}

.chem-green { stroke: #4caf50; stroke-dasharray: 10; animation: chemDash 20s linear infinite; }
.chem-yellow { stroke: #ffeb3b; }
.chem-red { stroke: #f44336; }

@keyframes chemDash {
    to { stroke-dashoffset: -1000; }
}

/* Roster FUT Upgrades */
.roster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
    padding: 40px 0;
}

.mvp-glow {
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.8) !important;
    animation: pulse-gold 2s infinite;
}

/* FUT player cards (roster, Team of the Week, player page).
   The base .fut-card above is absolutely positioned for the drag-and-drop pitch, so inside a
   .fut-card-container it is switched back to normal flow and given its own layout. */
.fut-card-container {
    position: relative;
    display: block;
    width: 100%;
    max-width: 210px;
    margin: 0 auto;
}

.fut-card-container .fut-card {
    position: relative;
    width: 100%;
    height: 310px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
}

.fut-card-container .fut-card:hover {
    transform: translateY(-6px);
}

.fut-card-container .fut-card-front {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 10px 12px;
    box-sizing: border-box;
}

.fut-card-badge {
    position: absolute;
    top: 10px;
    left: 12px;
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
}

.fut-card-pos {
    position: absolute;
    top: 42px;
    left: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--white);
}

.fut-card-image {
    width: 120px;
    height: 120px;
    margin-top: 12px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--gold);
    background: #0B0F1A;
}

.fut-card-info {
    width: 100%;
    margin-top: auto;
}

.fut-card-name {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gold);
    text-align: center;
    margin: 10px 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fut-card-container .fut-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 4px;
    font-size: 0.65rem;
}

.stat-col {
    text-align: center;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-col span {
    display: block;
    color: var(--white);
    font-size: 1rem;
    font-weight: 900;
}

/* Back of the roster card: career totals, revealed on hover */
.fut-card-back {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 14px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #0B0F1A 0%, #1c2538 100%);
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.fut-card-container:hover .fut-card-back {
    opacity: 1;
}

.stat-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.stat-summary-row strong {
    color: var(--white);
}

.badge-role.manager {
    margin-top: 14px;
    padding: 3px 12px;
    border-radius: 4px;
    background: var(--gold);
    color: #000;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 1px;
}

/* Team of the Week: animated diagonal shine sweep, like FUT's special/TOTW cards */
.totw-card {
    position: relative;
    overflow: hidden;
}

.totw-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.55), transparent);
    animation: totw-shine-sweep 3.5s ease-in-out infinite;
    z-index: 5;
    pointer-events: none;
}

@keyframes totw-shine-sweep {
    0% { left: -75%; }
    45% { left: 130%; }
    100% { left: 130%; }
}

.totw-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--gold), #B8860B);
    color: #000;
    font-weight: 900;
    font-size: 0.65rem;
    letter-spacing: 1px;
    padding: 4px 14px;
    border-radius: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    z-index: 6;
    white-space: nowrap;
}

/* Global Stats Bar */
.global-stats-bar {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: #0B0F1A;
    border-bottom: 1px solid var(--gold);
}

.global-stat {
    text-align: center;
}

.global-stat-val {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--gold);
    font-family: 'Cinzel', serif;
}

.global-stat-lbl {
    font-size: 0.6rem;
    text-transform: uppercase;
    color: var(--text-muted);
}


/* =====================================================================
   Theme refresh V4: compact header, tighter page tops, colour accents.
   Gold stays the brand colour; green / blue / violet mark different kinds
   of information so pages are not one flat gold-on-black.
   ===================================================================== */
:root {
    --emerald: #22c98e;
    --sky: #3aa0ff;
    --violet: #9b7bff;
    --amber: #f5a524;
    --loss: #ff5a6e;
}

/* --- Header: less height, one line of links --- */
.marquee-container { padding: 5px 0 !important; font-size: 0.72rem !important; }
.navbar { padding: 8px 0; border-bottom-width: 1px; }
.navbar .logo { width: 68px !important; height: auto; }
.performance-bar { position: static; padding: 6px 0; font-size: 0.8rem; }
.performance-bar .container { gap: 22px; flex-wrap: wrap; }

/* --- Page tops: less empty space above the real content --- */
main.container { margin-top: 14px !important; min-height: 60vh !important; }
main.container > div[style*="margin-top: 40px"] { margin-top: 6px !important; }
main h1 { font-size: clamp(1.6rem, 3.2vw, 2.4rem) !important; letter-spacing: 2px; line-height: 1.2; }
.hero-content h1 { font-size: clamp(2rem, 8vw, 4rem) !important; }
.global-stats-bar { padding: 12px 20px; }

/* --- Cards & tiles: gradient body + a coloured top edge that cycles --- */
.card, .glass-tile {
    --accent: var(--gold);
    background: linear-gradient(160deg, #1a2238 0%, #111726 100%);
    box-shadow: inset 0 3px 0 var(--accent);
}
.card:nth-child(4n+2), .glass-tile:nth-child(4n+2) { --accent: var(--emerald); }
.card:nth-child(4n+3), .glass-tile:nth-child(4n+3) { --accent: var(--sky); }
.card:nth-child(4n+4), .glass-tile:nth-child(4n+4) { --accent: var(--violet); }
.card:hover, .glass-tile:hover {
    border-color: var(--accent);
    box-shadow: inset 0 3px 0 var(--accent), 0 10px 30px rgba(0, 0, 0, 0.5);
}
.card h3, .glass-tile h3 { color: var(--accent); }

/* --- Dashboard tiles: compact, each with its own colour --- */
.dashboard-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.quick-action-card { padding: 18px 14px; }
.quick-action-card i { font-size: 1.9rem; margin-bottom: 8px; color: var(--accent); }
.quick-action-card h3 { font-size: 0.95rem; letter-spacing: 1.5px; margin-bottom: 4px; }
.quick-action-card:hover { background: rgba(255, 255, 255, 0.05); transform: translateY(-4px); }

/* --- Stat bars: colour by meaning --- */
.global-stat:nth-child(1) .global-stat-val { color: var(--emerald); }
.global-stat:nth-child(2) .global-stat-val { color: var(--sky); }
.global-stat:nth-child(3) .global-stat-val { color: var(--gold); }
.global-stat:nth-child(4) .global-stat-val { color: var(--violet); }
.performance-stat:nth-child(1) i { color: var(--emerald); opacity: 1; }
.performance-stat:nth-child(2) i { color: var(--amber); opacity: 1; }
.performance-stat:nth-child(3) i { color: var(--loss); opacity: 1; }
.performance-stat:nth-child(4) i { color: var(--sky); opacity: 1; }
.performance-stat strong { color: var(--white); }

/* --- Tables --- */
.modern-table th { color: var(--sky); }
.modern-table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--emerald); }
.modern-table td:last-child { border-radius: 0 8px 8px 0; }

/* --- Small touches --- */
.stat-pill { background: rgba(58, 160, 255, 0.12); color: var(--sky); }
.alert-success { border-color: var(--emerald); }

/* --- Nav: fit the logged-in admin menu on one line --- */
.navbar .nav-links a { padding: 8px 6px; font-size: 0.74rem; letter-spacing: 0.5px; }
.nav-links { gap: 0; }

/* --- Footer --- */
footer {
    margin-top: 40px;
    padding: 22px 0;
    background: #080b14;
    border-top: 1px solid rgba(212, 175, 55, 0.35);
    color: var(--text-muted);
    font-size: 0.85rem;
}
.footer-content { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer-logo { font-family: 'Cinzel', serif; font-weight: 900; letter-spacing: 3px; color: var(--gold); }
footer p { margin: 0; }
footer a { color: var(--sky); text-decoration: none; }
footer a:hover { color: var(--gold); }
.footer-content .socials { display: flex; gap: 16px; }
.footer-content .socials a { color: var(--white); font-weight: 600; }

/* Plain links inside page content: readable on the dark background */
main a:not([class]) { color: var(--sky); }
main a:not([class]):hover { color: var(--gold); }

/* ===== Phone layout =====
   Nothing may be wider than the screen: when one thing is, the phone zooms the WHOLE page out and everything
   becomes tiny. Many layouts use inline grids, so these rules override them (!important) on small screens. */
@media screen and (max-width: 768px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    .container, main.container { padding-left: 14px; padding-right: 14px; }
    [style*="display: grid"] > *, [style*="display:grid"] > * { min-width: 0; }

    /* small pairs of tiles stay side by side, but may shrink */
    [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    [style*="grid-template-columns: repeat(3, 1fr)"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }

    /* page-level layouts (sidebar + content, forms next to lists, 3 inputs in a row) become one column */
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns: 1fr 2fr"],
    [style*="grid-template-columns: 3fr 1fr"],
    [style*="grid-template-columns: 350px 1fr"],
    [style*="grid-template-columns: 320px 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr; gap: 30px"],
    [style*="grid-template-columns: 1fr 1fr; gap: 20px"] {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 20px !important;
    }

    /* the tall FUT card / avatar column no longer needs a fixed width */
    aside, section { min-width: 0; }

    /* headings: less letter-spacing and a size that fits, long words may wrap */
    h1, h2, h3, h4 { overflow-wrap: break-word; word-break: normal; hyphens: manual; }
    /* a title with buttons/filters next to it: the buttons drop below instead of squeezing the title */
    [style*="display: flex"][style*="justify-content: space-between"] { flex-wrap: wrap; gap: 10px; }
    h1[style*="letter-spacing"], h2[style*="letter-spacing"], h3[style*="letter-spacing"] { letter-spacing: 0.06em !important; }
    h2[style*="font-size: 2.5rem"], h2[style*="font-size: 2.2rem"], h2[style*="font-size: 2rem"] { font-size: 1.6rem !important; }
    h1[style*="font-size: 3rem"] { font-size: 2rem !important; }
    h1.cinzel { font-size: clamp(1.6rem, 7vw, 2.4rem); }

    /* big desktop paddings are too much on a phone */
    [style*="padding: 60px"], [style*="padding: 50px"] { padding: 28px 16px !important; }
    [style*="padding: 40px"] { padding: 22px 16px !important; }
    [style*="margin: 60px 0"] { margin-top: 36px !important; margin-bottom: 20px !important; }

    /* the big score of a match card (an inline 8rem on the home page) must fit on one line */
    .match-score { font-size: clamp(2.6rem, 15vw, 4.2rem) !important; white-space: nowrap; }
    .match-team h3 { font-size: 1.2rem !important; }
    .match-team img { max-width: 120px; height: auto; }

    /* tables scroll sideways inside their own box instead of stretching the page */
    table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* admin/quick-action tiles: two per row */
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; }
    .quick-action-card h3 { font-size: 0.95rem; }
    .quick-action-card p { font-size: 0.72rem; }

    /* text that was too small to read without zooming */
    .global-stat-lbl { font-size: 0.75rem !important; }
    .global-stat-val { font-size: 1.6rem; }
    footer a, footer li, footer p, footer small { font-size: 0.85rem !important; }
    small { font-size: max(0.75rem, 11.5px); }
    .stat-pill { font-size: 0.75rem; }
    input, select, textarea { font-size: 16px; }   /* 16px stops phones zooming in when a field is tapped */
}
