/* ロータリー財団まるわかり
   Palette: Royal Blue #17458F / Ink Navy #0C2B5E / Gold #F7A81B / Sky Wash #EEF3FA / Paper #FFFFFF */

:root {
  --blue: #17458F;
  --navy: #0C2B5E;
  --gold: #F7A81B;
  --gold-deep: #D98E00;
  --wash: #EEF3FA;
  --paper: #FFFFFF;
  --ink: #1B2A44;
  --line: #D5DFEE;
  --serif: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --sans: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--wash);
  line-height: 1.75;
  font-size: 16px;
}
button { font-family: inherit; cursor: pointer; }

.sp-only { display: none; }
@media (max-width: 640px) {
  .sp-only { display: inline; }
  .pc-only { display: none; }
}

/* ===== header ===== */
.site-head {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(255,255,255,.08), 0 4px 16px rgba(12,43,94,.25);
}
.head-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 16px 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; }
.wheel { width: 34px; height: 34px; color: var(--gold); flex: none; }
@media (prefers-reduced-motion: reduce) { .wheel { animation: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-eyebrow {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold); font-weight: 600;
}
.brand-title { font-family: var(--serif); font-size: 17px; font-weight: 700; }

.tabs { display: flex; gap: 2px; }
.tab {
  flex: 1;
  background: none; border: none; color: rgba(255,255,255,.65);
  padding: 10px 4px 12px; font-size: 14px; font-weight: 600;
  border-bottom: 3px solid transparent;
  transition: color .2s, border-color .2s;
}
.tab:hover { color: #fff; }
.tab.is-active { color: #fff; border-bottom-color: var(--gold); }
.tab:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* ===== layout ===== */
main { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }
.view { display: none; }
.view.is-active { display: block; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-title {
  font-family: var(--serif); font-size: 26px; color: var(--navy);
  margin-bottom: 4px;
}
.view-lead { color: #55688a; font-size: 14px; margin-bottom: 20px; }

/* ===== hero ===== */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--blue) 100%);
  color: #fff;
  border-radius: 14px;
  padding: 48px 24px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: 10px;
  border: 1px solid rgba(247,168,27,.45);
  border-radius: 9px;
  pointer-events: none;
}
.hero-since {
  font-size: 11px; letter-spacing: .35em; color: var(--gold);
  font-weight: 700; margin-bottom: 14px;
}
.hero-motto {
  font-family: var(--serif);
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.4;
}
.hero-en {
  font-family: var(--serif); font-style: italic;
  color: rgba(255,255,255,.75); font-size: 14px; letter-spacing: .12em;
  margin: 8px 0 18px;
}
.hero-lead { font-size: 14px; color: rgba(255,255,255,.9); margin-bottom: 24px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; z-index: 1; }

.btn {
  border: none; border-radius: 999px;
  padding: 12px 26px; font-size: 15px; font-weight: 700;
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn-gold { background: var(--gold); color: var(--navy); box-shadow: 0 4px 14px rgba(247,168,27,.4); }
.btn-line { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.6); }
.btn-line:hover { border-color: #fff; }

/* ===== stats ===== */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-top: 18px;
}
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--paper); border-radius: 10px;
  padding: 16px 8px 12px; text-align: center;
  border-top: 3px solid var(--gold);
  box-shadow: 0 2px 8px rgba(12,43,94,.07);
}
.stat-num {
  display: block; font-family: Georgia, var(--serif);
  font-size: 30px; font-weight: 700; color: var(--blue); line-height: 1.1;
}
.stat-num small { font-size: 14px; font-weight: 600; margin-left: 2px; }
.stat-label { font-size: 11.5px; color: #55688a; }
.stats-note { text-align: right; font-size: 11px; color: #8b9ab3; margin-top: 6px; }

/* ===== home cards ===== */
.home-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 26px; }
@media (max-width: 640px) { .home-cards { grid-template-columns: 1fr; } }
.home-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 18px; text-align: left;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.home-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(12,43,94,.12); border-color: var(--gold); }
.hc-num {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .18em;
  color: var(--gold-deep); border: 1px solid var(--gold); border-radius: 999px;
  padding: 2px 12px; margin-bottom: 10px;
}
.home-card strong { display: block; font-family: var(--serif); font-size: 19px; color: var(--navy); margin-bottom: 6px; }
.home-card p { font-size: 13px; color: #55688a; }

/* ===== learn ===== */
.learn-cat { margin-bottom: 26px; }
.learn-cat-title {
  font-family: var(--serif); font-size: 15px; color: var(--navy);
  letter-spacing: .1em; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.learn-cat-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.acc {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 8px; overflow: hidden;
}
.acc summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; font-weight: 700; font-size: 15px; color: var(--navy);
  cursor: pointer; user-select: none;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after {
  content: '+'; color: var(--gold-deep); font-size: 20px; font-weight: 400;
  transition: transform .2s; flex: none; margin-left: 12px;
}
.acc[open] summary::after { transform: rotate(45deg); }
.acc[open] summary { border-bottom: 1px dashed var(--line); }
.acc-body { padding: 14px 16px 18px; font-size: 14.5px; }
.acc-body strong { color: var(--blue); }

/* ===== bot ===== */
.chat {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  min-height: 300px; max-height: 55vh; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; }
.msg.user {
  align-self: flex-end; background: var(--blue); color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.bot {
  align-self: flex-start; background: var(--wash);
  border: 1px solid var(--line); border-bottom-left-radius: 4px;
}
.msg.bot strong { color: var(--blue); }
.msg-title { font-family: var(--serif); font-weight: 700; color: var(--navy); display: block; margin-bottom: 4px; }
.msg .related { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12.5px; }
.msg .related button {
  background: none; border: none; color: var(--blue); text-decoration: underline;
  font-size: 12.5px; padding: 0 4px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip {
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: 12.5px; color: var(--blue); font-weight: 600;
  transition: border-color .2s, background .2s;
}
.chip:hover { border-color: var(--gold); background: #FFF8EA; }
.chat-form { display: flex; gap: 8px; }
.chat-form input {
  flex: 1; border: 1px solid var(--line); border-radius: 999px;
  padding: 12px 18px; font-size: 15px; font-family: inherit;
  background: var(--paper);
}
.chat-form input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

/* ===== quiz ===== */
.quiz-start { text-align: center; padding: 10px 0 30px; }
.quiz-modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-width: 560px; margin: 20px auto 0; }
@media (max-width: 640px) { .quiz-modes { grid-template-columns: 1fr; } }
.mode-btn {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; text-align: left; transition: border-color .2s, box-shadow .2s;
}
.mode-btn:hover { border-color: var(--gold); box-shadow: 0 6px 16px rgba(12,43,94,.1); }
.mode-btn strong { display: block; font-family: var(--serif); font-size: 17px; color: var(--navy); }
.mode-btn span { font-size: 12.5px; color: #55688a; }

.q-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.q-count { font-family: Georgia, serif; font-weight: 700; color: var(--blue); font-size: 15px; white-space: nowrap; }
.q-bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.q-bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--gold)); transition: width .3s; }

.q-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px 20px;
}
.q-cat {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .12em;
  color: var(--gold-deep); border: 1px solid var(--gold); border-radius: 999px;
  padding: 2px 12px; margin-bottom: 12px;
}
.q-text { font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--navy); margin-bottom: 18px; line-height: 1.6; }
.q-choices { display: grid; gap: 10px; }
.choice {
  text-align: left; background: var(--wash); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 13px 16px; font-size: 15px;
  transition: border-color .15s, background .15s;
  position: relative;
}
.choice:hover { border-color: var(--blue); background: #E4EDF9; }
.choice:disabled { cursor: default; }
.choice.correct { border-color: #1E8A4C; background: #E8F6EE; font-weight: 700; }
.choice.correct::after { content: '正解'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; color: #1E8A4C; font-weight: 700; }
.choice.wrong { border-color: #C0392B; background: #FBEBE9; }
.choice.wrong::after { content: '不正解'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; color: #C0392B; font-weight: 700; }
.choice.dim { opacity: .5; }

.q-expl {
  margin-top: 16px; padding: 14px 16px; border-left: 3px solid var(--gold);
  background: #FFF8EA; border-radius: 0 8px 8px 0; font-size: 14px;
}
.q-next { margin-top: 18px; text-align: right; }

/* result */
.result { text-align: center; padding: 20px 0; }
.medal {
  width: 110px; height: 110px; margin: 0 auto 6px; position: relative;
}
.medal .ribbon {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 34px;
  background: linear-gradient(180deg, var(--blue), var(--navy));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}
.medal .disc {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFD97A, var(--gold) 55%, var(--gold-deep));
  border: 3px solid var(--gold-deep);
  display: flex; align-items: center; justify-content: center;
  font-family: Georgia, serif; font-size: 26px; font-weight: 700; color: var(--navy);
  box-shadow: 0 6px 18px rgba(217,142,0,.45);
}
.result-rank { font-family: var(--serif); font-size: 24px; color: var(--navy); font-weight: 700; margin-top: 12px; }
.result-score { font-size: 14px; color: #55688a; margin: 4px 0 8px; }
.result-desc { font-size: 14.5px; max-width: 480px; margin: 0 auto 22px; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-blue { background: var(--blue); color: #fff; }

.review { max-width: 640px; margin: 30px auto 0; text-align: left; }
.review h3 { font-family: var(--serif); font-size: 16px; color: var(--navy); margin-bottom: 10px; }
.review-item {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 8px; font-size: 13.5px;
}
.review-item .ri-q { font-weight: 700; color: var(--navy); }
.review-item .ri-a { color: #1E8A4C; font-weight: 600; }
.review-item .ri-x { color: #C0392B; }

/* ===== footer ===== */
.site-foot {
  text-align: center; padding: 28px 16px 40px;
  font-size: 11.5px; color: #8b9ab3; line-height: 1.9;
  border-top: 1px solid var(--line);
}

/* ===== 地区セミナー(ホーム) ===== */
.seminar { max-width: 960px; margin: 40px auto 8px; padding: 32px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.seminar-eyebrow { font-size: 13px; letter-spacing: .08em; color: var(--gold-deep); font-weight: 700; margin: 0 0 8px; }
.seminar-title { font-family: var(--serif); color: var(--navy); font-size: clamp(22px, 4vw, 30px); margin: 0 0 12px; line-height: 1.4; }
.seminar-lead { margin: 0 0 20px; line-height: 1.9; }
.homework { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.hw { background: var(--wash); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.hw-date { display: inline-block; font-size: 13px; font-weight: 700; color: #fff; background: var(--navy); border-radius: 999px; padding: 2px 10px; margin-bottom: 8px; }
.hw strong { display: block; line-height: 1.5; margin-bottom: 6px; }
.hw p { margin: 0; font-size: 14px; line-height: 1.7; color: #555; }
.btn-line-dark { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
