/*
Theme Name: MOSO Novel
Theme URI: https://mosonovel.jp
Author: moso-novel
Description: 妄想ノベルのためのオリジナル読書テーマ。トップは表紙サムネイルのグリッド、個別ページは「小説を読ませる」ことだけを目的にした一段組・縦書き風の落ち着いた文字組。スマホ最優先。文字サイズ・背景（白/セピア/黒）の切り替えと「前回の続きから読む」を備える。SWELL からの置き換え用に、旧記事のクラス（chapter-title / chapter-content / chapter-scene-image / moso-pagenav）もこの CSS が面倒を見る。
Version: 1.19.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: moso-novel
*/

/* ==========================================================================
   0. デザイントークン
   --------------------------------------------------------------------------
   色・書体・幅はすべてここの CSS 変数で決める。
   デザイン AI（追加 CSS の管理ブロック）が上書きするのもこの変数を想定。
   ========================================================================== */

html {
  /* セピア（既定・v1.7.2〜）。紙の色味を基調にする */
  --bg: #efe3cb;
  --surface: #f7eeda;
  --text: #3c3122;
  --muted: #8a7a5e;
  --line: #dccba6;
  --accent: #a34a5e;        /* 落ち着いた紅。リンク・強調 */
  --accent-weak: #ecdcc0;
  --shadow: 0 1px 3px rgba(60, 50, 30, .08), 0 4px 14px rgba(60, 50, 30, .06);

  --font-ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI",
             "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", YuMincho,
                "Noto Serif JP", "HGS明朝E", serif;

  --content-width: 42rem;    /* 本文の最大幅（読みやすさ優先） */
  --wide-width: 72rem;       /* 一覧グリッドの最大幅 */

  /* 表紙サムネイルの縦横比。
     アプリが生成する表紙・章画像は 16:9（横長）なので、それに合わせる。
     縦長（3/4 等）にすると横長画像の中央だけを拡大表示することになり、
     画素が足りず粗く見える。 */
  --card-aspect: 16 / 9;

  /* 本文の文字サイズ（data-moso-font で切り替え） */
  --reader-font-size: 17px;
  --reader-line-height: 2.05;
}

/* 白（明るい紙。読書設定で選んだ場合） */
html[data-moso-theme="light"] {
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --text: #2b2722;
  --muted: #877e6f;
  --line: #e4dccb;
  --accent: #a34a5e;
  --accent-weak: #f0e2e1;
}

/* セピア（既定と同じ。明示的に選んだ場合もここに落ちる） */
html[data-moso-theme="sepia"] {
  --bg: #efe3cb;
  --surface: #f7eeda;
  --text: #3c3122;
  --muted: #8a7a5e;
  --line: #dccba6;
  --accent: #a34a5e;
  --accent-weak: #ecdcc0;
}

/* ダーク（夜間の読書） */
html[data-moso-theme="dark"] {
  --bg: #16141a;
  --surface: #201d25;
  --text: #d8d3ca;
  --muted: #8e8a95;
  --line: #322e3a;
  --accent: #cd7c8e;
  --accent-weak: #3a2c33;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .35);
}

/* OS がダークモードで、読者がまだ選んでいない場合はダークに合わせる */
@media (prefers-color-scheme: dark) {
  html:not([data-moso-theme]) {
    --bg: #16141a;
    --surface: #201d25;
    --text: #d8d3ca;
    --muted: #8e8a95;
    --line: #322e3a;
    --accent: #cd7c8e;
    --accent-weak: #3a2c33;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 14px rgba(0, 0, 0, .35);
  }
}

/* 文字サイズ（本文のみ変わる。UI は据え置き） */
html[data-moso-font="s"]  { --reader-font-size: 15px; }
html[data-moso-font="m"]  { --reader-font-size: 17px; }
html[data-moso-font="l"]  { --reader-font-size: 19px; --reader-line-height: 2.1; }
html[data-moso-font="xl"] { --reader-font-size: 21px; --reader-line-height: 2.15; }

/* ==========================================================================
   1. ベース
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  transition: background-color .25s ease, color .25s ease;
}

img { max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  word-wrap: normal !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus { left: 8px; }

/* ==========================================================================
   2. ヘッダー / フッター
   ========================================================================== */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.site-header__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 14px 16px 10px;
  text-align: center;
}

.site-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: .12em;
  line-height: 1.3;
}
.site-title a { color: var(--text); }
.site-title a:hover { text-decoration: none; opacity: .8; }

.site-description {
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted);
}

.site-nav { margin-top: 8px; }
.site-nav ul {
  margin: 0; padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 16px;
  font-size: 13px;
}
.site-nav a { color: var(--muted); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }

