:root {
    color-scheme: dark;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(
            circle at 85% 0%,
            rgba(132, 37, 255, 0.16),
            transparent 34rem
        ),
        #07070c;
    color: #fff;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.c4-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 56px 0 80px;
}

.c4-header {
    margin-bottom: 30px;
}

.c4-back {
    display: inline-block;
    margin-bottom: 26px;
    color: #c780ff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.c4-kicker {
    margin-bottom: 7px;
    color: #db36ff;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.14em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(46px, 8vw, 80px);
    line-height: 0.96;
    letter-spacing: -0.04em;
}

.c4-header p {
    max-width: 660px;
    color: #bbb3ca;
    line-height: 1.7;
}

.c4-panel {
    margin-bottom: 24px;
    padding: 26px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 22px;
    background:
        rgba(17, 15, 24, 0.94);
    box-shadow:
        0 20px 80px rgba(0, 0, 0, 0.22);
}

.c4-mode-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.c4-mode-card {
    min-height: 190px;
    padding: 26px;
    border: 1px solid rgba(197, 66, 255, 0.34);
    border-radius: 18px;
    background:
        linear-gradient(
            145deg,
            rgba(139, 33, 219, 0.17),
            rgba(19, 16, 27, 0.96)
        );
    color: #fff;
    text-align: left;
    transition:
        transform 150ms ease,
        border-color 150ms ease;
}

.c4-mode-card:hover {
    transform: translateY(-3px);
    border-color: #d83aff;
}

.c4-mode-icon {
    display: block;
    margin-bottom: 20px;
    font-size: 34px;
}

.c4-mode-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 24px;
}

.c4-mode-card > span:last-child {
    color: #bdb6c9;
    line-height: 1.5;
}

.c4-section-head,
.c4-game-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.c4-search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 18px;
}

.c4-search-row input {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    outline: none;
    background: #111017;
    color: #fff;
}

.c4-search-row input:focus {
    border-color: #bd36ff;
}

.c4-search-row button,
.c4-secondary,
.c4-danger {
    padding: 13px 17px;
    border: 0;
    border-radius: 11px;
    font-weight: 950;
}

.c4-search-row button {
    background:
        linear-gradient(
            135deg,
            #8527ff,
            #d13fff
        );
    color: #fff;
}

.c4-secondary {
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: #17141d;
    color: #fff;
}

.c4-danger {
    background: #4a1720;
    color: #ffb0bc;
}

.c4-player-list,
.c4-challenge-list {
    display: grid;
    gap: 9px;
}

.c4-player-row,
.c4-challenge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: #121018;
}

.c4-player-row button,
.c4-challenge-actions button {
    padding: 9px 12px;
    border: 0;
    border-radius: 9px;
    background: #912cff;
    color: #fff;
    font-size: 12px;
    font-weight: 950;
}

.c4-challenge-actions {
    display: flex;
    gap: 7px;
}

.c4-challenge-actions
button:last-child {
    background: #26212d;
}

.c4-online-columns {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 26px;
}

.c4-online-box {
    min-height: 150px;
    padding: 17px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    background: #0d0c12;
}

.c4-online-box h3 {
    font-size: 15px;
}

.c4-empty {
    color: #80798d;
    font-size: 14px;
}

.c4-game-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.c4-turn {
    color: #c9c1d7;
}

.c4-players {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.c4-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 13px;
    background: #0e0d13;
}

.c4-player-dot {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
}

.c4-player-red .c4-player-dot {
    background: #ff4160;
    box-shadow:
        0 0 22px rgba(255, 65, 96, 0.35);
}

.c4-player-yellow .c4-player-dot {
    background: #ffd84c;
    box-shadow:
        0 0 22px rgba(255, 216, 76, 0.30);
}

.c4-player-label {
    display: block;
    color: #777080;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
}

.c4-board {
    display: grid;
    grid-template-columns:
        repeat(7, 1fr);
    gap: 8px;
    width: min(700px, 100%);
    margin: 0 auto;
    padding: 16px;
    border: 1px solid rgba(181, 55, 255, 0.5);
    border-radius: 22px;
    background:
        linear-gradient(
            160deg,
            #332047,
            #1a1224
        );
}

.c4-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 0;
    border-radius: 50%;
    background: #09080d;
    box-shadow:
        inset 0 6px 14px rgba(0,0,0,0.6);
}

.c4-cell:not(:disabled):hover {
    outline: 3px solid rgba(213, 68, 255, 0.35);
}

