
/* btn 
.bootbtn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 3px solid #fff;
  position: fixed;
  bottom: 2em;
  right: 2em;
  z-index: 999;
}
.aiicon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  z-index: 999;
}
.bootbtn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.bootbtn:active {
  transform: scale(0.95);
  transition: all 0.1s ease;
}
.bootbtn.hidden {
  display: none;
}*/

/* window 
.aiwdw {
  aspect-ratio: 10 / 16;

  height: 600px;
  border: solid 1px #aaa;
  border-radius: 0.5rem;
  position: fixed;
  bottom: 2em;
  right: 2em;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: visible;
  background: #aaa;
  box-sizing: border-box;
}
.w-inner {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0.5rem;
  position: relative;
  z-index: 1;
  display: block;
  overflow: hidden;
}
.close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  z-index: 1001;
  transition: all 0.2s ease;
  font-family: Arial, sans-serif;
}
.close-btn:hover {
  background: rgba(255, 0, 0, 0.8);
  transform: scale(1.1);
}
.close-btn:active {
  transform: scale(0.95);
}
.aiwdw.hidden {
  display: none;
}
.aiwdw.show {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}*/

/* SP 
  @media (max-width: 768px) {
    .aiwdw:not(.hidden)::before {
      content: '';
      position: fixed;
      top: -100vh;
      left: -100vw;
      width: 300vw;
      height: 300vh;
      background: rgba(0, 0, 0, 0.7);
      z-index: -1;
      pointer-events: none;
    }
  }
@media (max-width: 768px) {
  .aiwdw {
    aspect-ratio: none;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
    right: auto;
    width: 280px;
    height: 498px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  }
            
  .aiwdw.show {
      animation: fadeInScale 0.3s ease-out;
  }
  
  @keyframes fadeInScale {
    from {
      transform: translate(-50%, -50%) scale(0.9);
      opacity: 0;
    }
    to {
      transform: translate(-50%, -50%) scale(1);
      opacity: 1;
    }
  }
  
  .bootbtn {
    bottom: 1.5em;
    right: 1.5em;
  }
}

@media (max-width: 480px) {
  .bootbtn {
    bottom: 1em;
    right: 1em;
  }
}*/


/* btn */
        .bootbtn {
            width: 70px;
            height: 70px;
            border-radius: 50%;
            overflow: hidden;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            border: 3px solid #fff;
            position: fixed;
            bottom: 2em;
            right: 2em;
            z-index: 999;
        }
        .aiicon {
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: center;
            display: block;
            z-index: 999;
        }
        .bootbtn:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
        }
        .bootbtn:active {
            transform: scale(0.95);
            transition: all 0.1s ease;
        }
        .bootbtn.hidden {
            display: none;
        }
        
        /* window */
        .aiwdw {
            margin-top: 1rem;
            /*aspect-ratio: 10 / 16;*/
            /*height: 600px;
            min-height: 500px;
            max-height: calc(100vh - 4em);*/
            height: min(600px, 90vh);
            max-height: calc(100vh - 70px - 2em);
            width: 375px;
            border: solid 1px #aaa;
            border-radius: 0.5rem;
            position: fixed;
            bottom: 2em;
            right: 2em;
            /*position: fixed;
            bottom: max(1em, calc((100vh - 600px) / 2));
            right: 2em;*/

            z-index: 1000;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            overflow: visible;
            background: #aaa;
            box-sizing: border-box;
        }
        
        .w-inner {
            width: 100%;
            height: 100%;
            border: none;
            border-radius: 0.5rem;
            position: relative;
            z-index: 10;
            display: block;
            overflow: auto;
            -webkit-overflow-scrolling: touch;
            touch-action: manipulation;
        }
        
        .close-btn {
            position: absolute;
            top: 8px;
            right: 8px;
            width: 24px;
            height: 24px;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: bold;
            line-height: 1;
            z-index: 1001;
            transition: all 0.2s ease;
            font-family: Arial, sans-serif;
        }
        .close-btn:hover {
            background: rgba(255, 0, 0, 0.8);
            transform: scale(1.1);
        }
        .close-btn:active {
            transform: scale(0.95);
        }
        .aiwdw.hidden {
            display: none;
        }
        .aiwdw.show {
            animation: slideIn 0.3s ease-out;
        }
        @keyframes slideIn {
            from {
                transform: translateY(100%);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }
        
        /* SP全画面表示 */
        @media (max-width: 768px) {
            /* オーバーレイ */
            .aiwdw:not(.hidden)::before {
                content: '';
                position: fixed;
                top: -100vh;
                left: -100vw;
                width: 300vw;
                height: 300vh;
                background: rgba(0, 0, 0, 0.7);
                z-index: -1;
                pointer-events: none;
            }
            
            .aiwdw {
                /* 全画面表示（5%マージン） */
                position: fixed;
                top: 12vh;
                left: 5vw;
                right: 5vw;
                bottom: 5vh;
                width: auto;
                height: auto;
                aspect-ratio: auto;
                margin: 0;
                border-radius: 1rem;
                box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
            }
            
            /* SP用の閉じるボタン調整 */
            .close-btn {
                width: 32px;
                height: 32px;
                font-size: 18px;
                top: 12px;
                right: 12px;
            }
            
            /* フェードインアニメーション */
            .aiwdw.show {
                animation: fadeInScale 0.3s ease-out;
            }
            
            @keyframes fadeInScale {
                from {
                    opacity: 0;
                    transform: scale(0.95);
                }
                to {
                    opacity: 1;
                    transform: scale(1);
                }
            }
            
            .bootbtn {
                bottom: 1.5em;
                right: 1.5em;
            }
        }
        
        @media (max-width: 480px) {
            .bootbtn {
                bottom: 1em;
                right: 1em;
            }
        }
        
        /* ナビバー考慮版（もしナビバーがある場合） */
        @media (max-width: 768px) {
            .aiwdw.with-navbar {
                top: calc(70px + 5vh); /* ナビバーの高さ50px + 5%マージン */
            }
        }

/*@media (max-height: 600px) {
    .aiwdw {
        height: calc(100vh - 2em);
        top: 1em;
        bottom: auto;
    }
}*/
@media (max-height: 600px) {
    .aiwdw {
        top: calc(70px + 1em);
        bottom: 1em;
        height: auto;
        width: 375px;
    }
}




