/* にほんちりクイズ（仮）*/

:root {
  --bg: #fdf8ee;
  --card: #ffffff;
  --ink: #4a4033;
  --ink-light: #8a7d6a;
  --main: #7cc47f;
  --main-dark: #3f8f47;
  --cream: #fff6df;
  --accent: #f2a03d;
  --line: #ede3cf;
  --radius: 20px;
  --shadow: 0 4px 14px rgba(120, 100, 60, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }

ruby rt {
  font-size: 0.45em;
  color: var(--ink-light);
}

/* ふりがなOFF時 */
body.no-furigana ruby rt { display: none; }

/* ---------------- ヘッダー ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 252, 243, 0.95);
  border-bottom: 3px solid var(--main);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--main-dark);
}

.logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.header-buttons { display: flex; gap: 8px; }

.header-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 2px solid var(--main);
  border-radius: 999px;
  background: #fff;
  color: var(--main-dark);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.header-btn:hover { background: var(--cream); transform: translateY(-2px); }

.header-btn .material-symbols-rounded { font-size: 20px; }

.header-btn.furigana-off {
  border-color: #ccc;
  color: #999;
}

/* ---------------- レイアウト ---------------- */
.app {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.site-footer {
  text-align: center;
  padding: 24px 16px;
  background: #f4ecd9;
  color: var(--ink-light);
  font-size: 1rem;
}

.site-footer .footer-note { max-width: 620px; margin: 0 auto 4px; }
.site-footer .footer-copy { margin-top: 8px; font-weight: 700; }
.site-footer .footer-credit { margin-top: 8px; }
.site-footer .footer-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.25s;
}
.site-footer .footer-credit a:hover { opacity: 0.7; }
.site-footer .footer-credit a::after {
  content: "open_in_new";
  font-family: "Material Symbols Rounded";
  font-size: 0.9em;
  vertical-align: -2px;
  margin-left: 2px;
}

/* ---------------- 共通パーツ ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 32px;
  border: none;
  border-radius: 999px;
  background: var(--main-dark);
  color: #fff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #26718f;
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn:hover { transform: translateY(2px); box-shadow: 0 2px 0 #26718f; }

.btn ruby { position: relative; }
.btn ruby rt {
  position: absolute;
  top: -0.9em;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  white-space: nowrap;
}

.btn.btn-sub {
  background: #fff;
  color: var(--main-dark);
  border: 2px solid var(--main);
  box-shadow: 0 4px 0 #cfe7f2;
}

.btn.btn-accent {
  background: var(--accent);
  box-shadow: 0 4px 0 #c77f24;
}

.center { text-align: center; }

.back-row { margin-bottom: 16px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-light);
  cursor: pointer;
}

.back-link:hover { color: var(--main-dark); }

/* 吹き出し＋キャラ */
.piyo-block {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 24px;
}

.piyo-block img {
  width: 110px;
  flex-shrink: 0;
}

.speech {
  flex: 1;
  background: var(--card);
  border: 3px solid var(--main);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-weight: 500;
}

/* ---------------- トップページ ---------------- */
.hero {
  text-align: center;
  padding: 12px 0 8px;
}

.hero-img { width: 200px; }

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--main-dark);
  margin: 8px 0 4px;
}

.hero-sub {
  color: var(--ink-light);
  font-weight: 700;
  margin-bottom: 20px;
}

.hero-lead {
  max-width: 520px;
  margin: 0 auto 28px;
  text-align: left;
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
}

.furigana-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 1rem;
  color: var(--ink-light);
  background: var(--cream);
  border-radius: 999px;
  padding: 6px 16px;
}

.furigana-hint .material-symbols-rounded { font-size: 18px; color: var(--accent); }

/* ---------------- テーマ一覧 ---------------- */
.page-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--main-dark);
  margin-bottom: 20px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.theme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
}

.theme-card:hover { transform: translateY(-3px); border-color: var(--main); }

.theme-card .theme-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 800;
}

.theme-card .theme-head .material-symbols-rounded {
  font-size: 26px;
  color: var(--theme-color, var(--main-dark));
  flex-shrink: 0;
}

.theme-card .theme-head .theme-title {
  flex: 1;
  min-width: 0;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.theme-card .theme-catch {
  font-size: 1rem;
  color: var(--ink-light);
  line-height: 1.6;
}

.theme-card .cleared-badge {
  position: absolute;
  top: -10px;
  right: -6px;
  width: 52px;
  transform: rotate(12deg);
}

.theme-card.locked-final { opacity: 0.55; }

.final-note {
  margin-top: 14px;
  text-align: center;
  font-size: 1rem;
  color: var(--ink-light);
}

.bonus-heading {
  margin: 28px 0 14px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink-light);
}

.theme-grid-bonus {
  max-width: 340px;
  margin: 0 auto;
}

.quiz-info {
  margin-top: 20px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink-light);
}

/* ---------------- 学びページ ---------------- */
.learn-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.learn-points li {
  display: flex;
  gap: 10px;
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.learn-points .material-symbols-rounded {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
}

/* 都道府県・山川海のカード */
.pref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.pref-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.pref-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pref-num {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--main-dark);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.pref-name {
  font-size: 1.15rem;
  font-weight: 800;
}

.pref-cap {
  font-size: 1rem;
  margin-bottom: 10px;
}

.pref-cap .cap-label {
  display: inline-block;
  background: var(--cream);
  border-radius: 8px;
  padding: 0 8px;
  margin-right: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-light);
}

