:root {
  --navy: #1d3b53;
  --navy-2: #142b3d;
  --accent: #2c7a5b;
  --accent-light: #e8f4ee;
  --gold: #f2c14e;
  --paper: #fffdfa;
  --ink: #24323f;
  --muted: #5f6f7c;
  --rule: #cfdcd6;
  --notice: #8a4b00;
  --notice-bg: #fff4e0;
  --shadow: 0 10px 28px rgb(20 45 65 / 9%);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--ink);
  background: #f3f6f4;
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.8; }
a { color: #1f6a8a; text-underline-offset: .18em; }
a:hover { color: var(--accent); }
p, li, dd { overflow-wrap: anywhere; }

.skip-link { position: absolute; left: -9999px; top: 0; background: white; color: var(--navy); padding: .7rem 1rem; z-index: 99; }
.skip-link:focus { left: 1rem; top: 1rem; }

.site-header { position: sticky; top: 0; z-index: 20; background: rgb(20 43 61 / 96%); color: white; border-bottom: 3px solid var(--gold); }
.header-inner { max-width: 1120px; margin: auto; min-height: 64px; padding: .6rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { color: white; font-weight: 800; text-decoration: none; letter-spacing: .03em; }
.brand small { display: block; color: #cfe5da; font-size: .68rem; font-weight: 600; }
.global-nav { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.global-nav a { color: #eef6f2; font-size: .88rem; text-decoration: none; white-space: nowrap; }
.global-nav a:hover { color: var(--gold); }

.page-shell { max-width: 1120px; margin: 0 auto; padding: 1.8rem 1rem 4rem; }
.content-card { background: var(--paper); border: 1px solid #dde6e1; border-radius: 16px; box-shadow: var(--shadow); padding: clamp(1.1rem, 3.5vw, 2.6rem); margin-bottom: 1.6rem; }
.narrow { max-width: 880px; margin-inline: auto; }
.eyebrow { color: var(--accent); font-weight: 800; font-size: .8rem; letter-spacing: .12em; margin: 0; }
h1, h2, h3 { color: var(--navy); line-height: 1.4; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: .2em 0 .6em; }
h2 { margin-top: 1.8em; border-bottom: 2px solid var(--accent); padding-bottom: .2em; }
.content-card > h2:first-child { margin-top: 0; }
.note { color: var(--muted); font-size: .9rem; }

.hero { position: relative; overflow: hidden; margin-bottom: 1.6rem; padding: clamp(1.6rem, 6vw, 3.4rem) clamp(1.2rem, 5vw, 3.2rem); border-radius: 18px; color: #eef5f1; background: linear-gradient(120deg, var(--navy-2) 0%, var(--navy) 55%, #24604c 100%); box-shadow: var(--shadow); }
.hero h1 { color: white; margin: .2em 0 .5em; position: relative; }
.hero p { max-width: 44em; position: relative; }
.hero-kicker { font-size: .8rem; font-weight: 700; letter-spacing: .08em; color: var(--gold); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }
.hero-mark { position: absolute; right: -1rem; bottom: -3.2rem; font-size: 13rem; font-weight: 900; line-height: 1; color: rgb(255 255 255 / 6%); pointer-events: none; }
.lead { font-size: 1.1rem; max-width: 46em; }
.button { display: inline-block; background: var(--accent); color: white; padding: .55rem 1.3rem; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: .92rem; }
.button:hover { background: var(--navy); color: white; }
.button-accent { background: #bd4f28; }
.button-accent:hover { background: #a8441f; }
.button-light { background: white; color: var(--navy); }
.button-light:hover { background: var(--gold); color: var(--navy-2); }
.button-disabled { background: #e3e8e5; color: var(--muted); cursor: default; }
.button-disabled:hover { background: #e3e8e5; color: var(--muted); }

.concept-grid, .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; margin: 1rem 0; }
.concept { border: 1px solid var(--rule); border-radius: 12px; padding: .9rem 1.1rem; background: white; }
.concept h3 { margin: 0 0 .3rem; font-size: 1.02rem; }
.concept p { margin: 0; font-size: .9rem; color: var(--muted); }
.content-card > h3 { margin-top: 1.6rem; }
.mini-card { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; border: 1px solid var(--rule); border-radius: 12px; padding: 1rem 1.1rem; background: white; }
.mini-card h4 { margin: 0; color: var(--navy); font-size: 1.05rem; }
.mini-card p { margin: 0 0 .5rem; font-size: .9rem; color: var(--muted); flex: 1; }
.card-num { font-size: 1.6rem; font-weight: 800; color: var(--accent); line-height: 1; }

.round-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; margin: 1.2rem 0; }
.round-card { display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.1rem; border: 1px solid var(--rule); border-radius: 12px; background: white; text-decoration: none; color: var(--ink); }
.round-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.round-title { font-weight: 800; font-size: 1.25rem; color: var(--navy); }
.round-sub { font-size: .85rem; color: var(--muted); }
.badge-notice { align-self: flex-start; font-size: .75rem; font-weight: 700; color: var(--notice); background: var(--notice-bg); border-radius: 999px; padding: .05rem .6rem; }
.notice-box { margin: 1rem 0; padding: .8rem 1.1rem; border-left: 4px solid var(--notice); background: var(--notice-bg); border-radius: 8px; }
.notice-box h2, .notice-box h4 { margin: 0 0 .3rem; font-size: 1rem; border: 0; padding: 0; color: var(--notice); }
.notice-box p { margin: .3rem 0 0; font-size: .85rem; }
.rounds .group-row th { background: #f3f6f4; color: var(--accent); font-size: .85rem; letter-spacing: .08em; }

.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 0 0 1rem; font-size: .85rem; color: var(--muted); }
.breadcrumb li + li::before { content: "›"; margin-right: .3rem; }

.subject-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; }
.subject-card a { display: flex; flex-direction: column; gap: .15rem; height: 100%; padding: .9rem 1rem; border: 1px solid var(--rule); border-radius: 12px; background: white; text-decoration: none; color: var(--ink); }
.subject-card a:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.subject-group { font-size: .75rem; color: var(--muted); }
.subject-name { font-size: 1.2rem; font-weight: 800; color: var(--navy); }
.subject-meta { font-size: .8rem; color: var(--muted); }
.status { display: inline-block; align-self: flex-start; font-size: .75rem; font-weight: 700; padding: .05rem .6rem; border-radius: 999px; border: 1px solid currentColor; }
.status-published { color: var(--accent); background: var(--accent-light); }
.status-preparing { color: var(--muted); background: #f1f3f2; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: 0; }
.facts dt { font-weight: 700; color: var(--navy); }
.facts dd { margin: 0; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: .5rem; } }

.table-wrap { overflow-x: auto; }
.rounds { width: 100%; border-collapse: collapse; }
.rounds th, .rounds td { border-bottom: 1px solid var(--rule); padding: .6rem .5rem; text-align: left; vertical-align: top; }
.rounds thead th { background: var(--accent-light); color: var(--navy); }
.rounds tbody th { white-space: nowrap; font-weight: 700; }
.materials { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; }
.materials .kind-notice a { color: var(--notice); font-weight: 700; }
.materials .kind-notice::before { content: "⚠ "; color: var(--notice); }

.attribution { max-width: 1120px; margin: 0 auto 1.6rem; padding: 1rem 1.4rem; border-left: 4px solid var(--gold); background: #fffaf0; border-radius: 8px; font-size: .88rem; }
.attribution h2 { font-size: 1rem; margin: 0 0 .4rem; border: 0; padding: 0; }
.attribution ul { margin: 0 0 .4rem; padding-left: 1.2rem; }

.site-footer { background: var(--navy-2); color: #dbe7e1; font-size: .88rem; }
.site-footer a { color: #f6e3a8; }
.site-footer h2 { color: white; font-size: 1rem; border: 0; margin: 0 0 .4rem; }
.footer-inner { max-width: 1120px; margin: auto; padding: 2rem 1rem 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.4rem; }
.footer-inner ul { padding-left: 1.1rem; margin: 0; }
.copyright { max-width: 1120px; margin: auto; padding: 1rem; border-top: 1px solid rgb(255 255 255 / 15%); font-size: .8rem; color: #b8c9c1; }
@media (max-width: 640px) {
  .rounds thead { display: none; }
  .rounds, .rounds tbody, .rounds tr, .rounds th, .rounds td { display: block; width: 100%; }
  .rounds tbody th { border-bottom: 0; padding-bottom: 0; white-space: normal; }
  .rounds tbody td { padding-top: .2rem; }
}

.markdown-body table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .93rem; }
.markdown-body th, .markdown-body td { border: 1px solid var(--rule); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.markdown-body thead th { background: var(--accent-light); color: var(--navy); }
.markdown-body blockquote { margin: 1.2rem 0; padding: .6rem 1rem; border-left: 4px solid var(--gold); background: #fffaf0; font-size: .88rem; }
/* 抽出した表組み（列を空白で揃えた pre）は折り返すと列が崩れるので、ブロックの中だけを横に送る。
   折り返さずにはみ出すと、スマートフォンではページ全体が押し広げられて縮小表示になる。 */
.markdown-body pre { max-width: 100%; overflow-x: auto; }
.markdown-body h3 { margin-top: 1.8em; }
.markdown-body h4 { margin: 1.4em 0 .4em; color: var(--accent); }
.chapter-list li { margin: .3rem 0; }
.chapter-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2.4rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: .92rem; }
.footer-inner ul + h2 { margin-top: 1rem; }

/* 単元マップ・暗記整理・過去問分析 */
.unit-list { list-style: none; padding: 0; margin: .4rem 0 1rem; }
.unit-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .7rem; padding: .45rem 0; border-bottom: 1px dashed var(--rule); }
.unit-name { font-weight: 700; color: var(--navy); }
.unit-rounds { font-size: .82rem; color: var(--muted); }
.tag { font-size: .75rem; padding: .05rem .5rem; border: 1px solid var(--accent); border-radius: 999px; color: var(--accent); text-decoration: none; }
.memory-card { border-top: 1px solid var(--rule); padding-top: 1.2rem; margin-top: 1.6rem; scroll-margin-top: 1rem; }
.memory-card:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.memory-lead { margin: .3rem 0 .8rem; }
.memory-reading { margin: .9rem 0 .4rem; padding: .7rem .9rem; border-left: 3px solid var(--accent); background: #f7faf8; }
.memory-reading h3 { font-size: .95rem; margin: 0 0 .3rem; color: var(--navy); }
.memory-reading p { margin: .3rem 0 0; }
.memory-table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.memory-table th, .memory-table td { border: 1px solid var(--rule); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.memory-table thead th { background: var(--accent-light); color: var(--navy); }
.memory-table tbody th { background: #f7faf8; }
.memory-tree ul { margin: .2rem 0; padding-left: 1.3rem; }
.memory-tree > ul { padding-left: 1.1rem; }
.memory-flow .flow-guide { font-size: .88rem; color: var(--muted); margin: .2rem 0 .6rem; }
.flow-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.flow-node { border: 1px solid var(--rule); border-radius: 10px; padding: .6rem .8rem; margin: 0 0 .9rem; position: relative; scroll-margin-top: 1rem; }
.flow-node + .flow-node::before { content: "↓"; position: absolute; top: -1.05rem; left: 1rem; color: var(--muted); font-size: .85rem; }
.flow-question { background: #f7faf8; }
.flow-result-text { font-weight: 700; }
.flow-no { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 0 .5rem; margin-right: .4rem; }
.flow-branches { margin: .4rem 0 0; padding-left: 1.2rem; font-weight: 400; }
.flow-label { font-weight: 700; color: var(--navy); }
.flow-note { font-size: .85rem; font-weight: 400; color: var(--muted); margin: .3rem 0 0; }
span.flow-note { display: block; margin-top: .15rem; }
.steps-list { margin: .4rem 0; padding-left: 1.6rem; }
.steps-list li { margin: 0 0 .7rem; }
.step-detail { display: block; }
.step-formula { display: block; margin-top: .2rem; padding: .25rem .6rem; background: #f7faf8; border-left: 3px solid var(--accent); font-size: .92rem; }
.step-result { font-weight: 700; margin: .4rem 0 0; }
.diagram { margin: 1rem 0; }
.diagram svg { display: block; max-width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 10px; }
.diagram figcaption { font-size: .82rem; color: var(--muted); margin-top: .4rem; }
.related { font-size: .9rem; }
details { margin: .8rem 0; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 700; }
details h3 { font-size: .95rem; margin: .8rem 0 .3rem; }
.drill-answer { padding: .6rem 1rem; border-left: 4px solid var(--accent); background: var(--accent-light); border-radius: 6px; }
.matrix { border-collapse: collapse; width: 100%; font-size: .88rem; }
.matrix th, .matrix td { border: 1px solid var(--rule); padding: .4rem .5rem; text-align: center; white-space: nowrap; }
.matrix th[scope="row"] { text-align: left; white-space: normal; min-width: 10rem; }
.matrix thead th { background: var(--accent-light); color: var(--navy); }
.matrix td.hit { background: #eef7f2; font-weight: 700; color: var(--accent); }
.matrix td.miss { color: #a8b4bb; }

/* 過去問の問題ページ・解答ページ。印字配点と推定配点は同じ見た目にしない */
.points { display: inline-block; margin-left: .6rem; font-size: .78rem; font-weight: 700; padding: .05rem .6rem; border-radius: 999px; vertical-align: middle; }
.points-printed { color: var(--navy); background: var(--accent-light); border: 1px solid var(--accent); }
.points-estimated { color: var(--muted); background: white; border: 1px dashed var(--muted); font-style: italic; }
.format-tag { display: inline-block; margin-left: .6rem; font-size: .75rem; font-weight: 600; color: var(--accent); }
.question-sub, .answer-sub { border-top: 1px solid var(--rule); padding-top: 1rem; margin-top: 1.4rem; scroll-margin-top: 5rem; }
.question-sub h3 { margin: 0 0 .4rem; }
.question-part { font-size: 1.15rem; }
.blank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem 1rem; margin: .8rem 0; }
.blank { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; }
.blank-name { font-weight: 700; color: var(--navy); min-width: 2em; }
.blank input { flex: 1; min-width: 8rem; font: inherit; padding: .4rem .6rem; border: 1px solid var(--rule); border-radius: 6px; }
.blank-essay { flex-direction: column; align-items: stretch; margin: .8rem 0; }
.blank-essay textarea { width: 100%; font: inherit; padding: .5rem .7rem; border: 1px solid var(--rule); border-radius: 6px; }
.blank-unit { color: var(--muted); font-size: .9rem; }
.blank-with-kubun { grid-column: 1 / -1; }
.answer-actions { margin-top: 1.6rem; }
.answer-actions button { border: 0; cursor: pointer; font: inherit; }
.question-links { list-style: none; margin: 0 0 .4rem; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-weight: 700; }
.question-links .question-pending { color: var(--muted); font-weight: 400; }
.question-links .pending-tag { margin-left: .25rem; font-size: .8em; }
.authorship { font-size: .9rem; color: var(--notice); }

/* 演習の島: 解答入力と採点結果。正誤は色だけでなく記号（○ / ×）と文言でも示す */
.blank input:focus-visible, .blank-essay textarea:focus-visible, .viewpoint input:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.answer-actions button:focus-visible, .grading-status button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.answer-actions button:disabled { background: #e3e8e5; color: var(--muted); cursor: default; }
.essay-count { margin: .2rem 0 0; text-align: right; }
.form-status:empty { display: none; }
.form-status { font-weight: 700; color: var(--notice); }
.grading-status { margin: 1rem 0; padding: .7rem 1rem; border-left: 4px solid var(--accent); background: var(--accent-light); border-radius: 8px; }
.grading-status p { margin: .2rem 0; }
.grade-summary { font-weight: 700; margin: .6rem 0 .3rem; }
.grade-summary.is-correct { color: var(--accent); }
.grade-summary.is-wrong { color: #a8441f; }
.grade-list { list-style: none; margin: .4rem 0 1rem; padding: 0; }
.grade-item { padding: .5rem .8rem; margin: 0 0 .5rem; border: 1px solid var(--rule); border-left-width: 4px; border-radius: 8px; background: white; }
.grade-item.is-correct { border-left-color: var(--accent); }
.grade-item.is-wrong { border-left-color: #a8441f; border-left-style: double; border-left-width: 6px; }
.grade-mark { font-weight: 800; margin-right: .6rem; }
.is-correct .grade-mark { color: var(--accent); }
.is-wrong .grade-mark { color: #a8441f; }
.grade-field { font-weight: 700; color: var(--navy); }
.grade-detail { display: grid; grid-template-columns: max-content 1fr; gap: .1rem .8rem; margin: .3rem 0 0; font-size: .93rem; }
.grade-detail dt { color: var(--muted); }
.grade-detail dd { margin: 0; overflow-wrap: anywhere; }
.grade-accept { color: var(--muted); font-size: .85rem; }
.grade-selfnote { font-size: .9rem; color: var(--muted); }
.essay-text { white-space: pre-wrap; padding: .6rem .8rem; border: 1px solid var(--rule); border-radius: 6px; background: white; }
.viewpoints { border: 1px solid var(--rule); border-radius: 8px; padding: .6rem 1rem; margin: .8rem 0; }
.viewpoints legend { font-weight: 700; color: var(--navy); padding: 0 .3rem; }
.viewpoint { display: flex; gap: .5rem; align-items: flex-start; padding: .25rem 0; }
.viewpoint input { margin-top: .45rem; width: 1.1rem; height: 1.1rem; flex: none; }
.ronten-check { margin-top: 1rem; }
.ronten-head { font-weight: 700; color: var(--navy); margin: .6rem 0 .2rem; }
.ronten-list { margin: 0 0 .6rem; padding-left: 1.2rem; }
.ronten-list li { padding: .2rem 0; }
.ronten-jump { font: inherit; font-size: .85rem; margin-left: .4rem; padding: .1rem .5rem; border: 1px solid var(--rule); border-radius: 6px; background: white; color: var(--navy); cursor: pointer; }
.ronten-flash { background: #fff3c4; outline: 2px solid #e0b43a; border-radius: 4px; transition: background .3s; }
@media (max-width: 480px) {
  .blank-grid { grid-template-columns: 1fr; }
  .blank input { min-width: 0; width: 100%; font-size: 16px; }
  .blank-essay textarea { font-size: 16px; }
  .grade-detail { grid-template-columns: 1fr; }
  .grade-detail dd { margin-bottom: .3rem; }
  .answer-actions button { width: 100%; }
}
