/* 理科・社会 一問一答（公開ページ）
   検索から来た人が、そのまま解き始められることを最優先。
   マスネットのブランドカラー #0d9941 を軸に、読みやすさに寄せる。 */

:root {
  --green: #0d9941;
  --green-d: #0a7833;
  --green-l: #eaf6ee;
  --ink: #16231b;
  --paper: #f7f9f7;
  --line: #dde3dd;
  --muted: #6d7a70;
  --gold: #c08a1e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.85;
  -webkit-text-size-adjust: 100%;
}

/* ---------- ヘッダー（教材ページと同じ作り） ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: #fff; border-bottom: 2px solid #e2eaf5; padding: 0 20px;
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; height: 70px;
}
.nav-logo img { height: 40px; width: auto; display: block; }
.nav-back {
  font-size: 0.85rem; font-weight: 700; color: var(--green); text-decoration: none;
  padding: 8px 18px; border: 2px solid var(--green); border-radius: 50px;
  transition: 0.2s; white-space: nowrap;
}
.nav-back:hover { background: var(--green-l); }
.site-foot {
  margin-top: 60px; padding: 30px 20px 44px;
  background: #fff; border-top: 1px solid var(--line);
}
.site-foot__inner { max-width: 720px; margin: 0 auto; text-align: center; }
.site-foot__nav {
  display: flex; justify-content: center; align-items: center;
  flex-wrap: wrap; gap: 8px 24px; margin-bottom: 16px;
}
.site-foot__nav a {
  font-size: 14px; color: var(--muted); text-decoration: none;
}
.site-foot__nav a:hover { color: var(--green); text-decoration: underline; }
.site-foot__copy { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- 単元一覧に戻る ---------- */
.backlink { margin: 0 0 22px; }
.backlink a { font-size: 14px; color: var(--muted); text-decoration: none; }
.backlink a:hover { color: var(--green); text-decoration: underline; }

/* hidden 属性が display 指定に負けないようにする */
.play__back[hidden], .play[hidden], .qa[hidden] { display: none !important; }

.wrap { max-width: 720px; margin: 0 auto; padding: 28px 20px 40px; }

/* ---------- 見出し ---------- */
h1 { font-size: 26px; line-height: 1.45; margin: 0 0 6px; letter-spacing: .01em; }
h2 { font-size: 19px; margin: 40px 0 12px; }
h3 { font-size: 15px; margin: 24px 0 8px; color: var(--muted); font-weight: 600; }

.crumb { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.crumb a { color: var(--muted); }
.crumb span { margin: 0 4px; }

.meta { font-size: 14px; color: var(--muted); margin: 0 0 22px; }
.intro {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0; padding: 16px 18px; margin: 0 0 26px; font-size: 15px;
}

/* ---------- 形式の切り替え ---------- */
.modes { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 22px; }
.mode {
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-family: inherit; font-size: 14px; cursor: pointer;
}
.mode:hover { border-color: var(--green); }
.mode.is-on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }

/* ---------- 一覧（ここが検索に読まれる本体） ---------- */
.qa { list-style: none; counter-reset: qa; margin: 0; padding: 0; }
.qa__item {
  counter-increment: qa;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px 14px; margin-bottom: 10px;
}
.qa__q { margin: 0; font-weight: 600; padding-left: 30px; position: relative; }
.qa__q::before {
  content: counter(qa); position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green-l); color: var(--green-d);
  font-size: 12px; font-weight: 700; line-height: 22px; text-align: center;
}
.qa__a { margin: 10px 0 0; padding-left: 30px; color: var(--green-d); font-weight: 700; }
.qa__label {
  display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 4px;
  background: var(--green-l); color: var(--green-d);
  font-size: 11px; font-weight: 700; vertical-align: 2px;
}
.qa__exp {
  margin: 8px 0 0; padding-left: 30px;
  font-size: 14px; color: var(--muted);
}

