/* 文章の中の表（設計図 §6.3）
   2列までは幅に合わせる。3列以上は列ごとに中身から最小幅（最大13em、上限18em）を決め、収まらなければ横にスクロールし、右端に「続きがある」影を出す。
   画面の6割より高い表は、見出し行の写しを画面の上端に貼り付ける。拡大（全画面）とカード表示を切り替えられる。 */
.tbl { position: relative; margin: 0 0 1.2em; }
.tbl table { border-collapse: separate; border-spacing: 0; font-size: .9em; line-height: 1.6; letter-spacing: .01em; }
.tbl th, .tbl td { padding: .45em .7em; vertical-align: top; text-align: left; border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line); overflow-wrap: anywhere; }
.tbl tr > :first-child { border-left: 1px solid var(--line); }
.tbl thead tr:first-child > *, .tbl table > tr:first-child > *, .tbl tbody:first-child tr:first-child > * { border-top: 1px solid var(--line); }
.tbl th { background: var(--th-bg); font-weight: 700; }
.tbl thead th { position: sticky; top: 0; z-index: 1; }
.tbl.narrow table { width: 100%; }
.tbl.wide table { min-width: 100%; }
/* 列の最小幅は markdown.js が中身の文字数から各セルに付ける（6字以下は .short、7〜12字は L em、13字以上は 13em） */
.tbl.wide th, .tbl.wide td { max-width: 18em; }
.tbl.wide .short { min-width: 0; white-space: nowrap; }
.tbl-frame { position: relative; }
.tbl-scroll { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
/* 見出し行の写し（画面の上端に貼り付く。本物の見出し行に重ねて置く） */
.tbl-head { position: sticky; top: calc(var(--top-h) + var(--safe-t)); z-index: 3; overflow: hidden; pointer-events: none;
  transition: top .22s ease; }
.tbl-head.off { display: none; }
.chrome-hidden .tbl-head { top: var(--safe-t); }
.tbl-head table { table-layout: fixed; }
.tbl-frame::before, .tbl-frame::after { content: ""; position: absolute; top: 0; bottom: 0; width: 22px; pointer-events: none;
  opacity: 0; transition: opacity .15s; z-index: 2; }
.tbl-frame::before { left: 0; background: linear-gradient(to right, var(--shade), transparent); }
.tbl-frame::after { right: 0; background: linear-gradient(to left, var(--shade), transparent); }
.tbl-frame.sl::before, .tbl-frame.sr::after { opacity: 1; }

.tbl-tools { display: flex; justify-content: flex-end; gap: 6px; margin: 0 0 4px; font-family: var(--font-sans); }
.tbl-btn { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; color: var(--ink); letter-spacing: 0; }
.tbl-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

/* カード表示（1行＝1枚） */
.tbl-cards { display: flex; flex-direction: column; gap: 10px; }
.tcard { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: .7em 1em; font-size: .95em; line-height: 1.65; }
.tcard-h { font-weight: 700; margin: 0 0 .4em; padding-bottom: .4em; border-bottom: 1px solid var(--line); }
.tcard-k { display: block; font-size: .78em; font-weight: 600; color: var(--sub); }
.tcard dl { margin: 0; display: grid; grid-template-columns: minmax(4.5em, 32%) 1fr; gap: .35em .9em; }
.tcard dt { color: var(--sub); font-size: .88em; padding-top: .1em; }
.tcard dd { margin: 0; overflow-wrap: anywhere; }
.tcard dd > :last-child { margin-bottom: 0; }

/* 拡大（全画面） */
.tbl-full { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; background: var(--bg); }
.tbl-full-head { flex: none; display: flex; align-items: center; gap: 10px; height: calc(52px + var(--safe-t));
  padding: var(--safe-t) 4px 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tbl-full-head b { font-size: 15px; }
.tbl-full-hint { flex: 1; font-size: 12px; color: var(--sub); }
.tbl-full-body { flex: 1; overflow: auto; padding: 8px 8px calc(16px + var(--safe-b)); font-size: var(--fs); line-height: 1.6; }
.tbl-full-body .tbl { margin: 0; }
.tbl-full-body .tbl table { font-size: .9em; }
