/* =========================================================
   AIの窓口 for 保険 — 診断フロー専用スタイル
   ========================================================= */

.diagnose-page {
  min-height: 100vh;
}

/* ─── 音声トグル ─── */
.voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid rgba(244, 211, 94, 0.4);
  color: var(--deep-sky);
  font-family: var(--serif-jp);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  margin-right: 14px;
  transition: all 0.25s ease;
  letter-spacing: 0.05em;
}

.voice-toggle:hover {
  background: rgba(244, 211, 94, 0.15);
  border-color: var(--gold);
}

.voice-toggle.is-off {
  opacity: 0.55;
}

.voice-toggle.is-off .voice-icon::before {
  content: '🔇';
}

.voice-toggle .voice-icon {
  font-size: 14px;
}

.voice-toggle .voice-label {
  font-size: 12px;
}

/* そらが話している時の視覚的フィードバック */
.diagnose-sora.is-speaking .diagnose-sora-img {
  filter:
    drop-shadow(0 14px 40px rgba(244, 211, 94, 0.55))
    drop-shadow(0 24px 70px rgba(252, 213, 206, 0.5));
  animation: floatY 7s ease-in-out infinite, soraGlow 2.4s ease-in-out infinite;
}

.diagnose-sora.is-speaking .diagnose-sora-halo {
  animation: haloPulse 3s ease-in-out infinite;
  opacity: 1.2;
}

@keyframes soraGlow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}

@media (max-width: 600px) {
  .voice-toggle .voice-label { display: none; }
  .voice-toggle { padding: 6px 10px; }
}

.diagnose-main {
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ─── 進捗バー ─── */
.diagnose-progress {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px max(20px, 4vw) 16px;
}

.diagnose-progress-track {
  height: 4px;
  background: rgba(180, 200, 220, 0.25);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 14px;
}

.diagnose-progress-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--peach));
  border-radius: var(--radius-pill);
  transition: width 0.6s ease;
}

.diagnose-progress-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--serif-jp);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: var(--whisper);
}

.diagnose-step {
  position: relative;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  transition: all 0.3s ease;
}

.diagnose-step.is-active {
  color: var(--deep-sky);
  font-weight: 700;
  background: rgba(244, 211, 94, 0.18);
}

.diagnose-step.is-done {
  color: var(--gold-deep);
}

/* ─── 診断ステージ ─── */
.diagnose-stage {
  padding: 20px max(20px, 4vw) 80px;
  max-width: 1100px;
  margin: 0 auto;
}

.diagnose-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  align-items: start;
}

/* ─── そら（左・固定） ─── */
.diagnose-sora {
  position: sticky;
  top: calc(var(--header-h) + 30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.diagnose-sora-halo {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -30%);
  width: 110%;
  height: 60%;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 245, 230, 0.6) 0%, transparent 55%),
    radial-gradient(circle at 50% 70%, rgba(252, 213, 206, 0.45) 0%, transparent 55%);
  filter: blur(40px);
  z-index: 0;
  animation: haloPulse 7s ease-in-out infinite;
  pointer-events: none;
}

.diagnose-sora-img {
  width: 100%;
  max-width: 280px;
  height: auto;
  z-index: 1;
  filter:
    drop-shadow(0 10px 30px rgba(220, 200, 220, 0.4))
    drop-shadow(0 22px 60px rgba(252, 213, 206, 0.3));
  animation: floatY 7s ease-in-out infinite;
  transition:
    opacity 0.35s ease,
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.5s ease;
  opacity: 1;
  transform: scale(1);
}

/* 表情切り替え：フェードアウト */
.diagnose-sora-img.is-changing {
  opacity: 0;
  transform: scale(0.94);
}

/* 表情切り替え後：ふわっと出てくる */
.diagnose-sora-img.just-changed {
  animation:
    floatY 7s ease-in-out infinite,
    soraExpressionPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes soraExpressionPop {
  0% {
    transform: scale(0.92);
    filter:
      drop-shadow(0 10px 30px rgba(244, 211, 94, 0.6))
      drop-shadow(0 22px 60px rgba(252, 213, 206, 0.5))
      brightness(1.05);
  }
  50% {
    transform: scale(1.04);
    filter:
      drop-shadow(0 14px 40px rgba(244, 211, 94, 0.55))
      drop-shadow(0 28px 70px rgba(252, 213, 206, 0.45))
      brightness(1.08);
  }
  100% {
    transform: scale(1);
    filter:
      drop-shadow(0 10px 30px rgba(220, 200, 220, 0.4))
      drop-shadow(0 22px 60px rgba(252, 213, 206, 0.3));
  }
}

.diagnose-sora-name {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}

.diagnose-sora-name .sora-name {
  font-family: var(--serif-jp);
  font-size: 18px;
  font-weight: 700;
  color: var(--deep-sky);
  letter-spacing: 0.12em;
}

.diagnose-sora-name .sora-role {
  font-family: var(--serif-lat);
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--gold-deep);
  text-transform: uppercase;
}

