:root {
    --bg-1: #0a0f1f;
    --bg-2: #101731;
    --panel: rgba(23, 28, 57, 0.9);
    --panel-2: rgba(17, 22, 46, 0.94);
    --line: rgba(255, 255, 255, 0.08);
    --line-soft: rgba(255, 255, 255, 0.05);
    --text: #eaf0ff;
    --muted: #a7b2d1;
    --muted-2: #7f8aac;
    --green: #38d39f;
    --blue: #3b82f6;
    --cyan: #06b6d4;
    --violet: #a855f7;
    --pink: #ec4899;
    --orange: #f59e0b;
    --gold: #f7c948;
    --danger: #ef4444;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
    line-height: 1.45;
    background:
        radial-gradient(900px 420px at 8% 0%, rgba(56, 211, 159, 0.1), transparent 55%),
        radial-gradient(900px 480px at 70% 0%, rgba(168, 85, 247, 0.12), transparent 55%),
        radial-gradient(700px 380px at 100% 10%, rgba(59, 130, 246, 0.12), transparent 50%),
        linear-gradient(180deg, var(--bg-1) 0%, #090d18 100%);
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--green), var(--blue), transparent);
    opacity: 0.95;
    pointer-events: none;
    z-index: 10;
}

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

a:hover {
    text-decoration: none;
}

.page-wrap {
    width: min(1180px, calc(100% - 1rem));
    margin: 1rem auto;
    display: grid;
    gap: 0.9rem;
}

.top-panel,
.table-panel,
.site-footer {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    box-shadow: var(--shadow);
}

.top-panel {
    padding: 1rem;
}

.top-panel__inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.title-kicker {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.66rem;
    color: var(--muted-2);
}

.title-block h1 {
    margin: 0.25rem 0 0;
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    line-height: 1.1;
}

.title-sub {
    margin: 0.45rem 0 0;
    color: var(--muted);
}

.title-stats {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.stat-pill--green {
    background: rgba(56, 211, 159, 0.12);
    border-color: rgba(56, 211, 159, 0.3);
    color: #b9ffe6;
}

.stat-pill--blue {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.3);
    color: #dbeafe;
}

.stat-pill--pink {
    background: rgba(236, 72, 153, 0.12);
    border-color: rgba(236, 72, 153, 0.3);
    color: #ffd2ea;
}

.custom-header-slot {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line-soft);
    color: var(--muted);
}

.custom-header-slot * {
    color: inherit;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.8rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.86rem;
    color: var(--muted);
}

.breadcrumb {
    color: #e3ebff;
    padding: 0.16rem 0.4rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
}

.breadcrumb:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.crumb-sep {
    color: var(--muted-2);
}

.sort-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.sort-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.15rem;
    padding: 0.45rem 0.9rem;
    border-radius: 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fbff;
    font-size: 0.85rem;
    font-weight: 700;
    transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.sort-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.sort-btn.is-active {
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.tone-blue {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.9));
}

.tone-cyan {
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.95), rgba(14, 165, 233, 0.9));
}

.tone-green {
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.9));
}

.tone-violet {
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.95), rgba(147, 51, 234, 0.9));
}

.tone-pink {
    background: linear-gradient(180deg, rgba(244, 114, 182, 0.95), rgba(236, 72, 153, 0.9));
}

.tone-orange {
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.95), rgba(245, 158, 11, 0.9));
    color: #23160a;
}

.table-panel {
    padding: 0.8rem;
}

.table-panel__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    color: var(--muted);
    font-size: 0.84rem;
}

.meta-left,
.meta-right {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.meta-dot {
    width: 0.28rem;
    height: 0.28rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.24);
}

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

.meta-right code {
    color: #e5ecff;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    padding: 0.12rem 0.35rem;
    border-radius: 0.35rem;
    word-break: break-all;
}

.table-shell {
    overflow: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(12, 16, 34, 0.78);
}

