:root {
    --bg: #061829;
    --panel: rgba(16, 50, 79, 0.78);
    --panel-strong: rgba(15, 44, 71, 0.92);
    --line: rgba(150, 190, 218, 0.24);
    --text: #eff8ff;
    --muted: #a8c4da;
    --blue: #2077ba;
    --blue-dark: #0c4d83;
    --green: #78b52d;
    --lime: #b8ec42;
    --red: #ff4e5e;
    --yellow: #fff6a8;
    --row: #f6f8fa;
    --row-alt: #eef4f8;
    --row-border: #cfdae4;
    --market-title: #cfdae4;
    --locked: #7d8b97;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
}

.login-page {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(1, 16, 31, 0.88), rgba(10, 62, 100, 0.48)),
        url("../stadium-bg.png") center / cover no-repeat fixed;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(440px, 100%);
    padding: 34px;
    border: 1px solid rgba(218, 238, 255, 0.28);
    border-radius: 8px;
    background: rgba(9, 34, 56, 0.56);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
    backdrop-filter: blur(18px);
}

.login-mark {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    color: #dff4ff;
}

.login-mark span,
.brand-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lime), #1a9eff);
    box-shadow: 0 0 22px rgba(184, 236, 66, 0.75);
}

.login-card h1 {
    margin: 0 0 26px;
    font-size: clamp(30px, 6vw, 54px);
    line-height: 0.95;
    letter-spacing: 0;
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form label {
    display: grid;
    gap: 8px;
    color: #c6dcee;
    font-size: 13px;
}

.login-form input {
    width: 100%;
    height: 48px;
    border: 1px solid rgba(204, 232, 255, 0.34);
    border-radius: 6px;
    padding: 0 14px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.login-form input:focus {
    border-color: rgba(184, 236, 66, 0.85);
    box-shadow: 0 0 0 3px rgba(184, 236, 66, 0.16);
}

.login-form button {
    height: 50px;
    border: 0;
    border-radius: 6px;
    color: #06203a;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(135deg, #b8ec42, #28a8ff);
}

.login-error {
    border: 1px solid rgba(255, 78, 94, 0.44);
    border-radius: 6px;
    padding: 10px 12px;
    color: #ffd9dd;
    background: rgba(255, 78, 94, 0.14);
}

.app-page {
    min-height: 100vh;
    background: #e9f0f5;
}

.app-shell {
    min-height: 100vh;
    background: #e9f0f5;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto minmax(320px, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(164, 209, 240, 0.25);
    background: rgba(6, 28, 49, 0.9);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 190px;
}

.brand strong {
    display: block;
    font-size: 15px;
}

.brand small {
    color: var(--muted);
}

.endpoint-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.endpoint-chip {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid rgba(152, 198, 230, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
}

.endpoint-chip span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.endpoint-chip code {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #eaf8ff;
    font-size: 12px;
}

.status-panel {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.switcher {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #d8eaf6;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}

.switcher input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switcher span {
    position: relative;
    width: 34px;
    height: 18px;
    border-radius: 999px;
    background: #33566f;
    transition: background 180ms ease;
}

.switcher span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d9e6ef;
    transition: transform 180ms ease;
}

.switcher input:checked + span {
    background: #77b82c;
}

.switcher input:checked + span::after {
    transform: translateX(16px);
}

.time-pill {
    display: grid;
    gap: 1px;
    min-width: 92px;
    padding: 6px 9px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
}

.time-pill span {
    color: var(--muted);
    font-size: 11px;
}

.time-pill strong {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.logout-link {
    padding: 8px 10px;
    border-radius: 6px;
    color: #dbeefa;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.07);
}

.main-stage {
    padding-bottom: 28px;
    background: #e9f0f5;
}

.match-hero {
    position: relative;
    overflow: hidden;
    min-height: 232px;
    border-bottom: 1px solid rgba(144, 190, 222, 0.22);
    background:
        linear-gradient(90deg, rgba(5, 25, 43, 0.94), rgba(20, 72, 112, 0.74), rgba(5, 25, 43, 0.94)),
        url("../stadium-bg.png") center / cover no-repeat;
}

.match-hero::before {
    content: "";
    position: absolute;
    inset: 32px 10px auto;
    height: 1px;
    background: rgba(202, 229, 247, 0.22);
    box-shadow: 0 77px 0 rgba(202, 229, 247, 0.16);
}

.match-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(38, 145, 226, 0.24), transparent 45%);
}

.match-summary {
    position: relative;
    z-index: 1;
    min-height: 232px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 26px;
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
}

.team-card {
    display: grid;
    justify-items: center;
    gap: 6px;
    text-align: center;
}

.team-card strong {
    font-size: 15px;
    line-height: 1.25;
}

.team-card small {
    color: #b8d0e2;
    font-size: 12px;
}

.team-badge {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    color: #072a45;
    background: #f8fbff;
    font-size: 12px;
    font-weight: 900;
}

.team-badge.striped {
    color: #f8fbff;
    background: repeating-linear-gradient(90deg, #111 0 6px, #f8fbff 6px 12px);
    text-shadow: 0 1px 2px #000;
}

.score-board {
    display: grid;
    justify-items: center;
    gap: 6px;
    min-width: 188px;
}

.period-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #f4fbff;
    font-size: 13px;
    font-weight: 800;
}

.score-line {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: clamp(48px, 7vw, 64px);
    line-height: 0.9;
    font-weight: 900;
}

.score-line span:first-child {
    color: #4aaaff;
}

.score-line span:last-child {
    color: var(--lime);
}

.score-line i {
    color: #c5d8e8;
    font-style: normal;
}

.score-meta {
    min-width: 96px;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    text-align: center;
    color: #dcecf7;
    background: rgba(255, 255, 255, 0.1);
}

.market-tabs {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0 14px;
    background: #2b76ad;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid #14578d;
}

.tab {
    min-height: 42px;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0 16px;
    color: #d7eaf7;
    font-weight: 800;
    background: transparent;
    cursor: pointer;
}

.tab:last-of-type {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 -3px 0 var(--lime);
}

.tab span {
    color: #c9ddea;
}

.layout-select {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #d7eaf7;
    font-size: 13px;
}

.layout-select select {
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 5px;
    padding: 0 9px;
    color: #fff;
    background: #185f99;
    outline: none;
}

.markets-grid {
    display: grid;
    gap: 10px;
    align-items: start;
    max-height: min(62vh, 640px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 14px 18px;
    background: #e9f0f5;
    scrollbar-color: #2b76ad #d8e4ed;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}

.markets-grid::-webkit-scrollbar {
    width: 10px;
}

.markets-grid::-webkit-scrollbar-track {
    background: #d8e4ed;
}

.markets-grid::-webkit-scrollbar-thumb {
    border: 2px solid #d8e4ed;
    border-radius: 999px;
    background: linear-gradient(180deg, #2b76ad, #78b52d);
}

.markets-grid.cols-1 {
    grid-template-columns: minmax(0, 1fr);
}

.markets-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.markets-grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.market-card {
    overflow: hidden;
    border: 1px solid var(--row-border);
    border-radius: 8px;
    background: #dfe8ef;
}

.market-card.locked {
    opacity: 0.78;
}

.market-head {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 10px;
    color: #23577f;
    background: var(--market-title);
}

.market-title {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
}

.market-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pin {
    color: #5b8fb7;
    font-size: 13px;
}

.market-status {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #275b82;
    font-size: 12px;
    font-weight: 700;
}

.lock-dot {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 4px;
    position: relative;
}

.lock-dot::before {
    content: "";
    position: absolute;
    left: 2px;
    top: -8px;
    width: 8px;
    height: 8px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
}

.selection-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
    padding: 2px;
}

.selection-list.count-1 {
    grid-template-columns: minmax(0, 1fr);
}

.selection-list.count-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.odd-cell {
    position: relative;
    min-width: 0;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 0;
    border-radius: 6px;
    padding: 7px 10px;
    color: #23507a;
    text-align: left;
    background: var(--row);
    cursor: pointer;
    transition: background 220ms ease, color 220ms ease, transform 160ms ease;
}

.odd-cell::after {
    content: "";
    position: absolute;
    right: 4px;
    bottom: 3px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0;
    transition: opacity 180ms ease;
}

.odd-cell:nth-child(2n) {
    background: #fff;
}

.odd-cell span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.odd-cell strong {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 900;
}

.odd-cell.side-home,
.odd-cell.side-under,
.odd-cell.side-yes {
    color: #669d26;
}

.odd-cell.side-away,
.odd-cell.side-over,
.odd-cell.side-no {
    color: var(--red);
}

.odd-cell.side-draw,
.odd-cell.side-neutral {
    color: #1d5586;
}

.odd-cell.changed-up {
    color: #4f8612;
    background: #eefbd8;
    box-shadow: inset 0 0 0 999px rgba(184, 236, 66, 0.15);
}

.odd-cell.changed-up::after {
    border-bottom: 7px solid var(--green);
    opacity: 0.92;
}

.odd-cell.changed-down {
    color: #e83c4d;
    background: #ffe4e7;
    box-shadow: inset 0 0 0 999px rgba(255, 78, 94, 0.13);
}

.odd-cell.changed-down::after {
    bottom: 2px;
    border-top: 7px solid var(--red);
    opacity: 0.92;
}

.odd-cell.changed-up strong,
.odd-cell.changed-down strong {
    animation: digit-pop 560ms ease;
}

.odd-cell.paused-animation strong {
    animation: none;
}

.odd-cell.locked {
    color: #6f7f8e;
    background: #e1e7ec;
    cursor: not-allowed;
}

.odd-cell.locked::after {
    display: none;
}

.odd-cell.locked span,
.odd-cell.locked strong {
    opacity: 0.46;
}

.odd-cell.locked .cell-lock {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #244d6d;
    font-size: 12px;
    font-weight: 900;
    background: rgba(213, 222, 230, 0.72);
}

.empty-state {
    grid-column: 1 / -1;
    padding: 28px;
    border: 1px dashed #aec1cf;
    border-radius: 8px;
    color: #4a6980;
    text-align: center;
    background: #f7fbfe;
}

.bet-log {
    margin: 0 14px 26px;
    border: 1px solid rgba(25, 86, 130, 0.18);
    border-radius: 8px;
    color: #123f62;
    background: #f7fbfe;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.bet-log summary {
    min-height: 46px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    cursor: pointer;
    list-style: none;
    background: linear-gradient(90deg, #e9f2f8, #f8fbfe);
}

.bet-log summary::-webkit-details-marker {
    display: none;
}

.bet-log summary::after {
    content: "+";
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 900;
    background: #2b76ad;
}

.bet-log[open] summary::after {
    content: "-";
    background: #78b52d;
}

.bet-log-title {
    font-size: 14px;
    font-weight: 900;
}

.bet-log-state {
    min-width: 0;
    overflow: hidden;
    color: #58758b;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bet-log summary strong {
    min-width: 30px;
    padding: 4px 8px;
    border-radius: 999px;
    color: #fff;
    text-align: center;
    background: #174f7f;
}

.bet-log-body {
    max-height: 280px;
    overflow: auto;
    scrollbar-color: #2b76ad #edf3f7;
    scrollbar-width: thin;
}

.bet-log-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.bet-log-body::-webkit-scrollbar-track {
    background: #edf3f7;
}

.bet-log-body::-webkit-scrollbar-thumb {
    border: 2px solid #edf3f7;
    border-radius: 999px;
    background: linear-gradient(180deg, #2b76ad, #78b52d);
}

.bet-log table {
    width: 100%;
    min-width: 1060px;
    border-collapse: collapse;
    font-size: 12px;
}

.bet-log th,
.bet-log td {
    padding: 8px 10px;
    border-top: 1px solid #dde6ee;
    text-align: left;
    white-space: nowrap;
}

.bet-log th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #456982;
    font-size: 11px;
    font-weight: 800;
    background: #edf3f7;
}

.bet-log td:nth-child(7) {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bet-log tbody tr:nth-child(even) {
    background: #f0f6fa;
}

.bet-status-ok {
    color: #178a28;
    font-weight: 900;
}

.bet-status-error {
    color: #d13c4b;
    font-weight: 900;
}

.device-cell {
    text-align: center;
}

.device-icon {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: #174f7f;
    vertical-align: middle;
}

.device-icon::before,
.device-icon::after {
    content: "";
    position: absolute;
}

.device-android::before {
    width: 16px;
    height: 11px;
    border-radius: 5px 5px 3px 3px;
    background: #78b52d;
}

.device-android::after {
    top: 4px;
    width: 18px;
    height: 9px;
    border-left: 2px solid #78b52d;
    border-right: 2px solid #78b52d;
    box-shadow: -5px -4px 0 -4px #78b52d, 5px -4px 0 -4px #78b52d;
}

.device-ios::before {
    width: 13px;
    height: 17px;
    border: 2px solid #174f7f;
    border-radius: 4px;
    background: #f8fbfe;
}

.device-ios::after {
    bottom: 4px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #174f7f;
}

.device-desktop::before {
    width: 18px;
    height: 12px;
    border: 2px solid #174f7f;
    border-radius: 2px;
    background: #f8fbfe;
}

.device-desktop::after {
    bottom: 2px;
    width: 12px;
    height: 5px;
    border-bottom: 2px solid #174f7f;
    border-radius: 0 0 2px 2px;
}

.device-web::before {
    width: 18px;
    height: 18px;
    border: 2px solid #2b76ad;
    border-radius: 50%;
}

.device-web::after {
    width: 2px;
    height: 18px;
    border-left: 1px solid #2b76ad;
    border-right: 1px solid #2b76ad;
    box-shadow: 0 8px 0 -7px #2b76ad, 0 -8px 0 -7px #2b76ad;
}

@keyframes digit-pop {
    0% {
        transform: translateY(0) scale(1);
        filter: brightness(1);
    }

    38% {
        transform: translateY(-3px) scale(1.16);
        filter: brightness(1.18);
    }

    100% {
        transform: translateY(0) scale(1);
        filter: brightness(1);
    }
}

@media (max-width: 1180px) {
    .topbar {
        grid-template-columns: 1fr;
    }

    .status-panel {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .markets-grid.cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .endpoint-strip,
    .markets-grid.cols-2,
    .markets-grid.cols-3 {
        grid-template-columns: 1fr;
    }

    .market-tabs {
        overflow-x: auto;
        padding: 0 8px;
    }

    .tab {
        flex: 0 0 auto;
        padding: 0 13px;
    }

    .layout-select {
        flex: 0 0 auto;
        padding-left: 10px;
    }

    .match-summary {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 24px 0;
    }

    .match-hero,
    .match-summary {
        min-height: 0;
    }

    .team-card {
        grid-template-columns: auto 1fr;
        justify-items: start;
        width: min(320px, 100%);
        margin: 0 auto;
        text-align: left;
    }

    .team-card small {
        grid-column: 2;
    }

    .score-board {
        order: -1;
    }

    .selection-list,
    .selection-list.count-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .topbar {
        padding: 10px;
    }

    .status-panel {
        gap: 8px;
    }

    .time-pill {
        min-width: 0;
        width: calc(50% - 4px);
    }

    .switcher {
        width: 100%;
        justify-content: space-between;
    }

    .markets-grid {
        padding-left: 8px;
        padding-right: 8px;
    }

    .bet-log {
        margin-left: 8px;
        margin-right: 8px;
    }

    .login-card {
        padding: 26px;
    }
}
