.ctf-container {
    width: min(1180px, calc(100% - 32px));
    margin: 56px auto 96px;
    padding: 30px;
    border-radius: 30px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.34)),
        radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.85), transparent 22%),
        radial-gradient(circle at 100% 100%, rgba(32, 214, 255, 0.16), transparent 36%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 24px 80px rgba(45, 89, 139, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(26px) saturate(155%);
    -webkit-backdrop-filter: blur(26px) saturate(155%);
}

.ctf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 28px;
}

.page-heading {
    margin: 0;
    color: #08111f;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.leaderboard-link,
.ctf-card .btn {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    color: white;
    font-weight: 800;
    border-radius: 999px;
    background: linear-gradient(135deg, #111827, #246bfe 58%, #20d6ff);
    box-shadow: 0 16px 34px rgba(36, 107, 254, 0.24);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    white-space: nowrap;
}

.leaderboard-link:hover,
.ctf-card .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 42px rgba(36, 107, 254, 0.3);
}

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

.ctf-card {
    min-height: 240px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
    border-radius: 26px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.32)),
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.9), transparent 22%);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 18px 46px rgba(45, 89, 139, 0.14);
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

.ctf-card::before {
    content: "";
    position: absolute;
    right: -34px;
    top: -40px;
    width: 134px;
    height: 134px;
    border-radius: 46% 54% 58% 42% / 38% 42% 58% 62%;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(32, 214, 255, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.68);
}

.ctf-card:hover {
    transform: translateY(-6px);
    border-color: rgba(36, 107, 254, 0.32);
    box-shadow: 0 24px 58px rgba(45, 89, 139, 0.22);
}

.ctf-card h3,
.ctf-card p,
.ctf-card .btn {
    position: relative;
}

.ctf-card h3 {
    margin: 0 0 6px;
    color: #0b1526;
    font-size: clamp(1.55rem, 2.4vw, 1.9rem);
    line-height: 1.16;
}

.ctf-card p {
    margin: 0;
    color: #405066;
    font-size: 1.06rem;
    line-height: 1.7;
}

.ctf-card .btn {
    align-self: flex-start;
    margin-top: auto;
}

body.dark-mode .ctf-container,
body.dark-mode .ctf-card {
    background:
        linear-gradient(145deg, rgba(17, 31, 55, 0.88), rgba(11, 22, 41, 0.72)),
        radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.16), transparent 18%),
        radial-gradient(circle at 100% 100%, rgba(32, 214, 255, 0.15), transparent 36%);
    border-color: rgba(255, 255, 255, 0.16);
}

body.dark-mode .page-heading,
body.dark-mode .ctf-card h3 {
    color: #f4fbff;
}

body.dark-mode .ctf-card p {
    color: #d8e8f7;
}

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

@media (max-width: 640px) {
    .ctf-container {
        width: min(100% - 24px, 1180px);
        margin-top: 36px;
        padding: 20px;
        border-radius: 24px;
    }

    .ctf-header {
        align-items: stretch;
        flex-direction: column;
    }

    .leaderboard-link,
    .ctf-card .btn {
        width: 100%;
    }
}
