/* ===== Fantasy Football Isle of Man - FPL Style Theme ===== */

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Colors */
:root {
    --primary: #37003c;
    --primary-dark: #250028;
    --primary-light: #4a0052;
    --secondary: #00ff87;
    --secondary-dark: #00cc6a;
    --accent: #ff5555;
    --accent-blue: #3a86ff;
    --gold: #ffd700;
    --bg: #f5f5f5;
    --bg-dark: #1a1a2e;
    --text: #333;
    --text-light: #666;
    --text-muted: #999;
    --white: #ffffff;
    --border: #ddd;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;

    /* Difficulty colors */
    --diff-ee: #00c853;
    --diff-e: #64dd17;
    --diff-m: #ffd600;
    --diff-h: #ff6d00;
    --diff-hh: #d50000;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ===== NAVBAR ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
    color: var(--secondary);
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--white);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.nav-link:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.nav-link:active {
    transform: scale(0.95);
}

.nav-link.active {
    background: var(--secondary);
    color: var(--primary);
    font-weight: 700;
    animation: nav-active-glow 2s ease-in-out infinite alternate;
}

@keyframes nav-active-glow {
    0% { box-shadow: 0 0 4px rgba(0, 255, 135, 0.3); }
    100% { box-shadow: 0 0 12px rgba(0, 255, 135, 0.6); }
}

/* Nav brand hover */
.nav-brand:hover {
    transform: scale(1.05);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-user {
    font-weight: 500;
    font-size: 0.9rem;
}

/* ===== CONTAINER (Carousel Viewport) ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

/* Carousel track - slides horizontally through all pages */
.carousel-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.34, 1.28, 0.64, 1);
    will-change: transform;
}

/* Pages within the carousel - all visible side by side */
.page {
    min-width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    padding: 0 3rem;
}

/* Overlay pages (login/register) - not in carousel */
.page-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
}

.page-overlay.active {
    display: block;
    animation: overlay-fade-in 0.3s ease forwards;
}

@keyframes overlay-fade-in {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                background 0.2s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0px) scale(0.96);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition-duration: 0.05s;
}

/* Ripple effect */
.btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 70%);
    transform: scale(0);
    opacity: 0;
    transition: none;
    pointer-events: none;
    border-radius: inherit;
}

.btn.ripple::after {
    animation: btn-ripple 0.5s ease-out;
}

@keyframes btn-ripple {
    0% { transform: scale(0); opacity: 0.5; }
    100% { transform: scale(2.5); opacity: 0; }
}

.btn-primary {
    background: var(--secondary);
    color: var(--primary);
}

.btn-primary:hover {
    background: var(--secondary-dark);
}

.btn-secondary {
    background: var(--primary-light);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--secondary);
    color: var(--secondary);
}

.btn-outline:hover {
    background: rgba(0, 255, 135, 0.1);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

/* ===== HERO BANNER ===== */
.hero-banner {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    color: var(--white);
    margin-bottom: 2rem;
    animation: hero-fade-in 0.6s ease forwards;
}

@keyframes hero-fade-in {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hero-banner h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--secondary);
}

.hero-banner p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== GW BANNER ===== */
.gw-banner {
    margin-top: 1rem;
}

.gw-banner-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--primary);
    border-radius: 8px;
    color: var(--white);
}

.gw-banner-left h3 {
    color: var(--secondary);
    font-size: 1.5rem;
}

.gw-banner-right {
    text-align: right;
}

.gw-countdown {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
    transition: transform 0.2s ease;
}

.gw-countdown.pulse {
    animation: countdown-pulse 0.3s ease;
}

@keyframes countdown-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-open { background: var(--success); color: white; }
.badge-closed { background: var(--danger); color: white; }
.badge-scored { background: var(--info); color: white; }
.badge-bonus { background: var(--warning); color: var(--text); }
.badge-wildcard { background: var(--accent-blue); color: white; }
.badge-freehit { background: #9c27b0; color: white; }

.pos-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
}

.pos-badge.gk { background: #ffeb3b; color: #333; }
.pos-badge.def { background: #4caf50; color: white; }
.pos-badge.mid { background: #2196f3; color: white; }
.pos-badge.fwd { background: #f44336; color: white; }

/* ===== AUTH FORMS ===== */
.auth-form {
    max-width: 400px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.auth-form input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 2px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.2);
    transform: scale(1.01);
}

.auth-form p {
    margin-top: 1rem;
    text-align: center;
}

.auth-form a {
    color: var(--accent-blue);
}

/* ===== MY TEAM ===== */
.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.team-header h2 {
    color: var(--primary);
}

.team-stats-bar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-budget, .stat-value, .stat-points, .stat-transfers {
    background: var(--primary);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 600;
}

.chip-status-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.formation-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--white);
    border-radius: 4px;
}

.formation-bar select {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}

/* ===== PITCH (FPL-style) ===== */
.pitch-wrapper {
    margin: 1rem 0;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.pitch {
    position: relative;
    width: 100%;
    max-width: 520px;
    height: 620px;
    margin: 0 auto;
    background: #3a7d44;
    border-radius: 8px;
    overflow: hidden;
}

/* Pitch markings */
.pitch::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 5%;
    right: 5%;
    height: 2px;
    background: rgba(255,255,255,0.35);
    z-index: 1;
}

.pitch::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 50%;
    z-index: 1;
}

/* Penalty areas */
.pitch > .penalty-area-top,
.pitch > .penalty-area-bottom {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 14%;
    border: 2px solid rgba(255,255,255,0.3);
    background: transparent;
    z-index: 1;
}
.pitch > .penalty-area-top { top: 0; border-top: none; }
.pitch > .penalty-area-bottom { bottom: 0; border-bottom: none; }
.pitch > .center-spot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    z-index: 1;
}

.pitch-player {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
}

.player-card {
    text-align: center;
    padding: 0.5rem;
    border-radius: 8px;
    min-width: 90px;
    background: var(--white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
}

/* FPL-style player card */
.fpl-card {
    width: 100px;
    background: transparent;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
}

.fpl-card:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    z-index: 20;
}

