/*
 * AI案内 段1（func-ai-guide.php が読み込む）。2026-10-02・判断台帳 R-210
 * 🔴 ここ以外の部品に効かせない。セレクタは必ず #eg48-ag / #eg48-ag-panel から始める。
 *    例外は1つだけ: スマホで「トップへ戻る」(#goto_top) を隠す（白くまの↑に役目を移す・社長ご決定 案A）。
 *    このCSSは AI案内を出すページでしか読み込まれないので、出さないページの #goto_top はそのまま。
 * 位置: PC は「トップへ戻る」(#goto_top: right 5% / bottom 5% / 70x70・theme-child.css) と同じ列の真上に12pxあけて置く。
 *       スマホは「トップへ戻る」の位置そのものに置く。#goto_top の位置を変えたら、ここの right と bottom も合わせる。
 */
/* HTML 側で display:none にしてある（このCSSが届く前に見た目なしで出ないため）。ここで出す */
#eg48-ag{display:block !important;position:fixed;right:5%;bottom:calc(5% + 82px);width:70px;height:70px;z-index:10000}
#eg48-ag .rb-fab{display:block;width:70px;height:70px;padding:0;border-radius:50%;border:2px solid #1a8fd1;box-sizing:border-box;cursor:pointer;
  background:#fff var(--rb-icon) center/104% no-repeat;box-shadow:0 3px 10px rgba(0,0,0,.25);
  animation:eg48-rb-puru 4s ease-in-out infinite;transform-origin:50% 90%}
@keyframes eg48-rb-puru{0%,78%,100%{transform:scale(1,1)}83%{transform:scale(1.08,.92)}88%{transform:scale(.95,1.06)}93%{transform:scale(1.03,.97)}}

/* スマホの「↑」: 白くまの真上に小さく重ねる。少し下へ動いた後だけ出す（JS が .rb-scrolled を付ける）。PC では出さない */
#eg48-ag .rb-up{display:none;position:absolute;right:17px;bottom:62px;width:36px;height:36px;border-radius:50%;border:0;padding:0;
  background:#2bb3a3;color:#fff;font:bold 18px/36px sans-serif;text-align:center;box-shadow:0 2px 6px rgba(0,0,0,.25);cursor:pointer;z-index:1}
#eg48-ag .rb-up::before{content:"";position:absolute;inset:-6px}
@media (max-width:767px){
  #goto_top{display:none !important}
  #eg48-ag{bottom:5%}
  #eg48-ag.rb-scrolled .rb-up{display:block}
}

/* 吹き出し: 「…」のもにょもにょ。10秒ごとに文字が開く（1ページ2回まで・✕で30日止める＝JS） */
#eg48-ag .rb-say{position:absolute;right:58px;bottom:52px;background:#fff;border:1.5px solid #1a8fd1;border-radius:14px 14px 4px 14px;
  box-shadow:0 2px 6px rgba(0,0,0,.18);height:30px;display:flex;align-items:center;overflow:hidden;white-space:nowrap;
  font:bold 13px/1 sans-serif;color:#1a8fd1;padding:0 10px;box-sizing:border-box}
#eg48-ag .rb-dots{display:flex;gap:4px}
#eg48-ag .rb-dots i{display:block;width:7px;height:7px;border-radius:50%;background:#1a8fd1;animation:eg48-rb-dot 1.2s ease-in-out infinite}
#eg48-ag .rb-dots i:nth-child(2){animation-delay:.15s}
#eg48-ag .rb-dots i:nth-child(3){animation-delay:.3s}
@keyframes eg48-rb-dot{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-5px);opacity:1}}
#eg48-ag .rb-txt{display:block;max-width:0;opacity:0;overflow:hidden;animation:eg48-rb-txt 10s ease-in-out infinite}
@keyframes eg48-rb-txt{0%,55%{max-width:0;opacity:0;margin-left:0}62%,92%{max-width:170px;opacity:1;margin-left:6px}100%{max-width:0;opacity:0;margin-left:0}}
/* ✕は見た目20px・押せる範囲は周りに広げる（::before） */
#eg48-ag .rb-x{position:relative;flex:none;width:20px;height:20px;border-radius:50%;border:0;padding:0;background:#888;color:#fff;
  font:bold 11px/20px sans-serif;text-align:center;cursor:pointer;opacity:0;max-width:0;margin-left:0;overflow:visible;pointer-events:none;
  animation:eg48-rb-xshow 10s ease-in-out infinite}
