/* ===========================
   くらしのおたすけ（親・シニア向け） — yorozu-craft 共通の和紙風の配色を、大きな字・高いコントラストに寄せたもの
   色はトークン（--bg / --card / --text / --muted / --accent / --border）だけを使う。
   ダークモードは端末の設定に自動で合わせる（prefers-color-scheme。手動切替は付けない）
   字は 18px を基準（html の font-size 112.5%）、ボタンは高さ 48px 以上。印刷物は白黒・A4
   =========================== */
:root {
  color-scheme: light dark;
  --bg: #f0ebe0;
  --bg-2: #e6dfd0;
  --card: #fffdf8;
  --text: #221b12;
  --muted: #4f4335;
  --accent: #7a3a0c;
  --accent-soft: #f3e6d8;
  --border: #b9a887;
  --shadow: rgba(58, 48, 37, 0.12);
  --warn: #8a1c10;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120e;
    --bg-2: #1f1a14;
    --card: #26201a;
    --text: #f5eee2;
    --muted: #d4c7b3;
    --accent: #f0b27a;
    --accent-soft: #3a2e22;
    --border: #5d4f40;
    --shadow: rgba(0, 0, 0, 0.4);
    --warn: #ff9d8f;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }   /* 18px */
body {
  /* README「ツールを追加するとき」9: 端末のフォント。Web フォントは読まない */
  font-family: "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
}

a { color: var(--accent); }

/* ヘッダー */
.app-header {
  text-align: center;
  padding: 1.1rem 1rem 0.9rem;
  background: var(--bg-2);
  border-bottom: 2px solid var(--border);
}
.app-header h1 { font-size: 1.45rem; color: var(--accent); line-height: 1.4; }
.app-header .subtitle { font-size: 0.95rem; color: var(--muted); margin-top: 0.2rem; }

/* 高齢者向けページの先頭の定型文（WRITING 2 章・D118） */
.noad { font-weight: 700; font-size: 1rem; margin: 0 0 0.8rem; padding: 0.5rem 0.8rem; border-left: 5px solid var(--accent); background: var(--card); }

/* レイアウト */
.app-main { max-width: 720px; margin: 0 auto; padding: 1rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px var(--shadow);
}
.card h2 {
  font-size: 1.1rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.8rem;
}

/* 入力（大きめ） */
.field { margin-bottom: 1rem; }
.field > label, .field > .label { display: block; font-weight: 700; font-size: 1rem; margin-bottom: 0.25rem; }
.field .hint { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.3rem; }
input[type="text"], input[type="tel"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  max-width: 24rem;
  min-height: 48px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 1.05rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
}
textarea { min-height: 5.5rem; max-width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }

/* 選択肢（ラジオ・チェック）: 押しやすい大きさのタイル */
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; border: 0; }
.choices label {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 48px; padding: 0.4rem 0.8rem;
  border: 2px solid var(--border); border-radius: 8px; background: var(--card); cursor: pointer; font-size: 1rem;
}
.choices input { width: 1.3rem; height: 1.3rem; accent-color: var(--accent); }
.choices label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.check { display: flex; align-items: center; gap: 0.5rem; min-height: 48px; cursor: pointer; }
.check input { width: 1.4rem; height: 1.4rem; accent-color: var(--accent); flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px;
  padding: 0.55rem 1.2rem;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--card);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn-big { font-size: 1.25rem; min-height: 60px; padding: 0.6rem 1.6rem; }
.btn-sub { background: var(--card); color: var(--accent); }
.btn:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 0.8rem 0; align-items: center; }   /* ボタンの間隔（SCREEN.md 5 章） */

/* 読みもの（guide.html） */
.content { overflow-wrap: anywhere; }   /* 長いドメイン名などで横にはみ出さない */
.content h3 { font-size: 1.02rem; margin: 1rem 0 0.3rem; }
.content p, .content li { font-size: 1rem; }
.content p + p { margin-top: 0.5rem; }
.content ul, .content ol { padding-left: 1.4rem; margin: 0.3rem 0; }
.content li + li { margin-top: 0.3rem; }
.faq dt { font-weight: 700; margin-top: 0.9rem; font-size: 1rem; }
.faq dt::before { content: 'Q. '; color: var(--accent); }
.faq dd { font-size: 0.98rem; color: var(--muted); padding: 0.2rem 0 0.5rem 1.2rem; border-bottom: 1px solid var(--border); }
.small { font-size: 0.9rem; color: var(--muted); margin-top: 0.4rem; }
.warn { color: var(--warn); font-weight: 700; }
.src { font-size: 0.85rem; color: var(--muted); word-break: break-all; }

