/* =====================================================================
   右下のAIチャット「経営者に聞いてみる」（valleyin.co.jp 全ページ共通）
   REACTOR 公式サイト（valleyin-jarvis/reactor-homepage の src/assets/css/site.css）の .ai-help 以下を移植。
   マークアップ: src/components/AiChat.tsx / 挙動: public/js/ai-chat.js
   色・角丸などのトークンは .ai-help の内側だけで定義し、サイトの CSS 変数とは混ぜない。
   ===================================================================== */
.ai-help, .ai-toast-host {
  --navy: #050914;
  --navy-2: #0b1428;
  --navy-3: #111d36;
  --ink: #0f1a2b;
  --ink-2: #33415a;
  --muted: #64748b;
  --line: #e4eaf3;
  --line-2: #d3dded;
  --bg-soft: #f4f7fb;
  --bg-tint: #eaf2ff;
  --primary: #0035c3;
  --primary-2: #1d5cff;
  --primary-3: #4d7fff;
  --cyan: #61cfff;
  --cyan-2: #00b4e6;
  --radius: 16px;
  --radius-l: 24px;
  --shadow-s: 0 1px 2px rgba(15, 26, 43, .04), 0 4px 14px rgba(15, 26, 43, .05);
  --shadow-l: 0 12px 40px -8px rgba(0, 53, 195, .22), 0 40px 90px -40px rgba(15, 26, 43, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  font-family: "Noto Sans JP", system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  line-height: 1.75;
  letter-spacing: normal;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt";
}
/* サイト側の共通スタイル（見出しの書体・大文字化、p の字間など）を持ち込まないための下地 */
.ai-help *, .ai-help *::before, .ai-help *::after { box-sizing: border-box; }
.ai-help [hidden] { display: none !important; }
.ai-help img, .ai-help svg { display: block; max-width: 100%; }
.ai-help img { height: auto; }
.ai-help a { color: inherit; text-decoration: none; }
.ai-help button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; margin: 0; letter-spacing: inherit; text-transform: none; }
.ai-help textarea { font: inherit; color: inherit; margin: 0; }
.ai-help p, .ai-help ul { margin: 0; padding: 0; letter-spacing: normal; color: inherit; }
/* 暗いテーマのページは p などに白文字と影を当てているので、チャットの中では打ち消す */
.ai-help, .ai-help * { text-shadow: none; }
.ai-help strong, .ai-help b, .ai-help small { font-family: inherit; text-transform: none; letter-spacing: normal; }
.ai-help .ico { flex: none; }

/* サイト側の文字色・影（body.theme-dark p, span, div… / body.theme-light p, a…）を、チャットの中では継承に戻す。
   :is(.ai-help *) で詳細度を (0,2,0) にしている。チャット自身の色指定は、すべて .ai-help から始まるので後勝ちで効く */
.ai-help :is(.ai-help *) { color: inherit; text-shadow: none; }

.ai-help {
  --ai-w: 388px;
  --ai-h: 640px;
  position: fixed; right: 20px; bottom: 20px; z-index: 9000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
  font-size: 15px;
}

/* ランチャー */
.ai-help .ai-launcher {
  display: inline-flex; align-items: center; gap: 9px;
  height: 54px; padding: 0 20px 0 16px; border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 10px 30px -8px rgba(0, 53, 195, .5), 0 2px 6px rgba(15, 26, 43, .18);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), opacity .2s;
}
.ai-help .ai-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 38px -8px rgba(0, 53, 195, .55); }
.ai-help .ai-launcher:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.ai-help .ai-launcher-ico {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .18);
}
.ai-help.is-open .ai-launcher { display: none; }

/* パネル */
.ai-help .ai-panel {
  position: relative;
  width: min(var(--ai-w), calc(100vw - 32px));
  height: min(var(--ai-h), calc(100vh - 96px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-l);
  box-shadow: var(--shadow-l);
  animation: aiIn .26s var(--ease);
}
@keyframes aiIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ai-help .ai-panel { animation: none; } }

