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

html {
    height: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for better mobile support */
    /* Fix PWA scroll restoration */
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 25%, #16213e 50%, #0f3460 75%, #533483 100%);
    height: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for better mobile support */
    color: #333;
    position: relative;
    overflow-x: hidden;
    /* Ensure body starts at top */
    margin: 0;
    padding: 0;
    /* Add safe area support for devices with notches */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* Fix initial scroll position for PWA */
    scroll-padding-top: 0;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    width: calc(100% + env(safe-area-inset-left) + env(safe-area-inset-right));
    height: calc(100% + env(safe-area-inset-top) + env(safe-area-inset-bottom));
    top: calc(-1 * env(safe-area-inset-top));
    left: calc(-1 * env(safe-area-inset-left));
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #eee, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, #fff, transparent),
        radial-gradient(1px 1px at 200px 60px, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 250px 120px, #eee, transparent),
        radial-gradient(1px 1px at 300px 90px, #fff, transparent),
        radial-gradient(2px 2px at 350px 40px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 380px 150px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 60px 180px, #fff, transparent),
        radial-gradient(1px 1px at 120px 200px, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 180px 250px, #eee, transparent),
        radial-gradient(1px 1px at 240px 220px, #fff, transparent),
        radial-gradient(2px 2px at 320px 280px, rgba(255,255,255,0.7), transparent);
    background-repeat: repeat;
    background-size: 400px 300px;
    animation: twinkle 3s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 1;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 0.8; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px 20px 20px; /* Reduced top padding */
    position: relative;
    z-index: 2;
    min-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    /* Prevent container from causing initial scroll offset */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.filter-title {
    text-align: center;
    margin: 20px 0 15px 0;
    font-size: 1.2rem;
    font-weight: 500;
    opacity: 0.8;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ======= Sports Navigation ======= */
.sports-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Make navigation sticky */
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

/* Enhanced sticky nav when scrolled */
.sports-nav.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
}

.sport-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.sport-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,255,255,0.1);
}

.sport-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.refresh-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: white;
    flex-wrap: wrap;
    gap: 10px;
}

.left-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-games-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.all-close-games-btn {
    position: relative;
    margin: 0 auto;
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.9), rgba(255, 142, 83, 0.9));
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.8px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    z-index: 1;
    display: block;
    backdrop-filter: blur(10px);
    text-transform: uppercase;
    overflow: hidden;
}

.all-close-games-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.all-close-games-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 1), rgba(255, 142, 83, 1));
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 107, 107, 0.5);
}

.all-close-games-btn:hover::before {
    left: 100%;
}

.all-close-games-btn.active {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9), rgba(139, 195, 74, 0.9));
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.4);
    border-color: rgba(76, 175, 80, 0.5);
}

.all-close-games-btn.active:hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 1), rgba(139, 195, 74, 1));
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.6);
}

.upcoming-games-btn {
    background: rgba(135, 206, 250, 0.8);
    border: none;
    color: #333;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.upcoming-games-btn:hover {
    background: rgba(135, 206, 250, 1);
    transform: scale(1.05);
}

.upcoming-games-btn.active {
    background: #87ceeb;
    box-shadow: 0 2px 8px rgba(135, 206, 250, 0.4);
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255,255,255,0.1);
}

.grid-layout-selector {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 5px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.grid-option {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 8px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-option:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

.grid-option.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4) !important;
    transform: scale(1.05);
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
    animation: activePulse 2s ease-in-out infinite;
}

@keyframes activePulse {
    0%, 100% { 
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    }
    50% { 
        box-shadow: 0 2px 12px rgba(102, 126, 234, 0.6);
    }
}

.grid-icon {
    font-size: 14px;
    line-height: 1;
    letter-spacing: 1px;
}

.grid-1 {
    font-size: 16px;
}

.grid-2 {
    font-size: 14px;
    letter-spacing: 2px;
}

.grid-3 {
    font-size: 12px;
    letter-spacing: 3px;
}

