/* --- BỐ CỤC ĐẢO GIẤU VÀNG --- */
.island-arena {
    height: 220px;
    background: linear-gradient(180deg, #4fc3f7 0%, #29b6f6 50%, #fff59d 50%, #ffe082 100%);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
    position: relative; 
    overflow: hidden;
}

/* Nền trời, mây và bãi cát */
.treasure-island-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}
.treasure-island-bg::after {
    content: '☁️ ☁️';
    position: absolute;
    top: 20px; left: 10px;
    font-size: 2.5rem;
    opacity: 0.8;
    animation: drift-clouds 20s linear infinite;
}

@keyframes drift-clouds {
    0% { transform: translateX(-50px); }
    100% { transform: translateX(400px); }
}

/* Rương kho báu */
.treasure-chest {
    position: absolute;
    bottom: 20px;
    right: 15%;
    width: 90px;
    height: 70px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    perspective: 500px; /* Tạo hiệu ứng 3D khi mở nắp */
}

/* Thân rương */
.chest-body {
    width: 90px; height: 45px;
    background: linear-gradient(to bottom, #795548, #4e342e);
    border: 3px solid #3e2723;
    border-radius: 2px 2px 8px 8px;
    position: absolute;
    bottom: 0;
    z-index: 2;
    box-shadow: 0 5px 10px rgba(0,0,0,0.4), inset 0 0 10px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
}

/* Ổ khóa rương */
.chest-lock {
    width: 15px; height: 20px;
    background: #ffd54f;
    border: 3px solid #ffb300; /* Màu viền thay đổi theo hệ thống JS */
    border-radius: 0 0 10px 10px;
    margin-top: -3px;
    z-index: 4;
}

/* Nắp rương */
.chest-lid {
    width: 96px; height: 35px;
    background: linear-gradient(to top, #795548, #8d6e63);
    border: 3px solid #3e2723;
    border-radius: 20px 20px 0 0;
    position: absolute;
    top: 0;
    transform-origin: bottom center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 3;
}

/* Các viền nẹp vàng trên nắp */
.chest-lid::before, .chest-lid::after {
    content: '';
    position: absolute;
    top: 0; width: 6px; height: 100%;
    background: #ffb300; border: 1px solid #ff8f00;
}
.chest-lid::before { left: 15px; }
.chest-lid::after { right: 15px; }

/* Nội dung kho báu phát sáng (Ẩn bên trong) */
.chest-glow {
    position: absolute;
    bottom: 30px;
    font-size: 2.5rem;
    z-index: 1;
    opacity: 0;
    transform: translateY(20px) scale(0);
    transition: all 0.8s ease-out;
}

/* HIỆU ỨNG TRẢ LỜI ĐÚNG: MỞ NẮP VÀ HIỆN KHO BÁU */
.open-chest .chest-lid {
    transform: rotateX(80deg); /* Ngửa nắp ra sau */
}
.show-treasure {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: pulse-glow 1s infinite alternate;
}
@keyframes pulse-glow {
    0% { filter: drop-shadow(0 0 10px #ffeb3b); }
    100% { filter: drop-shadow(0 0 30px #ffffff); }
}

/* Rung lắc rương khi sai */
.lock-error { animation: shake-chest 0.4s !important; }
@keyframes shake-chest {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-3deg); }
    50% { transform: translateX(5px) rotate(3deg); }
    75% { transform: translateX(-5px) rotate(-3deg); }
    100% { transform: translateX(0); }
}

/* Nhân vật Thuyền trưởng */
.pirate-char {
    position: absolute;
    bottom: 20px;
    left: 15%;
    font-size: 4.5rem;
    z-index: 5;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.4));
}

/* Nhảy mừng */
.happy-jump {
    animation: build-jump 0.8s ease-out forwards !important;
}
@keyframes build-jump {
    0% { transform: translateY(0); }
    50% { transform: translateY(-30px) scale(1.1); }
    100% { transform: translateY(0); }
}

/* Rung lắc nhân vật khi sai */
.shake-error { animation: shake-char 0.4s !important; }
@keyframes shake-char {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    50% { transform: translateX(10px) rotate(5deg); }
    75% { transform: translateX(-10px) rotate(-5deg); }
    100% { transform: translateX(0); }
}

.min-h-75 { min-height: 85px; }