.ai-help .ai-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 14px 14px 14px 16px;
  background: linear-gradient(135deg, var(--navy), var(--navy-3));
  color: #fff;
}
.ai-help .ai-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-2), var(--cyan-2)); color: #fff;
}
.ai-help .ai-head-text { flex: 1; min-width: 0; display: grid; }
.ai-help .ai-head-text strong { font-size: 15px; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.ai-help .ai-head-text small { font-size: 11.5px; color: rgba(255, 255, 255, .72); line-height: 1.5; }
/* 見出し「経営者に聞いてみる」の「る」だけが2行目に送られないように（2026-11-29）。
   スマホでは余白と文字を少し詰めて1行に収め（幅375px以上）、それより狭いときは <wbr> の位置（経営者に／聞いてみる）で折り返す */
@media (max-width: 480px) {
  .ai-help .ai-head { gap: 6px; padding: 12px 10px 12px 12px; }
  .ai-help .ai-head-text strong { font-size: 14px; }
}
.ai-help .ai-icon-btn {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .8); transition: background .18s, color .18s;
}
.ai-help .ai-icon-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.ai-help .ai-icon-btn[aria-pressed="true"] { background: var(--primary-2); color: #fff; }
.ai-help .ai-icon-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }

/* 会話 */
.ai-help .ai-log {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 14px 10px; display: flex; flex-direction: column; gap: 12px;
  background: #e9eff8;
}
.ai-help .ai-log:focus-visible { outline: 2px solid var(--primary-2); outline-offset: -2px; }
/* 1発言＝1行。AIは左にアイコン＋吹き出し、自分は右に吹き出しだけ（LINE と同じ並び） */
.ai-help .ai-turn { display: grid; row-gap: 5px; max-width: 100%; }
.ai-help .ai-turn.ai-assistant { grid-template-columns: 30px minmax(0, 1fr); column-gap: 8px; justify-items: start; }
.ai-help .ai-turn.ai-assistant > * { grid-column: 2; }
.ai-help .ai-turn.ai-assistant > .ai-face { grid-column: 1; grid-row: 1 / span 3; align-self: start; }
.ai-help .ai-turn.ai-user { justify-items: end; }
.ai-help .ai-face {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-2), var(--cyan-2)); color: #fff;
  box-shadow: 0 2px 6px rgba(0, 53, 195, .25);
}
.ai-help .ai-bubble {
  position: relative; max-width: 82%; padding: 10px 14px; border-radius: 18px;
  font-size: 14.5px; line-height: 1.75; word-break: break-word; overflow-wrap: anywhere;
}
/* 吹き出しのしっぽ（話し手の側の上の角） */
.ai-help .ai-bubble::before {
  content: ""; position: absolute; top: 9px; width: 10px; height: 10px;
  background: inherit; transform: rotate(45deg); border-radius: 2px;
}
.ai-help .ai-assistant .ai-bubble { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 26, 43, .08); }
.ai-help .ai-assistant .ai-bubble::before { left: -4px; }
.ai-help .ai-user .ai-bubble { background: var(--primary-2); color: #fff; white-space: pre-wrap; }
.ai-help .ai-user .ai-bubble::before { right: -4px; }
.ai-help .ai-turn.is-error .ai-bubble { background: #fff5f4; color: #8a2b20; box-shadow: inset 0 0 0 1px #f3c6c1; }
.ai-help .ai-bubble p + p, .ai-help .ai-bubble ul { margin-top: 8px; }
.ai-help .ai-bubble ul { list-style: none; display: grid; gap: 4px; }
.ai-help .ai-bubble li { padding-left: 15px; position: relative; }
.ai-help .ai-bubble li::before { content: ""; position: absolute; left: 3px; top: .72em; width: 5px; height: 5px; border-radius: 50%; background: var(--primary-3); }
.ai-help .ai-bubble a { color: var(--primary-2); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.ai-help .ai-bubble strong { font-weight: 700; }

.ai-help .ai-links { display: flex; flex-wrap: wrap; gap: 6px; max-width: 92%; }
.ai-help .ai-links a {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; color: var(--primary);
  background: var(--bg-tint); border: 1px solid #cfe0ff; border-radius: 999px; padding: 4px 11px;
  transition: background .18s, transform .18s;
}
.ai-help .ai-links a:hover { background: #dbe8ff; transform: translateY(-1px); }
.ai-help .ai-replay {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  border-radius: 999px; padding: 3px 9px; border: 1px solid transparent;
}
.ai-help .ai-replay:hover { color: var(--primary-2); border-color: var(--line-2); background: #fff; }
.ai-help .ai-replay.is-loading { opacity: .5; pointer-events: none; }

.ai-help .ai-typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.ai-help .ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary-3); animation: aiDot 1.1s infinite ease-in-out; }
.ai-help .ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-help .ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* 質問の候補 */
.ai-help .ai-suggest { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 12px; background: var(--bg-soft); }
.ai-help .ai-suggest button {
  font-size: 12.5px; font-weight: 600; text-align: left;
  background: #fff; border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 12px;
  color: var(--ink-2); transition: border-color .18s, color .18s, transform .18s;
}
.ai-help .ai-suggest button:hover { border-color: var(--primary-2); color: var(--primary); transform: translateY(-1px); }

/* 入力 */

/* リアルタイム会話中の帯 */
.ai-help .ai-call {
  --ai-level: 0;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px; padding: 12px 12px 12px 14px;
  background: linear-gradient(135deg, var(--navy), var(--navy-3)); color: #fff;
  border-radius: 16px; box-shadow: var(--shadow-s);
}
.ai-help .ai-call-orb {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9fe2ff, var(--primary-2) 55%, var(--primary) 100%);
  /* 自分の声の大きさで脈打つ */
  transform: scale(calc(1 + var(--ai-level) * .22));
  transition: transform .08s linear;
}
.ai-help .ai-call-orb i {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(97, 207, 255, .55); opacity: 0;
}
/* AIが話している間・調べている間は、外側の輪が広がる */
.ai-help[data-call="speaking"] .ai-call-orb i,
.ai-help[data-call="searching"] .ai-call-orb i,
.ai-help[data-call="thinking"] .ai-call-orb i { animation: aiRing 1.4s infinite ease-out; }
.ai-help[data-call="connecting"] .ai-call-orb { animation: aiBreath 1.2s infinite ease-in-out; }
@keyframes aiRing { from { opacity: .9; transform: scale(.9); } to { opacity: 0; transform: scale(1.5); } }
@keyframes aiBreath { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ai-help .ai-call-orb, .ai-help .ai-call-orb i { animation: none !important; transition: none; } }
.ai-help .ai-call-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ai-help .ai-call-text b { font-size: 14px; line-height: 1.4; }
.ai-help .ai-call-text small { font-size: 11px; line-height: 1.5; color: rgba(255, 255, 255, .7); }
.ai-help .ai-call-btn {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; color: #fff;
  padding: 7px 11px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .08);
}
.ai-help .ai-call-btn:hover { background: rgba(255, 255, 255, .16); }
.ai-help .ai-call-btn[aria-pressed="true"] { background: #fff; color: var(--navy); }
.ai-help .ai-call-btn.is-end { background: #d3362b; border-color: #d3362b; }
.ai-help .ai-call-btn.is-end:hover { background: #bb2d23; }
.ai-help .ai-call-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
/* 会話中のマイクボタンは「終える」ボタンとして目立たせる */
.ai-help.is-calling .ai-mic { background: #d3362b; color: #fff; animation: none; }
/* 文字起こしを待っている自分の発言 */
.ai-help .ai-turn.is-pending .ai-bubble { opacity: .55; }
/* 候補の先頭「声で会話する」 */
.ai-help .ai-suggest .ai-suggest-call {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent;
}
.ai-help .ai-suggest .ai-suggest-call:hover { color: #fff; border-color: transparent; }
@media (max-width: 640px) {
  .ai-help .ai-call { flex-wrap: wrap; }
  .ai-help .ai-call-text { flex-basis: calc(100% - 56px); }
  .ai-help .ai-call-btn { flex: 1; justify-content: center; }
}

/* 録音中の帯：声が拾えているか（バー）と、いまの状態 */
.ai-help .ai-voice {
  --ai-level: 0;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; padding: 8px 10px 8px 12px;
  background: #fdeceb; border: 1px solid #f6cfcb; border-radius: 14px;
}
.ai-help .ai-voice-bars { display: inline-flex; align-items: center; gap: 3px; height: 20px; flex: none; }
.ai-help .ai-voice-bars i {
  width: 3px; border-radius: 2px; background: #d3362b;
  /* 声の大きさ（--ai-level）に応じて伸びる。バーごとに反応の強さを変える。 */
  height: calc(4px + (var(--ai-level) * var(--k, 1)) * 16px);
  transition: height .08s linear;
}
.ai-help .ai-voice-bars i:nth-child(1), .ai-help .ai-voice-bars i:nth-child(5) { --k: .5; }
.ai-help .ai-voice-bars i:nth-child(2), .ai-help .ai-voice-bars i:nth-child(4) { --k: .8; }
.ai-help .ai-voice-text { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; color: #a3291f; }
.ai-help .ai-voice-btn {
  flex: none; font-size: 12px; font-weight: 700; color: #a3291f;
  padding: 4px 10px; border-radius: 999px; border: 1px solid #f0bdb8; background: #fff;
}
.ai-help .ai-voice-btn:hover { background: #fff5f4; }
.ai-help .ai-voice-btn.is-send { background: #d3362b; border-color: #d3362b; color: #fff; }
.ai-help .ai-voice-btn.is-send:hover { background: #bb2d23; }
/* 聞き取り中は落ち着いた色に変える */
.ai-help.is-transcribing .ai-voice { background: var(--bg-tint); border-color: #cfe0ff; }
.ai-help.is-transcribing .ai-voice-text { color: var(--primary); }
.ai-help.is-transcribing .ai-voice-bars i { background: var(--primary-3); animation: aiDot 1.1s infinite ease-in-out; }
.ai-help.is-transcribing .ai-voice-btn { display: none; }

.ai-help .ai-form { flex: none; padding: 12px 14px 14px; background: #fff; border-top: 1px solid var(--line); }
.ai-help .ai-input {
  display: flex; align-items: flex-end; gap: 6px;
  border: 1.5px solid var(--line-2); border-radius: 18px; padding: 6px 6px 6px 14px;
  transition: border-color .2s, box-shadow .2s;
}
.ai-help .ai-input:focus-within { border-color: var(--primary-2); box-shadow: 0 0 0 4px rgba(29, 92, 255, .12); }
.ai-help .ai-input textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none;
  font-size: 15px; line-height: 1.6; padding: 8px 0; max-height: 120px;
}
.ai-help .ai-mic, .ai-help .ai-send {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .18s, color .18s, transform .18s;
}
.ai-help .ai-mic { color: var(--muted); }
.ai-help .ai-mic:hover { background: var(--bg-tint); color: var(--primary); }
.ai-help .ai-mic[aria-pressed="true"] { background: #fdeceb; color: #d3362b; animation: aiPulse 1.4s infinite; }
@keyframes aiPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(211, 54, 43, .35); } 50% { box-shadow: 0 0 0 7px rgba(211, 54, 43, 0); } }
.ai-help .ai-send { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.ai-help .ai-send:hover { transform: translateY(-1px); }
.ai-help .ai-mic:disabled, .ai-help .ai-send:disabled { opacity: .45; pointer-events: none; }
.ai-help .ai-note { margin-top: 8px; font-size: 10.5px; line-height: 1.6; color: var(--muted); }
.ai-help .ai-note a { color: var(--primary-2); font-weight: 700; text-decoration: underline; }
.ai-help.is-speaking .ai-icon-btn[aria-pressed="true"] { animation: aiPulse 1.6s infinite; }
/* 大きさを変えるつまみ（左上）と、全画面 */
/* 見た目は出さず、左上の角だけをつかめるようにする。マウスを乗せるとカーソルで分かる */
.ai-help .ai-resize {
  position: absolute; left: 0; top: 0; z-index: 2;
  width: 18px; height: 18px; padding: 0;
  background: transparent; border: 0; cursor: nwse-resize; touch-action: none;
  border-top-left-radius: var(--radius-l);
}
/* キーボードで選んだときだけ、位置が分かるよう枠を出す */
.ai-help .ai-resize:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.ai-help.is-resizing { cursor: nwse-resize; }
/* つかんでいる間は、本文の選択やホバーが邪魔をしないようにする */
.ai-help.is-resizing .ai-panel { user-select: none; }
.ai-help.is-resizing .ai-log, .ai-help.is-resizing .ai-form { pointer-events: none; }

.ai-help.is-full { left: 0; right: 0; top: 0; bottom: 0; padding: 16px; align-items: stretch; }
.ai-help.is-full .ai-panel { width: 100%; height: 100%; max-width: min(1100px, 100%); margin-inline: auto; }
.ai-help.is-full .ai-resize { display: none; }
.ai-help.is-full .ai-bubble { max-width: min(68ch, 78%); }
.ai-help.is-full .ai-log { padding-inline: clamp(16px, 4vw, 48px); }
.ai-help.is-full .ai-suggest, .ai-help.is-full .ai-form { padding-inline: clamp(14px, 4vw, 48px); }


/* スマートフォン：下から立ち上がるシート */
@media (max-width: 640px) {
  .ai-help { right: 12px; bottom: 12px; left: 12px; align-items: stretch; }
  .ai-help .ai-launcher { align-self: flex-end; height: 50px; padding: 0 18px 0 14px; }
  .ai-help .ai-panel { width: 100%; height: min(78vh, calc(100vh - 80px)); border-radius: var(--radius); }
  .ai-help .ai-log { padding: 14px 12px 6px; }
  .ai-help .ai-bubble { max-width: 86%; }
  .ai-help .ai-suggest { padding: 4px 12px 10px; }
  .ai-help .ai-resize { display: none; }
  .ai-help.is-full { padding: 0; }
  .ai-help.is-full .ai-panel { border-radius: 0; }
}

/* ---------- 右下の「経営者に聞いてみる」（2026-11-16 改）
   下にボタンのバー、その上（右寄せ）に代表の切り抜きが背景に浮く。押すとAIのチャットが開く ---------- */
.ai-help .ai-launcher {
  position: relative; display: block; width: 356px; height: 216px;
  padding: 0; border-radius: 0; background: none; box-shadow: none; text-align: left;
  /* 人物の左の何もない所は、下のページを押せるようにしておく */
  pointer-events: none;
}
.ai-help .ai-launcher > * { pointer-events: auto; }
/* 外枠（.ai-help）も透明な所は素通りさせ、押せるのはバー・人物・チャット画面だけにする */
.ai-help { pointer-events: none; }
.ai-help > .ai-panel { pointer-events: auto; }
.ai-help .ai-launcher:hover { transform: none; box-shadow: none; }
.ai-help .ai-launcher:focus-visible { outline: none; }
.ai-help .ai-launcher:focus-visible .ai-launcher-bar { outline: 3px solid var(--cyan); outline-offset: 3px; }

/* 代表の切り抜き（AIモデルで背景を抜いたもの）。下端はバーの裏に隠す */
.ai-help .ai-launcher-figure { position: absolute; right: 12px; bottom: 34px; height: 182px; z-index: 0; }
.ai-help .ai-launcher-figure img {
  display: block; height: 100%; width: auto;
  filter: drop-shadow(0 10px 18px rgba(3, 8, 22, .42));
  transition: transform .25s var(--ease);
  transform-origin: 50% 100%;
}
.ai-help .ai-launcher:hover .ai-launcher-figure img { transform: translateY(-3px); }

/* ボタンのバー */
.ai-help .ai-launcher-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 10px 0 18px; border-radius: 18px; color: #fff;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-3) 58%, #0a2a7c 100%);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 18px 40px -14px rgba(5, 12, 32, .6), 0 2px 8px rgba(15, 26, 43, .22);
  transition: box-shadow .2s var(--ease);
}
.ai-help .ai-launcher:hover .ai-launcher-bar { box-shadow: 0 22px 48px -14px rgba(5, 12, 32, .68), 0 2px 8px rgba(15, 26, 43, .22); }
.ai-help .ai-launcher-who { display: grid; gap: 3px; min-width: 0; line-height: 1.25; }
.ai-help .ai-launcher-role { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; color: #8fd3ff; }
.ai-help .ai-launcher-role svg { flex: none; }
.ai-help .ai-launcher-name { font-size: 14.5px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.ai-help .ai-launcher-cta {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 44px; padding: 0 14px 0 18px; border-radius: 12px;
  font-size: 14.5px; font-weight: 800; white-space: nowrap; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 16px -6px rgba(0, 53, 195, .75), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.ai-help .ai-launcher-cta svg { flex: none; transition: transform .2s var(--ease); }
.ai-help .ai-launcher:hover .ai-launcher-cta svg { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) {
  .ai-help .ai-launcher-figure img, .ai-help .ai-launcher-cta svg { transition: none; }
}
/* パネルの見出しも顔写真に */
.ai-help .ai-avatar.is-face { padding: 0; overflow: hidden; border-radius: 50%; background: none; border: 1.5px solid rgba(255, 255, 255, .45); }
.ai-help .ai-avatar.is-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* スマートフォン（2026-11-28 改）：人物とバーが本文に重なっていたため、代表の顔の丸いボタンだけにする。
   */
@media (max-width: 640px) {
  .ai-help .ai-launcher {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 8px 22px -8px rgba(0, 53, 195, .7), 0 0 0 2px rgba(255, 255, 255, .85);
    pointer-events: auto;
  }
  .ai-help .ai-launcher-figure { inset: 0; right: auto; bottom: auto; height: auto; border-radius: 50%; overflow: hidden; }
  .ai-help .ai-launcher-figure img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 6%; filter: none; transform: none; }
  .ai-help .ai-launcher:hover .ai-launcher-figure img { transform: none; }
  .ai-help .ai-launcher-bar { display: none; }
  /* チャットだとわかる小さな印 */
  .ai-help .ai-launcher::after {
    content: "AI"; position: absolute; right: -4px; bottom: -3px;
    padding: 1px 5px; border-radius: 999px; font-size: 10px; font-weight: 800; line-height: 1.4; letter-spacing: .04em;
    color: #fff; background: var(--primary); border: 1.5px solid #fff;
  }
  .ai-help .ai-launcher:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
}

/* ---------- valleyin.co.jp に合わせた調整 ---------- */
/* 入力欄の文字色（サイトの暗いテーマの文字色を引き継がない） */
.ai-help .ai-panel { color: var(--ink); }
.ai-help .ai-input textarea { color: var(--ink); }
.ai-help .ai-input textarea::placeholder { color: #94a3b8; }
/* サイト独自の赤く光るカーソル（.cursor-follower）は、チャットの上では消す（ボタンや文字に重なって紛らわしいため） */
body:has(.ai-help:hover) .cursor-follower { opacity: 0 !important; }
/* TOP のキャンペーン告知（右下固定）はチャットと重なるので、左下へ */
body:has(.ai-help) .campaign-popup { right: auto; left: 20px; }
/* スマホではチャットが右下の丸いボタンになるので、その左までに収める */
@media (max-width: 640px) { body:has(.ai-help) .campaign-popup { left: 12px; right: 84px; max-width: none; } }

/* 通知 */
.ai-toast-host { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 9001; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.ai-toast { background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; line-height: 1.6; box-shadow: var(--shadow-l); animation: aiToastIn .3s var(--ease); }
.ai-toast.is-error { background: #b42318; }
@keyframes aiToastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media print { .ai-help, .ai-toast-host { display: none !important; } }
