* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
}

body {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  background-color: #2b1f16;
  color: #f5e9d6;
  overflow-y: auto;
}

#app {
  position: relative;
  min-height: 100vh;
}

/* 画面共通 */

.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
   height: auto;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ホーム画面 */

.bg-overlay {
  position: fixed; 
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: sepia(0.9) contrast(1.1) brightness(0.9);
  opacity: 0.4;
  pointer-events: none;
}

.home-content {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.title {
  font-size: 2.4rem;
  letter-spacing: 0.2em;
  margin-bottom: 0.5rem;
  animation: glow 3s ease-in-out infinite;
  opacity: 1; /* ← 追加 */
}

.fade-out-title {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.subtitle {
  font-size: 1rem;
  margin-bottom: 2rem;
}

@keyframes glow {
  0% { text-shadow: 0 0 4px rgba(255,255,255,0.3); }
  50% { text-shadow: 0 0 12px rgba(255,255,255,0.6); }
  100% { text-shadow: 0 0 4px rgba(255,255,255,0.3); }
}


.fade-line {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.6s forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ボタン */

.btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
}

.main-btn {
  padding: 0.8rem 2.4rem;
  border-radius: 999px;
  background-color: #8b5a2b;
  color: #f5e9d6;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.main-btn:hover {
  background-color: #a86b35;
}

/* 公式Xボタン */
#official-x-btn {
  background-color: #8b7355;
  color: #f5e9d6;
}

#official-x-btn:hover {
  background-color: #a89968;
}

.fortune-buttons {
  display: flex;
  gap: 1rem;
   margin-bottom: 0.5rem;
}

/* クレジットボタン */

.credit-btn {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.45);
  color: #f5e9d6;
  z-index: 5;
  cursor: pointer;
}

/* 質問画面 */

.question-content {
  padding: 3rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.question-block {
  margin-bottom: 2rem;
}

.question-text {
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  text-align: center;
  text-shadow: 0 0 8px rgba(255,255,255,0.4);
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* リッチな選択肢カード */

.choice-btn {
  display: block;
  width: 100%;
  margin: 0.8rem 0;
  padding: 1rem 1.2rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  color: #f5e9d6;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  text-align: left;
  font-weight: 500;
  transition: all 0.25s ease;
  cursor: pointer;
}

.choice-btn,
.fortune-text,
.question-text {
  font-family: 'Noto Serif JP', 'Yu Mincho', serif;
}

.choice-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.15);
}

.choice-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: 2px;
}

.choice-btn:active {
  transform: scale(0.97) translateY(-2px);
  background: rgba(255,255,255,0.2);
  box-shadow: 0 4px 8px rgba(255,255,255,0.2);
}

/* ルート画面 */

.route-content {
  position: relative;
  height: 100vh;
  padding: 3rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}



.route-text {
  font-family: 'Noto Serif JP', 'Yu Mincho', serif;
  font-size: 1.2rem;
  line-height: 1.9;
  text-shadow: 0 0 8px rgba(255,255,255,0.3);
  margin-bottom: 2rem;
  color: #f5e9d6;
  white-space: pre-wrap;

}

.route-choice-btn {
  display: block;
  width: 100%;
  margin: 1.2rem 0;
  padding: 1.5rem 2rem;

  /* 古びた紙の質感 - もっと濃い背景 */
  background: rgba(245, 233, 214, 0.55);
  border: 3px solid rgba(91, 58, 31, 0.85);
  border-radius: 12px;

  /* 紙のざらつき（ドット風） */
  background-image:
    radial-gradient(rgba(255,255,255,0.15) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.15) 1px, transparent 1px);
  background-size: 4px 4px, 6px 6px;
  background-blend-mode: overlay;

  /* テキスト - 太字、強い影、大きいサイズ */
  color: #5b3a1f;
  font-size: 1.1rem;
  text-shadow: 
    0 3px 6px rgba(0, 0, 0, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.2);
  font-weight: 800;
  line-height: 1.6;

  /* 立体感 */
  box-shadow: 
    0 8px 20px rgba(0,0,0,0.3),
    inset 0 1px 2px rgba(255,255,255,0.3);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: all 0.25s ease;

  /* フォント統一 */
  font-family: 'Noto Serif JP', 'Yu Mincho', serif;
  letter-spacing: 0.03em;
}

.route-choice-btn:hover {
  background: rgba(245, 233, 214, 0.7);
  border-color: rgba(91, 58, 31, 1);
  box-shadow: 
    0 12px 28px rgba(0,0,0,0.35),
    inset 0 1px 2px rgba(255,255,255,0.5);
  transform: translateY(-6px);
}

