.fan-container {
    position: relative;
    bottom: -50px;
    width: 100%;
    height: 60vh;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    pointer-events: auto;
    z-index: 2000;
}

#gallery-section {
    --session-bg-white: radial-gradient(
        circle at 50% 82%,
        rgba(255, 255, 255, 0.34) 0%,
        rgba(255, 255, 255, 0.16) 28%,
        rgba(255, 255, 255, 0) 64%
    );
    --session-bg-tint: radial-gradient(
        circle at 50% 82%,
        rgba(181, 0, 154, 0.32) 0%,
        rgba(106, 25, 153, 0.24) 32%,
        rgba(0, 0, 0, 0) 70%
    );
}

#gallery-section::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: none;
    transition: background 0.45s ease;
}

#gallery-section[data-session-theme="red"] {
    --session-bg-white: none;
    --session-bg-tint: none;
}

#gallery-section[data-session-theme="green"] {
    --session-bg-tint: none;
}

#gallery-section[data-session-theme="yellow"] {
    --session-bg-tint: none;
}

#gallery-section[data-session-theme="blue"] {
    --session-bg-tint: none;
}

#gallery-section[data-session-theme="black"] {
    --session-bg-tint: none;
}

#gallery-section.is-window-active .fan-container {
    pointer-events: none;
}

.fan-card {
    --ira-fan-corner-xl: clamp(22px, 2.8vw, 34px);
    --ira-fan-corner-lg: calc(var(--ira-fan-corner-xl) - 5px);
    --ira-fan-corner-md: calc(var(--ira-fan-corner-xl) - 12px);
    position: absolute;
    width: 20vw;
    height: 30vw;
    max-width: 300px;
    max-height: 450px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: var(--ira-fan-corner-xl);
    clip-path: inset(0 round var(--ira-fan-corner-xl));
    transform-origin: bottom center;
    box-shadow: 0 16px 40px rgba(0,0,0,0.35), inset 0 1px 8px rgba(255,255,255,0.18);
    --fan-card-gradient: linear-gradient(145deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05));
    --fan-overlay-gradient: linear-gradient(155deg, rgba(59,130,246,0.30), rgba(16,185,129,0.20));
    background: var(--fan-card-gradient);
    backdrop-filter: blur(10px) saturate(130%);
    transition: transform 1.2s ease-in-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0;
    color: white;
    cursor: pointer;
    pointer-events: auto;
}

.fan-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.34);
    z-index: 2;
}

.fan-card h3 { margin: 0; font-size: 1.2rem; font-weight: 400; color: #fff; }
.fan-card p { margin: 5px 0 0; font-size: 0.7rem; color: #888; text-transform: uppercase; letter-spacing: 1px;}

.card-visual {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    opacity: 1;
    transition: opacity 0.3s;
    z-index: 0;
    pointer-events: none;
    border-radius: calc(var(--ira-fan-corner-xl) - 1px);
}

.card-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--fan-overlay-gradient);
    opacity: 0.55;
    pointer-events: none;
}


.fan-card:hover {
    z-index: 100 !important;
    box-shadow: 0 0 30px rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.6);
}

.fan-container.is-selecting .fan-card:not(.is-selected):hover {
    box-shadow: 0 16px 40px rgba(0,0,0,0.35), inset 0 1px 8px rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.28);
}

.fan-card:hover .card-visual { opacity: 1; }

.card-title {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translate(-50%, -100%);
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    text-shadow: 0 2px 6px rgba(0,0,0,0.6);
    text-align: center;
    white-space: nowrap;
    z-index: 2;
}

.fan-card:hover .card-title {
    opacity: 1;
    transform: translate(-50%, -100%);
}

.card-hover-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95); /* Scale up closer to 1 */
    /* Increased font size for maximum visibility */
    font-size: clamp(1.6rem, 4vw, 3.2rem);
    
    /* Updated Typography & Liquid Glass Effect */
    font-family: 'bianzhidai-Base', sans-serif;
    font-style: italic;
    font-weight: normal;
    
    color: #ff00de;
    text-shadow: 0 0 10px rgba(255, 0, 222, 0.5);
    
    /* Liquid Glass Container Style */
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.22) 0%,
        rgba(255,255,255,0.06) 50%,
        rgba(255,255,255,0.18) 100%
    );
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 
        0 4px 24px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.4);
    border-radius: var(--ira-fan-corner-md);
    clip-path: inset(0 round var(--ira-fan-corner-md));
    padding: 10px 10px; /* Reduced vertical/horizontal padding */
    
    text-transform: lowercase;
    letter-spacing: 0.1em;
    text-align: center;
    white-space: normal;
    width: 96%; /* Minimal margin from card edges (2% each side) */
    
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 3;
    line-height: 1.05; /* Tighter line height for big text */
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
}

/* Specific adjustments for longer titles */
.fan-card[data-index="1"] .card-hover-label {
    font-size: clamp(1.1rem, 2.4vw, 2.3rem);
}

.fan-card[data-index="2"] .card-hover-label {
    font-size: clamp(1.1rem, 2.4vw, 2.3rem);
}

.fan-card[data-index="3"] .card-hover-label {
    font-size: clamp(1.1rem, 2.4vw, 2.3rem);
}

.fan-card .card-title {
    display: none !important; /* Hide old white title completely to avoid confusion */
}

.fan-card:hover .card-hover-label {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.fan-card[data-index="0"] .card-hover-label {
    white-space: nowrap;
    font-size: clamp(1rem, 2.4vw, 1.9rem);
}

.fan-container.is-selecting .fan-card.is-selected .card-hover-label {
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
    z-index: 100 !important;
    color: #ff00de !important;
    /* Ensure liquid glass background persists */
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.22) 0%,
        rgba(255,255,255,0.06) 50%,
        rgba(255,255,255,0.18) 100%
    ) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    box-shadow: 
        0 4px 24px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.4) !important;
}

.fan-container.is-selecting .fan-card .card-visual {
    filter: grayscale(1);
    transition: filter 0.2s ease;
}

.fan-container.is-selecting .fan-card {
    /* Removed filter: grayscale(1) from here so text stays pink */
    opacity: 1;
    z-index: 4300;
    transition: transform 1.2s ease-in-out, opacity 0.2s ease;
}

.fan-container.is-selecting .fan-card.is-selected .card-visual {
    filter: none !important; /* Restore full color for selected card */
    opacity: 1; 
}

.fan-container.is-selecting .fan-card:not(.is-selected) .card-visual {
    filter: grayscale(1); 
    opacity: 0.5;
}

.fan-container.is-selecting .fan-card.is-selected {
    opacity: 1;
    z-index: 4400;
}

#gallery-section.is-shop-open .fan-container {
    pointer-events: none !important;
}

#gallery-section.is-shop-open .fan-container .fan-card {
    pointer-events: auto !important;
}

#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #050505;
    z-index: 9999;
    transition: opacity 0.8s ease-out;
}