/* ---------- 操作モード ---------- */
.play {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 22px 20px 18px; min-height: 260px;
}
.play__count { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.play__q { font-size: 19px; font-weight: 600; margin: 0 0 20px; line-height: 1.7; }
.play__reveal {
  display: block; width: 100%; padding: 16px;
  background: var(--green); color: #fff; border: 0; border-radius: 10px;
  font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
}
.play__reveal:hover { background: var(--green-d); }
.play__a {
  background: var(--green-l); border: 1px solid #b8dcc4; border-radius: 10px;
  padding: 18px; font-size: 20px; font-weight: 700; color: var(--green-d);
}
.play__exp {
  display: block; margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed #b8dcc4;
  font-size: 14px; font-weight: 400; color: var(--muted);
}

.play__choices { list-style: none; margin: 0; padding: 0; }
.play__choices li { margin-bottom: 9px; }
.play__choice {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 54px; padding: 14px 16px;
  background: #fff; border: 2px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 16px; color: var(--ink);
  text-align: left; cursor: pointer;
}
.play__choice:hover:enabled { border-color: var(--green); }
.play__choice:disabled { cursor: default; opacity: .85; }
.play__choice.is-correct {
  border-color: var(--green); background: var(--green-l);
  color: var(--green-d); font-weight: 700; opacity: 1;
}
.play__choice.is-wrong { border-color: #e0a9a3; background: #fcecea; color: #8f2419; opacity: 1; }
.play__choice > span:first-child { flex: 1; }

/* 正解を示す〇。丸つけと同じ見た目にする */
.play__maru {
  flex: 0 0 auto; color: #d9463c; font-size: 22px; font-weight: 700; line-height: 1;
}

/* 答えを隠す */
.play__hide {
  display: block; width: 100%; margin-top: 10px; padding: 12px;
  background: #fff; color: var(--muted); border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 15px; cursor: pointer;
}
.play__hide:hover { border-color: var(--green); color: var(--ink); }

/* 一覧へ戻る */
.play__back { margin: 14px 0 0; text-align: center; }
.play__back button, .play__back .btn {
  display: inline-block; padding: 11px 26px;
  background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.play__back button:hover, .play__back .btn:hover {
  border-color: var(--green); color: var(--green);
}

.play__nav { display: flex; justify-content: space-between; margin-top: 18px; }
.play__nav button {
  padding: 10px 18px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; font-family: inherit; font-size: 15px; cursor: pointer; color: var(--ink);
}
.play__nav button:hover { border-color: var(--green); }

/* ---------- 科目タブ ---------- */
.subject-tabs { display: flex; gap: 8px; margin: 0 0 22px; flex-wrap: wrap; }
.subject-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.subject-tab:hover { border-color: var(--green); color: var(--green); }
.subject-tab.is-on {
  background: var(--green); border-color: var(--green); color: #fff;
}
.subject-tab__n { font-size: 12px; font-weight: 400; opacity: .75; }

.group[hidden] { display: none !important; }
.group__empty {
  background: #fff; border: 1px dashed var(--line); border-radius: 10px;
  padding: 32px 20px; text-align: center; color: var(--muted);
}
.group__empty strong { display: block; color: var(--ink); margin-bottom: 6px; }
.group__empty p { margin: 0; font-size: 14px; }

/* 読み上げ用。画面には出さないが、見出しの構造は保つ */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 一覧ページ ---------- */
.group { margin-bottom: 8px; }
.units { list-style: none; margin: 0; padding: 0; }
.units li { margin-bottom: 8px; }
.units a {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; text-decoration: none; color: var(--ink);
}
.units a:hover { border-color: var(--green); }
.units__title { font-weight: 600; }
.units__meta { font-size: 13px; color: var(--muted); margin-left: auto; }

.related ul { list-style: none; margin: 0; padding: 0; }
.related li { margin-bottom: 8px; }
.related a {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; text-decoration: none; color: var(--ink); font-size: 15px;
}
.related a:hover { border-color: var(--green); }
.related__meta { font-size: 13px; color: var(--muted); margin-left: auto; }

/* ---------- 導線 ---------- */
.cta {
  margin-top: 48px; padding: 30px 24px;
  background: #f5f8fc; border: 1px solid #e3eaf2; border-radius: 14px;
  text-align: center;
}
.cta h2 { margin: 0 0 12px; font-size: 18px; }
.cta p { font-size: 15px; color: #4a5560; margin: 0; }
.cta__btns {
  display: flex; gap: 12px; flex-wrap: wrap;
  justify-content: center; margin: 22px 0 0;
}
.btn--line { background: #06c755; border-color: #06c755; color: #fff; }
.btn--line:hover { background: #05b34c; border-color: #05b34c; color: #fff; }
.btn--primary { border-radius: 999px; }
.cta .btn { border-radius: 999px; padding: 14px 30px; }

.btn {
  display: inline-block; padding: 13px 24px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  text-decoration: none; font-weight: 600; font-size: 15px;
}
.btn:hover { border-color: var(--green); }
.btn--primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-d); }

button:focus-visible, a:focus-visible {
  outline: 3px solid var(--ink); outline-offset: 2px;
}

@media (max-width: 600px) {
  .wrap { padding: 22px 15px 30px; }
  h1 { font-size: 22px; }
  .play__q { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
