:root { --amb-r: 255; --amb-g: 255; --amb-b: 255; }

/* Hide footer + audio when running inside shell iframe */
._sif .site-footer-bar, ._sif #bgm { display: none !important; }

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Montserrat', sans-serif; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; background: #09090f; color: #f0f0f0; overflow-x: hidden; position: relative; }

body::before {
    content: '';
    position: fixed; top: -10%; left: 50%; transform: translateX(-50%);
    width: 80%; height: 50%;
    background: radial-gradient(ellipse, rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.04) 0%, transparent 70%);
    z-index: -1; pointer-events: none;
    transition: background 1.1s ease;
    animation: ambientPulse 10s ease-in-out infinite;
}
@keyframes ambientPulse {
    0%,100% { opacity: 0.4; transform: translateX(-50%) scale(1); }
    50%      { opacity: 0.8; transform: translateX(-50%) scale(1.05); }
}

.bg-wrapper {
    position: fixed; inset: 0;
    background: url("../assets/images/bg2.jpg") center/cover no-repeat;
    z-index: -2; filter: brightness(0.22) saturate(0.45) blur(1px);
}
.shadow-overlay {
    position: fixed; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.52) 0%, rgba(9,9,15,0.84) 100%);
    z-index: -1;
}

/* ─── STARFIELD ─── */
#stars-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ─── TOP LEFT INFO ─── */
.top-left-info {
    position: fixed; top: 35px; left: 50px; z-index: 100;
    display: flex; flex-direction: column; align-items: flex-start; pointer-events: auto;
}
.crown-icon {
    font-size: 18px; color: rgba(255,255,255,0.62); margin-bottom: 6px;
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.38));
    animation: crownGlow 4s ease-in-out infinite;
}
@keyframes crownGlow {
    0%,100% { filter: drop-shadow(0 0 4px rgba(255,255,255,0.28)); opacity: 0.68; }
    50%      { filter: drop-shadow(0 0 12px rgba(255,255,255,0.72)); opacity: 1; }
}
.leader-name {
    font-size: 90px; font-weight: 900; letter-spacing: 2px; margin-bottom: 5px; line-height: 1;
    background: linear-gradient(120deg, #555 0%, #aaa 18%, #eee 36%, #fff 50%, #eee 64%, #aaa 82%, #555 100%);
    background-size: 200% auto; background-clip: text; -webkit-background-clip: text;
    color: transparent; -webkit-text-fill-color: transparent;
    animation: silverShimmer 5s linear infinite;
    filter: drop-shadow(0 3px 14px rgba(255,255,255,0.08));
}
@keyframes silverShimmer { 0% { background-position: 0% center; } 100% { background-position: 200% center; } }

.counter-box {
    display: flex; align-items: baseline; gap: 12px;
    border-left: 2px solid rgba(255,255,255,0.18);
    padding-left: 14px; margin-bottom: 16px;
}
.count-number {
    font-size: 58px; font-weight: 800; line-height: 1;
    background: linear-gradient(180deg, #fff 0%, rgba(255,255,255,0.5) 100%);
    background-clip: text; -webkit-background-clip: text;
    color: transparent; -webkit-text-fill-color: transparent;
}
.label { font-size: 13px; letter-spacing: 3px; font-weight: 700; color: rgba(255,255,255,0.32); text-transform: uppercase; }

.back-btn {
    text-decoration: none; color: rgba(255,255,255,0.42);
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px; padding: 8px 20px;
    font-size: 11px; letter-spacing: 2px; font-weight: 600;
    backdrop-filter: blur(20px); transition: 0.3s ease;
    display: flex; align-items: center; gap: 6px;
}
.back-btn:hover {
    background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.26);
    color: #fff; transform: translateX(-3px);
}

/* ─── GALLERY ─── */
.gallery-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    z-index: 10; pointer-events: none;
    padding-top: 115px; padding-bottom: 75px;
}
.gallery-container {
    position: relative;
    width: clamp(142px, 22.5vw, 248px);
    height: clamp(220px, 34.5vw, 382px);
    pointer-events: auto;
}
.gallery-container::after {
    content: '';
    position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%);
    width: 300px; height: 16px;
    background: radial-gradient(ellipse, rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.16) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none;
    transition: background 0.9s ease;
}

