/**
 * NHL Fan League - Main Stylesheet
 * 
 * Organization:
 * 1. Design Tokens (colors, spacing, typography)
 * 2. Utility Classes (spacing, layout, typography)
 * 3. Base Styles (reset, typography, body)
 * 4. Component Styles (buttons, cards, navigation, etc.)
 */

/* ========================================
   1. DESIGN TOKENS
   Import design tokens first for consistent theming
   ======================================== */
@import url('./design-tokens.css');

/* ========================================
   2. UTILITY CLASSES
   Atomic utility classes for rapid development
   ======================================== */
@import url('./utilities.css');

/* ========================================
   3. FONTS
   Import Modern Sans-Serif Font
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

/* ========================================
   4. BASE STYLES
   ======================================== */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    padding-bottom: 80px; /* Space for bottom nav */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent text size adjustment on mobile */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Enable momentum scrolling on iOS */
    -webkit-overflow-scrolling: touch;
}

/* ========================================
   5. TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    margin-top: 0;
}

h1 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 0.6rem;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

/* ========================================
   6. LAYOUT & CONTAINERS
   ======================================== */

/* Container */
.app-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 100px; /* Extra space for bottom nav on mobile */
}

@media (min-width: 768px) {
    .app-container {
        max-width: 1200px;
        padding: 2rem;
        padding-bottom: 2rem; /* No bottom nav on desktop */
    }
}

/* ========================================
   7. NAVIGATION COMPONENTS
   ======================================== */

/* Fixed Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 70px;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    /* Prevent layout shift */
    will-change: transform;
    /* Add backdrop blur for modern look on supported devices */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(26, 37, 58, 0.95);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: var(--min-touch-target);
    min-width: var(--min-touch-target);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    background: none;
    padding: 8px;
    /* Improve tap highlight */
    -webkit-tap-highlight-color: rgba(33, 209, 159, 0.15);
    tap-highlight-color: rgba(33, 209, 159, 0.15);
    /* Prevent text selection on double tap */
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

.nav-item:hover,
.nav-item:focus {
    color: var(--text-primary);
    outline: none;
    transform: translateY(-1px);
}

.nav-item:active {
    transform: translateY(0);
    color: var(--accent-green);
}

.nav-item:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: -2px;
}

.nav-item.active {
    color: var(--accent-green);
    position: relative;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background-color: var(--accent-green);
    border-radius: 2px 2px 0 0;
}

.nav-item-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.nav-item-label {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Tab Content Sections */
.tab-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-section.active {
    display: block;
}

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

/* Card System */
.card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    /* Prevent tappable elements from flickering on iOS */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

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

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

.card-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Horizontal Scrolling Carousel */
/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--bg-card) 0%, #2a3a52 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem;
    margin-bottom: 0.85rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Add animated gradient overlay */
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(33, 209, 159, 0.05) 0%, transparent 70%);
    animation: rotateGradient 20s linear infinite;
    pointer-events: none;
}

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

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    position: relative;
    z-index: 1;
}

.hero-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.hero-fan-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    text-shadow: 0 2px 8px rgba(33, 209, 159, 0.3);
}

.hero-team-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.hero-stats-row {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-green);
}

.hero-stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.15rem;
}

/* Top 3 Leaders - Compact Layout */
.leaders-compact-card {
    background: rgba(26, 37, 58, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 0.7rem;
    margin-bottom: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.leader-compact-item {
    background: rgba(26, 37, 58, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    position: relative;
    transition: all 0.3s ease;
}

.leader-compact-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(33, 209, 159, 0.2);
    border-color: rgba(33, 209, 159, 0.3);
}

.leader-compact-item.leader-first {
    border-color: rgba(33, 209, 159, 0.4);
    background: linear-gradient(135deg, rgba(33, 209, 159, 0.08) 0%, rgba(26, 37, 58, 0.5) 100%);
    box-shadow: 0 0 24px rgba(33, 209, 159, 0.15);
}

.leader-rank-badge {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.35rem 0.6rem;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.leader-rank-badge.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
    color: #FFD700;
}

.leader-rank-badge.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.1));
    color: #C0C0C0;
}

.leader-rank-badge.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.1));
    color: #CD7F32;
}

.rank-emoji {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.rank-text {
    font-weight: 800;
    letter-spacing: 0.5px;
}

.leader-identity {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-right: 4rem; /* Space for rank badge */
}

.leader-fan-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.leader-team-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.leader-achievement {
    font-size: 0.7rem;
    color: var(--accent-green);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.1rem;
}

.leader-stats-inline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(42, 58, 82, 0.3);
}