/* Jersey shirt - SVG icons */
.fpl-shirt {
    width: 64px;
    height: 64px;
    position: relative;
    transition: transform 0.15s;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.fpl-card:hover .fpl-shirt {
    transform: scale(1.08);
}

/* Collar detail removed - SVG shirts have their own shape */

/* Player name below shirt */
.fpl-player-name {
    font-size: 11px;
    font-weight: 700;
    color: #1a1a2e;
    margin-top: 4px;
    max-width: 95px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    line-height: 1.2;
}

.fpl-player-team {
    font-size: 9px;
    color: #666;
    margin-top: 1px;
    max-width: 95px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.fpl-player-points {
    margin-top: 2px;
    background: #37003c;
    color: #00ff87;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 3px;
    display: inline-block;
}

.player-card.gk { border-top: 3px solid #ffeb3b; }
.player-card.def { border-top: 3px solid #4caf50; }
.player-card.mid { border-top: 3px solid #2196f3; }
.player-card.fwd { border-top: 3px solid #f44336; }

.player-card.autosub::after {
    content: 'AUTO';
    position: absolute;
    top: -8px;
    right: -4px;
    background: var(--warning);
    color: var(--text);
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
    font-weight: 700;
}

.captain-badge, .vice-captain-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    z-index: 20;
}

.captain-badge {
    background: #ffd700;
    color: #37003c;
    border: 2px solid #37003c;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.vice-captain-badge {
    background: #fff;
    color: #37003c;
    border: 2px solid #999;
}

.player-pos-icon {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.player-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-team {
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-points {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--secondary);
}

/* ===== BENCH ===== */
.bench-wrapper {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--white);
    border-radius: 8px;
}

.bench-wrapper h3 {
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.bench-grid {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.bench-player {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bench-priority {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.bench-card {
    min-width: 80px;
    padding: 0.4rem;
}

/* ===== CHIPS SECTION ===== */
.chips-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--white);
    border-radius: 8px;
}

.chips-section h3 {
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.chip-card {
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid var(--border);
    text-align: center;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                border-color 0.2s ease,
                background 0.2s ease;
    cursor: default;
}

.chip-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.chip-card.active {
    border-color: var(--secondary);
    background: rgba(0, 255, 135, 0.1);
}

.chip-card.used {
    opacity: 0.5;
    border-color: var(--text-muted);
}

.chip-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.chip-name {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.chip-status {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.chip-card.active .chip-status {
    color: var(--secondary);
}

.chip-halves {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.chip-half {
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    background: var(--bg);
}

.chip-half.used {
    background: var(--text-muted);
    color: var(--white);
}

/* ===== PLAYERS TABLE ===== */
.players-table {
    overflow-x: auto;
}

.players-table table,
.leaderboard-table table,
.fixture-list table {
    width: 100%;
    border-collapse: collapse;
}

.players-table th,
.players-table td,
.leaderboard-table th,
.leaderboard-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.players-table th,
.leaderboard-table th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.players-table tr:hover {
    background: var(--bg);
    transform: scale(1.005);
    transition: background 0.15s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Sortable table headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem !important;
}
th.sortable:hover {
    background: var(--primary-dark, #1565c0) !important;
}
th.sort-active {
    background: var(--primary-light, #1e88e5) !important;
}
th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 0.4rem;
    opacity: 0.4;
    font-size: 0.7rem;
}
th.sort-active::after {
    opacity: 1;
}

/* Table row fade-in animation */
.table-row-fade {
    animation: row-fade-in 0.3s ease forwards;
    opacity: 0;
}

@keyframes row-fade-in {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.player-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.player-filters input,
.player-filters select {
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.player-filters input:focus,
.player-filters select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.15);
}

/* Global select/input focus styles */
select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
    border-color: var(--secondary) !important;
    box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.15);
}

/* ===== FIXTURES ===== */
.fixtures-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fixtures-header h2 {
    color: var(--primary);
}

.fixtures-controls {
    display: flex;
    gap: 0.75rem;
}

.fixtures-controls select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.fixtures-legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--white);
    border-radius: 4px;
}

.difficulty {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.difficulty-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.difficulty-dot.hh { background: var(--diff-hh); }
.difficulty-dot.h { background: var(--diff-h); }
.difficulty-dot.m { background: var(--diff-m); }
.difficulty-dot.e { background: var(--diff-e); }
.difficulty-dot.ee { background: var(--diff-ee); }

.fixture-gw {
    margin-bottom: 1.5rem;
}

.fixture-gw h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.fixture-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--white);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                background 0.15s ease;
}

.fixture-row:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: #fafafa;
}

.fixture-team {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.fixture-team.away {
    justify-content: flex-end;
    text-align: right;
}

.fixture-result {
    padding: 0 1rem;
    font-weight: 700;
}

.score {
    color: var(--primary);
    font-size: 1.1rem;
}

.vs {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.fixture-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
    text-align: center;
}

.difficulty-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
}

.difficulty-badge.hh { background: var(--diff-hh); }
.difficulty-badge.h { background: var(--diff-h); }
.difficulty-badge.m { background: var(--diff-m); color: var(--text); }
.difficulty-badge.e { background: var(--diff-e); }
.difficulty-badge.ee { background: var(--diff-ee); }

/* ===== GAMEWEEKS ===== */
.gw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.gw-header h2 {
    color: var(--primary);
}

.gw-card {
    padding: 1rem;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--secondary);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
    animation: card-fade-in 0.4s ease forwards;
    opacity: 0;
}

.gw-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

@keyframes card-fade-in {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Staggered card animations */
.gw-card:nth-child(1) { animation-delay: 0.05s; }
.gw-card:nth-child(2) { animation-delay: 0.1s; }
.gw-card:nth-child(3) { animation-delay: 0.15s; }
.gw-card:nth-child(4) { animation-delay: 0.2s; }
.gw-card:nth-child(5) { animation-delay: 0.25s; }
.gw-card:nth-child(6) { animation-delay: 0.3s; }
.gw-card:nth-child(7) { animation-delay: 0.35s; }
.gw-card:nth-child(8) { animation-delay: 0.4s; }
.gw-card:nth-child(9) { animation-delay: 0.45s; }
.gw-card:nth-child(10) { animation-delay: 0.5s; }

.gw-card.closed {
    opacity: 0.7;
    border-left-color: var(--text-muted);
}

.gw-card.scored {
    border-left-color: var(--info);
}

.gw-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.gw-card-header h3 {
    color: var(--primary);
    font-size: 1rem;
}

/* ===== SCORING PROGRESS ===== */
.scoring-progress {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--white);
    border-radius: 4px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.progress-track {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--secondary);
    transition: width 0.3s;
}

/* ===== HISTORY PAGE ===== */
.history-header h2 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.history-controls {
    margin-bottom: 1rem;
}

.history-controls select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    min-width: 200px;
}

.history-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.history-stat-card {
    padding: 1rem;
    background: var(--white);
    border-radius: 8px;
    text-align: center;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
}

.history-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.history-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
}

.history-stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.history-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 200px;
    padding: 1rem;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.history-bar {
    flex: 1;
    background: var(--secondary);
    border-radius: 4px 4px 0 0;
    min-height: 5%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    animation: bar-grow 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform-origin: bottom;
}

@keyframes bar-grow {
    0% { transform: scaleY(0); }
    100% { transform: scaleY(1); }
}

.bar-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.bar-value {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
}

/* Gameweek breakdown */
.gw-breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.gw-breakdown-header h3 {
    color: var(--primary);
}

.breakdown-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.chip-badge {
    background: var(--accent-blue);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.player-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.player-breakdown-card {
    padding: 0.75rem;
    background: var(--white);
    border-radius: 8px;
    border-left: 4px solid var(--border);
}

.player-breakdown-card.starting {
    border-left-color: var(--secondary);
}

.player-breakdown-card.bench {
    opacity: 0.7;
    border-left-color: var(--text-muted);
}

.pb-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.pb-details {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}

.captain-badge-sm, .vice-badge-sm {
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
    font-weight: 700;
}

.captain-badge-sm {
    background: var(--gold);
    color: var(--primary);
}

.vice-badge-sm {
    background: #c0c0c0;
    color: var(--primary);
}

.autosub-badge {
    background: var(--warning);
    color: var(--text);
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
    font-weight: 700;
}

.pb-stats {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.bonus-badge {
    color: var(--secondary);
    font-weight: 700;
}

.pb-points {
    font-weight: 800;
    font-size: 1.1rem;
    text-align: right;
}

.pb-points.positive {
    color: var(--secondary);
}

/* Transfer history */
.transfer-history-section {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--white);
    border-radius: 8px;
}

.transfer-history-section h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.transfer-history-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.transfer-gw {
    font-weight: 700;
    color: var(--primary);
    min-width: 50px;
}

.transfer-in {
    color: var(--success);
}

.transfer-out {
    color: var(--danger);
}

/* ===== LEADERBOARD ===== */
.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.leaderboard-header h2 {
    color: var(--primary);
}

.leaderboard-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.rank-change.up { color: var(--success); }
.rank-change.down { color: var(--danger); }

.leaderboard-table table {
    width: 100%;
}

.leaderboard-table td.points {
    font-weight: 700;
    color: var(--primary);
}

/* ===== LEAGUES ===== */
.league-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.league-header h2 {
    color: var(--primary);
}

.league-card {
    padding: 1.5rem;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
}

.league-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.league-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.standings-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.standings-row:hover {
    background: var(--bg);
    transform: translateX(2px);
}

.standings-row .rank {
    font-weight: 700;
    color: var(--primary);
    min-width: 40px;
}

.standings-row .points {
    font-weight: 700;
}

/* ===== DREAM TEAM ===== */
.dream-team-header {
    text-align: center;
    margin-bottom: 1rem;
}

.dream-team-header h2 {
    color: var(--primary);
}

.section-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dream-team-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dream-team-pitch {
    height: 500px;
}

.dream-team-player {
    position: absolute;
    transform: translate(-50%, -50%);
}

.dream-player-card {
    text-align: center;
    padding: 0.5rem;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    min-width: 90px;
    border-top: 3px solid var(--gold);
}

.dream-player-name {
    font-size: 0.75rem;
    font-weight: 700;
}

.dream-player-team {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.dream-player-points {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--gold);
}

.dream-team-total {
    text-align: center;
    margin-top: 1rem;
}

.dream-team-total-score {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

/* ===== HELP ===== */
.help-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--white);
    border-radius: 8px;
}

.help-section h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.help-section ul {
    padding-left: 1.5rem;
}

.help-section li {
    margin-bottom: 0.5rem;
}

.scoring-table table {
    width: 100%;
    border-collapse: collapse;
}

.scoring-table th,
.scoring-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.scoring-table th {
    background: var(--primary);
    color: var(--white);
}

.chips-help {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.chip-help-card {
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    border-left: 4px solid var(--secondary);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
}

.chip-help-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.chip-help-card h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* ===== TRANSFERS PAGE ===== */
.transfer-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.transfer-controls input,
.transfer-controls select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}

.transfer-player-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--white);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                background 0.15s ease;
}

.transfer-player-row:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.transfer-player-row.in-squad {
    border-left: 3px solid var(--danger);
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 1rem;
    z-index: 1000;
}

.toast {
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-weight: 600;
    animation: toast-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.toast-removing {
    animation: toast-slide-out 0.3s ease-in forwards;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--info); color: white; }

.toast.fade-out {
    opacity: 0;
    transition: opacity 0.3s;
}

@keyframes toast-slide-in {
    0% { transform: translateX(120%); opacity: 0; }
    60% { transform: translateX(-5%); }
    80% { transform: translateX(2%); }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes toast-slide-out {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(120%); opacity: 0; }
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 999;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
}

.modal-content {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    z-index: 1001;
    min-width: 280px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    cursor: default;
}

/* Modal pop-up from bottom with bounce */
.modal-content.modal-show {
    animation: modal-pop-up 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-content.modal-hide {
    animation: modal-pop-out 0.25s ease-in forwards;
}

@keyframes modal-pop-up {
    0% {
        opacity: 0;
        transform: translate(-50%, 100%) scale(0.85);
    }
    60% {
        transform: translate(-50%, -50%) scale(1.03);
    }
    80% {
        transform: translate(-50%, -50%) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes modal-pop-out {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, 80%) scale(0.9);
    }
}

/* Ensure modal buttons are always clickable */
.modal-content .btn,
.modal-content button {
    position: relative;
    z-index: 10;
    cursor: pointer;
    pointer-events: auto;
}

/* ===== EMPTY/ERROR STATES ===== */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.error-state {
    text-align: center;
    padding: 2rem;
    color: var(--danger);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }

    .hero-banner h1 {
        font-size: 1.75rem;
    }

    .gw-banner-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .team-stats-bar {
        width: 100%;
        justify-content: center;
    }

    .player-breakdown-grid {
        grid-template-columns: 1fr;
    }

    .chips-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== DEADLINE COUNTDOWN ===== */
.deadline-countdown {
    text-align: center;
    padding: 10px 20px;
    margin: 10px auto;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    display: inline-flex;
    gap: 15px;
    align-items: center;
}
.deadline-countdown .countdown-unit {
    text-align: center;
}
.deadline-countdown .countdown-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--green);
}
.deadline-countdown .countdown-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}
.deadline-countdown .countdown-separator {
    font-size: 1.2rem;
    color: var(--text-muted);
}
.deadline-countdown .countdown-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== SCORING PROGRESS BAR ===== */
.progress-bar-container {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 15px 20px;
    margin: 15px 0;
    border: 1px solid var(--border-color);
}
.progress-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.progress-label {
    font-weight: bold;
    color: var(--text-primary);
}
.progress-value {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.progress-bar-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green), #00c853);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ===== RANK DISPLAY ===== */
.rank-display {
    display: flex;
    gap: 20px;
    margin-top: 5px;
}
.rank-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
}
.rank-label {
    color: var(--text-muted);
}
.rank-value {
    color: var(--text-primary);
    font-weight: bold;
}