/* ─── 会話エリア ─── */
.diagnose-chat {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 60vh;
}

.chat-message {
  animation: fadeInUp 0.6s ease both;
}

.chat-message.hidden {
  display: none;
}

.chat-sora .chat-bubble {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(255, 245, 235, 0.7));
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-left: 4px solid var(--gold);
  border-radius: 22px;
  padding: 28px 32px;
  box-shadow: 0 10px 32px rgba(180, 200, 220, 0.18);
}

.chat-sora .chat-bubble p {
  font-family: var(--serif-jp);
  font-size: clamp(15px, 1.2vw, 16.5px);
  line-height: 2;
  color: var(--deep-sky);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}

.chat-sora .chat-bubble p:last-child {
  margin-bottom: 0;
}

.chat-sora .chat-bubble strong {
  background: linear-gradient(transparent 60%, rgba(244, 211, 94, 0.4) 60%);
  font-weight: 700;
  color: var(--deep-sky);
}

/* お客様の発言（こちらは右寄せ） */
.chat-user {
  display: flex;
  justify-content: flex-end;
}

.chat-user .chat-bubble {
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid rgba(180, 200, 220, 0.4);
  border-radius: 22px 22px 6px 22px;
  padding: 18px 24px;
  max-width: 80%;
  font-family: var(--sans-jp);
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--deep-sky);
  letter-spacing: 0.03em;
  box-shadow: 0 6px 20px rgba(180, 200, 220, 0.18);
}

/* ─── 入力ブロック ─── */
.chat-input-block {
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 22px;
  padding: 28px 32px;
  box-shadow: 0 10px 28px rgba(180, 200, 220, 0.15);
  animation: fadeInUp 0.6s ease both;
}

.chat-input-block.hidden {
  display: none;
}

.chat-input-label {
  font-family: var(--serif-jp);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--deep-sky);
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.chat-input-sublabel {
  font-size: 13px;
  color: var(--soft-ink);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  line-height: 1.85;
}

/* 提案ピル（候補ボタン） */
.chat-suggestion-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.chat-pill {
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(180, 200, 220, 0.45);
  color: var(--deep-sky);
  font-family: var(--serif-jp);
  font-size: 13.5px;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.25s ease;
}

.chat-pill:hover {
  border-color: var(--gold);
  background: rgba(244, 211, 94, 0.12);
  transform: translateY(-1px);
}

.chat-pill.is-selected {
  background: linear-gradient(135deg, var(--gold), var(--peach));
  border-color: var(--gold);
  color: var(--deep-sky);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(244, 211, 94, 0.35);
}

/* テキスト入力 */
.chat-textarea {
  width: 100%;
  font-family: var(--sans-jp);
  font-size: 14.5px;
  color: var(--deep-sky);
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid rgba(180, 200, 220, 0.45);
  border-radius: 14px;
  padding: 14px 18px;
  letter-spacing: 0.03em;
  line-height: 1.85;
  resize: vertical;
  min-height: 80px;
  transition: all 0.25s ease;
  margin-bottom: 18px;
  box-sizing: border-box;
}

.chat-textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(244, 211, 94, 0.15);
}

.chat-textarea::placeholder {
  color: var(--whisper);
}

/* チェックボックスグリッド */
.chat-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.chat-checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid rgba(180, 200, 220, 0.35);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--serif-jp);
  font-size: 13.5px;
  color: var(--deep-sky);
  letter-spacing: 0.03em;
}

.chat-checkbox-grid label:hover {
  border-color: var(--gold);
  background: rgba(244, 211, 94, 0.08);
}

.chat-checkbox-grid input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid rgba(180, 200, 220, 0.6);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
  position: relative;
}

.chat-checkbox-grid input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--gold), var(--peach));
  border-color: var(--gold);
}

.chat-checkbox-grid input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--deep-sky);
  font-weight: 700;
  font-size: 12px;
}

/* 質問グループ（Step 2, 3で複数の質問を並べる時） */
.chat-question-group {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px dashed rgba(180, 200, 220, 0.35);
}