.leader-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.leader-stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.leader-stat-label {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Desktop: Side-by-side leaders */
@media (min-width: 768px) {
    .leaders-compact-card {
        flex-direction: row;
        gap: 0.85rem;
        padding: 1rem;
    }
    
    .leader-compact-item {
        flex: 1;
        min-width: 0; /* Allow flex items to shrink */
    }
    
    .leader-fan-name {
        font-size: 1.2rem;
    }
    
    .leader-stat-value {
        font-size: 1rem;
    }
}

/* Featured Matchup */
.featured-matchup {
    margin-bottom: 1.25rem;
    position: relative;
}

.featured-matchup::before {
    content: '';
    position: absolute;
    top: -10px;
    right: -10px;
    width: 3rem;
    height: 3rem;
    background: var(--color-accent-primary);
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='currentColor' d='M14.616 1.9a1.371 1.371 0 0 1 2.468 1.2l-2.098 4.312h4.789a1.371 1.371 0 0 1 1.052 2.25l-10.5 12.6a1.371 1.371 0 0 1-2.468-1.2l2.098-4.312H5.168a1.371 1.371 0 0 1-1.052-2.25z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='currentColor' d='M14.616 1.9a1.371 1.371 0 0 1 2.468 1.2l-2.098 4.312h4.789a1.371 1.371 0 0 1 1.052 2.25l-10.5 12.6a1.371 1.371 0 0 1-2.468-1.2l2.098-4.312H5.168a1.371 1.371 0 0 1-1.052-2.25z'/%3E%3C/svg%3E");
    mask-size: contain;
    -webkit-mask-size: contain;
    opacity: 0.1;
    animation: rotate 10s linear infinite;
    pointer-events: none;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.featured-matchup-time {
    background: linear-gradient(90deg, rgba(41, 128, 185, 0.15) 0%, rgba(41, 128, 185, 0.05) 100%);
    border-left: 3px solid var(--accent-blue);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.time-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    animation: swing 2s ease-in-out infinite;
}

@keyframes swing {
    0%, 100% {
        transform: rotate(-10deg);
    }
    50% {
        transform: rotate(10deg);
    }
}

.time-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.featured-matchup-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 37, 58, 0.95) 100%);
    border: 1px solid rgba(33, 209, 159, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(33, 209, 159, 0.1);
}

/* Add battle arena effect */
.featured-matchup-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--accent-green) 50%, transparent 100%);
    animation: shimmerBar 2s linear infinite;
}

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

.featured-team-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    transition: all 0.3s ease;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

.featured-team-logo:hover {
    transform: scale(1.15) rotate(-5deg);
    filter: drop-shadow(0 4px 12px rgba(33, 209, 159, 0.4));
}

.featured-fallback {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.featured-team-info {
    text-align: center;
}

.featured-fan-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.featured-team-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.featured-record {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.featured-achievement {
    background: linear-gradient(135deg, rgba(33, 209, 159, 0.2) 0%, rgba(41, 128, 185, 0.2) 100%);
    border: 1px solid rgba(33, 209, 159, 0.4);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(33, 209, 159, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(33, 209, 159, 0.5);
    }
}

.achievement-emoji {
    font-size: 0.85rem;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.achievement-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.featured-vs {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(11, 22, 42, 0.8) 100%);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 20px rgba(33, 209, 159, 0.2);
    animation: pulse 2s ease-in-out infinite;
    border: 2px solid rgba(33, 209, 159, 0.3);
}

.voting-placeholder {
    background: linear-gradient(135deg, rgba(33, 209, 159, 0.1) 0%, rgba(41, 128, 185, 0.1) 100%);
    border: 2px dashed var(--accent-green);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    animation: fadeIn 1s ease-in-out;
}

.voting-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-green);
    animation: pulse 2s ease-in-out infinite;
}

/* Dense Featured Matchup Layout */
.featured-matchup-card-dense {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 37, 58, 0.95) 100%);
    border: 1px solid rgba(33, 209, 159, 0.2);
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(33, 209, 159, 0.1);
}

.featured-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.featured-time-compact {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(41, 128, 185, 0.15);
    border-left: 2px solid var(--accent-blue);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.featured-time-compact .time-icon {
    font-size: 0.9rem;
}

.featured-prediction-compact {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(33, 209, 159, 0.15);
    border-left: 2px solid var(--accent-green);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-green);
}

