:root {
  --primary: #e11d48;
  --primary-hover: #be123c;
  --primary-light: #ffe4e6;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-focus: #cbd5e1;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --error: #dc2626;
  --error-bg: #fee2e2;
  --hint-bg: #fef3c7;
  --hint-border: #fcd34d;
  --hint-text: #92400e;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.04);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ヘッダー（スクロールに追従） */
.site-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-accuracy {
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* 正解率上昇時の輝きアニメーション（2秒間） */
.header-accuracy.shining {
  animation: accuracyGlow 2s ease-in-out forwards;
}

.header-accuracy.shining::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.95) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(25deg);
  animation: shimmerSweep 1.2s ease-in-out;
  pointer-events: none;
}

@keyframes accuracyGlow {
  0% {
    transform: scale(1);
    color: #475569;
    background: #f1f5f9;
    border-color: #e2e8f0;
    box-shadow: none;
  }
  15% {
    transform: scale(1.14);
    color: #92400e;
    background: #fef3c7;
    border-color: #f59e0b;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.7), 0 0 30px rgba(251, 191, 36, 0.45);
  }
  45% {
    transform: scale(1.1);
    color: #92400e;
    background: #fef08a;
    border-color: #eab308;
    box-shadow: 0 0 22px rgba(234, 179, 8, 0.85), 0 0 38px rgba(245, 158, 11, 0.55);
  }
  75% {
    transform: scale(1.04);
    color: #92400e;
    background: #fef3c7;
    border-color: #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
  }
  100% {
    transform: scale(1);
    color: #475569;
    background: #f1f5f9;
    border-color: #e2e8f0;
    box-shadow: none;
  }
}

@keyframes shimmerSweep {
  0% {
    left: -75%;
  }
  100% {
    left: 160%;
  }
}

.logo-area {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #64748b;
  transition: color 0.2s;
}

.logo-area:hover {
  color: var(--text-main);
}

.logo-text {
  font-family: "Georgia", "Baskerville", "Times New Roman", "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #334155;
}

.logo-text .logo-initial {
  font-size: 1.25em;
  font-weight: 700;
}

.logo-text .logo-quiz {
  color: var(--primary);
  font-weight: 700;
}

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

.lang-switch {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 20px;
  padding: 3px;
  border: 1px solid var(--border);
}

.lang-btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--card-bg);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-link:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* メインコンテナ */
.main-content {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* 問題更新日時バー（ヘッダーと問題カードの間） */
.update-time-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.update-icon {
  font-size: 0.92rem;
  line-height: 1;
}

.update-time-text {
  letter-spacing: 0.01em;
}

/* クイズカード */
.quiz-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 32px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.quiz-source-badge {
  background: #f1f5f9;
  color: #475569;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.score-badge {
  font-weight: 700;
  color: var(--primary);
}

/* 問題文表示エリア */
.question-container {
  margin-bottom: 24px;
}

.question-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: block;
}

.question-text {
  font-size: 1.42rem;
  font-weight: 500;
  line-height: 1.85;
  color: var(--text-main);
  word-break: break-word;
  background: #fcfcfc;
  padding: 24px 26px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-focus);
}

/* 🍎伏字のハイライト演出 */
.masked-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  background: var(--primary-light);
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 0 8px;
  margin: 0 8px;
  font-size: 1.45rem;
  line-height: 1;
  vertical-align: middle;
  animation: pulse-apple 2s infinite ease-in-out;
}

@keyframes pulse-apple {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 0 6px rgba(225, 29, 72, 0);
  }
}

/* ヒントエリア */
.hint-area {
  margin-bottom: 28px;
}

.hint-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: #b45309;
  background-color: #fffbeb;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.hint-toggle-btn:hover {
  background-color: var(--hint-bg);
  border-color: var(--hint-border);
}

.hint-box {
  margin-top: 12px;
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  color: var(--hint-text);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  display: none;
  animation: fadeIn 0.3s ease;
}

.hint-box.active {
  display: block;
}

