@charset "UTF-8";

/*
 * ouyou main.css（第十二段階）
 *
 * senmon の www/senmon/css/main.css をそのまま踏襲（ouyou_instructions.md 4.1）。
 * ouyou固有の構造差異はない（mondai.php の nav a.next もsenmonと同じ形でよい）ため、変更なし。
 *
 * 旧サイトの CSS（style.css / custom.css / font-awesome.css / normalize.css）は参照しない。
 * 外部フレームワーク・Webフォント・アイコンフォント・JavaScriptを使わない。
 */

:root {
    --text: #222;          /* 本文（黒に近いグレー） */
    --muted: #666;         /* 区分など控えめな要素 */
    --line: #cccccc;       /* 罫線・枠線 */
    --line-strong: #999999;
    --accent: #b3141b;     /* アクセント赤（ページ見出し .page-title と解答ボタンのみ） */
    --accent-hover: #8f0f15;
    --emphasis: #cc0000;   /* 本文強調 .red 用（アクセント赤とは別用途） */
    --answer-bg: #f4f4f4;  /* 解答の背景 */
    --th-bg: #f0f0f0;
    --bg: #ffffff;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0 auto;
    padding: 16px;
    max-width: 700px;
    font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN",
        "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text);
    background: var(--bg);
}

/* ------- 見出し ------- */
/*
 * h1 はヘッダのロゴ（サイト名。.site-title でリセット）。
 * <h2> には2種類ある:
 *   - ページを識別する見出し → h2.page-title（赤）。mondai / mondai_top / 静的 / sitemap
 *   - 本文中の見出し → bare h2。index.php の「生保応用課程を短期合格！」
 */
h2 {
    margin: 0 0 16px;
    font-size: 1.3rem;
    line-height: 1.4;
}

h2.page-title {
    margin: 0 0 24px;
    font-size: 1.35rem;
    color: var(--accent);
}

h3 {
    margin: 28px 0 8px;
    font-size: 1.1rem;
    line-height: 1.4;
}

/* h4（sitemap.php の「第N回」の見出し。h3 より階層が下） */
h4 {
    margin: 20px 0 6px;
    font-size: 1rem;
    line-height: 1.4;
}

/* リード文（静的ページの見出し直後の概要。.content の外にある。h2 より目立たせない・赤は使わない） */
.lead {
    margin: 0 0 20px;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.6;
}

.lawdate {
    margin: 0 0 20px;
    font-size: 0.9rem;
}

p {
    margin: 0 0 14px;
}

ul {
    margin: 0 0 16px;
    padding-left: 1.4em;
}

li {
    margin: 4px 0;
}

/* 本文中の強調（旧サイトの .red を踏襲。色はアクセント赤とは別） */
.red {
    color: var(--emphasis);
    font-weight: 700;
}

/*
 * 囲みボックス。.waku（index / tokutyo / study）と .sentaku（point1〜8）は同じ見た目。
 */
.waku,
.sentaku {
    margin: 20px 0;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 4px;
}

.waku > :last-child,
.sentaku > :last-child {
    margin-bottom: 0;
}

/* ------- 枝（section。mondai.php） ------- */
section {
    margin: 0 0 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--line);
}

section:last-of-type {
    margin-bottom: 24px;
    padding-bottom: 0;
    border-bottom: none;
}

section p {
    margin: 0 0 12px;
}

/* ------- 区分（控えめ・小さめ。mondai.php） ------- */
p.meta {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--muted);
}

/* 区分ブロックの直後（問題文の先頭）に余白 */
p.meta + :not(p.meta) {
    margin-top: 16px;
}

/* ------- 解答（details / summary） ------- */
details {
    margin-top: 16px;
}

summary {
    display: inline-block;
    padding: 10px 20px;
    min-height: 44px;
    line-height: 24px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    list-style: none;
    -webkit-user-select: none;
    user-select: none;
}

summary::-webkit-details-marker {
    display: none;
}

summary::marker {
    content: "";
}

summary:hover,
summary:focus {
    background: var(--accent-hover);
}

details[open] summary {
    margin-bottom: 12px;
}

/* 解答の中身（本文と区別） */
.answer {
    padding: 12px 16px;
    background: var(--answer-bg);
    border-left: 4px solid var(--line-strong);
    border-radius: 2px;
}

.answer > :first-child {
    margin-top: 0;
}

.answer > :last-child {
    margin-bottom: 0;
}

/* 正誤の判定（色分けしない・濃いグレーの太字） */
p.verdict {
    font-weight: 700;
    color: var(--text);
}

/* ------- 表 ------- */
/*
 * table 自体は display: table のまま保ち、列幅の自動調整を効かせる。
 * 計算問題の表（mondai.php Kei=3。15件中3件が<table>を含む）は .table-wrap で横スクロールさせる。
 * DBが出力するHTML（tableの中身）は書き換えない。
 * white-space: nowrap は .table-wrap 内の表だけに適用（point1〜8 の表は長いセルを
 * 含むため折り返し可にする）。
 */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    margin: 12px 0;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th,
td {
    padding: 6px 12px;
    border: 1px solid var(--line-strong);
    text-align: center;
}

th {
    background: var(--th-bg);
}

.table-wrap table th,
.table-wrap table td {
    white-space: nowrap;
}

/* ------- ナビゲーション（前へ / 次へ） ------- */
/*
 * 「前へ」を左、「次へ」を右。狭くて2つ並ばないときは折り返す。
 * 片方だけのページでは、「次へ」のみ → 右寄せ（.next の margin-left:auto）、
 * 「前へ」のみ → 左寄せ（既定）。
 * breadcrumb も <nav> なので、フレックスは nav:not(.breadcrumb) に限定する。
 */
nav:not(.breadcrumb) {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

nav:not(.breadcrumb) a {
    flex: 0 0 auto;
    max-width: 100%;
    padding: 14px 16px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--text);
    text-align: center;
    text-decoration: none;
}

nav a.next {
    margin-left: auto;
}

nav:not(.breadcrumb) a:hover,
nav:not(.breadcrumb) a:focus {
    border-color: var(--line-strong);
}

/* ------- パンくずリスト（header.php の直後・h2 の前） ------- */
/* 本文より小さく控えめに。赤は使わない。インライン要素なのでスマホ幅で自然に折り返す。 */
.breadcrumb {
    margin: 0 0 16px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--muted);
}

.breadcrumb a {
    color: var(--muted);
}

.breadcrumb-sep {
    margin: 0 0.4em;
    color: var(--line-strong);
}

/* ------- サイトヘッダ（ロゴ = h1） ------- */
.site-header {
    margin-bottom: 20px;
}

/* ロゴを包む h1。既定の見出しスタイル（サイズ・余白・赤字）を打ち消す。 */
.site-title {
    margin: 0;
    font: inherit;
    color: inherit;
}

.site-header img {
    display: block;
    width: 300px;      /* 実寸。縮小のみ許可（下の max-width） */
    max-width: 100%;
    height: auto;      /* width/height 属性から縦横比を保つ */
}

/* ------- サイトフッタ ------- */
.site-footer {
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 0.85rem;
    color: var(--muted);
}

.site-footer p {
    margin: 0 0 8px;
}

.site-footer p:last-child {
    margin-bottom: 0;
}

.site-footer a {
    color: var(--muted);
}

/* ------- 広告（AdSense。第十三段階で使用） ------- */
/* .ad-block の上下余白で本文と区別。.splink（「スポンサーリンク」）は控えめに。赤は使わない。 */
.ad-block {
    margin: 28px 0;
}

.splink {
    margin: 0 0 4px;
    font-size: 0.8rem;
    color: var(--muted);
}
