:root {
    --bg:#0b1020;
    --sidebar:#111827;
    --card:#171f33;
    --card-hover:#1e2944;
    --border:#2b3654;
    --accent:#5dd4ff;
    --accent2:#8b5cf6;
    --text:#ffffff;
    --text-secondary:#d5dcee;
    --text-muted:#93a0bd;
}

* {
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:"Segoe UI", sans-serif;
}

html {
    scroll-behavior:smooth;
}

body {
    background:
        radial-gradient(
            circle at top,
            #111827,
            #0b1020
        );
    color:var(--text-secondary);
}

.layout {
    display:flex;
    min-height:100vh;
}

/* =========================
   SIDEBAR
========================= */

.sidebar {
    width:260px;
    height:100vh;
    position:fixed;
    top:0;
    left:0;
    background:#202a3d;
    border-right:1px solid #34425e;
    padding:30px 20px;
    overflow-y:auto;
}

.sidebar-logo {
    margin-bottom:40px;
}

.logo-title {
    font-size:26px;
    font-weight:bold;
    color:var(--accent);
    text-shadow:0 0 10px rgba(93,212,255,.25);
}

.logo-subtitle {
    color:#b8c7e6;
    margin-top:5px;
    font-size:13px;
}

.sidebar-nav {
    display:flex;
    flex-direction:column;
    gap:12px;
}

.sidebar-nav a {
    color:white;
    text-decoration:none;
    padding:12px 15px;
    border-radius:8px;
    transition:.2s;
}

.sidebar-nav a:hover {
    background:#2b3650;
}

.nav-category {
    margin-top:20px;
}

.category-title {
    color:#7dd3fc;
    font-size:13px;
    font-weight:bold;
    text-transform:uppercase;
    margin-bottom:8px;
    padding-left:15px;
}

.nav-group {
    display:flex;
    flex-direction:column;
}

.nav-parent {
    width:100%;
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:none;
    border:none;
    color:white;
    padding:12px 15px;
    border-radius:8px;
    cursor:pointer;
    font-size:15px;
}

.nav-parent:hover {
    background:#2b3650;
    transform:none;
    box-shadow:none;
}

.nav-child {
    display:none;
    flex-direction:column;
    margin-left:20px;
}

.nav-child.open {
    display:flex;
}

.nav-child a {
    color:#9cb0d4;
    text-decoration:none;
    padding:10px 15px;
    font-size:14px;
    border-radius:8px;
}

.nav-child a:hover {
    background:#20293b;
    color:white;
}

.nav-child a.active {
    background:#f5a623;
    color:#101010;
    font-weight:bold;
    pointer-events:none;
}

.mobile-menu-toggle {
    display:none;
}

/* =========================
   CONTENT
========================= */

.content {
    flex:1;
    margin-left:260px;
    padding:35px;
}

/* =========================
   PAGE HEADER
========================= */

.page-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:
        linear-gradient(
            135deg,
            rgba(93,212,255,.08),
            rgba(139,92,246,.08)
        );
    border:1px solid var(--border);
    border-radius:16px;
    padding:30px;
}

.page-header h1 {
    color:white;
    font-size:42px;
    margin-bottom:6px;
}

.page-subtitle {
    color:var(--accent);
    font-size:13px;
    letter-spacing:2px;
    text-transform:uppercase;
}

.creator {
    color:var(--text-muted);
    font-size:14px;
}

/* =========================
   SECTIONS
========================= */

.section {
    margin-top:40px;
}

.section h2 {
    color:white;
    font-size:18px;
    margin-bottom:15px;
    padding-left:12px;
    border-left:4px solid var(--accent);
}

.section h3 {
    color:white;
    margin-bottom:10px;
}

.section p {
    color:var(--text-secondary);
    line-height:1.8;
}

/* =========================
   TABS
========================= */

.mode-tabs {
    display:flex;
    width:100%;
    margin-top:40px;
    margin-bottom:20px;
    background:var(--card);
    border:1px solid var(--border);
    border-radius:12px;
    overflow:hidden;
}

.mode-tab {
    flex:1;
    height:52px;
    border:none;
    background:transparent;
    color:var(--text-muted);
    font-size:15px;
    font-weight:600;
    cursor:pointer;
    transition:.2s;
    border-radius:0;
}

.mode-tab:hover {
    background:var(--card-hover);
    transform:none;
    box-shadow:none;
}

.mode-tab.active {
    background:linear-gradient(
        135deg,
        var(--accent),
        var(--accent2)
    );
    color:white;
}

/* =========================
   WEAPON
========================= */

.weapon-selector {
    display:flex;
    align-items:center;
    gap:15px;
    padding:15px;
    background:var(--card);
    border:1px solid var(--border);
    border-radius:12px;
    cursor:pointer;
    transition:.2s;
}

.weapon-selector:hover {
    border-color:var(--accent);
    background:var(--card-hover);
}

.weapon-selector img {
    width:52px;
    height:52px;
    object-fit:contain;
}

