:root {
    color-scheme: dark;
    --bg: #071018;
    --surface: rgba(15, 28, 40, 0.86);
    --surface-solid: #0f1c28;
    --surface-2: #142536;
    --line: rgba(149, 177, 203, 0.17);
    --line-strong: rgba(149, 177, 203, 0.3);
    --text: #eef6fc;
    --muted: #94a9bb;
    --accent: #3dd9b5;
    --accent-strong: #20b996;
    --blue: #66a9ff;
    --danger: #ff7181;
    --warning: #ffcd70;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
    --radius: 18px;
    font-family: Inter, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 8% 4%, rgba(61, 217, 181, 0.13), transparent 32rem),
        radial-gradient(circle at 94% 15%, rgba(102, 169, 255, 0.12), transparent 30rem),
        linear-gradient(160deg, #071018 0%, #09131e 52%, #071018 100%);
}

button,
input,
select {
    font: inherit;
}

button,
summary,
select {
    cursor: pointer;
}

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

.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;
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 16, 24, 0.78);
    backdrop-filter: blur(18px);
}

.topbar__inner,
.page-shell {
    width: min(1480px, calc(100% - 40px));
    margin: 0 auto;
}

.topbar__inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 15px;
    letter-spacing: 0.01em;
}

.brand small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.brand-mark {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(61, 217, 181, 0.48);
    border-radius: 17px;
    color: #06241d;
    background: linear-gradient(145deg, #7af0d4, #2fc9a6);
    box-shadow: 0 12px 38px rgba(61, 217, 181, 0.2);
    font-size: 19px;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.brand-mark--small {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 14px;
}

.page-shell {
    padding: 36px 0 28px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card,
.panel {
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 142px;
    padding: 23px;
    border-radius: 16px;
}

.stat-card::after {
    content: "";
    position: absolute;
    width: 110px;
    height: 110px;
    right: -45px;
    bottom: -55px;
    border-radius: 50%;
    background: rgba(102, 169, 255, 0.09);
}

.stat-card--accent::after {
    background: rgba(61, 217, 181, 0.15);
}

.stat-card span,
.stat-card small,
.stat-card strong {
    display: block;
}

.stat-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-card strong {
    margin: 11px 0 6px;
    font-size: clamp(25px, 2.3vw, 35px);
    line-height: 1;
    letter-spacing: -0.04em;
}

.stat-card small {
    color: var(--muted);
    font-size: 12px;
}

.panel {
    margin-top: 18px;
    border-radius: var(--radius);
}

.panel__heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    padding: 25px 27px 20px;
    border-bottom: 1px solid var(--line);
}

.panel__heading h2 {
    margin: 4px 0 0;
    font-size: 22px;
    letter-spacing: -0.03em;
}

.panel__heading > p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.upload-form {
    display: grid;
    grid-template-columns: minmax(220px, 0.75fr) minmax(300px, 1.5fr) auto;
    align-items: end;
    gap: 16px;
    padding: 24px 27px 27px;
}

.field label,
.rename-form label span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 43px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: none;
    color: var(--text);
    background: rgba(5, 14, 22, 0.74);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input {
    padding: 0 13px;
}

select {
    padding: 0 36px 0 13px;
}

input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61, 217, 181, 0.13);
}

.file-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.file-picker label {
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 15px;
    border: 1px dashed rgba(61, 217, 181, 0.42);
    border-radius: 12px;
    background: rgba(61, 217, 181, 0.055);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.file-picker label:hover,
.file-picker input:focus + label {
    border-color: var(--accent);
    background: rgba(61, 217, 181, 0.09);
}

.file-picker__icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--accent);
    background: rgba(61, 217, 181, 0.12);
    font-size: 25px;
    font-weight: 300;
}

.file-picker strong,
.file-picker small {
    display: block;
}

.file-picker strong {
    font-size: 13px;
}

.file-picker small {
    max-width: 520px;
    margin-top: 5px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text);
    background: transparent;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:focus-visible {
    outline: 3px solid rgba(61, 217, 181, 0.28);
    outline-offset: 2px;
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
    transform: none;
}

