/* ========================================
   マネーリテラシー診断 — CSS
   水彩背景共通 + パープル/ラベンダー系カラー
   ======================================== */

:root {
  --primary: #7c4dff;
  --primary-light: #b388ff;
  --primary-dark: #651fff;
  --accent: #aa00ff;
  --text-main: #2d3436;
  --text-sub: #636e72;
  --card-bg: rgba(255, 255, 255, 0.88);
  --card-border: rgba(124, 77, 255, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #f0faf5 40%, #e8f8f0 100%);
}

/* ============================
   背景レイヤー（証券サイト共通）
   ============================ */
.bg-gradient {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #f0faf5 40%, #e8f8f0 100%);
  z-index: -3;
}

.bg-watercolor-blobs {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: -2;
  overflow: hidden;
}

.wc-blob {
  position: absolute;
  border-radius: 50%;
}
.wc-blob-1 { width: 500px; height: 500px; background: radial-gradient(ellipse, rgba(154,230,200,0.45) 0%, rgba(154,230,200,0.12) 50%, transparent 70%); top: -100px; left: -100px; filter: blur(30px); }
.wc-blob-2 { width: 300px; height: 300px; background: radial-gradient(ellipse, rgba(128,216,185,0.35) 0%, rgba(128,216,185,0.08) 50%, transparent 70%); top: -50px; right: -50px; filter: blur(25px); }
.wc-blob-3 { width: 400px; height: 400px; background: radial-gradient(ellipse, rgba(167,237,210,0.3) 0%, rgba(167,237,210,0.06) 50%, transparent 70%); bottom: -80px; left: -60px; filter: blur(35px); }
.wc-blob-4 { width: 350px; height: 350px; background: radial-gradient(ellipse, rgba(144,224,195,0.25) 0%, rgba(144,224,195,0.04) 50%, transparent 70%); bottom: 50px; right: -80px; filter: blur(40px); }
.wc-blob-5 { width: 250px; height: 250px; background: radial-gradient(ellipse, rgba(180,240,220,0.15) 0%, transparent 60%); top: 40%; left: 30%; filter: blur(30px); }

.bg-leaves {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: url('bg-watercolor-leaves.png') center center / cover no-repeat;
  z-index: -1;
  mix-blend-mode: multiply;
}

@media (max-width: 600px) {
  .bg-leaves {
    background-position: calc(50% - 50px) center;
  }
}

/* ============================
   レイアウト
   ============================ */
.container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* ============================
   ページ表示制御
   ============================ */
.page {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.page.active {
  display: flex;
}

/* ============================
   ランディングページ
   ============================ */
.title-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 36px 24px;
  margin-bottom: 30px;
  box-shadow: 0 4px 25px rgba(0,0,0,0.06);
  border: 1px solid var(--card-border);
  text-align: center;
  width: 100%;
}

.title-sub {
  font-size: 1.1rem;
  color: var(--text-sub);
  font-weight: 500;
  margin-bottom: 4px;
}

.title-main {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.title-main br + * {
  color: var(--primary);
}

.features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.feature-item {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  border: 1px solid rgba(255,255,255,0.9);
}

.icon {
  color: var(--primary);
  font-weight: bold;
}

.main-action-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 20px 48px;
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(124, 77, 255, 0.4);
  width: 100%;
  max-width: 360px;
  display: block;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  animation: pulse 3s infinite;
  transition: transform 0.2s, box-shadow 0.2s;
}

.main-action-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 12px 30px rgba(124, 77, 255, 0.5);
}

.main-action-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  animation: shine 3s infinite;
  z-index: 2;
}

@keyframes shine { 0% { left: -100%; } 20% { left: 200%; } 100% { left: 200%; } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.03); } 100% { transform: scale(1); } }

.landing-note {
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--primary);
  text-align: center;
  font-weight: 700;
}

/* ============================
   質問ページ
   ============================ */