#eg48-ag .rb-x::before{content:"";position:absolute;inset:-8px}
@keyframes eg48-rb-xshow{0%,58%{opacity:0;max-width:0;margin-left:0;pointer-events:none}63%,90%{opacity:1;max-width:20px;margin-left:8px;pointer-events:auto}95%,100%{opacity:0;max-width:0;margin-left:0;pointer-events:none}}
#eg48-ag.rb-quiet .rb-txt,#eg48-ag.rb-quiet .rb-x{animation:none;max-width:0;opacity:0;margin-left:0;pointer-events:none}
@media (prefers-reduced-motion:reduce){
  #eg48-ag .rb-fab,#eg48-ag .rb-dots i,#eg48-ag .rb-txt,#eg48-ag .rb-x{animation:none}
  #eg48-ag .rb-txt{max-width:none;opacity:1;margin-left:6px}
  #eg48-ag .rb-x{opacity:1;max-width:20px;margin-left:8px;pointer-events:auto}
}

/* 会話の画面: スマホは全画面・PCは右下の窓 */
#eg48-ag-panel[hidden]{display:none}
#eg48-ag-panel{position:fixed;inset:0;z-index:100000;background:#eef5fa;color:#222;font-size:14px;line-height:1.5;display:flex;flex-direction:column}
@media (min-width:768px){
  #eg48-ag-panel{inset:auto 24px 24px auto;width:380px;height:min(640px,calc(100vh - 48px));border-radius:14px;overflow:hidden;box-shadow:0 8px 30px rgba(0,0,0,.3)}
}
#eg48-ag-panel .ag-top{display:flex;align-items:center;gap:8px;background:#1a8fd1;color:#fff;padding:10px 14px;font-size:15px;flex:none}
#eg48-ag-panel .ag-face{display:block;flex:none;width:34px;height:34px;border-radius:50%;background:#fff var(--rb-icon) center/104% no-repeat;border:1px solid #cde}
#eg48-ag-panel .ag-close{margin-left:auto;background:none;border:0;color:#fff;font-size:20px;line-height:1;padding:6px;cursor:pointer}
#eg48-ag-panel .ag-log{position:relative;flex:1;overflow:auto;padding:12px;overscroll-behavior:contain}
#eg48-ag-panel .ag-b{display:flex;gap:8px;align-items:flex-start;margin-bottom:10px}
#eg48-ag-panel .ag-b .ag-face{width:40px;height:40px}
#eg48-ag-panel .ag-bb{background:#fff;border-radius:4px 14px 14px 14px;padding:10px 12px;max-width:80%;box-shadow:0 1px 2px rgba(0,0,0,.08)}
#eg48-ag-panel .ag-m{display:flex;justify-content:flex-end;margin-bottom:10px}
#eg48-ag-panel .ag-mb{background:#1a8fd1;color:#fff;border-radius:14px 4px 14px 14px;padding:9px 12px;font-weight:bold}
#eg48-ag-panel .ag-choices{display:flex;flex-wrap:wrap;gap:7px;padding-left:48px;margin-bottom:12px}
#eg48-ag-panel .ag-choices button{background:#fff;border:1.5px solid #1a8fd1;color:#1a8fd1;border-radius:18px;padding:8px 12px;font-size:13.5px;font-weight:bold;line-height:1.3;cursor:pointer}
#eg48-ag-panel .ag-choices button small{display:block;font-size:11px;font-weight:normal;color:#666;margin-top:2px}
#eg48-ag-panel .ag-choices button.ag-big{min-width:110px;padding:12px 20px;font-size:16px;border-radius:22px}
/* 「分からない・その他」は目立たせる（後で写真の相談の入口になる） */
#eg48-ag-panel .ag-choices button.ag-unk{background:#fff7e6;border-color:#f08c1e;color:#c46a00}
#eg48-ag-panel .ag-region,#eg48-ag-panel .ag-group{display:flex;flex-wrap:wrap;gap:6px;width:100%}
#eg48-ag-panel .ag-region-name{width:100%;font-size:12px;color:#555;font-weight:bold;margin-top:4px}
#eg48-ag-panel .ag-go{display:block;text-decoration:none;text-align:center;font-weight:bold;border-radius:10px;padding:11px;margin-top:8px}
#eg48-ag-panel .ag-go-a{border:1px solid #1a8fd1;color:#1a8fd1;background:#fff}
#eg48-ag-panel .ag-go-sub{color:#1a8fd1;font-weight:normal;font-size:13px;padding:6px 0 0}
#eg48-ag-panel .ag-note{display:block;font-size:13px;color:#555;margin-top:8px}
/* 下の帯: いつでも「ひとつ戻る」「はじめから」 */
#eg48-ag-panel .ag-foot{flex:none;display:flex;gap:8px;padding:8px 12px calc(8px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid #d6e6f2}
#eg48-ag-panel .ag-foot button{flex:1;background:#fff;border:1.5px solid #1a8fd1;color:#1a8fd1;border-radius:18px;padding:9px;font-weight:bold;font-size:14px;cursor:pointer}
#eg48-ag-panel .ag-foot button:disabled{opacity:.4;cursor:default}
html.eg48-ag-open,html.eg48-ag-open body{overflow:hidden}
@media (min-width:768px){html.eg48-ag-open,html.eg48-ag-open body{overflow:auto}}
