:root {
        --bg: #111;
        --panel: #1f1f1f;
        --panel-soft: #222;
        --border: #444;
        --accent: #7abaff;
        --text: #eee;
        --text-soft: #aaa;
        --danger: #ff5c5c;
    }

    * {
		 box-sizing: border-box;
    }

    body.videopage {
        font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        padding: 20px;
        background: var(--bg);
        color: var(--text);
        margin: 0;
    }

    h1 {
        margin-bottom: 10px;
        font-size: 26px;
    }

    h2 {
        margin-top: 30px;
        border-bottom: 1px solid var(--border);
        padding-bottom: 5px;
        font-size: 18px;
    }

    .top-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
        margin-bottom: 12px;
	margin-top: 1.5em;
    }

    .controls {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .controls button {
        background: var(--panel);
        color: var(--text);
        border: 1px solid var(--border);
        padding: 6px 10px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 13px;
    }

    .controls button.active {
        background: var(--accent);
        color: #111;
        border-color: var(--accent);
    }

    .search-box {
        margin-left: auto;
        min-width: 220px;
    }

    .search-box input {
        width: 100%;
        padding: 6px 8px;
        border-radius: 4px;
        border: 1px solid var(--border);
        background: var(--panel);
        color: var(--text);
        font-size: 13px;
    }

    #content {
        margin-top: 10px;
    }

    /* GRID: desktop/tablet default */
    .grid {
        display: grid;
        gap: 18px;
        margin-top: 15px;
        grid-template-columns: repeat(
            auto-fill,
            minmax(clamp(200px, 45vw, 260px), 1fr)
        );
    }

    /* Phones: allow 1-per-row when tight */
    @media (max-width: 600px) {
        .grid {
            grid-template-columns: repeat(
                auto-fill,
                minmax(220px, 1fr)
            );
            gap: 14px;
        }
    }

    /* Ultra-small phones: force single column */
    @media (max-width: 420px) {
        .grid {
            grid-template-columns: 1fr;
        }
    }

    body.compact .grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .item {
        position: relative;
        background: var(--panel-soft);
        padding: 10px;
        border-radius: 8px;
        text-align: center;
        overflow: hidden;
        border: 1px solid transparent;
        transition: border-color 0.15s ease-out, transform 0.15s ease-out, box-shadow 0.15s ease-out;
        opacity: 0;
        animation: fadeIn 0.25s ease-out forwards;
    }

    .item:hover {
        border-color: var(--accent);
        box-shadow: 0 0 0 1px rgba(122, 186, 255, 0.3);
    }

    .thumb-link {
        display: block;
        border-radius: 6px;
        overflow: hidden;
    }

    .thumb-img,
.thumb-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border-radius: 6px;
    object-fit: cover;
    background: #444;
    transition: transform 0.15s ease-out;
}


    @media (max-width: 600px) {
        .thumb-img,
        .thumb-placeholder {
            height: 160px;
        }
    }

    .item:hover .thumb-img {
        transform: scale(1.05);
    }

    .filename {
        margin-top: 8px;
        color: var(--accent);
        text-decoration: none;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 14px;
    }

    .meta {
        margin-top: 2px;
        font-size: 11px;
        color: var(--text-soft);
    }

    .info-btn {
        position: absolute;
        top: 6px;
        right: 6px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        border: 1px solid var(--border);
        background: rgba(0, 0, 0, 0.6);
        color: var(--text-soft);
        font-size: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        backdrop-filter: blur(2px);
    }

    .info-btn:hover {
        background: var(--accent);
        color: #111;
        border-color: var(--accent);
    }

    body.freeze-gifs .thumb-img {
        filter: grayscale(0.15) contrast(0.95);
    }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(4px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .modal-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 1000;
    }

    .modal-backdrop.visible {
        display: flex;
    }

    .modal {
        background: var(--panel);
        border-radius: 8px;
        border: 1px solid var(--border);
        max-width: 480px;
        width: 90%;
        padding: 16px 18px 14px;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
    }

    #loadingOverlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.85);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        z-index: 2000;
        transition: opacity 0.25s ease-out;
    }

    #loadingOverlay.hidden {
        opacity: 0;
        pointer-events: none;
    }

    .loader {
        width: 48px;
        height: 48px;
        border: 4px solid #333;
        border-top-color: var(--accent);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
        margin-bottom: 14px;
    }

    .loading-text {
        font-size: 13px;
        color: var(--text-soft);
        margin-bottom: 8px;
    }

    .loading-bar-container {
        width: 260px;
        height: 6px;
        border-radius: 999px;
        background: #222;
        overflow: hidden;
        border: 1px solid #333;
    }

    .loading-bar-fill {
        height: 100%;
        width: 0%;
        background: var(--accent);
        transition: width 0.15s ease-out;
    }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }

    .tags {
       padding-left: 0;
       margin-left: 0;
       list-style-type: none;
    }
    
    .tags li {
       display: inline-block;
       margin-right: 1em;
       padding: 4px;
       background-color: #333333;
       border: 1px solid silver;
       border-radius: 3px;
       color: white;
    }

    .camlogo img {
	display: inline-block;
	max-height: 60px;
    }
    .camlogo h1 {
	display: inline-block;
	margin-left: 0.4em;
    	position: relative;
    	top: 8px;
    }