.symbol-trivia {
  display: flex;
  gap: 8px;
  background: var(--cream);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  line-height: 1.7;
}

.symbol-trivia .material-symbols-rounded {
  font-size: 20px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ---------------- クイズ ---------------- */
.quiz-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.quiz-progress .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e5dcc8;
}

.quiz-progress .dot.now { background: var(--accent); }
.quiz-progress .dot.done-ok { background: var(--main-dark); }
.quiz-progress .dot.done-ng { background: #e0a49d; }

.quiz-q {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  font-size: 1.15rem;
  font-weight: 700;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}

.choice-btn:hover { border-color: var(--main); transform: translateX(4px); }

/* 回答後: 正解を緑、まちがえた選択肢を赤でしめす */
.choice-btn:disabled { cursor: default; color: var(--ink); }
.choice-btn:disabled:hover { transform: none; border-color: var(--line); }
.choice-btn.is-correct,
.choice-btn.is-correct:disabled:hover { border-color: #58a55c; background: #eef8ee; }
.choice-btn.is-wrong,
.choice-btn.is-wrong:disabled:hover { border-color: #e0a49d; background: #fbeeec; }

.choice-btn .choice-mark {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--cream);
  color: var(--main-dark);
  font-weight: 800;
  font-size: 0.9rem;
}

/* 判定パネル */
.judge {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 18px;
  animation: pop-in 0.3s ease;
}

.judge img { width: 100px; flex-shrink: 0; }

.judge-body {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 3px solid var(--main);
}

.judge-body.ng { border-color: #eebcb4; }

.judge-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.judge-title.ok { color: var(--main-dark); }
.judge-title.ng { color: #d06a5c; }

.judge-title .material-symbols-rounded { font-size: 26px; }

.judge-explain { font-size: 1rem; margin-bottom: 12px; }

.judge .btn {
  white-space: nowrap;
  padding: 12px 22px;
  font-size: 1rem;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 結果・クリア画面 ---------------- */
.result-hero {
  text-align: center;
  padding: 8px 0;
}

.result-hero img { width: 190px; }

.result-title {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--main-dark);
  margin: 10px 0 4px;
}

.result-title.ng { color: #d06a5c; }

.result-score {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink-light);
  margin-bottom: 18px;
}

.result-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

/* スタンプ演出 */
.stamp-get {
  width: 150px;
  margin: 8px auto;
  animation: stamp-press 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes stamp-press {
  0% { opacity: 0; transform: scale(2.2) rotate(-14deg); }
  60% { opacity: 1; transform: scale(0.92) rotate(-8deg); }
  100% { transform: scale(1) rotate(-8deg); }
}

/* ---------------- スタンプ台紙 ---------------- */
.stamp-board {
  background: var(--card);
  border: 3px dashed var(--main);
  border-radius: var(--radius);
  padding: 24px 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.stamp-slot { text-align: center; }

.stamp-slot .stamp-img-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  border-radius: 50%;
}

.stamp-slot img {
  width: 84px;
  height: 84px;
  object-fit: contain;
}

.stamp-slot .stamp-num {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--main-dark);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.stamp-slot .stamp-label {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.stamp-slot.locked img {
  filter: grayscale(1) opacity(0.3);
}

.stamp-slot.locked .stamp-num { background: #c9bfa8; }

/* スタンプの色分け（元画像は赤。色相を回して塗り分ける） */
.stamp-c1 img { filter: none; }
.stamp-c2 img { filter: hue-rotate(215deg); }
.stamp-c3 img { filter: hue-rotate(140deg) brightness(0.92); }
.stamp-c4 img { filter: hue-rotate(28deg) saturate(1.1); }
.stamp-c5 img { filter: hue-rotate(265deg); }
.stamp-c6 img { filter: hue-rotate(320deg); }
.stamp-c7 img { filter: hue-rotate(170deg); }
.stamp-c8 img { filter: hue-rotate(75deg) brightness(0.95); }
.stamp-c9 img { filter: hue-rotate(195deg); }
.stamp-c10 img { filter: hue-rotate(230deg); }
.stamp-c11 img { filter: hue-rotate(45deg) saturate(1.3) brightness(1.1); }

.master-banner {
  margin-top: 24px;
  text-align: center;
  background: linear-gradient(135deg, #fff3d6, #ffe9b8);
  border-radius: var(--radius);
  padding: 24px 18px;
  box-shadow: var(--shadow);
}

.master-banner img { width: 170px; }

.master-banner .master-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #b8860b;
  margin-top: 8px;
}

/* ---------------- スマホ調整 ---------------- */
@media (max-width: 520px) {
  /* ヘッダーを2段構成に：上段=ロゴ、下段=ふりがな/スタンプボタン */
  .site-header { flex-wrap: wrap; justify-content: center; padding: 10px 12px; gap: 8px; }
  .logo { gap: 6px; }
  .header-buttons { width: 100%; justify-content: center; }
  .header-btn { padding: 6px 10px; gap: 3px; }
  .header-btn .material-symbols-rounded { font-size: 17px; }
  .header-btn .btn-label { font-size: 0.85rem; }
  .piyo-block img { width: 84px; }
  .judge img { width: 80px; }
  .stamp-board { grid-template-columns: repeat(2, 1fr); }
  .hero-img { width: 160px; }
}
