@charset "UTF-8";
/* ============================================================================
   AI学習相談Bot
   ----------------------------------------------------------------------------
   色は css/ds/tokens.css の変数を参照する。トークンが無い画面でも壊れないよう
   var() には既定値を添えてある。
   固定UIの先客: .footer-nav-mobile-new（bottom:0 / z-index:1000 / 768px以下）
   → モバイルでは起動ボタンをその上へ逃がす。
   ========================================================================= */

#p1p-chatbot {
  --cb-navy: var(--navy-700, #043f6d);
  --cb-navy-dark: var(--navy-800, #03314f);
  --cb-sky: var(--sky-500, #46a2da);
  --cb-sky-50: var(--sky-50, #f2f8fc);
  --cb-pink: var(--pink-500, #eb4878);
  --cb-pink-dark: var(--pink-600, #d82d60);
  --cb-line: rgba(4, 63, 109, 0.12);
  --cb-ink: #1f2a33;
  --cb-muted: #5a6b78;
  --cb-radius: 14px;
  --cb-shadow: 0 18px 48px rgba(4, 63, 109, 0.22);

  font-family: inherit;
}

/* 置く先のページによって既定が変わるので、この中だけは自分で決める。
   content-box のままだと min-height に padding が乗って入力欄が1行ぶん高くなる。 */
#p1p-chatbot,
#p1p-chatbot *,
#p1p-chatbot *::before,
#p1p-chatbot *::after {
  box-sizing: border-box;
}

.p1pcb-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── 起動ボタン ───────────────────────────────────────────────── */

.p1pcb-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 文字は持たせず、丸いアイコンだけにする（2026-09-04）。
     「無料IELTS学習相談」はヘッダーとフッタに文字リンクがあるので、
     ここは “チャットができる場所” だと形で伝える役に振り切る。 */
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  /* 紺のまま、面に少しだけ角度をつける（navy-600 → navy-800）。
     マークの柱はマスクで抜いてあるので、この階調がそのまま透ける。 */
  background: linear-gradient(135deg, var(--navy-600, #0e4f7d) 0%, var(--cb-navy) 55%, var(--navy-800, #03314f) 100%);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;   /* きらめきを丸の内側で止める */
  /* 白い縁で暗い面から切り離す。記事ヒーローが同じ紺なので、影だけでは輪郭が消える
     （2026-09-04 実機の見え方で確認）。白い本文の上では縁が見えないだけで害はない。 */
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92), 0 10px 28px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

/* 数秒に一度、面を斜めに光が通る。動きはこれだけで、位置も大きさも変えない
   （固定UIが動くと本文の邪魔になるため）。 */
.p1pcb-launcher::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
              rgba(255, 255, 255, 0) 38%,
              rgba(255, 255, 255, 0.34) 50%,
              rgba(255, 255, 255, 0) 62%);
  transform: translateX(-150%);
  animation: p1pcb-sheen 7s ease-in-out 2.5s infinite;
  pointer-events: none;
}

@keyframes p1pcb-sheen {
  0%   { transform: translateX(-150%); }
  13%  { transform: translateX(150%); }
  100% { transform: translateX(150%); }
}

.p1pcb-launcher:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
}

.p1pcb-launcher:focus-visible {
  outline: 3px solid var(--cb-sky);
  outline-offset: 2px;
}

.p1pcb-launcher__icon {
  display: inline-flex;
  /* 吹き出しの尻尾が左下にあるぶん、見た目の重心を少しだけ戻す */
  transform: translate(1px, 1px);
}

#p1p-chatbot.is-open .p1pcb-launcher {
  opacity: 0;
  pointer-events: none;
}

/* ── パネル ──────────────────────────────────────────────────── */

.p1pcb-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  width: min(384px, calc(100vw - 40px));
  height: min(600px, calc(100vh - 40px));
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--cb-line);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  color: var(--cb-ink);
  animation: p1pcb-in 0.18s ease-out;
}

.p1pcb-panel[hidden] {
  display: none;
}

@keyframes p1pcb-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .p1pcb-panel { animation: none; }
  .p1pcb-launcher { transition: none; }
  .p1pcb-launcher::after { animation: none; opacity: 0; }
  .p1pcb-typing span { animation: none; opacity: 0.6; }
}

/* ── ヘッダー ─────────────────────────────────────────────────── */

.p1pcb-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--navy-600, #0e4f7d) 0%, var(--cb-navy) 55%, var(--navy-800, #03314f) 100%);
  color: #fff;
}

