/* 試し読み (read.html) 専用 の見た目。共通の色・ボタンは css/base.css、年齢確認は css/age-gate.css (2026-10-15 ページ内から切り出し) */
html { scroll-padding-top: 64px; }
body { background: #0f0719; color: var(--night-text); }
body.mode-page { overflow: hidden; }

#reader[hidden], #sticky-buy[hidden] { display: none !important; }

/* ===== Header ===== */
#reader-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: 56px; padding: 0 12px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(15,7,25,.88);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--night-line);
  transition: transform .3s var(--ease);
}
#reader-header.is-hidden { transform: translateY(-100%); }
#back-btn {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  height: 42px; padding: 0 14px 0 10px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.07); font-size: .78rem; font-weight: 800; color: #fff;
  transition: background-color .2s;
}
#back-btn:hover { background: rgba(255,255,255,.14); }
#reader-title { flex: 1; min-width: 0; font-size: .82rem; font-weight: 800; color: var(--night-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#page-count { flex-shrink: 0; font-family: var(--f-en); font-weight: 600; font-size: .86rem; color: #fff; letter-spacing: .04em; min-width: 58px; text-align: right; }
.seg { flex-shrink: 0; display: inline-flex; padding: 2px; border-radius: var(--r-pill); background: rgba(255,255,255,.08); }
.mode-btn { height: 40px; padding: 0 12px; border-radius: var(--r-pill); font-size: .74rem; font-weight: 800; color: var(--night-muted); transition: background-color .2s, color .2s; }
.mode-btn.active { background: var(--grad-brand); color: #fff; }
#progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: rgba(255,255,255,.06); }
#progress i { display: block; height: 100%; width: 0; background: var(--grad-brand); transition: width .2s linear; }

/* ===== 縦読み ===== */
#viewer-scroll { padding-top: 56px; }
#viewer-pages { max-width: 760px; margin: 0 auto; }
.pg { position: relative; aspect-ratio: var(--ar, 1559 / 2176); background: #1a0d2a; }
.pg::before {
  content: attr(data-n); position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--f-en); font-weight: 700; font-size: 2rem; color: rgba(255,255,255,.08);
}
.pg img { position: relative; width: 100%; height: 100%; object-fit: contain; }

/* ===== ページ送り (横読み) ===== */
#viewer-horizontal {
  position: fixed; inset: 56px 0 0 0; z-index: 10;
  display: none; align-items: center; justify-content: center;
  background: #0f0719; touch-action: pan-y;
}
body.mode-page #viewer-horizontal { display: flex; }
body.mode-page #viewer-scroll { display: none; }
body.mode-page.ui-hidden #viewer-horizontal { top: 0; }
.viewer-page-display { position: relative; height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; }
#current-page-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.tap { position: absolute; top: 0; bottom: 0; width: 34%; z-index: 2; }
.tap-l { left: 0; cursor: w-resize; }
.tap-r { right: 0; cursor: e-resize; }
.nav-btn {
  position: absolute; top: 50%; z-index: 3; transform: translateY(-50%);
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--violet-deep);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.7);
  transition: transform .2s var(--ease), opacity .2s;
}
.nav-btn:hover { transform: translateY(-50%) scale(1.08); }
#btn-prev { left: 18px; }
#btn-next { right: 18px; }
.nav-btn[hidden] { display: none; }
#page-indicator {
  position: absolute; left: 50%; bottom: 16px; z-index: 3; transform: translateX(-50%);
  padding: 4px 14px; border-radius: var(--r-pill); background: rgba(15,7,25,.75);
  font-family: var(--f-en); font-weight: 600; font-size: .82rem; pointer-events: none;
}
.kbd-hint { position: absolute; right: 16px; bottom: 16px; z-index: 3; font-size: .7rem; font-weight: 700; color: rgba(255,255,255,.35); pointer-events: none; }
#viewer-end-h { position: absolute; inset: 0; z-index: 4; overflow-y: auto; display: none; padding: 24px 16px 40px; background: #0f0719; }
#viewer-end-h.show { display: block; }

