:root {
    --bg-deep: #07080c;
    --bg-panel: #0c0e14;
    --bg-raised: #11141c;
    --bg-field: #090b10;

    --line: #1d2230;
    --line-strong: #2d3549;
    --control-border: #5f6b86;
    --text: #f3f5f9;
    --text-dim: #a4adc0;

    --radius: 6px;
    --font-body: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

    --sidebar-w: clamp(240px, 22vw, 320px);

    --accent: #125bfb;
    --accent-text: #6f9dff;
    --accent-rgb: 18 91 251;

    color-scheme: dark;
}

body[data-page="home"] {
    --accent: #125bfb;
    --accent-text: #6f9dff;
    --accent-rgb: 18 91 251;
}

body[data-page="edl"] {
    --accent: #9944ff;
    --accent-text: #c08cff;
    --accent-rgb: 153 68 255;
}

body[data-page="mdl"] {
    --accent: #ff00ff;
    --accent-text: #ff7bff;
    --accent-rgb: 255 0 255;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg-panel);
    background-image:
        radial-gradient(60rem 28rem at 85% -8%, rgb(var(--accent-rgb) / 0.16), transparent 70%),
        linear-gradient(rgb(255 255 255 / 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 0.025) 1px, transparent 1px);
    background-size: auto, 48px 48px, 48px 48px;
    background-repeat: no-repeat, repeat, repeat;
}

button,
select,
input {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent-text);
    outline-offset: 2px;
}

nav {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.5rem 1.25rem;
    background-color: var(--bg-deep);
    border-bottom: 2px solid var(--accent);
}

.nav-logo {
    display: block;
    width: 30px;
    height: 30px;
    transition: transform 0.25s ease-in-out;
}

.nav-logo:hover {
    transform: scale(1.15);
    color: #ffffffc4;
}

.logo-link {
    display: inline-block;
    border-radius: var(--radius);
    color: var(--text);
    transition: color 0.2s;
}

.logo-link:hover,
.logo-link:focus-visible {
    color: var(--accent-text);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
}

.nav-links a {
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius);
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.nav-links a:hover {
    color: var(--text);
    background-color: rgb(255 255 255 / 0.07);
}

.nav-links a[aria-current="page"] {
    color: var(--text);
    background-color: rgb(var(--accent-rgb) / 0.2);
}

.version {
    padding: 0.05rem 0.5rem;
    border: 1px solid rgb(var(--accent-rgb) / 0.55);
    border-radius: 4px;
    background-color: rgb(var(--accent-rgb) / 0.12);
    color: var(--accent-text);
    font-size: 0.75rem;
    font-weight: 700;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    padding: 1.75rem 2rem;
    background-color: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card h1,
.card h2 {
    margin-bottom: 0.75rem;
    color: var(--text);
}

.card p {
    max-width: 70ch;
    color: var(--text-dim);
}

.changelog ul,
.links ul {
    margin-left: 1rem;
    list-style-position: inside;
    color: var(--text-dim);
}

.changelog strong {
    color: var(--text);
}

.links a {
    color: var(--accent-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.links a:hover {
    text-decoration-thickness: 2px;
}

.layout-grid {
    flex: 1;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

.list-section {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-deep);
    border-bottom: 1px solid var(--line);
}

.preview-section {
    position: relative;
    min-width: 0;
    padding: 1rem;
}

@media (min-width: 768px) {

    body[data-page="edl"],
    body[data-page="mdl"] {
        height: 100vh;
        height: 100dvh;
        min-height: 30rem;
    }

    .layout-grid {
        min-height: 0;
        grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
    }

    .list-section {
        min-height: 0;
        border-bottom: 0;
        border-right: 1px solid var(--line);
    }

    .preview-section {
        min-height: 0;
        overflow-y: auto;
        padding: clamp(1rem, 4vw, 2.5rem);
    }
}

.list-section h1 {
    padding: 1rem 1rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
}

.search-controls,
.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.25rem 1rem 0.9rem;
}

.search-controls label,
.filter-controls label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.search-controls+.filter-controls {
    padding-top: 0;
}

.search-controls input[type="search"] {
    width: 100%;
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    background-color: var(--bg-field);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
}

.search-controls input[type="search"]:hover {
    border-color: rgb(var(--accent-rgb) / 0.7);
}

.filter-controls select {
    width: 100%;
    min-height: 40px;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    background-color: var(--bg-field);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a4adc0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
}

.filter-controls select:hover {
    border-color: rgb(var(--accent-rgb) / 0.7);
}

.results-status {
    min-height: 1.5rem;
    padding: 0 1rem 0.5rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.list-empty {
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.ranking-list {
    position: relative;
    list-style: none;
    max-height: min(50vh, 26rem);
    overflow-y: auto;
    border-top: 1px solid var(--line);
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

@media (min-width: 768px) {
    .ranking-list {
        flex: 1;
        min-height: 0;
        max-height: none;
    }
}

.ranking-item {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background-color: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-left: 3px solid transparent;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s;
}

.ranking-item:hover {
    background-color: rgb(255 255 255 / 0.05);
}

.ranking-item[aria-current="true"] {
    background-color: rgb(var(--accent-rgb) / 0.18);
    border-left-color: var(--accent);
}

.ranking-item:focus-visible {
    outline-offset: -3px;
}

.rank-badge {
    flex: none;
    min-width: 3.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent-text);
}

.level-name {
    font-size: 0.95rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.preview-card {
    max-width: 54rem;
    margin-inline: auto;
    background-color: rgb(13 15 21 / 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.preview-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgb(var(--accent-rgb) / 0.5);
}

.preview-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.preview-rank {
    margin-right: 0.5rem;
    color: var(--accent-text);
}

.preview-meta {
    margin-top: 0.35rem;
    color: var(--text-dim);
}

.preview-body {
    min-height: clamp(10rem, 32vh, 20rem);
    padding: 1.5rem;
}

.preview-label {
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.preview-body p {
    max-width: 65ch;
    line-height: 1.7;
}

.preview-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
}

.stat {
    padding: 1rem 0.75rem;
    text-align: center;
}

.stat+.stat {
    border-left: 1px solid var(--line);
}

.stat dt {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.stat dd {
    font-family: var(--font-mono);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.stat-accent {
    color: var(--accent-text);
}

.preview-reliable {
    padding: 1.25rem 1.5rem 1.5rem;
    border-top: 1px solid var(--line);
}

.preview-reliable p {
    line-height: 1.7;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

@media (max-width: 479px) {
    .preview-stats {
        grid-template-columns: minmax(0, 1fr);
    }

    .stat+.stat {
        border-left: 0;
        border-top: 1px solid var(--line);
    }
}

.preview-empty {
    max-width: 54rem;
    margin: 2rem auto;
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text-dim);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

@media (forced-colors: active) {
    .ranking-item[aria-current="true"] {
        border-left-color: Highlight;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}