:root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f8fafc;
    /* Category Colors */
    --alkali: #dc2626;
    --alkaline: #ea580c;
    --transition: #854d0e;
    --post-transition: #166534;
    --metalloid: #065f46;
    --nonmetal: #1e40af;
    --halogen: #6d28d9;
    --noble: #5b21b6;
    --lanthanide: #be185d;
    --actinide: #9d174d;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 20px;
}

.table-container {
    display: grid;
    grid-template-columns: repeat(18, 1fr);
    gap: 4px;
    max-width: 1400px;
    margin: 0 auto;
}

.element-card {
    aspect-ratio: 1/1.2;
    border-radius: 4px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.2s;
}

.element-card:hover {
    transform: scale(1.1);
    z-index: 10;
    filter: brightness(1.2);
}

.at-num { font-size: 0.6rem; font-weight: bold; }
.symbol { font-size: 1.2rem; font-weight: 800; text-align: center; }
.name { font-size: 0.5rem; text-align: center; overflow: hidden; }

/* Responsive: On mobile, use a flexible flow instead of a rigid 18-column grid */
@media (max-width: 1024px) {
    .table-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    .element-card {
        width: 65px;
        height: 80px;
    }
}

/* Color Classes */
.alkali-metal { background: var(--alkali); }
.alkaline-earth-metal { background: var(--alkaline); }
.transition-metal { background: var(--transition); }
.post-transition-metal { background: var(--post-transition); }
.metalloid { background: var(--metalloid); }
.diatomic-nonmetal, .polyatomic-nonmetal { background: var(--nonmetal); }
.noble-gas { background: var(--noble); }
.lanthanide { background: var(--lanthanide); }
.actinide { background: var(--actinide); }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--card);
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #334155;
    width: 80%;
    max-width: 500px;
    border-radius: 12px;
    position: relative;
}

.close-btn {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    cursor: pointer;
}



.hidden { display: none !important; }

.controls { margin-bottom: 20px; }

#toggle-view {
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}








/* Responsive Slideshow Container */
.slideshow-mode {
    display: flex;
    flex-direction: row; /* Desktop default */
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    padding: 10px;
    box-sizing: border-box;
}

#slide-content {
    background: var(--card);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #334155;
    flex: 1;
    text-align: center;
    min-width: 0; /* Prevents text from pushing box wide */
}

.nav-btn {
    background: #334155;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-btn:hover { background: #475569; }


.big-symbol {
    font-size: 5rem;
    font-weight: 900;
    margin: 10px 0;
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 600px) {
    .element-card {
        width: 72px;
        height: 92px;
    }

    .slideshow-mode {
        flex-direction: column; /* Stack vertically on mobile */
    }

    #slide-content {
        order: 1; /* Card stays on top */
        padding: 20px;
        width: 100%;
    }


    .big-symbol {
        font-size: 3.5rem;
    }
}


.big-symbol {
    font-size: 5rem;
    font-weight: 900;
    margin: 10px 0;
    line-height: 1;
}

.hidden { display: none !important; }



.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
    text-align: left;
    font-size: 0.9rem;
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 8px;
}

.stats-item {
    display: flex;
    flex-direction: column;
}

.stats-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    opacity: 0.6;
    letter-spacing: 1px;
}

.flex-slide-btn-holder{
    display: flex;
     order: 2;
}

.mobile-nav-wrapper {
        display: flex;
        margin: 0 10px;
    }