/* ==========================================================================
   浄土真宗クイズ 和モダン・スタイルシート
   ========================================================================== */

:root {
  --color-bg-dark: #0f141c;
  --color-bg-card: rgba(22, 29, 41, 0.88);
  --color-card-border: rgba(212, 175, 55, 0.28);
  --color-gold-light: #fbeea4;
  --color-gold: #d4af37;
  --color-gold-dark: #997c1d;
  --color-gold-glow: rgba(212, 175, 55, 0.4);
  --color-crimson: #c83838;
  --color-crimson-light: #ff7575;
  --color-green-matcha: #4d7c58;
  --color-cream: #fbf7ee;
  --color-text-muted: #b9bfcb;
  --color-text-dark: #2a2c33;
  --color-accent-blue: #3b82f6;

  --font-serif: "Shippori Mincho", "Yu Mincho", "Hiragino Mincho ProN", "MS PMincho", "Noto Serif JP", serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif;

  --shadow-gold: 0 10px 30px -10px rgba(212, 175, 55, 0.25);
  --shadow-box: 0 12px 35px rgba(0, 0, 0, 0.5);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* ライトテーマ（白木・和紙モード） */
body.theme-light {
  --color-bg-dark: #f7f4ed;
  --color-bg-card: rgba(255, 255, 255, 0.95);
  --color-card-border: rgba(184, 134, 11, 0.35);
  --color-gold-light: #6e4e04;
  --color-gold: #966f14;
  --color-gold-dark: #5e4100;
  --color-gold-glow: rgba(184, 134, 11, 0.2);
  --color-cream: #2d2925;
  --color-text-muted: #615c54;
  --color-text-dark: #1c1a18;
  --shadow-box: 0 10px 30px rgba(100, 80, 50, 0.1);
}

body.theme-light::before {
  background-image: 
    radial-gradient(circle at 50% 20%, rgba(212, 175, 55, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(77, 124, 88, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 20% 90%, rgba(200, 56, 56, 0.06) 0%, transparent 50%);
}

body.theme-light .card {
  color: #2d2925;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

body.theme-light .hero-title,
body.theme-light .question-text,
body.theme-light .result-title,
body.theme-light .hougo-quote,
body.theme-light .review-q-title,
body.theme-light .score-val {
  color: #1c1a18;
}

body.theme-light .hero-title span {
  background: linear-gradient(135deg, #443204 0%, #876208 50%, #b8860b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.theme-light .ctrl-btn {
  background: rgba(0, 0, 0, 0.04);
  color: #38342e;
  border-color: rgba(184, 134, 11, 0.3);
}

body.theme-light .mode-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(184, 134, 11, 0.25);
}

body.theme-light .mode-title {
  color: #1c1a18;
}

body.theme-light .option-btn {
  background: rgba(0, 0, 0, 0.02);
  color: #2d2925;
  border-color: rgba(184, 134, 11, 0.3);
}

body.theme-light .option-letter {
  background: rgba(184, 134, 11, 0.1);
  color: #7a5405;
  border-color: rgba(184, 134, 11, 0.35);
}

body.theme-light .explanation-card {
  background: #f4eee3;
  color: #2d2925;
  border-color: var(--color-gold);
}

body.theme-light .exp-body {
  color: #38342e;
}

body.theme-light .trivia-box {
  background: rgba(184, 134, 11, 0.1);
  color: #5e4100;
}

body.theme-light .stat-item,
body.theme-light .result-comment-box,
body.theme-light .review-item {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(184, 134, 11, 0.25);
}

body.theme-light .meigen-box {
  background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.2) 0%, rgba(247, 244, 237, 0.9) 100%);
}

body.theme-light .meigen-text {
  color: #1c1a18;
}

body.theme-light .modal-window {
  background: #fdfbf7;
  color: #2d2925;
}

body.theme-light .modal-header {
  border-bottom-color: rgba(184, 134, 11, 0.2);
  background: rgba(0, 0, 0, 0.02);
}

body.theme-light .term-item {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

body.theme-light .terms-search-input {
  background: #fff;
  color: #2d2925;
  border-color: rgba(184, 134, 11, 0.35);
}

body.theme-light .hougo-tanzaku {
  background: radial-gradient(circle at 50% 20%, rgba(212, 175, 55, 0.18) 0%, rgba(247, 244, 237, 0.95) 100%);
}

body.theme-light .app-footer {
  color: rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  font-family: var(--font-serif);
  background: var(--color-bg-dark);
  color: var(--color-cream);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ボタンや選択肢の誤選択（青ハイライト）防止 */
button, .option-btn, .mode-card, .brand-group {
  -webkit-user-select: none;
  user-select: none;
}

/* 和紙と雲紋の背景パターン */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(circle at 50% 20%, rgba(212, 175, 55, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(77, 124, 88, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 20% 90%, rgba(200, 56, 56, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* 蓮の花びら（散華）キャンバス */
#sange-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
}

/* 共通コンテナ */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ヘッダーエリア */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-emblem {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, #fbeea4 0%, #d4af37 60%, #856114 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
  color: #1a191d;
  font-weight: bold;
  font-size: 20px;
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-gold-light);
  letter-spacing: 0.08em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  letter-spacing: 0.12em;
}

.header-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ctrl-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--color-cream);
  padding: 8px 14px;
  border-radius: 30px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.ctrl-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--color-gold);
  transform: translateY(-1px);
}

/* カード基盤 */
.card {
  background: var(--color-bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-box), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  padding: 36px 32px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* カード四隅の和風飾り文様 */
.card::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: calc(var(--radius-lg) - 6px);
  pointer-events: none;
}

/* 画面切り替えアニメーション */
.screen {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.active {
  display: block;
}

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

/* ==========================================================================
   1. スタート画面
   ========================================================================== */

.start-hero {
  text-align: center;
  padding: 20px 10px 30px;
}

.hero-subtitle {
  display: inline-block;
  font-size: 0.9rem;
  letter-spacing: 0.25em;
  color: var(--color-gold);
  border-top: 1px solid var(--color-gold);
  border-bottom: 1px solid var(--color-gold);
  padding: 3px 18px;
  margin-bottom: 18px;
  text-transform: uppercase;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: 0.08em;
  text-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
}

.hero-title span {
  color: var(--color-gold-light);
  background: linear-gradient(135deg, #fff 0%, #fbeea4 50%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  max-width: 580px;
  margin: 0 auto 30px;
  line-height: 1.9;
}

/* モード選択グリッド */
.mode-selection-title {
  font-size: 1.1rem;
  color: var(--color-gold);
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: 0.15em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.mode-selection-title::before,
.mode-selection-title::after {
  content: "";
  display: block;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.mode-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
  position: relative;
  overflow: hidden;
}

.mode-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--color-gold);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mode-card:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: var(--color-gold);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.mode-card.selected {
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--color-gold);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

.mode-card.selected::after {
  opacity: 1;
}

.mode-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.mode-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.badge-beginner {
  background: rgba(77, 124, 88, 0.25);
  color: #8ce19e;
  border: 1px solid rgba(77, 124, 88, 0.5);
}

.badge-intermediate {
  background: rgba(212, 175, 55, 0.2);
  color: #fae082;
  border: 1px solid rgba(212, 175, 55, 0.5);
}

.badge-advanced {
  background: rgba(200, 56, 56, 0.2);
  color: #ff9999;
  border: 1px solid rgba(200, 56, 56, 0.5);
}

.badge-all {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.5);
}

.mode-q-count {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.mode-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-cream);
  margin-bottom: 6px;
}

.mode-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* 開始ボタン */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  padding: 18px 32px;
  background: linear-gradient(135deg, #e3c457 0%, #d4af37 50%, #997c1d 100%);
  color: #1a1405;
  border: none;
  border-radius: 50px;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.35);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 30px rgba(212, 175, 55, 0.5);
  background: linear-gradient(135deg, #fbeea4 0%, #dfb941 50%, #ad8d25 100%);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* ==========================================================================
   2. クイズプレイ画面
   ========================================================================== */

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.quiz-progress-text {
  font-size: 0.95rem;
  color: var(--color-gold);
  letter-spacing: 0.08em;
  font-weight: 600;
}

.quiz-score-live {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-family: var(--font-sans);
}

.quiz-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 28px;
}

.quiz-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #d4af37, #fbeea4);
  border-radius: 6px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.question-box {
  margin-bottom: 30px;
}

.question-number-badge {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--color-gold-light);
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.question-text {
  font-size: 1.35rem;
  line-height: 1.7;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* 4択選択肢 */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}

.option-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 22px;
  color: var(--color-cream);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  text-align: left;
  line-height: 1.5;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s ease;
  position: relative;
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: var(--color-gold);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  font-weight: 700;
  background: rgba(0, 0, 0, 0.25);
}

.option-text {
  flex: 1;
}

.option-btn:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--color-gold);
  transform: translateX(4px);
}

