/* 右下の目次とサイト内チャット（e-assist.js）。docs/ASSIST.md
   - 丸ボタン: PC は右下 20px。768px 以下は画面下の相談の帯（.e-bar 高さ56px＋下8px）の上に置く。帯の無いページ（html.ea-nobar）は下 16px
     フッターが見えてきたら --ea-lift だけ持ち上げて、フッターの上端より上に置く（フッターの文字に重ねない）
   - パネル: 673px 以上は丸ボタンの左に浮かぶ窓。672px 以下は下から出る全幅のシート
   - 濃い地（.e-deep）の上でも見えるように、目次は白地＋青の縁、チャットは青の面＋白の縁
   - 色帯・ホバー専用の操作は使わない。タップできるものはすべて 44px 以上
   - 丸の大きさは --ea-fab の1か所で決め、パネルの位置もそこから出す（2026-11-03 PC 58・スマホ 54 → どちらも 64。
     「チャット」の4文字が丸の下の狭い所で縁にかかっていた＝文字の下端の高さで円の内側の幅 34.7px に対し文字 44px。
     インクの範囲で測った縁までのすき間: 54px で -2 前後 → 60px で 2.2px（まだ窮屈）→ 64px で 4.2px） */
:root { --ea-fab: 64px; }
.ea-fabs {
  position: fixed; right: 20px; bottom: calc(20px + var(--ea-lift, 0px)); z-index: 95;   /* --ea-lift: フッターが見えたら持ち上げる量（e-assist.js） */
  display: flex; flex-direction: column; gap: 10px;
  transition: opacity .25s ease, transform .25s ease, visibility 0s linear 0s;
}
.ea-fabs[data-on="0"] { opacity: 0; transform: translateY(12px); visibility: hidden; pointer-events: none; transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s; }
.ea-fab {
  -webkit-appearance: none; appearance: none; margin: 0;
  width: var(--ea-fab); height: var(--ea-fab); border-radius: 50%; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-family: var(--font-jp, 'Zen Kaku Gothic New', 'Hiragino Sans', 'Yu Gothic', sans-serif); font-weight: 700; font-size: 11px; line-height: 1; letter-spacing: 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 12px 26px -12px rgba(16, 30, 90, .6), 0 0 0 1px rgba(16, 30, 90, .08);
  transition: transform .2s ease, box-shadow .2s ease;
}
.ea-fab[hidden] { display: none; }
.ea-fab svg { display: block; flex: none; width: 20px; height: 20px; }
.ea-fab--toc { background: #fff; color: #1F57D6; border: 2px solid #2A6FF5; }
.ea-fab--chat { background: linear-gradient(135deg, #0B6FD8 0%, #2A55E6 50%, #6A3FE8 100%); color: #fff; border: 2px solid #fff; }
.ea-fab[aria-expanded="true"] { box-shadow: 0 0 0 4px rgba(42, 111, 245, .28), 0 12px 26px -12px rgba(16, 30, 90, .6); }
.ea-fab:focus-visible { outline: 3px solid #141B38; outline-offset: 3px; box-shadow: 0 0 0 3px #fff, 0 12px 26px -12px rgba(16, 30, 90, .6); }   /* 白い輪で、濃い地の上でもフォーカスが見える */
@media (hover: hover) and (pointer: fine) {
  .ea-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -12px rgba(16, 30, 90, .65), 0 0 0 1px rgba(16, 30, 90, .08); }
}
/* 指・マウスで閉じて丸ボタンへ焦点を戻したとき（e-assist.js が印 data-e-quiet を付ける）は、輪も白い縁も出さない
   （2026-11-28 輪〔outline〕だけ消すと、focus() の focusVisible:false を読まない Safari で、↓ を押したあとに白い 3px の縁が残った） */
.ea-fab[data-e-quiet]:focus-visible { outline: none; box-shadow: 0 12px 26px -12px rgba(16, 30, 90, .6), 0 0 0 1px rgba(16, 30, 90, .08); }
@media (hover: hover) and (pointer: fine) {
  .ea-fab[data-e-quiet]:focus-visible:hover { box-shadow: 0 16px 30px -12px rgba(16, 30, 90, .65), 0 0 0 1px rgba(16, 30, 90, .08); }
}
@media (max-width: 768px) {
  .ea-fabs { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px) + var(--ea-lift, 0px)); gap: 8px; }
  .ea-nobar .ea-fabs { bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--ea-lift, 0px)); }
}

