:root {
    --bg-color: #000000;
    /* Pure Black */
    --card-bg: #0a0a0a;
    /* Very dark grey */
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --accent-color: #00f3ff;
    /* Cyan Neon */
    --accent-glow: rgba(0, 243, 255, 0.3);
    --border-color: #222;
    --success-color: #00ff41;
    /* Hacker Green */
    --danger-color: #ff003c;
    /* Cyberpunk Red */
    --warning-color: #ffd27a;
    /* Amber — cautions, highlights, beta/grant accents */
    --font-heading: 'Orbitron', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image:
        linear-gradient(rgba(0, 10, 20, 0.95), rgba(0, 0, 0, 1)),
        repeating-linear-gradient(0deg, transparent, transparent 1px, #111 1px, #111 2px);
    background-size: 100% 100%, 100% 4px;
    color: var(--text-primary);
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Header */
header {
    /* No backdrop-filter: a live blur on a position:sticky bar re-blurs a full-width strip every
       scroll frame (stutters on long pages like /admin). An opaque tint gives the same look at 60fps. */
    background: rgba(8, 13, 19, 0.92);
    border-bottom: 1px solid rgba(0, 243, 255, 0.14);
    padding: 0.55rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 0 rgba(0, 243, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.35);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    font-family: var(--font-mono);
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: inline-flex;
    align-items: baseline;
    gap: 0.35ch;
    white-space: nowrap;   /* brand + Open Beta badge stay on one line */
}
.brand .sep { color: #45555c; font-weight: 400; }
.brand .range-word { color: #e8f0f2; }
.brand { transition: text-shadow 0.2s; }
.brand:hover { text-shadow: 0 0 12px var(--accent-glow); }
/* Hero wordmark — same mono/uppercase/cyan treatment as the navbar brand, scaled up. */
.hero-brand { font-family: var(--font-mono); font-weight: 800; text-transform: uppercase;
    letter-spacing: 3px; color: var(--accent-color); text-shadow: 0 0 18px var(--accent-glow);
    line-height: 1.15; font-size: clamp(1.8rem, 5vw, 3rem); margin: 0.2rem 0; }
.hero-brand .wm-sep { color: #45555c; font-weight: 400; }
.hero-brand .wm-range { color: #e8f0f2; }

nav {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.7rem;
}

/* Hamburger toggle (hidden on desktop) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 36px;
    padding: 6px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: none;
}

.menu-toggle:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-glow);
}

.menu-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.menu-toggle.is-active .menu-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-active .menu-toggle-bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active .menu-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

nav a,
nav .nav-logout button {
    color: #9fb0b6;
    text-decoration: none;
    margin-left: 0;
    padding: 0.4rem 0.8rem;
    transition: color 0.2s, border-color 0.2s, text-shadow 0.2s;
    font-weight: 400;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    font-family: var(--font-mono);   /* Tech feel */
    background: transparent;
    /* Symmetric 1px border on ALL items (links AND pills) so every item is the same height and the
       baselines line up; plain links keep it transparent and only turn the BOTTOM cyan on hover. */
    border: 1px solid transparent;
    border-radius: 0;
    line-height: 1.4;
    cursor: pointer;
    /* Render <a> and the Logout <button> identically so every item is the same height + baseline. */
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    white-space: nowrap;   /* never wrap a link's text -> no uneven item heights as the bar tightens */
    flex: 0 0 auto;        /* keep each item at its natural width (collapse to hamburger before overflow) */
}

/* Sleek underline on hover / current page — no boxes. */
nav a:hover,
nav a.active,
nav .nav-logout button:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    background: transparent;
    box-shadow: none;
    text-shadow: 0 0 8px var(--accent-glow);
}

/* Primary CTA (Sign In) — sleek cyan pill. */
nav .btn-glow {
    background: transparent;
    color: var(--accent-color);
    padding: 0.4rem 1.3rem;
    border: 1px solid var(--accent-color);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 1px;
    box-shadow: none;
    transition: all 0.2s;
}

nav .btn-glow:hover {
    background: var(--accent-color);
    color: #001014;
    box-shadow: 0 0 14px var(--accent-glow);
    transform: translateY(-1px);
}

/* Emphasized links (Submit Flag / Private Containers) — subtle pills, not loud boxes. */
nav .nav-highlight {
    color: var(--accent-color) !important;
    border: 1px solid rgba(0, 243, 255, 0.4);
    border-radius: 999px;
    background: rgba(0, 243, 255, 0.07);
    box-shadow: none;
    font-weight: 700;
}

nav .nav-highlight:hover {
    border-color: var(--accent-color);
    background: rgba(0, 243, 255, 0.16);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    /* Hidden with visibility (not display) so it can fade and linger briefly. Hidden menus
       don't receive clicks. */
    display: block;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s ease, visibility 0s linear 0.3s; /* 0.3s grace before closing */
    position: absolute;
    top: 100%;
    right: 0;
    /* Aligns dropdown to the right edge of button */
    background: rgba(12, 18, 24, 0.98);
    min-width: 190px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 243, 255, 0.18);
    z-index: 1000;
    border-radius: 12px;
    margin-top: 8px;
    padding: 0.3rem;
}

/* Invisible bridge over the gap between the link and the menu, so the pointer never
   passes over "nothing" on the way down. */
.dropdown-content::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -12px;
    height: 12px;
}

.dropdown-content a {
    color: #cbd8dc;
    padding: 0.55rem 0.9rem;
    text-decoration: none;
    display: block;
    text-align: left;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    margin: 0;
}

.dropdown-content a:hover {
    background-color: rgba(0, 243, 255, 0.1);
    color: var(--accent-color);
    border: none;
}

.dropdown:hover .dropdown-content {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* Keyboard users: open when a link inside receives focus. Kept as a separate rule so
   browsers without :has() support still get the hover rule above. */
.dropdown:has(:focus-visible) .dropdown-content {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 3rem auto;
    padding: 0 2rem;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.glow-card {
    border: 1px solid #333;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.glow-card:hover {
    border-color: #444;
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.1);
}

.card h2 {
    font-family: var(--font-heading);
    margin-top: 0;
    border-bottom: 2px solid #222;
    padding-bottom: 1rem;
    font-size: 1.5rem;
    color: #fff;
    text-align: left;
}

/* Cyber Theme Enhancements */
.crt::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

.glitch {
    position: relative;
    color: var(--accent-color);
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75), -0.025em -0.05em 0 rgba(0, 255, 0, 0.75), 0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
    animation: glitch 500ms infinite;
}

@keyframes glitch {
    0% {
        text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75), -0.05em -0.025em 0 rgba(0, 255, 0, 0.75), -0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
    }

    14% {
        text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75), -0.05em -0.025em 0 rgba(0, 255, 0, 0.75), -0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
    }

    15% {
        text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75), 0.025em 0.025em 0 rgba(0, 255, 0, 0.75), -0.05em -0.05em 0 rgba(0, 0, 255, 0.75);
    }

    49% {
        text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75), 0.025em 0.025em 0 rgba(0, 255, 0, 0.75), -0.05em -0.05em 0 rgba(0, 0, 255, 0.75);
    }

    50% {
        text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75), 0.05em 0 0 rgba(0, 255, 0, 0.75), 0 -0.05em 0 rgba(0, 0, 255, 0.75);
    }

    99% {
        text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75), 0.05em 0 0 rgba(0, 255, 0, 0.75), 0 -0.05em 0 rgba(0, 0, 255, 0.75);
    }

    100% {
        text-shadow: -0.025em 0 0 rgba(255, 0, 0, 0.75), -0.025em -0.025em 0 rgba(0, 255, 0, 0.75), -0.025em -0.05em 0 rgba(0, 0, 255, 0.75);
    }
}

