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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #fafafa;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.6rem 1rem;
    background: rgba(250, 250, 250, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111;
}

.header-share {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
}

.header-share:hover {
    color: #333;
}

.gallery-meta-info {
    text-align: center;
    padding: 0.75rem 1rem 0.5rem;
    font-size: 0.8rem;
    color: #888;
}

.share-toast {
    position: fixed;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 200;
}

.share-toast.show {
    opacity: 1;
}

main {
    flex: 1;
    max-width: 2200px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    width: 100%;
}

/* Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 180px));
    gap: 6px;
    justify-content: center;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 3px;
    cursor: pointer;
    background: #eee;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.gallery-item.visible {
    opacity: 1;
}

.gallery-item.highlight {
    outline: 3px solid #2563eb;
    outline-offset: -3px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #999;
    background: #e0e0e0;
}

.item-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-item:hover .item-bar {
    opacity: 1;
}

.item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-download {
    color: #fff;
    text-decoration: none;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    opacity: 0.85;
}

.item-download:hover {
    opacity: 1;
}

/* Files section */
.files-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #ddd;
}

.files-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.files-list {
    list-style: none;
}

.files-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.files-list a {
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.files-list a:hover {
    color: #0066cc;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox[hidden] {
    display: none;
}

.lb-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 3rem 1rem;
    overflow: hidden;
    position: relative;
}

.lb-content img,
.lb-content video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Lightbox spinner */
.lb-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1;
    pointer-events: none;
}

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

.lb-close,
.lb-prev,
.lb-next {
    position: absolute;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 2rem;
    padding: 1rem;
    z-index: 10;
}

.lb-close {
    top: 0;
    right: 0;
}

.lb-prev {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.lb-next {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.lb-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

.lb-counter {
    opacity: 0.6;
    font-size: 0.75rem;
    margin-right: 1rem;
}

.lb-download {
    color: #fff;
    text-decoration: none;
}

.lb-download:hover {
    text-decoration: underline;
}

@media (max-width: 768px) and (orientation: landscape) {
    .lb-bar {
        padding: 0.3rem 0.75rem;
        font-size: 0.7rem;
    }

    .lb-counter {
        font-size: 0.65rem;
        margin-right: 0.5rem;
    }

    .lb-content {
        padding: 1.5rem 0.5rem;
    }

    .lb-close,
    .lb-prev,
    .lb-next {
        font-size: 1.5rem;
        padding: 0.5rem;
    }
}

/* Footer */
footer {
    position: sticky;
    bottom: 0;
    z-index: 100;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.65rem;
    color: #999;
    background: rgba(250, 250, 250, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

footer a {
    color: #888;
    text-decoration: none;
}

footer a:hover {
    color: #555;
}

/* Responsive – mobil na výšku: 3 sloupce */
@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
    }

    .item-bar {
        opacity: 1;
        padding: 2px 5px;
        font-size: 0.6rem;
    }

    .lb-prev,
    .lb-next {
        font-size: 1.5rem;
        padding: 0.5rem;
    }
}

/* Mobil na šířku / malý tablet: 5 sloupců */
@media (min-width: 481px) and (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
    }

    .item-bar {
        opacity: 1;
    }
}

/* Tablet + Desktop */
@media (min-width: 769px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 180px));
        gap: 6px;
    }
}

/* Password form */
.password-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.password-form {
    text-align: center;
}

.password-form input[type="password"] {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    margin-right: 0.5rem;
}

.password-form button {
    padding: 0.5rem 1.5rem;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

.password-form .error {
    color: #c00;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}
