/* =========================================================
   AIチャット（ぬま猫）ウィジェット
   ページ表示後に ai-chat.js が読み込まれて動きます（表示速度に影響させないため）
   ========================================================= */
.kv-chat-launch{position:fixed;right:clamp(10px,2vw,28px);bottom:clamp(10px,2vw,28px);z-index:60;display:block;width:92px;height:110px;padding:0;border:0;background:none;cursor:pointer;transition:transform .3s ease,opacity .3s ease;-webkit-tap-highlight-color:transparent}
.kv-chat-launch:hover{transform:translateY(-4px) rotate(-3deg)}
.kv-chat-launch:focus-visible{outline:2px solid #7be5e9;outline-offset:4px;border-radius:12px}
.kv-chat-launch img{display:block;width:92px;height:auto;filter:drop-shadow(0 0 1px rgba(214,244,248,.85)) drop-shadow(0 0 12px rgba(42,167,240,.45));animation:kv-cat-float 3.2s ease-in-out infinite}
@keyframes kv-cat-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-5px)}}
.kv-chat-launch .kv-chat-ping{position:absolute;top:2px;left:4px;width:10px;height:10px;border-radius:50%;background:#2aa7f0;box-shadow:0 0 0 0 rgba(42,167,240,.6);animation:kv-ping 2.2s infinite}
@keyframes kv-ping{0%{box-shadow:0 0 0 0 rgba(42,167,240,.6)}70%{box-shadow:0 0 0 12px rgba(42,167,240,0)}100%{box-shadow:0 0 0 0 rgba(42,167,240,0)}}
.kv-chat-open .kv-chat-launch{transform:scale(.85);opacity:0;pointer-events:none}

.kv-chat{position:fixed;right:clamp(14px,2.4vw,32px);bottom:clamp(14px,2.4vw,32px);z-index:61;display:flex;flex-direction:column;width:min(400px,calc(100vw - 28px));height:min(620px,calc(100vh - 120px));border:1px solid rgba(123,229,233,.28);border-radius:22px;overflow:hidden;background:linear-gradient(160deg,rgba(17,30,36,.98),rgba(7,17,22,.98));box-shadow:0 30px 80px rgba(0,0,0,.5);color:#eef5f2;font-family:"Noto Sans JP",sans-serif;font-size:14px;line-height:1.8;letter-spacing:.02em;opacity:0;visibility:hidden;transform:translateY(16px) scale(.98);transform-origin:bottom right;transition:opacity .3s ease,transform .35s cubic-bezier(.2,.8,.2,1),visibility .3s}
.kv-chat-open .kv-chat{opacity:1;visibility:visible;transform:none}
.kv-chat__head{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid rgba(190,238,233,.14);background:rgba(7,17,22,.6)}
.kv-chat__avatar{display:grid;place-items:center;width:44px;height:48px;flex:none}
.kv-chat__avatar img{width:40px;height:auto;filter:drop-shadow(0 0 1px rgba(214,244,248,.8)) drop-shadow(0 0 6px rgba(42,167,240,.4))}
.kv-chat__title{margin:0;font-family:"Noto Serif JP",serif;font-size:15px;font-weight:600}
.kv-chat__sub{margin:0;font-size:10px;letter-spacing:.2em;color:#7be5e9}
.kv-chat__close{margin-left:auto;width:36px;height:36px;border:1px solid rgba(190,238,233,.2);border-radius:50%;background:transparent;color:#eef5f2;font-size:18px;line-height:1;cursor:pointer}
.kv-chat__close:hover{border-color:#7be5e9;color:#7be5e9}
.kv-chat__log{flex:1;overflow-y:auto;padding:18px 16px;display:flex;flex-direction:column;gap:12px;scroll-behavior:smooth}
.kv-msg{max-width:88%;padding:10px 14px;border-radius:16px;white-space:pre-wrap;word-break:break-word}
.kv-msg--bot{align-self:flex-start;background:rgba(123,229,233,.08);border:1px solid rgba(123,229,233,.18);border-bottom-left-radius:4px}
.kv-msg--user{align-self:flex-end;background:#17363a;border:1px solid rgba(123,229,233,.3);border-bottom-right-radius:4px}
.kv-msg--note{align-self:center;max-width:100%;padding:6px 10px;font-size:11.5px;color:#aabcb9;background:none;border:0;text-align:center}
.kv-msg a{color:#7be5e9}
.kv-sources{display:grid;gap:6px;margin-top:8px;padding-top:8px;border-top:1px dashed rgba(190,238,233,.2)}
.kv-sources a{display:block;font-size:12px;line-height:1.6;color:#a4e0bd;text-decoration:none}
.kv-sources a::before{content:"↗ ";color:#7be5e9}
.kv-typing{display:inline-flex;gap:4px}
.kv-typing i{width:6px;height:6px;border-radius:50%;background:#7be5e9;animation:kv-typing 1s infinite}
.kv-typing i:nth-child(2){animation-delay:.15s}.kv-typing i:nth-child(3){animation-delay:.3s}
@keyframes kv-typing{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}
.kv-chat__chips{display:flex;flex-wrap:wrap;gap:6px;padding:0 16px 10px}
.kv-chat__chips button{padding:5px 12px;border:1px solid rgba(123,229,233,.3);border-radius:999px;background:transparent;color:#dbe9eb;font:inherit;font-size:12px;cursor:pointer}
.kv-chat__chips button:hover{background:rgba(123,229,233,.12)}
.kv-chat__form{display:flex;gap:8px;padding:12px;border-top:1px solid rgba(190,238,233,.14);background:rgba(7,17,22,.6)}
.kv-chat__input{flex:1;min-height:44px;max-height:120px;padding:10px 12px;border:1px solid rgba(190,238,233,.22);border-radius:12px;background:rgba(0,0,0,.25);color:#eef5f2;font:inherit;resize:none}
.kv-chat__input:focus{outline:2px solid rgba(123,229,233,.5);outline-offset:0}
.kv-chat__send{flex:none;width:44px;height:44px;border:0;border-radius:12px;background:#7be5e9;color:#071116;font-size:18px;cursor:pointer}
.kv-chat__send[disabled]{opacity:.45;cursor:not-allowed}
.kv-chat__foot{margin:0;padding:0 14px 10px;font-size:10.5px;line-height:1.6;color:#738581;background:rgba(7,17,22,.6)}
.kv-chat__foot a{color:#aabcb9}
@media(max-width:600px){
  .kv-chat-launch{width:72px;height:88px}
  .kv-chat-launch img{width:72px}
  .kv-chat{right:8px;left:8px;bottom:8px;width:auto;height:calc(100dvh - 90px);border-radius:18px}
}
@media(prefers-reduced-motion:reduce){.kv-chat-launch img{animation:none}.kv-chat,.kv-chat-launch{transition:none}.kv-chat-launch .kv-chat-ping,.kv-typing i{animation:none}}
.kv-chat__chips[hidden]{display:none}
body.menu-open .kv-chat-launch{opacity:0;pointer-events:none}