.option-btn:disabled {
  cursor: default;
}

/* 正解・不正解の状態クラス */
.option-btn.correct {
  background: rgba(46, 125, 50, 0.3) !important;
  border-color: #4caf50 !important;
  box-shadow: 0 0 16px rgba(76, 175, 80, 0.35);
  color: #bbf7d0 !important;
  animation: pulseGreen 0.6s ease;
}

.option-btn.correct .option-letter {
  background: #2e7d32;
  border-color: #4caf50;
  color: #fff;
}

.option-btn.wrong {
  background: rgba(198, 40, 40, 0.3) !important;
  border-color: #ef5350 !important;
  color: #fecaca !important;
  animation: shake 0.4s ease;
}

.option-btn.wrong .option-letter {
  background: #c62828;
  border-color: #ef5350;
  color: #fff;
}

.option-btn.dimmed {
  opacity: 0.4;
}

@keyframes pulseGreen {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* 解説ボックス（回答後にスライドイン） */
.explanation-card {
  display: none;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 10px;
  margin-bottom: 24px;
  animation: slideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.explanation-card.active {
  display: block;
}

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

.exp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 1.15rem;
  font-weight: 700;
}

.exp-header.correct {
  color: #4ade80;
}

.exp-header.wrong {
  color: #f87171;
}

.exp-body {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #e2e8f0;
  margin-bottom: 16px;
}

.trivia-box {
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid var(--color-gold);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  color: var(--color-gold-light);
  line-height: 1.7;
}

.trivia-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--color-gold);
}