.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--line);
  padding: 24px 16px 40px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.site-footer nav ul {
  margin: 0 0 10px; padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* ==========================================================================
   3. トップ / 一覧 — 表紙サムネイルのグリッド
   --------------------------------------------------------------------------
   トップは「画像が華やか」でクリック率が良い、という現状の強みを引き継ぐ。
   ========================================================================== */

.site-main { display: block; }

.archive-wrap {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 20px 14px 0;
}

.archive-title {
  margin: 6px 0 4px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .06em;
}
.archive-description {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

/* カテゴリーの探し口（ページを増やさず回遊させる） */
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
  justify-content: center;
}
.category-chips a {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}
.category-chips a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.novel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
/* 16:9 カードは縦が低いぶん、列を増やすのは広い画面だけにする */
@media (min-width: 640px)  { .novel-grid { grid-template-columns: repeat(3, 1fr); gap: 22px 16px; } }
@media (min-width: 1080px) { .novel-grid { grid-template-columns: repeat(4, 1fr); } }

/* モザイク配置（トップ）: 大タイルの後の隙間を詰める */
.novel-grid--mosaic { grid-auto-flow: dense; }

/* --- フォトタイル型カード（v1.4.0） ------------------------------------ */
/* 画像全面 + 下部グラデーションにタイトルを重ねる。
   全タイルが 16:9 で揃うため、2×2 の大タイル（--big）が綺麗にはまる。 */

.novel-card {
  margin: 0;
  position: relative;
  aspect-ratio: var(--card-aspect);
  border-radius: 10px;
  overflow: hidden;
  background: var(--accent-weak);
  box-shadow: var(--shadow);
}

.novel-card > a {
  position: absolute;
  inset: 0;
  display: block;
  color: #fff;
}
.novel-card > a:hover { text-decoration: none; }

.novel-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.novel-card > a:hover img { transform: scale(1.05); }

.novel-card__overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 30px 10px 8px;
  background: linear-gradient(transparent, rgba(8, 5, 10, .8));
}

.novel-card__cat {
  display: block;
  font-size: 10px;
  letter-spacing: .06em;
  opacity: .85;
}

.novel-card__title {
  margin: 2px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .55);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 発掘 / PICK UP バッジ（色は v1.18.2）

   バッジは 3 つとも**サムネ写真の上**に載る。ページの背景とは無関係なので、
   テーマで色を変える必然性が無い。にもかかわらずここだけ var(--accent) を
   使っていたため、暗テーマで紅 #a34a5e → 桃色 #cd7c8e に変わり、
   白文字とのコントラストが 5.68:1 → **3.06:1** に落ちていた（AA は 4.5）。

   明テーマでの見た目は変えず、値を固定した。これで 3 つのバッジが
   同じ書き方・同じ重さ（白文字とのコントラスト 5.3〜5.7）でそろう:
     発掘/PICK UP #a34a5e（紅 347°）/ 短編 #0e7490（青緑 193°）/ 新着 #1a7a4c（深緑 151°） */
.novel-card__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: #a34a5e;
  color: #fff;
  font-size: 10px;
  letter-spacing: .12em;
  padding: 3px 9px;
  border-radius: 999px;
}

/* コード枠（v1.13.0）— 相互リンクページの「リンク用HTML」など、
   相手に**コピーしてもらう**箇所。枠と背景で「ここを選択する」と分かるようにし、
   長い 1 行の HTML でもページ全体が横に伸びないよう枠の中でスクロールさせる */
.wp-block-code {
  background: rgba(0, 0, 0, .04);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 16px 0;
  overflow-x: auto;
}
.wp-block-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}

/* 新着マーク（v1.18.0 / 色は v1.18.1）— 公開から一定時間内、かつ直近 N 件まで。
   左上（発掘 / PICK UP と同じ枠・排他）。

   v1.18.0 では発掘と同じ紅にして「違うのは文字だけ」としたが、実機で
   **見間違える**という指摘。大タイルと小タイルの差では見分けがつかなかった。
   意味が逆（新着＝新しい / 発掘＝古い作品の掘り起こし）なので色を分ける。

   深緑にした理由は色相の距離。紅 #a34a5e は 347°、短編の青緑 #0e7490 は
   193°。深緑 151° は紅から 164°（いちばん遠い）、短編からも 42° 離れる。
   金茶・橙は紅との差が 39〜51° しかなく同じ間違いを繰り返し、藍・青は
   短編との差が 19〜37° で今度は短編と紛らわしくなる。
   白文字とのコントラストは 5.34:1（短編の 5.36:1 とほぼ同じ・AA 適合）。 */
.novel-card__badge--new { background: #1a7a4c; }

/* 短編マーク（v1.10.0）— 1 時間以内で読み切れる作品。発掘バッジ（左上）と共存する右上枠 */
.novel-card__badge--short {
  left: auto;
  right: 8px;
  background: #0e7490;   /* アクセント（紅）と混ざらない青緑。半券のイメージ */
}

/* 大タイル（2×2）— 「発掘」枠が入る */
.novel-card--big { grid-column: span 2; grid-row: span 2; }
.novel-card--big .novel-card__overlay { padding: 44px 14px 12px; }
.novel-card--big .novel-card__cat { font-size: 11px; }
.novel-card--big .novel-card__title {
  font-size: 16px;
  -webkit-line-clamp: 3;
}
@media (min-width: 640px) {
  .novel-card--big .novel-card__title { font-size: 19px; }
}

/* 表紙が無い記事の代替（タイトル文字を表紙に見立てる） */
.novel-card--noimg {
  background: linear-gradient(135deg, #45323c, #6b3a48);
}
.novel-card--noimg .novel-card__overlay { background: none; }
.novel-card--noimg .novel-card__title { -webkit-line-clamp: 3; }

/* ページ送り（一覧） */
.pagination { margin: 34px 0 0; text-align: center; }
.pagination .nav-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.pagination .page-numbers {
  display: inline-block;
  min-width: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}
.pagination .page-numbers.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pagination a.page-numbers:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ==========================================================================
   4. 個別ページ — 小説を読ませる
   --------------------------------------------------------------------------
   一段組・画像は控えめ・明朝・ゆったりした行間。スマホで最適になるよう
   モバイルの値を基準にし、大画面では幅を絞るだけ。
   ========================================================================== */

.novel-wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 18px 18px 0;
}

.breadcrumb {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 18px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 6px; opacity: .6; }

.novel-header { text-align: center; margin: 0 0 20px; }

.novel-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .04em;
}