/* ─── CARD OUTER — only handles position/transform, no overflow clip ─── */
.card {
    position: absolute; left: 50%; top: 0;
    width: clamp(133px, 21vw, 235px);
    height: clamp(206px, 32.9vw, 368px);
    margin-left: calc(clamp(133px, 21vw, 235px) / -2);
    border-radius: clamp(16px, 1.8vw, 20px);
    overflow: visible;    /* KEY: allows glow on card-inner to spill through */
    cursor: pointer; user-select: none;
    transform: translateX(var(--tx,0px)) translateY(var(--ty,0px)) rotate(var(--rot,0deg));
    z-index: var(--z,1);
    filter: brightness(0.58) saturate(0.5);
    transition: transform 0.48s cubic-bezier(0.25,1,0.5,1), filter 0.35s ease, opacity 0.45s ease;
}

/* ─── FLIPPER (handles card flip rotation) ─── */
.card-flipper {
    position: absolute; inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.65s cubic-bezier(0.25, 1, 0.5, 1);
}
.card.flipped .card-flipper { transform: rotateY(180deg); }

/* ─── CARD FRONT — VanillaTilt surface, carries glow ─── */
.card-inner {
    position: absolute; inset: 0;
    border-radius: 22px;
    overflow: hidden;
    transform-style: preserve-3d;
    border: 1px solid rgba(255,255,255,0.09);
    box-shadow: 0 8px 32px rgba(0,0,0,0.8), 0 2px 6px rgba(0,0,0,0.5);
    transition: box-shadow 0.35s ease, border-color 0.35s ease;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* ─── CARD BACK (shown on flip, bgImage) ─── */
.card-back {
    position: absolute; inset: 0;
    border-radius: 22px; overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: rotateY(180deg);
    background: #07070c;
    border: 1px solid rgba(255,255,255,0.09);
    cursor: pointer;
}
.card-back > img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; object-position: center; pointer-events: none;
}
.card-back-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 0 13px 16px;
    background: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.75) 40%, transparent 100%);
    display: flex; flex-direction: column; align-items: center;
    text-align: center; z-index: 5;
}
.flip-hint {
    font-size: 8px; font-weight: 700; letter-spacing: 2.5px;
    color: rgba(255,255,255,0.25); text-transform: uppercase; margin-top: 5px;
}
/* Close indicator on back face (top-right corner) */
.card-back-close {
    position: absolute; top: 10px; right: 12px;
    font-size: 16px; color: rgba(255,255,255,0.35);
    pointer-events: none;
}

/* Profile image fills front face */
.card-main-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; object-position: top; pointer-events: none; z-index: 1;
}

/* ─── LIGHT SWEEP (passes through each card like KIDJAYXD home btn) ─── */
.card-inner::before {
    content: '';
    position: absolute; top: 0; left: -80%; width: 55%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07) 50%, transparent);
    transform: skewX(-18deg);
    animation: cardSweep 8s ease-in-out infinite;
    z-index: 3; pointer-events: none;
}
@keyframes cardSweep {
    0%, 58%  { left: -80%; opacity: 0; }
    63%      { opacity: 1; }
    84%, 100% { left: 160%; opacity: 0; }
}
/* Stagger per position so sweeps don't all fire simultaneously */
.card:nth-child(1) .card-inner::before { animation-delay:  0s;    }
.card:nth-child(2) .card-inner::before { animation-delay: -1.3s;  }
.card:nth-child(3) .card-inner::before { animation-delay: -2.6s;  }
.card:nth-child(4) .card-inner::before { animation-delay: -3.9s;  }
.card:nth-child(5) .card-inner::before { animation-delay: -5.2s;  }
.card:nth-child(6) .card-inner::before { animation-delay: -6.5s;  }
.card:nth-child(7) .card-inner::before { animation-delay: -0.9s;  }
.card:nth-child(8) .card-inner::before { animation-delay: -2.2s;  }
.card:nth-child(9) .card-inner::before { animation-delay: -4.5s;  }

/* Shimmer at top of card (inside card-inner, tilts with it) */
.card-shimmer {
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent,
        rgba(255,255,255,0.3) 30%,
        rgba(255,255,255,0.82) 50%,
        rgba(255,255,255,0.3) 70%, transparent);
    z-index: 8; opacity: 0;
    transition: opacity 0.4s, background 0.9s ease;
    pointer-events: none;
}