.c4-cell::after {
    content: "";
    position: absolute;
    inset: 8%;
    border-radius: 50%;
}

.c4-cell.red::after {
    background:
        radial-gradient(
            circle at 35% 30%,
            #ff889b,
            #ff3557 44%,
            #ae1832
        );
}

.c4-cell.yellow::after {
    background:
        radial-gradient(
            circle at 35% 30%,
            #fff5ad,
            #ffd739 44%,
            #cc9d0c
        );
}

.c4-status {
    min-height: 24px;
    margin-top: 17px;
    color: #c8bfd3;
    text-align: center;
    font-size: 14px;
}

.c4-status.error {
    color: #ff8b9e;
}

.c4-status.success {
    color: #8dffbd;
}

.c4-stats {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.c4-stats > div {
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 13px;
    background: #0d0c12;
}

.c4-stats span {
    display: block;
    margin-bottom: 5px;
    color: #777080;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.09em;
}

.c4-stats strong {
    font-size: 22px;
}

@media (max-width: 720px) {

    .c4-shell {
        width: min(100% - 18px, 1180px);
        padding-top: 28px;
    }

    .c4-panel {
        padding: 17px;
        border-radius: 17px;
    }

    .c4-mode-grid,
    .c4-online-columns,
    .c4-players {
        grid-template-columns: 1fr;
    }

    .c4-section-head,
    .c4-game-head {
        flex-direction: column;
    }

    .c4-board {
        gap: 5px;
        padding: 10px;
        border-radius: 16px;
    }

    .c4-stats {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}
/* BIFF3EN_CONNECT4_LEADERBOARD_V1 */

.c4-leaderboard-panel {
    margin-top: 24px;
}

.c4-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: #0d0c12;
}

.c4-leaderboard {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.c4-leaderboard th,
.c4-leaderboard td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    text-align: left;
}

.c4-leaderboard th {
    color: #8d8499;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.09em;
}

.c4-leaderboard td {
    color: #d8d1e3;
    font-size: 14px;
}

.c4-leaderboard tbody tr:last-child td {
    border-bottom: 0;
}

.c4-leaderboard tbody tr:hover {
    background: rgba(174, 54, 255, 0.08);
}

.c4-leaderboard-rank {
    color: #d73aff;
    font-weight: 950;
}

.c4-leaderboard-player {
    color: #fff;
    font-weight: 900;
}

.c4-leaderboard-you {
    background: rgba(176, 50, 255, 0.12);
}

.c4-leaderboard-empty {
    color: #777080 !important;
    text-align: center !important;
}

@media (max-width: 720px) {

    .c4-leaderboard th,
    .c4-leaderboard td {
        padding: 12px;
        font-size: 12px;
    }
}
/* BIFF3EN_CONNECT4_MATCHMAKING_V1 */

.c4-matchmaking-box {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        auto;
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px;
    border: 1px solid rgba(204, 58, 255, 0.28);
    border-radius: 16px;
    background:
        linear-gradient(
            145deg,
            rgba(135, 32, 219, 0.12),
            rgba(12, 11, 17, 0.94)
        );
}

.c4-matchmaking-box h3 {
    margin-bottom: 6px;
}

.c4-matchmaking-box p {
    margin-bottom: 0;
    color: #91899f;
    line-height: 1.5;
}

.c4-matchmaking-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

#matchmakingButton {
    padding: 13px 17px;
    border: 0;
    border-radius: 11px;
    background:
        linear-gradient(
            135deg,
            #8128ff,
            #d33fff
        );
    color: #fff;
    font-weight: 950;
}

#matchmakingButton:disabled {
    opacity: 0.55;
    cursor: default;
}

.c4-matchmaking-status {
    grid-column: 1 / -1;
    min-height: 20px;
    color: #c9c0d7;
    font-size: 14px;
}

.c4-matchmaking-status.searching::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 9px;
    border-radius: 50%;
    background: #c23cff;
    box-shadow:
        0 0 16px rgba(194, 60, 255, 0.75);
    animation:
        c4MatchPulse 1s ease-in-out infinite;
}

@keyframes c4MatchPulse {

    0%,
    100% {
        opacity: 0.35;
        transform: scale(0.75);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@media (max-width: 720px) {

    .c4-matchmaking-box {
        grid-template-columns: 1fr;
    }

    .c4-matchmaking-actions {
        justify-content: flex-start;
    }
}