.grid-4 {
    font-size: 11px;
    letter-spacing: 4px;
}

.last-updated {
    font-size: 0.9rem;
    opacity: 0.8;
}

.loading {
    text-align: center;
    color: white;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: rgba(255, 59, 48, 0.9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.games-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    transition: all 0.3s ease;
}

/* Grid Layout Options */
.games-container.layout-compact {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.games-container.layout-tight {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.games-container.layout-dense {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.game-card {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, padding 0.3s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
}

/* Compact Layout - Slightly smaller cards */
.layout-compact .game-card {
    padding: 18px;
}

.layout-compact .team-logo {
    width: 36px;
    height: 36px;
}

.layout-compact .team-name {
    font-size: 1rem;
}

.layout-compact .team-score {
    font-size: 1.4rem;
}

.layout-compact .game-status {
    margin-bottom: 12px;
}

.layout-compact .teams {
    gap: 12px;
}

.layout-compact .game-details {
    margin-top: 12px;
    padding-top: 12px;
}

.layout-compact .game-time-header {
    margin-bottom: 6px;
    padding: 3px 6px;
}

.layout-compact .game-time-header .game-time {
    font-size: 0.75rem;
}

/* Tight Layout - Smaller cards */
.layout-tight .game-card {
    padding: 15px;
}

.layout-tight .team-logo {
    width: 32px;
    height: 32px;
}

.layout-tight .team-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.layout-tight .team-score {
    font-size: 1.3rem;
}

.layout-tight .game-status {
    margin-bottom: 10px;
}

.layout-tight .teams {
    gap: 10px;
}

.layout-tight .game-details {
    margin-top: 10px;
    padding-top: 10px;
    font-size: 0.8rem;
    justify-content: center; /* Center the single piece of info */
}

.layout-tight .game-details span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px; /* Allow more width since we only have one item */
    display: inline-block;
    text-align: center;
}

.layout-tight .click-indicator span {
    font-size: 0.75rem;
}

.layout-tight .game-time-header {
    margin-bottom: 5px;
    padding: 2px 5px;
}

.layout-tight .game-time-header .game-time {
    font-size: 0.7rem;
}

/* Dense Layout - Very compact cards */
.layout-dense .game-card {
    padding: 10px;
}

.layout-dense .team-logo {
    width: 26px;
    height: 26px;
}

.layout-dense .team-name {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.layout-dense .team-score {
    font-size: 1.1rem;
}

.layout-dense .game-status {
    margin-bottom: 6px;
}

.layout-dense .teams {
    gap: 6px;
}

.layout-dense .game-details {
    margin-top: 6px;
    padding-top: 6px;
    font-size: 0.7rem;
    justify-content: center; /* Center the single piece of info */
}

.layout-dense .game-details span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px; /* Allow more width since we only have one item */
    display: inline-block;
    text-align: center;
}

.layout-dense .click-indicator span {
    font-size: 0.65rem;
}

.layout-dense .hide-score-btn {
    font-size: 0.55rem;
    padding: 2px 5px;
    min-width: 55px;
    min-height: 18px;
}

.layout-dense .game-time-header {
    margin-bottom: 4px;
    padding: 2px 4px;
}

.layout-dense .game-time-header .game-time {
    font-size: 0.65rem;
}

/* Add extra padding when hide score button is present */
.game-card:has(.hide-score-btn) {
    padding-top: 35px;
}

/* Fallback for browsers that don't support :has() */
.game-card[data-has-hide-button="true"] {
    padding-top: 35px;
}

.team-colors-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.08;
    pointer-events: none;
    border-radius: 15px;
    z-index: 1;
}

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

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
}

.game-card:hover .team-colors-overlay {
    opacity: 0.15;
}

.game-card.live-game {
    border: 2px solid #ff3b30;
    box-shadow: 
        0 8px 32px rgba(255, 59, 48, 0.15),
        0 0 0 1px rgba(255, 59, 48, 0.2),
        0 0 10px rgba(255, 59, 48, 0.3),
        0 0 20px rgba(255, 59, 48, 0.1);
    animation: subtleRedGlow 2.5s ease-in-out infinite;
}

.game-card.live-game:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 15px 40px rgba(255, 59, 48, 0.25),
        0 0 0 1px rgba(255, 59, 48, 0.3),
        0 0 15px rgba(255, 59, 48, 0.4),
        0 0 30px rgba(255, 59, 48, 0.15);
}

