/* ひづけ帖。表が主役。画面では机の上の紙、印刷では紙そのもの。 */
:root {
  --paper: #ffffff;
  --desk: #eceef1;
  --ink: #1c1f23;
  --sub: #55606b;
  --line: #8b95a1;
  --soft: #dfe3e8;
  --sun: #c4262e;
  --sat: #1c5aa6;
  --holbg: #fdecec;
  --today: #fff3bf;
  --font: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--desk); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.7; }
a { color: #0b4f9e; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid #0b4f9e; outline-offset: 2px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* 上の帯 */
.site-header { background: var(--paper); border-bottom: 1px solid var(--soft); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 26px; padding-top: 10px; padding-bottom: 10px; }
.site-name { font-size: 1.25rem; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .04em; }
.site-nav { display: flex; flex-wrap: wrap; gap: 2px 20px; font-size: 1rem; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 4px 0; }
.site-nav a:hover, .site-nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; }
.today { margin-left: auto; font-size: .9rem; color: var(--sub); font-variant-numeric: tabular-nums; }

main { padding: 14px 0 44px; }
h1 { font-size: 1.5rem; line-height: 1.35; margin: 0 0 8px; }
h1 small { font-size: .95rem; font-weight: 400; color: var(--sub); margin-left: 6px; }
h2 { font-size: 1.1rem; margin: 26px 0 8px; }
h2.first { margin-top: 0; }
.lead { margin: 0 0 12px; color: var(--sub); }

