/* ===== CSS Variables ===== */
:root {
    scrollbar-width: none;
    --main-color: #00838f;
    --text-color: #263238;
    --p-color: #6c7781;
    --bg-color: #f6f7fa;
    --card-bg: #fdfdfd;
    --border-color: #f6f7fa;
    --hover-bg: #f0f0f0;
}

@media (prefers-color-scheme: dark) {
    :root {
        --main-color: #00838f;
        --text-color: #e6edf3;
        --p-color: #9aa4af;
        --bg-color: #0f1419;
        --card-bg: #1a1f24;
        --border-color: #2a3138;
        --hover-bg: #222933;
    }
}

/* ===== Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    font-size: 15px;
    font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* ===== Header ===== */
header {
    background: var(--card-bg);
    padding: 18px;
    border-top: 2px solid var(--main-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

h1 {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: 500;
}

h2 {
    font-size: 18px;
    font-weight: 500;
    padding: 14px 20px;
    border-bottom: 1px solid var(--bg-color);
}

a {
    color: var(--main-color);
    text-decoration: none;
}

/* ===== Main ===== */
main {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 38px;
    padding: 3em 1em;
}

main a {
    font-size: 15px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
    gap: 8px;
    padding-right: 20px;
}

main img {
    max-width: 20px;
    border-radius: 3px;
}

main p {
    font-size: 13px;
    color: var(--p-color);
    align-self: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

/* ===== Section Cards ===== */
section {
    width: 100%;
    max-width: 780px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

ul {
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 10px;
}

li {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1 1 calc(25% - 30px);
    height: fit-content;
    border: 1px solid var(--border-color);
    padding: 10px;
    cursor: pointer;
    gap: 8px;
    transition: background 0.25s, border-color 0.25s;
}

li:hover {
    background: var(--hover-bg);
}

main > section:nth-of-type(-n+2) li {
    flex: 1 1 calc(30% - 30px);
}

/* ===== Footer ===== */
footer {
    color: var(--p-color);
    line-height: 2em;
    text-align: center;
    padding: 0 20px 20px;
}

/* ===== Loading Animation ===== */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--main-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0%  { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
