* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body.gallery-page {
    margin: 0;
    min-height: 100svh;
    overflow-x: hidden;
    background: #E9E9E9;
    color: #173057;
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

body.gallery-page.entered {
    background: #E9E9E9;
}

.fullscreen-container {
    position: relative;
    min-height: 100svh;
    overflow: visible;
}

.fullscreen-container::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(5, 12, 25, 0.62) 0%, rgba(5, 12, 25, 0.18) 34%, rgba(245, 248, 252, 0) 56%),
        linear-gradient(180deg, rgba(245, 248, 252, 0) 62%, rgba(245, 248, 252, 0.9) 100%);
    z-index: 1;
    pointer-events: none;
}

.fullscreen-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100svh;
    object-fit: cover;
    object-position: center center;
    transform: translate3d(0, 0, 0);
    transition: none;
    z-index: 0;
}

.gallery-title-container {
    position: relative;
    z-index: 2;
    width: min(1320px, calc(100% - 28px));
    max-width: 980px;
    margin: 0 auto;
    padding: 116px 22px 116px;
    text-align: center;
    animation: galleryHeroRise 0.9s ease both;
}

.gallery-title {
    font-size: clamp(2.8rem, 7vw, 5rem);
    line-height: 0.96;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: #ffffff;
    text-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.gallery-subtitle {
    max-width: 720px;
    margin: 18px auto 0;
    color: rgba(245, 248, 252, 0.88);
    font-size: clamp(1rem, 1.8vw, 1.28rem);
    line-height: 1.7;
    text-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

@keyframes galleryHeroRise {
    from {
        opacity: 0;
        transform: translateY(22px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    position: relative;
    z-index: 2;
    padding: 45px 55px 190px;
}

.floating-controls {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 24px;
    top: auto;
    --floating-offset-y: 18px;
    transform: translate(-50%, var(--floating-offset-y));
    display: grid;
    grid-template-columns: minmax(0, 440px) 340px;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: min(820px, calc(100% - 28px));
    margin: 0;
    padding: 14px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(15, 38, 95, 0.08);
    box-shadow: 0 22px 50px rgba(24, 43, 88, 0.1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 30;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.25s ease;
}

.floating-controls.ready {
    opacity: 1;
    --floating-offset-y: 0px;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: none;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #7a8aa6;
}

.search-box input {
    width: 100%;
    min-height: 48px;
    padding: 0 16px 0 44px;
    border-radius: 16px;
    border: 1px solid rgba(23, 48, 87, 0.1);
    background: rgba(255, 255, 255, 0.9);
    outline: none;
    color: #173057;
    font-size: 0.94rem;
}

.toggle-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 340px;
    min-height: 50px;
    padding: 4px;
    border-radius: 18px;
    background: rgba(11, 81, 255, 0.06);
}

#activity-toggle {
    display: none;
}

.toggle-label {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 14px;
    color: #586a86;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: color 0.25s ease;
}

.toggle-label.active {
    color: #173057;
}

.toggle-slider {
    position: absolute;
    inset: 4px auto 4px 4px;
    width: calc(33.333% - 3px);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(11, 81, 255, 0.94), rgba(88, 174, 255, 0.84));
    box-shadow: 0 10px 22px rgba(11, 81, 255, 0.22);
    transition: transform 0.28s ease;
}

.image-grid {
    columns: 4 260px;
    column-gap: 22px;
    position: relative;
    width: 100%;
    min-height: 100svh;
    transition: opacity 0.8s ease;
    will-change: transform;
    opacity: 0;
}

.image-grid.entered {
    opacity: 1;
}

.image-card {
    break-inside: avoid;
    overflow: hidden;
    margin-bottom: 22px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(15, 38, 95, 0.08);
    box-shadow: none;
    cursor: pointer;
    transition: transform 0.3s ease;
    opacity: 0;
    transform: translateY(26px) scale(0.985);
}

.image-card.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.3s ease,
        border-color 0.3s ease;
}

.image-card:hover {
    transform: translateY(-8px);
    border-color: rgba(11, 81, 255, 0.16);
    box-shadow: 0 26px 56px rgba(24, 43, 88, 0.15);
}

.image-container {
    overflow: hidden;
}

.image-container img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.4s ease;
}

.image-card:hover .image-container img {
    transform: scale(1.04);
}

.image-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
}

.character-name {
    font-size: 1rem;
    font-weight: 800;
    color: #0B51FF;
}

.social-icons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.social-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0B51FF;
    text-decoration: none;
    transition: transform 0.24s ease, background-color 0.24s ease, color 0.24s ease;
}

.social-icon:hover {
    transform: translateY(-2px);
    background: rgba(11, 81, 255, 0.14);
    color: #173057;
}

.no-results {
    column-span: all;
    padding: 60px 24px;
    text-align: center;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(15, 38, 95, 0.08);
    color: #667790;
    font-size: 1rem;
    font-weight: 600;
}

@media (max-width: 980px) {
    .image-grid {
        columns: 3 220px;
    }

    .floating-controls {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: min(560px, calc(100% - 20px));
    }

    .toggle-container {
        width: 100%;
    }

    .search-box {
        width: 100%;
        max-width: none;
        flex: 1 1 auto;
    }
}

@media (max-width: 768px) {
    .gallery-title-container {
        width: calc(100% - 16px);
        padding: 96px 16px 96px;
    }

    .container {
        width: calc(100% - 16px);
        padding-bottom: 150px;
    }

    .floating-controls {
        bottom: 14px;
        padding: 12px;
        border-radius: 22px;
        width: calc(100% - 16px);
    }

    .image-grid {
        columns: 2 170px;
        column-gap: 14px;
    }

    .image-card {
        margin-bottom: 14px;
        border-radius: 18px;
    }

    .image-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .social-icons {
        width: 100%;
    }
}
