/* ルールブック（eBook）— ライツカップの Web パンフレットと同じ「横めくり」構造を、
   道場サイトの紙×墨×赤トーンで組む。外部ライブラリなし。 */
:root {
  --ink: #0b0b0c; --ink-2: #141416; --ink-3: #1e1e21;
  --paper: #f3efe6; --paper-2: #e7e1d3; --paper-3: #ddd6c4;
  --surface: #fffdf8;
  --red: #e1251b; --red-deep: #b3160e;
  --blue: #1f5fbf; --blue-deep: #164a97;
  --green: #1d9a4b; --yellow: #f2c518;
  --mute: #6d6a62; --line: rgba(11,11,12,.14);
  --font-sans: "Zen Kaku Gothic New", "Noto Sans JP", system-ui, sans-serif;
  --font-display: "Shippori Mincho B1", "Noto Serif JP", serif;
  --font-en: "Anton", var(--font-sans);
  --top: 48px; --bottom: 52px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; background: var(--ink); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-sans); font-size: 15.5px; line-height: 1.75; overflow: hidden; }
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ── 上下バー ───────────────────────────── */
.bar { position: fixed; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 0 10px; background: rgba(11,11,12,.92); color: var(--paper); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); border-color: rgba(255,255,255,.12); }
.bar--top { top: 0; height: var(--top); border-bottom: 1px solid; }
.bar--bottom { bottom: 0; height: var(--bottom); border-top: 1px solid; padding-bottom: env(safe-area-inset-bottom); }
.bar__title { font-family: var(--font-en); letter-spacing: .06em; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__title small { font-family: var(--font-sans); font-weight: 700; font-size: 11px; color: var(--paper-2); margin-left: 8px; letter-spacing: 0; }
.bar__sp { flex: 1; }
.bbtn { height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.28); font-size: 12.5px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--paper); }
.bbtn:hover { background: rgba(255,255,255,.1); }
.bbtn.is-on { background: var(--red); border-color: var(--red); color: #fff; }
.bbtn--icon { width: 34px; padding: 0; justify-content: center; font-size: 16px; }
.bbtn[disabled] { opacity: .35; cursor: default; }
.home { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; text-decoration: none; color: var(--paper-2); }
.home:hover { color: #fff; }

/* 読者フィルター（選手 / 審判 / はじめて） */
.aud { display: inline-flex; gap: 4px; }
.aud .bbtn { height: 30px; padding: 0 10px; font-size: 12px; }
@media (max-width: 640px) { .aud .bbtn span { display: none; } .aud .bbtn { width: 30px; padding: 0; justify-content: center; } }

/* 進捗（1ページ1セグメント） */
.prog { display: flex; gap: 2px; flex: 1; height: 8px; min-width: 60px; }
.prog button { flex: 1; height: 100%; border-radius: 2px; background: rgba(255,255,255,.18); padding: 0; }
.prog button.on { background: var(--red); }
.prog button.done { background: rgba(255,255,255,.45); }
.prog button.hid { display: none; }
.counter { font-family: var(--font-en); font-size: 13px; letter-spacing: .08em; min-width: 54px; text-align: center; color: var(--paper-2); }

/* ── 本体：横スクロールスナップ ───────────────────────── */
.book { position: fixed; inset: var(--top) 0 var(--bottom); display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--ink-2); }
.book::-webkit-scrollbar { display: none; }
.page { flex: 0 0 100%; width: 100%; min-width: 0; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior-y: contain; background: var(--paper); color: var(--ink); }
.page.hid { display: none; }
.page-in { max-width: 920px; min-width: 0; margin: 0 auto; padding: 28px 16px 56px; container-type: inline-size; min-height: 100%; }
@media (min-width: 900px) {
  /* ページ幅 1100px 上限。左右の余白を book の padding にして、snap center で常に中央に止まる */
  .book { padding: 16px max(16px, calc((100% - 1100px) / 2)); gap: 32px; }
  .page { border-radius: 8px; flex-basis: min(100% - 32px, 1100px); width: min(100% - 32px, 1100px); box-shadow: 0 10px 40px rgba(0,0,0,.45); }
  .page-in { padding: 44px 48px 72px; }
}
/* 縦読みモード */
.book--linear { display: block; overflow-y: auto; scroll-snap-type: none; padding: 0; }
.book--linear .page { height: auto; min-height: 0; overflow: visible; width: auto; margin: 0 auto 14px; max-width: 1100px; border-radius: 0; }
@media (min-width: 900px) { .book--linear .page { border-radius: 8px; margin: 16px auto; } }
/* 狭い画面の上バー: 副題・印刷ボタンを省く */
@media (max-width: 640px) { .bar__title small, #printBtn { display: none; } .bar--top { gap: 6px; padding: 0 8px; } }
.pager { position: fixed; top: 50%; transform: translateY(-50%); z-index: 15; width: 44px; height: 64px; border-radius: 10px;
  background: rgba(11,11,12,.6); color: var(--paper); font-size: 22px; display: none; align-items: center; justify-content: center; }
.pager:hover { background: var(--red); }
.pager--prev { left: 8px; } .pager--next { right: 8px; }
@media (min-width: 1200px) { .pager { display: flex; } .book--linear ~ .pager { display: none; } }

/* ── ページ共通部品 ───────────────────────── */
.pb-tag { font-family: var(--font-en); font-size: clamp(12px, 2cqw, 15px); letter-spacing: .22em; text-transform: uppercase; color: var(--red); }
.pb-h { font-family: var(--font-display); font-weight: 800; font-size: clamp(25px, 4.6cqw, 40px); line-height: 1.22; margin: 4px 0 10px; letter-spacing: .01em; text-wrap: balance; }
.pb-h .en { display: block; font-family: var(--font-en); font-size: .5em; letter-spacing: .1em; color: var(--mute); margin-top: 6px; font-weight: 400; }
.pb-head { border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 22px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; }
.pb-lead { font-size: 1.04em; margin: 0 0 20px; }
.who { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.who span { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--mute); }
.who span.w-player { border-color: var(--red); color: var(--red-deep); }
.who span.w-ref { border-color: var(--blue); color: var(--blue-deep); }
.who span.w-new { border-color: var(--green); color: var(--green); }
h3 { font-family: var(--font-display); font-size: 1.22em; margin: 26px 0 10px; line-height: 1.35; display: flex; align-items: center; gap: 8px; }
h3::before { content: ""; width: 6px; height: 1.1em; background: var(--red); border-radius: 2px; flex: none; }
h4 { font-size: 1em; margin: 16px 0 6px; }
p { margin: 0 0 10px; }
ul, ol { padding-left: 1.4em; margin: 0 0 12px; }
li { margin: 4px 0; }
b, strong { font-weight: 800; }
.mute { color: var(--mute); }
.small { font-size: .86em; }
.kw { font-family: var(--font-en); letter-spacing: .04em; }
.num { font-family: var(--font-en); font-size: 1.4em; line-height: 1; color: var(--red); letter-spacing: .02em; }

/* カード・グリッド */
.cards { display: grid; gap: 12px; margin: 12px 0 18px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-5 { grid-template-columns: repeat(5, 1fr) !important; }
@container (max-width: 640px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); } .cols-5 { grid-template-columns: repeat(3, 1fr) !important; } }
@container (max-width: 440px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } .cols-5 { grid-template-columns: repeat(2, 1fr) !important; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.card h4 { margin: 0 0 6px; font-size: 1.02em; }
.card .num { display: block; margin-bottom: 4px; }
.card--red { border-top: 4px solid var(--red); }
.card--blue { border-top: 4px solid var(--blue); }
.card--green { border-top: 4px solid var(--green); }
.card--ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.card--ink .mute { color: var(--paper-2); }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

/* 吹き出し・注意 */
.note { border-left: 4px solid var(--red); background: rgba(225,37,27,.07); padding: 10px 14px; border-radius: 0 10px 10px 0; margin: 12px 0 16px; }
.note--blue { border-color: var(--blue); background: rgba(31,95,191,.08); }
.note--green { border-color: var(--green); background: rgba(29,154,75,.09); }
.note--ink { border-color: var(--ink); background: var(--paper-2); }
.note .t { font-weight: 800; display: block; margin-bottom: 2px; }
.ok, .ng { font-weight: 800; }
.ok { color: var(--green); } .ng { color: var(--red); }
.q { font-family: var(--font-display); font-weight: 700; }
.q::before { content: "Q. "; color: var(--red); }
.a::before { content: "A. "; color: var(--blue); font-weight: 800; }

/* 表 */
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); font-size: .95em; margin: 10px 0 18px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--ink); color: var(--paper); font-weight: 700; font-size: .9em; }
tr:last-child td { border-bottom: 0; }
td.c, th.c { text-align: center; }
.old { color: var(--mute); text-decoration: line-through; text-decoration-color: rgba(225,37,27,.5); }
.new { color: var(--red-deep); font-weight: 800; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* フロー */
.flow { display: grid; gap: 8px; counter-reset: f; margin: 12px 0 18px; padding: 0; list-style: none; }
.flow li { position: relative; padding: 10px 14px 10px 52px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.flow li::before { counter-increment: f; content: counter(f); position: absolute; left: 12px; top: 10px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-family: var(--font-en); display: grid; place-items: center; font-size: 15px; }
.flow li b { display: block; }
.flow.h { grid-template-columns: repeat(4, 1fr); }
.flow.h li { padding: 40px 12px 12px; }
.flow.h li::before { left: 12px; top: 8px; }
@container (max-width: 640px) { .flow.h { grid-template-columns: 1fr 1fr; } }
@container (max-width: 400px) { .flow.h { grid-template-columns: 1fr; } }

/* 図版 */
.fig { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 12px 0 18px; }
.fig svg { width: 100%; height: auto; }
.fig figcaption { font-size: .86em; color: var(--mute); margin-top: 8px; }
.fig--ink { background: var(--ink); border-color: var(--ink); }
.fig--ink figcaption { color: var(--paper-2); }
.fig--row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: center; }
@container (max-width: 560px) { .fig--row { grid-template-columns: 1fr; } }
.svg-t { font-family: var(--font-sans); font-weight: 700; }
.svg-en { font-family: var(--font-en); letter-spacing: .06em; }

/* カード（審判カード） */
.cardpic { display: inline-grid; place-items: center; width: 42px; height: 58px; border-radius: 5px; color: #fff; font-family: var(--font-en); font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.25); vertical-align: middle; }
.cardpic--blue { background: var(--blue); } .cardpic--red { background: var(--red); } .cardpic--green { background: var(--green); } .cardpic--yellow { background: var(--yellow); color: var(--ink); }

/* 表紙・裏表紙 */
.page--cover { background: var(--ink); color: var(--paper); }
.page--cover .page-in { display: flex; flex-direction: column; justify-content: center; min-height: 100%; }
.cover__kicker { font-family: var(--font-en); letter-spacing: .3em; color: var(--red); font-size: clamp(13px, 2.4cqw, 18px); }
.cover__title { font-family: var(--font-display); font-weight: 800; font-size: clamp(34px, 8cqw, 76px); line-height: 1.1; margin: 10px 0 14px; letter-spacing: .01em; }
.cover__title .yr { font-family: var(--font-en); color: var(--red); letter-spacing: .04em; display: block; font-size: 1.15em; line-height: 1; }
.cover__sub { font-size: clamp(14px, 2.2cqw, 19px); color: var(--paper-2); max-width: 40em; }
.cover__who { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.cover__who span { border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; }
.cover__art { margin: 28px 0 8px; }
.cover__foot { margin-top: auto; padding-top: 24px; font-size: 12px; color: var(--paper-2); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* 目次 */
.toc-list { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 22px; }
@container (max-width: 560px) { .toc-list { columns: 1; } }
.toc-list li { break-inside: avoid; }
.toc-list a { display: flex; gap: 10px; align-items: baseline; padding: 8px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.toc-list a:hover { color: var(--red); }
.toc-list .n { font-family: var(--font-en); color: var(--red); min-width: 2em; }
.toc-list .ch { display: block; font-family: var(--font-en); letter-spacing: .2em; color: var(--mute); font-size: 12px; margin: 16px 0 2px; }

/* 目次ダイアログ */
dialog.toc { border: 0; border-radius: 16px; padding: 0; width: min(92vw, 560px); max-height: 80vh; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
dialog.toc::backdrop { background: rgba(0,0,0,.6); }
.toc__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.toc__body { padding: 8px 18px 18px; overflow: auto; max-height: calc(80vh - 56px); }
.toc__body ol { list-style: none; padding: 0; margin: 0; }
.toc__body button { width: 100%; text-align: left; display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.toc__body button:hover { color: var(--red); }
.toc__body button.on { color: var(--red); font-weight: 800; }
.toc__body .n { font-family: var(--font-en); min-width: 2em; color: var(--mute); }
.toc__body button.hid { display: none; }

/* 印刷：1ページ=A4 1枚 */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html, body { overflow: visible; background: #fff; }
  .bar, .pager { display: none !important; }
  .book { position: static; display: block; overflow: visible; background: #fff; padding: 0; }
  .page { display: block !important; height: auto; width: auto; margin: 0; border-radius: 0; box-shadow: none; page-break-after: always; break-after: page; overflow: visible; }
  .page-in { max-width: none; padding: 0; }
  .page--cover { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