.featured-teams-dense {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.featured-team-dense {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.featured-team-header-dense {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.featured-logo-dense {
    width: 48px;
    height: 48px;
    object-fit: contain;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    flex-shrink: 0;
}

.featured-logo-dense:hover {
    transform: scale(1.1);
}

.logo-fallback-dense {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.featured-team-identity {
    flex: 1;
    min-width: 0;
}

.featured-fan-name-dense {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.featured-team-name-dense {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.featured-badge-dense {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, rgba(33, 209, 159, 0.15) 0%, rgba(41, 128, 185, 0.15) 100%);
    border: 1px solid rgba(33, 209, 159, 0.3);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    white-space: nowrap;
}

.featured-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.stat-item-dense {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-value-dense {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}

.stat-label-dense {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.featured-vs-dense {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--accent-green);
    padding: 0 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.featured-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.info-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.info-icon {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.info-text {
    color: var(--text-secondary);
    font-weight: 500;
}

.rivalry-badge {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.2) 0%, rgba(192, 57, 43, 0.2) 100%);
    border: 1px solid rgba(231, 76, 60, 0.4);
}

.rivalry-badge .info-text {
    color: #e74c3c;
    font-weight: 600;
}

/* Section Headings */
.section-heading {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.section-heading::before {
    content: '';
    width: 3px;
    height: 1.2rem;
    background: linear-gradient(180deg, var(--accent-green), var(--accent-blue));
    border-radius: 2px;
}

.section-heading:first-of-type {
    margin-top: 0;
}

/* Stats Grid (replaces horizontal carousel) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
    margin-bottom: 0.9rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* On smaller screens, make even more compact */
@media (max-width: 360px) {
    .stats-grid {
        gap: 0.4rem;
    }
}

.carousel-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    margin: 0 -1rem 1.5rem;
    padding: 0 1rem;
}

.carousel-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.carousel {
    display: flex;
    gap: 1rem;
    padding-bottom: 0.5rem;
    min-height: 160px; /* Prevent collapse */
}

.stat-card-square {
    flex: 0 0 95px;
    width: 95px;
    height: 95px;
    background: rgba(26, 37, 58, 0.35);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    padding: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
    -webkit-tap-highlight-color: rgba(33, 209, 159, 0.1);
    tap-highlight-color: rgba(33, 209, 159, 0.1);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Add gradient overlay for visual depth */
.stat-card-square::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(33, 209, 159, 0.03) 0%, transparent 50%, rgba(33, 209, 159, 0.01) 100%);
    pointer-events: none;
    z-index: 0;
}

/* Add subtle shimmer effect */
.stat-card-square::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(33, 209, 159, 0.03) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card-square:hover::after {
    opacity: 1;
}

.stat-card-square:hover {
    transform: scale(1.08) translateY(-6px);
    box-shadow: 0 12px 30px rgba(33, 209, 159, 0.25), 0 8px 20px rgba(0, 0, 0, 0.45);
    border-color: rgba(33, 209, 159, 0.5);
}

.stat-card-square:active {
    transform: scale(1.02);
}

.stat-emoji {
    font-size: 1.6rem;
    margin-bottom: 0.35rem;
    line-height: 1;
    flex-shrink: 0;
    animation: float 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent-primary);
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    line-height: 1.1;
    flex-shrink: 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-green);
    margin-bottom: 0.2rem;
    line-height: 1.2;
    word-break: break-word;
    max-width: 100%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 3px rgba(33, 209, 159, 0.3);
}

.stat-fan-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    word-break: break-word;
    max-width: 100%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Achievement Cards - Expandable */
.achievement-card {
    position: relative;
    overflow: hidden;
}

.achievement-card.expandable {
    padding-bottom: 1.75rem; /* Space for expand button */
    cursor: pointer;
    user-select: none;
}

.achievement-card.expandable:focus {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

.achievement-card.expanded {
    height: auto;
    min-height: 140px;
    padding: 1rem;
    overflow: hidden;
    z-index: 10;
}

.achievement-entries {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.achievement-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 1;
    word-break: break-word;
    max-width: 100%;
}

.achievement-entry.hidden {
    display: none;
}

.achievement-card.expanded .achievement-entry {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.achievement-card.expanded .achievement-entry:last-child {
    border-bottom: none;
}

.achievement-rank {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.expand-toggle {
    position: absolute;
    bottom: 0.25rem;
    left: 50%;
    transform: translateX(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    transition: all 0.2s ease;
    z-index: 1;
}

.expand-toggle:hover {
    color: var(--text-primary);
}

.expand-toggle:focus {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

.expand-icon {
    display: inline-block;
    font-size: 0.6rem;
    transition: transform 0.3s ease;
}

/* Matchup Cards - Compact Design */
.matchup-card {
    background: rgba(26, 37, 58, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 14px;
    padding: 0.6rem;
    margin-bottom: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Add battle-themed gradient overlay */
.matchup-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-green) 50%, var(--accent-blue) 100%);
    background-size: 200% 100%;
    animation: shimmerBar 3s linear infinite;
}

@keyframes shimmerBar {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.matchup-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 32px rgba(33, 209, 159, 0.2), 0 4px 16px rgba(0, 0, 0, 0.4);
    border-color: rgba(33, 209, 159, 0.4);
}

/* Compact team header with logos side by side */
.matchup-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(42, 58, 82, 0.5);
}

.matchup-team {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0; /* Allow flex children to shrink */
}

.matchup-team > div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    flex: 1;
}

.team-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    flex-shrink: 0;
}

.team-logo:hover {
    transform: scale(1.1) rotate(5deg);
}

.team-logo-fallback {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-card-hover);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.65rem;
    color: var(--text-primary);
    flex-shrink: 0;
}

.matchup-team-name {
    font-weight: 700;
    font-size: 0.8rem;
    display: none; /* Hide on mobile for compact design */
}

.matchup-fan-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matchup-vs {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #1e5c87 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.7rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(41, 128, 185, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

/* Stats grid - compact 2 column layout */
.matchup-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    font-size: 0.75rem;
}

.matchup-stat {
    display: flex;
    flex-direction: column;
    background: rgba(11, 22, 42, 0.4);
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
    border-left: 2px solid var(--accent-blue);
}

.matchup-stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.matchup-stat-value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.8rem;
}

/* Bar chart for comparison stats */
.matchup-stat-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
}

.stat-bar-container {
    flex: 1;
    height: 6px;
    background: rgba(42, 58, 82, 0.6);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-blue) 100%);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-bar-fill.away {
    background: linear-gradient(90deg, var(--accent-red) 0%, var(--accent-orange) 100%);
}