.weapon-item img {
    width:45px;
    height:45px;
    object-fit:contain;
}

.compare-weapon-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:20px;
}

.arrow {
    margin-left:auto;
}

#weaponName,
#weaponNameA,
#weaponNameB {
    flex:1;
    color:white;
    font-weight:600;
}

.weapon-stats {
    display:grid;
    grid-template-columns:repeat(8,1fr);
    gap:10px;
    margin-top:15px;
}

.stat-box {
    height:45px;
    background:var(--card);
    border:1px solid var(--border);
    border-radius:8px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
}

.stat-box img {
    width:25px;
    height:25px;
    object-fit:contain;
}

.stat-box strong {
    font-size:14px;
    color:white;
}

.stat-box.better {
    border-color:#4caf50;
    background:#18351f;
}

.stat-box.worse {
    border-color:#f44336;
    background:#351818;
}

/* =========================
   PERKS
========================= */

.perk-container {
    display:flex;
    gap:30px;
    align-items:flex-start;
}

.perk-left {
    flex:1;
}

.perk-right {
    width:300px;
    display:flex;
    flex-direction:column;
    gap:20px;
}

.perk-grid {
    display:grid;
    grid-template-columns:repeat(auto-fill,80px);
    gap:15px;
}

.perk {
    width:80px;
    height:80px;
    border-radius:10px;
    border:2px solid transparent;
    cursor:pointer;
    transition:.2s;
}

.perk img {
    width:100%;
    height:100%;
    object-fit:contain;
}

.perk:hover {
    transform:translateY(-3px);
}

.perk.active {
    border-color:var(--accent);
    box-shadow:0 0 15px rgba(93,212,255,.45);
}

.perk-info {
    background:var(--card);
    border:1px solid var(--border);
    border-radius:10px;
    padding:15px;
}

.perk-info h3 {
    margin:0 0 12px;
    font-size:17px;
}

.perk-info ul {
    margin:0;
    padding-left:20px;
}

.perk-info li {
    margin-bottom:8px;
    font-size:14px;
    line-height:1.5;
}

.perk-info.better {
    border-color:#4caf50;
    background:#17351d;
}

.perk-info.worse {
    border-color:#f44336;
    background:#351818;
}

/* =========================
   NETHER
========================= */

.nether-grid {
    display:grid;
    grid-template-columns:repeat(5,1fr);
    gap:15px;
}

.nether-card {
    text-align:center;
    background:var(--card);
    border:1px solid var(--border);
    border-radius:14px;
    padding:15px;
    cursor:pointer;
    transition:.25s;
}

.nether-card:hover {
    transform:translateY(-4px);
    background:var(--card-hover);
    border-color:var(--accent);
}

.nether-card.active {
    border-color:var(--accent);
    box-shadow:0 0 15px rgba(93,212,255,.15);
}

.nether-card img {
    width:70%;
}

/* =========================
   RESULT
========================= */

.compare-table {
    width:100%;
    border-collapse:collapse;
    background:var(--card);
    border-radius:14px;
    overflow:hidden;
}

.compare-table thead {
    background:#202b46;
}

.compare-table th {
    padding:15px;
    text-align:center;
    font-size:15px;
    color:#fff;
    border:1px solid var(--border);
}

.compare-table td {
    padding:15px;
    text-align:center;
    border:1px solid var(--border);
    color:var(--text-secondary);
}

.compare-table tbody tr:hover {
    background:rgba(255,255,255,.02);
}

.monster-result {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
    gap:15px;
}

.monster-card {
    display:flex;
    align-items:center;
    gap:12px;
    background:var(--card);
    border:1px solid var(--border);
    border-radius:14px;
    padding:12px;
    transition:.25s;
}

.monster-card:hover {
    background:var(--card-hover);
    border-color:var(--accent);
    transform:translateY(-3px);
}

.monster-image {
    width:55px;
    height:55px;
    object-fit:contain;
    flex-shrink:0;
}

.monster-card h3 {
    font-size:18px;
    margin:0 0 8px;
    color:white;
}

.monster-card p {
    margin:5px 0;
    font-size:15px;
    color:var(--text-secondary);
}

/* =========================
   POPUP
========================= */

.popup {
    display:none;
    position:fixed;
    inset:0;
    z-index:9999;
    background:rgba(0,0,0,.75);
    justify-content:center;
    align-items:center;
}

.popup-content {
    width:900px;
    max-height:85vh;
    overflow:auto;
    background:var(--card);
    border:1px solid var(--border);
    border-radius:16px;
    padding:30px;
    position:relative;
}

#weaponSearch {
    width:100%;
    padding:14px;
    margin-bottom:20px;
    background:#20293b;
    color:white;
    border:1px solid var(--border);
    border-radius:8px;
    outline:none;
}

#weaponSearch:focus {
    border-color:var(--accent);
    box-shadow:0 0 0 2px rgba(93,212,255,.12);
}

#weaponList {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
    gap:15px;
}