.next-action-wrap {
  text-align: right;
  margin-top: 20px;
}

.btn-next {
  background: linear-gradient(135deg, #d4af37, #997c1d);
  color: #1a1405;
  border: none;
  border-radius: 30px;
  padding: 14px 32px;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

/* ==========================================================================
   3. 結果画面
   ========================================================================== */

.result-container {
  text-align: center;
  padding: 10px 0;
}

.result-badge {
  display: inline-block;
  font-size: 0.9rem;
  padding: 6px 18px;
  border-radius: 20px;
  background: rgba(212, 175, 55, 0.2);
  color: var(--color-gold-light);
  border: 1px solid var(--color-gold);
  margin-bottom: 16px;
}

.result-title {
  font-size: 2.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: 0.06em;
}

.result-subtitle {
  color: var(--color-gold);
  font-size: 1.1rem;
  margin-bottom: 24px;
  letter-spacing: 0.12em;
}

/* スコアサークル */
.score-circle-wrap {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-bg-circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
}

.score-fill-circle {
  fill: none;
  stroke: url(#goldGrad);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.score-number-display {
  position: absolute;
  text-align: center;
}

.score-val {
  font-size: 2.8rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-sans);
  line-height: 1;
}

.score-unit {
  font-size: 0.95rem;
  color: var(--color-gold);
  margin-top: 4px;
}

.result-stats-row {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 26px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  min-width: 130px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.stat-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-gold-light);
  font-family: var(--font-sans);
}

.result-comment-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  max-width: 620px;
  margin: 0 auto 30px;
  font-size: 0.95rem;
  line-height: 1.8;
  color: #e2e8f0;
}

