:root {
    --bg: #f6f7f9;
    --card: #ffffff;
    --border: #e6e8ec;
    --text: #1f2330;
    --muted: #7a8194;
    --accent: #1a8a3a;          /* green like the screenshot */
    --accent-soft: #e6f4eb;
    --orange: #d97706;
    --live: #d9303f;
    --row-alt: #fafbfc;
    --shadow: 0 1px 2px rgba(20, 24, 33, 0.04), 0 4px 16px rgba(20, 24, 33, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

.widget {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 16px;
}

.widget__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0 4px 12px;
}
.widget__title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.widget__meta {
    font-size: 12px;
    color: var(--muted);
}

.widget__main {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 16px;
    align-items: start;
}

@media (max-width: 820px) {
    .widget__main { grid-template-columns: 1fr; }
    .groups-pane { max-height: none !important; }
}

/* ---------- Main pane (live + match lists) ---------- */

.main-pane {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px 20px;
    box-shadow: var(--shadow);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.section-title:first-child { margin-top: 0; }

.dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dot--live {
    background: var(--live);
    box-shadow: 0 0 0 0 rgba(217, 48, 63, 0.6);
    animation: pulse 1.6s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(217, 48, 63, 0.55); }
    70%  { box-shadow: 0 0 0 10px rgba(217, 48, 63, 0); }
    100% { box-shadow: 0 0 0 0 rgba(217, 48, 63, 0); }
}

.empty {
    color: var(--muted);
    font-style: italic;
    padding: 14px 8px;
    text-align: center;
    background: var(--row-alt);
    border-radius: 8px;
}

/* ---------- Live match cards ---------- */

.live-list { display: flex; flex-direction: column; gap: 10px; }

.live-card {
    border: 1px solid var(--border);
    border-left: 4px solid var(--live);
    border-radius: 10px;
    padding: 14px 16px;
    background: #fff8f8;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 14px;
}
.live-card .side {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.live-card .side--away { justify-content: flex-end; text-align: right; }
.live-card .side--away .flag { order: 2; }
.live-card .team-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.live-card .score {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 4px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
}
.live-card .badge {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--live);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* ---------- Match list rows ---------- */

.match-list { display: flex; flex-direction: column; }

.match-row {
    display: grid;
    grid-template-columns: 70px 1fr auto 1fr 60px;
    align-items: center;
    gap: 10px;
    padding: 10px 6px;
    border-bottom: 1px solid var(--border);
}
.match-row:last-child { border-bottom: none; }
.match-row .when {
    font-size: 12px;
    color: var(--muted);
}
.match-row .home,
.match-row .away {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.match-row .away { justify-content: flex-end; }
.match-row .away .flag { order: 2; }
.match-row .name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.match-row .score {
    font-weight: 700;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 8px;
    text-align: center;
    min-width: 48px;
}
.match-row .score--scheduled {
    background: transparent;
    border: none;
    color: var(--muted);
    font-weight: 500;
}
.match-row .score__meta,
.live-card .score__meta {
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    margin-left: 2px;
    letter-spacing: 0.2px;
}
.match-row .group-tag {
    font-size: 11px;
    color: var(--muted);
    text-align: right;
}
.match-list--muted .match-row { opacity: 0.85; }

/* ---------- Groups pane (scrollable on the right) ---------- */

.groups-pane {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    position: sticky;
    top: 16px;
}
.groups-pane::-webkit-scrollbar { width: 8px; }
.groups-pane::-webkit-scrollbar-thumb { background: #d6d9e0; border-radius: 4px; }

.group {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}
.group:last-child { margin-bottom: 0; }

.group__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #fff, #fafbfc);
    border-bottom: 1px solid var(--border);
}
.group__trophy {
    font-size: 16px;
    color: var(--orange);
}
.group__name {
    font-weight: 700;
    font-size: 14px;
}

.group table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.group thead th {
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    padding: 6px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #fafbfc;
}
.group thead th.num,
.group tbody td.num { width: 22px; text-align: center; color: var(--orange); font-weight: 700; }
.group thead th.team { padding-left: 6px; }
.group thead th.center,
.group tbody td.center { text-align: center; }

.group tbody td {
    padding: 6px 4px;
    border-top: 1px solid var(--border);
    color: var(--orange);
    font-weight: 600;
}
.group tbody td.team-cell {
    color: var(--text);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 6px;
}
.group tbody td.team-cell .flag { width: 18px; height: 13px; }
.group tbody td.team-cell .name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}
.group tbody td.pts { font-weight: 700; color: var(--text); }

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    font-size: 11px;
}
.rank-badge--out { background: transparent; color: var(--muted); }

/* ---------- Shared ---------- */

.flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
    background: #eee;
}
