/* 四大力学ノート 共通スタイル（スマホ優先・ダークモード・印刷対応） */
:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #1d2126;
  --muted: #5a636d;
  --line: #e1ddd3;
  --accent: #1b557c;
  --accent-strong: #123f5e;
  --accent-soft: #e7eff5;
  --ok: #1d6a4d;
  --ok-soft: #e4f1ea;
  --red: #a3342a;
  --red-soft: #f9ecea;
  --kangae: #f0efe9;
  --cover: #e9edf1;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 2px 8px rgba(20, 30, 40, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --card: #1c2026;
    --text: #e6e6e2;
    --muted: #a2aab3;
    --line: #2e343c;
    --accent: #86b8de;
    --accent-strong: #a9cdea;
    --accent-soft: #1e2c39;
    --ok: #8dd2b2;
    --ok-soft: #1a2d25;
    --red: #f2a497;
    --red-soft: #33211e;
    --kangae: #22262c;
    --cover: #273039;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 12px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
strong { font-weight: 700; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--card); padding: 4px 8px; z-index: 10; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ヘッダー */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); border-top: 4px solid var(--accent); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding-top: 10px; padding-bottom: 10px; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; line-height: 1.35; }
.brand-sub { display: block; font-size: .72rem; font-weight: 400; color: var(--muted); letter-spacing: .04em; }
.nav { display: flex; flex-wrap: wrap; gap: 0 14px; font-size: .88rem; }
.nav a { text-decoration: none; padding: 4px 0; color: var(--text); }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }

/* 本文 */
main { padding-top: 14px; padding-bottom: 48px; }
h1 { font-size: 1.5rem; line-height: 1.45; margin: 10px 0 14px; letter-spacing: .02em; }
.h1-sub { display: block; font-size: .82rem; font-weight: 400; color: var(--muted); margin-top: 6px; line-height: 1.6; }
h2 { font-size: 1.25rem; line-height: 1.5; margin: 40px 0 12px; padding: 0 0 6px 12px; border-left: 5px solid var(--accent); border-bottom: 1px solid var(--line); }
h2 .num { display: block; font-size: .75rem; color: var(--muted); font-weight: 400; }
.h2-sub { display: block; font-size: .78rem; color: var(--muted); font-weight: 400; }
h3 { font-size: 1.05rem; margin: 24px 0 8px; }
h4 { font-size: .97rem; margin: 0 0 4px; line-height: 1.6; }
p, ul, ol { margin: 0 0 12px; }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: 4px; }
.lead { font-size: 1rem; }
.note-small { font-size: .84rem; color: var(--muted); }
.crumb { font-size: .82rem; color: var(--muted); }
.back { margin-top: 36px; font-size: .9rem; display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* トップ */
.hero { padding: 18px 0 4px; }
.hero h1 { font-size: 1.55rem; }
.hero .catch { font-size: 1rem; }
.hero-points { list-style: none; padding: 0; display: grid; gap: 8px; margin: 16px 0; }
.hero-points li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0; box-shadow: var(--shadow); font-size: .93rem; }
.hero-points b { color: var(--accent); }
.cta { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 2.3em; margin-bottom: 10px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: .25em; width: 1.6em; height: 1.6em; line-height: 1.6em; text-align: center; border-radius: 50%; background: var(--accent); color: var(--card); font-size: .85rem; font-weight: 700; }

/* マトリクス */
.matrix { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .82rem; background: var(--card); box-shadow: var(--shadow); }
.matrix th, .matrix td { border: 1px solid var(--line); padding: 8px 2px; text-align: center; line-height: 1.3; }
.matrix thead th { background: var(--accent-soft); font-weight: 700; font-size: .76rem; }
.matrix thead th:first-child, .matrix tbody th { width: 3.6em; }
.matrix tbody th a { font-weight: 700; }
.matrix td.ok { background: var(--ok-soft); padding: 0; }
.matrix td.ok a { color: var(--ok); font-weight: 700; display: block; padding: 8px 2px; text-decoration: none; }
.matrix td.wip { color: var(--muted); font-size: .76rem; }
.mk { font-size: .75em; vertical-align: top; }

/* カード・注意 */
.card, .pdf-box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 16px 0; box-shadow: var(--shadow); }
.pdf-title { font-weight: 700; margin-bottom: 2px; }
.pdf-desc { font-size: .88rem; color: var(--muted); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-block; padding: 9px 18px; border-radius: 8px; border: 1.5px solid var(--accent); color: var(--accent); background: var(--card); text-decoration: none; font-weight: 700; font-size: .93rem; line-height: 1.4; cursor: pointer; font-family: inherit; }
.btn.primary { background: var(--accent); color: var(--card); }
.btn:hover { border-color: var(--accent-strong); }
.notice { background: var(--red-soft); border-left: 4px solid var(--red); border-radius: 8px; padding: 10px 14px; margin: 16px 0; font-size: .9rem; }
.notice ul { margin: 0; padding-left: 1.2em; }
.notice li:last-child { margin-bottom: 0; }