.progress-container {
  width: 100%;
  margin-bottom: 24px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(124, 77, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-label {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 8px;
}

.quiz-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 30px 20px;
  box-shadow: 0 4px 25px rgba(0,0,0,0.06);
  border: 1px solid var(--card-border);
  width: 100%;
}

.question-text {
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  background: rgba(255,255,255,0.9);
  border: 2px solid rgba(124, 77, 255, 0.15);
  border-radius: 14px;
  padding: 16px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.option-btn:hover {
  border-color: var(--primary);
  background: rgba(124, 77, 255, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(124, 77, 255, 0.15);
}

.option-btn:active {
  transform: translateY(0);
}

.option-btn.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.12) 0%, rgba(170, 0, 255, 0.08) 100%);
  color: var(--primary-dark);
  box-shadow: 0 4px 15px rgba(124, 77, 255, 0.2);
}

.option-btn:disabled {
  opacity: 0.6;
}

/* タッチデバイスではホバー効果を無効化 */
@media (hover: none) {
  .option-btn:hover {
    border-color: rgba(124, 77, 255, 0.15);
    background: rgba(255,255,255,0.9);
    transform: none;
    box-shadow: none;
  }
}

/* ============================
   ローディング
   ============================ */
.loading-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 48px 24px;
  box-shadow: 0 4px 25px rgba(0,0,0,0.06);
  border: 1px solid var(--card-border);
  width: 100%;
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(124, 77, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 20px;
}

.loading-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(124, 77, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ============================
   結果ページ
   ============================ */
.result-header {
  text-align: center;
  margin-bottom: 24px;
}

.result-title-sub {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-sub);
  margin-bottom: 4px;
}

.result-score {
  font-size: clamp(3.5rem, 12vw, 5rem);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

.result-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 4px 25px rgba(0,0,0,0.06);
  border: 2px solid var(--card-border);
  width: 100%;
  text-align: center;
  margin-bottom: 24px;
}

.result-badge {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.1), rgba(170, 0, 255, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.result-emoji {
  font-size: 2.4rem;
}

.result-rank {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.result-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
}

.result-divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 2px;
  margin: 0 auto 16px;
}

.result-description {
  font-size: 0.95rem;
  color: var(--text-sub);
  line-height: 1.8;
  white-space: pre-line;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.share-section {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  border: 1px solid rgba(255,255,255,1);
  width: 100%;
}
.share-title { font-weight: 700; font-size: 1.25rem; margin-bottom: 4px; color: #222; }
.share-emoji { font-size: 1.4rem; }
.share-desc { font-size: 0.9rem; color: #666; margin-bottom: 20px; }
.share-buttons {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.share-icon-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px;
  border: 1px solid #ddd; border-radius: 50px; background: #fff; cursor: pointer; font-weight: 700; color: #444;
  transition: all 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.04); font-size: 0.9rem; flex: 1 1 120px; max-width: 140px;
  white-space: nowrap;
}
.share-icon-btn:hover { background: #fdfdfd; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.08); border-color: #ccc; }
.share-svg { width: 24px; height: 24px; flex-shrink: 0; }
.share-svg-stroke { width: 24px; height: 24px; flex-shrink: 0; }
.share-img { width: 24px; height: 24px; flex-shrink: 0; }

.retry-action {
  margin-top: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  width: 100%;
}

.retry-btn {
  width: 100%;
  max-width: 320px;
  background: white;
  color: #333;
  border: 1px solid #ddd;
  padding: 14px 20px;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.05rem;
}
.retry-btn.shadow-btn {
  box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}
.retry-btn:hover {
  background: #f9f9f9;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

/* 戻るボタン */
.back-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  padding: 8px 16px;
  transition: opacity 0.2s;
}
.back-btn:hover {
  opacity: 0.7;
}

/* ============================
   フッター
   ============================ */
.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 0.75rem;
  color: var(--text-sub);
  position: relative;
  z-index: 1;
}

/* ============================
   紙吹雪アニメーション（Sランク）
   ============================ */
#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 16px;
  opacity: 0;
  border-radius: 2px;
  animation: confetti-shoot forwards ease-out;
}

@keyframes confetti-shoot {
  0% {
    transform: translate3d(0, 0, 0) scale(0) rotate(0deg);
    opacity: 1;
  }
  30% {
    transform: translate3d(var(--x), var(--y), 0) scale(1) rotate(calc(var(--r) / 2));
    opacity: 1;
  }
  100% {
    transform: translate3d(calc(var(--x) * 1.5), calc(var(--y) + 800px), 0) rotate(var(--r));
    opacity: 0;
  }
}
