/* ============================================================
   試し読みリーダー（全作品共通）
   ============================================================ */
:root {
  --paper: #f4ecd8;
  --paper-2: #fbf6ea;
  --ink: #3f2b21;
  --ink-soft: #7a5f4c;
  --red: #d9412f;
  --line: rgba(74, 51, 40, .18);
  --mincho: "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --gothic: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
  --header-h: 52px;
  --bar-h: 48px;
  --fs: 17px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--mincho); -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url(../assets/paper.jpg) center / cover; opacity: .3; mix-blend-mode: multiply;
}
button { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- ツールバー ---------- */
.rbar {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--header-h)); z-index: 50;
  height: var(--bar-h); display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: rgba(251, 246, 234, .94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  font-family: var(--gothic); font-size: .8rem; font-weight: 700;
}
.rbar .back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; padding: 6px 4px; letter-spacing: .06em; white-space: nowrap; }
.rbar .now { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); font-weight: 500; letter-spacing: .04em; }
.rbar .now b { color: var(--ink); font-weight: 700; margin-right: .6em; }
.seg { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.55); flex: none; }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 999px; cursor: pointer; font-weight: 700; letter-spacing: .04em; line-height: 1.2; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff8ea; }
.seg button:focus-visible, .rbar a:focus-visible, .pager:focus-visible, .end a:focus-visible { outline: 2px dashed var(--red); outline-offset: 2px; }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: transparent; }
.progress i { display: block; height: 100%; width: 0; background: var(--red); transition: width .15s linear; }

