/* ===== やるよAIチャット ===== */
.yaruyo-chat{
  --yaruyo-green:#710800;
  --yaruyo-green-dark:#560600;
  --yaruyo-yellow:#ffd200;
  --yaruyo-red:#e8322d;
  --yaruyo-text:#222;
  --yaruyo-line:#e5e5e5;
  position:fixed;
  left:20px;
  bottom:20px;
  z-index:9999;
  font-family:"Noto Sans JP","Noto Sans",sans-serif;
}

/* 起動ボタン */
.yaruyo-chat__launcher{
  opacity:0;
  display:flex;
  align-items:center;
  gap:6px;
  padding:12px 18px;
  border:none;
  border-radius:10px;
  cursor:pointer;
  background:var(--yaruyo-green);
  color:#fff;
  font-size:15px;
  font-weight:700;
  box-shadow:0 4px 12px rgba(0,0,0,.25);
  transition:transform .15s, background .2s, opacity 1.0s ease;
}
.yaruyo-chat__launcher:hover{
  background:var(--yaruyo-green-dark);
  transform:translateY(-2px);
}
.yaruyo-chat__launcher-icon{
  width:28px;
  height:28px;
  object-fit:contain;
  display:block;
}

/* ウィンドウ */
.yaruyo-chat__window{
  position:absolute;
  left:0;
  bottom:64px;
  width:340px;
  max-width:calc(100vw - 40px);
  height:500px;
  max-height:70vh;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:#fff;
  border-radius:14px;
  box-shadow:0 8px 30px rgba(0,0,0,.28);
}
.yaruyo-chat__window[hidden]{ display:none; }

/* ヘッダー */
.yaruyo-chat__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  background:var(--yaruyo-green);
  color:#fff;
  flex:0 0 auto;
}
.yaruyo-chat__title{ font-size:13px; font-weight:700; }
.yaruyo-chat__close{
  border:none;
  background:transparent;
  color:#fff;
  font-size:22px;
  line-height:1;
  cursor:pointer;
  padding:0 4px;
}

/* 会話エリア */
.yaruyo-chat__messages{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  padding:8px;
  background:#f7f7f7;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.yaruyo-chat__msg{
  max-width:80%;
  padding:10px 14px;
  border-radius:14px;
  font-size:14px;
  line-height:1.6;
  color:var(--yaruyo-text);
}
.yaruyo-chat__msg--bot{
  align-self:flex-start;
  background:#fff;
  border:1px solid var(--yaruyo-line);
}
.yaruyo-chat__msg--user{
  align-self:flex-end;
  background:var(--yaruyo-yellow);
}

