/* ================= VXPEDITION SYSTEM STYLES ================= */
.popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.85) !important;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999999 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    padding: 16px;
    box-sizing: border-box;
}

.popup.xvpedition {
    background: linear-gradient(145deg, #d9934f, #ba6a2c) !important;
    border-radius: 22px !important;
    padding: 22px 24px 20px 24px !important;
    width: 95% !important;
    max-width: 900px !important;
    max-height: 88vh !important;
    border: 4px solid #753910 !important;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.85), inset 0 2px 4px rgba(255, 255, 255, 0.25) !important;
    position: relative !important;
    text-align: center !important;
    margin: auto !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 1000000 !important;
    box-sizing: border-box !important;
    color: #ffffff;
    font-family: "Trebuchet MS", Arial, sans-serif;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
}

/* Close Button */
.popup.xvpedition .close-btn {
    position: absolute !important;
    top: 14px !important;
    right: 18px !important;
    left: auto !important;
    width: 34px !important;
    height: 34px !important;
    background: rgba(0, 0, 0, 0.45) !important;
    border: 2px solid #ffe45c !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    font-weight: 900 !important;
    color: #ffe45c !important;
    cursor: pointer !important;
    z-index: 1000002 !important;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease !important;
    box-shadow: 0 3px 6px rgba(0,0,0,0.5) !important;
    line-height: 1 !important;
    padding: 0 !important;
    user-select: none !important;
}

.popup.xvpedition .close-btn:hover {
    background: #ffe45c !important;
    color: #4b2600 !important;
    transform: scale(1.1) !important;
}

/* Back Button */
.xv-back-btn {
    position: absolute;
    top: 12px;
    left: 18px;
    font-size: 13.5px;
    font-weight: bold;
    cursor: pointer;
    color: #4b2600;
    background: linear-gradient(#ffe066, #ff9800);
    border: 2px solid #6b2e05;
    border-radius: 16px;
    padding: 5px 12px;
    z-index: 1000001;
    transition: transform 0.2s ease, filter 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.xv-back-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Modal Headers */
.xvpedition-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
}

.xvpedition-main-title {
    margin: 0;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6), 0 0 10px rgba(255, 218, 128, 0.3);
}

.xvpedition-subtitle {
    margin: 0;
    font-size: 13.5px;
    color: #ffeaa7;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* ================= GLOSARIUM VIEW ================= */
.xv-tab-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.xvpedition-controls {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.xvpedition-search {
    width: 100%;
    padding: 11px 16px;
    border-radius: 12px;
    border: 2.5px solid #7a3e12;
    background: #fff9ed;
    color: #4b2600;
    font-size: 14.5px;
    font-weight: bold;
    outline: none;
    box-sizing: border-box;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}

.xvpedition-search::placeholder {
    color: #9e734c;
    font-weight: normal;
}

.xvpedition-search:focus {
    border-color: #ffea81;
    box-shadow: 0 0 8px rgba(255, 234, 129, 0.7);
}

.xvpedition-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.cat-btn {
    padding: 6px 12px;
    border-radius: 20px;
    border: 2px solid #7a3e12;
    font-size: 12.5px;
    font-weight: bold;
    cursor: pointer;
    background: #c67a3c;
    color: #ffffff;
    transition: all 0.2s ease;
}

.cat-btn:hover {
    background: #d9934f;
    transform: translateY(-1px);
}

.cat-btn.active {
    background: linear-gradient(#ffea81, #ff8400);
    color: #5a2a0c;
    border-color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.xvpedition-content {
    max-height: 52vh;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: contain;
    padding: 4px 6px 6px 4px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    text-align: left;
}

.xvpedition-content::-webkit-scrollbar {
    width: 7px;
}
.xvpedition-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.25);
    border-radius: 4px;
}
.xvpedition-content::-webkit-scrollbar-thumb {
    background: #ffea81;
    border-radius: 4px;
    border: 1px solid #7a3e12;
}

.term-card {
    background: rgba(0, 0, 0, 0.32);
    border: 2px solid #ffe45c;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.term-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    background: rgba(0, 0, 0, 0.45);
}

.term-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.term-title {
    font-size: 15.5px;
    font-weight: bold;
    color: #ffea81;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
}

.term-tag {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 8px;
    background: #7a3e12;
    color: #ffe45c;
    font-weight: bold;
    white-space: nowrap;
}

.term-desc {
    font-size: 13px;
    line-height: 1.45;
    color: #ffffff;
    margin: 0;
    white-space: normal;
}

.xv-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: #ffe45c;
    font-size: 15px;
}

/* ================= 3. REFERENSI WEB VIEW (SLIDER WITH NAV BUTTONS) ================= */
.ref-single-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    gap: 8px;
}

.ref-slide {
    width: 100%;
}

.ref-card {
    background: rgba(0, 0, 0, 0.4);
    border: 3px solid #ffe45c;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    text-align: left;
}

.ref-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7), 0 0 12px rgba(255, 228, 92, 0.4);
    border-color: #ffffff;
}

