:root {
    --bg-dark: #020617;
    --primary: #00e676;
    --primary-glow: rgba(0, 230, 118, 0.3);
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.3);
    --card-bg: rgba(15, 23, 42, 0.6);
    --text: #f8fafc;
    --text-dim: #94a3b8;
    --border: rgba(255, 255, 255, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(0, 230, 118, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
        linear-gradient(to bottom, #020617, #0f172a);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 1.5rem; 
    width: 100%; 
}

/* ================= NAV ================= */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap; /* Important for mobile */
}

.logo {
    font-weight: 900;
    font-size: 1.8rem;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.nav-links { 
    display: flex; 
    gap: 2rem; 
    align-items: center; 
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.nav-links a:hover, .nav-links a.active { 
    color: var(--primary); 
    text-shadow: 0 0 10px var(--primary-glow); 
}

.nhtml-badge { 
    background: rgba(56, 189, 248, 0.1); 
    border: 1px solid var(--accent); 
    color: var(--accent) !important; 
    padding: 5px 12px; 
    border-radius: 8px; 
    font-weight: 800; 
    font-size: 0.8rem; 
}

/* ================= BUTTONS ================= */
.btn-download {
    background: rgba(0, 230, 118, 0.1);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-download:hover {
    background: var(--primary);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-primary {
    background: var(--primary); 
    color: var(--bg-dark); 
    padding: 1rem 2rem; 
    border-radius: 8px; 
    font-weight: 700; 
    font-size: 1.1rem; 
    text-decoration: none; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    gap: 10px; 
    transition: all 0.3s; 
    border: 1px solid var(--primary);
}
.btn-primary:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 10px 25px var(--primary-glow); 
}

.btn-secondary {
    background: var(--card-bg); 
    color: var(--text); 
    padding: 1rem 2rem; 
    border-radius: 8px; 
    font-weight: 600; 
    font-size: 1.1rem; 
    text-decoration: none; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    gap: 10px; 
    border: 1px solid var(--border); 
    transition: all 0.3s;
}
.btn-secondary:hover { 
    border-color: var(--text-dim); 
    background: rgba(255,255,255,0.05); 
}

/* ================= HAMBURGER MENU ================= */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* ================= RESPONSIVE (MOBILE) ================= */
@media (max-width: 768px) {
    nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 1rem 0;
    }
    
    .hamburger {
        display: block;
    }

    .nav-links {
        display: none; /* hidden by default on mobile */
        width: 100%;
        flex-direction: column;
        gap: 1rem;
        padding-top: 1rem;
        text-align: center;
        border-top: 1px solid var(--border);
        margin-top: 1rem;
    }
    
    .nav-links.open {
        display: flex;
    }

    /* Buttons overflow fix */
    .hero-cta {
        flex-direction: column !important;
        width: 100%;
        gap: 1rem !important;
    }
    .btn-primary, .btn-secondary, button.btn-speedtest {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        justify-content: center;
    }
}

/* ================= INDEX.PHP SPECIFIC ================= */
.hero { padding: 8rem 0 6rem; text-align: center; position: relative; flex: 1; }
.hero::before {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(0,230,118,0.05) 0%, transparent 70%);
    z-index: -1; pointer-events: none;
}
.hero-badge {
    display: inline-block;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 2rem;
    letter-spacing: 1px;
}
.hero h1 { font-size: 4.5rem; font-weight: 900; line-height: 1.1; margin-bottom: 1.5rem; letter-spacing: -2px; }
.hero h1 span { background: linear-gradient(to right, var(--text), var(--primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 1.25rem; color: var(--text-dim); max-width: 600px; margin: 0 auto 3rem; }
.hero-cta { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 4rem 0;
    text-align: left;
}
.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s;
}
.feature-card:hover {
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(-5px);
}
.feature-icon { font-size: 2rem; color: var(--primary); margin-bottom: 1rem; }
.feature-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text); }
.feature-desc { font-size: 0.95rem; color: var(--text-dim); }

.story-section {
    background: rgba(15, 23, 42, 0.4);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 4rem 1.5rem;
    margin-top: 4rem;
}
.story-content { max-width: 800px; margin: 0 auto; text-align: center; }

/* SLIDER */
.slider-container {
    max-width: 900px;
    margin: 4rem auto;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.slides {
    display: flex;
    transition: transform 0.5s ease-in-out;
}
.slide {
    min-width: 100%;
    display: block;
}
.slide img {
    width: 100%;
    display: block;
}
.slider-dots {
    position: absolute;
    bottom: 15px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
}
.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.3s;
}
.dot.active { background: var(--primary); box-shadow: 0 0 10px var(--primary-glow); }

@media (max-width: 768px) {
    .hero { padding: 4rem 0 3rem; }
    .hero h1 { font-size: 2.5rem; }
    .hero p { font-size: 1rem; margin-bottom: 2rem; }
    .hero-cta { flex-direction: column; }
    .features { grid-template-columns: 1fr; margin: 2rem 0; }
    .slider-container { margin: 2rem auto; }
}

/* ================= LEADERBOARD.PHP SPECIFIC ================= */
.leaderboard-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; margin-top: 1rem; }
.leaderboard-table th { text-align: left; padding: 1rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px; border-bottom: 1px solid var(--border); }
.leaderboard-table td { padding: 1rem; background: var(--card-bg); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.leaderboard-table tr td:first-child { border-left: 1px solid var(--border); border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.leaderboard-table tr td:last-child { border-right: 1px solid var(--border); border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.rank-badge { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.1); font-weight: 700; font-size: 0.9rem; }
.rank-1 .rank-badge { background: #fbbf24; color: #000; box-shadow: 0 0 15px rgba(251, 191, 36, 0.5); }
.rank-2 .rank-badge { background: #94a3b8; color: #000; }
.rank-3 .rank-badge { background: #b45309; color: #fff; }
.score-val { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--primary); }
.spec-item { font-size: 0.8rem; color: var(--text-dim); display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.spec-item i { width: 14px; text-align: center; }
.loading-state { text-align: center; padding: 4rem; color: var(--text-dim); }
.podium-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-bottom: 3rem; align-items: flex-end; }
.podium-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; text-align: center; position: relative; }
.podium-card.rank-1 { border-color: #fbbf24; transform: scale(1.05); z-index: 2; box-shadow: 0 10px 30px rgba(251, 191, 36, 0.2); }
.podium-card.rank-2 { border-color: #94a3b8; }
.podium-card.rank-3 { border-color: #b45309; }
.podium-icon { font-size: 3rem; margin-bottom: 1rem; }
.rank-1 .podium-icon { color: #fbbf24; }
.rank-2 .podium-icon { color: #94a3b8; }
.rank-3 .podium-icon { color: #b45309; }
.table-responsive { overflow-x: auto; }
@media (max-width: 768px) {
    .podium-grid { grid-template-columns: 1fr; align-items: stretch; gap: 1rem; }
    .podium-card.rank-1 { transform: none; order: -1; }
}

/* ================= SPEEDTEST.PHP SPECIFIC ================= */
.header-title { text-align: center; margin-bottom: 3rem; }
.header-title h1 { font-size: 2.5rem; font-weight: 800; }
.header-title p { color: var(--text-dim); font-size: 1.1rem; }

.diag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; margin-bottom: 4rem; }
.diag-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; }
.diag-card h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.diag-item { margin-bottom: 0.8rem; display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; }
.diag-label { color: var(--text-dim); }
.diag-value { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--primary); text-align: right; }
.diag-note { font-size: 0.8rem; color: var(--text-dim); font-style: italic; margin-top: 1rem; }

/* Speedtest Widget */
.speedtest-container { text-align: center; padding: 2rem; background: var(--card-bg); border-radius: 16px; border: 1px solid var(--border); grid-column: 1 / -1; }
#dlMeter, #ulMeter { width: 150px; height: 150px; }
.meters { display: flex; justify-content: center; gap: 3rem; flex-wrap: wrap; margin-bottom: 2rem; }
.meter-box { text-align: center; }
.meter-val { font-family: 'JetBrains Mono', monospace; font-size: 2.5rem; font-weight: 700; color: var(--text); }
.ping-jit { display: flex; justify-content: center; gap: 2rem; margin-bottom: 2rem; }
.pj-box { background: rgba(0,0,0,0.3); padding: 1rem 2rem; border-radius: 8px; }
.pj-val { font-family: 'JetBrains Mono', monospace; font-size: 1.5rem; font-weight: 700; }
button.btn-speedtest { background: var(--primary); color: #000; border: none; padding: 1rem 3rem; font-size: 1.2rem; font-weight: 800; border-radius: 8px; cursor: pointer; transition: all 0.3s; }
button.btn-speedtest:hover { transform: scale(1.05); box-shadow: 0 0 20px var(--primary-glow); }

@media (max-width: 768px) {
    .diag-grid { grid-template-columns: 1fr; }
    .meters { gap: 1rem; }
    .ping-jit { flex-direction: column; gap: 1rem; }
    .speedtest-container { padding: 1rem; }
}