/* Daily Top Solver Pop */
.pop-highlight {
    animation: popPulse 2s infinite;
    display: inline-block;
    color: var(--accent-color);
    font-weight: 900;
    text-shadow: 0 0 10px var(--accent-color);
}

@keyframes popPulse {
    0% {
        transform: scale(1);
        text-shadow: 0 0 10px var(--accent-color);
    }

    50% {
        transform: scale(1.2);
        text-shadow: 0 0 20px var(--accent-color), 0 0 30px #fff;
    }

    100% {
        transform: scale(1);
        text-shadow: 0 0 10px var(--accent-color);
    }
}

/* Compact Tables */
table {
    width: 100%;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    border-collapse: separate;
    border-spacing: 0 4px;
    /* Reduced spacing */
}

th {
    padding: 0.5rem;
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: left;
}

td {
    padding: 0.3rem 0.5rem;
    /* More compact */
    background: #0f0f0f;
    border-bottom: 1px solid #111;
    color: #ccc;
    border-left: none;
    border-right: none;
}

/* Rank specific aesthetics */
.rank-1,
.rank-2,
.rank-3 {
    color: var(--accent-color);
    text-shadow: 0 0 5px var(--accent-color);
    font-weight: bold;
}

/* Top 3 scores: make them really pop with a pulsing glow.
   Glow uses currentColor so it matches the score color (green for the top 10). */
.score-top3 {
    font-weight: 900;
    font-size: 1.05rem;
    letter-spacing: 0.03em;
    animation: scoreGlow 1.8s ease-in-out infinite;
}

@keyframes scoreGlow {

    0%,
    100% {
        text-shadow: 0 0 6px currentColor;
    }

    50% {
        text-shadow: 0 0 16px currentColor, 0 0 28px currentColor;
    }
}

tr:hover td {
    background: #151515;
    color: #fff;
    cursor: pointer;
}

/* Pagination Controls */
.pagination {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination button {
    background: #111;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: var(--font-mono);
    text-transform: uppercase;
    transition: 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: var(--accent-color);
    color: #000;
    box-shadow: 0 0 10px var(--accent-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #333;
    color: #555;
}

/* 2-Column Layout */
.leaderboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

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

/* The top menu has three states. The script right after <header> in views/partials/header.ejs picks one by
   MEASURING whether the row fits, because its width depends on the account (a subscriber and an admin have
   more items) and on the Open Beta badge, so no single screen width is right for everyone:
     (no class)        one row, as designed
     html.nav-tight    the same row with less space between the items, when the designed row does not fit
     html.nav-compact  the hamburger: when even the tight row does not fit, and always at 1200px and below
   Links never wrap and never run off the screen. :where() adds no weight, so each rule below still loses to
   and wins over exactly the rules it did when this block was a plain media query. */

/* Before that script has decided (it then adds html.nav-ready), a screen of 1200px or less starts collapsed, so
   a phone never paints the wide row. The script reads THIS rule to learn the breakpoint ("is the hamburger
   showing?"), so the number 1200 lives only here. */
@media (max-width: 1200px) {
    html:not(.nav-ready) .menu-toggle { display: flex; }
    html:not(.nav-ready) nav { display: none; }
}

/* Tight row */
:where(html.nav-tight) header {
    padding-left: 1rem;
    padding-right: 1rem;
}

:where(html.nav-tight) nav {
    gap: 0.15rem;
}

:where(html.nav-tight) nav a,
:where(html.nav-tight) nav .nav-logout button {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    letter-spacing: 0.4px;
}

:where(html.nav-tight) nav .nav-highlight {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
    margin: 0 0.1rem;
}

:where(html.nav-tight) nav .nav-free-training {
    margin-left: 0.3rem !important;   /* the link carries an inline margin */
}

/* Hamburger */
:where(html.nav-compact) header {
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
}

:where(html.nav-compact) .menu-toggle {
    display: flex;
}

:where(html.nav-compact) nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.5rem 1rem 1rem;
    background: rgba(8, 13, 19, 0.98);
    border-bottom: 1px solid rgba(0, 243, 255, 0.14);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    z-index: 99;
}

:where(html.nav-compact) nav.nav-open {
    display: flex;
}

:where(html.nav-compact) nav a,
:where(html.nav-compact) nav .nav-logout button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 0.8rem;
    font-size: 0.85rem;
    margin-left: 0 !important;
}

/* Dropdowns become tap-to-expand, inline accordions */
:where(html.nav-compact) .dropdown {
    width: 100%;
}

:where(html.nav-compact) .dropdown-content {
    position: static;
    right: auto;
    display: none;
    min-width: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background-color: rgba(0, 0, 0, 0.35);
    visibility: visible;
    opacity: 1;
    transition: none;
}

