:root {
    --navy: #1e2a4a;
    --navy2: #2b3c66;
    --bg: #fff;
    --card: #fafbfc;
    --line: #d9dee8;
    --text: #111827;
    --muted: #6b7280;
    --theory: #4f6bd6;
    --theory-bg: #e8edfb;
    --ai: #0f9d8a;
    --ai-bg: #e1f5f1;
    --radius: 18px;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
}
body {
    font-family: "Segoe UI", Tahoma, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
a {
    color: inherit;
    text-decoration: none;
}

/* ---------- Header ---------- */
.hero {
    background: var(--bg);
    color: var(--text);
    padding: 26px 20px 20px;
    border-bottom: 1px solid var(--line);
}
.wrap {
    max-width: 1100px;
    margin: 0 auto;
}
.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    color: var(--navy);
}
.hero p {
    color: var(--muted);
    font-size: 1.05rem;
    margin-bottom: 22px;
}

/* ---------- Stats ---------- */
.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 26px 20px 6px;
}
.chip {
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: 16px;
    padding: 8px 14px;
    font-size: 1.05rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    transition: 0.15s;
    font-family: "Segoe UI", Tahoma, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    line-height: 1;
}
.chip b {
    font-weight: 700;
}
.chip:hover {
    border-color: #c7cfe3;
    box-shadow: 0 4px 12px rgba(30, 42, 74, 0.08);
}
.chip[data-cat="All"] {
    border-color: #c9d0e0;
    background: #eef1f7;
    color: var(--navy);
}
.chip[data-cat="Theory"] {
    border-color: #c3cdf0;
    background: var(--theory-bg);
    color: var(--theory);
}
.chip[data-cat="AI"] {
    border-color: #b6e3da;
    background: var(--ai-bg);
    color: var(--ai);
}
.chip b {
    color: inherit;
}
.chip.active[data-cat="All"] {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}
.chip.active[data-cat="Theory"] {
    background: var(--theory);
    border-color: var(--theory);
    color: #fff;
}
.chip-wrap {
    position: relative;
}
.chip-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    min-width: 100%;
    padding-top: 6px;
    display: none;
}
.chip-wrap:hover .chip-menu,
.chip-wrap:focus-within .chip-menu {
    display: block;
}
.chip-menu .chip-item {
    display: block;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 11px 18px;
    background: var(--card);
    color: var(--text);
    border-left: 1.5px solid var(--line);
    border-right: 1.5px solid var(--line);
}
.chip-menu .chip-item:first-child {
    border-top: 1.5px solid var(--line);
    border-radius: 12px 12px 0 0;
}
.chip-menu .chip-item:last-child {
    border-bottom: 1.5px solid var(--line);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 20px rgba(30, 42, 74, 0.12);
}
.chip-menu .chip-item:hover {
    background: #eef1f7;
}
.chip-wrap:has(.chip[data-cat="Theory"]) .chip-item:hover {
    background: var(--theory-bg);
    color: var(--theory);
}
.chip-wrap:has(.chip[data-cat="AI"]) .chip-item:hover {
    background: var(--ai-bg);
    color: var(--ai);
}
.section {
    scroll-margin-top: 16px;
}
.chip.active[data-cat="AI"] {
    background: var(--ai);
    border-color: var(--ai);
    color: #fff;
}

/* ---------- Sections ---------- */
main {
    padding: 0 20px 60px;
}
.section {
    margin-top: 26px;
}
.section h2 {
    font-size: 1.28rem;
    font-weight: 800;
    margin-bottom: 12px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.section h2 small {
    font-size: 0.84rem;
    color: var(--muted);
    font-weight: 500;
}
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

/* ---------- Card ---------- */
.card {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 18px;
    transition:
        transform 0.15s,
        box-shadow 0.15s,
        border-color 0.15s;
}
.card[data-href] {
    cursor: pointer;
}
.card[data-href]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(30, 42, 74, 0.1);
    border-color: #c7cfe3;
}
.card.nolink {
    cursor: default;
}
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 8px;
    letter-spacing: 0.01em;
}
.badge.Theory {
    background: var(--theory-bg);
    color: var(--theory);
}
.badge.AI {
    background: var(--ai-bg);
    color: var(--ai);
}
.badge + .badge {
    margin-left: 5px;
}
.title {
    font-weight: 700;
    font-size: 1.08rem;
    line-height: 1.4;
}
.authors {
    margin-top: 5px;
    color: #374151;
    font-size: 0.95rem;
}
.venue {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}
.meta {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-size: 0.75rem;
    color: var(--muted);
}
@media (min-width: 900px) {
    .card {
        display: flex;
        align-items: center;
        gap: 20px;
        padding: 6px 12px;
    }
    .title {
        font-size: 1.1rem;
    }
    .authors {
        font-size: 0.9rem;
    }
    .card .body {
        flex: 1;
        min-width: 0;
    }
    .meta {
        margin: 0;
        flex-shrink: 0;
    }
    .link {
        font-size: 0.84rem;
        padding: 8px 14px;
        margin: 0;
        border: 1px solid var(--line);
        background: #fff;
    }
}
.year-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 8px;
    font-weight: 700;
    font-size: 0.96rem;
    color: var(--navy);
}
.year-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}
.year-divider .count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 9px;
}
.section h2 {
    margin-bottom: 0;
}
.link {
    color: var(--theory);
    font-weight: 600;
    padding: 6px 10px;
    margin: -6px -10px;
    border-radius: 8px;
}
.link:hover {
    background: var(--theory-bg);
}
.link svg {
    width: 12px;
    height: 12px;
    vertical-align: -1px;
    margin-left: 3px;
}
.empty {
    padding: 40px;
    text-align: center;
    color: var(--muted);
}
footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0 20px 40px;
}
footer a {
    text-decoration: underline;
}

/* ---------- Back to top ---------- */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--navy);
    font: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(30, 42, 74, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition:
        opacity 0.15s,
        transform 0.15s,
        visibility 0.15s,
        background 0.15s;
    z-index: 100;
}

.back-to-top:hover {
    background: #fff;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
    .hero {
        padding: 34px 32px 24px;
    }
    .hero h1 {
        font-size: 2.6rem;
    }
    .stats,
    main,
    footer {
        padding-left: 32px;
        padding-right: 32px;
    }
    .stats {
        max-width: 1100px;
        margin: 0 auto;
        padding-top: 30px;
    }
    main {
        max-width: 1100px;
        margin: 0 auto;
    }
    .section h2 {
        font-size: 1.42rem;
    }
}