.novel-meta {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
}
.novel-meta a { color: var(--muted); }
/* 新着マーク（v1.18.0 / 色は v1.18.1）— 記事ヘッダーのメタ行。短編マークと並ぶ */
.novel-meta__new {
  display: inline-block;
  background: #1a7a4c;   /* カードのバッジと同じ深緑。理由は上の節 */
  color: #fff;
  font-size: 11px;
  letter-spacing: .12em;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 999px;
}

/* 短編マーク（v1.10.0）— 記事ヘッダーのメタ行 */
.novel-meta__short {
  display: inline-block;
  background: #0e7490;
  color: #fff;
  font-size: 11px;
  letter-spacing: .12em;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 999px;
}
.novel-meta a:hover { color: var(--accent); }

/* --- 読書設定（文字サイズ・背景） ------------------------------------- */

.reader-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 18px;
  margin: 18px 0 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
}
.reader-controls__group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.reader-controls button {
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.4;
}
.reader-controls button:hover { border-color: var(--accent); color: var(--accent); }
.reader-controls button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* --- リード（書影 + あらすじ） ----------------------------------------- */
/* 表紙は冒頭に全面で出さず、あらすじボックスの中の「書影」として見せる。 */

.novel-lead {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 22px 0 6px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
}
@media (min-width: 560px) {
  .novel-lead { flex-direction: row; align-items: flex-start; gap: 18px; }
}

.novel-lead__cover {
  flex: 0 0 auto;
  max-width: 280px;
  margin: 0 auto;
}
@media (min-width: 560px) {
  .novel-lead__cover { width: 220px; margin: 2px 0 0; }
}
.novel-lead__cover img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.novel-lead__synopsis { flex: 1; min-width: 0; }
.novel-lead__synopsis h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--accent);
}
.novel-lead__synopsis p {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.95;
}

/* --- 本文 --------------------------------------------------------------- */

.novel-body {
  font-family: var(--font-serif);
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  letter-spacing: .03em;
  margin-top: 26px;
}

.novel-body p {
  margin: 0 0 1.6em;
  text-align: justify;
}

/* 章見出し — 新旧どちらの記事にも効く。
   旧記事はインラインで #667eea が付いているため !important で消す。 */
.novel-body h2.chapter-title,
.novel-body h3.chapter-title-continued {
  color: var(--text) !important;
  font-family: var(--font-serif);
  font-weight: 600;
  text-align: center;
  letter-spacing: .1em;
  margin: 3.2em 0 2em;
  font-size: 1.12em;
}
.novel-body h2.chapter-title:first-child { margin-top: 1em; }
.novel-body h2.chapter-title::after,
.novel-body h3.chapter-title-continued::after {
  content: "";
  display: block;
  width: 3em;
  height: 1px;
  margin: .9em auto 0;
  background: var(--accent);
  opacity: .55;
}

/* 章のシーン画像 — 「画像が全面に来る」ことをやめ、挿絵として控えめに。 */
.novel-body figure.chapter-scene-image {
  margin: 2.4em auto;
  max-width: min(420px, 82%);
}
.novel-body figure.chapter-scene-image img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

/* 旧記事のスペーサーは行間に馴染む高さへ */
.novel-body .wp-block-spacer { height: 1.4em !important; }

/* 旧記事のページ分割リンク（moso-page-nav / wp_link_pages） */
.page-links,
.moso-pagenav {
  font-family: var(--font-ui);
  font-size: 13px;
  margin: 28px 0;
}
.page-links a, .page-links > span,
.moso-pagenav a, .moso-pagenav__numbers > span {
  display: inline-block;
  min-width: 34px;
  padding: 7px 10px;
  margin: 2px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}
.page-links > span.post-page-numbers.current,
.moso-pagenav__numbers .post-page-numbers.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.page-links a:hover, .moso-pagenav a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* --- 登場人物（折りたたみ） -------------------------------------------- */

.novel-characters {
  margin: 34px 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.novel-characters summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--accent);
  list-style: none;
}
.novel-characters summary::-webkit-details-marker { display: none; }
.novel-characters summary::before { content: "▸ "; }
.novel-characters[open] summary::before { content: "▾ "; }

