/* ===== 色やフォントの設定（ここを変えるとサイト全体の見た目が変わります） ===== */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2a2622;
  --muted: #6d655c;
  --line: #e6dfd4;
  --accent: #b8372b;       /* ご祝儀：朱色 */
  --accent-soft: #fbeae6;
  --radius: 14px;
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic", Meiryo, sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "Noto Serif CJK JP", serif;
}
body[data-scene="koden"] {
  --accent: #3d4a66;       /* 香典：藍鼠 */
  --accent-soft: #e8ebf1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a18; --surface: #262320; --ink: #f1ece5; --muted: #b0a79c; --line: #3a3530;
    --accent: #e0705f; --accent-soft: #3a2622;
  }
  body[data-scene="koden"] { --accent: #9fb0d4; --accent-soft: #262c38; }
}

/* ===== 基本 ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.8;
  transition: background-color .2s;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.4; font-weight: 700; }
h1 { font-size: clamp(1.5rem, 5vw, 2.1rem); margin: 1.2rem 0 .8rem; }
h2 { font-size: 1.3rem; margin: 0 0 1rem; padding-bottom: .4rem; border-bottom: 2px solid var(--accent-soft); }
h3 { font-size: 1.05rem; margin: 0 0 .3rem; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.small { font-size: .85rem; color: var(--muted); }
.lead { color: var(--muted); }
.sp { display: none; }
@media (max-width: 480px) { .sp { display: inline; } }

/* ===== ヘッダー・フッター ===== */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { display: flex; align-items: center; gap: .5rem; color: var(--ink); text-decoration: none; font-weight: 700; font-family: var(--serif); }
.logo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-size: .95rem; }
.nav { display: flex; gap: 1rem; }
.nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.nav a:hover { color: var(--accent); }
.site-footer { margin-top: 4rem; padding: 2rem 0; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.site-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

/* ===== トップ ===== */
.hero { padding: 2rem 0 .5rem; }
.hero h1 { font-size: clamp(1.7rem, 6vw, 2.4rem); margin-top: 0; }

/* ===== 判定ツール ===== */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin: 1.5rem 0; box-shadow: 0 2px 12px rgba(0,0,0,.04); }
.tool-form { display: grid; gap: 1.1rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend, .field-label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: .45rem; }
.field { display: block; }
select {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat;
}
.seg { display: flex; gap: .5rem; flex-wrap: wrap; }
.seg-btn {
  flex: 1 1 0; min-width: 0; text-align: center; cursor: pointer; font: inherit; font-size: .92rem;
  padding: .65rem .5rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
  transition: all .15s;
}
.seg-btn input { position: absolute; opacity: 0; pointer-events: none; }
.seg-btn[aria-pressed="true"], .seg-btn:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.seg-btn:focus-within, .seg-btn:focus-visible, select:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; }
.tool-result { margin-top: 1.25rem; }

/* ===== 結果 ===== */
.answer { background: var(--accent-soft); border-radius: var(--radius); padding: 1.25rem; text-align: center; margin: 1rem 0 1.5rem; }
.tool .answer { margin: 0; }
.answer-label { font-size: .9rem; color: var(--muted); }
.answer-range { font-family: var(--serif); font-size: clamp(2.2rem, 10vw, 3.2rem); font-weight: 700; color: var(--accent); line-height: 1.3; margin: .2rem 0; }
.answer-rec { font-size: 1rem; margin-bottom: .6rem; }
.answer-rec strong { color: var(--accent); font-size: 1.15rem; }
.answer p { text-align: left; margin: .8rem 0 0; font-size: .95rem; }
.btn { display: inline-block; margin-top: .4rem; padding: .6rem 1.2rem; border-radius: 999px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 700; font-size: .92rem; }
.btn:hover { opacity: .9; }

