* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background:
        linear-gradient(rgba(20, 20, 20, 0.94), rgba(20, 20, 20, 0.94)),
        repeating-linear-gradient(
            0deg,
            #151515 0px,
            #151515 2px,
            #111 2px,
            #111 4px
        );
    color: #f5f5f5;
    font-family: "Courier New", monospace;
}

header {
    height: 90px;
    background: #0d0d0d;
    border-bottom: 3px solid #ffcc00;
    display: flex;
    align-items: center;
    gap: 35px;
    padding: 0 30px;
    box-shadow: 0 5px 0 #000;
}

.header-title {
    color: #ffcc00;
    font-size: 30px;
    font-weight: bold;
    white-space: nowrap;
    letter-spacing: 2px;
}

#search {
    flex: 1;
    max-width: 700px;
    height: 44px;
    background: #181818;
    border: 2px solid #555;
    color: #fff;
    padding: 0 15px;
    font-family: inherit;
    font-size: 16px;
    outline: none;
}

#search:focus {
    border-color: #ffcc00;
}

.archive-container {
    display: flex;
    min-height: calc(100vh - 90px);
    width: 100%;
    overflow: hidden;
}

.tree-sidebar {
    width: 290px;
    min-width: 290px;
    background: #101010;
    border-right: 2px solid #333;
    padding: 22px 15px;
    overflow-x: hidden;
    overflow-y: auto;
}

.tree-title {
    color: #ffcc00;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.tree-branch {
    position: relative;
    max-width: 100%;
    overflow: hidden;
}

.tree-children {
    margin-left: 15px;
    padding-left: 14px;
    border-left: 1px dotted #ffcc00;
    max-width: calc(100% - 15px);
    overflow: hidden;
}

.tree-folder-title {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 7px 6px;
    color: #ddd;
    cursor: pointer;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.tree-folder-title:hover {
    background: #222;
    color: #ffcc00;
}

.tree-folder-title.selected {
    background: #ffcc00;
    color: #111;
    font-weight: bold;
}

.content {
    flex: 1;
    min-width: 0;
    padding: 25px;
    overflow-x: hidden;
}

.content-header {
    margin-bottom: 25px;
}

#currentFolder {
    color: #ffcc00;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 15px;
    overflow-wrap: anywhere;
}

.filter-area {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: #111;
    border: 1px solid #333;
}

.filter-label {
    color: #ffcc00;
    font-weight: bold;
    margin-right: 5px;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-tag,
.clear-filters,
.card-tag {
    font-family: inherit;
    cursor: pointer;
}

.filter-tag {
    background: #222;
    color: #aaa;
    border: 1px solid #555;
    padding: 5px 9px;
}

.filter-tag:hover {
    color: #ffcc00;
    border-color: #ffcc00;
}

.filter-tag.selected {
    background: #ffcc00;
    color: #111;
    border-color: #ffcc00;
    font-weight: bold;
}

.clear-filters {
    display: none;
    margin-left: auto;
    background: #111;
    color: #ffcc00;
    border: 1px solid #ffcc00;
    padding: 5px 10px;
}

.clear-filters:hover {
    background: #ffcc00;
    color: #111;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
}

.file-card {
    background: #171717;
    border: 2px solid #444;
    min-width: 0;
    overflow: hidden;
    transition: transform 0.15s, border-color 0.15s;
}

.file-card:hover {
    transform: translateY(-3px);
    border-color: #ffcc00;
}

.file-preview {
    height: 190px;
    background: #0c0c0c;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-image,
.card-video,
.card-audio {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.file-video {
    border-color: #d22;
}

.file-video:hover {
    border-color: #ffcc00;
}

.file-audio {
    border-color: #7ed6ff;
}

.file-roblox {
    border-color: #fff;
    color: #fff;
}

.file-text {
    border-color: #ffcc00;
}

.file-unknown {
    border-color: #777;
    color: #aaa;
}

.roblox-card-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.roblox-card-content button {
    background: #fff;
    color: #111;
    border: 2px solid #fff;
    padding: 12px 20px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
}

.roblox-card-content button:hover {
    background: #111;
    color: #fff;
}

.text-card-preview,
.unknown-card-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
}

.text-card-preview {
    color: #ffcc00;
    background: #191500;
}

.unknown-card-preview {
    color: #888;
    background: #191919;
}

.file-name {
    padding: 10px;
    color: #eee;
    font-weight: bold;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-height: 48px;
}

.file-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 10px 10px;
}

.card-tag {
    background: #222;
    border: 1px solid #444;
    color: #999;
    padding: 3px 6px;
    font-size: 11px;
}

.card-tag:hover,
.card-tag.active {
    background: #ffcc00;
    color: #111;
    border-color: #ffcc00;
}

.empty-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: #777;
    border: 2px dashed #333;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.lightbox.open {
    display: flex;
}

.lightbox-content {
    position: relative;
    width: min(1200px, 95vw);
    height: min(850px, 90vh);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 15px;
}

.lightbox-toolbar {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.lightbox-toolbar button,
.download-button {
    background: #ffcc00;
    color: #111;
    border: 2px solid #ffcc00;
    padding: 8px 14px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
}

.lightbox-toolbar button:hover,
.download-button:hover {
    background: #111;
    color: #ffcc00;
}

#lightboxImg,
#lightboxVideo {
    max-width: 90%;
    max-height: 78%;
    object-fit: contain;
    transform-origin: center;
}

#lightboxVideo {
    border: 3px solid #ffcc00;
    box-shadow:
        0 0 0 3px #111,
        0 0 25px rgba(255, 204, 0, 0.5);
}

.audio-viewer {
    width: min(700px, 90%);
    min-height: 300px;
    background: #151515;
    border: 3px solid #ffcc00;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    padding: 30px;
}

.audio-image {
    width: 220px;
    height: 220px;
    object-fit: contain;
}

#lightboxAudio {
    width: 100%;
    accent-color: #ffcc00;
}

.text-viewer {
    width: 90%;
    height: 75%;
    display: none;
    background: #111;
    border: 3px solid #ffcc00;
    padding: 20px;
    overflow: auto;
}

#lightboxText {
    margin: 0;
    color: #eee;
    font-family: "Courier New", monospace;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.roblox-viewer {
    width: min(600px, 90%);
    min-height: 250px;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    background: #151515;
    border: 3px solid #fff;
    padding: 30px;
}

.roblox-file-title {
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    overflow-wrap: anywhere;
}

.roblox-download {
    background: #fff;
    color: #111;
    border: 2px solid #fff;
    padding: 14px 24px;
    font-family: inherit;
    font-weight: bold;
    text-decoration: none;
}

.roblox-download:hover {
    background: #111;
    color: #fff;
}

@media (max-width: 750px) {
    header {
        height: auto;
        min-height: 90px;
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        padding: 15px;
        gap: 12px;
    }

    .header-title {
        font-size: 24px;
    }

    .archive-container {
        flex-direction: column;
    }

    .tree-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 280px;
        border-right: 0;
        border-bottom: 2px solid #333;
    }

    .content {
        padding: 15px;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
}