:root {
    --modal_top: calc(50vh - 60vh/2 - 3%);
    --margin_sp_btn_orientation_portrait: calc(96px + 1vh);
    --margin_tablet_btn_orientation_portrait: calc(140px + 1vh);
    --margin_sp_btn_orientation_landscape: calc(96px + 1vw);
    --margin_tablet_btn_orientation_landscape: calc(140px + 1vw);
    --margin_pc_btn_orientation_landscape: calc(5vw + 3px + 1vw);
}

#video {
    position: absolute; 
    width: 100%;
    height: 100%;
    top: 0px; 
    left: 0px;
    object-fit: cover;
    z-index: 900;
}

#canvas{
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0px;
    left: 0px;
    object-fit: cover;
    z-index: 950;
}

#mirror_canvas{
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0px;
    left: 0px;
    object-fit: cover;
    z-index: 950;
}

/* pc */
@media screen and (min-width:1366px){
    #video {
        width: 50vw; 
        height: 28vw;
        top: 50%; 
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    #canvas{
        width: 50vw; 
        height: 28vw;
        top: 50%; 
        left: 50%;
        transform: translate(-50%, -50%);
    }

    #mirror_canvas{
        width: 50vw; 
        height: 28vw;
        top: 50%; 
        left: 50%;
        transform: translate(-50%, -50%);
    }
}

/* -----------画面表示物----------- */
.btn{
    width: 88px;
}

#switch_camera {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2000;
}

#camera_shutter{
    position: absolute;
    left: 50%;
    bottom: 0px;
    z-index: 2000;
    transform: translate(-50%, -25%);
}

/* tablet */
@media screen and (min-width:600px) {
    .btn{
        width: 130px;
    }

    #switch_camera {
        top: 10px;
        left: 10px;
    }
    
    #camera_shutter{
        transform: translate(-50%, -25%);
    }
}

/* landscape */
@media (orientation:landscape){
    .btn{
        width: 88px;
    }
    
    #camera_shutter{
        top: 50%;
        left: 100%;
        bottom: 0px;
        transform: translate(-135%, -50%);
    }

    /* tablet */
    @media screen and (min-height:600px) {
        .btn{
            width: 130px;
        }

        #switch_orientation {
            top: 8px;
            left: var(--margin_tablet_btn_orientation_landscape);
        }
    }

    /*pc*/
    @media screen and (min-width:1366px){
        .btn{
            width: 5vw;
        }

        .display-item-container{
            position: absolute; 
            width: 50vw; 
            height: 28vw;
            top: 50%; 
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 1999;
        }
        
        #switch_camera {
            top: 3px; 
            left: 3px;
        }
        
        #switch_orientation {
            top: 3px;
            left: var(--margin_pc_btn_orientation_landscape);
        }

        #camera_shutter{
            top: 50%;
            left: 100%;
            bottom: 0px;
            transform: translate(-125%, -50%);
        }
    }
}

/* -----------画像保存モーダル----------- */
#mask{
    background:rgba(0,0,0,0.4);
    position: fixed;
    top:0;
    bottom:0;
    left:0;
    right:0;
    z-index: 3000;
}

#modal{
    position: absolute;
    top: var(--modal_top);
    left:0;
    right:0;
    background: #EB7171;
    width:80vw;
    height:60vh;
    padding-top:5vh;
    padding-bottom:5vh;
    margin:0 auto;
    transition:transform 0.4s;
    z-index:3001;
}

#mask.hidden{
    display:none;
}
 
#modal.hidden{
    transform:translate(0,-120vh);
}

#capture_container {
    width:100%;
    margin: 0px auto;

}

#img_wrapper{
    display: inline;
    position:absolute;
    text-align: center;
    top: 15%;
}

#capture_img {
    width: 50%;
    height: 50%;
    top:50%;
    left:50%;
    text-align: center;
    border: 1px solid #582323;
}

#modal_msg_wrapper{
    display: inline;
    position:absolute;
    text-align: center;
    bottom: 6%;
    left: 3%; /* 文字の中央寄せだと人間の目で違和感があるので少し右寄せ*/
    width: 100%;
}

#modal_img_close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 15%;
    z-index: 3010;
}

#modal_img_rabbit_left {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 20%;
    z-index: 3001;
}

#modal_img_rabbit_right {
    position: absolute;
    bottom: 3%;
    right: 0;
    width: 25%;
    z-index: 3002;
}

#modal_msg{
    display: block;
    font-size: 1em;
    font-weight: bold;
    font-family: "M PLUS 1";
    color: #582323;
}

/* tablet */
@media screen and (min-width:600px) {
    #modal_msg{
        font-size: 2em;
    }
}

/* landscape */
@media (orientation:landscape){

    #modal{
        width: 60vw;
        height: 60vh;
    }

    #capture_img {
        width: 60%;
        height: 60%;
    }

    #modal_msg{
        font-size: 1em;
    }
    
    #modal_img_close {
        width: 4vw;
    }
    
    #modal_img_present_left {
        width: 5vw;
    }
    
    #modal_img_present_right {
        width: 5vw;
    }

    /* tablet */
    @media screen and (min-height:600px) {
        #modal_msg{
            font-size: 2em;
        }
        #modal_img_close {
            width: 6vw;
        }
    }

    /* pc */
    @media screen and (min-width:1366px){
        #modal{
            width: 45vw;
            height: 25vw;
        }

        #capture_img {
            width: 65%;
            height: 65%;
        }
        
        #modal_msg{
            font-size: 1.5em;
        }
        
        #modal_img_close {
            width: 4vw;
        }
        
        #modal_img_present_left {
            width: 5vw;
        }
        
        #modal_img_present_right {
            width: 5vw;
        }
    }
}

/* -----------ローディング中の表示----------- */
#loading_container{
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: -50%;
    z-index: 1000;
    width: 15vw;
    height: 15vw;
    transform: translate(-50%, -50%);
}
#loading_spinner {
    margin:0 auto;
    width: 15vw;
    height: 15vw;
    border-radius: 50%;
    border: 0.4em solid #EB7171;
    border-top-color: #ff0000;
    animation: spinner 1.5s linear infinite;
}
#loading_container.hidden{
    display:none;
}
#loading_spinner.hidden{
    display:none;
}
@keyframes spinner {
    to {
      transform: rotate(360deg);
    }
}
/* tablet */
@media screen and (min-width:600px) {
    #loading_container{
        width: 10vw;
        height: 10vw;
    }
    #loading_spinner {
        width: 10vw;
        height: 10vw;
        border: 0.8em solid #EB7171;
        border-top-color: #ff0000;
    }
}

/* pc */
@media screen and (min-width:1366px){
    #loading_container{
        width: 3vw;
        height: 3vw;
    }
    #loading_spinner {
        width: 3vw;
        height: 3vw;
    }
}