.stat-bar-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 32px;
    text-align: right;
}

/* Momentum indicators and advanced visualizations */
.momentum-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

.momentum-hot {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.2), rgba(230, 126, 34, 0.2));
    color: var(--accent-orange);
    box-shadow: var(--glow-red);
}

.momentum-cold {
    background: linear-gradient(135deg, rgba(41, 128, 185, 0.2), rgba(52, 152, 219, 0.2));
    color: var(--accent-blue);
}

.momentum-neutral {
    background: rgba(141, 161, 185, 0.1);
    color: var(--text-secondary);
}

/* Mini sparkline for trends */
.mini-sparkline {
    display: inline-flex;
    align-items: flex-end;
    gap: 1px;
    height: 12px;
    margin-left: 0.3rem;
}

.sparkline-bar {
    width: 2px;
    background: var(--accent-green);
    transition: height 0.3s ease;
    border-radius: 1px 1px 0 0;
}

.sparkline-bar.loss {
    background: var(--accent-red);
}

.sparkline-bar.ot {
    background: var(--accent-blue);
}

/* Win probability indicator */
.win-probability {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.4rem 0.5rem;
    background: rgba(11, 22, 42, 0.6);
    border-radius: 6px;
    border-left: 2px solid var(--accent-purple);
}

.win-prob-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.win-prob-bar {
    flex: 1;
    height: 8px;
    background: rgba(42, 58, 82, 0.6);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.win-prob-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--glow-green);
}

.win-prob-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-green);
    min-width: 40px;
    text-align: right;
}

/* Advanced stat card with mini charts */
.stat-card-advanced {
    position: relative;
    overflow: visible;
}

.stat-trend-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    opacity: 0.3;
}

.trend-line-svg {
    width: 100%;
    height: 100%;
}

/* Matchup prediction badge */
.matchup-prediction {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.6rem;
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.2), rgba(41, 128, 185, 0.2));
    border: 1px solid rgba(155, 89, 182, 0.4);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-purple);
    animation: glow-pulse 2s ease-in-out infinite;
    margin-bottom: 0.6rem;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.2);
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(155, 89, 182, 0.2), 0 0 5px rgba(155, 89, 182, 0.3);
    }
    50% {
        box-shadow: 0 2px 12px rgba(155, 89, 182, 0.3), 0 0 15px rgba(155, 89, 182, 0.6);
    }
}

/* Team Cards (Standings) */
.team-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: var(--min-touch-target);
    /* Improve tap response */
    -webkit-tap-highlight-color: rgba(33, 209, 159, 0.1);
    tap-highlight-color: rgba(33, 209, 159, 0.1);
    /* Prevent text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    /* Optimize for touch scrolling */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.team-card:hover {
    background-color: var(--bg-card-hover);
    transform: translateX(4px);
}

.team-card:active {
    background-color: var(--bg-card-hover);
    transform: translateX(2px);
}

.team-card:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-green);
}

.team-card:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

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

.team-card-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.team-rank {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
}