.route-choice-btn:focus-visible {
  outline: 3px solid rgba(91, 58, 31, 0.9);
  outline-offset: 2px;
  background: rgba(245, 233, 214, 0.65);
}

.route-choice-btn:active {
  transform: scale(0.98) translateY(-2px);
  background: rgba(245, 233, 214, 0.65);
  box-shadow: 
    0 6px 12px rgba(0,0,0,0.25),
    inset 0 2px 4px rgba(0,0,0,0.1);
}

/* エンド画面 */

.end-content {
  padding: 3rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.letter-area {
  min-height: 90vh;
  overflow: visible;
}

.letter-area {
  position: relative;
  margin: 0 auto;
  max-width: 600px;
  background-color: rgba(245, 233, 214, 0.95);
  color: #3b2a1c;
  border-radius: 1.2rem;
  padding: 1.8rem;
  overflow: hidden;
  cursor: pointer;
  
  /* 古びた枠線 - より強調 */
  border: 3px solid rgba(139, 90, 43, 0.8);
  
  /* 羊皮紙のリッチなテクスチャー */
  background-image:
    /* ランダム性のある細かいノイズ1 */
    radial-gradient(circle at 20% 30%, rgba(139, 90, 43, 0.15) 1px, transparent 1px),
    radial-gradient(circle at 60% 70%, rgba(139, 90, 43, 0.1) 0.5px, transparent 0.5px),
    /* ランダム性のある細かいノイズ2 */
    radial-gradient(circle at 40% 60%, rgba(0, 0, 0, 0.08) 1.5px, transparent 1.5px),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.3) 1px, transparent 1px),
    /* ざらつき効果 */
    radial-gradient(rgba(139, 90, 43, 0.06) 1px, transparent 1px),
    /* 古い紙の焼けた効果 */
    linear-gradient(45deg, rgba(210, 180, 140, 0.1) 25%, transparent 25%, transparent 75%, rgba(210, 180, 140, 0.1) 75%),
    /* 光の流れ */
    linear-gradient(90deg, rgba(255,255,255,0.08) 0%, transparent 50%, rgba(0,0,0,0.04) 100%);
  background-size: 
    60px 60px,
    90px 90px,
    40px 40px,
    100px 100px,
    4px 4px,
    20px 20px,
    100% 100%;
  background-position:
    0 0,
    10px 10px,
    5px 5px,
    15px 15px,
    0 0,
    0 0,
    0 0;
  background-blend-mode: overlay, overlay, overlay, screen, overlay, overlay, normal;
  
  /* 古びた雰囲気 */
  filter: sepia(0.2) contrast(1.08) brightness(0.98);
  
  /* 立体感のある複層の影 - より強調 */
  box-shadow: 
    0 0 0 3px rgba(139, 90, 43, 0.35),
    0 12px 24px rgba(0, 0, 0, 0.25),
    0 4px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 3px rgba(255, 255, 255, 0.6),
    inset 0 -3px 6px rgba(0, 0, 0, 0.12);
}

.letter-header {
  margin-bottom: 1rem;
}

.end-title {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #8b6f47;
  text-shadow: 
    0 3px 8px rgba(0, 0, 0, 0.3),
    0 1px 2px rgba(255, 255, 255, 0.4);
  margin-bottom: 1.2rem;
  line-height: 1.6;
  word-spacing: 0.2em;
  
  /* 枠と背景 */
  border: 2px solid rgba(139, 90, 43, 0.8);
  border-radius: 0.6rem;
  background-color: rgba(245, 233, 214, 0.6);
  padding: 0.8rem 1.2rem;
  display: inline-block;
  width: auto;
  margin-left: auto;
  margin-right: auto;
  
  /* 立体感 */
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 2px rgba(255, 255, 255, 0.5),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.letter-image-wrapper {
  position: relative;
  height: 700px;
  overflow: hidden;
}

.end-image {
  width: 120%;
  height: 100%;
  object-fit: cover;
  transform: translateX(-10%);
  filter: sepia(0.9) contrast(1.1) brightness(0.9);
}

/* 手紙縮小演出（JS側で .letter-shrink を付与） */

.letter-shrink {
  transform: scale(0.85) rotate(-1deg);
  opacity: 0.85;
  filter: brightness(0.9);
  transition: all 1.2s ease;
}

/* 占い師コメント - ボタンではなく紙のような見た目 */

.fortune-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: -30rem;
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  
  /* 紙のような枠 - 薄い、淡い影 */
  border: 1px solid rgba(139, 90, 43, 0.5);
  border-radius: 0.3rem;
  background-color: rgba(245, 233, 214, 0.4);
  padding: 1.2rem;
  backdrop-filter: blur(2px);
  
  /* 淡い影のみ */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fortune-area:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}

