/* ============================================
   異世界に転生したら何の職業？診断 - style.css
   モバイルファースト / ファンタジーの夜空をイメージした紫×金系デザイン
   ============================================ */

:root {
  --color-primary: #5b4bc4;
  --color-primary-dark: #3d2f8f;
  --color-accent: #e8b443;
  --color-bg: #f7f5fc;
  --color-card: #ffffff;
  --color-text: #33313e;
  --color-text-light: #7a7787;
  --color-border: #e2dcf3;
  --color-ad-bg: #e9e9ec;
  --color-ad-text: #9a98a3;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-soft: 0 8px 24px rgba(91, 75, 196, 0.14);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #ece7fa 0%, #f7f5fc 40%);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.app-wrap {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- 画面切り替え ---------- */
.screen {
  display: none;
  flex-direction: column;
  padding: 20px 20px 32px;
  animation: fadeIn 0.35s ease;
}

.screen.is-active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 広告枠プレースホルダー ---------- */
.ad-space {
  width: 100%;
  min-height: 90px;
  max-height: 250px;
  margin: 16px 0;
  background: var(--color-ad-bg);
  border: 1px dashed #c9c7cf;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-space-label {
  font-size: 0.8rem;
  color: var(--color-ad-text);
  letter-spacing: 0.05em;
}

/* ---------- 画面1：トップ ---------- */
.top-header {
  text-align: center;
  margin-bottom: 8px;
}

.app-title {
  font-size: 1.6rem;
  line-height: 1.4;
  color: var(--color-primary-dark);
  margin: 8px 0 12px;
  font-weight: 800;
}

.app-desc {
  font-size: 0.92rem;
  color: var(--color-text-light);
  line-height: 1.7;
  margin: 0;
}

.top-emoji {
  font-size: 2.2rem;
  margin: 8px 0 0;
  letter-spacing: 0.1em;
}

.start-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-top: 16px;
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.start-note {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--color-text-light);
  font-weight: 700;
}

/* ---------- ボタン共通 ---------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 15px 20px;
  font-size: 1.02rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  box-shadow: 0 6px 16px rgba(61, 47, 143, 0.35);
  margin-top: 6px;
}

.btn-secondary {
  background: #fff;
  color: var(--color-primary-dark);
  border: 2px solid var(--color-primary);
}

.btn-share {
  background: #14171a;
  color: #fff;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

/* ---------- 画面2：診断中アニメーション ---------- */
#screen-loading {
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.loading-wrap {
  text-align: center;
}

.loading-spinner {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
}