.p1pcb-head__text { flex: 1; min-width: 0; }

.p1pcb-head__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}

.p1pcb-head__sub {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
}

.p1pcb-close {
  flex-shrink: 0;
  display: inline-flex;
  padding: 0.25rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.p1pcb-close:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* ── 会話ログ ─────────────────────────────────────────────────── */

.p1pcb-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #fbfcfd;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overscroll-behavior: contain;
}

.p1pcb-msg {
  max-width: 88%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.86rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.p1pcb-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--cb-line);
  border-bottom-left-radius: 4px;
}

.p1pcb-msg--user {
  align-self: flex-end;
  background: var(--cb-sky-50);
  border: 1px solid rgba(70, 162, 218, 0.28);
  border-bottom-right-radius: 4px;
}

.p1pcb-msg--error {
  align-self: stretch;
  max-width: 100%;
  background: #fff5f7;
  border: 1px solid rgba(235, 72, 120, 0.3);
  color: #8e1a3e;
}

/* 入力中 */
.p1pcb-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 0.8rem 0.9rem;
  background: #fff;
  border: 1px solid var(--cb-line);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.p1pcb-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cb-sky);
  animation: p1pcb-blink 1.2s infinite ease-in-out;
}

.p1pcb-typing span:nth-child(2) { animation-delay: 0.18s; }
.p1pcb-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes p1pcb-blink {
  0%, 60%, 100% { opacity: 0.28; }
  30% { opacity: 1; }
}

/* ── CTA ─────────────────────────────────────────────────────── */

.p1pcb-cta {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: -0.25rem;
}

.p1pcb-cta__btn {
  display: block;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--pink-400, #f27093) 0%, var(--cb-pink) 55%, var(--cb-pink-dark) 100%);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  line-height: 1.5;
  transition: background-color 0.2s ease;
}

.p1pcb-cta__btn:hover { filter: brightness(1.06); color: #fff; }

.p1pcb-cta__btn--secondary {
  background: #fff;
  color: var(--cb-navy);
  border: 1.5px solid var(--cb-navy);
}

.p1pcb-cta__btn--secondary:hover {
  background: var(--cb-navy);
  color: #fff;
}

/* ── 選択肢チップ ─────────────────────────────────────────────── */

.p1pcb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 1rem 0;
  border-top: 1px solid var(--cb-line);
}

.p1pcb-chips[hidden] { display: none; }

.p1pcb-chip {
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(70, 162, 218, 0.45);
  border-radius: 999px;
  background: #fff;
  color: var(--cb-navy);
  font-size: 0.78rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.p1pcb-chip:hover { background: var(--cb-sky-50); }

/* ── 入力欄 ──────────────────────────────────────────────────── */

.p1pcb-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.7rem 1rem 0.5rem;
}

.p1pcb-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--cb-line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.6;
  resize: none;
  color: var(--cb-ink);
  background: #fff;
}

.p1pcb-input:focus {
  outline: none;
  border-color: var(--cb-sky);
  box-shadow: 0 0 0 3px rgba(70, 162, 218, 0.18);
}

.p1pcb-send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--cb-navy);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.p1pcb-send:hover:not(:disabled) { background: var(--cb-navy-dark); }
.p1pcb-send:disabled { opacity: 0.45; cursor: default; }

.p1pcb-note {
  margin: 0;
  padding: 0 1rem 0.7rem;
  font-size: 0.66rem;
  line-height: 1.5;
  color: var(--cb-muted);
}

/* ── モバイル ─────────────────────────────────────────────────── */

@media (max-width: 768px) {
  /* 下部固定ナビ（.footer-nav-mobile-new）の上へ逃がす。
     ナビはスクロールで出入りするので、bottom もナビと同じ 0.3s ease で
     追わせる（chatbot.js が値を書き換える）。段差なく一緒に上下する。 */
  .p1pcb-launcher {
    right: 14px;
    bottom: 84px;
    width: 54px;
    height: 54px;
    transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease,
                bottom 0.3s ease;
  }

  .p1pcb-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 88vh;
    height: 88dvh;
    border-radius: var(--cb-radius) var(--cb-radius) 0 0;
    border-bottom: 0;
  }
}


/* モバイルの bottom アニメーションも、動きを減らす設定では止める。
   （上のモバイル用ブロックが後ろに来るため、ここで打ち消す） */
@media (prefers-reduced-motion: reduce) {
  .p1pcb-launcher { transition: none; }
}