.novel-characters ul {
  margin: 0;
  padding: 4px 16px 14px;
  list-style: none;
}
.novel-characters li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.character__avatar,
.character__avatar-fallback {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}
.character__avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-weak);
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 18px;
}
.character__body { flex: 1; min-width: 0; }
.character__name { font-size: 14px; font-weight: 600; }
.character__name .furigana { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.character__attrs { font-size: 11px; color: var(--muted); margin-top: 1px; }
.character__desc { font-size: 12.5px; line-height: 1.8; margin: 4px 0 0; color: var(--text); }

/* --- タグ・前後の作品 --------------------------------------------------- */

.novel-tags { margin: 22px 0 0; font-size: 12px; }
.novel-tags a {
  display: inline-block;
  padding: 3px 10px;
  margin: 0 6px 6px 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
}
.novel-tags a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* 関連作品（v1.7.0） */
.related { margin: 36px 0 0; }
.related__heading {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .08em;
}
.related-grid {
  grid-template-columns: repeat(3, 1fr) !important;   /* 本文幅に収める */
  gap: 12px 10px;
  margin-top: 0;
}
@media (max-width: 559px) {
  .related-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* --------------------------------------------------------------------------
   世界線のつながり（v1.15.0）
   ------------------------------------------------------------------------ */

/* 本文の前に置く「前回」バー。
   細く保つのが要点——ここは「これは続きだ」と伝える標識であって、
   クリックさせるための枠ではない。あらすじも入れない */
.series-prev {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.series-prev:hover { text-decoration: none; border-color: var(--accent); }
.series-prev__arrow { flex: none; color: var(--accent); font-size: 11px; }
.series-prev__body { min-width: 0; }
.series-prev__label {
  display: block;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--muted);
}
.series-prev__title {
  display: block;
  font-family: var(--font-serif);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 本文の後のカード。読了直後なので、ここだけあらすじまで見せる */
.series-related { margin: 36px 0 0; }
.series-cards {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.series-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.series-card__link {
  display: flex;
  gap: 12px;
  align-items: stretch;
  color: var(--text);
}
.series-card__link:hover { text-decoration: none; }
.series-card__link:hover .series-card__title { color: var(--accent); }
.series-card__thumb {
  flex: 0 0 34%;
  max-width: 190px;
  display: block;
  aspect-ratio: var(--card-aspect);   /* 枠の比率はここで決める */
}
.series-card__thumb img {
  display: block;
  width: 100%;
  height: 100%;      /* 枠いっぱいに敷く。比率は枠側が持っている */
  object-fit: cover;
}
.series-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px 10px 0;
}
.series-card--nothumb .series-card__body { padding-left: 12px; }
.series-card__label {
  font-size: 10px;
  letter-spacing: .12em;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  align-self: flex-start;
  line-height: 1.5;
}
.series-card__title {
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
}
.series-card__excerpt {
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}
@media (max-width: 559px) {
  .series-card__thumb { flex-basis: 38%; }
  .series-card__excerpt { display: none; }   /* 幅が無いとタイトルが潰れる */
}

.post-navigation { margin: 30px 0 0; border-top: 1px solid var(--line); padding-top: 18px; }
.post-navigation .nav-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.post-navigation .nav-previous,
.post-navigation .nav-next { max-width: 48%; }
.post-navigation .nav-next { margin-left: auto; text-align: right; }
.post-navigation a { color: var(--muted); }
.post-navigation a:hover { color: var(--accent); text-decoration: none; }

/* --- 読書の進み具合（JS が生成） --------------------------------------- */

.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 90;
  transition: width .1s linear;
}

.resume-chip {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 6px 6px 6px 14px;
  font-size: 12.5px;
  z-index: 95;
  max-width: calc(100vw - 24px);
}
.resume-chip__go {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.resume-chip__close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  padding: 4px 8px;
  cursor: pointer;
}

/* --- v1.16.0: 読みかけ・しおり・章の残り分数 ---------------------------- */

/* 読書バーの「▶ 第N章」（読みかけがあるときだけ JS が出す） */
.reader-bar__resume {
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.reader-bar__resume:hover { opacity: .9; }

/* 章見出しの「約N分」 */
.chapter-minutes {
  display: inline-block;
  margin-left: .6em;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  vertical-align: middle;
}

/* 作品メニューの「しおり」 */
.reader-side__bookmark .reader-side__heading { cursor: default; }
.bookmark-btn {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.bookmark-btn:hover { border-color: var(--accent); color: var(--accent); }
.bookmark-btn--resume { background: var(--accent); border-color: var(--accent); color: #fff; }
.bookmark-btn--resume:hover { color: #fff; opacity: .9; }
.bookmark-note { margin: 6px 0 0; font-size: 11px; line-height: 1.6; color: var(--muted); }

/* トップの「続きから読む」（中身は home-resume.js が描く） */
.home-resume {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.home-resume__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.home-resume__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.home-resume__more {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}
.home-resume__more:hover { color: var(--accent); border-color: var(--accent); }
.home-resume__cards {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  grid-auto-rows: minmax(0, auto);
  gap: 10px;
}
.home-resume__card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}
.home-resume__card--big { grid-row: span 2; }
.home-resume__link {
  display: flex;
  gap: 12px;
  padding: 10px 34px 10px 10px;
  color: inherit;
  text-decoration: none;
  height: 100%;
  box-sizing: border-box;
}
.home-resume__link:hover { text-decoration: none; }
.home-resume__thumb {
  /* v1.16.1: flex の既定 align-items: stretch でサムネの高さがタイトルの行数に
     引きずられ、カードごとに画角が変わっていた。高さを固定し、上寄せにする */
  flex: 0 0 56px;
  align-self: flex-start;
  width: 56px;
  height: 84px;               /* 2:3 */
  object-fit: cover;
  object-position: center top;
  border-radius: 6px;
  background: var(--line);
}
.home-resume__card--big .home-resume__thumb { flex-basis: 96px; width: 96px; height: 144px; }
.home-resume__thumb--none { display: block; }
.home-resume__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.home-resume__name {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.home-resume__card--big .home-resume__name { font-size: 16px; -webkit-line-clamp: 3; }
.home-resume__meta { font-size: 12px; color: var(--muted); }
.home-resume__pin { font-size: 12px; }
.home-resume__cta { margin-top: auto; font-size: 12.5px; color: var(--accent); font-weight: 600; }
.home-resume__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 6px;
  cursor: pointer;
}
.home-resume__remove:hover { color: var(--accent); }
.home-resume__empty { margin: 0; font-size: 13px; color: var(--muted); }
.home-resume__list { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.home-resume__rows { list-style: none; margin: 0; padding: 0; }
.home-resume__row {
  position: relative;
  border-top: 1px solid var(--line);
}
.home-resume__row:first-child { border-top: 0; }
.home-resume__row a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 34px 8px 2px;
  color: inherit;
  text-decoration: none;
}
.home-resume__row a:hover .home-resume__row-title { color: var(--accent); }
.home-resume__row-title { font-size: 13px; line-height: 1.4; }
.home-resume__row-meta { font-size: 11.5px; color: var(--muted); }
.home-resume__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.home-resume__clear {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}
.home-resume__clear:hover { color: var(--accent); border-color: var(--accent); }
.home-resume__nohist { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.home-resume__note { flex-basis: 100%; font-size: 11px; line-height: 1.6; }
@media (max-width: 640px) {
  .home-resume__cards { grid-template-columns: 1fr; }
  .home-resume__card--big { grid-row: auto; }
  .home-resume__card--big .home-resume__thumb { flex-basis: 64px; width: 64px; height: 96px; }
}

/* --- v1.17.0: 手動の栞 -------------------------------------------------- */

/* 読書バーの 🔖。挟んでいる間は色が付く */
.reader-bar__pin {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
  filter: grayscale(1);
  opacity: .65;
}
.reader-bar__pin:hover { opacity: 1; }
.reader-bar__pin.is-pinned {
  filter: none;
  opacity: 1;
  border-color: var(--accent);
  background: var(--accent-weak);
}

/* 作品メニューの栞ボタン */
.bookmark-btn--pin.is-pinned {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
}

/* 章の末尾の「ここまで読んだ」。読み進める邪魔にならないよう控えめに */
.chapter-end {
  display: flex;
  justify-content: center;
  margin: 1.5em 0 .5em;
}
.chapter-end__pin {
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 7px 16px;
  cursor: pointer;
}
.chapter-end__pin:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }

/* 栞を挟んだときなどの短い通知 */
.moso-toast {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%) translateY(8px);
  max-width: calc(100vw - 32px);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 96;
}
.moso-toast.is-open { opacity: .95; transform: translateX(-50%) translateY(0); }

/* 「栞をここへ進める」のチップ（続きから読むのチップより少し上に出す） */
.resume-chip--advance { bottom: 62px; }

/* --- 画像のクリック拡大（ライトボックス） ------------------------------ */
/* 書影・挿絵・登場人物アイコンをタップで原寸表示。JS が生成する。 */

.novel-lead__cover img,
.novel-body figure.chapter-scene-image img,
.novel-characters .character__avatar { cursor: zoom-in; }

.moso-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 8, 12, .92);
  cursor: zoom-out;
}
.moso-lightbox.is-open { display: flex; }

.moso-lightbox__img {
  max-width: 96vw;
  max-height: 94vh;
  width: auto;
  height: auto;
  object-fit: contain;      /* 切り抜かず全体を表示する */
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .6);
}

.moso-lightbox__close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  padding: 10px 13px;
  border-radius: 999px;
  cursor: pointer;
}
.moso-lightbox__close:hover { background: rgba(255, 255, 255, .25); }

/* 拡大表示中は背面のスクロールを止める */
body.moso-lightbox-open { overflow: hidden; }

/* --- フッターのクレジット表記（v1.9.1・利用規約 第7条の履行） ------------ */

.site-footer__credit {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}

/* --- トップの紹介文（v1.9.0・ブランド検索用のテキスト） ------------------ */

.home-intro {
  max-width: var(--content-width);
  margin: 0 auto 22px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.95;
  color: var(--text);
}
.home-intro p { margin: 0 0 .8em; }
.home-intro p:last-child { margin-bottom: 0; }
.home-intro__heading {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px;
}
.home-intro a { text-decoration: underline; }

@media (max-width: 640px) {
  .home-intro { padding: 14px; font-size: 13.5px; }
}

/* ==========================================================================
   4.5 広告枠
   --------------------------------------------------------------------------
   枠が空（ウィジェット未設定）のときは PHP 側で何も出力されない。
   ========================================================================== */

.ad-slot { margin: 26px 0; text-align: center; }
.ad-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: 6px;
}
.ad-widget { overflow: hidden; }

