/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans JP", sans-serif;
  color: #1E293B;
  background: #F8FAFC;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Page Transitions ===== */
.page {
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  min-height: 100vh;
}

.page.active {
  display: flex;
  opacity: 1;
}

.page.fade-out {
  opacity: 0;
}

.page.fade-in {
  opacity: 1;
}

/* ===== トップページ ===== */
.top-bg {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #A78BFA 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.top-content {
  text-align: center;
  max-width: 520px;
}

.top-title {
  font-size: 2.5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.top-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
  margin-bottom: 2rem;
}

/* ===== 犬キャラクター ===== */
.dog-character {
  display: inline-block;
}

.dog-svg {
  width: 140px;
  height: 140px;
}

.dog-small .dog-svg {
  width: 80px;
  height: 80px;
}

.dog-bounce {
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 尻尾振り */
.tail-wag {
  animation: wag 0.6s ease-in-out infinite alternate;
  transform-origin: 145px 135px;
}

@keyframes wag {
  0% { transform: rotate(-10deg); }
  100% { transform: rotate(10deg); }
}

/* ===== 吹き出し ===== */
.speech-bubble {
  background: #fff;
  border-radius: 1.2rem;
  padding: 1rem 1.5rem;
  position: relative;
  display: inline-block;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  margin: 1rem auto;
  max-width: 360px;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 14px solid #fff;
}

.top-bubble {
  margin-bottom: 1.5rem;
}

.top-bubble p {
  font-size: 1rem;
  color: #4F46E5;
  font-weight: 700;
  line-height: 1.7;
}

.small-bubble {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  margin: 0;
}

.small-bubble::after {
  bottom: auto;
  top: 50%;
  left: -10px;
  transform: translateY(-50%);
  border-left: none;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 12px solid #fff;
}

.small-bubble p {
  color: #6366F1;
  font-weight: 700;
  line-height: 1.5;
}

/* ===== ボタン共通 ===== */
.btn-primary {
  display: inline-block;
  background: #F59E0B;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 1rem 3rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  letter-spacing: 0.05em;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ===== 設問画面 ===== */
#page-quiz {
  background: #F8FAFC;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem;
}

.quiz-container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

/* プログレスバー */
.progress-area {
  margin-bottom: 1.5rem;
}

.progress-label {
  display: block;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #6366F1;
  margin-bottom: 0.5rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366F1, #A78BFA);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* 犬＋吹き出しエリア */
.quiz-dog-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* 設問 */
.quiz-question {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 1.2rem;
  line-height: 1.7;
}

/* 選択肢 */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-card {
  background: #fff;
  border: 2px solid #E2E8F0;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.option-card:hover {
  border-color: #A78BFA;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}

.option-card.selected {
  border-color: #6366F1;
  background: #EEF2FF;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.option-radio {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid #CBD5E1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.option-card.selected .option-radio {
  border-color: #6366F1;
}

.option-radio-inner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #6366F1;
  transform: scale(0);
  transition: transform 0.2s ease;
}

.option-card.selected .option-radio-inner {
  transform: scale(1);
}

.option-text {
  font-size: 1rem;
  color: #334155;
  line-height: 1.5;
}

/* 戻るボタン */
.quiz-nav {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-start;
}

.btn-back {
  background: none;
  border: 2px solid #CBD5E1;
  color: #64748B;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-back:hover {
  border-color: #6366F1;
  color: #6366F1;
}

/* ===== 結果画面 ===== */
#page-result {
  background: linear-gradient(180deg, #EEF2FF 0%, #F8FAFC 40%);
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.result-container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.result-bubble {
  margin-bottom: 1.5rem;
}

.result-bubble p {
  color: #6366F1;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.6;
}

.result-card {
  background: #fff;
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
}

.result-label {
  font-size: 0.95rem;
  color: #64748B;
  margin-bottom: 0.75rem;
}

.result-level {
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.result-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* スコアバー */
.result-score-bar {
  margin-bottom: 1.5rem;
}

.score-bar-track {
  width: 100%;
  height: 12px;
  background: #E2E8F0;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366F1, #A78BFA, #F59E0B);
  border-radius: 6px;
  width: 0%;
  transition: width 1s ease;
}

.score-text {
  font-size: 0.85rem;
  color: #64748B;
}

/* アドバイス */
.result-advice {
  text-align: left;
  background: #F8FAFC;
  border-radius: 1rem;
  padding: 1.25rem;
}

.result-advice h3 {
  font-size: 1rem;
  color: #4F46E5;
  margin-bottom: 0.75rem;
}

.result-advice p {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.8;
}

.result-advice ul {
  list-style: none;
  padding: 0;
  margin-top: 0.5rem;
}

.result-advice ul li {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.8;
  padding-left: 1.2rem;
  position: relative;
}

.result-advice ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #6366F1;
  font-weight: 700;
}

/* CTAカード */
.result-cta {
  margin-bottom: 1.5rem;
}

.cta-card {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  border-radius: 1.5rem;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 8px 32px rgba(79, 70, 229, 0.3);
}

.cta-lead {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.8;
  margin-bottom: 1.25rem;
}

.cta-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 0.75rem;
  letter-spacing: 0.03em;
}

.cta-desc {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.btn-cta {
  display: inline-block;
  background: #F59E0B;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.9rem 2.5rem;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
}

/* ネクストアクションボタン */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-action {
  display: block;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-retry {
  background: #fff;
  color: #6366F1;
  border: 2px solid #6366F1;
}

.btn-retry:hover {
  background: #EEF2FF;
  transform: translateY(-2px);
}

/* ===== レスポンシブ ===== */
@media (max-width: 600px) {
  .top-title {
    font-size: 1.8rem;
  }

  .top-subtitle {
    font-size: 0.95rem;
  }

  .dog-svg {
    width: 110px;
    height: 110px;
  }

  .quiz-question {
    font-size: 1.05rem;
  }

  .option-text {
    font-size: 0.9rem;
  }

  .result-level {
    font-size: 3rem;
  }

  .result-card {
    padding: 1.5rem;
  }

  .btn-primary {
    font-size: 1.05rem;
    padding: 0.9rem 2.5rem;
  }
}

/* ===== アニメーション補助 ===== */
.quiz-body {
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-container {
  animation: slideUp 0.6s ease;
}
