@media (min-width: 769px) {
    #popup-mission-container {
        position: fixed;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 500px;
        height: 85vh !important;
        background-image: url(/images/mission/mission_background.webp);
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-color: rgba(255, 255, 255, 0.5);
        background-blend-mode: overlay;
        z-index: 1004;
        border-radius: 10px 10px 0 0;
        display: flex;
        flex-direction: column;
    }
}
@media (max-width: 768px) {
    #popup-mission-container {
        position: fixed;
        background-image: url(/images/mission/mission_background.webp);
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        bottom: 0;
        width: 100vw;
        height: 85vh !important;
        border-radius: 10px 10px 0px 0px;
        z-index: 10000;
        /* margin-bottom: 50px; */
        background-color: rgba(255, 255, 255, 0.5);
        background-blend-mode: overlay;
    }
}
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}
.mission-list {
    margin: 40px 0;
    padding: 10px 20px 40px;
}

.mission-list {
    flex: 1;
    overflow-y: auto;
    height: 100%;
}
.mission-new {
    position: absolute;
    top: -20px;
    right: 30px;
    width: 50px;
    height: auto;
}
.header-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 40px;
    width: 100%;
    background-image: url(/images/mission/mission_tab.webp);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 0 10px;
    border-bottom: 1px solid #aaa;
    position: absolute;
    top: 0; /* Cố định ở đầu popup */
    z-index: 1001; /* Đảm bảo nằm trên các nội dung khác */
    background-color: white; /* Đặt màu nền để che phần nội dung cuộn bên dưới */
    border-radius: inherit;
}
.stat-container {
    display: flex;
    gap: 10px;
    margin-left: auto;
}
.border-wrapper {
    display: inline-block;
    position: relative;
    padding: 5px;
    background: linear-gradient(135deg, #bbb, #eee);
    clip-path: polygon(10% 0, 90% 0, 100% 10%, 100% 90%, 90% 100%, 10% 100%, 0 90%, 0 10%);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    width: 100%;
}
.img-wrapper {
    display: block;
    background: #fff;
    clip-path: polygon(10% 0, 90% 0, 100% 10%, 100% 90%, 90% 100%, 10% 100%, 0 90%, 0 10%);
}
.mission-img {
    display: block;
    width: 100%;
    height: auto;
    clip-path: polygon(10% 0, 90% 0, 100% 10%, 100% 90%, 90% 100%, 10% 100%, 0 90%, 0 10%);
}
.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 30px;
    background: linear-gradient(145deg, #1a1a2e, #272742);
    border: 2px solid #394264;
    border-radius: 8px;
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.2), 0 4px 8px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.back-button i {
    color: #ffffff;
    font-size: 18px;
}
#pet_scene_1_text {
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    background: black;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 20px;
    text-align: center;
}

#pet_scene_2_text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    text-align: center;
    font-size: 20px;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 20px;
    text-align: center;
}

#pet_scene_2_text p {
    text-shadow: #721c24 1.95px 1.95px 2.6px;
}
.highlighted {
    color: red;
    font-weight: bold; /* Tùy chọn: làm chữ đậm */
}
#background {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease; /* Fade effect */
    background: #000;
}

#button-container {
    position: absolute;
    top: 60%; /* Hiển thị dưới textContainer */
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    gap: 15px; /* Khoảng cách giữa các nút */
}
#background.shake {
    animation: shake 0.5s infinite;
}
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0000006e;
    pointer-events: none;
    z-index: 2;
}

#night-vision-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0;
    pointer-events: none;
    z-index: 3;
    transition: opacity 0.2s ease-in-out; /* Hiệu ứng fade */
}

#night-vision-flash.flash-active {
    opacity: 1;
}

@keyframes shake {
    0% { transform: translate(0px, 0px); }
    25% { transform: translate(-5px, 5px); }
    50% { transform: translate(5px, -5px); }
    75% { transform: translate(-5px, -5px); }
    100% { transform: translate(5px, 5px); }
}

