/* ============================================================
   ミクの無料鑑定 - メインCSS
   スマホファースト / 和の世界観：朱・墨・和紙ベージュ
   ============================================================ */

/* --- リセット --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  overflow-x: hidden;
}

/* --- カラーパレット（和色）と基本変数 --- */
:root {
  --color-shu: #C73E3A;
  --color-akane: #B7282E;
  --color-yamabuki: #F8B500;
  --color-asagi: #00A3AF;
  --color-gunjo: #1B3B6F;
  --color-fuji: #A18CD1;
  --color-sumi: #2B2B2B;
  --color-hakuji: #F5F0E1;

  --color-bg: #FAF6EE;
  --color-text: #2B2B2B;
  --color-accent: #C73E3A;
  --color-accent-dark: #B7282E;
  --color-line-green: #06C755;

  --font-serif: 'Noto Serif JP', 'Yu Mincho', 'YuMincho', serif;
}

/* --- ベース --- */
body {
  font-family: var(--font-serif);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt";
  /* iOS Safariの安全領域考慮 */
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 1.25rem 1.25rem 3rem;
  position: relative;
  background-color: var(--color-bg);
}

/* ============================================================
   プログレスバー
   ============================================================ */
.progress-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}
.progress-track {
  flex: 1;
  height: 6px;
  background-color: #e8ddc7;
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-shu) 0%, var(--color-akane) 100%);
  border-radius: 100px;
  transition: width 0.4s ease-out;
  width: 0%;
}
.progress-text {
  font-size: 0.75rem;
  color: #8a7a5a;
  font-weight: 500;
  letter-spacing: 0.05em;
  min-width: 3.5em;
  text-align: right;
}

/* ============================================================
   画面切り替え（共通）
   ============================================================ */
.screen {
  display: none;
  animation: fadeSlideIn 0.45s ease-out;
}
.screen.is-active {
  display: block;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   OP画面・未成年画面：ミクキャラクター・吹き出し
   ============================================================ */
.miku-character {
  text-align: center;
  margin-top: 0.5rem;
}
.miku-image {
  width: 220px;
  max-width: 65%;
  height: auto;
  display: inline-block;
  filter: drop-shadow(0 6px 18px rgba(135, 30, 30, 0.18));
}
.miku-name {
  margin-top: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-accent);
}
.miku-title {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: #777;
  margin-top: 0.2rem;
  letter-spacing: 0.05em;
}

/* --- 吹き出し --- */
.speech-bubble {
  margin: 1.5rem 0 1rem;
  padding: 1.5rem 1.25rem;
  background-color: #ffffff;
  border: 1px solid #ece3d0;
  border-radius: 14px;
  position: relative;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
.speech-bubble::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 11px solid #ffffff;
}
.speech-bubble::after {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 12px solid #ece3d0;
  z-index: -1;
}
.speech-text {
  text-align: center;
  font-size: 1.05rem;
  line-height: 2;
  color: var(--color-text);
}
.speech-text strong {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 1.15rem;
}

/* ============================================================
   質問画面
   ============================================================ */

/* --- ミク（小サイズ・横に並ぶ） --- */
.question-character {
  text-align: center;
  margin: 0.5rem 0 0;
}
.miku-image-small {
  width: 110px;
  max-width: 32%;
  height: auto;
  display: inline-block;
  filter: drop-shadow(0 4px 12px rgba(135, 30, 30, 0.15));
}

/* 質問用の吹き出しは少し小さめに */
.speech-bubble-question {
  margin: 1rem 0 1.25rem;
  padding: 1.25rem 1rem;
}
.speech-bubble-question .speech-text {
  font-size: 0.98rem;
  line-height: 1.85;
  text-align: left;
}

/* --- 回答エリア --- */
.answer-area {
  margin-bottom: 1rem;
}
.answer-subtitle {
  font-size: 0.85rem;
  color: #8a7a5a;
  margin: 1rem 0 0.5rem;
  text-align: center;
  letter-spacing: 0.05em;
}