:where(html.nav-compact) .dropdown-content::before {
    display: none;
}

:where(html.nav-compact) .dropdown-content a {
    padding-left: 1.75rem;
}

/* No hover-open in the hamburger; the .open class (set on tap) is used instead */
:where(html.nav-compact) .dropdown:hover .dropdown-content {
    display: none;
}

:where(html.nav-compact) .dropdown.open .dropdown-content {
    display: block;
}

/* Phones: the site name and its badge shrink with the screen, so the hamburger stays on the same row and
   nothing is cut off (at full size the name and badge alone are wider than a 360px screen). */
@media (max-width: 480px) {
    .brand {
        font-size: min(1.12rem, 3.6vw);
        letter-spacing: 0.5px;
    }

    .brand .beta-badge {
        margin-left: 0.3rem;
        padding: 1px 6px;
        font-size: 0.56rem;
        letter-spacing: 0.5px;
    }
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

input,
select {
    width: 100%;
    padding: 1rem;
    background-color: #050505;
    border: 1px solid #333;
    border-radius: 4px;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 1rem;
    transition: all 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

button[type="submit"] {
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 1rem 2rem;
    border-radius: 4px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.1);
}

button[type="submit"]:hover {
    background-color: var(--accent-color);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
    transform: translateY(-2px);
}

.alert {
    padding: 1rem;
    border: 1px solid;
    background: rgba(0, 0, 0, 0.5);
    font-family: var(--font-mono);
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-2 {
    margin-top: 1rem;
}
/* =====================================================================
   Range: home page, challenge tiles and challenge pages
   ===================================================================== */







.cta-primary { background: var(--accent-color); color: #000; box-shadow: 0 0 18px rgba(0, 243, 255, 0.35); }
.cta-primary:hover { box-shadow: 0 0 28px rgba(0, 243, 255, 0.6); transform: translateY(-2px); }
.cta-secondary { color: var(--accent-color); background: rgba(0, 0, 0, 0.4); }
.cta-secondary:hover { background: rgba(0, 243, 255, 0.1); transform: translateY(-2px); }

.cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid var(--accent-color);
    transition: all 0.2s;
}




.section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem 1rem;
    margin: 0 0 1rem;
}

.section-head h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin: 0;
    color: #fff;
    letter-spacing: 1px;
}

.section-link {
    font-family: var(--font-mono);
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.section-link:hover { text-decoration: underline; }

/* ---- Buttons (.btn) --------------------------------------------------------
   Admin pages (and the two site-wide privacy/blocked modals) use `.btn` for
   action buttons, but there was never a `.btn` rule — they fell back to raw
   browser chrome: the square grey buttons, and the purple visited-link "Back".
   Define it on-theme here. COSMETIC ONLY: each per-button inline `style=`
   (danger background, width, padding, font-size, flex) still wins by
   specificity, so layout and behavior are unchanged. Text is light (not cyan)
   so contrast holds on the one inline-red danger button. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    line-height: 1.3;
    color: #e8fdff;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.3);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn:visited { color: #e8fdff; }
.btn:hover,
.btn:focus-visible {
    background: rgba(0, 243, 255, 0.1);
    border-color: rgba(0, 243, 255, 0.6);
    box-shadow: 0 0 12px var(--accent-glow);
    color: #fff;
    transform: translateY(-1px);
}
.btn:disabled,
.btn[disabled],
.btn.disabled {
    opacity: 0.45;
    cursor: default;
    box-shadow: none;
    transform: none;
}

/* ---- Admin data tables (.data-table) ---------------------------------------
   Admin list pages reference `.data-table` and several bare id-tables, but
   there was no shared table rule — they rendered as browser-default tables.
   Define one on-theme table so every admin list reads the same. Cosmetic only;
   per-table/row inline `style=` still wins by specificity. */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.data-table thead th {
    text-align: left;
    padding: 0.5rem 0.65rem;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
    border-bottom: 1px solid rgba(0, 243, 255, 0.35);
    white-space: nowrap;
}
.data-table td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}
.data-table tbody tr:hover { background: rgba(0, 243, 255, 0.04); }
.data-table tbody tr:last-child td { border-bottom: none; }

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.9rem;
}