@keyframes subtleRedGlow {
    0%, 100% { 
        box-shadow: 
            0 8px 32px rgba(255, 59, 48, 0.15),
            0 0 0 1px rgba(255, 59, 48, 0.2),
            0 0 10px rgba(255, 59, 48, 0.3),
            0 0 20px rgba(255, 59, 48, 0.1);
        border-color: rgba(255, 59, 48, 0.8);
    }
    50% { 
        box-shadow: 
            0 8px 32px rgba(255, 59, 48, 0.2),
            0 0 0 1px rgba(255, 59, 48, 0.3),
            0 0 15px rgba(255, 59, 48, 0.5),
            0 0 25px rgba(255, 59, 48, 0.2);
        border-color: rgba(255, 59, 48, 1);
    }
}

.game-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.league-badge {
    background: #007AFF;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.live-indicator {
    display: inline-block;
    animation: livePulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 3px rgba(255, 59, 48, 0.8));
}

@keyframes livePulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.game-time {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

.teams {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.team-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0; /* Allow flex items to shrink below content size */
}

.team-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f0f0;
}

.team-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    min-width: 0; /* Allow text to shrink */
    flex: 1; /* Take available space */
}

.team-record {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 2px;
}

.team-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
}

.game-details {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    gap: 8px; /* Add gap between venue and progress */
}

.no-games {
    text-align: center;
    color: white;
    padding: 60px 20px;
}

.no-games p {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.sub-text {
    font-size: 1rem;
    opacity: 0.8;
}

/* Help Button Styles */
.help-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-size: 14px;
    margin-left: 10px;
}

.help-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,255,255,0.1);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    color: white;
    font-size: 1.8rem;
    margin: 0;
    font-weight: 600;
}

.close-modal {
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s ease;
    padding: 5px;
    border-radius: 50%;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px 30px 30px;
    color: white;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
}

.modal-intro {
    font-size: 1.1rem;
    margin-bottom: 25px;
    opacity: 0.9;
    line-height: 1.6;
}

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.criteria-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    transition: all 0.3s ease;
}

.criteria-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.criteria-item h3 {
    font-size: 1.3rem;
    margin-bottom: 12px;
    color: #fff;
    font-weight: 600;
}

.criteria-item p {
    margin-bottom: 8px;
    opacity: 0.9;
    line-height: 1.5;
}

.criteria-item p strong {
    color: #fff;
    font-weight: 600;
}