/* ===== カード ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 2rem 0; }
.card { display: grid; gap: .2rem; padding: 1.2rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); border-top: 4px solid #b8372b; }
.card-koden { border-top-color: #3d4a66; }
.card strong { font-family: var(--serif); font-size: 1.15rem; }
.card-kicker, .card span:last-child { font-size: .85rem; color: var(--muted); }

/* ===== セクション ===== */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin: 1.5rem 0; }
.crumbs { font-size: .82rem; color: var(--muted); margin-top: 1rem; }
.crumbs a { color: var(--muted); }
.crumbs .sep { margin: 0 .4rem; }
.table-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: .93rem; }
.grid th, .grid td { padding: .6rem .35rem; border-bottom: 1px solid var(--line); text-align: center; }
.grid th[scope="row"] { text-align: left; font-weight: 700; min-width: 6.5em; font-size: .88rem; }
.grid thead th { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.nw { white-space: nowrap; display: inline-block; }
.grid a { text-decoration: none; font-weight: 700; }
.manners { list-style: none; counter-reset: m; padding: 0; margin: 0; display: grid; gap: 1rem; }
.manners li { counter-increment: m; position: relative; padding-left: 2.4rem; }
.manners li::before { content: counter(m); position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .85rem; font-weight: 700; }
.manners p { margin: 0; font-size: .95rem; }
.tips { margin: 0; padding-left: 1.2rem; }
.tips li + li { margin-top: .4rem; }
.sources ul { padding-left: 1.2rem; font-size: .9rem; }
.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.related ul { padding-left: 1.2rem; margin: 0; font-size: .93rem; }
.prose h2 { margin-top: 1.5rem; }
.prose h2:first-child { margin-top: 0; }

/* ===== 中袋の見本 ===== */
.envelopes { display: flex; gap: 1rem; flex-wrap: wrap; }
.envelope { text-align: center; }
.env-amount { font-size: .82rem; color: var(--muted); margin-bottom: .3rem; }
.env-vertical {
  writing-mode: vertical-rl; font-family: var(--serif); font-size: 1.25rem; letter-spacing: .15em;
  background: #fffdf8; color: #222; border: 1px solid var(--line); border-radius: 4px;
  padding: 1.2rem .9rem; height: 12em; display: inline-block; text-align: center; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ===== 記事 ===== */
.article-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.article-list a { display: grid; gap: .2rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.article-list a:hover { border-color: var(--accent); }
.article-list strong { font-family: var(--serif); font-size: 1.05rem; line-height: 1.5; }
.article-desc { font-size: .88rem; color: var(--muted); line-height: 1.6; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .8rem; color: var(--muted); }
.tag { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; color: #fff; background: #7a7066; }
.tag-goshugi { background: #b8372b; }
.tag-koden { background: #3d4a66; }
.tag-draft { background: #c58a1a; }
.article header { margin: 1rem 0 1.25rem; }
.article header h1 { margin-top: .5rem; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.25rem; margin: 1rem 0 1.5rem; }
.toc-title { font-weight: 700; font-size: .9rem; margin-bottom: .3rem; }
.toc ol { margin: 0; padding-left: 1.3rem; font-size: .93rem; }
.toc a { color: var(--ink); }
.article-body { font-size: 1.02rem; line-height: 1.95; }
.article-body h2 { margin-top: 2.5rem; padding: .5rem .8rem; border: 0; border-left: 5px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; font-size: 1.25rem; }
.article-body h3 { margin-top: 1.8rem; font-size: 1.1rem; padding-bottom: .2rem; border-bottom: 1px dashed var(--line); }
.article-body h4 { margin-top: 1.4rem; }
.article-body img { max-width: 100%; height: auto; border-radius: 10px; }
.article-body ul, .article-body ol { padding-left: 1.4rem; }
.article-body blockquote { margin: 1.2rem 0; padding: .6rem 1rem; border-left: 4px solid var(--line); color: var(--muted); }
.article-body hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.article-body .grid td, .article-body .grid th { white-space: normal; }
.box { border-radius: 12px; padding: .9rem 1.1rem; margin: 1.4rem 0; border: 2px solid; }
.box > :last-child { margin-bottom: 0; }
.box p { margin: .3rem 0 0; }
.box-title { font-weight: 700; font-size: .92rem; }
.box-point { border-color: #d9a441; background: rgba(217,164,65,.08); }
.box-point .box-title::before { content: "✓ "; }
.box-warn { border-color: #c9533f; background: rgba(201,83,63,.07); }
.box-warn .box-title::before { content: "! "; }
.cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin: 2.5rem 0 1.5rem; padding: 1.25rem; border-radius: var(--radius); background: var(--accent-soft); }
.cta-text { display: grid; gap: .15rem; }
.cta-text strong { font-family: var(--serif); font-size: 1.15rem; }
.cta-text span { font-size: .9rem; color: var(--muted); }
.cta .btn { margin: 0; }

/* ===== 運営者情報 ===== */
.about-table th[scope="row"] { width: 8em; color: var(--muted); font-weight: 700; }
.about-table td { text-align: left; }