.team-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.team-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0;
    line-height: 1.3;
}

.team-fan {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.3;
}

.team-card-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.team-points {
    text-align: right;
}

.team-points-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.team-points-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

.team-trend {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.trend-up {
    color: var(--accent-green);
}

.trend-down {
    color: var(--accent-red);
}

/* Expandable Details */
.team-card-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.team-card.expanded .team-card-details {
    max-height: 800px;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Achievement badges */
.team-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.achievement-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    /* Use dynamic badge color with fallback to secondary background */
    background-color: var(--badge-bg, var(--color-bg-secondary));
}

.badge-emoji {
    font-size: 1.1rem;
    line-height: 1;
}

.badge-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
}

.badge-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Head-to-head section */
.h2h-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.h2h-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.h2h-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.h2h-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: var(--bg-card-hover);
    border-radius: 6px;
    font-size: 0.8rem;
}

.h2h-opponent {
    color: var(--text-secondary);
    font-weight: 600;
}

.h2h-record {
    font-weight: 700;
    font-size: 0.75rem;
}

.h2h-record.winning {
    color: var(--accent-green);
}

.h2h-record.losing {
    color: var(--accent-red);
}

/* Status Indicators */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    gap: 6px;
    white-space: nowrap;
    margin-top: 0.35rem;
    line-height: 1.2;
}

.status-badge > span[aria-hidden="true"] {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    font-size: 0.9rem;
}

/* Division leader statuses */
.status-div-leader-1,
.status-div-leader-2,
.status-div-leader-3 {
    background-color: rgba(33, 209, 159, 0.2);
    color: var(--accent-green);
}

/* Wildcard statuses */
.status-wildcard-1,
.status-wildcard-2 {
    background-color: rgba(33, 209, 159, 0.2);
    color: var(--accent-green);
}