.weapon-item {
    display:flex;
    align-items:center;
    gap:12px;
    background:var(--card);
    border:1px solid var(--border);
    padding:12px;
    border-radius:10px;
    cursor:pointer;
    transition:.2s;
}

.weapon-item:hover {
    background:var(--card-hover);
    border-color:var(--accent);
}

#closeWeaponPopup {
    position:absolute;
    top:15px;
    right:15px;
    width:35px;
    height:35px;
    padding:0;
    border:1px solid var(--border);
    border-radius:50%;
    background:#29314a;
    color:white;
    font-size:18px;
    cursor:pointer;
    transition:.2s;
}

#closeWeaponPopup:hover {
    background:#f44336;
    border-color:#f44336;
    transform:none;
    box-shadow:none;
}

.better {
    background:#17351d !important;
    border:1px solid #4caf50;
}

.worse {
    background:#351818 !important;
    border:1px solid #f44336;
}

.monster-cell img {
    width:50px;
    height:50px;
    object-fit:contain;
}

/* =========================
   GLOBAL BUTTON SAFETY
========================= */

button {
    background:
        linear-gradient(
            135deg,
            var(--accent),
            var(--accent2)
        );
    color:white;
    border:none;
    padding:10px 18px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
    transition:.25s;
}

button:hover {
    transform:translateY(-2px);
    box-shadow:0 0 20px rgba(93,212,255,.25);
}

.mode-tab,
.nav-parent,
.mobile-menu-toggle,
#closeWeaponPopup {
    box-shadow:none;
}

/* =========================
   SCROLLBAR
========================= */

::-webkit-scrollbar {
    width:10px;
}

::-webkit-scrollbar-track {
    background:#0b1020;
}

::-webkit-scrollbar-thumb {
    background:#334155;
    border-radius:999px;
}

::-webkit-scrollbar-thumb:hover {
    background:#475569;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width:900px) {

    .sidebar {
        width:100%;
        height:auto;
        position:fixed;
        top:0;
        left:0;
        z-index:1000;
        padding:15px 20px;
        border-right:none;
        border-bottom:1px solid #34425e;
    }

    .sidebar-nav {
        display:none;
    }

    .sidebar-nav.mobile-open {
        display:flex;
        margin-top:25px;
    }

    .sidebar-logo {
        margin-bottom:0;
    }

    .content {
        margin-left:0;
        padding-top:100px;
    }

    .mobile-menu-toggle {
        display:flex;
        align-items:center;
        justify-content:center;
        position:absolute;
        top:15px;
        right:20px;
        width:42px;
        height:42px;
        padding:0;
        border:1px solid var(--accent);
        border-radius:8px;
        background:#263653;
        color:var(--accent);
        font-size:22px;
        line-height:1;
        cursor:pointer;
    }

    .page-header {
        flex-direction:column;
        align-items:flex-start;
        gap:10px;
    }
}

@media (max-width:600px) {

    html,
    body {
        width:100%;
        max-width:100%;
        overflow-x:hidden;
    }

    .layout {
        width:100%;
        max-width:100%;
    }

    .content {
        width:100%;
        max-width:100%;
        margin-left:0;
        padding:110px 15px 20px;
        overflow-x:hidden;
    }

    .page-header {
        width:100%;
        padding:22px;
    }

    .page-header h1 {
        font-size:30px;
        line-height:1.2;
    }

    .page-subtitle {
        font-size:12px;
        letter-spacing:1.5px;
    }

    .creator {
        font-size:13px;
    }

    .section {
        width:100%;
        margin-top:30px;
    }

    .mode-tabs {
        margin-top:30px;
        margin-bottom:15px;
    }

    .mode-tab {
        height:48px;
        font-size:14px;
    }

    .nether-grid {
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:10px;
    }

    .nether-card {
        min-width:0;
        padding:10px;
    }

    .nether-card img {
        width:70%;
    }

    .perk-container {
        flex-direction:column;
        gap:20px;
    }

    .perk-right {
        width:100%;
    }

    .perk-grid {
        grid-template-columns:repeat(auto-fill,60px);
        gap:10px;
    }

    .perk {
        width:60px;
        height:60px;
    }

    .weapon-stats {
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:8px;
    }

    .stat-box {
        height:42px;
        gap:5px;
    }

    .stat-box img {
        width:22px;
        height:22px;
    }

    .stat-box strong {
        font-size:13px;
    }

    .compare-weapon-grid {
        grid-template-columns:1fr;
        gap:20px;
    }

    .monster-result {
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:10px;
    }

    .monster-card {
        min-width:0;
        padding:10px;
    }

    .monster-image {
        width:45px;
        height:45px;
    }

    .monster-card h3 {
        font-size:15px;
    }

    .monster-card p {
        font-size:13px;
    }

    .compare-table {
        min-width:600px;
    }

    .section:has(.compare-table) {
        overflow-x:auto;
    }

    .popup-content {
        width:calc(100% - 30px);
        max-width:900px;
        max-height:90vh;
        padding:20px;
    }

    #weaponList {
        grid-template-columns:1fr;
        gap:10px;
    }
}