
:root {
    color-scheme: light dark;
    --bg: #edf3f7;
    --panel: #fff;
    --text: #16293a;
    --text-light: #476074;
    --border-color: #cbd8e1;
    --control-border: #788e9f;
    --bg-light: #f0f5f8;
    --accent: #08635b;
    --accent-bg: #deeee9;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #101a24;
        --panel: #192837;
        --text: #eef4f8;
        --text-light: #b2c4d2;
        --border-color: #3b5063;
        --control-border: #859bab;
        --bg-light: #223545;
        --accent: #8adfcd;
        --accent-bg: #224842;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: system-ui, sans-serif;
    line-height: 1.55;
}

.container {
    width: min(100% - 2rem, 74rem);
    margin: 0 auto;
    padding: clamp(1.75rem, 4vw, 3.5rem) 0 3rem;
}

.container > header {
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 4px solid var(--accent);
}

h1 {
    margin: 0;
    font-size: clamp(1.75rem, 4.5vw, 3rem);
    line-height: 1.12;
}

.subtitle {
    margin: 0.5rem 0 0;
    color: var(--text-light);
}

.filters-section {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--panel);
}

.filter-group {
    min-width: 0;
}

.filter-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    font-weight: 650;
}

.search-input,
.filter-select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--control-border);
    border-radius: 0.45rem;
    color: var(--text);
    background: var(--bg-light);
    font: inherit;
}

.search-input::placeholder {
    color: var(--text-light);
    opacity: 1;
}

.stats {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--text-light);
    font-size: 0.875rem;
}

#resultCount {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}

.solutions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: 1rem;
}

.solution-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.15rem;
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    background: var(--panel);
}

.solution-card h3 {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.solution-card:focus-within {
    border-color: var(--accent);
}

@media (hover: hover) {
    .solution-card:hover {
        border-color: var(--control-border);
    }
}

a {
    color: var(--accent);
    text-underline-offset: 0.18em;
}

a:hover {
    text-decoration-thickness: 2px;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-name {
    margin: 0.35rem 0 0.85rem;
    color: var(--text-light);
    font-family: ui-monospace, monospace;
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.card-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.card-meta + div {
    margin-top: auto;
}

.topic-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.language-badge,
.topic-tag {
    display: inline-block;
    max-width: 100%;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.language-badge {
    border: 1px solid transparent;
    color: var(--accent);
    background: var(--accent-bg);
    font-weight: 650;
}

.topic-tag {
    border: 1px solid var(--border-color);
    color: var(--text-light);
    background: var(--bg-light);
}

.solution-card .source-link {
    margin-top: 0.35rem;
}

.loading,
.no-results {
    grid-column: 1 / -1;
    margin: 0;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    color: var(--text-light);
    background: var(--panel);
    text-align: center;
}

.no-results h2 {
    margin: 0;
    color: var(--text);
    font-size: 1.25rem;
}

.no-results p {
    margin: 0.35rem 0 0;
}

@media (max-width: 46rem) {
    .filters-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-box {
        grid-column: 1 / -1;
    }
}

@media (max-width: 30rem) {
    .filters-section {
        grid-template-columns: minmax(0, 1fr);
    }
}