/* Challenges-page "your progress" bar — live solved/total, auto-reflects newly added challenges. */
.chal-progress { margin: 0 0 1.1rem; }
.chal-progress-top { display: flex; justify-content: space-between; align-items: baseline;
    font-family: var(--font-mono); font-size: 0.78rem; color: #9aa5a8; margin-bottom: 0.35rem; }
.chal-progress-nums { color: var(--accent-color); font-weight: 700; }
.chal-progress-track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1); overflow: hidden; }
.chal-progress-fill { height: 100%; border-radius: 999px; min-width: 0;
    background: linear-gradient(90deg, #00f3ff, #00ff41); transition: width 0.4s ease; }

/* Profile badges (live-computed; see src/badges.js). Earned = achievement gold; locked = muted grey. */
.op-badges { margin: 0 0 1.5rem; }
.op-badges-head { margin: 0 0 0.75rem; font-size: 1rem; color: #fff; }
.badge-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.9rem; margin-bottom: 1rem; }
.badge-tier { background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px; padding: 0.7rem 0.85rem; }
.bt-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.4rem; }
.bt-name { font-weight: 700; color: #fff; font-size: 0.9rem; }
.bt-sub { font-family: var(--font-mono); font-size: 0.72rem; color: #9aa5a8; white-space: nowrap; }
.bt-track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1); overflow: hidden; }
.bt-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #00f3ff, #00ff41); transition: width 0.4s ease; }
.bt-goal { margin-top: 0.35rem; font-size: 0.72rem; color: #9aa5a8; }
.bt-goal strong { color: var(--accent-color); }
.badge-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.badge-chip { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--font-mono);
    font-size: 0.72rem; letter-spacing: 0.5px; padding: 0.3rem 0.7rem; border-radius: 999px; border: 1px solid; }
.badge-chip.earned { color: #ffd27a; border-color: rgba(255, 196, 0, 0.5); background: rgba(255, 196, 0, 0.1); }
.badge-chip.locked { color: #6b7276; border-color: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.02); }
.badge-chip .chip-prog { font-size: 0.66rem; opacity: 0.8; }
.op-badges-hint { font-size: 0.75rem; font-weight: 400; color: #6b7276; }
.badge-chip, .badge-tier { cursor: pointer; }
.badge-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62); display: flex; align-items: center;
    justify-content: center; z-index: 1000; padding: 1rem; }
.badge-modal-box { background: linear-gradient(160deg, #0d1114, #070707); border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px; padding: 1.3rem 1.4rem; max-width: 360px; width: 100%; text-align: center;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55); }
.bm-title { font-size: 1.15rem; font-weight: 700; color: #fff; margin-bottom: 0.35rem; }
.bm-status { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 0.7rem; }
.bm-status.earned { color: #ffd27a; }
.bm-status.locked { color: #9aa5a8; }
.bm-desc { color: #c7d0d4; font-size: 0.9rem; line-height: 1.5; margin: 0 0 1.1rem; }
.badge-modal-box .cta { display: inline-block; width: auto; margin: 0 auto; padding: 0.35rem 1.4rem;
    font-size: 0.78rem; border-radius: 999px; }

.challenge-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-height: 148px;
    padding: 0.9rem 1rem;
    border: 1px solid #262626;
    border-radius: 6px;
    background: linear-gradient(160deg, #0d1114, #070707);
    color: var(--text-primary);
    text-decoration: none;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.challenge-tile:hover,
.challenge-tile:focus-visible {
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(0, 243, 255, 0.12);
    outline: none;
}

.challenge-tile.solved { border-color: rgba(0, 255, 65, 0.45); }
/* Fixed 2-line title block (identical height on EVERY tile), title vertically centered. A title longer
   than 2 lines is clamped with an ellipsis (…). The fixed height keeps every tile the same size so the
   bottom divider lines up across all tiles (see .tile-badge-slot). */
.challenge-tile h3 { margin: 0; height: 2.4rem; font-size: 0.95rem; color: #fff; font-family: var(--font-body);
    line-height: 1.25; display: flex; align-items: center; justify-content: center; }
.challenge-tile h3 > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-align: center; }

/* Badge slot: a fixed-height row under the title, present on EVERY tile (empty when not premium) so
   premium and non-premium tiles are exactly the same height — that's what makes all the bottom dividers
   line up without stretching/shrinking any tile. The negative margin cancels the flex column gap so the
   badge is single-spaced right under the title, nudged down a few px. */
.challenge-tile .tile-badge-slot { height: 0.95rem; display: flex; align-items: center; justify-content: center;
    margin-top: calc(-0.45rem + 4px); }
.challenge-tile .tile-summary { color: #9aa5a8; font-size: 0.8rem; line-height: 1.4; flex: 1; margin: 0;
    /* Show WHOLE lines only, never a line sliced through the middle: clamp to 2 lines AND reserve exactly
       two full line-boxes (2 × 1.4em) so flex can't squeeze the box below a clean line boundary. A line
       that doesn't fully fit is omitted (read the rest by opening the tile); overflow stays hidden. */
    min-height: 2.8em; max-height: 2.8em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tile-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: #888;
    border-top: 1px solid #1d1d1d;
    padding-top: 0.5rem;
}

.tile-points { color: var(--accent-color); font-weight: 700; font-size: 0.85rem; }

.tile-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }
/* Grid tiles: the tag row keeps a consistent min-height (so 0/1-badge tiles still line up), but WRAPS
   neatly to a second row when a tile has several badges (category/difficulty/premium/new/solved) — so a
   badge is always fully contained in the box instead of being clipped at the edge. */
.challenge-tile .tile-tags { flex-wrap: wrap; align-items: center; justify-content: center; min-height: 1.6rem; row-gap: 0.35rem; }
/* Each badge stays intact (never splits); a long category tag truncates with … rather than overflowing. */
.challenge-tile .tile-tags .tag { flex: 0 0 auto; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Tier badge under the title — every tile shows exactly one: gold "Premium" (.tag-premium) or its
   blue counterpart "Free" (.tag-free). Scaled down from a normal tag, centered in the fixed-height
   .tile-badge-slot, kept inside the tile (overflow:hidden + ellipsis) so it can't overflow a narrow tile. */
.challenge-tile .tile-tier-badge {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.5rem;
    line-height: 1.2;
    padding: 1px 6px;
}

.tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid #333;
    color: #aaa;
    background: rgba(255, 255, 255, 0.03);
}

.tag-new { border-color: var(--success-color); color: var(--success-color); }
.tag-solved { border-color: var(--success-color); background: rgba(0, 255, 65, 0.12); color: var(--success-color); }
.tag-draft { border-color: #ffcc00; color: #ffcc00; }
.diff-easy { border-color: #2e7d32; color: #66bb6a; }
.diff-medium { border-color: #f9a825; color: #fdd835; }
.diff-hard { border-color: #ef6c00; color: #ffa726; }
.diff-insane { border-color: #c62828; color: #ff5252; }





.empty-state { color: #777; text-align: center; padding: 2rem 1rem; border: 1px dashed #2a2a2a; border-radius: 6px; }

/* Challenge list filters */
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem; }
.filters input, .filters select { width: auto; flex: 1 1 180px; padding: 0.65rem 0.8rem; font-size: 0.9rem; }

/* Challenge page */
.challenge-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 2rem; align-items: start; }
.challenge-header h1 { font-family: var(--font-heading); color: #fff; font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0.75rem 0; }
.breadcrumb { font-family: var(--font-mono); font-size: 0.8rem; color: #777; }
.breadcrumb a { color: var(--accent-color); text-decoration: none; }
.side-box { border: 1px solid #262626; border-radius: 6px; padding: 1.25rem; background: #080a0b; margin-bottom: 1.25rem; }
.side-box h3 { margin: 0 0 0.75rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: #888; font-family: var(--font-mono); }
.flag-format { font-family: var(--font-mono); font-size: 1.1rem; color: var(--success-color); background: #050505; border: 1px dashed #2e5d3a; padding: 0.6rem 0.8rem; border-radius: 4px; word-break: break-all; }
.access-link { font-family: var(--font-mono); color: var(--accent-color); white-space: nowrap; max-width: 100%; overflow-x: auto; }
.file-list { list-style: none; padding: 0; margin: 0; }
.file-list li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid #1a1a1a; }
.file-list a { color: var(--accent-color); word-break: break-all; }
.file-list span { color: #666; font-size: 0.8rem; white-space: nowrap; }
.submit-result { min-height: 1.5em; margin-top: 0.75rem; font-weight: 700; }

.md-content { line-height: 1.75; color: #d0d6d8; overflow-wrap: anywhere; }
.md-content h1, .md-content h2, .md-content h3 { color: #fff; font-family: var(--font-body); margin-top: 1.6em; }
.md-content a { color: var(--accent-color); }
.md-content code { font-family: var(--font-mono); background: #111; padding: 0.1em 0.35em; border-radius: 3px; color: var(--success-color); }
.md-content pre { background: #050505; border: 1px solid #222; padding: 1rem; border-radius: 4px; overflow-x: auto; }
.md-content pre code { background: none; padding: 0; }
.md-content img { max-width: 100%; height: auto; border-radius: 4px; }
.md-content blockquote { border-left: 3px solid var(--accent-color); margin: 1em 0; padding: 0.25em 1em; color: #aaa; }
.md-content table { width: 100%; }
details.reveal { border: 1px solid #262626; border-radius: 6px; padding: 0.75rem 1rem; background: #080a0b; margin-top: 1rem; }
details.reveal summary { cursor: pointer; font-family: var(--font-mono); color: var(--accent-color); }

@media (max-width: 900px) {
    .challenge-layout { grid-template-columns: minmax(0, 1fr); }
}

/* =====================================================================
   Site-wide theme: dark cyber + liquid glass
   (Overrides the flat panels above. Home-only layout lives in home.css.)
   ===================================================================== */
:root {
    --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.018));
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-highlight: rgba(255, 255, 255, 0.2);
    --glass-blur: blur(22px) saturate(160%);
    --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(255, 255, 255, 0.04), 0 24px 60px rgba(0, 0, 0, 0.55);
    --neon-violet: #a855f7;
}

/* Animated background on every page: aurora glow (body::before) + cyber grid (body::after) */
body {
    background: #020306;
    background-image: none;
}

body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

body::before {
    background:
        radial-gradient(40vmax 40vmax at 8% 0%, rgba(0, 229, 255, 0.26), transparent 70%),
        radial-gradient(45vmax 45vmax at 100% 100%, rgba(168, 85, 247, 0.24), transparent 70%),
        radial-gradient(28vmax 28vmax at 55% 45%, rgba(0, 255, 136, 0.08), transparent 70%),
        radial-gradient(ellipse at top, #071722 0%, #020306 60%);
    /* Deliberately static: animating a full-screen layer forces the browser to repaint the
       whole page every frame and made the site feel sluggish. */
}

body::after {
    background-image:
        linear-gradient(rgba(0, 243, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.06) 1px, transparent 1px),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
    background-size: 46px 46px, 46px 46px, 100% 3px;
    mask-image: radial-gradient(ellipse at 50% 25%, #000 0%, transparent 78%);
}


/* Glass header */
header {
    /* Near-opaque instead of a live backdrop blur: a sticky blurred header re-blurs the whole page
       on every scroll frame (severe jank on Firefox/Windows). Same look, composited once. */
    background: rgba(6, 10, 14, 0.92);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dropdown-content {
    background: rgba(8, 14, 20, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    /* No overflow:hidden here: it would clip the invisible hover bridge (::before) above the menu. */
}
.dropdown-content a:first-child { border-radius: 11px 11px 0 0; }
.dropdown-content a:last-child { border-radius: 0 0 11px 11px; }

/* Reusable glass panel. No backdrop-filter on purpose: live blur on large panels made every
   hover and animation re-blur the page (measured 14 fps / ~180 ms hover). A translucent tint
   over the soft background gives the same look at 60 fps. Only the header keeps a real blur. */
.glass,
.card {
    position: relative;
    background: var(--glass-bg), rgba(6, 12, 18, 0.45);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}

.glass { overflow: hidden; }

/* Specular sheen (only on .glass, so it never collides with .crt::before on .card) */
.glass::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 45%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent);
    pointer-events: none;
    border-radius: inherit;
}

/* Thin animated neon rim */
.glass.rim::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(120deg, rgba(0, 243, 255, 0.7), transparent 35%, transparent 65%, rgba(168, 85, 247, 0.7));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

@keyframes rim { to { background-position: 200% 200%; } }

.glow-card { border-color: var(--glass-border); box-shadow: var(--glass-shadow); }
.glow-card:hover { border-color: rgba(0, 243, 255, 0.28); box-shadow: var(--glass-shadow), 0 0 30px rgba(0, 243, 255, 0.08); }
.card h2 { border-bottom-color: rgba(255, 255, 255, 0.08); }

/* Tables become translucent rows */
th { border-bottom: 1px solid rgba(0, 243, 255, 0.45); }
td { background: rgba(255, 255, 255, 0.035); border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
tr:hover td { background: rgba(0, 243, 255, 0.07); }
td:first-child { border-radius: 8px 0 0 8px; }
td:last-child { border-radius: 0 8px 8px 0; }

/* Form fields */
input,
select,
textarea {
    background-color: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 12px !important;
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(0, 243, 255, 0.7) !important;
    box-shadow: 0 0 0 3px rgba(0, 243, 255, 0.12), 0 0 16px rgba(0, 243, 255, 0.2);
    outline: none;
}
input[type="checkbox"], input[type="radio"] { border-radius: 4px !important; }

button[type="submit"] {
    border-radius: 12px;
    background: rgba(0, 243, 255, 0.06);
}

.alert { border-radius: 12px; background: rgba(0, 0, 0, 0.35); }

/* Glass challenge tiles + side boxes (all pages) */
.challenge-tile {
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    overflow: hidden;
}
.challenge-tile::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, #00f3ff, #a855f7);
    opacity: 0.8;
}
.challenge-tile:hover,
.challenge-tile:focus-visible { border-color: rgba(0, 243, 255, 0.55); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 12px 34px rgba(0, 243, 255, 0.16); }
.challenge-tile.solved { border-color: rgba(0, 255, 65, 0.4); }
.challenge-tile.solved::before { background: linear-gradient(90deg, #00ff41, #00f3ff); }
.tile-meta { border-top-color: rgba(255, 255, 255, 0.07); }

.side-box,
details.reveal {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.flag-format { border-radius: 10px; background: rgba(0, 0, 0, 0.35); }
.md-content pre { background: rgba(0, 0, 0, 0.4); border-color: rgba(255, 255, 255, 0.08); border-radius: 12px; }
.empty-state { border-color: rgba(255, 255, 255, 0.14); border-radius: 16px; }
.tag { border-radius: 999px; padding: 2px 9px; }

.cta { border-radius: 12px; }
.cta-primary { background: linear-gradient(135deg, #00f3ff, #6ef7c8); border-color: transparent; color: #001014; }
.cta-secondary { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.18); color: #e8fdff; }
.cta-secondary:hover { border-color: rgba(0, 243, 255, 0.6); background: rgba(0, 243, 255, 0.08); }

.pagination button { border-radius: 10px; background: rgba(255, 255, 255, 0.04); }

/* Modals (blocked notice, etc.) */
.modal-content.card { background: rgba(10, 16, 22, 0.88) !important; border-radius: 20px; }

/* Respect "reduce motion" */
@media (prefers-reduced-motion: reduce) {
    .glow, .glitch { animation: none; }
}

/* ---------- Challenge list pagination ---------- */
/* Before the script runs, only the first page of tiles is visible (no flash of every tile). */
#tiles:not(.js-paged) .challenge-tile:nth-child(n+13) { display: none; }

.pager {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: fit-content;
    max-width: 100%;
    margin: 1.75rem auto 0;   /* centered under the grid */
    padding: 0.85rem 1.4rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.pager[hidden] { display: none; }
.pager-status { font-family: var(--font-mono); font-size: 0.85rem; color: #9fb3bb; letter-spacing: 1px; text-transform: uppercase; text-align: center; }
.pager-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem; }
.pager-btn {
    min-width: 2.4rem;
    height: 2.4rem;
    padding: 0 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: #d6e6ec;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pager-btn:hover:not(:disabled):not(.current) { border-color: rgba(0, 243, 255, 0.6); background: rgba(0, 243, 255, 0.08); color: #fff; }
.pager-btn.current { background: linear-gradient(135deg, #00f3ff, #6ef7c8); color: #001014; border-color: transparent; font-weight: 700; cursor: default; box-shadow: 0 0 16px rgba(0, 243, 255, 0.35); }
.pager-btn:disabled { opacity: 0.35; cursor: default; }
.pager-btn:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.pager-btn.nav { padding: 0 0.9rem; }
.pager-gap { color: #6b7f87; padding: 0 0.25rem; font-family: var(--font-mono); }
@media (max-width: 560px) { .pager { justify-content: center; } .pager-status { width: 100%; text-align: center; } }

/* =====================================================================
   Calm, scannable palette: one accent (cyan) + neutral greys.
   Colour only where it carries meaning (solved, difficulty dot, status).
   ===================================================================== */
.tag,
.tag.diff-easy, .tag.diff-medium, .tag.diff-hard, .tag.diff-insane {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: #b4c2c7;
}
/* Difficulty keeps a small coloured dot instead of a fully coloured badge */
.tag.diff-easy::before, .tag.diff-medium::before, .tag.diff-hard::before, .tag.diff-insane::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: 1px;
}
.tag.diff-easy::before { background: #4caf50; }
.tag.diff-medium::before { background: #e0b400; }
.tag.diff-hard::before { background: #f57c00; }
.tag.diff-insane::before { background: #e53935; }
.tag-new { border-color: rgba(0, 243, 255, 0.35); background: transparent; color: #7df9ff; }
.tag-solved { border-color: rgba(0, 255, 65, 0.4); background: rgba(0, 255, 65, 0.08); color: #6effa8; }

/* Tiles: no colour strip; uniform border; solved shows a quiet green edge */
.challenge-tile::before { display: none; }
.challenge-tile.solved { border-color: rgba(0, 255, 65, 0.28); }

/* One solid accent for primary buttons */
.cta-primary { background: #00dce8; color: #001014; box-shadow: none; }
.cta-primary:hover { background: #33ecf5; box-shadow: 0 0 16px rgba(0, 243, 255, 0.3); }

/* Scoreboard effects as still glows. Animated text-shadows (glitch title, pulsing name,
   glowing top-3 scores) each forced a full page re-layout every frame. */
.glitch { animation: none; }
.pop-highlight { animation: none; text-shadow: 0 0 12px var(--accent-color); }
.score-top3 { animation: none; text-shadow: 0 0 10px currentColor; }

/* =====================================================================
   Scoreboard (calm palette, fading activity cards)
   ===================================================================== */
.sb-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem 1.5rem;
           padding-bottom: 1rem; margin-bottom: 1.5rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.sb .sb-head h2 { margin: 0; padding: 0; border: none; font-size: 1.5rem; color: #f2f7f9; }
.sb-top { display: flex; align-items: baseline; gap: 0.75rem; font-family: var(--font-mono); }
.sb-top-label { color: #7f97a1; font-size: 0.75rem; letter-spacing: 2px; text-transform: uppercase; transition: opacity 0.4s; }
.sb-top-value { color: #c9d6dc; transition: opacity 0.4s; }
.sb .pop-highlight { color: #7df9ff; text-shadow: none; font-weight: 700; }

.sb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.75rem; align-items: start; }
.sb-search { max-width: 380px; margin-bottom: 1.1rem; font-size: 0.95rem !important; padding: 0.7rem 0.9rem !important; }

.sb th { color: #8fa6ae; border-bottom-color: rgba(255, 255, 255, 0.14); font-size: 0.75rem; }
.sb td { color: #d6e2e6; }
.sb .score-val, .sb .score-top3 { color: #7df9ff; text-shadow: none; font-weight: 700; }
.sb .sb-solves { color: #8fa6ae; white-space: nowrap; }
.sb-player { color: inherit; text-decoration: none; display: block; }
.sb-player:hover { color: #7df9ff; }
.sb .rank-1 { color: #ffd54a; text-shadow: none; }
.sb .rank-2 { color: #d7dde2; text-shadow: none; }
.sb .rank-3 { color: #e3a46b; text-shadow: none; }
.sb-pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.25rem; }

.sb-side { display: flex; flex-direction: column; gap: 1rem; }
.sb-card { padding: 1rem 1.1rem 1.1rem; }
/* Sleek centered cyber title, matching the challenge-page .box-title treatment. */
.sb-card h3 { margin: 0 0 0.85rem; padding-bottom: 0.55rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
              font-family: var(--font-mono); font-weight: 700; font-size: 1rem; text-transform: uppercase; letter-spacing: 2.5px;
              color: var(--accent-color); text-shadow: 0 0 10px var(--accent-glow); border-bottom: 1px solid rgba(0, 243, 255, 0.22); }
.sb-count { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 400; letter-spacing: 1px; color: var(--accent-color); text-shadow: none;
            border: 1px solid rgba(0, 243, 255, 0.35); border-radius: 999px; padding: 0 0.5rem; }
.sb-count:empty { display: none; }
/* Reusable sleek centered cyber title bar — same treatment as the challenge-page .box-title. */
.box-title { text-align: center; font-family: var(--font-mono); font-weight: 700; font-size: 1rem;
             text-transform: uppercase; letter-spacing: 2.5px; color: var(--accent-color);
             text-shadow: 0 0 10px var(--accent-glow); margin: 0 0 0.85rem; padding-bottom: 0.55rem;
             border-bottom: 1px solid rgba(0, 243, 255, 0.22); }
.box-title .box-title-sub { display: block; margin-top: 0.3rem; font-size: 0.72rem; font-weight: 400;
             letter-spacing: 1px; text-transform: none; color: var(--accent-color); text-shadow: none; }
.sb-hint { color: #7f97a1; font-size: 0.8rem; margin: 0 0 0.6rem; }
.sb-label { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 2px; text-transform: uppercase; color: #7f97a1; margin: 0.9rem 0 0.4rem; }

.sb-avail { list-style: none; margin: 0; padding: 0; max-height: 168px; overflow-y: auto; }
.sb-avail li { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 0.4rem 0.2rem;
               border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 0.88rem; }
.sb-avail li:last-child { border-bottom: none; }
.sb-avail-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-avail-name a { color: #d6e2e6; text-decoration: none; }
.sb-avail-name a:hover { color: #7df9ff; }
.sb-avail-pts { font-family: var(--font-mono); color: #7df9ff; font-weight: 700; white-space: nowrap; }
.sb-avail-empty { color: #6f838b; justify-content: flex-start !important; }

/* Fading rotator */
.rot { position: relative; min-height: 86px; padding: 0.75rem 0.9rem; border-radius: 12px;
       background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.07); }
.rot-item { transition: opacity 0.38s ease, transform 0.38s ease; }
.rot-item.fade { opacity: 0; transform: translateY(4px); }
.rot-who a { color: #7df9ff; font-weight: 700; text-decoration: none; font-family: var(--font-mono); }
.rot-what { color: #c9d6dc; font-size: 0.9rem; margin: 0.15rem 0 0.35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rot-what a { color: #e6f1f4; text-decoration: none; border-bottom: 1px dashed rgba(255, 255, 255, 0.25); }
.rot-what a:hover { color: #7df9ff; }
.rot-meta { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.78rem; color: #7f97a1; }
.rot-pts { color: #6effa8; font-weight: 700; }
.rot-count { position: absolute; top: 0.55rem; right: 0.75rem; font-family: var(--font-mono); font-size: 0.68rem; color: #5f737b; }
.rot-empty { color: #6f838b; font-size: 0.88rem; padding-top: 0.6rem; }

@media (max-width: 1100px) { .sb-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Open Beta & Premium ---------- */
.beta-badge {
    display: inline-block; vertical-align: middle; margin-left: 0.5rem; padding: 2px 8px; border-radius: 999px;
    font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 1.5px; text-transform: uppercase;
    color: #ffd27a; border: 1px solid rgba(255, 196, 0, 0.45); background: rgba(255, 196, 0, 0.08);
}
.beta-footer { color: #b59a5a; }
.tag.tag-premium { color: #ffd27a; border-color: rgba(255, 196, 0, 0.45); background: rgba(255, 196, 0, 0.07); }
/* Free: the blue counterpart to the gold Premium badge. */
.tag.tag-free { color: #86d0ff; border-color: rgba(0, 170, 255, 0.45); background: rgba(0, 170, 255, 0.07); }
.premium-note { margin: 0.25rem 0 1.25rem; padding: 0.75rem 1rem; border-radius: 12px; font-size: 0.92rem; color: #e9dcb8;
                border: 1px solid rgba(255, 196, 0, 0.3); background: rgba(255, 196, 0, 0.05); }
.premium-note.locked { padding: 1.1rem 1.25rem; }
.beta-welcome { color: #c9b98f; font-size: 0.85rem; line-height: 1.55; margin: -0.4rem 0 1rem; max-width: 620px; }

/* Sign-out is a POST form (CSRF-protected), styled like the nav links / a text link. */
nav .nav-logout { display: contents; margin: 0; }
/* Undo the generic button[type="submit"] look (glow, rounded pill, lift on hover). */
nav .nav-logout button[type="submit"] {
    background: none; box-shadow: none; border-radius: 0; font-weight: 400; cursor: pointer; line-height: inherit;
}
nav .nav-logout button[type="submit"]:hover {
    color: var(--accent-color); background: transparent; border-color: transparent;
    border-bottom-color: var(--accent-color); box-shadow: none; transform: none;
    text-shadow: 0 0 8px var(--accent-glow);
}
button[type="submit"].link-button, button[type="submit"].link-button:hover {
    background: none; border: none; box-shadow: none; transform: none; padding: 0; border-radius: 0;
    color: #888; text-decoration: underline; text-transform: none; letter-spacing: normal;
    font: inherit; font-weight: 400; cursor: pointer; width: auto;
}

/* Free-access promo byline (shown while Free Weekend is on) */
.free-byline { color: #ffe08a; background: rgba(255,196,0,0.08); border: 1px solid rgba(255,196,0,0.35); border-radius: 10px; padding: 0.6rem 0.9rem; margin: 0.75rem 0 0; font-size: 0.92rem; }

/* Sleek, theme-matching scrollbars everywhere (thin cyan thumb on a transparent track). */
* { scrollbar-width: thin; scrollbar-color: rgba(0, 243, 255, 0.35) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 243, 255, 0.28); border-radius: 999px;
    border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 243, 255, 0.55); }
::-webkit-scrollbar-corner { background: transparent; }

/* Challenge Target box: optional admin-authored "Connection details" (multi-service / multi-port).
   A line ending with ":" is a centered header; other lines are left-aligned one-line command boxes
   that scroll horizontally instead of wrapping mid-token. */
.target-extra { margin-top: 0.7rem; }
.target-extra .te-head { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 1.5px; text-transform: uppercase;
    color: #7f97a1; text-align: center; margin: 0.55rem 0 0.3rem; }
.target-extra .te-head:first-child { margin-top: 0; }
.target-extra .te-port { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; color: var(--accent-color);
    text-align: center; margin: 0 0 0.3rem; }
.target-extra .te-cmd { font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.4; color: #7df9ff; text-align: left;
    white-space: pre; overflow-x: auto; background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(0, 243, 255, 0.22);
    border-radius: 8px; padding: 0.45rem 0.6rem; }
.target-extra .te-gap { height: 0.45rem; }
/* Public/Private label when both instances' connection details are shown (matches the Target box labels) */
.target-extra .te-label { color: #7f97a1; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.6px;
  margin: 0.4rem 0 0.3rem; border-top: 1px dashed rgba(127,151,161,0.35); padding-top: 0.45rem; }
.target-extra .te-label + .te-head { margin-top: 0.2rem; }

/* ---- Kali Box (Connect page card + site-wide "box running" bar) ---- */
.kali-card { margin: 1.1rem 0 1.4rem; padding: 1rem 1.1rem; border: 1px solid rgba(0, 243, 255, 0.35); border-radius: 10px; background: rgba(0, 243, 255, 0.04); text-align: center; }   /* centred, like the rest of the Connect page */
.kali-card-head { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.kali-card h3 { margin: 0; font-size: 1.05rem; }
.kali-tag { font-family: var(--font-mono); font-size: 0.68rem; padding: 2px 7px; border: 1px solid var(--warning-color); color: var(--warning-color); border-radius: 999px; vertical-align: middle; margin-left: 0.4rem; }
.kali-state { font-family: var(--font-mono); font-size: 0.85rem; color: var(--success-color); }
.kali-blurb { color: #9fb3bd; margin: 0.5rem 0 0.8rem; }
.kali-notes { margin: 0.8rem auto 0; padding-left: 1.15rem; max-width: 36rem; text-align: left; color: #9fb3bd; font-size: 0.88rem; line-height: 1.6; }   /* bullets stay left-aligned inside a centred block */
.kali-notes a { color: var(--accent-color); }
.kali-sub { color: #9fb3bd; font-size: 0.88rem; margin-top: 0.55rem; }
/* The screenshot of a real box under "Start Kali Box" (views/partials/kali_shot.ejs). */
.kali-shot { margin: 1.1rem auto 0; max-width: 36rem; }
.kali-shot a { display: block; }
.kali-shot img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid rgba(0, 243, 255, 0.35); box-shadow: 0 0 22px rgba(0, 243, 255, 0.12); background: #05090c; }
.kali-shot figcaption { margin-top: 0.4rem; color: #9fb3bd; font-size: 0.82rem; }
/* The Stop button looks the same all the time; in the first 10 minutes a click opens the "too early" pop-up (css/kali_stop_pop.css). */
.kali-progress { height: 8px; max-width: 28rem; margin: 0 auto; border-radius: 999px; background: #10181c; border: 1px solid var(--border-color); overflow: hidden; }
.kali-progress > div { height: 100%; width: 2%; background: var(--accent-color); transition: width 1s linear; }
/* A running box: one centred column (Open / Stop / time left / Extend). The two main buttons share one width so the
   column reads as a unit. */
.kali-run-stack { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
#kaliCard .kali-run-stack > .vpn-btn { width: min(100%, 28rem); justify-content: center; text-align: center; white-space: normal; line-height: 1.3; }
.kali-left-line { color: #9fb3bd; font-size: 0.92rem; }
.kali-left { font-family: var(--font-mono); font-size: 0.95rem; color: var(--accent-color); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 480px) { #kaliCard .kali-run-stack > .vpn-btn { padding: 0.65rem 1rem; } }
.kali-bar { display: flex; align-items: center; justify-content: center; gap: 0.7rem; padding: 6px 12px; background: #06181b; border-bottom: 1px solid rgba(0, 243, 255, 0.35); font-size: 0.88rem; flex-wrap: wrap; }
.kali-bar[hidden] { display: none; }
/* Site-wide maintenance bar (views/partials/header.ejs, src/maintenance.js): amber = announced, red = in progress. */
.maint-bar { display: flex; align-items: baseline; justify-content: center; gap: 0.35rem 0.7rem; flex-wrap: wrap; padding: 8px 14px; font-size: 0.9rem; line-height: 1.4; text-align: center; color: #ffe9b0; background: #1f1705; border-bottom: 1px solid rgba(255, 196, 0, 0.55); }
.maint-bar strong { color: #ffc400; letter-spacing: 0.3px; }
.maint-bar.maint-on { color: #ffd9df; background: #23070d; border-bottom-color: rgba(255, 90, 122, 0.7); }
.maint-bar.maint-on strong { color: #ff6b85; }
.maint-bar .maint-staff { color: #9fe8b0; }
.kali-bar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success-color); box-shadow: 0 0 8px var(--success-color); }
.kali-bar-btn { background: transparent; color: var(--accent-color); border: 1px solid rgba(0, 243, 255, 0.45); border-radius: 6px; padding: 2px 10px; font: inherit; cursor: pointer; text-decoration: none; }
.kali-bar-btn.kali-bar-end { color: #ff6b85; border-color: rgba(255, 0, 60, 0.45); }