/* ---------- 背景とパネル ---------- */
.ea-scrim { position: fixed; inset: 0; z-index: 290; background: rgba(12, 22, 64, .26); animation: ea-fade .2s ease both; }
.ea-scrim[hidden], .ea-panel[hidden] { display: none; }
.ea-panel {
  position: fixed; z-index: 291; right: calc(20px + var(--ea-fab) + 18px); bottom: 20px;   /* 丸ボタンの左に 18px 空けて浮かぶ */
  width: min(420px, calc(100vw - 62px - var(--ea-fab)));
  max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
  display: flex; flex-direction: column;
  background: #fff; color: #141B38;
  border-radius: 24px; overflow: hidden;
  box-shadow: 0 30px 60px -24px rgba(16, 30, 90, .5), 0 0 0 1px rgba(42, 111, 245, .16);
  font-family: var(--font-jp, 'Zen Kaku Gothic New', 'Hiragino Sans', 'Yu Gothic', sans-serif);
  font-size: 15px; line-height: 1.7; text-align: left;
  word-break: auto-phrase; overflow-wrap: break-word; line-break: strict;
  animation: ea-in .22s cubic-bezier(.22, .61, .36, 1) both;
}
.ea-chat { height: min(680px, calc(100vh - 40px)); height: min(680px, calc(100dvh - 40px)); }
.ea-panel *, .ea-panel *::before, .ea-panel *::after { box-sizing: border-box; }
.ea-panel button, .ea-panel input { font: inherit; color: inherit; }
@media (max-width: 768px) {
  .ea-panel { right: calc(12px + var(--ea-fab) + 18px); bottom: 16px; width: min(420px, calc(100vw - 50px - var(--ea-fab))); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
  .ea-chat { height: min(680px, calc(100vh - 32px)); height: min(680px, calc(100dvh - 32px)); }
}
@media (max-width: 672px) {
  .ea-panel {
    left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 88vh; max-height: 88dvh;
    border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation-name: ea-up;
  }
  .ea-chat { height: 88vh; height: 88dvh; }
}
.ea-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 20px; border-bottom: 1px solid rgba(42, 111, 245, .14); }
.ea-h { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.4; color: #141B38; }
.ea-x { -webkit-appearance: none; appearance: none; flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: #EEF5FF; color: #1F57D6; cursor: pointer; }
.ea-x:focus-visible, .ea-chip:focus-visible, .ea-send:focus-visible, .ea-toc-a:focus-visible, .ea-card:focus-visible, .ea-cta:focus-visible, .ea-prices a:focus-visible { outline: 3px solid #1F57D6; outline-offset: 2px; }
.ea-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 目次 ---------- */
.ea-toc-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; overscroll-behavior: contain; }
.ea-toc-a { display: flex; align-items: baseline; gap: 12px; min-height: 44px; padding: 10px 12px; border-radius: 14px; color: #3A4466; font-size: 15px; line-height: 1.55; text-decoration: none; }
.ea-toc-n { flex: none; min-width: 1.7em; font-family: var(--font-en, 'Manrope', sans-serif); font-weight: 700; font-size: 12px; color: #56607F; }
.ea-toc-t { flex: 1 1 auto; min-width: 0; }
.ea-toc-a[aria-current] { background: #EEF5FF; color: #1F57D6; font-weight: 700; }
.ea-toc-a[aria-current] .ea-toc-n { color: #1F57D6; }
.ea-toc-a[aria-current]::after { content: '表示中'; flex: none; align-self: center; padding: 2px 8px; border-radius: 999px; background: #1F57D6; color: #fff; font-size: 11px; font-weight: 700; line-height: 1.6; }
@media (hover: hover) and (pointer: fine) { .ea-toc-a:hover { background: #F4F7FF; color: #1F57D6; } }

/* ---------- チャット ---------- */
.ea-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 14px; outline: 0; }
.ea-msg p { margin: 0; }
.ea-msg p + p, .ea-msg p + .ea-chips { margin-top: 8px; }
.ea-msg--me { align-self: flex-end; max-width: 86%; padding: 10px 14px; border-radius: 18px 18px 4px 18px; background: linear-gradient(135deg, #0B6FD8 0%, #2A55E6 60%, #6A3FE8 100%); color: #fff; }
.ea-msg--bot { align-self: stretch; padding: 14px; border-radius: 18px 18px 18px 4px; background: #F4F7FF; color: #141B38; }
.ea-wait { color: #56607F; }
.ea-sub { margin-top: 14px !important; font-size: 13px; font-weight: 700; color: #56607F; }
.ea-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ea-chip { -webkit-appearance: none; appearance: none; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid rgba(42, 111, 245, .45); background: #fff; color: #1F57D6; font-weight: 700; font-size: 14px; line-height: 1.4; cursor: pointer; text-align: left; }
@media (hover: hover) and (pointer: fine) { .ea-chip:hover { background: #EEF5FF; } }
.ea-card { display: block; margin-top: 10px; padding: 14px 16px; border-radius: 16px; background: #fff; border: 1px solid rgba(42, 111, 245, .2); color: inherit; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .ea-card:hover { border-color: rgba(42, 111, 245, .55); } }
.ea-card-k { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12px; font-weight: 700; line-height: 1.5; color: #56607F; }
.ea-card-sec { font-weight: 500; }
.ea-tag { padding: 1px 8px; border-radius: 999px; background: #EEF5FF; color: #1F57D6; }
.ea-card-t { display: block; margin-top: 6px; font-size: 15px; font-weight: 700; line-height: 1.55; color: #141B38; }
.ea-card-x { display: block; margin-top: 4px; font-size: 14px; line-height: 1.75; color: #3A4466; }
.ea-card-x mark { background: rgba(42, 111, 245, .15); color: inherit; border-radius: 3px; padding: 0 1px; }
.ea-card-go { display: block; margin-top: 8px; font-size: 13px; font-weight: 700; color: #1F57D6; }
.ea-prices { list-style: none; margin: 10px 0 0; padding: 0; border-radius: 16px; overflow: hidden; background: #fff; border: 1px solid rgba(42, 111, 245, .2); }
.ea-prices li + li { border-top: 1px solid rgba(42, 111, 245, .14); }
.ea-prices a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; min-height: 44px; padding: 11px 14px; color: inherit; text-decoration: none; }
.ea-price-l { flex: 1 1 11em; min-width: 0; font-size: 14px; font-weight: 700; line-height: 1.5; color: #141B38; }
.ea-price-l small { display: block; font-size: 12px; font-weight: 500; color: #56607F; }
.ea-price-v { flex: 0 1 auto; margin-left: auto; font-size: 15px; font-weight: 700; color: #1F57D6; text-align: right; }
.ea-price-p { flex: 1 0 100%; font-size: 12px; line-height: 1.5; color: #56607F; }
.ea-more { display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; font-size: 14px; font-weight: 700; color: #1F57D6; text-decoration: none; }
.ea-more:focus-visible { outline: 3px solid #1F57D6; outline-offset: 2px; }
.ea-cta { display: inline-flex; align-items: center; min-height: 44px; margin-top: 10px; padding: 10px 20px; border-radius: 999px; background: linear-gradient(135deg, #0B6FD8 0%, #2A55E6 50%, #6A3FE8 100%); color: #fff; font-weight: 700; text-decoration: none; }
.ea-form { flex: none; display: flex; gap: 8px; padding: 12px 12px 6px; border-top: 1px solid rgba(42, 111, 245, .14); background: #fff; }
.ea-input { flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 0 16px; border-radius: 999px; border: 1.5px solid rgba(42, 111, 245, .38); background: #fff; font-size: 16px; line-height: 1.4; }
.ea-input::placeholder { color: #6B7594; }
.ea-input:focus { outline: 0; border-color: #1F57D6; box-shadow: 0 0 0 3px rgba(42, 111, 245, .22); }
.ea-send { -webkit-appearance: none; appearance: none; flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; background: linear-gradient(135deg, #0B6FD8 0%, #2A55E6 50%, #6A3FE8 100%); color: #fff; cursor: pointer; }
.ea-note { flex: none; margin: 0; padding: 4px 16px 12px; background: #fff; font-size: 12px; line-height: 1.6; color: #56607F; }

@keyframes ea-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes ea-up { from { opacity: .4; transform: translateY(32px); } to { opacity: 1; transform: none; } }
@keyframes ea-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .ea-fabs, .ea-fab, .ea-panel, .ea-scrim { transition: none !important; animation: none !important; }
  .ea-fabs[data-on="0"] { transform: none; }
}
@media print { .ea-fabs, .ea-scrim, .ea-panel { display: none !important; } }