/* ハブ（トップ）のカード */
.tools { list-style: none; display: grid; gap: 0.8rem; }
.tools a { display: block; padding: 0.9rem 1rem; border: 2px solid var(--border); border-radius: 10px; background: var(--card); text-decoration: none; color: var(--text); }
.tools a:hover, .tools a:focus-visible { border-color: var(--accent); }
.tools .t { display: block; font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.tools .d { display: block; font-size: 0.98rem; color: var(--muted); }

/* フッター */
.app-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}
.footer-nav ul { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 0.2rem 1.1rem; margin-bottom: 0.6rem; }
.footer-nav a { color: var(--muted); text-decoration: none; display: inline-block; padding: 0.4rem 0; }
.footer-nav a:hover, .footer-nav a[aria-current="page"] { color: var(--accent); }

@media (max-width: 480px) {
  .app-header h1 { font-size: 1.25rem; }
  .app-main { padding: 0.8rem 0.7rem; }
}

/* ===========================
   画面の骨組み（yorozu-plans の docs/SCREEN.md 1.2。README「ツールを追加するとき」25）
   設定（fieldset.req）→ 主なボタン（印刷）→ 見本 → くわしい設定（details.opt）→ 保存・書き出し
   =========================== */
fieldset.card { min-width: 0; }
.req legend {
  float: left; width: 100%;   /* legend を枠の上に載せず、h2 と同じ見た目で枠の中に置く */
  font-size: 1.1rem; font-weight: 700; color: var(--accent);
  border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; margin-bottom: 0.8rem;
}
.req legend + * { clear: both; }

details.card.opt { padding: 0 1.1rem; margin-bottom: 0.7rem; }
details.card.opt > summary {
  cursor: pointer; display: block; min-height: 48px; padding: 0.65rem 0;
  color: var(--accent); font-weight: 700; font-size: 1.02rem; list-style: none;
}
details.card.opt > summary::-webkit-details-marker { display: none; }
details.card.opt > summary::before { content: '▸'; margin-right: 0.4rem; }
details.card.opt[open] > summary::before { content: '▾'; }
details.card.opt[open] { padding-bottom: 0.9rem; }
details.card.opt[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 0.9rem; }
details > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.opt-state { color: var(--text); font-weight: normal; }

/* 固定バー（SCREEN.md 0 章の 3）: 印刷物では「印刷する」のボタンを上端に */
.fixbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: 52px;
  background: var(--card); border-bottom: 2px solid var(--accent); box-shadow: 0 2px 8px var(--shadow);
}
.fixbar a, .fixbar button {
  display: block; width: 100%; max-width: 720px; margin: 0 auto; padding: 0 1rem; height: 50px; line-height: 50px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: inherit; font-weight: 700; font-size: 1.05rem;
  color: var(--accent); background: none; border: none; text-decoration: none; cursor: pointer;
}
.fixbar a:focus-visible, .fixbar button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* ===========================
   見本（印刷物をそのまま縮めて見せる。見本の DOM がそのまま印刷される）
   用紙は mm で組み、画面では common.js が幅に合わせて縮める
   =========================== */
.preview-cap { font-size: 0.95rem; color: var(--muted); margin: 0.2rem 0 0.3rem; }
.sheets-wrap { overflow: hidden; margin-bottom: 1rem; }
.sheets { transform-origin: 0 0; width: max-content; }
.sheet {
  position: relative; width: 210mm; height: 297mm; overflow: hidden;
  background: #fff; color: #000; margin: 0 0 6mm;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  font-family: "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.4;
}
.sheet.land { width: 297mm; height: 210mm; }
.rot { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.sheet .credit { position: absolute; right: 8mm; bottom: 4mm; font-size: 8pt; color: #444; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff !important; color: #000; }
  .app-header, .app-footer, .fixbar, .no-print, main > :not(.print-host):not(form), main > form > :not(.print-host), .print-host > :not(.sheets-wrap) { display: none !important; }
  .app-main { max-width: none; margin: 0; padding: 0; }
  .sheets-wrap { height: auto !important; overflow: visible !important; margin: 0; }
  .sheets { transform: none !important; }
  .sheet { margin: 0; box-shadow: none; break-after: page; page-break-after: always; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  /* 横長の用紙（写経の標準）は、縦の A4 に 90 度回して刷る（ブラウザの用紙の向きの設定に左右されない） */
  .sheet.land { width: 210mm; height: 297mm; }
  .sheet.land > .rot { left: 210mm; top: 0; width: 297mm; height: 210mm; transform: rotate(90deg); transform-origin: 0 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
