﻿

* {
    box-sizing: border-box
}

html, body {
    margin: 0
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Nunito',system-ui,-apple-system,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;
    font-weight: 600;
    -webkit-font-smoothing: antialiased;
    line-height: 1.4;
}

a {
    color: inherit;
    text-decoration: none
}

/* ---------- Search hero ---------- */
.hero {
    max-width: 1280px;
    margin: 0 auto;
    padding: 26px 22px 6px
}

    .hero h1 {
        margin: 0 0 4px;
        font-size: 26px;
        font-weight: 900;
        letter-spacing: -.6px;
        text-align:center;
        
    }

    .hero p {
        margin: 0 0 18px;
        color: var(--ink-soft);
        font-weight: 700;
        font-size: 15px;
        text-align: center;
    }

.search {
    position: relative;
}

    .search svg {
        position: absolute;
        left: 18px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--ink-faint)
    }

    .search input {
        width: 100%;
        padding: 16px 46px 16px 50px;
        border: 1.5px solid var(--line-strong);
        border-radius: 14px;
        background: var(--surface);
        color: var(--ink);
        font-family: inherit;
        font-weight: 700;
        font-size: 16px;
        box-shadow: var(--shadow);
        transition: border-color .15s, box-shadow .15s;
    }

        .search input::placeholder {
            color: var(--ink-faint);
            font-weight: 600
        }

        .search input:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 4px var(--brand-soft)
        }

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: var(--surface-2);
    color: var(--ink-soft);
    font-size: 16px;
    display: none;
    place-items: center;
}

    .search-clear:hover {
        background: var(--line-strong);
        color: var(--ink)
    }

    .search-clear.show {
        display: grid
    }

/* ---------- Layout ---------- */
.shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 18px 22px 60px;
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 26px;
    align-items: start
}

/* ---------- Sidebar ---------- */
.side {
    position: sticky;
    top: 86px
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 16px;
}

    .panel h2 {
        margin: 2px 0 12px;
        font-size: 13px;
        font-weight: 900;
        letter-spacing: .3px;
        color: var(--ink-faint);
        display: flex;
        align-items: center;
        gap: 8px;
        text-transform: uppercase;
    }

.grade-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 8px
}

.grade {
    border: 1.5px solid var(--line);
    background: var(--surface-2);
    color: var(--ink);
    border-radius: 11px;
    padding: 10px 6px;
    font-family: inherit;
    font-weight: 800;
    font-size: 12pt;
    cursor: pointer;
    transition: .12s;
    text-align: center;
}

    .grade small {
        display: block;
        font-size: 10pt;
        font-weight: 700;
        color: var(--ink-faint);
        margin-top: 1px
    }

    .grade:hover {
        border-color: var(--line-strong)
    }

    .grade.active {
        background: var(--brand);
        border-color: var(--brand);
        color: #fff
    }

        .grade.active small {
            color: rgba(255,255,255,.85)
        }

    .grade.all {
        grid-column: span 4
    }

.topics {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: calc(100vh - 340px);
    overflow: auto;
    margin: -4px -6px;
    padding: 4px 6px
}

    .topics::-webkit-scrollbar {
        width: 8px
    }

    .topics::-webkit-scrollbar-thumb {
        background: var(--line-strong);
        border-radius: 8px
    }

.topic {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--ink);
    border-radius: 10px;
    padding: 9px 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 12pt;
    cursor: pointer;
    text-align: left;
    transition: background .12s;
}

    .topic:hover {
        background: var(--surface-2)
    }

    .topic.active {
        background: var(--brand-soft);
        color: var(--brand)
    }

.dot {
    width: 11px;
    height: 11px;
    border-radius: 4px;
    flex: none
}

.topic .name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.topic .cnt {
    font-size: 12px;
    font-weight: 800;
    color: var(--ink-faint);
    background: var(--surface-2);
    padding: 1px 8px;
    border-radius: 20px
}

.topic.active .cnt {
    background: var(--surface);
    color: var(--brand)
}

