/* ===== RESET FIX MOBILE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

/* ===== BODY ===== */
body {
    font-family: Arial, sans-serif;
    text-align: center;
    background: url('khoa.png') no-repeat center center fixed;
    background-size: cover;
    position: relative;
}

/* nền tối */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

h2 {
    margin: 20px 0;
    color: white;
}

/* ===== GALLERY ===== */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    padding: 20px;

    width: 100%;
    max-width: 1200px;
    margin: auto;
}

/* CARD */
.card {
    background: transparent;
    padding: 0;
    box-shadow: none;
    border-radius: 14px;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
}

/* KHUNG ẢNH */
.img-box {
    width: 100%;
    height: 220px;
    border-radius: 14px;
    overflow: hidden;
    background: transparent;
}

/* ẢNH */
.img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


/* ===== mưa ảnh ===== */
.rain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 5000; /* thêm dòng này */
}

.drop {
    position: absolute;
    top: -100px;
    animation: fall linear forwards;
    opacity: 1;
    border-radius: 12px;
    object-fit: cover;
    z-index: 5001; /* thêm dòng này */
}

@keyframes fall {
    to {
        transform: translateY(110vh) rotate(360deg);
    }
}


/* ===== cánh hoa ===== */
.petals {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 6000; /* thêm */
}

.petal {
    position: absolute;
    top: -50px;
    font-size: 20px;
    opacity: 0.8;
    transform-origin: center;
    animation: fallPetal linear forwards;
    z-index: 6001; /* thêm */
}

@keyframes fallPetal {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    50% {
        transform: translateY(50vh) translateX(50px) rotate(180deg);
    }
    100% {
        transform: translateY(110vh) translateX(-50px) rotate(360deg);
    }
}


/* ===== nút admin ===== */
.admin-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff4d4d;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: 0.3s;
    z-index: 999;
}

.admin-btn:hover {
    background: #e60000;
    transform: scale(1.05);
}


/* ===== nút nhạc ===== */
.music-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(45deg, #ff6b6b, #ff9a9e);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: 0.3s;
    z-index: 999;
}

.music-btn:hover {
    transform: scale(1.1);
    background: linear-gradient(45deg, #ff4d4d, #ff7b7b);
}

.music-btn:active {
    transform: scale(0.95);
}


/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 768px) {

    body {
        background-attachment: scroll;
    }

    h2 {
        font-size: 20px;
        margin: 15px 0;
        padding: 0 10px;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
        padding: 12px;
    }

    .card {
        border-radius: 12px;
        padding: 0;
    }

    .img-box {
        height: 170px;
        border-radius: 10px;
    }

    .admin-btn {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 14px;
        border-radius: 7px;
    }

    .music-btn {
        bottom: 10px;
        right: 10px;
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 40px;
    }

    .drop {
        width: 40px !important;
        height: 40px !important;
        opacity: 0.9;
    }

    .petal {
        font-size: 16px;
        opacity: 0.7;
    }
}


/* ===== MOBILE NHỎ ===== */
@media (max-width: 480px) {

    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .img-box {
        height: 150px;
    }

    .card {
        padding: 0;
    }

    .admin-btn {
        font-size: 13px;
        padding: 7px 10px;
    }

    .music-btn {
        font-size: 13px;
        padding: 9px 12px;
    }
}
/* ===== FIX IOS SAFARI PHÓNG TO ẢNH ===== */
.gallery {
    display: grid !important;
    width: 100%;
    max-width: 1200px;
    margin: auto;
}

.card {
    width: 100%;
    max-width: 100%;
}

.img-box img {
    max-width: 100%;
    height: auto;
}

/* ép lại grid trên mobile */
@media (max-width: 768px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .img-box {
        height: 150px !important;
    }

    .img-box img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
}
/* ===== PHÓNG TO ẢNH KHI HOVER (PC) ===== */
.gallery .card {
    position: relative;
    overflow: visible;
    z-index: 1;
}

.gallery .card:hover {
    z-index: 9999;
}

.gallery .card img {
    transition: all 0.25s ease;
    cursor: zoom-in;
}

/* hover -> phóng ảnh ra giữa màn hình */
.gallery .card:hover img {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 50vw;
    max-height: 50vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 15px;
    box-shadow: 0px 0px 30px rgba(0,0,0,0.8);
    cursor: zoom-out;
    z-index: 10000;
}
/* ===== MÔ TẢ ẨN TRONG CARD ===== */
.card .desc {
    display: none;
}

/* ===== HIỆN MÔ TẢ KHI PHÓNG TO (PC) ===== */
.gallery .card:hover .desc {
    display: block;
    position: fixed;
    top: calc(50% + 30vh);
    left: 50%;
    transform: translateX(-50%);
    max-width: 60vw;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 16px;
    z-index: 10001;
    text-align: center;
    backdrop-filter: blur(6px);
}
/* ===== OVERLAY PHÓNG TO ẢNH (CLICK MOBILE) ===== */
.fullscreen-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 15px;
    z-index: 999999;
    padding: 20px;
}

.fullscreen-overlay img {
    max-width: 90vw;
    max-height: 75vh;
    border-radius: 15px;
    box-shadow: 0px 0px 30px rgba(0,0,0,0.8);
    object-fit: contain;
}

.fullscreen-overlay .desc {
    color: white;
    font-size: 16px;
    max-width: 90vw;
    text-align: center;
    background: rgba(0,0,0,0.5);
    padding: 10px 15px;
    border-radius: 12px;
}
/* ===== THANH ÂM LƯỢNG (ẨN / HIỆN) ===== */
.volume-box {
    position: fixed;
    bottom: 75px;
    right: 20px;
    background: rgba(0,0,0,0.55);
    padding: 6px 10px;
    border-radius: 10px;
    display: none; /* ẩn mặc định */
    align-items: center;
    gap: 6px;
    z-index: 999;
    color: white;
    font-size: 12px;
    backdrop-filter: blur(6px);
}

.volume-box.show {
    display: flex; /* hiện khi bật */
}

#volumeSlider {
    width: 80px; /* bé hơn */
    height: 4px;
    cursor: pointer;
}

/* mobile */
@media (max-width: 768px) {
    .volume-box {
        bottom: 65px;
        right: 10px;
        padding: 5px 8px;
        font-size: 11px;
    }

    #volumeSlider {
        width: 70px;
    }
}
/* ===== VOLUME ẨN - HOVER MỚI HIỆN ===== */
.volume-box {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: 0.25s;
}

.volume-box.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.gallery img {
    touch-action: manipulation;
}