/* ===== End CTA ===== */
.end { padding: 56px 16px calc(120px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, #0f0719 0%, #1e1030 100%); }
.end-inner { max-width: 640px; margin: 0 auto; text-align: center; }
.end-kicker { font-family: var(--f-en); font-weight: 700; letter-spacing: .24em; font-size: .8rem; color: var(--pink-2); }
.end-title { font-family: var(--f-pop); font-weight: 400; font-size: clamp(1.5rem, 5vw, 2rem); margin: 8px 0 6px; }
.end-sub { font-size: .86rem; color: var(--night-muted); margin-bottom: 26px; }
.end-card { display: grid; grid-template-columns: 180px 1fr; gap: 18px; align-items: center; text-align: left; padding: 16px; border-radius: 24px; background: rgba(255,255,255,.05); border: 1.5px solid var(--night-line); margin-bottom: 18px; }
.end-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; }
.end-card p { font-size: .92rem; font-weight: 800; line-height: 1.6; }
.end-cta { display: grid; gap: 10px; }
.end-cta .btn-primary { --bh: 60px; font-size: 1.05rem; width: 100%; }
.shop-btns { display: flex; gap: 8px; }
.shop-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 46px; padding: 0 12px; border-radius: 14px;
  background: rgba(255,255,255,.06); border: 1.5px solid var(--night-line);
  font-size: .84rem; font-weight: 800; color: #fff;
  transition: background-color .2s, border-color .2s;
}
.shop-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); }
.shop-btn i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, #fff); }
.shop-btn[data-track-shop="fanza"] { --dot: #ff2a55; }
.shop-btn[data-track-shop="xtoon"] { --dot: #36c275; }
.shop-btn[data-track-shop="booth"] { --dot: #ff6b6b; }
.pr-note { font-size: .7rem; color: var(--night-muted); margin-top: 4px; }
.more { margin-top: 44px; text-align: left; }
.more h3 { font-family: var(--f-en); font-weight: 700; letter-spacing: .2em; font-size: .86rem; color: var(--night-muted); margin-bottom: 12px; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.more-grid a { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.04); border: 1.5px solid var(--night-line); transition: transform .2s var(--ease), border-color .2s; }
.more-grid a:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.4); }
.more-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.more-body { display: flex; flex-direction: column; gap: 4px; padding: 9px 10px 11px; }
.more-same { align-self: flex-start; padding: 1px 9px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--c, #8757ff) 30%, transparent); border: 1px solid color-mix(in srgb, var(--c, #8757ff) 60%, transparent); font-size: .7rem; font-weight: 800; color: #fff; }
.more-title { font-size: .78rem; font-weight: 800; line-height: 1.55; color: var(--night-text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: auto-phrase; }
.follow { margin-top: 40px; padding: 22px 20px; border-radius: 24px; text-align: center; background: linear-gradient(135deg, rgba(255,79,154,.14), rgba(135,87,255,.16)); border: 1.5px solid rgba(255,134,191,.35); }
.follow-kicker { font-family: var(--f-en); font-weight: 700; letter-spacing: .22em; font-size: .74rem; color: var(--pink-2); }
.follow-title { font-size: 1.2rem; font-weight: 800; margin: 4px 0 6px; }
.follow-text { font-size: .84rem; line-height: 1.8; color: var(--night-muted); margin-bottom: 16px; word-break: auto-phrase; }
.follow-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.follow-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: var(--r-pill); font-size: .86rem; font-weight: 800; color: #fff; transition: transform .2s var(--ease), filter .2s; }
.follow-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.follow-btn--x { background: #000; border: 1.5px solid rgba(255,255,255,.3); }
.follow-btn--dc { background: #5865f2; }
.follow-sub { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-top: 8px; font-size: .8rem; font-weight: 800; color: var(--night-muted); text-decoration: underline; text-underline-offset: 3px; }
.follow-sub:hover { color: #fff; }
.back-to-list { display: inline-flex; align-items: center; gap: 6px; margin-top: 28px; padding: 0 22px; height: 46px; border-radius: var(--r-pill); border: 1.5px solid var(--night-line); color: var(--night-muted); font-size: .84rem; font-weight: 800; transition: color .2s, border-color .2s; }
.back-to-list:hover { color: #fff; border-color: rgba(255,255,255,.4); }

/* ===== 固定購入バー ===== */
#sticky-buy {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: none; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(15,7,25,.92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--night-line);
  transition: transform .3s var(--ease);
}
#sticky-buy.visible { display: flex; }
#sticky-buy.is-away { transform: translateY(110%); }
.sticky-label { font-size: .74rem; font-weight: 800; color: var(--night-muted); white-space: nowrap; }
#sticky-buy-btns { display: flex; gap: 8px; }
#sticky-buy-btns .shop-btn { min-height: 40px; flex: none; padding: 0 16px; }
#sticky-buy-btns .shop-btn[data-track-shop="fanza"] { background: var(--grad-brand); border-color: transparent; }
body.mode-page #sticky-buy { display: none; }

/* ===== 404 ===== */
#not-found { display: none; min-height: 100svh; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--night-muted); font-weight: 800; }

@media (max-width: 640px) {
  #reader-header { padding: 0 8px; gap: 6px; }
  #back-btn span { display: none; }
  #back-btn { padding: 0 12px; min-width: 44px; justify-content: center; }
  #reader-title { font-size: .74rem; }
  #page-count { font-size: .78rem; min-width: 48px; }
  .mode-btn { padding: 0 10px; font-size: .7rem; }
  .nav-btn { display: none; }
  .kbd-hint { display: none; }
  .end-card { grid-template-columns: 120px 1fr; }
  .more-grid { grid-template-columns: 1fr; gap: 8px; }
  .more-grid a { flex-direction: row; align-items: center; }
  .more-grid img { width: 116px; flex-shrink: 0; }
  .more-body { padding: 8px 12px; }
  .more-title { -webkit-line-clamp: 2; }
  .follow-btns { grid-template-columns: 1fr; }
  .sticky-label { display: none; }
  #sticky-buy-btns { width: 100%; }
  #sticky-buy-btns .shop-btn { flex: 1; padding: 0 8px; }
  #sticky-buy-btns .shop-btn[data-track-shop="fanza"] { flex: 2.2; }
}
