:root {
    --bg-0: #09131e;
    --bg-1: #0d1d2c;
    --bg-2: #12263a;
    --surface: rgba(17, 33, 51, 0.88);
    --surface-2: rgba(24, 44, 67, 0.92);
    --line: rgba(136, 181, 230, 0.2);
    --text-0: #f2f7ff;
    --text-1: #b7c8de;
    --brand: #21c89a;
    --brand-2: #1db88e;
    --accent: #39a7ff;
    --danger: #ff6c7a;
    --shadow: 0 16px 45px rgba(0, 0, 0, 0.32);
}

* {
    box-sizing: border-box;
}

body.events-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", system-ui, sans-serif;
    color: var(--text-0);
    background:
        radial-gradient(circle at 12% -5%, rgba(57, 167, 255, 0.28), transparent 40%),
        radial-gradient(circle at 92% 2%, rgba(33, 200, 154, 0.2), transparent 35%),
        linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 48%, #0a1623 100%);
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.4rem;
    background: rgba(5, 13, 22, 0.8);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 20;
}

header h1 {
    margin: 0;
    font-family: "Sora", sans-serif;
    letter-spacing: 0.4px;
    font-size: 1.35rem;
}

nav {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    padding: 0.85rem 1.4rem 0;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    color: var(--text-1);
    background: rgba(14, 35, 55, 0.75);
    border: 1px solid transparent;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.88rem;
}

nav a:hover,
nav a.active {
    color: var(--text-0);
    border-color: rgba(57, 167, 255, 0.35);
    background: rgba(22, 52, 80, 0.9);
}

.events-layout {
    width: min(1460px, 96vw);
    margin: 1rem auto 2rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) 380px;
    align-items: start;
}

.markets-column {
    display: grid;
    gap: 1rem;
}

.page-intro {
    background: linear-gradient(145deg, rgba(22, 48, 75, 0.92), rgba(16, 33, 51, 0.92));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: 16px;
    padding: 1rem 1.1rem;
}

.intro-kicker {
    color: var(--brand);
    font-size: 0.75rem;
    margin: 0;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    font-weight: 800;
}

.page-intro h2 {
    margin: 0.35rem 0 0.4rem;
    font-family: "Sora", sans-serif;
    font-size: 1.3rem;
}

.intro-copy {
    margin: 0;
    color: var(--text-1);
    font-size: 0.92rem;
}

.intro-chips {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.chip {
    font-size: 0.78rem;
    border: 1px solid rgba(120, 161, 207, 0.35);
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    color: #d9e8fa;
    background: rgba(9, 25, 40, 0.75);
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 1rem;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
    gap: 0.8rem;
}

.card-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-family: "Sora", sans-serif;
}

.btn-ghost {
    border: 1px solid rgba(57, 167, 255, 0.35);
    color: var(--text-0);
    background: rgba(14, 35, 53, 0.75);
    border-radius: 10px;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-weight: 700;
}

.btn-ghost:hover {
    border-color: rgba(57, 167, 255, 0.65);
    background: rgba(19, 43, 64, 0.95);
}

.virtual-meta {
    color: var(--text-1);
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.virtual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
    gap: 0.75rem;
}

.virtual-event-card,
.event-card {
    border: 1px solid rgba(118, 168, 220, 0.25);
    border-radius: 13px;
    background: var(--surface-2);
    padding: 0.8rem;
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.virtual-event-card:hover,
.event-card:hover {
    transform: translateY(-2px);
    border-color: rgba(57, 167, 255, 0.5);
    box-shadow: 0 8px 24px rgba(13, 21, 31, 0.3);
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.6rem;
}

.event-header h3 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.25;
}

.event-date {
    color: var(--text-1);
    font-size: 0.78rem;
    white-space: nowrap;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
}

.status.live {
    background: rgba(33, 200, 154, 0.16);
    color: #85f3d3;
}

.status.scheduled {
    background: rgba(57, 167, 255, 0.14);
    color: #9dd6ff;
}

.status.finished {
    background: rgba(255, 108, 122, 0.16);
    color: #ffc2ca;
}

.event-details p {
    margin: 0 0 0.6rem;
    color: var(--text-1);
    font-size: 0.84rem;
}

.teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    font-weight: 700;
}

.team {
    text-align: center;
}

.vs {
    color: var(--text-1);
    font-size: 0.8rem;
}

