:root {
    --bg: #0a0a0a;
    --surface: #111111;
    --surface2: #1a1a1a;
    --border: #2a2a2a;
    --red: #7c6af7;
    --red-bright: #9b8dff;
    --red-dim: rgba(124,106,247,0.15);
    --text: #ffffff;
    --text-muted: #888888;
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
input, textarea { -webkit-user-select: text; -moz-user-select: text; user-select: text; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    min-height: 100vh;
    position: relative;
}

body::before,
body::after {
    content: '';
    position: fixed;
    top: 15%;
    width: 420px;
    height: 650px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(70px);
    animation: sideGlow 6s ease-in-out infinite alternate;
}
body::before {
    left: -160px;
    background: radial-gradient(ellipse, rgba(124,106,247,0.28) 0%, transparent 70%);
    animation-delay: 0s;
}
body::after {
    right: -160px;
    background: radial-gradient(ellipse, rgba(124,106,247,0.28) 0%, transparent 70%);
    animation-delay: 3s;
}

@keyframes sideGlow {
    0%   { opacity: 0.5; transform: translateY(0) scale(1); }
    100% { opacity: 1;   transform: translateY(50px) scale(1.15); }
}

a { color: inherit; text-decoration: none; }

/* ── HEADER ── */
.site-header {
    background: #0f0f0f;
    padding: .9rem 3rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.site-header-wrap {
    background: #0f0f0f;
    border-bottom: 1px solid #1e1e1e;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}
.logo .gx { color: #ffffff; }
.logo .stuff { color: var(--red-bright); }

.search-wrap {
    flex: 1;
    max-width: 440px;
    position: relative;
}
.search-wrap svg {
    position: absolute;
    left: .8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px;
    height: 16px;
    pointer-events: none;
}
.search-wrap input {
    width: 100%;
    padding: .5rem .9rem .5rem 2.4rem;
    background: #1c1c1c;
    border: 1px solid #2e2e2e;
    border-radius: 6px;
    color: var(--text);
    font-size: .875rem;
}
.search-wrap input:focus { outline: none; border-color: #444; }
.search-wrap input::placeholder { color: var(--text-muted); }

.header-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
}

.hbtn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .9rem;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #2e2e2e;
    background: #1c1c1c;
    color: var(--text);
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.hbtn:hover { background: #282828; border-color: #444; }
.hbtn svg { width: 14px; height: 14px; flex-shrink: 0; }
.hbtn.new-leak { border-color: var(--red); color: var(--red-bright); }
.hbtn.new-leak:hover { background: var(--red-dim); }
.hbtn.discord-btn { border-color: #7c6af7; color: #9b8dff; }
.hbtn.discord-btn:hover { background: rgba(124,106,247,.15); }

/* User chip (logged in) */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .3rem .7rem .3rem .3rem;
    background: #1c1c1c;
    border: 1px solid #2e2e2e;
    border-radius: 999px;
    color: var(--text);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-decoration: none;
}
.user-chip:hover { border-color: var(--red); background: #242424; }
.user-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}
.user-avatar-initials {
    background: linear-gradient(135deg, #cc0000, #7a0000);
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 800; color: #fff;
}
.user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-logout-icon { width: 13px; height: 13px; color: var(--text-muted); flex-shrink: 0; }

.header-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b35, #cc0000);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; flex-shrink: 0;
    cursor: pointer;
}

/* ── MAIN ── */
.page { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

/* ── GRID ── */
.leaks-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.8rem;
}

/* ── CARD ── */
.card {
    background: #141414;
    border: 1px solid #222;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .2s, box-shadow .2s, transform .15s;
    cursor: pointer;
    min-height: 0;
}
.card:hover {
    border-color: var(--red);
    box-shadow: 0 0 16px rgba(124,106,247,0.35);
    transform: translateY(-2px);
}

.card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #0d0a1a 0%, #1a1020 50%, #1a1a1a 100%);
    overflow: hidden;
    flex-shrink: 0;
}
.card-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.card-thumb-placeholder {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 900;
    color: rgba(200,0,0,0.3);
    letter-spacing: .1em;
}

.thumb-stats {
    position: absolute;
    top: .4rem;
    left: .4rem;
    right: .4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.thumb-stat {
    display: flex;
    align-items: center;
    gap: .25rem;
    background: rgba(0,0,0,.65);
    border-radius: 4px;
    padding: .15rem .45rem;
    font-size: .72rem;
    font-weight: 600;
    color: #fff;
    backdrop-filter: blur(4px);
}
.thumb-stat svg { width: 11px; height: 11px; }
.thumb-stat.likes svg { color: #ff4444; }
.thumb-stat.downloads svg { color: #aaa; }
.new-badge {
    font-size: .58rem;
    font-weight: 800;
    background: #7c6af7;
    color: #fff;
    padding: .15rem .38rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .06em;
    animation: badgePulse 2.5s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(124,106,247,.5); }
    50%       { opacity: .75; box-shadow: 0 0 12px rgba(124,106,247,.8); }
}
.like-btn { cursor: pointer; transition: transform .15s, opacity .15s; }
.like-btn:hover { transform: scale(1.2); opacity: 1 !important; }
.like-btn.liked svg { color: #ff4d6d; filter: drop-shadow(0 0 4px rgba(255,77,109,.6)); }
.like-btn.liked { animation: likePop .25s ease; }
@keyframes likePop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

.thumb-icons {
    position: absolute;
    bottom: .4rem;
    right: .4rem;
    display: flex;
    gap: .3rem;
}
.thumb-icon {
    background: rgba(0,0,0,.6);
    border-radius: 4px;
    padding: .2rem;
    display: flex;
    backdrop-filter: blur(4px);
}
.thumb-icon svg { width: 13px; height: 13px; color: #ccc; }

.card-body {
    padding: .7rem .8rem .8rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: .3rem;
}

.card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .4rem;
}
.card-name {
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.3;
    color: #fff;
}
.cat-badge {
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .15rem .45rem;
    border-radius: 3px;
    background: var(--red);
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
}

.card-uploader {
    font-size: .75rem;
    color: var(--text-muted);
}

.card-desc {
    font-size: .78rem;
    color: #666;
    line-height: 1.4;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    width: 100%;
    padding: .55rem;
    background: var(--red);
    color: #fff;
    font-weight: 700;
    font-size: .82rem;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    margin-top: .5rem;
    transition: background .15s;
    text-decoration: none;
}
.dl-btn:hover { background: #aa0000; }
.dl-btn svg { width: 14px; height: 14px; }

/* ── PAGINATION ── */
.pagination {
    display: flex;
    justify-content: center;
    gap: .4rem;
    margin-top: 2rem;
}
.pagination a {
    padding: .4rem .85rem;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 5px;
    color: var(--text-muted);
    font-size: .82rem;
    transition: background .15s;
}
.pagination a.active, .pagination a:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

/* ── AUTH / FORMS ── */
.auth-box, .upload-box {
    max-width: 480px;
    margin: 2rem auto;
    background: #141414;
    border: 1px solid #222;
    border-radius: var(--radius);
    padding: 1.8rem;
}
.upload-box { max-width: 600px; }
.auth-box h2, .upload-box h2 {
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
    border-bottom: 1px solid #222;
    padding-bottom: .7rem;
}

form label { display: block; font-size: .8rem; color: var(--text-muted); margin: .7rem 0 .25rem; text-transform: uppercase; letter-spacing: .05em; }
form input, form textarea, form select {
    width: 100%;
    padding: .55rem .9rem;
    background: #1c1c1c;
    border: 1px solid #2e2e2e;
    border-radius: 6px;
    color: var(--text);
    font-size: .875rem;
    font-family: inherit;
}
form input:focus, form textarea:focus, form select:focus { outline: none; border-color: var(--red); }
form textarea { resize: vertical; }
form button[type=submit] {
    margin-top: 1rem;
    width: 100%;
    padding: .65rem;
    font-size: .95rem;
    font-weight: 700;
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
form button[type=submit]:hover { background: #6657d4; }
form input[type=file] { cursor: pointer; padding: .35rem .9rem; }

.alert {
    padding: .7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .875rem;
}
.alert-error { background: rgba(200,0,0,.15); border: 1px solid var(--red); color: #ff6666; }
.alert-success { background: rgba(0,180,80,.12); border: 1px solid #0a8; color: #2ecc71; }

/* ── SCRIPT DETAIL ── */
.script-detail { max-width: 820px; margin: 2.5rem auto; }
.script-header { margin-bottom: 1.5rem; }
.script-header h1 { font-size: 1.8rem; margin: .5rem 0 .4rem; }
.meta { color: var(--text-muted); font-size: .82rem; }
.script-tags { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.tag {
    background: #1c1c1c;
    border: 1px solid #2e2e2e;
    color: var(--text-muted);
    font-size: .72rem;
    padding: .15rem .5rem;
    border-radius: 4px;
}
.script-desc {
    background: #141414;
    border: 1px solid #222;
    border-radius: var(--radius);
    padding: 1.4rem;
    color: #999;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    white-space: pre-wrap;
}
.script-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1.1rem; border-radius: 6px; font-size: .85rem; font-weight: 600; cursor: pointer; border: none; transition: background .15s; text-decoration: none; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: #aa0000; }
.btn-outline { background: #1c1c1c; color: var(--text); border: 1px solid #2e2e2e; }
.btn-outline:hover { border-color: var(--red); color: var(--red-bright); }
.btn-danger { background: #7a0000; color: #fff; }
.btn-danger:hover { background: var(--red); }
.btn-sm { padding: .3rem .65rem; font-size: .75rem; }

/* ── ADMIN ── */
.admin-title { margin: 2rem 0 1.5rem; font-size: 1.6rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: #141414; border: 1px solid #222; border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.stat-num { font-size: 2.2rem; font-weight: 800; color: var(--red-bright); }
.stat-label { color: var(--text-muted); font-size: .82rem; margin-top: .3rem; }
.admin-table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; font-size: .82rem; }
.admin-table th, .admin-table td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid #1e1e1e; }
.admin-table th { color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.admin-table tr:hover td { background: #181818; }

/* ── FILTER MODAL ── */
.filter-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(6px);
    z-index: 200;
}
.filter-backdrop.show { display: block; }

.filter-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 201;
    background: #0f0f0f;
    border: 1px solid var(--red);
    border-radius: 14px;
    box-shadow: 0 0 40px rgba(124,106,247,.35), inset 0 0 60px rgba(124,106,247,.04);
    padding: 2.2rem 2rem 2rem;
    min-width: 420px;
    max-width: 500px;
    width: 90vw;
}
.filter-modal.show { display: block; }

.filter-logo {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-align: center;
    margin-bottom: 1.8rem;
    text-transform: uppercase;
}
.filter-logo .gx   { color: #fff; }
.filter-logo .stuff { color: var(--red-bright); }

.filter-sort { display: grid; grid-template-columns: 1fr; gap: .6rem; margin-bottom: .5rem; }
.filter-divider { height: 1px; background: #222; margin: .3rem 0 .6rem; }
.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
}

.filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .65rem .4rem;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 7px;
    color: #ccc;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    transition: background .15s, border-color .15s, color .15s;
    text-decoration: none;
}
.filter-btn:hover, .filter-btn.active {
    background: var(--red-dim);
    border-color: var(--red);
    color: var(--red-bright);
}

/* ── SITE BANNER ── */
.site-banner {
    position: fixed;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 210px;
    background: #131313;
    border: 1px solid rgba(124,106,247,.55);
    border-radius: 12px;
    padding: 1.1rem 1rem 1rem;
    z-index: 50;
    box-shadow: 0 0 28px rgba(124,106,247,.18);
}
.site-banner-title {
    font-size: .82rem;
    font-weight: 800;
    color: #9b8dff;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: .5rem;
    padding-bottom: .45rem;
    border-bottom: 1px solid #222;
}
.site-banner-content {
    font-size: .78rem;
    color: #999;
    line-height: 1.65;
}

/* ── TOGGLE SWITCH ── */
.toggle-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin-top: .8rem !important;
    padding: .35rem .9rem;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 7px;
    cursor: pointer;
}
.toggle-label { font-size: .85rem; color: #ccc; font-weight: 500; text-transform: none !important; letter-spacing: 0 !important; }
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0;
    background: #2a2a2a;
    border-radius: 999px;
    transition: background .2s;
    cursor: pointer;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    background: #666;
    border-radius: 50%;
    transition: transform .2s, background .2s;
}
.toggle-switch input:checked + .toggle-slider { background: rgba(124,106,247,.3); border: 1px solid #7c6af7; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); background: #9b8dff; }

/* ── DISCORD LOGIN ── */
.discord-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: 100%;
    padding: .75rem;
    background: #7c6af7;
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    border-radius: 6px;
    transition: background .15s;
    margin-bottom: .8rem;
}
.discord-login-btn:hover { background: #6657d4; color: #fff; }
.divider {
    display: flex;
    align-items: center;
    gap: .8rem;
    color: var(--text-muted);
    font-size: .8rem;
    margin: 1rem 0;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #2a2a2a; }

/* ── FOOTER ── */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #0f0f0f;
    border-top: 1px solid #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .8rem;
    z-index: 90;
    user-select: none;
}
.footer-logo { font-size: 1.1rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.footer-logo .gx   { color: #fff; }
.footer-logo .stuff { color: var(--red-bright); }
.footer-copy { color: var(--text-muted); font-size: .82rem; text-decoration: none; cursor: default; }

body { padding-bottom: 56px; }

/* ── EMPTY ── */
.empty { color: var(--text-muted); text-align: center; padding: 4rem; font-size: 1rem; }

/* ── TOP BAR ── */
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; color: var(--text-muted); font-size: .82rem; }

@media (max-width: 1200px) { .leaks-grid { grid-template-columns: repeat(4,1fr); } }
@media (max-width: 900px)  { .leaks-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 600px)  { .leaks-grid { grid-template-columns: repeat(2,1fr); } }

/* ── TABLET ── */
@media (max-width: 768px) {
    /* Hide side banner */
    .site-banner { display: none !important; }

    /* Header: two rows */
    .site-header {
        flex-wrap: wrap;
        padding: .75rem 1rem;
        gap: .6rem;
    }
    .search-wrap {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
    }
    .header-actions { margin-left: 0; }

    .page { padding: 1rem .75rem; }

    /* Stats grid */
    .stats-grid { grid-template-columns: repeat(2,1fr); }

    /* Script detail */
    .script-detail { margin: 1.2rem auto; }
    .script-header h1 { font-size: 1.4rem; }

    /* Admin table: scroll */
    .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Auth / upload boxes */
    .auth-box, .upload-box { margin: 1rem .75rem; }
}

/* ── MOBILE ── */
@media (max-width: 480px) {
    /* Tighten glows */
    body::before, body::after { width: 200px; height: 350px; }

    .leaks-grid { grid-template-columns: 1fr; gap: 1rem; }

    /* Header: hide Reload button, shrink */
    .hbtn.reload-btn { display: none; }
    .site-header { padding: .65rem .75rem; }
    .logo { font-size: 1.25rem; }

    /* Smaller header buttons */
    .hbtn { padding: .4rem .65rem; font-size: .75rem; }
    .user-name { max-width: 80px; }

    /* Stats grid single col */
    .stats-grid { grid-template-columns: 1fr; }

    /* Footer */
    .site-footer { gap: .4rem; font-size: .75rem; height: 48px; }
    body { padding-bottom: 48px; }

    /* Filter modal full-width */
    .filter-modal { min-width: unset; width: 94vw; padding: 1.5rem 1.1rem; }
    .filter-grid { grid-template-columns: repeat(2,1fr); }

    /* Script actions stack */
    .script-actions { flex-direction: column; }
    .script-actions .btn { width: 100%; justify-content: center; }

    /* Pagination smaller */
    .pagination a { padding: .35rem .6rem; font-size: .78rem; }

    /* Upload / auth box full width */
    .auth-box, .upload-box { margin: .75rem .5rem; padding: 1.3rem 1rem; }
}