.loading-spinner span {
  position: absolute;
  inset: 0;
  border: 5px solid transparent;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loading-spinner span:nth-child(2) {
  border-top-color: var(--color-accent);
  animation-delay: -0.3s;
  inset: 8px;
}

.loading-spinner span:nth-child(3) {
  border-top-color: #9d8cf0;
  animation-delay: -0.6s;
  inset: 16px;
}

.loading-spinner span:nth-child(4) {
  border-top-color: #d98b5f;
  animation-delay: -0.9s;
  inset: 24px;
}

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

.loading-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.dots span {
  animation: blink 1.4s infinite;
  opacity: 0;
}

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

@keyframes blink {
  0%, 20%   { opacity: 0; }
  50%       { opacity: 1; }
  100%      { opacity: 0; }
}

/* ---------- 画面3：結果画面 ---------- */
.result-header {
  text-align: center;
  margin-bottom: 4px;
}

.result-lead {
  font-size: 0.85rem;
  color: var(--color-text-light);
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 4px 0;
}

.result-title {
  font-size: 1.5rem;
  color: var(--color-primary-dark);
  font-weight: 800;
  line-height: 1.4;
  margin: 4px 0 16px;
}

.result-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 240px;
  background: linear-gradient(135deg, #e6e0fa, #fff1cf);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}

.result-emoji {
  font-size: 4.5rem;
  line-height: 1;
}

.result-desc {
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 18px 18px;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--color-text);
  box-shadow: var(--shadow-soft);
  white-space: pre-wrap;
}

/* ---------- 画面2：質問画面 ---------- */
.q-head {
  margin: 8px 0 20px;
}

.q-progress {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  text-align: center;
  letter-spacing: 0.08em;
}

.q-progress-track {
  width: 100%;
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.q-progress-bar {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.q-text {
  font-size: 1.3rem;
  line-height: 1.5;
  font-weight: 800;
  color: var(--color-text);
  text-align: center;
  margin: 8px 0 24px;
}

.q-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-btn {
  width: 100%;
  padding: 16px 18px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--color-text);
  text-align: left;
  background: var(--color-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.choice-btn:hover {
  border-color: var(--color-primary);
}

.choice-btn:active {
  transform: scale(0.98);
  background: #f0ecfb;
}

.btn-back {
  margin: 24px auto 0;
  padding: 8px 12px;
  background: none;
  border: none;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--color-text-light);
  cursor: pointer;
}

.btn-back[hidden] {
  display: none;
}

/* ---------- 結果画面：長所・短所・ラッキーアイテム ---------- */
.result-detail {
  margin: 0 0 8px;
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 6px 18px;
  box-shadow: var(--shadow-soft);
}

.result-detail-row {
  padding: 12px 0;
  border-bottom: 1px dashed var(--color-border);
}

.result-detail-row:last-child {
  border-bottom: none;
}

.result-detail dt {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  margin-bottom: 4px;
}

.result-detail dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ---------- 結果画面：登場する動物の一覧 ---------- */
.btn-more {
  background: transparent;
  color: var(--color-primary-dark);
  font-size: 0.92rem;
  padding: 10px 20px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.animal-list-wrap {
  margin-top: 12px;
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.animal-list-wrap[hidden] {
  display: none;
}

.animal-list-note {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--color-text-light);
  font-weight: 700;
  text-align: center;
}

.animal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
}

.animal-list li {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.animal-list li.is-current {
  border-color: var(--color-primary);
  background: #ece7fa;
}

.animal-you {
  font-size: 0.7rem;
  color: #fff;
  background: var(--color-primary);
  border-radius: 999px;
  padding: 1px 8px;
}

/* ---------- 検索エンジン向け説明コンテンツ ---------- */
.seo-content {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--color-text);
}

.seo-content h2 {
  font-size: 1.05rem;
  color: var(--color-primary-dark);
  font-weight: 800;
  margin: 28px 0 10px;
  padding-left: 10px;
  border-left: 4px solid var(--color-primary);
}

.seo-content h3 {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 16px 0 8px;
}

.seo-content p {
  line-height: 1.8;
  margin: 0 0 10px;
}

.seo-content ol {
  padding-left: 22px;
  line-height: 1.9;
  margin: 0 0 10px;
}

.type-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}

.type-list li {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.faq-list {
  margin: 0;
}

.faq-list dt {
  font-weight: 800;
  margin: 14px 0 4px;
  color: var(--color-primary-dark);
}

.faq-list dd {
  margin: 0;
  line-height: 1.8;
}

/* ---------- 共通フッター ---------- */
.app-footer {
  margin-top: auto;
  padding: 24px 20px 28px;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--color-text-light);
  border-top: 1px solid var(--color-border);
}

.app-footer p {
  margin: 0 0 10px;
}

.app-footer a {
  color: var(--color-primary-dark);
  font-weight: 700;
}

.footer-copy {
  letter-spacing: 0.05em;
}

/* ---------- プライバシーポリシーページ ---------- */
.legal-page {
  display: flex;
  flex-direction: column;
  padding: 24px 20px 32px;
}

.legal-title {
  font-size: 1.4rem;
  color: var(--color-primary-dark);
  font-weight: 800;
  margin: 8px 0 16px;
}

.legal-page h2 {
  font-size: 1.05rem;
  color: var(--color-text);
  margin: 24px 0 8px;
}

.legal-page p, .legal-page li {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--color-text);
  margin: 0 0 8px;
}

.legal-date {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.back-link {
  display: inline-block;
  margin-top: 24px;
  color: var(--color-primary-dark);
  font-weight: 700;
}

/* ---------- レスポンシブ（少し大きい画面） ---------- */
@media (min-width: 480px) {
  .app-wrap {
    margin: 24px 0;
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    min-height: calc(100vh - 48px);
  }
}

/* ============================================
   広告スペース一時非表示（AdSense承認待ち）
   承認後はこのブロックを削除すれば広告枠が復活します
   ============================================ */
.ad-space {
  display: none !important;
}

/* ---------- シェアされた結果ページ（result/*.html） ---------- */
a.btn {
  display: block;
  text-align: center;
  text-decoration: none;
}

.share-note {
  margin: 8px 0 12px;
  font-size: 0.9rem;
  line-height: 1.8;
  text-align: center;
  color: var(--color-text-light);
  font-weight: 700;
}