/* 導線ボタン */
.yaruyo-chat__cta{
  display:flex;
  gap:6px;
  padding:10px 12px;
  border-top:1px solid var(--yaruyo-line);
  flex:0 0 auto;
}
.yaruyo-chat__cta-btn{
  flex:1 1 0;
  min-width:0;
  text-align:center;
  padding:8px 4px;
  border-radius:8px;
  font-size:13px;
  font-weight:700;
  text-decoration:none;
  color:#fff;
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.yaruyo-chat__cta-btn--tel{ background:var(--yaruyo-red); }
.yaruyo-chat__cta-btn--line{ background:#06c755; }
.yaruyo-chat__cta-btn--mail{ background:var(--yaruyo-green); }
.yaruyo-chat__cta-sub{ font-size:10px; font-weight:400; margin-top:2px; }

/* 入力エリア */
.yaruyo-chat__input{
  display:flex;
  gap:8px;
  padding:10px 12px;
  border-top:1px solid var(--yaruyo-line);
  flex:0 0 auto;
}
.yaruyo-chat__text{
  flex:1 1 auto;
  min-width:0;
  padding:10px 12px;
  border:1px solid var(--yaruyo-line);
  border-radius:8px;
  font-size:16px;
  outline:none;
}
.yaruyo-chat__text:focus{ border-color:var(--yaruyo-green); }
.yaruyo-chat__send{
  flex:0 0 auto;
  padding:0 16px;
  border:none;
  border-radius:8px;
  cursor:pointer;
  background:var(--yaruyo-green);
  color:#fff;
  font-size:14px;
  font-weight:700;
}

/* ===== スマホ：全画面・JSの高さでピッタリ合わせる ===== */
@media (max-width:1024px){
  .yaruyo-chat{ left:10px; bottom:135px; }

  .yaruyo-chat__window{
    position:fixed;
    left:0;
    top:var(--yaruyo-top, 0px);        /* 見える範囲の上端に貼り付け */
    width:100vw;
    max-width:100vw;
    height:calc(var(--yaruyo-vh, 1vh) * 100);
    max-height:none;
    border-radius:0;
    z-index:100000;
  }

  .yaruyo-chat__input{
    padding-bottom:calc(10px + env(safe-area-inset-bottom));
  }
}

/* サイトと同じフォントを確実に適用 */
.yaruyo-chat,
.yaruyo-chat__title,
.yaruyo-chat__msg,
.yaruyo-chat__cta-btn,
.yaruyo-chat__text,
.yaruyo-chat__send,
.yaruyo-chat__launcher-label{
  font-family:"Noto Sans JP","Noto Sans",sans-serif !important;
}
/* 写真ボタン */
.yaruyo-chat__photo{
  flex:0 0 auto;
  display:flex; align-items:center; justify-content:center;
  width:42px; border:1px solid var(--yaruyo-line); border-radius:8px;
  cursor:pointer; font-size:20px; background:#fff;
}
.yaruyo-chat__photo:hover{ background:#f2f2f2; }

/* 選んだ写真のプレビュー（送信前に小さく表示） */
.yaruyo-chat__preview{
  display:flex; align-items:center; gap:8px;
  padding:6px 12px; border-top:1px solid var(--yaruyo-line);
  font-size:12px; color:#666;
}
.yaruyo-chat__preview img{ width:40px; height:40px; object-fit:cover; border-radius:6px; }
.yaruyo-chat__preview button{
  margin-left:auto; border:none; background:transparent; color:#e8322d;
  cursor:pointer; font-size:12px;
}

/* 会話内に表示する送信済み写真 */
.yaruyo-chat__msg img{
  max-width:160px; border-radius:8px; display:block; margin-top:4px;
}

/* 申し込みボタン */
/* §27 申し込みボタン＝チャットの主CTA（パネル幅いっぱい・高さ52px・ブランド色・アイコン左） */
.yaruyo-chat__apply{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  width:100%;
  min-height:52px;
  padding:12px 44px 12px 16px;
  border:none;
  border-radius:12px;
  background:#ff2400;
  color:#fff;
  font-size:16.5px;
  font-weight:700;
  letter-spacing:.04em;
  line-height:1.3;
  cursor:pointer;
  box-shadow:0 6px 16px rgba(255,36,0,.30), 0 2px 4px rgba(0,0,0,.12);
  transition:background .2s, transform .1s, box-shadow .2s;
}
.yaruyo-chat__apply::before{
  content:"\2709\FE0E";
  font-size:19px;
  line-height:1;
}
.yaruyo-chat__apply::after{
  content:"›";
  position:absolute;
  right:16px;
  top:50%;
  transform:translateY(-52%);
  font-size:24px;
  line-height:1;
}
.yaruyo-chat__apply:hover{ background:#d91e00; transform:translateY(-1px); box-shadow:0 8px 20px rgba(255,36,0,.36), 0 2px 4px rgba(0,0,0,.14); }
.yaruyo-chat__apply:focus-visible{ outline:3px solid rgba(255,36,0,.45); outline-offset:2px; }
.yaruyo-chat__apply:disabled{ opacity:.6; cursor:default; transform:none; }
.yaruyo-chat__apply-wrap{
  padding:6px 0 10px;
  opacity:0;
  transform:translateY(6px);
  transition:opacity .25s, transform .25s;
}
.yaruyo-chat__apply-wrap.is-in{ opacity:1; transform:none; }
@media (max-width:1024px){
  /* móvil: fijo en la parte baja del panel mientras la ボタン esté activa */
  .yaruyo-chat__apply-wrap{
    position:sticky;
    bottom:0;
    z-index:2;
    margin:0 -8px -8px;
    padding:10px 8px 12px;
    background:linear-gradient(rgba(247,247,247,0), #f7f7f7 30%);
  }
}

/* ===== アイコン付きメッセージ（アイコン左・吹き出し右） ===== */
.yaruyo-chat__row{
  display:flex;
  align-items:flex-start;
  gap:5px;
  margin-bottom:10px;
  max-width:88%;
}
.yaruyo-chat__row--bot{
  flex-direction:row;          /* アイコン左 → 吹き出し右 */
  margin-right:auto;
}
.yaruyo-chat__row--user{
  flex-direction:row-reverse;  /* お客様は逆（アイコン右） */
  margin-left:auto;
}

/* アイコン */
.yaruyo-chat__icon{
  width:30px; height:30px;
  object-fit:contain;
  flex:0 0 auto;
}

/* 吹き出し */
.yaruyo-chat__row .yaruyo-chat__msg{
  position:relative;
  align-self:auto;
  max-width:100%;
}

/* チョン（しっぽ）：AI＝吹き出しの左、枠線付き */
.yaruyo-chat__row--bot .yaruyo-chat__msg::before{
  content:"";
  position:absolute;
  left:-8px; top:14px;
  width:0; height:0;
  border-style:solid;
  border-width:6px 8px 6px 0;
  border-color:transparent #e5e5e5 transparent transparent; /* 枠線色 */
}
.yaruyo-chat__row--bot .yaruyo-chat__msg::after{
  content:"";
  position:absolute;
  left:-6px; top:15px;
  width:0; height:0;
  border-style:solid;
  border-width:5px 7px 5px 0;
  border-color:transparent #fff transparent transparent; /* 背景色 */
}

/* チョン（しっぽ）：お客様＝吹き出しの右 */
.yaruyo-chat__row--user .yaruyo-chat__msg::before{
  content:"";
  position:absolute;
  right:-8px; top:14px;
  width:0; height:0;
  border-style:solid;
  border-width:6px 0 6px 8px;
  border-color:transparent transparent transparent #ffd200; /* 背景色 */
}
/* 申し込み完了の表示 */
.yaruyo-chat__applied{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  width:100%;
  padding:14px 18px;
  border-radius:10px;
  background:#3aae4a;        /* 完了＝緑で安心感 */
  color:#fff;
  font-size:15px;
  font-weight:700;
}
/* フローティングバナー内 AI相談窓口ボタン */
.floating-banner__ai{
  position:relative;
  display:flex;
  align-items:center;
  gap:12px;
  background:#72D777;
  border-radius:12px;
  padding:14px 16px;
  margin:10px 0;
  text-decoration:none;
  overflow:hidden;
  transition: background 1s ease;
}
.floating-banner__ai-face{
  width:36px;
  height:36px;
  object-fit:contain;
  flex:0 0 auto;
}
.floating-banner__ai-body{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.floating-banner__ai-title{
  font-family:"Noto Sans", sans-serif;
  font-weight:700;
  font-size:20px;
  letter-spacing:0.15em;   /* 文字間隔15% */
  color:#710800;
  line-height:1.2;
}
.floating-banner__ai-sub{
  font-family:"Noto Sans", sans-serif;
  font-weight:700;
  font-size:10px;
  letter-spacing:0.10em;   /* 文字間隔10% */
  color:#01461E;
  line-height:1.2;
}
.floating-banner__ai:hover{
  background:#4CAF50;   /* 濃いみどり */
}
/* NEWバッジ（右上・斜め） */
.floating-banner__ai-new{
  position:absolute;
  top:0;
  right:0;
  width:54px;
  height:54px;
  pointer-events:none;
}
.floating-banner__ai-new img{
  width:100%;
  height:100%;
  display:block;
}
@media (min-width:1025px){
  .yaruyo-chat__launcher{
    display:none !important;
  }
}
@media (min-width:1025px){
  .yaruyo-chat__window{
    position:fixed;
    left:auto;
    right:50px;
    top:50%;
    bottom:auto;
    transform:translateY(-50%);
    width:280px;
    max-width:280px;
    height:450px;
    max-height:80vh;
    border-radius:20px;
    z-index:100000;
  }
}
/* ヘッダー内の日時 */
.yaruyo-chat__datetime{
  font-size:10px;
  font-weight:400;
  color:rgba(255,255,255,0.85);
  margin-left:auto;
  margin-right:0px;
  white-space:nowrap;
}

/* 会話の最初のLINE風・日時ラベル */
.yaruyo-chat__datestamp{
  align-self:center;
  margin:4px auto 10px;
  padding:3px 12px;
  background:rgba(0,0,0,0.08);
  border-radius:12px;
  font-size:9px;
  color:#666;
  white-space:nowrap;
}
/* ヘッダー日時のコロンを1秒周期で点滅 */
.yaruyo-chat__colon{
  animation:yaruyoBlink 1s step-start infinite;
}
@keyframes yaruyoBlink{
  0%, 50%   { opacity:1; }   /* 点灯0.5秒 */
  50.01%, 100% { opacity:0; } /* 消灯0.5秒 */
}

/* ==========================================================================
   §39 · Botón 「この内容で申し込む」
   El icono era el glifo de texto "\2709\FE0E": en los móviles cuyo sistema no
   trae ese carácter salía una caja (la "X" que se veía). Pasa a un SVG de sobre
   con mask, tamaño fijo y flex:0 0 auto para que el flex no lo comprima.
   Rojo #ff2400 con texto blanco en las dos webs (también en ihin).
   ========================================================================== */
.yaruyo-chat__apply {
    min-height: 60px;
    font-size: 18px;
    font-weight: 700;
    gap: 10px;
    background: #ff2400;
    color: #fff;
}

.yaruyo-chat__apply::before {
    content: "";
    flex: 0 0 auto;
    width: 23px;
    height: 23px;
    font-size: 0;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.5 4h15A2.5 2.5 0 0 1 22 6.5v11a2.5 2.5 0 0 1-2.5 2.5h-15A2.5 2.5 0 0 1 2 17.5v-11A2.5 2.5 0 0 1 4.5 4Zm.6 2 6.9 5.4L18.9 6H5.1ZM20 7.7l-7.4 5.8a1 1 0 0 1-1.2 0L4 7.7v9.8c0 .3.2.5.5.5h15c.3 0 .5-.2.5-.5V7.7Z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.5 4h15A2.5 2.5 0 0 1 22 6.5v11a2.5 2.5 0 0 1-2.5 2.5h-15A2.5 2.5 0 0 1 2 17.5v-11A2.5 2.5 0 0 1 4.5 4Zm.6 2 6.9 5.4L18.9 6H5.1ZM20 7.7l-7.4 5.8a1 1 0 0 1-1.2 0L4 7.7v9.8c0 .3.2.5.5.5h15c.3 0 .5-.2.5-.5V7.7Z'/%3E%3C/svg%3E") no-repeat center / contain;
}

.yaruyo-chat__apply:hover {
    background: #d91e00;
    opacity: 1;
}

.yaruyo-chat__apply:disabled {
    background: #ff2400;
    opacity: .6;
}

@media (max-width: 960px) {
    .yaruyo-chat__apply {
        min-height: 56px;
        font-size: 17px;
    }

    .yaruyo-chat__apply::before {
        width: 22px;
        height: 22px;
    }
}