/* ---------- Main ---------- */
.results-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 2px 2px 16px;
}

.count {
    font-weight: 900;
    font-size: 17px
}

    .count span {
        color: var(--brand)
    }

.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1
}

.fchip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 5px 6px 5px 11px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 13px;
    box-shadow: var(--shadow);
}

    .fchip button {
        border: none;
        background: var(--surface-2);
        color: var(--ink-soft);
        width: 20px;
        height: 20px;
        border-radius: 50%;
        cursor: pointer;
        font-size: 14px;
        line-height: 1
    }

        .fchip button:hover {
            background: var(--line-strong);
            color: var(--ink)
        }

.clear-all {
    border: none;
    background: transparent;
    color: var(--brand);
    font-family: inherit;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px
}

    .clear-all:hover {
        background: var(--brand-soft)
    }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(238px,1fr));
    gap: 14px
}

.card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 15px 15px 15px 17px;
    box-shadow: var(--shadow);
    transition: transform .13s ease, box-shadow .13s ease, border-color .13s;
    overflow: hidden;
}

    .card::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 5px;
        background: var(--c)
    }

    .card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-hover);
        border-color: transparent
    }

.card-ico {
    width: 42px;
    height: 42px;
    flex: none;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 17px;
    color: #fff;
    background: var(--c);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--c) 40%, transparent);
}

.card-body {
    min-width: 0;
    flex: 1
}

.card-title {
    font-weight: 800;
    font-size: 12pt;
    line-height: 1.3;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.card-meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 7px
}

.card-topic {
    font-size: 10pt;
    font-weight: 800;
    color: var(--c)
}

.card-grade {
    font-size: 11px;
    font-weight: 800;
    color: var(--ink-faint);
    background: var(--surface-2);
    padding: 1px 7px;
    border-radius: 20px
}

.empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
    color: var(--ink-soft)
}

    .empty div {
        font-size: 44px;
        margin-bottom: 8px
    }

    .empty h3 {
        margin: 0 0 6px;
        font-size: 18px;
        color: var(--ink)
    }

    .empty p {
        margin: 0;
        font-weight: 700
    }

/* ---------- Mobile filter toggle ---------- */
.filter-btn {
    display: none;
    align-items: center;
    gap: 9px;
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    padding: 12px 16px;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    box-shadow: var(--shadow);
    width: 100%;
    justify-content: center;
    margin-bottom: 16px;
}

    .filter-btn .badge {
        background: var(--brand);
        color: #fff;
        border-radius: 20px;
        padding: 0 8px;
        font-size: 12px;
        min-width: 20px
    }

.backdrop {
    display: none
}

@media (max-width:900px) {
    .shell {
        grid-template-columns: 1fr;
        gap: 0
    }

    .filter-btn {
        display: flex
    }

    .side {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        width: min(340px,86vw);
        top: 0;
        height: 100%;
        overflow: auto;
        padding: 16px;
        background: var(--bg);
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: 0 0 40px rgba(0,0,0,.25);
    }

        .side.open {
            transform: none
        }

    .backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15,20,35,.5);
        z-index: 55
    }

    .side-close {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 8px;
        font-weight: 900;
        font-size: 16px
    }

        .side-close button {
            border: none;
            background: var(--surface);
            width: 36px;
            height: 36px;
            border-radius: 10px;
            font-size: 20px;
            cursor: pointer;
            color: var(--ink)
        }

    .topics {
        max-height: none
    }

    .hero h1 {
        font-size: 22px
    }
}

@media (min-width:901px) {
    .side-close {
        display: none
    }
}

@media (max-width:560px) {
    .topbar-in {
        padding: 12px 15px
    }

    .hero {
        padding: 20px 15px 4px
    }

    .shell {
        padding: 14px 15px 50px
    }

    .crumb {
        display: none
    }

    .grid {
        grid-template-columns: 1fr 1fr;
        gap: 11px
    }

    .card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 13px
    }
}

@media (max-width:380px) {
    .grid {
        grid-template-columns: 1fr
    }
}

