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

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&display=swap');

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: 
        radial-gradient(ellipse at top left, rgba(227, 27, 35, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at bottom right, rgba(246, 235, 97, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at center, rgba(227, 27, 35, 0.05) 0%, transparent 70%),
        linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 25%, #1f1f1f 50%, #2a2a2a 75%, #1e1e1e 100%);
    color: #e5e5e5;
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
    box-sizing: border-box;
}

/* Header Styles */
.header {
    background: rgb(227, 27, 35);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: white;
    padding: 16px 0;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header h1 {
    font-family: 'Playfair Display', 'Georgia', 'Times New Roman', serif;
    font-size: 2.2rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
    color: white;
    line-height: 1;
    text-transform: none;
    font-display: swap;
}

/* Header Button Styling */
.load-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.load-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.load-btn:active {
    transform: translateY(0);
}

.load-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.5;
}

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

.load-btn:hover .refresh-icon {
    transform: rotate(90deg);
}

.load-btn:disabled .refresh-icon {
    animation: spin 1s linear infinite;
}

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

/* Main Content Grid */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    align-items: stretch;
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 0;
    height: calc(100vh - 76px);
    width: 100%;
    box-sizing: border-box;
}

/* Section Styles */
.section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    color: #333;
}

/* Section Content Areas */
.section h2 {
    font-family: 'Playfair Display', 'Georgia', 'Times New Roman', serif;
    color: rgb(227, 27, 35);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    letter-spacing: -0.01em;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-counter {
    background: rgba(227, 27, 35, 0.1);
    color: rgb(227, 27, 35);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

.section-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

/* Custom scrollbar styling */
.section-content::-webkit-scrollbar {
    width: 6px;
}

.section-content::-webkit-scrollbar-track {
    background: rgba(227, 27, 35, 0.05);
    border-radius: 3px;
}

.section-content::-webkit-scrollbar-thumb {
    background: rgba(227, 27, 35, 0.3);
    border-radius: 3px;
}

.section-content::-webkit-scrollbar-thumb:hover {
    background: rgba(227, 27, 35, 0.5);
}

/* News Section */
.news-list {
    list-style: none;
}

.news-item {
    padding: 16px 0;
    border-bottom: 1px solid rgba(227, 27, 35, 0.1);
    transition: all 0.3s ease;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.news-item:last-child {
    border-bottom: none;
}

.news-item:hover {
    background: rgba(227, 27, 35, 0.03);
    margin: 0 -16px;
    padding: 16px;
    border-radius: 8px;
}

.news-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(227, 27, 35, 0.1);
    border: 1px solid rgba(227, 27, 35, 0.1);
}

.news-logo-fallback {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgb(227, 27, 35) 0%, #c92a2a 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.news-content {
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.news-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 4px;
    transition: color 0.3s ease;
    line-height: 1.4;
}

.news-link:hover {
    color: #000;
}

.news-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.news-source {
    color: rgb(227, 27, 35);
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(227, 27, 35, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.news-date {
    color: #666;
    font-size: 0.8rem;
    font-weight: 400;
}

/* Videos Section */
.videos-grid {
    display: grid;
    gap: 16px;
}

.video-item {
    border: 1px solid rgba(227, 27, 35, 0.08);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.video-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(227, 27, 35, 0.12);
    border-color: rgba(227, 27, 35, 0.15);
    cursor: pointer;
}

.video-embed {
    width: 100%;
    height: 180px;
    border: none;
}

.video-thumbnail-container {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}


.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-item:hover .video-thumbnail {
    transform: scale(1.05);
}

.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.video-item:hover .video-play-button {
    background: rgba(227, 27, 35, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-play-button svg {
    margin-left: 2px;
}

.video-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 60px;
}

.video-text-content {
    flex: 1;
}

.video-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.video-duration {
    background: rgba(227, 27, 35, 0.1);
    color: rgb(227, 27, 35);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(227, 27, 35, 0.2);
    flex-shrink: 0;
}

.video-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}

.video-date {
    color: #666;
    font-size: 0.8rem;
    font-weight: 400;
    flex-shrink: 0;
}

/* Premier League Table Styles */
.pl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.pl-table th,
.pl-table td {
    padding: 8px 4px;
    text-align: left;
    border-bottom: 1px solid rgba(227, 27, 35, 0.1);
    vertical-align: middle;
}

.pl-table th {
    background: rgba(227, 27, 35, 0.1);
    color: rgb(227, 27, 35);
    font-weight: 600;
    font-size: 0.8rem;
    position: sticky;
    top: 0;
}

.pl-table .position {
    text-align: center;
    width: 30px;
}

.pl-table .team {
    font-weight: 500;
}

.pl-table .pts {
    font-weight: 600;
    text-align: center;
    width: 40px;
}

.pl-table .stats {
    text-align: center;
    width: 30px;
}

.liverpool-row {
    background: rgba(227, 27, 35, 0.1);
    font-weight: 600;
}

.liverpool-row .team {
    color: rgb(227, 27, 35);
}

/* Fixtures Styles */
.fixtures-list {
    list-style: none;
}

.fixture-item {
    padding: 12px 0;
    border-bottom: 1px solid rgba(227, 27, 35, 0.1);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fixture-item:last-child {
    border-bottom: none;
}

.fixture-teams {
    font-weight: 500;
    color: rgb(227, 27, 35);
    font-size: 0.9rem;
}

.fixture-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #666;
}



/* Source Links */
.source-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #666;
    text-decoration: none;
    font-size: 0.8rem;
    margin-top: 8px;
    transition: color 0.3s ease;
}

.source-link:hover {
    color: rgb(227, 27, 35);
}

/* Video Overlay Modal */
.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.video-overlay.active {
    opacity: 1;
    visibility: visible;
}

.video-modal {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.video-overlay.active .video-modal {
    transform: scale(1);
}

.video-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.video-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgb(227, 27, 35);
    margin: 0;
    flex: 1;
    margin-right: 16px;
    line-height: 1.4;
}

.video-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.video-modal-close:hover {
    background: rgba(227, 27, 35, 0.1);
    color: rgb(227, 27, 35);
}

.video-modal-embed {
    width: 100%;
    height: 400px;
    border: none;
    border-radius: 12px;
}

.video-modal-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(227, 27, 35, 0.1);
}

.video-modal-date {
    color: #666;
    font-size: 0.85rem;
    font-weight: 400;
}

.ios-autoplay-notice {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #856404;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-top: 8px;
    display: none;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 48px 24px;
    color: #666;
    font-size: 0.9rem;
    font-weight: 400;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(227, 27, 35, 0.3);
    border-top: 2px solid rgb(227, 27, 35);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

/* Error States */
.error {
    background: rgba(227, 27, 35, 0.1);
    border: 1px solid rgba(227, 27, 35, 0.2);
    color: rgb(227, 27, 35);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #666;
    font-size: 0.9rem;
    background: rgba(227, 27, 35, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(227, 27, 35, 0.05);
}

.initial-state {
    text-align: center;
    padding: 48px 24px;
    color: #666;
    font-size: 0.9rem;
    background: rgba(227, 27, 35, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(227, 27, 35, 0.05);
}

/* API Unavailable Fallback Styles */
.api-unavailable {
    text-align: center;
    padding: 32px 24px;
    background: rgba(227, 27, 35, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(227, 27, 35, 0.1);
}

.api-unavailable-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.7;
}

.api-unavailable-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgb(227, 27, 35);
    margin-bottom: 12px;
}

.api-unavailable-message {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 24px;
}

.fallback-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 280px;
    margin: 0 auto;
}

.fallback-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(227, 27, 35, 0.05);
    border: 1px solid rgba(227, 27, 35, 0.1);
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}

.fallback-link:hover {
    background: rgba(227, 27, 35, 0.1);
    border-color: rgba(227, 27, 35, 0.2);
    transform: translateY(-1px);
}

.fallback-link-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.fallback-link-text {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
}

/* Liverpool Table Row Styles */
.table-row-container {
    background: rgba(227, 27, 35, 0.05);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(227, 27, 35, 0.1);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.table-header-mini {
    display: grid;
    grid-template-columns: 30px 1fr 30px 30px 30px 30px 40px 40px;
    gap: 4px;
    align-items: center;
    padding: 6px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(227, 27, 35, 0.15);
    margin-bottom: 6px;
    width: 100%;
    min-width: 0;
}

.liverpool-table-row {
    display: grid;
    grid-template-columns: 30px 1fr 30px 30px 30px 30px 40px 40px;
    gap: 4px;
    align-items: center;
    padding: 8px 4px;
    background: rgba(227, 27, 35, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(227, 27, 35, 0.2);
    transition: all 0.3s ease;
    width: 100%;
    min-width: 0;
}

.liverpool-table-row:hover {
    background: rgba(227, 27, 35, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(227, 27, 35, 0.2);
}

.pos-col, .mp-col, .w-col, .d-col, .l-col, .gd-col, .pts-col {
    text-align: center;
    font-size: 0.9rem;
    vertical-align: middle;
}

.team-col {
    text-align: left;
    font-weight: 600;
}

.position-number {
    background: rgb(227, 27, 35);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.team-name {
    color: rgb(227, 27, 35);
    font-weight: 600;
}

.points {
    background: rgb(227, 27, 35);
    color: white;
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}



/* Compact content for position section */
.compact-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* Competition Sections Styling */
.competition-section {
    margin-bottom: 20px;
}

.competition-section:last-child {
    margin-bottom: 0;
}

.competition-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.competition-title {
    color: rgb(227, 27, 35);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-link {
    color: rgb(227, 27, 35);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: 1px solid rgba(227, 27, 35, 0.2);
}

.header-link:hover {
    background: rgba(227, 27, 35, 0.1);
    transform: translateY(-1px);
}

/* Simplified Position Display */
.simple-position {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 6px 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.mini-table {
    width: 100%;
}

.mini-table-header {
    display: grid;
    grid-template-columns: 32px repeat(8, 1fr);
    gap: 3px;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(227, 27, 35, 0.15);
    margin-bottom: 4px;
}

.mini-table-header > div {
    text-align: center;
    vertical-align: middle;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-table-row {
    display: grid;
    grid-template-columns: 32px repeat(8, 1fr);
    gap: 3px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 500;
}

.mini-table-row > div {
    text-align: center;
    color: #666;
    vertical-align: middle;
    display: flex;
    align-items: center;
    justify-content: center;
}

.position-cell {
    background: rgb(227, 27, 35);
    color: white !important;
    font-weight: 700;
    border-radius: 3px;
    padding: 2px 0;
    font-size: 0.75rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.points-cell {
    color: #333 !important;
    font-weight: 700;
}

/* Simplified Match Display */
.matches-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.match-item {
    padding: 8px;
    border-bottom: 1px solid rgba(227, 27, 35, 0.1);
}

.match-item:last-child {
    border-bottom: none;
}

.match-row-top {
    line-height: 1.4;
}

.match-teams-line {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
}

.match-status-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.match-status-badge.ft {
    background: rgba(100, 100, 100, 0.12);
    color: #999;
    font-size: 0.6rem;
}

.match-status-badge.live {
    background: #E31B23;
    color: white;
    animation: pulse-live 1.5s ease-in-out infinite;
}

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

.match-status-badge.upcoming {
    background: rgba(227, 27, 35, 0.1);
    color: #E31B23;
}

.match-row-details {
    color: #888;
    font-size: 0.75rem;
    margin-top: 3px;
}

.match-stadium-time {
    font-size: 0.78rem;
    color: #555;
    margin-top: 3px;
    font-weight: 500;
}

.match-tv-channels {
    font-size: 0.7rem;
    color: #888;
    margin-top: 3px;
    line-height: 1.4;
}


/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .section:nth-child(3) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .main-content {
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding: 16px 16px;
        height: calc(100vh - 76px);
    }

    .section {
        padding: 16px;
        min-height: 0;
        flex: 1;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 12px;
        align-items: center;
        padding: 0 16px;
    }

    .header-brand {
        flex: 1;
        min-width: 0;
        gap: 12px;
    }

    .load-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .video-embed {
        height: 160px;
    }

    .pl-table {
        font-size: 0.8rem;
    }

    .pl-table th,
    .pl-table td {
        padding: 6px 2px;
    }
}

@media (max-width: 480px) {
    .main-content {
        display: flex;
        flex-direction: column;
        padding: 12px 12px;
        gap: 12px;
        height: calc(100vh - 76px);
    }

    .section {
        padding: 12px;
        min-height: 0;
        flex: 1;
    }

    .section h2 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .header-content {
        padding: 0 12px;
    }

    .header-brand {
        gap: 8px;
    }

    .logo {
        width: 32px;
        height: 32px;
    }

    .load-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
        border-radius: 12px;
    }

    .video-embed {
        height: 140px;
    }

    .video-thumbnail-container {
        height: 140px;
    }

    .video-play-button {
        width: 48px;
        height: 48px;
    }

    .video-play-button svg {
        width: 18px;
        height: 18px;
    }

    /* Video Modal Mobile Styles */
    .video-modal {
        width: 95%;
        padding: 16px;
        max-height: 95vh;
        overflow-y: auto;
    }

    .video-modal-embed {
        height: 250px;
    }

    .video-modal-title {
        font-size: 1rem;
    }

    .pl-table {
        font-size: 0.75rem;
    }

    .pl-table th,
    .pl-table td {
        padding: 4px 2px;
    }

    /* Competition sections mobile responsive */
    .competition-section {
        margin-bottom: 16px;
    }

    .competition-header {
        margin-bottom: 6px;
    }

    .competition-title {
        font-size: 0.85rem;
    }

    .header-link {
        font-size: 0.75rem;
        padding: 3px 6px;
    }

    .simple-position {
        padding: 4px 0;
    }

    .mini-table-header {
        font-size: 0.65rem;
        gap: 2px;
        padding: 3px 6px;
        grid-template-columns: 28px repeat(8, 1fr);
    }

    .mini-table-row {
        font-size: 0.75rem;
        gap: 2px;
        padding: 3px 6px;
        grid-template-columns: 28px repeat(8, 1fr);
    }

    .position-cell {
        font-size: 0.7rem;
        padding: 1px 0;
    }

    .points-cell {
        padding: 1px 3px;
    }

    .match-item {
        padding: 6px;
    }

    .match-teams-line {
        font-size: 0.82rem;
    }

    .match-row-details {
        font-size: 0.7rem;
    }
}

/* App Footer Styles */
.app-footer {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(227, 27, 35, 0.15);
    padding: 16px 0;
    margin-top: auto;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.app-footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    flex-shrink: 0;
}

.replit-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #F26207;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 6px;
}

.replit-link:hover {
    background: rgba(242, 98, 7, 0.1);
    transform: translateY(-1px);
}

.replit-logo {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.footer-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.branding-component {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.branding-component:hover {
    transform: translateY(-1px);
}

.avatar-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.heart-icon {
    width: 18px;
    height: 18px;
    color: rgb(227, 27, 35);
    fill: rgb(227, 27, 35);
    position: absolute;
    left: -12px;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.5;
        transform: scale(1.05);
    }
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(227, 27, 35, 0.2);
    transition: all 0.3s ease;
}

.branding-component:hover .avatar {
    border-color: rgb(227, 27, 35);
    box-shadow: 0 2px 8px rgba(227, 27, 35, 0.3);
}

/* Footer Responsive */
@media (max-width: 768px) {
    .app-footer {
        padding: 20px 0;
    }

    .app-footer-content {
        gap: 16px;
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .app-footer {
        padding: 16px 0;
        margin-top: 0;
    }

    .app-footer-content {
        gap: 16px;
        padding: 0 12px;
    }

    .footer-left {
        justify-content: flex-start;
    }

    .footer-right {
        justify-content: flex-end;
    }
}

/* Table unavailable message styling */
.table-unavailable {
    text-align: center;
    padding: 24px;
    color: #666;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(227, 27, 35, 0.1);
}

/* Mobile Content Hub */
.mobile-hub-nav,
.mobile-overview {
    display: none;
}

.section.hub-panel {
    display: flex;
}

@media (max-width: 600px) {
    html {
        /* iOS Safari paints the areas beyond the page from the root
           background-color, so the base must be solid red for the top
           bar/overscroll; the footer gray is a non-repeating layer pinned
           to the bottom half of the page itself. */
        background: linear-gradient(#e9e9e9, #e9e9e9) bottom / 100% 50% no-repeat #e31b23;
    }

    body {
        width: 100%;
        background: linear-gradient(160deg, #251719 0%, #171717 42%, #292323 100%);
    }

    .header {
        position: relative;
        z-index: 21;
        margin-top: calc(-1 * env(safe-area-inset-top, 0px));
        padding: 12px 0;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }

    .header::before {
        content: '';
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        height: env(safe-area-inset-top, 0px);
        background: rgb(227, 27, 35);
        pointer-events: none;
    }

    .mobile-hub-nav {
        display: block;
        position: sticky;
        top: 0;
        z-index: 20;
        margin: -12px -12px 0;
        padding: 8px 12px 10px;
        background: rgba(227, 27, 35, 0.97);
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    }

    .hub-tabs {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
        padding: 4px;
        border-radius: 12px;
        background: rgba(0, 0, 0, .18);
    }

    .hub-tab {
        min-height: 42px;
        border: 0;
        border-radius: 9px;
        padding: 8px 4px;
        background: transparent;
        color: rgba(255, 255, 255, .78);
        font: inherit;
        font-size: .75rem;
        font-weight: 700;
        cursor: pointer;
    }

    .hub-tab.is-active {
        background: #fff;
        color: #c9141d;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
    }

    .mobile-overview {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        color: #fff;
        padding: 12px 0;
    }

    .mobile-overview[hidden],
    .section.hub-panel[hidden] {
        display: none;
    }

    .overview-eyebrow {
        color: #ff8b8f;
        font-size: .7rem;
        font-weight: 700;
        letter-spacing: .12em;
        text-transform: uppercase;
    }

    .overview-intro h2 {
        margin: 3px 0 5px;
        font-family: 'Playfair Display', Georgia, serif;
        font-size: 1.65rem;
        line-height: 1.15;
    }

    .overview-intro p {
        color: #d1c6c6;
        font-size: .88rem;
        line-height: 1.45;
        max-width: 34rem;
    }

    .overview-cards {
        display: grid;
        flex: 1 1 auto;
        grid-template-rows: repeat(3, minmax(0, 1fr));
        gap: 12px;
        margin-top: 0;
    }

    .overview-card {
        background: rgba(255, 255, 255, .97);
        border-radius: 14px;
        padding: 16px;
        color: #292323;
        box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    }

    .overview-card-heading {
        display: flex;
        align-items: center;
        gap: 9px;
    }

    .overview-card-heading h3 {
        color: #cf1821;
        font-size: 1rem;
        margin: 0;
    }

    .overview-icon {
        display: grid;
        place-items: center;
        width: 28px;
        height: 28px;
        border-radius: 8px;
        background: rgba(227, 27, 35, .1);
        color: #cf1821;
        font-size: .85rem;
        font-weight: 700;
    }

    .overview-count {
        margin-left: auto;
        color: #a18f8f;
        font-size: .75rem;
        font-weight: 700;
    }

    .overview-preview {
        display: -webkit-box;
        margin: 12px 0 14px 37px;
        color: #584f4f;
        font-size: .86rem;
        line-height: 1.4;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }

    .overview-action {
        width: 100%;
        min-height: 42px;
        border: 1px solid rgba(207, 24, 33, .25);
        border-radius: 9px;
        background: #fff;
        color: #c9141d;
        font: inherit;
        font-size: .82rem;
        font-weight: 700;
        text-align: left;
        padding: 8px 12px;
        cursor: pointer;
    }

    .overview-action span {
        float: right;
        font-size: 1.1rem;
        line-height: 1;
    }

    .main-content {
        display: block;
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        padding: 12px 12px 12px;
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 25%, #1f1f1f 50%, #2a2a2a 75%, #1e1e1e 100%);
    }

    .section.hub-panel {
        display: block;
        min-height: 0;
        overflow: visible;
        padding: 16px;
        margin-top: 12px;
        border-radius: 14px;
    }

    .section-content {
        overflow: visible;
        flex: none;
    }

    .section h2 {
        font-size: 1.15rem;
    }

    .news-item {
        padding: 16px 0;
    }

    .news-link {
        font-size: .94rem;
    }

    .videos-grid {
        gap: 14px;
    }

    .video-thumbnail-container {
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .video-item {
        cursor: pointer;
    }

    .mini-table-header,
    .mini-table-row {
        grid-template-columns: 28px repeat(8, minmax(22px, 1fr));
        gap: 2px;
        padding-left: 4px;
        padding-right: 4px;
    }

    .mini-table-header {
        font-size: .62rem;
    }

    .mini-table-row {
        font-size: .75rem;
    }

    .match-item {
        padding: 13px 4px;
    }

    .match-row-top {
        display: flex;
        align-items: flex-start;
        gap: 6px;
    }

    .match-teams-line {
        font-size: .88rem;
        overflow-wrap: anywhere;
    }

    .match-status-badge {
        flex-shrink: 0;
        margin-left: auto;
    }

    .app-footer {
        position: relative;
        margin-top: 0;
        background: #e9e9e9;
        backdrop-filter: none;
        padding: 16px 0 calc(16px + env(safe-area-inset-bottom, 0px));
    }

    body {
        background:
            linear-gradient(#e31b23, #e31b23) top / 100% env(safe-area-inset-top, 0px) no-repeat,
            linear-gradient(#e9e9e9, #e9e9e9) bottom / 100% env(safe-area-inset-bottom, 0px) no-repeat,
            #e9e9e9;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

:where(button, a, [tabindex="-1"]):focus-visible {
    outline: 3px solid #ffb3b6;
    outline-offset: 3px;
}

.table-unavailable h3,
.table-unavailable h4 {
    color: rgb(227, 27, 35);
    margin-bottom: 8px;
    font-size: 1rem;
}

.table-unavailable p {
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* CSP-safe utility classes (replace former inline style attributes) */
.is-hidden {
    display: none;
}

.match-error-title {
    color: #E31B23;
}

.match-error-link {
    color: #E31B23;
    text-decoration: none;
}

.matches-empty-note {
    grid-column: 1 / -1;
    text-align: center;
    padding: 16px;
    color: #666;
    font-style: italic;
}
