:root {
    color-scheme: light;
    --bg: #f4f5f7;
    --panel: #ffffff;
    --text: #202431;
    --muted: #9a9da8;
    --line: #eceef2;
    --brand: #f05a28;
    --dark: #17172a;
    --green: #3f9650;
    --blue: #2777ba;
    --shadow: 0 8px 26px rgba(30, 34, 48, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--text);
    background: var(--bg);
    font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
    font: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.header-inner,
.page {
    width: min(1258px, calc(100% - 36px));
    margin: 0 auto;
}

.header-inner {
    display: flex;
    height: 82px;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--brand);
    text-decoration: none;
}

.brand-main {
    display: inline-grid;
    width: 84px;
    line-height: 1;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.brand-main::after {
    content: "KOPHAN";
    margin-top: 2px;
    font-size: 9px;
    letter-spacing: .04em;
}

.brand-line {
    width: 1px;
    height: 18px;
    background: var(--brand);
}

.brand-sub {
    font-size: 16px;
    font-weight: 800;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-btn {
    display: inline-flex;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    color: #fff;
    border-radius: 8px;
    background: var(--dark);
    font-weight: 800;
    text-decoration: none;
}

.page {
    padding-bottom: 42px;
}

.search-section {
    display: flex;
    align-items: center;
    height: 64px;
}

.search-box {
    position: relative;
    display: block;
    width: min(482px, 100%);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    color: #a9adb6;
    transform: translateY(-50%);
    font-size: 21px;
}

.search-box input {
    width: 100%;
    height: 42px;
    padding: 0 18px 0 38px;
    color: var(--text);
    border: 1px solid #222436;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 0 #fff inset, 0 1px 5px rgba(0, 0, 0, .08);
    outline: none;
}

.search-box input::placeholder {
    color: #b5b8c1;
}

.tabs {
    display: flex;
    height: 44px;
    align-items: stretch;
    gap: 34px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.tabs a {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    position: relative;
    padding: 0;
    color: #8b8e98;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
}

.tabs a:visited {
    color: #8b8e98;
    text-decoration: none;
}

.tabs a:hover {
    color: #171a28;
    text-decoration: none;
}

.tabs a.active {
    color: #171a28;
}

.tabs a.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    border-radius: 999px;
    background: #171a28;
}

.tabs span {
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    padding: 0 5px;
    color: #b0b3bc;
    border-radius: 999px;
    background: #f0f1f4;
    font-size: 12px;
}

.content-shell {
    min-height: 360px;
    margin-left: calc((100vw - min(1258px, calc(100vw - 36px))) / -2);
    margin-right: calc((100vw - min(1258px, calc(100vw - 36px))) / -2);
    padding: 14px max(18px, calc((100vw - 1258px) / 2)) 30px;
    background: var(--bg);
}

.material-grid {
    column-count: 5;
    column-gap: 14px;
}

.material-card {
    display: inline-block;
    width: 100%;
    margin: 0 0 14px;
    overflow: hidden;
    border-radius: 9px;
    background: var(--panel);
    box-shadow: var(--shadow);
    break-inside: avoid;
    transition: transform .18s ease, box-shadow .18s ease;
}

.material-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(30, 34, 48, .12);
}

.cover {
    position: relative;
    display: block;
    min-height: 152px;
    color: inherit;
    background: #edf0f4;
    text-decoration: none;
}

.cover.is-downloading {
    pointer-events: none;
    opacity: .72;
}

.cover img {
    display: block;
    width: 100%;
    height: auto;
    min-height: 152px;
    object-fit: cover;
}

.file-cover {
    display: grid;
    min-height: 178px;
    place-items: center;
    padding: 36px 18px 26px;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .16), transparent 36%),
        linear-gradient(135deg, #252a3c, #606b7d);
}

.material-card.is-tall .file-cover { min-height: 318px; }
.material-card.is-medium .file-cover { min-height: 236px; }
.material-card.is-short .file-cover { min-height: 152px; }

.material-card.has-image .file-cover {
    display: none;
}

.material-card:not(.has-image) img {
    display: none;
}

.file-ext {
    display: grid;
    width: 88px;
    height: 88px;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, .72);
    border-radius: 18px;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: .02em;
}

.file-cover small {
    margin-top: 14px;
    color: rgba(255, 255, 255, .72);
}

.type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    height: 22px;
    padding: 0 8px;
    color: #fff;
    border-radius: 5px;
    background: var(--green);
    font-size: 12px;
    font-weight: 800;
    line-height: 22px;
}

.type-badge.video,
.type-badge.pdf,
.type-badge.archive {
    background: var(--blue);
}

.card-body {
    padding: 12px 12px 13px;
}

.card-body h2 {
    margin: 0;
    overflow: hidden;
    color: #323642;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    margin: 5px 0 0;
    overflow: hidden;
    color: #a2a6b0;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.state {
    display: grid;
    min-height: 320px;
    place-items: center;
    padding: 40px 18px;
    text-align: center;
}

.state p,
.state b {
    margin: 7px 0 0;
}

.state p {
    color: var(--muted);
}

.loading-ring {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e2e8;
    border-top-color: var(--dark);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

.pager a {
    display: inline-flex;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    color: #555966;
    border: 1px solid #dfe2e8;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-decoration: none;
}

.pager a:hover {
    border-color: #cfd4dc;
}

.pager a.disabled {
    color: #babdc5;
    pointer-events: none;
}

.pager button {
    height: 32px;
    padding: 0 14px;
    color: #555966;
    border: 1px solid #dfe2e8;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.pager button:disabled {
    color: #babdc5;
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1180px) {
    .material-grid {
        column-count: 4;
    }
}

@media (max-width: 920px) {
    .material-grid {
        column-count: 3;
    }
}

@media (max-width: 680px) {
    .header-inner,
    .page {
        width: min(100% - 24px, 520px);
    }

    .header-inner {
        height: auto;
        min-height: 70px;
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 12px 0;
    }

    .brand-sub {
        font-size: 14px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .search-section {
        height: 58px;
    }

    .tabs {
        gap: 22px;
        overflow-x: auto;
        white-space: nowrap;
    }

    .content-shell {
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .material-grid {
        column-count: 2;
        column-gap: 10px;
    }

    .material-card {
        margin-bottom: 10px;
        border-radius: 8px;
    }

    .cover,
    .cover img {
        min-height: 128px;
    }
}
