/* ===== リセット・基本 ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

.popup-overlay,
.popup-overlay * {
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ===== オーバーレイ ===== */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 16px;
}

.popup-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ===== ポップアップコンテナ ===== */
.popup-container {
  background: #fff;
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* 結果・ローディング時はヘッダー非表示 */
.popup-container.is-result .popup-header {
  display: none;
}

/* ===== ヘッダー ===== */
.popup-header {
  background: #c62828;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.badge {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: bold;
  line-height: 1.3;
  text-align: center;
}

.badge br {
  display: block;
}

.header-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  margin: 0;
}

.header-title br {
  display: block;
}

/* ===== ボディ ===== */
.popup-body {
  padding: 24px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 320px;
}

/* ===== 設問ステップ ===== */
.step {
  display: none;
}

.step.is-active {
  display: block;
}

.question-header {
  display: inline;
  color: #c62828;
  font-size: 28px;
  font-weight: bold;
  margin-right: 4px;
}

.question-text {
  color: #c62828;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px;
  line-height: 1.4;
}

.question-image {
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
}

.question-image img {
  display: block;
  width: 100%;
  height: auto;
}

/* ===== 選択肢ボタン ===== */
.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-align: center;
}

.choice:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.choice:active {
  transform: translateY(0);
}

.choice-primary {
  background: #c62828;
  box-shadow: 0 2px 8px rgba(198, 40, 40, 0.3);
}

.choice-primary:hover {
  background: #a51c1c;
}

.choice-secondary {
  background: #5c6bc0;
  box-shadow: 0 2px 8px rgba(92, 107, 192, 0.3);
}

.choice-secondary:hover {
  background: #3f51b5;
}

/* ===== ローディング ===== */
.step-loading {
  display: none;
}

.step-loading.is-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  width: 100%;
}

.loading-text {
  text-align: center;
  margin-bottom: 32px;
  width: 100%;
}

.loading-line1 {
  font-size: 18px;
  color: #555;
  margin: 0 0 4px;
  font-weight: 500;
}

.loading-line2 {
  font-size: 20px;
  color: #333;
  margin: 0;
  font-weight: bold;
}

.loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.spinner-dots {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  border: 4px solid transparent;
  border-top-color: #c62828;
  border-right-color: #c62828;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-label {
  position: relative;
  z-index: 1;
  font-size: 10px;
  font-weight: bold;
  color: #333;
  background: #fff;
  padding: 0 4px;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== 結果画面 ===== */
.result-title {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin: 0 0 16px;
}

.result-banner {
  margin-bottom: 16px;
  border-radius: 8px;
  overflow: hidden;
}

.result-banner img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
}

.result-content {
  background: #FFF5F5;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.result-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.result-list li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

.result-list li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: #c62828;
  font-weight: bold;
  font-size: 16px;
}

.result-cta-lead {
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  color: #333;
  margin: 0 0 12px;
}

.result-cta-sub {
  text-align: center;
  font-size: 14px;
  color: #555;
  margin: 8px 0 0;
  line-height: 1.5;
}

.cta-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(180deg, #43A047 0%, #388E3C 100%);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  text-decoration: none;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(56, 142, 60, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(56, 142, 60, 0.45);
}

.cta-icon {
  font-size: 18px;
}

.result-disclaimer {
  font-size: 10px;
  color: #999;
  line-height: 1.6;
  margin: 0;
}

/* ===== レスポンシブ ===== */
@media (max-width: 480px) {
  .popup-overlay {
    padding: 8px;
  }

  .popup-container {
    max-height: 95vh;
  }

  .popup-header {
    padding: 10px 12px;
    gap: 10px;
  }

  .badge {
    padding: 6px 10px;
    font-size: 11px;
    white-space: nowrap;
  }

  .badge br {
    display: none;
  }

  .header-title {
    font-size: 13px;
  }

  .popup-body {
    padding: 16px 14px;
    min-height: auto;
  }

  .question-header {
    font-size: 22px;
  }

  .question-text {
    font-size: 15px;
    margin-bottom: 10px;
  }

  .question-image {
    margin-bottom: 12px;
  }

  .choices {
    gap: 10px;
  }

  .choice {
    padding: 12px 16px;
    font-size: 14px;
  }

  /* 結果画面コンパクト化 */
  .result-title {
    font-size: 20px;
  }

  .result-banner {
    margin-bottom: 10px;
  }

  .result-content {
    padding: 14px;
    margin-bottom: 10px;
  }

  .result-list {
    margin-bottom: 10px;
  }

  .result-list li {
    font-size: 13px;
    margin-bottom: 6px;
    padding-left: 20px;
  }

  .result-list li::before {
    font-size: 14px;
  }

  .result-cta-lead {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .cta-button {
    padding: 14px 20px;
    font-size: 15px;
  }

  .result-disclaimer {
    font-size: 9px;
  }
}