/* ありがたいお言葉カード */
.meigen-box {
  background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.15) 0%, rgba(15, 20, 28, 0.6) 100%);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  max-width: 620px;
  margin: 0 auto 34px;
  text-align: center;
  position: relative;
}

.meigen-title {
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--color-gold);
  margin-bottom: 12px;
}

.meigen-text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.7;
  color: #fff;
  margin-bottom: 8px;
}

.meigen-source {
  font-size: 0.85rem;
  color: var(--color-gold-light);
  text-align: right;
  margin-bottom: 10px;
}

.meigen-meaning {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  border-top: 1px dashed rgba(212, 175, 55, 0.25);
  padding-top: 10px;
  text-align: left;
  line-height: 1.6;
}

/* アクションボタン群 */
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-bottom: 40px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--color-cream);
  padding: 14px 28px;
  border-radius: 30px;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--color-gold);
  transform: translateY(-2px);
}

.btn-share {
  background: #000;
  border: 1px solid #333;
  color: #fff;
  padding: 14px 28px;
  border-radius: 30px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.btn-share:hover {
  background: #111;
  border-color: #555;
  transform: translateY(-2px);
}

/* 復習アコーディオン */
.review-section {
  text-align: left;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  padding-top: 28px;
}

.review-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.review-section-title {
  font-size: 1.25rem;
  color: var(--color-gold);
  letter-spacing: 0.08em;
}

.review-filter-tabs {
  display: flex;
  gap: 8px;
}

.filter-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--color-text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.filter-tab.active {
  background: rgba(212, 175, 55, 0.2);
  color: var(--color-gold-light);
  border-color: var(--color-gold);
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.review-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: border-color 0.2s ease;
}

.review-item.is-correct {
  border-left: 4px solid #4ade80;
}

.review-item.is-wrong {
  border-left: 4px solid #f87171;
}

.review-q-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.review-q-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.5;
}

.review-status-tag {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-weight: bold;
  white-space: nowrap;
}

.review-status-tag.correct {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.review-status-tag.wrong {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

.review-answer-row {
  font-size: 0.88rem;
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.review-answer-correct {
  color: #4ade80;
}

.review-answer-user {
  color: #f87171;
}

.review-explanation {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-top: 6px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   モーダル共通スタイル（今日のご法語・用語事典）
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  background: #141a24;
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(212, 175, 55, 0.2);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-window {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(255, 255, 255, 0.02);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-icon {
  font-size: 1.3rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-gold-light);
  letter-spacing: 0.08em;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  line-height: 1.8;
}

/* ご法語（日めくり短冊風） */
.hougo-container {
  text-align: center;
  padding: 10px 0;
}

.hougo-tanzaku {
  background: radial-gradient(circle at 50% 20%, rgba(212, 175, 55, 0.12) 0%, rgba(20, 26, 36, 0.8) 100%);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: var(--radius-md);
  padding: 30px 24px;
  margin-bottom: 24px;
  position: relative;
}

.hougo-tanzaku::before,
.hougo-tanzaku::after {
  content: "❖";
  color: var(--color-gold);
  font-size: 0.9rem;
  display: block;
}

.hougo-tanzaku::before {
  margin-bottom: 16px;
}

.hougo-tanzaku::after {
  margin-top: 16px;
}

.hougo-quote {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.8;
  color: #fff;
  margin-bottom: 16px;
  letter-spacing: 0.06em;
}

.hougo-source {
  font-size: 0.95rem;
  color: var(--color-gold-light);
  text-align: right;
  margin-bottom: 18px;
}

.hougo-meaning {
  border-top: 1px dashed rgba(212, 175, 55, 0.25);
  padding-top: 16px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-align: left;
  line-height: 1.8;
}

.hougo-reload-btn {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--color-gold);
  color: var(--color-gold-light);
  padding: 10px 24px;
  border-radius: 30px;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.hougo-reload-btn:hover {
  background: rgba(212, 175, 55, 0.25);
  transform: translateY(-2px);
}

/* 用語事典 */
.terms-search-wrapper {
  margin-bottom: 18px;
}

.terms-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 30px;
  padding: 12px 20px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 16px; /* iOS Safariでの自動ズーム防止 */
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.terms-search-input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
}

.terms-search-input::placeholder {
  color: var(--color-text-muted);
}

.terms-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.term-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: all 0.2s ease;
}

.term-item:hover {
  border-color: rgba(212, 175, 55, 0.35);
  background: rgba(212, 175, 55, 0.04);
}

.term-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.term-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-gold-light);
}

