:root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f2430;
    --text: #e7eaf0;
    --muted: #8a93a6;
    --accent: #6ea8fe;
    --radius: 12px;
    --gap: 10px;
    --header-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.fg-body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.fg-header {
    position: sticky; top: 0; z-index: 30;
    height: var(--header-h);
    display: flex; align-items: center; gap: 12px;
    padding: 0 14px;
    background: rgba(15, 17, 21, .85);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.fg-logo {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: .3px;
    white-space: nowrap;
}
.fg-crumbs {
    display: flex; align-items: center; gap: 6px;
    overflow: hidden; white-space: nowrap;
    color: var(--muted);
    font-size: 14px;
}
.fg-crumbs a { color: var(--muted); text-decoration: none; }
.fg-crumbs a:hover { color: var(--text); }
.fg-crumbs [aria-current] { color: var(--text); }
.fg-sep { opacity: .5; }

.fg-burger {
    display: none;
    background: none; border: 0; padding: 8px; cursor: pointer;
    width: 40px; height: 40px;
}
.fg-burger span {
    display: block; height: 2px; background: var(--text);
    margin: 5px 0; border-radius: 2px;
    transition: transform .2s;
}

/* Drawer */
.fg-drawer {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; max-width: 85vw;
    background: var(--surface);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 40;
    overflow-y: auto;
    display: flex; flex-direction: column;
}
.fg-drawer.is-open { transform: translateX(0); }
.fg-drawer-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
    font-weight: 600;
}
.fg-drawer-head button {
    background: none; border: 0; color: var(--text);
    font-size: 24px; cursor: pointer; line-height: 1;
}
.fg-menu { list-style: none; margin: 0; padding: 8px 0; }
.fg-menu li a {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    margin: 2px 8px;
}
.fg-menu li a:hover { background: var(--surface-2); }
.fg-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
    z-index: 35;
}
.fg-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* Main */
.fg-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 14px 48px;
}

/* Folders */
.fg-dirs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--gap);
    margin-bottom: 18px;
}
.fg-dir {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.05);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: transform .15s, background .15s;
}
.fg-dir:hover { background: var(--surface-2); transform: translateY(-1px); }
.fg-dir-icon { font-size: 18px; opacity: .9; }
.fg-dir-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Toolbar */
.fg-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin: 8px 0 12px;
    color: var(--muted); font-size: 14px;
    gap: 12px; flex-wrap: wrap;
}
.fg-sort { display: flex; gap: 6px; align-items: center; }
.fg-sort a { color: var(--muted); text-decoration: none; }
.fg-sort a:hover { color: var(--text); }
.fg-sort strong { color: var(--text); font-weight: 600; }

/* Grid */
.fg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--gap);
}
.fg-item {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.05);
}
.fg-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease, opacity .3s;
    opacity: 0;
}
.fg-item img.is-loaded { opacity: 1; }
.fg-item:hover img { transform: scale(1.04); }

/* Pager */
.fg-pager {
    display: flex; flex-wrap: wrap; gap: 6px;
    justify-content: center;
    margin-top: 24px;
}
.fg-page {
    min-width: 36px; padding: 6px 10px;
    text-align: center;
    border-radius: 8px;
    color: var(--muted);
    background: var(--surface);
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.05);
}
.fg-page:hover { color: var(--text); }
.fg-page.is-active {
    background: var(--accent); color: #0b0d12; border-color: transparent; font-weight: 600;
}

.fg-empty {
    text-align: center; color: var(--muted); padding: 48px 0;
}

/* Mobile */
@media (max-width: 768px) {
    .fg-burger { display: block; }
    .fg-crumbs { font-size: 13px; }
    .fg-logo { font-size: 15px; }
    .fg-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 6px;
    }
    .fg-dirs {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 6px;
    }
    .fg-main { padding: 10px 8px 32px; }
}