.modal-note {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.modal-note p {
    margin: 0;
    color: #ffc107;
    font-weight: 500;
    line-height: 1.6;
}

/* Responsive Design for Modal */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .games-container {
        grid-template-columns: 1fr;
    }
    
    /* Mobile grid layouts - maintain ascending grid system */
    .games-container.layout-compact {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .games-container.layout-tight {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .games-container.layout-dense {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    
    /* Mobile game time header adjustments */
    .game-time-header {
        margin-bottom: 6px;
        padding: 3px 6px;
    }
    
    .game-time-header .game-time {
        font-size: 0.75rem;
    }
    
    .sports-nav {
        gap: 8px;
    }
    
    .sport-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .refresh-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .left-controls {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .grid-layout-selector {
        gap: 3px;
        padding: 3px;
    }
    
    .grid-option {
        padding: 6px 8px;
        min-width: 35px;
    }
    
    .grid-icon {
        font-size: 12px;
    }
    
    .grid-1 {
        font-size: 14px;
    }
    
    .grid-2 {
        font-size: 12px;
        letter-spacing: 1px;
    }
    
    .grid-3 {
        font-size: 10px;
        letter-spacing: 2px;
    }
    
    .grid-4 {
        font-size: 9px;
        letter-spacing: 3px;
    }

    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 20px 20px 15px;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 20px;
        max-height: calc(90vh - 100px);
    }
    
    .criteria-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .criteria-item {
        padding: 15px;
    }
}

/* Tablet and Desktop - Restore full game details and improve grid layouts for 3 and 4 grid layouts */
@media (min-width: 769px) {
    /* Improve grid layouts for larger screens - show more cards */
    .games-container.layout-compact {
        grid-template-columns: repeat(3, 1fr); /* Show 3 cards instead of 2 */
        gap: 20px;
    }
    
    .games-container.layout-tight {
        grid-template-columns: repeat(5, 1fr); /* Show 5 cards instead of 3 */
        gap: 18px;
    }
    
    .games-container.layout-dense {
        grid-template-columns: repeat(7, 1fr); /* Show 7 cards instead of 4 */
        gap: 15px;
    }
    
    /* Simplified content for tight layout (5 cards) on larger screens - prevent overlapping */
    .layout-tight .game-details {
        margin-top: 12px;
        padding-top: 12px;
        font-size: 0.85rem;
        justify-content: center; /* Center the single piece of info */
        display: flex;
    }
    
    .layout-tight .game-details span {
        white-space: nowrap; /* Prevent text wrapping */
        overflow: hidden; /* Hide overflow */
        text-overflow: ellipsis; /* Show ellipsis */
        max-width: 100%; /* Use full width */
        display: block; /* Block display for centering */
        text-align: center; /* Center the text */
    }
    
    /* Simplified content for dense layout (7 cards) on larger screens - prevent overlapping */
    .layout-dense .game-details {
        margin-top: 10px;
        padding-top: 10px;
        font-size: 0.8rem;
        justify-content: center; /* Center the single piece of info */
        display: flex;
    }
    
    .layout-dense .game-details span {
        white-space: nowrap; /* Prevent text wrapping */
        overflow: hidden; /* Hide overflow */
        text-overflow: ellipsis; /* Show ellipsis */
        max-width: 100%; /* Use full width */
        display: block; /* Block display for centering */
        text-align: center; /* Center the text */
    }
    
    /* Optimize team logos for space efficiency */
    .layout-tight .team-logo {
        width: 32px;
        height: 32px;
    }
    
    .layout-dense .team-logo {
        width: 28px;
        height: 28px;
    }
    
    /* Hide team names and records to save space and prevent overlapping */
    .layout-tight .team-name,
    .layout-tight .team-record {
        display: none;
    }
    
    .layout-dense .team-name,
    .layout-dense .team-record {
        display: none;
    }
    
    /* Optimize scores for better fit */
    .layout-tight .team-score {
        font-size: 1.3rem;
    }
    
    .layout-dense .team-score {
        font-size: 1.1rem;
    }
    
    /* Optimize card padding for space efficiency */
    .layout-tight .game-card {
        padding: 16px;
    }
    
    .layout-dense .game-card {
        padding: 14px;
    }
    
    /* Optimize spacing between elements */
    .layout-tight .teams {
        gap: 10px;
    }
    
    .layout-dense .teams {
        gap: 8px;
    }
    
    .layout-tight .game-status {
        margin-bottom: 10px;
    }
    
    .layout-dense .game-status {
        margin-bottom: 8px;
    }
    
    /* Optimize team info spacing */
    .layout-tight .team-info {
        gap: 8px;
    }
    
    .layout-dense .team-info {
        gap: 6px;
    }
}

/* Large Desktop - Further enhance grid layouts and show even more cards */
@media (min-width: 1024px) {
    /* Show even more cards on very large screens */
    .games-container.layout-compact {
        grid-template-columns: repeat(4, 1fr); /* Show 4 cards on large desktops */
        gap: 22px;
    }
    
    .games-container.layout-tight {
        grid-template-columns: repeat(6, 1fr); /* Show 6 cards on large desktops */
        gap: 20px;
    }
    
    .games-container.layout-dense {
        grid-template-columns: repeat(8, 1fr); /* Show 8 cards on large desktops */
        gap: 18px;
    }
    
    /* Simplified content for large desktop - prevent overlapping */
    .layout-tight .game-details {
        font-size: 0.9rem;
    }
    
    .layout-dense .game-details {
        font-size: 0.85rem;
    }
    
    /* Keep team names hidden to save space */
    .layout-tight .team-name,
    .layout-tight .team-record {
        display: none;
    }
    
    .layout-dense .team-name,
    .layout-dense .team-record {
        display: none;
    }
    
    .layout-tight .team-logo {
        width: 34px;
        height: 34px;
    }
    
    .layout-dense .team-logo {
        width: 30px;
        height: 30px;
    }
    
    .layout-tight .team-score {
        font-size: 1.4rem;
    }
    
    .layout-dense .team-score {
        font-size: 1.2rem;
    }
}

/* Extra Large Desktop - Maximum card density for ultrawide screens */
@media (min-width: 1440px) {
    /* Show maximum number of cards on ultrawide screens */
    .games-container.layout-compact {
        grid-template-columns: repeat(5, 1fr); /* Show 5 cards on ultrawide */
        gap: 25px;
    }
    
    .games-container.layout-tight {
        grid-template-columns: repeat(8, 1fr); /* Show 8 cards on ultrawide */
        gap: 22px;
    }
    
    .games-container.layout-dense {
        grid-template-columns: repeat(10, 1fr); /* Show 10 cards on ultrawide */
        gap: 20px;
    }
    
    /* Optimize card sizing for maximum density */
    .layout-tight .game-card {
        padding: 14px;
    }
    
    .layout-dense .game-card {
        padding: 12px;
    }
    
    /* Keep team names hidden for maximum density */
    .layout-tight .team-name,
    .layout-tight .team-record {
        display: none;
    }
    
    .layout-dense .team-name,
    .layout-dense .team-record {
        display: none;
    }
    
    .layout-tight .team-logo {
        width: 32px;
        height: 32px;
    }
    
    .layout-dense .team-logo {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .game-card {
        padding: 15px;
    }
    
    .team-name {
        font-size: 1rem;
    }
    
    .team-score {
        font-size: 1.3rem;
    }
    
    /* Very small screen grid layouts - maintain ascending grid system */
    .games-container.layout-compact {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .games-container.layout-tight {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .games-container.layout-dense {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }
    
    /* Very small screen game time header adjustments */
    .game-time-header {
        margin-bottom: 4px;
        padding: 2px 4px;
    }
    
    .game-time-header .game-time {
        font-size: 0.7rem;
    }
    
    /* Adjust button sizes for very small screens */
    .grid-layout-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    /* Optimize dense layout for 4-card visibility on very small screens */
    .layout-dense .game-card {
        padding: 8px;
    }
    
    .layout-dense .team-logo {
        width: 24px;
        height: 24px;
    }
    
    .layout-dense .team-name {
        font-size: 0.75rem;
    }
    
    .layout-dense .team-score {
        font-size: 1rem;
    }
    
    .layout-dense .game-status {
        margin-bottom: 4px;
    }
    
    .layout-dense .teams {
        gap: 4px;
    }
    
    .layout-dense .game-details {
        margin-top: 4px;
        padding-top: 4px;
        font-size: 0.65rem;
    }
    
    .layout-dense .click-indicator span {
        font-size: 0.6rem;
    }
    
    .layout-dense .hide-score-btn {
        font-size: 0.5rem;
        padding: 1px 4px;
        min-width: 50px;
        min-height: 16px;
    }
}

/* Additional optimization for dense layout on medium screens */
@media (max-width: 600px) {
    .games-container.layout-dense {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }
    
    .layout-dense .game-card {
        padding: 9px;
    }
    
    .layout-dense .team-logo {
        width: 25px;
        height: 25px;
    }
    
    .layout-dense .team-name {
        font-size: 0.78rem;
    }
    
    .layout-dense .team-score {
        font-size: 1.05rem;
    }
    
    .layout-dense .game-time-header {
        margin-bottom: 3px;
        padding: 2px 3px;
    }
    
    .layout-dense .game-time-header .game-time {
        font-size: 0.6rem;
    }
} 

/* Clickable Game Card Styles */
.clickable-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.clickable-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    background: rgba(255, 255, 255, 0.95);
}

.clickable-card:hover .team-colors-overlay {
    opacity: 0.2;
}

.clickable-card:active {
    transform: translateY(-2px);
}

/* Click Indicator */
.click-indicator {
    text-align: center;
    padding: 10px 15px 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 10px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.click-indicator span {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.clickable-card:hover .click-indicator {
    opacity: 1;
}

.clickable-card:hover .click-indicator span {
    color: #fff;
    font-weight: 500;
}

/* Add pointer cursor to team logos and scores for better UX */
.clickable-card .team-logo,
.clickable-card .team-score,
.clickable-card .team-name {
    pointer-events: none; /* Prevent event bubbling issues */
}

/* Mobile responsiveness for click indicator */
@media (max-width: 768px) {
    .click-indicator span {
        font-size: 0.8rem;
    }
} 

/* Game Details Modal Styles */
.game-modal {
    z-index: 1001; /* Higher than regular modal */
}

.game-modal-content {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    max-height: 90vh;
    margin: 2.5vh auto;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
}

.game-modal-header {
    padding: 15px 20px;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

.game-modal-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.open-espn-btn {
    background: #ff3b30;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.open-espn-btn:hover {
    background: #e6342a;
    transform: translateY(-1px);
}

.game-close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.game-close-modal:hover {
    color: #ff3b30;
}

.game-modal-body {
    padding: 20px;
    height: calc(90vh - 70px);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Game Details Content Styles */
.game-details-content {
    color: white;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.game-details-header {
    margin-bottom: 30px;
    flex-shrink: 0;
}

.team-matchup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.team-detail {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.team-detail.home {
    flex-direction: row-reverse;
    text-align: right;
}

.team-logo-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.team-info-large h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.team-record-large {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

.team-score-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
}

.vs-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 20px;
}

.game-status-large {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.game-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.game-info p {
    margin: 5px 0;
    font-size: 0.95rem;
}

/* Scoring Section */
.scoring-section, .stats-section, .leaders-section {
    margin: 25px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.scoring-section h3, .stats-section h3, .leaders-section h3 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

.scoring-table, .stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.scoring-table th, .scoring-table td, 
.stats-table th, .stats-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    vertical-align: middle;
}

.scoring-table th, .stats-table th {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: #fff;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.team-name-cell, .stat-name {
    font-weight: 600;
    color: #fff;
    text-align: left;
    padding-left: 20px;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.stats-table .stat-name {
    text-align: center;
    padding-left: 15px;
    max-width: 180px;
    font-size: 0.85rem;
    color: #e0e0e0;
    font-weight: 500;
}

.total-score {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

.stats-table td:first-child,
.stats-table td:last-child {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
}

/* Leaders Section */
.leader-category {
    margin-bottom: 20px;
}

.leader-category h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

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

.leader-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leader-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-headshot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.player-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
}

.player-team {
    font-size: 0.8rem;
    opacity: 0.8;
    color: #ccc;
}

.leader-stat {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

/* ESPN Link Section */
.espn-link-section {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.full-espn-btn {
    background: #ff3b30;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.3);
}

.full-espn-btn:hover {
    background: #e6342a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 59, 48, 0.4);
}

.game-details-error {
    text-align: center;
    color: #ff6b6b;
    font-size: 1.1rem;
    padding: 40px 20px;
}

/* Responsive design for game details */
@media (max-width: 768px) {
    .game-modal-content {
        width: 98%;
        height: 95vh;
        margin: 2.5vh auto;
    }
    
    .game-modal-header {
        padding: 12px 15px;
    }
    
    .open-espn-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .game-modal-body {
        height: calc(95vh - 60px);
        padding: 15px;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .team-matchup {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .team-detail {
        flex-direction: column;
        text-align: center;
    }
    
    .team-detail.home {
        flex-direction: column;
        text-align: center;
    }
    
    .vs-divider {
        order: 2;
    }
    
    .team-score-large {
        font-size: 2rem;
    }
    
    .scoring-table th, .scoring-table td,
    .stats-table th, .stats-table td {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .stats-table .stat-name {
        font-size: 0.75rem;
        max-width: 120px;
        padding-left: 10px;
    }
    
    .team-name-cell {
        font-size: 0.8rem;
        padding-left: 12px;
        max-width: 80px;
    }
    
    .stats-table td:first-child,
    .stats-table td:last-child {
        font-size: 0.85rem;
    }
    
    .leaders-grid {
        grid-template-columns: 1fr;
    }
}

/* Animation for modal appearance */
.game-modal {
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
} 

/* PWA Install Banner Styles */
.pwa-install-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideDown 0.3s ease-out;
    /* Hide banner when app is installed as PWA */
    display: none !important;
}

/* Hide PWA banner when running in standalone mode */
@media (display-mode: standalone) {
    .pwa-install-banner {
        display: none !important;
    }
}

/* Hide PWA banner when running in fullscreen mode */
@media (display-mode: fullscreen) {
    .pwa-install-banner {
        display: none !important;
    }
}

/* Hide PWA banner on iOS when added to home screen */
@media (display-mode: standalone) and (-webkit-touch-callout: default) {
    .pwa-install-banner {
        display: none !important;
    }
} 

/* Game time header - displays above hide score button */
.game-time-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-time-header .game-time {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Score hiding button styles */
.hide-score-btn {
    position: relative;
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 4px 8px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    text-align: center;
    min-width: 70px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    margin: 0;
    flex-shrink: 0;
}

.hide-score-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hide-score-btn:active {
    transform: scale(0.95);
}

/* Ensure proper spacing for game cards with hide buttons */
.game-card .game-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Adjust hide score button positioning for different layouts */
.layout-compact .hide-score-btn {
    font-size: 0.65rem;
    padding: 6px 10px;
    min-width: 80px;
    min-height: 28px;
}

.layout-tight .hide-score-btn {
    font-size: 0.6rem;
    padding: 5px 8px;
    min-width: 75px;
    min-height: 26px;
}

.layout-dense .hide-score-btn {
    font-size: 0.55rem;
    padding: 4px 6px;
    min-width: 70px;
    min-height: 22px;
}

/* Enhanced game scores styling for better visibility */
.game-scores {
    transition: all 0.3s ease;
}

/* Responsive adjustments for hide score button */
@media (max-width: 768px) {
    .hide-score-btn {
        font-size: 0.7rem;
        padding: 8px 12px;
        min-width: 90px;
        min-height: 36px;
        top: 10px;
        right: 10px;
        border-radius: 18px;
    }
    
    /* Adjust game card padding for mobile */
    .game-card:has(.hide-score-btn),
    .game-card[data-has-hide-button="true"] {
        padding-top: 30px;
    }
}

@media (max-width: 480px) {
    .hide-score-btn {
        font-size: 0.65rem;
        padding: 10px 14px;
        min-width: 95px;
        min-height: 40px;
        top: 8px;
        right: 8px;
        border-radius: 20px;
        font-weight: 700;
    }
    
    /* Adjust game card padding for small mobile */
    .game-card:has(.hide-score-btn),
    .game-card[data-has-hide-button="true"] {
        padding-top: 30px;
        padding-left: 15px;
        padding-right: 15px;
    }
} 

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
    color: #0f3460;
}

.back-to-top:active {
    transform: translateY(-1px);
}

/* Mobile adjustments for back to top button */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
} 