/* Rain canvas */
#rain-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Dialogue container */
#dialogue-container {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 98%;
    text-align: center;
}

/* Character container */
#character-container {
    position: relative;
    top: 10px;
    width: 100%;
    height: 200px;
    display: flex;
}

/* Individual character box */
.character-box {
    width: 50%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Character image */
.character {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: grayscale(1);
    transition: filter 0.5s ease;
    visibility: hidden;
}

/* Active character state */
.active {
    filter: grayscale(0);
    visibility: visible;
}

/* Center character */
#character-center {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Ensure it displays on top */
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Align image to bottom */
}

#character-center img {
    width: auto; /* Maintain aspect ratio */
    height: 100%; /* Limit height to container */
    object-fit: contain;
    transform-origin: center; /* Center transform origin */
    filter: grayscale(1); /* Default hidden */
    visibility: visible; /* Show image */
}

#character-center img.active {
    filter: grayscale(0); /* Highlight when active */
    visibility: visible; /* Ensure visibility */
}

/* Dialogue box */
#dialogue-box {
    position: relative;
    width: 100%;
    height: 120px;
    margin: 0 auto;
    z-index: 3;
}

#dialogue-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
}

#dialogue-text-container {
    position: absolute;
    top: 10%;
    left: 5%;
    right: 5%;
    color: black;
    text-align: center;
}

#character-status {
    font-style: italic;
    font-size: 0.9em;
}

#dialogue-text {
    font-size: 1em;
    text-align: justify;
}

/* End scene text */
#end-scene-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    font-size: 26px;
    font-family: Arial, sans-serif;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    width: 90%;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7); /* Text shadow */
}

#end-scene-text.show {
    opacity: 1;
    pointer-events: auto; /* Enable interaction when visible */
}

/* Hidden state */
.hidden {
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
.game-card {
    position: relative;
    gap: 10px;
    padding: 10px;
    border-radius: 15px;
    color: white;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    height: 80px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.game-card h5 {
    margin: 0 !important;
}
.card-image {
    width: 100px;
}
.game-card .card-icon-personal,
.game-card .card-icon-team,
.game-card .card-icon-travel {
    position: absolute;
    color: white;
    opacity: 0.3;
    font-size: 30px;
}

/* Icon cho game-card Đào kho báu cá nhân */
.card-icon-personal.icon-personal-1 {
    top: 15%;
    left: 25%;
    transform: rotate(20deg);
}

.card-icon-personal.icon-personal-2 {
    top: 55%;
    left: 65%;
    transform: rotate(-15deg);
}

.card-icon-personal.icon-personal-3 {
    top: 75%;
    left: 35%;
    transform: rotate(10deg);
}

.card-icon-personal.icon-personal-4 {
    top: 35%;
    left: 85%;
    transform: rotate(10deg);
}

/* Icon cho game-card Đào kho báu cùng team */
.card-icon-team.icon-team-1 {
    top: 25%;
    left: 70%;
    transform: rotate(-20deg);
}

.card-icon-team.icon-team-2 {
    top: 65%;
    left: 20%;
    transform: rotate(25deg);
}

.card-icon-team.icon-team-3 {
    top: 35%;
    left: 50%;
    transform: rotate(-10deg);
}

.card-icon-team.icon-team-4 {
    top: 45%;
    left: 40%;
    transform: rotate(-40deg);
}

/* Icon cho game-card Du lịch - Kết đôi */
.card-icon-travel.icon-travel-1 {
    top: 20%;
    left: 30%;
    transform: rotate(15deg);
}

.card-icon-travel.icon-travel-2 {
    top: 60%;
    left: 75%;
    transform: rotate(-25deg);
}

.card-icon-travel.icon-travel-3 {
    top: 40%;
    left: 45%;
    transform: rotate(5deg);
}