* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #0d1117;
    color: #c9d1d9;
    padding: 0 0 80px 0; /* Ensures the last row isn't covered by the footer */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Navbar ── */
.navbar {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 200;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
}

.nav-logo {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.nav-logo span { color: #00ff7f; }

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #8b949e;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.nav-links a:hover { color: #00ff7f; }

/* ── Page Header — NOT sticky ── */
.page-header {
    padding: 30px 0 10px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid #30363d;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #ffffff;
    font-size: 2.5rem;
    letter-spacing: -1px;
}

h1 span { color: #00ff7f; }

header p {
    color: #8b949e;
    margin-top: 5px;
    font-size: 0.9rem;
}

header p a {
    color: #58a6ff;
    text-decoration: none;
}

header p a:hover { text-decoration: underline; }

/* ── Search ── */
.controls {
    display: flex;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}

input[type="text"] {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    border: 1px solid #30363d;
    border-radius: 8px;
    background-color: #010409;
    color: #ffffff;
    outline: none;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    border-color: #00ff7f;
    box-shadow: 0 0 8px rgba(0, 255, 127, 0.2);
}

/* ── Filter Toggle ── */
.filter-toggle-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.filter-toggle-btn {
    background: transparent;
    color: #8b949e;
    border: 1px solid #30363d;
    border-radius: 20px;
    padding: 6px 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-toggle-btn:hover {
    color: #00ff7f;
    border-color: #00ff7f;
    background: rgba(0, 255, 127, 0.05);
}

/* ── Collapsible Filter Section ── */
.filter-section {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.filter-section.collapsed {
    max-height: 0;
    opacity: 0;
}

/* ── Category Buttons ── */
.category-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px 5px 5px 5px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.category-btn {
    background-color: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.category-btn:hover {
    border-color: #58a6ff;
    background-color: #1f242b;
}

.category-btn.active {
    background-color: rgba(0, 255, 127, 0.1);
    color: #00ff7f;
    border-color: #00ff7f;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0, 255, 127, 0.2);
}

/* ── Status text ── */
.status-text {
    text-align: center;
    font-size: 0.9rem;
    color: #8b949e;
    margin-top: 12px;
}

/* ── Difficulty Legend ── */
.legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.82rem;
    color: #8b949e;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 14px;
}

.legend-title {
    font-weight: 600;
    color: #c9d1d9;
}

.legend-desc { color: #8b949e; }

.legend-sep {
    color: #30363d;
    font-size: 1rem;
}

/* ── Table ── */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #161b22;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

th, td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #30363d;
}

th {
    background-color: #21262d;
    color: #ffffff;
}

/* Sortable column headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

th.sortable:hover {
    background-color: #292e37;
    color: #00ff7f;
}

th.sortable.active-sort {
    color: #00ff7f;
}

.sort-icon {
    font-size: 0.7rem;
    margin-left: 4px;
    color: #00ff7f;
}

tr {
    transition: background-color 0.2s ease;
    border-left: 3px solid transparent;
}

tr:hover {
    background-color: #1f242b;
    border-left: 3px solid #00ff7f;
}

a.tool-link {
    color: #58a6ff;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

a.tool-link:hover { color: #79c0ff; }

.tag-advanced {
    background-color: rgba(163, 113, 247, 0.2);
    color: #a371f7;
    border: 1px solid #a371f7;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.tag-beginner {
    background-color: rgba(46, 160, 67, 0.2);
    color: #2ea043;
    border: 1px solid #2ea043;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }

/* ── Sticky Footer ── */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(22, 27, 34, 0.9); /* Matches the dark theme */
    backdrop-filter: blur(10px);       /* Glassmorphism effect */
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid #30363d;
    padding: 12px 20px;
    z-index: 200;
    
    /* Centering */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.site-footer p {
    font-size: 0.85rem;
    color: #8b949e;
    margin: 0;
}

.site-footer a {
    color: #58a6ff;
    text-decoration: none;
    font-weight: 500;
}

.site-footer a:hover {
    text-decoration: underline;
    color: #79c0ff;
}

/* ── Back to Top (Adjusted to avoid footer) ── */
.back-to-top {
    display: none;
    position: fixed;
    bottom: 60px; /* Increased from 30px so it sits ABOVE the footer */
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #21262d;
    color: #00ff7f;
    border: 1px solid #00ff7f;
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(0, 255, 127, 0.2);
    transition: all 0.2s ease;
    z-index: 999;
}

.back-to-top:hover {
    background-color: rgba(0, 255, 127, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 127, 0.35);
}