.term-category {
  font-size: 0.72rem;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--color-gold);
  padding: 2px 10px;
  border-radius: 12px;
  font-family: var(--font-sans);
}

.term-summary {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* フッター */
.app-footer {
  text-align: center;
  padding: 20px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   レスポンシブ・スマートフォン最適化 (iPhone / Android / 各種ブラウザ)
   ========================================================================== */

@media (max-width: 640px) {
  .app-container {
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .app-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .brand-group {
    justify-content: center;
  }

  .header-controls {
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .ctrl-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
    gap: 4px;
    flex: 1 1 auto;
    justify-content: center;
    min-width: 72px;
  }

  .card {
    padding: 20px 16px;
    border-radius: var(--radius-md);
  }

  .start-hero {
    padding: 10px 4px 20px;
  }

  .hero-subtitle {
    font-size: 0.8rem;
    padding: 2px 12px;
    margin-bottom: 12px;
  }

  .hero-title {
    font-size: 1.55rem;
    line-height: 1.35;
    margin-bottom: 10px;
  }

  .hero-desc {
    font-size: 0.88rem;
    line-height: 1.7;
    margin-bottom: 20px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
  }

  .mode-card {
    padding: 16px;
  }

  .mode-title {
    font-size: 1.05rem;
  }

  .mode-desc {
    font-size: 0.82rem;
  }

  .btn-primary {
    max-width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
  }

  /* クイズ画面 */
  .question-box {
    margin-bottom: 20px;
  }

  .question-number-badge {
    font-size: 0.75rem;
    padding: 3px 10px;
    margin-bottom: 10px;
  }

  .question-text {
    font-size: 1.15rem;
    line-height: 1.6;
  }

  .options-grid {
    gap: 10px;
    margin-bottom: 20px;
  }

  .option-btn {
    padding: 14px 16px;
    font-size: 0.95rem;
    gap: 12px;
    min-height: 52px; /* 指で押しやすいタップ領域 */
  }

  .option-letter {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.85rem;
  }

  .explanation-card {
    padding: 18px 16px;
    margin-bottom: 20px;
  }

  .exp-header {
    font-size: 1.05rem;
  }

  .exp-body {
    font-size: 0.9rem;
    line-height: 1.7;
  }

  .trivia-box {
    padding: 10px 12px;
    font-size: 0.84rem;
  }

  .btn-next {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 1rem;
  }

  /* 結果画面 */
  .result-title {
    font-size: 1.6rem;
  }

  .result-subtitle {
    font-size: 0.95rem;
    margin-bottom: 18px;
  }

  .score-val {
    font-size: 2.3rem;
  }

  .score-circle-wrap {
    width: 140px;
    height: 140px;
    margin-bottom: 20px;
  }

  .result-stats-row {
    gap: 8px;
    margin-bottom: 20px;
  }

  .stat-item {
    padding: 10px 8px;
    min-width: 0;
    flex: 1;
  }

  .stat-label {
    font-size: 0.72rem;
  }

  .stat-num {
    font-size: 1.15rem;
  }

  .result-comment-box {
    padding: 16px;
    font-size: 0.88rem;
    margin-bottom: 22px;
  }

  .meigen-box {
    padding: 18px 16px;
    margin-bottom: 24px;
  }

  .meigen-text {
    font-size: 1rem;
  }

  .meigen-meaning {
    font-size: 0.82rem;
  }

  .result-actions {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 28px;
  }

  .btn-secondary, .btn-share {
    width: 100%;
    justify-content: center;
    padding: 14px;
  }

  .review-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .review-filter-tabs {
    width: 100%;
    justify-content: flex-start;
  }

  /* モーダル */
  .modal-window {
    max-height: 90vh;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 16px 18px;
  }

  .modal-title {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 18px 16px;
  }

  .hougo-quote {
    font-size: 1.1rem;
  }
}

/* 超小型スマートフォン (iPhone SE 1st, 幅360px以下など) */
@media (max-width: 360px) {
  .hero-title {
    font-size: 1.35rem;
  }

  .brand-text h1 {
    font-size: 1.15rem;
  }

  .ctrl-btn span:last-child {
    display: none; /* アイコンのみ表示して横幅を収める */
  }

  .ctrl-btn {
    min-width: 40px;
    padding: 6px 8px;
  }
}

/* ==========================================================================
   YouTubeチャンネルPRカード
   ========================================================================== */

.youtube-promo-card {
  margin-top: 32px;
  background: radial-gradient(circle at 15% 50%, rgba(255, 0, 0, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(255, 70, 70, 0.3);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

body.theme-light .youtube-promo-card {
  background: radial-gradient(circle at 15% 50%, rgba(255, 0, 0, 0.06) 0%, rgba(255, 255, 255, 0.95) 100%);
  border-color: rgba(200, 30, 30, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.youtube-promo-card:hover {
  border-color: #ff3333;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 0, 0, 0.18);
}

.yt-left-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.yt-icon-box {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff1a1a 0%, #b30000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.35);
}

.yt-icon-svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.yt-info-group {
  text-align: left;
}

.yt-tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #ff7070;
  border: 1px solid rgba(255, 100, 100, 0.4);
  padding: 1px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
  font-family: var(--font-sans);
  font-weight: 600;
}

body.theme-light .yt-tag {
  color: #c41818;
  border-color: rgba(196, 24, 24, 0.4);
}

.yt-channel-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.theme-light .yt-channel-name {
  color: #1a191d;
}

.yt-channel-handle {
  font-size: 0.85rem;
  color: var(--color-gold-light);
  font-family: var(--font-sans);
  font-weight: normal;
}

body.theme-light .yt-channel-handle {
  color: #966f14;
}

.yt-channel-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.yt-action-btn {
  background: linear-gradient(135deg, #ff3333 0%, #cc0000 100%);
  color: #fff;
  padding: 10px 20px;
  border-radius: 30px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(255, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.youtube-promo-card:hover .yt-action-btn {
  background: linear-gradient(135deg, #ff4d4d 0%, #e60000 100%);
  transform: scale(1.03);
  box-shadow: 0 6px 18px rgba(255, 0, 0, 0.45);
}

/* ヘッダーのYouTubeボタン */
.ctrl-btn.ctrl-btn-yt {
  border-color: rgba(255, 70, 70, 0.35);
}

.ctrl-btn.ctrl-btn-yt:hover {
  background: rgba(255, 0, 0, 0.15);
  border-color: #ff3333;
}

@media (max-width: 640px) {
  .youtube-promo-card {
    flex-direction: column;
    align-items: stretch;
    padding: 18px 16px;
    gap: 14px;
    margin-top: 24px;
  }

  .yt-left-group {
    align-items: flex-start;
  }

  .yt-action-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }
}