/* ─── HOVER & SELECTED — glow lives on card-inner so it follows tilt ─── */
.card:hover, .card.selected {
    filter: brightness(1) saturate(1);
    z-index: 20;
    transform: translateX(var(--tx,0px)) translateY(calc(var(--ty,0px) - 34px)) rotate(var(--rot,0deg)) scale(1.09);
}
.card:hover:not(.flipped) .card-inner,
.card.selected:not(.flipped) .card-inner {
    border-color: rgba(255,255,255,0.42);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.25),
        0 0 22px rgba(255,255,255,0.6),
        0 0 55px rgba(255,255,255,0.22),
        0 22px 52px rgba(0,0,0,0.92);
}
.card:hover:not(.flipped) .card-shimmer, .card.selected:not(.flipped) .card-shimmer { opacity: 1; }

/* ─── CARD CONTENT ─── */
.card-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 0 13px 17px 13px;
    background: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.88) 38%, rgba(0,0,0,0.4) 64%, transparent 100%);
    display: flex; flex-direction: column; align-items: center;
    text-align: center; z-index: 5; pointer-events: none;
}
.card-badge {
    font-size: 7px; font-weight: 800; letter-spacing: 3.5px;
    text-transform: uppercase; padding: 2px 9px; border-radius: 20px; margin-bottom: 6px;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.16);
    color: rgba(210,208,200,0.62);
    opacity: 0; transform: translateY(6px);
    transition: opacity 0.36s ease 0.07s, transform 0.36s ease 0.07s;
    pointer-events: none;
}
.card:hover .card-badge, .card.selected .card-badge { opacity: 1; transform: translateY(0); }

.card-name {
    font-size: 18px; font-weight: 900; letter-spacing: 1.5px;
    text-transform: uppercase; color: #f2ede0;
    text-shadow: 0 2px 12px rgba(0,0,0,1);
    margin-bottom: 9px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
    pointer-events: none;
}
.card-actions {
    display: flex; gap: 8px;
    opacity: 0; transform: translateY(8px);
    transition: opacity 0.36s ease 0.13s, transform 0.36s ease 0.13s;
    pointer-events: auto;
}
.card:hover .card-actions, .card.selected .card-actions { opacity: 1; transform: translateY(0); }

.card-action-btn {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    color: rgba(230,225,215,0.85); text-decoration: none;
    backdrop-filter: blur(6px); transition: all 0.28s ease;
}
.card-action-btn:hover {
    background: rgba(255,255,255,0.88); color: #111;
    border-color: transparent; transform: translateY(-3px);
    box-shadow: 0 5px 14px rgba(255,255,255,0.22);
}
.card-action-btn i { font-size: 12px; }

/* ─── SKELETON LOADING ─── */
.skeleton-card {
    position: absolute; left: 50%; top: 0;
    width: clamp(133px, 21vw, 235px);
    height: clamp(206px, 32.9vw, 368px);
    margin-left: calc(clamp(133px, 21vw, 235px) / -2);
    border-radius: clamp(16px, 1.8vw, 22px); overflow: hidden;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
}
.skeleton-card::after {
    content: '';
    position: absolute; top: 0; left: -60%;
    width: 55%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.055), transparent);
    animation: skelShimmer 1.9s ease-in-out infinite;
}
@keyframes skelShimmer {
    0%   { left: -60%; opacity: 0; }
    15%  { opacity: 1; }
    85%  { opacity: 1; }
    100% { left: 160%; opacity: 0; }
}
/* Fake bottom overlay */
.skeleton-card::before {
    content: '';
    position: absolute; bottom: 0; left: 0; right: 0; height: 40%;
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 100%);
}

