* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--dark-bg-primary); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--dark-primary), var(--dark-secondary)); border-radius: 8px; }
* { scrollbar-width: thin; scrollbar-color: var(--dark-primary) var(--dark-bg-primary); }

body {
    font-family: "Cairo", sans-serif;
    background: var(--dark-bg-primary);
    background-image: var(--dark-gradient-main), var(--dark-gradient-1), var(--dark-gradient-2), var(--dark-gradient-3);
    color: var(--dark-text);
    min-height: 100vh;
    direction: rtl;
    overflow-x: hidden;
}

.view-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 100px;
}

.view-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 3rem 2rem;
    background: var(--dark-bg-secondary);
    border: 1px solid var(--dark-border);
    border-radius: 1.5rem;
    position: relative;
    overflow: hidden;
}

.view-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--dark-primary), var(--dark-secondary), var(--dark-accent), var(--dark-secondary), var(--dark-primary));
    background-size: 200% 100%;
    animation: shimmer 4s linear infinite;
}

.view-header::after {
    content: '';
    position: absolute;
    bottom: -60px; right: -60px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, var(--dark-primary-10) 0%, transparent 70%);
    border-radius: 50%;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.header-logo {
    width: 72px; height: 72px;
    margin: 0 auto 1rem;
    display: block;
    filter: drop-shadow(0 0 20px var(--dark-primary-50));
}

.view-header h1 {
    font-size: clamp(1.5rem, 4vw, 2.75rem);
    background: linear-gradient(135deg, var(--dark-primary), var(--dark-secondary), var(--dark-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    line-height: 1.2;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--error-light);
    border: 1px solid var(--error-border);
    color: var(--error-primary);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    margin-top: 1rem;
    letter-spacing: 0.05em;
}

.live-badge .dot {
    width: 8px; height: 8px;
    background: var(--error-primary);
    border-radius: 50%;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.section-title {
    font-size: 1.75rem;
    color: var(--dark-secondary);
    margin: 2.5rem 0 1.5rem;
    padding-bottom: 0.75rem;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--dark-primary-40), transparent);
    border-radius: 2px;
}

.section-title svg {
    width: 28px; height: 28px;
    color: var(--dark-primary);
    flex-shrink: 0;
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-chip {
    background: var(--dark-bg-secondary);
    border: 1px solid var(--dark-border);
    border-radius: 1rem;
    padding: 1.25rem 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-chip:hover {
    border-color: var(--dark-primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px var(--dark-shadow);
}

.stat-chip .stat-number {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--dark-primary), var(--dark-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-chip .stat-label {
    font-size: 0.8rem;
    color: var(--white-50);
    font-weight: 600;
}

.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.match-display-card {
    background: var(--dark-bg-secondary);
    border: 1px solid var(--dark-border);
    border-radius: 1.25rem;
    padding: 1.75rem;
    box-shadow: 0 8px 32px var(--dark-shadow);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.match-display-card.is-running {
    border-color: var(--success-2-500);
    box-shadow: 0 0 0 1px var(--success-2-500), 0 8px 32px var(--success-2-20);
}

.match-display-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 48px var(--dark-primary-30);
}

.match-status-pill {
    position: absolute;
    top: 1rem; left: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.match-status-pill.live {
    background: var(--error-light);
    border: 1px solid var(--error-border);
    color: var(--error-primary);
}

.match-status-pill.paused {
    background: var(--warning-light);
    border: 1px solid var(--warning-border);
    color: var(--warning-primary);
}

.match-display-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 1.5rem 0 1.25rem;
}

.team-name-view {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark-text);
    text-align: center;
    flex: 1;
    line-height: 1.2;
}

.vs-badge {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--white-40);
    padding: 0.25rem 0.5rem;
    background: var(--white-05);
    border-radius: 0.5rem;
    letter-spacing: 0.1em;
    flex-shrink: 0;
}

.match-display-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.score-num {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--dark-primary), var(--dark-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-variant-numeric: tabular-nums;
    min-width: 2.5ch;
    text-align: center;
}

.score-sep {
    font-size: 2.5rem;
    color: var(--white-20);
    font-weight: 300;
    line-height: 1;
}

.match-display-timer {
    text-align: center;
    font-size: 1.5rem;
    color: var(--dark-secondary);
    background: var(--dark-bg-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 2px solid var(--dark-border);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: all 0.3s ease;
    letter-spacing: 0.05em;
}

.match-display-timer.active {
    color: var(--success-2-500);
    border-color: var(--success-2-500);
    animation: timerPulse 2s infinite;
}

@keyframes timerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
}

.group-display-card {
    background: var(--dark-bg-secondary);
    border: 1px solid var(--dark-border);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 8px 32px var(--dark-shadow);
    transition: all 0.3s ease;
}

.group-display-card:hover {
    border-color: var(--dark-primary-40);
    transform: translateY(-3px);
}

.group-display-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--dark-primary-10), var(--dark-secondary-05));
    border-bottom: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.group-display-header h3 {
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--dark-primary), var(--dark-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.group-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--dark-primary), var(--dark-secondary));
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--white);
    flex-shrink: 0;
}