/* クリエイティブは枠の幅に収める。FANZA の 728×90 や 468×60 を
   スマホで貼っても「切れる」のではなく「縮む」ようにする。 */
.ad-widget img,
.ad-widget video { max-width: 100%; height: auto; }
.ad-widget iframe,
.ad-widget ins,
.ad-widget object,
.ad-widget embed { max-width: 100%; }

/* 広告が入らなかった枠（在庫切れ・審査待ち・広告ブロッカー）。
   「スポンサーリンク」の札だけが浮くのを防ぐ。判定は functions.php の
   moso-ad-guard スクリプト（表示から 15 秒後に 1 回だけ）。
   広告そのものは残す（後から入れば見える）が、一覧の広告カードだけは
   点線の空カードが残るので枠ごと畳む。 */
.ad-slot.is-unfilled { margin: 0; }
.ad-slot.is-unfilled > .ad-label { display: none; }
.novel-card--ad.is-unfilled { display: none; }

/* 本文内（章の切れ目・スクロールで出現）— 本文の行間に馴染む余白 */
.ad-slot--in-article,
.ad-slot--scroll { margin: 2.6em 0; }

/* 章のスクロール表示（v1.5.0） */
.novel-more { height: 1px; }          /* 次章を呼び出す見えない目印 */

.novel-chunk.is-revealed {
  animation: moso-fadeup .45s ease;
}
@keyframes moso-fadeup {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .novel-chunk.is-revealed { animation: none; }
}

