*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a0a;
    color: #f0f0f0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 24px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Screens ---- */
.screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* ---- Loading ---- */
.loader {
    text-align: center;
}

.spinner {
    width: 64px;
    height: 64px;
    border: 5px solid rgba(255, 255, 255, 0.08);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader p {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.6);
}

/* ---- Message Box (error / empty) ---- */
.message-box {
    text-align: center;
    padding: 40px;
}

.message-text {
    font-size: 32px;
    margin-bottom: 32px;
    color: rgba(255, 255, 255, 0.8);
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 18px 56px;
    font-size: 26px;
    font-family: inherit;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    min-width: 200px;
    text-align: center;
}

.btn:hover,
.btn:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    border-color: #fff;
    outline: none;
}

.btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
    transform: scale(1.02);
}

.btn:active {
    transform: scale(0.97);
}

/* ---- Header ---- */
.header {
    padding: 36px 40px 12px;
    width: 100%;
    text-align: center;
    flex-shrink: 0;
}

.header h1 {
    font-size: 44px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

/* ---- Folder Grid ---- */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    padding: 28px 40px 40px;
    max-width: 1440px;
    width: 100%;
    flex: 1;
    align-content: start;
    overflow-y: auto;
}

.folder-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    padding: 32px 28px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    font-size: 30px;
    font-weight: 500;
    font-family: inherit;
    color: #f0f0f0;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    word-break: break-word;
    line-height: 1.3;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.folder-card:hover,
.folder-card:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
    outline: none;
}

.folder-card:focus-visible {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
    transform: scale(1.03);
}

.folder-card:active {
    transform: scale(0.97);
}

/* ---- Presentation ---- */
.presentation {
    background: #000;
    z-index: 2;
}

.media-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

.media-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity var(--transition-duration, 0.5s) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    pointer-events: none;
}

.media-layer.active {
    opacity: 1;
}

.media-layer img,
.media-layer video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ---- Back Button ---- */
.btn-back {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 10;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 34px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, border-color 0.2s, background 0.2s;
    opacity: 0.5;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.btn-back:hover,
.btn-back:focus-visible {
    opacity: 1;
    border-color: #fff;
    background: rgba(0, 0, 0, 0.75);
    outline: none;
}

.btn-back:focus-visible {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
}

/* ---- Fullscreen Button ---- */
.btn-fullscreen {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 30px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, border-color 0.2s, background 0.2s;
    opacity: 0.5;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.btn-fullscreen:hover,
.btn-fullscreen:focus-visible {
    opacity: 1;
    border-color: #fff;
    background: rgba(0, 0, 0, 0.75);
    outline: none;
}

.btn-fullscreen:focus-visible {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
}

.btn-fullscreen.active {
    opacity: 0.8;
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.25);
}

/* ---- Toast ---- */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    padding: 14px 28px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    font-size: 22px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
}

/* ---- Scrollbar ---- */
.folder-grid::-webkit-scrollbar {
    width: 10px;
}

.folder-grid::-webkit-scrollbar-track {
    background: transparent;
}

.folder-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 5px;
}

.folder-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .folder-grid {
        grid-template-columns: 1fr;
        padding: 16px 20px 24px;
        gap: 16px;
    }

    .folder-card {
        min-height: 100px;
        font-size: 24px;
        padding: 24px 20px;
    }

    .header h1 {
        font-size: 32px;
    }

    .header {
        padding: 24px 20px 8px;
    }

    .btn-back {
        width: 52px;
        height: 52px;
        font-size: 28px;
        top: 16px;
        left: 16px;
    }

    .btn-fullscreen {
        width: 52px;
        height: 52px;
        font-size: 26px;
        top: 16px;
        right: 16px;
    }

    .toast {
        font-size: 18px;
        padding: 12px 20px;
        bottom: 70px;
    }

    .message-text {
        font-size: 26px;
    }

    .btn {
        padding: 14px 40px;
        font-size: 22px;
        min-width: 160px;
    }
}

@media (max-width: 480px) {
    .folder-card {
        font-size: 20px;
        min-height: 80px;
        padding: 18px 16px;
    }

    .header h1 {
        font-size: 26px;
    }

    .folder-grid {
        gap: 12px;
        padding: 12px 16px 20px;
    }
}