.group-table {
    width: 100%;
    border-collapse: collapse;
}

.group-table th {
    padding: 0.75rem 1rem;
    text-align: center;
    color: var(--white-50);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--dark-border);
    background: var(--dark-bg-primary);
}

.group-table td {
    padding: 0.875rem 1rem;
    text-align: center;
    color: var(--dark-text);
    border-bottom: 1px solid var(--white-05);
    font-size: 0.95rem;
    transition: background 0.2s;
}

.group-table tbody tr:last-child td { border-bottom: none; }

.group-table tbody tr:hover td { background: var(--dark-primary-05); }

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--dark-bg-primary);
    border: 1px solid var(--dark-border);
    color: var(--white-70);
    font-weight: 700;
    font-size: 0.85rem;
}

.rank-badge.first {
    background: linear-gradient(135deg, var(--warn-400), var(--warn-500));
    border-color: transparent;
    color: var(--dark-bg-primary);
    box-shadow: 0 4px 12px var(--warning-shadow);
}

.rank-badge.second {
    background: linear-gradient(135deg, var(--neutral-slate-300), var(--neutral-slate-400));
    border-color: transparent;
    color: var(--dark-bg-primary);
}

.rank-badge.third {
    background: linear-gradient(135deg, var(--brand-orange), var(--warn-2-600));
    border-color: transparent;
    color: var(--white);
}

.wins-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--success-light);
    border: 1px solid var(--success-border);
    color: var(--success-primary);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    min-width: 36px;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--white-30);
    font-size: 1.1rem;
    font-style: italic;
    background: var(--dark-bg-secondary);
    border: 2px dashed var(--dark-border);
    border-radius: 1.25rem;
}

.empty-state svg {
    width: 48px; height: 48px;
    color: var(--dark-border);
    margin: 0 auto 1rem;
    display: block;
}

.app-footer {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(24px);
    border-top: 1px solid var(--white-08);
    background: var(--topbar-dark-bg);
    z-index: 1000;
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--white-50);
}

.footer-dev a {
    text-decoration: none;
    font-weight: 800;
    color: var(--dark-secondary);
    transition: color 0.2s;
}

.footer-dev a:hover { color: var(--dark-accent); }

@media (max-width: 768px) {
    .view-container { padding: 1rem 1rem 100px; }
    .view-header { padding: 2rem 1rem; }
    .matches-grid, .groups-grid { grid-template-columns: 1fr; }
    .score-num { font-size: 3rem; }
    .section-title { font-size: 1.4rem; }
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    .app-footer { height: auto; padding: 0.75rem 1rem; }
    .footer-content { flex-direction: column; gap: 4px; text-align: center; }
}