#main_content {
    width: 100%;
    min-width: 640px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

#main_content thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    white-space: nowrap;
    padding: 0.85rem 0.9rem;
    color: #e8efff;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(31, 39, 76, 0.98), rgba(24, 31, 61, 0.98));
}

#main_content thead .th-icon {
    width: 2.8rem;
}

#main_content thead .th-size {
    width: 8.5rem;
}

#main_content thead .th-mtime {
    width: 15rem;
}

#main_content tbody tr {
    background: rgba(16, 20, 40, 0.88);
}

#main_content tbody tr.even {
    background: rgba(18, 23, 46, 0.94);
}

#main_content tbody tr.odd {
    background: rgba(14, 18, 38, 0.92);
}

#main_content tbody tr:hover {
    background: rgba(30, 38, 73, 0.9);
}

#main_content td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

#main_content tbody tr:last-child td {
    border-bottom: none;
}

#main_content td.fico {
    width: 2.8rem;
    text-align: center;
}

#main_content td.fico img {
    display: inline-block;
    opacity: 0.95;
}

#main_content td.fname {
    min-width: 0;
}

#main_content td.fsize,
#main_content td.fmtime {
    color: var(--muted);
    white-space: nowrap;
    text-align: right;
}

a.directory {
    color: var(--gold);
    font-weight: 700;
}

a.file {
    color: var(--text);
}

a.file:hover,
a.directory:hover {
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.35);
    text-underline-offset: 0.14rem;
}

.recent {
    display: inline-flex;
    align-items: center;
    margin-left: 0.45rem;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.empty-state td {
    text-align: center;
    color: var(--muted);
    padding: 1rem;
}

.site-footer {
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.footer-runtime {
    color: var(--muted);
    font-size: 0.82rem;
}

.footer-signature {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #e8eeff;
}

.footer-signature a {
    color: #93c5fd;
    font-weight: 700;
}

.footer-signature a:hover {
    text-decoration: underline;
}

.beat-heart {
    color: var(--danger);
    animation: beatHeart 1s ease-in-out infinite;
    transform-origin: center;
    filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.35));
}

@keyframes beatHeart {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.18); }
    30% { transform: scale(1); }
    45% { transform: scale(1.14); }
    60% { transform: scale(1); }
}

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

@media (max-width: 700px) {
    .page-wrap {
        width: calc(100% - 0.6rem);
        margin: 0.5rem auto;
        gap: 0.6rem;
    }

    .top-panel,
    .table-panel,
    .site-footer {
        border-radius: var(--radius-md);
    }

    .top-panel {
        padding: 0.8rem;
    }

    .table-panel {
        padding: 0.55rem;
    }

    .sort-toolbar {
        gap: 0.4rem;
    }

    .sort-btn {
        min-height: 2rem;
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }

    #main_content {
        min-width: 560px;
    }

    .site-footer {
        padding: 0.75rem 0.85rem;
    }

    .footer-signature {
        font-size: 0.84rem;
    }
}

@media print {
    body {
        background: #ffffff !important;
        color: #000000;
    }

    body::before {
        display: none;
    }

    .top-panel,
    .table-panel,
    .site-footer {
        background: #ffffff;
        border: 1px solid #d9d9d9;
        box-shadow: none;
    }

    .sort-toolbar {
        display: none;
    }

    .table-shell {
        background: #ffffff;
        border-color: #d9d9d9;
    }

    #main_content {
        min-width: 0;
        color: #000000;
    }

    #main_content thead th {
        position: static;
        background: #f3f3f3;
        color: #000000;
        border-bottom-color: #d9d9d9;
    }

    #main_content tbody tr,
    #main_content tbody tr.even,
    #main_content tbody tr.odd,
    #main_content tbody tr:hover {
        background: #ffffff;
    }

    #main_content td {
        border-bottom-color: #e6e6e6;
    }

    .footer-signature a {
        color: #000000;
    }
}
