:root {
    color-scheme: dark;
    --bg: #08111f;
    --bg-accent: #0f1c31;
    --panel: rgba(10, 18, 33, 0.82);
    --panel-strong: rgba(14, 24, 42, 0.96);
    --line: rgba(137, 168, 204, 0.16);
    --text: #eaf2ff;
    --muted: #9fb2cc;
    --highlight: #69d0ff;
    --highlight-strong: #22c55e;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --font-sans: "Segoe UI", "Inter", sans-serif;
    --font-mono: "Consolas", "SFMono-Regular", monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.10), transparent 28%),
        radial-gradient(circle at top right, rgba(105, 208, 255, 0.16), transparent 30%),
        linear-gradient(180deg, #0b1629 0%, var(--bg) 50%, #040912 100%);
    color: var(--text);
    font-family: var(--font-sans);
}

body {
    min-height: 100vh;
    padding: 32px 18px 48px;
    background-repeat: no-repeat;
    background-size: cover;
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    max-width: 1220px;
    margin: 0 auto;
}

.hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(10, 20, 38, 0.92), rgba(6, 11, 22, 0.88));
    box-shadow: var(--shadow);
}

.hero__inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(560px, 1fr);
    gap: 24px;
    padding: 36px;
    align-items: start;
}

.hero__inner > div:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    text-align: center;
}

.hero__glow {
    position: absolute;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    filter: blur(48px);
    opacity: 0.5;
}

.hero__glow--left {
    top: -130px;
    left: -90px;
    background: rgba(34, 197, 94, 0.18);
}

.hero__glow--right {
    top: -140px;
    right: -50px;
    background: rgba(105, 208, 255, 0.18);
}

.hero h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 0.95;
}

.hero__stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    align-self: end;
    min-width: 0;
}

.stat-card {
    min-width: 118px;
    padding: 18px 20px;
    border: 1px solid rgba(137, 168, 204, 0.14);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    min-height: 112px;
    overflow: hidden;
}

.stat-card--size {
    min-width: 142px;
}

.stat-card__label {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.35;
}

.stat-card strong {
    display: block;
    font-size: clamp(1.45rem, 2.2vw, 1.9rem);
    line-height: 1;
    max-width: 100%;
}

.stat-card__value {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 48px;
}

.stat-card__number,
.stat-card__unit {
    display: block;
    max-width: 100%;
}

.stat-card__number {
    overflow-wrap: anywhere;
}

.stat-card__unit {
    font-size: 0.78em;
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.content-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.directory-form {
    display: block;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 24px 18px;
    border-bottom: 1px solid var(--line);
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
}

.breadcrumb-link {
    transition: color 160ms ease, transform 160ms ease;
}

.breadcrumb-link:hover {
    color: var(--text);
    transform: translateY(-1px);
}

.breadcrumb-separator {
    opacity: 0.45;
}

.toolbar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: nowrap;
    flex: 0 0 auto;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    white-space: nowrap;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-weight: 600;
    cursor: pointer;
}

.button--ghost {
    background: rgba(255, 255, 255, 0.04);
    flex: 0 0 auto;
}

.button--primary {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.92), rgba(12, 148, 136, 0.9));
    border-color: rgba(103, 232, 163, 0.26);
    color: #04131a;
    box-shadow: 0 14px 30px rgba(12, 148, 136, 0.18);
}

.searchbox {
    display: flex;
    align-items: center;
    min-height: 46px;
    width: 300px;
    flex: 0 1 300px;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
}

.searchbox input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
}

.searchbox input::placeholder {
    color: #7f93b0;
}

.searchbox__icon {
    color: var(--muted);
}

.notice {
    margin: 18px 24px 0;
    padding: 14px 16px;
    border: 1px solid rgba(255, 136, 136, 0.2);
    border-radius: var(--radius-md);
    background: rgba(255, 91, 91, 0.09);
    color: #ffd0d0;
}

.download-hint {
    padding: 14px 24px 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.directory-panel {
    padding: 10px 16px 16px;
}

.directory-head,
.directory-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 100px 100px 180px;
    gap: 16px;
    align-items: center;
}