/* ===== NOTIFICATIONS PAGE ===== */
.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.notifications-container {
    max-width: 700px;
}
.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: background 0.2s;
}
.notification-item.unread {
    background: rgba(76, 175, 80, 0.1);
    border-left: 3px solid var(--green);
}
.notification-item.read {
    opacity: 0.7;
}
.notification-icon {
    font-size: 1.5rem;
    min-width: 30px;
    text-align: center;
}
.notification-content {
    flex: 1;
}
.notification-title {
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.notification-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.notification-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 3px;
}

/* ===== GW RECAP PAGE ===== */
.recap-selector {
    margin: 15px 0;
}
.recap-selector select {
    padding: 8px 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
}
.player-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 15px;
}
.player-breakdown-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 15px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.player-breakdown-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--text-primary);
    flex-shrink: 0;
}
.player-breakdown-info {
    flex: 1;
    min-width: 0;
}
.player-breakdown-name {
    font-weight: bold;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-breakdown-team {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.player-breakdown-points {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--green);
    flex-shrink: 0;
}
.player-breakdown-details {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ===== H2H PAGE ===== */
.h2h-overview {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.h2h-stat-card {
    flex: 1;
    min-width: 120px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 15px;
    border: 1px solid var(--border-color);
    text-align: center;
}
.h2h-stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--green);
}
.h2h-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}
.h2h-matchup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 25px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}
.h2h-team {
    text-align: center;
    min-width: 150px;
}
.h2h-team-name {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 5px;
}
.h2h-team-records {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.h2h-vs {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--purple);
}
.h2h-points {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--green);
    margin-top: 5px;
}
.h2h-bracket {
    margin-top: 20px;
}
.h2h-bracket-round {
    margin-bottom: 20px;
}
.h2h-bracket-round h3 {
    margin-bottom: 10px;
    color: var(--text-secondary);
}
.h2h-bracket-match {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}
.h2h-bracket-match .bracket-team {
    flex: 1;
    text-align: center;
}
.h2h-bracket-match .bracket-team.winner {
    color: var(--green);
    font-weight: bold;
}
.h2h-bracket-match .bracket-team.loser {
    color: var(--text-muted);
}
.h2h-bracket-match .bracket-score {
    font-weight: bold;
    padding: 2px 10px;
    background: var(--border-color);
    border-radius: 4px;
}
.h2h-bracket-match .bracket-result {
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 4px;
}
.bracket-result.win { background: rgba(76, 175, 80, 0.2); color: var(--green); }
.bracket-result.draw { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.bracket-result.loss { background: rgba(244, 67, 54, 0.2); color: #f44336; }

/* ===== MODAL OVERLAY ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay > div {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 25px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}
.modal-overlay > div h2 {
    margin-bottom: 15px;
    color: var(--text-primary);
}
.modal-overlay > div p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.modal-overlay > div .warning-text {
    color: #f44336;
    font-weight: bold;
}
.modal-overlay > div .info-text {
    color: var(--text-muted);
    font-style: italic;
}

/* ===== PLAYER DETAIL MODAL ===== */
.player-detail-modal .player-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.player-detail-modal .player-detail-info h2 {
    margin-bottom: 5px;
}
.player-detail-modal .player-detail-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.player-detail-modal .player-detail-price {
    text-align: right;
}
.player-detail-modal .price-main {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--green);
}
.player-detail-modal .price-change {
    font-size: 0.9rem;
    margin-top: 3px;
}
.player-detail-modal .price-change.price-up { color: var(--green); }
.player-detail-modal .price-change.price-down { color: #f44336; }
.player-detail-modal .injury-badge {
    display: inline-block;
    background: #f44336;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-top: 5px;
}
.player-detail-modal .stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}
.player-detail-modal .stat-item {
    text-align: center;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}
.player-detail-modal .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}
.player-detail-modal .stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
}
.player-detail-section {
    margin: 15px 0;
}
.player-detail-section h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.player-detail-section .form-guide {
    display: flex;
    gap: 5px;
}
.form-badge {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
}
.form-badge.form-high { background: rgba(76, 175, 80, 0.2); color: var(--green); }
.form-badge.form-mid { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.form-badge.form-low { background: rgba(244, 67, 54, 0.2); color: #f44336; }
.fixture-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin: 2px;
}
.fixture-badge.easy { background: rgba(76, 175, 80, 0.2); color: var(--green); }
.fixture-badge.medium { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.fixture-badge.hard { background: rgba(244, 67, 54, 0.2); color: #f44336; }
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.history-table th {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}
.history-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.player-detail-footer {
    margin-top: 20px;
    text-align: right;
}

/* ===== TEAM DETAILS MODAL ===== */
.team-details-modal .form-group {
    margin-bottom: 15px;
}
.team-details-modal label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.team-details-modal .form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
}
.team-details-modal .form-input:focus {
    outline: none;
    border-color: var(--green);
}

/* ============================================================ */
/*  v3 FPL-style refinements                                     */
/* ============================================================ */

/* --- Pitch (My Team / Dream Team) ---------------------------- */
.pitch-wrapper {
    background: linear-gradient(180deg, #2e7d32 0%, #1b5e20 100%);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    overflow: hidden;
}
.pitch {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 11;
    background:
        repeating-linear-gradient(0deg,
            rgba(255,255,255,0.04) 0 30px,
            rgba(255,255,255,0.0)  30px 60px),
        radial-gradient(ellipse at center, rgba(255,255,255,0.08) 0%, transparent 60%),
        linear-gradient(180deg, #2e7d32, #2e7d32);
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    overflow: hidden;
}
.pitch::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0; bottom: 0;
    width: 2px;
    background: rgba(255,255,255,0.4);
    transform: translateX(-50%);
}
.pitch::after {
    content: "";
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 28%;
    aspect-ratio: 1;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 50%;
}
#pitch-players, #dream-team-players {
    position: absolute;
    inset: 0;
    z-index: 2;
}
/* --- Pitch rows and slots (FPL formation layout) --- */
.pitch-row {
    position: absolute;
    left: 0; right: 0;
    transform: translateY(-50%);
    height: 0;
}
.pitch-slot {
    position: absolute;
    transform: translate(-50%, 0);
    width: 100px;
    text-align: center;
    top: 0;
}
.pitch-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
    padding: 1rem;
}

/* --- FPL player card on pitch --- */
.player-card {
    position: relative;
    cursor: pointer;
}
.fpl-card {
    width: 100px;
    background: transparent;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.fpl-card:hover .fpl-shirt {
    transform: scale(1.08);
}

/* Legacy shirt styles (backward compat) */
.player-card .shirt {
    width: 56px;
    height: 56px;
    margin: 0 auto 2px;
    background: linear-gradient(180deg, #d50000 0%, #ad0000 100%);
    clip-path: polygon(20% 0, 30% 10%, 70% 10%, 80% 0, 100% 20%, 90% 30%, 90% 100%, 10% 100%, 10% 30%, 0 20%);
}
.shirt-gk  { background: linear-gradient(180deg, #ffd54f, #ff8f00); }
.shirt-def { background: linear-gradient(180deg, #1976d2, #0d47a1); }
.shirt-mid { background: linear-gradient(180deg, #00c853, #2e7d32); }
.shirt-fwd { background: linear-gradient(180deg, #d50000, #b71c1c); }

.player-card .player-name {
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    margin: 0 auto;
}
.player-card .player-meta {
    font-size: 9px;
    color: #666;
}
.player-card .player-points {
    margin-top: 2px;
    background: #37003c;
    color: #00ff87;
    font-size: 11px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 3px;
    display: inline-block;
}

/* FPL captain/vice-captain badges (on pitch) */
.captain-badge, .vice-captain-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    z-index: 2;
}
.captain-badge {
    background: #ffd700;
    color: #37003c;
    border: 2px solid #37003c;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.vice-captain-badge {
    background: #fff;
    color: #37003c;
    border: 2px solid #999;
}
.injury-dot {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #d50000;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* --- Bench (FPL-style) --- */
.bench-wrapper {
    background: #2e7d32;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 2px solid #1b5e20;
}
.bench-wrapper h3 {
    color: #fff;
    margin-bottom: 0.75rem;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#bench-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}
.bench-slot {
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.bench-slot-num {
    color: rgba(255,255,255,0.7);
    font-size: 10px;
    margin-bottom: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

/* --- Team header bar (FPL-style) --- */
.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--primary);
    color: #fff;
    padding: 1rem 1.25rem;
    border-radius: 8px;
}
.team-header h2 {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
}
.team-stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: center;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
}
.team-stats-bar > span {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
}
.team-stats-bar strong,
.team-stats-bar #team-budget,
.team-stats-bar #team-value,
.team-stats-bar #team-points,
.team-stats-bar #team-transfers {
    color: #00ff87;
    font-weight: 700;
}
.stat-budget, .stat-value, .stat-points, .stat-transfers {
    background: transparent;
    color: rgba(255,255,255,0.85);
    padding: 0;
    border-radius: 0;
    font-weight: 500;
}
.formation-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
    padding: 0.6rem 1rem;
    background: var(--white);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.formation-bar label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.formation-bar select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
}
.chip-status-bar:empty { display: none; }
.chip-active-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(90deg, #00ff87, #00cc6a);
    color: #37003c;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* --- Position badges ----------------------------------------- */
.pos-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    text-align: center;
    min-width: 32px;
}
.pos-badge.pos-gk  { background: #ff8f00; }
.pos-badge.pos-def { background: #0d47a1; }
.pos-badge.pos-mid { background: #2e7d32; }
.pos-badge.pos-fwd { background: #b71c1c; }

/* --- Chips section ------------------------------------------- */
.chips-section { margin-top: 1rem; }
.chips-section h3 { margin-bottom: 0.5rem; }
#chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}
.chip-card {
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    transition: transform 0.15s;
}
.chip-card:hover { transform: translateY(-2px); }
.chip-card.chip-active { border-color: #00cc6a; box-shadow: 0 0 0 2px rgba(0,255,135,0.25); }
.chip-card.chip-used { opacity: 0.55; }
.chip-icon { font-size: 1.6rem; }
.chip-name { font-weight: 700; margin: 0.25rem 0; }
.chip-desc { font-size: 0.75rem; color: var(--text-light); min-height: 30px; }
.chip-status { font-size: 0.8rem; color: var(--text-light); margin-bottom: 0.4rem; }
.chip-halves { display: flex; gap: 0.4rem; justify-content: center; margin-bottom: 0.4rem; }
.chip-half {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #eee;
}
.chip-half.used { background: #ccc; color: #888; text-decoration: line-through; }

/* --- Transfers page ------------------------------------------ */
.transfer-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    background: linear-gradient(90deg, #37003c, #4a0052);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #fff;
    margin-bottom: 0.75rem;
}
.ts-cell { text-align: center; }
.ts-label { font-size: 0.7rem; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 1px; }
.ts-value { font-size: 1.2rem; font-weight: 700; color: #00ff87; }
.transfer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.transfer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 0.5rem;
}
.transfer-controls input,
.transfer-controls select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
}
.transfer-controls input { flex: 1; min-width: 200px; }

.squad-group { margin-bottom: 0.5rem; }
.squad-group h4 { color: var(--primary); margin-bottom: 0.4rem; }
.squad-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.5rem;
}
@media (max-width: 768px) { .squad-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.squad-cell {
    background: #f4f4f9;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s, border-color 0.15s;
}
.squad-cell:hover { transform: translateY(-1px); }
.squad-cell.selected { border-color: #00ff87; box-shadow: 0 0 0 2px rgba(0,255,135,0.4); }
.squad-cell.empty {
    border-style: dashed;
    color: var(--text-muted);
    cursor: default;
}
.empty-slot { padding: 1rem 0; text-align: center; font-weight: 600; }
.player-mini {
    text-align: center;
    position: relative;
}
.player-mini .shirt {
    width: 36px;
    height: 36px;
    margin: 0 auto 4px;
}
.player-mini .pm-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-mini .pm-team { font-size: 0.7rem; color: var(--text-light); }
.player-mini .pm-price { font-size: 0.75rem; color: var(--primary); font-weight: 700; }
.btn-x {
    position: absolute;
    top: 2px; right: 2px;
    background: #d50000;
    color: #fff;
    border: 0;
    border-radius: 50%;
    width: 18px; height: 18px;
    font-size: 12px;
    cursor: pointer;
    line-height: 16px;
    padding: 0;
}

/* === Transfer squad layout (FPL-style 3 rows) === */
.ts-pitch { margin-bottom: 1rem; }
.ts-pitch-field {
    background: #2d7a3a;
    border-radius: 8px;
    padding: 0.5rem;
    position: relative;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.ts-pitch-label {
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.2rem 0;
    text-align: center;
}
.ts-pitch-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.25rem 0;
}
.ts-pitch-slot {
    flex: 0 0 auto;
    width: 100px;
    text-align: center;
    cursor: pointer;
}
.ts-pitch-slot.empty {
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 6px;
    padding: 0.5rem;
    color: rgba(255,255,255,0.5);
}
.ts-pitch-slot.selected {
    outline: 2px solid #00ff87;
    outline-offset: 2px;
    border-radius: 6px;
}
.ts-pitch-slot.pending-out {
    opacity: 0.6;
}
.ts-pitch-card {
    background: var(--card-bg);
    border-radius: 6px;
    padding: 0.5rem;
}
.ts-pitch-card .pm-name { font-size: 0.8rem; }
.ts-pitch-card .pm-team { font-size: 0.65rem; }
.ts-pitch-card .pm-price { font-size: 0.7rem; }

/* Bench section */
.bench-section { margin-top: 1rem; }
.bench-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}
.bench-section .bench-slot {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}
.bench-section .bench-slot:hover { transform: translateY(-1px); }
.bench-section .bench-slot.selected { border-color: #00ff87; box-shadow: 0 0 0 2px rgba(0,255,135,0.4); }
.bench-section .bench-slot.pending-out { opacity: 0.6; }
.bench-section .bench-slot.empty {
    border-style: dashed;
    color: var(--text-muted);
    cursor: default;
}

/* Pending transfers bar */
.pending-transfers-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
    background: rgba(0,255,135,0.1);
    border: 1px solid rgba(0,255,135,0.3);
    border-radius: 6px;
}
.pending-count {
    font-weight: 600;
    color: var(--text);
}
.btn-success {
    background: #00c853;
    color: #fff;
    border: 0;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.btn-success:hover { background: #00a844; }

/* Pending transfers list */
.pending-transfers-list {
    margin-top: 0.5rem;
}
.pending-transfer-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}
.transfer-out { color: #ff5252; font-weight: 600; }
.transfer-in { color: #00c853; font-weight: 600; }
.transfer-arrow { color: var(--text-muted); }

/* Pending badge on player */
.pending-badge {
    display: inline-block;
    background: #ff5252;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    text-transform: uppercase;
}

/* === Gameweek breakdown badges === */
.not-played-badge {
    display: inline-block;
    background: #666;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    text-transform: uppercase;
}
.added-later-badge {
    display: inline-block;
    background: var(--text-muted);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
}
.player-breakdown-card.not-in-squad {
    opacity: 0.6;
    background: var(--bg);
}
.not-in-squad-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.not-in-squad-section h4 {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.transfer-list-header {
    display: grid;
    grid-template-columns: 2fr 1.4fr 0.6fr 0.7fr 0.6fr 0.6fr 0.7fr 1fr;
    padding: 0.5rem 0.75rem;
    background: var(--primary);
    color: #fff;
    border-radius: 6px 6px 0 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.transfer-list { max-height: 480px; overflow-y: auto; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 6px 6px; }
.transfer-row {
    display: grid;
    grid-template-columns: 2fr 1.4fr 0.6fr 0.7fr 0.6fr 0.6fr 0.7fr 1fr;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.transfer-row:last-child { border-bottom: 0; }
.transfer-row:hover { background: #fafafa; }
.transfer-row.in-squad { background: #fff8e1; }
.t-name { font-weight: 600; color: var(--primary); }

/* --- Gameweeks page ------------------------------------------ */
.current-gw-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, #37003c, #4a0052);
    color: #fff;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}
.current-gw-card .cgw-label { font-size: 0.75rem; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 1px; }
.cgw-countdown {
    font-size: 1.6rem;
    font-weight: 800;
    color: #00ff87;
    font-variant-numeric: tabular-nums;
}
.gw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.gw-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.gw-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.gw-card.current { border-color: #00ff87; box-shadow: 0 0 0 2px rgba(0,255,135,0.25); }
.gw-card.scored { background: #f1f8e9; }
.gw-card-header { display: flex; justify-content: space-between; align-items: center; }
.gw-card h4 { margin: 0; color: var(--primary); }
.gw-deadline { font-size: 0.75rem; color: var(--text-light); margin-top: 4px; }
.gw-meta { font-size: 0.7rem; color: var(--text-muted); }
.gw-status .badge { font-size: 0.7rem; }
.badge-current { background: #00ff87; color: #37003c; }
.badge-open { background: #e3f2fd; color: #1565c0; }
.badge-closed { background: #eee; color: #666; }
.badge-scored { background: #c8e6c9; color: #2e7d32; }

.gw-detail-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 1rem;
    margin-top: 0.5rem;
}
.gw-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.gw-detail-stats { display: flex; gap: 1.25rem; font-size: 0.9rem; }
.gw-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 768px) { .gw-detail-grid { grid-template-columns: 1fr; } }
.top-perf-row {
    display: grid;
    grid-template-columns: 50px 1.6fr 1fr 60px;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.top-perf-row:last-child { border: 0; }
.tp-points { color: var(--primary); font-weight: 800; }
.tp-name { font-weight: 600; }

/* --- History page -------------------------------------------- */
.history-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.history-stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
}
.history-stat-card .stat-value { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.history-stat-card .stat-label { font-size: 0.75rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 1px; }
.history-table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.history-table th {
    text-align: left;
    background: var(--primary);
    color: #fff;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.history-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #f0f0f0; }
.history-table tbody tr:hover { background: #fafafa; }
.chip-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background: #00ff87;
    color: #37003c;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}
.chip-badge.chip-wildcard { background: #ff5722; color: #fff; }
.chip-badge.chip-free_hit { background: #ffc107; color: #37003c; }
.chip-badge.chip-bench_boost { background: #2196f3; color: #fff; }
.chip-badge.chip-triple_captain { background: #9c27b0; color: #fff; }

.gw-breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.breakdown-stats { display: flex; gap: 1rem; align-items: center; font-size: 0.9rem; }
.breakdown-stats .cost { color: #d50000; }
.player-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem;
}
.player-breakdown-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}
.player-breakdown-card.bench { background: #f8f9fa; opacity: 0.85; }
.pb-header { display: flex; align-items: center; gap: 0.4rem; }
.pb-name { font-weight: 700; flex: 1; }
.captain-badge-sm, .vice-badge-sm, .autosub-badge {
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 3px;
    background: #37003c;
    color: #00ff87;
    font-weight: 700;
}
.vice-badge-sm { background: #fff; color: #37003c; border: 1px solid #37003c; }
.autosub-badge { background: #ffc107; color: #37003c; }
.pb-meta { font-size: 0.75rem; }
.pb-stats { font-size: 0.75rem; color: var(--text-light); display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.25rem 0; }
.pb-points { font-size: 1.1rem; font-weight: 800; color: var(--primary); text-align: right; }
.pb-points.positive { color: #2e7d32; }

.transfer-history-section { margin-top: 1.5rem; }
.transfer-history-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}
.transfer-gw { color: var(--text-light); font-weight: 700; min-width: 60px; }
.transfer-in { color: #2e7d32; }
.transfer-out { color: #d50000; }

/* --- Dream Team (FPL-style) -------------------------------- */
#dream-team-pitch {
    background: #3a7d44;
    border-radius: 8px;
    padding: 0;
    margin: 1rem 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    position: relative;
    width: 100%;
    max-width: 520px;
    height: 620px;
    margin: 1rem auto;
    overflow: hidden;
}

/* Dream team gold accent border */
#dream-team-pitch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ffd700, #ffab00, #ffd700);
    z-index: 5;
}

/* Pitch markings for dream team */
#dream-team-pitch .penalty-area-top,
#dream-team-pitch .penalty-area-bottom {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 14%;
    border: 2px solid rgba(255,255,255,0.3);
    background: transparent;
    z-index: 1;
}
#dream-team-pitch .penalty-area-top { top: 0; border-top: none; }
#dream-team-pitch .penalty-area-bottom { bottom: 0; border-bottom: none; }
#dream-team-pitch .center-spot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    z-index: 1;
}
#dream-team-players {
    position: absolute;
    inset: 0;
    z-index: 2;
}
.dream-team-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.dream-team-selector select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
}
.dream-total-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}
.dream-total-card strong { color: var(--primary); font-size: 1.1rem; }

/* --- Misc helpers -------------------------------------------- */
.muted { color: var(--text-light); }
.btn-warn { background: #ffc107; color: #37003c; }
.btn-warn:hover { background: #e0a800; }
.menu-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }
.player-menu-modal { padding: 1rem; }
.player-menu-modal h3 { margin-bottom: 0.25rem; }
.player-menu-modal .menu-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.player-menu-modal .menu-actions .btn { position: relative; z-index: 1; }
.chip-confirm-modal { padding: 1rem; }
.chip-confirm-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }
.warning-text { color: #d84315; font-weight: 600; }
.empty-state { padding: 2rem; text-align: center; color: var(--text-light); }
.error-state { padding: 1rem; text-align: center; color: #d50000; }

.form-guide { display: flex; gap: 0.25rem; margin-bottom: 0.5rem; }
.form-pill {
    display: inline-block;
    min-width: 28px;
    text-align: center;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    color: #fff;
}
.form-high { background: #2e7d32; }
.form-mid { background: #ff8f00; }
.form-low { background: #b71c1c; }
.upcoming-fixtures { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.fix-pill {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    background: #eee;
}
.fix-pill.diff-1 { background: #00c853; color: #fff; }
.fix-pill.diff-2 { background: #64dd17; color: #1a1a1a; }
.fix-pill.diff-3 { background: #ffd600; color: #1a1a1a; }
.fix-pill.diff-4 { background: #ff6d00; color: #fff; }
.fix-pill.diff-5 { background: #d50000; color: #fff; }

.btn-block { display: block; width: 100%; }

/* ===== MOBILE OPTIMIZATIONS ===== */

/* Touch targets minimum 44x44px */
* {
    -webkit-tap-highlight-color: transparent;
}

button, .btn, .nav-link {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

/* Bottom navigation for mobile */
@media (max-width: 768px) {
    /* Stack navbar */
    .navbar {
        flex-wrap: wrap;
        padding: 0.5rem;
    }

    .nav-brand {
        font-size: 1.1rem;
        flex: 1;
    }

    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0.25rem 0;
        gap: 0.25rem;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .nav-auth {
        gap: 0.5rem;
    }

    /* Container */
    .container {
        padding: 0.75rem;
    }

    /* Hero */
    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .hero-features {
        flex-direction: column;
    }

    .feature-card {
        margin-bottom: 0.5rem;
    }

    /* Rules */
    .rules-grid {
        grid-template-columns: 1fr;
    }

    .rule-card {
        margin-bottom: 0.5rem;
    }

    /* GW Banner */
    .gw-banner-card {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
        padding: 1rem;
    }

    .gw-banner-left, .gw-banner-right {
        text-align: center;
    }

    /* Team header */
    .team-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .team-info {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    .team-stat {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    /* Pitch - make it fit on mobile */
    .pitch {
        max-width: 100%;
        height: auto;
        aspect-ratio: 3/4;
        min-height: 400px;
    }

    .pitch-player {
        transform: translate(-50%, -50%) scale(0.85);
    }

    .player-card, .fpl-card {
        min-width: 70px;
    }

    .fpl-shirt {
        width: 48px;
        height: 48px;
    }

    .fpl-player-name {
        font-size: 9px;
        max-width: 75px;
    }

    .fpl-player-team {
        font-size: 8px;
        max-width: 75px;
    }

    .fpl-player-points {
        font-size: 9px;
    }

    /* Bench */
    .bench-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }

    .bench-slot {
        text-align: center;
    }

    .bench-slot-num {
        font-size: 0.7rem;
    }

    /* Chips */
    .chips-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .chip-card {
        padding: 0.75rem;
    }

    .chip-icon {
        font-size: 1.5rem;
    }

    .chip-name {
        font-size: 0.8rem;
    }

    .chip-desc {
        font-size: 0.7rem;
    }

    /* Transfer page */
    .transfer-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .transfer-stat {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    .transfer-search {
        flex-direction: column;
    }

    .transfer-search input {
        width: 100%;
    }

    /* Transfer list - horizontal scroll */
    .transfer-list-header,
    .transfer-row {
        min-width: 500px;
    }

    .transfer-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .transfer-list-header {
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .transfer-row {
        padding: 0.75rem 0.5rem;
    }

    .transfer-row .btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    /* Squad cells */
    .squad-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .squad-cell {
        flex: 1;
        min-width: 80px;
    }

    .player-mini {
        padding: 0.5rem;
    }

    .pm-name {
        font-size: 0.75rem;
    }

    .pm-team {
        font-size: 0.65rem;
    }

    .pm-price {
        font-size: 0.7rem;
    }

    .btn-x {
        min-width: 44px;
        min-height: 44px;
        font-size: 1.5rem;
    }

    /* Players table - horizontal scroll */
    .players-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .players-table table {
        min-width: 600px;
    }

    .players-table th,
    .players-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Gameweeks */
    .gameweeks-container {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Leaderboard */
    #leaderboard-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #leaderboard-table table {
        min-width: 400px;
    }

    /* Help */
    .help-section {
        margin-bottom: 1rem;
    }

    .scoring-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .scoring-table table {
        min-width: 300px;
    }

    .chips-help {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* Fixtures */
    .fixture-row {
        padding: 0.75rem 0.5rem;
    }

    .team-name {
        font-size: 0.85rem;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
    }

    /* Toast */
    .toast-container {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
    }

    .toast {
        width: 100%;
        font-size: 0.9rem;
    }

    /* Auth forms */
    .auth-form {
        margin: 1rem auto;
        padding: 1.5rem;
    }

    .auth-form input {
        min-height: 44px;
        font-size: 1rem;
    }

    /* Select elements */
    select {
        min-height: 44px;
        font-size: 1rem;
    }

    /* Inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"] {
        min-height: 44px;
        font-size: 1rem;
    }

    /* Notifications */
    .notifications-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* H2H */
    .h2h-bracket {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .nav-link {
        font-size: 0.75rem;
        padding: 0.4rem 0.5rem;
    }

    .hero h1 {
        font-size: 1.25rem;
    }

    .pitch {
        min-height: 350px;
    }

    .fpl-shirt {
        width: 40px;
        height: 40px;
    }

    .fpl-player-name {
        font-size: 8px;
        max-width: 60px;
    }

    .fpl-player-team {
        font-size: 7px;
        max-width: 60px;
    }

    .chips-grid {
        grid-template-columns: 1fr;
    }
}