/* --- テキスト/数値/日付入力 --- */
.input-text, .input-date, .input-number {
  display: block;
  width: 100%;
  padding: 0.9rem 1rem;
  /* iOS Safariズーム防止のため16px以上を厳守 */
  font-size: 16px;
  font-family: var(--font-serif);
  color: var(--color-text);
  background-color: #ffffff;
  border: 1.5px solid #ddcfb2;
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.input-text:focus, .input-date:focus, .input-number:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(199, 62, 58, 0.12);
}
textarea.input-text {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

/* --- 生年月日（年・月・日 を別々に手入力） --- */
.date-split-grid {
  display: grid;
  grid-template-columns: 2fr 1.1fr 1.1fr;
  gap: 0.5rem;
}
.date-split-field {
  position: relative;
}
.input-date-part {
  width: 100%;
  padding: 0.9rem 2rem 0.9rem 0.75rem;
  font-size: 16px;
  font-family: var(--font-serif);
  color: var(--color-text);
  background-color: #ffffff;
  border: 1.5px solid #ddcfb2;
  border-radius: 12px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
  -moz-appearance: textfield;
}
/* 数字入力欄の上下矢印（スピンボタン）を非表示 */
.input-date-part::-webkit-outer-spin-button,
.input-date-part::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-date-part:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(199, 62, 58, 0.12);
}
.date-split-label {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: #8a7a5a;
  pointer-events: none;
}
.input-text-sub, .input-text-other {
  margin-top: 0.75rem;
}

/* --- 選択肢グリッド --- */
.select-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}
.select-btn {
  display: block;
  width: 100%;
  padding: 0.9rem 1rem;
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--color-text);
  background-color: #ffffff;
  border: 1.5px solid #ddcfb2;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
  min-height: 48px; /* タッチ範囲確保 */
}
.select-btn:hover {
  border-color: var(--color-accent);
  background-color: #fff8f7;
}
.select-btn.is-selected {
  background: linear-gradient(135deg, var(--color-shu) 0%, var(--color-akane) 100%);
  color: #ffffff;
  border-color: var(--color-accent-dark);
  font-weight: 500;
  box-shadow: 0 3px 10px rgba(199, 62, 58, 0.25);
}

/* --- 色パレット（Q12） --- */
.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* 縦は色名ラベル分の余白(2rem)が必要。横は密でOK */
  column-gap: 0.5rem;
  row-gap: 2.25rem;
  margin-bottom: 1.5rem;
  padding: 0 0.25rem;
}
.color-btn {
  aspect-ratio: 1 / 1;
  border: 3px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 0;
  /* 白磁が背景に埋もれないよう内側に薄い枠を付ける */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.color-btn:hover {
  transform: scale(1.05);
}
.color-btn.is-selected {
  border-color: var(--color-shu);
  box-shadow: 0 4px 12px rgba(199, 62, 58, 0.35), 0 0 0 3px rgba(199, 62, 58, 0.15);
  transform: scale(1.08);
}
.color-label {
  position: absolute;
  /* 円の真下に明確に配置（row-gap 2.25rem の中央あたり） */
  bottom: -1.6rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  letter-spacing: 0.05em;
}

/* --- 数字グリッド（Q12） --- */
.number-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.number-btn {
  aspect-ratio: 1 / 1;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--color-text);
  background-color: #ffffff;
  border: 1.5px solid #ddcfb2;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s;
}
.number-btn:hover {
  border-color: var(--color-accent);
  background-color: #fff8f7;
}
.number-btn.is-selected {
  background: linear-gradient(135deg, var(--color-shu) 0%, var(--color-akane) 100%);
  color: #ffffff;
  border-color: var(--color-accent-dark);
  box-shadow: 0 3px 10px rgba(199, 62, 58, 0.25);
}

/* --- エラーメッセージ --- */
.error-message {
  background-color: #fff0ef;
  color: var(--color-accent);
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  text-align: center;
  margin-bottom: 0.75rem;
  border: 1px solid #f5d5d2;
}

/* ============================================================
   ボタン共通
   ============================================================ */
.btn {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.05em;
  min-height: 48px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--color-shu) 0%, var(--color-akane) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(199, 62, 58, 0.32);
  margin-top: 1.25rem;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(199, 62, 58, 0.42);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(199, 62, 58, 0.3);
}
.btn-text {
  background: transparent;
  color: #8a7a5a;
  font-size: 0.85rem;
  margin-top: 0.75rem;
  text-decoration: underline;
  min-height: 36px;
}
.btn-text:hover {
  color: var(--color-accent);
}

/* --- プライバシー注記 --- */
.privacy-note {
  text-align: center;
  font-size: 0.72rem;
  color: #888;
  margin-top: 1rem;
}

/* ============================================================
   ローディング画面
   ============================================================ */
.loading-character {
  text-align: center;
  margin-top: 2rem;
}
.loading-pulse {
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.98); }
}
.loading-text {
  text-align: center;
  font-size: 1.15rem;
  margin-top: 1.5rem;
  letter-spacing: 0.1em;
  color: var(--color-text);
  line-height: 1.8;
}
.loading-spinner {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.loading-dot {
  width: 10px;
  height: 10px;
  background-color: var(--color-shu);
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite both;
}
.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}
.loading-sub {
  text-align: center;
  font-size: 0.85rem;
  color: #8a7a5a;
  margin-top: 2rem;
  letter-spacing: 0.1em;
}