/* 月の見出しタブ（手帳の月見出し） */
.months { display: flex; gap: 2px; margin: 8px 0 0; padding: 0; list-style: none; }
.months li { flex: 1 0 auto; }
.months a { display: block; min-width: 3.1em; padding: 7px 6px 6px; text-align: center; text-decoration: none; color: var(--ink); background: #f7f8f9; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; font-size: 1rem; font-variant-numeric: tabular-nums; }
.months a:hover { background: var(--paper); }
.months a[aria-current] { background: var(--paper); font-weight: 700; padding-top: 9px; margin-top: -2px; position: relative; z-index: 1; }
.months .yr a { min-width: 4.2em; }
.below .months a { border-bottom: 1px solid var(--line); border-radius: 6px; }

/* 操作の帯 */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-bottom: 0; padding: 10px 12px; }
.tools.slim { border: 0; background: none; padding: 0 0 10px; }
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; font-size: .95rem; padding: 7px 12px; border: 0; background: var(--paper); color: var(--ink); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.btn { font: inherit; font-size: .95rem; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn.main { background: var(--ink); color: #fff; }
.btn:hover { background: #33383f; color: #fff; }
.tools .spacer { flex: 1 1 auto; }

/* 紙 */
.sheet { background: var(--paper); border: 1px solid var(--line); padding: 14px 16px; }
.sheet.text { margin-top: 10px; max-width: 760px; }
.sheet.text > :first-child { margin-top: 0; }
.sheet-title, .sheet-foot { display: none; }          /* 画面では見出しが上にあるので出さない。印刷でだけ出す */

table.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.cal th { font-weight: 700; font-size: 1rem; padding: 4px 0; border: 1px solid var(--line); background: #f1f2f4; }
table.cal td { height: 4.9rem; vertical-align: top; border: 1px solid var(--line); padding: 4px 6px; }
table.cal .d { display: block; font-size: 1.4rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
table.cal .h { display: block; font-size: .85rem; font-weight: 700; line-height: 1.2; color: var(--sun); margin-top: 2px; }
table.cal .sun, table.cal .hol { color: var(--sun); }
table.cal .sat { color: var(--sat); }
table.cal td { position: relative; }
table.cal .r { position: absolute; bottom: 5px; right: 6px; font-size: .78rem; line-height: 1.2; color: var(--sub); }
table.cal .r.tai { color: #17692f; font-weight: 700; }
table.cal.mid .r { top: 5px; bottom: auto; right: 5px; font-size: .68rem; }
table.cal td.holcell { background: var(--holbg); }
table.cal td.today { background: var(--today); }
table.cal td.empty { background: #f8f9fa; }
table.cal.mid td { height: 3.6rem; padding: 3px 5px; }
table.cal.mid .d { font-size: 1.1rem; }
table.cal.mid .h { font-size: .68rem; }
table.cal.mid th { font-size: .88rem; padding: 2px 0; }

/* 週の始まりの切り替え。両方を置いて、片方だけ見せる */
body:not([data-start="mon"]) [data-for="mon"] { display: none; }
body[data-start="mon"] [data-for="sun"] { display: none; }

/* トップ: 今月と来月 */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.duo-item h2 { margin: 0 0 6px; font-size: 1.25rem; }
.duo-item h2 a { color: var(--ink); text-decoration: none; }
.duo-links { display: flex; gap: 8px; margin: 8px 0 0; }
.jump { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px 14px; margin: 14px 0 0; padding: 0; list-style: none; }
.jump li { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.jump a { display: block; font-size: 1.05rem; font-weight: 700; }
.jump span { color: var(--sub); font-size: .9rem; }

/* 年間 */
.year-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 20px; }
.mini { break-inside: avoid; }
.mini h3 { margin: 0 0 2px; font-size: 1.05rem; }
.mini h3 a { color: var(--ink); text-decoration: none; }
.mini h3 small { font-size: .78rem; font-weight: 400; color: var(--sub); margin-left: 5px; }
.sheet-note { margin: 10px 0 0; font-size: .9rem; color: var(--sub); }
.mini h3 a:hover { text-decoration: underline; }
table.minical { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
table.minical th { font-size: .8rem; font-weight: 400; color: var(--sub); padding: 1px 0; }
table.minical td { text-align: center; font-size: .95rem; padding: 1px 0; }
table.minical .sun, table.minical .hol { color: var(--sun); }
table.minical .hol { font-weight: 700; background: var(--holbg); }
table.minical .sat { color: var(--sat); }
table.minical th.sun { color: var(--sun); } table.minical th.sat { color: var(--sat); }

/* 下の欄と一覧の表 */
.below { background: var(--paper); border: 1px solid var(--line); border-top: 0; padding: 4px 16px 18px; }
.below > :first-child { margin-top: 12px; }
.facts { margin: 12px 0 6px; font-size: 1.02rem; }
table.list { border-collapse: collapse; width: 100%; max-width: 560px; font-variant-numeric: tabular-nums; }
table.list th, table.list td { border-bottom: 1px solid var(--soft); padding: 6px 14px 5px 0; text-align: left; vertical-align: top; white-space: nowrap; }
table.list thead th { border-bottom: 2px solid var(--ink); font-size: .9rem; }
table.list .sun { color: var(--sun); } table.list .sat { color: var(--sat); }
table.list td.num, table.list th.num { text-align: right; }
table.list tr.hit td { background: var(--today); }
.age-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 36px; margin-top: 14px; }
table.list.age { max-width: none; }
.agefind label { display: block; font-weight: 700; }
.agefind input { font: inherit; font-size: 1.2rem; width: 11em; max-width: 100%; padding: 8px 10px; border: 1px solid var(--ink); border-radius: 6px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 14px 0 0; }
.note { font-size: .9rem; color: var(--sub); margin: 6px 0; }
.source { font-size: .9rem; color: var(--sub); margin: 12px 0 0; }
ul.plain { padding-left: 1.2em; margin: 6px 0; }
.dl { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.dl .btn { min-width: 4.2em; justify-content: center; }

/* 計算 */
.calc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; max-width: 640px; }
.calc label { display: block; font-weight: 700; font-size: .95rem; }
.calc input[type="date"], .calc input[type="number"] { font: inherit; font-size: 1.1rem; width: 100%; padding: 8px 10px; border: 1px solid var(--ink); border-radius: 6px; background: var(--paper); color: var(--ink); }
.calc .full { grid-column: 1 / -1; }
.calc .check { font-weight: 400; display: flex; align-items: center; gap: 8px; }
.result { margin: 12px 0 0; padding: 12px 16px; border: 2px solid var(--ink); max-width: 640px; background: var(--paper); }
.result .big { font-size: 1.9rem; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.result p { margin: 2px 0 0; }

.site-footer { border-top: 1px solid var(--soft); background: var(--paper); font-size: .9rem; color: var(--sub); }
.site-footer .wrap { padding-top: 14px; padding-bottom: 22px; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.site-footer a { color: var(--sub); }

@media (max-width: 720px) {
  h1 { font-size: 1.25rem; }
  .today { margin-left: 0; width: 100%; }
  .sheet { padding: 10px 8px; }
  table.cal td { height: 4.6rem; padding: 3px 3px; }
  table.cal .d { font-size: 1.1rem; }
  table.cal .h { font-size: .68rem; line-height: 1.15; }
  table.cal .r { bottom: 4px; right: 3px; font-size: .7rem; letter-spacing: -.02em; }
  table.cal.mid .r { display: none; }
  table.cal th { font-size: .88rem; }
  .duo { grid-template-columns: 1fr; }
  table.cal.mid td { height: 3.6rem; }
  .jump { grid-template-columns: 1fr 1fr; }
  .year-grid { grid-template-columns: repeat(2, 1fr); gap: 12px 12px; }
  table.minical td { font-size: .88rem; }
  .months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
  .months .yr { grid-column: 1 / -1; }
  .months a, .months a[aria-current] { min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 7px 2px; margin-top: 0; }
  .months a[aria-current] { border-color: var(--ink); border-width: 2px; padding: 6px 1px; }
  .months + .tools { margin-top: 8px; }
  .tools .btn { flex: 1 1 44%; justify-content: center; }
  .tools .spacer { display: none; }
  .below { padding: 4px 10px 16px; }
  table.list th, table.list td { padding-right: 8px; }
  .eto, .wide-only { display: none; }
  .age-cols { grid-template-columns: 1fr; }
  .age-cols table + table thead { display: none; }
  .calc { grid-template-columns: 1fr; }
}

/* 印刷: 紙だけを出す */
@page { size: A4 landscape; margin: 9mm 10mm 8mm; }
@media print {
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer, .tools, .months, .below, h1, .lead, .no-print { display: none !important; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .sheet { border: 0; padding: 0; }
  .sheet-title { display: flex; align-items: baseline; gap: 5mm; margin: 0 0 3mm; }
  .sheet-title .ym { font-size: 32pt; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
  .sheet-title .era { font-size: 13pt; color: #444; }
  .sheet-note { font-size: 8.5pt; margin: 2mm 0 0; color: #444; }
  .mini h3 small { font-size: 8pt; }
  .sheet-foot { display: block; margin: 1.5mm 0 0; text-align: right; font-size: 6.5pt; color: #777; }
  table.cal th { font-size: 14pt; padding: 1.2mm 0; border: .75pt solid #8b95a1; background: #eef0f2 !important; }
  table.cal td { height: var(--row-h, 27mm); padding: 1.2mm 2mm; border: .75pt solid #8b95a1; background: #fff !important; }
  table.cal td.holcell { background: #fdecec !important; }
  table.cal .r, table.cal.mid .r { top: auto; bottom: 1.6mm; right: 2mm; font-size: 10.5pt; }
  table.cal .d { font-size: 28pt; line-height: 1.05; }
  table.cal .h { font-size: 11pt; margin-top: .5mm; }
  table.cal, table.minical, table.cal td, table.cal th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .year-grid { grid-template-columns: repeat(4, 1fr); gap: 4mm 9mm; }
  .mini h3 { font-size: 14pt; margin-bottom: .3mm; line-height: 1.3; }
  table.minical td { font-size: 11pt; padding: .3mm 0; line-height: 1.32; }
  table.minical th { font-size: 9pt; line-height: 1.3; }
  table.minical .hol { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* 大きい文字版（壁掛け用）: 日付と祝日名を、2m 離れても読める大きさに */
  .big table.cal th { font-size: 16pt; padding: 1mm 0; }
  .big table.cal td { padding: 1.2mm 2.2mm; height: calc(var(--row-h, 27mm) - 2.5mm); }
  .big table.cal .d { font-size: 40pt; line-height: 1; }
  .big table.cal .h { font-size: 14pt; line-height: 1.15; margin-top: .6mm; }
  .big table.cal .r { font-size: 13pt; bottom: 1.6mm; right: 2.2mm; }
  .big .sheet-title { margin-bottom: 2mm; }
  .big .sheet-title .ym { font-size: 34pt; }
  .big .sheet-title .era { font-size: 15pt; }
  .big table.cal td, .big table.cal th { border-width: 1.1pt; border-color: #5f6b78; }
  a { color: inherit; text-decoration: none; }
}

/* 計算の結果: 項目名と値を2列に並べる（長い文を折り返さない） */
.result .big { margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--soft); }
.kv dt { color: var(--sub); font-size: .9rem; padding-top: .1em; }
.kv dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv dd small { display: block; font-weight: 400; font-size: .9rem; color: var(--sub); }
.howto { margin: 6px 0; padding-left: 1.2em; font-size: .95rem; }
.howto li { margin: 4px 0; }
/* 日本語の改行を文節で区切り、行末に1〜2文字だけ残るのを避ける（対応していないブラウザーでは今までどおり） */
.lead, .note, .howto li, .kv dd, .result p, .jump a, .jump span, .facts { word-break: auto-phrase; text-wrap: pretty; }
.below .jump { margin: 16px 0 4px; }
.below > .kv:first-child { border-top: 0; padding-top: 0; }

/* 六曜の一覧ページ */
.rk .kv.first { border-top: 0; padding-top: 0; margin-top: 0; }
.rk h2 { margin-top: 22px; }
table.rk-list { max-width: 640px; }
table.rk-list th, table.rk-list td { white-space: normal; }
table.rk-list tbody th { font-weight: 700; padding-right: 12px; white-space: nowrap; }
table.rk-list tbody th a { color: var(--ink); }
table.rk-list td.nums { line-height: 1.6; }
.nums span { display: inline-block; margin-right: .55em; font-variant-numeric: tabular-nums; }
.nums .sun, .nums .sat { font-weight: 700; }
.rk details { border-top: 1px solid var(--soft); padding: 8px 0; }
.rk summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.rk details table { margin-top: 8px; }
.below .source { margin-top: 14px; }

/* 年末年始 */
table.cal.nm td { height: 3.6rem; }
table.cal.nm .d { font-size: 1.15rem; }
table.cal.nm td.nm-gov { background: #fff4d6; }
table.cal.nm td.nm-bank { background: #ffe3b3; }
table.cal.nm .nm-l { display: block; font-size: .72rem; line-height: 1.2; color: var(--sub); margin-top: 2px; word-break: keep-all; }
.nm-key { display: inline-block; width: 1em; height: 1em; vertical-align: -.15em; margin-right: 4px; border: 1px solid var(--line); }
.nm-key.nm-gov { background: #fff4d6; } .nm-key.nm-bank { background: #ffe3b3; }
.result .kv { margin-top: 8px; }
/* 連休の一覧 */
.rk-list td small{display:block;color:var(--sub);font-size:.8rem}
.rk-list td{vertical-align:top}
ul.rk{list-style:none;margin:0;padding:0}
ul.rk li{margin:0 0 6px;word-break:auto-phrase;text-wrap:pretty}
ul.rk li:last-child{margin-bottom:0}
ul.rk b{display:block}
.rk-list td.num,.rk-list th.num{white-space:nowrap}
.muted{color:var(--sub)}