/* 一覧グリッドのカード型
   広告はタイルの縦横比に縛らない（広告の切り抜き表示を避ける） */
.novel-card--ad .ad-slot--card { margin: 0; }
.novel-card--ad {
  aspect-ratio: auto;
  overflow: visible;
  background: var(--surface);
  box-shadow: none;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ==========================================================================
   4.7 読書バーと作品メニュー / トップの右枠（v1.6.0）
   ========================================================================== */

/* --- 常時表示の読書バー（記事ページ） ---------------------------------- */

.reader-bar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.reader-bar__home {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.reader-bar__home:hover { color: var(--accent); text-decoration: none; }

.reader-bar__title {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  padding: 4px 0;
}

.reader-bar__menu {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.reader-bar__menu:hover { color: var(--accent); border-color: var(--accent); }

/* --- レイアウト（PC は本文 + 右カラム） -------------------------------- */

.reader-layout { display: block; }

@media (min-width: 1080px) {
  .reader-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: 0 14px;
  }

  /* v1.6.2: PC でも ☰ で右枠ごと畳める（小説スペースだけにする）。
     状態は html[data-moso-side="collapsed"] に持ち、head の
     インラインスクリプトが localStorage から復元する */
  html[data-moso-side="collapsed"] .reader-layout { display: block; }
  html[data-moso-side="collapsed"] .reader-side { display: none; }
}

/* --- 作品メニュー ------------------------------------------------------- */

/* スマホ: 右からの引き出し */
.reader-side {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  z-index: 120;
  background: var(--surface);
  border-left: 1px solid var(--line);
  transform: translateX(105%);
  transition: transform .25s ease;
  overflow-y: auto;
}
.reader-side.is-open { transform: none; box-shadow: -8px 0 30px rgba(0, 0, 0, .25); }

.reader-side__inner { padding: 14px 16px 24px; }

.reader-side__close {
  display: block;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  padding: 6px 8px;
  cursor: pointer;
}

/* PC: 引き出しではなく右カラムとして常時表示 */
@media (min-width: 1080px) {
  .reader-side {
    position: static;
    width: auto;
    transform: none;
    background: transparent;
    border-left: 0;
    overflow: visible;
    z-index: auto;
  }
  .reader-side__inner {
    position: sticky;
    top: 52px;               /* 読書バーの下に貼り付く */
    padding: 18px 0 0;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  .reader-side__close { display: none; }
}

.reader-side__section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.reader-side__heading {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--accent);
}

/* 折りたたみ（details）の見出し。▸/▾ で開閉が分かるようにする */
details.reader-side__section > summary.reader-side__heading {
  cursor: pointer;
  list-style: none;
  margin: 0;
  user-select: none;
}
details.reader-side__section > summary.reader-side__heading::-webkit-details-marker { display: none; }
details.reader-side__section > summary.reader-side__heading::before { content: "▸ "; }
details.reader-side__section[open] > summary.reader-side__heading::before { content: "▾ "; }
details.reader-side__section[open] > summary.reader-side__heading { margin-bottom: 8px; }

.chapter-list {
  margin: 0;
  padding: 0 0 0 2px;
  list-style: none;
  font-size: 13px;
}
.chapter-list li { border-top: 1px solid var(--line); }
.chapter-list li:first-child { border-top: 0; }
.chapter-list a {
  display: block;
  padding: 8px 2px;
  color: var(--text);
}
.chapter-list a:hover { color: var(--accent); text-decoration: none; }
.chapter-list__heat { margin-left: 6px; font-size: 11px; opacity: .85; }

/* 山場フロー（v1.11.0）— 段階が動く章だけの縦タイムライン。押すとその章へ飛ぶ */
.heat-flow {
  margin: 0;
  padding: 0 0 0 2px;
  list-style: none;
  font-size: 13px;
}
.heat-flow__item { border-top: 1px solid var(--line); }
.heat-flow__item:first-child { border-top: 0; }
.heat-flow__jump {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px 2px;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}
.heat-flow__jump:hover { color: var(--accent); }
.heat-flow__jump:disabled { opacity: .4; cursor: default; }
.heat-flow__emoji { flex: none; }
.heat-flow__label { flex: 1; min-width: 0; }
.heat-flow__chapter { flex: none; font-size: 11px; color: var(--muted); }
.heat-flow__peak {
  flex: none;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  letter-spacing: .1em;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
}
.heat-flow__item--peak .heat-flow__label { font-weight: 700; }

/* この世界線の作品（v1.15.0）— 目次と同じ見え方に揃える */
.series-list {
  margin: 0;
  padding: 0 0 0 2px;
  list-style: none;
  font-size: 13px;
}
.series-list__item { border-top: 1px solid var(--line); }
.series-list__item:first-child { border-top: 0; }
.series-list__link {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 8px 2px;
  color: var(--text);
}
a.series-list__link:hover { color: var(--accent); text-decoration: none; }
.series-list__no { flex: none; font-size: 11px; color: var(--muted); }
.series-list__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.series-list__item--current .series-list__title { font-weight: 700; }
.series-list__here {
  flex: none;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  letter-spacing: .1em;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
}
.series-list__all {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--accent);
}

.side-characters {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}
.side-characters li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
.side-characters__avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}
.side-characters__avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-weak);
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 14px;
}
.side-characters__name { font-weight: 600; }
.side-characters__attrs { color: var(--muted); font-size: 11px; }