.hint-link {
  color: #b45309;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: underline;
  word-break: break-all;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

.hint-link:hover {
  color: #78350f;
  text-decoration: none;
}

/* 3択選択肢エリア */
.choices-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.choice-btn {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  min-height: 88px;
  position: relative;
}

.choice-value {
  font-size: 2.3rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: #fff1f2;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.choice-btn:disabled {
  cursor: default;
  opacity: 0.65;
}

.choice-btn.correct {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
  opacity: 1 !important;
  animation: bounce-correct 0.5s ease;
}

.choice-btn.incorrect {
  background: var(--error-bg) !important;
  border-color: var(--error) !important;
  color: var(--error) !important;
  opacity: 1 !important;
  animation: shake 0.4s ease;
}

@keyframes bounce-correct {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

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

/* 回答結果エリア */
.result-box {
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-top: 16px;
  display: none;
  animation: slideDown 0.35s ease;
  scroll-margin-top: 80px;
}

.result-box.active {
  display: block;
}

.result-box.correct {
  background: var(--success-bg);
  border: 1px solid #86efac;
}

.result-box.incorrect {
  background: var(--error-bg);
  border: 1px solid #fca5a5;
}

.result-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-title.correct { color: #15803d; }
.result-title.incorrect { color: #b91c1c; }

.result-detail {
  font-size: 0.95rem;
  color: #334155;
  margin-bottom: 12px;
  line-height: 1.7;
}

.result-detail strong {
  font-size: 1.25em;
  font-weight: 600;
  color: var(--primary);
  padding: 0 2px;
}

.result-original-title {
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.6;
  margin-top: 6px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-sm);
  display: block;
}

.result-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.98rem;
  transition: color 0.2s ease;
}

.result-link:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

/* 「次の問題へ」アクション */
.action-area {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

.next-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 28px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.3);
}

.next-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.4);
}

.next-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* アドセンス広告エリア */
.ad-area {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  text-align: center;
  min-height: 100px;
  overflow: hidden;
}

.ad-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
  text-align: center;
}

/* ローディング & エラー表示 */
.loading-indicator {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ソース元一覧ページ (sources.html) 用スタイル */
.page-title-area {
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.page-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

.source-item-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.source-item-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.source-item-info {
  flex: 1;
}

.source-item-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  text-decoration: underline;
  text-underline-offset: 3px;
  line-height: 1.5;
  display: block;
  margin-bottom: 6px;
  transition: color 0.2s ease;
}

.source-item-title:hover {
  color: var(--primary);
  text-decoration: none;
}

.source-item-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-open-btn {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  border: 1px solid #dbeafe;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.source-open-btn:hover {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

/* 説明文内のフィード一覧へのアンカーリンク */
.desc-feed-link {
  color: var(--primary);
  font-weight: 600;
  font-size: 1.05em;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.desc-feed-link:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

/* 配信元公式RSS/RDFフィード一覧 */
.feeds-section {
  margin-top: 56px;
  margin-bottom: 24px;
  scroll-margin-top: 80px;
}

.feeds-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-sm);
}

.feeds-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.feeds-title {
  font-family: var(--font-serif);
  font-size: 1.38rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

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

.feeds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.feed-item-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
}

.feed-item-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feed-item-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.feed-item-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
}

.feed-item-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.feed-item-name {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-item-name:hover {
  color: var(--primary);
  text-decoration: none;
}

.feed-item-cat {
  font-size: 0.78rem;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  align-self: flex-start;
  font-weight: 600;
}

.feed-item-body {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  min-width: 0;
}

.feed-type-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  flex-shrink: 0;
}

.feed-item-url {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  transition: color 0.2s ease;
}

.feed-item-url:hover {
  color: var(--primary);
  text-decoration: none;
}

/* フッター（ページの最下部に配置） */
.site-footer {
  margin-top: auto;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 32px 20px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer .lang-switch {
  margin: 4px auto;
}

.footer-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-link-main {
  font-weight: 800;
  font-size: 1rem;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  letter-spacing: -0.01em;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.footer-link-main:hover {
  color: var(--primary-hover);
  text-decoration: none;
  background: var(--primary-light);
}

.footer-link-author {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.footer-link-author:hover {
  color: var(--primary-hover);
  text-decoration: none;
  background: var(--primary-light);
}

.footer-link-sub {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.footer-link-sub:hover {
  color: var(--primary);
  text-decoration: none;
  background: #f1f5f9;
}

.footer-score {
  font-weight: 700;
  color: #334155;
  font-size: 0.88rem;
  padding-top: 4px;
}

/* レスポンシブ対応 */
@media (max-width: 640px) {
  .choices-container {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .choice-btn {
    min-height: 60px;
    padding: 12px 16px;
    justify-content: center;
  }

  .choice-value {
    font-size: 1.85rem;
  }

  .quiz-card {
    padding: 22px 18px;
  }

  .question-text {
    font-size: 1.15rem;
    line-height: 1.75;
    padding: 18px 16px;
  }

  .masked-char {
    min-width: 42px;
    height: 42px;
    margin: 0 5px;
    font-size: 1.25rem;
  }

  .logo-text {
    font-size: 1.05rem;
  }

  .header-accuracy {
    font-size: 0.8rem;
    padding: 3px 8px;
  }

  .header-inner {
    padding: 10px 14px;
  }

  .feeds-card {
    padding: 22px 16px;
  }

  .feeds-grid {
    grid-template-columns: 1fr;
  }
}