.chat-question-group:last-of-type {
  margin-bottom: 18px;
  padding-bottom: 0;
  border-bottom: none;
}

.chat-question-title {
  font-family: var(--serif-jp);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--deep-sky);
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  line-height: 1.7;
}

.chat-question-title .q-num {
  display: inline-block;
  font-family: var(--serif-lat);
  font-style: italic;
  font-size: 13px;
  color: var(--gold-deep);
  margin-right: 10px;
  letter-spacing: 0.15em;
}

/* 次へボタン */
.chat-next-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--gold), var(--peach));
  color: var(--deep-sky);
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--serif-jp);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 18px rgba(244, 211, 94, 0.35);
}

.chat-next-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(244, 211, 94, 0.5);
}

.chat-next-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-next-btn .arrow {
  font-weight: 300;
  font-size: 18px;
  transition: transform 0.3s ease;
}

.chat-next-btn:hover:not(:disabled) .arrow {
  transform: translateX(4px);
}

/* 戻るリンク */
.chat-back-link {
  display: inline-block;
  margin-right: 16px;
  font-family: var(--serif-jp);
  font-size: 13px;
  color: var(--whisper);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: color 0.25s ease;
}

.chat-back-link:hover {
  color: var(--soft-ink);
}

/* スキップリンク */
.chat-skip-link {
  display: inline-block;
  margin-left: 16px;
  font-family: var(--serif-jp);
  font-size: 13px;
  color: var(--whisper);
  text-decoration: underline;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color 0.25s ease;
  background: none;
  border: none;
}

.chat-skip-link:hover {
  color: var(--soft-ink);
}

/* ─── 洞察カード（Step 2の中盤に挿入） ─── */
.chat-insight {
  background: linear-gradient(135deg, rgba(244, 211, 94, 0.12), rgba(252, 213, 206, 0.1));
  border: 1.5px dashed var(--gold);
  border-radius: 18px;
  padding: 22px 26px;
  margin: 18px 0;
}

.chat-insight-tag {
  display: inline-block;
  font-family: var(--serif-lat);
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--gold-deep);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.chat-insight-title {
  font-family: var(--serif-jp);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--deep-sky);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.chat-insight p {
  font-size: 13.5px;
  color: var(--soft-ink);
  line-height: 1.95;
  letter-spacing: 0.03em;
}

.chat-insight strong {
  color: var(--deep-sky);
  background: linear-gradient(transparent 60%, rgba(244, 211, 94, 0.35) 60%);
  font-weight: 700;
}

/* ─── 整理書作成中のローディング ─── */
.chat-loading {
  text-align: center;
  padding: 48px 0;
}

.chat-loading-text {
  font-family: var(--serif-jp);
  font-size: 16px;
  color: var(--deep-sky);
  letter-spacing: 0.06em;
  margin-bottom: 24px;
  line-height: 1.95;
}

.chat-loading-dots {
  display: inline-flex;
  gap: 8px;
}

.chat-loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--peach));
  animation: dotPulse 1.4s ease-in-out infinite;
}

.chat-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(0.85);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ─── フッターノート ─── */
.diagnose-footer-note {
  text-align: center;
  padding: 32px 20px 0;
  max-width: 720px;
  margin: 0 auto;
}

.diagnose-footer-note p {
  font-family: var(--serif-jp);
  font-size: 12.5px;
  color: var(--whisper);
  line-height: 1.95;
  letter-spacing: 0.04em;
}

/* ─── レスポンシブ ─── */
@media (max-width: 900px) {
  .diagnose-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .diagnose-sora {
    position: static;
    max-width: 220px;
    margin: 0 auto;
  }

  .diagnose-sora-img {
    max-width: 180px;
  }
}

@media (max-width: 600px) {
  .diagnose-progress {
    padding: 24px 18px 12px;
  }

  .diagnose-progress-steps {
    font-size: 11px;
  }

  .diagnose-step {
    padding: 3px 8px;
  }

  .diagnose-stage {
    padding: 16px 16px 60px;
  }

  .chat-sora .chat-bubble,
  .chat-input-block {
    padding: 22px 22px;
    border-radius: 18px;
  }

  .chat-suggestion-pills {
    gap: 8px;
  }

  .chat-pill {
    padding: 9px 14px;
    font-size: 12.5px;
  }

  .chat-next-btn {
    width: 100%;
    padding: 14px 24px;
  }

  .chat-checkbox-grid {
    grid-template-columns: 1fr;
  }
}