/* ─── ERROR STATE ─── */
#error-state {
    position: fixed; inset: 0; z-index: 200;
    display: none; align-items: center; justify-content: center;
}
.error-card {
    background: rgba(10,10,15,0.94);
    border: 1px solid rgba(255,80,80,0.22);
    border-radius: 18px; padding: 30px 38px;
    text-align: center; max-width: 300px;
    backdrop-filter: blur(24px);
    box-shadow: 0 0 44px rgba(255,40,40,0.06);
}
.error-icon  { font-size: 30px; color: rgba(255,100,100,0.55); margin-bottom: 14px; display: block; }
.error-title { font-size: 11px; font-weight: 800; letter-spacing: 3px; color: rgba(255,255,255,0.68); margin-bottom: 8px; }
.error-msg   { font-size: 12px; color: rgba(255,255,255,0.35); margin-bottom: 20px; line-height: 1.55; }
.error-retry {
    padding: 9px 24px; border-radius: 8px;
    background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.68);
    font-size: 11px; font-weight: 700; letter-spacing: 2px;
    cursor: pointer; transition: 0.25s; font-family: inherit; text-transform: uppercase;
}
.error-retry:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ─── FOOTER BAR ─── */
.site-footer-bar {
    position: fixed; bottom: 0; left: 0; right: 0; height: 60px;
    display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
    z-index: 100; pointer-events: none;
    background: linear-gradient(to top, rgba(0,0,0,0.62) 0%, transparent 100%);
}
.footer-left  { display: flex; align-items: center; gap: 10px; pointer-events: auto; flex-shrink: 0; }
.footer-right { display: flex; align-items: center; pointer-events: auto; flex-shrink: 0; }
.social-icons { display: flex; gap: 8px; }

.social-btn {
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px; backdrop-filter: blur(20px);
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; color: rgba(255,255,255,0.4); transition: 0.3s; cursor: pointer;
}
.social-btn:hover {
    background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.26);
    color: #fff; transform: translateY(-3px);
}
.social-btn i, .social-btn svg { font-size: 16px; width: 16px; height: 16px; display: block; }
.social-btn .fa-facebook-f { transform: translateX(2px); }

.music-control {
    display: flex; align-items: center;
    background: rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.06);
    border: 1px solid rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.18);
    border-radius: 12px; backdrop-filter: blur(20px);
    padding: 0 12px; height: 38px; gap: 10px;
    transition: background 0.9s ease, border-color 0.9s ease, box-shadow 0.9s ease;
}
.music-control:hover {
    background: rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.12);
    border-color: rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.32);
    box-shadow: 0 0 14px rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.12);
}
.play-btn {
    background: none; border: none;
    color: rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.72); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; padding: 0; flex-shrink: 0;
    transition: color 0.9s ease;
}
.play-btn svg { width: 12px; height: 12px; }
#vol {
    -webkit-appearance: none; appearance: none;
    width: 80px; height: 3px; border: none; padding: 0; margin: 0;
    border-radius: 3px;
    outline: none; cursor: pointer; flex-shrink: 0; display: block;
    /* fill is set dynamically by music-player.js via _syncVolFill() */
    background: rgba(255,255,255,0.12);
}
#vol::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: transparent; }
#vol::-webkit-slider-thumb {
    -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
    background: rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.9); cursor: pointer; margin-top: -4.5px;
    box-shadow: 0 0 6px rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.45); transition: 0.2s, background 0.9s ease;
}
#vol::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: rgba(var(--amb-r),var(--amb-g),var(--amb-b),0.9); border: none; cursor: pointer; }

#admin-link-btn {
    width: 36px; height: 36px; border-radius: 10px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.35); font-size: 14px;
    display: none; align-items: center; justify-content: center;
    text-decoration: none; transition: 0.28s; backdrop-filter: blur(10px);
}
#admin-link-btn:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.82); border-color: rgba(255,255,255,0.24); }

img { pointer-events: none; user-select: none; -webkit-user-drag: none; }

/* ─── MOBILE ─── */
@media (max-width: 900px) { .leader-name { font-size: 70px; } }

@media (max-width: 768px) {
    .top-left-info { left: 16px; top: 16px; }
    .leader-name { font-size: 50px; letter-spacing: 1px; }
    .count-number { font-size: 44px; }
    .label { font-size: 11px; }
    .gallery-wrapper { padding-top: 28px; padding-bottom: 65px; }
    .card-name { font-size: 13px; margin-bottom: 7px; }
    .card-badge { font-size: 6px; padding: 2px 7px; }
    .card-action-btn { width: 29px; height: 29px; }
    .site-footer-bar { padding: 0 14px; height: 56px; }
    #vol { width: 60px; }
}

@media (max-width: 480px) {
    .leader-name { font-size: 34px; }
    .card-name { font-size: 11px; letter-spacing: 0.5px; }
}
