:root {
  --bg: #f5f2eb;
  --ink: #141c18;
  --muted: #58665d;
  --line: #e2dacb;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0f5c56;
  --accent-light: #e0f2fe;
  --danger: #b42318;
  --danger-light: #fef2f2;
  --ok: #15803d;
  --ok-light: #ecfdf5;
  --header-bg: rgba(247, 244, 237, 0.94);
  --stat-bg: #f3eee3;
  --meter-bg: #e8e0d1;
  --result-bg: #f1f7f4;
  --result-wrong-bg: #fff0ed;
  --badge-bg: linear-gradient(135deg, #fdfbfa, #f5efe3);
  --shadow: 0 12px 40px rgba(15, 118, 110, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 20px 48px rgba(15, 118, 110, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px; /* 固定ヘッダーの高さ分の余白（PC用） */
}

@media (max-width: 860px) {
  html {
    scroll-padding-top: 130px; /* 縦並びで高くなったヘッダーの高さ分の余白（スマホ用） */
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Outfit', 'Noto Sans JP', "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

button,
select {
  font: inherit;
  transition: var(--transition);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand,
.nav a {
  color: var(--ink);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
}

.nav {
  display: flex;
  gap: 22px;
  font-size: 14px;
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.55fr);
  gap: clamp(28px, 6vw, 80px);
  align-items: center;
  min-height: calc(86vh - 64px);
  padding: clamp(42px, 8vw, 96px) clamp(20px, 6vw, 82px) 52px;
}

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(38px, 6.2vw, 78px);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero p {
  max-width: 650px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
}

.hero-actions,
.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.button.primary {
  background: var(--accent);
  color: white;
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.secondary {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

.button.quiet {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.button.full {
  width: 100%;
}

.hero-panel,
.controls,
.quiz-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.hero-panel:hover,
.quiz-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.hero-panel {
  border-radius: 8px;
  padding: 28px;
}

.meter-label,
.progress-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.meter-card strong {
  display: block;
  margin-top: 8px;
  font-size: 56px;
  line-height: 1;
}

.meter {
  overflow: hidden;
  height: 10px;
  margin-top: 16px;
  border-radius: 999px;
  background: var(--meter-bg);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 24px;
}

.mini-stats span {
  padding: 14px 10px;
  border-radius: 8px;
  background: var(--stat-bg);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.mini-stats strong {
  display: block;
  color: var(--ink);
  font-size: 22px;
}

.quiz-section {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 20px;
  padding: 28px clamp(20px, 6vw, 82px) 80px;
}

.controls,
.quiz-card {
  border-radius: 8px;
}

.controls {
  position: sticky;
  top: 82px;
  align-self: start;
  padding: 22px;
}

.controls h2,
.method h2,
.data-note h2 {
  margin: 0 0 18px;
  font-size: 24px;
  line-height: 1.3;
}

.controls label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 11px;
}

.controls .button {
  margin-top: 8px;
}

.progress-box {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.progress-box strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.quiz-card {
  min-height: 520px;
  padding: clamp(24px, 5vw, 52px);
  scroll-margin-top: 96px;
  position: relative;
  overflow: hidden;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.question-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  transition: var(--transition);
  background: var(--panel);
}

/* 分野別のグラデーションカラーバッジ */
.question-meta span.topic-業法 { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.question-meta span.topic-権利 { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.question-meta span.topic-法令 { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.question-meta span.topic-税他 { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }

.quiz-card h2 {
  min-height: 138px;
  margin: 26px 0 30px;
  font-size: clamp(24px, 3.4vw, 38px);
  line-height: 1.45;
}

.answer-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.answer {
  position: relative;
  overflow: hidden;
  min-height: 104px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-size: 48px;
  font-weight: 900;
  transition: var(--transition);
}

.answer.true {
  color: var(--ok);
  border-color: rgba(21, 128, 61, 0.2);
}

.answer.false {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.2);
}

.answer.true:hover,
.answer.true.selected {
  background: var(--ok-light);
  border-color: var(--ok);
  box-shadow: 0 8px 24px rgba(21, 128, 61, 0.15);
  transform: translateY(-2px);
}

.answer.false:hover,
.answer.false.selected {
  background: var(--danger-light);
  border-color: var(--danger);
  box-shadow: 0 8px 24px rgba(180, 35, 24, 0.15);
  transform: translateY(-2px);
}

.result {
  margin-top: 22px;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--result-bg);
  padding: 18px 20px;
  color: var(--ink);
}

.result.wrong {
  border-left-color: var(--danger);
  background: var(--result-wrong-bg);
}

.result-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

#resultBadge {
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--ok);
  color: white;
  font-weight: 900;
}

.result.wrong #resultBadge {
  background: var(--danger);
}

.result p {
  margin: 0;
}

.method,
.data-note {
  margin: 0 clamp(20px, 6vw, 82px) 80px;
  padding: clamp(28px, 5vw, 54px) 0;
  border-top: 1px solid var(--line);
}

.method {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(300px, 1fr);
  gap: 42px;
  align-items: start;
}

.method p,
.data-note p {
  max-width: 780px;
  color: var(--muted);
  font-size: 17px;
}

.method-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.method-list li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.method-list strong {
  color: var(--accent);
}

.method-list span {
  color: var(--muted);
}

@media (max-width: 860px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
  }

  .hero,
  .quiz-section,
  .method {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 34px;
    padding-bottom: 28px;
  }

  .controls {
    position: static;
  }
}

@media (max-width: 560px) {
  .nav {
    font-size: 12px;
  }

  .mini-stats,
  .method-list li {
    grid-template-columns: 1fr;
  }

  .mini-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .quiz-card {
    min-height: auto;
    padding: 22px;
  }

  .quiz-card h2 {
    min-height: auto;
    margin: 18px 0 20px;
    font-size: 22px;
  }

  .answer-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .answer {
    min-height: 64px;
    font-size: 34px;
  }

  .result {
    margin-top: 16px;
    padding: 14px 16px;
  }
}

/* 応援メッセージ */
.cheer-message {
  font-weight: 700;
  color: var(--ok);
  font-size: 15px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.result.wrong .cheer-message {
  color: var(--danger);
}

/* カードシェイクアニメーション (不正解時) */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-8px); }
  30%, 60%, 90% { transform: translateX(8px); }
}
.shake {
  animation: shake 0.4s ease-in-out;
}

/* 紙吹雪アニメーション (正解時) */
.confetti-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  pointer-events: none;
  z-index: 10;
  animation: fall 1s ease-out forwards;
}
@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(280px) rotate(360deg);
    opacity: 0;
  }
}

/* 称号バッジ */
.badge-card {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.badge-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--badge-bg);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: var(--transition);
}
.badge-display:hover {
  transform: scale(1.02);
}
.badge-icon {
  font-size: 26px;
  display: grid;
  place-items: center;
  animation: badge-bounce 2s infinite ease-in-out;
}
.badge-display strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
}
@keyframes badge-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* スマホ用TOPボタン */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(15, 118, 110, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(15, 118, 110, 0.3);
  z-index: 99;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  pointer-events: none;
}
.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--accent-dark);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(15, 118, 110, 0.4);
}

/* プレミアムフッター */
.site-footer {
  background: #0d211a;
  color: #bfd0c9;
  border-top: 1px solid #163026;
  padding: 48px clamp(20px, 6vw, 82px) 32px;
  margin-top: 60px;
}
.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 28px;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: white;
}
.footer-desc {
  max-width: 500px;
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-links a {
  color: #bfd0c9;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: var(--transition);
}
.footer-links a:hover {
  color: white;
}
.footer-disclaimer {
  margin: 0;
  font-size: 12px;
  color: #79948a;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 20px;
}
.footer-copy {
  margin: 0;
  font-size: 12px;
  color: #79948a;
}