/* ---------- 本文（共通） ---------- */
.text { font-size: var(--fs); line-height: 1.95; letter-spacing: .03em; font-feature-settings: "palt" 0; }
.text p { margin: 0; text-indent: 1em; }
.text p.dlg { text-indent: 0; }
.text p.blank { block-size: 1.95em; }
.text p.scene { text-indent: 0; color: var(--ink-soft); font-size: .8em; margin-block: 1.2em; padding-inline-start: 3em; }
.text ruby rt { font-size: .5em; letter-spacing: .05em; color: var(--ink-soft); }
/* シェア */
.share { writing-mode: horizontal-tb; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-family: var(--gothic); }
.share-k { width: 100%; font-size: .68rem; font-weight: 700; letter-spacing: .14em; color: var(--ink-soft); }
.share .sh {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.7); color: var(--ink); text-decoration: none; cursor: pointer;
  font-size: .76rem; font-weight: 700; letter-spacing: .04em; line-height: 1; transition: background .2s, transform .15s;
}
.share .sh svg { width: 15px; height: 15px; flex: none; }
.share .sh:active { transform: scale(.96); }
.share .sh:focus-visible { outline: 2px dashed var(--red); outline-offset: 2px; }
.share-end { width: min(320px, 100%); margin-block-end: 18px; }
@media (hover: hover) { .share .sh:hover { background: #fff; } }
.text .chitsuki { text-align: end; }
.text .shatai { font-style: italic; font-synthesis: style; } /* 明朝体に斜体はないので、ブラウザが字を傾けて表示する */
.text .bouten { -webkit-text-emphasis: filled sesame; text-emphasis: filled sesame; }
.mode-h .text .bouten { -webkit-text-emphasis-position: over right; text-emphasis-position: over right; }
.cover h1 .sub { display: block; font-size: .55em; font-weight: 700; letter-spacing: .04em; margin-block-start: .4em; color: var(--ink-soft); }
.end .next-work {
  display: grid; gap: 2px; text-decoration: none; width: min(320px, 100%); writing-mode: horizontal-tb;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.6);
  font-family: var(--gothic); line-height: 1.5; transition: background .2s;
}
.end .next-work small { font-size: .7rem; font-weight: 700; letter-spacing: .1em; color: var(--red); }
.end .next-work b { font-family: var(--mincho); font-size: 1.02rem; }
.end .next-work span { font-size: .8rem; color: var(--ink-soft); }
.end .next-work::after { content: "読む →"; font-size: .78rem; font-weight: 700; justify-self: end; }
.mode-v .end .next-work { margin-block-end: 18px; }
@media (hover: hover) { .end .next-work:hover { background: #fff; } }
.text .bousen { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .25em; }
.text .doc {
  margin-block: 1.2em; padding: 1em 1.1em; border: 1px solid rgba(74,51,40,.3); background: rgba(255,255,255,.5);
  font-family: var(--gothic); font-size: .92em; line-height: 1.9;
}
.text .doc p { text-indent: 0; }
.text .doc .doc-title { font-weight: 700; letter-spacing: .3em; margin-block-end: .6em; }
.text .doc .item { padding-inline-start: 1em; text-indent: -1em; }
.text .doc .chitsuki { text-align: end; }

/* 作品扉 */
.cover { text-indent: 0; }
.cover .place { font-family: var(--gothic); font-size: .72rem; font-weight: 700; letter-spacing: .18em; color: var(--red); }
.cover h1 { font-size: 1.7em; line-height: 1.45; margin-block: .5em .3em; margin-inline: 0; font-weight: 900; letter-spacing: .08em; }
.cover .author { font-size: 1.05em; font-weight: 700; letter-spacing: .1em; }
.cover .author small { font-family: var(--gothic); font-size: .7em; font-weight: 500; color: var(--ink-soft); margin-inline-end: .6em; }
.cover img { width: 120px; height: auto; display: block; }

/* 読了後 */
.end { font-family: var(--gothic); text-indent: 0; }
.end .fin { font-family: var(--mincho); font-size: 1em; color: var(--ink-soft); letter-spacing: .3em; }
.end .card {
  writing-mode: horizontal-tb; width: min(320px, 100%);
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 6px; padding: 18px 18px 16px;
  box-shadow: 0 10px 24px -16px rgba(74,51,40,.6); font-size: .86rem; line-height: 1.7; letter-spacing: .02em;
}
.end .card .k { font-size: .7rem; font-weight: 700; letter-spacing: .16em; color: var(--red); }
.end .card .t { font-family: var(--mincho); font-size: 1.12rem; font-weight: 900; margin: 2px 0 6px; line-height: 1.45; }
.end .card dl { margin: 8px 0 12px; display: grid; grid-template-columns: auto 1fr; gap: 0 12px; }
.end .card dt { color: var(--ink-soft); }
.end .card dd { margin: 0; }
.end .btns { display: grid; gap: 8px; }
.end .btn { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 4px; text-decoration: none; font-weight: 700; letter-spacing: .08em; }
.end .btn.primary { background: var(--ink); color: #fff8ea; }
.end .btn.ghost { border: 1px solid var(--line); background: rgba(255,255,255,.6); }

/* ---------- 横書き ---------- */
.mode-h .stage { max-width: 36em; margin: 0 auto; padding: 40px 20px 80px; font-size: var(--fs); }
.mode-h .cover { display: grid; grid-template-columns: 1fr auto; align-items: end; column-gap: 12px; padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px dashed rgba(74,51,40,.35); }
.mode-h .cover > :not(img) { grid-column: 1; }
.mode-h .cover img { grid-column: 2; grid-row: 1 / span 3; width: 96px; }
.mode-h .text .scene { text-align: center; padding: 0; }
.mode-h .end { margin-top: 48px; display: grid; justify-items: center; gap: 18px; }
.mode-h .pager { display: none; }

/* ---------- 縦書き ---------- */
.mode-v .stage {
  position: relative;
  height: calc(100svh - var(--header-h) - var(--bar-h) - env(safe-area-inset-top, 0px));
  display: flex; align-items: center;
}
.mode-v .vscroll {
  writing-mode: vertical-rl; width: 100%;
  height: min(100%, calc(var(--fs) * 44));
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  padding: 32px 56px 48px; scrollbar-width: thin;
}
.mode-v .text .bousen { text-underline-position: left; }
.mode-v .text .tcy { text-combine-upright: all; -webkit-text-combine: horizontal; }
.mode-v .cover { margin-block-end: 3em; }
.mode-v .cover img { width: 110px; margin-block-start: 1.5em; }
.mode-v .cover .place { letter-spacing: .3em; }
.mode-v .end { margin-block-start: 4em; padding-block-end: 40px; }
.mode-v .end .fin { margin-block-end: 1.5em; }
.mode-v .end .card { margin-block-start: 0; }
.pager {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 5;
  width: 44px; height: 64px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(251,246,234,.92); cursor: pointer; font-family: var(--gothic); font-size: 1.1rem; font-weight: 700;
  display: grid; place-items: center; transition: opacity .2s, transform .15s;
}
.pager.next { left: 8px; }
.pager.prev { right: 8px; }
.pager[disabled] { opacity: 0; pointer-events: none; }
.pager:active { transform: scale(.94); }
.hint {
  position: absolute; left: 50%; bottom: 14px; translate: -50% 0; z-index: 6;
  font-family: var(--gothic); font-size: .76rem; font-weight: 700; letter-spacing: .08em;
  background: rgba(63,43,33,.85); color: #fff8ea; padding: 6px 14px; border-radius: 999px;
  opacity: 0; transition: opacity .4s; pointer-events: none; white-space: nowrap;
}
.hint.show { opacity: 1; }

/* 続きから読む */
.resume {
  position: fixed; left: 50%; bottom: 20px; translate: -50% 0; z-index: 70;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 999px;
  background: var(--ink); color: #fff8ea; font-family: var(--gothic); font-size: .82rem; font-weight: 700;
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.5);
}
.resume button { border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 700; }
.resume .go { background: var(--red); color: #fff; }
.resume .x { background: transparent; color: #fff8ea; opacity: .7; padding: 6px 8px; }

@media (max-width: 640px) {
  :root { --fs: 16px; }
  .rbar { gap: 8px; padding: 0 10px; font-size: .74rem; }
  .rbar .now { display: none; }
  .rbar .back span:last-child { display: none; }
  .rbar .back { font-size: 1.1rem; padding: 6px 8px 6px 2px; }
  .seg button { padding: 4px 8px; }
  .mode-v .vscroll { padding: 20px 16px; }
  .pager { display: none; }
}
@media (hover: hover) {
  .pager:hover { background: #fff; }
  .end .btn.primary:hover { filter: brightness(1.15); }
  .end .btn.ghost:hover { background: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