/* 目次 */
.toc ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.toc li { margin: 0; }
.toc a { display: inline-block; padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); text-decoration: none; font-size: .88rem; color: var(--text); }
.toc a:hover { border-color: var(--accent); color: var(--accent); }

/* 答えの一覧（タップで表示） */
.quiz-bar { display: none; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; font-size: .84rem; color: var(--muted); }
.js .quiz-bar { display: flex; }
.reveal-all { font: inherit; font-size: .84rem; font-weight: 700; color: var(--accent); background: var(--card); border: 1.5px solid var(--accent); border-radius: 999px; padding: 4px 14px; cursor: pointer; }
.answers { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; background: var(--card); font-size: .95rem; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.answers col.c-lab { width: 5.4em; }
.answers th, .answers td { border-bottom: 1px solid var(--line); padding: 8px 8px; vertical-align: middle; text-align: left; }
.answers tr:last-child th, .answers tr:last-child td { border-bottom: 0; }
.answers tbody th[scope="row"] { font-weight: 700; color: var(--accent); }
.answers tr.grp th { background: var(--accent-soft); color: var(--text); font-size: .88rem; padding: 6px 10px; }
.answers td.ans { position: relative; }
.answers .a { overflow-x: auto; overflow-y: hidden; max-width: 100%; min-height: 1.6em; }
.js .quiz td.ans { cursor: pointer; }
.js .quiz td.ans:not(.open) .a { visibility: hidden; }
.js .quiz td.ans:not(.open)::after { content: "タップで表示"; position: absolute; inset: 5px 6px; display: flex; align-items: center; justify-content: center; background: var(--cover); border-radius: 6px; font-size: .78rem; color: var(--muted); letter-spacing: .05em; }
.katex { font-size: 1.05em; }
/* 長い数式は、その数式だけ横にスクロール（ページ全体は横にはみ出さない） */
.m { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; }

/* 考え方 */
.kangae { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.kangae p { margin: 0; font-size: .95rem; }
.kangae .range { font-weight: 400; font-size: .78rem; color: var(--muted); }
.tags { margin-top: 8px !important; font-size: .8rem; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.tags-lab { color: var(--muted); }
.tag { display: inline-block; padding: 1px 10px; border-radius: 999px; background: var(--accent-soft); text-decoration: none; }

/* ミス注意の一覧 */
.mis-all h2 { border-left-color: var(--red); }
.mis-subj { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px 8px; margin: 12px 0; box-shadow: var(--shadow); }
.mis-subj h3 { color: var(--red); margin: 12px 0 6px; }
.mis-subj h4 { font-size: .88rem; margin-top: 10px; }
.mis-subj h4 a { color: var(--text); }
.mis-list { list-style: none; padding: 0; margin: 0 0 6px; }
.mis-list li { position: relative; padding: 4px 0 4px 1.3em; font-size: .93rem; border-bottom: 1px dashed var(--line); margin: 0; }
.mis-list li:last-child { border-bottom: 0; }
.mis-list li::before { content: "!"; position: absolute; left: 0; top: .55em; width: 1em; height: 1em; line-height: 1em; border-radius: 50%; background: var(--red); color: var(--card); font-size: .7rem; font-weight: 700; text-align: center; }

/* テーマ別索引 */
.theme { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 12px 0; box-shadow: var(--shadow); }
.theme h3 { margin: 0 0 2px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.theme .count { flex: none; font-size: .75rem; font-weight: 700; color: var(--ok); background: var(--ok-soft); border-radius: 999px; padding: 1px 10px; }
.theme-hint { font-size: .86rem; color: var(--muted); margin-bottom: 6px; }
.t-list { list-style: none; padding: 0; margin: 0; }
.t-list > li { border-top: 1px solid var(--line); padding: 8px 0 6px; margin: 0; }
.t-link { display: flex; gap: 10px; align-items: baseline; text-decoration: none; }
.t-year { flex: none; font-weight: 700; font-size: .85rem; color: var(--card); background: var(--accent); border-radius: 4px; padding: 0 6px; }
.t-q { color: var(--text); font-size: .93rem; text-decoration: underline; text-decoration-color: var(--line); }
details { margin: 4px 0 0 0; }
summary { cursor: pointer; font-size: .8rem; color: var(--accent); }
details p { font-size: .9rem; background: var(--kangae); border-radius: 6px; padding: 8px 10px; margin: 6px 0 2px; }

/* 勉強法 */
.flow { list-style: none; padding: 0; }
.flow > li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.flow > li h3 { margin-top: 0; color: var(--accent); }
.example { background: var(--kangae); border-radius: 8px; padding: 10px 14px; font-size: .92rem; }
.placeholder { background: #fff1bf; color: #5a4300; padding: 0 3px; border-radius: 3px; }
@media (prefers-color-scheme: dark) { .placeholder { background: #4a3d10; color: #ffe7a0; } }

/* フッター */
.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: 20px 0 28px; font-size: .84rem; color: var(--muted); }
.site-footer .disclaimer { color: var(--text); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; }
.copy { margin: 0; }

/* 出題傾向ページの表：スマホでは表だけ横スクロール、PC では全幅 */
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 12px 0 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: var(--shadow); }
.data { width: 100%; min-width: 520px; border-collapse: collapse; font-size: .88rem; }
.data th, .data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data thead th { background: var(--accent-soft); font-weight: 700; white-space: nowrap; }
.data tr:last-child td { border-bottom: none; }
.data td.n { white-space: nowrap; font-weight: 700; text-align: right; }
.data tr.sub td { color: var(--muted); font-size: .84rem; }
.fmt { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.fmt li { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; }
.fmt li.now { border-left-color: var(--red); }
.point { background: var(--kangae); border-radius: 10px; padding: 10px 14px 10px 14px; margin: 10px 0 22px; }
.point h3 { margin: 0 0 6px; font-size: 1rem; }
.point ul { margin: 0; padding-left: 1.2em; }
.toc-inline { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9rem; margin: 8px 0 18px; }

/* スマホ：表を「行ごとのカード」にして横スクロールをなくす */
@media (max-width: 599px) {
  .tbl { overflow-x: visible; }
  .data { min-width: 0; }
  .data thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data, .data tbody, .data tr, .data td { display: block; }
  .data tr { padding: 9px 12px; border-bottom: 1px solid var(--line); }
  .data tr:last-child { border-bottom: none; }
  .data td { padding: 0; border: none; }
  .data td:first-child { font-weight: 700; margin-bottom: 2px; }
  .data td:nth-child(2), .data td.n { display: inline; font-size: .84rem; color: var(--muted); }
  .data td.n { color: var(--accent); margin-left: .6em; }
  .data td.n::before { content: "— "; color: var(--muted); font-weight: 400; }
  .data tr.sub td:first-child { font-weight: 400; }
}
@media (min-width: 600px) {
  .data { min-width: 0; font-size: .92rem; }
}
@media (min-width: 1000px) {
  .wrap.wide { max-width: 920px; }
}

@media (min-width: 600px) {
  h1 { font-size: 1.75rem; }
  .hero h1 { font-size: 1.9rem; }
  .matrix { font-size: .9rem; }
  .matrix thead th { font-size: .85rem; }
  .pdf-box { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .pdf-box .btns { flex: none; }
  .hero-points { grid-template-columns: 1fr 1fr 1fr; }
}

/* 印刷：答えは全部表示 */
@media print {
  :root { --bg: #fff; --card: #fff; --text: #000; --muted: #444; --line: #bbb; --accent: #000; --accent-soft: #eee; --ok: #000; --ok-soft: #fff; --red: #000; --red-soft: #fff; --kangae: #f3f3f3; --shadow: none; }
  body { font-size: 10.5pt; line-height: 1.6; }
  .site-header .nav, .btns, .toc, .skip, .back, .footer-nav, .quiz-bar, .cta { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  a { color: #000; text-decoration: none; }
  .answers .a { overflow: visible; }
  .js .quiz td.ans .a { visibility: visible !important; }
  .js .quiz td.ans::after { display: none !important; }
  tr, .kangae, .theme > h3 { break-inside: avoid; }
  h2, h3, h4 { break-after: avoid; }
  details p { display: block; }
}

/* 合格体験記（launch/taikenki.html） */
.story h2 { margin-top: 2.2em; }
.toc-list ol { margin: 4px 0 0; padding-left: 1.6em; }
.toc-list li { margin-bottom: 2px; }
.book { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 14px; margin: 12px 0; box-shadow: var(--shadow); }
.book p { margin: 0; font-size: .92rem; }
.book .book-title { font-weight: 700; font-size: .98rem; }
.book .book-by { color: var(--muted); font-size: .84rem; margin-bottom: 4px; }
.subj { margin-top: 1.6em; }
.four { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px 12px 2em; }
.four li:last-child { margin-bottom: 0; }
.book .book-link { margin-top: 6px; font-size: .86rem; font-weight: 700; }
.book.has-img { display: grid; grid-template-columns: 64px 1fr; column-gap: 12px; }
.book.has-img > p { grid-column: 2; }
.book-img { grid-row: 1 / span 4; width: 64px; height: auto; border-radius: 3px; border: 1px solid var(--line); }