/* ============================================================
   鑑定書画面
   ============================================================ */
.screen-verdict {
  position: relative;
}
.verdict-paper {
  background-color: #fffdf6;
  border: 1px solid #e8d9b4;
  border-radius: 8px;
  padding: 2rem 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  position: relative;
  /* 縦書きっぽい和紙感 */
  background-image:
    repeating-linear-gradient(0deg, transparent 0px, transparent 31px, rgba(199, 62, 58, 0.04) 31px, rgba(199, 62, 58, 0.04) 32px);
}

.verdict-header {
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
}
.verdict-stamp {
  position: absolute;
  top: -0.5rem;
  right: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-shu);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  border-radius: 6px;
  transform: rotate(8deg);
  box-shadow: 0 2px 6px rgba(199, 62, 58, 0.3);
  font-family: var(--font-serif);
}
.verdict-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.3em;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-shu);
  display: inline-block;
}
.verdict-subtitle {
  font-size: 0.8rem;
  color: #8a7a5a;
  margin-top: 0.75rem;
  letter-spacing: 0.1em;
}

.verdict-body {
  font-size: 0.95rem;
  line-height: 2;
  color: var(--color-text);
}
.verdict-body p {
  margin-bottom: 1rem;
}
.verdict-body strong {
  color: var(--color-accent);
  font-weight: 700;
}
.verdict-body small {
  font-size: 0.8rem;
  color: #777;
}
.verdict-greeting {
  text-align: center;
  font-size: 1.05rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed #e8d9b4;
  margin-bottom: 1.25rem;
}
.verdict-hook {
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-accent);
  letter-spacing: 0.1em;
  margin-top: 1.5rem;
}
.verdict-subheading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-accent);
  margin: 1.5rem 0 0.75rem;
  text-align: center;
  letter-spacing: 0.1em;
}
.verdict-closing {
  text-align: center;
  font-style: italic;
  color: var(--color-accent);
  margin-top: 1.5rem;
}

/* --- 見える部分（visible） --- */
.verdict-visible {
  /* 通常表示。何もしない */
}

/* --- ぼかし部分（hidden）：薄めの blur で文字の存在は匂わせる --- */
.verdict-hidden {
  position: relative;
  margin-top: 1rem;
}
/* hidden の直接子（CTA以外）に薄いぼかし */
.verdict-hidden > *:not(.verdict-overlay) {
  filter: blur(3.5px);
  -webkit-filter: blur(3.5px);
  user-select: none;
  pointer-events: none;
}

/* --- ぼかし上に重なる CTA エリア --- */
.verdict-overlay {
  position: absolute;
  top: 0;
  left: -1rem;
  right: -1rem;
  bottom: -1rem;
  /* 薄めの半透明グラデーション：文字の輪郭が見える程度に */
  background: linear-gradient(
    180deg,
    rgba(250, 246, 238, 0.25) 0%,
    rgba(250, 246, 238, 0.55) 35%,
    rgba(250, 246, 238, 0.85) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem;
}
.verdict-cta {
  width: 100%;
  text-align: center;
}
.verdict-cta-headline {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
  background-color: rgba(255, 253, 246, 0.85);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid #e8d9b4;
}
.verdict-cta-headline strong {
  color: var(--color-accent);
  font-size: 1.2rem;
}
.btn-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(135deg, #06C755 0%, #00b54b 100%);
  color: #ffffff;
  text-decoration: none;
  border-radius: 100px;
  font-size: 1.05rem;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(6, 199, 85, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.05em;
  /* 注目を集めるパルスアニメ */
  animation: ctaPulse 2.4s ease-in-out infinite;
}
@keyframes ctaPulse {
  0%, 100% { transform: translateY(0); box-shadow: 0 6px 20px rgba(6, 199, 85, 0.45); }
  50% { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(6, 199, 85, 0.55); }
}
.btn-line:hover {
  transform: translateY(-2px);
  animation: none;
}
.btn-line-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  color: #06C755;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  letter-spacing: 0.02em;
}
.btn-line-text strong {
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0 0.15em;
  color: #fffce0;
}
.verdict-cta-note {
  font-size: 0.75rem;
  color: #777;
  margin-top: 0.75rem;
  background-color: rgba(255, 253, 246, 0.7);
  padding: 0.5rem;
  border-radius: 8px;
}
.verdict-cta-note strong {
  color: var(--color-accent);
}