.ref-card-img-wrap {
    position: relative;
    width: 100%;
    height: clamp(130px, 25vh, 200px);
    background: #111;
    overflow: hidden;
}

.ref-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 6px;
    padding: 0 4px;
}

.ref-indicator {
    font-size: 15px;
    font-weight: bold;
    color: #ffe45c;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.ref-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ref-card:hover .ref-card-img {
    transform: scale(1.05);
}

.ref-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.ref-card-badge.youtube {
    background: linear-gradient(135deg, #ff0000, #cc0000);
}

.ref-card-badge.bbc {
    background: linear-gradient(135deg, #bb1919, #880000);
}

.ref-card-body {
    padding: 14px 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    justify-content: space-between;
}

.ref-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: #ffea81;
    line-height: 1.35;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.ref-card-desc {
    margin: 0;
    font-size: 12.5px;
    color: #e0e0e0;
    line-height: 1.45;
    flex: 1;
}

.ref-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
    transition: transform 0.2s ease, filter 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    margin-top: 6px;
}

.ref-card-btn.youtube {
    background: linear-gradient(#ffea81, #ff8400);
    color: #4b2600;
    border: 2px solid #7a3e12;
}

.ref-card-btn.bbc {
    background: linear-gradient(#ffe066, #ff9800);
    color: #4b2600;
    border: 2px solid #6b2e05;
}

.ref-card-btn:hover {
    transform: scale(1.03);
    filter: brightness(1.1);
}

/* ================= GAMEPLAY FLOATING BUTTON (BELOW MENU BUTTON, TOP-RIGHT) ================= */
.xvpedition-game-btn {
    position: fixed;
    top: 60px;
    right: 12px;
    left: auto;
    height: 35px;
    padding: 0 12px 0 5px;
    background: linear-gradient(135deg, #ffe066 0%, #ff9800 55%, #d84315 100%);
    border: 2px solid #6b2e05;
    border-radius: 20px;
    display: none; /* Controlled dynamically by shouldShowXVpeditionBtn */
    justify-content: center;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 2px 2px rgba(255, 255, 255, 0.6);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.xvpedition-game-btn:hover {
    transform: scale(1.06);
    filter: brightness(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.75), inset 0 2px 3px rgba(255, 255, 255, 0.8);
}

.xvpedition-game-btn:active {
    transform: scale(0.95);
}

.xvpedition-btn-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
    pointer-events: none;
}

.xvpedition-btn-text {
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 12.5px;
    font-weight: 900;
    color: #441f03;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
    pointer-events: none;
}

/* ================= MOBILE RESPONSIVE MEDIA QUERIES ================= */
@media (max-width: 480px) {
    .popup.xvpedition {
        padding: 16px 14px 14px 14px !important;
        border-width: 3px !important;
    }
    .xvpedition-main-title {
        font-size: 20px;
    }
    .cat-btn {
        padding: 5px 9px;
        font-size: 11px;
    }
    .xvpedition-search {
        padding: 9px 12px;
        font-size: 13px;
    }
    .xvpedition-content {
        grid-template-columns: 1fr;
        max-height: 58vh;
    }
    .ref-card-grid {
        grid-template-columns: 1fr;
        max-height: 58vh;
        gap: 12px;
    }
    .ref-card-title {
        font-size: 14px;
    }
    .ref-card-desc {
        font-size: 12px;
    }
}

@media (max-height: 500px) {
    .popup.xvpedition {
        max-height: 94vh !important;
        padding: 12px 14px !important;
    }
    .xvpedition-header {
        margin-bottom: 8px;
    }
    .xvpedition-main-title {
        font-size: 18px;
    }
    .xvpedition-controls {
        margin-bottom: 8px;
        gap: 6px;
    }
    .xvpedition-content,
    .ref-card-grid {
        max-height: 48vh;
    }
}
