:root {
    --bg: #0f1115;
    --panel: #15181e;
    --panel-2: #1b1f26;
    --line: #262b33;
    --text: #e7e9ee;
    --muted: #9aa3ad;
    --accent: #ff7a1a;
    --accent-2: #2bd68f;
}

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

body {
    font-family: "Source Sans 3", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

header {
    background: #0c0c0c;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-row {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 16px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

header .logo {
    color: #fff !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

header .logo img {
    width: 28px;
    height: 28px;
}

header .logo h1 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

header .nav-pills {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

header .nav-link {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.event-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 14px 40px;
}

.stats-navigation .btn-back-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 14px;
}

.event-hero {
    background: var(--panel);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
}

.event-competition {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.event-league {
    font-size: 16px;
    font-weight: 700;
}

.event-country {
    color: var(--muted);
    font-size: 13px;
}

.event-scoreboard {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.team-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.team-logo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-logo img {
    width: 46px;
    height: 46px;
    object-fit: contain;
}

.team-name {
    font-weight: 700;
    text-align: center;
}

.score-block {
    min-width: 120px;
    text-align: center;
}

.score {
    font-size: 28px;
    font-weight: 800;
}

.penalty {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    margin-top: 4px;
}

.penalty.is-empty {
    display: none;
}

.status {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.status.live {
    color: var(--accent-2);
    font-weight: 700;
}

.event-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.event-tabs .tab {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
}

.event-tabs .tab.active {
    background: #fff;
    color: #111;
    border-color: transparent;
}

.event-content {
    display: block;
}

.tab-panel {
    display: none;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
}

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

.panel-loading,
.panel-empty {
    text-align: center;
    color: var(--muted);
    padding: 18px 0;
}

.summary-row {
    display: grid;
    grid-template-columns: 1fr 90px 1fr;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    align-items: center;
}

.summary-body {
    background: transparent;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-middle {
    text-align: center;
}

.summary-time {
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
}

.summary-score {
    font-weight: 700;
    margin-top: 4px;
}

.summary-side {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.summary-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-texts {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-name {
    font-weight: 600;
}

.summary-label {
    font-weight: 700;
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
}

.summary-assist {
    font-size: 12px;
    color: var(--muted);
}

.summary-side.right {
    justify-content: flex-end;
    text-align: right;
}

.summary-side.right .summary-content {
    justify-content: flex-end;
}

.summary-side.right .summary-texts {
    align-items: flex-end;
}

.tennis-sets {
    margin-top: 18px;
    width: 100%;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.tennis-sets-header,
.tennis-sets-row {
    display: grid;
    grid-template-columns: repeat(var(--set-count, 3), minmax(18px, 1fr)) 54px;
    gap: 10px;
    align-items: center;
    justify-items: end;
}

.tennis-sets-header {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0 8px 6px;
}

.tennis-sets-row {
    font-size: 13px;
    font-weight: 700;
    padding: 6px 8px;
    border-top: 1px solid var(--line);
}

.tennis-sets-row span {
    min-width: 18px;
    text-align: right;
}

.tennis-sets-total {
    min-width: 46px;
    text-align: right;
}

.tennis-sets-row sup {
    font-size: 0.65em;
    vertical-align: super;
    margin-left: 1px;
}

.tennis-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tennis-summary-row {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
}

.tennis-summary-time {
    display: inline-block;
    min-width: 44px;
    margin-right: 8px;
    color: var(--muted);
    font-weight: 600;
}

.commentary-row {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    align-items: start;
}

.commentary-time {
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

.commentary-text {
    color: var(--text);
    line-height: 1.5;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.info-card {
    background: var(--panel-2);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.info-label {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.info-value {
    font-weight: 700;
}

.stat-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.stat-values {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.stat-label {
    text-align: center;
    color: var(--muted);
    font-weight: 600;
}

.stat-bar {
    margin-top: 8px;
    height: 6px;
    background: #2a2f36;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.stat-bar.split::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    transform: translateX(-2px);
    background: #0f1115;
}

.stat-bar-home {
    position: absolute;
    right: 50%;
    top: 0;
    bottom: 0;
    background: #b8b8b8;
}

.stat-bar-away {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    background: #3b82f6;
}

.lineups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.lineups-title {
    font-weight: 700;
    margin-bottom: 10px;
}

.lineups-section {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
}

.lineups-player {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lineups-player:last-child {
    border-bottom: none;
}

.lineups-subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.table-wrap {
    width: 100%;
}

.table-filters,
.h2h-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.table-filter,
.h2h-tab {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
}

.table-filter.active,
.h2h-tab.active {
    background: #fff;
    color: #111;
    border-color: transparent;
}

.table-head,
.table-row {
    display: grid;
    grid-template-columns: 28px 1.6fr repeat(8, 36px);
    gap: 6px;
    align-items: center;
    padding: 8px 0;
}

.table-head {
    color: var(--muted);
    font-weight: 700;
    border-bottom: 1px solid var(--line);
}

.table-row {
    border-bottom: 1px solid var(--line);
}

.table-row:last-child {
    border-bottom: none;
}

.table-team {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.team-badge img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.table-head.form,
.table-row.form {
    grid-template-columns: 28px 1.4fr 1fr;
}

.table-form {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.form-pill {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    background: #2b2b2b;
    color: #fff;
}

.form-pill.w { background: #19d38e; color: #0b1c13; }
.form-pill.d { background: #9b9b9b; color: #111; }
.form-pill.l { background: #ff4d4d; color: #fff; }

.h2h-section {
    margin-bottom: 16px;
}

.h2h-stage {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.h2h-stage-name {
    font-weight: 700;
}

.h2h-stage-country {
    color: var(--muted);
    font-size: 12px;
}

.h2h-row {
    display: grid;
    grid-template-columns: 120px 1fr 60px 40px;
    gap: 10px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.h2h-row:last-child {
    border-bottom: none;
}

.h2h-meta {
    display: grid;
    gap: 4px;
}

.h2h-date,
.h2h-status {
    color: var(--muted);
    font-size: 12px;
}

.h2h-status {
    text-align: left;
}

.h2h-score {
    text-align: center;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.h2h-result {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.h2h-result.w { background: #19d38e; color: #0b1c13; }
.h2h-result.l { background: #ff4d4d; color: #fff; }
.h2h-result.d { background: #ff9f2d; color: #111; }

.lineups-section {
    margin-bottom: 16px;
}

.lineups-title {
    font-weight: 700;
    margin-bottom: 8px;
}

.lineups-list {
    display: grid;
    gap: 6px;
}

.lineups-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-number {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.lineups-subtitle {
    color: var(--muted);
    font-weight: 700;
    margin: 12px 0 8px;
}

.lineups-team-header {
    font-weight: 700;
    margin-bottom: 6px;
}

.lineups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.lineups-subrow {
    display: grid;
    grid-template-columns: 50px 1fr 1fr;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
}

.lineups-subrow:last-child {
    border-bottom: none;
}

.sub-time {
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
}

.sub-out {
    color: var(--muted);
}

.sub-in {
    font-weight: 700;
}

.lineups-meta {
    color: var(--muted);
    font-size: 12px;
    margin-left: 8px;
}

@media (max-width: 768px) {
    .event-scoreboard {
        grid-template-columns: 1fr auto 1fr;
        gap: 10px;
    }

    .team-logo {
        width: 56px;
        height: 56px;
    }

    .team-logo img {
        width: 40px;
        height: 40px;
    }

    .commentary-row {
        grid-template-columns: 56px 1fr;
    }

    .table-head,
    .table-row {
        grid-template-columns: 24px 1.4fr repeat(4, 32px);
    }

    .table-head span:nth-child(n+6),
    .table-row span:nth-child(n+6) {
        display: none;
    }

    .h2h-row {
        grid-template-columns: 100px 1fr 50px 34px;
    }
}

@media (max-width: 600px) {
    .h2h-row {
        grid-template-columns: 96px 1fr 52px 32px;
        align-items: center;
        gap: 8px;
    }

    .h2h-status {
        text-align: left;
    }

    .h2h-teams {
        display: grid;
        gap: 6px;
        font-size: 13px;
    }

    .h2h-score {
        justify-self: end;
    }

    .h2h-result {
        width: 28px;
        height: 28px;
    }

    .h2h-teams .team-badge {
        width: 18px;
        height: 18px;
    }

    .h2h-teams .team-badge img {
        width: 14px;
        height: 14px;
    }

    .tennis-sets-header,
    .tennis-sets-row {
        gap: 6px;
    }

    .tennis-sets-header {
        font-size: 11px;
    }

    .tennis-sets-row {
        font-size: 12px;
    }

    .tennis-sets-total {
        min-width: 36px;
    }

    .tennis-summary-row {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .event-page {
        padding: 12px 10px 32px;
    }

    .team-logo {
        width: 52px;
        height: 52px;
    }

    .team-logo img {
        width: 38px;
        height: 38px;
    }

    .score {
        font-size: 24px;
    }

    .event-tabs .tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    .tennis-sets-header,
    .tennis-sets-row {
        gap: 4px;
    }

    .tennis-sets-header {
        font-size: 10px;
    }

    .tennis-sets-row {
        font-size: 11px;
    }

    .tennis-sets-total {
        min-width: 32px;
    }
}

/* Basketball event additions */
.basketball-periods {
    margin-top: 18px;
    padding: 16px 18px;
    background: #1b1f27;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: grid;
    gap: 10px;
}

.basketball-periods .periods-header,
.basketball-periods .periods-row {
    display: grid;
    grid-template-columns: repeat(var(--period-count, 4), minmax(28px, 1fr)) 52px;
    gap: 8px;
    align-items: center;
    text-align: center;
    font-size: 0.9rem;
}

.basketball-periods .periods-header {
    color: #8ea1b4;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
}

.basketball-periods .periods-row {
    color: #e8eef6;
    font-weight: 600;
}

.basketball-periods .periods-total {
    text-align: right;
    font-weight: 700;
}

.basketball-periods .periods-row.away {
    color: #c7d2df;
}

.standings-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.standings-tab {
    padding: 8px 16px;
    border-radius: 999px;
    background: #12151c;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #c9d3de;
    font-weight: 600;
    cursor: pointer;
}

.standings-tab.active {
    background: #f4f6f9;
    color: #0f1218;
    border-color: transparent;
}

.standings-table {
    display: grid;
    gap: 14px;
}

.standings-group {
    background: #151a22;
    border-radius: 16px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.standings-group-title {
    font-size: 0.8rem;
    color: #9bb0c4;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.standings-head,
.standings-row {
    display: grid;
    grid-template-columns: 40px 1fr repeat(7, 48px);
    gap: 8px;
    align-items: center;
    min-width: 720px;
}

.standings-head {
    color: #8ea1b4;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 6px;
}

.standings-row {
    padding: 8px 6px;
    border-radius: 12px;
}

.standings-row + .standings-row {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.standings-team {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.standings-team img {
    width: 24px;
    height: 24px;
}

.standings-head span,
.standings-row span {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .basketball-periods {
        padding: 12px;
    }

    .basketball-periods .periods-header,
    .basketball-periods .periods-row {
        grid-template-columns: repeat(var(--period-count, 4), minmax(22px, 1fr)) 44px;
        font-size: 0.8rem;
    }

    .standings-head,
    .standings-row {
        grid-template-columns: 28px 1fr repeat(7, 34px);
        font-size: 0.78rem;
        min-width: 620px;
    }

    .standings-team img {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .standings-head,
    .standings-row {
        grid-template-columns: 24px 1fr repeat(7, 28px);
        font-size: 0.7rem;
        min-width: 560px;
    }
}