.reader-side__top {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  padding: 10px;
  cursor: pointer;
}
.reader-side__top:hover { color: var(--accent); border-color: var(--accent); }

.reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(10, 8, 12, .45);
}

.ad-slot--side { margin: 0 0 14px; }

/* --- トップの右枠（ランキング） ---------------------------------------- */

@media (min-width: 1080px) {
  .home-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
  }
  /* 右枠のぶん、グリッドは 3 列に抑える */
  .home-main .novel-grid { grid-template-columns: repeat(3, 1fr); }
  .home-side { position: sticky; top: 16px; }
}

.home-side { margin-top: 18px; }

.ranking {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px 14px 6px;
  margin-bottom: 14px;
}
.ranking__heading {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .08em;
}
.ranking__list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.ranking__list li { border-top: 1px solid var(--line); }
.ranking__list li:first-child { border-top: 0; }
.ranking__list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  color: var(--text);
}
.ranking__list a:hover { text-decoration: none; }
.ranking__list a:hover .ranking__title { color: var(--accent); }

.ranking__num {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent-weak);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.ranking__num--1 { background: #b8973a; color: #fff; }   /* 金 */
.ranking__num--2 { background: #9aa2ad; color: #fff; }   /* 銀 */
.ranking__num--3 { background: #a9704a; color: #fff; }   /* 銅 */

.ranking__thumb {
  flex: 0 0 auto;
  width: 58px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
}
.ranking__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ranking__body { flex: 1; min-width: 0; }
.ranking__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}
.ranking__cat {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

/* ==========================================================================
   4.8 年齢確認（Age Gate プラグイン）の見た目調整（v1.7.1）
   --------------------------------------------------------------------------
   既定の「白い全画面」を、半透明 + 強いぼかしのモーダル風に変える。
   背後のページはぼかしで判別不能にする（年齢確認の目的を損なわないため、
   ぼかしは強め・暗幕も重ねる）。backdrop-filter 非対応の古い環境では
   ほぼ不透明な暗幕にフォールバックする。
   Age Gate v3 の BEM クラス（.age-gate__headline / __form / __submit 等）を
   対象にし、構造が違っても「半透明の暗幕」までは必ず効くようにしてある。
   ========================================================================== */

/* 外側の全画面ラッパー（クラス名の揺れに備えて age-gate 前方一致で拾う。
   __ 付きの内部要素は除外）も含めて、白背景を消して半透明にする */
[class^="age-gate"]:not([class*="__"]),
[class*=" age-gate"]:not([class*="__"]) {
  background: rgba(24, 18, 14, .35) !important;
}

/* Age Gate の背景レイヤー群を透明化する（v1.7.8 完成）。
   elementsFromPoint の実測で、.age-gate の中に
   __background と __background-color の 2 枚の塗りレイヤーがあると判明。
   前方一致でまとめて透明にし、暗幕とぼかしは .age-gate__wrapper に一本化する */
.age-gate__background,
.age-gate__background-color,
.age-gate [class^="age-gate__background"] {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* 全画面の覆いの実体（v1.7.6-7・DevTools 実測）: body 直下の .age-gate__wrapper。
   Age Gate はこれを body の先頭に「通常フロー」で挿入し、本文を 100vh の外へ
   押し出したうえで body の overflow:hidden で隠す構造。そのままでは半透明に
   しても body の背景色しか透けない。position:fixed でフローから外し、
   本文を押し出さず「その場で上に重なる」覆いに変える（v1.7.7）。 */
body > .age-gate__wrapper {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 999990;
  background: rgba(24, 18, 14, .93) !important;
  background-image: none !important;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body > .age-gate__wrapper {
    background: rgba(24, 18, 14, .35) !important;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }
}

/* ==========================================================================
   チラ見え防止カーテン（v1.7.5）
   --------------------------------------------------------------------------
   Age Gate は JS でゲートを被せるため、被せ終わるまでの一瞬本文が見える。
   同意 Cookie (age_gate) が無い読者には、head のインラインスクリプトが
   html[data-moso-gate="pending"] を立て、この CSS が最初の描画から
   半透明カーテンを張る（見た目はゲートの背景と同一）。
   ゲートが表示されたら / 4 秒経ってもゲートが出なければ、属性は外れる
   （検索エンジンのレンダリングを塞がないための保険）。
   ========================================================================== */

html[data-moso-gate="pending"] body { overflow: hidden; }
html[data-moso-gate="pending"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99990;              /* .age-gate (999999) より下 */
  background: rgba(24, 18, 14, .93);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-moso-gate="pending"] body::before {
    background: rgba(24, 18, 14, .35);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }
}

/* .age-gate 自身を全画面のオーバーレイとして固定する。
   実測では .age-gate は内容サイズの小箱で、全画面は外側ラッパーだった
   （v1.7.1 で灰色の枠だけになった原因）。ここで自前で全画面化すれば、
   外側がどんな構造でも画面全体を覆える */
/* .age-gate はカードを画面中央へ置くためのレイヤーに徹する。
   暗幕とぼかしは .age-gate__wrapper（親）が担うため、ここは透明にする
   （重ねると二重に暗くなる） */
.age-gate {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999999;
  background: transparent !important;
}

/* Remember me 行を整える */
.age-gate label {
  color: var(--muted);
  font-size: 12px;
}

/* 中央のカード（wrapper が無い構成では form に同じ装いを当てる）。
   Age Gate 側がラッパーに height 100% を持っており、そのままだと
   カードが縦に全画面へ引き伸ばされるため、高さは内容ぶんに固定する */
.age-gate .age-gate__wrapper,
.age-gate:not(:has(.age-gate__wrapper)) .age-gate__form {
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  box-shadow: 0 10px 44px rgba(0, 0, 0, .45);
  padding: 34px 28px;
  width: min(400px, 92vw);
  max-width: none;
  /* 親のフレックス配置による縦の引き伸ばし（stretch）を子側から強制解除する */
  height: fit-content !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: 0 0 auto !important;
  align-self: center !important;
  justify-self: center !important;
  margin: auto;
}

.age-gate .age-gate__logo { margin-bottom: 10px; }

.age-gate .age-gate__headline,
.age-gate .age-gate__heading,
.age-gate h1, .age-gate h2 {
  font-family: var(--font-serif);
  color: var(--text) !important;
  font-size: 20px;
  line-height: 1.5;
}

.age-gate .age-gate__subheadline,
.age-gate .age-gate__description,
.age-gate p {
  color: var(--muted) !important;
  font-size: 13px;
}

/* ボタン: 「はい」= アクセント / 「いいえ」= 控えめ */
.age-gate .age-gate__submit,
.age-gate button[type="submit"] {
  border-radius: 999px;
  padding: 10px 28px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  transition: opacity .15s ease;
}
.age-gate .age-gate__submit--yes,
.age-gate .age-gate__submit[value="yes"] {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.age-gate .age-gate__submit:hover { opacity: .85; }

/* ==========================================================================
   5. 固定ページ / 404 / コメント
   ========================================================================== */

.page-body {
  font-size: 14.5px;
  line-height: 2;
  margin-top: 20px;
}

.error-404 { text-align: center; padding: 60px 0 20px; }
.error-404 h1 { font-family: var(--font-serif); font-size: 22px; }

.search-form {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}
.search-form input[type="search"] {
  flex: 1;
  max-width: 320px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}
.search-form button {
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.comments-area { margin: 40px 0 0; font-size: 14px; }
.comments-area .comment-list { list-style: none; padding: 0; }
.comments-area .comment-body {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
  margin-bottom: 12px;
}

/* ==========================================================================
   6. 印刷 — 余計なものを消して本文だけ
   ========================================================================== */

@media print {
  .site-header, .site-footer, .reader-controls, .reading-progress,
  .resume-chip, .post-navigation, .novel-tags, .breadcrumb,
  .ad-slot, .novel-card--ad, .home-resume, .chapter-minutes,
  .chapter-end, .moso-toast,
  .reader-bar, .reader-side, .reader-overlay, .home-side { display: none !important; }
  body { background: #fff; color: #000; }
}