.directory-head {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.directory-list {
    display: grid;
    gap: 10px;
}

.directory-row {
    padding: 16px 12px;
    border: 1px solid rgba(137, 168, 204, 0.08);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        background 160ms ease,
        box-shadow 160ms ease;
}

.directory-row:hover {
    transform: translateY(-2px);
    border-color: rgba(105, 208, 255, 0.24);
    background: linear-gradient(180deg, rgba(22, 38, 65, 0.78), rgba(12, 23, 39, 0.72));
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.name-cell {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.entry-link {
    min-width: 0;
}

.name-copy {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.meta-copy {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.92rem;
}

.align-right {
    text-align: right;
}

.type-pill {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(105, 208, 255, 0.10);
    color: #bfefff;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.icon {
    position: relative;
    display: inline-flex;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.icon::before,
.icon::after {
    content: "";
    position: absolute;
}

.icon--folder::before {
    top: 4px;
    left: 0;
    width: 16px;
    height: 10px;
    border-radius: 3px;
    background: linear-gradient(180deg, #7ce8ff, #38bdf8);
}

.icon--folder::after {
    top: 1px;
    left: 1px;
    width: 7px;
    height: 5px;
    border-radius: 2px 2px 0 0;
    background: #93f4ff;
}

.icon--file::before,
.icon--document::before,
.icon--image::before,
.icon--video::before,
.icon--audio::before,
.icon--archive::before {
    inset: 1px 2px 1px 2px;
    border-radius: 3px;
    background: linear-gradient(180deg, #d8e6ff, #8da6d0);
}

.icon--file::after,
.icon--document::after,
.icon--image::after,
.icon--video::after,
.icon--audio::after,
.icon--archive::after {
    top: 1px;
    right: 2px;
    width: 5px;
    height: 5px;
    background: rgba(8, 17, 31, 0.66);
    clip-path: polygon(0 0, 100% 100%, 100% 0);
}

.icon--image::before {
    background: linear-gradient(180deg, #8af7c1, #3dbd8f);
}

.icon--video::before {
    background: linear-gradient(180deg, #f7c36b, #fb923c);
}

.icon--audio::before {
    background: linear-gradient(180deg, #d0b2ff, #8b5cf6);
}

.icon--archive::before {
    background: linear-gradient(180deg, #ffd37a, #f59e0b);
}

.icon--document::before {
    background: linear-gradient(180deg, #94e1ff, #60a5fa);
}

.empty-state {
    padding: 56px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state h2 {
    margin: 0 0 8px;
    color: var(--text);
}

.empty-state p {
    margin: 0;
}

.select-toggle,
.select-spacer {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.select-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.select-toggle input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.select-toggle__control {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(137, 168, 204, 0.36);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.select-toggle__control::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 6px;
    width: 4px;
    height: 8px;
    border-right: 2px solid #04131a;
    border-bottom: 2px solid #04131a;
    transform: rotate(45deg) scale(0);
    transition: transform 160ms ease;
}

.select-toggle input:checked + .select-toggle__control {
    border-color: rgba(103, 232, 163, 0.7);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.92), rgba(12, 148, 136, 0.9));
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.select-toggle input:checked + .select-toggle__control::after {
    transform: rotate(45deg) scale(1);
}

.is-hidden {
    display: none;
}

@media (max-width: 900px) {
    .hero__inner,
    .toolbar {
        grid-template-columns: 1fr;
        display: grid;
    }

    .toolbar__actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .hero__stats {
        grid-template-columns: repeat(2, 1fr);
        align-self: stretch;
    }

    .directory-head {
        display: none;
    }

    .directory-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .align-right {
        text-align: left;
    }

    .meta-copy::before {
        display: inline-block;
        margin-right: 8px;
        color: var(--text);
        opacity: 0.7;
    }

    .directory-row > :nth-child(3)::before {
        content: "Size";
    }

    .directory-row > :nth-child(4)::before {
        content: "Modified";
    }

    .searchbox {
        width: 100%;
        flex-basis: 100%;
    }

    .download-hint {
        padding-left: 14px;
        padding-right: 14px;
    }
}

@media (max-width: 640px) {
    body {
        padding: 18px 10px 32px;
    }

    .hero__inner,
    .toolbar,
    .directory-panel {
        padding-left: 14px;
        padding-right: 14px;
    }

    .hero {
        border-radius: 22px;
    }

    .content-card {
        border-radius: 22px;
    }

    .hero__stats {
        grid-template-columns: 1fr;
    }
}