.fortune-text {
  margin-bottom: 1.5rem;
  line-height: 1.8;
  font-size: 1.2rem;
  font-weight: 700;
  color: #5b3a1f;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.02em;
}

/* シェア・再診断ボタン */

.share-btn {
  padding: 0.6rem 1.6rem;
  border-radius: 0.8rem;
  background-color: #7a4a2a;
  color: #f5e9d6;
  margin-right: 0.6rem;
}

.share-btn:hover {
  background-color: #9b5b34;
}

.retry-btn {
  padding: 0.6rem 1.6rem;
  border-radius: 0.8rem;
  background-color: rgba(0, 0, 0, 0.4);
  color: #f5e9d6;
}

.retry-btn:hover {
  background-color: rgba(0, 0, 0, 0.6);
}

/* 真の終幕 */

.final-content {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #000;
  color: #f5f5f5;
  text-align: center;
  padding: 2rem;
}

.final-line {
  margin-bottom: 0.8rem;
}

.final-last {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ロック画面 */

#locked-screen {
  background: black;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  opacity: 0;
  transition: opacity 1.5s ease;
}

#locked-screen.active {
  opacity: 1;
}

.locked-content {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #000;
  color: #f5f5f5;
}

/* クレジット */

.credit-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

.credit-modal.hidden {
  display: none;
}

.credit-inner {
  background-color: rgba(245, 233, 214, 0.95);
  color: #3b2a1c;
  padding: 1.2rem 1.6rem;
  border-radius: 1rem;
  min-width: 240px;
  text-align: center;
  box-shadow: 0 0 12px rgba(0,0,0,0.4);
}

.small-btn {
  margin-top: 1rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.4);
  color: #f5e9d6;
  cursor: pointer;
}

.small-btn:hover {
  background-color: rgba(0, 0, 0, 0.6);
}

/* スマホ最適化 */

@media (max-width: 600px) {
  .home-content .title {
    font-size: 1.8rem;
  }

  .home-content .subtitle {
    font-size: 1rem;
  }

  .choice-btn {
    font-size: 0.9rem;
    padding: 0.7rem 0.8rem;
  }

  .question-text {
    font-size: 1.1rem;
  }

  .end-image {
    width: 90%;
  }

  .final-content {
    padding: 1rem;
    font-size: 0.9rem;
  }
}

#route-screen {
  position: relative;
  z-index: 10;
}

#route-choices {
  position: relative;
  z-index: 20;
}

.route-shadow,
.particle-layer {
  z-index: 0 !important;
  pointer-events: none;
}

/* タイトルフェードイン */
.fade-in {
  opacity: 0;
  transition: opacity 1.5s ease;
}
.fade-in.fade-active {
  opacity: 1;
}

/* タイトルフェードアウト */

.fade-out {
  opacity: 1;
  transition: opacity 1s ease;
}
.fade-out.fade-active {
  opacity: 0;
}
/* タイピング表示枠 */
.home-message-box {
  max-width: 600px;
  margin: 0px auto 20px;
  padding: 20px;
  min-height: 120px;
  text-align: center;
  color: #fff;
  font-size: 18px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.hidden {
  display: none;
}

/* ルート画面の背景 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(white 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.05;
  pointer-events: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, transparent 60%, rgba(0,0,0,0.7));
  pointer-events: none;
}

.body-bg-home {
  background-image: url("../assets/img/bg.jpg");
}

.body-bg-question {
  background-image: url("../assets/img/bg_question.jpg");
}

body {
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

/* 占い師コメント - セピア色、ボタンではなく紙のような見た目 */
.question-message {
  color: #5b3a1f;
  font-size: 1rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-top: 1.5rem;
  letter-spacing: 0.05em;
  
  /* 紙のような枠 - 薄い、淡い影 */
  border: 1px solid rgba(91, 58, 31, 0.5);
  border-radius: 0.3rem;
  background-color: rgba(245, 233, 214, 0.4);
  padding: 1rem 1.2rem;
  backdrop-filter: blur(2px);
  
  /* 淡い影のみ */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