.odds {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.odds-button {
    width: 100%;
    border: 1px solid rgba(94, 157, 219, 0.33);
    border-radius: 10px;
    background: linear-gradient(160deg, rgba(12, 31, 48, 0.95), rgba(18, 41, 62, 0.95));
    color: var(--text-0);
    padding: 0.5rem 0.4rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    font-size: 0.82rem;
}

.odds-button:hover {
    border-color: rgba(57, 167, 255, 0.7);
}

.odds-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.events-head {
    margin-bottom: 0.8rem;
}

.filter-row {
    display: flex;
    gap: 0.4rem;
}

.filter-btn {
    border: 1px solid rgba(116, 162, 213, 0.35);
    background: rgba(18, 40, 60, 0.88);
    color: var(--text-1);
    border-radius: 999px;
    padding: 0.38rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.filter-btn.active,
.filter-btn:hover {
    color: var(--text-0);
    border-color: rgba(57, 167, 255, 0.75);
}

.sports-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
    margin-bottom: 0.8rem;
}

.sport-pill {
    border: 1px solid rgba(93, 138, 182, 0.36);
    border-radius: 999px;
    color: var(--text-1);
    padding: 0.2rem 0.55rem;
    font-size: 0.74rem;
    background: rgba(10, 25, 40, 0.72);
}

.sport-pill.active,
.sport-pill:hover {
    color: var(--text-0);
    border-color: rgba(57, 167, 255, 0.75);
}

.events-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.slip-column {
    position: sticky;
    top: 94px;
}

.slip-card {
    padding: 0.75rem;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    margin-bottom: 0.7rem;
}

.tab {
    border: 1px solid rgba(97, 147, 196, 0.33);
    background: rgba(14, 35, 53, 0.8);
    color: var(--text-1);
    border-radius: 10px;
    padding: 0.48rem 0.4rem;
    font-size: 0.77rem;
    font-weight: 800;
    cursor: pointer;
}

.tab.active {
    color: var(--text-0);
    border-color: rgba(57, 167, 255, 0.78);
    background: rgba(20, 50, 75, 0.96);
}

.panel-content {
    max-height: 48vh;
    overflow: auto;
}

.placeholder {
    color: var(--text-1);
    margin: 0.3rem 0;
}

.betslip-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.45rem;
}

.betslip-item {
    border: 1px solid rgba(95, 145, 197, 0.28);
    border-radius: 10px;
    padding: 0.55rem;
    background: rgba(11, 27, 41, 0.78);
}

.betslip-item-top {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: flex-start;
}

.betslip-item-title {
    font-size: 0.83rem;
    font-weight: 800;
}

.betslip-item-sub {
    margin-top: 0.2rem;
    color: var(--text-1);
    font-size: 0.75rem;
}

.betslip-remove {
    border: 1px solid rgba(255, 122, 139, 0.6);
    color: #ffc8d0;
    background: rgba(61, 20, 28, 0.7);
    border-radius: 8px;
    font-size: 0.72rem;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
}

.bet-slip-total {
    margin-top: 0.65rem;
    border-top: 1px solid rgba(101, 145, 190, 0.3);
    padding-top: 0.65rem;
}

.bet-slip-summary p {
    margin: 0.35rem 0;
    font-size: 0.86rem;
}

.stake-section {
    display: block;
    margin-top: 0.4rem;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-1);
}

#stakeInput {
    width: 100%;
    border: 1px solid rgba(98, 145, 193, 0.43);
    border-radius: 10px;
    background: rgba(10, 25, 39, 0.85);
    color: var(--text-0);
    padding: 0.5rem 0.6rem;
}

.place-bet-btn {
    margin-top: 0.6rem;
    width: 100%;
    border: 1px solid rgba(45, 191, 150, 0.55);
    color: #e9fff9;
    background: linear-gradient(155deg, rgba(22, 146, 114, 0.95), rgba(17, 118, 93, 0.95));
    border-radius: 10px;
    padding: 0.56rem 0.7rem;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 800;
}

.place-bet-btn:hover {
    background: linear-gradient(155deg, rgba(30, 165, 130, 0.98), rgba(20, 133, 105, 0.98));
}

.place-bet-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bet-slip-notice {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
}

.bet-slip-notice.error {
    color: var(--danger);
}

.bet-slip-notice.success {
    color: var(--brand);
}

.data-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.45rem;
}

.data-list li {
    border: 1px solid rgba(95, 145, 197, 0.28);
    border-radius: 10px;
    padding: 0.52rem;
    background: rgba(11, 27, 41, 0.78);
    font-size: 0.8rem;
}

#betHistoryTable {
    width: 100%;
    border-collapse: collapse;
}

#betHistoryTable th,
#betHistoryTable td {
    border-bottom: 1px solid rgba(103, 148, 192, 0.24);
    padding: 0.4rem 0.3rem;
    text-align: left;
    font-size: 0.74rem;
}

#betHistoryTable th {
    color: #d1e6ff;
    font-weight: 800;
}

.hidden {
    display: none !important;
}

@media (max-width: 1160px) {
    .events-layout {
        grid-template-columns: 1fr;
    }

    .slip-column {
        position: static;
    }
}

@media (max-width: 740px) {
    nav {
        gap: 0.4rem;
        padding-inline: 0.9rem;
    }

    nav a {
        font-size: 0.8rem;
    }

    .events-layout {
        width: 96vw;
    }

    .events-list,
    .virtual-grid {
        grid-template-columns: 1fr;
    }
}