/* In the hunt status */
.status-in-hunt {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

/* Fading fast status - teams unlikely but not mathematically eliminated */
.status-fading-fast {
    background-color: rgba(255, 140, 0, 0.2);
    color: #ff8c00;
}

/* Eliminated status */
.status-eliminated {
    background-color: rgba(231, 76, 60, 0.2);
    color: var(--accent-red);
}

/* Legacy status classes for backward compatibility */
.status-clinched {
    background-color: rgba(33, 209, 159, 0.2);
    color: var(--accent-green);
}

.status-contending {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

/* Playoff Status Legend */
.playoff-status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.status-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.status-item > span[role="img"] {
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
    line-height: 1;
}

/* Loading Skeleton */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 0%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

.skeleton-card {
    height: 100px;
    border-radius: 12px;
    margin-bottom: 1rem;
}

/* Color Utilities */
.text-green {
    color: var(--accent-green);
}

.text-red {
    color: var(--accent-red);
}

.text-blue {
    color: var(--accent-blue);
}

.text-secondary {
    color: var(--text-secondary);
}

/* Desktop Adjustments */
@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
    
    body {
        padding-bottom: 2rem;
    }
    
    .app-container .desktop-tabs {
        display: flex; /* More specific selector instead of !important */
        gap: 1rem;
        margin-bottom: 2rem;
        border-bottom: 2px solid var(--border-color);
    }
    
    .desktop-tab {
        padding: 1rem 1.5rem;
        background: none;
        border: none;
        color: var(--text-secondary);
        font-weight: 600;
        font-size: 1rem;
        cursor: pointer;
        border-bottom: 3px solid transparent;
        transition: all 0.2s ease;
    }
    
    .desktop-tab:hover {
        color: var(--text-primary);
    }
    
    .desktop-tab:focus {
        outline: none;
    }
    
    .desktop-tab:focus-visible {
        outline: 2px solid var(--accent-green);
        outline-offset: -2px;
    }
    
    .desktop-tab.active {
        color: var(--accent-green);
        border-bottom-color: var(--accent-green);
    }
    
    .stat-card-square {
        flex: 0 0 160px;
        width: 160px;
        height: 160px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .details-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hero-section {
        padding: 2rem;
    }
    
    .hero-fan-name {
        font-size: 2.5rem;
    }
    
    .hero-team-name {
        font-size: 1.25rem;
    }
    
    .featured-matchup-card {
        padding: 1.5rem 2rem;
    }
    
    .featured-team-logo {
        width: 72px;
        height: 72px;
    }
    
    .featured-fallback {
        width: 72px;
        height: 72px;
    }
}

/* Hide desktop tabs on mobile */
@media (max-width: 767px) {
    .app-container .desktop-tabs {
        display: none; /* More specific selector instead of !important */
    }
}

/* Chart styling */
.chart-container {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    min-height: 400px;
    position: relative;
}

/* Loading indicator for charts */
.chart-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 767px) {
    .chart-container {
        min-height: 500px;
        padding: 0.75rem;
        padding-bottom: 0.5rem;
    }
    
    .chart-container h2 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    .chart-container canvas {
        max-height: 450px;
        /* Improve touch responsiveness */
        touch-action: pan-y;
    }
    
    /* Mobile-specific card adjustments */
    .team-card {
        padding: 0.75rem;
        /* Smoother animations on mobile */
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .team-card:active {
        background-color: var(--bg-card-hover);
        transform: scale(0.98) translateX(2px);
    }
    
    .team-card-left {
        gap: 0.5rem;
        min-width: 0;
        flex: 1;
    }
    
    .team-rank {
        font-size: 1.25rem;
        min-width: 30px;
    }
    
    .team-info {
        min-width: 0;
        flex: 1;
    }
    
    .team-name {
        font-size: 0.9rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .team-fan {
        font-size: 0.75rem;
    }
    
    .team-card-right {
        gap: 0.5rem;
        flex-shrink: 0;
    }
    
    .team-points-value {
        font-size: 1.25rem;
    }
    
    .team-points-label {
        font-size: 0.65rem;
    }
    
    .team-trend {
        font-size: 1.25rem;
    }
    
    /* Status badge adjustments for mobile */
    .status-badge {
        padding: 4px 8px;
        font-size: 0.65rem;
        gap: 4px;
        margin-top: 0.25rem;
    }
    
    .status-badge > span[aria-hidden="true"] {
        font-size: 0.8rem;
    }
    
    /* Playoff status legend for mobile */
    .playoff-status-legend {
        gap: 0.5rem;
        padding: 0.75rem;
        font-size: 0.7rem;
    }
    
    .status-item {
        font-size: 0.7rem;
        gap: 4px;
    }
    
    .status-item > span[role="img"] {
        font-size: 0.9rem;
    }
    
    /* Achievement card mobile adjustments */
    .stat-card-square {
        flex: 0 0 130px;
        width: 130px;
        height: 130px;
        padding: 0.75rem;
    }
    
    .stat-emoji {
        font-size: 1.6rem;
        margin-bottom: 0.3rem;
        color: var(--color-accent-primary);
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .stat-value {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
    }
    
    .stat-fan-name {
        font-size: 0.65rem;
    }
    
    .achievement-card.expandable {
        padding-bottom: 1.5rem;
        /* Improve touch response */
        -webkit-tap-highlight-color: rgba(33, 209, 159, 0.1);
        tap-highlight-color: rgba(33, 209, 159, 0.1);
    }
    
    .achievement-card:active {
        transform: scale(0.98);
        background-color: var(--bg-card-hover);
    }
    
    .achievement-rank {
        font-size: 0.6rem;
    }
    
    /* Optimize button touch targets on mobile */
    button, .desktop-tab, .nav-item, .team-card, .stat-card-square, .achievement-card {
        /* Ensure touch targets are at least 44x44px */
        min-height: 44px;
    }
    
    /* Improve header spacing on mobile */
    .app-container header {
        margin-bottom: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.25rem;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.1rem;
        line-height: 1.3;
    }
    
    /* Improve tap targets for matchup cards */
    .matchup-vs {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .featured-vs {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Optimize scroll performance */
    .app-container {
        /* Use CSS containment for better performance */
        contain: layout style paint;
        /* Prevent zooming on iOS when focusing */
        touch-action: manipulation;
    }
    
    .tab-section {
        /* Optimize tab switching */
        contain: layout style paint;
    }
    
    /* Improve loading states */
    .skeleton-card {
        animation: shimmer 2s infinite;
        will-change: background-position;
    }
    
    /* Enhanced mobile animations for stat cards */
    .stat-card-square {
        animation: fadeInUp 0.5s ease-out backwards;
    }
    
    .stat-card-square:nth-child(1) { animation-delay: 0.1s; }
    .stat-card-square:nth-child(2) { animation-delay: 0.2s; }
    .stat-card-square:nth-child(3) { animation-delay: 0.3s; }
    .stat-card-square:nth-child(4) { animation-delay: 0.4s; }
    .stat-card-square:nth-child(5) { animation-delay: 0.5s; }
    .stat-card-square:nth-child(6) { animation-delay: 0.6s; }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Matchup cards stagger animation */
    .matchup-card {
        animation: slideIn 0.5s ease-out backwards;
    }
    
    .matchup-card:nth-child(1) { animation-delay: 0.1s; }
    .matchup-card:nth-child(2) { animation-delay: 0.2s; }
    .matchup-card:nth-child(3) { animation-delay: 0.3s; }
    .matchup-card:nth-child(4) { animation-delay: 0.4s; }
    
    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateX(-20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
}

/* Utility classes */
.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.hidden {
    display: none !important;
}

/* Enhanced Matchup Display Styles */
.matchup-date-group {
    margin-bottom: 1.5rem;
}

.matchups-list-hidden {
    display: none;
}

.date-group-header {
    margin-bottom: 0.75rem;
}

.date-group-toggle {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    color: inherit;
}

.date-group-toggle:hover {
    opacity: 0.8;
}

.toggle-icon {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    color: var(--fgColor-muted);
}

.date-label {
    display: inline-block;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.matchup-item {
    transition: all 0.2s ease;
}

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

.interest-indicator {
    font-size: 1.2rem;
    line-height: 1;
}

.rivalry-badge {
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.team-info {
    min-width: 0; /* Allow text truncation */
}

.team-name {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.team-record {
    line-height: 1.4;
}

.team-streak {
    font-style: italic;
}

.team-streak-spacing {
    margin-top: 0.25rem;
}

.matchup-teams-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: center;
}

.vs-divider {
    flex-shrink: 0;
    padding: 0 0.5rem;
}

.vs-divider-styled {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--fgColor-muted);
}

.h2h-border {
    border-color: var(--borderColor-muted) !important;
}

.matchup-summary {
    cursor: pointer;
    color: var(--fgColor-accent);
}

.stats-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.expanded-stats-grid {
    font-size: 0.875rem;
    line-height: 1.6;
}

.game-time-border {
    border-color: var(--borderColor-muted) !important;
}

.matchup-details-expand summary {
    list-style: none;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.matchup-details-expand summary:hover {
    background-color: var(--bgColor-muted);
}

.matchup-details-expand summary::-webkit-details-marker {
    display: none;
}

.matchup-details-expand[open] summary {
    margin-bottom: 0.5rem;
}

.expanded-stats {
    font-size: 0.875rem;
    line-height: 1.6;
}

.game-time {
    font-size: 0.9rem;
}

/* Additional utility classes for matchups */
.badge-date {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.matchup-item-high-interest {
    border-width: 2px !important;
    border-color: var(--borderColor-danger-emphasis) !important;
}

.matchup-title {
    font-size: 1.1rem;
}

.rivalry-badge-inline {
    font-size: 0.75rem;
}

/* Responsive adjustments for matchups */
@media (max-width: 768px) {
    /* Matchup Cards - Mobile Optimization */
    .matchup-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .matchup-teams {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .matchup-team {
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
        gap: 0.75rem;
        padding: 0.75rem;
        background-color: rgba(26, 37, 58, 0.5);
        border-radius: 8px;
    }
    
    .team-logo {
        width: 56px;
        height: 56px;
        margin: 0;
        flex-shrink: 0;
    }
    
    .team-logo-fallback {
        width: 56px;
        height: 56px;
        margin: 0;
        flex-shrink: 0;
    }
    
    .matchup-team-name {
        font-size: 0.95rem;
        margin-bottom: 0.15rem;
    }
    
    .matchup-fan-name {
        font-size: 0.8rem;
    }
    
    .matchup-vs {
        align-self: center;
        margin: 0;
        padding: 12px 14px;  /* Increased to meet 44px touch target */
        font-size: 0.85rem;
    }
    
    .matchup-details {
        flex-direction: column;
        gap: 0.5rem;
        padding-top: 0.75rem;
    }
    
    .matchup-stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
        background-color: rgba(26, 37, 58, 0.5);
        border-radius: 6px;
    }
    
    .matchup-stat-label {
        font-size: 0.75rem;
        margin-bottom: 0;
        text-align: left;
    }
    
    .matchup-stat-value {
        font-size: 0.85rem;
        font-weight: 700;
        text-align: right;
    }
    
    /* Featured Matchup - Enhanced Mobile */
    .featured-matchup-card {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .featured-team {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.75rem;
        padding: 0.75rem;
        background-color: rgba(26, 37, 58, 0.5);
        border-radius: 8px;
    }
    
    .featured-team-logo {
        width: 64px;
        height: 64px;
        flex-shrink: 0;
    }
    
    .featured-fallback {
        width: 64px;
        height: 64px;
        flex-shrink: 0;
    }
    
    .featured-team-info {
        text-align: left;
        flex: 1;
    }
    
    .featured-fan-name {
        font-size: 1rem;
    }
    
    .featured-team-name {
        font-size: 0.8rem;
    }
    
    .featured-record {
        font-size: 0.85rem;
    }
    
    .featured-vs {
        font-size: 1.1rem;
        padding: 0.75rem 1rem;  /* Increased to meet 44px touch target */
    }
    
    /* Legacy matchup-item support (if exists) */
    .matchup-item .matchup-teams-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .matchup-item .vs-divider {
        text-align: center;
        padding: 0.5rem 0;
    }
    
    .matchup-item .team-info {
        text-align: center;
    }
    
    .matchup-item .stats-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Dense Featured Matchup - Mobile adjustments */
    .featured-teams-dense {
        flex-direction: column;
        gap: 1rem;
    }
    
    .featured-vs-dense {
        padding: 0.5rem 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .featured-stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.4rem;
    }
    
    .stat-item-dense {
        padding: 0.35rem 0.4rem;
    }
    
    .stat-value-dense {
        font-size: 0.75rem;
    }
    
    .stat-label-dense {
        font-size: 0.6rem;
    }
    
    .featured-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .featured-time-compact,
    .featured-prediction-compact {
        justify-content: center;
    }
}

/* Playoff Odds Specific Styles */

.playoff-odds-summary {
    margin-bottom: 1rem;
}

.playoff-odds-summary table {
    font-size: 0.8rem;
    width: 100%;
    border-collapse: collapse;
}

.playoff-odds-summary th {
    padding: 0.4rem 0.3rem;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.playoff-odds-summary td {
    padding: 0.5rem 0.3rem;
    border-bottom: 1px solid rgba(42, 58, 82, 0.3);
}

/* Chart.js legend styling for playoff odds chart */
#playoffOddsChart + .chartjs-legend,
.chart-container .chartjs-legend,
.chart-container canvas + div {
    color: #ffffff !important;
}

.chart-container .chartjs-legend ul,
.chart-container .chartjs-legend li {
    color: #ffffff !important;
}

/* Override Chart.js default legend text color */
#playoff-odds-tab .chart-container canvas {
    color: #ffffff;
}

#playoff-odds-tab .chart-container {
    --legend-text-color: #ffffff;
}

/* Responsive improvements for playoff odds */
@media (max-width: 767px) {
    .playoff-odds-summary table {
        font-size: 0.75rem;
    }
    
    .playoff-odds-summary th,
    .playoff-odds-summary td {
        padding: 0.4rem 0.25rem;
    }
    
    /* Make table horizontally scrollable on small screens */
    .playoff-odds-summary > div {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Better spacing for tab sections */
.tab-section {
    padding: 0;
    margin: 0;
}

.tab-section > h2:first-child {
    margin-bottom: 0.75rem;
    margin-top: 0;
}

.tab-section > * {
    margin-bottom: 0.75rem;
}

.tab-section > *:last-child {
    margin-bottom: 0;
}

/* Ensure consistent card spacing across all tabs */
.matchup-card,
.team-card,
.achievement-card,
.stat-card-square {
    margin-bottom: 0.85rem;
}

/* Fix any potential overflow issues */
.app-container {
    overflow-x: hidden;
}

/* Improve touch target sizes for better mobile experience */
@media (max-width: 767px) {
    /* Ensure buttons and interactive elements meet minimum touch target size */
    button, .nav-item, .desktop-tab, .date-group-toggle {
        min-height: var(--min-touch-target);
        min-width: var(--min-touch-target);
    }
    
    /* Better spacing between sections on mobile */
    .tab-section > * {
        margin-bottom: 0.85rem;
    }
    
    /* Prevent horizontal scroll on mobile */
    body {
        overflow-x: hidden;
    }
}

/* ============================================================
   Personality touches — hand-crafted UI polish
   ============================================================ */

/* Accent bar — team color strip at top of page */
.app-accent-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-info, var(--color-accent-primary)));
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

/* Team-aware header styling */
header h1 {
  position: relative;
  display: inline-block;
}

header h1::after {
  content: '';
  display: block;
  height: 2px;
  margin-top: 4px;
  background: linear-gradient(90deg, var(--color-accent-primary), transparent);
  border-radius: 1px;
  opacity: 0.6;
}

/* Team-colored active tab indicator */
.bottom-nav .nav-item.active {
  border-top-color: var(--color-accent-primary);
}

/* Subtle background texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.015) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

.app-container {
  position: relative;
  z-index: 1;
}

/* Card personality */
.stat-card-square,
.matchup-card,
.team-card {
  transition: transform var(--duration-base, 0.2s) var(--ease-out, ease),
              box-shadow var(--duration-base, 0.2s) var(--ease-out, ease),
              border-color var(--duration-base, 0.2s) var(--ease-out, ease);
}

.stat-card-square:hover,
.matchup-card:hover,
.team-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border-color: var(--color-accent-primary);
}