.button--primary {
    color: #05221b;
    border-color: var(--accent);
    background: linear-gradient(140deg, #65e9ca, #30c6a4);
    box-shadow: 0 10px 25px rgba(61, 217, 181, 0.13);
}

.button--secondary {
    border-color: var(--line-strong);
    background: rgba(15, 32, 46, 0.82);
}

.button--secondary:hover,
.button--secondary.is-success {
    color: var(--accent);
    border-color: rgba(61, 217, 181, 0.52);
    background: rgba(61, 217, 181, 0.08);
}

.button--danger {
    color: #ff9eaa;
    border-color: rgba(255, 113, 129, 0.29);
    background: rgba(255, 113, 129, 0.07);
}

.button--danger:hover {
    border-color: rgba(255, 113, 129, 0.65);
    background: rgba(255, 113, 129, 0.13);
}

.button--ghost {
    min-height: 36px;
    border-color: var(--line-strong);
    color: var(--muted);
}

.button--ghost:hover {
    color: var(--text);
    border-color: rgba(149, 177, 203, 0.55);
}

.button--small {
    min-height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 11px;
}

.button--large {
    width: 100%;
    min-height: 48px;
}

.upload-submit {
    min-height: 70px;
    padding: 0 23px;
}

.panel__heading--files {
    align-items: center;
}

.file-tools {
    display: flex;
    gap: 10px;
}

.file-tools input {
    width: min(310px, 40vw);
}

.file-tools select {
    width: 130px;
}

.result-line {
    padding: 13px 27px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.result-line strong {
    color: var(--text);
}

.table-wrap {
    overflow-x: auto;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.file-table th {
    padding: 13px 16px;
    color: var(--muted);
    background: rgba(5, 14, 22, 0.35);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
}

.file-table th:first-child,
.file-table td:first-child {
    padding-left: 27px;
}

.file-table th:last-child,
.file-table td:last-child {
    padding-right: 27px;
}

.file-table td {
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}

.file-table tbody tr:first-child td {
    border-top: 0;
}

.file-table tbody tr:not(.empty-row):hover {
    background: rgba(102, 169, 255, 0.035);
}

.file-cell {
    min-width: 300px;
}

.file-cell__inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.type-badge {
    flex: 0 0 auto;
    min-width: 45px;
    padding: 7px 6px;
    border: 1px solid rgba(102, 169, 255, 0.23);
    border-radius: 8px;
    color: #a8cdff;
    background: rgba(102, 169, 255, 0.08);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-align: center;
}

.type-badge--iso {
    color: #c8a8ff;
    border-color: rgba(178, 132, 255, 0.25);
    background: rgba(178, 132, 255, 0.08);
}

.type-badge--img {
    color: #ffb4d8;
    border-color: rgba(255, 105, 180, 0.25);
    background: rgba(255, 105, 180, 0.08);
}

.type-badge--exe {
    color: #ffd48c;
    border-color: rgba(255, 194, 93, 0.25);
    background: rgba(255, 194, 93, 0.08);
}

.type-badge--rar {
    color: #9ae8d5;
    border-color: rgba(61, 217, 181, 0.25);
    background: rgba(61, 217, 181, 0.08);
}

.file-path {
    min-width: 0;
}

.file-path small,
.file-path strong {
    display: block;
    overflow-wrap: anywhere;
}

.file-path small {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 10px;
}

.file-path strong {
    font-size: 13px;
    font-weight: 650;
}

.size-cell,
.date-cell {
    color: var(--muted);
    white-space: nowrap;
}

.count-heading,
.count-cell {
    text-align: center;
    white-space: nowrap;
}

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

.count-cell strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.actions-heading {
    min-width: 305px;
}

.actions-cell {
    position: relative;
}

.action-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.delete-form {
    display: inline-flex;
}

.rename-details {
    position: relative;
}

.rename-details summary {
    list-style: none;
}

.rename-details summary::-webkit-details-marker {
    display: none;
}

.rename-form {
    position: absolute;
    z-index: 10;
    width: min(330px, calc(100vw - 48px));
    right: 0;
    top: calc(100% + 9px);
    padding: 14px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #101f2d;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.rename-form input {
    min-height: 39px;
    margin-bottom: 10px;
    font-size: 12px;
}

.flash-stack {
    display: grid;
    gap: 9px;
    margin-bottom: 16px;
}

.flash {
    padding: 13px 15px;
    border: 1px solid rgba(102, 169, 255, 0.3);
    border-radius: 11px;
    color: #cfe3ff;
    background: rgba(102, 169, 255, 0.08);
    font-size: 13px;
    line-height: 1.5;
}

.flash--success {
    color: #aaf1df;
    border-color: rgba(61, 217, 181, 0.33);
    background: rgba(61, 217, 181, 0.08);
}

.flash--error {
    color: #ffb1ba;
    border-color: rgba(255, 113, 129, 0.33);
    background: rgba(255, 113, 129, 0.08);
}

.flash--warning {
    margin-bottom: 16px;
    color: #ffe1a8;
    border-color: rgba(255, 205, 112, 0.33);
    background: rgba(255, 205, 112, 0.08);
}

.empty-state {
    min-height: 190px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: var(--text);
    font-size: 16px;
}

.empty-state span {
    font-size: 12px;
}

.page-footer {
    padding: 25px 4px 0;
    color: #698093;
    font-size: 11px;
    text-align: center;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-shell {
    width: min(440px, 100%);
}

.login-card {
    padding: 38px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(13, 26, 38, 0.9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-card > .brand-mark {
    margin-bottom: 25px;
}

.login-card h1 {
    margin: 7px 0 10px;
    font-size: 28px;
    letter-spacing: -0.04em;
}

.login-intro,
.login-footnote {
    color: var(--muted);
    line-height: 1.7;
}

.login-intro {
    margin: 0 0 24px;
    font-size: 13px;
}

.login-form {
    display: grid;
    gap: 13px;
    margin-top: 18px;
}

.login-form label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.login-form input {
    min-height: 48px;
}

.login-footnote {
    margin: 20px 0 0;
    font-size: 10px;
    text-align: center;
}

@media (max-width: 1050px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .upload-form {
        grid-template-columns: 1fr 1.5fr;
    }

    .upload-submit {
        grid-column: 1 / -1;
        min-height: 48px;
    }
}

@media (max-width: 720px) {
    .topbar__inner,
    .page-shell {
        width: min(100% - 24px, 1480px);
    }

    .topbar__inner {
        min-height: 68px;
    }

    .brand small {
        display: none;
    }

    .page-shell {
        padding-top: 22px;
    }

    .stats-grid {
        gap: 10px;
    }

    .stat-card {
        min-height: 125px;
        padding: 18px;
    }

    .panel__heading,
    .panel__heading--files {
        align-items: stretch;
        flex-direction: column;
        gap: 15px;
        padding: 21px 18px 17px;
    }

    .upload-form {
        grid-template-columns: 1fr;
        padding: 20px 18px 22px;
    }

    .upload-submit {
        grid-column: auto;
    }

    .file-tools {
        width: 100%;
    }

    .file-tools label:first-child {
        flex: 1;
    }

    .file-tools input {
        width: 100%;
    }

    .result-line {
        padding-inline: 18px;
    }

    .file-table th:first-child,
    .file-table td:first-child {
        padding-left: 18px;
    }

    .file-table th:last-child,
    .file-table td:last-child {
        padding-right: 18px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: 112px;
    }

    .file-tools {
        flex-direction: column;
    }

    .file-tools select {
        width: 100%;
    }

    .login-page {
        padding: 14px;
    }

    .login-card {
        padding: 28px 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

.download-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.download-shell {
    width: min(520px, 100%);
}

.download-card {
    padding: 36px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(13, 26, 38, 0.92);
    box-shadow: var(--shadow);
}

.download-card h1 {
    margin: 8px 0 10px;
    font-size: 29px;
}

.download-intro,
.download-note {
    color: var(--muted);
    line-height: 1.6;
}

.download-meta {
    display: grid;
    gap: 10px;
    margin: 24px 0;
}

.download-meta div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--line);
}

.download-meta dt { color: var(--muted); }
.download-meta dd { margin: 0; overflow-wrap: anywhere; text-align: right; }
.download-form { display: grid; gap: 12px; }
.download-form label { color: var(--muted); font-size: 13px; font-weight: 700; }
.download-note { margin: 18px 0 0; font-size: 11px; text-align: center; }
.download-honeypot { position: absolute !important; left: -10000px !important; }
